Commit Graph

308 Commits

Author SHA1 Message Date
Ari Lazier 49955a03e3 use cpp extension for pure cpp files 2015-11-20 19:32:35 -08:00
Ari Lazier df7474feb3 run parser tests in RealmJSTests 2015-11-20 15:16:35 -08:00
Ari Lazier 40f0e5f274 move queryTests to parser dir 2015-11-20 14:51:04 -08:00
Ari Lazier 494fbd3a06 object tests 2015-11-20 14:14:35 -08:00
Ari Lazier 7b993d2f09 turn off parser analyze 2015-11-19 15:59:16 -08:00
Ari Lazier 22ca94e36e test and bug fixes for data queries 2015-11-19 15:17:57 -08:00
Ari Lazier 0e8ca5ed05 add binary query support 2015-11-19 13:05:37 -08:00
Ari Lazier aa3bad1a69 more string tests and bugfix 2015-11-19 13:05:37 -08:00
Ari Lazier be93d3dd58 first string tests and custom error messages 2015-11-19 13:05:37 -08:00
Ari Lazier 20ac833e41 bool tests 2015-11-19 13:05:37 -08:00
Ari Lazier 5784bbe6ed start porting over objc query tests 2015-11-19 13:05:37 -08:00
Ari Lazier 2cc88b5a26 fix for not predicate 2015-11-19 13:05:37 -08:00
Ari Lazier 3828417f32 compound tests 2015-11-19 13:05:37 -08:00
Ari Lazier 5dda5f4b6b test not, remove requirement of padding 2015-11-19 13:05:37 -08:00
Ari Lazier f402a45a40 change argument syntax to use $ instead of {} 2015-11-19 13:05:37 -08:00
Ari Lazier 5c56a5c87c tests for all expressions/operators 2015-11-19 13:05:37 -08:00
Ari Lazier 735b49ff2a fix and tests for arguments 2015-11-19 13:05:37 -08:00
Ari Lazier 676b86d194 more grammer tests 2015-11-19 13:05:37 -08:00
Ari Lazier f46e92468c add basic test harness for grammer validation 2015-11-19 13:05:37 -08:00
Ari Lazier 7829d21bd4 add macro to enable/disable debug token printing 2015-11-19 13:05:37 -08:00
Ari Lazier 9309bbfbf8 make precondition a macro 2015-11-19 13:05:37 -08:00
Ari Lazier f3d7855c99 test and fix for date queries 2015-11-19 13:05:37 -08:00
Ari Lazier 3a198ec507 support query format strings 2015-11-19 13:05:37 -08:00
Ari Lazier 3b698400b7 support for querying boolean properties 2015-11-19 13:05:37 -08:00
Ari Lazier bb16ffa7fe add required padding around string operators, use pegtl_istring_t 2015-11-19 13:05:37 -08:00
Ari Lazier e7e4b6715e move query building to a separate file 2015-11-19 13:05:37 -08:00
Ari Lazier 2f1c26ad73 remove duplicate code, add argument expression type 2015-11-19 13:05:37 -08:00
Ari Lazier c776290df8 code cleanup, bugfixes 2015-11-19 13:05:37 -08:00
Ari Lazier d8c89c7098 support for truepredicate/falsepredicate, single quote strings - all tests now pass 2015-11-19 13:05:37 -08:00
Ari Lazier c7c0698ad0 hook it up 2015-11-19 13:05:37 -08:00
Ari Lazier 11b27dbdbf store negated predicates in parse tree 2015-11-19 13:05:37 -08:00
Ari Lazier 4b3417736f support OR with proper precedence 2015-11-19 13:05:37 -08:00
Ari Lazier 5bdc6eba93 parse tree construction 2015-11-19 13:05:37 -08:00
Ari Lazier 2f287d046d full grammar 2015-11-19 13:05:37 -08:00
Ari Lazier ed4e59c8d0 compound predicates 2015-11-19 13:05:37 -08:00
Ari Lazier 6ea80c4ecd beginnings of a parser 2015-11-19 13:05:37 -08:00
Ari Lazier d1a579c922 size_t, no std::size_t 2015-11-19 07:07:33 -08:00
Ari Lazier 55851f6d99 fix for rpc constants and other pr feedback 2015-11-18 17:55:30 -08:00
Ari Lazier a12b6caedb fixes to list.cpp/hpp based on object store pr feedback - use lowercase strings for property names 2015-11-18 14:36:46 -08:00
Scott Kyle 7b115a934b ArrayBufferView objects now fully supported
Previously we were not accounting for the byte offsets and misunderstood how the Uint8Array constructor worked. The tests now confirm everything works as expected with multiple different typed arrays and slices of the data.
2015-11-17 13:32:32 -08:00
Scott Kyle 616f78ea07 Add support for data properties in RPC layer
The data is base64 encoded before being sent via the RPC.
2015-11-17 13:32:31 -08:00
Scott Kyle 3bf84a1b6f Update data properties to return ArrayBuffers
As a convenience, the setters will take typed Arrays (e.g. Uint8Array) since that is a common representation of data in JS (as they are "views" of ArrayBuffer objects).

