Commit Graph

206 Commits

Author SHA1 Message Date
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
Scott Kyle b5ce02c0ce Make List and Results inherit from Collection
This will allow for easier type checking, documentation, etc.
2016-03-20 11:51:16 -07:00
Scott Kyle 27073a9e66 Properly configure ESLint for syntax checking
Added a test case to run on CI as well.
2016-03-16 13:01:38 -07:00
Scott Kyle 1e652d9f2a Merge pull request #292 from realm/sk-debug-on-device
Use device IP addresses to connect to RPC host
2016-03-16 12:51:24 -07:00
Scott Kyle 8d73a8e985 Simplify setting up Chrome debugging sessionHost 2016-03-16 09:28:18 -07:00
Ari Lazier aa08d25ed0 Merge pull request #305 from realm/al-object-store
Latest object store changes and core
2016-03-10 16:03:12 -08:00
Scott Kyle d39d437bfe Fix for failing test with Chrome debugging
A new error popped up ("LinkView is not attached") which required a more generalized check.
2016-03-09 15:23:58 -08:00
Scott Kyle 1a127b425b Merge pull request #289 from realm/sk-accept-constructor
Accept constructor in create() and objects() methods
2016-03-07 12:23:26 -08:00
Scott Kyle 37b2c35169 Add Symbol.iterator method to List and Results
Resolves #235
2016-03-02 23:00:53 -08:00
Scott Kyle 1cba02c34d Fix broken iterator methods on Android
Turns out the JSC included with React Native on Android includes a buggy implementation of ArrayIterator that is missing an exposed next() method, so we implement it ourselves instead.
2016-03-02 22:57:36 -08:00
Scott Kyle 00b19d95b8 Use device IP addresses to connect to RPC host
It still only tries localhost for the simulator, but for devices, we now get a list of possible IP addresses to attempt to connect to before throw a more helpful exception.

Resolves #284 and fixes #276
2016-03-01 00:56:45 -08:00
Scott Kyle 4a81b091cb Accept constructor in create() and objects() methods
This will help the linter prevent spelling mistakes and make some code more easily readable.

Resolves #233
2016-03-01 00:46:03 -08:00
Scott Kyle ad24673776 Rename util.createList to createCollection
Sounds more generic this way.
2016-02-29 12:34:29 -08:00
Scott Kyle 4ea2e729b4 Support many Array methods on List and Results
Resolves #18
2016-02-29 03:24:58 -08:00
Scott Kyle 236d0a5eed Ensure List and Results constructors throw exception
This was already done from native code, but needed to happen for the browser shim and be tested.
2016-02-29 03:24:58 -08:00
Scott Kyle b1f656a252 Convert browser module to use ES6 modules 2016-02-29 03:24:58 -08:00
Scott Kyle 44a29d8dd4 Expose List and Results constructors into JS 2016-02-29 03:24:58 -08:00
Scott Kyle 97e6166597 Move browser JS shim under its own directory 2016-02-29 03:24:58 -08:00
Tim Anglade 7cc2f69736 Merge pull request #264 from realm/km-js-fixlicense
License update
2016-02-21 18:56:59 -08:00
Scott Kyle 2e3a3b5db8 Merge pull request #257 from realm/sk-schema-prop
The schema property should be directly on constructor
2016-02-18 16:27:47 -08:00
Karson Miller 5e9333b699 no message 2016-02-18 15:30:44 -08:00
Scott Kyle 5332131c14 Add sorted() method to List 2016-02-18 13:41:11 -08:00
Scott Kyle 05d84b23a2 Change sortedBy API as discussed
If provided an array, then each member can optionally be an array of [propName, reverse]
2016-02-18 12:47:18 -08:00
Scott Kyle 249bcd8f3f Change sortByProperty to return new Results
The method name changed to sortedBy to reflect that it returns a new Results object and to be more succinct. Also, the second optional argument instead reflects descending (or rather, reverse) since it's an anti-pattern to have an optional argument default to true in JS, and this also follows precedences set by other JS libraries and by Python's sorted function.
2016-02-18 11:58:39 -08:00
Scott Kyle b34e52b290 The schema property should be directly on constructor
The constructor is now also called with `this` set as the constructed object.

