mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-09 13:55:49 +00:00
merge latest master
This commit is contained in:
commit
a3178506c4
@ -5,3 +5,5 @@
|
|||||||
build/
|
build/
|
||||||
node_modules/
|
node_modules/
|
||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
|
/tests/test-runners/
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,3 +1,14 @@
|
|||||||
|
x.x.x Release notes (yyyy-MM-dd)
|
||||||
|
=============================================================
|
||||||
|
### Breaking changes
|
||||||
|
* Deprecate `Realm.Types`. Please specify the type name as lowercase string instead.
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
* None
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
* None
|
||||||
|
|
||||||
0.14.2 Release notes (2016-7-11)
|
0.14.2 Release notes (2016-7-11)
|
||||||
=============================================================
|
=============================================================
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "~15.2.0",
|
"react": "~15.2.0",
|
||||||
"react-native": "^0.29.0",
|
"react-native": "^0.31.0",
|
||||||
"realm": "file:../.."
|
"realm": "file:../.."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
40
lib/index.js
40
lib/index.js
@ -29,7 +29,7 @@ if (typeof Realm != 'undefined') {
|
|||||||
// The userAgent will be defined when running in a browser (such as Chrome debugging mode).
|
// The userAgent will be defined when running in a browser (such as Chrome debugging mode).
|
||||||
realmConstructor = require('./browser').default; // (exported as ES6 module)
|
realmConstructor = require('./browser').default; // (exported as ES6 module)
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
} else if (typeof process == 'object' && ('' + process) == '[object process]') {
|
} else if (typeof process == 'object' && (('' + process) == '[object process]' || typeof jest == 'object')) {
|
||||||
// Prevent React Native packager from seeing this module.
|
// Prevent React Native packager from seeing this module.
|
||||||
var bindings = 'bindings';
|
var bindings = 'bindings';
|
||||||
realmConstructor = require(bindings)('realm').Realm;
|
realmConstructor = require(bindings)('realm').Realm;
|
||||||
@ -41,18 +41,34 @@ if (typeof Realm != 'undefined') {
|
|||||||
Object.defineProperties(realmConstructor.Collection.prototype, arrayMethods);
|
Object.defineProperties(realmConstructor.Collection.prototype, arrayMethods);
|
||||||
|
|
||||||
// TODO: Remove this now useless object.
|
// TODO: Remove this now useless object.
|
||||||
|
var types = Object.freeze({
|
||||||
|
'BOOL': 'bool',
|
||||||
|
'INT': 'int',
|
||||||
|
'FLOAT': 'float',
|
||||||
|
'DOUBLE': 'double',
|
||||||
|
'STRING': 'string',
|
||||||
|
'DATE': 'date',
|
||||||
|
'DATA': 'data',
|
||||||
|
'OBJECT': 'object',
|
||||||
|
'LIST': 'list',
|
||||||
|
});
|
||||||
Object.defineProperty(realmConstructor, 'Types', {
|
Object.defineProperty(realmConstructor, 'Types', {
|
||||||
value: Object.freeze({
|
get: function() {
|
||||||
'BOOL': 'bool',
|
if (typeof console != 'undefined') {
|
||||||
'INT': 'int',
|
/* global console */
|
||||||
'FLOAT': 'float',
|
/* eslint-disable no-console */
|
||||||
'DOUBLE': 'double',
|
var stack = new Error().stack.split("\n").slice(2).join("\n");
|
||||||
'STRING': 'string',
|
var msg = '`Realm.Types` is deprecated! Please specify the type name as lowercase string instead!\n'+stack;
|
||||||
'DATE': 'date',
|
if (console.warn != undefined) {
|
||||||
'DATA': 'data',
|
console.warn(msg);
|
||||||
'OBJECT': 'object',
|
}
|
||||||
'LIST': 'list',
|
else {
|
||||||
})
|
console.log(msg);
|
||||||
|
}
|
||||||
|
/* eslint-enable no-console */
|
||||||
|
}
|
||||||
|
return types;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = realmConstructor;
|
module.exports = realmConstructor;
|
||||||
|
@ -19,11 +19,13 @@
|
|||||||
#import "RealmReact.h"
|
#import "RealmReact.h"
|
||||||
#import "RealmAnalytics.h"
|
#import "RealmAnalytics.h"
|
||||||
#import "RCTBridge.h"
|
#import "RCTBridge.h"
|
||||||
|
#import "RCTJavaScriptExecutor.h"
|
||||||
|
|
||||||
#import "jsc_init.h"
|
#import "jsc_init.h"
|
||||||
#import "shared_realm.hpp"
|
#import "shared_realm.hpp"
|
||||||
#import "realm_coordinator.hpp"
|
#import "realm_coordinator.hpp"
|
||||||
|
|
||||||
|
#import <objc/runtime.h>
|
||||||
#import <arpa/inet.h>
|
#import <arpa/inet.h>
|
||||||
#import <ifaddrs.h>
|
#import <ifaddrs.h>
|
||||||
#import <netdb.h>
|
#import <netdb.h>
|
||||||
@ -44,7 +46,7 @@ using namespace realm::rpc;
|
|||||||
@interface NSObject ()
|
@interface NSObject ()
|
||||||
- (instancetype)initWithJSContext:(JSContext *)context;
|
- (instancetype)initWithJSContext:(JSContext *)context;
|
||||||
- (instancetype)initWithJSContext:(JSContext *)context onThread:(NSThread *)thread;
|
- (instancetype)initWithJSContext:(JSContext *)context onThread:(NSThread *)thread;
|
||||||
- (JSGlobalContextRef)ctx;
|
- (JSContext *)context;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern "C" JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executor, bool create) {
|
extern "C" JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executor, bool create) {
|
||||||
@ -69,7 +71,7 @@ extern "C" JSGlobalContextRef RealmReactGetJSGlobalContextForExecutor(id executo
|
|||||||
object_setIvar(executor, contextIvar, rctJSContext);
|
object_setIvar(executor, contextIvar, rctJSContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [rctJSContext ctx];
|
return [rctJSContext context].JSGlobalContextRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface RealmReact () <RCTBridgeModule>
|
@interface RealmReact () <RCTBridgeModule>
|
||||||
|
@ -4,7 +4,7 @@ set -e
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
# Set to "latest" for the latest build.
|
# Set to "latest" for the latest build.
|
||||||
: ${REALM_CORE_VERSION:=1.4.0}
|
: ${REALM_CORE_VERSION:=1.5.0}
|
||||||
|
|
||||||
if [ "$1" = '--version' ]; then
|
if [ "$1" = '--version' ]; then
|
||||||
echo "$REALM_CORE_VERSION"
|
echo "$REALM_CORE_VERSION"
|
||||||
|
@ -157,6 +157,18 @@ case "$TARGET" in
|
|||||||
|
|
||||||
node "$SRCROOT/tests"
|
node "$SRCROOT/tests"
|
||||||
;;
|
;;
|
||||||
|
"test-runners")
|
||||||
|
npm install
|
||||||
|
scripts/download-core.sh node
|
||||||
|
src/node/build-node.sh $CONFIGURATION
|
||||||
|
|
||||||
|
for runner in ava mocha jest; do
|
||||||
|
pushd "$SRCROOT/tests/test-runners/$runner"
|
||||||
|
npm install
|
||||||
|
npm test
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
;;
|
||||||
"object-store")
|
"object-store")
|
||||||
pushd src/object-store
|
pushd src/object-store
|
||||||
cmake -DCMAKE_BUILD_TYPE=$CONFIGURATION .
|
cmake -DCMAKE_BUILD_TYPE=$CONFIGURATION .
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
02F59ED51C88F1B6007F774C /* weak_realm_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59ED11C88F1B6007F774C /* weak_realm_notifier.cpp */; };
|
02F59ED51C88F1B6007F774C /* weak_realm_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59ED11C88F1B6007F774C /* weak_realm_notifier.cpp */; };
|
||||||
02F59EE21C88F2BB007F774C /* realm_coordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EDB1C88F2BA007F774C /* realm_coordinator.cpp */; };
|
02F59EE21C88F2BB007F774C /* realm_coordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EDB1C88F2BA007F774C /* realm_coordinator.cpp */; };
|
||||||
02F59EE31C88F2BB007F774C /* transact_log_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EDD1C88F2BB007F774C /* transact_log_handler.cpp */; };
|
02F59EE31C88F2BB007F774C /* transact_log_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EDD1C88F2BB007F774C /* transact_log_handler.cpp */; };
|
||||||
|
5DC74A781D623C9800D77A4F /* handover.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC74A751D623C8700D77A4F /* handover.cpp */; };
|
||||||
|
5DC74A791D623CA200D77A4F /* handover.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC74A751D623C8700D77A4F /* handover.cpp */; };
|
||||||
|
5DC74A7A1D623CA800D77A4F /* thread_confined.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC74A721D623C7A00D77A4F /* thread_confined.cpp */; };
|
||||||
|
5DC74A7B1D623CA800D77A4F /* thread_confined.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC74A721D623C7A00D77A4F /* thread_confined.cpp */; };
|
||||||
F60102D31CBB966E00EC01BA /* js_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048071C0428DF00ABDED4 /* js_realm.cpp */; };
|
F60102D31CBB966E00EC01BA /* js_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048071C0428DF00ABDED4 /* js_realm.cpp */; };
|
||||||
F60102D41CBB96AB00EC01BA /* index_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EAF1C88F17D007F774C /* index_set.cpp */; };
|
F60102D41CBB96AB00EC01BA /* index_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EAF1C88F17D007F774C /* index_set.cpp */; };
|
||||||
F60102D51CBB96AE00EC01BA /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EB11C88F17D007F774C /* list.cpp */; };
|
F60102D51CBB96AE00EC01BA /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EB11C88F17D007F774C /* list.cpp */; };
|
||||||
@ -163,6 +167,11 @@
|
|||||||
02F59EDE1C88F2BB007F774C /* transact_log_handler.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = transact_log_handler.hpp; sourceTree = "<group>"; };
|
02F59EDE1C88F2BB007F774C /* transact_log_handler.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = transact_log_handler.hpp; sourceTree = "<group>"; };
|
||||||
02F59EDF1C88F2BB007F774C /* weak_realm_notifier_base.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier_base.hpp; sourceTree = "<group>"; };
|
02F59EDF1C88F2BB007F774C /* weak_realm_notifier_base.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier_base.hpp; sourceTree = "<group>"; };
|
||||||
02F59EE01C88F2BB007F774C /* weak_realm_notifier.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier.hpp; sourceTree = "<group>"; };
|
02F59EE01C88F2BB007F774C /* weak_realm_notifier.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier.hpp; sourceTree = "<group>"; };
|
||||||
|
5DC74A721D623C7A00D77A4F /* thread_confined.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = thread_confined.cpp; path = src/thread_confined.cpp; sourceTree = "<group>"; };
|
||||||
|
5DC74A731D623C7A00D77A4F /* thread_confined.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = thread_confined.hpp; path = src/thread_confined.hpp; sourceTree = "<group>"; };
|
||||||
|
5DC74A751D623C8700D77A4F /* handover.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = handover.cpp; sourceTree = "<group>"; };
|
||||||
|
5DC74A761D623C8700D77A4F /* handover.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = handover.hpp; sourceTree = "<group>"; };
|
||||||
|
5DC74A7C1D623CED00D77A4F /* compiler.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = compiler.hpp; sourceTree = "<group>"; };
|
||||||
F60102CF1CBB814A00EC01BA /* node_init.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = node_init.hpp; sourceTree = "<group>"; };
|
F60102CF1CBB814A00EC01BA /* node_init.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = node_init.hpp; sourceTree = "<group>"; };
|
||||||
F60102D11CBB865A00EC01BA /* jsc_init.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsc_init.hpp; sourceTree = "<group>"; };
|
F60102D11CBB865A00EC01BA /* jsc_init.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsc_init.hpp; sourceTree = "<group>"; };
|
||||||
F60102E31CBBB19700EC01BA /* node_object_accessor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = node_object_accessor.hpp; sourceTree = "<group>"; };
|
F60102E31CBBB19700EC01BA /* node_object_accessor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = node_object_accessor.hpp; sourceTree = "<group>"; };
|
||||||
@ -375,6 +384,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
02E008D11D10AB1B00F3AA37 /* atomic_shared_ptr.hpp */,
|
02E008D11D10AB1B00F3AA37 /* atomic_shared_ptr.hpp */,
|
||||||
|
5DC74A7C1D623CED00D77A4F /* compiler.hpp */,
|
||||||
02E008D21D10AB1B00F3AA37 /* format.cpp */,
|
02E008D21D10AB1B00F3AA37 /* format.cpp */,
|
||||||
02E008D31D10AB1B00F3AA37 /* format.hpp */,
|
02E008D31D10AB1B00F3AA37 /* format.hpp */,
|
||||||
F6242B291D08EE9600BE1E03 /* thread_id.hpp */,
|
F6242B291D08EE9600BE1E03 /* thread_id.hpp */,
|
||||||
@ -420,6 +430,8 @@
|
|||||||
02F59EBC1C88F17D007F774C /* schema.hpp */,
|
02F59EBC1C88F17D007F774C /* schema.hpp */,
|
||||||
02F59EBD1C88F17D007F774C /* shared_realm.cpp */,
|
02F59EBD1C88F17D007F774C /* shared_realm.cpp */,
|
||||||
02F59EBE1C88F17D007F774C /* shared_realm.hpp */,
|
02F59EBE1C88F17D007F774C /* shared_realm.hpp */,
|
||||||
|
5DC74A721D623C7A00D77A4F /* thread_confined.cpp */,
|
||||||
|
5DC74A731D623C7A00D77A4F /* thread_confined.hpp */,
|
||||||
);
|
);
|
||||||
name = "Object Store";
|
name = "Object Store";
|
||||||
path = "object-store";
|
path = "object-store";
|
||||||
@ -459,6 +471,8 @@
|
|||||||
02414B9A1CE6AAEF00A8669F /* collection_change_builder.hpp */,
|
02414B9A1CE6AAEF00A8669F /* collection_change_builder.hpp */,
|
||||||
02414B9B1CE6AAEF00A8669F /* collection_notifier.cpp */,
|
02414B9B1CE6AAEF00A8669F /* collection_notifier.cpp */,
|
||||||
02414B9C1CE6AAEF00A8669F /* collection_notifier.hpp */,
|
02414B9C1CE6AAEF00A8669F /* collection_notifier.hpp */,
|
||||||
|
5DC74A751D623C8700D77A4F /* handover.cpp */,
|
||||||
|
5DC74A761D623C8700D77A4F /* handover.hpp */,
|
||||||
02414B9D1CE6AAEF00A8669F /* list_notifier.cpp */,
|
02414B9D1CE6AAEF00A8669F /* list_notifier.cpp */,
|
||||||
02414B9E1CE6AAEF00A8669F /* list_notifier.hpp */,
|
02414B9E1CE6AAEF00A8669F /* list_notifier.hpp */,
|
||||||
02414B9F1CE6AAEF00A8669F /* results_notifier.cpp */,
|
02414B9F1CE6AAEF00A8669F /* results_notifier.cpp */,
|
||||||
@ -832,6 +846,7 @@
|
|||||||
F60102DB1CBB96C600EC01BA /* parser.cpp in Sources */,
|
F60102DB1CBB96C600EC01BA /* parser.cpp in Sources */,
|
||||||
F6E931BB1CFEAE310016AF14 /* collection_change_builder.cpp in Sources */,
|
F6E931BB1CFEAE310016AF14 /* collection_change_builder.cpp in Sources */,
|
||||||
F64A059B1D10D928004ACDBE /* format.cpp in Sources */,
|
F64A059B1D10D928004ACDBE /* format.cpp in Sources */,
|
||||||
|
5DC74A7B1D623CA800D77A4F /* thread_confined.cpp in Sources */,
|
||||||
F60102D51CBB96AE00EC01BA /* list.cpp in Sources */,
|
F60102D51CBB96AE00EC01BA /* list.cpp in Sources */,
|
||||||
F6E931BC1CFEAE340016AF14 /* collection_notifier.cpp in Sources */,
|
F6E931BC1CFEAE340016AF14 /* collection_notifier.cpp in Sources */,
|
||||||
F60102DC1CBB96C900EC01BA /* query_builder.cpp in Sources */,
|
F60102DC1CBB96C900EC01BA /* query_builder.cpp in Sources */,
|
||||||
@ -848,6 +863,7 @@
|
|||||||
F60102D81CBB96BD00EC01BA /* results.cpp in Sources */,
|
F60102D81CBB96BD00EC01BA /* results.cpp in Sources */,
|
||||||
F674784A1CC81F1900F9273C /* platform.cpp in Sources */,
|
F674784A1CC81F1900F9273C /* platform.cpp in Sources */,
|
||||||
F620F0581CB766DA0082977B /* node_init.cpp in Sources */,
|
F620F0581CB766DA0082977B /* node_init.cpp in Sources */,
|
||||||
|
5DC74A791D623CA200D77A4F /* handover.cpp in Sources */,
|
||||||
F60102D91CBB96C100EC01BA /* schema.cpp in Sources */,
|
F60102D91CBB96C100EC01BA /* schema.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -857,6 +873,7 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
02E008D51D10ABB600F3AA37 /* format.cpp in Sources */,
|
02E008D51D10ABB600F3AA37 /* format.cpp in Sources */,
|
||||||
|
5DC74A7A1D623CA800D77A4F /* thread_confined.cpp in Sources */,
|
||||||
02414BA51CE6ABCF00A8669F /* collection_change_builder.cpp in Sources */,
|
02414BA51CE6ABCF00A8669F /* collection_change_builder.cpp in Sources */,
|
||||||
02414BA61CE6ABCF00A8669F /* collection_notifier.cpp in Sources */,
|
02414BA61CE6ABCF00A8669F /* collection_notifier.cpp in Sources */,
|
||||||
F64A059D1D13710C004ACDBE /* thread_id.cpp in Sources */,
|
F64A059D1D13710C004ACDBE /* thread_id.cpp in Sources */,
|
||||||
@ -864,6 +881,7 @@
|
|||||||
02414BA81CE6ABCF00A8669F /* results_notifier.cpp in Sources */,
|
02414BA81CE6ABCF00A8669F /* results_notifier.cpp in Sources */,
|
||||||
02414BA91CE6ABCF00A8669F /* collection_notifications.cpp in Sources */,
|
02414BA91CE6ABCF00A8669F /* collection_notifications.cpp in Sources */,
|
||||||
02F59EE31C88F2BB007F774C /* transact_log_handler.cpp in Sources */,
|
02F59EE31C88F2BB007F774C /* transact_log_handler.cpp in Sources */,
|
||||||
|
5DC74A781D623C9800D77A4F /* handover.cpp in Sources */,
|
||||||
F63FF2E81C159C4B00B3B8E0 /* platform.mm in Sources */,
|
F63FF2E81C159C4B00B3B8E0 /* platform.mm in Sources */,
|
||||||
02F59EC31C88F17D007F774C /* results.cpp in Sources */,
|
02F59EC31C88F17D007F774C /* results.cpp in Sources */,
|
||||||
F63FF2E21C15921A00B3B8E0 /* base64.cpp in Sources */,
|
F63FF2E21C15921A00B3B8E0 /* base64.cpp in Sources */,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "results.hpp"
|
#include "results.hpp"
|
||||||
#include "list.hpp"
|
#include "list.hpp"
|
||||||
|
#include "object_store.hpp"
|
||||||
#include "parser.hpp"
|
#include "parser.hpp"
|
||||||
#include "query_builder.hpp"
|
#include "query_builder.hpp"
|
||||||
|
|
||||||
@ -40,9 +41,9 @@ class Results : public realm::Results {
|
|||||||
|
|
||||||
Results() = default;
|
Results() = default;
|
||||||
Results(SharedRealm r, Table& table) : realm::Results(r, table) {}
|
Results(SharedRealm r, Table& table) : realm::Results(r, table) {}
|
||||||
Results(SharedRealm r, Query q, SortOrder s = {}) : realm::Results(r, q, s) {}
|
Results(SharedRealm r, Query q, SortDescriptor s = {}) : realm::Results(r, q, s) {}
|
||||||
Results(SharedRealm r, TableView tv, SortOrder s) : realm::Results(r, tv, s) {}
|
Results(SharedRealm r, TableView tv, SortDescriptor s) : realm::Results(r, tv, s) {}
|
||||||
Results(SharedRealm r, LinkViewRef lv, util::Optional<Query> q = {}, SortOrder s = {}) : realm::Results(r, lv, q, s) {}
|
Results(SharedRealm r, LinkViewRef lv, util::Optional<Query> q = {}, SortDescriptor s = {}) : realm::Results(r, lv, q, s) {}
|
||||||
|
|
||||||
std::vector<std::pair<Protected<typename T::Function>, NotificationToken>> m_notification_tokens;
|
std::vector<std::pair<Protected<typename T::Function>, NotificationToken>> m_notification_tokens;
|
||||||
};
|
};
|
||||||
@ -169,7 +170,7 @@ typename T::Object ResultsClass<T>::create_sorted(ContextType ctx, const U &coll
|
|||||||
ascending.push_back(argc == 1 ? true : !Value::to_boolean(ctx, arguments[1]));
|
ascending.push_back(argc == 1 ? true : !Value::to_boolean(ctx, arguments[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<size_t> columns;
|
std::vector<std::vector<size_t>> columns;
|
||||||
columns.reserve(prop_count);
|
columns.reserve(prop_count);
|
||||||
|
|
||||||
for (std::string &prop_name : prop_names) {
|
for (std::string &prop_name : prop_names) {
|
||||||
@ -177,10 +178,12 @@ typename T::Object ResultsClass<T>::create_sorted(ContextType ctx, const U &coll
|
|||||||
if (!prop) {
|
if (!prop) {
|
||||||
throw std::runtime_error("Property '" + prop_name + "' does not exist on object type '" + object_schema.name + "'");
|
throw std::runtime_error("Property '" + prop_name + "' does not exist on object type '" + object_schema.name + "'");
|
||||||
}
|
}
|
||||||
columns.push_back(prop->table_column);
|
columns.push_back({prop->table_column});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto results = new realm::js::Results<T>(realm, collection.get_query(), {std::move(columns), std::move(ascending)});
|
auto table = realm::ObjectStore::table_for_object_type(realm->read_group(), object_schema.name);
|
||||||
|
auto results = new realm::js::Results<T>(realm, collection.get_query(),
|
||||||
|
{*table, std::move(columns), std::move(ascending)});
|
||||||
return create_object<T, ResultsClass<T>>(ctx, results);
|
return create_object<T, ResultsClass<T>>(ctx, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,10 @@
|
|||||||
"../object-store/src/results.cpp",
|
"../object-store/src/results.cpp",
|
||||||
"../object-store/src/schema.cpp",
|
"../object-store/src/schema.cpp",
|
||||||
"../object-store/src/shared_realm.cpp",
|
"../object-store/src/shared_realm.cpp",
|
||||||
|
"../object-store/src/thread_confined.cpp",
|
||||||
"../object-store/src/impl/collection_change_builder.cpp",
|
"../object-store/src/impl/collection_change_builder.cpp",
|
||||||
"../object-store/src/impl/collection_notifier.cpp",
|
"../object-store/src/impl/collection_notifier.cpp",
|
||||||
|
"../object-store/src/impl/handover.cpp",
|
||||||
"../object-store/src/impl/list_notifier.cpp",
|
"../object-store/src/impl/list_notifier.cpp",
|
||||||
"../object-store/src/impl/realm_coordinator.cpp",
|
"../object-store/src/impl/realm_coordinator.cpp",
|
||||||
"../object-store/src/impl/results_notifier.cpp",
|
"../object-store/src/impl/results_notifier.cpp",
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c34b3db85d86bf542fb57cd34f393efeac87b929
|
Subproject commit c3e4be6d6cd0bf3e010e169b9793087e60eb52bb
|
@ -50,13 +50,13 @@ module.exports = {
|
|||||||
var prop = schemas.BasicTypes.properties[name];
|
var prop = schemas.BasicTypes.properties[name];
|
||||||
var type = typeof prop == 'object' ? prop.type : prop;
|
var type = typeof prop == 'object' ? prop.type : prop;
|
||||||
|
|
||||||
if (type == Realm.Types.FLOAT || type == Realm.Types.DOUBLE) {
|
if (type == 'float' || type == 'double') {
|
||||||
TestCase.assertEqualWithTolerance(object[name], basicTypesValues[name], 0.000001);
|
TestCase.assertEqualWithTolerance(object[name], basicTypesValues[name], 0.000001);
|
||||||
}
|
}
|
||||||
else if (type == Realm.Types.DATA) {
|
else if (type == 'data') {
|
||||||
TestCase.assertArraysEqual(new Uint8Array(object[name]), RANDOM_DATA);
|
TestCase.assertArraysEqual(new Uint8Array(object[name]), RANDOM_DATA);
|
||||||
}
|
}
|
||||||
else if (type == Realm.Types.DATE) {
|
else if (type == 'date') {
|
||||||
TestCase.assertEqual(object[name].getTime(), basicTypesValues[name].getTime());
|
TestCase.assertEqual(object[name].getTime(), basicTypesValues[name].getTime());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -100,13 +100,13 @@ module.exports = {
|
|||||||
|
|
||||||
TestCase.assertEqual(nullObject[name], null);
|
TestCase.assertEqual(nullObject[name], null);
|
||||||
|
|
||||||
if (type == Realm.Types.FLOAT || type == Realm.Types.DOUBLE) {
|
if (type == 'float' || type == 'double') {
|
||||||
TestCase.assertEqualWithTolerance(object[name], basicTypesValues[name], 0.000001);
|
TestCase.assertEqualWithTolerance(object[name], basicTypesValues[name], 0.000001);
|
||||||
}
|
}
|
||||||
else if (type == Realm.Types.DATA) {
|
else if (type == 'data') {
|
||||||
TestCase.assertArraysEqual(new Uint8Array(object[name]), RANDOM_DATA);
|
TestCase.assertArraysEqual(new Uint8Array(object[name]), RANDOM_DATA);
|
||||||
}
|
}
|
||||||
else if (type == Realm.Types.DATE) {
|
else if (type == 'date') {
|
||||||
TestCase.assertEqual(object[name].getTime(), basicTypesValues[name].getTime());
|
TestCase.assertEqual(object[name].getTime(), basicTypesValues[name].getTime());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -42,9 +42,9 @@ function convertValue(value, schema, type) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
typeConverters[Realm.Types.DATE] = function(value) { return new Date(value); };
|
typeConverters['date'] = function(value) { return new Date(value); };
|
||||||
typeConverters[Realm.Types.DATA] = function(value) { return new Uint8Array(value); };
|
typeConverters['data'] = function(value) { return new Uint8Array(value); };
|
||||||
typeConverters[Realm.Types.OBJECT] = convertValue;
|
typeConverters['object'] = convertValue;
|
||||||
|
|
||||||
function runQuerySuite(suite) {
|
function runQuerySuite(suite) {
|
||||||
var realm = new Realm({schema: suite.schema});
|
var realm = new Realm({schema: suite.schema});
|
||||||
|
@ -116,7 +116,7 @@ module.exports = {
|
|||||||
}, 'The schema should be an array of ObjectSchema objects');
|
}, 'The schema should be an array of ObjectSchema objects');
|
||||||
|
|
||||||
TestCase.assertThrows(function() {
|
TestCase.assertThrows(function() {
|
||||||
new Realm({schema: [{properties: {intCol: Realm.Types.INT}}]});
|
new Realm({schema: [{properties: {intCol: 'int'}}]});
|
||||||
}, 'The schema should be an array of ObjectSchema objects');
|
}, 'The schema should be an array of ObjectSchema objects');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ var Realm = require('realm');
|
|||||||
exports.TestObject = {
|
exports.TestObject = {
|
||||||
name: 'TestObject',
|
name: 'TestObject',
|
||||||
properties: {
|
properties: {
|
||||||
doubleCol: Realm.Types.DOUBLE,
|
doubleCol: 'double',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -31,9 +31,9 @@ function PersonObject() {}
|
|||||||
PersonObject.schema = {
|
PersonObject.schema = {
|
||||||
name: 'PersonObject',
|
name: 'PersonObject',
|
||||||
properties: {
|
properties: {
|
||||||
name: Realm.Types.STRING,
|
name: 'string',
|
||||||
age: Realm.Types.DOUBLE,
|
age: 'double',
|
||||||
married: {type: Realm.Types.BOOL, default: false},
|
married: {type: 'bool', default: false},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
PersonObject.prototype.description = function() {
|
PersonObject.prototype.description = function() {
|
||||||
@ -54,26 +54,26 @@ exports.PersonList = {
|
|||||||
exports.BasicTypes = {
|
exports.BasicTypes = {
|
||||||
name: 'BasicTypesObject',
|
name: 'BasicTypesObject',
|
||||||
properties: {
|
properties: {
|
||||||
boolCol: Realm.Types.BOOL,
|
boolCol: 'bool',
|
||||||
intCol: Realm.Types.INT,
|
intCol: 'int',
|
||||||
floatCol: Realm.Types.FLOAT,
|
floatCol: 'float',
|
||||||
doubleCol: Realm.Types.DOUBLE,
|
doubleCol: 'double',
|
||||||
stringCol: Realm.Types.STRING,
|
stringCol: 'string',
|
||||||
dateCol: Realm.Types.DATE,
|
dateCol: 'date',
|
||||||
dataCol: Realm.Types.DATA,
|
dataCol: 'data',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.NullableBasicTypes = {
|
exports.NullableBasicTypes = {
|
||||||
name: 'NullableBasicTypesObject',
|
name: 'NullableBasicTypesObject',
|
||||||
properties: {
|
properties: {
|
||||||
boolCol: {type: Realm.Types.BOOL, optional: true},
|
boolCol: {type: 'bool', optional: true},
|
||||||
intCol: {type: Realm.Types.INT, optional: true},
|
intCol: {type: 'int', optional: true},
|
||||||
floatCol: {type: Realm.Types.FLOAT, optional: true},
|
floatCol: {type: 'float', optional: true},
|
||||||
doubleCol: {type: Realm.Types.DOUBLE, optional: true},
|
doubleCol: {type: 'double', optional: true},
|
||||||
stringCol: {type: Realm.Types.STRING, optional: true},
|
stringCol: {type: 'string', optional: true},
|
||||||
dateCol: {type: Realm.Types.DATE, optional: true},
|
dateCol: {type: 'date', optional: true},
|
||||||
dataCol: {type: Realm.Types.DATA, optional: true},
|
dataCol: {type: 'data', optional: true},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,8 +92,8 @@ exports.LinkTypes = {
|
|||||||
name: 'LinkTypesObject',
|
name: 'LinkTypesObject',
|
||||||
properties: {
|
properties: {
|
||||||
objectCol: 'TestObject',
|
objectCol: 'TestObject',
|
||||||
objectCol1: {type: Realm.Types.OBJECT, objectType: 'TestObject'},
|
objectCol1: {type: 'object', objectType: 'TestObject'},
|
||||||
arrayCol: {type: Realm.Types.LIST, objectType: 'TestObject'},
|
arrayCol: {type: 'list', objectType: 'TestObject'},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -101,8 +101,8 @@ exports.IntPrimary = {
|
|||||||
name: 'IntPrimaryObject',
|
name: 'IntPrimaryObject',
|
||||||
primaryKey: 'primaryCol',
|
primaryKey: 'primaryCol',
|
||||||
properties: {
|
properties: {
|
||||||
primaryCol: Realm.Types.INT,
|
primaryCol: 'int',
|
||||||
valueCol: Realm.Types.STRING,
|
valueCol: 'string',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ exports.StringPrimary = {
|
|||||||
name: 'StringPrimaryObject',
|
name: 'StringPrimaryObject',
|
||||||
primaryKey: 'primaryCol',
|
primaryKey: 'primaryCol',
|
||||||
properties: {
|
properties: {
|
||||||
primaryCol: Realm.Types.STRING,
|
primaryCol: 'string',
|
||||||
valueCol: Realm.Types.INT,
|
valueCol: 'int',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,64 +119,64 @@ exports.AllTypes = {
|
|||||||
name: 'AllTypesObject',
|
name: 'AllTypesObject',
|
||||||
primaryKey: 'primaryCol',
|
primaryKey: 'primaryCol',
|
||||||
properties: {
|
properties: {
|
||||||
primaryCol: Realm.Types.STRING,
|
primaryCol: 'string',
|
||||||
boolCol: Realm.Types.BOOL,
|
boolCol: 'bool',
|
||||||
intCol: Realm.Types.INT,
|
intCol: 'int',
|
||||||
floatCol: Realm.Types.FLOAT,
|
floatCol: 'float',
|
||||||
doubleCol: Realm.Types.DOUBLE,
|
doubleCol: 'double',
|
||||||
stringCol: Realm.Types.STRING,
|
stringCol: 'string',
|
||||||
dateCol: Realm.Types.DATE,
|
dateCol: 'date',
|
||||||
dataCol: Realm.Types.DATA,
|
dataCol: 'data',
|
||||||
objectCol: 'TestObject',
|
objectCol: 'TestObject',
|
||||||
arrayCol: {type: Realm.Types.LIST, objectType: 'TestObject'},
|
arrayCol: {type: 'list', objectType: 'TestObject'},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.DefaultValues = {
|
exports.DefaultValues = {
|
||||||
name: 'DefaultValuesObject',
|
name: 'DefaultValuesObject',
|
||||||
properties: {
|
properties: {
|
||||||
boolCol: {type: Realm.Types.BOOL, default: true},
|
boolCol: {type: 'bool', default: true},
|
||||||
intCol: {type: Realm.Types.INT, default: -1},
|
intCol: {type: 'int', default: -1},
|
||||||
floatCol: {type: Realm.Types.FLOAT, default: -1.1},
|
floatCol: {type: 'float', default: -1.1},
|
||||||
doubleCol: {type: Realm.Types.DOUBLE, default: -1.11},
|
doubleCol: {type: 'double', default: -1.11},
|
||||||
stringCol: {type: Realm.Types.STRING, default: 'defaultString'},
|
stringCol: {type: 'string', default: 'defaultString'},
|
||||||
dateCol: {type: Realm.Types.DATE, default: new Date(1.111)},
|
dateCol: {type: 'date', default: new Date(1.111)},
|
||||||
dataCol: {type: Realm.Types.DATA, default: new ArrayBuffer(1)},
|
dataCol: {type: 'data', default: new ArrayBuffer(1)},
|
||||||
objectCol: {type: 'TestObject', default: {doubleCol: 1}},
|
objectCol: {type: 'TestObject', default: {doubleCol: 1}},
|
||||||
nullObjectCol: {type: 'TestObject', default: null},
|
nullObjectCol: {type: 'TestObject', default: null},
|
||||||
arrayCol: {type: Realm.Types.LIST, objectType: 'TestObject', default: [{doubleCol: 2}]},
|
arrayCol: {type: 'list', objectType: 'TestObject', default: [{doubleCol: 2}]},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.QueryObject = {
|
exports.QueryObject = {
|
||||||
name: 'QueryObject',
|
name: 'QueryObject',
|
||||||
properties: [
|
properties: [
|
||||||
{name: 'bool1', type: Realm.Types.BOOL},
|
{name: 'bool1', type: 'bool'},
|
||||||
{name: 'bool2', type: Realm.Types.BOOL},
|
{name: 'bool2', type: 'bool'},
|
||||||
{name: 'int1', type: Realm.Types.INT},
|
{name: 'int1', type: 'int'},
|
||||||
{name: 'int2', type: Realm.Types.INT},
|
{name: 'int2', type: 'int'},
|
||||||
{name: 'float1', type: Realm.Types.FLOAT},
|
{name: 'float1', type: 'float'},
|
||||||
{name: 'float2', type: Realm.Types.FLOAT},
|
{name: 'float2', type: 'float'},
|
||||||
{name: 'double1', type: Realm.Types.DOUBLE},
|
{name: 'double1', type: 'double'},
|
||||||
{name: 'double2', type: Realm.Types.DOUBLE},
|
{name: 'double2', type: 'double'},
|
||||||
{name: 'string1', type: Realm.Types.STRING},
|
{name: 'string1', type: 'string'},
|
||||||
{name: 'string2', type: Realm.Types.STRING},
|
{name: 'string2', type: 'string'},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.NullQueryObject = {
|
exports.NullQueryObject = {
|
||||||
name: 'NullQueryObject',
|
name: 'NullQueryObject',
|
||||||
properties: [
|
properties: [
|
||||||
{name: 'bool1', type: Realm.Types.BOOL},
|
{name: 'bool1', type: 'bool'},
|
||||||
{name: 'bool2', type: Realm.Types.BOOL},
|
{name: 'bool2', type: 'bool'},
|
||||||
{name: 'int1', type: Realm.Types.INT},
|
{name: 'int1', type: 'int'},
|
||||||
{name: 'int2', type: Realm.Types.INT},
|
{name: 'int2', type: 'int'},
|
||||||
{name: 'float1', type: Realm.Types.FLOAT},
|
{name: 'float1', type: 'float'},
|
||||||
{name: 'float2', type: Realm.Types.FLOAT},
|
{name: 'float2', type: 'float'},
|
||||||
{name: 'double1', type: Realm.Types.DOUBLE},
|
{name: 'double1', type: 'double'},
|
||||||
{name: 'double2', type: Realm.Types.DOUBLE},
|
{name: 'double2', type: 'double'},
|
||||||
{name: 'string1', type: Realm.Types.STRING},
|
{name: 'string1', type: 'string'},
|
||||||
{name: 'string2', type: Realm.Types.STRING},
|
{name: 'string2', type: 'string'},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "~15.2.0",
|
"react": "~15.2.0",
|
||||||
"react-native": "^0.29.0",
|
"react-native": "^0.31.0",
|
||||||
"react-native-fs": "^1.1.0",
|
"react-native-fs": "^1.1.0",
|
||||||
"xmlbuilder": "^4.2.1",
|
"xmlbuilder": "^4.2.1",
|
||||||
"realm": "file:../..",
|
"realm": "file:../..",
|
||||||
|
8
tests/test-runners/ava/package.json
Normal file
8
tests/test-runners/ava/package.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"test": "ava"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^0.16.0"
|
||||||
|
}
|
||||||
|
}
|
7
tests/test-runners/ava/test.js
Normal file
7
tests/test-runners/ava/test.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import test from 'ava';
|
||||||
|
|
||||||
|
test('can require Realm', t => {
|
||||||
|
var realm = require('realm');
|
||||||
|
t.is('function', typeof realm);
|
||||||
|
t.is('Realm', realm.name);
|
||||||
|
});
|
15
tests/test-runners/jest/package.json
Normal file
15
tests/test-runners/jest/package.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jest-cli": "^13.2.3"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"testEnvironment": "node",
|
||||||
|
"unmockedModulePathPatterns": [
|
||||||
|
"realm"
|
||||||
|
],
|
||||||
|
"testRegex": "test.js"
|
||||||
|
}
|
||||||
|
}
|
7
tests/test-runners/jest/test.js
Normal file
7
tests/test-runners/jest/test.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
describe('Realm', function() {
|
||||||
|
it('should be requirable', function() {
|
||||||
|
var realm = require('realm');
|
||||||
|
expect(typeof realm).toBe('function');
|
||||||
|
expect(realm.name).toBe('Realm');
|
||||||
|
});
|
||||||
|
});
|
8
tests/test-runners/mocha/package.json
Normal file
8
tests/test-runners/mocha/package.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"mocha": "^3.0.2"
|
||||||
|
}
|
||||||
|
}
|
9
tests/test-runners/mocha/test.js
Normal file
9
tests/test-runners/mocha/test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
|
describe('Realm', function() {
|
||||||
|
it('should be requirable', function() {
|
||||||
|
var realm = require('realm');
|
||||||
|
assert.equal(typeof realm, 'function');
|
||||||
|
assert.equal(realm.name, 'Realm');
|
||||||
|
});
|
||||||
|
});
|
1
tests/test-runners/node_modules/realm
generated
vendored
Symbolic link
1
tests/test-runners/node_modules/realm
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../..
|
Loading…
x
Reference in New Issue
Block a user