The tests have been updated to reflect this new behavior.
2015-11-17 13:32:31 -08:00
Ari Lazier 159931e4ec pr fixes 2015-11-16 17:36:28 -08:00
Ari Lazier 53911fefb6 block refresh until the last context has finished execution 2015-11-16 11:16:09 -08:00
Ari Lazier df15c5f722 integrate latest object store changes 2015-11-13 18:20:40 -08:00
Ari Lazier 52da420496 integrate latest object store changes 2015-11-13 18:20:27 -08:00
Scott Kyle 5320df9a5f Merge pull request #116 from realm/sk-realmjs-api
Create API that returns constructor JSObjectRef
2015-11-03 16:39:08 -08:00
Scott Kyle 83869e2193 Prevent memory leaks when adding listeners
Check if the callback has already been added to the set before protecting it. Vice versa for unprotecting it when removing the listener.
2015-11-03 02:43:29 -08:00
Scott Kyle aff11983f3 Create API that returns constructor JSObjectRef
Resolves #98
2015-11-02 22:51:33 -08:00
Ari Lazier 196a0a15a4 allow setting nullable properties to undefined 2015-11-02 10:08:23 -08:00
Ari Lazier 2cff7e291f create docs dir in binding 2015-10-28 14:45:31 -07:00
Ari Lazier 841f45a7b2 change the license before starting the beta 2015-10-27 14:15:21 -07:00
Ari Lazier ec87281cc1 don't convert undefined to null in rpc requests 2015-10-27 12:13:57 -07:00
Ari Lazier 18d65471be fix and tests for setting null properties 2015-10-27 12:13:57 -07:00
Ari Lazier ac1cdfdc8b support null for basic propety types 2015-10-27 12:13:57 -07:00
Ari Lazier e3fb40f299 enable nullable propeties without a macro 2015-10-27 12:13:57 -07:00
Ari Lazier fc631c3e6f wont work until we have propery object store support 2015-10-27 12:13:57 -07:00
Ari Lazier db67fe71ea only ignore invalid property exceptions 2015-10-27 09:39:52 -07:00
Ari Lazier 9092f9ac5f use typed exceptions 2015-10-27 09:39:52 -07:00
Scott Kyle 0511bade62 Non-existent object getters shouldn't throw exceptions 2015-10-27 09:39:52 -07:00
Ari Lazier a1c4cd5702 pr fixes 2015-10-27 07:48:11 -07:00
Ari Lazier 6f41c3cf68 take notification name 2015-10-26 19:18:24 -07:00
Ari Lazier 6f57500972 change notification name to change 2015-10-26 16:19:12 -07:00
Ari Lazier 246ccc7bde add other notification methods 2015-10-26 16:15:46 -07:00
Ari Lazier ab1965c27e no more notification token 2015-10-26 16:03:32 -07:00
Ari Lazier b7d47ac543 apply newest object store changes 2015-10-26 15:27:43 -07:00
Scott Kyle d3cf748dc1 Rename RealmRPC.mm -> RealmRPC.cpp 2015-10-26 01:20:14 -07:00
Scott Kyle 0843d69a4f Expose RealmJS API as C functions
We're still using Objective-C to delete test files, so we can't rename the implementation file quite yet.
2015-10-26 01:14:33 -07:00
Ari Lazier 28e21041bc bugfix and move gcd out of rpc 2015-10-22 18:06:11 -07:00
Ari Lazier 8b5a8a731c fix naming 2015-10-22 17:59:05 -07:00
Ari Lazier c3c9cee0ee make it work 2015-10-22 16:49:32 -07:00
Ari Lazier 92a9113ef6 get it to compile 2015-10-22 15:31:26 -07:00
Ari Lazier 418d6dfc1c partial port of rpc server to cpp 2015-10-22 10:44:10 -07:00
Ari Lazier 1be81205d0 check for undefined was already covered 2015-10-21 23:06:39 -07:00
Ari Lazier ac544205a1 test setting all primitive types to null/undefined throw 2015-10-21 23:06:39 -07:00
Ari Lazier 290a595259 update to latest core 2015-10-21 19:12:36 -07:00
Scott Kyle 9cbc695fd7 Skip throwing an exception inside ResultsSetProperty 2015-10-21 15:59:11 -07:00
Scott Kyle bd2d1559d1 Error when assigning to Result index or length
Added some tests. Turns out our Chrome layer already did this too, so no changes were needed there.