Fixes #232
2016-02-18 11:10:02 -08:00
Ari Lazier 6374a04ed4 chrome support for filtered 2016-02-17 20:27:10 -08:00
Scott Kyle 3e1889d342 Merge branch 'master' into sk-listview-merge
* master: (207 commits)
  Convert to using new React Native MainActivity template
  Create RealmReactPackage for our Android plugin
  Fix doc for Android
  NPM ignore react-native/android folder
  Skip building Android module under Xcode
  Skip building Android module for iOS tests
  gitignore Android downloads folder
  Update README with instructions to run on Android
  Use un-patched RN for Android by installing hook into JSC
  cleanup build system
  Use Realm in node_modules for ReactTests on Android
  Change Demo => ReactTests
  adding a 'publishAndroid' task to generate the AAR with prebuilt .so files
  Adjust POM_NAME
  Use consistent package naming
  Remove old Demo files
  Add copyright to JNI file
  Cleanup platform.hpp
  Make our Android module buildable as a dependency
  Add `npm test` command
  ...
2016-02-15 14:49:31 -08:00
Scott Kyle a6715d210d Ignore more things when publishing with NPM
Unfortunately some kind of NPM bug is making it ignore a top-level .npmignore file.
2016-01-22 16:43:53 -08:00
Scott Kyle eb4ac0000b Efficient React ListView for Realm collections
This component is fully backwards compatible with the original React ListView, but is compatible with Realm Results and List objects to use their snapshot functionality along with more efficiently checking if each row should update.
2016-01-21 11:41:38 -08:00
Scott Kyle bc77077b13 Merge branch 'sk-schema-api'
* sk-schema-api:
  Improve clarity of schema parsing and serialization
  Add test that checks schema validation
  Update README with new Schema API
  Cleanup some code and comments to make it consistent
  Convert tests to create objects with property objects
  Update example apps with new schema API
  Remove confusion between propTypes and objectTypes
  Simplify object schema info returned from RPC
  RPC now keeps object keys in the same order
  Change schema API to take properties as an object
  Add method to clear mutation listeners in RPC client
  Plug small leak from not releasing a JSStringRef
  Make RJSStringForValue use consistent exception style
  Improve error messages inside RJSUtil
2016-01-14 15:13:33 -08:00
Scott Kyle 7202994482 Add comments to explain checking for userAgent 2016-01-08 15:54:30 -08:00
Scott Kyle 334e646d7b Error message when RealmReact framework is missing
Fixes #190
2016-01-07 15:18:27 -08:00
Scott Kyle 15052985f1 Remove confusion between propTypes and objectTypes
The RPC layer now only speaks in objectTypes, since they don't always equate to propTypes. We were overloading the use of propTypes for no good purpose.
2016-01-05 13:53:54 -08:00
Scott Kyle 36ffc6c77c Simplify object schema info returned from RPC
Only the property names are needed.
2016-01-05 13:40:57 -08:00
Scott Kyle c928ab716e RPC now keeps object keys in the same order
Maintaining insertion order when passing objects through the RPC is essential to make the new schema API work.
2016-01-05 13:40:57 -08:00
Scott Kyle 358e5dacf3 Add method to clear mutation listeners in RPC client 2016-01-05 13:40:53 -08:00
Scott Kyle 381dbbe7ba Merge branch 'sk-npm'
* sk-npm:
  Add ability to publish NPM module to git
  Move RealmJS.mm to correct location
2016-01-05 13:25:20 -08:00
Scott Kyle 632f9d737e Add methods to create snapshot of List and Results
The Results class was updated to match the style of List and include a flag (m_live) that determines if it should sync updates. If an object in the static Results is deleted, then it will return null.
2015-12-30 16:53:26 -08:00
Scott Kyle 3da6b54df6 Add ability to publish NPM module to git
The top-level package.json explicitly includes the directories it needs (vendor/.npmignore cuts down the cruft). The publish-beta.sh script essentially uses `npm pack` to package up the NPM module and then push it into an orphaned `beta` branch.
2015-12-28 22:01:17 -08:00