harperdb 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -11
- package/bin/BinObjects.jsc +0 -0
- package/bin/harperdb.jsc +0 -0
- package/bin/install.jsc +0 -0
- package/bin/register.jsc +0 -0
- package/bin/run.jsc +0 -0
- package/bin/stop.jsc +0 -0
- package/bin/upgrade.jsc +0 -0
- package/bin/utility.jsc +0 -0
- package/bin/version.jsc +0 -0
- package/coverage/lcov.info +6624 -6141
- package/data_layer/CreateAttributeObject.jsc +0 -0
- package/data_layer/CreateTableObject.jsc +0 -0
- package/data_layer/DataLayerObjects.jsc +0 -0
- package/data_layer/DeleteBeforeObject.jsc +0 -0
- package/data_layer/DeleteObject.jsc +0 -0
- package/data_layer/DropAttributeObject.jsc +0 -0
- package/data_layer/InsertObject.jsc +0 -0
- package/data_layer/ReadTransactionLogObject.jsc +0 -0
- package/data_layer/SQLSearch.jsc +0 -0
- package/data_layer/SearchByConditionsObject.jsc +0 -0
- package/data_layer/SearchByHashObject.jsc +0 -0
- package/data_layer/SearchObject.jsc +0 -0
- package/data_layer/SqlSearchObject.jsc +0 -0
- package/data_layer/UpdateObject.jsc +0 -0
- package/data_layer/UpsertObject.jsc +0 -0
- package/data_layer/bulkLoad.jsc +0 -0
- package/data_layer/data_objects/BulkLoadObjects.jsc +0 -0
- package/data_layer/data_objects/UpsertObject.jsc +0 -0
- package/data_layer/delete.jsc +0 -0
- package/data_layer/export.jsc +0 -0
- package/data_layer/harperBridge/BridgeMethods.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/checkForNewAttr.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/convertOperationToTransaction.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/evaluateTableGetAttributes.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/insertUpdateReturnObj.jsc +0 -0
- package/data_layer/harperBridge/bridgeUtility/insertUpdateValidate.jsc +0 -0
- package/data_layer/harperBridge/harperBridge.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/LMDBBridge.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/DeleteTransactionsBeforeResults.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecordsBefore.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteTransactionLogsBefore.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadTransactionLog.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/ThreadSearchObject.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsEnvironment.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbDropAllAttributes.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbThreadSearch.jsc +0 -0
- package/data_layer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.jsc +0 -0
- package/data_layer/hdbInfoController.jsc +0 -0
- package/data_layer/insert.jsc +0 -0
- package/data_layer/readTransactionLog.jsc +0 -0
- package/data_layer/schema.jsc +0 -0
- package/data_layer/schemaDescribe.jsc +0 -0
- package/data_layer/search.jsc +0 -0
- package/data_layer/update.jsc +0 -0
- package/events/ClusterStatusEmitter.jsc +0 -0
- package/events/SioServerStoppedEvent.jsc +0 -0
- package/events/SocketClusterStatusEmitter.jsc +0 -0
- package/license/LICENSE +91 -1
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/README.md +1 -0
- package/node_modules/{node-addon-api/src/nothing.c → @msgpackr-extract/msgpackr-extract-linux-x64/index.js} +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.abi93.glibc.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.abi93.musl.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.napi.glibc.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/node.napi.musl.node +0 -0
- package/node_modules/@msgpackr-extract/msgpackr-extract-linux-x64/package.json +53 -0
- package/node_modules/{msgpackr-extract → lmdb-store}/.github/workflows/prebuild.yml +9 -10
- package/node_modules/lmdb-store/.idea/lmdb-store.iml +12 -0
- package/node_modules/lmdb-store/.idea/misc.xml +6 -0
- package/node_modules/lmdb-store/.idea/modules.xml +8 -0
- package/node_modules/lmdb-store/.idea/workspace.xml +4 -0
- package/node_modules/lmdb-store/README.md +393 -388
- package/node_modules/lmdb-store/benchmark/index.js +162 -162
- package/node_modules/lmdb-store/binding.gyp +79 -88
- package/node_modules/lmdb-store/caching.js +113 -113
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/COPYRIGHT +20 -20
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/Doxyfile +1631 -1631
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/LICENSE +47 -47
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.c +183 -183
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.h +14 -14
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/crypto.c +121 -121
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/intro.doc +192 -192
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.c +12125 -12125
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_copy.1 +74 -74
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_copy.c +106 -106
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_drop.1 +53 -53
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_drop.c +154 -154
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_dump.1 +94 -94
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_dump.c +333 -333
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_load.1 +97 -97
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_load.c +530 -530
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_stat.1 +83 -83
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb_stat.c +276 -276
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.c +452 -452
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.h +208 -208
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/module.c +101 -101
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/module.h +16 -16
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest.c +178 -178
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest2.c +124 -124
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest3.c +133 -133
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest4.c +168 -168
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest5.c +135 -135
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest6.c +141 -141
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_enc.c +190 -190
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_enc2.c +189 -189
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/mtest_remap.c +177 -177
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/sample-bdb.txt +73 -73
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/sample-mdb.txt +62 -62
- package/node_modules/lmdb-store/dependencies/lmdb/libraries/liblmdb/tooltag +27 -27
- package/node_modules/lmdb-store/dependencies/lz4/LICENSE +11 -11
- package/node_modules/lmdb-store/dependencies/lz4/lib/README.md +137 -137
- package/node_modules/lmdb-store/dependencies/lz4/lib/dll/example/README.md +69 -69
- package/node_modules/lmdb-store/dependencies/lz4/lib/lz4frame.c +1899 -1899
- package/node_modules/lmdb-store/dependencies/lz4/lib/xxhash.c +1030 -1030
- package/node_modules/lmdb-store/dependencies/lz4/lib/xxhash.h +328 -328
- package/node_modules/lmdb-store/dist/index.cjs +2591 -0
- package/node_modules/lmdb-store/dist/index.cjs.map +1 -0
- package/node_modules/lmdb-store/index.d.ts +323 -323
- package/node_modules/lmdb-store/index.js +1274 -1274
- package/node_modules/lmdb-store/index.mjs +3 -3
- package/node_modules/lmdb-store/package.json +16 -11
- package/node_modules/lmdb-store/prebuilds/darwin-arm64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-arm64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-arm64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-arm64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-arm64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-arm64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi83.musl.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi93.musl.node +0 -0
- package/node_modules/lmdb-store/prebuilds/linux-x64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/electron.abi98.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi83.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi93.node +0 -0
- package/node_modules/lmdb-store/src/compression.cpp +181 -181
- package/node_modules/lmdb-store/src/cursor.cpp +407 -407
- package/node_modules/lmdb-store/src/dbi.cpp +354 -354
- package/node_modules/lmdb-store/src/env.cpp +1134 -1134
- package/node_modules/lmdb-store/src/misc.cpp +528 -528
- package/node_modules/lmdb-store/src/node-lmdb.cpp +44 -44
- package/node_modules/lmdb-store/src/node-lmdb.h +965 -965
- package/node_modules/lmdb-store/src/ordered-binary.cpp +337 -337
- package/node_modules/lmdb-store/src/txn.cpp +513 -513
- package/node_modules/lmdb-store/src/v8-fast-api-calls.h +419 -419
- package/node_modules/lmdb-store/src/windows.c +30 -30
- package/node_modules/lmdb-store/test/index.test.js +584 -584
- package/node_modules/lmdb-store/test/node-lmdb.test.js +1525 -1525
- package/node_modules/lmdb-store/test/threads.js +100 -100
- package/node_modules/lmdb-store/util/ArrayLikeIterable.js +136 -136
- package/node_modules/lmdb-store/util/WeakValueMap.js +40 -40
- package/node_modules/lmdb-store/util/upgrade-lmdb.js +46 -46
- package/node_modules/lmdb-store/util/when.js +8 -8
- package/node_modules/microtime/.github/workflows/release.yml +76 -0
- package/node_modules/microtime/.github/workflows/test.yml +46 -0
- package/node_modules/microtime/README.md +0 -2
- package/node_modules/microtime/binding.gyp +28 -10
- package/node_modules/microtime/package.json +25 -20
- package/node_modules/microtime/prebuilds/darwin-x64+arm64/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm/node.napi.armv7.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/node.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-ia32/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-ia32/node.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/electron.napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/node.napi.node +0 -0
- package/node_modules/msgpackr/dist/index.js +1929 -1917
- package/node_modules/msgpackr/dist/index.min.js +67 -68
- package/node_modules/msgpackr/dist/node.cjs +1994 -1980
- package/node_modules/msgpackr/dist/test.js +683 -1235
- package/node_modules/msgpackr/index.d.ts +23 -12
- package/node_modules/msgpackr/node-index.js +23 -21
- package/node_modules/msgpackr/pack.js +935 -931
- package/node_modules/msgpackr/package.json +24 -12
- package/node_modules/msgpackr/unpack.d.ts +52 -50
- package/node_modules/msgpackr/unpack.js +1061 -1053
- package/node_modules/msgpackr-extract/bin/download-prebuilds.js +11 -0
- package/node_modules/msgpackr-extract/binding.gyp +22 -5
- package/node_modules/msgpackr-extract/index.js +1 -1
- package/node_modules/msgpackr-extract/package.json +46 -21
- package/node_modules/msgpackr-extract/src/.vs/ProjectSettings.json +3 -0
- package/node_modules/msgpackr-extract/src/.vs/VSWorkspaceState.json +7 -0
- package/node_modules/msgpackr-extract/src/.vs/slnx.sqlite +0 -0
- package/node_modules/msgpackr-extract/src/.vs/src/v16/.suo +0 -0
- package/node_modules/msgpackr-extract/src/.vs/src/v16/Browse.VC.db +0 -0
- package/node_modules/msgpackr-extract/{prebuilds/darwin-x64/node.abi72.node → src/.vs/src/v16/Browse.VC.db-shm} +0 -0
- package/node_modules/msgpackr-extract/src/.vs/src/v16/Browse.VC.db-wal +0 -0
- package/node_modules/msgpackr-extract/src/extract.cpp +272 -269
- package/node_modules/nan/package.json +0 -1
- package/node_modules/node-addon-api/README.md +146 -53
- package/node_modules/node-addon-api/common.gypi +21 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +7 -41
- package/node_modules/node-addon-api/napi-inl.deprecated.h +8 -8
- package/node_modules/node-addon-api/napi-inl.h +2795 -633
- package/node_modules/node-addon-api/napi.h +1547 -597
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +203 -13
- package/node_modules/node-addon-api/tools/README.md +12 -6
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +4 -8
- package/node_modules/node-addon-api/tools/eslint-format.js +71 -0
- package/node_modules/node-gyp-build/README.md +17 -14
- package/node_modules/node-gyp-build/bin.js +28 -15
- package/node_modules/node-gyp-build/index.js +145 -34
- package/node_modules/node-gyp-build/package.json +18 -15
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/LICENSE +0 -0
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/README.md +0 -0
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/bin.js +1 -1
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/build-test.js +0 -0
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/index.js +17 -11
- package/node_modules/{lmdb-store/node_modules/node-gyp-build → node-gyp-build-optional-packages}/optional.js +0 -0
- package/node_modules/{msgpackr-extract/node_modules/node-gyp-build → node-gyp-build-optional-packages}/package.json +17 -17
- package/package.json +12 -11
- package/security/JWTObjects.jsc +0 -0
- package/security/auth.jsc +0 -0
- package/security/cryptoHash.jsc +0 -0
- package/security/data_objects/PermissionAttributeResponseObject.jsc +0 -0
- package/security/data_objects/PermissionResponseObject.jsc +0 -0
- package/security/data_objects/PermissionTableResponseObject.jsc +0 -0
- package/security/permissionsTranslator.jsc +0 -0
- package/security/role.jsc +0 -0
- package/security/tokenAuthentication.jsc +0 -0
- package/security/user.jsc +0 -0
- package/server/ClusteringOriginObject.jsc +0 -0
- package/server/JobObject.jsc +0 -0
- package/server/clustering/ClusterStatusObject.jsc +0 -0
- package/server/clustering/NodeObject.jsc +0 -0
- package/server/clustering/clusterUtilities.jsc +0 -0
- package/server/configuration.jsc +0 -0
- package/server/customFunctions/customFunctionsServer.jsc +0 -0
- package/server/customFunctions/helpers/getCORSOptions.jsc +0 -0
- package/server/customFunctions/helpers/getHeaderTimeoutConfig.jsc +0 -0
- package/server/customFunctions/helpers/getServerOptions.jsc +0 -0
- package/server/customFunctions/operations.jsc +0 -0
- package/server/customFunctions/operationsValidation.jsc +0 -0
- package/server/harperdb/hdbServer.jsc +0 -0
- package/server/ipc/IPCClient.jsc +0 -0
- package/server/ipc/hdbIpcServer.jsc +0 -0
- package/server/ipc/serverHandlers.jsc +0 -0
- package/server/ipc/utility/IPCEventObject.jsc +0 -0
- package/server/ipc/utility/ipcUtils.jsc +0 -0
- package/server/jobRunner.jsc +0 -0
- package/server/jobThread.jsc +0 -0
- package/server/jobs.jsc +0 -0
- package/server/serverHelpers/OperationFunctionObject.jsc +0 -0
- package/server/serverHelpers/requestTimePlugin.jsc +0 -0
- package/server/serverHelpers/serverHandlers.jsc +0 -0
- package/server/serverHelpers/serverUtilities.jsc +0 -0
- package/server/socketcluster/Server.jsc +0 -0
- package/server/socketcluster/broker.jsc +0 -0
- package/server/socketcluster/connector/HDBSocketConnector.jsc +0 -0
- package/server/socketcluster/connector/InterNodeSocketConnector.jsc +0 -0
- package/server/socketcluster/connector/SocketConnector.jsc +0 -0
- package/server/socketcluster/connector/spawnSCConnection.jsc +0 -0
- package/server/socketcluster/decisionMatrix/CoreDecisionMatrix.jsc +0 -0
- package/server/socketcluster/decisionMatrix/DecisionMatrixIF.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/AssignToHdbChildWorkerRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/CallRoomMsgHandlerRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/CleanDataObjectRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/CommandCollection.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/DummyRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/RulesIF.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/StripHdbHeaderRule.jsc +0 -0
- package/server/socketcluster/decisionMatrix/rules/TestRule.jsc +0 -0
- package/server/socketcluster/handlers/NodeConnectionsHandler.jsc +0 -0
- package/server/socketcluster/handlers/SCServer.jsc +0 -0
- package/server/socketcluster/handlers/ServerSocket.jsc +0 -0
- package/server/socketcluster/interNodeConnectionLauncher.jsc +0 -0
- package/server/socketcluster/messageQueue/MessageQueueIF.jsc +0 -0
- package/server/socketcluster/middleware/AuthMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/ConnectionNameCheckMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/GenericMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/MessagePrepMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/MiddlewareFactory.jsc +0 -0
- package/server/socketcluster/middleware/MiddlewareIF.jsc +0 -0
- package/server/socketcluster/middleware/OriginatorCheckMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/RequestDataValidMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/StampOriginatorMiddleware.jsc +0 -0
- package/server/socketcluster/middleware/StampRequestMiddleware.jsc +0 -0
- package/server/socketcluster/observer/EventableIF.jsc +0 -0
- package/server/socketcluster/room/AddUserRoom.jsc +0 -0
- package/server/socketcluster/room/AlterUserRoom.jsc +0 -0
- package/server/socketcluster/room/CoreRoom.jsc +0 -0
- package/server/socketcluster/room/CreateAttributeRoom.jsc +0 -0
- package/server/socketcluster/room/CreateSchemaRoom.jsc +0 -0
- package/server/socketcluster/room/CreateTableRoom.jsc +0 -0
- package/server/socketcluster/room/DropUserRoom.jsc +0 -0
- package/server/socketcluster/room/HDBNodeRoom.jsc +0 -0
- package/server/socketcluster/room/RoomIF.jsc +0 -0
- package/server/socketcluster/room/RoomMessageObjects.jsc +0 -0
- package/server/socketcluster/room/UsersRoom.jsc +0 -0
- package/server/socketcluster/room/WatchHDBWorkersRoom.jsc +0 -0
- package/server/socketcluster/room/WorkerRoom.jsc +0 -0
- package/server/socketcluster/room/roomFactory.jsc +0 -0
- package/server/socketcluster/socketClusterObjects.jsc +0 -0
- package/server/socketcluster/types.jsc +0 -0
- package/server/socketcluster/util/clusterData.jsc +0 -0
- package/server/socketcluster/util/socketClusterUtils.jsc +0 -0
- package/server/socketcluster/worker/ClusterWorker.jsc +0 -0
- package/server/socketcluster/worker/WorkerIF.jsc +0 -0
- package/server/socketcluster/worker/WorkerObjects.jsc +0 -0
- package/server/transactToClusteringUtilities.jsc +0 -0
- package/sqlTranslator/SelectValidator.jsc +0 -0
- package/sqlTranslator/alasqlFunctionImporter.jsc +0 -0
- package/sqlTranslator/conditionPatterns.jsc +0 -0
- package/sqlTranslator/deleteTranslator.jsc +0 -0
- package/sqlTranslator/index.jsc +0 -0
- package/sqlTranslator/sql_statement_bucket.jsc +0 -0
- package/upgrade/EnvironmentVariable.jsc +0 -0
- package/upgrade/UpgradeDirective.jsc +0 -0
- package/upgrade/UpgradeObjects.jsc +0 -0
- package/upgrade/directives/3-0-0.jsc +0 -0
- package/upgrade/directives/3-1-0.jsc +0 -0
- package/upgrade/directives/directivesController.jsc +0 -0
- package/upgrade/directives/upgrade_scripts/3_0_0_reindex_script.jsc +0 -0
- package/upgrade/directivesManager.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/DBIDefinition.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/OpenDBIObject.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/OpenEnvironmentObject.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/commonErrors.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/commonUtility.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/environmentUtility.jsc +0 -0
- package/upgrade/lmdb/nodeLMDB/terms.jsc +0 -0
- package/upgrade/upgradePrompt.jsc +0 -0
- package/upgrade/upgradeUtilities.jsc +0 -0
- package/utility/AWS/AWSConnector.jsc +0 -0
- package/utility/OperationFunctionCaller.jsc +0 -0
- package/utility/common_utils.jsc +0 -0
- package/utility/environment/SystemInformationObject.jsc +0 -0
- package/utility/environment/SystemInformationOperation.jsc +0 -0
- package/utility/environment/environmentManager.jsc +0 -0
- package/utility/environment/systemInformation.jsc +0 -0
- package/utility/errors/commonErrors.jsc +0 -0
- package/utility/errors/hdbError.jsc +0 -0
- package/utility/functions/date/dateFunctions.jsc +0 -0
- package/utility/functions/geo.jsc +0 -0
- package/utility/functions/math/avg.jsc +0 -0
- package/utility/functions/math/count.jsc +0 -0
- package/utility/functions/sql/alaSQLExtension.jsc +0 -0
- package/utility/functions/string/compare.jsc +0 -0
- package/utility/globalSchema.jsc +0 -0
- package/utility/hdbTerms.jsc +0 -0
- package/utility/install/checkJWTTokensExist.jsc +0 -0
- package/utility/install/installer.jsc +0 -0
- package/utility/install_user_permission.jsc +0 -0
- package/utility/lmdb/DBIDefinition.jsc +0 -0
- package/utility/lmdb/DeleteRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/InsertRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/OpenDBIObject.jsc +0 -0
- package/utility/lmdb/OpenEnvironmentObject.jsc +0 -0
- package/utility/lmdb/UpdateRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/UpsertRecordsResponseObject.jsc +0 -0
- package/utility/lmdb/cleanLMDBMap.jsc +0 -0
- package/utility/lmdb/commonUtility.jsc +0 -0
- package/utility/lmdb/deleteUtility.jsc +0 -0
- package/utility/lmdb/environmentUtility.jsc +0 -0
- package/utility/lmdb/searchCursorFunctions.jsc +0 -0
- package/utility/lmdb/searchUtility.jsc +0 -0
- package/utility/lmdb/terms.jsc +0 -0
- package/utility/lmdb/writeUtility.jsc +0 -0
- package/utility/logging/harper_logger.jsc +0 -0
- package/utility/mount_hdb.jsc +0 -0
- package/utility/npmUtilities.jsc +0 -0
- package/utility/operation_authorization.jsc +0 -0
- package/utility/password.jsc +0 -0
- package/utility/pm2/servicesConfig.jsc +0 -0
- package/utility/pm2/utilityFunctions.jsc +0 -0
- package/utility/psList.jsc +0 -0
- package/utility/registration/hdb_license.jsc +0 -0
- package/utility/registration/licenseObjects.jsc +0 -0
- package/utility/registration/registrationHandler.jsc +0 -0
- package/utility/scripts/restartHdb.jsc +0 -0
- package/utility/signalling.jsc +0 -0
- package/utility/system_info.jsc +0 -0
- package/validation/bulkDeleteValidator.jsc +0 -0
- package/validation/check_permissions.jsc +0 -0
- package/validation/clustering/configureValidator.jsc +0 -0
- package/validation/common_validators.jsc +0 -0
- package/validation/conditionalDeleteValidator.jsc +0 -0
- package/validation/deleteValidator.jsc +0 -0
- package/validation/fileLoadValidator.jsc +0 -0
- package/validation/insertValidator.jsc +0 -0
- package/validation/nodeSubscriptionValidator.jsc +0 -0
- package/validation/nodeValidator.jsc +0 -0
- package/validation/readLogValidator.jsc +0 -0
- package/validation/registration/license_key_object.jsc +0 -0
- package/validation/role_validation.jsc +0 -0
- package/validation/schemaMetadataValidator.jsc +0 -0
- package/validation/schema_validator.jsc +0 -0
- package/validation/searchValidator.jsc +0 -0
- package/validation/user_validation.jsc +0 -0
- package/validation/validationWrapper.jsc +0 -0
- package/node_modules/lmdb-store/build/Makefile +0 -324
- package/node_modules/lmdb-store/build/Release/.deps/Release/lmdb-store.node.d +0 -1
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.o.d +0 -6
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.o.d +0 -8
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.o.d +0 -8
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/dependencies/lz4/lib/lz4.o.d +0 -5
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/compression.o.d +0 -72
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/cursor.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/dbi.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/env.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/misc.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/node-lmdb.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/ordered-binary.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/txn.o.d +0 -73
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store/src/windows.o.d +0 -3
- package/node_modules/lmdb-store/build/Release/.deps/Release/obj.target/lmdb-store.node.d +0 -1
- package/node_modules/lmdb-store/build/Release/lmdb-store.node +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/chacha8.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/mdb.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lmdb/libraries/liblmdb/midl.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/dependencies/lz4/lib/lz4.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/compression.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/cursor.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/dbi.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/env.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/misc.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/node-lmdb.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/ordered-binary.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/txn.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store/src/windows.o +0 -0
- package/node_modules/lmdb-store/build/Release/obj.target/lmdb-store.node +0 -0
- package/node_modules/lmdb-store/build/binding.Makefile +0 -6
- package/node_modules/lmdb-store/build/config.gypi +0 -426
- package/node_modules/lmdb-store/build/lmdb-store.target.mk +0 -206
- package/node_modules/lmdb-store/node_modules/node-gyp-build/package.json +0 -60
- package/node_modules/lmdb-store/prebuilds/darwin-x64/electron.abi87.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi72.node +0 -0
- package/node_modules/lmdb-store/prebuilds/darwin-x64/node.abi88.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/electron.abi87.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi72.node +0 -0
- package/node_modules/lmdb-store/prebuilds/win32-x64/node.abi88.node +0 -0
- package/node_modules/microtime/prebuilds/darwin-x64/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/darwin-x64/node-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-arm/node-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/linux-x64/node-napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/electron-napi.node +0 -0
- package/node_modules/microtime/prebuilds/win32-x64/node-napi.node +0 -0
- package/node_modules/msgpackr-extract/.circleci/config.yml +0 -19
- package/node_modules/msgpackr-extract/.travis.yml +0 -30
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/LICENSE +0 -21
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/README.md +0 -58
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/bin.js +0 -77
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/build-test.js +0 -19
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/index.js +0 -202
- package/node_modules/msgpackr-extract/node_modules/node-gyp-build/optional.js +0 -7
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-arm64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi88.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/darwin-x64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-arm64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi102.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi72.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi72.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi83.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi88.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi93.musl.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/linux-x64/node.abi93.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/electron.abi98.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi102.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi72.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi83.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi88.node +0 -0
- package/node_modules/msgpackr-extract/prebuilds/win32-x64/node.abi93.node +0 -0
- package/node_modules/node-addon-api/.editorconfig +0 -8
- package/node_modules/node-addon-api/.travis.yml +0 -65
- package/node_modules/node-addon-api/CHANGELOG.md +0 -325
- package/node_modules/node-addon-api/CODE_OF_CONDUCT.md +0 -4
- package/node_modules/node-addon-api/CONTRIBUTING.md +0 -66
- package/node_modules/node-addon-api/appveyor.yml +0 -48
- package/node_modules/node-addon-api/doc/Doxyfile +0 -2450
- package/node_modules/node-addon-api/doc/array_buffer.md +0 -129
- package/node_modules/node-addon-api/doc/async_context.md +0 -76
- package/node_modules/node-addon-api/doc/async_operations.md +0 -31
- package/node_modules/node-addon-api/doc/async_worker.md +0 -397
- package/node_modules/node-addon-api/doc/basic_types.md +0 -415
- package/node_modules/node-addon-api/doc/bigint.md +0 -92
- package/node_modules/node-addon-api/doc/boolean.md +0 -64
- package/node_modules/node-addon-api/doc/buffer.md +0 -140
- package/node_modules/node-addon-api/doc/callback_scope.md +0 -54
- package/node_modules/node-addon-api/doc/callbackinfo.md +0 -97
- package/node_modules/node-addon-api/doc/checker-tool.md +0 -32
- package/node_modules/node-addon-api/doc/class_property_descriptor.md +0 -118
- package/node_modules/node-addon-api/doc/cmake-js.md +0 -19
- package/node_modules/node-addon-api/doc/conversion-tool.md +0 -28
- package/node_modules/node-addon-api/doc/creating_a_release.md +0 -62
- package/node_modules/node-addon-api/doc/dataview.md +0 -244
- package/node_modules/node-addon-api/doc/env.md +0 -63
- package/node_modules/node-addon-api/doc/error.md +0 -115
- package/node_modules/node-addon-api/doc/error_handling.md +0 -186
- package/node_modules/node-addon-api/doc/escapable_handle_scope.md +0 -82
- package/node_modules/node-addon-api/doc/external.md +0 -59
- package/node_modules/node-addon-api/doc/function.md +0 -294
- package/node_modules/node-addon-api/doc/function_reference.md +0 -238
- package/node_modules/node-addon-api/doc/generator.md +0 -13
- package/node_modules/node-addon-api/doc/handle_scope.md +0 -65
- package/node_modules/node-addon-api/doc/memory_management.md +0 -27
- package/node_modules/node-addon-api/doc/node-gyp.md +0 -82
- package/node_modules/node-addon-api/doc/number.md +0 -163
- package/node_modules/node-addon-api/doc/object.md +0 -202
- package/node_modules/node-addon-api/doc/object_lifetime_management.md +0 -83
- package/node_modules/node-addon-api/doc/object_reference.md +0 -117
- package/node_modules/node-addon-api/doc/object_wrap.md +0 -546
- package/node_modules/node-addon-api/doc/prebuild_tools.md +0 -16
- package/node_modules/node-addon-api/doc/promises.md +0 -74
- package/node_modules/node-addon-api/doc/property_descriptor.md +0 -231
- package/node_modules/node-addon-api/doc/range_error.md +0 -59
- package/node_modules/node-addon-api/doc/reference.md +0 -111
- package/node_modules/node-addon-api/doc/setup.md +0 -82
- package/node_modules/node-addon-api/doc/string.md +0 -89
- package/node_modules/node-addon-api/doc/symbol.md +0 -44
- package/node_modules/node-addon-api/doc/threadsafe_function.md +0 -303
- package/node_modules/node-addon-api/doc/type_error.md +0 -59
- package/node_modules/node-addon-api/doc/typed_array.md +0 -74
- package/node_modules/node-addon-api/doc/typed_array_of.md +0 -133
- package/node_modules/node-addon-api/doc/value.md +0 -269
- package/node_modules/node-addon-api/doc/version_management.md +0 -43
- package/node_modules/node-addon-api/doc/working_with_javascript_values.md +0 -14
- package/node_modules/node-addon-api/external-napi/node_api.h +0 -7
- package/node_modules/node-addon-api/src/node_api.cc +0 -3655
- package/node_modules/node-addon-api/src/node_api.gyp +0 -21
- package/node_modules/node-addon-api/src/node_api.h +0 -588
- package/node_modules/node-addon-api/src/node_api_types.h +0 -115
- package/node_modules/node-addon-api/src/node_internals.cc +0 -142
- package/node_modules/node-addon-api/src/node_internals.h +0 -157
- package/node_modules/node-addon-api/src/util-inl.h +0 -38
- package/node_modules/node-addon-api/src/util.h +0 -7
|
@@ -1,1053 +1,1061 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var decoder
|
|
3
|
-
try {
|
|
4
|
-
decoder = new TextDecoder()
|
|
5
|
-
} catch(error) {}
|
|
6
|
-
var src
|
|
7
|
-
var srcEnd
|
|
8
|
-
var position = 0
|
|
9
|
-
var alreadySet
|
|
10
|
-
const EMPTY_ARRAY = []
|
|
11
|
-
var strings = EMPTY_ARRAY
|
|
12
|
-
var stringPosition = 0
|
|
13
|
-
var currentUnpackr = {}
|
|
14
|
-
var currentStructures
|
|
15
|
-
var srcString
|
|
16
|
-
var srcStringStart = 0
|
|
17
|
-
var srcStringEnd = 0
|
|
18
|
-
var bundledStrings
|
|
19
|
-
var referenceMap
|
|
20
|
-
var currentExtensions = []
|
|
21
|
-
var dataView
|
|
22
|
-
var defaultOptions = {
|
|
23
|
-
useRecords: false,
|
|
24
|
-
mapsAsObjects: true
|
|
25
|
-
}
|
|
26
|
-
export class C1Type {}
|
|
27
|
-
export const C1 = new C1Type()
|
|
28
|
-
C1.name = 'MessagePack 0xC1'
|
|
29
|
-
var sequentialMode = false
|
|
30
|
-
var inlineObjectReadThreshold = 2
|
|
31
|
-
try {
|
|
32
|
-
new Function('')
|
|
33
|
-
} catch(error) {
|
|
34
|
-
// if eval variants are not supported, do not create inline object readers ever
|
|
35
|
-
inlineObjectReadThreshold = Infinity
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class Unpackr {
|
|
39
|
-
constructor(options) {
|
|
40
|
-
if (options) {
|
|
41
|
-
if (options.useRecords === false && options.mapsAsObjects === undefined)
|
|
42
|
-
options.mapsAsObjects = true
|
|
43
|
-
if (options.
|
|
44
|
-
options.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
currentUnpackr =
|
|
90
|
-
if (
|
|
91
|
-
currentStructures =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
let
|
|
233
|
-
for (let i = 0; i < token; i++) {
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
return
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
position
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
value = dataView.
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
value
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
value
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
case
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
case
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
result
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
units.push(
|
|
564
|
-
} else if ((byte1 &
|
|
565
|
-
//
|
|
566
|
-
const byte2 = src[position++] & 0x3f
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
let g = src[position++]
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
let k = src[position++]
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
case
|
|
789
|
-
// str
|
|
790
|
-
length =
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
while (checkPosition < end) {
|
|
847
|
-
chunk =
|
|
848
|
-
if (chunk != entry[i++]) {
|
|
849
|
-
checkPosition = 0x70000000
|
|
850
|
-
break
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
let
|
|
884
|
-
if (
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
currentExtensions[
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
let
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
if (
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
refEntry.
|
|
933
|
-
return
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
currentExtensions[
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
currentExtensions[
|
|
949
|
-
let
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
else
|
|
979
|
-
return new Date(
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
let
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
let
|
|
997
|
-
let
|
|
998
|
-
let
|
|
999
|
-
let
|
|
1000
|
-
let
|
|
1001
|
-
let
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
currentStructures
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
export const
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
export
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
var decoder
|
|
3
|
+
try {
|
|
4
|
+
decoder = new TextDecoder()
|
|
5
|
+
} catch(error) {}
|
|
6
|
+
var src
|
|
7
|
+
var srcEnd
|
|
8
|
+
var position = 0
|
|
9
|
+
var alreadySet
|
|
10
|
+
const EMPTY_ARRAY = []
|
|
11
|
+
var strings = EMPTY_ARRAY
|
|
12
|
+
var stringPosition = 0
|
|
13
|
+
var currentUnpackr = {}
|
|
14
|
+
var currentStructures
|
|
15
|
+
var srcString
|
|
16
|
+
var srcStringStart = 0
|
|
17
|
+
var srcStringEnd = 0
|
|
18
|
+
var bundledStrings
|
|
19
|
+
var referenceMap
|
|
20
|
+
var currentExtensions = []
|
|
21
|
+
var dataView
|
|
22
|
+
var defaultOptions = {
|
|
23
|
+
useRecords: false,
|
|
24
|
+
mapsAsObjects: true
|
|
25
|
+
}
|
|
26
|
+
export class C1Type {}
|
|
27
|
+
export const C1 = new C1Type()
|
|
28
|
+
C1.name = 'MessagePack 0xC1'
|
|
29
|
+
var sequentialMode = false
|
|
30
|
+
var inlineObjectReadThreshold = 2
|
|
31
|
+
try {
|
|
32
|
+
new Function('')
|
|
33
|
+
} catch(error) {
|
|
34
|
+
// if eval variants are not supported, do not create inline object readers ever
|
|
35
|
+
inlineObjectReadThreshold = Infinity
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class Unpackr {
|
|
39
|
+
constructor(options) {
|
|
40
|
+
if (options) {
|
|
41
|
+
if (options.useRecords === false && options.mapsAsObjects === undefined)
|
|
42
|
+
options.mapsAsObjects = true
|
|
43
|
+
if (options.sequential && options.trusted !== false) {
|
|
44
|
+
options.trusted = true;
|
|
45
|
+
if (!options.structures && options.useRecords != false) {
|
|
46
|
+
options.structures = []
|
|
47
|
+
if (!options.maxSharedStructures)
|
|
48
|
+
options.maxSharedStructures = 0
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (options.structures)
|
|
52
|
+
options.structures.sharedLength = options.structures.length
|
|
53
|
+
else if (options.getStructures) {
|
|
54
|
+
(options.structures = []).uninitialized = true // this is what we use to denote an uninitialized structures
|
|
55
|
+
options.structures.sharedLength = 0
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
Object.assign(this, options)
|
|
59
|
+
}
|
|
60
|
+
unpack(source, end) {
|
|
61
|
+
if (src) {
|
|
62
|
+
// re-entrant execution, save the state and restore it after we do this unpack
|
|
63
|
+
return saveState(() => {
|
|
64
|
+
clearSource()
|
|
65
|
+
return this ? this.unpack(source, end) : Unpackr.prototype.unpack.call(defaultOptions, source, end)
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
srcEnd = end > -1 ? end : source.length
|
|
69
|
+
position = 0
|
|
70
|
+
stringPosition = 0
|
|
71
|
+
srcStringEnd = 0
|
|
72
|
+
srcString = null
|
|
73
|
+
strings = EMPTY_ARRAY
|
|
74
|
+
bundledStrings = null
|
|
75
|
+
src = source
|
|
76
|
+
// this provides cached access to the data view for a buffer if it is getting reused, which is a recommend
|
|
77
|
+
// technique for getting data from a database where it can be copied into an existing buffer instead of creating
|
|
78
|
+
// new ones
|
|
79
|
+
try {
|
|
80
|
+
dataView = source.dataView || (source.dataView = new DataView(source.buffer, source.byteOffset, source.byteLength))
|
|
81
|
+
} catch(error) {
|
|
82
|
+
// if it doesn't have a buffer, maybe it is the wrong type of object
|
|
83
|
+
src = null
|
|
84
|
+
if (source instanceof Uint8Array)
|
|
85
|
+
throw error
|
|
86
|
+
throw new Error('Source must be a Uint8Array or Buffer but was a ' + ((source && typeof source == 'object') ? source.constructor.name : typeof source))
|
|
87
|
+
}
|
|
88
|
+
if (this instanceof Unpackr) {
|
|
89
|
+
currentUnpackr = this
|
|
90
|
+
if (this.structures) {
|
|
91
|
+
currentStructures = this.structures
|
|
92
|
+
return checkedRead()
|
|
93
|
+
} else if (!currentStructures || currentStructures.length > 0) {
|
|
94
|
+
currentStructures = []
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
currentUnpackr = defaultOptions
|
|
98
|
+
if (!currentStructures || currentStructures.length > 0)
|
|
99
|
+
currentStructures = []
|
|
100
|
+
}
|
|
101
|
+
return checkedRead()
|
|
102
|
+
}
|
|
103
|
+
unpackMultiple(source, forEach) {
|
|
104
|
+
let values, lastPosition = 0
|
|
105
|
+
try {
|
|
106
|
+
sequentialMode = true
|
|
107
|
+
let size = source.length
|
|
108
|
+
let value = this ? this.unpack(source, size) : defaultUnpackr.unpack(source, size)
|
|
109
|
+
if (forEach) {
|
|
110
|
+
forEach(value)
|
|
111
|
+
while(position < size) {
|
|
112
|
+
lastPosition = position
|
|
113
|
+
if (forEach(checkedRead()) === false) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
values = [ value ]
|
|
120
|
+
while(position < size) {
|
|
121
|
+
lastPosition = position
|
|
122
|
+
values.push(checkedRead())
|
|
123
|
+
}
|
|
124
|
+
return values
|
|
125
|
+
}
|
|
126
|
+
} catch(error) {
|
|
127
|
+
error.lastPosition = lastPosition
|
|
128
|
+
error.values = values
|
|
129
|
+
throw error
|
|
130
|
+
} finally {
|
|
131
|
+
sequentialMode = false
|
|
132
|
+
clearSource()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_mergeStructures(loadedStructures, existingStructures) {
|
|
136
|
+
loadedStructures = loadedStructures || []
|
|
137
|
+
for (let i = 0, l = loadedStructures.length; i < l; i++) {
|
|
138
|
+
let structure = loadedStructures[i]
|
|
139
|
+
if (structure) {
|
|
140
|
+
structure.isShared = true
|
|
141
|
+
if (i >= 32)
|
|
142
|
+
structure.highByte = (i - 32) >> 5
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
loadedStructures.sharedLength = loadedStructures.length
|
|
146
|
+
for (let id in existingStructures || []) {
|
|
147
|
+
if (id >= 0) {
|
|
148
|
+
let structure = loadedStructures[id]
|
|
149
|
+
let existing = existingStructures[id]
|
|
150
|
+
if (existing) {
|
|
151
|
+
if (structure)
|
|
152
|
+
(loadedStructures.restoreStructures || (loadedStructures.restoreStructures = []))[id] = structure
|
|
153
|
+
loadedStructures[id] = existing
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return this.structures = loadedStructures
|
|
158
|
+
}
|
|
159
|
+
decode(source, end) {
|
|
160
|
+
return this.unpack(source, end)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export function getPosition() {
|
|
164
|
+
return position
|
|
165
|
+
}
|
|
166
|
+
export function checkedRead() {
|
|
167
|
+
try {
|
|
168
|
+
if (!currentUnpackr.trusted && !sequentialMode) {
|
|
169
|
+
let sharedLength = currentStructures.sharedLength || 0
|
|
170
|
+
if (sharedLength < currentStructures.length)
|
|
171
|
+
currentStructures.length = sharedLength
|
|
172
|
+
}
|
|
173
|
+
let result = read()
|
|
174
|
+
if (bundledStrings) // bundled strings to skip past
|
|
175
|
+
position = bundledStrings.postBundlePosition
|
|
176
|
+
|
|
177
|
+
if (position == srcEnd) {
|
|
178
|
+
// finished reading this source, cleanup references
|
|
179
|
+
if (currentStructures.restoreStructures)
|
|
180
|
+
restoreStructures()
|
|
181
|
+
currentStructures = null
|
|
182
|
+
src = null
|
|
183
|
+
if (referenceMap)
|
|
184
|
+
referenceMap = null
|
|
185
|
+
} else if (position > srcEnd) {
|
|
186
|
+
// over read
|
|
187
|
+
throw new Error('Unexpected end of MessagePack data')
|
|
188
|
+
} else if (!sequentialMode) {
|
|
189
|
+
throw new Error('Data read, but end of buffer not reached ' + JSON.stringify(result).slice(0, 100))
|
|
190
|
+
}
|
|
191
|
+
// else more to read, but we are reading sequentially, so don't clear source yet
|
|
192
|
+
return result
|
|
193
|
+
} catch(error) {
|
|
194
|
+
if (currentStructures.restoreStructures)
|
|
195
|
+
restoreStructures()
|
|
196
|
+
clearSource()
|
|
197
|
+
if (error instanceof RangeError || error.message.startsWith('Unexpected end of buffer') || position > srcEnd) {
|
|
198
|
+
error.incomplete = true
|
|
199
|
+
}
|
|
200
|
+
throw error
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function restoreStructures() {
|
|
205
|
+
for (let id in currentStructures.restoreStructures) {
|
|
206
|
+
currentStructures[id] = currentStructures.restoreStructures[id]
|
|
207
|
+
}
|
|
208
|
+
currentStructures.restoreStructures = null
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function read() {
|
|
212
|
+
let token = src[position++]
|
|
213
|
+
if (token < 0xa0) {
|
|
214
|
+
if (token < 0x80) {
|
|
215
|
+
if (token < 0x40)
|
|
216
|
+
return token
|
|
217
|
+
else {
|
|
218
|
+
let structure = currentStructures[token & 0x3f] ||
|
|
219
|
+
currentUnpackr.getStructures && loadStructures()[token & 0x3f]
|
|
220
|
+
if (structure) {
|
|
221
|
+
if (!structure.read) {
|
|
222
|
+
structure.read = createStructureReader(structure, token & 0x3f)
|
|
223
|
+
}
|
|
224
|
+
return structure.read()
|
|
225
|
+
} else
|
|
226
|
+
return token
|
|
227
|
+
}
|
|
228
|
+
} else if (token < 0x90) {
|
|
229
|
+
// map
|
|
230
|
+
token -= 0x80
|
|
231
|
+
if (currentUnpackr.mapsAsObjects) {
|
|
232
|
+
let object = {}
|
|
233
|
+
for (let i = 0; i < token; i++) {
|
|
234
|
+
object[readKey()] = read()
|
|
235
|
+
}
|
|
236
|
+
return object
|
|
237
|
+
} else {
|
|
238
|
+
let map = new Map()
|
|
239
|
+
for (let i = 0; i < token; i++) {
|
|
240
|
+
map.set(read(), read())
|
|
241
|
+
}
|
|
242
|
+
return map
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
token -= 0x90
|
|
246
|
+
let array = new Array(token)
|
|
247
|
+
for (let i = 0; i < token; i++) {
|
|
248
|
+
array[i] = read()
|
|
249
|
+
}
|
|
250
|
+
return array
|
|
251
|
+
}
|
|
252
|
+
} else if (token < 0xc0) {
|
|
253
|
+
// fixstr
|
|
254
|
+
let length = token - 0xa0
|
|
255
|
+
if (srcStringEnd >= position) {
|
|
256
|
+
return srcString.slice(position - srcStringStart, (position += length) - srcStringStart)
|
|
257
|
+
}
|
|
258
|
+
if (srcStringEnd == 0 && srcEnd < 140) {
|
|
259
|
+
// for small blocks, avoiding the overhead of the extract call is helpful
|
|
260
|
+
let string = length < 16 ? shortStringInJS(length) : longStringInJS(length)
|
|
261
|
+
if (string != null)
|
|
262
|
+
return string
|
|
263
|
+
}
|
|
264
|
+
return readFixedString(length)
|
|
265
|
+
} else {
|
|
266
|
+
let value
|
|
267
|
+
switch (token) {
|
|
268
|
+
case 0xc0: return null
|
|
269
|
+
case 0xc1:
|
|
270
|
+
if (bundledStrings) {
|
|
271
|
+
value = read() // followed by the length of the string in characters (not bytes!)
|
|
272
|
+
if (value > 0)
|
|
273
|
+
return bundledStrings[1].slice(bundledStrings.position1, bundledStrings.position1 += value)
|
|
274
|
+
else
|
|
275
|
+
return bundledStrings[0].slice(bundledStrings.position0, bundledStrings.position0 -= value)
|
|
276
|
+
}
|
|
277
|
+
return C1; // "never-used", return special object to denote that
|
|
278
|
+
case 0xc2: return false
|
|
279
|
+
case 0xc3: return true
|
|
280
|
+
case 0xc4:
|
|
281
|
+
// bin 8
|
|
282
|
+
value = src[position++]
|
|
283
|
+
if (value === undefined)
|
|
284
|
+
throw new Error('Unexpected end of buffer')
|
|
285
|
+
return readBin(value)
|
|
286
|
+
case 0xc5:
|
|
287
|
+
// bin 16
|
|
288
|
+
value = dataView.getUint16(position)
|
|
289
|
+
position += 2
|
|
290
|
+
return readBin(value)
|
|
291
|
+
case 0xc6:
|
|
292
|
+
// bin 32
|
|
293
|
+
value = dataView.getUint32(position)
|
|
294
|
+
position += 4
|
|
295
|
+
return readBin(value)
|
|
296
|
+
case 0xc7:
|
|
297
|
+
// ext 8
|
|
298
|
+
return readExt(src[position++])
|
|
299
|
+
case 0xc8:
|
|
300
|
+
// ext 16
|
|
301
|
+
value = dataView.getUint16(position)
|
|
302
|
+
position += 2
|
|
303
|
+
return readExt(value)
|
|
304
|
+
case 0xc9:
|
|
305
|
+
// ext 32
|
|
306
|
+
value = dataView.getUint32(position)
|
|
307
|
+
position += 4
|
|
308
|
+
return readExt(value)
|
|
309
|
+
case 0xca:
|
|
310
|
+
value = dataView.getFloat32(position)
|
|
311
|
+
if (currentUnpackr.useFloat32 > 2) {
|
|
312
|
+
// this does rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved
|
|
313
|
+
let multiplier = mult10[((src[position] & 0x7f) << 1) | (src[position + 1] >> 7)]
|
|
314
|
+
position += 4
|
|
315
|
+
return ((multiplier * value + (value > 0 ? 0.5 : -0.5)) >> 0) / multiplier
|
|
316
|
+
}
|
|
317
|
+
position += 4
|
|
318
|
+
return value
|
|
319
|
+
case 0xcb:
|
|
320
|
+
value = dataView.getFloat64(position)
|
|
321
|
+
position += 8
|
|
322
|
+
return value
|
|
323
|
+
// uint handlers
|
|
324
|
+
case 0xcc:
|
|
325
|
+
return src[position++]
|
|
326
|
+
case 0xcd:
|
|
327
|
+
value = dataView.getUint16(position)
|
|
328
|
+
position += 2
|
|
329
|
+
return value
|
|
330
|
+
case 0xce:
|
|
331
|
+
value = dataView.getUint32(position)
|
|
332
|
+
position += 4
|
|
333
|
+
return value
|
|
334
|
+
case 0xcf:
|
|
335
|
+
if (currentUnpackr.int64AsNumber) {
|
|
336
|
+
value = dataView.getUint32(position) * 0x100000000
|
|
337
|
+
value += dataView.getUint32(position + 4)
|
|
338
|
+
} else
|
|
339
|
+
value = dataView.getBigUint64(position)
|
|
340
|
+
position += 8
|
|
341
|
+
return value
|
|
342
|
+
|
|
343
|
+
// int handlers
|
|
344
|
+
case 0xd0:
|
|
345
|
+
return dataView.getInt8(position++)
|
|
346
|
+
case 0xd1:
|
|
347
|
+
value = dataView.getInt16(position)
|
|
348
|
+
position += 2
|
|
349
|
+
return value
|
|
350
|
+
case 0xd2:
|
|
351
|
+
value = dataView.getInt32(position)
|
|
352
|
+
position += 4
|
|
353
|
+
return value
|
|
354
|
+
case 0xd3:
|
|
355
|
+
if (currentUnpackr.int64AsNumber) {
|
|
356
|
+
value = dataView.getInt32(position) * 0x100000000
|
|
357
|
+
value += dataView.getUint32(position + 4)
|
|
358
|
+
} else
|
|
359
|
+
value = dataView.getBigInt64(position)
|
|
360
|
+
position += 8
|
|
361
|
+
return value
|
|
362
|
+
|
|
363
|
+
case 0xd4:
|
|
364
|
+
// fixext 1
|
|
365
|
+
value = src[position++]
|
|
366
|
+
if (value == 0x72) {
|
|
367
|
+
return recordDefinition(src[position++] & 0x3f)
|
|
368
|
+
} else {
|
|
369
|
+
let extension = currentExtensions[value]
|
|
370
|
+
if (extension) {
|
|
371
|
+
if (extension.read) {
|
|
372
|
+
position++ // skip filler byte
|
|
373
|
+
return extension.read(read())
|
|
374
|
+
} else if (extension.noBuffer) {
|
|
375
|
+
position++ // skip filler byte
|
|
376
|
+
return extension()
|
|
377
|
+
} else
|
|
378
|
+
return extension(src.subarray(position, ++position))
|
|
379
|
+
} else
|
|
380
|
+
throw new Error('Unknown extension ' + value)
|
|
381
|
+
}
|
|
382
|
+
case 0xd5:
|
|
383
|
+
// fixext 2
|
|
384
|
+
value = src[position]
|
|
385
|
+
if (value == 0x72) {
|
|
386
|
+
position++
|
|
387
|
+
return recordDefinition(src[position++] & 0x3f, src[position++])
|
|
388
|
+
} else
|
|
389
|
+
return readExt(2)
|
|
390
|
+
case 0xd6:
|
|
391
|
+
// fixext 4
|
|
392
|
+
return readExt(4)
|
|
393
|
+
case 0xd7:
|
|
394
|
+
// fixext 8
|
|
395
|
+
return readExt(8)
|
|
396
|
+
case 0xd8:
|
|
397
|
+
// fixext 16
|
|
398
|
+
return readExt(16)
|
|
399
|
+
case 0xd9:
|
|
400
|
+
// str 8
|
|
401
|
+
value = src[position++]
|
|
402
|
+
if (srcStringEnd >= position) {
|
|
403
|
+
return srcString.slice(position - srcStringStart, (position += value) - srcStringStart)
|
|
404
|
+
}
|
|
405
|
+
return readString8(value)
|
|
406
|
+
case 0xda:
|
|
407
|
+
// str 16
|
|
408
|
+
value = dataView.getUint16(position)
|
|
409
|
+
position += 2
|
|
410
|
+
if (srcStringEnd >= position) {
|
|
411
|
+
return srcString.slice(position - srcStringStart, (position += value) - srcStringStart)
|
|
412
|
+
}
|
|
413
|
+
return readString16(value)
|
|
414
|
+
case 0xdb:
|
|
415
|
+
// str 32
|
|
416
|
+
value = dataView.getUint32(position)
|
|
417
|
+
position += 4
|
|
418
|
+
if (srcStringEnd >= position) {
|
|
419
|
+
return srcString.slice(position - srcStringStart, (position += value) - srcStringStart)
|
|
420
|
+
}
|
|
421
|
+
return readString32(value)
|
|
422
|
+
case 0xdc:
|
|
423
|
+
// array 16
|
|
424
|
+
value = dataView.getUint16(position)
|
|
425
|
+
position += 2
|
|
426
|
+
return readArray(value)
|
|
427
|
+
case 0xdd:
|
|
428
|
+
// array 32
|
|
429
|
+
value = dataView.getUint32(position)
|
|
430
|
+
position += 4
|
|
431
|
+
return readArray(value)
|
|
432
|
+
case 0xde:
|
|
433
|
+
// map 16
|
|
434
|
+
value = dataView.getUint16(position)
|
|
435
|
+
position += 2
|
|
436
|
+
return readMap(value)
|
|
437
|
+
case 0xdf:
|
|
438
|
+
// map 32
|
|
439
|
+
value = dataView.getUint32(position)
|
|
440
|
+
position += 4
|
|
441
|
+
return readMap(value)
|
|
442
|
+
default: // negative int
|
|
443
|
+
if (token >= 0xe0)
|
|
444
|
+
return token - 0x100
|
|
445
|
+
if (token === undefined) {
|
|
446
|
+
let error = new Error('Unexpected end of MessagePack data')
|
|
447
|
+
error.incomplete = true
|
|
448
|
+
throw error
|
|
449
|
+
}
|
|
450
|
+
throw new Error('Unknown MessagePack token ' + token)
|
|
451
|
+
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
const validName = /^[a-zA-Z_$][a-zA-Z\d_$]*$/
|
|
456
|
+
function createStructureReader(structure, firstId) {
|
|
457
|
+
function readObject() {
|
|
458
|
+
// This initial function is quick to instantiate, but runs slower. After several iterations pay the cost to build the faster function
|
|
459
|
+
if (readObject.count++ > inlineObjectReadThreshold) {
|
|
460
|
+
let readObject = structure.read = (new Function('r', 'return function(){return {' + structure.map(key => validName.test(key) ? key + ':r()' : ('[' + JSON.stringify(key) + ']:r()')).join(',') + '}}'))(read)
|
|
461
|
+
if (structure.highByte === 0)
|
|
462
|
+
structure.read = createSecondByteReader(firstId, structure.read)
|
|
463
|
+
return readObject() // second byte is already read, if there is one so immediately read object
|
|
464
|
+
}
|
|
465
|
+
let object = {}
|
|
466
|
+
for (let i = 0, l = structure.length; i < l; i++) {
|
|
467
|
+
let key = structure[i]
|
|
468
|
+
object[key] = read()
|
|
469
|
+
}
|
|
470
|
+
return object
|
|
471
|
+
}
|
|
472
|
+
readObject.count = 0
|
|
473
|
+
if (structure.highByte === 0) {
|
|
474
|
+
return createSecondByteReader(firstId, readObject)
|
|
475
|
+
}
|
|
476
|
+
return readObject
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
const createSecondByteReader = (firstId, read0) => {
|
|
480
|
+
return function() {
|
|
481
|
+
let highByte = src[position++]
|
|
482
|
+
if (highByte === 0)
|
|
483
|
+
return read0()
|
|
484
|
+
let id = firstId < 32 ? -(firstId + (highByte << 5)) : firstId + (highByte << 5)
|
|
485
|
+
let structure = currentStructures[id] || loadStructures()[id]
|
|
486
|
+
if (!structure) {
|
|
487
|
+
throw new Error('Record id is not defined for ' + id)
|
|
488
|
+
}
|
|
489
|
+
if (!structure.read)
|
|
490
|
+
structure.read = createStructureReader(structure, firstId)
|
|
491
|
+
return structure.read()
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function loadStructures() {
|
|
496
|
+
let loadedStructures = saveState(() => {
|
|
497
|
+
// save the state in case getStructures modifies our buffer
|
|
498
|
+
src = null
|
|
499
|
+
return currentUnpackr.getStructures()
|
|
500
|
+
})
|
|
501
|
+
return currentStructures = currentUnpackr._mergeStructures(loadedStructures, currentStructures)
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
var readFixedString = readStringJS
|
|
505
|
+
var readString8 = readStringJS
|
|
506
|
+
var readString16 = readStringJS
|
|
507
|
+
var readString32 = readStringJS
|
|
508
|
+
export let isNativeAccelerationEnabled = false
|
|
509
|
+
|
|
510
|
+
export function setExtractor(extractStrings) {
|
|
511
|
+
isNativeAccelerationEnabled = true
|
|
512
|
+
readFixedString = readString(1)
|
|
513
|
+
readString8 = readString(2)
|
|
514
|
+
readString16 = readString(3)
|
|
515
|
+
readString32 = readString(5)
|
|
516
|
+
function readString(headerLength) {
|
|
517
|
+
return function readString(length) {
|
|
518
|
+
let string = strings[stringPosition++]
|
|
519
|
+
if (string == null) {
|
|
520
|
+
if (bundledStrings)
|
|
521
|
+
return readStringJS(length)
|
|
522
|
+
let extraction = extractStrings(position - headerLength, srcEnd, src)
|
|
523
|
+
if (typeof extraction == 'string') {
|
|
524
|
+
string = extraction
|
|
525
|
+
strings = EMPTY_ARRAY
|
|
526
|
+
} else {
|
|
527
|
+
strings = extraction
|
|
528
|
+
stringPosition = 1
|
|
529
|
+
srcStringEnd = 1 // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings
|
|
530
|
+
string = strings[0]
|
|
531
|
+
if (string === undefined)
|
|
532
|
+
throw new Error('Unexpected end of buffer')
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
let srcStringLength = string.length
|
|
536
|
+
if (srcStringLength <= length) {
|
|
537
|
+
position += length
|
|
538
|
+
return string
|
|
539
|
+
}
|
|
540
|
+
srcString = string
|
|
541
|
+
srcStringStart = position
|
|
542
|
+
srcStringEnd = position + srcStringLength
|
|
543
|
+
position += length
|
|
544
|
+
return string.slice(0, length) // we know we just want the beginning
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
function readStringJS(length) {
|
|
549
|
+
let result
|
|
550
|
+
if (length < 16) {
|
|
551
|
+
if (result = shortStringInJS(length))
|
|
552
|
+
return result
|
|
553
|
+
}
|
|
554
|
+
if (length > 64 && decoder)
|
|
555
|
+
return decoder.decode(src.subarray(position, position += length))
|
|
556
|
+
const end = position + length
|
|
557
|
+
const units = []
|
|
558
|
+
result = ''
|
|
559
|
+
while (position < end) {
|
|
560
|
+
const byte1 = src[position++]
|
|
561
|
+
if ((byte1 & 0x80) === 0) {
|
|
562
|
+
// 1 byte
|
|
563
|
+
units.push(byte1)
|
|
564
|
+
} else if ((byte1 & 0xe0) === 0xc0) {
|
|
565
|
+
// 2 bytes
|
|
566
|
+
const byte2 = src[position++] & 0x3f
|
|
567
|
+
units.push(((byte1 & 0x1f) << 6) | byte2)
|
|
568
|
+
} else if ((byte1 & 0xf0) === 0xe0) {
|
|
569
|
+
// 3 bytes
|
|
570
|
+
const byte2 = src[position++] & 0x3f
|
|
571
|
+
const byte3 = src[position++] & 0x3f
|
|
572
|
+
units.push(((byte1 & 0x1f) << 12) | (byte2 << 6) | byte3)
|
|
573
|
+
} else if ((byte1 & 0xf8) === 0xf0) {
|
|
574
|
+
// 4 bytes
|
|
575
|
+
const byte2 = src[position++] & 0x3f
|
|
576
|
+
const byte3 = src[position++] & 0x3f
|
|
577
|
+
const byte4 = src[position++] & 0x3f
|
|
578
|
+
let unit = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4
|
|
579
|
+
if (unit > 0xffff) {
|
|
580
|
+
unit -= 0x10000
|
|
581
|
+
units.push(((unit >>> 10) & 0x3ff) | 0xd800)
|
|
582
|
+
unit = 0xdc00 | (unit & 0x3ff)
|
|
583
|
+
}
|
|
584
|
+
units.push(unit)
|
|
585
|
+
} else {
|
|
586
|
+
units.push(byte1)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (units.length >= 0x1000) {
|
|
590
|
+
result += fromCharCode.apply(String, units)
|
|
591
|
+
units.length = 0
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (units.length > 0) {
|
|
596
|
+
result += fromCharCode.apply(String, units)
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return result
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function readArray(length) {
|
|
603
|
+
let array = new Array(length)
|
|
604
|
+
for (let i = 0; i < length; i++) {
|
|
605
|
+
array[i] = read()
|
|
606
|
+
}
|
|
607
|
+
return array
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function readMap(length) {
|
|
611
|
+
if (currentUnpackr.mapsAsObjects) {
|
|
612
|
+
let object = {}
|
|
613
|
+
for (let i = 0; i < length; i++) {
|
|
614
|
+
object[readKey()] = read()
|
|
615
|
+
}
|
|
616
|
+
return object
|
|
617
|
+
} else {
|
|
618
|
+
let map = new Map()
|
|
619
|
+
for (let i = 0; i < length; i++) {
|
|
620
|
+
map.set(read(), read())
|
|
621
|
+
}
|
|
622
|
+
return map
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
var fromCharCode = String.fromCharCode
|
|
627
|
+
function longStringInJS(length) {
|
|
628
|
+
let start = position
|
|
629
|
+
let bytes = new Array(length)
|
|
630
|
+
for (let i = 0; i < length; i++) {
|
|
631
|
+
const byte = src[position++];
|
|
632
|
+
if ((byte & 0x80) > 0) {
|
|
633
|
+
position = start
|
|
634
|
+
return
|
|
635
|
+
}
|
|
636
|
+
bytes[i] = byte
|
|
637
|
+
}
|
|
638
|
+
return fromCharCode.apply(String, bytes)
|
|
639
|
+
}
|
|
640
|
+
function shortStringInJS(length) {
|
|
641
|
+
if (length < 4) {
|
|
642
|
+
if (length < 2) {
|
|
643
|
+
if (length === 0)
|
|
644
|
+
return ''
|
|
645
|
+
else {
|
|
646
|
+
let a = src[position++]
|
|
647
|
+
if ((a & 0x80) > 1) {
|
|
648
|
+
position -= 1
|
|
649
|
+
return
|
|
650
|
+
}
|
|
651
|
+
return fromCharCode(a)
|
|
652
|
+
}
|
|
653
|
+
} else {
|
|
654
|
+
let a = src[position++]
|
|
655
|
+
let b = src[position++]
|
|
656
|
+
if ((a & 0x80) > 0 || (b & 0x80) > 0) {
|
|
657
|
+
position -= 2
|
|
658
|
+
return
|
|
659
|
+
}
|
|
660
|
+
if (length < 3)
|
|
661
|
+
return fromCharCode(a, b)
|
|
662
|
+
let c = src[position++]
|
|
663
|
+
if ((c & 0x80) > 0) {
|
|
664
|
+
position -= 3
|
|
665
|
+
return
|
|
666
|
+
}
|
|
667
|
+
return fromCharCode(a, b, c)
|
|
668
|
+
}
|
|
669
|
+
} else {
|
|
670
|
+
let a = src[position++]
|
|
671
|
+
let b = src[position++]
|
|
672
|
+
let c = src[position++]
|
|
673
|
+
let d = src[position++]
|
|
674
|
+
if ((a & 0x80) > 0 || (b & 0x80) > 0 || (c & 0x80) > 0 || (d & 0x80) > 0) {
|
|
675
|
+
position -= 4
|
|
676
|
+
return
|
|
677
|
+
}
|
|
678
|
+
if (length < 6) {
|
|
679
|
+
if (length === 4)
|
|
680
|
+
return fromCharCode(a, b, c, d)
|
|
681
|
+
else {
|
|
682
|
+
let e = src[position++]
|
|
683
|
+
if ((e & 0x80) > 0) {
|
|
684
|
+
position -= 5
|
|
685
|
+
return
|
|
686
|
+
}
|
|
687
|
+
return fromCharCode(a, b, c, d, e)
|
|
688
|
+
}
|
|
689
|
+
} else if (length < 8) {
|
|
690
|
+
let e = src[position++]
|
|
691
|
+
let f = src[position++]
|
|
692
|
+
if ((e & 0x80) > 0 || (f & 0x80) > 0) {
|
|
693
|
+
position -= 6
|
|
694
|
+
return
|
|
695
|
+
}
|
|
696
|
+
if (length < 7)
|
|
697
|
+
return fromCharCode(a, b, c, d, e, f)
|
|
698
|
+
let g = src[position++]
|
|
699
|
+
if ((g & 0x80) > 0) {
|
|
700
|
+
position -= 7
|
|
701
|
+
return
|
|
702
|
+
}
|
|
703
|
+
return fromCharCode(a, b, c, d, e, f, g)
|
|
704
|
+
} else {
|
|
705
|
+
let e = src[position++]
|
|
706
|
+
let f = src[position++]
|
|
707
|
+
let g = src[position++]
|
|
708
|
+
let h = src[position++]
|
|
709
|
+
if ((e & 0x80) > 0 || (f & 0x80) > 0 || (g & 0x80) > 0 || (h & 0x80) > 0) {
|
|
710
|
+
position -= 8
|
|
711
|
+
return
|
|
712
|
+
}
|
|
713
|
+
if (length < 10) {
|
|
714
|
+
if (length === 8)
|
|
715
|
+
return fromCharCode(a, b, c, d, e, f, g, h)
|
|
716
|
+
else {
|
|
717
|
+
let i = src[position++]
|
|
718
|
+
if ((i & 0x80) > 0) {
|
|
719
|
+
position -= 9
|
|
720
|
+
return
|
|
721
|
+
}
|
|
722
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i)
|
|
723
|
+
}
|
|
724
|
+
} else if (length < 12) {
|
|
725
|
+
let i = src[position++]
|
|
726
|
+
let j = src[position++]
|
|
727
|
+
if ((i & 0x80) > 0 || (j & 0x80) > 0) {
|
|
728
|
+
position -= 10
|
|
729
|
+
return
|
|
730
|
+
}
|
|
731
|
+
if (length < 11)
|
|
732
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j)
|
|
733
|
+
let k = src[position++]
|
|
734
|
+
if ((k & 0x80) > 0) {
|
|
735
|
+
position -= 11
|
|
736
|
+
return
|
|
737
|
+
}
|
|
738
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k)
|
|
739
|
+
} else {
|
|
740
|
+
let i = src[position++]
|
|
741
|
+
let j = src[position++]
|
|
742
|
+
let k = src[position++]
|
|
743
|
+
let l = src[position++]
|
|
744
|
+
if ((i & 0x80) > 0 || (j & 0x80) > 0 || (k & 0x80) > 0 || (l & 0x80) > 0) {
|
|
745
|
+
position -= 12
|
|
746
|
+
return
|
|
747
|
+
}
|
|
748
|
+
if (length < 14) {
|
|
749
|
+
if (length === 12)
|
|
750
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l)
|
|
751
|
+
else {
|
|
752
|
+
let m = src[position++]
|
|
753
|
+
if ((m & 0x80) > 0) {
|
|
754
|
+
position -= 13
|
|
755
|
+
return
|
|
756
|
+
}
|
|
757
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m)
|
|
758
|
+
}
|
|
759
|
+
} else {
|
|
760
|
+
let m = src[position++]
|
|
761
|
+
let n = src[position++]
|
|
762
|
+
if ((m & 0x80) > 0 || (n & 0x80) > 0) {
|
|
763
|
+
position -= 14
|
|
764
|
+
return
|
|
765
|
+
}
|
|
766
|
+
if (length < 15)
|
|
767
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
|
|
768
|
+
let o = src[position++]
|
|
769
|
+
if ((o & 0x80) > 0) {
|
|
770
|
+
position -= 15
|
|
771
|
+
return
|
|
772
|
+
}
|
|
773
|
+
return fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
function readOnlyJSString() {
|
|
781
|
+
let token = src[position++]
|
|
782
|
+
let length
|
|
783
|
+
if (token < 0xc0) {
|
|
784
|
+
// fixstr
|
|
785
|
+
length = token - 0xa0
|
|
786
|
+
} else {
|
|
787
|
+
switch(token) {
|
|
788
|
+
case 0xd9:
|
|
789
|
+
// str 8
|
|
790
|
+
length = src[position++]
|
|
791
|
+
break
|
|
792
|
+
case 0xda:
|
|
793
|
+
// str 16
|
|
794
|
+
length = dataView.getUint16(position)
|
|
795
|
+
position += 2
|
|
796
|
+
break
|
|
797
|
+
case 0xdb:
|
|
798
|
+
// str 32
|
|
799
|
+
length = dataView.getUint32(position)
|
|
800
|
+
position += 4
|
|
801
|
+
break
|
|
802
|
+
default:
|
|
803
|
+
throw new Error('Expected string')
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return readStringJS(length)
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
function readBin(length) {
|
|
811
|
+
return currentUnpackr.copyBuffers ?
|
|
812
|
+
// specifically use the copying slice (not the node one)
|
|
813
|
+
Uint8Array.prototype.slice.call(src, position, position += length) :
|
|
814
|
+
src.subarray(position, position += length)
|
|
815
|
+
}
|
|
816
|
+
function readExt(length) {
|
|
817
|
+
let type = src[position++]
|
|
818
|
+
if (currentExtensions[type]) {
|
|
819
|
+
return currentExtensions[type](src.subarray(position, position += length))
|
|
820
|
+
}
|
|
821
|
+
else
|
|
822
|
+
throw new Error('Unknown extension type ' + type)
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
var keyCache = new Array(4096)
|
|
826
|
+
function readKey() {
|
|
827
|
+
let length = src[position++]
|
|
828
|
+
if (length >= 0xa0 && length < 0xc0) {
|
|
829
|
+
// fixstr, potentially use key cache
|
|
830
|
+
length = length - 0xa0
|
|
831
|
+
if (srcStringEnd >= position) // if it has been extracted, must use it (and faster anyway)
|
|
832
|
+
return srcString.slice(position - srcStringStart, (position += length) - srcStringStart)
|
|
833
|
+
else if (!(srcStringEnd == 0 && srcEnd < 180))
|
|
834
|
+
return readFixedString(length)
|
|
835
|
+
} else { // not cacheable, go back and do a standard read
|
|
836
|
+
position--
|
|
837
|
+
return read()
|
|
838
|
+
}
|
|
839
|
+
let key = ((length << 5) ^ (length > 1 ? dataView.getUint16(position) : length > 0 ? src[position] : 0)) & 0xfff
|
|
840
|
+
let entry = keyCache[key]
|
|
841
|
+
let checkPosition = position
|
|
842
|
+
let end = position + length - 3
|
|
843
|
+
let chunk
|
|
844
|
+
let i = 0
|
|
845
|
+
if (entry && entry.bytes == length) {
|
|
846
|
+
while (checkPosition < end) {
|
|
847
|
+
chunk = dataView.getUint32(checkPosition)
|
|
848
|
+
if (chunk != entry[i++]) {
|
|
849
|
+
checkPosition = 0x70000000
|
|
850
|
+
break
|
|
851
|
+
}
|
|
852
|
+
checkPosition += 4
|
|
853
|
+
}
|
|
854
|
+
end += 3
|
|
855
|
+
while (checkPosition < end) {
|
|
856
|
+
chunk = src[checkPosition++]
|
|
857
|
+
if (chunk != entry[i++]) {
|
|
858
|
+
checkPosition = 0x70000000
|
|
859
|
+
break
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if (checkPosition === end) {
|
|
863
|
+
position = checkPosition
|
|
864
|
+
return entry.string
|
|
865
|
+
}
|
|
866
|
+
end -= 3
|
|
867
|
+
checkPosition = position
|
|
868
|
+
}
|
|
869
|
+
entry = []
|
|
870
|
+
keyCache[key] = entry
|
|
871
|
+
entry.bytes = length
|
|
872
|
+
while (checkPosition < end) {
|
|
873
|
+
chunk = dataView.getUint32(checkPosition)
|
|
874
|
+
entry.push(chunk)
|
|
875
|
+
checkPosition += 4
|
|
876
|
+
}
|
|
877
|
+
end += 3
|
|
878
|
+
while (checkPosition < end) {
|
|
879
|
+
chunk = src[checkPosition++]
|
|
880
|
+
entry.push(chunk)
|
|
881
|
+
}
|
|
882
|
+
// for small blocks, avoiding the overhead of the extract call is helpful
|
|
883
|
+
let string = length < 16 ? shortStringInJS(length) : longStringInJS(length)
|
|
884
|
+
if (string != null)
|
|
885
|
+
return entry.string = string
|
|
886
|
+
return entry.string = readFixedString(length)
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// the registration of the record definition extension (as "r")
|
|
890
|
+
const recordDefinition = (id, highByte) => {
|
|
891
|
+
var structure = read()
|
|
892
|
+
let firstByte = id
|
|
893
|
+
if (highByte !== undefined) {
|
|
894
|
+
id = id < 32 ? -((highByte << 5) + id) : ((highByte << 5) + id)
|
|
895
|
+
structure.highByte = highByte
|
|
896
|
+
}
|
|
897
|
+
let existingStructure = currentStructures[id]
|
|
898
|
+
if (existingStructure && existingStructure.isShared) {
|
|
899
|
+
(currentStructures.restoreStructures || (currentStructures.restoreStructures = []))[id] = existingStructure
|
|
900
|
+
}
|
|
901
|
+
currentStructures[id] = structure
|
|
902
|
+
structure.read = createStructureReader(structure, firstByte)
|
|
903
|
+
return structure.read()
|
|
904
|
+
}
|
|
905
|
+
currentExtensions[0] = () => {} // notepack defines extension 0 to mean undefined, so use that as the default here
|
|
906
|
+
currentExtensions[0].noBuffer = true
|
|
907
|
+
|
|
908
|
+
currentExtensions[0x65] = () => {
|
|
909
|
+
let data = read()
|
|
910
|
+
return (globalThis[data[0]] || Error)(data[1])
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
currentExtensions[0x69] = (data) => {
|
|
914
|
+
// id extension (for structured clones)
|
|
915
|
+
let id = dataView.getUint32(position - 4)
|
|
916
|
+
if (!referenceMap)
|
|
917
|
+
referenceMap = new Map()
|
|
918
|
+
let token = src[position]
|
|
919
|
+
let target
|
|
920
|
+
// TODO: handle Maps, Sets, and other types that can cycle; this is complicated, because you potentially need to read
|
|
921
|
+
// ahead past references to record structure definitions
|
|
922
|
+
if (token >= 0x90 && token < 0xa0 || token == 0xdc || token == 0xdd)
|
|
923
|
+
target = []
|
|
924
|
+
else
|
|
925
|
+
target = {}
|
|
926
|
+
|
|
927
|
+
let refEntry = { target } // a placeholder object
|
|
928
|
+
referenceMap.set(id, refEntry)
|
|
929
|
+
let targetProperties = read() // read the next value as the target object to id
|
|
930
|
+
if (refEntry.used) // there is a cycle, so we have to assign properties to original target
|
|
931
|
+
return Object.assign(target, targetProperties)
|
|
932
|
+
refEntry.target = targetProperties // the placeholder wasn't used, replace with the deserialized one
|
|
933
|
+
return targetProperties // no cycle, can just use the returned read object
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
currentExtensions[0x70] = (data) => {
|
|
937
|
+
// pointer extension (for structured clones)
|
|
938
|
+
let id = dataView.getUint32(position - 4)
|
|
939
|
+
let refEntry = referenceMap.get(id)
|
|
940
|
+
refEntry.used = true
|
|
941
|
+
return refEntry.target
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
currentExtensions[0x73] = () => new Set(read())
|
|
945
|
+
|
|
946
|
+
export const typedArrays = ['Int8','Uint8','Uint8Clamped','Int16','Uint16','Int32','Uint32','Float32','Float64','BigInt64','BigUint64'].map(type => type + 'Array')
|
|
947
|
+
|
|
948
|
+
currentExtensions[0x74] = (data) => {
|
|
949
|
+
let typeCode = data[0]
|
|
950
|
+
let typedArrayName = typedArrays[typeCode]
|
|
951
|
+
if (!typedArrayName)
|
|
952
|
+
throw new Error('Could not find typed array for code ' + typeCode)
|
|
953
|
+
// we have to always slice/copy here to get a new ArrayBuffer that is word/byte aligned
|
|
954
|
+
return new globalThis[typedArrayName](Uint8Array.prototype.slice.call(data, 1).buffer)
|
|
955
|
+
}
|
|
956
|
+
currentExtensions[0x78] = () => {
|
|
957
|
+
let data = read()
|
|
958
|
+
return new RegExp(data[0], data[1])
|
|
959
|
+
}
|
|
960
|
+
const TEMP_BUNDLE = []
|
|
961
|
+
currentExtensions[0x62] = (data) => {
|
|
962
|
+
let dataSize = (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]
|
|
963
|
+
let dataPosition = position
|
|
964
|
+
position += dataSize - data.length
|
|
965
|
+
bundledStrings = TEMP_BUNDLE
|
|
966
|
+
bundledStrings = [readOnlyJSString(), readOnlyJSString()]
|
|
967
|
+
bundledStrings.position0 = 0
|
|
968
|
+
bundledStrings.position1 = 0
|
|
969
|
+
bundledStrings.postBundlePosition = position
|
|
970
|
+
position = dataPosition
|
|
971
|
+
return read()
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
currentExtensions[0xff] = (data) => {
|
|
975
|
+
// 32-bit date extension
|
|
976
|
+
if (data.length == 4)
|
|
977
|
+
return new Date((data[0] * 0x1000000 + (data[1] << 16) + (data[2] << 8) + data[3]) * 1000)
|
|
978
|
+
else if (data.length == 8)
|
|
979
|
+
return new Date(
|
|
980
|
+
((data[0] << 22) + (data[1] << 14) + (data[2] << 6) + (data[3] >> 2)) / 1000000 +
|
|
981
|
+
((data[3] & 0x3) * 0x100000000 + data[4] * 0x1000000 + (data[5] << 16) + (data[6] << 8) + data[7]) * 1000)
|
|
982
|
+
else if (data.length == 12)// TODO: Implement support for negative
|
|
983
|
+
return new Date(
|
|
984
|
+
((data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]) / 1000000 +
|
|
985
|
+
(((data[4] & 0x80) ? -0x1000000000000 : 0) + data[6] * 0x10000000000 + data[7] * 0x100000000 + data[8] * 0x1000000 + (data[9] << 16) + (data[10] << 8) + data[11]) * 1000)
|
|
986
|
+
else
|
|
987
|
+
return new Date('invalid')
|
|
988
|
+
} // notepack defines extension 0 to mean undefined, so use that as the default here
|
|
989
|
+
// registration of bulk record definition?
|
|
990
|
+
// currentExtensions[0x52] = () =>
|
|
991
|
+
|
|
992
|
+
function saveState(callback) {
|
|
993
|
+
let savedSrcEnd = srcEnd
|
|
994
|
+
let savedPosition = position
|
|
995
|
+
let savedStringPosition = stringPosition
|
|
996
|
+
let savedSrcStringStart = srcStringStart
|
|
997
|
+
let savedSrcStringEnd = srcStringEnd
|
|
998
|
+
let savedSrcString = srcString
|
|
999
|
+
let savedStrings = strings
|
|
1000
|
+
let savedReferenceMap = referenceMap
|
|
1001
|
+
let savedBundledStrings = bundledStrings
|
|
1002
|
+
|
|
1003
|
+
// TODO: We may need to revisit this if we do more external calls to user code (since it could be slow)
|
|
1004
|
+
let savedSrc = new Uint8Array(src.slice(0, srcEnd)) // we copy the data in case it changes while external data is processed
|
|
1005
|
+
let savedStructures = currentStructures
|
|
1006
|
+
let savedStructuresContents = currentStructures.slice(0, currentStructures.length)
|
|
1007
|
+
let savedPackr = currentUnpackr
|
|
1008
|
+
let savedSequentialMode = sequentialMode
|
|
1009
|
+
let value = callback()
|
|
1010
|
+
srcEnd = savedSrcEnd
|
|
1011
|
+
position = savedPosition
|
|
1012
|
+
stringPosition = savedStringPosition
|
|
1013
|
+
srcStringStart = savedSrcStringStart
|
|
1014
|
+
srcStringEnd = savedSrcStringEnd
|
|
1015
|
+
srcString = savedSrcString
|
|
1016
|
+
strings = savedStrings
|
|
1017
|
+
referenceMap = savedReferenceMap
|
|
1018
|
+
bundledStrings = savedBundledStrings
|
|
1019
|
+
src = savedSrc
|
|
1020
|
+
sequentialMode = savedSequentialMode
|
|
1021
|
+
currentStructures = savedStructures
|
|
1022
|
+
currentStructures.splice(0, currentStructures.length, ...savedStructuresContents)
|
|
1023
|
+
currentUnpackr = savedPackr
|
|
1024
|
+
dataView = new DataView(src.buffer, src.byteOffset, src.byteLength)
|
|
1025
|
+
return value
|
|
1026
|
+
}
|
|
1027
|
+
export function clearSource() {
|
|
1028
|
+
src = null
|
|
1029
|
+
referenceMap = null
|
|
1030
|
+
currentStructures = null
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
export function addExtension(extension) {
|
|
1034
|
+
if (extension.unpack)
|
|
1035
|
+
currentExtensions[extension.type] = extension.unpack
|
|
1036
|
+
else
|
|
1037
|
+
currentExtensions[extension.type] = extension
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
export const mult10 = new Array(147) // this is a table matching binary exponents to the multiplier to determine significant digit rounding
|
|
1041
|
+
for (let i = 0; i < 256; i++) {
|
|
1042
|
+
mult10[i] = +('1e' + Math.floor(45.15 - i * 0.30103))
|
|
1043
|
+
}
|
|
1044
|
+
export const Decoder = Unpackr
|
|
1045
|
+
var defaultUnpackr = new Unpackr({ useRecords: false })
|
|
1046
|
+
export const unpack = defaultUnpackr.unpack
|
|
1047
|
+
export const unpackMultiple = defaultUnpackr.unpackMultiple
|
|
1048
|
+
export const decode = defaultUnpackr.unpack
|
|
1049
|
+
export const FLOAT32_OPTIONS = {
|
|
1050
|
+
NEVER: 0,
|
|
1051
|
+
ALWAYS: 1,
|
|
1052
|
+
DECIMAL_ROUND: 3,
|
|
1053
|
+
DECIMAL_FIT: 4
|
|
1054
|
+
}
|
|
1055
|
+
let f32Array = new Float32Array(1)
|
|
1056
|
+
let u8Array = new Uint8Array(f32Array.buffer, 0, 4)
|
|
1057
|
+
export function roundFloat32(float32Number) {
|
|
1058
|
+
f32Array[0] = float32Number
|
|
1059
|
+
let multiplier = mult10[((u8Array[3] & 0x7f) << 1) | (u8Array[2] >> 7)]
|
|
1060
|
+
return ((multiplier * float32Number + (float32Number > 0 ? 0.5 : -0.5)) >> 0) / multiplier
|
|
1061
|
+
}
|