Resolves #70
2015-10-21 15:25:53 -07:00
Scott Kyle 8ba3a24eae Move RealmJSCoreTests.m to tests directory
Test failures were not pointing to the correct JS file path when it was in the src directory. This is where it belongs anyways.
2015-10-21 15:18:47 -07:00
Scott Kyle 34b84759c8 Fix crash when reloading app during Chrome debugging
Added a session ID, that actually tracks the Realm constructor in our RPC server's JS context. This conveniently let us remove the special casing for defaultPath as well as letting us call the Realm constructor with JSObjectCallAsConstructor.

Fixes #68
2015-10-20 15:10:52 -07:00
Scott Kyle b98e89db22 Merge pull request #63 from realm/sk-chrome-apis
Finish implementing APIs for Chrome
2015-10-20 01:23:40 -07:00
Scott Kyle 3439b4c455 Add getter/setter for defaultPath to RPC 2015-10-19 16:59:04 -07:00
Scott Kyle 03751c35b4 Handle passing dates through RPC 2015-10-19 16:46:56 -07:00
Scott Kyle 57778ce878 Improve calling object methods through RPC 2015-10-19 16:15:38 -07:00
Scott Kyle 1b7653206a Generalize getting/setting properties through RPC 2015-10-19 15:46:00 -07:00
Ari Lazier 5aa066e6fa newline 2015-10-19 14:56:59 -07:00
Ari Lazier 8fed61cb8a clean up per realm resources/threads 2015-10-19 14:25:35 -07:00
Ari Lazier 167c3e97b5 store schema and prototypes on the realm object 2015-10-19 13:39:21 -07:00
Scott Kyle 4c0cc578d5 Generalize calling methods through the RPC 2015-10-19 12:46:31 -07:00
Scott Kyle 5f52d07154 Add support for Results methods in Chrome
Which only consists of sortByProperty
2015-10-19 12:18:09 -07:00
Scott Kyle 78ec67cd6c Hacky support for adding notifications in Chrome
Since notifications are called synchronously after a write, we fake it by calling them manually for now. The future plan will be more involved, so some of that is stubbed out.
2015-10-19 12:09:14 -07:00
Ari Lazier fae276816f newline 2015-10-19 10:33:59 -07:00
Ari Lazier 69ea13944f disable schema/defaults cleanup until we can ensure we are using the correct context 2015-10-19 10:25:25 -07:00
Ari Lazier 430b2a29e5 Merge branch 'sk-test-suite' of https://github.com/realm/realm-js into sk-test-suite 2015-10-16 10:35:41 -07:00
Ari Lazier 7ae6fe4a03 make sure we have destructors for all objects 2015-10-16 10:35:26 -07:00
Ari Lazier 5edb205978 clean up prototype and defaults state 2015-10-15 20:56:12 -07:00
Scott Kyle 69bf42c4f4 Actually stop and dealloc RPC server 2015-10-15 20:52:11 -07:00
Ari Lazier 5ccc03eeb7 rename some methods for clarity - try to cleanup js objects 2015-10-15 18:48:13 -07:00
Ari Lazier 45a3c89605 remove hardcoded test paths 2015-10-15 17:28:51 -07:00
Ari Lazier eb598a2408 fix for in chrome 2015-10-15 17:07:10 -07:00
Scott Kyle 7f5902b021 Remove dependency on JavaScriptCore for RealmReactTests
The test structure is now provided by a JS API, that is used by all things that run tests. Also, the tests can be run manually by tapping a button in the ReactTests app.
2015-10-15 15:19:59 -07:00
Scott Kyle 7a79ac8803 Make Xcode tests run in React environment
The deleteTestFiles() function is now added to the Realm object, so that it's easy for the RPC module to handle this as well. We can only do this in testing environments in the future.
2015-10-15 03:26:56 -07:00
Scott Kyle 94521b73bb Properly serialize args to create Realm through RPC
An exception was thrown when parsing the JSON when only a string was passed. This is better and no longer uses the Objective-C API for converting the dictionary to a JSValue.
2015-10-15 03:00:13 -07:00
Ari Lazier 7b5be78df2 close to working test harness 2015-10-14 18:52:55 -07:00
Ari Lazier e470c5d189 run tests from subclass 2015-10-14 15:46:46 -07:00
Scott Kyle 9916fe14a4 Change RealmReact to be a dynamic framework
It embeds RealmJS and GCDWebServers frameworks. This fixes #58, where there were issues with building for devices rather than just the simulator.

