Commit Graph

1117 Commits

Author SHA1 Message Date
Kenneth Geisshirt f94f351bfb Adding documentation, TS definition and change log. 2017-09-27 17:53:09 +02:00
Kenneth Geisshirt e669a221a1 Cleaning up 2017-09-27 16:00:45 +02:00
Kenneth Geisshirt f4248f5d30 wip 2017-09-27 15:59:21 +02:00
Thomas Goyne c9a3548f32 Add some missing property type validation 2017-09-26 14:43:44 -07:00
Thomas Goyne c7e44cd01f Fix assertion failures when serializing collections for RPC 2017-09-26 12:23:10 -07:00
Thomas Goyne 9a31febc4c Add support for lists of things other than objects
And add a shorthand syntax for schema definitions.
2017-09-26 11:40:22 -07:00
Thomas Goyne ada3d116af Include linking objects properties in the property names reported 2017-09-26 11:40:22 -07:00
Thomas Goyne 2a28a29341 Avoid throwing exceptions in non-error property reads
These make debugging annoying (and probably slow things down, but that's a
secondary benefit).
2017-09-26 11:40:22 -07:00
Yavor Georgiev f6732c4b58
Sync for Windows 2017-09-26 15:08:26 +02:00
Thomas Goyne 2298609ce5 Merge remote-tracking branch 'origin/master' into tg/merge-master-to-2.0.x
* origin/master: (23 commits)
  Fix api doc error
  fix progress notifications registrations
  Fix typo in Github issue template
  Fix port conflict between RN >= 0.48 and RPC server (#1294)
  Disable testAddListener when running in chrome
  Ensure RN has an event loop running for async tests
  Make permission tests better handle server delays
  Fix race conditions in testAddListener
  Separate build and test steps in xcode to reduce chance of hitting "Early unexpected exit"
  Ignore errors when sourcing nvm.sh
  Don't forward arguments to nvh.sh
  Skip sourcing nvm.sh if it's already available
  Fix some shellcheck warnings
  Ensure node 6.5.0 is installed on CI
  Build realm from source for each test-runner test
  Improve error reporting for incorrect argument counts for Realm methods
  Use the same error messages in the RPC code as the regular code
  Silence an unused variable warning when building with sync disabled
  Check the exception message in all Realm tests which assert an exception is thrown
  Don't discard the actual error message in validated_get_X
  ...
2017-09-25 09:40:56 -07:00
Kenneth Geisshirt 49392bd4c6 Merge branch '2.0.x' of github.com:realm/realm-js into kneth/v1_v2-upgrade 2017-09-25 16:04:43 +02:00
Morten Krogh fbe619c255 Changed ssl_verify_callback to open_ssl_verify_callback.
Changed the preverifyOk to acceptedByOpenSSL and made it a Boolean.
Changed jsdoc formatting.
2017-09-25 11:05:16 +02:00
Kenneth Geisshirt a0aff98173 Switch to later object store 2017-09-23 10:18:57 +02:00
Kenneth Geisshirt a717b291e8 Merge branch '2.0.x' of github.com:realm/realm-js into kneth/v1_v2-upgrade 2017-09-23 00:18:42 +02:00
Kenneth Geisshirt 39fe8c6280 Creating a proper IncompatibleSyncedRealmError class. 2017-09-23 00:05:33 +02:00
Morten Krogh c1e198cbab Documentation and comments for ssl_verify_callback. 2017-09-22 11:21:36 +02:00
Morten Krogh 3657ef385c The sync config object gets a new property called ssl_verify_callback.
The callback is used to let JS code decide whether the server's SSL
certificate should be accepted or rejected. The ssl_verify_callback
function is only applicable for platforms using OpenSSL.
2017-09-22 10:29:37 +02:00
Thomas Goyne 086f31c07f Use the objectstore keypath sorting functionality
Adds support for sorting on values over links, reduces the amount of code in
the binding, and is required for sorting non-object lists.
2017-09-21 10:41:19 -07:00
Kenneth Geisshirt 3f685c15b8 wip 2017-09-21 16:11:27 +02:00
blagoev 275db8a631 fix progress notifications registrations 2017-09-20 21:59:07 +03:00
blagoev 5ea8ff1685 Fix xcode project 2017-09-19 16:38:11 +03:00
Kenneth Geisshirt abe0781565 Encode exception type and path in string 2017-09-19 14:16:15 +02:00
Kenneth Geisshirt a6bbaeb580 [2.0.0-rc9] Bump version 2017-09-19 08:25:11 +02:00
Kenneth Geisshirt 183f051bb1 v1 -> v2 upgrade path 2017-09-18 17:44:17 +02:00
Kenneth Geisshirt 616f5d79e6 Fixing merge 2017-09-18 10:05:06 +02:00
Kenneth Geisshirt eeb78d8e1b Merge branch 'master' of github.com:realm/realm-js into 2.0.x 2017-09-18 09:46:36 +02:00
Thomas Goyne 0c9d7ca54e Improve error reporting for incorrect argument counts for Realm methods
Report the expected and actual arg counts for too many arguments, and behave
more like normal JS when too few are supplied (i.e. complain about the next
argument being undefined rather than just saying 'Invalid arguments').
2017-09-15 15:00:13 -07:00
Thomas Goyne e697ae3d5c Silence an unused variable warning when building with sync disabled 2017-09-15 13:12:44 -07:00
Thomas Goyne 4ad75c9546 Don't discard the actual error message in validated_get_X 2017-09-14 16:25:33 -07:00
Thomas Goyne b8fd4fb861 Add the invalid value to the type error exception message 2017-09-14 16:25:33 -07:00
Thomas Goyne e564ad1de8 Improve the errors thrown for invalid schema definitions 2017-09-14 16:25:33 -07:00
Thomas Goyne aac7d1498a Throw a more appropriate error for some operations on closed Realms 2017-09-14 16:25:33 -07:00
Kenneth Geisshirt e18f54594f [1.12.0] Bump verion 2017-09-14 11:07:47 +02:00
astigsen 208aa8ee46 Added support for in-memory realms (#1304)
* Added support for in-memory realms
2017-09-13 20:42:23 +02:00
Ashwin Phatak 532f517ded Add Realm.deleteModel API (#573) 2017-09-12 14:45:36 +05:30
blagoev 069bdfd2af change the this argument for the callback 2017-09-12 02:47:07 +03:00
blagoev 87c88b746a better naming for private properties 2017-09-11 15:50:44 +03:00
blagoev c843f8e7f9 Validate callback was registered on unregistration 2017-09-11 15:50:44 +03:00
blagoev 731384f228 fix iOS values null checking 2017-09-11 15:50:44 +03:00
blagoev 37a5a92cc9 address reviews 2017-09-11 15:50:44 +03:00
blagoev 3a8f56cdc0 Remove dead code 2017-09-11 15:50:44 +03:00
blagoev e1cebe073a add progress notifications api 2017-09-11 15:50:44 +03:00
Yavor Georgiev b567cd3006 Make a session bind callback factory (#1289)
which can be used in GlobalNotifier
2017-09-11 12:21:44 +02:00
Kenneth Geisshirt 356033a8c4 Merge branch 'tg/update-object-store' of github.com:realm/realm-js into 2.0.x 2017-09-08 14:56:01 +02:00
Kenneth Geisshirt fa0016ba6b Merge branch 'master' of github.com:realm/realm-js into 2.0.x 2017-09-08 14:54:56 +02:00
Ashwin Phatak 119cd79e5d Add Realm.deleteFile API (#363) 2017-09-07 10:12:59 +05:30
Thomas Goyne d3fde5f728 Bump objectstore version again 2017-09-05 10:16:08 -07:00
Thomas Goyne 682a45a18e Disambiguate some uses of PropertyType for msvc 2017-09-05 10:04:41 -07:00
Thomas Goyne 360a5fbd07 Don't throw an exception every 10ms in the RPC worker
Cuts the time taken to run the react native tests on my machine from 198
seconds to 41 seconds. Probably has a similar impact on the react native
debugger performance.
2017-09-01 10:32:51 -07:00
Kenneth Geisshirt 806146b07c [1.11.1] Bump version 2017-09-01 13:07:37 +02:00
Thomas Goyne 7e1466b47a Don't throw an exception every 10ms in the RPC worker
Cuts the time taken to run the react native tests on my machine from 198
seconds to 41 seconds. Probably has a similar impact on the react native
debugger performance.
2017-08-31 16:43:25 -07:00
Thomas Goyne c06daa795e Add missing files to the xcode project 2017-08-31 16:43:25 -07:00
Thomas Goyne 736277084e Fix creating admin token users 2017-08-31 13:49:45 -07:00
Thomas Goyne 9c1b04f8e5 Restore old list property validation logic 2017-08-31 13:49:45 -07:00
Thomas Goyne cb9a3c9f76 Add the invalid value to the type error exception message 2017-08-31 13:49:45 -07:00
Thomas Goyne 944ef57b59 Fix property type conversions to ObjectStore types 2017-08-31 13:49:45 -07:00
Thomas Goyne ce0ce3d299 Update to latest objectstore master and core/sync 2017-08-31 13:49:45 -07:00
kristiandupont de94dc0e16 [1.11.0] Bump version 2017-08-31 12:52:36 +02:00
Thomas Goyne 675b517274 Fix some incorrect checks for Array property types 2017-08-29 15:23:49 -07:00
blagoev 1e5c8b95e1 fix property type checking 2017-08-29 14:52:21 -07:00
blagoev f115a641b0 Remove not needed casts 2017-08-29 14:52:04 -07:00
blagoev 5e6f576e31 address code review for property type checks 2017-08-29 14:52:02 -07:00
blagoev 736cbd3ef3 Update object store 2017-08-29 14:51:25 -07:00
Kenneth Geisshirt 85fb49b354 Adding methods and property to manually control write transactions (#1216)
* Adding methods and property to manually control write transactions
2017-08-21 17:48:53 +02:00
Kenneth Geisshirt bd28c05936 Add shouldCompactOnLaunch option to configuration (#1209)
* Adding shouldCompactOnLaunch option to configuration
* Adding Realm.compact()
2017-08-18 14:22:29 +02:00
Yavor Georgiev 614c699385 [2.0.0-rc4] Bump version 2017-08-17 13:21:34 +02:00
Yavor Georgiev 1be5340129 [2.0.0-rc3] Bump version 2017-08-17 13:20:41 +02:00
Yavor Georgiev c78f82ac0c Update download script for the new core build system 2017-08-17 13:01:41 +02:00
Yavor Georgiev 05cce5aeec use newest object store 2017-08-17 13:01:01 +02:00
kristiandupont 0db8fac3e5 [1.10.3] Version bump 2017-08-17 11:35:13 +02:00
kristiandupont 796ebe2533 [1.10.2] Bump version 2017-08-15 15:12:18 +02:00
Yavor Georgiev fb7f11263c Modernize V8 ArrayBuffer usage (#1198)
Instead of manually allocating a chunk of memory and asking V8 to create an ArrayBuffer around it, have V8 create an ArrayBuffer with its own allocator and copy the data in it. (fixes #1197)

Remove an extra copy when reading data from ArrayBufferViews.

Remove TODOs for Node.js versions older than 4.
2017-08-10 11:45:48 +02:00
Yavor Georgiev b71eec6b98
[1.10.1] Bump version 2017-08-02 14:07:16 +02:00
Yavor Georgiev 22a086859f
[1.10.0] Bump version 2017-07-12 16:45:35 +02:00
Yavor Georgiev 5dd9264225
Add `Realm.empty` 2017-07-12 13:02:21 +02:00
Yavor Georgiev 1e58351ace
Don’t enter node::MakeCallback if we have a calling context
this means we already have JavaScript frames on the execution stack
2017-07-11 17:47:10 +02:00
Yavor Georgiev fe756bdc86
Rethrow callback errors as fatal Node.js errors
Instead of rethrowing the JavaScript error emitted from a callback function, we should instead pass it to `node::FatalException`.

Callbacks are employed when there is no other JavaScript frame on the stack prior so rethrowing the JS error as a C++ exception is not going to propagate the error back to JavaScript. `node::FatalException` will raise the `uncaughtError` event on the `process` object , print the error and stacktrace, and alert the debugger is there is one attached. This would make our async callbacks behave consistently with Node’s own async callbacks such as `setTimeout` when encountering an error.
2017-07-11 17:47:09 +02:00
Yavor Georgiev 7b9c4eee46
[1.9.0] Bump version 2017-07-10 17:26:44 +02:00
Yavor Georgiev 1ba9b434b4 Add a new optional server parameter to User.adminUser (#1111)
* add a new optional server parameter to User.adminUser

This enables `User.openManagementRealm()` for admin token users.

* changelog

* API docs
2017-07-10 15:04:55 +02:00
Mark Rowe 89149c0a75 Make it possible to assign a List or Results to a List property once more (#1126)
* Make it possible to assign a List or Results to a List property.

The change made in #1069 to improve error messages when values of
incorrect types were assigned to a given property was being too
narrow in the types it accepted for list properties, allowing only
arrays. Lists and Results are now accepted once more.

* Update CHANGELOG.md
2017-07-10 13:45:49 +02:00
Yavor Georgiev 02c19bacb2 Close uv handles on the loop thread (#1125) 2017-07-07 14:50:34 +02:00
Marius Rackwitz 9e0a9a3bd3 Add support for accessing linking objects / backlinks (#1101)
* Add support for linkingObjects

* Test linkingObjects

* Borrow names helper from list tests

* include computed properties when serializing the schema for the RN debugger

* add API docs

* review comments

* Expose admin users to JS (#1100)

The JS binding used to conflate `SyncUser::is_admin()` with the user being created by calling `Realm.Sync.User.adminToken()`, but now that we expose a user’s role on the server under `is_admin()` this supposition is no longer correct.

#1097 attempted to fix one such case, but fixing it only uncovered another: in `UserClass<T>::all_users()`.  I’ve gone through all the callsites of `SyncUser::is_admin()` to make sure they don’t assume an admin token user.

* [1.8.3] Bump version

* add linkingObjects method to Realm.Object

* changelog
2017-06-29 11:59:10 +02:00
blagoev f54487c6cc Rename the progress function to better reflect purpose
refactored registration code to remove the unneccesary lambda
2017-06-28 15:02:28 +03:00
blagoev 97f25cc1ab Add progress notifications
Support download progress notifications for Realm open and openAsync methods
2017-06-28 13:40:35 +03:00
Yavor Georgiev 1adabdd73e
[1.8.3] Bump version 2017-06-27 20:38:39 +02:00
Yavor Georgiev 7ab3aff82f Expose admin users to JS (#1100)
The JS binding used to conflate `SyncUser::is_admin()` with the user being created by calling `Realm.Sync.User.adminToken()`, but now that we expose a user’s role on the server under `is_admin()` this supposition is no longer correct.

#1097 attempted to fix one such case, but fixing it only uncovered another: in `UserClass<T>::all_users()`.  I’ve gone through all the callsites of `SyncUser::is_admin()` to make sure they don’t assume an admin token user.
2017-06-27 20:32:34 +02:00
Yavor Georgiev e6818d693d
[1.8.2] Bump version 2017-06-26 13:49:50 +02:00
astigsen db4e184524 Added method to find index of object in collections (#1094)
* Added method to find index of object in collections

* rework as the indexOf method
2017-06-26 13:43:49 +02:00
Yavor Georgiev beda604425 Fix refreshing the access token of a logged-in admin user (#1097)
Fixes #1091
2017-06-26 12:03:48 +02:00
Yavor Georgiev feba70333b
[1.8.1] Bump version 2017-06-20 16:27:05 +02:00
Mark Rowe 30e58022cf Include property names in type error exceptions thrown by Realm.create (#1069)
* Add and adopt `Value::is_binary` / `Value::to_binary` / `Value::from_binary`.

These methods allow conversions between `BinaryData` and the equivalent
JavaScript types without using `NativeAccessor`. Instead,
`NativeAccessor` now itself delegates to these methods.

* Have `NativeAccessor::value_for_property` and `RealmObjectClass::set_property`
verify that values are valid for the property in question.

If not, we throw an exception that includes the name and type of the
property in question.

`NativeAccessor` is changed to always hold a reference to a `Realm` and
an `ObjectSchema` in order to make this validation possible.

* Fix the Windows build.

* Remove an unused, incorrect forward declaration of a template class
  named `Realm` that caused ambiguity with object store's `Realm` class.
* Disambiguate between `realm::js::PropertyType` and
  `realm::PropertyType`.

* Update CHANGELOG.md
2017-06-20 14:40:01 +02:00
Adam Fish 37dba6bb36 Add objectSchema method to Realm Object (#1055)
* Add objectSchema property to Realm Object

* fix
2017-06-20 11:42:43 +02:00
Yavor Georgiev 28fe678a1b Use an uncached realm instance for _waitForDownload (#1083)
Fixes #1061
2017-06-19 13:58:19 +02:00
Yavor Georgiev acd962d602 Make sure all callbacks enqueue on the Node.js event loop (#1079)
Fixes #1077
2017-06-19 13:19:43 +02:00
Yavor Georgiev 3e80683ad8 Extract admin status from the refresh token (#1078)
* Extract admin status from the refresh token

Fixes #1063

* wire up rpc
2017-06-17 16:59:15 +02:00
Yavor Georgiev 0f5d6a1df4
[1.8.0] Bump version 2017-06-15 16:27:43 +02:00
Adam Lebsack fdc9414013 Use sync 1.10.0 (#1068) 2017-06-15 15:50:00 +02:00
Mark Rowe 98d57a34ce Update to core v2.8.1 and sync v1.9.x.
FIXME: We'll need to update to sync v1.9.2 once it is available as
v1.9.1 does not include core v2.8.1. This may result in the missing
symbols on Linux problem only being fixed when sync is disabled.
2017-05-23 11:52:43 -07:00
Mark Rowe b108d06231 Use `int64_t` rather than `long long` as the integer type in the accessor
implementation.

This matches what core uses for integers, and avoids ambiguity that
otherwise results when `int64_t` is declared as `long` rather than `long long`.
2017-05-22 20:17:35 -07:00
Mark Rowe 75f8b28831 Fix the Node build.
Tweak the signature on some of the accessor methods to take
`JSEngine::Value`s by value rather than by const reference. Some Node
APIs appear to assume that only non-const objects will be used.
2017-05-22 16:19:15 -07:00