@harperfast/harper 5.0.0-alpha.10
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/CODE_OF_CONDUCT.md +83 -0
- package/LICENSE +201 -0
- package/README.md +54 -0
- package/SECURITY.md +18 -0
- package/SUPPORT.md +26 -0
- package/dist/bin/BinObjects.d.ts +9 -0
- package/dist/bin/BinObjects.js +15 -0
- package/dist/bin/BinObjects.js.map +1 -0
- package/dist/bin/cliOperations.d.ts +12 -0
- package/dist/bin/cliOperations.js +156 -0
- package/dist/bin/cliOperations.js.map +1 -0
- package/dist/bin/copyDb.d.ts +2 -0
- package/dist/bin/copyDb.js +298 -0
- package/dist/bin/copyDb.js.map +1 -0
- package/dist/bin/harper.d.ts +2 -0
- package/dist/bin/harper.js +148 -0
- package/dist/bin/harper.js.map +1 -0
- package/dist/bin/install.d.ts +2 -0
- package/dist/bin/install.js +16 -0
- package/dist/bin/install.js.map +1 -0
- package/dist/bin/lite.d.ts +1 -0
- package/dist/bin/lite.js +6 -0
- package/dist/bin/lite.js.map +1 -0
- package/dist/bin/restart.d.ts +13 -0
- package/dist/bin/restart.js +194 -0
- package/dist/bin/restart.js.map +1 -0
- package/dist/bin/run.d.ts +21 -0
- package/dist/bin/run.js +365 -0
- package/dist/bin/run.js.map +1 -0
- package/dist/bin/status.d.ts +2 -0
- package/dist/bin/status.js +56 -0
- package/dist/bin/status.js.map +1 -0
- package/dist/bin/stop.d.ts +2 -0
- package/dist/bin/stop.js +17 -0
- package/dist/bin/stop.js.map +1 -0
- package/dist/bin/upgrade.d.ts +7 -0
- package/dist/bin/upgrade.js +111 -0
- package/dist/bin/upgrade.js.map +1 -0
- package/dist/components/Application.d.ts +110 -0
- package/dist/components/Application.js +509 -0
- package/dist/components/Application.js.map +1 -0
- package/dist/components/ApplicationScope.d.ts +28 -0
- package/dist/components/ApplicationScope.js +81 -0
- package/dist/components/ApplicationScope.js.map +1 -0
- package/dist/components/Component.d.ts +21 -0
- package/dist/components/Component.js +43 -0
- package/dist/components/Component.js.map +1 -0
- package/dist/components/ComponentV1.d.ts +69 -0
- package/dist/components/ComponentV1.js +263 -0
- package/dist/components/ComponentV1.js.map +1 -0
- package/dist/components/DEFAULT_CONFIG.d.ts +18 -0
- package/dist/components/DEFAULT_CONFIG.js +22 -0
- package/dist/components/DEFAULT_CONFIG.js.map +1 -0
- package/dist/components/EntryHandler.d.ts +61 -0
- package/dist/components/EntryHandler.js +148 -0
- package/dist/components/EntryHandler.js.map +1 -0
- package/dist/components/OptionsWatcher.d.ts +75 -0
- package/dist/components/OptionsWatcher.js +281 -0
- package/dist/components/OptionsWatcher.js.map +1 -0
- package/dist/components/PluginModule.d.ts +5 -0
- package/dist/components/PluginModule.js +3 -0
- package/dist/components/PluginModule.js.map +1 -0
- package/dist/components/Scope.d.ts +49 -0
- package/dist/components/Scope.js +262 -0
- package/dist/components/Scope.js.map +1 -0
- package/dist/components/componentLoader.js +498 -0
- package/dist/components/componentLoader.js.map +1 -0
- package/dist/components/deriveCommonPatternBase.d.ts +1 -0
- package/dist/components/deriveCommonPatternBase.js +34 -0
- package/dist/components/deriveCommonPatternBase.js.map +1 -0
- package/dist/components/deriveGlobOptions.d.ts +13 -0
- package/dist/components/deriveGlobOptions.js +30 -0
- package/dist/components/deriveGlobOptions.js.map +1 -0
- package/dist/components/deriveURLPath.d.ts +3 -0
- package/dist/components/deriveURLPath.js +55 -0
- package/dist/components/deriveURLPath.js.map +1 -0
- package/dist/components/operations.d.ts +97 -0
- package/dist/components/operations.js +556 -0
- package/dist/components/operations.js.map +1 -0
- package/dist/components/operationsValidation.d.ts +44 -0
- package/dist/components/operationsValidation.js +221 -0
- package/dist/components/operationsValidation.js.map +1 -0
- package/dist/components/packageComponent.d.ts +8 -0
- package/dist/components/packageComponent.js +42 -0
- package/dist/components/packageComponent.js.map +1 -0
- package/dist/components/requestRestart.d.ts +3 -0
- package/dist/components/requestRestart.js +27 -0
- package/dist/components/requestRestart.js.map +1 -0
- package/dist/components/resolveBaseURLPath.d.ts +15 -0
- package/dist/components/resolveBaseURLPath.js +38 -0
- package/dist/components/resolveBaseURLPath.js.map +1 -0
- package/dist/components/status/ComponentStatus.d.ts +61 -0
- package/dist/components/status/ComponentStatus.js +102 -0
- package/dist/components/status/ComponentStatus.js.map +1 -0
- package/dist/components/status/ComponentStatusRegistry.d.ts +89 -0
- package/dist/components/status/ComponentStatusRegistry.js +195 -0
- package/dist/components/status/ComponentStatusRegistry.js.map +1 -0
- package/dist/components/status/api.d.ts +104 -0
- package/dist/components/status/api.js +137 -0
- package/dist/components/status/api.js.map +1 -0
- package/dist/components/status/crossThread.d.ts +62 -0
- package/dist/components/status/crossThread.js +343 -0
- package/dist/components/status/crossThread.js.map +1 -0
- package/dist/components/status/errors.d.ts +68 -0
- package/dist/components/status/errors.js +123 -0
- package/dist/components/status/errors.js.map +1 -0
- package/dist/components/status/index.d.ts +35 -0
- package/dist/components/status/index.js +75 -0
- package/dist/components/status/index.js.map +1 -0
- package/dist/components/status/internal.d.ts +40 -0
- package/dist/components/status/internal.js +76 -0
- package/dist/components/status/internal.js.map +1 -0
- package/dist/components/status/registry.d.ts +10 -0
- package/dist/components/status/registry.js +14 -0
- package/dist/components/status/registry.js.map +1 -0
- package/dist/components/status/types.d.ts +94 -0
- package/dist/components/status/types.js +20 -0
- package/dist/components/status/types.js.map +1 -0
- package/dist/config/RootConfigWatcher.d.ts +10 -0
- package/dist/config/RootConfigWatcher.js +59 -0
- package/dist/config/RootConfigWatcher.js.map +1 -0
- package/dist/config/configHelpers.d.ts +6 -0
- package/dist/config/configHelpers.js +47 -0
- package/dist/config/configHelpers.js.map +1 -0
- package/dist/config/configUtils.d.ts +85 -0
- package/dist/config/configUtils.js +801 -0
- package/dist/config/configUtils.js.map +1 -0
- package/dist/config/harperConfigEnvVars.d.ts +46 -0
- package/dist/config/harperConfigEnvVars.js +527 -0
- package/dist/config/harperConfigEnvVars.js.map +1 -0
- package/dist/dataLayer/CreateAttributeObject.d.ts +19 -0
- package/dist/dataLayer/CreateAttributeObject.js +23 -0
- package/dist/dataLayer/CreateAttributeObject.js.map +1 -0
- package/dist/dataLayer/CreateTableObject.d.ts +7 -0
- package/dist/dataLayer/CreateTableObject.js +10 -0
- package/dist/dataLayer/CreateTableObject.js.map +1 -0
- package/dist/dataLayer/DataLayerObjects.d.ts +22 -0
- package/dist/dataLayer/DataLayerObjects.js +33 -0
- package/dist/dataLayer/DataLayerObjects.js.map +1 -0
- package/dist/dataLayer/DeleteBeforeObject.d.ts +18 -0
- package/dist/dataLayer/DeleteBeforeObject.js +21 -0
- package/dist/dataLayer/DeleteBeforeObject.js.map +1 -0
- package/dist/dataLayer/DeleteObject.d.ts +19 -0
- package/dist/dataLayer/DeleteObject.js +23 -0
- package/dist/dataLayer/DeleteObject.js.map +1 -0
- package/dist/dataLayer/DropAttributeObject.d.ts +7 -0
- package/dist/dataLayer/DropAttributeObject.js +10 -0
- package/dist/dataLayer/DropAttributeObject.js.map +1 -0
- package/dist/dataLayer/GetBackupObject.d.ts +16 -0
- package/dist/dataLayer/GetBackupObject.js +20 -0
- package/dist/dataLayer/GetBackupObject.js.map +1 -0
- package/dist/dataLayer/InsertObject.d.ts +20 -0
- package/dist/dataLayer/InsertObject.js +24 -0
- package/dist/dataLayer/InsertObject.js.map +1 -0
- package/dist/dataLayer/ReadAuditLogObject.d.ts +18 -0
- package/dist/dataLayer/ReadAuditLogObject.js +22 -0
- package/dist/dataLayer/ReadAuditLogObject.js.map +1 -0
- package/dist/dataLayer/SQLSearch.d.ts +171 -0
- package/dist/dataLayer/SQLSearch.js +1168 -0
- package/dist/dataLayer/SQLSearch.js.map +1 -0
- package/dist/dataLayer/SearchByConditionsObject.d.ts +85 -0
- package/dist/dataLayer/SearchByConditionsObject.js +57 -0
- package/dist/dataLayer/SearchByConditionsObject.js.map +1 -0
- package/dist/dataLayer/SearchByHashObject.d.ts +17 -0
- package/dist/dataLayer/SearchByHashObject.js +20 -0
- package/dist/dataLayer/SearchByHashObject.js.map +1 -0
- package/dist/dataLayer/SearchObject.d.ts +30 -0
- package/dist/dataLayer/SearchObject.js +33 -0
- package/dist/dataLayer/SearchObject.js.map +1 -0
- package/dist/dataLayer/SqlSearchObject.d.ts +10 -0
- package/dist/dataLayer/SqlSearchObject.js +13 -0
- package/dist/dataLayer/SqlSearchObject.js.map +1 -0
- package/dist/dataLayer/UpdateObject.d.ts +18 -0
- package/dist/dataLayer/UpdateObject.js +22 -0
- package/dist/dataLayer/UpdateObject.js.map +1 -0
- package/dist/dataLayer/UpsertObject.d.ts +18 -0
- package/dist/dataLayer/UpsertObject.js +22 -0
- package/dist/dataLayer/UpsertObject.js.map +1 -0
- package/dist/dataLayer/bulkLoad.d.ts +28 -0
- package/dist/dataLayer/bulkLoad.js +624 -0
- package/dist/dataLayer/bulkLoad.js.map +1 -0
- package/dist/dataLayer/dataObjects/BulkLoadObjects.d.ts +17 -0
- package/dist/dataLayer/dataObjects/BulkLoadObjects.js +25 -0
- package/dist/dataLayer/dataObjects/BulkLoadObjects.js.map +1 -0
- package/dist/dataLayer/dataObjects/UpsertObject.d.ts +18 -0
- package/dist/dataLayer/dataObjects/UpsertObject.js +22 -0
- package/dist/dataLayer/dataObjects/UpsertObject.js.map +1 -0
- package/dist/dataLayer/delete.d.ts +22 -0
- package/dist/dataLayer/delete.js +111 -0
- package/dist/dataLayer/delete.js.map +1 -0
- package/dist/dataLayer/export.d.ts +15 -0
- package/dist/dataLayer/export.js +302 -0
- package/dist/dataLayer/export.js.map +1 -0
- package/dist/dataLayer/getBackup.d.ts +8 -0
- package/dist/dataLayer/getBackup.js +28 -0
- package/dist/dataLayer/getBackup.js.map +1 -0
- package/dist/dataLayer/harperBridge/BridgeMethods.d.ts +24 -0
- package/dist/dataLayer/harperBridge/BridgeMethods.js +62 -0
- package/dist/dataLayer/harperBridge/BridgeMethods.js.map +1 -0
- package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +104 -0
- package/dist/dataLayer/harperBridge/ResourceBridge.js +630 -0
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -0
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.d.ts +14 -0
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.js +24 -0
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.js.map +1 -0
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.d.ts +11 -0
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +68 -0
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js.map +1 -0
- package/dist/dataLayer/harperBridge/harperBridge.d.ts +2 -0
- package/dist/dataLayer/harperBridge/harperBridge.js +18 -0
- package/dist/dataLayer/harperBridge/harperBridge.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/LMDBBridge.d.ts +47 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/LMDBBridge.js +99 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/LMDBBridge.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.d.ts +15 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +18 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.d.ts +12 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +74 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.d.ts +13 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +54 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.d.ts +6 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +23 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +62 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +82 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.d.ts +11 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +76 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.d.ts +9 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +83 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.d.ts +6 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +73 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.d.ts +6 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +110 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.d.ts +14 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +33 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.d.ts +7 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +110 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.d.ts +6 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +21 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.d.ts +14 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +25 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.d.ts +7 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +180 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +134 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.d.ts +6 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +14 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.d.ts +15 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +26 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.js +17 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.d.ts +12 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +52 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.d.ts +15 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +56 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.d.ts +16 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +20 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.d.ts +16 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.js +22 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.d.ts +16 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.js +21 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.d.ts +19 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.js +22 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.d.ts +18 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.js +23 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.d.ts +18 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.js +23 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.d.ts +21 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js +24 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.d.ts +7 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +19 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.d.ts +22 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +137 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.d.ts +9 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +73 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +38 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +29 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.d.ts +17 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +63 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.d.ts +106 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +251 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js.map +1 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.d.ts +8 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +66 -0
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js.map +1 -0
- package/dist/dataLayer/hdbInfoController.d.ts +28 -0
- package/dist/dataLayer/hdbInfoController.js +203 -0
- package/dist/dataLayer/hdbInfoController.js.map +1 -0
- package/dist/dataLayer/insert.d.ts +44 -0
- package/dist/dataLayer/insert.js +192 -0
- package/dist/dataLayer/insert.js.map +1 -0
- package/dist/dataLayer/readAuditLog.d.ts +8 -0
- package/dist/dataLayer/readAuditLog.js +37 -0
- package/dist/dataLayer/readAuditLog.js.map +1 -0
- package/dist/dataLayer/schema.d.ts +24 -0
- package/dist/dataLayer/schema.js +225 -0
- package/dist/dataLayer/schema.js.map +1 -0
- package/dist/dataLayer/schemaDescribe.d.ts +26 -0
- package/dist/dataLayer/schemaDescribe.js +265 -0
- package/dist/dataLayer/schemaDescribe.js.map +1 -0
- package/dist/dataLayer/search.d.ts +4 -0
- package/dist/dataLayer/search.js +56 -0
- package/dist/dataLayer/search.js.map +1 -0
- package/dist/dataLayer/transaction.d.ts +8 -0
- package/dist/dataLayer/transaction.js +16 -0
- package/dist/dataLayer/transaction.js.map +1 -0
- package/dist/dataLayer/update.d.ts +15 -0
- package/dist/dataLayer/update.js +107 -0
- package/dist/dataLayer/update.js.map +1 -0
- package/dist/globals.d.ts +7 -0
- package/dist/globals.js +12 -0
- package/dist/globals.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/json/systemSchema.json +373 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.d.ts +4 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.js +13 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.js.map +1 -0
- package/dist/resources/DatabaseTransaction.d.ts +96 -0
- package/dist/resources/DatabaseTransaction.js +354 -0
- package/dist/resources/DatabaseTransaction.js.map +1 -0
- package/dist/resources/ErrorResource.d.ts +26 -0
- package/dist/resources/ErrorResource.js +60 -0
- package/dist/resources/ErrorResource.js.map +1 -0
- package/dist/resources/IterableEventQueue.d.ts +19 -0
- package/dist/resources/IterableEventQueue.js +103 -0
- package/dist/resources/IterableEventQueue.js.map +1 -0
- package/dist/resources/LMDBTransaction.d.ts +43 -0
- package/dist/resources/LMDBTransaction.js +371 -0
- package/dist/resources/LMDBTransaction.js.map +1 -0
- package/dist/resources/RecordEncoder.d.ts +65 -0
- package/dist/resources/RecordEncoder.js +700 -0
- package/dist/resources/RecordEncoder.js.map +1 -0
- package/dist/resources/RequestTarget.d.ts +57 -0
- package/dist/resources/RequestTarget.js +91 -0
- package/dist/resources/RequestTarget.js.map +1 -0
- package/dist/resources/Resource.d.ts +152 -0
- package/dist/resources/Resource.js +727 -0
- package/dist/resources/Resource.js.map +1 -0
- package/dist/resources/ResourceInterface.d.ts +162 -0
- package/dist/resources/ResourceInterface.js +3 -0
- package/dist/resources/ResourceInterface.js.map +1 -0
- package/dist/resources/ResourceInterfaceV2.d.ts +21 -0
- package/dist/resources/ResourceInterfaceV2.js +3 -0
- package/dist/resources/ResourceInterfaceV2.js.map +1 -0
- package/dist/resources/ResourceV2.d.ts +30 -0
- package/dist/resources/ResourceV2.js +27 -0
- package/dist/resources/ResourceV2.js.map +1 -0
- package/dist/resources/Resources.d.ts +36 -0
- package/dist/resources/Resources.js +155 -0
- package/dist/resources/Resources.js.map +1 -0
- package/dist/resources/RocksIndexStore.d.ts +24 -0
- package/dist/resources/RocksIndexStore.js +54 -0
- package/dist/resources/RocksIndexStore.js.map +1 -0
- package/dist/resources/RocksTransactionLogStore.d.ts +60 -0
- package/dist/resources/RocksTransactionLogStore.js +344 -0
- package/dist/resources/RocksTransactionLogStore.js.map +1 -0
- package/dist/resources/Table.d.ts +854 -0
- package/dist/resources/Table.js +4350 -0
- package/dist/resources/Table.js.map +1 -0
- package/dist/resources/analytics/hostnames.d.ts +16 -0
- package/dist/resources/analytics/hostnames.js +72 -0
- package/dist/resources/analytics/hostnames.js.map +1 -0
- package/dist/resources/analytics/metadata.d.ts +9 -0
- package/dist/resources/analytics/metadata.js +12 -0
- package/dist/resources/analytics/metadata.js.map +1 -0
- package/dist/resources/analytics/profile.d.ts +2 -0
- package/dist/resources/analytics/profile.js +144 -0
- package/dist/resources/analytics/profile.js.map +1 -0
- package/dist/resources/analytics/read.d.ts +41 -0
- package/dist/resources/analytics/read.js +189 -0
- package/dist/resources/analytics/read.js.map +1 -0
- package/dist/resources/analytics/write.d.ts +131 -0
- package/dist/resources/analytics/write.js +822 -0
- package/dist/resources/analytics/write.js.map +1 -0
- package/dist/resources/auditStore.d.ts +81 -0
- package/dist/resources/auditStore.js +572 -0
- package/dist/resources/auditStore.js.map +1 -0
- package/dist/resources/blob.d.ts +137 -0
- package/dist/resources/blob.js +1273 -0
- package/dist/resources/blob.js.map +1 -0
- package/dist/resources/crdt.d.ts +19 -0
- package/dist/resources/crdt.js +146 -0
- package/dist/resources/crdt.js.map +1 -0
- package/dist/resources/dataLoader.d.ts +98 -0
- package/dist/resources/dataLoader.js +461 -0
- package/dist/resources/dataLoader.js.map +1 -0
- package/dist/resources/databases.d.ts +131 -0
- package/dist/resources/databases.js +1220 -0
- package/dist/resources/databases.js.map +1 -0
- package/dist/resources/graphql.d.ts +19 -0
- package/dist/resources/graphql.js +223 -0
- package/dist/resources/graphql.js.map +1 -0
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +87 -0
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +598 -0
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -0
- package/dist/resources/indexes/customIndexes.d.ts +4 -0
- package/dist/resources/indexes/customIndexes.js +10 -0
- package/dist/resources/indexes/customIndexes.js.map +1 -0
- package/dist/resources/indexes/vector.d.ts +2 -0
- package/dist/resources/indexes/vector.js +40 -0
- package/dist/resources/indexes/vector.js.map +1 -0
- package/dist/resources/jsResource.d.ts +24 -0
- package/dist/resources/jsResource.js +82 -0
- package/dist/resources/jsResource.js.map +1 -0
- package/dist/resources/loadEnv.d.ts +5 -0
- package/dist/resources/loadEnv.js +28 -0
- package/dist/resources/loadEnv.js.map +1 -0
- package/dist/resources/login.d.ts +3 -0
- package/dist/resources/login.js +22 -0
- package/dist/resources/login.js.map +1 -0
- package/dist/resources/openApi.d.ts +27 -0
- package/dist/resources/openApi.js +327 -0
- package/dist/resources/openApi.js.map +1 -0
- package/dist/resources/registrationDeprecated.d.ts +4 -0
- package/dist/resources/registrationDeprecated.js +11 -0
- package/dist/resources/registrationDeprecated.js.map +1 -0
- package/dist/resources/replayLogs.d.ts +2 -0
- package/dist/resources/replayLogs.js +170 -0
- package/dist/resources/replayLogs.js.map +1 -0
- package/dist/resources/roles.d.ts +11 -0
- package/dist/resources/roles.js +102 -0
- package/dist/resources/roles.js.map +1 -0
- package/dist/resources/search.d.ts +39 -0
- package/dist/resources/search.js +1333 -0
- package/dist/resources/search.js.map +1 -0
- package/dist/resources/tracked.d.ts +49 -0
- package/dist/resources/tracked.js +665 -0
- package/dist/resources/tracked.js.map +1 -0
- package/dist/resources/transaction.d.ts +9 -0
- package/dist/resources/transaction.js +89 -0
- package/dist/resources/transaction.js.map +1 -0
- package/dist/resources/transactionBroadcast.d.ts +38 -0
- package/dist/resources/transactionBroadcast.js +263 -0
- package/dist/resources/transactionBroadcast.js.map +1 -0
- package/dist/security/auth.d.ts +9 -0
- package/dist/security/auth.js +408 -0
- package/dist/security/auth.js.map +1 -0
- package/dist/security/certificateVerification/certificateVerificationSource.d.ts +18 -0
- package/dist/security/certificateVerification/certificateVerificationSource.js +78 -0
- package/dist/security/certificateVerification/certificateVerificationSource.js.map +1 -0
- package/dist/security/certificateVerification/configValidation.d.ts +14 -0
- package/dist/security/certificateVerification/configValidation.js +101 -0
- package/dist/security/certificateVerification/configValidation.js.map +1 -0
- package/dist/security/certificateVerification/crlVerification.d.ts +29 -0
- package/dist/security/certificateVerification/crlVerification.js +564 -0
- package/dist/security/certificateVerification/crlVerification.js.map +1 -0
- package/dist/security/certificateVerification/index.d.ts +31 -0
- package/dist/security/certificateVerification/index.js +111 -0
- package/dist/security/certificateVerification/index.js.map +1 -0
- package/dist/security/certificateVerification/ocspVerification.d.ts +23 -0
- package/dist/security/certificateVerification/ocspVerification.js +117 -0
- package/dist/security/certificateVerification/ocspVerification.js.map +1 -0
- package/dist/security/certificateVerification/pkijs-ed25519-patch.d.ts +14 -0
- package/dist/security/certificateVerification/pkijs-ed25519-patch.js +183 -0
- package/dist/security/certificateVerification/pkijs-ed25519-patch.js.map +1 -0
- package/dist/security/certificateVerification/types.d.ts +105 -0
- package/dist/security/certificateVerification/types.js +6 -0
- package/dist/security/certificateVerification/types.js.map +1 -0
- package/dist/security/certificateVerification/verificationConfig.d.ts +29 -0
- package/dist/security/certificateVerification/verificationConfig.js +121 -0
- package/dist/security/certificateVerification/verificationConfig.js.map +1 -0
- package/dist/security/certificateVerification/verificationUtils.d.ts +79 -0
- package/dist/security/certificateVerification/verificationUtils.js +441 -0
- package/dist/security/certificateVerification/verificationUtils.js.map +1 -0
- package/dist/security/cryptoHash.d.ts +2 -0
- package/dist/security/cryptoHash.js +35 -0
- package/dist/security/cryptoHash.js.map +1 -0
- package/dist/security/data_objects/PermissionAttributeResponseObject.d.ts +11 -0
- package/dist/security/data_objects/PermissionAttributeResponseObject.js +14 -0
- package/dist/security/data_objects/PermissionAttributeResponseObject.js.map +1 -0
- package/dist/security/data_objects/PermissionResponseObject.d.ts +57 -0
- package/dist/security/data_objects/PermissionResponseObject.js +105 -0
- package/dist/security/data_objects/PermissionResponseObject.js.map +1 -0
- package/dist/security/data_objects/PermissionTableResponseObject.d.ts +16 -0
- package/dist/security/data_objects/PermissionTableResponseObject.js +19 -0
- package/dist/security/data_objects/PermissionTableResponseObject.js.map +1 -0
- package/dist/security/fastifyAuth.d.ts +2 -0
- package/dist/security/fastifyAuth.js +135 -0
- package/dist/security/fastifyAuth.js.map +1 -0
- package/dist/security/impersonation.d.ts +11 -0
- package/dist/security/impersonation.js +139 -0
- package/dist/security/impersonation.js.map +1 -0
- package/dist/security/jsLoader.d.ts +9 -0
- package/dist/security/jsLoader.js +522 -0
- package/dist/security/jsLoader.js.map +1 -0
- package/dist/security/keys.d.ts +119 -0
- package/dist/security/keys.js +866 -0
- package/dist/security/keys.js.map +1 -0
- package/dist/security/permissionsTranslator.d.ts +9 -0
- package/dist/security/permissionsTranslator.js +269 -0
- package/dist/security/permissionsTranslator.js.map +1 -0
- package/dist/security/role.d.ts +5 -0
- package/dist/security/role.js +160 -0
- package/dist/security/role.js.map +1 -0
- package/dist/security/tokenAuthentication.d.ts +38 -0
- package/dist/security/tokenAuthentication.js +205 -0
- package/dist/security/tokenAuthentication.js.map +1 -0
- package/dist/security/user.d.ts +77 -0
- package/dist/security/user.js +349 -0
- package/dist/security/user.js.map +1 -0
- package/dist/server/DurableSubscriptionsSession.d.ts +74 -0
- package/dist/server/DurableSubscriptionsSession.js +511 -0
- package/dist/server/DurableSubscriptionsSession.js.map +1 -0
- package/dist/server/REST.d.ts +16 -0
- package/dist/server/REST.js +423 -0
- package/dist/server/REST.js.map +1 -0
- package/dist/server/Server.d.ts +62 -0
- package/dist/server/Server.js +27 -0
- package/dist/server/Server.js.map +1 -0
- package/dist/server/fastifyRoutes/helpers/getCORSOptions.d.ts +11 -0
- package/dist/server/fastifyRoutes/helpers/getCORSOptions.js +32 -0
- package/dist/server/fastifyRoutes/helpers/getCORSOptions.js.map +1 -0
- package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.d.ts +6 -0
- package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +13 -0
- package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js.map +1 -0
- package/dist/server/fastifyRoutes/helpers/getServerOptions.d.ts +12 -0
- package/dist/server/fastifyRoutes/helpers/getServerOptions.js +30 -0
- package/dist/server/fastifyRoutes/helpers/getServerOptions.js.map +1 -0
- package/dist/server/fastifyRoutes/plugins/hdbCore.d.ts +2 -0
- package/dist/server/fastifyRoutes/plugins/hdbCore.js +31 -0
- package/dist/server/fastifyRoutes/plugins/hdbCore.js.map +1 -0
- package/dist/server/fastifyRoutes.d.ts +25 -0
- package/dist/server/fastifyRoutes.js +235 -0
- package/dist/server/fastifyRoutes.js.map +1 -0
- package/dist/server/graphqlQuerying.d.ts +1 -0
- package/dist/server/graphqlQuerying.js +630 -0
- package/dist/server/graphqlQuerying.js.map +1 -0
- package/dist/server/http.d.ts +15 -0
- package/dist/server/http.js +650 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/itc/serverHandlers.d.ts +10 -0
- package/dist/server/itc/serverHandlers.js +153 -0
- package/dist/server/itc/serverHandlers.js.map +1 -0
- package/dist/server/itc/utility/ITCEventObject.d.ts +6 -0
- package/dist/server/itc/utility/ITCEventObject.js +9 -0
- package/dist/server/itc/utility/ITCEventObject.js.map +1 -0
- package/dist/server/jobs/JobObject.d.ts +15 -0
- package/dist/server/jobs/JobObject.js +22 -0
- package/dist/server/jobs/JobObject.js.map +1 -0
- package/dist/server/jobs/jobProcess.d.ts +1 -0
- package/dist/server/jobs/jobProcess.js +66 -0
- package/dist/server/jobs/jobProcess.js.map +1 -0
- package/dist/server/jobs/jobRunner.d.ts +11 -0
- package/dist/server/jobs/jobRunner.js +160 -0
- package/dist/server/jobs/jobRunner.js.map +1 -0
- package/dist/server/jobs/jobs.d.ts +20 -0
- package/dist/server/jobs/jobs.js +267 -0
- package/dist/server/jobs/jobs.js.map +1 -0
- package/dist/server/loadRootComponents.d.ts +5 -0
- package/dist/server/loadRootComponents.js +45 -0
- package/dist/server/loadRootComponents.js.map +1 -0
- package/dist/server/mqtt.d.ts +9 -0
- package/dist/server/mqtt.js +466 -0
- package/dist/server/mqtt.js.map +1 -0
- package/dist/server/nodeName.d.ts +5 -0
- package/dist/server/nodeName.js +84 -0
- package/dist/server/nodeName.js.map +1 -0
- package/dist/server/operationsServer.d.ts +48 -0
- package/dist/server/operationsServer.js +265 -0
- package/dist/server/operationsServer.js.map +1 -0
- package/dist/server/serverHelpers/Headers.d.ts +20 -0
- package/dist/server/serverHelpers/Headers.js +134 -0
- package/dist/server/serverHelpers/Headers.js.map +1 -0
- package/dist/server/serverHelpers/JSONStream.d.ts +14 -0
- package/dist/server/serverHelpers/JSONStream.js +322 -0
- package/dist/server/serverHelpers/JSONStream.js.map +1 -0
- package/dist/server/serverHelpers/OperationFunctionObject.d.ts +9 -0
- package/dist/server/serverHelpers/OperationFunctionObject.js +17 -0
- package/dist/server/serverHelpers/OperationFunctionObject.js.map +1 -0
- package/dist/server/serverHelpers/Request.d.ts +69 -0
- package/dist/server/serverHelpers/Request.js +141 -0
- package/dist/server/serverHelpers/Request.js.map +1 -0
- package/dist/server/serverHelpers/contentTypes.d.ts +57 -0
- package/dist/server/serverHelpers/contentTypes.js +639 -0
- package/dist/server/serverHelpers/contentTypes.js.map +1 -0
- package/dist/server/serverHelpers/requestTimePlugin.d.ts +2 -0
- package/dist/server/serverHelpers/requestTimePlugin.js +56 -0
- package/dist/server/serverHelpers/requestTimePlugin.js.map +1 -0
- package/dist/server/serverHelpers/serverHandlers.d.ts +6 -0
- package/dist/server/serverHelpers/serverHandlers.js +130 -0
- package/dist/server/serverHelpers/serverHandlers.js.map +1 -0
- package/dist/server/serverHelpers/serverUtilities.d.ts +29 -0
- package/dist/server/serverHelpers/serverUtilities.js +356 -0
- package/dist/server/serverHelpers/serverUtilities.js.map +1 -0
- package/dist/server/serverRegistry.d.ts +3 -0
- package/dist/server/serverRegistry.js +11 -0
- package/dist/server/serverRegistry.js.map +1 -0
- package/dist/server/static.d.ts +16 -0
- package/dist/server/static.js +164 -0
- package/dist/server/static.js.map +1 -0
- package/dist/server/status/definitions.d.ts +27 -0
- package/dist/server/status/definitions.js +22 -0
- package/dist/server/status/definitions.js.map +1 -0
- package/dist/server/status/index.d.ts +26 -0
- package/dist/server/status/index.js +89 -0
- package/dist/server/status/index.js.map +1 -0
- package/dist/server/storageReclamation.d.ts +18 -0
- package/dist/server/storageReclamation.js +96 -0
- package/dist/server/storageReclamation.js.map +1 -0
- package/dist/server/threads/itc.d.ts +53 -0
- package/dist/server/threads/itc.js +81 -0
- package/dist/server/threads/itc.js.map +1 -0
- package/dist/server/threads/manageThreads.d.ts +30 -0
- package/dist/server/threads/manageThreads.js +579 -0
- package/dist/server/threads/manageThreads.js.map +1 -0
- package/dist/server/threads/socketRouter.d.ts +6 -0
- package/dist/server/threads/socketRouter.js +395 -0
- package/dist/server/threads/socketRouter.js.map +1 -0
- package/dist/server/threads/threadServer.d.ts +5 -0
- package/dist/server/threads/threadServer.js +288 -0
- package/dist/server/threads/threadServer.js.map +1 -0
- package/dist/server/throttle.d.ts +7 -0
- package/dist/server/throttle.js +71 -0
- package/dist/server/throttle.js.map +1 -0
- package/dist/sqlTranslator/SelectValidator.d.ts +79 -0
- package/dist/sqlTranslator/SelectValidator.js +274 -0
- package/dist/sqlTranslator/SelectValidator.js.map +1 -0
- package/dist/sqlTranslator/alasqlFunctionImporter.d.ts +2 -0
- package/dist/sqlTranslator/alasqlFunctionImporter.js +55 -0
- package/dist/sqlTranslator/alasqlFunctionImporter.js.map +1 -0
- package/dist/sqlTranslator/deleteTranslator.d.ts +2 -0
- package/dist/sqlTranslator/deleteTranslator.js +56 -0
- package/dist/sqlTranslator/deleteTranslator.js.map +1 -0
- package/dist/sqlTranslator/index.d.ts +16 -0
- package/dist/sqlTranslator/index.js +215 -0
- package/dist/sqlTranslator/index.js.map +1 -0
- package/dist/sqlTranslator/sql_statement_bucket.d.ts +46 -0
- package/dist/sqlTranslator/sql_statement_bucket.js +430 -0
- package/dist/sqlTranslator/sql_statement_bucket.js.map +1 -0
- package/dist/upgrade/UpgradeObjects.d.ts +5 -0
- package/dist/upgrade/UpgradeObjects.js +12 -0
- package/dist/upgrade/UpgradeObjects.js.map +1 -0
- package/dist/upgrade/directives/directivesController.d.ts +30 -0
- package/dist/upgrade/directives/directivesController.js +76 -0
- package/dist/upgrade/directives/directivesController.js.map +1 -0
- package/dist/upgrade/directivesManager.d.ts +7 -0
- package/dist/upgrade/directivesManager.js +125 -0
- package/dist/upgrade/directivesManager.js.map +1 -0
- package/dist/upgrade/upgradePrompt.d.ts +13 -0
- package/dist/upgrade/upgradePrompt.js +102 -0
- package/dist/upgrade/upgradePrompt.js.map +1 -0
- package/dist/upgrade/upgradeUtilities.d.ts +10 -0
- package/dist/upgrade/upgradeUtilities.js +26 -0
- package/dist/upgrade/upgradeUtilities.js.map +1 -0
- package/dist/utility/AWS/AWSConnector.d.ts +2 -0
- package/dist/utility/AWS/AWSConnector.js +26 -0
- package/dist/utility/AWS/AWSConnector.js.map +1 -0
- package/dist/utility/OperationFunctionCaller.d.ts +9 -0
- package/dist/utility/OperationFunctionCaller.js +58 -0
- package/dist/utility/OperationFunctionCaller.js.map +1 -0
- package/dist/utility/assignCmdEnvVariables.d.ts +10 -0
- package/dist/utility/assignCmdEnvVariables.js +55 -0
- package/dist/utility/assignCmdEnvVariables.js.map +1 -0
- package/dist/utility/common_utils.d.ts +264 -0
- package/dist/utility/common_utils.js +806 -0
- package/dist/utility/common_utils.js.map +1 -0
- package/dist/utility/environment/environmentManager.d.ts +41 -0
- package/dist/utility/environment/environmentManager.js +179 -0
- package/dist/utility/environment/environmentManager.js.map +1 -0
- package/dist/utility/environment/systemInformation.d.ts +67 -0
- package/dist/utility/environment/systemInformation.js +326 -0
- package/dist/utility/environment/systemInformation.js.map +1 -0
- package/dist/utility/errors/commonErrors.d.ts +171 -0
- package/dist/utility/errors/commonErrors.js +230 -0
- package/dist/utility/errors/commonErrors.js.map +1 -0
- package/dist/utility/errors/hdbError.d.ts +76 -0
- package/dist/utility/errors/hdbError.js +128 -0
- package/dist/utility/errors/hdbError.js.map +1 -0
- package/dist/utility/functions/date/dateFunctions.d.ts +11 -0
- package/dist/utility/functions/date/dateFunctions.js +64 -0
- package/dist/utility/functions/date/dateFunctions.js.map +1 -0
- package/dist/utility/functions/geo.d.ts +74 -0
- package/dist/utility/functions/geo.js +311 -0
- package/dist/utility/functions/geo.js.map +1 -0
- package/dist/utility/functions/sql/alaSQLExtension.d.ts +13 -0
- package/dist/utility/functions/sql/alaSQLExtension.js +96 -0
- package/dist/utility/functions/sql/alaSQLExtension.js.map +1 -0
- package/dist/utility/globalSchema.d.ts +151 -0
- package/dist/utility/globalSchema.js +34 -0
- package/dist/utility/globalSchema.js.map +1 -0
- package/dist/utility/hdbTerms.d.ts +737 -0
- package/dist/utility/hdbTerms.js +756 -0
- package/dist/utility/hdbTerms.js.map +1 -0
- package/dist/utility/install/checkJWTTokensExist.d.ts +5 -0
- package/dist/utility/install/checkJWTTokensExist.js +53 -0
- package/dist/utility/install/checkJWTTokensExist.js.map +1 -0
- package/dist/utility/install/installer.d.ts +17 -0
- package/dist/utility/install/installer.js +569 -0
- package/dist/utility/install/installer.js.map +1 -0
- package/dist/utility/installation.d.ts +12 -0
- package/dist/utility/installation.js +64 -0
- package/dist/utility/installation.js.map +1 -0
- package/dist/utility/lmdb/DBIDefinition.d.ts +16 -0
- package/dist/utility/lmdb/DBIDefinition.js +19 -0
- package/dist/utility/lmdb/DBIDefinition.js.map +1 -0
- package/dist/utility/lmdb/DeleteRecordsResponseObject.d.ts +21 -0
- package/dist/utility/lmdb/DeleteRecordsResponseObject.js +24 -0
- package/dist/utility/lmdb/DeleteRecordsResponseObject.js.map +1 -0
- package/dist/utility/lmdb/InsertRecordsResponseObject.d.ts +18 -0
- package/dist/utility/lmdb/InsertRecordsResponseObject.js +21 -0
- package/dist/utility/lmdb/InsertRecordsResponseObject.js.map +1 -0
- package/dist/utility/lmdb/OpenDBIObject.d.ts +23 -0
- package/dist/utility/lmdb/OpenDBIObject.js +29 -0
- package/dist/utility/lmdb/OpenDBIObject.js.map +1 -0
- package/dist/utility/lmdb/OpenEnvironmentObject.d.ts +22 -0
- package/dist/utility/lmdb/OpenEnvironmentObject.js +40 -0
- package/dist/utility/lmdb/OpenEnvironmentObject.js.map +1 -0
- package/dist/utility/lmdb/UpdateRecordsResponseObject.d.ts +21 -0
- package/dist/utility/lmdb/UpdateRecordsResponseObject.js +24 -0
- package/dist/utility/lmdb/UpdateRecordsResponseObject.js.map +1 -0
- package/dist/utility/lmdb/UpsertRecordsResponseObject.d.ts +18 -0
- package/dist/utility/lmdb/UpsertRecordsResponseObject.js +21 -0
- package/dist/utility/lmdb/UpsertRecordsResponseObject.js.map +1 -0
- package/dist/utility/lmdb/cleanLMDBMap.d.ts +6 -0
- package/dist/utility/lmdb/cleanLMDBMap.js +63 -0
- package/dist/utility/lmdb/cleanLMDBMap.js.map +1 -0
- package/dist/utility/lmdb/commonUtility.d.ts +28 -0
- package/dist/utility/lmdb/commonUtility.js +120 -0
- package/dist/utility/lmdb/commonUtility.js.map +1 -0
- package/dist/utility/lmdb/deleteUtility.d.ts +10 -0
- package/dist/utility/lmdb/deleteUtility.js +115 -0
- package/dist/utility/lmdb/deleteUtility.js.map +1 -0
- package/dist/utility/lmdb/environmentUtility.d.ts +81 -0
- package/dist/utility/lmdb/environmentUtility.js +432 -0
- package/dist/utility/lmdb/environmentUtility.js.map +1 -0
- package/dist/utility/lmdb/searchCursorFunctions.d.ts +93 -0
- package/dist/utility/lmdb/searchCursorFunctions.js +174 -0
- package/dist/utility/lmdb/searchCursorFunctions.js.map +1 -0
- package/dist/utility/lmdb/searchUtility.d.ts +204 -0
- package/dist/utility/lmdb/searchUtility.js +724 -0
- package/dist/utility/lmdb/searchUtility.js.map +1 -0
- package/dist/utility/lmdb/terms.d.ts +34 -0
- package/dist/utility/lmdb/terms.js +52 -0
- package/dist/utility/lmdb/terms.js.map +1 -0
- package/dist/utility/lmdb/writeUtility.d.ts +32 -0
- package/dist/utility/lmdb/writeUtility.js +360 -0
- package/dist/utility/lmdb/writeUtility.js.map +1 -0
- package/dist/utility/logging/harper_logger.d.ts +141 -0
- package/dist/utility/logging/harper_logger.js +862 -0
- package/dist/utility/logging/harper_logger.js.map +1 -0
- package/dist/utility/logging/logRotator.d.ts +19 -0
- package/dist/utility/logging/logRotator.js +146 -0
- package/dist/utility/logging/logRotator.js.map +1 -0
- package/dist/utility/logging/logger.d.ts +11 -0
- package/dist/utility/logging/logger.js +19 -0
- package/dist/utility/logging/logger.js.map +1 -0
- package/dist/utility/logging/readLog.d.ts +8 -0
- package/dist/utility/logging/readLog.js +339 -0
- package/dist/utility/logging/readLog.js.map +1 -0
- package/dist/utility/logging/transactionLog.d.ts +8 -0
- package/dist/utility/logging/transactionLog.js +46 -0
- package/dist/utility/logging/transactionLog.js.map +1 -0
- package/dist/utility/mount_hdb.d.ts +2 -0
- package/dist/utility/mount_hdb.js +51 -0
- package/dist/utility/mount_hdb.js.map +1 -0
- package/dist/utility/npmUtilities.d.ts +6 -0
- package/dist/utility/npmUtilities.js +91 -0
- package/dist/utility/npmUtilities.js.map +1 -0
- package/dist/utility/operationPermissions.d.ts +36 -0
- package/dist/utility/operationPermissions.js +116 -0
- package/dist/utility/operationPermissions.js.map +1 -0
- package/dist/utility/operation_authorization.d.ts +18 -0
- package/dist/utility/operation_authorization.js +667 -0
- package/dist/utility/operation_authorization.js.map +1 -0
- package/dist/utility/packageUtils.d.ts +9 -0
- package/dist/utility/packageUtils.js +52 -0
- package/dist/utility/packageUtils.js.map +1 -0
- package/dist/utility/password.d.ts +20 -0
- package/dist/utility/password.js +119 -0
- package/dist/utility/password.js.map +1 -0
- package/dist/utility/processManagement/processManagement.d.ts +35 -0
- package/dist/utility/processManagement/processManagement.js +188 -0
- package/dist/utility/processManagement/processManagement.js.map +1 -0
- package/dist/utility/processManagement/servicesConfig.d.ts +29 -0
- package/dist/utility/processManagement/servicesConfig.js +52 -0
- package/dist/utility/processManagement/servicesConfig.js.map +1 -0
- package/dist/utility/scripts/restartHdb.d.ts +1 -0
- package/dist/utility/scripts/restartHdb.js +23 -0
- package/dist/utility/scripts/restartHdb.js.map +1 -0
- package/dist/utility/signalling.d.ts +2 -0
- package/dist/utility/signalling.js +35 -0
- package/dist/utility/signalling.js.map +1 -0
- package/dist/utility/terms/certificates.d.ts +46 -0
- package/dist/utility/terms/certificates.js +65 -0
- package/dist/utility/terms/certificates.js.map +1 -0
- package/dist/utility/when.d.ts +3 -0
- package/dist/utility/when.js +18 -0
- package/dist/utility/when.js.map +1 -0
- package/dist/validation/bulkDeleteValidator.d.ts +2 -0
- package/dist/validation/bulkDeleteValidator.js +21 -0
- package/dist/validation/bulkDeleteValidator.js.map +1 -0
- package/dist/validation/check_permissions.d.ts +2 -0
- package/dist/validation/check_permissions.js +20 -0
- package/dist/validation/check_permissions.js.map +1 -0
- package/dist/validation/common_validators.d.ts +19 -0
- package/dist/validation/common_validators.js +76 -0
- package/dist/validation/common_validators.js.map +1 -0
- package/dist/validation/configValidator.d.ts +8 -0
- package/dist/validation/configValidator.js +292 -0
- package/dist/validation/configValidator.js.map +1 -0
- package/dist/validation/deleteValidator.d.ts +2 -0
- package/dist/validation/deleteValidator.js +15 -0
- package/dist/validation/deleteValidator.js.map +1 -0
- package/dist/validation/fileLoadValidator.d.ts +4 -0
- package/dist/validation/fileLoadValidator.js +138 -0
- package/dist/validation/fileLoadValidator.js.map +1 -0
- package/dist/validation/insertValidator.d.ts +2 -0
- package/dist/validation/insertValidator.js +38 -0
- package/dist/validation/insertValidator.js.map +1 -0
- package/dist/validation/installValidator.d.ts +7 -0
- package/dist/validation/installValidator.js +28 -0
- package/dist/validation/installValidator.js.map +1 -0
- package/dist/validation/readLogValidator.d.ts +2 -0
- package/dist/validation/readLogValidator.js +48 -0
- package/dist/validation/readLogValidator.js.map +1 -0
- package/dist/validation/role_validation.d.ts +3 -0
- package/dist/validation/role_validation.js +284 -0
- package/dist/validation/role_validation.js.map +1 -0
- package/dist/validation/schemaMetadataValidator.d.ts +16 -0
- package/dist/validation/schemaMetadataValidator.js +38 -0
- package/dist/validation/schemaMetadataValidator.js.map +1 -0
- package/dist/validation/searchValidator.d.ts +2 -0
- package/dist/validation/searchValidator.js +141 -0
- package/dist/validation/searchValidator.js.map +1 -0
- package/dist/validation/statusValidator.d.ts +19 -0
- package/dist/validation/statusValidator.js +95 -0
- package/dist/validation/statusValidator.js.map +1 -0
- package/dist/validation/transactionLogValidator.d.ts +2 -0
- package/dist/validation/transactionLogValidator.js +28 -0
- package/dist/validation/transactionLogValidator.js.map +1 -0
- package/dist/validation/user_validation.d.ts +3 -0
- package/dist/validation/user_validation.js +52 -0
- package/dist/validation/user_validation.js.map +1 -0
- package/dist/validation/validationWrapper.d.ts +15 -0
- package/dist/validation/validationWrapper.js +95 -0
- package/dist/validation/validationWrapper.js.map +1 -0
- package/package.json +225 -0
- package/static/README.md +13 -0
- package/static/ascii_logo.txt +21 -0
- package/static/defaultConfig.yaml +75 -0
|
@@ -0,0 +1,1333 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COERCIBLE_OPERATORS = void 0;
|
|
4
|
+
exports.executeConditions = executeConditions;
|
|
5
|
+
exports.searchByIndex = searchByIndex;
|
|
6
|
+
exports.findAttribute = findAttribute;
|
|
7
|
+
exports.filterByType = filterByType;
|
|
8
|
+
exports.estimateCondition = estimateCondition;
|
|
9
|
+
exports.parseQuery = parseQuery;
|
|
10
|
+
exports.flattenKey = flattenKey;
|
|
11
|
+
exports.intersectionEstimate = intersectionEstimate;
|
|
12
|
+
const hdbError_js_1 = require("../utility/errors/hdbError.js");
|
|
13
|
+
const terms_js_1 = require("../utility/lmdb/terms.js");
|
|
14
|
+
const ordered_binary_1 = require("ordered-binary");
|
|
15
|
+
const extended_iterable_1 = require("@harperfast/extended-iterable");
|
|
16
|
+
const Table_ts_1 = require("./Table.js");
|
|
17
|
+
const RecordEncoder_ts_1 = require("./RecordEncoder.js");
|
|
18
|
+
const write_1 = require("./analytics/write");
|
|
19
|
+
// these are ratios/percentages of overall table size
|
|
20
|
+
const OPEN_RANGE_ESTIMATE = 0.3;
|
|
21
|
+
const BETWEEN_ESTIMATE = 0.1;
|
|
22
|
+
const STARTS_WITH_ESTIMATE = 0.05;
|
|
23
|
+
const SYMBOL_OPERATORS = {
|
|
24
|
+
// these are coercing operators
|
|
25
|
+
'<': 'lt',
|
|
26
|
+
'<=': 'le',
|
|
27
|
+
'>': 'gt',
|
|
28
|
+
'>=': 'ge',
|
|
29
|
+
'!=': 'ne',
|
|
30
|
+
'==': 'eq',
|
|
31
|
+
// these are strict operators:
|
|
32
|
+
'===': 'equals',
|
|
33
|
+
'!==': 'not_equal',
|
|
34
|
+
};
|
|
35
|
+
exports.COERCIBLE_OPERATORS = {
|
|
36
|
+
lt: true,
|
|
37
|
+
le: true,
|
|
38
|
+
gt: true,
|
|
39
|
+
ge: true,
|
|
40
|
+
ne: true,
|
|
41
|
+
eq: true,
|
|
42
|
+
};
|
|
43
|
+
function executeConditions(conditions, operator, table, txn, request, context, transformToEntries, filtered) {
|
|
44
|
+
const firstSearch = conditions[0];
|
|
45
|
+
// both AND and OR start by getting an iterator for the ids for first condition
|
|
46
|
+
// and then things diverge...
|
|
47
|
+
if (operator === 'or') {
|
|
48
|
+
let results = executeCondition(firstSearch);
|
|
49
|
+
//get the union of ids from all condition searches
|
|
50
|
+
for (let i = 1; i < conditions.length; i++) {
|
|
51
|
+
const condition = conditions[i];
|
|
52
|
+
// might want to lazily execute this after getting to this point in the iteration
|
|
53
|
+
const nextResults = executeCondition(condition);
|
|
54
|
+
results = results.concat(nextResults);
|
|
55
|
+
}
|
|
56
|
+
const returnedIds = new Set();
|
|
57
|
+
return results.filter((entry) => {
|
|
58
|
+
const id = entry.key ?? entry;
|
|
59
|
+
if (returnedIds.has(id))
|
|
60
|
+
// skip duplicate ids
|
|
61
|
+
return false;
|
|
62
|
+
returnedIds.add(id);
|
|
63
|
+
return true;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// AND
|
|
68
|
+
const results = executeCondition(firstSearch);
|
|
69
|
+
// get the intersection of condition searches by using the indexed query for the first condition
|
|
70
|
+
// and then filtering by all subsequent conditions.
|
|
71
|
+
// now apply filters that require looking up records
|
|
72
|
+
const filters = mapConditionsToFilters(conditions.slice(1), true, firstSearch.estimated_count);
|
|
73
|
+
return filters.length > 0 ? transformToEntries(results, filters) : results;
|
|
74
|
+
}
|
|
75
|
+
function executeCondition(condition) {
|
|
76
|
+
if (condition.conditions)
|
|
77
|
+
return executeConditions(condition.conditions, condition.operator, table, txn, request, context, transformToEntries, filtered);
|
|
78
|
+
return searchByIndex(condition, txn, condition.descending || request.reverse === true, table, request.allowFullScan, filtered, context);
|
|
79
|
+
}
|
|
80
|
+
function mapConditionsToFilters(conditions, intersection, estimatedIncomingCount) {
|
|
81
|
+
return conditions
|
|
82
|
+
.map((condition, index) => {
|
|
83
|
+
if (condition.conditions) {
|
|
84
|
+
// this is a group of conditions, we need to combine them
|
|
85
|
+
const union = condition.operator === 'or';
|
|
86
|
+
const filters = mapConditionsToFilters(condition.conditions, !union, estimatedIncomingCount);
|
|
87
|
+
if (union)
|
|
88
|
+
return (record, entry) => filters.some((filter) => filter(record, entry));
|
|
89
|
+
else
|
|
90
|
+
return (record, entry) => filters.every((filter) => filter(record, entry));
|
|
91
|
+
}
|
|
92
|
+
const isPrimaryKey = (condition.attribute || condition[0]) === table.primaryKey;
|
|
93
|
+
const filter = filterByType(condition, table, context, filtered, isPrimaryKey, estimatedIncomingCount);
|
|
94
|
+
if (intersection && index < conditions.length - 1 && estimatedIncomingCount) {
|
|
95
|
+
estimatedIncomingCount = intersectionEstimate(table.primaryStore, condition.estimated_count, estimatedIncomingCount);
|
|
96
|
+
}
|
|
97
|
+
return filter;
|
|
98
|
+
})
|
|
99
|
+
.filter(Boolean);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Search for records or keys, based on the search condition, using an index if available
|
|
104
|
+
* @param searchCondition
|
|
105
|
+
* @param transaction
|
|
106
|
+
* @param reverse
|
|
107
|
+
* @param Table
|
|
108
|
+
* @param allowFullScan
|
|
109
|
+
* @param filtered
|
|
110
|
+
*/
|
|
111
|
+
function searchByIndex(searchCondition, transaction, reverse, Table, allowFullScan, filtered, context) {
|
|
112
|
+
let attribute_name = searchCondition[0] ?? searchCondition.attribute;
|
|
113
|
+
let value = searchCondition[1] ?? searchCondition.value;
|
|
114
|
+
const comparator = searchCondition.comparator;
|
|
115
|
+
if (value === undefined && comparator !== 'sort') {
|
|
116
|
+
throw new hdbError_js_1.ClientError(`Search condition for ${attribute_name} must have a value`);
|
|
117
|
+
}
|
|
118
|
+
if (Array.isArray(attribute_name)) {
|
|
119
|
+
const firstAttributeName = attribute_name[0];
|
|
120
|
+
// get the potential relationship attribute
|
|
121
|
+
const attribute = findAttribute(Table.attributes, firstAttributeName);
|
|
122
|
+
if (attribute.relationship) {
|
|
123
|
+
// it is a join/relational query
|
|
124
|
+
if (attribute_name.length < 2)
|
|
125
|
+
throw new hdbError_js_1.ClientError('Can not directly query a relational attribute, must query an attribute within the target table');
|
|
126
|
+
const relatedTable = attribute.definition?.tableClass || attribute.elements?.definition?.tableClass;
|
|
127
|
+
const joined = new Map();
|
|
128
|
+
// search the related table
|
|
129
|
+
let results = searchByIndex({
|
|
130
|
+
attribute: attribute_name.length > 2 ? attribute_name.slice(1) : attribute_name[1],
|
|
131
|
+
value,
|
|
132
|
+
comparator,
|
|
133
|
+
}, transaction, reverse, relatedTable, allowFullScan, joined);
|
|
134
|
+
if (attribute.relationship.to) {
|
|
135
|
+
// this is one-to-many or many-to-many, so we need to track the filtering of related entries that match
|
|
136
|
+
filtered[attribute_name[0]] = joined;
|
|
137
|
+
// Use the joinTo to join the results of the related table to the current table (can be one-to-many or many-to-many)
|
|
138
|
+
const isManyToMany = Boolean(findAttribute(relatedTable.attributes, attribute.relationship.to)?.elements);
|
|
139
|
+
results = joinTo(results, attribute, relatedTable.primaryStore, isManyToMany, joined);
|
|
140
|
+
}
|
|
141
|
+
if (attribute.relationship.from) {
|
|
142
|
+
const searchEntry = (relatedEntry) => {
|
|
143
|
+
if (relatedEntry?.key !== undefined)
|
|
144
|
+
relatedEntry = relatedEntry.key;
|
|
145
|
+
return searchByIndex({ attribute: attribute.relationship.from, value: relatedEntry }, transaction, reverse, Table, allowFullScan, joined);
|
|
146
|
+
};
|
|
147
|
+
if (attribute.elements) {
|
|
148
|
+
filtered[attribute_name[0]] = joined;
|
|
149
|
+
// many-to-many relationship (forward), get all the ids first
|
|
150
|
+
results = joinFrom(results, attribute, relatedTable.primaryStore, joined, searchEntry);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// many-to-one relationship, need to flatten the ids that point back to potentially many instances of this
|
|
154
|
+
results = results.flatMap(searchEntry);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return results;
|
|
158
|
+
}
|
|
159
|
+
else if (attribute_name.length === 1) {
|
|
160
|
+
attribute_name = attribute_name[0];
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
throw new hdbError_js_1.ClientError('Unable to query by attribute ' + JSON.stringify(attribute_name));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const isPrimaryKey = attribute_name === Table.primaryKey || attribute_name == null;
|
|
167
|
+
const index = isPrimaryKey ? Table.primaryStore : Table.indices[attribute_name];
|
|
168
|
+
let start;
|
|
169
|
+
let end, inclusiveEnd, exclusiveStart;
|
|
170
|
+
if (value instanceof Date)
|
|
171
|
+
value = value.getTime();
|
|
172
|
+
let needFullScan;
|
|
173
|
+
switch (ALTERNATE_COMPARATOR_NAMES[comparator] || comparator) {
|
|
174
|
+
case 'lt':
|
|
175
|
+
start = true;
|
|
176
|
+
end = value;
|
|
177
|
+
break;
|
|
178
|
+
case 'le':
|
|
179
|
+
start = true;
|
|
180
|
+
end = value;
|
|
181
|
+
inclusiveEnd = true;
|
|
182
|
+
break;
|
|
183
|
+
case 'gt':
|
|
184
|
+
start = value;
|
|
185
|
+
exclusiveStart = true;
|
|
186
|
+
break;
|
|
187
|
+
case 'ge':
|
|
188
|
+
start = value;
|
|
189
|
+
break;
|
|
190
|
+
case 'prefix': // this is form finding multi-part keys that start with the provided prefix
|
|
191
|
+
// this search needs to be of the form:
|
|
192
|
+
// start: [prefix, null], end: [prefix, MAXIMUM_KEY]
|
|
193
|
+
if (!Array.isArray(value))
|
|
194
|
+
value = [value, null];
|
|
195
|
+
else if (value[value.length - 1] != null)
|
|
196
|
+
value = value.concat(null);
|
|
197
|
+
start = value;
|
|
198
|
+
end = value.slice(0);
|
|
199
|
+
end[end.length - 1] = ordered_binary_1.MAXIMUM_KEY;
|
|
200
|
+
break;
|
|
201
|
+
case 'starts_with':
|
|
202
|
+
start = value.toString();
|
|
203
|
+
end = value + String.fromCharCode(0xffff);
|
|
204
|
+
break;
|
|
205
|
+
case 'between':
|
|
206
|
+
case 'gele':
|
|
207
|
+
case 'gelt':
|
|
208
|
+
case 'gtlt':
|
|
209
|
+
case 'gtle':
|
|
210
|
+
start = value[0];
|
|
211
|
+
if (start instanceof Date)
|
|
212
|
+
start = start.getTime();
|
|
213
|
+
end = value[1];
|
|
214
|
+
if (end instanceof Date)
|
|
215
|
+
end = end.getTime();
|
|
216
|
+
inclusiveEnd = comparator === 'gele' || comparator === 'gtle' || comparator === 'between';
|
|
217
|
+
exclusiveStart = comparator === 'gtlt' || comparator === 'gtle';
|
|
218
|
+
break;
|
|
219
|
+
case 'equals':
|
|
220
|
+
case undefined:
|
|
221
|
+
start = value;
|
|
222
|
+
end = value;
|
|
223
|
+
inclusiveEnd = true;
|
|
224
|
+
break;
|
|
225
|
+
case 'ne':
|
|
226
|
+
if (value === null) {
|
|
227
|
+
// since null is the lowest value in an index, we can treat anything higher as a non-null
|
|
228
|
+
start = value;
|
|
229
|
+
exclusiveStart = true;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case 'sort': // this is a special case for when we want to get all records for sorting
|
|
233
|
+
case 'contains':
|
|
234
|
+
case 'ends_with':
|
|
235
|
+
// we have to revert to full table scan here
|
|
236
|
+
start = true;
|
|
237
|
+
needFullScan = true;
|
|
238
|
+
break;
|
|
239
|
+
default:
|
|
240
|
+
throw new hdbError_js_1.ClientError(`Unknown query comparator "${comparator}"`);
|
|
241
|
+
}
|
|
242
|
+
let filter;
|
|
243
|
+
if (typeof start === 'string' && start.length > terms_js_1.MAX_SEARCH_KEY_LENGTH) {
|
|
244
|
+
// if the key is too long, we need to truncate it and filter the results
|
|
245
|
+
start = start.slice(0, terms_js_1.MAX_SEARCH_KEY_LENGTH) + terms_js_1.OVERFLOW_MARKER;
|
|
246
|
+
exclusiveStart = false;
|
|
247
|
+
filter = filterByType(searchCondition, Table, null, filtered, isPrimaryKey);
|
|
248
|
+
}
|
|
249
|
+
if (typeof end === 'string' && end.length > terms_js_1.MAX_SEARCH_KEY_LENGTH) {
|
|
250
|
+
// if the key is too long, we need to truncate it and filter the results
|
|
251
|
+
end = end.slice(0, terms_js_1.MAX_SEARCH_KEY_LENGTH) + terms_js_1.OVERFLOW_MARKER;
|
|
252
|
+
inclusiveEnd = true;
|
|
253
|
+
filter = filter ?? filterByType(searchCondition, Table, null, filtered, isPrimaryKey);
|
|
254
|
+
}
|
|
255
|
+
if (reverse) {
|
|
256
|
+
let newEnd = start;
|
|
257
|
+
start = end;
|
|
258
|
+
end = newEnd;
|
|
259
|
+
newEnd = !exclusiveStart;
|
|
260
|
+
exclusiveStart = !inclusiveEnd;
|
|
261
|
+
inclusiveEnd = newEnd;
|
|
262
|
+
}
|
|
263
|
+
if (!index || index.isIndexing || needFullScan || (value === null && !index.indexNulls)) {
|
|
264
|
+
// no indexed searching available, need a full scan
|
|
265
|
+
if (allowFullScan === false && !index)
|
|
266
|
+
throw new hdbError_js_1.ClientError(`"${attribute_name}" is not indexed, can not search for this attribute`, 404);
|
|
267
|
+
if (allowFullScan === false && needFullScan)
|
|
268
|
+
throw new hdbError_js_1.ClientError(`Can not use ${comparator || 'equal'} operator without combining with a condition that uses an index, can not search for attribute ${attribute_name}`, 403);
|
|
269
|
+
if (index?.isIndexing)
|
|
270
|
+
throw new hdbError_js_1.ServerError(`"${attribute_name}" is not indexed yet, can not search for this attribute`, 503);
|
|
271
|
+
if (value === null && index && !index.indexNulls)
|
|
272
|
+
throw new hdbError_js_1.ClientError(`"${attribute_name}" is not indexed for nulls, index needs to be rebuilt to search for nulls, can not search for this attribute`, 400);
|
|
273
|
+
filter = filter ?? filterByType(searchCondition, Table, null, filtered, isPrimaryKey);
|
|
274
|
+
if (!filter) {
|
|
275
|
+
throw new hdbError_js_1.ClientError(`Unknown search operator ${searchCondition.comparator}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const rangeOptions = {
|
|
279
|
+
start,
|
|
280
|
+
end,
|
|
281
|
+
inclusiveEnd,
|
|
282
|
+
exclusiveStart,
|
|
283
|
+
values: true,
|
|
284
|
+
versions: isPrimaryKey,
|
|
285
|
+
transaction,
|
|
286
|
+
reverse,
|
|
287
|
+
};
|
|
288
|
+
if (isPrimaryKey) {
|
|
289
|
+
const results = index.getRange(rangeOptions).map(filter
|
|
290
|
+
? function ({ key, value }) {
|
|
291
|
+
if (this?.isSync)
|
|
292
|
+
return value && filter(value) ? key : extended_iterable_1.SKIP;
|
|
293
|
+
// for filter operations, we intentionally yield the event turn so that scanning queries
|
|
294
|
+
// do not hog resources
|
|
295
|
+
return new Promise((resolve, reject) => setImmediate(() => {
|
|
296
|
+
try {
|
|
297
|
+
resolve(value && filter(value) ? key : extended_iterable_1.SKIP);
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
reject(error);
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
: (entry) => {
|
|
305
|
+
if (entry.value == null && !(entry.metadataFlags & (Table_ts_1.INVALIDATED | Table_ts_1.EVICTED)))
|
|
306
|
+
return extended_iterable_1.SKIP;
|
|
307
|
+
Object.freeze(entry.value);
|
|
308
|
+
recordRead(entry);
|
|
309
|
+
return entry;
|
|
310
|
+
});
|
|
311
|
+
results.hasEntries = true;
|
|
312
|
+
return results;
|
|
313
|
+
}
|
|
314
|
+
else if (index) {
|
|
315
|
+
if (index.customIndex) {
|
|
316
|
+
return index.customIndex.search(searchCondition, context).map((entry) => {
|
|
317
|
+
// if the custom index returns an entry with metadata, merge it with the loaded entry
|
|
318
|
+
if (typeof entry === 'object' && entry) {
|
|
319
|
+
const { key, ...otherProps } = entry;
|
|
320
|
+
const loadedEntry = Table.primaryStore.getEntry(key);
|
|
321
|
+
Object.freeze(loadedEntry?.value);
|
|
322
|
+
recordRead(loadedEntry);
|
|
323
|
+
return { ...otherProps, ...loadedEntry };
|
|
324
|
+
}
|
|
325
|
+
return entry;
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return index.getRange(rangeOptions).map(filter
|
|
329
|
+
? function ({ key, value }) {
|
|
330
|
+
let recordMatcher;
|
|
331
|
+
if (typeof key === 'string' && key.length > terms_js_1.MAX_SEARCH_KEY_LENGTH) {
|
|
332
|
+
// if it is an overflow string, need to get the actual value from the database
|
|
333
|
+
recordMatcher = Table.primaryStore.getSync(value);
|
|
334
|
+
}
|
|
335
|
+
else
|
|
336
|
+
recordMatcher = { [attribute_name]: key };
|
|
337
|
+
if (this.isSync)
|
|
338
|
+
return filter(recordMatcher) ? value : extended_iterable_1.SKIP;
|
|
339
|
+
// for filter operations, we intentionally yield the event turn so that scanning queries
|
|
340
|
+
// do not hog resources
|
|
341
|
+
return new Promise((resolve, reject) => setImmediate(() => {
|
|
342
|
+
try {
|
|
343
|
+
resolve(filter(recordMatcher) ? value : extended_iterable_1.SKIP);
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
reject(error);
|
|
347
|
+
}
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
: ({ value }) => value);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
return Table.primaryStore
|
|
354
|
+
.getRange(reverse ? { end: true, transaction, reverse: true } : { start: true, transaction })
|
|
355
|
+
.map(function (entry) {
|
|
356
|
+
const { key, value } = entry;
|
|
357
|
+
if (this.isSync) {
|
|
358
|
+
recordRead(entry);
|
|
359
|
+
return value && filter(value) ? key : extended_iterable_1.SKIP;
|
|
360
|
+
}
|
|
361
|
+
// for filter operations, we intentionally yield the event turn so that scanning queries
|
|
362
|
+
// do not hog resources
|
|
363
|
+
return new Promise((resolve, reject) => setImmediate(() => {
|
|
364
|
+
try {
|
|
365
|
+
recordRead(entry);
|
|
366
|
+
resolve(value && filter(value) ? key : extended_iterable_1.SKIP);
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
reject(error);
|
|
370
|
+
}
|
|
371
|
+
}));
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function recordRead(entry) {
|
|
375
|
+
if ((Table.databaseName !== 'system' || Table.name === 'hdb_analytics') && entry?.value) {
|
|
376
|
+
(0, write_1.recordAction)(entry.size ?? 1, 'db-read', Table.name, null);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function findAttribute(attributes, attribute_name) {
|
|
381
|
+
if (Array.isArray(attribute_name)) {
|
|
382
|
+
if (attribute_name.length > 1) {
|
|
383
|
+
const firstAttribute = findAttribute(attributes, attribute_name[0]);
|
|
384
|
+
const nextAttributes = (firstAttribute?.definition?.tableClass || firstAttribute?.elements?.definition?.tableClass)?.attributes ??
|
|
385
|
+
firstAttribute?.properties;
|
|
386
|
+
if (nextAttributes)
|
|
387
|
+
return findAttribute(nextAttributes, attribute_name.slice(1));
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
else
|
|
391
|
+
attribute_name = attribute_name.toString();
|
|
392
|
+
}
|
|
393
|
+
else if (typeof attribute_name !== 'string')
|
|
394
|
+
attribute_name = attribute_name.toString();
|
|
395
|
+
return attributes.find((attribute) => attribute.name === attribute_name);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* This is used to join the results of a query where the right side is a set of records with the foreign key that
|
|
399
|
+
* points to the left side (from right to left)
|
|
400
|
+
* @param rightIterable
|
|
401
|
+
* @param attribute
|
|
402
|
+
* @param store
|
|
403
|
+
* @param isManyToMany
|
|
404
|
+
* @param joined
|
|
405
|
+
* @returns
|
|
406
|
+
*/
|
|
407
|
+
function joinTo(rightIterable, attribute, store, isManyToMany, joined) {
|
|
408
|
+
return new rightIterable.constructor({
|
|
409
|
+
[Symbol.iterator]() {
|
|
410
|
+
let joinedIterator;
|
|
411
|
+
joined.hasMappings = true;
|
|
412
|
+
return {
|
|
413
|
+
next() {
|
|
414
|
+
if (!joinedIterator) {
|
|
415
|
+
const rightProperty = attribute.relationship.to;
|
|
416
|
+
const addEntry = (key, entry) => {
|
|
417
|
+
let entriesForKey = joined.get(key);
|
|
418
|
+
if (entriesForKey)
|
|
419
|
+
entriesForKey.push(entry);
|
|
420
|
+
else
|
|
421
|
+
joined.set(key, (entriesForKey = [entry]));
|
|
422
|
+
};
|
|
423
|
+
//let i = 0;
|
|
424
|
+
// get all the ids of the related records
|
|
425
|
+
for (const entry of rightIterable) {
|
|
426
|
+
const record = entry.value ?? store.getSync(entry.key ?? entry);
|
|
427
|
+
const leftKey = record?.[rightProperty];
|
|
428
|
+
if (leftKey == null)
|
|
429
|
+
continue;
|
|
430
|
+
if (joined.filters?.some((filter) => !filter(record)))
|
|
431
|
+
continue;
|
|
432
|
+
if (isManyToMany) {
|
|
433
|
+
for (let i = 0; i < leftKey.length; i++) {
|
|
434
|
+
addEntry(leftKey[i], entry);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
addEntry(leftKey, entry);
|
|
439
|
+
}
|
|
440
|
+
// TODO: Enable this with async iterator manually iterating so that we don't need to do an await on every iteration
|
|
441
|
+
/*
|
|
442
|
+
if (i++ > 100) {
|
|
443
|
+
// yield the event turn every 100 ids. See below for more explanation
|
|
444
|
+
await new Promise(setImmediate);
|
|
445
|
+
i = 0;
|
|
446
|
+
}*/
|
|
447
|
+
}
|
|
448
|
+
joinedIterator = joined.keys()[Symbol.iterator]();
|
|
449
|
+
return this.next();
|
|
450
|
+
}
|
|
451
|
+
const joinedEntry = joinedIterator.next();
|
|
452
|
+
if (joinedEntry.done)
|
|
453
|
+
return joinedEntry;
|
|
454
|
+
return {
|
|
455
|
+
// if necessary, get the original key from the entries array
|
|
456
|
+
value: joinedEntry.value,
|
|
457
|
+
};
|
|
458
|
+
},
|
|
459
|
+
return() {
|
|
460
|
+
if (joinedIterator?.return)
|
|
461
|
+
return joinedIterator.return();
|
|
462
|
+
},
|
|
463
|
+
};
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* This is used to join the results of a query where the right side is a set of ids and the left side is a set of records
|
|
469
|
+
* that have the foreign key (from left to right)
|
|
470
|
+
* @param rightIterable
|
|
471
|
+
* @param attribute
|
|
472
|
+
* @param store
|
|
473
|
+
* @param joined
|
|
474
|
+
* @param searchEntry
|
|
475
|
+
* @returns
|
|
476
|
+
*/
|
|
477
|
+
function joinFrom(rightIterable, attribute, store, joined, searchEntry) {
|
|
478
|
+
return new rightIterable.constructor({
|
|
479
|
+
[Symbol.iterator]() {
|
|
480
|
+
let idIterator;
|
|
481
|
+
let joinedIterator;
|
|
482
|
+
const seenIds = new Set();
|
|
483
|
+
return {
|
|
484
|
+
next() {
|
|
485
|
+
let joinedEntry;
|
|
486
|
+
if (joinedIterator) {
|
|
487
|
+
while (true) {
|
|
488
|
+
joinedEntry = joinedIterator.next();
|
|
489
|
+
if (joinedEntry.done)
|
|
490
|
+
break; // and continue to find next
|
|
491
|
+
const id = joinedEntry.value;
|
|
492
|
+
if (seenIds.has(id))
|
|
493
|
+
continue;
|
|
494
|
+
seenIds.add(id);
|
|
495
|
+
return joinedEntry;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (!idIterator) {
|
|
499
|
+
// get the ids of the related records as a Set so we can quickly check if it is in the set
|
|
500
|
+
// when are iterating through the results
|
|
501
|
+
const ids = new Set();
|
|
502
|
+
// Define the fromRecord function so that we can use it to filter the related records
|
|
503
|
+
// that are in the select(), to only those that are in this set of ids
|
|
504
|
+
joined.fromRecord = (record) => {
|
|
505
|
+
// TODO: Sort based on order ids
|
|
506
|
+
return record[attribute.relationship.from]?.filter?.((id) => ids.has(id));
|
|
507
|
+
};
|
|
508
|
+
//let i = 0;
|
|
509
|
+
// get all the ids of the related records
|
|
510
|
+
for (const id of rightIterable) {
|
|
511
|
+
if (joined.filters) {
|
|
512
|
+
// if additional filters are defined, we need to check them
|
|
513
|
+
const record = store.getSync(id);
|
|
514
|
+
if (joined.filters.some((filter) => !filter(record)))
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
517
|
+
ids.add(id);
|
|
518
|
+
// TODO: Re-enable this when async iteration is used, and do so with manually iterating so that we don't need to do an await on every iteration
|
|
519
|
+
/*
|
|
520
|
+
if (i++ > 100) {
|
|
521
|
+
// yield the event turn every 100 ids. We don't want to monopolize the
|
|
522
|
+
// event loop, give others a chance to run. However, we are much more aggressive
|
|
523
|
+
// about running here than in simple filter operations, because we are
|
|
524
|
+
// executing a very minimal range iteration and because this is consuming
|
|
525
|
+
// memory (so we want to get it over with) and the user isn't getting any
|
|
526
|
+
// results until we finish
|
|
527
|
+
await new Promise(setImmediate);
|
|
528
|
+
i = 0;
|
|
529
|
+
}*/
|
|
530
|
+
}
|
|
531
|
+
// and now start iterating through the ids
|
|
532
|
+
idIterator = ids[Symbol.iterator]();
|
|
533
|
+
return this.next();
|
|
534
|
+
}
|
|
535
|
+
do {
|
|
536
|
+
const idEntry = idIterator.next();
|
|
537
|
+
if (idEntry.done)
|
|
538
|
+
return idEntry;
|
|
539
|
+
joinedIterator = searchEntry(idEntry.value)[Symbol.iterator]();
|
|
540
|
+
return this.next();
|
|
541
|
+
} while (true);
|
|
542
|
+
},
|
|
543
|
+
return() {
|
|
544
|
+
return joinedIterator?.return?.();
|
|
545
|
+
},
|
|
546
|
+
throw() {
|
|
547
|
+
return joinedIterator?.throw?.();
|
|
548
|
+
},
|
|
549
|
+
};
|
|
550
|
+
},
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
const ALTERNATE_COMPARATOR_NAMES = {
|
|
554
|
+
'eq': 'equals',
|
|
555
|
+
'greater_than': 'gt',
|
|
556
|
+
'greaterThan': 'gt',
|
|
557
|
+
'greater_than_equal': 'ge',
|
|
558
|
+
'greaterThanEqual': 'ge',
|
|
559
|
+
'less_than': 'lt',
|
|
560
|
+
'lessThan': 'lt',
|
|
561
|
+
'less_than_equal': 'le',
|
|
562
|
+
'lessThanEqual': 'le',
|
|
563
|
+
'not_equal': 'ne',
|
|
564
|
+
'notEqual': 'ne',
|
|
565
|
+
'equal': 'equals',
|
|
566
|
+
'sw': 'starts_with',
|
|
567
|
+
'startsWith': 'starts_with',
|
|
568
|
+
'ew': 'ends_with',
|
|
569
|
+
'endsWith': 'ends_with',
|
|
570
|
+
'ct': 'contains',
|
|
571
|
+
'>': 'gt',
|
|
572
|
+
'>=': 'ge',
|
|
573
|
+
'<': 'lt',
|
|
574
|
+
'<=': 'le',
|
|
575
|
+
'...': 'between',
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* Create a filter based on the search condition that can be used to test each supplied record.
|
|
579
|
+
* @param {SearchObject} searchCondition
|
|
580
|
+
* @returns {({}) => boolean}
|
|
581
|
+
*/
|
|
582
|
+
function filterByType(searchCondition, Table, context, filtered, isPrimaryKey, estimatedIncomingCount) {
|
|
583
|
+
const comparator = searchCondition.comparator;
|
|
584
|
+
let attribute = searchCondition[0] ?? searchCondition.attribute;
|
|
585
|
+
let value = searchCondition[1] ?? searchCondition.value;
|
|
586
|
+
if (Array.isArray(attribute)) {
|
|
587
|
+
if (attribute.length === 0)
|
|
588
|
+
return () => true;
|
|
589
|
+
if (attribute.length === 1)
|
|
590
|
+
attribute = attribute[0];
|
|
591
|
+
else if (attribute.length > 1) {
|
|
592
|
+
const firstAttributeName = attribute[0];
|
|
593
|
+
// get the relationship attribute
|
|
594
|
+
const firstAttribute = findAttribute(Table.attributes, firstAttributeName);
|
|
595
|
+
const relatedTable = firstAttribute.definition?.tableClass || firstAttribute.elements.definition?.tableClass;
|
|
596
|
+
// TODO: If this is a relationship, we can potentially make this more efficient by using the index
|
|
597
|
+
// and retrieving the set of matching ids first
|
|
598
|
+
const filterMap = filtered?.[firstAttributeName];
|
|
599
|
+
const nextFilter = filterByType({
|
|
600
|
+
attribute: attribute.length > 2 ? attribute.slice(1) : attribute[1],
|
|
601
|
+
value,
|
|
602
|
+
comparator,
|
|
603
|
+
}, relatedTable, context, filterMap?.[firstAttributeName]?.joined, attribute[1] === relatedTable.primaryKey, estimatedIncomingCount);
|
|
604
|
+
if (!nextFilter)
|
|
605
|
+
return;
|
|
606
|
+
if (filterMap) {
|
|
607
|
+
if (!filterMap.filters)
|
|
608
|
+
filterMap.filters = [];
|
|
609
|
+
filterMap.filters.push(nextFilter);
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
const resolver = Table.propertyResolvers?.[firstAttributeName];
|
|
613
|
+
if (resolver.to)
|
|
614
|
+
nextFilter.to = resolver.to;
|
|
615
|
+
let subIdFilter;
|
|
616
|
+
const getSubObject = (record, entry) => {
|
|
617
|
+
let subObject, subEntry;
|
|
618
|
+
if (resolver) {
|
|
619
|
+
if (resolver.returnDirect) {
|
|
620
|
+
// indicates that the resolver will direct return the value instead of an entry
|
|
621
|
+
subObject = resolver(record, context, entry);
|
|
622
|
+
subEntry = RecordEncoder_ts_1.lastMetadata;
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
subEntry = resolver(record, context, entry, true);
|
|
626
|
+
if (Array.isArray(subEntry)) {
|
|
627
|
+
// if any array, map the values
|
|
628
|
+
subObject = subEntry.map((subEntry) => subEntry.value);
|
|
629
|
+
subEntry = null;
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
subObject = subEntry?.value;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
else
|
|
637
|
+
subObject = record[firstAttributeName];
|
|
638
|
+
return { subObject, subEntry };
|
|
639
|
+
};
|
|
640
|
+
const recordFilter = (record, entry) => {
|
|
641
|
+
if (resolver) {
|
|
642
|
+
if (nextFilter.idFilter) {
|
|
643
|
+
// if we are filtering by id, we can use the idFilter to avoid loading the record
|
|
644
|
+
if (!subIdFilter) {
|
|
645
|
+
if (nextFilter.idFilter.idSet?.size === 1) {
|
|
646
|
+
// if there is a single id we are looking for, we can create a new search condition that the
|
|
647
|
+
// attribute comparator could eventually use to create a recursive id set
|
|
648
|
+
// TODO: Eventually we should be able to handle multiple ids by creating a union
|
|
649
|
+
for (const id of nextFilter.idFilter.idSet) {
|
|
650
|
+
searchCondition = {
|
|
651
|
+
attribute: resolver.from ?? Table.primaryKey, // if no from, we use our primary key
|
|
652
|
+
value: id,
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
// indicate that we can use an index for this. also we indicate that we allow object matching to allow array ids to directly tested
|
|
656
|
+
subIdFilter = attributeComparator(resolver.from ?? Table.primaryKey, nextFilter.idFilter, true, true);
|
|
657
|
+
}
|
|
658
|
+
else
|
|
659
|
+
subIdFilter = attributeComparator(resolver.from ?? Table.primaryKey, nextFilter.idFilter, false, true);
|
|
660
|
+
}
|
|
661
|
+
const matches = subIdFilter(record);
|
|
662
|
+
if (subIdFilter.idFilter)
|
|
663
|
+
recordFilter.idFilter = subIdFilter.idFilter;
|
|
664
|
+
return matches;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const { subObject, subEntry } = getSubObject(record, entry);
|
|
668
|
+
if (!subObject)
|
|
669
|
+
return false;
|
|
670
|
+
if (!Array.isArray(subObject))
|
|
671
|
+
return nextFilter(subObject, subEntry);
|
|
672
|
+
const filterMap = filtered?.[firstAttributeName];
|
|
673
|
+
if (!filterMap && filtered) {
|
|
674
|
+
// establish a filtering that can preserve this filter for the select() results of these sub objects
|
|
675
|
+
filtered[firstAttributeName] = {
|
|
676
|
+
fromRecord(record) {
|
|
677
|
+
// this is called when selecting the fields to include in results
|
|
678
|
+
const value = getSubObject(record).subObject;
|
|
679
|
+
if (Array.isArray(value))
|
|
680
|
+
return value.filter(nextFilter).map((value) => value[relatedTable.primaryKey]);
|
|
681
|
+
return value;
|
|
682
|
+
},
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
return subObject.some(nextFilter);
|
|
686
|
+
};
|
|
687
|
+
return recordFilter;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
if (value instanceof Date)
|
|
691
|
+
value = value.getTime();
|
|
692
|
+
switch (ALTERNATE_COMPARATOR_NAMES[comparator] || comparator) {
|
|
693
|
+
case terms_js_1.SEARCH_TYPES.EQUALS:
|
|
694
|
+
case undefined:
|
|
695
|
+
return attributeComparator(attribute, (recordValue) => recordValue === value, true);
|
|
696
|
+
case 'contains':
|
|
697
|
+
return attributeComparator(attribute, (recordValue) => recordValue?.toString().includes(value));
|
|
698
|
+
case 'ends_with':
|
|
699
|
+
return attributeComparator(attribute, (recordValue) => recordValue?.toString().endsWith(value));
|
|
700
|
+
case 'starts_with':
|
|
701
|
+
return attributeComparator(attribute, (recordValue) => typeof recordValue === 'string' && recordValue.startsWith(value), true);
|
|
702
|
+
case 'prefix':
|
|
703
|
+
if (!Array.isArray(value))
|
|
704
|
+
value = [value];
|
|
705
|
+
else if (value[value.length - 1] == null)
|
|
706
|
+
value = value.slice(0, -1);
|
|
707
|
+
return attributeComparator(attribute, (recordValue) => {
|
|
708
|
+
if (!Array.isArray(recordValue))
|
|
709
|
+
return false;
|
|
710
|
+
for (let i = 0, l = value.length; i < l; i++) {
|
|
711
|
+
if (recordValue[i] !== value[i])
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
return true;
|
|
715
|
+
}, true);
|
|
716
|
+
case 'between':
|
|
717
|
+
if (value[0] instanceof Date)
|
|
718
|
+
value[0] = value[0].getTime();
|
|
719
|
+
if (value[1] instanceof Date)
|
|
720
|
+
value[1] = value[1].getTime();
|
|
721
|
+
return attributeComparator(attribute, (recordValue) => {
|
|
722
|
+
return (0, ordered_binary_1.compareKeys)(recordValue, value[0]) >= 0 && (0, ordered_binary_1.compareKeys)(recordValue, value[1]) <= 0;
|
|
723
|
+
}, true);
|
|
724
|
+
case 'gt':
|
|
725
|
+
return attributeComparator(attribute, (recordValue) => (0, ordered_binary_1.compareKeys)(recordValue, value) > 0);
|
|
726
|
+
case 'ge':
|
|
727
|
+
return attributeComparator(attribute, (recordValue) => (0, ordered_binary_1.compareKeys)(recordValue, value) >= 0);
|
|
728
|
+
case 'lt':
|
|
729
|
+
return attributeComparator(attribute, (recordValue) => (0, ordered_binary_1.compareKeys)(recordValue, value) < 0);
|
|
730
|
+
case 'le':
|
|
731
|
+
return attributeComparator(attribute, (recordValue) => (0, ordered_binary_1.compareKeys)(recordValue, value) <= 0);
|
|
732
|
+
case 'ne':
|
|
733
|
+
return attributeComparator(attribute, (recordValue) => (0, ordered_binary_1.compareKeys)(recordValue, value) !== 0, false, true);
|
|
734
|
+
case 'sort':
|
|
735
|
+
return () => true;
|
|
736
|
+
default:
|
|
737
|
+
throw new hdbError_js_1.ClientError(`Unknown query comparator "${comparator}"`);
|
|
738
|
+
}
|
|
739
|
+
/** Create a comparison function that can take the record and check the attribute's value with the filter function */
|
|
740
|
+
function attributeComparator(attribute, filter, canUseIndex, allowObjectMatching) {
|
|
741
|
+
let thresholdRemainingMisses;
|
|
742
|
+
canUseIndex =
|
|
743
|
+
canUseIndex && // is it a comparator that makes sense to use index
|
|
744
|
+
!isPrimaryKey && // no need to use index for primary keys, since we will be iterating over the primary keys
|
|
745
|
+
Table?.indices[attribute] && // is there an index for this attribute
|
|
746
|
+
estimatedIncomingCount > 3; // do we have a valid estimate of multiple incoming records (that is worth using an index for)
|
|
747
|
+
if (canUseIndex) {
|
|
748
|
+
if (searchCondition.estimated_count == undefined)
|
|
749
|
+
estimateCondition(Table)(searchCondition);
|
|
750
|
+
thresholdRemainingMisses = searchCondition.estimated_count >> 4;
|
|
751
|
+
if (isNaN(thresholdRemainingMisses) || thresholdRemainingMisses >= estimatedIncomingCount)
|
|
752
|
+
// invalid or can't be ever reached
|
|
753
|
+
canUseIndex = false;
|
|
754
|
+
}
|
|
755
|
+
let misses = 0;
|
|
756
|
+
let filteredSoFar = 3; // what we use to calculate miss rate; we give some buffer so we don't jump to indexed retrieval too quickly
|
|
757
|
+
function recordFilter(record) {
|
|
758
|
+
const value = record[attribute];
|
|
759
|
+
let matches;
|
|
760
|
+
if (typeof value !== 'object' || !value || allowObjectMatching)
|
|
761
|
+
matches = filter(value);
|
|
762
|
+
else if (Array.isArray(value))
|
|
763
|
+
matches = value.some(filter);
|
|
764
|
+
else if (value instanceof Date)
|
|
765
|
+
matches = filter(value.getTime());
|
|
766
|
+
//else matches = false;
|
|
767
|
+
// As we are filtering, we can lazily/reactively switch to indexing if we are getting a low match rate, allowing use to load
|
|
768
|
+
// a set of ids instead of loading each record. This can be a significant performance improvement for large queries with low match rates
|
|
769
|
+
if (canUseIndex) {
|
|
770
|
+
filteredSoFar++;
|
|
771
|
+
if (!matches &&
|
|
772
|
+
!recordFilter.idFilter &&
|
|
773
|
+
// miss rate x estimated remaining to filter > 10% of estimated incoming
|
|
774
|
+
(++misses / filteredSoFar) * estimatedIncomingCount > thresholdRemainingMisses) {
|
|
775
|
+
// if we have missed too many times, we need to switch to indexed retrieval
|
|
776
|
+
const searchResults = searchByIndex(searchCondition, Table._readTxnForContext(context), false, Table);
|
|
777
|
+
let matchingIds;
|
|
778
|
+
if (recordFilter.to) {
|
|
779
|
+
// the values could be an array of keys, so we flatten the mapping
|
|
780
|
+
matchingIds = searchResults.flatMap((id) => Table.primaryStore.getSync(id)[recordFilter.to]);
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
matchingIds = searchResults.map(flattenKey);
|
|
784
|
+
}
|
|
785
|
+
// now generate a hash set that we can efficiently check primary keys against
|
|
786
|
+
// TODO: Do this asynchronously
|
|
787
|
+
const idSet = new Set(matchingIds);
|
|
788
|
+
recordFilter.idFilter = (id) => idSet.has(flattenKey(id));
|
|
789
|
+
recordFilter.idFilter.idSet = idSet;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return matches;
|
|
793
|
+
}
|
|
794
|
+
if (isPrimaryKey) {
|
|
795
|
+
recordFilter.idFilter = filter;
|
|
796
|
+
}
|
|
797
|
+
return recordFilter;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function estimateCondition(table) {
|
|
801
|
+
function estimateConditionForTable(condition) {
|
|
802
|
+
if (condition.estimated_count === undefined) {
|
|
803
|
+
if (condition.conditions) {
|
|
804
|
+
// for a group of conditions, we can estimate the count by combining the estimates of the sub-conditions
|
|
805
|
+
let estimatedCount;
|
|
806
|
+
if (condition.operator === 'or') {
|
|
807
|
+
// with a union, we can just add the estimated counts
|
|
808
|
+
estimatedCount = 0;
|
|
809
|
+
for (const subCondition of condition.conditions) {
|
|
810
|
+
estimateConditionForTable(subCondition);
|
|
811
|
+
estimatedCount += subCondition.estimated_count;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
// with an intersection, we have to use the rate of the sub-conditions to apply to estimate count of last condition
|
|
816
|
+
estimatedCount = Infinity;
|
|
817
|
+
for (const subCondition of condition.conditions) {
|
|
818
|
+
estimateConditionForTable(subCondition);
|
|
819
|
+
estimatedCount = isFinite(estimatedCount)
|
|
820
|
+
? (estimatedCount * subCondition.estimated_count) / estimatedEntryCount(table.primaryStore)
|
|
821
|
+
: subCondition.estimated_count;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
condition.estimated_count = estimatedCount;
|
|
825
|
+
return condition.estimated_count;
|
|
826
|
+
}
|
|
827
|
+
// skip if it is cached
|
|
828
|
+
let searchType = condition.comparator || condition.search_type;
|
|
829
|
+
searchType = ALTERNATE_COMPARATOR_NAMES[searchType] || searchType;
|
|
830
|
+
if (searchType === terms_js_1.SEARCH_TYPES.EQUALS || !searchType) {
|
|
831
|
+
const attribute_name = condition[0] ?? condition.attribute;
|
|
832
|
+
if (attribute_name == null || attribute_name === table.primaryKey)
|
|
833
|
+
condition.estimated_count = 1;
|
|
834
|
+
else if (Array.isArray(attribute_name) && attribute_name.length > 1) {
|
|
835
|
+
const attribute = findAttribute(table.attributes, attribute_name[0]);
|
|
836
|
+
const relatedTable = attribute.definition?.tableClass || attribute.elements.definition?.tableClass;
|
|
837
|
+
const estimate = estimateCondition(relatedTable)({
|
|
838
|
+
value: condition.value,
|
|
839
|
+
attribute: attribute_name.length > 2 ? attribute_name.slice(1) : attribute_name[1],
|
|
840
|
+
comparator: 'equals',
|
|
841
|
+
});
|
|
842
|
+
const fromIndex = table.indices[attribute.relationship.from];
|
|
843
|
+
// the estimated count is sum of the estimate of the related table and the estimate of the index
|
|
844
|
+
condition.estimated_count =
|
|
845
|
+
estimate +
|
|
846
|
+
(fromIndex
|
|
847
|
+
? (estimate * estimatedEntryCount(table.indices[attribute.relationship.from])) /
|
|
848
|
+
(estimatedEntryCount(relatedTable.primaryStore) || 1)
|
|
849
|
+
: estimate);
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
// we only attempt to estimate count on equals operator because that's really all that LMDB supports (some other key-value stores like libmdbx could be considered if we need to do estimated counts of ranges at some point)
|
|
853
|
+
const index = table.indices[attribute_name];
|
|
854
|
+
condition.estimated_count = index ? index.getValuesCount(condition[1] ?? condition.value) : Infinity;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
else if (searchType === 'contains' || searchType === 'ends_with' || searchType === 'ne') {
|
|
858
|
+
const attribute_name = condition[0] ?? condition.attribute;
|
|
859
|
+
const index = table.indices[attribute_name];
|
|
860
|
+
if (condition.value === null && searchType === 'ne') {
|
|
861
|
+
condition.estimated_count =
|
|
862
|
+
estimatedEntryCount(table.primaryStore) - (index ? index.getValuesCount(null) : 0);
|
|
863
|
+
}
|
|
864
|
+
else
|
|
865
|
+
condition.estimated_count = Infinity;
|
|
866
|
+
// for range queries (betweens, startsWith, greater, etc.), just arbitrarily guess
|
|
867
|
+
}
|
|
868
|
+
else if (searchType === 'starts_with' || searchType === 'prefix')
|
|
869
|
+
condition.estimated_count = STARTS_WITH_ESTIMATE * estimatedEntryCount(table.primaryStore) + 1;
|
|
870
|
+
else if (searchType === 'between')
|
|
871
|
+
condition.estimated_count = BETWEEN_ESTIMATE * estimatedEntryCount(table.primaryStore) + 1;
|
|
872
|
+
else if (searchType === 'sort') {
|
|
873
|
+
const attribute_name = condition[0] ?? condition.attribute;
|
|
874
|
+
const index = table.indices[attribute_name];
|
|
875
|
+
if (index?.customIndex?.estimateCountAsSort)
|
|
876
|
+
// allow custom index to define its own estimation of counts
|
|
877
|
+
condition.estimated_count = index.customIndex.estimateCountAsSort(condition);
|
|
878
|
+
else
|
|
879
|
+
condition.estimated_count = estimatedEntryCount(table.primaryStore) + 1; // only used by sort
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
// for the search types that use the broadest range, try do them last
|
|
883
|
+
const attribute_name = condition[0] ?? condition.attribute;
|
|
884
|
+
const index = table.indices[attribute_name];
|
|
885
|
+
if (index?.customIndex?.estimateCount)
|
|
886
|
+
// allow custom index to define its own estimation of counts
|
|
887
|
+
condition.estimated_count = index.customIndex.estimateCount(condition.value);
|
|
888
|
+
else
|
|
889
|
+
condition.estimated_count = OPEN_RANGE_ESTIMATE * estimatedEntryCount(table.primaryStore) + 1;
|
|
890
|
+
}
|
|
891
|
+
// we give a condition significantly more weight/preference if we will be ordering by it
|
|
892
|
+
if (typeof condition.descending === 'boolean')
|
|
893
|
+
condition.estimated_count /= 2;
|
|
894
|
+
}
|
|
895
|
+
return condition.estimated_count; // use cached count
|
|
896
|
+
}
|
|
897
|
+
return estimateConditionForTable;
|
|
898
|
+
}
|
|
899
|
+
class SyntaxViolation extends hdbError_js_1.Violation {
|
|
900
|
+
}
|
|
901
|
+
const NEEDS_PARSER = /[()[\]|!<>.]|(=\w*=)/;
|
|
902
|
+
const QUERY_PARSER = /([^?&|=<>!([{}\]),]*)([([{}\])|,&]|[=<>!]*)/g;
|
|
903
|
+
const VALUE_PARSER = /([^&|=[\]{}]+)([[\]{}]|[&|=]*)/g;
|
|
904
|
+
let lastIndex;
|
|
905
|
+
let currentQuery;
|
|
906
|
+
let queryString;
|
|
907
|
+
/**
|
|
908
|
+
* This is responsible for taking a query string (from a get()) and merging the parsed elements into a RequestTarget object.
|
|
909
|
+
* @param queryString
|
|
910
|
+
*/
|
|
911
|
+
function parseQuery(queryToParse, query) {
|
|
912
|
+
if (!queryToParse)
|
|
913
|
+
return;
|
|
914
|
+
queryString = queryToParse;
|
|
915
|
+
// TODO: We can remove this if we are sure all exits points end with lastIndex as zero (reaching the end of parsing will do that)
|
|
916
|
+
QUERY_PARSER.lastIndex = 0;
|
|
917
|
+
if (NEEDS_PARSER.test(queryToParse)) {
|
|
918
|
+
try {
|
|
919
|
+
if (query)
|
|
920
|
+
query.conditions = [];
|
|
921
|
+
currentQuery = query ?? new Query();
|
|
922
|
+
parseBlock(currentQuery, '');
|
|
923
|
+
if (lastIndex !== queryString.length)
|
|
924
|
+
recordError(`Unable to parse query, unexpected end of query`);
|
|
925
|
+
if (currentQuery.parseErrorMessage) {
|
|
926
|
+
currentQuery.parseError = new SyntaxViolation(query.parseErrorMessage);
|
|
927
|
+
if (!query)
|
|
928
|
+
throw currentQuery.parseError;
|
|
929
|
+
}
|
|
930
|
+
return currentQuery;
|
|
931
|
+
}
|
|
932
|
+
catch (error) {
|
|
933
|
+
error.statusCode = 400;
|
|
934
|
+
error.message = `Unable to parse query, ${error.message} at position ${lastIndex} in '${queryString}'`;
|
|
935
|
+
if (currentQuery.parseErrorMessage)
|
|
936
|
+
error.message += ', ' + currentQuery.parseErrorMessage;
|
|
937
|
+
if (query) {
|
|
938
|
+
query.parseError = error;
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
throw error;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
else {
|
|
946
|
+
return query ?? new URLSearchParams(queryToParse);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function recordError(message) {
|
|
950
|
+
const errorMessage = `${message} at position ${lastIndex}`;
|
|
951
|
+
currentQuery.parseErrorMessage = currentQuery.parseErrorMessage
|
|
952
|
+
? currentQuery.parseErrorMessage + ', ' + errorMessage
|
|
953
|
+
: errorMessage;
|
|
954
|
+
}
|
|
955
|
+
function parseBlock(query, expectedEnd) {
|
|
956
|
+
let parser = QUERY_PARSER;
|
|
957
|
+
let match;
|
|
958
|
+
let attribute, comparator, expectingDelimiter, expectingValue;
|
|
959
|
+
let valueDecoder = decodeURIComponent;
|
|
960
|
+
let lastBinaryOperator;
|
|
961
|
+
while ((match = parser.exec(queryString))) {
|
|
962
|
+
lastIndex = parser.lastIndex;
|
|
963
|
+
const [, value, operator] = match;
|
|
964
|
+
if (expectingDelimiter) {
|
|
965
|
+
if (value)
|
|
966
|
+
recordError(`expected operator, but encountered '${value}'`);
|
|
967
|
+
expectingDelimiter = false;
|
|
968
|
+
expectingValue = false;
|
|
969
|
+
}
|
|
970
|
+
else
|
|
971
|
+
expectingValue = true;
|
|
972
|
+
let entry;
|
|
973
|
+
switch (operator) {
|
|
974
|
+
case '=':
|
|
975
|
+
if (attribute != undefined) {
|
|
976
|
+
// a FIQL operator like =gt= (and don't allow just any string)
|
|
977
|
+
if (value.length <= 2)
|
|
978
|
+
comparator = value;
|
|
979
|
+
else
|
|
980
|
+
recordError(`invalid FIQL operator ${value}`);
|
|
981
|
+
valueDecoder = typedDecoding; // use typed/auto-cast decoding for FIQL operators
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
// standard equal comparison
|
|
985
|
+
valueDecoder = decodeURIComponent; // use strict decoding
|
|
986
|
+
comparator = 'equals'; // strict equals
|
|
987
|
+
if (!value)
|
|
988
|
+
recordError(`attribute must be specified before equality comparator`);
|
|
989
|
+
attribute = decodeProperty(value);
|
|
990
|
+
}
|
|
991
|
+
break;
|
|
992
|
+
case '==':
|
|
993
|
+
// TODO: Separate decoder to handle * operator here for startsWith, endsWith, and contains?
|
|
994
|
+
// fall through
|
|
995
|
+
case '!=':
|
|
996
|
+
case '<':
|
|
997
|
+
case '<=':
|
|
998
|
+
case '>':
|
|
999
|
+
case '>=':
|
|
1000
|
+
case '===':
|
|
1001
|
+
case '!==':
|
|
1002
|
+
comparator = SYMBOL_OPERATORS[operator];
|
|
1003
|
+
valueDecoder = exports.COERCIBLE_OPERATORS[comparator] ? typedDecoding : decodeURIComponent;
|
|
1004
|
+
if (!value)
|
|
1005
|
+
recordError(`attribute must be specified before comparator ${operator}`);
|
|
1006
|
+
attribute = decodeProperty(value);
|
|
1007
|
+
break;
|
|
1008
|
+
case '&=': // for chaining conditions on to the same attribute
|
|
1009
|
+
case '|=':
|
|
1010
|
+
case '|':
|
|
1011
|
+
case '&':
|
|
1012
|
+
case '':
|
|
1013
|
+
case undefined:
|
|
1014
|
+
if (attribute == null) {
|
|
1015
|
+
if (attribute === undefined) {
|
|
1016
|
+
if (expectedEnd)
|
|
1017
|
+
recordError(`expected '${expectedEnd}', but encountered ${operator[0] ? "'" + operator[0] + "'" : 'end of string'}}`);
|
|
1018
|
+
recordError(`no comparison specified before ${operator ? "'" + operator + "'" : 'end of string'}`);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
if (!query.conditions)
|
|
1023
|
+
recordError('conditions/comparisons are not allowed in a property list');
|
|
1024
|
+
const condition = {
|
|
1025
|
+
comparator,
|
|
1026
|
+
attribute: attribute || null,
|
|
1027
|
+
value: valueDecoder(value),
|
|
1028
|
+
};
|
|
1029
|
+
if (comparator === 'eq')
|
|
1030
|
+
wildcardDecoding(condition, value);
|
|
1031
|
+
if (attribute === '') {
|
|
1032
|
+
// this is a nested condition
|
|
1033
|
+
const lastCondition = query.conditions[query.conditions.length - 1];
|
|
1034
|
+
lastCondition.chainedConditions = lastCondition.chainedConditions || [];
|
|
1035
|
+
lastCondition.chainedConditions.push(condition);
|
|
1036
|
+
lastCondition.operator = lastBinaryOperator;
|
|
1037
|
+
}
|
|
1038
|
+
else {
|
|
1039
|
+
assignOperator(query, lastBinaryOperator);
|
|
1040
|
+
query.conditions.push(condition);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
if (operator === '&') {
|
|
1044
|
+
lastBinaryOperator = 'and';
|
|
1045
|
+
attribute = undefined;
|
|
1046
|
+
}
|
|
1047
|
+
else if (operator === '|') {
|
|
1048
|
+
lastBinaryOperator = 'or';
|
|
1049
|
+
attribute = undefined;
|
|
1050
|
+
}
|
|
1051
|
+
else if (operator === '&=') {
|
|
1052
|
+
lastBinaryOperator = 'and';
|
|
1053
|
+
attribute = '';
|
|
1054
|
+
}
|
|
1055
|
+
else if (operator === '|=') {
|
|
1056
|
+
lastBinaryOperator = 'or';
|
|
1057
|
+
attribute = '';
|
|
1058
|
+
}
|
|
1059
|
+
break;
|
|
1060
|
+
case ',':
|
|
1061
|
+
if (query.conditions) {
|
|
1062
|
+
// TODO: Add support for a list of values
|
|
1063
|
+
recordError('conditions/comparisons are not allowed in a property list');
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
query.push(decodeProperty(value));
|
|
1067
|
+
}
|
|
1068
|
+
attribute = undefined;
|
|
1069
|
+
break;
|
|
1070
|
+
case '(':
|
|
1071
|
+
QUERY_PARSER.lastIndex = lastIndex;
|
|
1072
|
+
const args = parseBlock(value ? [] : new Query(), ')');
|
|
1073
|
+
switch (value) {
|
|
1074
|
+
case '': // nested/grouped condition
|
|
1075
|
+
assignOperator(query, lastBinaryOperator);
|
|
1076
|
+
query.conditions.push(args);
|
|
1077
|
+
break;
|
|
1078
|
+
case 'limit':
|
|
1079
|
+
switch (args.length) {
|
|
1080
|
+
case 1:
|
|
1081
|
+
query.limit = +args[0];
|
|
1082
|
+
break;
|
|
1083
|
+
case 2:
|
|
1084
|
+
query.offset = +args[0];
|
|
1085
|
+
query.limit = args[1] - query.offset;
|
|
1086
|
+
break;
|
|
1087
|
+
default:
|
|
1088
|
+
recordError('limit must have 1 or 2 arguments');
|
|
1089
|
+
}
|
|
1090
|
+
break;
|
|
1091
|
+
case 'select':
|
|
1092
|
+
if (Array.isArray(args[0]) && args.length === 1 && !args[0].name) {
|
|
1093
|
+
query.select = args[0];
|
|
1094
|
+
query.select.asArray = true;
|
|
1095
|
+
}
|
|
1096
|
+
else if (args.length === 1)
|
|
1097
|
+
query.select = args[0];
|
|
1098
|
+
else if (args.length === 2 && args[1] === '')
|
|
1099
|
+
query.select = args.slice(0, 1);
|
|
1100
|
+
else
|
|
1101
|
+
query.select = args;
|
|
1102
|
+
break;
|
|
1103
|
+
case 'group-by':
|
|
1104
|
+
recordError('group by is not implemented yet');
|
|
1105
|
+
case 'sort':
|
|
1106
|
+
query.sort = toSortObject(args);
|
|
1107
|
+
break;
|
|
1108
|
+
default:
|
|
1109
|
+
recordError(`unknown query function call ${value}`);
|
|
1110
|
+
}
|
|
1111
|
+
if (queryString[lastIndex] === ',') {
|
|
1112
|
+
parser.lastIndex = ++lastIndex;
|
|
1113
|
+
}
|
|
1114
|
+
else
|
|
1115
|
+
expectingDelimiter = true;
|
|
1116
|
+
attribute = null;
|
|
1117
|
+
break;
|
|
1118
|
+
case '{':
|
|
1119
|
+
if (query.conditions)
|
|
1120
|
+
recordError('property sets are not allowed in a queries');
|
|
1121
|
+
if (!value)
|
|
1122
|
+
recordError('property sets must have a defined parent property name');
|
|
1123
|
+
// this is interpreted as property{subProperty}
|
|
1124
|
+
QUERY_PARSER.lastIndex = lastIndex;
|
|
1125
|
+
entry = parseBlock([], '}');
|
|
1126
|
+
entry.name = value;
|
|
1127
|
+
query.push(entry);
|
|
1128
|
+
if (queryString[lastIndex] === ',') {
|
|
1129
|
+
parser.lastIndex = ++lastIndex;
|
|
1130
|
+
}
|
|
1131
|
+
else
|
|
1132
|
+
expectingDelimiter = true;
|
|
1133
|
+
break;
|
|
1134
|
+
case '[':
|
|
1135
|
+
QUERY_PARSER.lastIndex = lastIndex;
|
|
1136
|
+
if (value) {
|
|
1137
|
+
// this is interpreted as propertyWithArray[name=value&anotherOtherConditions...]
|
|
1138
|
+
entry = parseBlock(new Query(), ']');
|
|
1139
|
+
entry.name = value;
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
// this is interpreted a property list that can be used within other lists
|
|
1143
|
+
entry = parseBlock(query.conditions ? new Query() : [], ']');
|
|
1144
|
+
}
|
|
1145
|
+
if (query.conditions) {
|
|
1146
|
+
assignOperator(query, lastBinaryOperator);
|
|
1147
|
+
if (queryString[lastIndex] === '=') {
|
|
1148
|
+
// handle the case of a query parameter like property[]=value, using the standard equal behavior
|
|
1149
|
+
valueDecoder = decodeURIComponent; // use strict decoding
|
|
1150
|
+
comparator = 'equals'; // strict equals
|
|
1151
|
+
attribute = decodeProperty(value);
|
|
1152
|
+
parser.lastIndex = ++lastIndex;
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
else {
|
|
1156
|
+
query.conditions.push(entry);
|
|
1157
|
+
attribute = null;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
else
|
|
1161
|
+
query.push(entry);
|
|
1162
|
+
if (queryString[lastIndex] === ',') {
|
|
1163
|
+
parser.lastIndex = ++lastIndex;
|
|
1164
|
+
}
|
|
1165
|
+
else
|
|
1166
|
+
expectingDelimiter = true;
|
|
1167
|
+
break;
|
|
1168
|
+
case ')':
|
|
1169
|
+
case ']':
|
|
1170
|
+
case '}':
|
|
1171
|
+
if (expectedEnd === operator[0]) {
|
|
1172
|
+
// assert that it is expected
|
|
1173
|
+
if (query.conditions) {
|
|
1174
|
+
// finish condition
|
|
1175
|
+
if (attribute) {
|
|
1176
|
+
const condition = {
|
|
1177
|
+
comparator: comparator || 'equals',
|
|
1178
|
+
attribute,
|
|
1179
|
+
value: valueDecoder(value),
|
|
1180
|
+
};
|
|
1181
|
+
if (comparator === 'eq')
|
|
1182
|
+
wildcardDecoding(condition, value);
|
|
1183
|
+
assignOperator(query, lastBinaryOperator);
|
|
1184
|
+
query.conditions.push(condition);
|
|
1185
|
+
}
|
|
1186
|
+
else if (value) {
|
|
1187
|
+
recordError('no attribute or comparison specified');
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
else if (value || (query.length > 0 && expectingValue)) {
|
|
1191
|
+
query.push(decodeProperty(value));
|
|
1192
|
+
}
|
|
1193
|
+
return query;
|
|
1194
|
+
}
|
|
1195
|
+
else if (expectedEnd)
|
|
1196
|
+
recordError(`expected '${expectedEnd}', but encountered '${operator[0]}'`);
|
|
1197
|
+
else
|
|
1198
|
+
recordError(`unexpected token '${operator[0]}'`);
|
|
1199
|
+
default:
|
|
1200
|
+
recordError(`unexpected operator '${operator}'`);
|
|
1201
|
+
}
|
|
1202
|
+
if (expectedEnd !== ')') {
|
|
1203
|
+
parser = attribute ? VALUE_PARSER : QUERY_PARSER;
|
|
1204
|
+
parser.lastIndex = lastIndex;
|
|
1205
|
+
}
|
|
1206
|
+
if (lastIndex === queryString.length)
|
|
1207
|
+
return query;
|
|
1208
|
+
}
|
|
1209
|
+
if (expectedEnd)
|
|
1210
|
+
recordError(`expected '${expectedEnd}', but encountered end of string`);
|
|
1211
|
+
}
|
|
1212
|
+
function assignOperator(query, lastBinaryOperator) {
|
|
1213
|
+
if (query.conditions.length > 0) {
|
|
1214
|
+
if (query.operator) {
|
|
1215
|
+
if (query.operator !== lastBinaryOperator)
|
|
1216
|
+
recordError('Can not mix operators within a condition grouping');
|
|
1217
|
+
}
|
|
1218
|
+
else
|
|
1219
|
+
query.operator = lastBinaryOperator;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function decodeProperty(name) {
|
|
1223
|
+
if (name.indexOf('.') > -1) {
|
|
1224
|
+
return name.split('.').map(decodeProperty);
|
|
1225
|
+
}
|
|
1226
|
+
return decodeURIComponent(name);
|
|
1227
|
+
}
|
|
1228
|
+
function typedDecoding(value) {
|
|
1229
|
+
// for non-strict operators, we allow for coercion of types
|
|
1230
|
+
if (value === 'null')
|
|
1231
|
+
return null;
|
|
1232
|
+
if (value.indexOf(':') > -1) {
|
|
1233
|
+
const [type, valueToCoerce] = value.split(':');
|
|
1234
|
+
if (type === 'number') {
|
|
1235
|
+
if (valueToCoerce[0] === '$')
|
|
1236
|
+
return parseInt(valueToCoerce.slice(1), 36);
|
|
1237
|
+
return +valueToCoerce;
|
|
1238
|
+
}
|
|
1239
|
+
else if (type === 'boolean')
|
|
1240
|
+
return valueToCoerce === 'true';
|
|
1241
|
+
else if (type === 'date')
|
|
1242
|
+
return new Date(isNaN(valueToCoerce) ? decodeURIComponent(valueToCoerce) : +valueToCoerce);
|
|
1243
|
+
else if (type === 'string')
|
|
1244
|
+
return decodeURIComponent(valueToCoerce);
|
|
1245
|
+
else
|
|
1246
|
+
throw new hdbError_js_1.ClientError(`Unknown type ${type}`);
|
|
1247
|
+
}
|
|
1248
|
+
return decodeURIComponent(value);
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Perform wildcard detection and conversion to correct comparator
|
|
1252
|
+
* @param condition
|
|
1253
|
+
* @param value
|
|
1254
|
+
*/
|
|
1255
|
+
function wildcardDecoding(condition, value) {
|
|
1256
|
+
if (value.indexOf('*') > -1) {
|
|
1257
|
+
if (value.endsWith('*')) {
|
|
1258
|
+
condition.comparator = 'starts_with';
|
|
1259
|
+
condition.value = decodeURIComponent(value.slice(0, -1));
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
throw new hdbError_js_1.ClientError('wildcard can only be used at the end of a string');
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
function toSortObject(sort) {
|
|
1267
|
+
const sortObject = toSortEntry(sort[0]);
|
|
1268
|
+
if (sort.length > 1) {
|
|
1269
|
+
sortObject.next = toSortObject(sort.slice(1));
|
|
1270
|
+
}
|
|
1271
|
+
return sortObject;
|
|
1272
|
+
}
|
|
1273
|
+
function toSortEntry(sort) {
|
|
1274
|
+
if (Array.isArray(sort)) {
|
|
1275
|
+
const sortObject = toSortEntry(sort[0]);
|
|
1276
|
+
sort[0] = sortObject.attribute;
|
|
1277
|
+
sortObject.attribute = sort;
|
|
1278
|
+
return sortObject;
|
|
1279
|
+
}
|
|
1280
|
+
if (typeof sort === 'string') {
|
|
1281
|
+
switch (sort[0]) {
|
|
1282
|
+
case '-':
|
|
1283
|
+
return { attribute: sort.slice(1), descending: true };
|
|
1284
|
+
case '+':
|
|
1285
|
+
return { attribute: sort.slice(1), descending: false };
|
|
1286
|
+
default:
|
|
1287
|
+
return { attribute: sort, descending: false };
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
recordError(`Unknown sort type ${sort}`);
|
|
1291
|
+
}
|
|
1292
|
+
class Query {
|
|
1293
|
+
constructor() {
|
|
1294
|
+
this.conditions = [];
|
|
1295
|
+
}
|
|
1296
|
+
[Symbol.iterator]() {
|
|
1297
|
+
return this.conditions[Symbol.iterator]();
|
|
1298
|
+
}
|
|
1299
|
+
get(name) {
|
|
1300
|
+
for (let i = 0; i < this.conditions.length; i++) {
|
|
1301
|
+
const condition = this.conditions[i];
|
|
1302
|
+
if (condition.attribute === name)
|
|
1303
|
+
return condition.value;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
getAll() {
|
|
1307
|
+
const values = [];
|
|
1308
|
+
for (let i = 0, len = this.conditions.length; i < len; i++) {
|
|
1309
|
+
const condition = this.conditions[i];
|
|
1310
|
+
if (condition.attribute)
|
|
1311
|
+
values.push(condition.value);
|
|
1312
|
+
}
|
|
1313
|
+
return values;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
function flattenKey(key) {
|
|
1317
|
+
if (Array.isArray(key))
|
|
1318
|
+
return key.join('\x00');
|
|
1319
|
+
return key;
|
|
1320
|
+
}
|
|
1321
|
+
function estimatedEntryCount(store) {
|
|
1322
|
+
const now = Date.now();
|
|
1323
|
+
if ((store.estimatedEntryCountExpires || 0) < now) {
|
|
1324
|
+
// use getStats for LMDB because it is fast path, otherwise RocksDB can handle fast path on its own
|
|
1325
|
+
store.estimatedEntryCount = store.readerCheck ? store.getStats().entryCount : store.getKeysCount();
|
|
1326
|
+
store.estimatedEntryCountExpires = now + 10000;
|
|
1327
|
+
}
|
|
1328
|
+
return store.estimatedEntryCount;
|
|
1329
|
+
}
|
|
1330
|
+
function intersectionEstimate(store, left, right) {
|
|
1331
|
+
return (left * right) / estimatedEntryCount(store);
|
|
1332
|
+
}
|
|
1333
|
+
//# sourceMappingURL=search.js.map
|