@harperfast/harper 5.0.25 → 5.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/agent/agent.ts +203 -0
- package/agent/loop.ts +205 -0
- package/agent/operations.ts +148 -0
- package/agent/session.ts +187 -0
- package/agent/tools/fsTools.ts +276 -0
- package/agent/tools/httpFetchTool.ts +112 -0
- package/agent/tools/scheduleTool.ts +68 -0
- package/agent/toolset.ts +43 -0
- package/agent/types.ts +85 -0
- package/bin/{BinObjects.js → BinObjects.ts} +4 -5
- package/bin/cliCredentials.ts +133 -0
- package/bin/cliOperations.ts +339 -0
- package/bin/copyDb.ts +10 -10
- package/bin/deployRenderer.ts +196 -0
- package/bin/{harper.js → harper.ts} +43 -19
- package/bin/{install.js → install.ts} +3 -3
- package/bin/lite.ts +2 -0
- package/bin/login.ts +168 -0
- package/bin/logout.ts +11 -0
- package/bin/mcp/client.ts +407 -0
- package/bin/mcp/doctor.ts +189 -0
- package/bin/mcp/index.ts +80 -0
- package/bin/mcp/options.ts +122 -0
- package/bin/mcp/printConfig.ts +89 -0
- package/bin/multipartBuilder.ts +74 -0
- package/bin/{restart.js → restart.ts} +27 -28
- package/bin/{run.js → run.ts} +41 -30
- package/bin/sseConsumer.ts +126 -0
- package/bin/{status.js → status.ts} +10 -10
- package/bin/{stop.js → stop.ts} +5 -5
- package/bin/upgrade.js +6 -6
- package/components/Application.ts +144 -18
- package/components/ApplicationScope.ts +2 -2
- package/components/ComponentV1.ts +2 -2
- package/components/EntryHandler.ts +159 -9
- package/components/OptionsWatcher.ts +75 -11
- package/components/Scope.ts +125 -15
- package/components/anthropic/index.ts +547 -0
- package/components/bedrock/index.ts +823 -0
- package/components/componentLoader.ts +63 -32
- package/components/deployLifecycle.ts +161 -0
- package/components/deploymentOperations.ts +173 -0
- package/components/deploymentRecorder.ts +402 -0
- package/components/deriveURLPath.ts +4 -4
- package/components/mcp/adapters/fastify.ts +87 -0
- package/components/mcp/adapters/harperHttp.ts +103 -0
- package/components/mcp/audit.ts +75 -0
- package/components/mcp/index.ts +134 -0
- package/components/mcp/jsonrpc.ts +134 -0
- package/components/mcp/lifecycle.ts +105 -0
- package/components/mcp/listChanged.ts +270 -0
- package/components/mcp/rateLimit.ts +217 -0
- package/components/mcp/resources.ts +593 -0
- package/components/mcp/session.ts +151 -0
- package/components/mcp/sessionRegistry.ts +140 -0
- package/components/mcp/toolRegistry.ts +292 -0
- package/components/mcp/tools/application.ts +603 -0
- package/components/mcp/tools/operations.ts +283 -0
- package/components/mcp/tools/schemas/derive.ts +256 -0
- package/components/mcp/tools/schemas/operations.ts +245 -0
- package/components/mcp/transport.ts +517 -0
- package/components/ollama/index.ts +316 -0
- package/components/openai/index.ts +563 -0
- package/components/operations.js +211 -60
- package/components/operationsValidation.js +3 -3
- package/components/packageComponent.ts +97 -29
- package/components/requestRestart.ts +17 -2
- package/components/status/crossThread.ts +14 -5
- package/components/status/errors.ts +1 -1
- package/config/RootConfigWatcher.ts +56 -2
- package/config/configUtils.js +29 -8
- package/config/harperConfigEnvVars.ts +1 -1
- package/config-root.schema.json +74 -0
- package/dataLayer/{CreateAttributeObject.js → CreateAttributeObject.ts} +4 -3
- package/dataLayer/{CreateTableObject.js → CreateTableObject.ts} +2 -1
- package/dataLayer/{DataLayerObjects.js → DataLayerObjects.ts} +17 -9
- package/dataLayer/{DeleteBeforeObject.js → DeleteBeforeObject.ts} +2 -1
- package/dataLayer/{DeleteObject.js → DeleteObject.ts} +3 -2
- package/dataLayer/{DropAttributeObject.js → DropAttributeObject.ts} +2 -1
- package/dataLayer/{GetBackupObject.js → GetBackupObject.ts} +3 -2
- package/dataLayer/{InsertObject.js → InsertObject.ts} +3 -2
- package/dataLayer/{ReadAuditLogObject.js → ReadAuditLogObject.ts} +3 -2
- package/dataLayer/{SQLSearch.js → SQLSearch.ts} +97 -43
- package/dataLayer/{SearchByConditionsObject.js → SearchByConditionsObject.ts} +5 -6
- package/dataLayer/{SearchByHashObject.js → SearchByHashObject.ts} +2 -1
- package/dataLayer/{SearchObject.js → SearchObject.ts} +2 -1
- package/dataLayer/{SqlSearchObject.js → SqlSearchObject.ts} +2 -1
- package/dataLayer/{UpdateObject.js → UpdateObject.ts} +3 -2
- package/dataLayer/{UpsertObject.js → UpsertObject.ts} +3 -2
- package/dataLayer/{bulkLoad.js → bulkLoad.ts} +40 -49
- package/dataLayer/{delete.js → delete.ts} +21 -26
- package/dataLayer/{export.js → export.ts} +22 -26
- package/dataLayer/{getBackup.js → getBackup.ts} +7 -9
- package/dataLayer/harperBridge/BridgeMethods.ts +102 -0
- package/dataLayer/harperBridge/ResourceBridge.ts +27 -26
- package/dataLayer/harperBridge/TableSizeObject.ts +1 -0
- package/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
- package/dataLayer/harperBridge/{harperBridge.js → harperBridge.ts} +3 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +8 -6
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +6 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +5 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +6 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +5 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +3 -2
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +10 -8
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +4 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +6 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +2 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +3 -2
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +5 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +6 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.ts +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
- package/dataLayer/{hdbInfoController.js → hdbInfoController.ts} +20 -26
- package/dataLayer/{insert.js → insert.ts} +24 -24
- package/dataLayer/{readAuditLog.js → readAuditLog.ts} +8 -10
- package/dataLayer/{schema.js → schema.ts} +32 -44
- package/dataLayer/{schemaDescribe.js → schemaDescribe.ts} +23 -26
- package/dataLayer/{search.js → search.ts} +9 -15
- package/dataLayer/{transaction.js → transaction.ts} +2 -5
- package/dataLayer/{update.js → update.ts} +19 -22
- package/dist/agent/agent.d.ts +35 -0
- package/dist/agent/agent.js +175 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/loop.d.ts +34 -0
- package/dist/agent/loop.js +176 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/operations.d.ts +17 -0
- package/dist/agent/operations.js +137 -0
- package/dist/agent/operations.js.map +1 -0
- package/dist/agent/session.d.ts +36 -0
- package/dist/agent/session.js +182 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/agent/tools/fsTools.d.ts +19 -0
- package/dist/agent/tools/fsTools.js +286 -0
- package/dist/agent/tools/fsTools.js.map +1 -0
- package/dist/agent/tools/httpFetchTool.d.ts +9 -0
- package/dist/agent/tools/httpFetchTool.js +116 -0
- package/dist/agent/tools/httpFetchTool.js.map +1 -0
- package/dist/agent/tools/scheduleTool.d.ts +22 -0
- package/dist/agent/tools/scheduleTool.js +54 -0
- package/dist/agent/tools/scheduleTool.js.map +1 -0
- package/dist/agent/toolset.d.ts +24 -0
- package/dist/agent/toolset.js +33 -0
- package/dist/agent/toolset.js.map +1 -0
- package/dist/agent/types.d.ts +75 -0
- package/dist/agent/types.js +10 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/bin/BinObjects.d.ts +2 -2
- package/dist/bin/BinObjects.js +6 -3
- package/dist/bin/BinObjects.js.map +1 -1
- package/dist/bin/cliCredentials.d.ts +27 -0
- package/dist/bin/cliCredentials.js +130 -0
- package/dist/bin/cliCredentials.js.map +1 -0
- package/dist/bin/cliOperations.d.ts +7 -7
- package/dist/bin/cliOperations.js +251 -37
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/copyDb.js +16 -16
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/bin/deployRenderer.d.ts +47 -0
- package/dist/bin/deployRenderer.js +185 -0
- package/dist/bin/deployRenderer.js.map +1 -0
- package/dist/bin/harper.d.ts +2 -1
- package/dist/bin/harper.js +87 -26
- package/dist/bin/harper.js.map +1 -1
- package/dist/bin/install.d.ts +1 -1
- package/dist/bin/install.js +41 -4
- package/dist/bin/install.js.map +1 -1
- package/dist/bin/lite.js +3 -4
- package/dist/bin/lite.js.map +1 -1
- package/dist/bin/login.d.ts +4 -0
- package/dist/bin/login.js +158 -0
- package/dist/bin/login.js.map +1 -0
- package/dist/bin/logout.d.ts +4 -0
- package/dist/bin/logout.js +16 -0
- package/dist/bin/logout.js.map +1 -0
- package/dist/bin/mcp/client.d.ts +34 -0
- package/dist/bin/mcp/client.js +395 -0
- package/dist/bin/mcp/client.js.map +1 -0
- package/dist/bin/mcp/doctor.d.ts +11 -0
- package/dist/bin/mcp/doctor.js +193 -0
- package/dist/bin/mcp/doctor.js.map +1 -0
- package/dist/bin/mcp/index.d.ts +10 -0
- package/dist/bin/mcp/index.js +81 -0
- package/dist/bin/mcp/index.js.map +1 -0
- package/dist/bin/mcp/options.d.ts +33 -0
- package/dist/bin/mcp/options.js +113 -0
- package/dist/bin/mcp/options.js.map +1 -0
- package/dist/bin/mcp/printConfig.d.ts +14 -0
- package/dist/bin/mcp/printConfig.js +85 -0
- package/dist/bin/mcp/printConfig.js.map +1 -0
- package/dist/bin/multipartBuilder.d.ts +26 -0
- package/dist/bin/multipartBuilder.js +55 -0
- package/dist/bin/multipartBuilder.js.map +1 -0
- package/dist/bin/restart.d.ts +3 -2
- package/dist/bin/restart.js +82 -45
- package/dist/bin/restart.js.map +1 -1
- package/dist/bin/run.d.ts +13 -9
- package/dist/bin/run.js +111 -65
- package/dist/bin/run.js.map +1 -1
- package/dist/bin/sseConsumer.d.ts +24 -0
- package/dist/bin/sseConsumer.js +127 -0
- package/dist/bin/sseConsumer.js.map +1 -0
- package/dist/bin/status.d.ts +1 -1
- package/dist/bin/status.js +48 -11
- package/dist/bin/status.js.map +1 -1
- package/dist/bin/stop.d.ts +1 -1
- package/dist/bin/stop.js +43 -6
- package/dist/bin/stop.js.map +1 -1
- package/dist/bin/upgrade.js +6 -6
- package/dist/components/Application.d.ts +29 -17
- package/dist/components/Application.js +134 -28
- package/dist/components/Application.js.map +1 -1
- package/dist/components/ApplicationScope.js +2 -2
- package/dist/components/ComponentV1.d.ts +1 -1
- package/dist/components/ComponentV1.js +5 -5
- package/dist/components/ComponentV1.js.map +1 -1
- package/dist/components/EntryHandler.d.ts +26 -3
- package/dist/components/EntryHandler.js +153 -13
- package/dist/components/EntryHandler.js.map +1 -1
- package/dist/components/OptionsWatcher.d.ts +7 -2
- package/dist/components/OptionsWatcher.js +72 -10
- package/dist/components/OptionsWatcher.js.map +1 -1
- package/dist/components/Scope.d.ts +11 -6
- package/dist/components/Scope.js +105 -9
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/anthropic/index.d.ts +40 -0
- package/dist/components/anthropic/index.js +428 -0
- package/dist/components/anthropic/index.js.map +1 -0
- package/dist/components/bedrock/index.d.ts +79 -0
- package/dist/components/bedrock/index.js +734 -0
- package/dist/components/bedrock/index.js.map +1 -0
- package/dist/components/componentLoader.d.ts +29 -0
- package/dist/components/componentLoader.js +63 -38
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/deployLifecycle.d.ts +39 -0
- package/dist/components/deployLifecycle.js +156 -0
- package/dist/components/deployLifecycle.js.map +1 -0
- package/dist/components/deploymentOperations.d.ts +19 -0
- package/dist/components/deploymentOperations.js +185 -0
- package/dist/components/deploymentOperations.js.map +1 -0
- package/dist/components/deploymentRecorder.d.ts +81 -0
- package/dist/components/deploymentRecorder.js +401 -0
- package/dist/components/deploymentRecorder.js.map +1 -0
- package/dist/components/deriveURLPath.d.ts +2 -2
- package/dist/components/deriveURLPath.js +2 -2
- package/dist/components/deriveURLPath.js.map +1 -1
- package/dist/components/mcp/adapters/fastify.d.ts +35 -0
- package/dist/components/mcp/adapters/fastify.js +66 -0
- package/dist/components/mcp/adapters/fastify.js.map +1 -0
- package/dist/components/mcp/adapters/harperHttp.d.ts +38 -0
- package/dist/components/mcp/adapters/harperHttp.js +78 -0
- package/dist/components/mcp/adapters/harperHttp.js.map +1 -0
- package/dist/components/mcp/audit.d.ts +27 -0
- package/dist/components/mcp/audit.js +73 -0
- package/dist/components/mcp/audit.js.map +1 -0
- package/dist/components/mcp/index.d.ts +47 -0
- package/dist/components/mcp/index.js +109 -0
- package/dist/components/mcp/index.js.map +1 -0
- package/dist/components/mcp/jsonrpc.d.ts +71 -0
- package/dist/components/mcp/jsonrpc.js +93 -0
- package/dist/components/mcp/jsonrpc.js.map +1 -0
- package/dist/components/mcp/lifecycle.d.ts +69 -0
- package/dist/components/mcp/lifecycle.js +79 -0
- package/dist/components/mcp/lifecycle.js.map +1 -0
- package/dist/components/mcp/listChanged.d.ts +24 -0
- package/dist/components/mcp/listChanged.js +257 -0
- package/dist/components/mcp/listChanged.js.map +1 -0
- package/dist/components/mcp/rateLimit.d.ts +25 -0
- package/dist/components/mcp/rateLimit.js +226 -0
- package/dist/components/mcp/rateLimit.js.map +1 -0
- package/dist/components/mcp/resources.d.ts +90 -0
- package/dist/components/mcp/resources.js +515 -0
- package/dist/components/mcp/resources.js.map +1 -0
- package/dist/components/mcp/session.d.ts +36 -0
- package/dist/components/mcp/session.js +170 -0
- package/dist/components/mcp/session.js.map +1 -0
- package/dist/components/mcp/sessionRegistry.d.ts +63 -0
- package/dist/components/mcp/sessionRegistry.js +124 -0
- package/dist/components/mcp/sessionRegistry.js.map +1 -0
- package/dist/components/mcp/toolRegistry.d.ts +150 -0
- package/dist/components/mcp/toolRegistry.js +176 -0
- package/dist/components/mcp/toolRegistry.js.map +1 -0
- package/dist/components/mcp/tools/application.d.ts +58 -0
- package/dist/components/mcp/tools/application.js +549 -0
- package/dist/components/mcp/tools/application.js.map +1 -0
- package/dist/components/mcp/tools/operations.d.ts +23 -0
- package/dist/components/mcp/tools/operations.js +303 -0
- package/dist/components/mcp/tools/operations.js.map +1 -0
- package/dist/components/mcp/tools/schemas/derive.d.ts +36 -0
- package/dist/components/mcp/tools/schemas/derive.js +216 -0
- package/dist/components/mcp/tools/schemas/derive.js.map +1 -0
- package/dist/components/mcp/tools/schemas/operations.d.ts +27 -0
- package/dist/components/mcp/tools/schemas/operations.js +243 -0
- package/dist/components/mcp/tools/schemas/operations.js.map +1 -0
- package/dist/components/mcp/transport.d.ts +38 -0
- package/dist/components/mcp/transport.js +467 -0
- package/dist/components/mcp/transport.js.map +1 -0
- package/dist/components/ollama/index.d.ts +46 -0
- package/dist/components/ollama/index.js +239 -0
- package/dist/components/ollama/index.js.map +1 -0
- package/dist/components/openai/index.d.ts +51 -0
- package/dist/components/openai/index.js +475 -0
- package/dist/components/openai/index.js.map +1 -0
- package/dist/components/operations.d.ts +6 -6
- package/dist/components/operations.js +198 -52
- package/dist/components/operations.js.map +1 -1
- package/dist/components/operationsValidation.d.ts +2 -2
- package/dist/components/operationsValidation.js +3 -3
- package/dist/components/packageComponent.d.ts +28 -6
- package/dist/components/packageComponent.js +87 -26
- package/dist/components/packageComponent.js.map +1 -1
- package/dist/components/requestRestart.d.ts +1 -0
- package/dist/components/requestRestart.js +12 -1
- package/dist/components/requestRestart.js.map +1 -1
- package/dist/components/status/crossThread.d.ts +5 -1
- package/dist/components/status/crossThread.js +12 -5
- package/dist/components/status/crossThread.js.map +1 -1
- package/dist/components/status/errors.js +7 -7
- package/dist/config/RootConfigWatcher.d.ts +3 -0
- package/dist/config/RootConfigWatcher.js +52 -1
- package/dist/config/RootConfigWatcher.js.map +1 -1
- package/dist/config/configUtils.js +31 -8
- package/dist/config/configUtils.js.map +1 -1
- package/dist/config/harperConfigEnvVars.js +1 -1
- package/dist/config/harperConfigEnvVars.js.map +1 -1
- package/dist/dataLayer/CreateAttributeObject.d.ts +3 -7
- package/dist/dataLayer/CreateAttributeObject.js +4 -3
- package/dist/dataLayer/CreateAttributeObject.js.map +1 -1
- package/dist/dataLayer/CreateTableObject.d.ts +2 -4
- package/dist/dataLayer/CreateTableObject.js +2 -1
- package/dist/dataLayer/CreateTableObject.js.map +1 -1
- package/dist/dataLayer/DataLayerObjects.d.ts +17 -16
- package/dist/dataLayer/DataLayerObjects.js +19 -5
- package/dist/dataLayer/DataLayerObjects.js.map +1 -1
- package/dist/dataLayer/DeleteBeforeObject.d.ts +3 -5
- package/dist/dataLayer/DeleteBeforeObject.js +2 -1
- package/dist/dataLayer/DeleteBeforeObject.js.map +1 -1
- package/dist/dataLayer/DeleteObject.d.ts +3 -7
- package/dist/dataLayer/DeleteObject.js +4 -3
- package/dist/dataLayer/DeleteObject.js.map +1 -1
- package/dist/dataLayer/DropAttributeObject.d.ts +2 -4
- package/dist/dataLayer/DropAttributeObject.js +2 -1
- package/dist/dataLayer/DropAttributeObject.js.map +1 -1
- package/dist/dataLayer/GetBackupObject.d.ts +3 -5
- package/dist/dataLayer/GetBackupObject.js +4 -3
- package/dist/dataLayer/GetBackupObject.js.map +1 -1
- package/dist/dataLayer/InsertObject.d.ts +3 -8
- package/dist/dataLayer/InsertObject.js +4 -3
- package/dist/dataLayer/InsertObject.js.map +1 -1
- package/dist/dataLayer/ReadAuditLogObject.d.ts +3 -7
- package/dist/dataLayer/ReadAuditLogObject.js +4 -3
- package/dist/dataLayer/ReadAuditLogObject.js.map +1 -1
- package/dist/dataLayer/SQLSearch.d.ts +68 -38
- package/dist/dataLayer/SQLSearch.js +140 -78
- package/dist/dataLayer/SQLSearch.js.map +1 -1
- package/dist/dataLayer/SearchByConditionsObject.d.ts +10 -58
- package/dist/dataLayer/SearchByConditionsObject.js +5 -7
- package/dist/dataLayer/SearchByConditionsObject.js.map +1 -1
- package/dist/dataLayer/SearchByHashObject.d.ts +3 -6
- package/dist/dataLayer/SearchByHashObject.js +2 -1
- package/dist/dataLayer/SearchByHashObject.js.map +1 -1
- package/dist/dataLayer/SearchObject.d.ts +3 -12
- package/dist/dataLayer/SearchObject.js +2 -1
- package/dist/dataLayer/SearchObject.js.map +1 -1
- package/dist/dataLayer/SqlSearchObject.d.ts +2 -4
- package/dist/dataLayer/SqlSearchObject.js +2 -1
- package/dist/dataLayer/SqlSearchObject.js.map +1 -1
- package/dist/dataLayer/UpdateObject.d.ts +3 -7
- package/dist/dataLayer/UpdateObject.js +4 -3
- package/dist/dataLayer/UpdateObject.js.map +1 -1
- package/dist/dataLayer/UpsertObject.d.ts +3 -7
- package/dist/dataLayer/UpsertObject.js +4 -3
- package/dist/dataLayer/UpsertObject.js.map +1 -1
- package/dist/dataLayer/bulkLoad.d.ts +4 -4
- package/dist/dataLayer/bulkLoad.js +122 -88
- package/dist/dataLayer/bulkLoad.js.map +1 -1
- package/dist/dataLayer/delete.d.ts +10 -11
- package/dist/dataLayer/delete.js +74 -39
- package/dist/dataLayer/delete.js.map +1 -1
- package/dist/dataLayer/export.d.ts +8 -8
- package/dist/dataLayer/export.js +90 -55
- package/dist/dataLayer/export.js.map +1 -1
- package/dist/dataLayer/getBackup.d.ts +4 -3
- package/dist/dataLayer/getBackup.js +43 -11
- package/dist/dataLayer/getBackup.js.map +1 -1
- package/dist/dataLayer/harperBridge/BridgeMethods.d.ts +39 -21
- package/dist/dataLayer/harperBridge/BridgeMethods.js +41 -20
- package/dist/dataLayer/harperBridge/BridgeMethods.js.map +1 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +2 -2
- package/dist/dataLayer/harperBridge/ResourceBridge.js +26 -25
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
- package/dist/dataLayer/harperBridge/TableSizeObject.d.ts +1 -0
- package/dist/dataLayer/harperBridge/TableSizeObject.js.map +1 -1
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.d.ts +4 -4
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
- package/dist/dataLayer/harperBridge/harperBridge.d.ts +2 -3
- package/dist/dataLayer/harperBridge/harperBridge.js +38 -4
- package/dist/dataLayer/harperBridge/harperBridge.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +7 -6
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +5 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +8 -8
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.d.ts +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +3 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +5 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
- package/dist/dataLayer/hdbInfoController.d.ts +4 -8
- package/dist/dataLayer/hdbInfoController.js +66 -31
- package/dist/dataLayer/hdbInfoController.js.map +1 -1
- package/dist/dataLayer/insert.d.ts +14 -26
- package/dist/dataLayer/insert.js +63 -28
- package/dist/dataLayer/insert.js.map +1 -1
- package/dist/dataLayer/readAuditLog.d.ts +1 -3
- package/dist/dataLayer/readAuditLog.js +45 -13
- package/dist/dataLayer/readAuditLog.js.map +1 -1
- package/dist/dataLayer/schema.d.ts +10 -10
- package/dist/dataLayer/schema.js +124 -89
- package/dist/dataLayer/schema.js.map +1 -1
- package/dist/dataLayer/schemaDescribe.d.ts +4 -4
- package/dist/dataLayer/schemaDescribe.js +78 -41
- package/dist/dataLayer/schemaDescribe.js.map +1 -1
- package/dist/dataLayer/search.d.ts +4 -4
- package/dist/dataLayer/search.js +12 -13
- package/dist/dataLayer/search.js.map +1 -1
- package/dist/dataLayer/transaction.d.ts +1 -1
- package/dist/dataLayer/transaction.js +3 -4
- package/dist/dataLayer/transaction.js.map +1 -1
- package/dist/dataLayer/update.d.ts +2 -8
- package/dist/dataLayer/update.js +53 -18
- package/dist/dataLayer/update.js.map +1 -1
- package/dist/globals.d.ts +1 -1
- package/dist/globals.js +1 -0
- package/dist/globals.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/json/systemSchema.json +65 -0
- package/dist/launchServiceScripts/launchHarperDB.d.ts +1 -0
- package/dist/launchServiceScripts/launchHarperDB.js +3 -0
- package/dist/launchServiceScripts/launchHarperDB.js.map +1 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.js +3 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.js.map +1 -1
- package/dist/resources/DatabaseTransaction.d.ts +14 -6
- package/dist/resources/DatabaseTransaction.js +39 -15
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/ErrorResource.d.ts +1 -1
- package/dist/resources/ErrorResource.js +3 -1
- package/dist/resources/ErrorResource.js.map +1 -1
- package/dist/resources/LMDBTransaction.d.ts +10 -13
- package/dist/resources/LMDBTransaction.js +18 -7
- package/dist/resources/LMDBTransaction.js.map +1 -1
- package/dist/resources/RecordEncoder.d.ts +7 -1
- package/dist/resources/RecordEncoder.js +5 -2
- package/dist/resources/RecordEncoder.js.map +1 -1
- package/dist/resources/RequestTarget.d.ts +1 -0
- package/dist/resources/RequestTarget.js.map +1 -1
- package/dist/resources/Resource.d.ts +9 -5
- package/dist/resources/Resource.js +37 -10
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/ResourceInterface.d.ts +24 -5
- package/dist/resources/ResourceInterface.js +20 -0
- package/dist/resources/ResourceInterface.js.map +1 -1
- package/dist/resources/Resources.d.ts +3 -4
- package/dist/resources/Resources.js +7 -6
- package/dist/resources/Resources.js.map +1 -1
- package/dist/resources/RocksIndexStore.js +3 -0
- package/dist/resources/RocksIndexStore.js.map +1 -1
- package/dist/resources/RocksTransactionLogStore.d.ts +1 -1
- package/dist/resources/RocksTransactionLogStore.js +46 -27
- package/dist/resources/RocksTransactionLogStore.js.map +1 -1
- package/dist/resources/Table.d.ts +59 -329
- package/dist/resources/Table.js +267 -107
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/analytics/metadata.d.ts +1 -0
- package/dist/resources/analytics/metadata.js +1 -0
- package/dist/resources/analytics/metadata.js.map +1 -1
- package/dist/resources/analytics/read.d.ts +5 -0
- package/dist/resources/analytics/read.js +16 -5
- package/dist/resources/analytics/read.js.map +1 -1
- package/dist/resources/analytics/write.d.ts +28 -0
- package/dist/resources/analytics/write.js +232 -20
- package/dist/resources/analytics/write.js.map +1 -1
- package/dist/resources/auditStore.d.ts +18 -13
- package/dist/resources/auditStore.js +13 -8
- package/dist/resources/auditStore.js.map +1 -1
- package/dist/resources/blob.d.ts +16 -27
- package/dist/resources/blob.js +8 -8
- package/dist/resources/blob.js.map +1 -1
- package/dist/resources/dataLoader.d.ts +1 -1
- package/dist/resources/dataLoader.js +13 -13
- package/dist/resources/databases.d.ts +13 -0
- package/dist/resources/databases.js +160 -52
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/graphql.d.ts +1 -7
- package/dist/resources/graphql.js +224 -174
- package/dist/resources/graphql.js.map +1 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +16 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +308 -59
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
- package/dist/resources/indexes/vector.d.ts +1 -0
- package/dist/resources/indexes/vector.js +14 -0
- package/dist/resources/indexes/vector.js.map +1 -1
- package/dist/resources/loadEnv.d.ts +2 -5
- package/dist/resources/loadEnv.js +21 -18
- package/dist/resources/loadEnv.js.map +1 -1
- package/dist/resources/login.d.ts +2 -3
- package/dist/resources/login.js +5 -4
- package/dist/resources/login.js.map +1 -1
- package/dist/resources/models/Models.d.ts +45 -0
- package/dist/resources/models/Models.js +265 -0
- package/dist/resources/models/Models.js.map +1 -0
- package/dist/resources/models/TestBackend.d.ts +15 -0
- package/dist/resources/models/TestBackend.js +71 -0
- package/dist/resources/models/TestBackend.js.map +1 -0
- package/dist/resources/models/agentLoop.d.ts +125 -0
- package/dist/resources/models/agentLoop.js +746 -0
- package/dist/resources/models/agentLoop.js.map +1 -0
- package/dist/resources/models/analyticsTable.d.ts +65 -0
- package/dist/resources/models/analyticsTable.js +166 -0
- package/dist/resources/models/analyticsTable.js.map +1 -0
- package/dist/resources/models/backendHelpers.d.ts +57 -0
- package/dist/resources/models/backendHelpers.js +109 -0
- package/dist/resources/models/backendHelpers.js.map +1 -0
- package/dist/resources/models/backendRegistry.d.ts +36 -0
- package/dist/resources/models/backendRegistry.js +54 -0
- package/dist/resources/models/backendRegistry.js.map +1 -0
- package/dist/resources/models/bootstrap.d.ts +24 -0
- package/dist/resources/models/bootstrap.js +112 -0
- package/dist/resources/models/bootstrap.js.map +1 -0
- package/dist/resources/models/embedHook.d.ts +33 -0
- package/dist/resources/models/embedHook.js +127 -0
- package/dist/resources/models/embedHook.js.map +1 -0
- package/dist/resources/models/types.d.ts +301 -0
- package/dist/resources/models/types.js +11 -0
- package/dist/resources/models/types.js.map +1 -0
- package/dist/resources/replayLogs.js +7 -1
- package/dist/resources/replayLogs.js.map +1 -1
- package/dist/resources/roles.d.ts +1 -7
- package/dist/resources/roles.js +67 -71
- package/dist/resources/roles.js.map +1 -1
- package/dist/resources/search.d.ts +18 -1
- package/dist/resources/search.js +349 -140
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/tracked.d.ts +1 -1
- package/dist/resources/tracked.js +14 -14
- package/dist/resources/tracked.js.map +1 -1
- package/dist/resources/transaction.d.ts +1 -1
- package/dist/resources/transaction.js +1 -1
- package/dist/resources/transaction.js.map +1 -1
- package/dist/resources/transactionBroadcast.d.ts +1 -1
- package/dist/resources/transactionBroadcast.js.map +1 -1
- package/dist/security/auth.d.ts +1 -5
- package/dist/security/auth.js +34 -25
- package/dist/security/auth.js.map +1 -1
- package/dist/security/certificateVerification/crlVerification.js +7 -1
- package/dist/security/certificateVerification/crlVerification.js.map +1 -1
- package/dist/security/cryptoHash.d.ts +2 -2
- package/dist/security/cryptoHash.js +37 -5
- package/dist/security/cryptoHash.js.map +1 -1
- package/dist/security/data_objects/PermissionAttributeResponseObject.d.ts +3 -4
- package/dist/security/data_objects/PermissionAttributeResponseObject.js +4 -1
- package/dist/security/data_objects/PermissionAttributeResponseObject.js.map +1 -1
- package/dist/security/data_objects/PermissionResponseObject.d.ts +9 -9
- package/dist/security/data_objects/PermissionResponseObject.js +15 -8
- package/dist/security/data_objects/PermissionResponseObject.js.map +1 -1
- package/dist/security/data_objects/PermissionTableResponseObject.d.ts +5 -6
- package/dist/security/data_objects/PermissionTableResponseObject.js +6 -1
- package/dist/security/data_objects/PermissionTableResponseObject.js.map +1 -1
- package/dist/security/fastifyAuth.d.ts +2 -2
- package/dist/security/fastifyAuth.js +131 -22
- package/dist/security/fastifyAuth.js.map +1 -1
- package/dist/security/impersonation.js +15 -15
- package/dist/security/jsLoader.js +18 -5
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/security/keys.d.ts +45 -48
- package/dist/security/keys.js +160 -114
- package/dist/security/keys.js.map +1 -1
- package/dist/security/permissionsTranslator.js +2 -2
- package/dist/security/role.d.ts +5 -5
- package/dist/security/role.js +70 -35
- package/dist/security/role.js.map +1 -1
- package/dist/security/tokenAuthentication.d.ts +13 -0
- package/dist/security/tokenAuthentication.js +57 -27
- package/dist/security/tokenAuthentication.js.map +1 -1
- package/dist/security/user.js +74 -38
- package/dist/security/user.js.map +1 -1
- package/dist/server/DurableSubscriptionsSession.d.ts +4 -2
- package/dist/server/DurableSubscriptionsSession.js +71 -55
- package/dist/server/DurableSubscriptionsSession.js.map +1 -1
- package/dist/server/REST.d.ts +1 -8
- package/dist/server/REST.js +17 -16
- package/dist/server/REST.js.map +1 -1
- package/dist/server/Server.d.ts +23 -4
- package/dist/server/Server.js +1 -1
- package/dist/server/Server.js.map +1 -1
- package/dist/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
- package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
- package/dist/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
- package/dist/server/fastifyRoutes.d.ts +1 -4
- package/dist/server/fastifyRoutes.js +34 -30
- package/dist/server/fastifyRoutes.js.map +1 -1
- package/dist/server/graphqlQuerying.d.ts +1 -1
- package/dist/server/graphqlQuerying.js +8 -7
- package/dist/server/graphqlQuerying.js.map +1 -1
- package/dist/server/http.d.ts +9 -4
- package/dist/server/http.js +523 -47
- package/dist/server/http.js.map +1 -1
- package/dist/server/itc/serverHandlers.js +66 -15
- package/dist/server/itc/serverHandlers.js.map +1 -1
- package/dist/server/jobs/JobObject.d.ts +3 -3
- package/dist/server/jobs/JobObject.js +53 -7
- package/dist/server/jobs/JobObject.js.map +1 -1
- package/dist/server/jobs/jobProcess.js +64 -24
- package/dist/server/jobs/jobProcess.js.map +1 -1
- package/dist/server/jobs/jobRunner.d.ts +7 -6
- package/dist/server/jobs/jobRunner.js +68 -30
- package/dist/server/jobs/jobRunner.js.map +1 -1
- package/dist/server/jobs/jobs.d.ts +18 -7
- package/dist/server/jobs/jobs.js +93 -61
- package/dist/server/jobs/jobs.js.map +1 -1
- package/dist/server/loadRootComponents.js +1 -1
- package/dist/server/middlewareChain.d.ts +80 -0
- package/dist/server/middlewareChain.js +252 -0
- package/dist/server/middlewareChain.js.map +1 -0
- package/dist/server/mqtt.d.ts +1 -8
- package/dist/server/mqtt.js +22 -17
- package/dist/server/mqtt.js.map +1 -1
- package/dist/server/nodeName.js +44 -13
- package/dist/server/nodeName.js.map +1 -1
- package/dist/server/operationsServer.d.ts +2 -2
- package/dist/server/operationsServer.js +106 -33
- package/dist/server/operationsServer.js.map +1 -1
- package/dist/server/serverHelpers/Headers.d.ts +4 -4
- package/dist/server/serverHelpers/Headers.js +2 -0
- package/dist/server/serverHelpers/Headers.js.map +1 -1
- package/dist/server/serverHelpers/JSONStream.d.ts +7 -1
- package/dist/server/serverHelpers/JSONStream.js +12 -3
- package/dist/server/serverHelpers/JSONStream.js.map +1 -1
- package/dist/server/serverHelpers/Request.d.ts +106 -8
- package/dist/server/serverHelpers/Request.js +370 -9
- package/dist/server/serverHelpers/Request.js.map +1 -1
- package/dist/server/serverHelpers/contentTypes.d.ts +1 -1
- package/dist/server/serverHelpers/contentTypes.js +36 -7
- package/dist/server/serverHelpers/contentTypes.js.map +1 -1
- package/dist/server/serverHelpers/multipartParser.d.ts +21 -0
- package/dist/server/serverHelpers/multipartParser.js +142 -0
- package/dist/server/serverHelpers/multipartParser.js.map +1 -0
- package/dist/server/serverHelpers/progressEmitter.d.ts +25 -0
- package/dist/server/serverHelpers/progressEmitter.js +103 -0
- package/dist/server/serverHelpers/progressEmitter.js.map +1 -0
- package/dist/server/serverHelpers/serverHandlers.d.ts +1 -1
- package/dist/server/serverHelpers/serverHandlers.js +38 -7
- package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
- package/dist/server/serverHelpers/serverUtilities.d.ts +4 -2
- package/dist/server/serverHelpers/serverUtilities.js +97 -93
- package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
- package/dist/server/static.js +8 -5
- package/dist/server/static.js.map +1 -1
- package/dist/server/status/index.js +3 -3
- package/dist/server/storageReclamation.d.ts +10 -0
- package/dist/server/storageReclamation.js +68 -9
- package/dist/server/storageReclamation.js.map +1 -1
- package/dist/server/threads/itc.js +7 -4
- package/dist/server/threads/itc.js.map +1 -1
- package/dist/server/threads/manageThreads.d.ts +1 -1
- package/dist/server/threads/manageThreads.js +110 -26
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/socketRouter.d.ts +0 -1
- package/dist/server/threads/socketRouter.js +8 -271
- package/dist/server/threads/socketRouter.js.map +1 -1
- package/dist/server/threads/threadServer.d.ts +1 -0
- package/dist/server/threads/threadServer.js +360 -118
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/server/threads/workerProcessGuard.d.ts +42 -0
- package/dist/server/threads/workerProcessGuard.js +114 -0
- package/dist/server/threads/workerProcessGuard.js.map +1 -0
- package/dist/server/throttle.js +17 -0
- package/dist/server/throttle.js.map +1 -1
- package/dist/sqlTranslator/SelectValidator.d.ts +21 -24
- package/dist/sqlTranslator/SelectValidator.js +86 -47
- package/dist/sqlTranslator/SelectValidator.js.map +1 -1
- package/dist/sqlTranslator/alasqlFunctionImporter.d.ts +6 -2
- package/dist/sqlTranslator/alasqlFunctionImporter.js +40 -3
- package/dist/sqlTranslator/alasqlFunctionImporter.js.map +1 -1
- package/dist/sqlTranslator/deleteTranslator.d.ts +4 -7
- package/dist/sqlTranslator/deleteTranslator.js +48 -14
- package/dist/sqlTranslator/deleteTranslator.js.map +1 -1
- package/dist/sqlTranslator/index.d.ts +10 -9
- package/dist/sqlTranslator/index.js +69 -30
- package/dist/sqlTranslator/index.js.map +1 -1
- package/dist/sqlTranslator/sql_statement_bucket.d.ts +10 -10
- package/dist/sqlTranslator/sql_statement_bucket.js +55 -13
- package/dist/sqlTranslator/sql_statement_bucket.js.map +1 -1
- package/dist/upgrade/UpgradeObjects.d.ts +2 -3
- package/dist/upgrade/UpgradeObjects.js +37 -4
- package/dist/upgrade/UpgradeObjects.js.map +1 -1
- package/dist/upgrade/directives/5-2-0.d.ts +6 -0
- package/dist/upgrade/directives/5-2-0.js +77 -0
- package/dist/upgrade/directives/5-2-0.js.map +1 -0
- package/dist/upgrade/directives/directivesController.d.ts +10 -10
- package/dist/upgrade/directives/directivesController.js +52 -11
- package/dist/upgrade/directives/directivesController.js.map +1 -1
- package/dist/upgrade/directivesManager.d.ts +1 -1
- package/dist/upgrade/directivesManager.js +53 -18
- package/dist/upgrade/directivesManager.js.map +1 -1
- package/dist/upgrade/upgradePrompt.d.ts +3 -3
- package/dist/upgrade/upgradePrompt.js +65 -30
- package/dist/upgrade/upgradePrompt.js.map +1 -1
- package/dist/upgrade/upgradeUtilities.d.ts +1 -1
- package/dist/upgrade/upgradeUtilities.js +37 -5
- package/dist/upgrade/upgradeUtilities.js.map +1 -1
- package/dist/utility/OperationFunctionCaller.d.ts +1 -1
- package/dist/utility/OperationFunctionCaller.js +45 -10
- package/dist/utility/OperationFunctionCaller.js.map +1 -1
- package/dist/utility/assignCmdEnvVariables.d.ts +1 -2
- package/dist/utility/assignCmdEnvVariables.js +8 -4
- package/dist/utility/assignCmdEnvVariables.js.map +1 -1
- package/dist/utility/common_utils.d.ts +80 -77
- package/dist/utility/common_utils.js +140 -79
- package/dist/utility/common_utils.js.map +1 -1
- package/dist/utility/environment/environmentManager.d.ts +12 -11
- package/dist/utility/environment/environmentManager.js +75 -29
- package/dist/utility/environment/environmentManager.js.map +1 -1
- package/dist/utility/environment/systemInformation.d.ts +4 -0
- package/dist/utility/environment/systemInformation.js +27 -16
- package/dist/utility/environment/systemInformation.js.map +1 -1
- package/dist/utility/errors/commonErrors.d.ts +192 -168
- package/dist/utility/errors/commonErrors.js +49 -18
- package/dist/utility/errors/commonErrors.js.map +1 -1
- package/dist/utility/errors/hdbError.d.ts +37 -51
- package/dist/utility/errors/hdbError.js +65 -26
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/utility/expandEnvVar.d.ts +61 -0
- package/dist/utility/expandEnvVar.js +113 -0
- package/dist/utility/expandEnvVar.js.map +1 -0
- package/dist/utility/functions/geo.js +2 -2
- package/dist/utility/functions/sql/alaSQLExtension.js +1 -1
- package/dist/utility/globalSchema.d.ts +13 -4
- package/dist/utility/globalSchema.js +14 -11
- package/dist/utility/globalSchema.js.map +1 -1
- package/dist/utility/hdbTerms.d.ts +56 -0
- package/dist/utility/hdbTerms.js +56 -0
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/install/checkJWTTokensExist.js +1 -1
- package/dist/utility/install/installer.d.ts +9 -12
- package/dist/utility/install/installer.js +87 -51
- package/dist/utility/install/installer.js.map +1 -1
- package/dist/utility/installation.js +3 -3
- package/dist/utility/lmdb/DBIDefinition.d.ts +4 -4
- package/dist/utility/lmdb/DBIDefinition.js +5 -1
- package/dist/utility/lmdb/DBIDefinition.js.map +1 -1
- package/dist/utility/lmdb/DeleteRecordsResponseObject.d.ts +3 -6
- package/dist/utility/lmdb/DeleteRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/DeleteRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/InsertRecordsResponseObject.d.ts +3 -5
- package/dist/utility/lmdb/InsertRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/InsertRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/OpenDBIObject.d.ts +11 -15
- package/dist/utility/lmdb/OpenDBIObject.js +54 -6
- package/dist/utility/lmdb/OpenDBIObject.js.map +1 -1
- package/dist/utility/lmdb/OpenEnvironmentObject.d.ts +5 -8
- package/dist/utility/lmdb/OpenEnvironmentObject.js +52 -4
- package/dist/utility/lmdb/OpenEnvironmentObject.js.map +1 -1
- package/dist/utility/lmdb/UpdateRecordsResponseObject.d.ts +3 -6
- package/dist/utility/lmdb/UpdateRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/UpdateRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/UpsertRecordsResponseObject.d.ts +3 -5
- package/dist/utility/lmdb/UpsertRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/UpsertRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/cleanLMDBMap.d.ts +1 -1
- package/dist/utility/lmdb/cleanLMDBMap.js +44 -7
- package/dist/utility/lmdb/cleanLMDBMap.js.map +1 -1
- package/dist/utility/lmdb/commonUtility.d.ts +8 -9
- package/dist/utility/lmdb/commonUtility.js +46 -17
- package/dist/utility/lmdb/commonUtility.js.map +1 -1
- package/dist/utility/lmdb/deleteUtility.d.ts +2 -3
- package/dist/utility/lmdb/deleteUtility.js +51 -16
- package/dist/utility/lmdb/deleteUtility.js.map +1 -1
- package/dist/utility/lmdb/environmentUtility.d.ts +69 -36
- package/dist/utility/lmdb/environmentUtility.js +91 -51
- package/dist/utility/lmdb/environmentUtility.js.map +1 -1
- package/dist/utility/lmdb/searchCursorFunctions.d.ts +19 -19
- package/dist/utility/lmdb/searchCursorFunctions.js +46 -14
- package/dist/utility/lmdb/searchCursorFunctions.js.map +1 -1
- package/dist/utility/lmdb/searchUtility.d.ts +142 -73
- package/dist/utility/lmdb/searchUtility.js +91 -55
- package/dist/utility/lmdb/searchUtility.js.map +1 -1
- package/dist/utility/lmdb/terms.d.ts +34 -34
- package/dist/utility/lmdb/terms.js +12 -22
- package/dist/utility/lmdb/terms.js.map +1 -1
- package/dist/utility/lmdb/writeUtility.d.ts +3 -6
- package/dist/utility/lmdb/writeUtility.js +61 -28
- package/dist/utility/lmdb/writeUtility.js.map +1 -1
- package/dist/utility/logging/harper_logger.d.ts +87 -103
- package/dist/utility/logging/harper_logger.js +176 -81
- package/dist/utility/logging/harper_logger.js.map +1 -1
- package/dist/utility/logging/logRotator.d.ts +2 -10
- package/dist/utility/logging/logRotator.js +65 -28
- package/dist/utility/logging/logRotator.js.map +1 -1
- package/dist/utility/logging/logger.js +4 -4
- package/dist/utility/logging/readLog.d.ts +1 -1
- package/dist/utility/logging/readLog.js +54 -17
- package/dist/utility/logging/readLog.js.map +1 -1
- package/dist/utility/logging/transactionLog.d.ts +2 -2
- package/dist/utility/logging/transactionLog.js +51 -16
- package/dist/utility/logging/transactionLog.js.map +1 -1
- package/dist/utility/mount_hdb.d.ts +1 -2
- package/dist/utility/mount_hdb.js +54 -17
- package/dist/utility/mount_hdb.js.map +1 -1
- package/dist/utility/npmUtilities.d.ts +1 -1
- package/dist/utility/npmUtilities.js +54 -19
- package/dist/utility/npmUtilities.js.map +1 -1
- package/dist/utility/operation_authorization.d.ts +36 -9
- package/dist/utility/operation_authorization.js +135 -86
- package/dist/utility/operation_authorization.js.map +1 -1
- package/dist/utility/packageUtils.d.ts +0 -2
- package/dist/utility/packageUtils.js +7 -17
- package/dist/utility/packageUtils.js.map +1 -1
- package/dist/utility/password.js +2 -2
- package/dist/utility/processManagement/processManagement.js +2 -2
- package/dist/utility/processManagement/servicesConfig.js +1 -1
- package/dist/utility/signalling.d.ts +2 -2
- package/dist/utility/signalling.js +51 -16
- package/dist/utility/signalling.js.map +1 -1
- package/dist/utility/watcherFallback.d.ts +36 -0
- package/dist/utility/watcherFallback.js +73 -0
- package/dist/utility/watcherFallback.js.map +1 -0
- package/dist/validation/analyticsValidator.d.ts +1 -0
- package/dist/validation/analyticsValidator.js +79 -0
- package/dist/validation/analyticsValidator.js.map +1 -0
- package/dist/validation/bulkDeleteValidator.d.ts +1 -2
- package/dist/validation/bulkDeleteValidator.js +49 -11
- package/dist/validation/bulkDeleteValidator.js.map +1 -1
- package/dist/validation/check_permissions.d.ts +1 -2
- package/dist/validation/check_permissions.js +38 -3
- package/dist/validation/check_permissions.js.map +1 -1
- package/dist/validation/common_validators.d.ts +20 -20
- package/dist/validation/common_validators.js +62 -31
- package/dist/validation/common_validators.js.map +1 -1
- package/dist/validation/configValidator.d.ts +4 -4
- package/dist/validation/configValidator.js +189 -54
- package/dist/validation/configValidator.js.map +1 -1
- package/dist/validation/deleteValidator.d.ts +1 -2
- package/dist/validation/deleteValidator.js +49 -11
- package/dist/validation/deleteValidator.js.map +1 -1
- package/dist/validation/fileLoadValidator.d.ts +4 -4
- package/dist/validation/fileLoadValidator.js +67 -32
- package/dist/validation/fileLoadValidator.js.map +1 -1
- package/dist/validation/insertValidator.d.ts +1 -2
- package/dist/validation/insertValidator.js +48 -10
- package/dist/validation/insertValidator.js.map +1 -1
- package/dist/validation/installValidator.d.ts +2 -2
- package/dist/validation/installValidator.js +47 -10
- package/dist/validation/installValidator.js.map +1 -1
- package/dist/validation/readLogValidator.d.ts +1 -2
- package/dist/validation/readLogValidator.js +60 -22
- package/dist/validation/readLogValidator.js.map +1 -1
- package/dist/validation/role_validation.d.ts +3 -3
- package/dist/validation/role_validation.js +55 -19
- package/dist/validation/role_validation.js.map +1 -1
- package/dist/validation/schemaMetadataValidator.d.ts +3 -4
- package/dist/validation/schemaMetadataValidator.js +11 -12
- package/dist/validation/schemaMetadataValidator.js.map +1 -1
- package/dist/validation/searchValidator.d.ts +1 -2
- package/dist/validation/searchValidator.js +82 -43
- package/dist/validation/searchValidator.js.map +1 -1
- package/dist/validation/statusValidator.d.ts +1 -1
- package/dist/validation/transactionLogValidator.d.ts +3 -3
- package/dist/validation/transactionLogValidator.js +52 -17
- package/dist/validation/transactionLogValidator.js.map +1 -1
- package/dist/validation/user_validation.d.ts +3 -3
- package/dist/validation/user_validation.js +38 -6
- package/dist/validation/user_validation.js.map +1 -1
- package/dist/validation/validationWrapper.d.ts +3 -3
- package/dist/validation/validationWrapper.js +4 -5
- package/dist/validation/validationWrapper.js.map +1 -1
- package/index.ts +5 -0
- package/json/systemSchema.json +65 -0
- package/launchServiceScripts/utility/checkNodeVersion.js +2 -0
- package/package.json +37 -22
- package/resources/DESIGN.md +98 -0
- package/resources/DatabaseTransaction.ts +58 -30
- package/resources/ErrorResource.ts +2 -1
- package/resources/LMDBTransaction.ts +38 -29
- package/resources/RecordEncoder.ts +12 -4
- package/resources/RequestTarget.ts +2 -0
- package/resources/Resource.ts +89 -56
- package/resources/ResourceInterface.ts +44 -21
- package/resources/Resources.ts +8 -8
- package/resources/RocksIndexStore.ts +3 -0
- package/resources/RocksTransactionLogStore.ts +47 -28
- package/resources/Table.ts +386 -214
- package/resources/analytics/metadata.ts +1 -0
- package/resources/analytics/read.ts +24 -6
- package/resources/analytics/write.ts +240 -17
- package/resources/auditStore.ts +28 -19
- package/resources/blob.ts +53 -53
- package/resources/dataLoader.ts +4 -4
- package/resources/databases.ts +190 -71
- package/resources/graphql.ts +227 -164
- package/resources/indexes/HierarchicalNavigableSmallWorld.ts +294 -65
- package/resources/indexes/vector.ts +17 -0
- package/resources/loadEnv.ts +21 -17
- package/resources/login.ts +5 -3
- package/resources/models/Models.ts +304 -0
- package/resources/models/TestBackend.ts +83 -0
- package/resources/models/agentLoop.ts +895 -0
- package/resources/models/analyticsTable.ts +199 -0
- package/resources/models/backendHelpers.ts +116 -0
- package/resources/models/backendRegistry.ts +66 -0
- package/resources/models/bootstrap.ts +135 -0
- package/resources/models/embedHook.ts +138 -0
- package/resources/models/types.ts +296 -0
- package/resources/replayLogs.ts +15 -7
- package/resources/roles.ts +62 -67
- package/resources/search.ts +355 -135
- package/resources/tracked.ts +8 -8
- package/resources/transaction.ts +8 -8
- package/resources/transactionBroadcast.ts +3 -3
- package/security/auth.ts +35 -26
- package/security/certificateVerification/crlVerification.ts +11 -4
- package/security/{cryptoHash.js → cryptoHash.ts} +3 -8
- package/security/data_objects/{PermissionAttributeResponseObject.js → PermissionAttributeResponseObject.ts} +4 -4
- package/security/data_objects/{PermissionResponseObject.js → PermissionResponseObject.ts} +12 -11
- package/security/data_objects/{PermissionTableResponseObject.js → PermissionTableResponseObject.ts} +6 -4
- package/security/{fastifyAuth.js → fastifyAuth.ts} +93 -20
- package/security/impersonation.ts +3 -3
- package/security/jsLoader.ts +22 -8
- package/security/{keys.js → keys.ts} +113 -121
- package/security/permissionsTranslator.js +2 -2
- package/security/{role.js → role.ts} +26 -33
- package/security/tokenAuthentication.ts +34 -7
- package/security/user.ts +26 -22
- package/server/DESIGN.md +139 -0
- package/server/DurableSubscriptionsSession.ts +67 -50
- package/server/REST.ts +120 -107
- package/server/Server.ts +31 -12
- package/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
- package/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
- package/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
- package/server/fastifyRoutes.ts +37 -33
- package/server/graphqlQuerying.ts +6 -5
- package/server/http.ts +517 -26
- package/server/itc/serverHandlers.js +75 -14
- package/server/jobs/{JobObject.js → JobObject.ts} +13 -6
- package/server/jobs/{jobProcess.js → jobProcess.ts} +20 -16
- package/server/jobs/{jobRunner.js → jobRunner.ts} +20 -21
- package/server/jobs/{jobs.js → jobs.ts} +41 -44
- package/server/loadRootComponents.js +1 -1
- package/server/middlewareChain.ts +270 -0
- package/server/mqtt.ts +35 -26
- package/server/nodeName.ts +2 -1
- package/server/operationsServer.ts +85 -10
- package/server/serverHelpers/Headers.ts +10 -8
- package/server/serverHelpers/JSONStream.ts +15 -5
- package/server/serverHelpers/Request.ts +370 -13
- package/server/serverHelpers/contentTypes.ts +42 -11
- package/server/serverHelpers/multipartParser.ts +152 -0
- package/server/serverHelpers/progressEmitter.ts +110 -0
- package/server/serverHelpers/serverHandlers.js +43 -7
- package/server/serverHelpers/serverUtilities.ts +40 -30
- package/server/static.ts +9 -6
- package/server/status/index.ts +2 -2
- package/server/storageReclamation.ts +39 -2
- package/server/threads/itc.js +7 -4
- package/server/threads/manageThreads.js +100 -26
- package/server/threads/socketRouter.ts +12 -275
- package/server/threads/threadServer.js +345 -105
- package/server/threads/workerProcessGuard.ts +93 -0
- package/server/throttle.ts +18 -0
- package/sqlTranslator/{SelectValidator.js → SelectValidator.ts} +41 -49
- package/sqlTranslator/{alasqlFunctionImporter.js → alasqlFunctionImporter.ts} +5 -5
- package/sqlTranslator/{deleteTranslator.js → deleteTranslator.ts} +13 -18
- package/sqlTranslator/{index.js → index.ts} +30 -33
- package/sqlTranslator/{sql_statement_bucket.js → sql_statement_bucket.ts} +49 -20
- package/static/README.md +10 -9
- package/studio/web/assets/{index-CmtPP0YO.js → index-COfIkCT-.js} +5 -5
- package/studio/web/assets/index-COfIkCT-.js.map +1 -0
- package/studio/web/assets/{index.lazy-C8jvGtlu.js → index.lazy-CIvl7Fj9.js} +2 -2
- package/studio/web/assets/{index.lazy-C8jvGtlu.js.map → index.lazy-CIvl7Fj9.js.map} +1 -1
- package/studio/web/assets/{profile-O0DYlJUv.js → profile-B2ZVB--r.js} +2 -2
- package/studio/web/assets/{profile-O0DYlJUv.js.map → profile-B2ZVB--r.js.map} +1 -1
- package/studio/web/assets/{status-BIlJkJby.js → status-Db6WBmhf.js} +2 -2
- package/studio/web/assets/{status-BIlJkJby.js.map → status-Db6WBmhf.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/upgrade/{UpgradeObjects.js → UpgradeObjects.ts} +3 -6
- package/upgrade/directives/5-2-0.ts +49 -0
- package/upgrade/directives/{directivesController.js → directivesController.ts} +16 -16
- package/upgrade/{directivesManager.js → directivesManager.ts} +7 -11
- package/upgrade/{upgradePrompt.js → upgradePrompt.ts} +8 -14
- package/upgrade/{upgradeUtilities.js → upgradeUtilities.ts} +3 -7
- package/utility/{OperationFunctionCaller.js → OperationFunctionCaller.ts} +7 -7
- package/utility/{assignCmdEnvVariables.js → assignCmdEnvVariables.ts} +6 -8
- package/utility/{common_utils.js → common_utils.ts} +113 -139
- package/utility/environment/{environmentManager.js → environmentManager.ts} +34 -33
- package/utility/environment/systemInformation.ts +18 -4
- package/utility/errors/{commonErrors.js → commonErrors.ts} +9 -9
- package/utility/errors/{hdbError.js → hdbError.ts} +39 -45
- package/utility/expandEnvVar.ts +110 -0
- package/utility/functions/geo.js +2 -2
- package/utility/functions/sql/alaSQLExtension.js +1 -1
- package/utility/globalSchema.ts +30 -0
- package/utility/hdbTerms.ts +56 -0
- package/utility/install/checkJWTTokensExist.js +1 -1
- package/utility/install/{installer.js → installer.ts} +38 -39
- package/utility/installation.ts +2 -2
- package/utility/lmdb/{DBIDefinition.js → DBIDefinition.ts} +4 -1
- package/utility/lmdb/{DeleteRecordsResponseObject.js → DeleteRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/{InsertRecordsResponseObject.js → InsertRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/OpenDBIObject.ts +43 -0
- package/utility/lmdb/{OpenEnvironmentObject.js → OpenEnvironmentObject.ts} +19 -6
- package/utility/lmdb/{UpdateRecordsResponseObject.js → UpdateRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/{UpsertRecordsResponseObject.js → UpsertRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/{cleanLMDBMap.js → cleanLMDBMap.ts} +5 -5
- package/utility/lmdb/{commonUtility.js → commonUtility.ts} +13 -21
- package/utility/lmdb/{deleteUtility.js → deleteUtility.ts} +8 -12
- package/utility/lmdb/{environmentUtility.js → environmentUtility.ts} +43 -52
- package/utility/lmdb/{searchCursorFunctions.js → searchCursorFunctions.ts} +12 -26
- package/utility/lmdb/{searchUtility.js → searchUtility.ts} +75 -64
- package/utility/lmdb/{terms.js → terms.ts} +10 -23
- package/utility/lmdb/{writeUtility.js → writeUtility.ts} +37 -22
- package/utility/logging/{harper_logger.js → harper_logger.ts} +136 -89
- package/utility/logging/{logRotator.js → logRotator.ts} +13 -13
- package/utility/logging/logger.ts +1 -1
- package/utility/logging/{readLog.js → readLog.ts} +19 -19
- package/utility/logging/{transactionLog.js → transactionLog.ts} +10 -14
- package/utility/{mount_hdb.js → mount_hdb.ts} +15 -16
- package/utility/{npmUtilities.js → npmUtilities.ts} +14 -17
- package/utility/{operation_authorization.js → operation_authorization.ts} +173 -124
- package/utility/packageUtils.js +7 -16
- package/utility/password.ts +1 -1
- package/utility/processManagement/processManagement.js +2 -2
- package/utility/processManagement/servicesConfig.js +1 -1
- package/utility/{signalling.js → signalling.ts} +6 -11
- package/utility/watcherFallback.ts +74 -0
- package/validation/analyticsValidator.ts +43 -0
- package/validation/{bulkDeleteValidator.js → bulkDeleteValidator.ts} +5 -5
- package/validation/{check_permissions.js → check_permissions.ts} +3 -3
- package/validation/{common_validators.js → common_validators.ts} +12 -24
- package/validation/{configValidator.js → configValidator.ts} +114 -18
- package/validation/{deleteValidator.js → deleteValidator.ts} +5 -5
- package/validation/{fileLoadValidator.js → fileLoadValidator.ts} +12 -19
- package/validation/{insertValidator.js → insertValidator.ts} +5 -5
- package/validation/{installValidator.js → installValidator.ts} +8 -8
- package/validation/{readLogValidator.js → readLogValidator.ts} +10 -10
- package/validation/{role_validation.js → role_validation.ts} +26 -32
- package/validation/{schemaMetadataValidator.js → schemaMetadataValidator.ts} +5 -11
- package/validation/{searchValidator.js → searchValidator.ts} +12 -11
- package/validation/statusValidator.ts +1 -1
- package/validation/{transactionLogValidator.js → transactionLogValidator.ts} +4 -9
- package/validation/{user_validation.js → user_validation.ts} +4 -10
- package/validation/{validationWrapper.js → validationWrapper.ts} +3 -9
- package/bin/cliOperations.js +0 -159
- package/bin/lite.js +0 -5
- package/dataLayer/harperBridge/BridgeMethods.js +0 -85
- package/studio/web/assets/index-CmtPP0YO.js.map +0 -1
- package/utility/globalSchema.js +0 -35
- package/utility/lmdb/OpenDBIObject.js +0 -31
package/dist/resources/Table.js
CHANGED
|
@@ -45,7 +45,8 @@ exports.EVICTED = exports.INVALIDATED = void 0;
|
|
|
45
45
|
exports.makeTable = makeTable;
|
|
46
46
|
exports.coerceType = coerceType;
|
|
47
47
|
const hdbTerms_ts_1 = require("../utility/hdbTerms.js");
|
|
48
|
-
const
|
|
48
|
+
const node_vm_1 = require("node:vm");
|
|
49
|
+
const commonUtility_ts_1 = require("../utility/lmdb/commonUtility.js");
|
|
49
50
|
const nodeIdMapping_ts_1 = require("./nodeIdMapping.js");
|
|
50
51
|
const lodash_1 = __importDefault(require("lodash"));
|
|
51
52
|
const extended_iterable_1 = require("@harperfast/extended-iterable");
|
|
@@ -55,7 +56,7 @@ const when_ts_1 = require("../utility/when.js");
|
|
|
55
56
|
const DatabaseTransaction_ts_1 = require("./DatabaseTransaction.js");
|
|
56
57
|
const envMngr = __importStar(require("../utility/environment/environmentManager.js"));
|
|
57
58
|
const transactionBroadcast_ts_1 = require("./transactionBroadcast.js");
|
|
58
|
-
const
|
|
59
|
+
const hdbError_ts_1 = require("../utility/errors/hdbError.js");
|
|
59
60
|
const signalling = __importStar(require("../utility/signalling.js"));
|
|
60
61
|
const itc_js_1 = require("../server/threads/itc.js");
|
|
61
62
|
const databases_ts_1 = require("./databases.js");
|
|
@@ -66,7 +67,8 @@ const transaction_ts_1 = require("./transaction.js");
|
|
|
66
67
|
const ordered_binary_1 = require("ordered-binary");
|
|
67
68
|
const manageThreads_js_1 = require("../server/threads/manageThreads.js");
|
|
68
69
|
const auditStore_ts_1 = require("./auditStore.js");
|
|
69
|
-
const
|
|
70
|
+
const embedHook_ts_1 = require("./models/embedHook.js");
|
|
71
|
+
const common_utils_ts_1 = require("../utility/common_utils.js");
|
|
70
72
|
const RecordEncoder_ts_1 = require("./RecordEncoder.js");
|
|
71
73
|
const write_ts_1 = require("./analytics/write.js");
|
|
72
74
|
const crdt_ts_1 = require("./crdt.js");
|
|
@@ -74,7 +76,7 @@ const Headers_ts_1 = require("../server/serverHelpers/Headers.js");
|
|
|
74
76
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
75
77
|
const blob_ts_1 = require("./blob.js");
|
|
76
78
|
const storageReclamation_ts_1 = require("../server/storageReclamation.js");
|
|
77
|
-
const
|
|
79
|
+
const harper_logger_ts_1 = __importDefault(require("../utility/logging/harper_logger.js"));
|
|
78
80
|
const throttle_ts_1 = require("../server/throttle.js");
|
|
79
81
|
const rocksdb_js_1 = require("@harperfast/rocksdb-js");
|
|
80
82
|
const LMDBTransaction_1 = require("./LMDBTransaction");
|
|
@@ -85,6 +87,7 @@ const NULL_WITH_TIMESTAMP = new Uint8Array(9);
|
|
|
85
87
|
NULL_WITH_TIMESTAMP[8] = 0xc0; // null
|
|
86
88
|
const UNCACHEABLE_TIMESTAMP = Infinity; // we use this when dynamic content is accessed that we can't safely cache, and this prevents earlier timestamps from change the "last" modification
|
|
87
89
|
const RECORD_PRUNING_INTERVAL = 60000; // one minute
|
|
90
|
+
const CACHEABLE_STATUS_CODES = new Set([200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, 501]);
|
|
88
91
|
envMngr.initSync();
|
|
89
92
|
const LMDB_PREFETCH_WRITES = envMngr.get(hdbTerms_ts_1.CONFIG_PARAMS.STORAGE_PREFETCHWRITES);
|
|
90
93
|
const LOCK_TIMEOUT = 10000;
|
|
@@ -106,6 +109,7 @@ const FULL_PERMISSIONS = {
|
|
|
106
109
|
* Instances of the returned class are Resource instances, intended to provide a consistent view or transaction of the table
|
|
107
110
|
* @param options
|
|
108
111
|
*/
|
|
112
|
+
// #section: setup-and-factory
|
|
109
113
|
function makeTable(options) {
|
|
110
114
|
const { primaryKey, indices, tableId, tableName, primaryStore, databasePath, databaseName, auditStore, schemaDefined, dbisDB: dbisDb, sealed, splitSegments, replicate, } = options;
|
|
111
115
|
let { expirationMS: expirationMs, evictionMS: evictionMs, audit, trackDeletes } = options;
|
|
@@ -116,7 +120,7 @@ function makeTable(options) {
|
|
|
116
120
|
const updateRecord = (0, RecordEncoder_ts_1.recordUpdater)(primaryStore, tableId, auditStore);
|
|
117
121
|
let sourceLoad; // if a source has a load function (replicator), record it here
|
|
118
122
|
let hasSourceGet;
|
|
119
|
-
let primaryKeyAttribute
|
|
123
|
+
let primaryKeyAttribute;
|
|
120
124
|
let lastEvictionCompletion = Promise.resolve();
|
|
121
125
|
let createdTimeProperty, updatedTimeProperty, expiresAtProperty;
|
|
122
126
|
for (const attribute of attributes) {
|
|
@@ -186,6 +190,7 @@ function makeTable(options) {
|
|
|
186
190
|
#version; // version of the record
|
|
187
191
|
#entry; // the entry from the database
|
|
188
192
|
#savingOperation; // operation for the record is currently being saved
|
|
193
|
+
// #section: static-config
|
|
189
194
|
static name = tableName; // for display/debugging purposes
|
|
190
195
|
static primaryStore = primaryStore;
|
|
191
196
|
static auditStore = auditStore;
|
|
@@ -204,6 +209,11 @@ function makeTable(options) {
|
|
|
204
209
|
static updatedTimeProperty = updatedTimeProperty;
|
|
205
210
|
static propertyResolvers;
|
|
206
211
|
static userResolvers = {};
|
|
212
|
+
// `@embed` hook registry. `userSetEmbedders` records names set explicitly via
|
|
213
|
+
// `setEmbedAttribute` so a schema reload refreshes defaults without clobbering them.
|
|
214
|
+
static userEmbedders = {};
|
|
215
|
+
static userSetEmbedders = new Set();
|
|
216
|
+
static embedAttributes = attributes.filter((a) => a?.embed);
|
|
207
217
|
static source;
|
|
208
218
|
static getResidencyById;
|
|
209
219
|
static get expirationMS() {
|
|
@@ -219,6 +229,7 @@ function makeTable(options) {
|
|
|
219
229
|
* @param options
|
|
220
230
|
* @returns
|
|
221
231
|
*/
|
|
232
|
+
// #section: resource-registry
|
|
222
233
|
static sourcedFrom(source, options) {
|
|
223
234
|
// define a source for retrieving invalidated entries for caching purposes
|
|
224
235
|
if (options) {
|
|
@@ -463,7 +474,7 @@ function makeTable(options) {
|
|
|
463
474
|
});
|
|
464
475
|
if (txnInProgress)
|
|
465
476
|
txnInProgress.committed = commitResolution;
|
|
466
|
-
if (userRoleUpdate && commitResolution && !commitResolution
|
|
477
|
+
if (userRoleUpdate && commitResolution && !commitResolution.waitingForUserChange) {
|
|
467
478
|
// if the user role changed, asynchronously signal the user change (but don't block this function)
|
|
468
479
|
commitResolution.then(() => signalling.signalUserChange(new itc_js_1.UserEventMsg(process.pid)));
|
|
469
480
|
commitResolution.waitingForUserChange = true; // only need to send one signal per transaction
|
|
@@ -539,7 +550,9 @@ function makeTable(options) {
|
|
|
539
550
|
// return 504 (rather than 404) if there is no content and the cache-control header
|
|
540
551
|
// dictates not to go to source
|
|
541
552
|
if (!this.doesExist())
|
|
542
|
-
throw new
|
|
553
|
+
throw new hdbError_ts_1.ServerError('Entry is not cached', 504);
|
|
554
|
+
if (hasSourceGet && target)
|
|
555
|
+
target.loadedFromSource = false; // mark it as cached
|
|
543
556
|
}
|
|
544
557
|
else if (resourceOptions?.ensureLoaded) {
|
|
545
558
|
const loadingFromSource = ensureLoadedFromSource(this.constructor.source, id, entry, request, this, target);
|
|
@@ -582,6 +595,7 @@ function makeTable(options) {
|
|
|
582
595
|
});
|
|
583
596
|
}
|
|
584
597
|
}
|
|
598
|
+
// #section: lifecycle-admin
|
|
585
599
|
static getNewId() {
|
|
586
600
|
const type = primaryKeyAttribute?.type;
|
|
587
601
|
// the default Resource behavior is to return a GUID, but for a table we can return incrementing numeric keys if the type is (or can be) numeric
|
|
@@ -867,6 +881,11 @@ function makeTable(options) {
|
|
|
867
881
|
}
|
|
868
882
|
signalling.signalSchemaChange(new itc_js_1.SchemaEventMsg(process.pid, hdbTerms_ts_1.OPERATIONS_ENUM.DROP_TABLE, databaseName, tableName));
|
|
869
883
|
}
|
|
884
|
+
// #section: read-path
|
|
885
|
+
/**
|
|
886
|
+
* This retrieves the data of this resource.
|
|
887
|
+
* @param target - If included, is an identifier/query that specifies the requested target to retrieve and query
|
|
888
|
+
*/
|
|
870
889
|
get(target) {
|
|
871
890
|
const constructor = this.constructor;
|
|
872
891
|
if (typeof target === 'string' && constructor.loadAsInstance !== false)
|
|
@@ -905,13 +924,13 @@ function makeTable(options) {
|
|
|
905
924
|
const id = requestTargetToId(target);
|
|
906
925
|
checkValidId(id);
|
|
907
926
|
let allowed = true;
|
|
908
|
-
if (target
|
|
927
|
+
if (target?.checkPermission) {
|
|
909
928
|
// requesting authorization verification
|
|
910
929
|
allowed = this.allowRead(context.user, target, context);
|
|
911
930
|
}
|
|
912
931
|
return (0, when_ts_1.promiseNormalize)((0, when_ts_1.when)((0, when_ts_1.when)(allowed, (allowed) => {
|
|
913
932
|
if (!allowed) {
|
|
914
|
-
throw new
|
|
933
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
915
934
|
}
|
|
916
935
|
const ensureLoaded = true;
|
|
917
936
|
return loadLocalRecord(id, context, { transaction: readTxn, ensureLoaded }, false, (entry) => {
|
|
@@ -920,7 +939,7 @@ function makeTable(options) {
|
|
|
920
939
|
// return 504 (rather than 404) if there is no content and the cache-control header
|
|
921
940
|
// dictates not to go to source
|
|
922
941
|
if (!entry?.value)
|
|
923
|
-
throw new
|
|
942
|
+
throw new hdbError_ts_1.ServerError('Entry is not cached', 504);
|
|
924
943
|
}
|
|
925
944
|
else if (ensureLoaded) {
|
|
926
945
|
const loadingFromSource = ensureLoadedFromSource(constructor.source, id, entry, context, this, target);
|
|
@@ -960,6 +979,7 @@ function makeTable(options) {
|
|
|
960
979
|
}
|
|
961
980
|
return undefined;
|
|
962
981
|
}
|
|
982
|
+
// #section: authz-hooks
|
|
963
983
|
/**
|
|
964
984
|
* Determine if the user is allowed to get/read data from the current resource
|
|
965
985
|
*/
|
|
@@ -1124,13 +1144,13 @@ function makeTable(options) {
|
|
|
1124
1144
|
let allowed = true;
|
|
1125
1145
|
if (target == undefined)
|
|
1126
1146
|
throw new TypeError('Can not put a record without a target');
|
|
1127
|
-
if (target
|
|
1147
|
+
if (target?.checkPermission) {
|
|
1128
1148
|
// requesting authorization verification
|
|
1129
1149
|
allowed = this.allowUpdate(context.user, updates, context);
|
|
1130
1150
|
}
|
|
1131
1151
|
return (0, when_ts_1.when)(allowed, (allowed) => {
|
|
1132
1152
|
if (!allowed) {
|
|
1133
|
-
throw new
|
|
1153
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
1134
1154
|
}
|
|
1135
1155
|
let loading;
|
|
1136
1156
|
if (!this.#entry && this.constructor.loadAsInstance === false) {
|
|
@@ -1139,31 +1159,33 @@ function makeTable(options) {
|
|
|
1139
1159
|
}
|
|
1140
1160
|
return (0, when_ts_1.when)(loading, () => {
|
|
1141
1161
|
this.#changes = updates;
|
|
1142
|
-
|
|
1143
|
-
|
|
1162
|
+
// `when` awaits the embed hook (when `@embed` is active) before resolving,
|
|
1163
|
+
// so the caller's `save()` doesn't run before the write is staged.
|
|
1164
|
+
return (0, when_ts_1.when)(this._writeUpdate(id, this.#changes, false), () => this);
|
|
1144
1165
|
});
|
|
1145
1166
|
});
|
|
1146
1167
|
}
|
|
1147
1168
|
}
|
|
1148
|
-
this._writeUpdate(id, this.#changes, fullUpdate);
|
|
1149
|
-
return this;
|
|
1169
|
+
return (0, when_ts_1.when)(this._writeUpdate(id, this.#changes, fullUpdate), () => this);
|
|
1150
1170
|
}
|
|
1151
1171
|
/**
|
|
1152
1172
|
* Save any changes into this instance to the current transaction
|
|
1153
1173
|
*/
|
|
1154
1174
|
save() {
|
|
1155
1175
|
if (this.#savingOperation) {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
finally {
|
|
1162
|
-
this.#savingOperation = null;
|
|
1163
|
-
}
|
|
1176
|
+
try {
|
|
1177
|
+
return this.#saveOperation(this.#savingOperation);
|
|
1178
|
+
}
|
|
1179
|
+
finally {
|
|
1180
|
+
this.#savingOperation = null;
|
|
1164
1181
|
}
|
|
1165
1182
|
}
|
|
1166
1183
|
}
|
|
1184
|
+
#saveOperation(operation) {
|
|
1185
|
+
const transaction = txnForContext(this.getContext());
|
|
1186
|
+
if (transaction.save)
|
|
1187
|
+
return transaction.save(operation) || operation.promise || operation.result;
|
|
1188
|
+
}
|
|
1167
1189
|
addTo(property, value) {
|
|
1168
1190
|
if (typeof value === 'number' || typeof value === 'bigint') {
|
|
1169
1191
|
if (this.#savingOperation?.fullUpdate)
|
|
@@ -1210,7 +1232,7 @@ function makeTable(options) {
|
|
|
1210
1232
|
}
|
|
1211
1233
|
return (0, when_ts_1.when)(allowed, (allowed) => {
|
|
1212
1234
|
if (!allowed) {
|
|
1213
|
-
throw new
|
|
1235
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
1214
1236
|
}
|
|
1215
1237
|
this._writeInvalidate(target ? requestTargetToId(target) : this.getId());
|
|
1216
1238
|
});
|
|
@@ -1287,7 +1309,7 @@ function makeTable(options) {
|
|
|
1287
1309
|
}
|
|
1288
1310
|
logger_ts_1.logger.trace?.(`Relocating entry id: ${id}, timestamp: ${new Date(txnTime).toISOString()}`);
|
|
1289
1311
|
updateRecord(id, newRecord, existingEntry, txnTime, metadata, audit, {
|
|
1290
|
-
user: context
|
|
1312
|
+
user: context?.user,
|
|
1291
1313
|
residencyId: options.residencyId,
|
|
1292
1314
|
nodeId: options.nodeId,
|
|
1293
1315
|
viaNodeId: options?.viaNodeId,
|
|
@@ -1370,7 +1392,7 @@ function makeTable(options) {
|
|
|
1370
1392
|
// RocksDB: eviction writes went directly into the raw transaction via options;
|
|
1371
1393
|
// commit it directly, as DatabaseTransaction.commit() would abort it (no tracked writes).
|
|
1372
1394
|
// Wrap in Promise.resolve so callers can rely on a thenable return regardless of engine.
|
|
1373
|
-
return
|
|
1395
|
+
return transaction.commit();
|
|
1374
1396
|
}
|
|
1375
1397
|
finally {
|
|
1376
1398
|
if (!committed) {
|
|
@@ -1400,11 +1422,12 @@ function makeTable(options) {
|
|
|
1400
1422
|
* Store the provided record data into the current resource. This is not written
|
|
1401
1423
|
* until the corresponding transaction is committed.
|
|
1402
1424
|
*/
|
|
1425
|
+
// @ts-expect-error The implementation intentionally uses a different argument order for back-compat
|
|
1403
1426
|
put(target, record) {
|
|
1404
1427
|
if (record === undefined || record instanceof URLSearchParams) {
|
|
1405
|
-
// legacy argument position, shift the arguments and go through the update method for back-compat
|
|
1406
|
-
|
|
1407
|
-
return this.save();
|
|
1428
|
+
// legacy argument position, shift the arguments and go through the update method for back-compat.
|
|
1429
|
+
// `when` settles the embed hook before `save()` so the write is staged first.
|
|
1430
|
+
return (0, when_ts_1.when)(this.update(target, true), () => this.save());
|
|
1408
1431
|
}
|
|
1409
1432
|
else {
|
|
1410
1433
|
let allowed = true;
|
|
@@ -1417,20 +1440,26 @@ function makeTable(options) {
|
|
|
1417
1440
|
}
|
|
1418
1441
|
return (0, when_ts_1.when)(allowed, (allowed) => {
|
|
1419
1442
|
if (!allowed) {
|
|
1420
|
-
throw new
|
|
1443
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
1421
1444
|
}
|
|
1422
1445
|
// standard path, handle arrays as multiple updates, and otherwise do a direct update
|
|
1423
1446
|
if (Array.isArray(record)) {
|
|
1424
|
-
|
|
1447
|
+
// Capture each element's operation synchronously (before any async `@embed`
|
|
1448
|
+
// hook resolves): `#savingOperation` is a single field that parallel writes
|
|
1449
|
+
// would otherwise clobber, so a deferred `save()` would commit the wrong op
|
|
1450
|
+
// — e.g. one element's save running before a later element's vector is written.
|
|
1451
|
+
const writes = record.map((element) => {
|
|
1425
1452
|
const id = element[primaryKey];
|
|
1426
|
-
this._writeUpdate(id, element, true);
|
|
1427
|
-
|
|
1428
|
-
|
|
1453
|
+
const writePromise = this._writeUpdate(id, element, true);
|
|
1454
|
+
const operation = this.#savingOperation;
|
|
1455
|
+
return (0, when_ts_1.when)(writePromise, () => this.#saveOperation(operation));
|
|
1456
|
+
});
|
|
1457
|
+
this.#savingOperation = null;
|
|
1458
|
+
return Promise.all(writes);
|
|
1429
1459
|
}
|
|
1430
1460
|
else {
|
|
1431
1461
|
const id = requestTargetToId(target);
|
|
1432
|
-
this._writeUpdate(id, record, true);
|
|
1433
|
-
return this.save();
|
|
1462
|
+
return (0, when_ts_1.when)(this._writeUpdate(id, record, true), () => this.save());
|
|
1434
1463
|
}
|
|
1435
1464
|
});
|
|
1436
1465
|
}
|
|
@@ -1453,7 +1482,7 @@ function makeTable(options) {
|
|
|
1453
1482
|
}
|
|
1454
1483
|
return (0, when_ts_1.when)(allowed, (allowed) => {
|
|
1455
1484
|
if (!allowed) {
|
|
1456
|
-
throw new
|
|
1485
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
1457
1486
|
}
|
|
1458
1487
|
let id = requestTargetToId(target) ?? record[primaryKey];
|
|
1459
1488
|
if (id === undefined) {
|
|
@@ -1463,19 +1492,21 @@ function makeTable(options) {
|
|
|
1463
1492
|
else {
|
|
1464
1493
|
const existing = primaryStore.getSync(id);
|
|
1465
1494
|
if (existing) {
|
|
1466
|
-
throw new
|
|
1495
|
+
throw new hdbError_ts_1.ClientError('Record already exists', 409);
|
|
1467
1496
|
}
|
|
1468
1497
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1498
|
+
// `_writeUpdate` may return a promise when an `@embed` directive
|
|
1499
|
+
// requires running an embedder before the per-write `commit(...)`
|
|
1500
|
+
// closure. `when()` passes through synchronous returns.
|
|
1501
|
+
return (0, when_ts_1.when)(this._writeUpdate(id, record, true), () => record);
|
|
1471
1502
|
});
|
|
1472
1503
|
}
|
|
1473
1504
|
// @ts-expect-error The implementation handles the possibility of target and recordUpdate being swapped
|
|
1474
1505
|
patch(target, recordUpdate) {
|
|
1475
1506
|
if (recordUpdate === undefined || recordUpdate instanceof URLSearchParams) {
|
|
1476
|
-
// legacy argument position, shift the arguments and go through the update method for back-compat
|
|
1477
|
-
|
|
1478
|
-
return this.save();
|
|
1507
|
+
// legacy argument position, shift the arguments and go through the update method for back-compat.
|
|
1508
|
+
// `when` settles the embed hook before `save()` so the write is staged first.
|
|
1509
|
+
return (0, when_ts_1.when)(this.update(target, false), () => this.save());
|
|
1479
1510
|
}
|
|
1480
1511
|
else {
|
|
1481
1512
|
// standard path, ensure there is no return object
|
|
@@ -1484,6 +1515,7 @@ function makeTable(options) {
|
|
|
1484
1515
|
});
|
|
1485
1516
|
}
|
|
1486
1517
|
}
|
|
1518
|
+
// #section: write-path-internals
|
|
1487
1519
|
// perform the actual write operation; this may come from a user request to write (put, post, etc.), or
|
|
1488
1520
|
// a notification that a write has already occurred in the canonical data source, we need to update our
|
|
1489
1521
|
// local copy
|
|
@@ -1796,8 +1828,21 @@ function makeTable(options) {
|
|
|
1796
1828
|
},
|
|
1797
1829
|
};
|
|
1798
1830
|
this.#savingOperation = write;
|
|
1799
|
-
|
|
1800
|
-
|
|
1831
|
+
// `@embed` hook must run before `addWrite` so the embedder's vector is on the
|
|
1832
|
+
// record when `commit` runs. (The txn `before` slot runs after commit, which
|
|
1833
|
+
// suits blob writes but not embedding, where the vector must be present at commit.)
|
|
1834
|
+
// Known limitation of this write-time placement (a validate-time alternative was
|
|
1835
|
+
// tried and reverted as a Harper-foreign pattern): the embedder sees this write's
|
|
1836
|
+
// payload, before table validation — so a write that later fails validation still
|
|
1837
|
+
// calls the backend, and a tracked-instance mutation (update(id,{}); row.source=…;
|
|
1838
|
+
// save()) that sets the source via accessors after update() won't re-embed. A
|
|
1839
|
+
// resource-layer re-embed is the proper fix; tracked as a follow-up.
|
|
1840
|
+
const embedBefore = (0, embedHook_ts_1.buildEmbedBefore)(recordUpdate, context, options, TableResource.embedAttributes, TableResource.userEmbedders);
|
|
1841
|
+
const proceed = () => {
|
|
1842
|
+
write.beforeIntermediate = preCommitBlobsForRecordBefore(write, recordUpdate);
|
|
1843
|
+
return transaction.addWrite(write);
|
|
1844
|
+
};
|
|
1845
|
+
return embedBefore ? embedBefore().then(proceed) : proceed();
|
|
1801
1846
|
}
|
|
1802
1847
|
async delete(target) {
|
|
1803
1848
|
if (isSearchTarget(target)) {
|
|
@@ -1810,13 +1855,13 @@ function makeTable(options) {
|
|
|
1810
1855
|
if (target) {
|
|
1811
1856
|
let allowed = true;
|
|
1812
1857
|
const context = this.getContext();
|
|
1813
|
-
if (target
|
|
1858
|
+
if (target?.checkPermission) {
|
|
1814
1859
|
// requesting authorization verification
|
|
1815
1860
|
allowed = this.allowDelete(context.user, target, context);
|
|
1816
1861
|
}
|
|
1817
1862
|
return (0, when_ts_1.when)(allowed, (allowed) => {
|
|
1818
1863
|
if (!allowed) {
|
|
1819
|
-
throw new
|
|
1864
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
1820
1865
|
}
|
|
1821
1866
|
const id = requestTargetToId(target);
|
|
1822
1867
|
this._writeDelete(id);
|
|
@@ -1868,6 +1913,7 @@ function makeTable(options) {
|
|
|
1868
1913
|
});
|
|
1869
1914
|
return true;
|
|
1870
1915
|
}
|
|
1916
|
+
// #section: search-query
|
|
1871
1917
|
search(target) {
|
|
1872
1918
|
const context = this.getContext();
|
|
1873
1919
|
const txn = txnForContext(context);
|
|
@@ -1879,7 +1925,7 @@ function makeTable(options) {
|
|
|
1879
1925
|
// requesting authorization verification
|
|
1880
1926
|
const allowed = this.allowRead(context.user, target, context);
|
|
1881
1927
|
if (!allowed) {
|
|
1882
|
-
throw new
|
|
1928
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
1883
1929
|
}
|
|
1884
1930
|
}
|
|
1885
1931
|
if (context)
|
|
@@ -1922,18 +1968,39 @@ function makeTable(options) {
|
|
|
1922
1968
|
condition.conditions = prepareConditions(condition.conditions, condition.operator);
|
|
1923
1969
|
continue;
|
|
1924
1970
|
}
|
|
1971
|
+
// Normalize `not_X` comparator forms passed in via structured queries.
|
|
1972
|
+
// The REST parser already does this, but programmatic callers may
|
|
1973
|
+
// pass `not_in`, `not_starts_with`, etc. directly.
|
|
1974
|
+
if (condition.comparator) {
|
|
1975
|
+
const resolved = (0, search_ts_1.resolveComparator)(condition.comparator);
|
|
1976
|
+
if (resolved.negated) {
|
|
1977
|
+
condition.comparator = resolved.comparator;
|
|
1978
|
+
condition.negated = true;
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1925
1981
|
const attribute_name = condition[0] ?? condition.attribute;
|
|
1926
|
-
|
|
1982
|
+
let attribute = attribute_name == null ? primaryKeyAttribute : (0, search_ts_1.findAttribute)(attributes, attribute_name);
|
|
1983
|
+
if (!attribute && Array.isArray(attribute_name) && attribute_name.length > 1) {
|
|
1984
|
+
// Plain JSON nested path: the leaf may not be declared in the
|
|
1985
|
+
// schema. Fall back to the root attribute so we can validate
|
|
1986
|
+
// existence without requiring the inner structure to be typed.
|
|
1987
|
+
attribute = (0, search_ts_1.findAttribute)(attributes, attribute_name[0]);
|
|
1988
|
+
}
|
|
1927
1989
|
if (!attribute) {
|
|
1928
1990
|
if (attribute_name != null && !target.allowConditionsOnDynamicAttributes)
|
|
1929
|
-
throw (0,
|
|
1991
|
+
throw (0, hdbError_ts_1.handleHDBError)(new Error(), `${attribute_name} is not a defined attribute`, 404);
|
|
1930
1992
|
}
|
|
1931
1993
|
else if (attribute.type || search_ts_1.COERCIBLE_OPERATORS[condition.comparator]) {
|
|
1932
|
-
// Do auto-coercion or coercion as required by the attribute type
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1994
|
+
// Do auto-coercion or coercion as required by the attribute type.
|
|
1995
|
+
// Skipped for nested paths into plain JSON — the root attribute's
|
|
1996
|
+
// type is not the leaf type, so coercion would be wrong.
|
|
1997
|
+
const isNestedPathRoot = Array.isArray(attribute_name) && attribute_name.length > 1 && !attribute.relationship;
|
|
1998
|
+
if (!isNestedPathRoot) {
|
|
1999
|
+
if (condition[1] === undefined)
|
|
2000
|
+
condition.value = coerceTypedValues(condition.value, attribute);
|
|
2001
|
+
else
|
|
2002
|
+
condition[1] = coerceTypedValues(condition[1], attribute);
|
|
2003
|
+
}
|
|
1937
2004
|
}
|
|
1938
2005
|
if (condition.chainedConditions) {
|
|
1939
2006
|
if (condition.chainedConditions.length === 1 && (!condition.operator || condition.operator == 'and')) {
|
|
@@ -1958,7 +2025,7 @@ function makeTable(options) {
|
|
|
1958
2025
|
}
|
|
1959
2026
|
const isGe = lower.comparator === 'ge' || lower.comparator === 'greater_than_equal';
|
|
1960
2027
|
const isLe = upper.comparator === 'le' || upper.comparator === 'less_than_equal';
|
|
1961
|
-
condition.comparator = (isGe ? 'ge' : 'gt') + (isLe ? 'le' : 'lt');
|
|
2028
|
+
condition.comparator = ((isGe ? 'ge' : 'gt') + (isLe ? 'le' : 'lt'));
|
|
1962
2029
|
condition.value = [lower.value, upper.value];
|
|
1963
2030
|
}
|
|
1964
2031
|
else
|
|
@@ -1998,7 +2065,7 @@ function makeTable(options) {
|
|
|
1998
2065
|
if (operator !== 'or') {
|
|
1999
2066
|
const attribute_name = sort.attribute;
|
|
2000
2067
|
if (attribute_name == undefined)
|
|
2001
|
-
throw new
|
|
2068
|
+
throw new hdbError_ts_1.ClientError('Sort requires an attribute');
|
|
2002
2069
|
orderAlignedCondition = conditions.find((condition) => (0, search_ts_1.flattenKey)(condition.attribute) === (0, search_ts_1.flattenKey)(attribute_name));
|
|
2003
2070
|
if (orderAlignedCondition) {
|
|
2004
2071
|
// if there is a condition on the same attribute as the first sort, we can use it to align the sort
|
|
@@ -2007,14 +2074,14 @@ function makeTable(options) {
|
|
|
2007
2074
|
else {
|
|
2008
2075
|
const attribute = (0, search_ts_1.findAttribute)(attributes, attribute_name);
|
|
2009
2076
|
if (!attribute)
|
|
2010
|
-
throw (0,
|
|
2077
|
+
throw (0, hdbError_ts_1.handleHDBError)(new Error(), `${Array.isArray(attribute_name) ? attribute_name.join('.') : attribute_name} is not a defined attribute`, 404);
|
|
2011
2078
|
if (attribute.indexed) {
|
|
2012
2079
|
// if it is indexed, we add a pseudo-condition to align with the natural sort order of the index
|
|
2013
2080
|
orderAlignedCondition = { ...sort, comparator: 'sort' };
|
|
2014
2081
|
conditions.push(orderAlignedCondition);
|
|
2015
2082
|
}
|
|
2016
2083
|
else if (conditions.length === 0 && !target.allowFullScan)
|
|
2017
|
-
throw (0,
|
|
2084
|
+
throw (0, hdbError_ts_1.handleHDBError)(new Error(), `${Array.isArray(attribute_name) ? attribute_name.join('.') : attribute_name} is not indexed and not combined with any other conditions`, 404);
|
|
2018
2085
|
}
|
|
2019
2086
|
if (orderAlignedCondition)
|
|
2020
2087
|
orderAlignedCondition.descending = Boolean(sort.descending);
|
|
@@ -2422,7 +2489,16 @@ function makeTable(options) {
|
|
|
2422
2489
|
else {
|
|
2423
2490
|
value = record[attribute_name];
|
|
2424
2491
|
if (value && typeof value === 'object' && attribute_name !== attribute) {
|
|
2425
|
-
|
|
2492
|
+
const subTransform = TableResource.transformEntryForSelect(attribute.select || attribute, context, readTxn, null);
|
|
2493
|
+
// Plain JSON nested values: arrays project per-element so that
|
|
2494
|
+
// `select: [{ name: 'addresses', select: ['city'] }]` returns
|
|
2495
|
+
// `addresses: [{ city }, { city }]` rather than a single object.
|
|
2496
|
+
if (Array.isArray(value)) {
|
|
2497
|
+
value = value.map((item) => item && typeof item === 'object' ? subTransform({ value: item }) : item);
|
|
2498
|
+
}
|
|
2499
|
+
else if (!(value instanceof Date)) {
|
|
2500
|
+
value = subTransform({ value });
|
|
2501
|
+
}
|
|
2426
2502
|
}
|
|
2427
2503
|
}
|
|
2428
2504
|
callback(value, attribute_name);
|
|
@@ -2461,7 +2537,7 @@ function makeTable(options) {
|
|
|
2461
2537
|
}
|
|
2462
2538
|
}
|
|
2463
2539
|
else
|
|
2464
|
-
throw new
|
|
2540
|
+
throw new hdbError_ts_1.ClientError('Invalid select' + select);
|
|
2465
2541
|
if (promises) {
|
|
2466
2542
|
return Promise.all(promises).then(() => selected);
|
|
2467
2543
|
}
|
|
@@ -2471,6 +2547,7 @@ function makeTable(options) {
|
|
|
2471
2547
|
};
|
|
2472
2548
|
return transform;
|
|
2473
2549
|
}
|
|
2550
|
+
// #section: pub-sub
|
|
2474
2551
|
async subscribe(request) {
|
|
2475
2552
|
if (!auditStore)
|
|
2476
2553
|
throw new Error('Can not subscribe to a table without an audit log');
|
|
@@ -2561,7 +2638,7 @@ function makeTable(options) {
|
|
|
2561
2638
|
// a collection should retrieve all descendant ids
|
|
2562
2639
|
if (startTime) {
|
|
2563
2640
|
if (count)
|
|
2564
|
-
throw new
|
|
2641
|
+
throw new hdbError_ts_1.ClientError('startTime and previousCount can not be combined for a table level subscription');
|
|
2565
2642
|
// start time specified, get the audit history for this time range. We drop real-time
|
|
2566
2643
|
// messages during this loop because the snapshot:false cursor will pick them up itself.
|
|
2567
2644
|
pendingRealTimeQueue = null;
|
|
@@ -2772,7 +2849,7 @@ function makeTable(options) {
|
|
|
2772
2849
|
}
|
|
2773
2850
|
})();
|
|
2774
2851
|
result.catch((error) => {
|
|
2775
|
-
|
|
2852
|
+
harper_logger_ts_1.default.error?.('Error in real-time subscription:', error);
|
|
2776
2853
|
subscription.send(error);
|
|
2777
2854
|
});
|
|
2778
2855
|
function send(event) {
|
|
@@ -2809,13 +2886,13 @@ function makeTable(options) {
|
|
|
2809
2886
|
else {
|
|
2810
2887
|
let allowed = true;
|
|
2811
2888
|
const context = this.getContext();
|
|
2812
|
-
if (target
|
|
2889
|
+
if (target?.checkPermission) {
|
|
2813
2890
|
// requesting authorization verification
|
|
2814
|
-
allowed = this.
|
|
2891
|
+
allowed = this.allowDelete(context.user, target, context);
|
|
2815
2892
|
}
|
|
2816
2893
|
return (0, when_ts_1.when)(allowed, (allowed) => {
|
|
2817
2894
|
if (!allowed) {
|
|
2818
|
-
throw new
|
|
2895
|
+
throw new hdbError_ts_1.AccessViolation(context.user);
|
|
2819
2896
|
}
|
|
2820
2897
|
const id = requestTargetToId(target);
|
|
2821
2898
|
this._writePublish(id, message, options);
|
|
@@ -2867,6 +2944,7 @@ function makeTable(options) {
|
|
|
2867
2944
|
write.beforeIntermediate = preCommitBlobsForRecordBefore(write, message, undefined, true);
|
|
2868
2945
|
transaction.addWrite(write);
|
|
2869
2946
|
}
|
|
2947
|
+
// #section: validation
|
|
2870
2948
|
validate(record, patch) {
|
|
2871
2949
|
let validationErrors;
|
|
2872
2950
|
const validateValue = (value, attribute, name) => {
|
|
@@ -3001,9 +3079,10 @@ function makeTable(options) {
|
|
|
3001
3079
|
}
|
|
3002
3080
|
}
|
|
3003
3081
|
if (validationErrors) {
|
|
3004
|
-
throw new
|
|
3082
|
+
throw new hdbError_ts_1.ClientError(validationErrors.join('. '));
|
|
3005
3083
|
}
|
|
3006
3084
|
}
|
|
3085
|
+
// #section: stats-admin
|
|
3007
3086
|
getUpdatedTime() {
|
|
3008
3087
|
return this.#version;
|
|
3009
3088
|
}
|
|
@@ -3011,9 +3090,9 @@ function makeTable(options) {
|
|
|
3011
3090
|
const new_attributes = attributes.slice(0);
|
|
3012
3091
|
for (const attribute of attributesToAdd) {
|
|
3013
3092
|
if (!attribute.name)
|
|
3014
|
-
throw new
|
|
3093
|
+
throw new hdbError_ts_1.ClientError('Attribute name is required');
|
|
3015
3094
|
if (attribute.name.match(/[`/]/))
|
|
3016
|
-
throw new
|
|
3095
|
+
throw new hdbError_ts_1.ClientError('Attribute names cannot include backticks or forward slashes');
|
|
3017
3096
|
validateAttribute(attribute.name);
|
|
3018
3097
|
new_attributes.push(attribute);
|
|
3019
3098
|
}
|
|
@@ -3126,6 +3205,18 @@ function makeTable(options) {
|
|
|
3126
3205
|
* When attributes have been changed, we update the accessors that are assigned to this table
|
|
3127
3206
|
*/
|
|
3128
3207
|
static updatedAttributes() {
|
|
3208
|
+
// Refresh on every call: schema reload mutates `attributes` in place, so the
|
|
3209
|
+
// class-construction snapshot would otherwise go stale.
|
|
3210
|
+
this.embedAttributes = this.attributes.filter((a) => a?.embed);
|
|
3211
|
+
// Drop registry entries for attributes that are no longer `@embed`, so a dropped
|
|
3212
|
+
// directive doesn't leave a stale embedder or block a default refresh on re-add.
|
|
3213
|
+
const embedNames = new Set(this.embedAttributes.map((a) => a.name));
|
|
3214
|
+
for (const name of Object.keys(this.userEmbedders))
|
|
3215
|
+
if (!embedNames.has(name))
|
|
3216
|
+
delete this.userEmbedders[name];
|
|
3217
|
+
for (const name of this.userSetEmbedders)
|
|
3218
|
+
if (!embedNames.has(name))
|
|
3219
|
+
this.userSetEmbedders.delete(name);
|
|
3129
3220
|
propertyResolvers = this.propertyResolvers = {
|
|
3130
3221
|
$id: (object, context, entry) => ({ value: entry.key }),
|
|
3131
3222
|
$updatedtime: (object, context, entry) => entry.version,
|
|
@@ -3142,6 +3233,11 @@ function makeTable(options) {
|
|
|
3142
3233
|
attribute.resolve = null; // reset this
|
|
3143
3234
|
const relationship = attribute.relationship;
|
|
3144
3235
|
const computed = attribute.computed;
|
|
3236
|
+
// Register the default embedder unless an author override is set. Sits outside
|
|
3237
|
+
// the resolver chain below so `@embed` fields still flow through auto-HNSW indexing.
|
|
3238
|
+
if (attribute.embed && !TableResource.userSetEmbedders.has(attribute.name)) {
|
|
3239
|
+
this.userEmbedders[attribute.name] = (0, embedHook_ts_1.createDefaultEmbedder)(attribute.embed);
|
|
3240
|
+
}
|
|
3145
3241
|
if (relationship) {
|
|
3146
3242
|
if (attribute.indexed) {
|
|
3147
3243
|
console.error(`A relationship property can not be directly indexed, (but you may want to index the foreign key attribute)`);
|
|
@@ -3242,6 +3338,14 @@ function makeTable(options) {
|
|
|
3242
3338
|
if (typeof computed.from === 'function') {
|
|
3243
3339
|
this.setComputedAttribute(attribute.name, computed.from);
|
|
3244
3340
|
}
|
|
3341
|
+
else if (attribute.computedFromExpression) {
|
|
3342
|
+
// build a fallback scope object with all attribute names set to undefined,
|
|
3343
|
+
// matching the behavior in graphql.ts to prevent ReferenceErrors
|
|
3344
|
+
const attributesFallback = {};
|
|
3345
|
+
for (const attr of this.attributes)
|
|
3346
|
+
attributesFallback[attr.name] = undefined;
|
|
3347
|
+
this.setComputedAttribute(attribute.name, createComputedFrom(attribute.computedFromExpression, attributesFallback));
|
|
3348
|
+
}
|
|
3245
3349
|
propertyResolvers[attribute.name] = attribute.resolve = (object, context, entry) => {
|
|
3246
3350
|
const value = typeof computed.from === 'string' ? object[computed.from] : object;
|
|
3247
3351
|
const userResolver = this.userResolvers[attribute.name];
|
|
@@ -3295,6 +3399,7 @@ function makeTable(options) {
|
|
|
3295
3399
|
}
|
|
3296
3400
|
}
|
|
3297
3401
|
}
|
|
3402
|
+
// #section: computed-history
|
|
3298
3403
|
static setComputedAttribute(attribute_name, resolver) {
|
|
3299
3404
|
const attribute = (0, search_ts_1.findAttribute)(attributes, attribute_name);
|
|
3300
3405
|
if (!attribute) {
|
|
@@ -3307,6 +3412,25 @@ function makeTable(options) {
|
|
|
3307
3412
|
}
|
|
3308
3413
|
this.userResolvers[attribute_name] = resolver;
|
|
3309
3414
|
}
|
|
3415
|
+
/**
|
|
3416
|
+
* Override the default embedder for an `@embed` attribute. Return the vector to
|
|
3417
|
+
* store at `attribute_name`. The embedder receives the write payload (the fields
|
|
3418
|
+
* present in the PUT/PATCH body), not the post-merge record, so multi-field
|
|
3419
|
+
* concatenation only works when all source fields are in the same write.
|
|
3420
|
+
*/
|
|
3421
|
+
static setEmbedAttribute(attribute_name, embedder) {
|
|
3422
|
+
const attribute = (0, search_ts_1.findAttribute)(attributes, attribute_name);
|
|
3423
|
+
if (!attribute) {
|
|
3424
|
+
console.error(`The attribute "${attribute_name}" does not exist in the table "${tableName}"`);
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
if (!attribute.embed) {
|
|
3428
|
+
console.error(`The attribute "${attribute_name}" is not declared with @embed in the table "${tableName}"`);
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
this.userEmbedders[attribute_name] = embedder;
|
|
3432
|
+
this.userSetEmbedders.add(attribute_name);
|
|
3433
|
+
}
|
|
3310
3434
|
static async deleteHistory(endTime = 0, cleanupDeletedRecords = false) {
|
|
3311
3435
|
let completion;
|
|
3312
3436
|
for (const auditRecord of auditStore.getRange({
|
|
@@ -3408,7 +3532,7 @@ function makeTable(options) {
|
|
|
3408
3532
|
}
|
|
3409
3533
|
}
|
|
3410
3534
|
}, () => {
|
|
3411
|
-
throw new
|
|
3535
|
+
throw new hdbError_ts_1.ServerError('Service unavailable, exceeded request queue limit for resolving cache record', 503);
|
|
3412
3536
|
});
|
|
3413
3537
|
TableResource.updatedAttributes(); // on creation, update accessors as well
|
|
3414
3538
|
if (expirationMs)
|
|
@@ -3438,8 +3562,8 @@ function makeTable(options) {
|
|
|
3438
3562
|
hasChanges = true;
|
|
3439
3563
|
const indexNulls = index.indexNulls;
|
|
3440
3564
|
// determine what index values need to be removed and added
|
|
3441
|
-
let valuesToAdd = (0,
|
|
3442
|
-
let valuesToRemove = (0,
|
|
3565
|
+
let valuesToAdd = (0, commonUtility_ts_1.getIndexedValues)(value, indexNulls);
|
|
3566
|
+
let valuesToRemove = (0, commonUtility_ts_1.getIndexedValues)(existingValue, indexNulls);
|
|
3443
3567
|
let isLMDB = !!index.prefetch;
|
|
3444
3568
|
if (valuesToRemove?.length > 0) {
|
|
3445
3569
|
// put this in a conditional so we can do a faster version for new records
|
|
@@ -3483,19 +3607,21 @@ function makeTable(options) {
|
|
|
3483
3607
|
function checkValidId(id) {
|
|
3484
3608
|
switch (typeof id) {
|
|
3485
3609
|
case 'number':
|
|
3610
|
+
if (isNaN(id))
|
|
3611
|
+
throw new hdbError_ts_1.ClientError('Invalid primary key of NaN', 400);
|
|
3486
3612
|
return true;
|
|
3487
3613
|
case 'string':
|
|
3488
3614
|
if (id.length < 659)
|
|
3489
3615
|
return true; // max number of characters that can't expand our key size limit
|
|
3490
3616
|
if (id.length > MAX_KEY_BYTES) {
|
|
3491
3617
|
// we can quickly determine this is too big
|
|
3492
|
-
throw new
|
|
3618
|
+
throw new hdbError_ts_1.ClientError('Primary key size is too large: ' + id.length, 400);
|
|
3493
3619
|
}
|
|
3494
3620
|
// TODO: We could potentially have a faster test here, Buffer.byteLength is close, but we have to handle characters < 4 that are escaped in ordered-binary
|
|
3495
3621
|
break; // otherwise we have to test it, in this range, unicode characters could put it over the limit
|
|
3496
3622
|
case 'object':
|
|
3497
3623
|
if (id === null) {
|
|
3498
|
-
throw new
|
|
3624
|
+
throw new hdbError_ts_1.ClientError('Invalid primary key of null', 400);
|
|
3499
3625
|
}
|
|
3500
3626
|
break; // otherwise we have to test it
|
|
3501
3627
|
case 'bigint':
|
|
@@ -3503,13 +3629,13 @@ function makeTable(options) {
|
|
|
3503
3629
|
return true;
|
|
3504
3630
|
break; // otherwise we have to test it
|
|
3505
3631
|
default:
|
|
3506
|
-
throw new
|
|
3632
|
+
throw new hdbError_ts_1.ClientError('Invalid primary key type: ' + typeof id, 400);
|
|
3507
3633
|
}
|
|
3508
3634
|
// otherwise it is difficult to determine if the key size is too large
|
|
3509
3635
|
// without actually attempting to serialize it
|
|
3510
3636
|
const length = (0, ordered_binary_1.writeKey)(id, TEST_WRITE_KEY_BUFFER, 0);
|
|
3511
3637
|
if (length > MAX_KEY_BYTES)
|
|
3512
|
-
throw new
|
|
3638
|
+
throw new hdbError_ts_1.ClientError('Primary key size is too large: ' + id.length, 400);
|
|
3513
3639
|
return true;
|
|
3514
3640
|
}
|
|
3515
3641
|
function requestTargetToId(target) {
|
|
@@ -3550,7 +3676,7 @@ function makeTable(options) {
|
|
|
3550
3676
|
// skip recording reads for most system tables except hdb_analytics
|
|
3551
3677
|
// we want to track analytics reads in licensing, etc.
|
|
3552
3678
|
if (databaseName !== 'system' && (options.type === 'read' || !options.type)) {
|
|
3553
|
-
|
|
3679
|
+
harper_logger_ts_1.default.trace?.('Recording db-read action for', `${databaseName}.${tableName}`);
|
|
3554
3680
|
(0, write_ts_1.recordAction)(entry?.size ?? 1, 'db-read', tableName, null);
|
|
3555
3681
|
}
|
|
3556
3682
|
// we need to freeze entry records to ensure the integrity of the cache;
|
|
@@ -3681,6 +3807,11 @@ function makeTable(options) {
|
|
|
3681
3807
|
}
|
|
3682
3808
|
}
|
|
3683
3809
|
function ensureLoadedFromSource(source, id, entry, context, resource, target) {
|
|
3810
|
+
if (context?.onlyIfCached) {
|
|
3811
|
+
if (!entry?.value)
|
|
3812
|
+
throw new hdbError_ts_1.ServerError('Entry is not cached', 504);
|
|
3813
|
+
return;
|
|
3814
|
+
}
|
|
3684
3815
|
if (hasSourceGet) {
|
|
3685
3816
|
let needsSourceData = false;
|
|
3686
3817
|
if (context.noCache)
|
|
@@ -3711,11 +3842,9 @@ function makeTable(options) {
|
|
|
3711
3842
|
return entry;
|
|
3712
3843
|
});
|
|
3713
3844
|
// if the resource defines a method for indicating if stale-while-revalidate is allowed for a record
|
|
3714
|
-
if (
|
|
3845
|
+
if (entry?.value && resource?.allowStaleWhileRevalidate?.(entry, id)) {
|
|
3715
3846
|
// since we aren't waiting for it any errors won't propagate so we should at least log them
|
|
3716
3847
|
loadingFromSource.catch((error) => logger_ts_1.logger.warn?.(error));
|
|
3717
|
-
if (context?.onlyIfCached && !resource.doesExist())
|
|
3718
|
-
throw new hdbError_js_1.ServerError('Entry is not cached', 504);
|
|
3719
3848
|
return; // go ahead and return and let the current stale value be used while we re-validate
|
|
3720
3849
|
}
|
|
3721
3850
|
else
|
|
@@ -3767,7 +3896,7 @@ function makeTable(options) {
|
|
|
3767
3896
|
} while (true);
|
|
3768
3897
|
}
|
|
3769
3898
|
else {
|
|
3770
|
-
transaction = isRocksDB ? new DatabaseTransaction_ts_1.ImmediateTransaction(primaryStore) : new LMDBTransaction_1.ImmediateTransaction(primaryStore);
|
|
3899
|
+
transaction = (isRocksDB ? new DatabaseTransaction_ts_1.ImmediateTransaction(primaryStore) : new LMDBTransaction_1.ImmediateTransaction(primaryStore));
|
|
3771
3900
|
if (context) {
|
|
3772
3901
|
context.transaction = transaction;
|
|
3773
3902
|
if (context.timestamp)
|
|
@@ -3972,16 +4101,15 @@ function makeTable(options) {
|
|
|
3972
4101
|
throw new Error('Only objects can be cached and stored in tables');
|
|
3973
4102
|
if (updatedRecord.status > 0 && updatedRecord.headers) {
|
|
3974
4103
|
// if the source has a status code and headers, treat it as a response
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
} // there are definitely more status codes to handle
|
|
4104
|
+
const status = updatedRecord.status;
|
|
4105
|
+
if (status === 304) {
|
|
4106
|
+
// revalidation of our current cached record
|
|
4107
|
+
updatedRecord = existingRecord;
|
|
4108
|
+
version = existingVersion;
|
|
4109
|
+
}
|
|
4110
|
+
else if (!CACHEABLE_STATUS_CODES.has(status)) {
|
|
4111
|
+
// non-cacheable status - propagate to client without caching
|
|
4112
|
+
throw new hdbError_ts_1.ServerError(updatedRecord.body || 'Error from source', status);
|
|
3985
4113
|
}
|
|
3986
4114
|
else {
|
|
3987
4115
|
let headers;
|
|
@@ -4010,17 +4138,13 @@ function makeTable(options) {
|
|
|
4010
4138
|
if (data !== undefined) {
|
|
4011
4139
|
// we have structured data that we have parsed
|
|
4012
4140
|
delete headers['content-type']; // don't store the content type if we have already parsed it
|
|
4013
|
-
updatedRecord = {
|
|
4014
|
-
headers,
|
|
4015
|
-
data,
|
|
4016
|
-
};
|
|
4141
|
+
updatedRecord = { headers, data };
|
|
4017
4142
|
}
|
|
4018
4143
|
else {
|
|
4019
|
-
updatedRecord = {
|
|
4020
|
-
headers,
|
|
4021
|
-
body: createBlob(updatedRecord.body),
|
|
4022
|
-
};
|
|
4144
|
+
updatedRecord = { headers, body: createBlob(updatedRecord.body) };
|
|
4023
4145
|
}
|
|
4146
|
+
if (status !== 200)
|
|
4147
|
+
updatedRecord.status = status;
|
|
4024
4148
|
}
|
|
4025
4149
|
}
|
|
4026
4150
|
if (typeof updatedRecord.toJSON === 'function')
|
|
@@ -4029,11 +4153,26 @@ function makeTable(options) {
|
|
|
4029
4153
|
updatedRecord[primaryKey] = id;
|
|
4030
4154
|
}
|
|
4031
4155
|
resolved = true;
|
|
4032
|
-
|
|
4156
|
+
const resolvedEntry = {
|
|
4033
4157
|
key: id,
|
|
4034
4158
|
version,
|
|
4035
4159
|
value: updatedRecord,
|
|
4036
|
-
|
|
4160
|
+
expiresAt: sourceContext.expiresAt,
|
|
4161
|
+
metadataFlags: 0,
|
|
4162
|
+
size: 0,
|
|
4163
|
+
localTime: 0,
|
|
4164
|
+
nodeId: 0,
|
|
4165
|
+
residencyId: 0,
|
|
4166
|
+
};
|
|
4167
|
+
// Give the plain object the RecordObject prototype so getExpiresAt/getUpdatedTime
|
|
4168
|
+
// are available on the immediately-resolved entry. We mutate the prototype
|
|
4169
|
+
// in-place rather than copying so that the commit callback (which adds
|
|
4170
|
+
// createdAt/updatedAt to updatedRecord) is still reflected in the entry value.
|
|
4171
|
+
if (updatedRecord && updatedRecord.constructor === Object) {
|
|
4172
|
+
Object.setPrototypeOf(updatedRecord, primaryStore.encoder.structPrototype);
|
|
4173
|
+
RecordEncoder_ts_1.entryMap.set(updatedRecord, resolvedEntry);
|
|
4174
|
+
}
|
|
4175
|
+
resolve(resolvedEntry);
|
|
4037
4176
|
}
|
|
4038
4177
|
catch (error) {
|
|
4039
4178
|
error.message += ` while resolving record ${id} for ${tableName}`;
|
|
@@ -4164,6 +4303,14 @@ function makeTable(options) {
|
|
|
4164
4303
|
}
|
|
4165
4304
|
},
|
|
4166
4305
|
};
|
|
4306
|
+
// The cache-from-source write bypasses `_writeUpdate`, so wire the embed hook here
|
|
4307
|
+
// too (always the originating node). It runs after the client GET has resolved with
|
|
4308
|
+
// fresh source data, so it's a background commit: an embedder failure aborts the cache
|
|
4309
|
+
// write via the outer error handler (row re-embeds next read) and never reaches the
|
|
4310
|
+
// caller. Source-resolution errors are handled earlier, with the stale-data fallback.
|
|
4311
|
+
const embedBefore = (0, embedHook_ts_1.buildEmbedBefore)(updatedRecord, sourceContext, undefined, TableResource.embedAttributes, TableResource.userEmbedders);
|
|
4312
|
+
if (embedBefore)
|
|
4313
|
+
await embedBefore();
|
|
4167
4314
|
sourceWrite.before = preCommitBlobsForRecordBefore(sourceWrite, updatedRecord);
|
|
4168
4315
|
dbTxn.addWrite(sourceWrite);
|
|
4169
4316
|
}), () => {
|
|
@@ -4186,9 +4333,9 @@ function makeTable(options) {
|
|
|
4186
4333
|
if (context.user?.role?.permission?.super_user)
|
|
4187
4334
|
return true;
|
|
4188
4335
|
if (context.replicateTo)
|
|
4189
|
-
throw new
|
|
4336
|
+
throw new hdbError_ts_1.ClientError('Can not specify replication parameters without super user permissions', 403);
|
|
4190
4337
|
if (context.replicatedConfirmation)
|
|
4191
|
-
throw new
|
|
4338
|
+
throw new hdbError_ts_1.ClientError('Can not specify replication confirmation without super user permissions', 403);
|
|
4192
4339
|
return true;
|
|
4193
4340
|
}
|
|
4194
4341
|
function scheduleCleanup(priority) {
|
|
@@ -4392,7 +4539,9 @@ function makeTable(options) {
|
|
|
4392
4539
|
return callSources
|
|
4393
4540
|
? async () => {
|
|
4394
4541
|
// if we are calling the sources first and waiting for blobs, do those in order
|
|
4395
|
-
|
|
4542
|
+
const result = callSources();
|
|
4543
|
+
if (result && result.then)
|
|
4544
|
+
await result;
|
|
4396
4545
|
await preCommit.complete();
|
|
4397
4546
|
}
|
|
4398
4547
|
: () => preCommit.complete();
|
|
@@ -4414,6 +4563,17 @@ function attributesAsObject(attribute_permissions, type) {
|
|
|
4414
4563
|
function noop() {
|
|
4415
4564
|
// prefetch callback
|
|
4416
4565
|
}
|
|
4566
|
+
/**
|
|
4567
|
+
* Recreate a computed "from" function from a stored expression string. This is used when a table
|
|
4568
|
+
* is loaded from metadata on a thread that hasn't loaded the GraphQL schema, so the computed
|
|
4569
|
+
* function needs to be reconstructed from the persisted expression.
|
|
4570
|
+
*/
|
|
4571
|
+
function createComputedFrom(computedFromExpression, attributesFallback) {
|
|
4572
|
+
const script = new node_vm_1.Script(attributesFallback
|
|
4573
|
+
? `function computed(attributes) { return function(record) { with(attributes) { with (record) { return ${computedFromExpression}; } } } } computed;`
|
|
4574
|
+
: `function computed() { return function(record) { with (record) { return ${computedFromExpression}; } } } computed;`);
|
|
4575
|
+
return script.runInThisContext()(attributesFallback);
|
|
4576
|
+
}
|
|
4417
4577
|
const ENDS_WITH_TIMEZONE = /[+-][0-9]{2}:[0-9]{2}|[a-zA-Z]$/;
|
|
4418
4578
|
/**
|
|
4419
4579
|
* Coerce a string to the type defined by the attribute
|
|
@@ -4448,7 +4608,7 @@ function coerceType(value, attribute) {
|
|
|
4448
4608
|
case 'BigInt':
|
|
4449
4609
|
return value === 'null' ? null : BigInt(value);
|
|
4450
4610
|
case 'Boolean':
|
|
4451
|
-
return (0,
|
|
4611
|
+
return (0, common_utils_ts_1.autoCastBooleanStrict)(value);
|
|
4452
4612
|
case 'Date':
|
|
4453
4613
|
if (isNaN(value)) {
|
|
4454
4614
|
if (value === 'null')
|
|
@@ -4464,7 +4624,7 @@ function coerceType(value, attribute) {
|
|
|
4464
4624
|
return new Date(+value); // epoch ms number
|
|
4465
4625
|
case undefined:
|
|
4466
4626
|
case 'Any':
|
|
4467
|
-
return (0,
|
|
4627
|
+
return (0, common_utils_ts_1.autoCast)(value);
|
|
4468
4628
|
default:
|
|
4469
4629
|
return value;
|
|
4470
4630
|
}
|