Some changes were made so that RealmReact.m didn't need to be weakly linked to libReact.a since that would actually cause any executable that uses this framework from being able to compile with bitcode.
2015-10-14 02:05:02 -07:00
Ari Lazier 4cf19d0e87 Merge pull request #60 from realm/al-os
First pass at object_store refactor
2015-10-13 17:16:27 -07:00
Ari Lazier 7db001c3da finish Array to List rename 2015-10-13 15:56:43 -07:00
Ari Lazier f6e0d34022 RJSArray -> RJSList 2015-10-13 15:27:24 -07:00
Ari Lazier 385f387332 move property getters to object store code 2015-10-13 15:25:06 -07:00
Ari Lazier 77359f14e3 move List class to its own file 2015-10-13 14:44:31 -07:00
Ari Lazier 9cb9960af5 ObjectArray -> List 2015-10-13 14:41:51 -07:00
Scott Kyle d5ae329d8a Add Notification constructor and destructor
These handle the life cycle of the member variables.
2015-10-12 23:21:13 -07:00
Scott Kyle 290234cb8a RJSException no longer requires JS strings
Since most often some kind of JS Error is passed into RJSException, it would mask the original error by throwing a new exception because that Error was not a string!
2015-10-12 23:17:02 -07:00
Scott Kyle d996147b09 Protect realm and callback from GC in addNotification
Fixes #54
2015-10-12 17:27:44 -07:00
Ari Lazier f4715da2a4 Merge pull request #55 from realm/al-migrations
Minimal migration tests - use same path for all tests
2015-10-12 17:26:51 -07:00
Ari Lazier c81ea6e5be pr fixes 2015-10-12 17:18:49 -07:00
Ari Lazier 8ad1b0907d minimal tests for migrations 2015-10-12 17:01:51 -07:00
Scott Kyle c2e51ab541 Check for NaN inside RJSValidatedValueToNumber
Turns out this API can return NaN without an exception. Also added tests to make sure these conversions either work or throw exceptions in the appropriate places.
2015-10-12 16:50:45 -07:00
Ari Lazier aa035717a5 allow running all tests at the same path by invalidating all cached realm paths between test runs 2015-10-12 16:43:05 -07:00
Scott Kyle a4194586ea Native methods should convert to numbers/bools
It will still throw if unable to make the conversion. Fixes #51
2015-10-12 15:42:56 -07:00
Scott Kyle 35a8f9816c Out of bounds getters for Results return undefined 2015-10-12 15:35:13 -07:00
Scott Kyle 6788cd6f3d Out of bounds list item getters return undefined
Resolves #50
2015-10-12 15:25:39 -07:00
Scott Kyle a5bd3264c1 Consolidate code that verifies array index bounds 2015-10-12 15:25:39 -07:00
Scott Kyle ae9ae4dc77 Add list item setters in JS
Added a test and made other array tests syntactically consistent. Resolves #45
2015-10-12 15:25:39 -07:00
Scott Kyle c600af9182 Mutating lists outside transaction should throw 2015-10-12 02:23:09 -07:00
Scott Kyle 33e0f5d8b1 Setting properties outside transaction should throw
Resolves #40
2015-10-12 02:02:23 -07:00
Scott Kyle 310e3d7a03 Don't store transient arrays returned by RPC 2015-10-08 15:31:29 -07:00
Scott Kyle 665e63aa6f Handle exceptions when getting size through RPC 2015-10-08 15:30:29 -07:00
Ari Lazier c8c8a883bf pr fixes 2015-10-08 12:23:42 -06:00
Ari Lazier 1991d9df95 move rpc server to RealmJS 2015-10-08 11:57:07 -06:00
Ari Lazier dbc43726f5 object methods no longer need to be publicly declared 2015-10-08 11:29:32 -06:00
Ari Lazier 417f0a0c72 don't add Results to property types 2015-10-08 11:22:52 -06:00
Ari Lazier ed3cf01432 consolidate realm methods, code cleanup/remove some duplication 2015-10-08 10:43:38 -06:00
Scott Kyle ebb400ed41 Support delete and deleteAll from RPC 2015-10-08 01:53:22 -07:00
Ari Lazier d8e7c89478 list methods 2015-10-07 21:37:51 -06:00
Ari Lazier 055b0c9309 support list properties 2015-10-07 20:57:23 -06:00
Scott Kyle e136da5117 Make RPC server return Results properly
Still doesn't handle returning property values.
2015-10-07 18:42:08 -07:00
Ari Lazier a0f098bff3 rpc implementation for results 2015-10-07 17:51:06 -06:00
Ari Lazier 476b3623bb partial rpc server implemenation 2015-10-06 13:36:56 -06:00
Ari Lazier 8ca8a24913 ARRAY -> LIST 2015-09-30 10:51:04 -07:00
Ari Lazier aa78436f53 use capitalized names for enums/constants 2015-09-30 10:41:47 -07:00
Ari Lazier 8f466d47b1 Type -> Types 2015-09-29 15:14:39 -07:00
Ari Lazier a7662af484 RealmType -> Realm.Type 2015-09-29 14:53:33 -07:00
Scott Kyle 4bf67b30bc Use std::min() for consistency inside ArraySplice 2015-09-28 17:58:23 -07:00
Scott Kyle 1822b0a2d6 Use RJSVerifiedArray inside ArrayPropertyNames 2015-09-28 17:30:15 -07:00
Scott Kyle 70ee822f19 Update splice method to mimic JS standard
It now will return the removed elements, and clamps the first two arguments to be acceptable values rather than throwing an exception.
2015-09-28 16:00:24 -07:00
Scott Kyle 37130ceca3 Minor optimization of ArrayPropertyNames 2015-09-28 16:00:24 -07:00
Scott Kyle 38a4e993ae Minor cleanups in ArrayPop 2015-09-28 16:00:24 -07:00
Scott Kyle 75dc7bd05e Remove redundant call to verify_attached 2015-09-28 16:00:24 -07:00