Commit Graph

244 Commits

Author SHA1 Message Date
blagoev e31529397f Add tests for retrieveAccount method
fix admin-user-helper wait for admin to correctly wait
2017-07-07 10:31:29 +03:00
blagoev 73c861dc74 Remove method from list 2017-07-07 10:31:29 +03:00
blagoev 42e03e038d Add support for getting user id
For #1090
2017-07-07 10:31:29 +03: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
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
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
Ari Lazier 726d02e78f Make ssl SyncConfiguration parameters optional 2017-06-20 10:13:33 -07:00
Yavor Georgiev 7086ed745f Do not throw when the Sync constructor isn’t there (#1086)
* Do not throw when the Sync constructor isn’t there

with unified packaging it’s there all the time now

Closes #1084
Fixes #996

* Fix running the sync tests when Sync is disabled
2017-06-20 15:40:54 +02:00
Maximilian Alexander 775bd8e2ff adding ts and package.json typings (#1076)
* adding ts and package.json typings

* remove DefinitelyTyped needed comments, we are hosting this ourselves

* adding licensing comments

* Added initial contribution support

Thanks @akim95

* changing year

* adding parameters

* Expand on collection typings

* update the windows pre-gyp script (#1072)

* Extract admin status from the refresh token (#1078)

* Extract admin status from the refresh token

Fixes #1063

* wire up rpc

* Make sure all callbacks enqueue on the Node.js event loop (#1079)

Fixes #1077

* Use an uncached realm instance for _waitForDownload (#1083)

Fixes #1061

* Add objectSchema method to Realm Object (#1055)

* Add objectSchema property to Realm Object

* fix

* fixes

* move typings under lib/

* changelog
2017-06-20 13:09: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 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
Kristian Dupont af72770094 Replace calls to sync.cleanup with sync.removealllisteners (#1066) 2017-06-14 12:54:47 +02:00
blagoev 416632c9ad Merge pull request #1062 from realm/blagoev/fix-RN-debug-with-vscode
Return debugger context if running on node in vscode debugger
2017-06-13 12:27:45 +03:00
blagoev 3764d4bf55 Return debugger context if running on node in vscode debugger
Experimental
2017-05-29 09:33:06 +03:00
blagoev 2390f9b084 Merge pull request #869 from realm/kd/fix-execution-context-detection
Update index.js to report missing react-native link
2017-05-29 09:00:16 +03:00
blagoev f4528ae6f5 fix for open async in RN Debug 2017-05-20 09:41:51 +03:00
blagoev cc2e685594 Fix for react-tests in Debug 2017-05-20 09:17:48 +03:00
blagoev a0f963775b Fix download api for RN
fix tests when run in RN
2017-05-17 16:09:19 +03:00
blagoev 0d3fbccbe1 forgotten file 2017-05-17 16:09:05 +03:00
blagoev 4b67d883b6 Add a fix for RN hang with promises 2017-05-17 16:08:42 +03:00
blagoev 4aecf90176 enable all session-tests and Realm.openAsync 2017-05-17 16:08:24 +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 4e77bf326f fix Realm.open to use the correct ctor function 2017-05-17 16:07:35 +03:00
blagoev 216484aede Initial download api support 2017-05-17 16:07:08 +03:00
Kristian Dupont 045b963d6f Change fragile test to wait for signal rather than for a period of time (#936)
* Change test to wait for signal rather than for 4 seconds

* Tiny refactoring
2017-03-24 12:49:28 +01:00
Kristian Dupont f551a51acc Add missing sync error (#925)
* Add missing sync error

* Make unit tests work without sync

* Wording fix
2017-03-22 13:52:41 +01:00
Kristian Dupont 5bece3d5c4 Validate user-methods parameters (#924)
* Validate user-methods parameters

* Switch homemade typeof operator for real one.

* Fix array prototype access
2017-03-20 12:52:41 +01:00
Kristian Dupont 94f8d5a891 Add optional userInfo param to registerWithProvider (#915)
* Add optional userInfo param to registerWithProvider

* Fixes per PR comments
2017-03-17 14:13:03 +01:00
Kristian Dupont 1c6f4e6a05 Fix analytics buffer creation (#913) 2017-03-15 11:23:14 +01:00
kristiandupont f48c9ce079 Check for chrome debugger when navigator.product is set as well 2017-03-15 11:21:16 +01:00
kristiandupont 1073a4bbc0 Update index.js to report missing react-native link 2017-02-16 10:53:30 +01:00
M 0ec11ce16e rpc.js: removed Buffer.from
There hasn't Buffer Object in react native environment.
2017-02-10 18:28:03 +13:00
M 079a810044 rpc.js: fixed issue: #736 2017-02-10 11:27:44 +13:00
Radu Tutueanu 716201a1fe Fix loading the constructor for node-server-sdk 2017-02-08 13:36:43 +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 0c6000a733 Enable running android sync tests on macOS (#834)
* start ROS and forward ports when running android tests on macOS

* rework AuthError so JSC likes it
2017-02-02 02:41:27 +01:00
Yavor Georgiev 19f00e1b4b Rework #832 (#833) 2017-02-02 02:41:11 +01:00
Yavor Georgiev b2da398559 Fix token refresh and session bugs in chrome debugging (#831) 2017-02-01 23:44:56 +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
Yavor Georgiev 408f5588f8 Add Permissions models and User Management Realm API (#824)
* Add Permissions models and User Management Realm API

* docs and changelog

* fix bad merge

* add test

* fix jsdoc annotation

* rename permissions to management schema
2017-01-31 22:56:09 +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 12bde1ed35 Improve CI builds relying on Chrome (#796)
* Use ES6 Proxies to implement collections in the Chrome debugger

* rework realm-test-names event

* move React stuff on the CPH mac mini

* use node with npm3

* remove debugging aid code
2017-01-11 18:22:41 +01:00
Kristian Dupont fa1f22ddc2 Fix constructor init (#774)
* Update test app to RN 0.39.0

* Fix getContext in index.js

* Add dependency on invariant

* Add some comments to getContext

* Make invariant a devdependency rather than a dependency
2017-01-06 14:30:32 +01:00
Kristian Dupont 6bbdb34da0 Catch analytics errors (#770) 2017-01-03 15:16:46 +01:00
Kristian Dupont 4dc0403c58 Make eslint happy 2016-12-29 10:53:51 +01:00
Kristian Dupont e74a657725 Improve realm constructor logic (#742)
* Add user file

* Clean up initialization and add error message

* Revert "Add user file"

This reverts commit 2948f4cfc2dfd2d5d75594307b1e89806b817eb7.

* Make index.js more robust

* Fix review comments
2016-12-22 13:20:19 +01:00
Nabil Hachicha 43dabf5cbd Nh/symbol iterator android (#732)
* Fix Symbol.iterator on Android
2016-12-20 18:56:51 +00:00
Ari Lazier fcf04bf7f5 add non-working listener methods 2016-11-22 07:27:58 -08:00
Ari Lazier acae0aaf4f don't require node analytics for rn 2016-11-21 17:47:55 -08:00
Ari Lazier 0238e8fa48 lint fix 2016-11-21 15:33:37 -08:00
Brandon Smith bcec963629 Support running realm-js in Electron renderer (#667)
Electron is a combination of a node and
Chromium processes. Chromium processes
can have node bindings enabled and can
therefore run most npm modules seamlessly.

The current `lib/index.js` bootstrapping
logic results in a ReferenceError on the
following statement:

    typeof Realm != 'undefined'

Thus, checking whether running under node
first allows realm-js to run inside the
Electron renderer (Chromium) process.
2016-11-21 16:14:46 +01:00
Ari Lazier df18d1f925 Merge pull request #675 from realm/al/cleanup
call cleanup on exceptions and ctr-c
2016-11-21 07:08:50 -08:00
Ari Lazier ec2622ba96 call cleanup on exceptions and ctr-c 2016-11-20 10:34:13 -08:00
Kristian Dupont 39b082f607 Add runtime analytics for node 2016-11-16 15:55:59 +01:00
Søren Vind 06d277aacd Bumped version of ESLint, added eslinting of specs, make all linting pass 2016-11-14 10:48:50 -08:00
Ari Lazier e4d4cbbdf3 proper fix/hack removal, partially working sync for rn 2016-11-11 17:53:58 -08:00
Ari Lazier 8ce8f52105 add test for login 2016-11-08 14:07:04 -08:00
Ari Lazier b2e71a5fb6 test fixes 2016-11-08 09:21:27 -08:00
Ari Lazier fde1c5d00d start implementing sync tests 2016-11-08 08:59:30 -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 92adb669d5 hook up new object store apis 2016-10-26 17:00:46 -07:00
Ari Lazier 0d74c05366 add sync cleanup method 2016-10-25 15:04:58 -07:00
Yavor Georgiev 622482029a Pass AuthError in Realm.Sync.User methods callbacks (#619)
* Pass AuthError in Realm.Sync.User methods callbacks

The new Realm.Sync.AuthError class exposes properties common to the Problem family of classes in the Realm Object Server

* extract AuthError in a separate file

* whitespace
2016-10-25 00:12:12 +02:00
Yavor Georgiev 3dc968cfe2 rename wireup 2016-10-11 00:45:01 +02:00
Yavor Georgiev 74d385141a refactor Realm constructor wireup 2016-10-10 16:17:05 +02:00
Yavor Georgiev 0ff7357cc3 Build for node without sync 2016-10-10 14:20:33 +02:00
Ari Lazier 9d0df0de3d Sync and fine grained notifications 2016-10-04 15:07:14 -07:00
Yavor Georgiev 33eb3fe06f Make Collection prototype methods configurable and writable (#592)
* Make Collection prototype methods configurable and writable

* Make `Realm.Types` re-definable
2016-09-09 01:33:42 +03:00
Yavor Georgiev fb7911e3fa add support for the jest runner’s node environment 2016-08-10 15:50:37 +02:00
Marius Rackwitz 48b106e610 Check if there is a global console to silent eslint 2016-08-04 10:12:16 -07:00
Marius Rackwitz 7755e7030b Warn when Realm.Types is still used 2016-08-04 10:10:28 -07:00
Scott Kyle 717d6781a1 Add support for debugging in Visual Studio Code
Since Code runs in Node, rather than Chrome, we need to require the `sync-request` module. The global `__debug__` object was exposed by the vscode-react-native plugin v0.1.5 for us to be able to do that.

Resolves #374
2016-06-29 16:02:50 -07:00
Scott Kyle 5b9fbbb0ac Remove unnecessary cross-Realm check in rpc
This was causing the new failure in Chrome debug mode in the `testLinkTypesPropertySetters` test.
2016-06-14 16:58:05 -07:00
Scott Kyle 3307bf0a26 Fix for changed error message 2016-06-14 16:57:39 -07:00
Scott Kyle cdcb99a502 Improvements from PR feedback 2016-06-09 13:07:05 -07:00
Scott Kyle cd0bb079b7 Implement objectForPrimaryKey() method
Resolves #328
2016-06-03 16:51:32 -07:00
Ari Lazier 9c7292acff chrome debug and and react native fixes 2016-05-19 13:27:36 -07:00
Ari Lazier e7b341dfdb merge latest from master 2016-05-13 15:05:19 -07:00
Ari Lazier 9c1b923797 fixes for test app 2016-05-13 13:05:39 -07:00
Scott Kyle d4b7a6bed3 Update RPC layer for changing constructors
This is very important for hot module reloading.
2016-05-06 15:42:17 -07:00
Scott Kyle e8cd20d7bb Use RPC callback mechanism for writes and listeners
The callbacks are stored by their id in the RPCServer so they are properly uniqued. This prevents the same callback from being added multiple times as a change listener.
2016-05-02 12:41:53 -07:00
Scott Kyle 32a8a2ed72 Make migration tests work in Chrome debug mode
All realm operations for the RPC are now done in their own thread so it can be allowed to block on waiting for callback results. The recursive and multi-threaded nature of this makes it pretty tricky, but it works!
2016-04-29 13:55:49 -07:00
Scott Kyle 950b75fd2f Fix broken testResultsInvalidation test on Chrome
We needed more actions to actually get sent over the RPC.
2016-04-29 11:16:21 -07:00
Scott Kyle 85919dc66f Fix realm.schema property in Chrome debug mode 2016-04-29 11:16:10 -07:00
Ari Lazier 2b35360117 add readOnly property 2016-04-28 15:50:43 -07:00
Scott Kyle df14c7760d Fix Realm.Object in Chrome debug mode 2016-04-26 17:33:33 -07:00
Ari Lazier 785e57eb47 another fix for chrome debug mode 2016-04-26 17:08:00 -07:00
Ari Lazier 591dce8051 one fix for chrome debug mode 2016-04-26 16:53:50 -07:00
Ari Lazier b59784670b create RealmObject class and make isValid a member 2016-04-26 16:30:04 -07:00
Ari Lazier 3509caedd5 bugfix for empty results, fix for realm.isValid 2016-04-19 17:29:34 -07:00
Scott Kyle 275334fa7e Remove definition of Realm.Types from browser shim
It's added in the top-level index.js file
2016-04-19 03:24:15 -07:00
Scott Kyle a05f7e2261 Fix some eslint errors 2016-04-19 01:38:46 -07:00
Scott Kyle 73cfca7d81 Fix for failing React Native test on iOS 2016-04-18 16:06:59 -07:00
Scott Kyle 133289ad85 All tests now pass on Node 2016-04-15 16:06:44 -07:00
Scott Kyle 0e74362e4c Merge pull request #340 from realm/sk-collection
Make List and Results inherit from Collection
2016-03-21 15:27:18 -07:00
Scott Kyle 83e09268ea Rename array-methods.js to collection-methods.js 2016-03-21 15:00:00 -07:00
Ari Lazier 836cfc1c6b add chrome debugging, use -1 for not versioned 2016-03-21 13:34:12 -07:00
Scott Kyle 8c66bab8aa Make collection iterators actually iterable
The ES6 spec calls for this so these iterators are usable in for-of loops, with spread operators, etc.
2016-03-20 11:51:16 -07:00