proper fix/hack removal, partially working sync for rn

This commit is contained in:
Ari Lazier 2016-11-11 17:53:58 -08:00
parent 043d801bb7
commit e4d4cbbdf3
10 changed files with 30 additions and 233 deletions

View File

@ -20,7 +20,7 @@ if (typeof fetch != 'undefined') {
} }
}) })
.then((body) => { .then((body) => {
callback(undefined, {statusCode: 200}, body) callback(undefined, {statusCode: 200}, JSON.parse(body));
}) })
.catch((error) => { .catch((error) => {
callback(error); callback(error);

View File

@ -42,23 +42,8 @@
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 */; };
5D25F5A11D6284FD00EBBB30 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F63FF3301C16434400B3B8E0 /* libz.tbd */; }; 5D25F5A11D6284FD00EBBB30 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F63FF3301C16434400B3B8E0 /* libz.tbd */; };
5DC74A781D623C9800D77A4F /* handover.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DC74A751D623C8700D77A4F /* handover.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 */; }; 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 */; };
F60102D41CBB96AB00EC01BA /* index_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EAF1C88F17D007F774C /* index_set.cpp */; };
F60102D51CBB96AE00EC01BA /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EB11C88F17D007F774C /* list.cpp */; };
F60102D61CBB96B400EC01BA /* object_schema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EB41C88F17D007F774C /* object_schema.cpp */; };
F60102D71CBB96B800EC01BA /* object_store.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EB61C88F17D007F774C /* object_store.cpp */; };
F60102D81CBB96BD00EC01BA /* results.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EB91C88F17D007F774C /* results.cpp */; };
F60102D91CBB96C100EC01BA /* schema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EBB1C88F17D007F774C /* schema.cpp */; };
F60102DA1CBB96C300EC01BA /* shared_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EBD1C88F17D007F774C /* shared_realm.cpp */; };
F60102E01CBB96D900EC01BA /* realm_coordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EDB1C88F2BA007F774C /* realm_coordinator.cpp */; };
F60102E11CBB96DD00EC01BA /* transact_log_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F59EDD1C88F2BB007F774C /* transact_log_handler.cpp */; };
F60102EA1CBCAFC300EC01BA /* node_dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6267BCA1CADC49200AC36B1 /* node_dummy.cpp */; };
F61378791C18EAC5008BFC51 /* js in Resources */ = {isa = PBXBuildFile; fileRef = F61378781C18EAAC008BFC51 /* js */; }; F61378791C18EAC5008BFC51 /* js in Resources */ = {isa = PBXBuildFile; fileRef = F61378781C18EAAC008BFC51 /* js */; };
F620F0581CB766DA0082977B /* node_init.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F620F0571CB766DA0082977B /* node_init.cpp */; };
F620F0751CB9F60C0082977B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F620F0741CB9F60C0082977B /* CoreFoundation.framework */; };
F63FF2C61C12469E00B3B8E0 /* jsc_init.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048011C0428DF00ABDED4 /* jsc_init.cpp */; }; F63FF2C61C12469E00B3B8E0 /* jsc_init.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048011C0428DF00ABDED4 /* jsc_init.cpp */; };
F63FF2C91C12469E00B3B8E0 /* js_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048071C0428DF00ABDED4 /* js_realm.cpp */; }; F63FF2C91C12469E00B3B8E0 /* js_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048071C0428DF00ABDED4 /* js_realm.cpp */; };
F63FF2CD1C12469E00B3B8E0 /* rpc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0290480F1C0428DF00ABDED4 /* rpc.cpp */; }; F63FF2CD1C12469E00B3B8E0 /* rpc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0290480F1C0428DF00ABDED4 /* rpc.cpp */; };
@ -77,14 +62,8 @@
F63FF3251C1642BB00B3B8E0 /* GCDWebServerErrorResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = F63FF3161C1642BB00B3B8E0 /* GCDWebServerErrorResponse.m */; }; F63FF3251C1642BB00B3B8E0 /* GCDWebServerErrorResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = F63FF3161C1642BB00B3B8E0 /* GCDWebServerErrorResponse.m */; };
F63FF3261C1642BB00B3B8E0 /* GCDWebServerFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = F63FF3181C1642BB00B3B8E0 /* GCDWebServerFileResponse.m */; }; F63FF3261C1642BB00B3B8E0 /* GCDWebServerFileResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = F63FF3181C1642BB00B3B8E0 /* GCDWebServerFileResponse.m */; };
F63FF3271C1642BB00B3B8E0 /* GCDWebServerStreamedResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = F63FF31A1C1642BB00B3B8E0 /* GCDWebServerStreamedResponse.m */; }; F63FF3271C1642BB00B3B8E0 /* GCDWebServerStreamedResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = F63FF31A1C1642BB00B3B8E0 /* GCDWebServerStreamedResponse.m */; };
F674784A1CC81F1900F9273C /* platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F67478481CC81F1300F9273C /* platform.cpp */; };
F68A278C1BC2722A0063D40A /* RJSModuleLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = F68A278B1BC2722A0063D40A /* RJSModuleLoader.m */; }; F68A278C1BC2722A0063D40A /* RJSModuleLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = F68A278B1BC2722A0063D40A /* RJSModuleLoader.m */; };
F6BCCFE21C8380A400FE31AE /* lib in Resources */ = {isa = PBXBuildFile; fileRef = F6BCCFDF1C83809A00FE31AE /* lib */; }; F6BCCFE21C8380A400FE31AE /* lib in Resources */ = {isa = PBXBuildFile; fileRef = F6BCCFDF1C83809A00FE31AE /* lib */; };
F6E931BA1CFEAE170016AF14 /* collection_notifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02414B961CE6AADD00A8669F /* collection_notifications.cpp */; };
F6E931BB1CFEAE310016AF14 /* collection_change_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02414B991CE6AAEF00A8669F /* collection_change_builder.cpp */; };
F6E931BC1CFEAE340016AF14 /* collection_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02414B9B1CE6AAEF00A8669F /* collection_notifier.cpp */; };
F6E931BD1CFEAE370016AF14 /* list_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02414B9D1CE6AAEF00A8669F /* list_notifier.cpp */; };
F6E931BE1CFEAE3A0016AF14 /* results_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02414B9F1CE6AAEF00A8669F /* results_notifier.cpp */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
@ -228,7 +207,6 @@
F620F0741CB9F60C0082977B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; }; F620F0741CB9F60C0082977B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; };
F6267BC91CADC30000AC36B1 /* js_util.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = js_util.hpp; sourceTree = "<group>"; }; F6267BC91CADC30000AC36B1 /* js_util.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = js_util.hpp; sourceTree = "<group>"; };
F6267BCA1CADC49200AC36B1 /* node_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_dummy.cpp; sourceTree = "<group>"; }; F6267BCA1CADC49200AC36B1 /* node_dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_dummy.cpp; sourceTree = "<group>"; };
F62BF8FB1CAC71780022BCDC /* libRealmNode.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libRealmNode.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
F63118431CEBA7B700ECB2DE /* external_commit_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = external_commit_helper.cpp; sourceTree = "<group>"; }; F63118431CEBA7B700ECB2DE /* external_commit_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = external_commit_helper.cpp; sourceTree = "<group>"; };
F63118441CEBA7B700ECB2DE /* external_commit_helper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = external_commit_helper.hpp; sourceTree = "<group>"; }; F63118441CEBA7B700ECB2DE /* external_commit_helper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = external_commit_helper.hpp; sourceTree = "<group>"; };
F631184A1CEBA7D800ECB2DE /* external_commit_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = external_commit_helper.cpp; sourceTree = "<group>"; }; F631184A1CEBA7D800ECB2DE /* external_commit_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = external_commit_helper.cpp; sourceTree = "<group>"; };
@ -290,14 +268,6 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
F62BF8F81CAC71780022BCDC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F620F0751CB9F60C0082977B /* CoreFoundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F63FF2ED1C16405C00B3B8E0 /* Frameworks */ = { F63FF2ED1C16405C00B3B8E0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -407,7 +377,6 @@
02B58CBC1AE99CEC009B348C /* RealmJSTests.xctest */, 02B58CBC1AE99CEC009B348C /* RealmJSTests.xctest */,
F63FF2B11C1241E500B3B8E0 /* libRealmJS.a */, F63FF2B11C1241E500B3B8E0 /* libRealmJS.a */,
F63FF2F01C16405C00B3B8E0 /* libGCDWebServers.a */, F63FF2F01C16405C00B3B8E0 /* libGCDWebServers.a */,
F62BF8FB1CAC71780022BCDC /* libRealmNode.dylib */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -722,24 +691,6 @@
productReference = 02B58CBC1AE99CEC009B348C /* RealmJSTests.xctest */; productReference = 02B58CBC1AE99CEC009B348C /* RealmJSTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test"; productType = "com.apple.product-type.bundle.unit-test";
}; };
F62BF8FA1CAC71780022BCDC /* RealmNode */ = {
isa = PBXNativeTarget;
buildConfigurationList = F62BF8FF1CAC71780022BCDC /* Build configuration list for PBXNativeTarget "RealmNode" */;
buildPhases = (
F64A05B71D140311004ACDBE /* Download Core */,
F62BF8F71CAC71780022BCDC /* Sources */,
F62BF8F81CAC71780022BCDC /* Frameworks */,
F63117A41CEA911000ECB2DE /* Build with node-gyp */,
);
buildRules = (
);
dependencies = (
);
name = RealmNode;
productName = RealmNode;
productReference = F62BF8FB1CAC71780022BCDC /* libRealmNode.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
F63FF2B01C1241E500B3B8E0 /* RealmJS */ = { F63FF2B01C1241E500B3B8E0 /* RealmJS */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = F63FF2C41C1241E500B3B8E0 /* Build configuration list for PBXNativeTarget "RealmJS" */; buildConfigurationList = F63FF2C41C1241E500B3B8E0 /* Build configuration list for PBXNativeTarget "RealmJS" */;
@ -785,9 +736,6 @@
02B58CBB1AE99CEC009B348C = { 02B58CBB1AE99CEC009B348C = {
CreatedOnToolsVersion = 6.3.1; CreatedOnToolsVersion = 6.3.1;
}; };
F62BF8FA1CAC71780022BCDC = {
CreatedOnToolsVersion = 7.3;
};
F63FF2B01C1241E500B3B8E0 = { F63FF2B01C1241E500B3B8E0 = {
CreatedOnToolsVersion = 7.1.1; CreatedOnToolsVersion = 7.1.1;
}; };
@ -810,7 +758,6 @@
targets = ( targets = (
F63FF2EF1C16405C00B3B8E0 /* GCDWebServers */, F63FF2EF1C16405C00B3B8E0 /* GCDWebServers */,
F63FF2B01C1241E500B3B8E0 /* RealmJS */, F63FF2B01C1241E500B3B8E0 /* RealmJS */,
F62BF8FA1CAC71780022BCDC /* RealmNode */,
02B58CBB1AE99CEC009B348C /* RealmJSTests */, 02B58CBB1AE99CEC009B348C /* RealmJSTests */,
); );
}; };
@ -845,20 +792,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "cd \"$TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH\"\nyarn add needle url-parse"; shellScript = "cd \"$TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH\"\nyarn add needle url-parse";
}; };
F63117A41CEA911000ECB2DE /* Build with node-gyp */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Build with node-gyp";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "node/build-node.sh \"$CONFIGURATION\"";
};
F63FF2C51C12462600B3B8E0 /* Download Core */ = { F63FF2C51C12462600B3B8E0 /* Download Core */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -873,20 +806,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "../scripts/download-core.sh"; shellScript = "../scripts/download-core.sh";
}; };
F64A05B71D140311004ACDBE /* Download Core */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Download Core";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../scripts/download-core.sh node";
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
@ -900,33 +819,6 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
F62BF8F71CAC71780022BCDC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F6E931BA1CFEAE170016AF14 /* collection_notifications.cpp in Sources */,
F60102D31CBB966E00EC01BA /* js_realm.cpp in Sources */,
F60102D61CBB96B400EC01BA /* object_schema.cpp in Sources */,
F60102D41CBB96AB00EC01BA /* index_set.cpp in Sources */,
F6E931BB1CFEAE310016AF14 /* collection_change_builder.cpp in Sources */,
5DC74A7B1D623CA800D77A4F /* thread_confined.cpp in Sources */,
F60102D51CBB96AE00EC01BA /* list.cpp in Sources */,
F6E931BC1CFEAE340016AF14 /* collection_notifier.cpp in Sources */,
F60102E11CBB96DD00EC01BA /* transact_log_handler.cpp in Sources */,
F6E931BE1CFEAE3A0016AF14 /* results_notifier.cpp in Sources */,
F60102D71CBB96B800EC01BA /* object_store.cpp in Sources */,
F6E931BD1CFEAE370016AF14 /* list_notifier.cpp in Sources */,
F60102DA1CBB96C300EC01BA /* shared_realm.cpp in Sources */,
F60102E01CBB96D900EC01BA /* realm_coordinator.cpp in Sources */,
F60102EA1CBCAFC300EC01BA /* node_dummy.cpp in Sources */,
F60102D81CBB96BD00EC01BA /* results.cpp in Sources */,
F674784A1CC81F1900F9273C /* platform.cpp in Sources */,
F620F0581CB766DA0082977B /* node_init.cpp in Sources */,
5DC74A791D623CA200D77A4F /* handover.cpp in Sources */,
F60102D91CBB96C100EC01BA /* schema.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F63FF2AD1C1241E500B3B8E0 /* Sources */ = { F63FF2AD1C1241E500B3B8E0 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -1144,75 +1036,6 @@
}; };
name = Release; name = Release;
}; };
F62BF8FC1CAC71780022BCDC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 0.14.3;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"REALM_PLATFORM_NODE=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/nan",
/usr/local/include/node,
);
LIBRARY_SEARCH_PATHS = (
/usr/local/lib,
"../core-node",
);
OTHER_CPLUSPLUSFLAGS = (
"$(inherited)",
"-isystem",
"../core-node/include",
);
OTHER_LDFLAGS = (
"-lrealm-node-dbg",
"-luv",
"-lv8",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
name = Debug;
};
F62BF8FE1CAC71780022BCDC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 0.14.3;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"REALM_PLATFORM_NODE=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/nan",
/usr/local/include/node,
);
LIBRARY_SEARCH_PATHS = (
/usr/local/lib,
"../core-node",
);
OTHER_CPLUSPLUSFLAGS = (
"$(inherited)",
"-isystem",
"../core-node/include",
);
OTHER_LDFLAGS = (
"-lrealm-node",
"-luv",
"-lv8",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
name = Release;
};
F63FF2B71C1241E500B3B8E0 /* Debug */ = { F63FF2B71C1241E500B3B8E0 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
@ -1300,15 +1123,6 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
F62BF8FF1CAC71780022BCDC /* Build configuration list for PBXNativeTarget "RealmNode" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F62BF8FC1CAC71780022BCDC /* Debug */,
F62BF8FE1CAC71780022BCDC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F63FF2C41C1241E500B3B8E0 /* Build configuration list for PBXNativeTarget "RealmJS" */ = { F63FF2C41C1241E500B3B8E0 /* Build configuration list for PBXNativeTarget "RealmJS" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (

View File

@ -93,7 +93,7 @@ void remove_realm_files_from_directory(const std::string &directory)
NSString *fileDir = @(directory.c_str()); NSString *fileDir = @(directory.c_str());
for (NSString *path in [manager enumeratorAtPath:fileDir]) { for (NSString *path in [manager enumeratorAtPath:fileDir]) {
if (![path containsString:@".realm"]) { if (![path.pathExtension isEqualToString:@"realm"] && ![path.pathExtension isEqualToString:@"realm.lock"] && ![path.pathExtension isEqualToString:@"realm.management"]) {
continue; continue;
} }
if (![manager removeItemAtPath:[fileDir stringByAppendingPathComponent:path] error:nil]) { if (![manager removeItemAtPath:[fileDir stringByAppendingPathComponent:path] error:nil]) {

View File

@ -148,9 +148,6 @@ class RealmClass : public ClassDefinition<T, SharedRealm, ObservableClass<T>> {
public: public:
static FunctionType create_constructor(ContextType); static FunctionType create_constructor(ContextType);
#if REALM_PLATFORM_NODE
static Global<FunctionType> s_constructor;
#endif
// methods // methods
static void objects(ContextType, ObjectType, size_t, const ValueType[], ReturnValue &); static void objects(ContextType, ObjectType, size_t, const ValueType[], ReturnValue &);
@ -260,11 +257,6 @@ public:
} }
}; };
#if REALM_PLATFORM_NODE
template<typename T>
Global<typename T::Function> RealmClass<T>::s_constructor;
#endif
template<typename T> template<typename T>
inline typename T::Function RealmClass<T>::create_constructor(ContextType ctx) { inline typename T::Function RealmClass<T>::create_constructor(ContextType ctx) {
FunctionType realm_constructor = ObjectWrap<T, RealmClass<T>>::create_constructor(ctx); FunctionType realm_constructor = ObjectWrap<T, RealmClass<T>>::create_constructor(ctx);
@ -284,10 +276,7 @@ inline typename T::Function RealmClass<T>::create_constructor(ContextType ctx) {
Object::set_property(ctx, realm_constructor, "Sync", sync_constructor, attributes); Object::set_property(ctx, realm_constructor, "Sync", sync_constructor, attributes);
#endif #endif
#if REALM_PLATFORM_NODE Object::set_global(ctx, "Realm", realm_constructor);
s_constructor = Global<FunctionType>(ctx, realm_constructor);
#endif
return realm_constructor; return realm_constructor;
} }
@ -404,11 +393,7 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
config.encryption_key = std::vector<char>(encryption_key.begin(), encryption_key.end()); config.encryption_key = std::vector<char>(encryption_key.begin(), encryption_key.end());
} }
#if REALM_ENABLE_SYNC #if REALM_ENABLE_SYNC
#if REALM_PLATFORM_NODE SyncClass<T>::populate_sync_config(ctx, Value::validated_to_object(ctx, Object::get_global(ctx, "Realm")), object, config);
SyncClass<T>::populate_sync_config(ctx, FunctionType(s_constructor), object, config);
#else
SyncClass<T>::populate_sync_config(ctx, Value::validated_to_object(ctx, Object::get_prototype(ctx, this_object)), object, config);
#endif
#endif #endif
} }
} }

View File

@ -170,6 +170,9 @@ struct Object {
static void set_property(ContextType, const ObjectType &, uint32_t, const ValueType &); static void set_property(ContextType, const ObjectType &, uint32_t, const ValueType &);
static std::vector<String<T>> get_property_names(ContextType, const ObjectType &); static std::vector<String<T>> get_property_names(ContextType, const ObjectType &);
static void set_global(ContextType, const String<T> &, const ValueType &);
static ValueType get_global(ContextType, const String<T> &);
template<typename P> template<typename P>
static ValueType validated_get_property(ContextType ctx, const ObjectType &object, const P &property, const char *message = nullptr) { static ValueType validated_get_property(ContextType ctx, const ObjectType &object, const P &property, const char *message = nullptr) {
if (!has_property(ctx, object, property)) { if (!has_property(ctx, object, property)) {
@ -258,11 +261,6 @@ class Protected {
}; };
}; };
template<typename ValueType>
class Global {
operator ValueType() const;
};
template<typename T> template<typename T>
struct Exception : public std::runtime_error { struct Exception : public std::runtime_error {
using ContextType = typename T::Context; using ContextType = typename T::Context;

View File

@ -26,7 +26,6 @@ extern "C" {
JSObjectRef RJSConstructorCreate(JSContextRef ctx); JSObjectRef RJSConstructorCreate(JSContextRef ctx);
void RJSInitializeInContext(JSContextRef ctx); void RJSInitializeInContext(JSContextRef ctx);
void RJSClearTestState(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -143,5 +143,17 @@ inline void jsc::Object::set_internal(const JSObjectRef &object, typename ClassT
*wrap = ptr; *wrap = ptr;
} }
template<>
inline void jsc::Object::set_global(JSContextRef ctx, const jsc::String &key, const JSValueRef &value) {
JSObjectRef global_object = JSContextGetGlobalObject(ctx);
jsc::Object::set_property(ctx, global_object, key, value, js::ReadOnly | js::DontEnum | js::DontDelete);
}
template<>
inline JSValueRef jsc::Object::get_global(JSContextRef ctx, const jsc::String &key) {
JSObjectRef global_object = JSContextGetGlobalObject(ctx);
return jsc::Object::get_property(ctx, global_object, key);
}
} // js } // js
} // realm } // realm

View File

@ -119,12 +119,5 @@ class Protected<JSObjectRef> : public Protected<JSValueRef> {
} }
}; };
template<>
class Global<JSObjectRef> : public Protected<JSObjectRef> {
public:
Global() : Protected<JSObjectRef>() {}
Global(JSContextRef ctx, JSObjectRef value) : Protected<JSObjectRef>(ctx, value) {}
};
} // js } // js
} // realm } // realm

View File

@ -154,6 +154,16 @@ inline void node::Object::set_internal(const v8::Local<v8::Object> &object, type
auto wrap = Nan::ObjectWrap::Unwrap<node::ObjectWrap<ClassType>>(object); auto wrap = Nan::ObjectWrap::Unwrap<node::ObjectWrap<ClassType>>(object);
*wrap = ptr; *wrap = ptr;
} }
template<>
inline void node::Object::set_global(v8::Isolate* isolate, const node::String &key, const v8::Local<v8::Value> &value) {
Object::set_property(isolate, isolate->GetCurrentContext()->Global(), key, value);
}
template<>
inline v8::Local<v8::Value> node::Object::get_global(v8::Isolate* isolate, const node::String &key) {
return Object::get_property(isolate, isolate->GetCurrentContext()->Global(), key);
}
} // js } // js
} // realm } // realm

View File

@ -102,19 +102,5 @@ struct GlobalCopyablePersistentTraits {
static inline void Copy(const v8::Persistent<S, M> &source, CopyablePersistent *dest) {} static inline void Copy(const v8::Persistent<S, M> &source, CopyablePersistent *dest) {}
}; };
template<>
class Global<node::Types::Function> {
// TODO: Figure out why Nan::CopyablePersistentTraits causes a build failure.
Nan::Persistent<v8::Function, GlobalCopyablePersistentTraits<v8::Function>> m_value;
public:
Global() {}
Global(v8::Isolate* isolate, v8::Local<v8::Function> value) : m_value(value) {}
operator v8::Local<v8::Function>() const {
return Nan::New(m_value);
}
};
} // js } // js
} // realm } // realm