Commit Graph

1193 Commits

Author SHA1 Message Date
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
Mark Rowe 66da78af74 Merge remote-tracking branch 'origin/master' into tg/object-accessor-updates 2017-05-22 14:39:55 -07:00
Mark Rowe 43200b1db5 Update the recently-added `RealmClass::wait_for_download_completion` to
use the new object accessor interface.
2017-05-22 14:33:39 -07:00
kristiandupont 401a6043bf [1.3.1] Bump version 2017-05-18 13:13:28 +02:00
Thomas Goyne 08052e12f6 Update to work with new API for arrays of primitives 2017-05-17 11:02:45 -07:00
blagoev be328accb4 Merge pull request #1021 from realm/download-api-3
Download API with fixes for windows build
2017-05-17 20:07:00 +03:00
blagoev cf8e6efb16 fix build for no sync on windows 2017-05-17 16:10:20 +03:00
blagoev 158b513a12 Cleaner error checking 2017-05-17 16:10:00 +03:00
blagoev cb72fe1977 addressed pr review comments 2017-05-17 16:09:48 +03:00
blagoev be0611a255 Pass the error code and message to user code 2017-05-17 16:08:55 +03:00
blagoev 315b8c1a7a Fix download api to wait correctly using schema less realm
Added tests using two processes (nodes only)
2017-05-17 16:08:01 +03:00
blagoev 216484aede Initial download api support 2017-05-17 16:07:08 +03:00
blagoev 4751aca0dc Fix event_loop_dispatcher 2017-05-17 16:06:21 +03:00
blagoev 33bb01be11 Fix EventLoopDispatcher
Fixes callback not called due to dispatcher freed when instance go out of scope. Preserves the EventLoopSignal if there are pending invocations
2017-05-17 16:05:46 +03:00
blagoev 018afe6207 Revert "Download api (aka open async api)" 2017-05-17 15:12:30 +03:00
blagoev 8258e184f4 Merge pull request #1005 from realm/download-api
Download api (aka open async api)
2017-05-17 14:29:42 +03:00
blagoev b100e782cb Cleaner error checking 2017-05-16 12:11:23 +03:00
blagoev ab626253e5 addressed pr review comments 2017-05-15 15:33:53 +03:00
blagoev 1ae58780bf Pass the error code and message to user code 2017-05-12 01:40:15 +03:00
blagoev 6cd8eefe5d Fix download api to wait correctly using schema less realm
Added tests using two processes (nodes only)
2017-05-11 23:22:28 +03:00
kristiandupont a916958941 [1.3.0] Bump version 2017-05-11 14:34:52 +02:00
blagoev ef63a8829c Initial download api support 2017-05-07 02:26:14 +03:00
blagoev 5a6baef612 Fix event_loop_dispatcher 2017-05-07 02:02:57 +03:00
blagoev 44432660ea Add MakeCallback method abstraction
Needed for node to kick next tick properly. JSC uses regular call
2017-05-07 02:02:05 +03:00
blagoev 9c700053af Fix EventLoopDispatcher
Fixes callback not called due to dispatcher freed when instance go out of scope. Preserves the EventLoopSignal if there are pending invocations
2017-05-06 15:33:06 +03:00
Radu Tutueanu 6a2b0efe07 Add missing files to the xcode project 2017-05-05 15:15:59 +02:00
Radu Tutueanu f6564ca68f Add the variables to the syncConfig 2017-05-05 13:50:45 +02:00
Radu Tutueanu b9f90a956b Update handling of ssl certificates according to changes in OS 2017-05-05 11:48:34 +02:00
Radu Tutueanu 7653c7f10d Use sync 1.8.3 2017-05-04 16:58:00 +02:00
blagoev 0dabf3d87d report null instead of undefined for deleteAll indexes count 2017-05-01 10:51:48 +03:00
blagoev 5effd3a9ac report undefined deletions on deleteAll instead of max int count indexes 2017-04-28 12:54:23 +03:00
Radu Tutueanu ba0b298244 Merge pull request #971 from realm/al/notifier-fix
Use notifier fix in latest object store, update core & sync
2017-04-19 13:20:42 +03:00
Ari Lazier 8e43eb7441 use notifier fix in latest object store, update core 2017-04-18 10:58:50 -07:00
Yavor Georgiev aa506935a5 Construct Results with object type name only (#959) 2017-04-18 13:41:44 +03:00
Yavor Georgiev 8b652b4e8a Expose option to force the sync history type when opening a realm (#966) 2017-04-18 13:41:07 +03:00
Radu Tutueanu 274661dde4 Use core 2.5.1 and sync 1.5.0 (#949)
* Use core 2.5.1 and sync 1.5.0

* Add changelog entry
2017-03-29 13:41:17 +02:00
Yavor Georgiev 2881cf5502
[1.2.0] Bump version 2017-03-28 14:49:58 +02:00
Yavor Georgiev 80818779ba Fix opening synced realm with an encryption key (#945) 2017-03-28 14:34:27 +02:00
Yavor Georgiev f0d70d4061 Fix ambiguous type reference error (#943)
* Fix ambiguous type reference error

* Bump ROS version for testing
2017-03-27 16:58:58 +02:00
Radu Tutueanu 479b21c3f8 Use sync 1.4.0 (#918)
* Use sync 1.4.0

* Use master@OS

* Make normalize_path available for the GN (#932)
2017-03-23 15:43:02 +01:00
Ari Lazier a9120fe09b fixes for latest object store 2017-03-09 21:17:33 -08:00
Ari Lazier 496ae14181 update to latest object store 2017-03-09 10:04:39 -08:00
Ari Lazier 1e43d5e105 update object store 2017-03-09 09:58:12 -08:00
Yavor Georgiev cfc330305b
[1.1.1] Bump version 2017-03-09 14:35:30 +01:00
Yavor Georgiev 72329865ec
[1.1.0] Bump version 2017-03-09 11:53:00 +01:00
Yavor Georgiev db8ebd9333 Node.js Win32 support (#864)
* Remove the windows install check

* Node.js Win32 support

* Bring back the `REALM_HAVE_CONFIG` definition

* Download core for Windows when building

* Implement cross-platform node platform.cpp with libuv

* wip

* Make jasmine run quicker

https://github.com/jasmine/jasmine/issues/1204

* Wait for worker process to close in AsyncTests

* Cross-platform paths in tests

* Normalize path separator for forward slash on Windows

* MSVC exception voodoo

* cross-platform uv_cwd

* fix linux build

* make the prepublish script cross-platform

* Disable encryption tests on windows

* ignore vendor/realm-node

* jenkinsfile work

* Only run the prepublish script for publish and pack

* Jenkinsfile work

* Include gyp files in package

* rewrite default_realm_file_directory()

* fix React Native Android build

* delete all realm artifacts in remove_realm_files_from_directory

* bring back build environment variables

* node-pre-gyp windows

* Update CHANGELOG.md
2017-03-07 23:24:30 +01:00
Ari Lazier b36775472d fix for core change 2017-03-02 06:24:09 -08:00
Ari Lazier 7f75ef4c26 update to latest os and sync 2017-03-01 15:56:22 -08:00
Ari Lazier 4ea81e8e24 support external realm creation 2017-03-01 15:55:40 -08:00
Ari Lazier e892315290 latest object store 2017-03-01 15:55:40 -08:00
Radu Tutueanu 10634a17e4 Update core and sync versions (#882) 2017-02-22 13:28:57 +01:00
kristiandupont 0840c136b9 [1.0.2] Bump version 2017-02-07 13:01:16 +01:00
Yavor Georgiev 7c1dab7079 Propagate token refresh errors to the session error handler (#843)
* Get a session’s error handler

* Change the signature of all methods to add the callee

* Deserialize rpc callbacks

* Expose the session error handle on its config property

* When a token refresh error occurs and there is a session error handler

propagate the error to the handler
2017-02-07 11:01:26 +01:00
Yavor Georgiev bb0dc575c9 Implement proactive access token refresh (#842)
Closes #840
2017-02-03 16:40:13 +01:00
Yavor Georgiev f22efa7117
[1.0.1] Bump version 2017-02-02 15:50:17 +01:00
Yavor Georgiev 7843e72595 Don’t capture the current JS context in the session bind callback (#839) 2017-02-02 15:41:52 +01:00
Yavor Georgiev de3c3e6788
[1.0.0] Bump version 2017-02-02 13:51:53 +01:00
Yavor Georgiev 19f00e1b4b Rework #832 (#833) 2017-02-02 02:41:11 +01:00
Yavor Georgiev 36dd43b3b2 Make sure all JavaScriptCore prototypes have a constructor (#832)
`js_class` for v8 sets up the `Class.prototype.constructor === Class` relationship automatically, but we need to do it manually in JavaScriptCore.
2017-02-01 23:52:36 +01:00
Yavor Georgiev 9d1d970b1f Sync Session API (#825)
* Add Session class and expose it to JS

* Add error property on the sync config object for the event handler

* tests

* refactor access token refresh

* chrome debugging
2017-02-01 14:18:59 +01:00
Kristian Dupont 0c9c5ac407 Add missing chrome debugging apis for Sync.User (#801)
* Add user tests

* Add Sync member to Realm

* Add a simple test for addListener

* Introduce browser User class

* Introduce Sync.User proxy

* Fix User.all

* Add User.logout

* Remove some console.log statements

* Update rpc.cpp from tests-folder

* Use user.current from user-methods, not cpp

* remove user.current from two missing places

* Start server in realmjs and react tests

* Add user tests

* Add Sync member to Realm

* Add a simple test for addListener

* Introduce browser User class

* Introduce Sync.User proxy

* Fix User.all

* Add User.logout

* Remove some console.log statements

* Update rpc.cpp from tests-folder

* Use user.current from user-methods, not cpp

* remove user.current from two missing places

* Start server in realmjs and react tests

* Replace needle with node-fetch

* Make AuthError work in the browser

* Allow for persistent callbacks

* Expose _authenticateRealm to native

* Use clear_test_state in roc

* Streamline test inclusion

* Fix login tests

* Promisify testLogin()

* Disable AsyncTests for now

* Mode jasmine timeout to spec/unit_tests.js

* Avoid use of global for fetch module

* Only include user-tests is sync is enabled

* Skip ROS for android tests

* Add some comments about persistent callbacks

* Fix results-test

* Run async-tests in node

* Add a comment about (user object)

* Cache all users in User.current and return promises in fetch

* node_require async-tests so RN doesn't try and package them

* Add missing parenthesis
2017-01-31 14:07:29 +01:00
Yavor Georgiev 5183ff9a8c Always invoke sync callbacks on the JavaScript thread (#809)
* Always invoke sync callbacks on the JavaScript thread

* Address review comments

* Make Callback::m_state be a shared, not a weak pointer

* Use the protected GlobalContext in the session bind handler

* Only dispatch on the event loop if we’re not on its thread
2017-01-23 12:37:13 +01:00
Radu Tutueanu fa8088348d Update Object Store Submodule (#797)
* Update OS

* Use the latest sync

* Update objectstore

* Use realm-sync 7.2

* Add files to project

* Use OS submodule with fix

* Fix object store includes in xcode project

* add missing object store file to binding.gyp

* Update OS with fix for the GlobalNotifier

* Add OS files to Android jni

* Use master@ObjectStore
2017-01-18 12:39:56 +01:00
Kristian Dupont 35c21c203f [0.15.4] Bump version 2017-01-11 12:53:01 +01:00
Kristian Dupont f9f61aeb36 [0.15.3] Bump version 2017-01-10 16:21:11 +01:00
Radu Tutueanu 14d82c703f Enable sync by default on macOS (#781) 2017-01-10 15:40:19 +01:00
Kristian Dupont bd8a27b963 Improve error message for typeerrors (#785)
* Add a test

* Catch TypeErrorException

* Make exception asserts check error type

* Remove commented-out testcase and check for error type

* Test for Error, not TypeError
2017-01-10 13:41:56 +01:00
Mark Rowe 9d858d0329 Update to object store master to pick up the fix for the global notifier. (#778) 2017-01-05 11:56:11 +01:00
Mark Rowe c4b22a160a Update to sync v1.0.0-BETA-6.3 (#776)
* Update to sync v1.0.0-BETA-6.3.

This requires updating to current object store master to accommodate the
changes to sync error reporting.

* Add some include folder search paths

* Add thread_safe_reference to the RealmJS target
2017-01-04 15:07:25 +01:00
Kristian Dupont f0fd0d4308 [0.15.2] Bump version 2016-12-29 10:35:07 +01:00
Mark Rowe d8e13bc7bb Switch to using object store's master branch (#748)
* Switch to using object store's master branch.

* Switch to caching Realm instances per JavaScript execution context.
2016-12-28 17:28:44 +01:00
Kristian Dupont c1e7ddcda1 Throw when deleting detached object (#694)
* Throw when deleting detached object

* Update error message

* Add user file

* Throw when deleting detached object

* Update error message

* Revert "Add user file"

This reverts commit 2948f4cfc2dfd2d5d75594307b1e89806b817eb7.
2016-12-20 16:28:02 +01:00
Ari Lazier 43cb7bc463 only use custom dir for the notifier 2016-12-09 17:16:07 +01:00
Ari Lazier 64730e7e97 allow use of a custom sync dir 2016-12-09 12:49:59 +01:00
Ari Lazier bfa9402a06 submodule udpate 2016-12-07 16:39:39 +01:00
Kristian Dupont 62f5157565 Update object store 2016-12-07 16:33:11 +01:00
Kristian Dupont 43d94d1b8b Add checks for removeListener 2016-12-07 16:31:52 +01:00
Kristian Dupont 1d4bb7c2ad Add more tests and fix add_notification 2016-12-07 16:31:52 +01:00
Radu Tutueanu 19d82caec4 Update ObjectStore (#723) 2016-12-07 11:21:32 +01:00
Ari Lazier 216d97ed5d update object store 2016-12-06 10:24:30 +01:00
Ari Lazier 4f3bf08704 use proper object store merge 2016-12-05 16:25:52 +01:00
Ari Lazier 335d035752 update object-store 2016-12-05 16:25:52 +01:00
Ari Lazier 696a80ec0a merge master 2016-12-05 16:25:07 +01:00
Marius Rackwitz 8964e4d7f9 Only set the path derived from the SyncManager if none was provided (#679)
* Only set the path derived from the SyncManager if none was provided

* Disable synchronizeChangeswithTwoClientsAndOneUser
2016-11-29 10:51:26 +01:00
Ari Lazier 6ed6b77b52 Remove unneccesary braces 2016-11-28 10:40:50 -08:00
Ari Lazier 0f8536f23c fix for node/osx 2016-11-28 09:02:15 -08:00
Ari Lazier e48e0b19f7 fixes for latest object store update 2016-11-28 07:42:41 -08:00
Radu Tutueanu 70a30484d8 Update OS (#696)
Remove duplicate files from the submodule.
2016-11-24 14:15:15 +01:00
Ari Lazier f44f31e721 [0.15.1-rc] Bump version 2016-11-22 16:42:07 -08:00
Radu Tutueanu 4b0f5f41e6 Merge pull request #655 from realm/rt/build-without-by-default
Do not build node with sync by default
2016-11-15 18:04:07 +01:00
Ari Lazier db524a56a2 [0.15.0-rc] Bump version 2016-11-15 05:42:25 -08:00
Radu Tutueanu ca0fd78cee Do not build node with sync by default 2016-11-15 13:49:41 +01:00
Ari Lazier eef8a2de3b property clean up sync state between tests in c++ 2016-11-12 05:26:37 -08:00
Ari Lazier 011f293d13 Merge branch 'al-sync-user-tests' of https://github.com/realm/realm-js into al-sync-user-tests 2016-11-11 17:54:04 -08:00
Ari Lazier e4d4cbbdf3 proper fix/hack removal, partially working sync for rn 2016-11-11 17:53:58 -08:00
Ari Lazier 41b0426e01 Merge pull request #652 from realm/rt/improve-build
Improve build
2016-11-11 16:31:48 -08:00
Ari Lazier 043d801bb7 fix for node 2016-11-11 15:33:13 -08:00
Ari Lazier 2b90def150 terrible hack to make rn not retain the context 2016-11-11 15:05:08 -08:00
Ari Lazier b2077910a4 fix for handle scope warning 2016-11-11 11:41:27 -08:00
Radu Tutueanu e268cfef58 Add variable to enable skipping the download 2016-11-11 17:39:07 +01:00
Ari Lazier d229cd6130 throw exception when trying to open a realm with an invalid user 2016-11-11 00:14:52 -08:00
Ari Lazier 08ffc3bf15 ccache support 2016-11-10 23:55:26 -08:00
Ari Lazier 30679c2470 remove unneeded script phases 2016-11-10 15:54:24 -08:00
Ari Lazier 6d485866f6 all users should return a dictionary 2016-11-10 13:55:22 -08:00
Søren Vind 87b30fb4ec Add tests of Realm.Sync.User.all and Realm.Sync.User.current. Fix both to only return active (logged-in) users. Fix current return values: Throws if >1 user logged in, returns undefined if no logged in. 2016-11-10 12:54:15 -08:00
Ari Lazier 0495c1f906 fixed object store 2016-11-10 08:51:14 -08:00
Ari Lazier 3b91ca94f4 use updated object store 2016-11-10 06:58:03 -08:00
Ari Lazier 6a257d594e only npm install actual dependencies 2016-11-10 04:42:07 -08:00
Ari Lazier c5c451ed18 remove invalid resource 2016-11-10 04:23:34 -08:00
Ari Lazier 3e37795d62 fix for unregistering notifications in a notification 2016-11-09 18:01:56 -08:00
Ari Lazier 85c655a91c fix for constructor destruction after timeout 2016-11-09 17:46:26 -08:00
Ari Lazier 4fc874f35c some small fixes for download-core script 2016-11-09 15:01:42 -08:00
Radu Tutueanu 9833b8e490 Build macOS with sync by default 2016-11-09 19:07:26 +01:00
Radu Tutueanu c995253202 Fix building with sync 2016-11-09 17:25:25 +01:00
Radu Tutueanu ba48933561 Enable building without sync
This is needed because the linux node binding needs to work without sync
2016-11-09 16:47:17 +01:00
Ari Lazier 42cab3a95a update submodule 2016-11-08 15:07:57 -08:00
Ari Lazier 8ce8f52105 add test for login 2016-11-08 14:07:04 -08:00
Ari Lazier 5a49dbc325 make sync work with RealmJS tests 2016-10-27 13:49:41 -07:00
Ari Lazier 60d9da1b44 remove unneded server argument for adminUser, update care and sync dependencies 2016-10-26 17:20:34 -07:00
Ari Lazier e52351fc50 add support for logging out 2016-10-26 17:00:46 -07:00
Ari Lazier dfc10a5a42 update to latest object store changes/bugfixes 2016-10-26 17:00:46 -07:00
Ari Lazier d987c7db7b add api for all users 2016-10-26 17:00:46 -07:00
Ari Lazier 92adb669d5 hook up new object store apis 2016-10-26 17:00:46 -07:00
Ari Lazier c49727913c update to public object store 2016-10-26 17:00:46 -07:00
Ari Lazier 5e1ecdf19e default the schema version to 0 when a schema is provided 2016-10-26 17:00:33 -07:00
Ari Lazier 18c419fb96 don't set version to 0 when not set 2016-10-26 17:00:33 -07:00
Ari Lazier e05ef29e4f update object store 2016-10-26 16:30:00 -07:00
Ari Lazier 0d74c05366 add sync cleanup method 2016-10-25 15:04:58 -07:00
Yavor Georgiev c3e082616e
Use latest object store 2016-10-25 00:46:49 +02:00
Yavor Georgiev b2d7d66b90 remove UvAsync 2016-10-12 01:15:27 +02:00
Yavor Georgiev f5d396a93c remove the global notifier from object store 2016-10-12 00:54:13 +02:00
Yavor Georgiev a37fe03e20 bring back node ci 2016-10-11 22:30:39 +02:00
Yavor Georgiev 33b87e6582 remove the node sync logger 2016-10-11 01:33:10 +02:00
Yavor Georgiev 245328009a expose the node class constructor 2016-10-11 00:38:32 +02:00
Yavor Georgiev 3a8ed6cbe6 fix linux build. again. 2016-10-10 18:09:25 +02:00
Yavor Georgiev 28924b4f99 Build the node addon as a static library 2016-10-10 14:20:54 +02:00
Yavor Georgiev 0ff7357cc3 Build for node without sync 2016-10-10 14:20:33 +02:00
Yavor Georgiev 5623653477 prepare for the glorious future 2016-10-08 19:36:03 +02:00
Ari Lazier 857369f5a4 download core and sync and get the test app running on sync 2016-10-04 17:27:09 -07:00
Ari Lazier 9d0df0de3d Sync and fine grained notifications 2016-10-04 15:07:14 -07:00
Ari Lazier 876417716f Merge pull request #567 from realm/al-latest
Update changelog/version on master
2016-08-19 06:55:17 -07:00
Mark Rowe 5b888ed91d Update to core 1.5.0 and the latest version of the object store. 2016-08-15 11:29:58 -07:00
Ari Lazier 3e55944818 [0.14.3-rc] Bump version 2016-08-15 11:12:36 -07:00
Mark Rowe b08db9f768 Merge pull request #548 from realm/mar/object-store-as-submodule
Switch to pulling the object store in as a submodule
2016-08-02 11:34:29 -07:00
Ari Lazier 1522fb3689 Merge pull request #523 from realm/al-rn-29
Support latest react-native version
2016-08-02 09:59:57 -07:00
Thomas Goyne f8ed437003 Update the binding for object store API changes 2016-08-02 09:31:25 -07:00
Mark Rowe b62a5e6d99 Pull in the object store as a submodule. 2016-08-02 09:25:17 -07:00
Ari Lazier ad97836d19 [0.14.2] Bump version 2016-07-31 14:25:13 -07:00
Yavor Georgiev 6a6ed5a214 Get the path to nan relatively
Under npm3 the `realm` and `nan` modules might end up as siblings so the best way to get the path to `nan` is to require it from within the `realm` module. The `nan` module prints its path so it can be captured by an external build system like in this patch.
2016-07-21 17:39:03 +02:00
Thomas Goyne a4c8d745cf Use List::snapshot() 2016-07-18 14:42:10 -07:00
Thomas Goyne b59af706ea Update binding code for API changes 2016-07-18 14:15:25 -07:00
Yavor Georgiev 9320be158c Allow for non-nullterminated object type names (#97)
`StringData::data()` returns the underlying buffer, which might not be null-terminated, so the resulting string from appending to `"class_"` has garbage in the end. Use the `std::string` conversion of `StringData` because it takes the size of the string into account.
2016-07-18 14:15:25 -07:00
Thomas Goyne 847b6852c9 Change the API-misuse exceptions from runtime_error to logic_error 2016-07-18 14:15:25 -07:00
Mark Rowe 11018952e9 Change API misuse exceptions in object_accessor.hpp to derive from `std::logic_error` rather than `std::runtime_error`.
Also includes the following minor changes:
* Renames `ReadOnlyPropertyValueException` to
  `ReadOnlyPropertyException` since it's the property that's read-only,
  not the value.
* Elminiates some unnecessary copies of arguments passed to the
  exception constructors.
* Makes the exception type data members public, since otherwise there's
  no point in storing them at.
2016-07-18 14:15:25 -07:00
Mark Rowe 00e4790353 Have `List` and `Results` fetch their object schema when requested.
This avoids the need to eagerly fetch the object schema in order to
construct a `List` or `Results`. Instead the work can be deferred until
the object schema is requested. Since `List` and `Results` never use the
object schema themselves this can avoid unnecessary work in some bindings.
2016-07-18 14:15:25 -07:00
Mark Rowe f529ec9f58 Fix a typo in the name of a #define. 2016-07-18 14:15:25 -07:00
Mark Rowe f00eb4f52d Enable clang's warning about implicit fallthrough. 2016-07-18 14:15:25 -07:00
Mark Rowe ac2223b32d Fix compiler checks to match clang on OS X, which CMake labels AppleClang. 2016-07-18 14:12:58 -07:00
Mark Rowe c756045871 Perform extra synchronization the first time `TsanNotifyWorker` hands a `RealmCoordinator` to the worker thread.
This prevents TSan from reporting data races on members of the coordinator.
2016-07-18 14:12:58 -07:00
Mark Rowe 7c0b99594a Replace `Results::set_live` with `Results::snapshot` and `List::snapshot`, and add tests.
`snapshot()` functions are a better fit for what realm-js needs. The new
API also makes it clearer that the liveness of a given `Results`
cannot change at arbitrary times. Changing the liveness at arbitrary
times was not safe and could result in incorrect behavior, such as a
non-live `Results` changing.
2016-07-18 14:12:58 -07:00
Mark Rowe 8798b1c617 Remove workaround for a core issue fixed in core v1.2.0. 2016-07-18 14:12:57 -07:00
Kristian Dupont edf53a1750 Specify width of PropertyType to 1 byte 2016-07-18 14:12:57 -07:00
Thomas Goyne 8293675bd6 Update to core 1.2.0 2016-07-18 14:12:57 -07:00
Thomas Goyne aaa811306e Resolve trivial differences with realm-cocoa 2016-07-18 14:12:57 -07:00
Thomas Goyne bdc8dbc5b2 Enable more warnings (and fix them)
This brings the warnings settings in line with realm-cocoa's.
2016-07-18 13:40:08 -07:00
Scott Kyle 63adf8732e [0.14.0-rc] Bump version 2016-06-28 12:15:36 -07:00
Scott Kyle 6109675749 Disable "Strip Linked Product" on our static libs
There seems to a bug inside the `strip` command (or its `ld64` library) that is being triggered by some users who get this message: `Assertion failed: (0 && "need to handle arm64 -r reloc")`

It is reported that disabling this setting side-steps the issue, and we don't need any stripping done on the static library itself.

Fixes #503
2016-06-28 12:13:58 -07:00
Scott Kyle e8ea8e493e Fix for linker error when building for iOS 7
By default, React Native projects target a minimum of iOS 7, but our projects were set to iOS 8 because previously we used a dynamic framework.

When building for an iOS 7 minimum target version, the linker would complain about thread local variables not working on iOS 7. So it was necessary to add even more checks (iOS >= 8 or OS X >= 10.7) before using native thread local variables rather than our shim.

This also changes our projects to target iOS 7 so we can catch these issues quicker in the future.
2016-06-27 12:16:35 -07:00
Ari Lazier 7d42d26fe9 quote dir path 2016-06-20 12:02:55 -07:00
Ari Lazier 5488eff9b9 recursively delete management directories 2016-06-20 11:41:18 -07:00
Ari Lazier 5eb64025f9 remove management directories in node 2016-06-20 10:49:53 -07:00
Scott Kyle adc07fdd7f Remove files accidentally added to GCDWebServers target
Not sure when this happened!
2016-06-17 13:16:01 -07:00
Scott Kyle 928ab03ce4 Update to download and use core build for Node
This will need to be updated again with a newer version since 1.1.2 build was created on CI but is not actually on static.realm.io until a new release is made.
2016-06-17 11:19:19 -07:00
Scott Kyle 12517a0d1e Add ability to run Node tests on Linux
It uses the Android ExternalCommitHelper implementation.

The Dockerfile requires that you have a static library build of core for Linux with PIC enabled.
2016-06-17 02:38:33 -07:00
Scott Kyle dc3d88f053 [0.14.0-rc] Bump version 2016-06-16 17:55:45 -07:00
Scott Kyle 55aa3d0702 Fix thread_local.hpp to compile with GCC 2016-06-16 17:32:11 -07:00
Scott Kyle 13ab8f8111 Refactor thread_id.hpp into cpp and thread_local.hpp 2016-06-16 17:02:53 -07:00
Scott Kyle b55483d2d9 Emulate thread_local for older iPhone targets
It seems that Xcode clang will not even support __thread for iPhone 5 and older, so this includes a simple abstraction over pthread keys in that case.
2016-06-16 17:02:53 -07:00
Scott Kyle 446cb0245e Fix bug due to std:🧵:id being reused
After a thread is destroyed, a thread id might be reused. This is true for pthread_self() and hence std:🧵:id. We were hitting this in Chrome debug mode because the "worker" thread was being destroyed and a new one immediately created when reloading. The thread id would be the same, and therefore we'd get back the SharedRealm for the previously destroyed thread (which had yet to be garbage collected.

The new implementation uses an atomically incremented, thread-local identifier, which serves our needs very well.

Fixes #473
2016-06-16 17:02:53 -07:00
Scott Kyle a335d7bbc8 The DEBUG macro is now defined at the project level 2016-06-15 01:19:19 -07:00
Scott Kyle 44fc1a4b36 Change RealmJS to use regular and debug cores
Bitcode build went away.
2016-06-14 18:04:12 -07:00
Scott Kyle d26edff0f5 Add format.cpp to Xcode Node build 2016-06-14 17:42:41 -07:00
Scott Kyle af52e9f437 Make stuff build for Node and Android 2016-06-14 17:22:04 -07:00
Ari Lazier 2e3b95f2e7 merge latest master 2016-06-14 16:40:57 -07:00
Ari Lazier f0b533c75f add util back to header path 2016-06-14 15:11:19 -07:00
Ari Lazier 08dd1a41be always invalidate newly opened realms 2016-06-14 14:36:27 -07:00
Ari Lazier 81a32909c1 update to latest object store changes 2016-06-14 14:33:27 -07:00
Ari Lazier 5b8f43dca2 get latest from os branch 2016-06-14 13:51:40 -07:00
Scott Kyle 6d524107e0 Silence warnings about member function pointers
The base ClassDefinition defines its constructor member as null, but some subclass have a static constructor function. This allows both cases to be handled without a warning.
2016-06-13 17:24:43 -07:00
Scott Kyle 43f7329047 Remove confusing, unnecessary typedef
This is not used anywhere.
2016-06-13 17:24:43 -07:00
Scott Kyle 9bcb30e86d Add missing source files to RealmNode target 2016-06-13 17:24:43 -07:00
Ari Lazier c7e156a7b8 Merge pull request #488 from realm/al-typos
fixes for typos and added upsert test
2016-06-13 14:51:53 -07:00
Ari Lazier 0a4e0665ae fixes for typos and added upsert test 2016-06-13 14:46:26 -07:00
Ari Lazier 3901bf53dc Merge pull request #479 from realm/al-muti-realm
fix for setting properties to objects from other realms
2016-06-13 14:44:28 -07:00
Scott Kyle 6aa9825cd1 Merge pull request #469 from realm/sk-object-store-merge
Merge latest object store (includes Android async stuff)
2016-06-13 14:38:28 -07:00
Ari Lazier 2b48ebb30a negate if statements 2016-06-13 14:07:50 -07:00
Kenneth Geisshirt 57a1015b85 Killing a few gcc warnings (#88)
* killing a few gcc warnings
2016-06-13 09:31:41 +02:00
Scott Kyle cd20d870dd Fix crash from querying with object from another Realm 2016-06-09 15:32:37 -07:00
Scott Kyle cdcb99a502 Improvements from PR feedback 2016-06-09 13:07:05 -07:00
Ari Lazier 81feca0ce9 fix for setting properties to objects from other realms 2016-06-08 11:22:12 -07:00
Mark Rowe 7f1be608f3 Merge pull request #85 from realm/mar/cocoa-list
Pull in changes to List from realm-cocoa
2016-06-07 15:45:08 -07:00
Thomas Goyne 5054bbc1a2 Add the path of the Realm file to the config mismatch exception message 2016-06-06 15:30:57 -07:00
Thomas Goyne bd0913bc03 Pull in changes to `List` from realm/realm-cocoa@355657f168. 2016-06-06 15:09:26 -07:00
Mark Rowe 152697d199 Add the linking objects property type. 2016-06-06 11:49:29 -07:00
Mark Rowe abca7c26e1 Add support for the concept of computed properties. 2016-06-06 11:41:34 -07:00
Chen Mulong 64e733e4d7 Fix compile errors for NDK (#82)
make_unique<TableView> causes ambiguous call with NDK's default gnustl.
Compiler fails to decide which constructor of Query to use.
2016-06-06 18:27:05 +08:00
Scott Kyle cd0bb079b7 Implement objectForPrimaryKey() method
Resolves #328
2016-06-03 16:51:32 -07:00
Scott Kyle cb889ea8f8 Merge pull request #466 from realm/sk-remove-gcov-config
Remove unused GCov_Build configuration
2016-06-03 16:04:29 -07:00
Thomas Goyne f4e5049f47 Add basic string formatting for error messages
The main motivation for this is that building error messages via string
concatenation is tedious and makes it hard to judge what the actual message
looks like when there are a lot of parts being inserted, to the extent that
I've been tempted to leave out some potentially useful information because the
code was getting unwieldy.

It also has some small functional benefits: bools are printed as true/false
rather than 1/0, and it is optimized for minimizing the compiled size.
Currently it cuts ~30 KB off librealm-object-store.dylib even with the addition
of new functionality.
2016-06-03 13:19:42 -07:00
Ari Lazier 49fd092cae Fix for whitespce 2016-06-02 22:05:17 -07:00
Mark Rowe 57ee591809 Merge pull request #78 from realm/mar/weakrealmnotifier-leak
Fix a potential leak within WeakRealmNotifier
2016-06-01 13:07:56 -07:00
Mark Rowe 8685390345 Merge pull request #77 from realm/mar/results-leak
Fix move-assigning to a Results that has a notifier to not leak the Realm
2016-06-01 13:07:45 -07:00
Thomas Goyne 6d22d28fea Merge pull request #72 from realm/tg/core-1.0.0
Upgrade to core 1.0.0 and update the file exception translation to match
2016-06-01 12:02:27 -07:00
Mark Rowe 08404d7098 Express `Results`' asignment operators in terms of their equivalent
constructors.

This avoids having to repeat the move constructor's logic in the move
assignment operator, and allows the copy assignment operator to compile
despite `TableViewBase`'s missing copy assignment implementation. the
copy assignment implementation can be defaulted once `TableViewBase` is
fixed.
2016-06-01 11:50:25 -07:00
Mark Rowe 3e952269da Have `Results` default its copy constructor.
The custom implementation was an attempt to ensure that
`m_has_used_table_view` and `m_wants_background_updates` had appropriate
intial values. Thomas pointed out that we can remove the reliance on the
initial values by ensure that `prepare_async` sets
`m_wants_background_updates`, removing the need for a custom copy
constructor.
2016-06-01 11:48:35 -07:00
Mark Rowe fc63c4f67b Merge pull request #76 from realm/mar/fix-building-tests-in-xcode
Fix building tests in Xcode
2016-06-01 11:40:14 -07:00
Mark Rowe 2a75edde8e Move `List`s defaulted constructors and assignment operators out of line. 2016-06-01 11:29:32 -07:00
Scott Kyle b5853c2590 Merge remote-tracking branch 'object-store/master' into sk-object-store-merge
* object-store/master:
  Make Realm::is_closed() work on read-only instances
  Fix for object store build issues on Android
  Implement commit helper and realm notifier for Android (#69)
  Build both dynamic and static libraries.
  moving pegtl dependency as step 1 in install doc
  update docu (install procedure)
2016-06-01 10:14:16 -07:00
Mark Rowe 702b8a31fb Avoid leaking the runloop and source if WeakRealmNotifier is move-assigned. 2016-05-31 21:54:40 -07:00
Mark Rowe 65a748de0c Fix move-assigning to a `Results` that has a notifier to not leak the
`Realm`, and moving from a `Results` to not result in a use-after-free.

The compiler generated move-assignment operator resulted in `m_notifier`
being assigned to without first calling `CollectionNotifier::unregister`.
This left a retain cycle in place, causing the `Realm` and other objects
to leak.

`ResultsNotifier` keeps track of which `Results` it should update when a
new `TableView` becomes available. When `Results` move-assignment
operator and move-constructor transfer ownership of the
`ResultsNotifier` to a new instance they also need to update its target
so it won't attempt to update the moved-from `Results`.
2016-05-31 19:03:29 -07:00
Mark Rowe 7e99634567 Fix building tests in Xcode.
The Xcode project generated by CMake doesn't create the dylib when built
as the dylib target does not contain any source files. Adding an empty
placeholder .cpp file to the target is sufficient to convince Xcode to
produce the dylib.
2016-05-31 17:16:52 -07:00
Mark Rowe 344fc42d4e Avoid copying `Object` unnecessarily. 2016-05-31 15:54:43 -07:00
Mark Rowe efdf0e01a9 Avoid copying `List` unnecessarily. 2016-05-31 15:27:48 -07:00
Scott Kyle 3b9b8cbc75 Remove unused GCov_Build configuration
We've never really used this, so let's remove it until we ever actually need something like this.
2016-05-31 11:30:24 -07:00
Scott Kyle 385fe97861 Make Realm::is_closed() work on read-only instances 2016-05-31 11:27:39 -07:00