@harperfast/harper 5.2.10 → 5.3.0-alpha.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/agent/mcpTools.ts +1 -1
- package/agent/session.ts +25 -14
- package/bin/cliOperations.ts +46 -9
- package/bin/copyDb.ts +282 -59
- package/bin/deploySetup.ts +16 -5
- package/bin/harper.ts +1 -1
- package/bin/help.ts +4 -1
- package/bin/lite.ts +4 -1
- package/bin/restart.ts +59 -3
- package/bin/run.ts +6 -11
- package/bin/upgrade.js +7 -3
- package/bin/workloadIdentity.ts +119 -0
- package/components/Application.ts +2414 -242
- package/components/ApplicationScope.ts +8 -0
- package/components/EntryHandler.ts +59 -39
- package/components/OptionsWatcher.ts +150 -74
- package/components/RuntimeModuleTracker.ts +38 -7
- package/components/Scope.ts +37 -15
- package/components/awaitRestart.ts +84 -0
- package/components/componentLoader.ts +340 -30
- package/components/componentPreparationLock.ts +16 -5
- package/components/mcp/adapters/harperHttp.ts +4 -0
- package/components/mcp/listChanged.ts +4 -0
- package/components/mcp/toolRegistry.ts +2 -0
- package/components/mcp/tools/operations.ts +9 -0
- package/components/mcp/tools/schemas/operationDescriptions.ts +2 -2
- package/components/operations.js +270 -78
- package/components/operationsValidation.js +49 -1
- package/components/status/ComponentStatusRegistry.ts +59 -0
- package/config/RootConfigWatcher.ts +80 -34
- package/config/configUtils.ts +291 -34
- package/config/harperConfigEnvVars.ts +170 -27
- package/config-root.schema.json +29 -0
- package/dataLayer/blobBackup.ts +160 -50
- package/dataLayer/delete.ts +6 -1
- package/dataLayer/harperBridge/ResourceBridge.ts +52 -8
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +3 -1
- package/dataLayer/hdbInfoController.ts +34 -1
- package/dataLayer/insert.ts +44 -1
- package/dataLayer/rocksdbBackup.ts +53 -10
- package/dataLayer/schema.ts +11 -1
- package/dataLayer/schemaDescribe.ts +8 -1
- package/dist/agent/mcpTools.js +1 -1
- package/dist/agent/mcpTools.js.map +1 -1
- package/dist/agent/session.d.ts +22 -0
- package/dist/agent/session.js +26 -15
- package/dist/agent/session.js.map +1 -1
- package/dist/bin/cliOperations.js +48 -9
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/copyDb.d.ts +12 -1
- package/dist/bin/copyDb.js +248 -60
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/bin/deploySetup.d.ts +2 -0
- package/dist/bin/deploySetup.js +11 -3
- package/dist/bin/deploySetup.js.map +1 -1
- package/dist/bin/harper.js +1 -1
- package/dist/bin/harper.js.map +1 -1
- package/dist/bin/help.js +4 -1
- package/dist/bin/help.js.map +1 -1
- package/dist/bin/lite.js +4 -1
- package/dist/bin/lite.js.map +1 -1
- package/dist/bin/restart.js +54 -5
- package/dist/bin/restart.js.map +1 -1
- package/dist/bin/run.js +4 -10
- package/dist/bin/run.js.map +1 -1
- package/dist/bin/upgrade.js +4 -3
- package/dist/bin/upgrade.js.map +1 -1
- package/dist/bin/workloadIdentity.d.ts +18 -0
- package/dist/bin/workloadIdentity.js +100 -0
- package/dist/bin/workloadIdentity.js.map +1 -0
- package/dist/components/Application.d.ts +139 -16
- package/dist/components/Application.js +2215 -267
- package/dist/components/Application.js.map +1 -1
- package/dist/components/ApplicationScope.d.ts +8 -0
- package/dist/components/ApplicationScope.js +7 -0
- package/dist/components/ApplicationScope.js.map +1 -1
- package/dist/components/EntryHandler.js +26 -10
- package/dist/components/EntryHandler.js.map +1 -1
- package/dist/components/OptionsWatcher.d.ts +1 -0
- package/dist/components/OptionsWatcher.js +141 -74
- package/dist/components/OptionsWatcher.js.map +1 -1
- package/dist/components/RuntimeModuleTracker.js +40 -6
- package/dist/components/RuntimeModuleTracker.js.map +1 -1
- package/dist/components/Scope.js +38 -13
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/awaitRestart.d.ts +33 -0
- package/dist/components/awaitRestart.js +61 -0
- package/dist/components/awaitRestart.js.map +1 -0
- package/dist/components/componentLoader.d.ts +38 -1
- package/dist/components/componentLoader.js +279 -22
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/componentPreparationLock.d.ts +5 -0
- package/dist/components/componentPreparationLock.js +14 -6
- package/dist/components/componentPreparationLock.js.map +1 -1
- package/dist/components/mcp/adapters/harperHttp.js +4 -0
- package/dist/components/mcp/adapters/harperHttp.js.map +1 -1
- package/dist/components/mcp/listChanged.js +5 -0
- package/dist/components/mcp/listChanged.js.map +1 -1
- package/dist/components/mcp/toolRegistry.d.ts +1 -0
- package/dist/components/mcp/toolRegistry.js.map +1 -1
- package/dist/components/mcp/tools/operations.d.ts +5 -0
- package/dist/components/mcp/tools/operations.js +9 -0
- package/dist/components/mcp/tools/operations.js.map +1 -1
- package/dist/components/mcp/tools/schemas/operationDescriptions.js +2 -2
- package/dist/components/mcp/tools/schemas/operationDescriptions.js.map +1 -1
- package/dist/components/operations.js +231 -77
- package/dist/components/operations.js.map +1 -1
- package/dist/components/operationsValidation.js +49 -1
- package/dist/components/operationsValidation.js.map +1 -1
- package/dist/components/status/ComponentStatusRegistry.d.ts +0 -4
- package/dist/components/status/ComponentStatusRegistry.js +63 -0
- package/dist/components/status/ComponentStatusRegistry.js.map +1 -1
- package/dist/config/RootConfigWatcher.d.ts +7 -1
- package/dist/config/RootConfigWatcher.js +64 -27
- package/dist/config/RootConfigWatcher.js.map +1 -1
- package/dist/config/configUtils.d.ts +9 -1
- package/dist/config/configUtils.js +254 -33
- package/dist/config/configUtils.js.map +1 -1
- package/dist/config/harperConfigEnvVars.d.ts +16 -0
- package/dist/config/harperConfigEnvVars.js +162 -25
- package/dist/config/harperConfigEnvVars.js.map +1 -1
- package/dist/dataLayer/blobBackup.d.ts +49 -20
- package/dist/dataLayer/blobBackup.js +139 -50
- package/dist/dataLayer/blobBackup.js.map +1 -1
- package/dist/dataLayer/delete.js +1 -1
- package/dist/dataLayer/delete.js.map +1 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +14 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.js +51 -10
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.d.ts +3 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +3 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js.map +1 -1
- package/dist/dataLayer/hdbInfoController.d.ts +10 -0
- package/dist/dataLayer/hdbInfoController.js +30 -1
- package/dist/dataLayer/hdbInfoController.js.map +1 -1
- package/dist/dataLayer/insert.d.ts +9 -1
- package/dist/dataLayer/insert.js +30 -0
- package/dist/dataLayer/insert.js.map +1 -1
- package/dist/dataLayer/rocksdbBackup.d.ts +2 -2
- package/dist/dataLayer/rocksdbBackup.js +45 -8
- package/dist/dataLayer/rocksdbBackup.js.map +1 -1
- package/dist/dataLayer/schema.js +8 -0
- package/dist/dataLayer/schema.js.map +1 -1
- package/dist/dataLayer/schemaDescribe.js +8 -1
- package/dist/dataLayer/schemaDescribe.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/json/systemSchema.json +52 -0
- package/dist/resources/DatabaseTransaction.d.ts +55 -3
- package/dist/resources/DatabaseTransaction.js +460 -134
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/LMDBTransaction.js +22 -4
- package/dist/resources/LMDBTransaction.js.map +1 -1
- package/dist/resources/PrimaryRocksDatabase.d.ts +1 -0
- package/dist/resources/PrimaryRocksDatabase.js +30 -2
- package/dist/resources/PrimaryRocksDatabase.js.map +1 -1
- package/dist/resources/RecordEncoder.d.ts +20 -0
- package/dist/resources/RecordEncoder.js +94 -9
- package/dist/resources/RecordEncoder.js.map +1 -1
- package/dist/resources/RequestTarget.d.ts +2 -0
- package/dist/resources/RequestTarget.js.map +1 -1
- package/dist/resources/Resource.js +20 -11
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/ResourceInterface.d.ts +20 -1
- package/dist/resources/ResourceInterface.js.map +1 -1
- package/dist/resources/RocksIndexStore.d.ts +6 -1
- package/dist/resources/RocksIndexStore.js +24 -10
- package/dist/resources/RocksIndexStore.js.map +1 -1
- package/dist/resources/RocksTransactionLogStore.d.ts +14 -1
- package/dist/resources/RocksTransactionLogStore.js +57 -17
- package/dist/resources/RocksTransactionLogStore.js.map +1 -1
- package/dist/resources/Table.d.ts +112 -8
- package/dist/resources/Table.js +1071 -197
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/auditStore.d.ts +11 -2
- package/dist/resources/auditStore.js +183 -18
- package/dist/resources/auditStore.js.map +1 -1
- package/dist/resources/blob.d.ts +129 -9
- package/dist/resources/blob.js +992 -114
- package/dist/resources/blob.js.map +1 -1
- package/dist/resources/branchDatabase.d.ts +48 -0
- package/dist/resources/branchDatabase.js +892 -0
- package/dist/resources/branchDatabase.js.map +1 -0
- package/dist/resources/crdt.js +50 -12
- package/dist/resources/crdt.js.map +1 -1
- package/dist/resources/databases.d.ts +150 -9
- package/dist/resources/databases.js +1247 -525
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/defineTable.d.ts +10 -2
- package/dist/resources/defineTable.js +9 -1
- package/dist/resources/defineTable.js.map +1 -1
- package/dist/resources/graphql.d.ts +1 -1
- package/dist/resources/graphql.js +50 -15
- package/dist/resources/graphql.js.map +1 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +1 -0
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +6 -2
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
- package/dist/resources/longLivedTransactions.d.ts +71 -0
- package/dist/resources/longLivedTransactions.js +358 -0
- package/dist/resources/longLivedTransactions.js.map +1 -0
- package/dist/resources/models/backendRegistry.d.ts +26 -0
- package/dist/resources/models/backendRegistry.js +60 -2
- package/dist/resources/models/backendRegistry.js.map +1 -1
- package/dist/resources/models/bootstrap.d.ts +33 -1
- package/dist/resources/models/bootstrap.js +416 -31
- package/dist/resources/models/bootstrap.js.map +1 -1
- package/dist/resources/recordLock.d.ts +80 -0
- package/dist/resources/recordLock.js +184 -0
- package/dist/resources/recordLock.js.map +1 -0
- package/dist/resources/replayLogs.d.ts +14 -1
- package/dist/resources/replayLogs.js +152 -24
- package/dist/resources/replayLogs.js.map +1 -1
- package/dist/resources/replayLogsGuards.d.ts +94 -7
- package/dist/resources/replayLogsGuards.js +111 -7
- package/dist/resources/replayLogsGuards.js.map +1 -1
- package/dist/resources/search.js +158 -32
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/transactionBroadcast.d.ts +1 -1
- package/dist/resources/transactionBroadcast.js +2 -2
- package/dist/resources/transactionBroadcast.js.map +1 -1
- package/dist/security/auth.js +61 -30
- package/dist/security/auth.js.map +1 -1
- package/dist/security/authn/oidc/claims.d.ts +22 -0
- package/dist/security/authn/oidc/claims.js +71 -0
- package/dist/security/authn/oidc/claims.js.map +1 -0
- package/dist/security/authn/oidc/identityToken.d.ts +27 -0
- package/dist/security/authn/oidc/identityToken.js +111 -0
- package/dist/security/authn/oidc/identityToken.js.map +1 -0
- package/dist/security/authn/oidc/jwks.d.ts +25 -0
- package/dist/security/authn/oidc/jwks.js +261 -0
- package/dist/security/authn/oidc/jwks.js.map +1 -0
- package/dist/security/authn/oidc/providers/generic.d.ts +13 -0
- package/dist/security/authn/oidc/providers/generic.js +34 -0
- package/dist/security/authn/oidc/providers/generic.js.map +1 -0
- package/dist/security/authn/oidc/providers/githubActions.d.ts +11 -0
- package/dist/security/authn/oidc/providers/githubActions.js +129 -0
- package/dist/security/authn/oidc/providers/githubActions.js.map +1 -0
- package/dist/security/authn/oidc/providers/index.d.ts +37 -0
- package/dist/security/authn/oidc/providers/index.js +24 -0
- package/dist/security/authn/oidc/providers/index.js.map +1 -0
- package/dist/security/authn/oidc/tokenExchange.d.ts +12 -0
- package/dist/security/authn/oidc/tokenExchange.js +306 -0
- package/dist/security/authn/oidc/tokenExchange.js.map +1 -0
- package/dist/security/authn/oidc/trustPolicyOperations.d.ts +49 -0
- package/dist/security/authn/oidc/trustPolicyOperations.js +358 -0
- package/dist/security/authn/oidc/trustPolicyOperations.js.map +1 -0
- package/dist/security/authn/oidc/types.d.ts +38 -0
- package/dist/security/authn/oidc/types.js +6 -0
- package/dist/security/authn/oidc/types.js.map +1 -0
- package/dist/security/certificateVerification/index.js +40 -11
- package/dist/security/certificateVerification/index.js.map +1 -1
- package/dist/security/certificateVerification/trustedIssuers.d.ts +24 -0
- package/dist/security/certificateVerification/trustedIssuers.js +79 -0
- package/dist/security/certificateVerification/trustedIssuers.js.map +1 -0
- package/dist/security/certificateVerification/types.d.ts +1 -0
- package/dist/security/credentialProvenance.d.ts +35 -0
- package/dist/security/credentialProvenance.js +51 -0
- package/dist/security/credentialProvenance.js.map +1 -0
- package/dist/security/credentialRejection.d.ts +4 -0
- package/dist/security/credentialRejection.js +24 -0
- package/dist/security/credentialRejection.js.map +1 -0
- package/dist/security/deferredAuthentication.d.ts +36 -0
- package/dist/security/deferredAuthentication.js +70 -0
- package/dist/security/deferredAuthentication.js.map +1 -0
- package/dist/security/impersonation.d.ts +21 -0
- package/dist/security/impersonation.js +108 -9
- package/dist/security/impersonation.js.map +1 -1
- package/dist/security/jsLoader.d.ts +6 -0
- package/dist/security/jsLoader.js +75 -15
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/security/keys.js +301 -71
- package/dist/security/keys.js.map +1 -1
- package/dist/security/operationScope.d.ts +21 -0
- package/dist/security/operationScope.js +36 -0
- package/dist/security/operationScope.js.map +1 -0
- package/dist/security/permissionsTranslator.js +21 -0
- package/dist/security/permissionsTranslator.js.map +1 -1
- package/dist/security/tokenAuthentication.d.ts +19 -1
- package/dist/security/tokenAuthentication.js +191 -10
- package/dist/security/tokenAuthentication.js.map +1 -1
- package/dist/security/user.js +4 -3
- package/dist/security/user.js.map +1 -1
- package/dist/server/DurableSubscriptionsSession.d.ts +2 -2
- package/dist/server/DurableSubscriptionsSession.js +67 -10
- package/dist/server/DurableSubscriptionsSession.js.map +1 -1
- package/dist/server/REST.js +73 -0
- package/dist/server/REST.js.map +1 -1
- package/dist/server/graphqlQuerying.js +4 -0
- package/dist/server/graphqlQuerying.js.map +1 -1
- package/dist/server/http.d.ts +11 -0
- package/dist/server/http.js +88 -15
- package/dist/server/http.js.map +1 -1
- package/dist/server/itc/serverHandlers.js +8 -1
- package/dist/server/itc/serverHandlers.js.map +1 -1
- package/dist/server/jobs/jobProcess.js +6 -2
- package/dist/server/jobs/jobProcess.js.map +1 -1
- package/dist/server/jobs/jobs.js +4 -1
- package/dist/server/jobs/jobs.js.map +1 -1
- package/dist/server/liveSubscriptionAuth.d.ts +26 -4
- package/dist/server/liveSubscriptionAuth.js +105 -39
- package/dist/server/liveSubscriptionAuth.js.map +1 -1
- package/dist/server/loadRootComponents.js +49 -10
- package/dist/server/loadRootComponents.js.map +1 -1
- package/dist/server/mqtt.d.ts +2 -0
- package/dist/server/mqtt.js +165 -30
- package/dist/server/mqtt.js.map +1 -1
- package/dist/server/nodeName.d.ts +2 -0
- package/dist/server/nodeName.js +107 -23
- package/dist/server/nodeName.js.map +1 -1
- package/dist/server/serverHelpers/Headers.d.ts +25 -0
- package/dist/server/serverHelpers/Headers.js +139 -1
- package/dist/server/serverHelpers/Headers.js.map +1 -1
- package/dist/server/serverHelpers/contentTypes.d.ts +9 -0
- package/dist/server/serverHelpers/contentTypes.js +32 -25
- package/dist/server/serverHelpers/contentTypes.js.map +1 -1
- package/dist/server/serverHelpers/deployValidationState.d.ts +3 -0
- package/dist/server/serverHelpers/deployValidationState.js +9 -19
- package/dist/server/serverHelpers/deployValidationState.js.map +1 -1
- package/dist/server/serverHelpers/operationAuthorizationState.d.ts +12 -0
- package/dist/server/serverHelpers/operationAuthorizationState.js +24 -2
- package/dist/server/serverHelpers/operationAuthorizationState.js.map +1 -1
- package/dist/server/serverHelpers/registeredOperations.d.ts +5 -4
- package/dist/server/serverHelpers/registeredOperations.js +74 -21
- package/dist/server/serverHelpers/registeredOperations.js.map +1 -1
- package/dist/server/serverHelpers/requestSanitization.d.ts +11 -0
- package/dist/server/serverHelpers/requestSanitization.js +20 -0
- package/dist/server/serverHelpers/requestSanitization.js.map +1 -0
- package/dist/server/serverHelpers/serverHandlers.js +6 -3
- package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
- package/dist/server/serverHelpers/serverUtilities.d.ts +18 -0
- package/dist/server/serverHelpers/serverUtilities.js +90 -20
- package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
- package/dist/server/serverHelpers/sharedMessageEncoding.d.ts +67 -0
- package/dist/server/serverHelpers/sharedMessageEncoding.js +280 -0
- package/dist/server/serverHelpers/sharedMessageEncoding.js.map +1 -0
- package/dist/server/serverHelpers/uwsServer.js +19 -1
- package/dist/server/serverHelpers/uwsServer.js.map +1 -1
- package/dist/server/static.js +24 -28
- package/dist/server/static.js.map +1 -1
- package/dist/server/storageReclamation.d.ts +5 -0
- package/dist/server/storageReclamation.js +16 -0
- package/dist/server/storageReclamation.js.map +1 -1
- package/dist/server/threads/itc.d.ts +7 -2
- package/dist/server/threads/itc.js +5 -1
- package/dist/server/threads/itc.js.map +1 -1
- package/dist/server/threads/manageThreads.d.ts +26 -4
- package/dist/server/threads/manageThreads.js +517 -72
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/socketRouter.js +89 -26
- package/dist/server/threads/socketRouter.js.map +1 -1
- package/dist/server/threads/threadHeapMemory.d.ts +2 -0
- package/dist/server/threads/threadHeapMemory.js +31 -0
- package/dist/server/threads/threadHeapMemory.js.map +1 -0
- package/dist/server/threads/threadServer.js +46 -15
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/sqlEngine/config.d.ts +1 -3
- package/dist/sqlEngine/config.js +19 -16
- package/dist/sqlEngine/config.js.map +1 -1
- package/dist/sqlTranslator/index.d.ts +1 -1
- package/dist/sqlTranslator/index.js +30 -7
- package/dist/sqlTranslator/index.js.map +1 -1
- package/dist/upgrade/directives/5-3-0.d.ts +7 -0
- package/dist/upgrade/directives/5-3-0.js +148 -0
- package/dist/upgrade/directives/5-3-0.js.map +1 -0
- package/dist/upgrade/directives/directivesController.js +2 -1
- package/dist/upgrade/directives/directivesController.js.map +1 -1
- package/dist/utility/OperationFunctionCaller.js +2 -1
- package/dist/utility/OperationFunctionCaller.js.map +1 -1
- package/dist/utility/common_utils.d.ts +16 -0
- package/dist/utility/common_utils.js +32 -6
- package/dist/utility/common_utils.js.map +1 -1
- package/dist/utility/componentNames.d.ts +8 -0
- package/dist/utility/componentNames.js +12 -1
- package/dist/utility/componentNames.js.map +1 -1
- package/dist/utility/environment/environmentManager.js +3 -6
- package/dist/utility/environment/environmentManager.js.map +1 -1
- package/dist/utility/environment/systemInformation.d.ts +1 -0
- package/dist/utility/environment/systemInformation.js +1 -0
- package/dist/utility/environment/systemInformation.js.map +1 -1
- package/dist/utility/errors/commonErrors.d.ts +2 -0
- package/dist/utility/errors/commonErrors.js +2 -0
- package/dist/utility/errors/commonErrors.js.map +1 -1
- package/dist/utility/errors/hdbError.d.ts +17 -0
- package/dist/utility/errors/hdbError.js +30 -1
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/utility/globalSchema.d.ts +18 -0
- package/dist/utility/hdbTerms.d.ts +16 -0
- package/dist/utility/hdbTerms.js +18 -2
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/logging/harper_logger.d.ts +2 -0
- package/dist/utility/logging/harper_logger.js +91 -14
- package/dist/utility/logging/harper_logger.js.map +1 -1
- package/dist/utility/logging/logRotator.js +76 -49
- package/dist/utility/logging/logRotator.js.map +1 -1
- package/dist/utility/nodeIdentity.d.ts +9 -0
- package/dist/utility/nodeIdentity.js +58 -0
- package/dist/utility/nodeIdentity.js.map +1 -0
- package/dist/utility/npmUtilities.js +9 -7
- package/dist/utility/npmUtilities.js.map +1 -1
- package/dist/utility/operationPermissions.d.ts +3 -1
- package/dist/utility/operationPermissions.js +16 -1
- package/dist/utility/operationPermissions.js.map +1 -1
- package/dist/utility/operation_authorization.d.ts +10 -7
- package/dist/utility/operation_authorization.js +212 -41
- package/dist/utility/operation_authorization.js.map +1 -1
- package/dist/utility/watchPath.d.ts +29 -0
- package/dist/utility/watchPath.js +68 -0
- package/dist/utility/watchPath.js.map +1 -0
- package/dist/utility/watcherFallback.d.ts +86 -0
- package/dist/utility/watcherFallback.js +278 -1
- package/dist/utility/watcherFallback.js.map +1 -1
- package/dist/validation/configValidator.d.ts +12 -0
- package/dist/validation/configValidator.js +199 -72
- package/dist/validation/configValidator.js.map +1 -1
- package/dist/validation/installValidator.js +12 -0
- package/dist/validation/installValidator.js.map +1 -1
- package/dist/validation/validationWrapper.d.ts +11 -0
- package/dist/validation/validationWrapper.js +16 -3
- package/dist/validation/validationWrapper.js.map +1 -1
- package/index.ts +2 -0
- package/json/systemSchema.json +52 -0
- package/npm-shrinkwrap.json +235 -233
- package/package.json +8 -7
- package/resources/DESIGN.md +114 -52
- package/resources/DatabaseTransaction.ts +522 -130
- package/resources/LMDBTransaction.ts +26 -4
- package/resources/PrimaryRocksDatabase.ts +29 -3
- package/resources/RecordEncoder.ts +103 -8
- package/resources/RequestTarget.ts +2 -0
- package/resources/Resource.ts +17 -9
- package/resources/ResourceInterface.ts +23 -0
- package/resources/RocksIndexStore.ts +30 -10
- package/resources/RocksTransactionLogStore.ts +78 -21
- package/resources/Table.ts +1107 -164
- package/resources/auditStore.ts +187 -21
- package/resources/blob.ts +1029 -110
- package/resources/branchDatabase.ts +941 -0
- package/resources/crdt.ts +76 -12
- package/resources/databases.ts +1354 -522
- package/resources/defineTable.ts +18 -2
- package/resources/graphql.ts +70 -16
- package/resources/indexes/HierarchicalNavigableSmallWorld.ts +6 -2
- package/resources/longLivedTransactions.ts +360 -0
- package/resources/models/backendRegistry.ts +84 -2
- package/resources/models/bootstrap.ts +473 -28
- package/resources/recordLock.ts +253 -0
- package/resources/replayLogs.ts +147 -26
- package/resources/replayLogsGuards.ts +171 -8
- package/resources/search.ts +154 -32
- package/resources/transactionBroadcast.ts +3 -3
- package/security/auth.ts +68 -29
- package/security/authn/oidc/claims.ts +72 -0
- package/security/authn/oidc/identityToken.ts +129 -0
- package/security/authn/oidc/jwks.ts +260 -0
- package/security/authn/oidc/providers/generic.ts +40 -0
- package/security/authn/oidc/providers/githubActions.ts +137 -0
- package/security/authn/oidc/providers/index.ts +52 -0
- package/security/authn/oidc/tokenExchange.ts +300 -0
- package/security/authn/oidc/trustPolicyOperations.ts +343 -0
- package/security/authn/oidc/types.ts +41 -0
- package/security/certificateVerification/index.ts +54 -13
- package/security/certificateVerification/trustedIssuers.ts +76 -0
- package/security/certificateVerification/types.ts +1 -0
- package/security/credentialProvenance.ts +47 -0
- package/security/credentialRejection.ts +22 -0
- package/security/deferredAuthentication.ts +71 -0
- package/security/impersonation.ts +117 -12
- package/security/jsLoader.ts +81 -18
- package/security/keys.ts +298 -72
- package/security/operationScope.ts +33 -0
- package/security/permissionsTranslator.js +23 -0
- package/security/tokenAuthentication.ts +233 -12
- package/security/user.ts +4 -3
- package/server/DESIGN.md +183 -16
- package/server/DurableSubscriptionsSession.ts +71 -11
- package/server/REST.ts +79 -1
- package/server/graphqlQuerying.ts +4 -0
- package/server/http.ts +99 -18
- package/server/itc/serverHandlers.js +8 -1
- package/server/jobs/jobProcess.ts +8 -2
- package/server/jobs/jobs.ts +4 -1
- package/server/liveSubscriptionAuth.ts +129 -46
- package/server/loadRootComponents.js +50 -8
- package/server/mqtt.ts +179 -38
- package/server/nodeName.ts +103 -21
- package/server/serverHelpers/Headers.ts +131 -0
- package/server/serverHelpers/contentTypes.ts +29 -21
- package/server/serverHelpers/deployValidationState.ts +24 -13
- package/server/serverHelpers/operationAuthorizationState.ts +34 -3
- package/server/serverHelpers/registeredOperations.ts +79 -22
- package/server/serverHelpers/requestSanitization.ts +15 -0
- package/server/serverHelpers/serverHandlers.js +6 -3
- package/server/serverHelpers/serverUtilities.ts +104 -31
- package/server/serverHelpers/sharedMessageEncoding.ts +307 -0
- package/server/serverHelpers/uwsServer.ts +17 -2
- package/server/static.ts +23 -29
- package/server/storageReclamation.ts +13 -0
- package/server/threads/itc.js +11 -1
- package/server/threads/manageThreads.js +526 -63
- package/server/threads/socketRouter.ts +81 -26
- package/server/threads/threadHeapMemory.ts +26 -0
- package/server/threads/threadServer.js +43 -15
- package/sqlTranslator/index.ts +31 -8
- package/studio/web/assets/{Chat-Br06zdMA.js → Chat-BnCBegQz.js} +1 -1
- package/studio/web/assets/{FloatingChat-BWImX5fA.js → FloatingChat-CoDW1ySS.js} +3 -3
- package/studio/web/assets/{apiToken-DN0nmDsq.js → apiToken-Bwk5BLXW.js} +1 -1
- package/studio/web/assets/{applications-kSxVoyeU.js → applications-DHxGi7JH.js} +1 -1
- package/studio/web/assets/{cssMode-C1JeufH5.js → cssMode-s0cWI-_M.js} +1 -1
- package/studio/web/assets/{editor-qoo9CrGO.js → editor-DNcRHK54.js} +1 -1
- package/studio/web/assets/{html-Dt4IIy04.js → html-Bdssedlg.js} +1 -1
- package/studio/web/assets/{htmlMode-DXgKKr4C.js → htmlMode-CoDlJ3fw.js} +1 -1
- package/studio/web/assets/{index-6onkYFOG.js → index-D6sxmFLR.js} +5 -5
- package/studio/web/assets/{index.lazy-BrCFnpNJ.js → index.lazy-tmU5BS8s.js} +1 -1
- package/studio/web/assets/{javascript-DNCQGUBc.js → javascript-B8meVSTH.js} +1 -1
- package/studio/web/assets/{jsonMode-CR6HWruP.js → jsonMode-DpIPd35T.js} +1 -1
- package/studio/web/assets/{languageServices-BM4fI4rS.js → languageServices-C_5FMJzQ.js} +1 -1
- package/studio/web/assets/{lspLanguageFeatures-DSa1ttcD.js → lspLanguageFeatures-BIzNBzPK.js} +1 -1
- package/studio/web/assets/{notifications-BHXLnh6x.js → notifications-CQf18QKb.js} +1 -1
- package/studio/web/assets/{notifications-CUmtIA6z.js → notifications-CvZivSbh.js} +1 -1
- package/studio/web/assets/{profile-8BeFSF3j.js → profile-DdOwtntb.js} +1 -1
- package/studio/web/assets/{regions-C8qR0HhD.js → regions-n69fwagr.js} +1 -1
- package/studio/web/assets/{register-B4n5i0SD.js → register-PfWTCXWB.js} +2 -2
- package/studio/web/assets/{setComponentFile-g0_B0lgX.js → setComponentFile-Bg6O7X0S.js} +1 -1
- package/studio/web/assets/{setup-B0CTj_Q5.js → setup-CUx_aUDl.js} +2 -2
- package/studio/web/assets/{status-C6Yib7-K.js → status-D7BVKqX9.js} +1 -1
- package/studio/web/assets/{toggleHighContrast-Dgta7bVi.js → toggleHighContrast-DBSyXzMr.js} +1 -1
- package/studio/web/assets/{tsMode-CH_jHvU-.js → tsMode-BByKCjBS.js} +1 -1
- package/studio/web/assets/{typescript-Co9LCXd5.js → typescript-DDLnLpw9.js} +1 -1
- package/studio/web/assets/{useEntityRestURL-wKC8NsC_.js → useEntityRestURL-31CHGaHk.js} +1 -1
- package/studio/web/assets/{workers-CWeLxCXA.js → workers-pR3jRY9D.js} +1 -1
- package/studio/web/assets/{xml-BadC-0Rk.js → xml-2iRnMhQO.js} +1 -1
- package/studio/web/assets/{yaml-BiUfxPbC.js → yaml-Bf92gJpd.js} +1 -1
- package/studio/web/index.html +1 -1
- package/upgrade/directives/5-3-0.ts +132 -0
- package/upgrade/directives/directivesController.ts +2 -1
- package/utility/OperationFunctionCaller.ts +2 -1
- package/utility/common_utils.ts +30 -5
- package/utility/componentNames.ts +12 -0
- package/utility/environment/environmentManager.ts +3 -7
- package/utility/environment/systemInformation.ts +7 -0
- package/utility/errors/commonErrors.ts +4 -0
- package/utility/errors/hdbError.ts +29 -0
- package/utility/hdbTerms.ts +17 -0
- package/utility/logging/harper_logger.ts +87 -14
- package/utility/logging/logRotator.ts +72 -45
- package/utility/nodeIdentity.ts +45 -0
- package/utility/npmUtilities.ts +10 -8
- package/utility/operationPermissions.ts +18 -1
- package/utility/operation_authorization.ts +231 -42
- package/utility/watchPath.ts +63 -0
- package/utility/watcherFallback.ts +270 -0
- package/validation/configValidator.ts +209 -72
- package/validation/installValidator.ts +15 -0
- package/validation/validationWrapper.ts +18 -4
|
@@ -199,10 +199,35 @@ export class ResourceBridge extends BridgeMethods {
|
|
|
199
199
|
return this.upsertRecords(updateObj);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Create-or-replace: the stored record becomes exactly the submitted one, so an attribute the
|
|
204
|
+
* request omits is REMOVED rather than kept. `update`/`upsert` merge (`Table.patch`), which is the
|
|
205
|
+
* v4-compatible behaviour every existing client depends on and is why this is a separate operation
|
|
206
|
+
* rather than a flag on those. Equivalent to REST `PUT /Table/id` — same `Table.put`, so the same
|
|
207
|
+
* audit type, replication shape, and retained `__createdtime__`.
|
|
208
|
+
*/
|
|
209
|
+
async putRecords(putObj) {
|
|
210
|
+
return this.upsertRecords(putObj, true);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async upsertRecords(upsertObj, fullRecord = false) {
|
|
203
214
|
const { attributes } = insertUpdateValidate(upsertObj);
|
|
204
215
|
|
|
205
216
|
let new_attributes;
|
|
217
|
+
// `fullRecord` arrives as an ARGUMENT, never as a field on the request. Reading it off
|
|
218
|
+
// `upsertObj` would let a client send `full_record: true` with an `update` and get a replace —
|
|
219
|
+
// which makes the operation name stop describing the write, and bypasses the attribute-scoped
|
|
220
|
+
// `put` denial in `verifyPerms`, since that is keyed on the operation.
|
|
221
|
+
//
|
|
222
|
+
// Without it a write over an existing record merges (`Table.patch`), so an attribute the caller
|
|
223
|
+
// omitted keeps its stored value and `null` stores a null. That merge is the v4-compatible
|
|
224
|
+
// behaviour `update`/`upsert` must keep; HarperFast/studio#1643 is the removal case it cannot
|
|
225
|
+
// serve, and `put` is the operation that can.
|
|
226
|
+
//
|
|
227
|
+
// A put is also one operation where a client emulating removal needs two: the record is never
|
|
228
|
+
// absent between them, subscribers see a single write rather than a delete followed by an
|
|
229
|
+
// insert, and `__createdtime__` survives (`Table._writeUpdate` retains the stored created time
|
|
230
|
+
// on a full update and only stamps a new one for a new entry).
|
|
206
231
|
const Table = getDatabases()[upsertObj.schema][upsertObj.table];
|
|
207
232
|
const context: Context = {
|
|
208
233
|
user: upsertObj.hdb_user,
|
|
@@ -259,9 +284,14 @@ export class ResourceBridge extends BridgeMethods {
|
|
|
259
284
|
}
|
|
260
285
|
}
|
|
261
286
|
}
|
|
287
|
+
// Keyed on whether there IS a record to remove from, not on which operation asked. Guarding
|
|
288
|
+
// the insert flag alone left `upsert` with no primary key reaching the same silent partial
|
|
289
|
+
// write one branch over: `insertUpdateValidate` requires a hash attribute only for
|
|
290
|
+
// `update`, so such a record takes the `id == undefined → Table.create` path and stored an
|
|
291
|
+
// auto-keyed record with the named attributes stripped, returning 200.
|
|
262
292
|
await (id == undefined
|
|
263
293
|
? Table.create(record, context)
|
|
264
|
-
: existingRecord
|
|
294
|
+
: existingRecord && !fullRecord
|
|
265
295
|
? Table.patch(record, context)
|
|
266
296
|
: Table.put(record, context));
|
|
267
297
|
keys.push(record[Table.primaryKey]);
|
|
@@ -546,11 +576,12 @@ export class ResourceBridge extends BridgeMethods {
|
|
|
546
576
|
// get the history of each record
|
|
547
577
|
for (const id of readAuditLogObj.search_values) {
|
|
548
578
|
histories[id] = (await table.getHistoryOfRecord(id)).map((auditRecord) => {
|
|
549
|
-
let operation = auditRecord.operation
|
|
550
|
-
if (operation === 'put') operation = 'upsert';
|
|
579
|
+
let operation = normalizeHistoryOperation(auditRecord.operation, auditRecord.type);
|
|
551
580
|
return {
|
|
552
581
|
operation,
|
|
553
|
-
|
|
582
|
+
// the transaction's position in the log, which is what this field has always
|
|
583
|
+
// reported on RocksDB and what groups an atomic transaction (harper#2412)
|
|
584
|
+
timestamp: auditRecord.localTime,
|
|
554
585
|
user_name: auditRecord.user,
|
|
555
586
|
ids: [id],
|
|
556
587
|
records: [auditRecord.value],
|
|
@@ -745,9 +776,8 @@ async function* groupRecordsInHistory(table, start?, end?, limit?) {
|
|
|
745
776
|
let enqueued;
|
|
746
777
|
let count = 0;
|
|
747
778
|
for await (const entry of table.getHistory(start, end)) {
|
|
748
|
-
let operation = entry.operation
|
|
749
|
-
|
|
750
|
-
const { id, version: timestamp, value } = entry;
|
|
779
|
+
let operation = normalizeHistoryOperation(entry.operation, entry.type);
|
|
780
|
+
const { id, localTime: timestamp, value } = entry;
|
|
751
781
|
if (enqueued?.timestamp === timestamp) {
|
|
752
782
|
enqueued.ids.push(id);
|
|
753
783
|
enqueued.records.push(value);
|
|
@@ -771,3 +801,17 @@ async function* groupRecordsInHistory(table, start?, end?, limit?) {
|
|
|
771
801
|
}
|
|
772
802
|
if (enqueued) yield enqueued;
|
|
773
803
|
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Which operation a history entry should report: the originating operation when one was recorded,
|
|
807
|
+
* otherwise the physical write type.
|
|
808
|
+
*
|
|
809
|
+
* A recorded `put` is reported as `put`, so replication catch-up replays it as a replace. Only a
|
|
810
|
+
* LEGACY physical put — one with no originating operation, written before `put` existed — is still
|
|
811
|
+
* normalized to `upsert`, which is what produced a physical put back then. Normalizing both would
|
|
812
|
+
* make catch-up patch the replica and retain attributes the source removed.
|
|
813
|
+
*/
|
|
814
|
+
function normalizeHistoryOperation(originatingOperation, physicalType) {
|
|
815
|
+
if (originatingOperation !== undefined) return originatingOperation;
|
|
816
|
+
return physicalType === 'put' ? 'upsert' : physicalType;
|
|
817
|
+
}
|
|
@@ -8,11 +8,13 @@ class DeleteAuditLogsBeforeResults {
|
|
|
8
8
|
* @param {number} startTimestamp
|
|
9
9
|
* @param {number} endTimestamp
|
|
10
10
|
* @param {number} transactionsDeleted
|
|
11
|
+
* @param {number} logFilesDeleted
|
|
11
12
|
*/
|
|
12
|
-
constructor(startTimestamp = undefined, endTimestamp = undefined, transactionsDeleted = 0) {
|
|
13
|
+
constructor(startTimestamp = undefined, endTimestamp = undefined, transactionsDeleted = 0, logFilesDeleted = 0) {
|
|
13
14
|
this.start_timestamp = startTimestamp;
|
|
14
15
|
this.end_timestamp = endTimestamp;
|
|
15
16
|
this.transactions_deleted = transactionsDeleted;
|
|
17
|
+
this.log_files_deleted = logFilesDeleted;
|
|
16
18
|
this.deprecated = 'Please use delete_transaction_logs_before instead';
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -37,6 +37,37 @@ const DEFAULT_DATA_VERSION_NUM = '2.9.9';
|
|
|
37
37
|
// This value should change as supported versions change.
|
|
38
38
|
const MINIMUM_SUPPORTED_VERSION_NUM = '3.0.0';
|
|
39
39
|
|
|
40
|
+
export class VersionStampNotRecordedError extends Error {
|
|
41
|
+
statusCode: number;
|
|
42
|
+
constructor(message: string) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.name = 'VersionStampNotRecordedError';
|
|
45
|
+
this.statusCode = 500;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `insert.insert` reports a key that already exists as skipped, not as a failure, so a resolved
|
|
51
|
+
* insert is not evidence that the version was recorded. Ids compare as strings: the guard is
|
|
52
|
+
* against a write that did not happen, not against a hash returned in a different type.
|
|
53
|
+
*/
|
|
54
|
+
export function assertVersionRecorded(insertResult: any, expectedId: number, newVersionString: string) {
|
|
55
|
+
const insertedHashes = insertResult?.inserted_hashes;
|
|
56
|
+
if (
|
|
57
|
+
Array.isArray(insertedHashes) &&
|
|
58
|
+
insertedHashes.length === 1 &&
|
|
59
|
+
String(insertedHashes[0]) === String(expectedId)
|
|
60
|
+
) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
throw new VersionStampNotRecordedError(
|
|
65
|
+
`Could not record data version ${newVersionString} in '${hdbTerms.SYSTEM_SCHEMA_NAME}.${hdbTerms.SYSTEM_TABLE_NAMES.INFO_TABLE_NAME}': ` +
|
|
66
|
+
`the insert of ${HDB_INFO_SEARCH_ATTRIBUTE} ${expectedId} reported inserted ${JSON.stringify(insertedHashes ?? null)} ` +
|
|
67
|
+
`and skipped ${JSON.stringify(insertResult?.skipped_hashes ?? null)}`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
40
71
|
/**
|
|
41
72
|
* * Insert a row into hdbInfo with the initial version data at install.
|
|
42
73
|
*
|
|
@@ -91,7 +122,9 @@ export async function insertHdbUpgradeInfo(newVersionString: string) {
|
|
|
91
122
|
);
|
|
92
123
|
|
|
93
124
|
await pSetSchemaDataToGlobal();
|
|
94
|
-
|
|
125
|
+
const insertResult = await insert.insert(insertObject);
|
|
126
|
+
assertVersionRecorded(insertResult, newId, newVersionString);
|
|
127
|
+
return insertResult;
|
|
95
128
|
}
|
|
96
129
|
|
|
97
130
|
/**
|
package/dataLayer/insert.ts
CHANGED
|
@@ -21,6 +21,7 @@ const pGlobalSchema = util.promisify(globalSchema.getTableSchema);
|
|
|
21
21
|
const UPDATE_ACTION = 'updated';
|
|
22
22
|
const INSERT_ACTION = 'inserted';
|
|
23
23
|
const UPSERT_ACTION = 'upserted';
|
|
24
|
+
const PUT_ACTION = 'put';
|
|
24
25
|
|
|
25
26
|
//IMPORTANT - This validation function is the async version of the code in harperBridge/bridgeUtility/insertUpdateValidate.js
|
|
26
27
|
// make sure any changes below are also made there. This is to resolve a circular dependency.
|
|
@@ -218,6 +219,42 @@ async function upsertData(upsertObject: any) {
|
|
|
218
219
|
);
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Create-or-replace the records in the putObject parameter: the stored record becomes exactly the
|
|
224
|
+
* submitted one, so an attribute the request omits is removed. `update`/`upsert` merge instead, and
|
|
225
|
+
* must keep doing so for v4 compatibility — hence a distinct operation rather than a flag on those.
|
|
226
|
+
* Equivalent to REST `PUT /Table/id`.
|
|
227
|
+
* @param putObject - Represents the data that will be written
|
|
228
|
+
*/
|
|
229
|
+
async function putData(putObject: any) {
|
|
230
|
+
if (putObject.operation !== 'put') {
|
|
231
|
+
throw handleHDBError(new Error(), 'invalid operation, must be put', HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
let validator = insertValidator(putObject);
|
|
235
|
+
if (validator) {
|
|
236
|
+
throw handleHDBError(new Error(), validator.message, HTTP_STATUS_CODES.BAD_REQUEST);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
hdbUtils.transformReq(putObject);
|
|
240
|
+
|
|
241
|
+
let invalidSchemaTableMsg = hdbUtils.checkSchemaTableExist(putObject.schema, putObject.table);
|
|
242
|
+
if (invalidSchemaTableMsg) {
|
|
243
|
+
throw handleHDBError(new Error(), invalidSchemaTableMsg, HTTP_STATUS_CODES.BAD_REQUEST);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
let bridgePutResult = await harperBridge.putRecords(putObject);
|
|
247
|
+
|
|
248
|
+
return returnObject(
|
|
249
|
+
PUT_ACTION,
|
|
250
|
+
bridgePutResult.written_hashes,
|
|
251
|
+
putObject,
|
|
252
|
+
[],
|
|
253
|
+
bridgePutResult.new_attributes,
|
|
254
|
+
bridgePutResult.txn_time
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
221
258
|
/**
|
|
222
259
|
* Constructs return object for insert, update, and upsert.
|
|
223
260
|
* @param action
|
|
@@ -254,6 +291,12 @@ function returnObject(
|
|
|
254
291
|
return return_object;
|
|
255
292
|
}
|
|
256
293
|
|
|
294
|
+
if (action === PUT_ACTION) {
|
|
295
|
+
// `put` never skips: every submitted record is written, created or replaced.
|
|
296
|
+
return_object.put_hashes = written_hashes;
|
|
297
|
+
return return_object;
|
|
298
|
+
}
|
|
299
|
+
|
|
257
300
|
return_object.update_hashes = written_hashes;
|
|
258
301
|
return_object.skipped_hashes = skipped;
|
|
259
302
|
return return_object;
|
|
@@ -263,4 +306,4 @@ export function flush(object: any) {
|
|
|
263
306
|
hdbUtils.transformReq(object);
|
|
264
307
|
return harperBridge.flush(object.schema, object.table);
|
|
265
308
|
}
|
|
266
|
-
export { insertData as insert, updateData as update, upsertData as upsert };
|
|
309
|
+
export { insertData as insert, updateData as update, upsertData as upsert, putData as put };
|
|
@@ -10,7 +10,13 @@ import { setTimeout as delay } from 'node:timers/promises';
|
|
|
10
10
|
import { pack as tarPack, type Pack } from 'tar-stream';
|
|
11
11
|
import { RocksDatabase, backups, registryStatus, type BackupInfo } from '@harperfast/rocksdb-js';
|
|
12
12
|
import { getDatabases, resolveDatabasePath } from '../resources/databases.ts';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
type BlobCaptureDisposition,
|
|
15
|
+
classifyBlobFileForCapture,
|
|
16
|
+
createCaptureMarker,
|
|
17
|
+
getBlobPathsForDatabaseName,
|
|
18
|
+
isSystemicIoError,
|
|
19
|
+
} from '../resources/blob.ts';
|
|
14
20
|
import { getHdbBasePath } from '../utility/environment/environmentManager.ts';
|
|
15
21
|
import { getConfigPath } from '../config/configUtils.ts';
|
|
16
22
|
import { getBackupDirPath } from '../config/configHelpers.ts';
|
|
@@ -677,8 +683,8 @@ function isRocksDbLockError(error: any): boolean {
|
|
|
677
683
|
*
|
|
678
684
|
* With blobs included (the default; `excludeBlobs` opts out), the database's file-backed blob roots
|
|
679
685
|
* are appended to the same archive under `blobs/<rootIndex>/<relpath>` so a downloaded backup is a
|
|
680
|
-
* complete Harper database.
|
|
681
|
-
*
|
|
686
|
+
* complete Harper database. Each enumerated blob is classified before capture; one that is incomplete
|
|
687
|
+
* or vanishes before it can be opened is represented by a PENDING or ERROR marker at the same path.
|
|
682
688
|
*/
|
|
683
689
|
export function createBackupStream(
|
|
684
690
|
rootStore: RocksDatabase,
|
|
@@ -748,7 +754,7 @@ async function streamBackupWithBlobs(
|
|
|
748
754
|
await appendBlobEntries(pack, blobRoots);
|
|
749
755
|
// generate the same self-documenting READMEs a managed backup writes to disk, on the fly
|
|
750
756
|
await addTextEntry(pack, 'README.md', streamedBackupReadme(databaseName));
|
|
751
|
-
await addTextEntry(pack, 'blobs/README.md', blobsReadmeContent(blobRoots, {
|
|
757
|
+
await addTextEntry(pack, 'blobs/README.md', blobsReadmeContent(blobRoots, { variant: 'archive' }));
|
|
752
758
|
pack.finalize();
|
|
753
759
|
await packed;
|
|
754
760
|
await consumed;
|
|
@@ -808,8 +814,8 @@ function writeWithBackpressure(dest: PassThrough, chunk: Buffer): Promise<void>
|
|
|
808
814
|
|
|
809
815
|
/**
|
|
810
816
|
* Append every blob file under the given blob roots to `pack` as `blobs/<rootIndex>/<relpath>`
|
|
811
|
-
* entries.
|
|
812
|
-
*
|
|
817
|
+
* entries. Complete files are streamed at the size captured on open; files that cannot be captured
|
|
818
|
+
* whole are represented by markers, and repair temporaries are omitted.
|
|
813
819
|
*/
|
|
814
820
|
async function appendBlobEntries(pack: Pack, blobRoots: string[]): Promise<void> {
|
|
815
821
|
for (let index = 0; index < blobRoots.length; index++) {
|
|
@@ -833,20 +839,56 @@ async function appendBlobEntries(pack: Pack, blobRoots: string[]): Promise<void>
|
|
|
833
839
|
// tar entry names are always POSIX-separated; relative() yields `\` on Windows, which
|
|
834
840
|
// would otherwise become literal filename characters when extracted on POSIX
|
|
835
841
|
const relativePath = relative(root, filePath).split(sep).join('/');
|
|
836
|
-
await
|
|
842
|
+
await appendBlobEntry(pack, filePath, `blobs/${index}/${relativePath}`);
|
|
837
843
|
}
|
|
838
844
|
}
|
|
839
845
|
}
|
|
840
846
|
}
|
|
841
847
|
}
|
|
842
848
|
|
|
843
|
-
/**
|
|
844
|
-
|
|
849
|
+
/**
|
|
850
|
+
* Add one blob to the pack, applying the same capture rule as the managed snapshot
|
|
851
|
+
* (`classifyBlobFileForCapture`): a blob still being written would otherwise be archived truncated,
|
|
852
|
+
* so it is packed as a PENDING marker, which also keeps its file id reserved on extraction.
|
|
853
|
+
*/
|
|
854
|
+
async function appendBlobEntry(pack: Pack, filePath: string, name: string): Promise<void> {
|
|
855
|
+
let disposition: BlobCaptureDisposition;
|
|
856
|
+
try {
|
|
857
|
+
disposition = await classifyBlobFileForCapture(filePath);
|
|
858
|
+
} catch (error) {
|
|
859
|
+
if (isSystemicIoError(error)) throw error; // unverified, as on the snapshot path
|
|
860
|
+
// As on the snapshot path: a read failure is not evidence the bytes are bad, so fall back to the
|
|
861
|
+
// pre-classification behavior rather than downgrading a valid blob to a stub.
|
|
862
|
+
logger.warn(`Could not verify blob ${filePath} for the backup archive; packing it unverified`, error);
|
|
863
|
+
disposition = 'capture';
|
|
864
|
+
}
|
|
865
|
+
if (disposition === 'skip') return;
|
|
866
|
+
if (disposition === 'capture') {
|
|
867
|
+
if (await appendBlobFile(pack, filePath, name)) return;
|
|
868
|
+
disposition = 'gone';
|
|
869
|
+
}
|
|
870
|
+
const marker = createCaptureMarker(
|
|
871
|
+
disposition,
|
|
872
|
+
disposition === 'gone'
|
|
873
|
+
? 'blob was deleted while this archive was being built'
|
|
874
|
+
: 'blob was not yet complete when this archive was built'
|
|
875
|
+
);
|
|
876
|
+
await new Promise<void>((resolvePromise, reject) => {
|
|
877
|
+
const entry = pack.entry({ name, size: marker.length }, (error) => (error ? reject(error) : resolvePromise()));
|
|
878
|
+
entry.end(marker);
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Add a single file to the pack, streaming exactly the byte count captured at open time. Returns false
|
|
884
|
+
* if it vanished first, so the caller can still reserve its id.
|
|
885
|
+
*/
|
|
886
|
+
async function appendBlobFile(pack: Pack, filePath: string, name: string): Promise<boolean> {
|
|
845
887
|
let handle;
|
|
846
888
|
try {
|
|
847
889
|
handle = await open(filePath, 'r');
|
|
848
890
|
} catch (error: any) {
|
|
849
|
-
if (error.code === 'ENOENT') return;
|
|
891
|
+
if (error.code === 'ENOENT') return false;
|
|
850
892
|
throw error;
|
|
851
893
|
}
|
|
852
894
|
try {
|
|
@@ -866,6 +908,7 @@ async function appendBlobFile(pack: Pack, filePath: string, name: string): Promi
|
|
|
866
908
|
} finally {
|
|
867
909
|
await handle.close();
|
|
868
910
|
}
|
|
911
|
+
return true;
|
|
869
912
|
}
|
|
870
913
|
|
|
871
914
|
/** Add an in-memory string to the pack as a single tar entry (used for the generated READMEs). */
|
package/dataLayer/schema.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { handleHDBError, ClientError } from '../utility/errors/hdbError.ts';
|
|
|
14
14
|
import { HDB_ERROR_MSGS, HTTP_STATUS_CODES } from '../utility/errors/commonErrors.ts';
|
|
15
15
|
|
|
16
16
|
import { SchemaEventMsg } from '../server/threads/itc.js';
|
|
17
|
-
import { getDatabases, dropTableMeta } from '../resources/databases.ts';
|
|
17
|
+
import { getDatabases, dropTableMeta, isBranchIdentity } from '../resources/databases.ts';
|
|
18
18
|
import { transformReq } from '../utility/common_utils.ts';
|
|
19
19
|
import { server } from '../server/Server.ts';
|
|
20
20
|
import { cleanupOrphans } from '../resources/blob.ts';
|
|
@@ -81,6 +81,16 @@ export async function createSchemaStructure(schemaCreateObject: any) {
|
|
|
81
81
|
if (validation) throw new ClientError(validation.message);
|
|
82
82
|
|
|
83
83
|
transformReq(schemaCreateObject);
|
|
84
|
+
// After the normalization, because that is what settles which of `database`/`schema` names the
|
|
85
|
+
// database being created. The same refusal schema authoring makes in `table()`: a branch resolves
|
|
86
|
+
// its blob root from its store identity, so a database under that name shares the root -- two
|
|
87
|
+
// allocators minting the same file paths, and `drop_database` deleting the branch's blobs
|
|
88
|
+
// (harper#644).
|
|
89
|
+
if (isBranchIdentity(schemaCreateObject.schema)) {
|
|
90
|
+
throw new ClientError(
|
|
91
|
+
`'${schemaCreateObject.schema}' is in use as a branch store identity and cannot be a database name`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
84
94
|
|
|
85
95
|
if (!(await schemaMetadataValidator.checkSchemaExists(schemaCreateObject.schema))) {
|
|
86
96
|
throw handleHDBError(
|
|
@@ -215,7 +215,7 @@ async function descTable(describeTableObject: any, attrPerms?: any) {
|
|
|
215
215
|
// `getRecordCount` scans the table's primary store, which dominates describe latency on large
|
|
216
216
|
// tables -- and `describe_all` pays it serially for every table. Callers that only need schema
|
|
217
217
|
// /metadata can pass `skip_record_count: true` to omit the scan and fetch the count separately
|
|
218
|
-
// (e.g. asynchronously). The remaining stats below are
|
|
218
|
+
// (e.g. asynchronously). The remaining stats below are all small per-table storage reads.
|
|
219
219
|
if (!describeTableObject.skip_record_count) {
|
|
220
220
|
const recordCount = await tableObj.getRecordCount({ exactCount: !!describeTableObject.exact_count });
|
|
221
221
|
tableResult.record_count = recordCount.recordCount;
|
|
@@ -223,6 +223,13 @@ async function descTable(describeTableObject: any, attrPerms?: any) {
|
|
|
223
223
|
}
|
|
224
224
|
tableResult.table_size = tableObj.getSize();
|
|
225
225
|
tableResult.db_audit_size = tableObj.getAuditSize();
|
|
226
|
+
const structureCounts = tableObj.getStructureCounts?.();
|
|
227
|
+
if (structureCounts) {
|
|
228
|
+
tableResult.typed_structures_enabled = structureCounts.typedEnabled;
|
|
229
|
+
tableResult.typed_structure_count = structureCounts.typed;
|
|
230
|
+
tableResult.typed_structure_limit = structureCounts.typedLimit;
|
|
231
|
+
tableResult.classic_structure_count = structureCounts.classic;
|
|
232
|
+
}
|
|
226
233
|
let auditStore = tableObj.auditStore;
|
|
227
234
|
if (auditStore) {
|
|
228
235
|
for (let key of auditStore.getKeys({ reverse: true, limit: 1 })) {
|
package/dist/agent/mcpTools.js
CHANGED
|
@@ -50,7 +50,7 @@ const AGENT_MCP_TOOLS = {
|
|
|
50
50
|
readOnly: true,
|
|
51
51
|
},
|
|
52
52
|
list_agent_sessions: {
|
|
53
|
-
description: 'List built-in-agent sessions, most
|
|
53
|
+
description: 'List built-in-agent sessions, most recently updated first.',
|
|
54
54
|
inputSchema: {
|
|
55
55
|
type: 'object',
|
|
56
56
|
properties: { limit: { type: 'integer', minimum: 1, description: 'Max sessions to return (default 100).' } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpTools.js","sourceRoot":"","sources":["../../agent/mcpTools.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;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C,IAAI,CAAC;SACvC,CAAC,CAAC;QACH,KAAK,EAAE,CAAC;IACT,CAAC;IACD,GAAG,CAAC,IAAI,EAAE,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/agent/session.d.ts
CHANGED
|
@@ -9,6 +9,28 @@
|
|
|
9
9
|
* table is server-local and operator-owned.
|
|
10
10
|
*/
|
|
11
11
|
import type { AgentMessage, AgentRunStatus, AgentSessionRow, ApprovalRequest } from './types.ts';
|
|
12
|
+
/** `listSessions` sorts on `updatedAt`, which Table.search serves only from an index. */
|
|
13
|
+
export declare const AGENT_SESSION_ATTRIBUTES: ({
|
|
14
|
+
name: string;
|
|
15
|
+
isPrimaryKey: boolean;
|
|
16
|
+
type?: undefined;
|
|
17
|
+
indexed?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
indexed: boolean;
|
|
22
|
+
isPrimaryKey?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
name: string;
|
|
25
|
+
isPrimaryKey?: undefined;
|
|
26
|
+
type?: undefined;
|
|
27
|
+
indexed?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
isPrimaryKey?: undefined;
|
|
32
|
+
indexed?: undefined;
|
|
33
|
+
})[];
|
|
12
34
|
export declare function getAgentSessionTable(): any;
|
|
13
35
|
export interface CreateSessionOpts {
|
|
14
36
|
sessionId?: string;
|
package/dist/agent/session.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* table is server-local and operator-owned.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AGENT_SESSION_ATTRIBUTES = void 0;
|
|
13
14
|
exports.getAgentSessionTable = getAgentSessionTable;
|
|
14
15
|
exports.createSession = createSession;
|
|
15
16
|
exports.getSession = getSession;
|
|
@@ -25,6 +26,19 @@ const node_crypto_1 = require("node:crypto");
|
|
|
25
26
|
const databases_ts_1 = require("../resources/databases.js");
|
|
26
27
|
const hdbTerms_ts_1 = require("../utility/hdbTerms.js");
|
|
27
28
|
let cachedTable;
|
|
29
|
+
/** `listSessions` sorts on `updatedAt`, which Table.search serves only from an index. */
|
|
30
|
+
exports.AGENT_SESSION_ATTRIBUTES = [
|
|
31
|
+
{ name: 'session_id', isPrimaryKey: true },
|
|
32
|
+
{ name: 'user', type: 'string', indexed: true },
|
|
33
|
+
{ name: 'status', type: 'string', indexed: true },
|
|
34
|
+
{ name: 'messages' },
|
|
35
|
+
{ name: 'pendingApprovals' },
|
|
36
|
+
{ name: 'model', type: 'string' },
|
|
37
|
+
{ name: 'provider', type: 'string' },
|
|
38
|
+
{ name: 'createdAt', type: 'number', indexed: true },
|
|
39
|
+
{ name: 'updatedAt', type: 'number', indexed: true },
|
|
40
|
+
{ name: 'lastError', type: 'string' },
|
|
41
|
+
];
|
|
28
42
|
function getAgentSessionTable() {
|
|
29
43
|
if (cachedTable)
|
|
30
44
|
return cachedTable;
|
|
@@ -33,18 +47,7 @@ function getAgentSessionTable() {
|
|
|
33
47
|
database: hdbTerms_ts_1.SYSTEM_SCHEMA_NAME,
|
|
34
48
|
audit: true,
|
|
35
49
|
trackDeletes: false,
|
|
36
|
-
attributes:
|
|
37
|
-
{ name: 'session_id', isPrimaryKey: true },
|
|
38
|
-
{ name: 'user', type: 'string', indexed: true },
|
|
39
|
-
{ name: 'status', type: 'string', indexed: true },
|
|
40
|
-
{ name: 'messages' },
|
|
41
|
-
{ name: 'pendingApprovals' },
|
|
42
|
-
{ name: 'model', type: 'string' },
|
|
43
|
-
{ name: 'provider', type: 'string' },
|
|
44
|
-
{ name: 'createdAt', type: 'number', indexed: true },
|
|
45
|
-
{ name: 'updatedAt', type: 'number', indexed: true },
|
|
46
|
-
{ name: 'lastError', type: 'string' },
|
|
47
|
-
],
|
|
50
|
+
attributes: exports.AGENT_SESSION_ATTRIBUTES,
|
|
48
51
|
});
|
|
49
52
|
return cachedTable;
|
|
50
53
|
}
|
|
@@ -76,9 +79,17 @@ async function getSession(sessionId) {
|
|
|
76
79
|
async function listSessions(opts = {}) {
|
|
77
80
|
const limit = opts.limit ?? 100;
|
|
78
81
|
const out = [];
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
// Sort with no conditions on purpose: Table.search pushes an order-aligned pseudo-condition when
|
|
83
|
+
// the sort attribute is indexed, and throws 404 when it is not. Adding a `updatedAt > 0` sentinel
|
|
84
|
+
// to force the index would make conditions non-empty, so losing `indexed` on the attribute would
|
|
85
|
+
// silently degrade to decoding every session (full transcripts) and sorting in memory instead of
|
|
86
|
+
// failing. The sentinel would also drop rows whose updatedAt is absent or 0.
|
|
87
|
+
for await (const row of getAgentSessionTable().search({
|
|
88
|
+
sort: { attribute: 'updatedAt', descending: true },
|
|
89
|
+
limit,
|
|
90
|
+
})) {
|
|
91
|
+
if (row != null)
|
|
92
|
+
out.push(row);
|
|
82
93
|
}
|
|
83
94
|
return out;
|
|
84
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../agent/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../agent/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAuBH,oDAUC;AAUD,sCAqBC;AAED,gCAEC;AAED,oCAeC;AAsBD,sCAQC;AAED,8BASC;AAED,gDAaC;AAED,oDAWC;AAED,0CAmBC;AAeD,wCAEC;AAGD,8CAEC;AAnMD,6CAAyC;AACzC,4DAAkD;AAClD,wDAAgF;AAGhF,IAAI,WAAgB,CAAC;AAErB,yFAAyF;AAC5E,QAAA,wBAAwB,GAAG;IACvC,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE;IAC1C,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ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