@harperfast/harper 5.0.0-alpha.10 → 5.0.0-beta.3
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/bin/BinObjects.js +17 -0
- package/bin/cliOperations.js +157 -0
- package/bin/copyDb.ts +280 -0
- package/bin/harper.js +156 -0
- package/bin/install.js +15 -0
- package/bin/lite.js +5 -0
- package/bin/restart.js +201 -0
- package/bin/run.js +409 -0
- package/bin/status.js +65 -0
- package/bin/stop.js +22 -0
- package/bin/upgrade.js +134 -0
- package/components/Application.ts +646 -0
- package/components/ApplicationScope.ts +49 -0
- package/components/Component.ts +53 -0
- package/components/ComponentV1.ts +342 -0
- package/components/DEFAULT_CONFIG.ts +18 -0
- package/components/EntryHandler.ts +227 -0
- package/components/Logger.ts +14 -0
- package/components/OptionsWatcher.ts +354 -0
- package/components/PluginModule.ts +6 -0
- package/components/Scope.ts +329 -0
- package/components/componentLoader.ts +529 -0
- package/components/deriveCommonPatternBase.ts +31 -0
- package/components/deriveGlobOptions.ts +44 -0
- package/components/deriveURLPath.ts +57 -0
- package/components/operations.js +658 -0
- package/components/operationsValidation.js +246 -0
- package/components/packageComponent.ts +39 -0
- package/components/requestRestart.ts +26 -0
- package/components/resolveBaseURLPath.ts +38 -0
- package/components/status/ComponentStatus.ts +110 -0
- package/components/status/ComponentStatusRegistry.ts +251 -0
- package/components/status/api.ts +153 -0
- package/components/status/crossThread.ts +405 -0
- package/components/status/errors.ts +152 -0
- package/components/status/index.ts +44 -0
- package/components/status/internal.ts +65 -0
- package/components/status/registry.ts +12 -0
- package/components/status/types.ts +96 -0
- package/config/RootConfigWatcher.ts +59 -0
- package/config/configHelpers.ts +11 -0
- package/config/configUtils.js +967 -0
- package/config/harperConfigEnvVars.ts +641 -0
- package/dataLayer/CreateAttributeObject.js +25 -0
- package/dataLayer/CreateTableObject.js +11 -0
- package/dataLayer/DataLayerObjects.js +43 -0
- package/dataLayer/DeleteBeforeObject.js +22 -0
- package/dataLayer/DeleteObject.js +25 -0
- package/dataLayer/DropAttributeObject.js +11 -0
- package/dataLayer/GetBackupObject.js +22 -0
- package/dataLayer/InsertObject.js +24 -0
- package/dataLayer/ReadAuditLogObject.js +24 -0
- package/dataLayer/SQLSearch.js +1335 -0
- package/dataLayer/SearchByConditionsObject.js +61 -0
- package/dataLayer/SearchByHashObject.js +21 -0
- package/dataLayer/SearchObject.js +45 -0
- package/dataLayer/SqlSearchObject.js +14 -0
- package/dataLayer/UpdateObject.js +23 -0
- package/dataLayer/UpsertObject.js +23 -0
- package/dataLayer/bulkLoad.js +813 -0
- package/dataLayer/dataObjects/BulkLoadObjects.js +27 -0
- package/dataLayer/dataObjects/UpsertObject.js +23 -0
- package/dataLayer/delete.js +164 -0
- package/dataLayer/export.js +381 -0
- package/dataLayer/getBackup.js +40 -0
- package/dataLayer/harperBridge/BridgeMethods.js +81 -0
- package/dataLayer/harperBridge/ResourceBridge.ts +633 -0
- package/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.js +28 -0
- package/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +88 -0
- package/dataLayer/harperBridge/harperBridge.js +21 -0
- package/dataLayer/harperBridge/lmdbBridge/LMDBBridge.js +119 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +19 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +112 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +67 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +31 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +94 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +98 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +89 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +109 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +107 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +137 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +35 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +111 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +28 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +29 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +207 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +156 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +21 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +30 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.js +19 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +64 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +70 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +22 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.js +23 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.js +22 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.js +23 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.js +24 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.js +24 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js +25 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +21 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +157 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +94 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +39 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +34 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +100 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +371 -0
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +109 -0
- package/dataLayer/hdbInfoController.js +254 -0
- package/dataLayer/insert.js +266 -0
- package/dataLayer/readAuditLog.js +59 -0
- package/dataLayer/schema.js +366 -0
- package/dataLayer/schemaDescribe.js +289 -0
- package/dataLayer/search.js +60 -0
- package/dataLayer/transaction.js +17 -0
- package/dataLayer/update.js +124 -0
- package/dist/components/Logger.d.ts +12 -0
- package/dist/{resources/ResourceInterfaceV2.js → components/Logger.js} +1 -1
- package/dist/components/Logger.js.map +1 -0
- package/dist/components/Scope.d.ts +14 -4
- package/dist/components/Scope.js +18 -10
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/componentLoader.js +17 -10
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/operations.js +2 -2
- package/dist/components/operations.js.map +1 -1
- package/dist/config/configUtils.d.ts +1 -1
- package/dist/config/configUtils.js +1 -1
- package/dist/config/configUtils.js.map +1 -1
- package/dist/dataLayer/CreateTableObject.d.ts +2 -2
- package/dist/dataLayer/CreateTableObject.js +2 -2
- package/dist/dataLayer/CreateTableObject.js.map +1 -1
- package/dist/dataLayer/delete.d.ts +1 -1
- package/dist/dataLayer/schema.js +6 -5
- package/dist/dataLayer/schema.js.map +1 -1
- package/dist/dataLayer/schemaDescribe.js +1 -1
- package/dist/dataLayer/schemaDescribe.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/DatabaseTransaction.d.ts +1 -1
- package/dist/resources/IterableEventQueue.d.ts +1 -1
- package/dist/resources/LMDBTransaction.d.ts +5 -1
- package/dist/resources/Resource.d.ts +1 -1
- package/dist/resources/ResourceInterface.d.ts +1 -1
- package/dist/resources/RocksIndexStore.d.ts +3 -3
- package/dist/resources/RocksTransactionLogStore.d.ts +6 -3
- package/dist/resources/Table.d.ts +15 -6
- package/dist/resources/Table.js +12 -4
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/analytics/read.js +32 -22
- package/dist/resources/analytics/read.js.map +1 -1
- package/dist/resources/analytics/write.js +3 -6
- package/dist/resources/analytics/write.js.map +1 -1
- package/dist/resources/auditStore.d.ts +3 -3
- package/dist/resources/blob.d.ts +25 -2
- package/dist/resources/databases.d.ts +12 -2
- package/dist/resources/databases.js +22 -19
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/search.js +11 -5
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/transaction.d.ts +2 -1
- package/dist/security/auth.js +1 -1
- package/dist/security/auth.js.map +1 -1
- package/dist/security/cryptoHash.d.ts +2 -2
- package/dist/security/jsLoader.js +265 -73
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/security/keys.js +11 -12
- package/dist/security/keys.js.map +1 -1
- package/dist/security/user.js +3 -3
- package/dist/security/user.js.map +1 -1
- package/dist/server/REST.js +16 -2
- package/dist/server/REST.js.map +1 -1
- package/dist/server/Server.d.ts +2 -1
- package/dist/server/Server.js.map +1 -1
- package/dist/server/fastifyRoutes/plugins/hdbCore.d.ts +6 -1
- package/dist/server/fastifyRoutes.js +2 -0
- package/dist/server/fastifyRoutes.js.map +1 -1
- package/dist/server/http.js +12 -6
- package/dist/server/http.js.map +1 -1
- package/dist/server/jobs/JobObject.d.ts +3 -3
- package/dist/server/loadRootComponents.js +1 -0
- package/dist/server/loadRootComponents.js.map +1 -1
- package/dist/server/operationsServer.js +3 -1
- package/dist/server/operationsServer.js.map +1 -1
- package/dist/server/serverHelpers/JSONStream.d.ts +3 -3
- package/dist/server/serverHelpers/Request.d.ts +5 -5
- package/dist/server/serverHelpers/requestTimePlugin.d.ts +1 -1
- package/dist/server/threads/manageThreads.d.ts +2 -2
- package/dist/server/threads/manageThreads.js +52 -35
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/socketRouter.d.ts +1 -1
- package/dist/sqlTranslator/deleteTranslator.d.ts +1 -1
- package/dist/utility/AWS/AWSConnector.d.ts +3 -2
- package/dist/utility/common_utils.d.ts +3 -3
- package/dist/utility/environment/systemInformation.d.ts +1 -0
- package/dist/utility/functions/date/dateFunctions.d.ts +11 -11
- package/dist/utility/globalSchema.d.ts +1 -1
- package/dist/utility/hdbTerms.d.ts +3 -0
- package/dist/utility/hdbTerms.js +3 -0
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/installation.d.ts +2 -4
- package/dist/utility/installation.js.map +1 -1
- package/dist/utility/lmdb/commonUtility.d.ts +2 -1
- package/dist/utility/lmdb/commonUtility.js +20 -13
- package/dist/utility/lmdb/commonUtility.js.map +1 -1
- package/dist/utility/lmdb/deleteUtility.d.ts +1 -0
- package/dist/utility/lmdb/environmentUtility.d.ts +1 -0
- package/dist/utility/lmdb/searchUtility.d.ts +2 -1
- package/dist/utility/lmdb/writeUtility.d.ts +1 -0
- package/dist/utility/logging/harper_logger.d.ts +6 -6
- package/dist/utility/processManagement/processManagement.d.ts +1 -1
- package/dist/utility/processManagement/servicesConfig.d.ts +12 -6
- package/dist/validation/common_validators.d.ts +4 -3
- package/dist/validation/configValidator.d.ts +3 -2
- package/index.d.ts +56 -0
- package/index.js +41 -0
- package/json/systemSchema.json +373 -0
- package/launchServiceScripts/launchHarperDB.js +3 -0
- package/launchServiceScripts/utility/checkNodeVersion.js +15 -0
- package/package.json +35 -16
- package/resources/DatabaseTransaction.ts +378 -0
- package/resources/ErrorResource.ts +57 -0
- package/resources/IterableEventQueue.ts +94 -0
- package/resources/LMDBTransaction.ts +349 -0
- package/resources/RecordEncoder.ts +702 -0
- package/resources/RequestTarget.ts +134 -0
- package/resources/Resource.ts +789 -0
- package/resources/ResourceInterface.ts +221 -0
- package/resources/Resources.ts +162 -0
- package/resources/RocksIndexStore.ts +70 -0
- package/resources/RocksTransactionLogStore.ts +352 -0
- package/resources/Table.ts +4531 -0
- package/resources/analytics/hostnames.ts +72 -0
- package/resources/analytics/metadata.ts +10 -0
- package/resources/analytics/read.ts +252 -0
- package/resources/analytics/write.ts +803 -0
- package/resources/auditStore.ts +556 -0
- package/resources/blob.ts +1268 -0
- package/resources/crdt.ts +125 -0
- package/resources/dataLoader.ts +527 -0
- package/resources/databases.ts +1290 -0
- package/resources/graphql.ts +221 -0
- package/resources/indexes/HierarchicalNavigableSmallWorld.ts +638 -0
- package/resources/indexes/customIndexes.ts +7 -0
- package/resources/indexes/vector.ts +38 -0
- package/resources/jsResource.ts +86 -0
- package/resources/loadEnv.ts +22 -0
- package/resources/login.ts +18 -0
- package/resources/openApi.ts +409 -0
- package/resources/registrationDeprecated.ts +8 -0
- package/resources/replayLogs.ts +136 -0
- package/resources/roles.ts +98 -0
- package/resources/search.ts +1301 -0
- package/resources/tracked.ts +584 -0
- package/resources/transaction.ts +89 -0
- package/resources/transactionBroadcast.ts +258 -0
- package/security/auth.ts +376 -0
- package/security/certificateVerification/certificateVerificationSource.ts +84 -0
- package/security/certificateVerification/configValidation.ts +107 -0
- package/security/certificateVerification/crlVerification.ts +623 -0
- package/security/certificateVerification/index.ts +121 -0
- package/security/certificateVerification/ocspVerification.ts +148 -0
- package/security/certificateVerification/pkijs-ed25519-patch.ts +188 -0
- package/security/certificateVerification/types.ts +128 -0
- package/security/certificateVerification/verificationConfig.ts +138 -0
- package/security/certificateVerification/verificationUtils.ts +447 -0
- package/security/cryptoHash.js +42 -0
- package/security/data_objects/PermissionAttributeResponseObject.js +15 -0
- package/security/data_objects/PermissionResponseObject.js +115 -0
- package/security/data_objects/PermissionTableResponseObject.js +20 -0
- package/security/fastifyAuth.js +169 -0
- package/security/impersonation.ts +160 -0
- package/security/jsLoader.ts +733 -0
- package/security/keys.js +948 -0
- package/security/permissionsTranslator.js +300 -0
- package/security/role.js +218 -0
- package/security/tokenAuthentication.ts +228 -0
- package/security/user.ts +449 -0
- package/server/DurableSubscriptionsSession.ts +503 -0
- package/server/REST.ts +407 -0
- package/server/Server.ts +89 -0
- package/server/fastifyRoutes/helpers/getCORSOptions.js +36 -0
- package/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +15 -0
- package/server/fastifyRoutes/helpers/getServerOptions.js +33 -0
- package/server/fastifyRoutes/plugins/hdbCore.js +39 -0
- package/server/fastifyRoutes.ts +205 -0
- package/server/graphqlQuerying.ts +700 -0
- package/server/http.ts +640 -0
- package/server/itc/serverHandlers.js +161 -0
- package/server/itc/utility/ITCEventObject.js +10 -0
- package/server/jobs/JobObject.js +24 -0
- package/server/jobs/jobProcess.js +69 -0
- package/server/jobs/jobRunner.js +162 -0
- package/server/jobs/jobs.js +304 -0
- package/server/loadRootComponents.js +44 -0
- package/server/mqtt.ts +485 -0
- package/server/nodeName.ts +75 -0
- package/server/operationsServer.ts +313 -0
- package/server/serverHelpers/Headers.ts +108 -0
- package/server/serverHelpers/JSONStream.ts +269 -0
- package/server/serverHelpers/OperationFunctionObject.ts +13 -0
- package/server/serverHelpers/Request.ts +158 -0
- package/server/serverHelpers/contentTypes.ts +637 -0
- package/server/serverHelpers/requestTimePlugin.js +57 -0
- package/server/serverHelpers/serverHandlers.js +148 -0
- package/server/serverHelpers/serverUtilities.ts +473 -0
- package/server/serverRegistry.ts +8 -0
- package/server/static.ts +187 -0
- package/server/status/definitions.ts +37 -0
- package/server/status/index.ts +125 -0
- package/server/storageReclamation.ts +93 -0
- package/server/threads/itc.js +89 -0
- package/server/threads/manageThreads.js +596 -0
- package/server/threads/socketRouter.ts +360 -0
- package/server/threads/threadServer.js +279 -0
- package/server/throttle.ts +73 -0
- package/sqlTranslator/SelectValidator.js +330 -0
- package/sqlTranslator/alasqlFunctionImporter.js +62 -0
- package/sqlTranslator/deleteTranslator.js +67 -0
- package/sqlTranslator/index.js +242 -0
- package/sqlTranslator/sql_statement_bucket.js +472 -0
- package/static/defaultConfig.yaml +3 -0
- package/studio/web/HDBDogOnly.svg +78 -0
- package/studio/web/assets/PPRadioGrotesk-Bold-DDaUYG8E.woff +0 -0
- package/studio/web/assets/fa-brands-400-CEJbCg16.woff +0 -0
- package/studio/web/assets/fa-brands-400-CSYNqBb_.ttf +0 -0
- package/studio/web/assets/fa-brands-400-DnkPfk3o.eot +0 -0
- package/studio/web/assets/fa-brands-400-UxlILjvJ.woff2 +0 -0
- package/studio/web/assets/fa-brands-400-cH1MgKbP.svg +3717 -0
- package/studio/web/assets/fa-regular-400-BhTwtT8w.eot +0 -0
- package/studio/web/assets/fa-regular-400-D1vz6WBx.ttf +0 -0
- package/studio/web/assets/fa-regular-400-DFnMcJPd.woff +0 -0
- package/studio/web/assets/fa-regular-400-DGzu1beS.woff2 +0 -0
- package/studio/web/assets/fa-regular-400-gwj8Pxq-.svg +801 -0
- package/studio/web/assets/fa-solid-900-B4ZZ7kfP.svg +5034 -0
- package/studio/web/assets/fa-solid-900-B6Axprfb.eot +0 -0
- package/studio/web/assets/fa-solid-900-BUswJgRo.woff2 +0 -0
- package/studio/web/assets/fa-solid-900-DOXgCApm.woff +0 -0
- package/studio/web/assets/fa-solid-900-mxuxnBEa.ttf +0 -0
- package/studio/web/assets/index-C1G-Jo6n.js +37 -0
- package/studio/web/assets/index-C1G-Jo6n.js.map +1 -0
- package/studio/web/assets/index-D-CahN0-.js +2 -0
- package/studio/web/assets/index-D-CahN0-.js.map +1 -0
- package/studio/web/assets/index-DxlZI0PX.js +235 -0
- package/studio/web/assets/index-DxlZI0PX.js.map +1 -0
- package/studio/web/assets/index-Y2g_iFpU.css +1 -0
- package/studio/web/assets/index-jiPwkrsB.css +1 -0
- package/studio/web/assets/index.lazy-BUXDDqq9.js +266 -0
- package/studio/web/assets/index.lazy-BUXDDqq9.js.map +1 -0
- package/studio/web/assets/profiler-CU93QiSW.js +2 -0
- package/studio/web/assets/profiler-CU93QiSW.js.map +1 -0
- package/studio/web/assets/react-redux-B8k9Ep7e.js +6 -0
- package/studio/web/assets/react-redux-B8k9Ep7e.js.map +1 -0
- package/studio/web/assets/startRecording-DFeBXGk6.js +3 -0
- package/studio/web/assets/startRecording-DFeBXGk6.js.map +1 -0
- package/studio/web/fabric-signup-background.webp +0 -0
- package/studio/web/fabric-signup-text.png +0 -0
- package/studio/web/favicon_purple.png +0 -0
- package/studio/web/github-icon.svg +15 -0
- package/studio/web/harper-fabric_black.png +0 -0
- package/studio/web/harper-fabric_white.png +0 -0
- package/studio/web/harper-studio_white.png +0 -0
- package/studio/web/index.html +16 -0
- package/studio/web/running.css +148 -0
- package/studio/web/running.html +147 -0
- package/studio/web/running.js +111 -0
- package/upgrade/UpgradeObjects.js +13 -0
- package/upgrade/directives/directivesController.js +90 -0
- package/upgrade/directivesManager.js +139 -0
- package/upgrade/upgradePrompt.js +124 -0
- package/upgrade/upgradeUtilities.js +28 -0
- package/utility/AWS/AWSConnector.js +29 -0
- package/utility/OperationFunctionCaller.js +63 -0
- package/utility/assignCmdEnvVariables.js +62 -0
- package/utility/common_utils.js +867 -0
- package/utility/environment/environmentManager.js +208 -0
- package/utility/environment/systemInformation.js +355 -0
- package/utility/errors/commonErrors.js +267 -0
- package/utility/errors/hdbError.js +146 -0
- package/utility/functions/date/dateFunctions.js +65 -0
- package/utility/functions/geo.js +355 -0
- package/utility/functions/sql/alaSQLExtension.js +104 -0
- package/utility/globalSchema.js +35 -0
- package/utility/hdbTerms.ts +819 -0
- package/utility/install/checkJWTTokensExist.js +62 -0
- package/utility/install/harperdb.conf +15 -0
- package/utility/install/harperdb.service +14 -0
- package/utility/install/installer.js +635 -0
- package/utility/installation.ts +30 -0
- package/utility/lmdb/DBIDefinition.js +20 -0
- package/utility/lmdb/DeleteRecordsResponseObject.js +25 -0
- package/utility/lmdb/InsertRecordsResponseObject.js +22 -0
- package/utility/lmdb/OpenDBIObject.js +31 -0
- package/utility/lmdb/OpenEnvironmentObject.js +41 -0
- package/utility/lmdb/UpdateRecordsResponseObject.js +25 -0
- package/utility/lmdb/UpsertRecordsResponseObject.js +22 -0
- package/utility/lmdb/cleanLMDBMap.js +65 -0
- package/utility/lmdb/commonUtility.js +130 -0
- package/utility/lmdb/deleteUtility.js +128 -0
- package/utility/lmdb/environmentUtility.js +477 -0
- package/utility/lmdb/searchCursorFunctions.js +187 -0
- package/utility/lmdb/searchUtility.js +918 -0
- package/utility/lmdb/terms.js +57 -0
- package/utility/lmdb/writeUtility.js +407 -0
- package/utility/logging/harper_logger.js +876 -0
- package/utility/logging/logRotator.js +157 -0
- package/utility/logging/logger.ts +24 -0
- package/utility/logging/readLog.js +355 -0
- package/utility/logging/transactionLog.js +57 -0
- package/utility/mount_hdb.js +59 -0
- package/utility/npmUtilities.js +102 -0
- package/utility/operationPermissions.ts +112 -0
- package/utility/operation_authorization.js +836 -0
- package/utility/packageUtils.js +55 -0
- package/utility/password.ts +99 -0
- package/utility/processManagement/processManagement.js +187 -0
- package/utility/processManagement/servicesConfig.js +56 -0
- package/utility/scripts/restartHdb.js +24 -0
- package/utility/scripts/user_data.sh +13 -0
- package/utility/signalling.js +36 -0
- package/utility/terms/certificates.js +81 -0
- package/utility/when.ts +20 -0
- package/validation/bulkDeleteValidator.js +24 -0
- package/validation/check_permissions.js +19 -0
- package/validation/common_validators.js +95 -0
- package/validation/configValidator.js +331 -0
- package/validation/deleteValidator.js +15 -0
- package/validation/fileLoadValidator.js +153 -0
- package/validation/insertValidator.js +40 -0
- package/validation/installValidator.js +37 -0
- package/validation/readLogValidator.js +64 -0
- package/validation/role_validation.js +320 -0
- package/validation/schemaMetadataValidator.js +42 -0
- package/validation/searchValidator.js +166 -0
- package/validation/statusValidator.ts +66 -0
- package/validation/transactionLogValidator.js +33 -0
- package/validation/user_validation.js +55 -0
- package/validation/validationWrapper.js +105 -0
- package/dist/resources/ResourceInterfaceV2.d.ts +0 -21
- package/dist/resources/ResourceInterfaceV2.js.map +0 -1
- package/dist/resources/ResourceV2.d.ts +0 -30
- package/dist/resources/ResourceV2.js +0 -27
- package/dist/resources/ResourceV2.js.map +0 -1
- package/dist/resources/analytics/profile.d.ts +0 -2
- package/dist/resources/analytics/profile.js +0 -144
- package/dist/resources/analytics/profile.js.map +0 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
* {
|
|
2
|
+
padding: 0;
|
|
3
|
+
margin: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
#app-bg-color,
|
|
7
|
+
#app-bg-grid {
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
position: fixed;
|
|
11
|
+
right: 0;
|
|
12
|
+
top: 0;
|
|
13
|
+
z-index: -2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#app-bg-color {
|
|
17
|
+
background: linear-gradient(45deg, #312556, #403b8a, #7a3a87);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#app-bg-grid {
|
|
21
|
+
inset: 0;
|
|
22
|
+
height: 100%;
|
|
23
|
+
width: 100%;
|
|
24
|
+
opacity: 0.05;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.orb-container {
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
min-height: 100vh; /* Centers the orb vertically */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.orb {
|
|
35
|
+
background-color: hsl(151.07, 49.12%, 55.29%);
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
animation: pulse 15s ease-in-out forwards;
|
|
38
|
+
opacity: 0.01;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@keyframes pulse {
|
|
42
|
+
0% {
|
|
43
|
+
opacity: 0.01;
|
|
44
|
+
transform: scale(1);
|
|
45
|
+
box-shadow: 0 0 0 hsla(151.07, 49.12%, 55.29%, 0);
|
|
46
|
+
}
|
|
47
|
+
50% {
|
|
48
|
+
opacity: 0.1;
|
|
49
|
+
transform: scale(1.2);
|
|
50
|
+
box-shadow: 0 0 30px hsla(151.07, 49.12%, 55.29%, 0.9);
|
|
51
|
+
}
|
|
52
|
+
100% {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: scale(1);
|
|
55
|
+
box-shadow: 0 0 0 hsla(151.07, 49.12%, 55.29%, 0);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#content {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
font-family: helvetica, sans-serif;
|
|
65
|
+
color: #efefef;
|
|
66
|
+
line-height: 1.5;
|
|
67
|
+
max-width: 800px;
|
|
68
|
+
margin: 0 auto;
|
|
69
|
+
padding: 5em;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
a {
|
|
73
|
+
color: hsl(0, 0%, 80%);
|
|
74
|
+
|
|
75
|
+
&:hover {
|
|
76
|
+
color: hsl(0, 0%, 95%);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
h1 {
|
|
81
|
+
margin-bottom: 0.5em;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.card {
|
|
85
|
+
background: hsl(0, 0%, 95%);
|
|
86
|
+
border-radius: 6px;
|
|
87
|
+
color: black;
|
|
88
|
+
box-shadow: 0 4px 8px hsla(0, 0%, 0%, 0.2);
|
|
89
|
+
margin: 1em 0;
|
|
90
|
+
|
|
91
|
+
padding: 1em 2em 1em 1em;
|
|
92
|
+
|
|
93
|
+
svg {
|
|
94
|
+
width: 4em;
|
|
95
|
+
height: 2em;
|
|
96
|
+
margin-top: 0.25em;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
p {
|
|
100
|
+
margin: 1em 0 0.5em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
a {
|
|
104
|
+
display: inline-block;
|
|
105
|
+
color: white;
|
|
106
|
+
background-color: black;
|
|
107
|
+
border-radius: 1em;
|
|
108
|
+
padding: 0.5em 2em;
|
|
109
|
+
margin: 0.5em 0;
|
|
110
|
+
text-decoration: none;
|
|
111
|
+
box-shadow: 0 4px 8px hsla(0, 0%, 0%, 0.2);
|
|
112
|
+
transition: all 0.3s ease-in-out;
|
|
113
|
+
|
|
114
|
+
&:hover {
|
|
115
|
+
background-color: hsla(0, 0%, 0%, 0.8);
|
|
116
|
+
box-shadow: 0 4px 8px hsla(0, 0%, 0%, 0.4);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.badge {
|
|
122
|
+
color: hsl(232.92, 80.9%, 60.98%);
|
|
123
|
+
background: hsl(240, 100%, 88.43%);
|
|
124
|
+
border: 1px solid hsl(241.05, 100%, 77.65%);
|
|
125
|
+
border-radius: 0.5em;
|
|
126
|
+
align-self: center;
|
|
127
|
+
font-size: 0.75em;
|
|
128
|
+
padding: 0.25em 0.5em;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.flex-row {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: row;
|
|
134
|
+
gap: 1em;
|
|
135
|
+
align-items: flex-start;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.code-snippet {
|
|
139
|
+
background-color: black;
|
|
140
|
+
border-radius: 0.5em;
|
|
141
|
+
padding: 0.5em 2em;
|
|
142
|
+
color: white;
|
|
143
|
+
|
|
144
|
+
code {
|
|
145
|
+
font-family: Consolas, Courier New, serif;
|
|
146
|
+
white-space: pre-wrap;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Harper is Running!</title>
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/HDBDogOnly.svg" />
|
|
6
|
+
<link rel="icon" type="dynamic-favicon" href="/favicon_purple.png" />
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
|
+
<link rel="stylesheet" href="./running.css" type="text/css" />
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="content">
|
|
13
|
+
<img
|
|
14
|
+
src="/HDBDogOnly.svg"
|
|
15
|
+
width="100px"
|
|
16
|
+
height="100px"
|
|
17
|
+
alt="Harper Logo"
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
<h1>Server is Running!</h1>
|
|
21
|
+
<p>
|
|
22
|
+
Your Harper server is up and running. Choose how you'd like to get
|
|
23
|
+
started:
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<div class="card flex-row">
|
|
27
|
+
<svg
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
width="24"
|
|
30
|
+
height="24"
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
fill="none"
|
|
33
|
+
stroke="hsl(232.92, 80.9%, 60.98%)"
|
|
34
|
+
stroke-width="2"
|
|
35
|
+
stroke-linecap="round"
|
|
36
|
+
stroke-linejoin="round"
|
|
37
|
+
class="lucide lucide-sparkles w-6 h-6 text-blue-600 flex-shrink-0 mt-1"
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
>
|
|
40
|
+
<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z">
|
|
41
|
+
</path>
|
|
42
|
+
<path d="M20 3v4"></path>
|
|
43
|
+
<path d="M22 5h-4"></path>
|
|
44
|
+
<path d="M4 17v2"></path>
|
|
45
|
+
<path d="M5 18H3"></path>
|
|
46
|
+
</svg>
|
|
47
|
+
|
|
48
|
+
<div>
|
|
49
|
+
<div class="flex-row">
|
|
50
|
+
<h2>Connect to Harper Fabric</h2>
|
|
51
|
+
<span class="badge">
|
|
52
|
+
Most Popular
|
|
53
|
+
</span>
|
|
54
|
+
</div>
|
|
55
|
+
<p>
|
|
56
|
+
Connect your server to Harper Fabric for cloud management,
|
|
57
|
+
monitoring, and seamless collaboration. Access your instance from
|
|
58
|
+
anywhere with full observability.
|
|
59
|
+
</p>
|
|
60
|
+
<a
|
|
61
|
+
id="connectToHarperFabricAnchor"
|
|
62
|
+
href="https://fabric.harper.fast/"
|
|
63
|
+
target="_blank"
|
|
64
|
+
>
|
|
65
|
+
Connect to Harper Fabric
|
|
66
|
+
</a>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div class="card flex-row">
|
|
71
|
+
<svg
|
|
72
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
73
|
+
width="24"
|
|
74
|
+
height="24"
|
|
75
|
+
viewBox="0 0 24 24"
|
|
76
|
+
fill="none"
|
|
77
|
+
stroke="currentColor"
|
|
78
|
+
stroke-width="2"
|
|
79
|
+
stroke-linecap="round"
|
|
80
|
+
stroke-linejoin="round"
|
|
81
|
+
class="lucide lucide-terminal w-6 h-6 text-slate-600 flex-shrink-0 mt-1"
|
|
82
|
+
aria-hidden="true"
|
|
83
|
+
>
|
|
84
|
+
<path d="M12 19h8"></path>
|
|
85
|
+
<path d="m4 17 6-6-6-6"></path>
|
|
86
|
+
</svg>
|
|
87
|
+
|
|
88
|
+
<div>
|
|
89
|
+
<h2>Manage Harper Offline</h2>
|
|
90
|
+
<p>
|
|
91
|
+
Prefer to work locally? Enable Harper Studio to configure and manage
|
|
92
|
+
your instance directly from your development environment.
|
|
93
|
+
</p>
|
|
94
|
+
<p>
|
|
95
|
+
Turn on localStudio in your harperdb-config.yaml:
|
|
96
|
+
</p>
|
|
97
|
+
<div class="code-snippet">
|
|
98
|
+
<code content="yaml">localStudio: enabled: true</code>
|
|
99
|
+
</div>
|
|
100
|
+
<p>
|
|
101
|
+
Then refresh this page!
|
|
102
|
+
</p>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<!-- {/* Footer */}-->
|
|
107
|
+
<div class="text-center text-slate-500">
|
|
108
|
+
<p>
|
|
109
|
+
Need help?
|
|
110
|
+
<a
|
|
111
|
+
href="https://docs.harperdb.io/docs"
|
|
112
|
+
target="_blank"
|
|
113
|
+
rel="noopener noreferrer"
|
|
114
|
+
>
|
|
115
|
+
Check out our docs.
|
|
116
|
+
</a>
|
|
117
|
+
</p>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div id="app-bg-color">
|
|
122
|
+
<div class="orb-container">
|
|
123
|
+
<div class="orb"></div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<svg id="app-bg-grid" xmlns="http://www.w3.org/2000/svg">
|
|
127
|
+
<defs>
|
|
128
|
+
<pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
|
|
129
|
+
<animateTransform
|
|
130
|
+
attributeType="xml"
|
|
131
|
+
attributeName="patternTransform"
|
|
132
|
+
type="translate"
|
|
133
|
+
from="0 0"
|
|
134
|
+
to="-40 -40"
|
|
135
|
+
begin="0"
|
|
136
|
+
dur="5s"
|
|
137
|
+
repeatCount="indefinite"
|
|
138
|
+
>
|
|
139
|
+
</animateTransform>
|
|
140
|
+
<path d="M 40 0 L 0 0 0 40" fill="none" stroke="currentColor" />
|
|
141
|
+
</pattern>
|
|
142
|
+
</defs>
|
|
143
|
+
<rect width="100%" height="100%" fill="url(#grid)" />
|
|
144
|
+
</svg>
|
|
145
|
+
<script src="./running.js" async></script>
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const anchor = document.getElementById('connectToHarperFabricAnchor');
|
|
3
|
+
if (!anchor) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
anchor.setAttribute('href', calculateCreateClusterDeepLink());
|
|
7
|
+
|
|
8
|
+
const container = document.getElementById('app-bg-color');
|
|
9
|
+
if (!container) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Remove the centered single orb if present
|
|
14
|
+
const existingCentered = container.querySelector('.orb-container');
|
|
15
|
+
if (existingCentered) { existingCentered.remove(); }
|
|
16
|
+
|
|
17
|
+
const ORB_COUNT = 6;
|
|
18
|
+
const MIN_SIZE = 120; // px
|
|
19
|
+
const MAX_SIZE = 640; // px
|
|
20
|
+
const FILL_DURATION = 15_000; // ms
|
|
21
|
+
const REPLACE_EVERY = 15_000; // ms
|
|
22
|
+
|
|
23
|
+
let addTimer = null;
|
|
24
|
+
let replaceTimer = null;
|
|
25
|
+
let createdCount = 0;
|
|
26
|
+
|
|
27
|
+
window.addEventListener('beforeunload', beforeUnload);
|
|
28
|
+
startStaggeredFill();
|
|
29
|
+
|
|
30
|
+
function randomInt(min, max) {
|
|
31
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function createOrb() {
|
|
35
|
+
const vw = window.innerWidth;
|
|
36
|
+
const vh = window.innerHeight;
|
|
37
|
+
const size = randomInt(MIN_SIZE, MAX_SIZE);
|
|
38
|
+
const left = randomInt(0, Math.max(0, vw - size));
|
|
39
|
+
const top = randomInt(0, Math.max(0, vh - size));
|
|
40
|
+
|
|
41
|
+
const orb = document.createElement('div');
|
|
42
|
+
orb.className = 'orb auto';
|
|
43
|
+
orb.style.position = 'fixed';
|
|
44
|
+
orb.style.width = size + 'px';
|
|
45
|
+
orb.style.height = size + 'px';
|
|
46
|
+
orb.style.left = left + 'px';
|
|
47
|
+
orb.style.top = top + 'px';
|
|
48
|
+
orb.style.animationDelay = (Math.random() * 15).toFixed(2) + 's';
|
|
49
|
+
orb.style.pointerEvents = 'none';
|
|
50
|
+
container.appendChild(orb);
|
|
51
|
+
|
|
52
|
+
return orb;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function startStaggeredFill() {
|
|
56
|
+
const interval = Math.max(150, Math.floor(FILL_DURATION / ORB_COUNT));
|
|
57
|
+
addTimer = setInterval(executeStaggeredFillStep, interval);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function executeStaggeredFillStep() {
|
|
61
|
+
createOrb();
|
|
62
|
+
createdCount++;
|
|
63
|
+
if (createdCount >= ORB_COUNT) {
|
|
64
|
+
clearInterval(addTimer);
|
|
65
|
+
addTimer = null;
|
|
66
|
+
|
|
67
|
+
const orbsNow = container.querySelectorAll('.orb.auto');
|
|
68
|
+
if (orbsNow.length > 0) {
|
|
69
|
+
const idxNow = Math.floor(Math.random() * orbsNow.length);
|
|
70
|
+
orbsNow[idxNow].remove();
|
|
71
|
+
createOrb();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
replaceTimer = setInterval(executeGentleRefreshCycle, REPLACE_EVERY);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function executeGentleRefreshCycle() {
|
|
79
|
+
const orbs = container.querySelectorAll('.orb.auto');
|
|
80
|
+
if (orbs.length !== 0) {
|
|
81
|
+
const idx = Math.floor(Math.random() * orbs.length);
|
|
82
|
+
const toRemove = orbs[idx];
|
|
83
|
+
toRemove.remove();
|
|
84
|
+
createOrb();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function beforeUnload() {
|
|
89
|
+
if (addTimer) {
|
|
90
|
+
clearInterval(addTimer);
|
|
91
|
+
}
|
|
92
|
+
if (replaceTimer) {
|
|
93
|
+
clearInterval(replaceTimer);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function calculateCreateClusterDeepLink() {
|
|
98
|
+
// NOTE: This is also embedded in src/config/deepLinks.ts
|
|
99
|
+
return 'https://fabric.harper.fast/#/?createCluster=' + encodeURIComponent(JSON.stringify({
|
|
100
|
+
deploymentDescription: 'Self-Hosted',
|
|
101
|
+
performanceDescription: 'Self Supported and Managed',
|
|
102
|
+
instances: [
|
|
103
|
+
{
|
|
104
|
+
secure: String(location.protocol === 'https:'),
|
|
105
|
+
fqdn: location.hostname,
|
|
106
|
+
port: parseInt(location.port, 10),
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
let terms = require('../utility/hdbTerms.ts');
|
|
3
|
+
|
|
4
|
+
class UpgradeObject {
|
|
5
|
+
constructor(dataVersion, upgradeVersion) {
|
|
6
|
+
this[terms.UPGRADE_JSON_FIELD_NAMES_ENUM.DATA_VERSION] = dataVersion;
|
|
7
|
+
this[terms.UPGRADE_JSON_FIELD_NAMES_ENUM.UPGRADE_VERSION] = upgradeVersion;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
UpgradeObject,
|
|
13
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The directive controller serves as an interface between directive files and HDB. Since we don't maintain file
|
|
5
|
+
* structure in the installed version, we need to require all directive files in order to make them accessible.
|
|
6
|
+
*
|
|
7
|
+
* Any time a directive file is added to the project, it must be required in this manager.
|
|
8
|
+
*/
|
|
9
|
+
const hdbUtils = require('../../utility/common_utils.js');
|
|
10
|
+
const hdbTerms = require('../../utility/hdbTerms.ts');
|
|
11
|
+
const hdbLog = require('../../utility/logging/harper_logger.js');
|
|
12
|
+
const { DATA_VERSION, UPGRADE_VERSION } = hdbTerms.UPGRADE_JSON_FIELD_NAMES_ENUM;
|
|
13
|
+
|
|
14
|
+
let versions = new Map();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns all HDB versions w/ upgrade directives
|
|
18
|
+
* Note: this does NOT return a list of all versions of HDB
|
|
19
|
+
*
|
|
20
|
+
* @returns {this}
|
|
21
|
+
*/
|
|
22
|
+
function getSortedVersions() {
|
|
23
|
+
return [...versions.keys()].sort(hdbUtils.compareVersions);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns an array of version numbers that include/require an upgrade directive be run - this is basically the ordered list
|
|
28
|
+
* of upgrades that will need to be run for the HDB instance to be able to run on the currently installed software version
|
|
29
|
+
*
|
|
30
|
+
* @param upgradeObj
|
|
31
|
+
* @returns {any[]|*[]}
|
|
32
|
+
*/
|
|
33
|
+
function getVersionsForUpgrade(upgradeObj) {
|
|
34
|
+
let currVersion = upgradeObj[DATA_VERSION];
|
|
35
|
+
let newVersion = upgradeObj[UPGRADE_VERSION];
|
|
36
|
+
|
|
37
|
+
if (hdbUtils.isEmptyOrZeroLength(currVersion) || hdbUtils.isEmptyOrZeroLength(newVersion)) {
|
|
38
|
+
//we should never get to this scenario but if so, we will return empty array so that server can try to start
|
|
39
|
+
// with current install and data
|
|
40
|
+
hdbLog.info(
|
|
41
|
+
`There is an issue with the version data in your instance of HDB. Current version data: ${upgradeObj}`
|
|
42
|
+
);
|
|
43
|
+
hdbLog.error(
|
|
44
|
+
'There was an error when trying to evaluate the version information for your instance. Trying to ' +
|
|
45
|
+
'start the server anyways but it may fail. If you continue to have this problem, please contact support@harperdb.io.'
|
|
46
|
+
);
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return [...versions.keys()].sort(hdbUtils.compareVersions).filter(function (thisVersion) {
|
|
51
|
+
return (
|
|
52
|
+
hdbUtils.compareVersions(thisVersion, currVersion) > 0 && hdbUtils.compareVersions(thisVersion, newVersion) <= 0
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Helper function for determining if there are version upgrades required based on the current status of the data and hdb software
|
|
59
|
+
* versions. If there are not, it will return false.
|
|
60
|
+
*
|
|
61
|
+
* @param upgradeObj
|
|
62
|
+
* @returns {boolean} - returns true if an upgrade/s is/are required
|
|
63
|
+
*/
|
|
64
|
+
function hasUpgradesRequired(upgradeObj) {
|
|
65
|
+
const validVersions = getVersionsForUpgrade(upgradeObj);
|
|
66
|
+
return validVersions.length > 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Returns the upgrade directive object for a specific version, if present.
|
|
71
|
+
*
|
|
72
|
+
* @param version
|
|
73
|
+
* @returns {null|any}
|
|
74
|
+
*/
|
|
75
|
+
function getDirectiveByVersion(version) {
|
|
76
|
+
if (hdbUtils.isEmptyOrZeroLength(version)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
if (versions.has(version)) {
|
|
80
|
+
return versions.get(version);
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = {
|
|
86
|
+
getSortedVersions,
|
|
87
|
+
getDirectiveByVersion,
|
|
88
|
+
getVersionsForUpgrade,
|
|
89
|
+
hasUpgradesRequired,
|
|
90
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const hdbUtil = require('../utility/common_utils.js');
|
|
4
|
+
const log = require('../utility/logging/harper_logger.js');
|
|
5
|
+
const directivesController = require('./directives/directivesController.js');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
processDirectives,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Iterates through the directives files to find uninstalled updates and runs the files.
|
|
13
|
+
*
|
|
14
|
+
* @param upgradeObj
|
|
15
|
+
* @returns {Promise<*[]>}
|
|
16
|
+
*/
|
|
17
|
+
async function processDirectives(upgradeObj) {
|
|
18
|
+
console.log('Starting upgrade process...');
|
|
19
|
+
|
|
20
|
+
let loadedDirectives = directivesController.getVersionsForUpgrade(upgradeObj);
|
|
21
|
+
let upgradeDirectives = getUpgradeDirectivesToInstall(loadedDirectives);
|
|
22
|
+
|
|
23
|
+
let allResponses = [];
|
|
24
|
+
const dirLength = upgradeDirectives.length;
|
|
25
|
+
for (let i = 0; i < dirLength; i++) {
|
|
26
|
+
const vers = upgradeDirectives[i];
|
|
27
|
+
let notifyMsg = `Running upgrade for version ${vers.version}`;
|
|
28
|
+
log.notify(notifyMsg);
|
|
29
|
+
console.log(notifyMsg);
|
|
30
|
+
|
|
31
|
+
let syncFuncResponse = [];
|
|
32
|
+
let asyncFuncResponses = [];
|
|
33
|
+
|
|
34
|
+
// Run sync functions for upgrade
|
|
35
|
+
try {
|
|
36
|
+
syncFuncResponse = runSyncFunctions(vers.sync_functions);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
log.error(`Error while running an upgrade script for ${vers.version}`);
|
|
39
|
+
throw e;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Run async functions for upgrade
|
|
43
|
+
try {
|
|
44
|
+
asyncFuncResponses = await runAsyncFunctions(vers.async_functions);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
log.error(`Error while running an upgrade script for ${vers.version}`);
|
|
47
|
+
throw e;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
allResponses.push(...syncFuncResponse, ...asyncFuncResponses);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return allResponses;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Runs sync functions specified in a directive object.
|
|
58
|
+
*
|
|
59
|
+
* @param directiveFunctions - Array of sync functions to run
|
|
60
|
+
* @returns - Array of responses from function calls
|
|
61
|
+
*/
|
|
62
|
+
function runSyncFunctions(directiveFunctions) {
|
|
63
|
+
if (hdbUtil.isEmptyOrZeroLength(directiveFunctions)) {
|
|
64
|
+
log.info('No functions found to run for upgrade');
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
if (!Array.isArray(directiveFunctions)) {
|
|
68
|
+
log.info('Passed parameter is not an array');
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
let funcResponses = [];
|
|
72
|
+
for (let func of directiveFunctions) {
|
|
73
|
+
log.info(`Running function ${func.name}`);
|
|
74
|
+
if (!(func instanceof Function)) {
|
|
75
|
+
log.info('Variable being processed is not a function');
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const response = func();
|
|
80
|
+
log.info(response);
|
|
81
|
+
funcResponses.push(response);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return funcResponses;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Runs async functions specified in a directive object.
|
|
89
|
+
*
|
|
90
|
+
* @param directiveFunctions - Array of async functions to run
|
|
91
|
+
* @returns - Array of responses from async function calls
|
|
92
|
+
*/
|
|
93
|
+
async function runAsyncFunctions(directiveFunctions) {
|
|
94
|
+
if (hdbUtil.isEmptyOrZeroLength(directiveFunctions)) {
|
|
95
|
+
log.info('No functions found to run for upgrade');
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
if (!Array.isArray(directiveFunctions)) {
|
|
99
|
+
log.info('Passed parameter is not an array');
|
|
100
|
+
return [];
|
|
101
|
+
}
|
|
102
|
+
let funcResponses = [];
|
|
103
|
+
const funcsLength = directiveFunctions.length;
|
|
104
|
+
for (let i = 0; i < funcsLength; i++) {
|
|
105
|
+
const func = directiveFunctions[i];
|
|
106
|
+
log.info(`Running function ${func.name}`);
|
|
107
|
+
if (!(func instanceof Function)) {
|
|
108
|
+
log.info('Variable being processed is not a function');
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const response = await func();
|
|
113
|
+
log.info(response);
|
|
114
|
+
funcResponses.push(response);
|
|
115
|
+
}
|
|
116
|
+
return funcResponses;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Based on the current version, find all upgrade directives that need to be installed to make this installation current.
|
|
121
|
+
* Returns the install directives array sorted from lowest to highest version number.
|
|
122
|
+
*
|
|
123
|
+
* @param currVersionNum - The current version of HDB.
|
|
124
|
+
* @returns {Array}
|
|
125
|
+
*/
|
|
126
|
+
function getUpgradeDirectivesToInstall(loadedDirectives) {
|
|
127
|
+
if (hdbUtil.isEmptyOrZeroLength(loadedDirectives)) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let versionModulesToRun = [];
|
|
132
|
+
for (let vers of loadedDirectives) {
|
|
133
|
+
let module = directivesController.getDirectiveByVersion(vers);
|
|
134
|
+
if (module) {
|
|
135
|
+
versionModulesToRun.push(module);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return versionModulesToRun;
|
|
139
|
+
}
|