@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,1220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.databases = exports.tables = exports.NON_REPLICATING_SYSTEM_TABLES = void 0;
|
|
40
|
+
exports.getTables = getTables;
|
|
41
|
+
exports.getDatabases = getDatabases;
|
|
42
|
+
exports.readMetaDb = readMetaDb;
|
|
43
|
+
exports.resetDatabases = resetDatabases;
|
|
44
|
+
exports.database = database;
|
|
45
|
+
exports.dropDatabase = dropDatabase;
|
|
46
|
+
exports.table = table;
|
|
47
|
+
exports.dropTableMeta = dropTableMeta;
|
|
48
|
+
exports.onUpdatedTable = onUpdatedTable;
|
|
49
|
+
exports.onRemovedDB = onRemovedDB;
|
|
50
|
+
exports.getDefaultCompression = getDefaultCompression;
|
|
51
|
+
const environmentManager_js_1 = require("../utility/environment/environmentManager.js");
|
|
52
|
+
const terms_js_1 = require("../utility/lmdb/terms.js");
|
|
53
|
+
const lmdb_1 = require("lmdb");
|
|
54
|
+
const path_1 = require("path");
|
|
55
|
+
const node_fs_1 = require("node:fs");
|
|
56
|
+
const promises_1 = require("node:fs/promises");
|
|
57
|
+
const initializePaths_js_1 = require("../dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js");
|
|
58
|
+
const Table_ts_1 = require("./Table.js");
|
|
59
|
+
const OpenEnvironmentObject_js_1 = __importDefault(require("../utility/lmdb/OpenEnvironmentObject.js"));
|
|
60
|
+
const hdbTerms_ts_1 = require("../utility/hdbTerms.js");
|
|
61
|
+
const globals_js_1 = require("../globals.js");
|
|
62
|
+
const commonUtility_js_1 = require("../utility/lmdb/commonUtility.js");
|
|
63
|
+
const signalling = __importStar(require("../utility/signalling.js"));
|
|
64
|
+
const itc_js_1 = require("../server/threads/itc.js");
|
|
65
|
+
const worker_threads_1 = require("worker_threads");
|
|
66
|
+
const harper_logger_js_1 = __importDefault(require("../utility/logging/harper_logger.js"));
|
|
67
|
+
const { forComponent } = harper_logger_js_1.default;
|
|
68
|
+
const manageThreads = __importStar(require("../server/threads/manageThreads.js"));
|
|
69
|
+
const auditStore_ts_1 = require("./auditStore.js");
|
|
70
|
+
const RecordEncoder_ts_1 = require("./RecordEncoder.js");
|
|
71
|
+
const blob_ts_1 = require("./blob.js");
|
|
72
|
+
const customIndexes_ts_1 = require("./indexes/customIndexes.js");
|
|
73
|
+
const OpenDBIObject_js_1 = require("../utility/lmdb/OpenDBIObject.js");
|
|
74
|
+
const rocksdb_js_1 = require("@harperfast/rocksdb-js");
|
|
75
|
+
const replayLogs_ts_1 = require("./replayLogs.js");
|
|
76
|
+
const node_os_1 = require("node:os");
|
|
77
|
+
const RocksIndexStore_ts_1 = require("./RocksIndexStore.js");
|
|
78
|
+
const when_ts_1 = require("../utility/when.js");
|
|
79
|
+
const processManagement_js_1 = require("../utility/processManagement/processManagement.js");
|
|
80
|
+
function createOpenDBIObject(dupSort = false, isPrimary = false) {
|
|
81
|
+
return new OpenDBIObject_js_1.OpenDBIObject(dupSort, isPrimary);
|
|
82
|
+
}
|
|
83
|
+
const logger = forComponent('storage');
|
|
84
|
+
const DEFAULT_DATABASE_NAME = 'data';
|
|
85
|
+
const DEFINED_TABLES = Symbol('defined-tables');
|
|
86
|
+
const DEFAULT_COMPRESSION_THRESHOLD = ((0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_PAGESIZE) || 4096) - 60; // larger than this requires multiple pages
|
|
87
|
+
(0, environmentManager_js_1.initSync)();
|
|
88
|
+
// I don't know if this is the best place for this, but somewhere we need to specify which tables
|
|
89
|
+
// replicate by default:
|
|
90
|
+
exports.NON_REPLICATING_SYSTEM_TABLES = [
|
|
91
|
+
'hdb_temp',
|
|
92
|
+
'hdb_certificate',
|
|
93
|
+
'hdb_raw_analytics',
|
|
94
|
+
'hdb_session_will',
|
|
95
|
+
'hdb_job',
|
|
96
|
+
'hdb_info',
|
|
97
|
+
];
|
|
98
|
+
exports.tables = Object.create(null);
|
|
99
|
+
exports.databases = Object.create(null);
|
|
100
|
+
const MEMORY_FOR_ROCKS_DB = Math.min(process.constrainedMemory?.() ?? Infinity, (0, node_os_1.totalmem)()) * 0.25; // 25% of available memory
|
|
101
|
+
function openRocksDatabase(path, options) {
|
|
102
|
+
options.disableWAL ??= true;
|
|
103
|
+
rocksdb_js_1.RocksDatabase.config({ blockCacheSize: MEMORY_FOR_ROCKS_DB });
|
|
104
|
+
if (!(0, node_fs_1.existsSync)(path)) {
|
|
105
|
+
(0, node_fs_1.mkdirSync)(path, { recursive: true });
|
|
106
|
+
}
|
|
107
|
+
let db;
|
|
108
|
+
if (options.dupSort) {
|
|
109
|
+
db = rocksdb_js_1.RocksDatabase.open(new RocksIndexStore_ts_1.RocksIndexStore(path, options));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
db = rocksdb_js_1.RocksDatabase.open(path, options);
|
|
113
|
+
db.encoder.name = options.name;
|
|
114
|
+
}
|
|
115
|
+
db.env = {};
|
|
116
|
+
return db;
|
|
117
|
+
}
|
|
118
|
+
const lmdbDatabaseEnvs = new Map();
|
|
119
|
+
const rocksdbDatabaseEnvs = new Map();
|
|
120
|
+
// set the following in both global and exports
|
|
121
|
+
(0, globals_js_1._assignPackageExport)('databases', exports.databases);
|
|
122
|
+
(0, globals_js_1._assignPackageExport)('tables', exports.tables);
|
|
123
|
+
const NEXT_TABLE_ID = Symbol.for('next-table-id');
|
|
124
|
+
const tableListeners = [];
|
|
125
|
+
const dbRemovalListeners = [];
|
|
126
|
+
let loadedDatabases; // indicates if we have loaded databases from the file system yet
|
|
127
|
+
// This is used to track all the databases that are found when iterating through the file system so that anything that is missing
|
|
128
|
+
// can be removed:
|
|
129
|
+
let definedDatabases;
|
|
130
|
+
/**
|
|
131
|
+
* This gets the set of tables from the default database ("data").
|
|
132
|
+
*/
|
|
133
|
+
function getTables() {
|
|
134
|
+
if (!loadedDatabases) {
|
|
135
|
+
getDatabases();
|
|
136
|
+
}
|
|
137
|
+
return exports.tables || {};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* This provides the main entry point for getting the set of all Harper tables (organized by schemas/databases).
|
|
141
|
+
* This proactively scans the known
|
|
142
|
+
* databases/schemas directories and finds any databases and opens them. This done proactively so that there is a fast
|
|
143
|
+
* object available to all consumers that doesn't require runtime checks for database open states.
|
|
144
|
+
* This also attaches the audit store associated with table. Note that legacy tables had a single audit table per db table
|
|
145
|
+
* but in newer multi-table databases, there is one consistent, integrated audit table for the database since transactions
|
|
146
|
+
* can span any tables in the database.
|
|
147
|
+
*/
|
|
148
|
+
function getDatabases() {
|
|
149
|
+
if (loadedDatabases) {
|
|
150
|
+
return exports.databases;
|
|
151
|
+
}
|
|
152
|
+
loadedDatabases = true;
|
|
153
|
+
definedDatabases = new Map();
|
|
154
|
+
const hdbBasePath = (0, environmentManager_js_1.getHdbBasePath)();
|
|
155
|
+
let databasePath = hdbBasePath && (0, path_1.join)(hdbBasePath, hdbTerms_ts_1.DATABASES_DIR_NAME);
|
|
156
|
+
const schemaConfigs = (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.DATABASES) || {};
|
|
157
|
+
// not sure why this doesn't work with the environmemt manager
|
|
158
|
+
if (process.env.SCHEMAS_DATA_PATH)
|
|
159
|
+
schemaConfigs.data = { path: process.env.SCHEMAS_DATA_PATH };
|
|
160
|
+
databasePath =
|
|
161
|
+
process.env.STORAGE_PATH ||
|
|
162
|
+
(0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_PATH) ||
|
|
163
|
+
(databasePath && ((0, node_fs_1.existsSync)(databasePath) ? databasePath : (0, path_1.join)((0, environmentManager_js_1.getHdbBasePath)(), hdbTerms_ts_1.LEGACY_DATABASES_DIR_NAME)));
|
|
164
|
+
if (!databasePath)
|
|
165
|
+
return;
|
|
166
|
+
if ((0, node_fs_1.existsSync)(databasePath)) {
|
|
167
|
+
// First load all the databases from our main database folder
|
|
168
|
+
// TODO: Load any databases defined with explicit storage paths from the config
|
|
169
|
+
for (const databaseEntry of (0, node_fs_1.readdirSync)(databasePath, { withFileTypes: true })) {
|
|
170
|
+
const dbName = (0, path_1.basename)(databaseEntry.name, '.mdb');
|
|
171
|
+
const dbPath = (0, path_1.join)(databasePath, databaseEntry.name);
|
|
172
|
+
if (databaseEntry.isFile() &&
|
|
173
|
+
(0, path_1.extname)(databaseEntry.name).toLowerCase() === '.mdb' &&
|
|
174
|
+
!schemaConfigs[dbName]?.path) {
|
|
175
|
+
logger.trace(`loading lmdb database: ${dbPath}`);
|
|
176
|
+
readMetaDb(dbPath, null, dbName);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
const files = (0, node_fs_1.readdirSync)(dbPath, { withFileTypes: true });
|
|
181
|
+
if (files.find((file) => file.name === 'CURRENT')?.isFile() &&
|
|
182
|
+
files.some((file) => file.name.startsWith('MANIFEST-')) &&
|
|
183
|
+
!schemaConfigs[dbName]?.path) {
|
|
184
|
+
readRocksMetaDb(dbPath, null, dbName);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
if (!('code' in err && (err.code === 'ENOENT' || err.code === 'ENOTDIR'))) {
|
|
190
|
+
throw err;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// now we load databases from the legacy "schema" directory folder structure
|
|
196
|
+
const baseSchemaPath = (0, initializePaths_js_1.getBaseSchemaPath)();
|
|
197
|
+
if ((0, node_fs_1.existsSync)(baseSchemaPath)) {
|
|
198
|
+
for (const schemaEntry of (0, node_fs_1.readdirSync)(baseSchemaPath, { withFileTypes: true })) {
|
|
199
|
+
if (!schemaEntry.isFile()) {
|
|
200
|
+
const schemaPath = (0, path_1.join)(baseSchemaPath, schemaEntry.name);
|
|
201
|
+
const schemaAuditPath = (0, path_1.join)((0, initializePaths_js_1.getTransactionAuditStoreBasePath)(), schemaEntry.name);
|
|
202
|
+
for (const tableEntry of (0, node_fs_1.readdirSync)(schemaPath, { withFileTypes: true })) {
|
|
203
|
+
if (tableEntry.isFile() && (0, path_1.extname)(tableEntry.name).toLowerCase() === '.mdb') {
|
|
204
|
+
const auditPath = (0, path_1.join)(schemaAuditPath, tableEntry.name);
|
|
205
|
+
readMetaDb((0, path_1.join)(schemaPath, tableEntry.name), (0, path_1.basename)(tableEntry.name, '.mdb'), schemaEntry.name, auditPath, true);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (schemaConfigs) {
|
|
212
|
+
for (const dbName in schemaConfigs) {
|
|
213
|
+
const schemaConfig = schemaConfigs[dbName];
|
|
214
|
+
const databasePath = schemaConfig.path;
|
|
215
|
+
if ((0, node_fs_1.existsSync)(databasePath)) {
|
|
216
|
+
for (const databaseEntry of (0, node_fs_1.readdirSync)(databasePath, { withFileTypes: true })) {
|
|
217
|
+
if (databaseEntry.isFile() && (0, path_1.extname)(databaseEntry.name).toLowerCase() === '.mdb') {
|
|
218
|
+
readMetaDb((0, path_1.join)(databasePath, databaseEntry.name), (0, path_1.basename)(databaseEntry.name, '.mdb'), dbName);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
try {
|
|
222
|
+
const dbPath = (0, path_1.join)(databasePath, databaseEntry.name);
|
|
223
|
+
const files = (0, node_fs_1.readdirSync)(dbPath, { withFileTypes: true });
|
|
224
|
+
if (files.find((file) => file.name === 'CURRENT')?.isFile() &&
|
|
225
|
+
files.some((file) => file.name.startsWith('MANIFEST-'))) {
|
|
226
|
+
readRocksMetaDb(dbPath, null, dbName);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
if (!('code' in err && (err.code === 'ENOENT' || err.code === 'ENOTDIR'))) {
|
|
232
|
+
throw err;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const tableConfigs = schemaConfig.tables;
|
|
239
|
+
if (tableConfigs) {
|
|
240
|
+
for (const tableName in tableConfigs) {
|
|
241
|
+
const tableConfig = tableConfigs[tableName];
|
|
242
|
+
const tablePath = (0, path_1.join)(tableConfig.path, (0, path_1.basename)(tableName + '.mdb'));
|
|
243
|
+
if ((0, node_fs_1.existsSync)(tablePath)) {
|
|
244
|
+
readMetaDb(tablePath, tableName, dbName, null, true);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//TODO: Iterate configured table paths
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// now remove any databases or tables that have been removed
|
|
252
|
+
for (const dbName in exports.databases) {
|
|
253
|
+
const definedTables = definedDatabases.get(dbName);
|
|
254
|
+
if (definedTables) {
|
|
255
|
+
const tables = exports.databases[dbName];
|
|
256
|
+
if (dbName.includes('delete'))
|
|
257
|
+
logger.trace(`defined tables ${Array.from(definedTables.keys())}`);
|
|
258
|
+
for (const tableName in tables) {
|
|
259
|
+
if (!definedTables.has(tableName)) {
|
|
260
|
+
logger.trace(`delete table class ${tableName}`);
|
|
261
|
+
delete tables[tableName];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
delete exports.databases[dbName];
|
|
267
|
+
if (dbName === 'data') {
|
|
268
|
+
for (const tableName in exports.tables) {
|
|
269
|
+
delete exports.tables[tableName];
|
|
270
|
+
}
|
|
271
|
+
delete exports.tables[DEFINED_TABLES];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if ((0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.ANALYTICS_REPLICATE) === false) {
|
|
276
|
+
if (!exports.NON_REPLICATING_SYSTEM_TABLES.includes('hdb_analytics'))
|
|
277
|
+
exports.NON_REPLICATING_SYSTEM_TABLES.push('hdb_analytics');
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
// auditing must be enabled for replication
|
|
281
|
+
exports.databases.system?.hdb_analytics?.enableAuditing();
|
|
282
|
+
exports.databases.system?.hdb_analytics_hostname?.enableAuditing();
|
|
283
|
+
}
|
|
284
|
+
if (exports.databases.system) {
|
|
285
|
+
for (const tableName of exports.NON_REPLICATING_SYSTEM_TABLES) {
|
|
286
|
+
if (exports.databases.system[tableName]) {
|
|
287
|
+
exports.databases.system[tableName].replicate = false;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return exports.databases;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* This is responsible for reading the internal dbi of a single database file to get a list of all the tables and
|
|
295
|
+
* their indexed or registered attributes
|
|
296
|
+
* @param path
|
|
297
|
+
* @param defaultTable
|
|
298
|
+
* @param databaseName
|
|
299
|
+
*/
|
|
300
|
+
function readMetaDb(path, defaultTable, databaseName = DEFAULT_DATABASE_NAME, auditPath, isLegacy) {
|
|
301
|
+
const envInit = new OpenEnvironmentObject_js_1.default(path, false);
|
|
302
|
+
try {
|
|
303
|
+
let rootStore = lmdbDatabaseEnvs.get(path);
|
|
304
|
+
if (rootStore) {
|
|
305
|
+
rootStore.needsDeletion = false;
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
rootStore = (0, lmdb_1.open)(envInit);
|
|
309
|
+
lmdbDatabaseEnvs.set(path, rootStore);
|
|
310
|
+
}
|
|
311
|
+
return initStores(path, rootStore, databaseName, defaultTable, auditPath, isLegacy);
|
|
312
|
+
}
|
|
313
|
+
catch (error) {
|
|
314
|
+
error.message += ` opening database ${path}`;
|
|
315
|
+
throw error;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function readRocksMetaDb(path, defaultTable, databaseName = DEFAULT_DATABASE_NAME) {
|
|
319
|
+
try {
|
|
320
|
+
logger.trace(`loading rocksdb database: ${path}`);
|
|
321
|
+
if (process.env.HARPER_PARENT_PROCESS_PID) {
|
|
322
|
+
const parentProcessPid = parseInt(process.env.HARPER_PARENT_PROCESS_PID);
|
|
323
|
+
if ((0, processManagement_js_1.isProcessRunning)(parentProcessPid)) {
|
|
324
|
+
logger.info(`Parent process ${parentProcessPid} is still running!`);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
let rootStore = rocksdbDatabaseEnvs.get(path);
|
|
328
|
+
if (rootStore) {
|
|
329
|
+
initStores(path, rootStore, databaseName, defaultTable);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
rootStore = openRocksDatabase(path, { disableWAL: false });
|
|
333
|
+
rocksdbDatabaseEnvs.set(path, rootStore);
|
|
334
|
+
initStores(path, rootStore, databaseName, defaultTable);
|
|
335
|
+
(0, replayLogs_ts_1.replayLogs)(rootStore, exports.databases[databaseName]);
|
|
336
|
+
}
|
|
337
|
+
return rootStore;
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
error.message += ` opening database ${path}`;
|
|
341
|
+
throw error;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function initStores(path, rootStore, databaseName, defaultTable, auditPath, isLegacy) {
|
|
345
|
+
const envInit = new OpenEnvironmentObject_js_1.default(path, false);
|
|
346
|
+
const internalDbiInit = createOpenDBIObject(false);
|
|
347
|
+
let dbisStore = rootStore.dbisDb;
|
|
348
|
+
if (!dbisStore) {
|
|
349
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
350
|
+
dbisStore = openRocksDatabase(rootStore.path, {
|
|
351
|
+
...internalDbiInit,
|
|
352
|
+
disableWAL: false,
|
|
353
|
+
name: terms_js_1.INTERNAL_DBIS_NAME,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
dbisStore = rootStore.openDB(terms_js_1.INTERNAL_DBIS_NAME, internalDbiInit);
|
|
358
|
+
}
|
|
359
|
+
rootStore.dbisDb = dbisStore;
|
|
360
|
+
}
|
|
361
|
+
let auditStore = rootStore.auditStore;
|
|
362
|
+
if (!auditStore) {
|
|
363
|
+
if (auditPath) {
|
|
364
|
+
if ((0, node_fs_1.existsSync)(auditPath)) {
|
|
365
|
+
envInit.path = auditPath;
|
|
366
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
367
|
+
auditStore = (0, auditStore_ts_1.openAuditStore)(rootStore);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
auditStore = (0, lmdb_1.open)({
|
|
371
|
+
...envInit,
|
|
372
|
+
encoder: {
|
|
373
|
+
encode: (auditRecord) => (0, auditStore_ts_1.createAuditEntry)(auditRecord),
|
|
374
|
+
decode: (encoding) => (0, auditStore_ts_1.readAuditEntry)(encoding),
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
auditStore.isLegacy = true;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
auditStore = (0, auditStore_ts_1.openAuditStore)(rootStore);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const tables = ensureDB(databaseName);
|
|
386
|
+
const definedTables = tables[DEFINED_TABLES];
|
|
387
|
+
definedTables.rootStore = rootStore;
|
|
388
|
+
const tablesToLoad = new Map();
|
|
389
|
+
for (const result of dbisStore.getRange({ start: false })) {
|
|
390
|
+
const { key, value } = result;
|
|
391
|
+
let [tableName, attribute_name] = key.toString().split('/');
|
|
392
|
+
if (attribute_name === '') {
|
|
393
|
+
// primary key
|
|
394
|
+
attribute_name = value.name;
|
|
395
|
+
}
|
|
396
|
+
else if (!attribute_name) {
|
|
397
|
+
attribute_name = tableName;
|
|
398
|
+
tableName = defaultTable;
|
|
399
|
+
if (!value.name) {
|
|
400
|
+
// legacy attribute
|
|
401
|
+
value.name = attribute_name;
|
|
402
|
+
value.indexed = !value.isPrimaryKey;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
definedTables?.add(tableName);
|
|
406
|
+
let tableDef = tablesToLoad.get(tableName);
|
|
407
|
+
if (!tableDef)
|
|
408
|
+
tablesToLoad.set(tableName, (tableDef = { attributes: [] }));
|
|
409
|
+
if (attribute_name == null || value.isPrimaryKey)
|
|
410
|
+
tableDef.primary = value;
|
|
411
|
+
if (attribute_name != null)
|
|
412
|
+
tableDef.attributes.push(value);
|
|
413
|
+
Object.defineProperty(value, 'key', { value: key, configurable: true });
|
|
414
|
+
}
|
|
415
|
+
for (const [tableName, tableDef] of tablesToLoad) {
|
|
416
|
+
let { attributes, primary: primaryAttribute } = tableDef;
|
|
417
|
+
if (!primaryAttribute) {
|
|
418
|
+
// this isn't defined, find it in the attributes
|
|
419
|
+
for (const attribute of attributes) {
|
|
420
|
+
if (attribute.isPrimaryKey) {
|
|
421
|
+
primaryAttribute = attribute;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (!primaryAttribute) {
|
|
426
|
+
logger.warn(`Unable to find a primary key attribute on table ${tableName}, with attributes: ${JSON.stringify(attributes)}`);
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// if the table has already been defined, use that class, don't create a new one
|
|
431
|
+
let table = tables[tableName];
|
|
432
|
+
let indices = {}, existingAttributes = [];
|
|
433
|
+
let tableId;
|
|
434
|
+
let primaryStore;
|
|
435
|
+
const audit = typeof primaryAttribute.audit === 'boolean' ? primaryAttribute.audit : (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.LOGGING_AUDITLOG);
|
|
436
|
+
const trackDeletes = primaryAttribute.trackDeletes;
|
|
437
|
+
const expiration = primaryAttribute.expiration;
|
|
438
|
+
const eviction = primaryAttribute.eviction;
|
|
439
|
+
const sealed = primaryAttribute.sealed;
|
|
440
|
+
const splitSegments = primaryAttribute.splitSegments;
|
|
441
|
+
const replicate = primaryAttribute.replicate;
|
|
442
|
+
if (table) {
|
|
443
|
+
indices = table.indices;
|
|
444
|
+
existingAttributes = table.attributes;
|
|
445
|
+
table.schemaVersion++;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
tableId = primaryAttribute.tableId;
|
|
449
|
+
if (tableId) {
|
|
450
|
+
if (tableId >= (dbisStore.getSync(NEXT_TABLE_ID) || 0)) {
|
|
451
|
+
dbisStore.putSync(NEXT_TABLE_ID, tableId + 1);
|
|
452
|
+
logger.info(`Updating next table id (it was out of sync) to ${tableId + 1} for ${tableName}`);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
primaryAttribute.tableId = tableId = dbisStore.getSync(NEXT_TABLE_ID);
|
|
457
|
+
if (!tableId)
|
|
458
|
+
tableId = 1;
|
|
459
|
+
logger.debug(`Table {tableName} missing an id, assigning {tableId}`);
|
|
460
|
+
dbisStore.putSync(NEXT_TABLE_ID, tableId + 1);
|
|
461
|
+
dbisStore.putSync(primaryAttribute.key, primaryAttribute);
|
|
462
|
+
}
|
|
463
|
+
const dbiInit = createOpenDBIObject(!primaryAttribute.isPrimaryKey, primaryAttribute.isPrimaryKey);
|
|
464
|
+
dbiInit.compression = primaryAttribute.compression;
|
|
465
|
+
if (dbiInit.compression) {
|
|
466
|
+
const compressionThreshold = (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_COMPRESSION_THRESHOLD) || DEFAULT_COMPRESSION_THRESHOLD; // this is the only thing that can change;
|
|
467
|
+
dbiInit.compression.threshold = compressionThreshold;
|
|
468
|
+
}
|
|
469
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
470
|
+
primaryStore = (0, RecordEncoder_ts_1.handleLocalTimeForGets)(openRocksDatabase(rootStore.path, { ...dbiInit, name: primaryAttribute.key }), rootStore);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
primaryStore = (0, RecordEncoder_ts_1.handleLocalTimeForGets)(rootStore.openDB(primaryAttribute.key, dbiInit), rootStore);
|
|
474
|
+
}
|
|
475
|
+
rootStore.databaseName = databaseName;
|
|
476
|
+
primaryStore.tableId = tableId;
|
|
477
|
+
}
|
|
478
|
+
let attributesUpdated;
|
|
479
|
+
for (const attribute of attributes) {
|
|
480
|
+
attribute.attribute = attribute.name;
|
|
481
|
+
try {
|
|
482
|
+
// now load the non-primary keys, opening the dbs as necessary for indices
|
|
483
|
+
if (!attribute.isPrimaryKey && (attribute.indexed || (attribute.attribute && !attribute.name))) {
|
|
484
|
+
if (!indices[attribute.name]) {
|
|
485
|
+
const dbi = openIndex(attribute.key, rootStore, attribute);
|
|
486
|
+
indices[attribute.name] = dbi;
|
|
487
|
+
indices[attribute.name].indexNulls = attribute.indexNulls;
|
|
488
|
+
}
|
|
489
|
+
const existingAttribute = existingAttributes.find((existingAttribute) => existingAttribute.name === attribute.name);
|
|
490
|
+
if (existingAttribute)
|
|
491
|
+
existingAttributes.splice(existingAttributes.indexOf(existingAttribute), 1, attribute);
|
|
492
|
+
else
|
|
493
|
+
existingAttributes.push(attribute);
|
|
494
|
+
attributesUpdated = true;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
logger.error(`Error trying to update attribute`, attribute, existingAttributes, indices, error);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
for (const existingAttribute of existingAttributes) {
|
|
502
|
+
const attribute = attributes.find((attribute) => attribute.name === existingAttribute.name);
|
|
503
|
+
if (!attribute) {
|
|
504
|
+
if (existingAttribute.isPrimaryKey) {
|
|
505
|
+
logger.error('Unable to remove existing primary key attribute', existingAttribute);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (existingAttribute.indexed) {
|
|
509
|
+
// we only remove attributes if they were indexed, in order to support dropAttribute that removes dynamic indexed attributes
|
|
510
|
+
existingAttributes.splice(existingAttributes.indexOf(existingAttribute), 1);
|
|
511
|
+
attributesUpdated = true;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (table) {
|
|
516
|
+
if (attributesUpdated) {
|
|
517
|
+
table.schemaVersion++;
|
|
518
|
+
table.updatedAttributes();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
table = setTable(tables, tableName, (0, Table_ts_1.makeTable)({
|
|
523
|
+
primaryStore,
|
|
524
|
+
auditStore,
|
|
525
|
+
audit,
|
|
526
|
+
sealed,
|
|
527
|
+
splitSegments,
|
|
528
|
+
replicate,
|
|
529
|
+
expirationMS: expiration && expiration * 1000,
|
|
530
|
+
evictionMS: eviction && eviction * 1000,
|
|
531
|
+
trackDeletes,
|
|
532
|
+
tableName,
|
|
533
|
+
tableId,
|
|
534
|
+
primaryKey: primaryAttribute.name,
|
|
535
|
+
databasePath: isLegacy ? `${databaseName}/${tableName}` : databaseName,
|
|
536
|
+
databaseName,
|
|
537
|
+
indices,
|
|
538
|
+
attributes,
|
|
539
|
+
schemaDefined: primaryAttribute.schemaDefined,
|
|
540
|
+
dbisDB: dbisStore,
|
|
541
|
+
}));
|
|
542
|
+
table.schemaVersion = 1;
|
|
543
|
+
for (const listener of tableListeners) {
|
|
544
|
+
listener(table);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return rootStore;
|
|
549
|
+
}
|
|
550
|
+
function resetDatabases() {
|
|
551
|
+
loadedDatabases = false;
|
|
552
|
+
for (const store of Object.values(lmdbDatabaseEnvs)) {
|
|
553
|
+
store.needsDeletion = true;
|
|
554
|
+
}
|
|
555
|
+
getDatabases();
|
|
556
|
+
for (const [path, store] of lmdbDatabaseEnvs) {
|
|
557
|
+
if (store.needsDeletion && !path.endsWith('system.mdb')) {
|
|
558
|
+
store.close();
|
|
559
|
+
lmdbDatabaseEnvs.delete(path);
|
|
560
|
+
const db = exports.databases[store.databaseName];
|
|
561
|
+
for (const tableName in db) {
|
|
562
|
+
const table = db[tableName];
|
|
563
|
+
if (table.primaryStore.path === path) {
|
|
564
|
+
delete exports.databases[store.databaseName];
|
|
565
|
+
dbRemovalListeners.forEach((listener) => listener(store.databaseName));
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return exports.databases;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Ensure that we have this database object (that holds a set of tables) set up
|
|
575
|
+
* @param databaseName
|
|
576
|
+
* @returns
|
|
577
|
+
*/
|
|
578
|
+
function ensureDB(databaseName) {
|
|
579
|
+
let dbTables = exports.databases[databaseName];
|
|
580
|
+
if (!dbTables) {
|
|
581
|
+
if (databaseName === 'data')
|
|
582
|
+
// preserve the data tables objet
|
|
583
|
+
dbTables = exports.databases[databaseName] = exports.tables;
|
|
584
|
+
else if (databaseName === 'system')
|
|
585
|
+
// make system non-enumerable
|
|
586
|
+
Object.defineProperty(exports.databases, 'system', {
|
|
587
|
+
value: (dbTables = Object.create(null)),
|
|
588
|
+
configurable: true, // no enum
|
|
589
|
+
});
|
|
590
|
+
else {
|
|
591
|
+
dbTables = exports.databases[databaseName] = Object.create(null);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (definedDatabases && !definedDatabases.has(databaseName)) {
|
|
595
|
+
const definedTables = new Set(); // we create this so we can determine what was found in a reset and remove any removed dbs/tables
|
|
596
|
+
dbTables[DEFINED_TABLES] = definedTables;
|
|
597
|
+
definedDatabases.set(databaseName, definedTables);
|
|
598
|
+
}
|
|
599
|
+
return dbTables;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Set the table class into the database's tables object
|
|
603
|
+
* @param tables
|
|
604
|
+
* @param tableName
|
|
605
|
+
* @param Table
|
|
606
|
+
* @returns
|
|
607
|
+
*/
|
|
608
|
+
function setTable(tables, tableName, Table) {
|
|
609
|
+
tables[tableName] = Table;
|
|
610
|
+
return Table;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Get root store for a database
|
|
614
|
+
* @param options
|
|
615
|
+
* @returns
|
|
616
|
+
*/
|
|
617
|
+
function database({ database: databaseName, table: tableName }) {
|
|
618
|
+
if (!databaseName)
|
|
619
|
+
databaseName = DEFAULT_DATABASE_NAME;
|
|
620
|
+
getDatabases();
|
|
621
|
+
ensureDB(databaseName);
|
|
622
|
+
const definedDatabase = definedDatabases.get(databaseName);
|
|
623
|
+
if (definedDatabase?.rootStore) {
|
|
624
|
+
return definedDatabase.rootStore;
|
|
625
|
+
}
|
|
626
|
+
const databaseConfig = (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.DATABASES) || {};
|
|
627
|
+
if (process.env.SCHEMAS_DATA_PATH) {
|
|
628
|
+
databaseConfig.data = { path: process.env.SCHEMAS_DATA_PATH };
|
|
629
|
+
}
|
|
630
|
+
const tablePath = tableName && databaseConfig[databaseName]?.tables?.[tableName]?.path;
|
|
631
|
+
const hdbBasePath = (0, environmentManager_js_1.getHdbBasePath)();
|
|
632
|
+
const databasePath = tablePath ||
|
|
633
|
+
databaseConfig[databaseName]?.path ||
|
|
634
|
+
process.env.STORAGE_PATH ||
|
|
635
|
+
(0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_PATH) ||
|
|
636
|
+
((0, node_fs_1.existsSync)((0, path_1.join)(hdbBasePath, hdbTerms_ts_1.DATABASES_DIR_NAME))
|
|
637
|
+
? (0, path_1.join)(hdbBasePath, hdbTerms_ts_1.DATABASES_DIR_NAME)
|
|
638
|
+
: (0, path_1.join)(hdbBasePath, hdbTerms_ts_1.LEGACY_DATABASES_DIR_NAME));
|
|
639
|
+
let rootStore;
|
|
640
|
+
const useRocksdb = (process.env.HARPER_STORAGE_ENGINE || (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_ENGINE)) !== 'lmdb';
|
|
641
|
+
if (useRocksdb) {
|
|
642
|
+
const path = (0, path_1.join)(databasePath, tablePath ? tableName : databaseName);
|
|
643
|
+
rootStore = rocksdbDatabaseEnvs.get(path);
|
|
644
|
+
if (!rootStore || rootStore.status === 'closed') {
|
|
645
|
+
rootStore = openRocksDatabase(path, {
|
|
646
|
+
disableWAL: false,
|
|
647
|
+
});
|
|
648
|
+
rocksdbDatabaseEnvs.set(path, rootStore);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
const path = (0, path_1.join)(databasePath, `${tablePath ? tableName : databaseName}.mdb`);
|
|
653
|
+
rootStore = lmdbDatabaseEnvs.get(path);
|
|
654
|
+
if (!rootStore || rootStore.status === 'closed') {
|
|
655
|
+
// TODO: validate database name
|
|
656
|
+
const envInit = new OpenEnvironmentObject_js_1.default(path, false);
|
|
657
|
+
rootStore = (0, lmdb_1.open)(envInit);
|
|
658
|
+
lmdbDatabaseEnvs.set(path, rootStore);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (!rootStore.auditStore) {
|
|
662
|
+
rootStore.auditStore = (0, auditStore_ts_1.openAuditStore)(rootStore);
|
|
663
|
+
}
|
|
664
|
+
if (definedDatabase)
|
|
665
|
+
definedDatabase.rootStore = rootStore;
|
|
666
|
+
return rootStore;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Delete the database
|
|
670
|
+
* @param databaseName
|
|
671
|
+
*/
|
|
672
|
+
async function dropDatabase(databaseName) {
|
|
673
|
+
if (!exports.databases[databaseName])
|
|
674
|
+
throw new Error('Database does not exist');
|
|
675
|
+
const dbTables = exports.databases[databaseName];
|
|
676
|
+
let rootStore;
|
|
677
|
+
for (const tableName in dbTables) {
|
|
678
|
+
const table = dbTables[tableName];
|
|
679
|
+
rootStore = table.primaryStore.rootStore;
|
|
680
|
+
lmdbDatabaseEnvs.delete(rootStore.path);
|
|
681
|
+
rocksdbDatabaseEnvs.delete(rootStore.path);
|
|
682
|
+
if (rootStore.status === 'open') {
|
|
683
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
684
|
+
rootStore.close();
|
|
685
|
+
rootStore.destroy();
|
|
686
|
+
}
|
|
687
|
+
else if (rootStore.status === 'open') {
|
|
688
|
+
await rootStore.close();
|
|
689
|
+
await (0, promises_1.unlink)(rootStore.path);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (!rootStore) {
|
|
694
|
+
rootStore = database({ database: databaseName, table: null });
|
|
695
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
696
|
+
rootStore.destroy();
|
|
697
|
+
}
|
|
698
|
+
else if (rootStore.status === 'open') {
|
|
699
|
+
await rootStore.close();
|
|
700
|
+
await (0, promises_1.unlink)(rootStore.path);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (databaseName === 'data') {
|
|
704
|
+
for (const tableName in exports.tables) {
|
|
705
|
+
delete exports.tables[tableName];
|
|
706
|
+
}
|
|
707
|
+
delete exports.tables[DEFINED_TABLES];
|
|
708
|
+
}
|
|
709
|
+
delete exports.databases[databaseName];
|
|
710
|
+
dbRemovalListeners.forEach((listener) => listener(databaseName));
|
|
711
|
+
await (0, blob_ts_1.deleteRootBlobPathsForDB)(rootStore);
|
|
712
|
+
}
|
|
713
|
+
// opens an index, consulting with custom indexes that may use alternate store configuration
|
|
714
|
+
function openIndex(dbiKey, rootStore, attribute) {
|
|
715
|
+
const objectStorage = attribute.isPrimaryKey || (attribute.indexed.type && customIndexes_ts_1.CUSTOM_INDEXES[attribute.indexed.type]?.useObjectStore);
|
|
716
|
+
const dbiInit = createOpenDBIObject(!objectStorage, objectStorage);
|
|
717
|
+
let dbi;
|
|
718
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
719
|
+
dbi = openRocksDatabase(rootStore.path, { ...dbiInit, name: dbiKey });
|
|
720
|
+
dbi.rootStore = rootStore;
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
dbi = rootStore.openDB(dbiKey, dbiInit);
|
|
724
|
+
}
|
|
725
|
+
if (attribute.indexed.type) {
|
|
726
|
+
const CustomIndex = customIndexes_ts_1.CUSTOM_INDEXES[attribute.indexed.type];
|
|
727
|
+
if (CustomIndex) {
|
|
728
|
+
dbi.customIndex = new CustomIndex(dbi, attribute.indexed);
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
logger.error(`The indexing type '${attribute.indexed.type}' is unknown`);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return dbi;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* This can be called to ensure that the specified table exists and if it does not exist, it should be created.
|
|
738
|
+
* @param tableName
|
|
739
|
+
* @param databaseName
|
|
740
|
+
* @param customPath
|
|
741
|
+
* @param expiration
|
|
742
|
+
* @param eviction
|
|
743
|
+
* @param scanInterval
|
|
744
|
+
* @param attributes
|
|
745
|
+
* @param audit
|
|
746
|
+
* @param sealed
|
|
747
|
+
* @param splitSegments
|
|
748
|
+
* @param replicate
|
|
749
|
+
*/
|
|
750
|
+
function table(tableDefinition) {
|
|
751
|
+
let { table: tableName, database: databaseName, expiration, eviction, scanInterval, attributes, audit, sealed, splitSegments, replicate, trackDeletes, schemaDefined, origin, } = tableDefinition;
|
|
752
|
+
if (!databaseName)
|
|
753
|
+
databaseName = DEFAULT_DATABASE_NAME;
|
|
754
|
+
const rootStore = database({ database: databaseName, table: tableName });
|
|
755
|
+
const tables = exports.databases[databaseName];
|
|
756
|
+
logger.trace(`Defining ${tableName} in ${databaseName}`);
|
|
757
|
+
let Table = tables?.[tableName];
|
|
758
|
+
if (rootStore.status === 'closed') {
|
|
759
|
+
throw new Error(`Can not use a closed data store for ${tableName}`);
|
|
760
|
+
}
|
|
761
|
+
let primaryKey;
|
|
762
|
+
let primaryKeyAttribute;
|
|
763
|
+
let attributesDbi;
|
|
764
|
+
if (schemaDefined == undefined)
|
|
765
|
+
schemaDefined = true;
|
|
766
|
+
const internalDbiInit = createOpenDBIObject(false);
|
|
767
|
+
for (const attribute of attributes) {
|
|
768
|
+
if (attribute.attribute && !attribute.name) {
|
|
769
|
+
// there is some legacy code that calls the attribute's name the attribute's attribute
|
|
770
|
+
attribute.name = attribute.attribute;
|
|
771
|
+
attribute.indexed = true;
|
|
772
|
+
}
|
|
773
|
+
else
|
|
774
|
+
attribute.attribute = attribute.name;
|
|
775
|
+
if (attribute.expiresAt)
|
|
776
|
+
attribute.indexed = true;
|
|
777
|
+
}
|
|
778
|
+
let hasChanges;
|
|
779
|
+
let releaseExclusiveLock;
|
|
780
|
+
if (Table) {
|
|
781
|
+
primaryKey = Table.primaryKey;
|
|
782
|
+
if (Table.primaryStore.rootStore.status === 'closed') {
|
|
783
|
+
throw new Error(`Can not use a closed data store from ${tableName} class`);
|
|
784
|
+
}
|
|
785
|
+
// it table already exists, get the split segments setting
|
|
786
|
+
if (splitSegments == undefined)
|
|
787
|
+
splitSegments = Table.splitSegments;
|
|
788
|
+
Table.attributes.splice(0, Table.attributes.length, ...attributes);
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
const auditStore = rootStore.auditStore;
|
|
792
|
+
primaryKeyAttribute = attributes.find((attribute) => attribute.isPrimaryKey) || {};
|
|
793
|
+
primaryKey = primaryKeyAttribute.name;
|
|
794
|
+
primaryKeyAttribute.isPrimaryKey = true;
|
|
795
|
+
primaryKeyAttribute.schemaDefined = schemaDefined;
|
|
796
|
+
// can't change compression after the fact (except threshold), so save only when we create the table
|
|
797
|
+
primaryKeyAttribute.compression = getDefaultCompression();
|
|
798
|
+
if (trackDeletes)
|
|
799
|
+
primaryKeyAttribute.trackDeletes = true;
|
|
800
|
+
audit = primaryKeyAttribute.audit = typeof audit === 'boolean' ? audit : (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.LOGGING_AUDITLOG);
|
|
801
|
+
if (expiration)
|
|
802
|
+
primaryKeyAttribute.expiration = expiration;
|
|
803
|
+
if (eviction)
|
|
804
|
+
primaryKeyAttribute.eviction = eviction;
|
|
805
|
+
splitSegments ??= false;
|
|
806
|
+
primaryKeyAttribute.splitSegments = splitSegments; // always default to not splitting segments going forward
|
|
807
|
+
if (typeof sealed === 'boolean')
|
|
808
|
+
primaryKeyAttribute.sealed = sealed;
|
|
809
|
+
if (typeof replicate === 'boolean')
|
|
810
|
+
primaryKeyAttribute.replicate = replicate;
|
|
811
|
+
if (origin) {
|
|
812
|
+
if (!primaryKeyAttribute.origins)
|
|
813
|
+
primaryKeyAttribute.origins = [origin];
|
|
814
|
+
else if (!primaryKeyAttribute.origins.includes(origin))
|
|
815
|
+
primaryKeyAttribute.origins.push(origin);
|
|
816
|
+
}
|
|
817
|
+
logger.trace(`${tableName} table loading, opening primary store`);
|
|
818
|
+
const dbiInit = createOpenDBIObject(false, true);
|
|
819
|
+
dbiInit.compression = primaryKeyAttribute.compression;
|
|
820
|
+
const dbiName = tableName + '/';
|
|
821
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
822
|
+
attributesDbi = rootStore.dbisDb = openRocksDatabase(rootStore.path, {
|
|
823
|
+
...internalDbiInit,
|
|
824
|
+
disableWAL: false,
|
|
825
|
+
name: terms_js_1.INTERNAL_DBIS_NAME,
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
attributesDbi = rootStore.dbisDb = rootStore.openDB(terms_js_1.INTERNAL_DBIS_NAME, internalDbiInit);
|
|
830
|
+
}
|
|
831
|
+
exclusiveLock(); // get an exclusive lock on the database so we can verify that we are the only thread creating the table (and assigning the table id)
|
|
832
|
+
if (attributesDbi.getSync(dbiName)) {
|
|
833
|
+
// table was created while we were setting up
|
|
834
|
+
if (releaseExclusiveLock)
|
|
835
|
+
releaseExclusiveLock();
|
|
836
|
+
resetDatabases();
|
|
837
|
+
return table(tableDefinition);
|
|
838
|
+
}
|
|
839
|
+
let primaryStore;
|
|
840
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
841
|
+
primaryStore = openRocksDatabase(rootStore.path, { ...dbiInit, name: dbiName });
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
primaryStore = rootStore.openDB(dbiName, dbiInit);
|
|
845
|
+
}
|
|
846
|
+
primaryStore = (0, RecordEncoder_ts_1.handleLocalTimeForGets)(primaryStore, rootStore);
|
|
847
|
+
rootStore.databaseName = databaseName;
|
|
848
|
+
primaryStore.tableId = attributesDbi.getSync(NEXT_TABLE_ID);
|
|
849
|
+
logger.trace(`Assigning new table id ${primaryStore.tableId} for ${tableName}`);
|
|
850
|
+
if (!primaryStore.tableId)
|
|
851
|
+
primaryStore.tableId = 1;
|
|
852
|
+
attributesDbi.put(NEXT_TABLE_ID, primaryStore.tableId + 1);
|
|
853
|
+
primaryKeyAttribute.tableId = primaryStore.tableId;
|
|
854
|
+
Table = setTable(tables, tableName, (0, Table_ts_1.makeTable)({
|
|
855
|
+
primaryStore,
|
|
856
|
+
auditStore,
|
|
857
|
+
audit,
|
|
858
|
+
sealed,
|
|
859
|
+
splitSegments,
|
|
860
|
+
replicate,
|
|
861
|
+
trackDeletes,
|
|
862
|
+
expirationMS: expiration && expiration * 1000,
|
|
863
|
+
evictionMS: eviction && eviction * 1000,
|
|
864
|
+
primaryKey,
|
|
865
|
+
tableName,
|
|
866
|
+
tableId: primaryStore.tableId,
|
|
867
|
+
databasePath: databaseName,
|
|
868
|
+
databaseName,
|
|
869
|
+
indices: {},
|
|
870
|
+
attributes,
|
|
871
|
+
schemaDefined,
|
|
872
|
+
dbisDB: attributesDbi,
|
|
873
|
+
}));
|
|
874
|
+
Table.schemaVersion = 1;
|
|
875
|
+
hasChanges = true;
|
|
876
|
+
attributesDbi.put(dbiName, primaryKeyAttribute);
|
|
877
|
+
}
|
|
878
|
+
const indices = Table.indices;
|
|
879
|
+
if (!attributesDbi) {
|
|
880
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
881
|
+
rootStore.dbisDb = openRocksDatabase(rootStore.path, {
|
|
882
|
+
...internalDbiInit,
|
|
883
|
+
disableWAL: false,
|
|
884
|
+
name: terms_js_1.INTERNAL_DBIS_NAME,
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
rootStore.dbisDb = rootStore.openDB(terms_js_1.INTERNAL_DBIS_NAME, internalDbiInit);
|
|
889
|
+
}
|
|
890
|
+
attributesDbi = rootStore.dbisDb;
|
|
891
|
+
}
|
|
892
|
+
Table.dbisDB = attributesDbi;
|
|
893
|
+
const indicesToRemove = [];
|
|
894
|
+
for (const { key, value } of attributesDbi.getRange({ start: true })) {
|
|
895
|
+
let [attributeTableName, attribute_name] = key.toString().split('/');
|
|
896
|
+
if (attribute_name === '')
|
|
897
|
+
attribute_name = value.name; // primary key
|
|
898
|
+
if (attribute_name) {
|
|
899
|
+
if (attributeTableName !== tableName)
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
// table attribute for a table with no primary key, we don't want to remove this, so continue on
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
const attribute = attributes.find((attribute) => attribute.name === attribute_name);
|
|
907
|
+
const removeIndex = !attribute?.indexed && value.indexed && !value.isPrimaryKey;
|
|
908
|
+
if (!attribute || removeIndex) {
|
|
909
|
+
exclusiveLock();
|
|
910
|
+
hasChanges = true;
|
|
911
|
+
if (!attribute)
|
|
912
|
+
attributesDbi.remove(key);
|
|
913
|
+
if (removeIndex) {
|
|
914
|
+
const indexDbi = Table.indices[attributeTableName];
|
|
915
|
+
if (indexDbi)
|
|
916
|
+
indicesToRemove.push(indexDbi);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
const attributesToIndex = [];
|
|
921
|
+
try {
|
|
922
|
+
// TODO: If we have attributes and the schemaDefined flag is not set, turn it on
|
|
923
|
+
// iterate through the attributes to ensure that we have all the dbis created and indexed
|
|
924
|
+
for (const attribute of attributes || []) {
|
|
925
|
+
if (attribute.relationship || attribute.computed) {
|
|
926
|
+
hasChanges = true; // need to update the table so the computed properties are translated to property resolvers
|
|
927
|
+
if (attribute.relationship)
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
let dbiKey = tableName + '/' + (attribute.name || '');
|
|
931
|
+
Object.defineProperty(attribute, 'key', { value: dbiKey, configurable: true });
|
|
932
|
+
let attributeDescriptor = attributesDbi.getSync(dbiKey);
|
|
933
|
+
if (attribute.isPrimaryKey) {
|
|
934
|
+
attributeDescriptor = attributeDescriptor || attributesDbi.getSync((dbiKey = tableName + '/')) || {};
|
|
935
|
+
// primary key can't change indexing, but settings can change
|
|
936
|
+
if ((audit !== undefined && audit !== Table.audit) ||
|
|
937
|
+
(sealed !== undefined && sealed !== Table.sealed) ||
|
|
938
|
+
(replicate !== undefined && replicate !== Table.replicate) ||
|
|
939
|
+
(+expiration || undefined) !== (+attributeDescriptor.expiration || undefined) ||
|
|
940
|
+
(+eviction || undefined) !== (+attributeDescriptor.eviction || undefined) ||
|
|
941
|
+
attribute.type !== attributeDescriptor.type) {
|
|
942
|
+
const updatedPrimaryAttribute = { ...attributeDescriptor };
|
|
943
|
+
if (typeof audit === 'boolean') {
|
|
944
|
+
if (audit)
|
|
945
|
+
Table.enableAuditing(audit);
|
|
946
|
+
updatedPrimaryAttribute.audit = audit;
|
|
947
|
+
}
|
|
948
|
+
if (expiration)
|
|
949
|
+
updatedPrimaryAttribute.expiration = +expiration;
|
|
950
|
+
if (eviction)
|
|
951
|
+
updatedPrimaryAttribute.eviction = +eviction;
|
|
952
|
+
if (sealed !== undefined)
|
|
953
|
+
updatedPrimaryAttribute.sealed = sealed;
|
|
954
|
+
if (replicate !== undefined)
|
|
955
|
+
updatedPrimaryAttribute.replicate = replicate;
|
|
956
|
+
if (attribute.type)
|
|
957
|
+
updatedPrimaryAttribute.type = attribute.type;
|
|
958
|
+
hasChanges = true; // send out notification of the change
|
|
959
|
+
exclusiveLock();
|
|
960
|
+
attributesDbi.put(dbiKey, updatedPrimaryAttribute);
|
|
961
|
+
}
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
// note that non-indexed attributes do not need a dbi
|
|
965
|
+
if (attributeDescriptor?.attribute && !attributeDescriptor.name)
|
|
966
|
+
attributeDescriptor.indexed = true; // legacy descriptor
|
|
967
|
+
const changed = !attributeDescriptor ||
|
|
968
|
+
attributeDescriptor.type !== attribute.type ||
|
|
969
|
+
JSON.stringify(attributeDescriptor.indexed) !== JSON.stringify(attribute.indexed) ||
|
|
970
|
+
attributeDescriptor.nullable !== attribute.nullable ||
|
|
971
|
+
attributeDescriptor.version !== attribute.version ||
|
|
972
|
+
attributeDescriptor.enumerable !== attribute.enumerable ||
|
|
973
|
+
JSON.stringify(attributeDescriptor.properties) !== JSON.stringify(attribute.properties) ||
|
|
974
|
+
JSON.stringify(attributeDescriptor.elements) !== JSON.stringify(attribute.elements);
|
|
975
|
+
if (attribute.indexed) {
|
|
976
|
+
const dbi = openIndex(dbiKey, rootStore, attribute);
|
|
977
|
+
if (changed ||
|
|
978
|
+
(attributeDescriptor.indexingPID && attributeDescriptor.indexingPID !== process.pid) ||
|
|
979
|
+
attributeDescriptor.restartNumber < worker_threads_1.workerData?.restartNumber) {
|
|
980
|
+
hasChanges = true;
|
|
981
|
+
exclusiveLock();
|
|
982
|
+
attributeDescriptor = attributesDbi.getSync(dbiKey);
|
|
983
|
+
if (changed ||
|
|
984
|
+
(attributeDescriptor.indexingPID && attributeDescriptor.indexingPID !== process.pid) ||
|
|
985
|
+
attributeDescriptor.restartNumber < worker_threads_1.workerData?.restartNumber) {
|
|
986
|
+
hasChanges = true;
|
|
987
|
+
if (attribute.indexNulls === undefined)
|
|
988
|
+
attribute.indexNulls = true;
|
|
989
|
+
let hasExistingData = false;
|
|
990
|
+
for (let _entry of Table.primaryStore.getRange({ start: true })) {
|
|
991
|
+
hasExistingData = true;
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
if (hasExistingData) {
|
|
995
|
+
attribute.lastIndexedKey = attributeDescriptor?.lastIndexedKey ?? undefined;
|
|
996
|
+
attribute.indexingPID = process.pid;
|
|
997
|
+
dbi.isIndexing = true;
|
|
998
|
+
Object.defineProperty(attribute, 'dbi', { value: dbi });
|
|
999
|
+
// we only set indexing nulls to true if new or reindexing, we can't have partial indexing of null
|
|
1000
|
+
attributesToIndex.push(attribute);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
attributesDbi.put(dbiKey, attribute);
|
|
1004
|
+
}
|
|
1005
|
+
if (attributeDescriptor?.indexNulls && attribute.indexNulls === undefined)
|
|
1006
|
+
attribute.indexNulls = true;
|
|
1007
|
+
dbi.indexNulls = attribute.indexNulls;
|
|
1008
|
+
indices[attribute.name] = dbi;
|
|
1009
|
+
}
|
|
1010
|
+
else if (changed) {
|
|
1011
|
+
hasChanges = true;
|
|
1012
|
+
exclusiveLock();
|
|
1013
|
+
attributesDbi.put(dbiKey, attribute);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
finally {
|
|
1018
|
+
if (releaseExclusiveLock)
|
|
1019
|
+
releaseExclusiveLock();
|
|
1020
|
+
}
|
|
1021
|
+
if (hasChanges) {
|
|
1022
|
+
Table.schemaVersion++;
|
|
1023
|
+
Table.updatedAttributes();
|
|
1024
|
+
}
|
|
1025
|
+
logger.trace(`${tableName} table loading, running index`);
|
|
1026
|
+
if (attributesToIndex.length > 0 || indicesToRemove.length > 0) {
|
|
1027
|
+
Table.indexingOperation = runIndexing(Table, attributesToIndex, indicesToRemove);
|
|
1028
|
+
}
|
|
1029
|
+
else if (hasChanges)
|
|
1030
|
+
signalling.signalSchemaChange(new itc_js_1.SchemaEventMsg(process.pid, 'schema-change', Table.databaseName, Table.tableName));
|
|
1031
|
+
Table.origin = origin;
|
|
1032
|
+
if (hasChanges) {
|
|
1033
|
+
for (const listener of tableListeners) {
|
|
1034
|
+
listener(Table, origin !== 'cluster');
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if (expiration || eviction || scanInterval)
|
|
1038
|
+
Table.setTTLExpiration({
|
|
1039
|
+
expiration,
|
|
1040
|
+
eviction,
|
|
1041
|
+
scanInterval,
|
|
1042
|
+
});
|
|
1043
|
+
logger.trace(`${tableName} table loaded`);
|
|
1044
|
+
return Table;
|
|
1045
|
+
// Acquire an exclusive lock for attribute updates
|
|
1046
|
+
function exclusiveLock() {
|
|
1047
|
+
if (releaseExclusiveLock)
|
|
1048
|
+
return;
|
|
1049
|
+
if (rootStore instanceof rocksdb_js_1.RocksDatabase) {
|
|
1050
|
+
while (!rootStore.tryLock('update-attributes')) { } // use a spin lock, we really need an synchronous exclusive lock here
|
|
1051
|
+
releaseExclusiveLock = () => {
|
|
1052
|
+
rootStore.unlock('update-attributes');
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
// we only need an exclusive transaction lock in lmdb
|
|
1057
|
+
rootStore.transactionSync(() => {
|
|
1058
|
+
return {
|
|
1059
|
+
then(callback) {
|
|
1060
|
+
releaseExclusiveLock = callback;
|
|
1061
|
+
},
|
|
1062
|
+
};
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
const MAX_OUTSTANDING_INDEXING = 1000;
|
|
1068
|
+
const MIN_OUTSTANDING_INDEXING = 10;
|
|
1069
|
+
async function runIndexing(Table, attributes, indicesToRemove) {
|
|
1070
|
+
try {
|
|
1071
|
+
logger.info(`Indexing ${Table.tableName} attributes`, attributes);
|
|
1072
|
+
await signalling.signalSchemaChange(new itc_js_1.SchemaEventMsg(process.pid, 'schema-change', Table.databaseName, Table.tableName));
|
|
1073
|
+
let lastResolution;
|
|
1074
|
+
for (const index of indicesToRemove) {
|
|
1075
|
+
lastResolution = index.drop();
|
|
1076
|
+
}
|
|
1077
|
+
let interrupted;
|
|
1078
|
+
const attributeErrorReported = {};
|
|
1079
|
+
let indexed = 0;
|
|
1080
|
+
const attributesLength = attributes.length;
|
|
1081
|
+
await new Promise((resolve) => setImmediate(resolve)); // yield event turn, indexing should consistently take at least one event turn
|
|
1082
|
+
if (attributesLength > 0) {
|
|
1083
|
+
let start;
|
|
1084
|
+
for (const attribute of attributes) {
|
|
1085
|
+
// if we are resuming, we need to start from the last key we indexed by all attributes
|
|
1086
|
+
if ((0, lmdb_1.compareKeys)(attribute.lastIndexedKey, start) < 0)
|
|
1087
|
+
start = attribute.lastIndexedKey;
|
|
1088
|
+
if (attribute.lastIndexedKey == undefined) {
|
|
1089
|
+
// if we are starting from the beginning, clear out any previous index entries since we are rewriting
|
|
1090
|
+
if (attribute.dbi.clearAsync) {
|
|
1091
|
+
// LMDB, note that we don't need to wait for this to complete, just gets enqueued in front of the other writes
|
|
1092
|
+
attribute.dbi.clearAsync();
|
|
1093
|
+
}
|
|
1094
|
+
else {
|
|
1095
|
+
await attribute.dbi.clear();
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
let outstanding = 0;
|
|
1100
|
+
// this means that a new attribute has been introduced that needs to be indexed
|
|
1101
|
+
for (const { key, value: record } of Table.primaryStore.getRange({
|
|
1102
|
+
start,
|
|
1103
|
+
lazy: attributesLength < 4,
|
|
1104
|
+
versions: true,
|
|
1105
|
+
snapshot: false, // don't hold a read transaction this whole time
|
|
1106
|
+
})) {
|
|
1107
|
+
if (!record)
|
|
1108
|
+
continue; // deletion entry
|
|
1109
|
+
// TODO: Do we ever need to interrupt due to a schema change that was not a restart?
|
|
1110
|
+
//if (Table.schemaVersion !== schemaVersion) return; // break out if there are any schema changes and let someone else pick it up
|
|
1111
|
+
outstanding++;
|
|
1112
|
+
// every index operation needs to be guarded by the version still be the same. If it has already changed before
|
|
1113
|
+
// we index, that's fine because indexing is idempotent, we can just put the same values again. If it changes
|
|
1114
|
+
// during the indexing, the indexing here will fail. This is also fine because it means the other thread will have
|
|
1115
|
+
// performed indexing and we don't need to do anything further
|
|
1116
|
+
for (let i = 0; i < attributesLength; i++) {
|
|
1117
|
+
const attribute = attributes[i];
|
|
1118
|
+
const property = attribute.name;
|
|
1119
|
+
const index = attribute.dbi;
|
|
1120
|
+
try {
|
|
1121
|
+
const resolver = attribute.resolve;
|
|
1122
|
+
const value = record && (resolver ? resolver(record) : record[property]);
|
|
1123
|
+
if (index.customIndex) {
|
|
1124
|
+
index.customIndex.index(key, value);
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
const values = (0, commonUtility_js_1.getIndexedValues)(value, index.indexNulls);
|
|
1128
|
+
if (values) {
|
|
1129
|
+
for (let i = 0, l = values.length; i < l; i++) {
|
|
1130
|
+
lastResolution = index.put(values[i], key);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
catch (error) {
|
|
1135
|
+
if (!attributeErrorReported[property]) {
|
|
1136
|
+
// just report an indexing error once per attribute so we don't spam the logs
|
|
1137
|
+
attributeErrorReported[property] = true;
|
|
1138
|
+
logger.error(`Error indexing attribute ${property}`, error);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
(0, when_ts_1.when)(lastResolution, () => outstanding--, (error) => {
|
|
1143
|
+
outstanding--;
|
|
1144
|
+
logger.error(error);
|
|
1145
|
+
});
|
|
1146
|
+
if (worker_threads_1.workerData && worker_threads_1.workerData.restartNumber !== manageThreads.restartNumber) {
|
|
1147
|
+
interrupted = true;
|
|
1148
|
+
}
|
|
1149
|
+
if (++indexed % 100 === 0 || interrupted) {
|
|
1150
|
+
// occasionally update our progress so if we crash, we can resume
|
|
1151
|
+
for (const attribute of attributes) {
|
|
1152
|
+
attribute.lastIndexedKey = key;
|
|
1153
|
+
Table.dbisDB.put(attribute.key, attribute);
|
|
1154
|
+
}
|
|
1155
|
+
if (interrupted)
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
if (outstanding > MAX_OUTSTANDING_INDEXING)
|
|
1159
|
+
await lastResolution;
|
|
1160
|
+
else if (outstanding > MIN_OUTSTANDING_INDEXING)
|
|
1161
|
+
await new Promise((resolve) => setImmediate(resolve)); // yield event turn, don't want to use all computation
|
|
1162
|
+
}
|
|
1163
|
+
// update the attributes to indicate that we are finished
|
|
1164
|
+
for (const attribute of attributes) {
|
|
1165
|
+
delete attribute.lastIndexedKey;
|
|
1166
|
+
delete attribute.indexingPID;
|
|
1167
|
+
attribute.dbi.isIndexing = false;
|
|
1168
|
+
lastResolution = Table.dbisDB.put(attribute.key, attribute);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
await lastResolution;
|
|
1172
|
+
// now notify all the threads that we are done and the index is ready to use
|
|
1173
|
+
await signalling.signalSchemaChange(new itc_js_1.SchemaEventMsg(process.pid, 'indexing-finished', Table.databaseName, Table.tableName));
|
|
1174
|
+
logger.info(`Finished indexing ${Table.tableName} attributes`, attributes);
|
|
1175
|
+
}
|
|
1176
|
+
catch (error) {
|
|
1177
|
+
logger.error('Error in indexing', error);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
function dropTableMeta({ table: tableName, database: databaseName }) {
|
|
1181
|
+
const rootStore = database({ database: databaseName, table: tableName });
|
|
1182
|
+
const removals = [];
|
|
1183
|
+
const dbisDb = rootStore.dbisDb;
|
|
1184
|
+
for (const key of dbisDb.getKeys({ start: tableName + '/', end: tableName + '0' })) {
|
|
1185
|
+
removals.push(dbisDb.remove(key));
|
|
1186
|
+
}
|
|
1187
|
+
return Promise.all(removals);
|
|
1188
|
+
}
|
|
1189
|
+
function onUpdatedTable(listener) {
|
|
1190
|
+
tableListeners.push(listener);
|
|
1191
|
+
return {
|
|
1192
|
+
remove() {
|
|
1193
|
+
const index = tableListeners.indexOf(listener);
|
|
1194
|
+
if (index > -1)
|
|
1195
|
+
tableListeners.splice(index, 1);
|
|
1196
|
+
},
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
function onRemovedDB(listener) {
|
|
1200
|
+
dbRemovalListeners.push(listener);
|
|
1201
|
+
return {
|
|
1202
|
+
remove() {
|
|
1203
|
+
const index = dbRemovalListeners.indexOf(listener);
|
|
1204
|
+
if (index > -1)
|
|
1205
|
+
dbRemovalListeners.splice(index, 1);
|
|
1206
|
+
},
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
function getDefaultCompression() {
|
|
1210
|
+
const LMDB_COMPRESSION = (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_COMPRESSION);
|
|
1211
|
+
const STORAGE_COMPRESSION_DICTIONARY = (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_COMPRESSION_DICTIONARY);
|
|
1212
|
+
const STORAGE_COMPRESSION_THRESHOLD = (0, environmentManager_js_1.get)(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_COMPRESSION_THRESHOLD) || DEFAULT_COMPRESSION_THRESHOLD;
|
|
1213
|
+
const LMDB_COMPRESSION_OPTS = { startingOffset: 32 };
|
|
1214
|
+
if (STORAGE_COMPRESSION_DICTIONARY)
|
|
1215
|
+
LMDB_COMPRESSION_OPTS['dictionary'] = (0, node_fs_1.readFileSync)(STORAGE_COMPRESSION_DICTIONARY);
|
|
1216
|
+
if (STORAGE_COMPRESSION_THRESHOLD)
|
|
1217
|
+
LMDB_COMPRESSION_OPTS['threshold'] = STORAGE_COMPRESSION_THRESHOLD;
|
|
1218
|
+
return LMDB_COMPRESSION && LMDB_COMPRESSION_OPTS;
|
|
1219
|
+
}
|
|
1220
|
+
//# sourceMappingURL=databases.js.map
|