@twin.org/node-core 0.0.3-next.36 → 0.0.3-next.38

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.
@@ -1 +1 @@
1
- {"version":3,"file":"engineServerEnvBuilder.js","sourceRoot":"","sources":["../../../src/builders/engineServerEnvBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACN,gCAAgC,EAChC,gCAAgC,EAChC,2BAA2B,EAC3B,+BAA+B,EAC/B,oBAAoB,EAEpB,wBAAwB,EAExB,sBAAsB,EACtB,wBAAwB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAGnG;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CACnD,OAA+E,EAC/E,sBAA4E,EAC5E,gBAAmC,EACnC,UAAuB,EACvB,eAAwB,EACxB,WAAoB;IAEpB,MAAM,gBAAgB,GAAsB;QAC3C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QACjC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC;YAC3C,CAAC,CAAE,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAkB;YAClD,CAAC,CAAC,SAAS;QACZ,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC;YACzD,CAAC,CAAC,OAAO,CAAC,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AAE,CAAC;wBACtC,UAAU,CAAC,QAAQ,GAAG,gBAAgB,CAAC;oBACxC,CAAC;oBACD,MAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAA0C;IACrF,OAAO,CACN,OAAO,CAAC,sBAAsB,KAAK,gCAAgC,CAAC,aAAa;QACjF,OAAO,CAAC,iBAAiB,KAAK,2BAA2B,CAAC,aAAa,CACvE,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IServerInfo, IWebServerOptions } from \"@twin.org/api-models\";\nimport { ContextIdKeys } from \"@twin.org/context\";\nimport { Coerce, GeneralError, Is, StringHelper, Url } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"@twin.org/engine-models\";\nimport { addDefaultRestPaths, addDefaultSocketPaths } from \"@twin.org/engine-server\";\nimport {\n\tAuthenticationAdminComponentType,\n\tAuthenticationAuditComponentType,\n\tAuthenticationComponentType,\n\tAuthenticationRateComponentType,\n\tHostingComponentType,\n\ttype IEngineServerConfig,\n\tInformationComponentType,\n\ttype MimeTypeProcessorType,\n\tRestRouteProcessorType,\n\tSocketRouteProcessorType\n} from \"@twin.org/engine-server-types\";\nimport type { HttpMethod } from \"@twin.org/web\";\nimport { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from \"../defaults.js\";\nimport type { IEngineServerEnvironmentVariables } from \"../models/IEngineServerEnvironmentVariables.js\";\n\n/**\n * Handles the configuration of the server.\n * @param envVars The environment variables for the engine server.\n * @param availableContextIdKeys The context ID keys.\n * @param coreEngineConfig The core engine config.\n * @param serverInfo The server information.\n * @param openApiSpecPath The path to the open api spec.\n * @param favIconPath The path to the favicon.\n * @returns The config for the core and the server.\n */\nexport async function buildEngineServerConfiguration(\n\tenvVars: IEngineServerEnvironmentVariables & { [id: string]: string | unknown },\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[],\n\tcoreEngineConfig: IEngineCoreConfig,\n\tserverInfo: IServerInfo,\n\topenApiSpecPath?: string,\n\tfavIconPath?: string\n): Promise<IEngineServerConfig> {\n\tconst webServerOptions: IWebServerOptions = {\n\t\tport: Coerce.number(envVars.port),\n\t\thost: Coerce.string(envVars.host),\n\t\tmethods: Is.stringValue(envVars.httpMethods)\n\t\t\t? (envVars.httpMethods.split(\",\") as HttpMethod[])\n\t\t\t: undefined,\n\t\tallowedHeaders: Is.stringValue(envVars.httpAllowedHeaders)\n\t\t\t? envVars.httpAllowedHeaders.split(\",\")\n\t\t\t: undefined,\n\t\texposedHeaders: Is.stringValue(envVars.httpExposedHeaders)\n\t\t\t? envVars.httpExposedHeaders.split(\",\")\n\t\t\t: undefined,\n\t\tcorsOrigins: Is.stringValue(envVars.corsOrigins) ? envVars.corsOrigins.split(\",\") : undefined\n\t};\n\n\tconst localOrigin = `http://${webServerOptions.host ?? \"localhost\"}:${webServerOptions.port ?? 3000}`;\n\n\tlet publicOrigin;\n\tif (Is.stringValue(envVars.publicOrigin)) {\n\t\tconst publicUrl = Url.tryParseExact(envVars.publicOrigin);\n\t\tif (!Is.empty(publicUrl)) {\n\t\t\tconst urlParts = publicUrl.parts();\n\t\t\tpublicOrigin = `${urlParts.schema}://${urlParts.host}${Is.integer(urlParts.port) ? `:${urlParts.port}` : \"\"}`;\n\t\t} else {\n\t\t\tthrow new GeneralError(\"node\", \"invalidPublicOrigin\", { publicOrigin: envVars.publicOrigin });\n\t\t}\n\t}\n\n\tconst nodeIdentityEnabled = Coerce.boolean(envVars.nodeIdentityEnabled) ?? true;\n\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\tif (tenantEnabled) {\n\t\twebServerOptions.allowedHeaders ??= [];\n\t\tif (!webServerOptions.allowedHeaders.includes(\"x-api-key\")) {\n\t\t\twebServerOptions.allowedHeaders.push(\"x-api-key\");\n\t\t}\n\t}\n\n\tconst serverConfig: IEngineServerConfig = {\n\t\t...coreEngineConfig,\n\t\tweb: webServerOptions,\n\t\ttypes: {\n\t\t\t...coreEngineConfig.types,\n\t\t\tinformationComponent: [\n\t\t\t\t{\n\t\t\t\t\ttype: InformationComponentType.Service,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tserverInfo,\n\t\t\t\t\t\t\topenApiSpecPath,\n\t\t\t\t\t\t\tfavIconPath\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t],\n\t\t\thostingComponent: [\n\t\t\t\t{\n\t\t\t\t\ttype: HostingComponentType.Service,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tlocalOrigin,\n\t\t\t\t\t\t\tpublicOrigin\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t};\n\n\tif (Is.stringValue(envVars.mimeTypeProcessors)) {\n\t\tconst mimeTypeProcessors = envVars.mimeTypeProcessors.split(\",\");\n\n\t\tif (Is.arrayValue(mimeTypeProcessors)) {\n\t\t\tserverConfig.types.mimeTypeProcessor ??= [];\n\t\t\tfor (const mimeTypeProcessor of mimeTypeProcessors) {\n\t\t\t\tserverConfig.types.mimeTypeProcessor.push({\n\t\t\t\t\ttype: mimeTypeProcessor as MimeTypeProcessorType\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tserverConfig.types.restRouteProcessor ??= [];\n\tserverConfig.types.socketRouteProcessor ??= [];\n\n\tif (nodeIdentityEnabled) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Node,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.ContextId,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.ContextId,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (tenantEnabled) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Tenant,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_TENANT]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (!coreEngineConfig.silent) {\n\t\tconst includeBody = Coerce.boolean(envVars.routeLoggingIncludeBody) ?? coreEngineConfig.debug;\n\t\tconst fullBase64 = Coerce.boolean(envVars.routeLoggingFullBase64) ?? false;\n\t\tconst obfuscateProperties = Is.stringValue(envVars.routeLoggingObfuscateProperties)\n\t\t\t? envVars.routeLoggingObfuscateProperties.split(\",\")\n\t\t\t: undefined;\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tserverConfig.types.restRouteProcessor.push({\n\t\ttype: RestRouteProcessorType.RestRoute,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tincludeErrorStack: coreEngineConfig.debug\n\t\t\t}\n\t\t}\n\t});\n\tserverConfig.types.socketRouteProcessor.push({\n\t\ttype: SocketRouteProcessorType.SocketRoute,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tincludeErrorStack: coreEngineConfig.debug\n\t\t\t}\n\t\t}\n\t});\n\n\tconst authAdminProcessorType = envVars.authAdminProcessorType;\n\tconst authProcessorType = envVars.authProcessorType;\n\n\tif (\n\t\tauthAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tauthProcessorType === AuthenticationComponentType.EntityStorage\n\t) {\n\t\tserverConfig.types.authenticationRateComponent ??= [];\n\t\tserverConfig.types.authenticationRateComponent.push({\n\t\t\ttype: AuthenticationRateComponentType.EntityStorage\n\t\t});\n\n\t\tserverConfig.types.authenticationAuditComponent ??= [];\n\t\tserverConfig.types.authenticationAuditComponent.push({\n\t\t\ttype: AuthenticationAuditComponentType.EntityStorage\n\t\t});\n\t}\n\n\tif (authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage) {\n\t\tserverConfig.types.authenticationAdminComponent ??= [];\n\t\tserverConfig.types.authenticationAdminComponent.push({\n\t\t\ttype: AuthenticationAdminComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (authProcessorType === AuthenticationComponentType.EntityStorage) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Organization,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.User,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.authenticationComponent ??= [];\n\t\tserverConfig.types.authenticationComponent.push({\n\t\t\ttype: AuthenticationComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\taddDefaultRestPaths(serverConfig);\n\taddDefaultSocketPaths(serverConfig);\n\n\t// See if any of the rest paths should be overridden by environment variables and update the config accordingly\n\tfor (const componentType in serverConfig.types) {\n\t\tconst types = serverConfig.types[componentType];\n\n\t\tif (Is.arrayValue(types)) {\n\t\t\tfor (const typeConfig of types) {\n\t\t\t\tif (Is.stringValue(typeConfig.restPath)) {\n\t\t\t\t\tconst envVarName = `restPath${StringHelper.pascalCase(componentType.replace(\"Component\", \"\"))}`;\n\t\t\t\t\tconst overrideRestPath = envVars[envVarName];\n\t\t\t\t\tif (Is.stringValue(overrideRestPath)) {\n\t\t\t\t\t\ttypeConfig.restPath = overrideRestPath;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn serverConfig;\n}\n\n/**\n * Checks if the authentication entity storage subsystem is required.\n * Returns true when any component that depends on the authentication entity storage subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if authentication entity storage is enabled.\n */\nexport function isAuthEntityStorageRequired(envVars: IEngineServerEnvironmentVariables): boolean {\n\treturn (\n\t\tenvVars.authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tenvVars.authProcessorType === AuthenticationComponentType.EntityStorage\n\t);\n}\n"]}
1
+ {"version":3,"file":"engineServerEnvBuilder.js","sourceRoot":"","sources":["../../../src/builders/engineServerEnvBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACN,gCAAgC,EAChC,gCAAgC,EAChC,2BAA2B,EAC3B,+BAA+B,EAC/B,oBAAoB,EAEpB,wBAAwB,EAExB,sBAAsB,EACtB,wBAAwB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAGnG;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CACnD,OAA+E,EAC/E,sBAA4E,EAC5E,gBAAmC,EACnC,UAAuB,EACvB,eAAwB,EACxB,WAAoB;IAEpB,MAAM,gBAAgB,GAAsB;QAC3C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QACjC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC;YAC3C,CAAC,CAAE,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAkB;YAClD,CAAC,CAAC,SAAS;QACZ,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC;YACzD,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK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,WAAW,CAAC,gBAAgB,CAAC,EAAE,CAAC;wBACtC,UAAU,CAAC,QAAQ,GAAG,gBAAgB,CAAC;oBACxC,CAAC;oBACD,MAAM;gBACP,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAA0C;IACrF,OAAO,CACN,OAAO,CAAC,sBAAsB,KAAK,gCAAgC,CAAC,aAAa;QACjF,OAAO,CAAC,iBAAiB,KAAK,2BAA2B,CAAC,aAAa,CACvE,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IServerInfo, IWebServerOptions } from \"@twin.org/api-models\";\nimport { ContextIdKeys } from \"@twin.org/context\";\nimport { Coerce, GeneralError, Is, StringHelper, Url } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"@twin.org/engine-models\";\nimport { addDefaultRestPaths, addDefaultSocketPaths } from \"@twin.org/engine-server\";\nimport {\n\tAuthenticationAdminComponentType,\n\tAuthenticationAuditComponentType,\n\tAuthenticationComponentType,\n\tAuthenticationRateComponentType,\n\tHostingComponentType,\n\ttype IEngineServerConfig,\n\tInformationComponentType,\n\ttype MimeTypeProcessorType,\n\tRestRouteProcessorType,\n\tSocketRouteProcessorType\n} from \"@twin.org/engine-server-types\";\nimport type { HttpMethod } from \"@twin.org/web\";\nimport { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from \"../defaults.js\";\nimport type { IEngineServerEnvironmentVariables } from \"../models/IEngineServerEnvironmentVariables.js\";\n\n/**\n * Handles the configuration of the server.\n * @param envVars The environment variables for the engine server.\n * @param availableContextIdKeys The context ID keys.\n * @param coreEngineConfig The core engine config.\n * @param serverInfo The server information.\n * @param openApiSpecPath The path to the open api spec.\n * @param favIconPath The path to the favicon.\n * @returns The config for the core and the server.\n */\nexport async function buildEngineServerConfiguration(\n\tenvVars: IEngineServerEnvironmentVariables & { [id: string]: string | unknown },\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[],\n\tcoreEngineConfig: IEngineCoreConfig,\n\tserverInfo: IServerInfo,\n\topenApiSpecPath?: string,\n\tfavIconPath?: string\n): Promise<IEngineServerConfig> {\n\tconst webServerOptions: IWebServerOptions = {\n\t\tport: Coerce.number(envVars.port),\n\t\thost: Coerce.string(envVars.host),\n\t\tmethods: Is.stringValue(envVars.httpMethods)\n\t\t\t? (envVars.httpMethods.split(\",\") as HttpMethod[])\n\t\t\t: undefined,\n\t\tallowedHeaders: Is.stringValue(envVars.httpAllowedHeaders)\n\t\t\t? envVars.httpAllowedHeaders.split(\",\")\n\t\t\t: undefined,\n\t\texposedHeaders: Is.stringValue(envVars.httpExposedHeaders)\n\t\t\t? envVars.httpExposedHeaders.split(\",\")\n\t\t\t: undefined,\n\t\tcorsOrigins: Is.stringValue(envVars.corsOrigins) ? envVars.corsOrigins.split(\",\") : undefined\n\t};\n\n\tconst localOrigin = `http://${webServerOptions.host ?? \"localhost\"}:${webServerOptions.port ?? 3000}`;\n\n\tlet publicOrigin;\n\tif (Is.stringValue(envVars.publicOrigin)) {\n\t\tconst publicUrl = Url.tryParseExact(envVars.publicOrigin);\n\t\tif (!Is.empty(publicUrl)) {\n\t\t\tconst urlParts = publicUrl.parts();\n\t\t\tpublicOrigin = `${urlParts.schema}://${urlParts.host}${Is.integer(urlParts.port) ? `:${urlParts.port}` : \"\"}`;\n\t\t} else {\n\t\t\tthrow new GeneralError(\"node\", \"invalidPublicOrigin\", { publicOrigin: envVars.publicOrigin });\n\t\t}\n\t}\n\n\tconst nodeIdentityEnabled = Coerce.boolean(envVars.nodeIdentityEnabled) ?? true;\n\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\tif (tenantEnabled) {\n\t\twebServerOptions.allowedHeaders ??= [];\n\t\tif (!webServerOptions.allowedHeaders.includes(\"x-api-key\")) {\n\t\t\twebServerOptions.allowedHeaders.push(\"x-api-key\");\n\t\t}\n\t}\n\n\tconst serverConfig: IEngineServerConfig = {\n\t\t...coreEngineConfig,\n\t\tweb: webServerOptions,\n\t\ttypes: {\n\t\t\t...coreEngineConfig.types,\n\t\t\tinformationComponent: [\n\t\t\t\t{\n\t\t\t\t\ttype: InformationComponentType.Service,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tserverInfo,\n\t\t\t\t\t\t\topenApiSpecPath,\n\t\t\t\t\t\t\tfavIconPath\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t],\n\t\t\thostingComponent: [\n\t\t\t\t{\n\t\t\t\t\ttype: HostingComponentType.Service,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tlocalOrigin,\n\t\t\t\t\t\t\tpublicOrigin\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t};\n\n\tif (Is.stringValue(envVars.mimeTypeProcessors)) {\n\t\tconst mimeTypeProcessors = envVars.mimeTypeProcessors.split(\",\");\n\n\t\tif (Is.arrayValue(mimeTypeProcessors)) {\n\t\t\tserverConfig.types.mimeTypeProcessor ??= [];\n\t\t\tfor (const mimeTypeProcessor of mimeTypeProcessors) {\n\t\t\t\tserverConfig.types.mimeTypeProcessor.push({\n\t\t\t\t\ttype: mimeTypeProcessor as MimeTypeProcessorType\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tserverConfig.types.restRouteProcessor ??= [];\n\tserverConfig.types.socketRouteProcessor ??= [];\n\n\tif (nodeIdentityEnabled) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Node,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.ContextId,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.ContextId,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tkey: ContextIdKeys.Node\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (tenantEnabled) {\n\t\tavailableContextIdKeys.push({\n\t\t\tkey: ContextIdKeys.Tenant,\n\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_TENANT]\n\t\t});\n\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Tenant,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (!coreEngineConfig.silent) {\n\t\tconst includeBody = Coerce.boolean(envVars.routeLoggingIncludeBody) ?? coreEngineConfig.debug;\n\t\tconst fullBase64 = Coerce.boolean(envVars.routeLoggingFullBase64) ?? false;\n\t\tconst obfuscateProperties = Is.stringValue(envVars.routeLoggingObfuscateProperties)\n\t\t\t? envVars.routeLoggingObfuscateProperties.split(\",\")\n\t\t\t: undefined;\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.Logging,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tincludeBody,\n\t\t\t\t\tfullBase64,\n\t\t\t\t\tobfuscateProperties\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\tserverConfig.types.restRouteProcessor.push({\n\t\ttype: RestRouteProcessorType.RestRoute,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tincludeErrorStack: coreEngineConfig.debug\n\t\t\t}\n\t\t}\n\t});\n\tserverConfig.types.socketRouteProcessor.push({\n\t\ttype: SocketRouteProcessorType.SocketRoute,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tincludeErrorStack: coreEngineConfig.debug\n\t\t\t}\n\t\t}\n\t});\n\n\tconst authAdminProcessorType = envVars.authAdminProcessorType;\n\tconst authProcessorType = envVars.authProcessorType;\n\n\tif (\n\t\tauthAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tauthProcessorType === AuthenticationComponentType.EntityStorage\n\t) {\n\t\tserverConfig.types.authenticationRateComponent ??= [];\n\t\tserverConfig.types.authenticationRateComponent.push({\n\t\t\ttype: AuthenticationRateComponentType.EntityStorage\n\t\t});\n\n\t\tserverConfig.types.authenticationAuditComponent ??= [];\n\t\tserverConfig.types.authenticationAuditComponent.push({\n\t\t\ttype: AuthenticationAuditComponentType.EntityStorage\n\t\t});\n\t}\n\n\tif (authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage) {\n\t\tserverConfig.types.authenticationAdminComponent ??= [];\n\t\tserverConfig.types.authenticationAdminComponent.push({\n\t\t\ttype: AuthenticationAdminComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (authProcessorType === AuthenticationComponentType.EntityStorage) {\n\t\tif (nodeIdentityEnabled) {\n\t\t\tavailableContextIdKeys.push({\n\t\t\t\tkey: ContextIdKeys.Organization,\n\t\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t\t});\n\t\t\tavailableContextIdKeys.push({\n\t\t\t\tkey: ContextIdKeys.User,\n\t\t\t\trequiredHandlerFeatures: [CONTEXT_ID_HANDLER_FEATURE_DID]\n\t\t\t});\n\t\t}\n\n\t\tserverConfig.types.authenticationComponent ??= [];\n\t\tserverConfig.types.authenticationComponent.push({\n\t\t\ttype: AuthenticationComponentType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.restRouteProcessor.push({\n\t\t\ttype: RestRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tserverConfig.types.socketRouteProcessor.push({\n\t\t\ttype: SocketRouteProcessorType.AuthHeader,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tsigningKeyName: envVars.authSigningKeyId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\taddDefaultRestPaths(serverConfig);\n\taddDefaultSocketPaths(serverConfig);\n\n\t// See if any of the rest paths should be overridden by environment variables and update the config accordingly\n\tfor (const componentType in serverConfig.types) {\n\t\tconst types = serverConfig.types[componentType];\n\n\t\tif (Is.arrayValue(types)) {\n\t\t\tfor (const typeConfig of types) {\n\t\t\t\tif (Is.stringValue(typeConfig.restPath)) {\n\t\t\t\t\tconst envVarName = `restPath${StringHelper.pascalCase(componentType.replace(\"Component\", \"\"))}`;\n\t\t\t\t\tconst overrideRestPath = envVars[envVarName];\n\t\t\t\t\tif (Is.stringValue(overrideRestPath)) {\n\t\t\t\t\t\ttypeConfig.restPath = overrideRestPath;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn serverConfig;\n}\n\n/**\n * Checks if the authentication entity storage subsystem is required.\n * Returns true when any component that depends on the authentication entity storage subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if authentication entity storage is enabled.\n */\nexport function isAuthEntityStorageRequired(envVars: IEngineServerEnvironmentVariables): boolean {\n\treturn (\n\t\tenvVars.authAdminProcessorType === AuthenticationAdminComponentType.EntityStorage ||\n\t\tenvVars.authProcessorType === AuthenticationComponentType.EntityStorage\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IEngineEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine core environment variables.\n */\nexport interface IEngineEnvironmentVariables {\n\t/**\n\t * Start the engine in debug mode.\n\t */\n\tdebug?: string;\n\n\t/**\n\t * Start the engine in silent mode.\n\t */\n\tsilent?: string;\n\n\t/**\n\t * The root directory for storing items like state file.\n\t */\n\tstorageFileRoot?: string;\n\n\t/**\n\t * The name of the state file.\n\t */\n\tstateFilename?: string;\n\n\t/**\n\t * Does the node have a unique ID, defaults to true.\n\t */\n\tnodeIdentityEnabled?: string;\n\n\t/**\n\t * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql\n\t */\n\tentityStorageConnectorType?: string;\n\n\t/**\n\t * The default entity storage connector to use, defaults to the first one in the list.\n\t */\n\tentityStorageConnectorDefault?: string;\n\n\t/**\n\t * A prefix for all the table in entity-storage, can be empty.\n\t */\n\tentityStorageTablePrefix?: string;\n\n\t/**\n\t * AWS DynamoDB auth mode, either credentials or pod.\n\t */\n\tawsDynamodbAuthMode?: string;\n\n\t/**\n\t * AWS Dynamo DB access key id.\n\t */\n\tawsDynamodbAccessKeyId?: string;\n\n\t/**\n\t * AWS Dynamo DB Endpoint if running local instance.\n\t */\n\tawsDynamodbEndpoint?: string;\n\n\t/**\n\t * AWS Dynamo DB region.\n\t */\n\tawsDynamodbRegion?: string;\n\n\t/**\n\t * AWS Dynamo DB secret access key.\n\t */\n\tawsDynamodbSecretAccessKey?: string;\n\n\t/**\n\t * AWS Dynamo DB connection timeout.\n\t */\n\tawsDynamodbConnectionTimeoutMs?: string;\n\n\t/**\n\t * Azure Cosmos DB key.\n\t */\n\tazureCosmosdbKey?: string;\n\n\t/**\n\t * Azure Cosmos DB container id.\n\t */\n\tazureCosmosdbContainerId?: string;\n\n\t/**\n\t * Azure Cosmos DB database id.\n\t */\n\tazureCosmosdbDatabaseId?: string;\n\n\t/**\n\t * Azure Cosmos DB endpoint.\n\t */\n\tazureCosmosdbEndpoint?: string;\n\n\t/**\n\t * GCP Firestore collection name.\n\t */\n\tgcpFirestoreCollectionName?: string;\n\n\t/**\n\t * GCP Firestore credentials.\n\t */\n\tgcpFirestoreCredentials?: string;\n\n\t/**\n\t * GCP Firestore database id.\n\t */\n\tgcpFirestoreDatabaseId?: string;\n\n\t/**\n\t * GCP Firestore endpoint.\n\t */\n\tgcpFirestoreApiEndpoint?: string;\n\n\t/**\n\t * GCP Firestore project id.\n\t */\n\tgcpFirestoreProjectId?: string;\n\n\t/**\n\t * ScyllaDB hosts as comma separated string.\n\t */\n\tscylladbHosts?: string;\n\n\t/**\n\t * ScyllaDB keyspace.\n\t */\n\tscylladbKeyspace?: string;\n\n\t/**\n\t * ScyllaDB local data center.\n\t */\n\tscylladbLocalDataCenter?: string;\n\n\t/**\n\t * ScyllaDB port.\n\t */\n\tscylladbPort?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: number;\n\n\t/**\n\t * MySQL username.\n\t */\n\tmySqlUser?: string;\n\n\t/**\n\t * MySQL password.\n\t */\n\tmySqlPassword?: string;\n\n\t/**\n\t * MySQL Database.\n\t */\n\tmySqlDatabase?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: number;\n\n\t/**\n\t * MongoDB username.\n\t */\n\tmongoDbUser?: string;\n\n\t/**\n\t * MongoDB password.\n\t */\n\tmongoDbPassword?: string;\n\n\t/**\n\t * MongoDB Database.\n\t */\n\tmongoDbDatabase?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: number;\n\n\t/**\n\t * PostgreSQl username.\n\t */\n\tpostgreSqlUser?: string;\n\n\t/**\n\t * PostgreSQl password.\n\t */\n\tpostgreSqlPassword?: string;\n\n\t/**\n\t * PostgreSQl Database.\n\t */\n\tpostgreSqlDatabase?: string;\n\n\t/**\n\t * The security token for accessing IPFS API.\n\t */\n\tipfsBearerToken?: string;\n\n\t/**\n\t * The url for accessing IPFS API.\n\t */\n\tipfsApiUrl?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.\n\t */\n\tblobStorageConnectorType?: string;\n\n\t/**\n\t * The default blob storage connector to use, defaults to the first one in the list.\n\t */\n\tblobStorageConnectorDefault?: string;\n\n\t/**\n\t * Blog storage connector which has public access.\n\t */\n\tblobStorageConnectorPublic?: string;\n\n\t/**\n\t * Enable encryption for the blob storage.\n\t */\n\tblobStorageEnableEncryption?: string;\n\n\t/**\n\t * The id of the encryption key for the blob storage.\n\t */\n\tblobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * A prefix for all the blobs in blob-storage, can be empty.\n\t */\n\tblobStoragePrefix?: string;\n\n\t/**\n\t * AWS S3 region.\n\t */\n\tawsS3Region?: string;\n\n\t/**\n\t * AWS S3 bucket name.\n\t */\n\tawsS3BucketName?: string;\n\n\t/**\n\t * AWS S3 auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsS3AuthMode?: string;\n\n\t/**\n\t * AWS S3 access key id.\n\t */\n\tawsS3AccessKeyId?: string;\n\n\t/**\n\t * AWS S3 secret access key.\n\t */\n\tawsS3SecretAccessKey?: string;\n\n\t/**\n\t * AWS S3 endpoint.\n\t */\n\tawsS3Endpoint?: string;\n\n\t/**\n\t * Azure Storage account key.\n\t */\n\tazureStorageAccountKey?: string;\n\n\t/**\n\t * Azure Storage account name.\n\t */\n\tazureStorageAccountName?: string;\n\n\t/**\n\t * Azure Storage container.\n\t */\n\tazureStorageContainerName?: string;\n\n\t/**\n\t * Azure Storage endpoint.\n\t */\n\tazureStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage bucket.\n\t */\n\tgcpStorageBucketName?: string;\n\n\t/**\n\t * GCP Storage credentials.\n\t */\n\tgcpStorageCredentials?: string;\n\n\t/**\n\t * GCP Storage endpoint.\n\t */\n\tgcpStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage project id.\n\t */\n\tgcpStorageProjectId?: string;\n\n\t/**\n\t * The type of the default vault connector: entity-storage, hashicorp.\n\t */\n\tvaultConnector?: string;\n\n\t/**\n\t * Prefix to prepend to entries in the vault.\n\t */\n\tvaultPrefix?: string;\n\n\t/**\n\t * Hashicorp Vault token.\n\t */\n\thashicorpVaultToken?: string;\n\n\t/**\n\t * Hashicorp Vault endpoint.\n\t */\n\thashicorpVaultEndpoint?: string;\n\n\t/**\n\t * The type of logging task connector, can be a comma separated list: console, entity-storage.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The type of event bus connector: local.\n\t */\n\teventBusConnector?: string;\n\n\t/**\n\t * The type of event bus component: service.\n\t */\n\teventBusComponent?: string;\n\n\t/**\n\t * Are the messaging components enabled, defaults to false.\n\t */\n\tmessagingEnabled?: string;\n\n\t/**\n\t * AWS SES region.\n\t */\n\tawsSesRegion?: string;\n\n\t/**\n\t * AWS SES auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsSesAuthMode?: string;\n\n\t/**\n\t * AWS SES secret access key.\n\t */\n\tawsSesSecretAccessKey?: string;\n\n\t/**\n\t * AWS SES access key id.\n\t */\n\tawsSesAccessKeyId?: string;\n\n\t/**\n\t * AWS SES endpoint.\n\t */\n\tawsSesEndpoint?: string;\n\n\t/**\n\t * The applications for the push notifications reference a separate json with @json: prefix.\n\t */\n\tawsMessagingPushNotificationApplications?: string;\n\n\t/**\n\t * The type of messaging email connector: entity-storage, aws.\n\t */\n\tmessagingEmailConnector?: string;\n\n\t/**\n\t * The type of messaging sms connector: entity-storage, aws.\n\t */\n\tmessagingSmsConnector?: string;\n\n\t/**\n\t * The type of messaging push notification connector: entity-storage, aws.\n\t */\n\tmessagingPushNotificationConnector?: string;\n\n\t/**\n\t * The type of telemetry connector: entity-storage.\n\t */\n\ttelemetryConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry meter to use, only required if using open-telemetry as telemetry connector, defaults to twin-node.\n\t */\n\topenTelemetryMeterName?: string;\n\n\t/**\n\t * The version of the Open Telemetry metrics specification to use, only required if using open-telemetry as telemetry connector, defaults to 1.0.0.\n\t */\n\topenTelemetryMeterVersion?: string;\n\n\t/**\n\t * The type of Open Telemetry metric reader to use, only required if using open-telemetry as telemetry connector, values: prometheus.\n\t */\n\topenTelemetryReader?: string;\n\n\t/**\n\t * The port to use for the Open Telemetry Prometheus metrics server, only required if using open-telemetry as telemetry connector and prometheus as reader, defaults to 9464.\n\t */\n\topenTelemetryPrometheusPort?: string;\n\n\t/**\n\t * The type of faucet connector: entity-storage, iota.\n\t */\n\tfaucetConnector?: string;\n\n\t/**\n\t * The type of wallet connector: entity-storage, iota.\n\t */\n\twalletConnector?: string;\n\n\t/**\n\t * The type of NFT connector: entity-storage, iota.\n\t */\n\tnftConnector?: string;\n\n\t/**\n\t * The type of notarization connector: entity-storage, iota.\n\t */\n\tnotarizationConnector?: string;\n\n\t/**\n\t * The type of identity connector: entity-storage, iota.\n\t */\n\tidentityConnector?: string;\n\n\t/**\n\t * The index of the wallet address to use, defaults to 0.\n\t */\n\tidentityWalletAddressIndex?: string;\n\n\t/**\n\t * The type of identity resolver connector: entity-storage, iota.\n\t */\n\tidentityResolverConnector?: string;\n\n\t/**\n\t * The type of verifiable storage connector: entity-storage, iota.\n\t */\n\tverifiableStorageConnector?: string;\n\n\t/**\n\t * IOTA Faucet Endpoint.\n\t */\n\tiotaFaucetEndpoint?: string;\n\n\t/**\n\t * IOTA Node Endpoint.\n\t */\n\tiotaNodeEndpoint?: string;\n\n\t/**\n\t * IOTA network.\n\t */\n\tiotaNetwork?: string;\n\n\t/**\n\t * IOTA coin type.\n\t */\n\tiotaCoinType?: string;\n\n\t/**\n\t * IOTA Explorer Endpoint.\n\t */\n\tiotaExplorerEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Endpoint.\n\t */\n\tiotaGasStationEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Authentication Token.\n\t */\n\tiotaGasStationAuthToken?: string;\n\n\t/**\n\t * Universal Resolver Endpoint.\n\t */\n\tuniversalResolverEndpoint?: string;\n\n\t/**\n\t * The type of identity profile connector: entity-storage.\n\t */\n\tidentityProfileConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with immutable proofs.\n\t */\n\timmutableProofVerificationMethodId?: string;\n\n\t/**\n\t * The type of attestation connector: entity-storage, iota.\n\t */\n\tattestationConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with attestation.\n\t */\n\tattestationVerificationMethodId?: string;\n\n\t/**\n\t * Is the data processing enabled, defaults to false.\n\t */\n\tdataProcessingEnabled?: string;\n\n\t/**\n\t * The type of the default data converters, can be a comma separated list: json, xml.\n\t */\n\tdataConverterConnectors?: string;\n\n\t/**\n\t * The type of the default data extractor, can be a comma separated list: json-path.\n\t */\n\tdataExtractorConnectors?: string;\n\n\t/**\n\t * Is the auditable item graph enabled, defaults to false.\n\t */\n\tauditableItemGraphEnabled?: string;\n\n\t/**\n\t * Is the auditable item stream enabled, defaults to false.\n\t */\n\tauditableItemStreamEnabled?: string;\n\n\t/**\n\t * Is the document management enabled, defaults to false.\n\t */\n\tdocumentManagementEnabled?: string;\n\n\t/**\n\t * Is the synchronised storage enabled, defaults to false.\n\t */\n\tsynchronisedStorageEnabled?: string;\n\n\t/**\n\t * Url which points to the api for a trusted synchronised storage node, not required if this is a trusted node.\n\t */\n\tsynchronisedStorageTrustedUrl?: string;\n\n\t/**\n\t * The key for the smart contract which contains the verifiable storage pointer store for synchronised storage.\n\t * This only required if using a custom verifiable storage item, otherwise it will default to the network name.\n\t */\n\tsynchronisedStorageVerifiableStorageKeyId?: string;\n\n\t/**\n\t * The key from the vault which is used to encrypt the synchronised storage blobs.\n\t * Only required for trusted nodes, as regular nodes will request from the trusted nodes.\n\t * Defaults to synchronised-storage-blob-encryption\n\t */\n\tsynchronisedStorageBlobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.\n\t * Only required for trusted nodes, as regular nodes will not write encrypted data.\n\t */\n\tsynchronisedStorageBlobStorageKey?: string;\n\n\t/**\n\t * How often to check for entity updates in minutes.\n\t * @default 5\n\t */\n\tsynchronisedStorageEntityUpdateIntervalMinutes?: string;\n\n\t/**\n\t * Interval to perform consolidation of changesets, only used if this is a trusted node.\n\t * @default 60\n\t */\n\tsynchronisedStorageConsolidationIntervalMinutes?: string;\n\n\t/**\n\t * The number of entities to process in a single consolidation batch, only used if this is a trusted node.\n\t * @default 1000\n\t */\n\tsynchronisedStorageConsolidationBatchSize?: string;\n\n\t/**\n\t * The maximum number of consolidations to keep in storage, only used if this is a trusted node.\n\t * @default 5\n\t */\n\tsynchronisedStorageMaxConsolidations?: string;\n\n\t/**\n\t * Federated catalog filters, command separated list of filters to add.\n\t */\n\tfederatedCatalogueFilters?: string;\n\n\t/**\n\t * The trust generators to add to the factory, comma separated list.\n\t */\n\ttrustGenerators?: string;\n\n\t/**\n\t * The trust verifiers to add to the factory, comma separated list.\n\t */\n\ttrustVerifiers?: string;\n\n\t/**\n\t * The verification method to use for trust identities.\n\t * Defaults to trust-assertion.\n\t */\n\ttrustVerificationMethodId?: string;\n\n\t/**\n\t * The trust time to live for generating JWTs.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtlSeconds?: string;\n\n\t/**\n\t * Path under which the rights management service is mounted (single source\n\t * of truth). The same value drives:\n\t * - the server route mount (via engine config)\n\t * - the PNP service's callback URL builder (`buildCallbackUrl`)\n\t * - the PNP rest-client's pathPrefix (consumer side)\n\t * Defaults to `rights-management`. Set when deploying behind a reverse proxy\n\t * with path rewriting, K8s ingress with path-based routing, or any custom\n\t * mount point.\n\t */\n\trightsManagementCallbackPath?: string;\n\n\t/**\n\t * The rights management policy information sources to add to the factory.\n\t */\n\trightsManagementPolicyInformationSources?: string;\n\n\t/**\n\t * The rights management policy negotiators sources to add to the factory.\n\t */\n\trightsManagementPolicyNegotiators?: string;\n\n\t/**\n\t * The rights management policy requesters to add to the factory.\n\t */\n\trightsManagementPolicyRequesters?: string;\n\n\t/**\n\t * The rights management policy execution actions to add to the factory.\n\t */\n\trightsManagementPolicyExecutionActions?: string;\n\n\t/**\n\t * The rights management policy enforcement processors to add to the factory.\n\t */\n\trightsManagementPolicyEnforcementProcessors?: string;\n\n\t/**\n\t * The rights management policy arbiters to add to the factory.\n\t */\n\trightsManagementPolicyArbiters?: string;\n\n\t/**\n\t * The rights management policy obligation enforcers to add to the factory.\n\t */\n\trightsManagementPolicyObligationEnforcers?: string;\n\n\t/**\n\t * Is the dataspace enabled, defaults to false.\n\t */\n\tdataspaceEnabled?: string;\n\n\t/**\n\t * The length of time to retain the activity logs for in minutes, set to -1 to keep forever.\n\t * @default 10\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval for cleaning up the activity logs.\n\t * @default 60\n\t */\n\tdataspaceActivityLogsCleanUpInterval?: string;\n\n\t/**\n\t * The data plane path for PULL transfers (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * Required if PULL transfers should be supported.\n\t * Example: \"dataspace/entities\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Are the health components enabled, defaults to false.\n\t */\n\thealthEnabled?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks, defaults to 60.\n\t */\n\thealthIntervalSeconds?: string;\n\n\t/**\n\t * The id of the key in the vault to use for encrypting parameters in url transformer.\n\t */\n\turlTransformerEncryptionKeyId?: string;\n\n\t/**\n\t * The type of the automation action to create, comma separate for more than one connector.\n\t * values: fetch\n\t */\n\tautomationActionTypes?: string;\n\n\t/**\n\t * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.\n\t */\n\textensions?: string;\n}\n"]}
1
+ {"version":3,"file":"IEngineEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine core environment variables.\n */\nexport interface IEngineEnvironmentVariables {\n\t/**\n\t * Start the engine in debug mode.\n\t */\n\tdebug?: string;\n\n\t/**\n\t * Start the engine in silent mode.\n\t */\n\tsilent?: string;\n\n\t/**\n\t * The root directory for storing items like state file.\n\t */\n\tstorageFileRoot?: string;\n\n\t/**\n\t * The name of the state file.\n\t */\n\tstateFilename?: string;\n\n\t/**\n\t * Does the node have a unique ID, defaults to true.\n\t */\n\tnodeIdentityEnabled?: string;\n\n\t/**\n\t * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql\n\t */\n\tentityStorageConnectorType?: string;\n\n\t/**\n\t * The default entity storage connector to use, defaults to the first one in the list.\n\t */\n\tentityStorageConnectorDefault?: string;\n\n\t/**\n\t * A prefix for all the table in entity-storage, can be empty.\n\t */\n\tentityStorageTablePrefix?: string;\n\n\t/**\n\t * AWS DynamoDB auth mode, either credentials or pod.\n\t */\n\tawsDynamodbAuthMode?: string;\n\n\t/**\n\t * AWS Dynamo DB access key id.\n\t */\n\tawsDynamodbAccessKeyId?: string;\n\n\t/**\n\t * AWS Dynamo DB Endpoint if running local instance.\n\t */\n\tawsDynamodbEndpoint?: string;\n\n\t/**\n\t * AWS Dynamo DB region.\n\t */\n\tawsDynamodbRegion?: string;\n\n\t/**\n\t * AWS Dynamo DB secret access key.\n\t */\n\tawsDynamodbSecretAccessKey?: string;\n\n\t/**\n\t * AWS Dynamo DB connection timeout.\n\t */\n\tawsDynamodbConnectionTimeoutMs?: string;\n\n\t/**\n\t * Azure Cosmos DB key.\n\t */\n\tazureCosmosdbKey?: string;\n\n\t/**\n\t * Azure Cosmos DB container id.\n\t */\n\tazureCosmosdbContainerId?: string;\n\n\t/**\n\t * Azure Cosmos DB database id.\n\t */\n\tazureCosmosdbDatabaseId?: string;\n\n\t/**\n\t * Azure Cosmos DB endpoint.\n\t */\n\tazureCosmosdbEndpoint?: string;\n\n\t/**\n\t * GCP Firestore collection name.\n\t */\n\tgcpFirestoreCollectionName?: string;\n\n\t/**\n\t * GCP Firestore credentials.\n\t */\n\tgcpFirestoreCredentials?: string;\n\n\t/**\n\t * GCP Firestore database id.\n\t */\n\tgcpFirestoreDatabaseId?: string;\n\n\t/**\n\t * GCP Firestore endpoint.\n\t */\n\tgcpFirestoreApiEndpoint?: string;\n\n\t/**\n\t * GCP Firestore project id.\n\t */\n\tgcpFirestoreProjectId?: string;\n\n\t/**\n\t * ScyllaDB hosts as comma separated string.\n\t */\n\tscylladbHosts?: string;\n\n\t/**\n\t * ScyllaDB keyspace.\n\t */\n\tscylladbKeyspace?: string;\n\n\t/**\n\t * ScyllaDB local data center.\n\t */\n\tscylladbLocalDataCenter?: string;\n\n\t/**\n\t * ScyllaDB port.\n\t */\n\tscylladbPort?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: number;\n\n\t/**\n\t * MySQL username.\n\t */\n\tmySqlUser?: string;\n\n\t/**\n\t * MySQL password.\n\t */\n\tmySqlPassword?: string;\n\n\t/**\n\t * MySQL Database.\n\t */\n\tmySqlDatabase?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: number;\n\n\t/**\n\t * MongoDB username.\n\t */\n\tmongoDbUser?: string;\n\n\t/**\n\t * MongoDB password.\n\t */\n\tmongoDbPassword?: string;\n\n\t/**\n\t * MongoDB Database.\n\t */\n\tmongoDbDatabase?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: number;\n\n\t/**\n\t * PostgreSQl username.\n\t */\n\tpostgreSqlUser?: string;\n\n\t/**\n\t * PostgreSQl password.\n\t */\n\tpostgreSqlPassword?: string;\n\n\t/**\n\t * PostgreSQl Database.\n\t */\n\tpostgreSqlDatabase?: string;\n\n\t/**\n\t * The security token for accessing IPFS API.\n\t */\n\tipfsBearerToken?: string;\n\n\t/**\n\t * The url for accessing IPFS API.\n\t */\n\tipfsApiUrl?: string;\n\n\t/**\n\t * The type of the entity storage to create, comma separate for more than one connector.\n\t * values: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.\n\t */\n\tblobStorageConnectorType?: string;\n\n\t/**\n\t * The default blob storage connector to use, defaults to the first one in the list.\n\t */\n\tblobStorageConnectorDefault?: string;\n\n\t/**\n\t * Blog storage connector which has public access.\n\t */\n\tblobStorageConnectorPublic?: string;\n\n\t/**\n\t * Enable encryption for the blob storage.\n\t */\n\tblobStorageEnableEncryption?: string;\n\n\t/**\n\t * The id of the encryption key for the blob storage.\n\t */\n\tblobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * A prefix for all the blobs in blob-storage, can be empty.\n\t */\n\tblobStoragePrefix?: string;\n\n\t/**\n\t * AWS S3 region.\n\t */\n\tawsS3Region?: string;\n\n\t/**\n\t * AWS S3 bucket name.\n\t */\n\tawsS3BucketName?: string;\n\n\t/**\n\t * AWS S3 auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsS3AuthMode?: string;\n\n\t/**\n\t * AWS S3 access key id.\n\t */\n\tawsS3AccessKeyId?: string;\n\n\t/**\n\t * AWS S3 secret access key.\n\t */\n\tawsS3SecretAccessKey?: string;\n\n\t/**\n\t * AWS S3 endpoint.\n\t */\n\tawsS3Endpoint?: string;\n\n\t/**\n\t * Azure Storage account key.\n\t */\n\tazureStorageAccountKey?: string;\n\n\t/**\n\t * Azure Storage account name.\n\t */\n\tazureStorageAccountName?: string;\n\n\t/**\n\t * Azure Storage container.\n\t */\n\tazureStorageContainerName?: string;\n\n\t/**\n\t * Azure Storage endpoint.\n\t */\n\tazureStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage bucket.\n\t */\n\tgcpStorageBucketName?: string;\n\n\t/**\n\t * GCP Storage credentials.\n\t */\n\tgcpStorageCredentials?: string;\n\n\t/**\n\t * GCP Storage endpoint.\n\t */\n\tgcpStorageEndpoint?: string;\n\n\t/**\n\t * GCP Storage project id.\n\t */\n\tgcpStorageProjectId?: string;\n\n\t/**\n\t * The type of the default vault connector: entity-storage, hashicorp.\n\t */\n\tvaultConnector?: string;\n\n\t/**\n\t * Prefix to prepend to entries in the vault.\n\t */\n\tvaultPrefix?: string;\n\n\t/**\n\t * Hashicorp Vault token.\n\t */\n\thashicorpVaultToken?: string;\n\n\t/**\n\t * Hashicorp Vault endpoint.\n\t */\n\thashicorpVaultEndpoint?: string;\n\n\t/**\n\t * The type of logging task connector, can be a comma separated list: console, entity-storage.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The type of event bus connector: local.\n\t */\n\teventBusConnector?: string;\n\n\t/**\n\t * The type of event bus component: service.\n\t */\n\teventBusComponent?: string;\n\n\t/**\n\t * Are the messaging components enabled, defaults to false.\n\t */\n\tmessagingEnabled?: string;\n\n\t/**\n\t * AWS SES region.\n\t */\n\tawsSesRegion?: string;\n\n\t/**\n\t * AWS SES auth mode, either credentials or pod, defaults to credentials.\n\t */\n\tawsSesAuthMode?: string;\n\n\t/**\n\t * AWS SES secret access key.\n\t */\n\tawsSesSecretAccessKey?: string;\n\n\t/**\n\t * AWS SES access key id.\n\t */\n\tawsSesAccessKeyId?: string;\n\n\t/**\n\t * AWS SES endpoint.\n\t */\n\tawsSesEndpoint?: string;\n\n\t/**\n\t * The applications for the push notifications reference a separate json with @json: prefix.\n\t */\n\tawsMessagingPushNotificationApplications?: string;\n\n\t/**\n\t * The type of messaging email connector: entity-storage, aws.\n\t */\n\tmessagingEmailConnector?: string;\n\n\t/**\n\t * The type of messaging sms connector: entity-storage, aws.\n\t */\n\tmessagingSmsConnector?: string;\n\n\t/**\n\t * The type of messaging push notification connector: entity-storage, aws.\n\t */\n\tmessagingPushNotificationConnector?: string;\n\n\t/**\n\t * The type of telemetry connector: entity-storage.\n\t */\n\ttelemetryConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry meter to use, only required if using open-telemetry as telemetry connector, defaults to twin-node.\n\t */\n\topenTelemetryMeterName?: string;\n\n\t/**\n\t * The version of the Open Telemetry metrics specification to use, only required if using open-telemetry as telemetry connector, defaults to 1.0.0.\n\t */\n\topenTelemetryMeterVersion?: string;\n\n\t/**\n\t * The type of Open Telemetry metric reader to use, only required if using open-telemetry as telemetry connector, values: prometheus.\n\t */\n\topenTelemetryReader?: string;\n\n\t/**\n\t * The port to use for the Open Telemetry Prometheus metrics server, only required if using open-telemetry as telemetry connector and prometheus as reader, defaults to 9464.\n\t */\n\topenTelemetryPrometheusPort?: string;\n\n\t/**\n\t * Polling interval in seconds for the telemetry metrics collector. Defaults to 60.\n\t */\n\ttelemetryMetricsCollectorIntervalSeconds?: string;\n\n\t/**\n\t * The type of telemetry metrics producers, can be a comma separated list: system, process.\n\t */\n\ttelemetryMetricsProducers?: string;\n\n\t/**\n\t * Maximum number of values retained per telemetry metric (count-based history cap). Defaults to 1440.\n\t */\n\ttelemetryMetricsProducerMaxHistory?: string;\n\n\t/**\n\t * The type of faucet connector: entity-storage, iota.\n\t */\n\tfaucetConnector?: string;\n\n\t/**\n\t * The type of wallet connector: entity-storage, iota.\n\t */\n\twalletConnector?: string;\n\n\t/**\n\t * The type of NFT connector: entity-storage, iota.\n\t */\n\tnftConnector?: string;\n\n\t/**\n\t * The type of notarization connector: entity-storage, iota.\n\t */\n\tnotarizationConnector?: string;\n\n\t/**\n\t * The type of identity connector: entity-storage, iota.\n\t */\n\tidentityConnector?: string;\n\n\t/**\n\t * The index of the wallet address to use, defaults to 0.\n\t */\n\tidentityWalletAddressIndex?: string;\n\n\t/**\n\t * The type of identity resolver connector: entity-storage, iota.\n\t */\n\tidentityResolverConnector?: string;\n\n\t/**\n\t * The type of verifiable storage connector: entity-storage, iota.\n\t */\n\tverifiableStorageConnector?: string;\n\n\t/**\n\t * IOTA Faucet Endpoint.\n\t */\n\tiotaFaucetEndpoint?: string;\n\n\t/**\n\t * IOTA Node Endpoint.\n\t */\n\tiotaNodeEndpoint?: string;\n\n\t/**\n\t * IOTA network.\n\t */\n\tiotaNetwork?: string;\n\n\t/**\n\t * IOTA coin type.\n\t */\n\tiotaCoinType?: string;\n\n\t/**\n\t * IOTA Explorer Endpoint.\n\t */\n\tiotaExplorerEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Endpoint.\n\t */\n\tiotaGasStationEndpoint?: string;\n\n\t/**\n\t * IOTA Gas Station Authentication Token.\n\t */\n\tiotaGasStationAuthToken?: string;\n\n\t/**\n\t * Universal Resolver Endpoint.\n\t */\n\tuniversalResolverEndpoint?: string;\n\n\t/**\n\t * The type of identity profile connector: entity-storage.\n\t */\n\tidentityProfileConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with immutable proofs.\n\t */\n\timmutableProofVerificationMethodId?: string;\n\n\t/**\n\t * The type of attestation connector: entity-storage, iota.\n\t */\n\tattestationConnector?: string;\n\n\t/**\n\t * The identity verification method id to use with attestation.\n\t */\n\tattestationVerificationMethodId?: string;\n\n\t/**\n\t * Is the data processing enabled, defaults to false.\n\t */\n\tdataProcessingEnabled?: string;\n\n\t/**\n\t * The type of the default data converters, can be a comma separated list: json, xml.\n\t */\n\tdataConverterConnectors?: string;\n\n\t/**\n\t * The type of the default data extractor, can be a comma separated list: json-path.\n\t */\n\tdataExtractorConnectors?: string;\n\n\t/**\n\t * Is the auditable item graph enabled, defaults to false.\n\t */\n\tauditableItemGraphEnabled?: string;\n\n\t/**\n\t * Is the auditable item stream enabled, defaults to false.\n\t */\n\tauditableItemStreamEnabled?: string;\n\n\t/**\n\t * Is the document management enabled, defaults to false.\n\t */\n\tdocumentManagementEnabled?: string;\n\n\t/**\n\t * Is the synchronised storage enabled, defaults to false.\n\t */\n\tsynchronisedStorageEnabled?: string;\n\n\t/**\n\t * Url which points to the api for a trusted synchronised storage node, not required if this is a trusted node.\n\t */\n\tsynchronisedStorageTrustedUrl?: string;\n\n\t/**\n\t * The key for the smart contract which contains the verifiable storage pointer store for synchronised storage.\n\t * This only required if using a custom verifiable storage item, otherwise it will default to the network name.\n\t */\n\tsynchronisedStorageVerifiableStorageKeyId?: string;\n\n\t/**\n\t * The key from the vault which is used to encrypt the synchronised storage blobs.\n\t * Only required for trusted nodes, as regular nodes will request from the trusted nodes.\n\t * Defaults to synchronised-storage-blob-encryption\n\t */\n\tsynchronisedStorageBlobStorageEncryptionKeyId?: string;\n\n\t/**\n\t * The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.\n\t * Only required for trusted nodes, as regular nodes will not write encrypted data.\n\t */\n\tsynchronisedStorageBlobStorageKey?: string;\n\n\t/**\n\t * How often to check for entity updates in minutes.\n\t * @default 5\n\t */\n\tsynchronisedStorageEntityUpdateIntervalMinutes?: string;\n\n\t/**\n\t * Interval to perform consolidation of changesets, only used if this is a trusted node.\n\t * @default 60\n\t */\n\tsynchronisedStorageConsolidationIntervalMinutes?: string;\n\n\t/**\n\t * The number of entities to process in a single consolidation batch, only used if this is a trusted node.\n\t * @default 1000\n\t */\n\tsynchronisedStorageConsolidationBatchSize?: string;\n\n\t/**\n\t * The maximum number of consolidations to keep in storage, only used if this is a trusted node.\n\t * @default 5\n\t */\n\tsynchronisedStorageMaxConsolidations?: string;\n\n\t/**\n\t * Federated catalog filters, command separated list of filters to add.\n\t */\n\tfederatedCatalogueFilters?: string;\n\n\t/**\n\t * The trust generators to add to the factory, comma separated list.\n\t */\n\ttrustGenerators?: string;\n\n\t/**\n\t * The trust verifiers to add to the factory, comma separated list.\n\t */\n\ttrustVerifiers?: string;\n\n\t/**\n\t * The verification method to use for trust identities.\n\t * Defaults to trust-assertion.\n\t */\n\ttrustVerificationMethodId?: string;\n\n\t/**\n\t * The trust time to live for generating JWTs.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtlSeconds?: string;\n\n\t/**\n\t * Path under which the rights management service is mounted (single source\n\t * of truth). The same value drives:\n\t * - the server route mount (via engine config)\n\t * - the PNP service's callback URL builder (`buildCallbackUrl`)\n\t * - the PNP rest-client's pathPrefix (consumer side)\n\t * Defaults to `rights-management`. Set when deploying behind a reverse proxy\n\t * with path rewriting, K8s ingress with path-based routing, or any custom\n\t * mount point.\n\t */\n\trightsManagementCallbackPath?: string;\n\n\t/**\n\t * The rights management policy information sources to add to the factory.\n\t */\n\trightsManagementPolicyInformationSources?: string;\n\n\t/**\n\t * The rights management policy negotiators sources to add to the factory.\n\t */\n\trightsManagementPolicyNegotiators?: string;\n\n\t/**\n\t * The rights management policy requesters to add to the factory.\n\t */\n\trightsManagementPolicyRequesters?: string;\n\n\t/**\n\t * The rights management policy execution actions to add to the factory.\n\t */\n\trightsManagementPolicyExecutionActions?: string;\n\n\t/**\n\t * The rights management policy enforcement processors to add to the factory.\n\t */\n\trightsManagementPolicyEnforcementProcessors?: string;\n\n\t/**\n\t * The rights management policy arbiters to add to the factory.\n\t */\n\trightsManagementPolicyArbiters?: string;\n\n\t/**\n\t * The rights management policy obligation enforcers to add to the factory.\n\t */\n\trightsManagementPolicyObligationEnforcers?: string;\n\n\t/**\n\t * Is the dataspace enabled, defaults to false.\n\t */\n\tdataspaceEnabled?: string;\n\n\t/**\n\t * The length of time to retain the activity logs for in minutes, set to -1 to keep forever.\n\t * @default 10\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval for cleaning up the activity logs.\n\t * @default 60\n\t */\n\tdataspaceActivityLogsCleanUpInterval?: string;\n\n\t/**\n\t * The data plane path for PULL transfers (path only, not full URL).\n\t * Will be combined with public origin from hosting component.\n\t * Required if PULL transfers should be supported.\n\t * Example: \"dataspace/entities\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Are the health components enabled, defaults to false.\n\t */\n\thealthEnabled?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks, defaults to 60.\n\t */\n\thealthIntervalSeconds?: string;\n\n\t/**\n\t * The id of the key in the vault to use for encrypting parameters in url transformer.\n\t */\n\turlTransformerEncryptionKeyId?: string;\n\n\t/**\n\t * The type of the automation action to create, comma separate for more than one connector.\n\t * values: fetch\n\t */\n\tautomationActionTypes?: string;\n\n\t/**\n\t * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.\n\t */\n\textensions?: string;\n}\n"]}
package/dist/es/node.js CHANGED
@@ -28,7 +28,7 @@ export async function run(nodeOptions, args) {
28
28
  nodeOptions ??= {};
29
29
  const serverInfo = {
30
30
  name: nodeOptions?.serverName ?? "TWIN Node",
31
- version: nodeOptions?.serverVersion ?? "0.0.3-next.36" // x-release-please-version
31
+ version: nodeOptions?.serverVersion ?? "0.0.3-next.38" // x-release-please-version
32
32
  };
33
33
  CLIDisplay.header(serverInfo.name, serverInfo.version, "🌩️ ");
34
34
  if (!Is.stringValue(nodeOptions?.executionDirectory)) {
@@ -1 +1 @@
1
- {"version":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,CAAC,CAAC;oBAC3D,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;oBACzE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;oBACvD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC5C,IAAI,MAAM,EAAE,CAAC;wBACZ,YAAY,GAAG,UAAU,CAAC;oBAC3B,CAAC;gBACF,CAAC;gBAAC,MAAM,CAAC;oBACR,4CAA4C;gBAC7C,CAAC;gBACD,MAAM;YACP,CAAC;QACF,CAAC;QAED,0CAA0C;QAC1C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC;YACjE,WAAW,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;YACjC,OAAO;gBACN,MAAM;gBACN,UAAU,EAAE,KAAK;aACjB,CAAC;QACH,CAAC;QAED,OAAO;YACN,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,IAAI;SAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc;IACtB,YAAY,KAAK,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5E,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { execSync } from \"node:child_process\";\nimport path from \"node:path\";\nimport type { IServerInfo } from \"@twin.org/api-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { BaseError, Coerce, EnvHelper, GeneralError, Is, ObjectHelper } from \"@twin.org/core\";\nimport type { Engine } from \"@twin.org/engine\";\nimport type { EngineServer } from \"@twin.org/engine-server\";\nimport type { IEngineServerConfig } from \"@twin.org/engine-server-types\";\nimport { ModuleHelper } from \"@twin.org/modules\";\nimport * as dotenv from \"dotenv\";\nimport { buildEngineConfiguration } from \"./builders/engineEnvBuilder.js\";\nimport { buildEngineServerConfiguration } from \"./builders/engineServerEnvBuilder.js\";\nimport { extensionsConfiguration } from \"./builders/extensionsBuilder.js\";\nimport { constructCliCommand, parseCommandLineArgs, registerCommands } from \"./cli.js\";\nimport { getEnvDefaults } from \"./defaults.js\";\nimport type { INodeEngineConfig } from \"./models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"./models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"./models/INodeEnvironmentVariables.js\";\nimport type { INodeOptions } from \"./models/INodeOptions.js\";\nimport { ModuleProtocol } from \"./models/moduleProtocol.js\";\nimport { start } from \"./start.js\";\nimport {\n\tcreateModuleImportUrl,\n\tfileExists,\n\tgetExecutionDirectory,\n\tgetExtensionsCacheDir,\n\tgetScriptDirectory,\n\thandleHttpsProtocol,\n\thandleNpmProtocol,\n\tinitialiseLocales,\n\tloadJsonFile,\n\tloadTextFile,\n\tparseModuleProtocol,\n\tresolvePackageEntryPoint\n} from \"./utils.js\";\n\nconst moduleCache: { [id: string]: unknown } = {};\nlet npmRootCache: string | undefined;\n\n/**\n * Run the TWIN Node.\n * @param nodeOptions Optional configuration options for running the server.\n * @param args Optional command line arguments.\n * @returns A promise that resolves when the server is started containing a shutdown method.\n */\nexport async function run(\n\tnodeOptions?: INodeOptions,\n\targs?: string[]\n): Promise<\n\t| {\n\t\t\tengine: Engine<IEngineServerConfig, INodeEngineState>;\n\t\t\tserver: EngineServer;\n\t\t\tshutdown: () => Promise<void>;\n\t }\n\t| undefined\n> {\n\tlet showErrorDetails = true;\n\ttry {\n\t\tnodeOptions ??= {};\n\n\t\tconst serverInfo: IServerInfo = {\n\t\t\tname: nodeOptions?.serverName ?? \"TWIN Node\",\n\t\t\tversion: nodeOptions?.serverVersion ?? \"0.0.3-next.36\" // x-release-please-version\n\t\t};\n\n\t\tCLIDisplay.header(serverInfo.name, serverInfo.version, \"🌩️ \");\n\n\t\tif (!Is.stringValue(nodeOptions?.executionDirectory)) {\n\t\t\tnodeOptions.executionDirectory = getExecutionDirectory();\n\t\t}\n\t\tCLIDisplay.value(\"Execution Directory\", nodeOptions.executionDirectory);\n\n\t\tif (!Is.stringValue(nodeOptions?.scriptDirectory)) {\n\t\t\tnodeOptions.scriptDirectory = getScriptDirectory(args);\n\t\t}\n\t\tCLIDisplay.value(\"Script Directory\", nodeOptions.scriptDirectory);\n\n\t\tnodeOptions.localesDirectory =\n\t\t\tnodeOptions?.localesDirectory ??\n\t\t\tpath.resolve(path.join(nodeOptions.scriptDirectory, \"dist\", \"locales\"));\n\n\t\tCLIDisplay.value(\"Locales Directory\", nodeOptions.localesDirectory);\n\t\tawait initialiseLocales(nodeOptions.localesDirectory);\n\n\t\tnodeOptions.envPrefix ??= \"TWIN_\";\n\n\t\toverrideModuleImport(nodeOptions.executionDirectory ?? \"\");\n\n\t\tconst commandLineArgs = parseCommandLineArgs(args);\n\n\t\tconst hasEnvPrefix = commandLineArgs.options?.find(option => option.key === \"env-prefix\");\n\t\tif (hasEnvPrefix) {\n\t\t\tnodeOptions.envPrefix = Coerce.string(hasEnvPrefix.value) ?? nodeOptions.envPrefix;\n\t\t}\n\n\t\tCLIDisplay.value(\"Environment Variable Prefix\", nodeOptions.envPrefix);\n\n\t\t// This is the only location in the code base that should access process.env directly\n\t\t// So we can safely disable the linting rule here.\n\t\tlet finalEnvVars =\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tprocess.env as {\n\t\t\t\t[id: string]: string;\n\t\t\t};\n\n\t\tif (Is.objectValue(nodeOptions?.envVars)) {\n\t\t\tfinalEnvVars = {\n\t\t\t\t...finalEnvVars,\n\t\t\t\t...nodeOptions.envVars\n\t\t\t};\n\t\t}\n\n\t\tfinalEnvVars = {\n\t\t\t...getEnvDefaults(nodeOptions.envPrefix),\n\t\t\t...finalEnvVars\n\t\t};\n\n\t\tlet cliCommand;\n\t\tif (Is.arrayValue(commandLineArgs.options)) {\n\t\t\tregisterCommands();\n\t\t\tcliCommand = constructCliCommand(finalEnvVars, commandLineArgs);\n\t\t}\n\n\t\tif (Is.object(cliCommand)) {\n\t\t\tfinalEnvVars[`${nodeOptions.envPrefix}SILENT`] ??= \"true\";\n\t\t} else {\n\t\t\tif (Is.empty(nodeOptions?.openApiSpecFile)) {\n\t\t\t\tconst specFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"docs\", \"open-api\", \"spec.json\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(specFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.openApiSpecFile = specFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.openApiSpecFile)) {\n\t\t\t\tCLIDisplay.value(\"OpenAPI Spec File\", nodeOptions.openApiSpecFile);\n\t\t\t}\n\n\t\t\tif (Is.empty(nodeOptions?.favIconFile)) {\n\t\t\t\tconst favIconFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"static\", \"favicon.png\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(favIconFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.favIconFile = favIconFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.favIconFile)) {\n\t\t\t\tCLIDisplay.value(\"Favicon File\", nodeOptions.favIconFile);\n\t\t\t}\n\t\t}\n\n\t\tconst { nodeEngineConfig, nodeEnvVars, availableContextIdKeys } = await buildConfiguration(\n\t\t\tfinalEnvVars,\n\t\t\tnodeOptions,\n\t\t\tserverInfo\n\t\t);\n\n\t\tCLIDisplay.break();\n\n\t\tconst startResult = await start(\n\t\t\tnodeOptions,\n\t\t\tnodeEngineConfig,\n\t\t\tnodeEnvVars,\n\t\t\tcliCommand,\n\t\t\tavailableContextIdKeys\n\t\t);\n\n\t\tif (!Is.empty(startResult)) {\n\t\t\tshowErrorDetails = false;\n\n\t\t\tlet isShuttingDown = false;\n\t\t\tfor (const signal of [\"SIGHUP\", \"SIGINT\", \"SIGTERM\"]) {\n\t\t\t\tprocess.on(signal, async () => {\n\t\t\t\t\tif (!isShuttingDown) {\n\t\t\t\t\t\tisShuttingDown = true;\n\t\t\t\t\t\tCLIDisplay.value(\"Terminate Signal\", signal);\n\t\t\t\t\t\tawait startResult.shutdown();\n\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn startResult;\n\t} catch (err) {\n\t\tif (nodeOptions?.disableProcessExitOnFailure ?? false) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tif (showErrorDetails) {\n\t\t\tconst baseError = BaseError.fromError(err);\n\t\t\tif (baseError.source === \"node\") {\n\t\t\t\tObjectHelper.propertyDelete(err, \"stack\");\n\t\t\t}\n\t\t\tCLIDisplay.error(err);\n\t\t}\n\n\t\t// eslint-disable-next-line unicorn/no-process-exit\n\t\tprocess.exit(1);\n\t}\n}\n\n/**\n * Build the configuration for the TWIN Node.\n * @param processEnv The environment variables from the process.\n * @param options The options for running the server.\n * @param serverInfo The server information.\n * @returns A promise that resolves to the engine server configuration, environment prefix, environment variables,\n * and options.\n */\nexport async function buildConfiguration(\n\tprocessEnv: {\n\t\t[id: string]: string;\n\t},\n\toptions: INodeOptions,\n\tserverInfo: IServerInfo\n): Promise<{\n\tnodeEnvVars: INodeEnvironmentVariables & { [id: string]: string | unknown };\n\tnodeEngineConfig: INodeEngineConfig;\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[];\n}> {\n\tconst availableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[] = [];\n\n\tlet defaultEnvOnly = false;\n\tif (Is.empty(options?.envFilenames)) {\n\t\tconst envFile = path.resolve(path.join(options.executionDirectory ?? \"\", \".env\"));\n\t\tCLIDisplay.value(\"Default Environment File\", envFile);\n\t\toptions ??= {};\n\t\toptions.envFilenames = [envFile];\n\t\tdefaultEnvOnly = true;\n\t}\n\n\tif (Is.arrayValue(options?.envFilenames)) {\n\t\tconst output = dotenv.config({\n\t\t\tpath: options?.envFilenames,\n\t\t\tquiet: true\n\t\t});\n\n\t\t// We don't want to throw an error if the default environment file is not found.\n\t\t// Only if we have custom environment files.\n\t\tif (!defaultEnvOnly && output.error) {\n\t\t\tthrow output.error;\n\t\t}\n\n\t\tif (Is.objectValue(output.parsed)) {\n\t\t\tfor (const [key, value] of Object.entries(output.parsed)) {\n\t\t\t\t// Only set environment variables that are not already set in\n\t\t\t\t// the process environment or provided via options.envVars\n\t\t\t\tprocessEnv[key] ??= value;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst envVars = EnvHelper.envToJson<{ [id: string]: string | unknown }>(\n\t\tprocessEnv,\n\t\toptions.envPrefix ?? \"\"\n\t);\n\n\t// Expand any environment variables that use the @file: syntax\n\tconst keys = Object.keys(envVars);\n\tfor (const key of keys) {\n\t\tif (\n\t\t\tIs.stringValue(envVars[key]) &&\n\t\t\t(envVars[key].startsWith(\"@text:\") || envVars[key].startsWith(\"@json:\"))\n\t\t) {\n\t\t\tconst filePath = envVars[key].slice(6).trim();\n\t\t\tconst embeddedFile = path.resolve(path.join(options.executionDirectory ?? \"\", filePath));\n\n\t\t\tif (envVars[key].startsWith(\"@text:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from text file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadTextFile(embeddedFile);\n\t\t\t} else if (envVars[key].startsWith(\"@json:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from JSON file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadJsonFile(embeddedFile);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Extend the environment variables with any additional custom configuration.\n\tif (Is.function(options?.extendEnvVars)) {\n\t\tCLIDisplay.task(\"Extending Environment Variables\");\n\t\tawait options.extendEnvVars(envVars);\n\t}\n\n\t// Build the engine configuration from the environment variables.\n\tconst coreConfig = await buildEngineConfiguration(envVars, availableContextIdKeys);\n\tconst engineServerConfig = await buildEngineServerConfiguration(\n\t\tenvVars,\n\t\tavailableContextIdKeys,\n\t\tcoreConfig,\n\t\tserverInfo,\n\t\toptions?.openApiSpecFile,\n\t\toptions?.favIconFile\n\t);\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.arrayValue(options?.configFilenames)) {\n\t\tfor (const configFile of options.configFilenames) {\n\t\t\tCLIDisplay.value(\"Loading Configuration File\", configFile);\n\t\t\tconst configFilePath = path.resolve(path.join(options.executionDirectory ?? \"\", configFile));\n\t\t\tconst config = await loadJsonFile(configFilePath);\n\t\t\tObject.assign(engineServerConfig, config);\n\t\t}\n\t}\n\n\tif (Is.objectValue(options?.config)) {\n\t\tCLIDisplay.task(\"Merging Custom Configuration\");\n\t\tObject.assign(engineServerConfig, options.config);\n\t}\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.function(options?.extendConfig)) {\n\t\tCLIDisplay.task(\"Extending Configuration\");\n\t\tawait options.extendConfig(envVars, engineServerConfig);\n\t}\n\n\tconst nodeEngineConfig = await extensionsConfiguration(envVars, engineServerConfig);\n\n\treturn { nodeEngineConfig, nodeEnvVars: envVars, availableContextIdKeys };\n}\n\n/**\n * Override module imports to support protocol-based loading (npm:, https:) and local files.\n * @param executionDirectory The execution directory for resolving local module paths.\n * @param envVars The environment variables containing extension configuration (optional, uses defaults if not provided).\n */\nexport function overrideModuleImport(\n\texecutionDirectory: string,\n\tenvVars?: INodeEnvironmentVariables\n): void {\n\tconst maxSizeMb = Coerce.number(envVars?.extensionsMaxSizeMb) ?? 10;\n\tconst cacheDirectory = envVars?.extensionsCacheDirectory;\n\n\tModuleHelper.overrideImport(async moduleName => {\n\t\tif (moduleCache[moduleName]) {\n\t\t\treturn {\n\t\t\t\tmodule: moduleCache[moduleName],\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\tconst parsed = parseModuleProtocol(moduleName);\n\t\tlet resolvedPath: string | undefined;\n\n\t\tswitch (parsed.protocol) {\n\t\t\tcase ModuleProtocol.Npm: {\n\t\t\t\tconst result = await handleNpmProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tcacheDirectory\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Https: {\n\t\t\t\tconst result = await handleHttpsProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tmaxSizeMb,\n\t\t\t\t\tcacheDirectory,\n\t\t\t\t\tenvVars?.extensionsCacheTtlHours,\n\t\t\t\t\tenvVars?.extensionsForceRefresh\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Http: {\n\t\t\t\tthrow new GeneralError(\"node\", \"insecureProtocol\", { protocol: ModuleProtocol.Http });\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Local: {\n\t\t\t\tlet localFilename = path.resolve(moduleName);\n\n\t\t\t\tlet exists = await fileExists(localFilename);\n\t\t\t\tif (!exists) {\n\t\t\t\t\tlocalFilename = path.resolve(executionDirectory, moduleName);\n\t\t\t\t\texists = await fileExists(localFilename);\n\t\t\t\t}\n\n\t\t\t\tif (exists) {\n\t\t\t\t\tresolvedPath = localFilename;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Default: {\n\t\t\t\ttry {\n\t\t\t\t\tconst packagePath = path.resolve(getNpmRootPath(), moduleName);\n\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Continue to fallback resolution\n\t\t\t\t}\n\n\t\t\t\t// Fallback: resolve from npm protocol cache directory (installed via handleNpmProtocol)\n\t\t\t\ttry {\n\t\t\t\t\tconst cacheNpmRoot = path.resolve(\n\t\t\t\t\t\tgetExtensionsCacheDir(executionDirectory, ModuleProtocol.Npm, cacheDirectory),\n\t\t\t\t\t\t\"node_modules\"\n\t\t\t\t\t);\n\n\t\t\t\t\tconst packagePath = path.resolve(cacheNpmRoot, moduleName);\n\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// No cached resolution either; fall through\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Common module loading and caching logic\n\t\tif (resolvedPath) {\n\t\t\tconst module = await import(createModuleImportUrl(resolvedPath));\n\t\t\tmoduleCache[moduleName] = module;\n\t\t\treturn {\n\t\t\t\tmodule,\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tmodule: undefined,\n\t\t\tuseDefault: true\n\t\t};\n\t});\n}\n\n/**\n * Get the root path for npm modules by executing \"npm root\" command and cache it.\n * @returns The root path for npm modules.\n */\nfunction getNpmRootPath(): string {\n\tnpmRootCache ??= execSync(\"npm root\").toString().trim().replace(/\\\\/g, \"/\");\n\treturn npmRootCache;\n}\n"]}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,gC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WAAW,EAAE,UAAU,CAAC,CAAC;oBACzE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;oBACvD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC5C,IAAI,MAAM,EAAE,CAAC;wBACZ,YAAY,GAAG,UAAU,CAAC;oBAC3B,CAAC;gBACF,CAAC;gBAAC,MAAM,CAAC;oBACR,4CAA4C;gBAC7C,CAAC;gBACD,MAAM;YACP,CAAC;QACF,CAAC;QAED,0CAA0C;QAC1C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC;YACjE,WAAW,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;YACjC,OAAO;gBACN,MAAM;gBACN,UAAU,EAAE,KAAK;aACjB,CAAC;QACH,CAAC;QAED,OAAO;YACN,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,IAAI;SAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc;IACtB,YAAY,KAAK,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5E,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { execSync } from \"node:child_process\";\nimport path from \"node:path\";\nimport type { IServerInfo } from \"@twin.org/api-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { BaseError, Coerce, EnvHelper, GeneralError, Is, ObjectHelper } from \"@twin.org/core\";\nimport type { Engine } from \"@twin.org/engine\";\nimport type { EngineServer } from \"@twin.org/engine-server\";\nimport type { IEngineServerConfig } from \"@twin.org/engine-server-types\";\nimport { ModuleHelper } from \"@twin.org/modules\";\nimport * as dotenv from \"dotenv\";\nimport { buildEngineConfiguration } from \"./builders/engineEnvBuilder.js\";\nimport { buildEngineServerConfiguration } from \"./builders/engineServerEnvBuilder.js\";\nimport { extensionsConfiguration } from \"./builders/extensionsBuilder.js\";\nimport { constructCliCommand, parseCommandLineArgs, registerCommands } from \"./cli.js\";\nimport { getEnvDefaults } from \"./defaults.js\";\nimport type { INodeEngineConfig } from \"./models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"./models/INodeEngineState.js\";\nimport type { INodeEnvironmentVariables } from \"./models/INodeEnvironmentVariables.js\";\nimport type { INodeOptions } from \"./models/INodeOptions.js\";\nimport { ModuleProtocol } from \"./models/moduleProtocol.js\";\nimport { start } from \"./start.js\";\nimport {\n\tcreateModuleImportUrl,\n\tfileExists,\n\tgetExecutionDirectory,\n\tgetExtensionsCacheDir,\n\tgetScriptDirectory,\n\thandleHttpsProtocol,\n\thandleNpmProtocol,\n\tinitialiseLocales,\n\tloadJsonFile,\n\tloadTextFile,\n\tparseModuleProtocol,\n\tresolvePackageEntryPoint\n} from \"./utils.js\";\n\nconst moduleCache: { [id: string]: unknown } = {};\nlet npmRootCache: string | undefined;\n\n/**\n * Run the TWIN Node.\n * @param nodeOptions Optional configuration options for running the server.\n * @param args Optional command line arguments.\n * @returns A promise that resolves when the server is started containing a shutdown method.\n */\nexport async function run(\n\tnodeOptions?: INodeOptions,\n\targs?: string[]\n): Promise<\n\t| {\n\t\t\tengine: Engine<IEngineServerConfig, INodeEngineState>;\n\t\t\tserver: EngineServer;\n\t\t\tshutdown: () => Promise<void>;\n\t }\n\t| undefined\n> {\n\tlet showErrorDetails = true;\n\ttry {\n\t\tnodeOptions ??= {};\n\n\t\tconst serverInfo: IServerInfo = {\n\t\t\tname: nodeOptions?.serverName ?? \"TWIN Node\",\n\t\t\tversion: nodeOptions?.serverVersion ?? \"0.0.3-next.38\" // x-release-please-version\n\t\t};\n\n\t\tCLIDisplay.header(serverInfo.name, serverInfo.version, \"🌩️ \");\n\n\t\tif (!Is.stringValue(nodeOptions?.executionDirectory)) {\n\t\t\tnodeOptions.executionDirectory = getExecutionDirectory();\n\t\t}\n\t\tCLIDisplay.value(\"Execution Directory\", nodeOptions.executionDirectory);\n\n\t\tif (!Is.stringValue(nodeOptions?.scriptDirectory)) {\n\t\t\tnodeOptions.scriptDirectory = getScriptDirectory(args);\n\t\t}\n\t\tCLIDisplay.value(\"Script Directory\", nodeOptions.scriptDirectory);\n\n\t\tnodeOptions.localesDirectory =\n\t\t\tnodeOptions?.localesDirectory ??\n\t\t\tpath.resolve(path.join(nodeOptions.scriptDirectory, \"dist\", \"locales\"));\n\n\t\tCLIDisplay.value(\"Locales Directory\", nodeOptions.localesDirectory);\n\t\tawait initialiseLocales(nodeOptions.localesDirectory);\n\n\t\tnodeOptions.envPrefix ??= \"TWIN_\";\n\n\t\toverrideModuleImport(nodeOptions.executionDirectory ?? \"\");\n\n\t\tconst commandLineArgs = parseCommandLineArgs(args);\n\n\t\tconst hasEnvPrefix = commandLineArgs.options?.find(option => option.key === \"env-prefix\");\n\t\tif (hasEnvPrefix) {\n\t\t\tnodeOptions.envPrefix = Coerce.string(hasEnvPrefix.value) ?? nodeOptions.envPrefix;\n\t\t}\n\n\t\tCLIDisplay.value(\"Environment Variable Prefix\", nodeOptions.envPrefix);\n\n\t\t// This is the only location in the code base that should access process.env directly\n\t\t// So we can safely disable the linting rule here.\n\t\tlet finalEnvVars =\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tprocess.env as {\n\t\t\t\t[id: string]: string;\n\t\t\t};\n\n\t\tif (Is.objectValue(nodeOptions?.envVars)) {\n\t\t\tfinalEnvVars = {\n\t\t\t\t...finalEnvVars,\n\t\t\t\t...nodeOptions.envVars\n\t\t\t};\n\t\t}\n\n\t\tfinalEnvVars = {\n\t\t\t...getEnvDefaults(nodeOptions.envPrefix),\n\t\t\t...finalEnvVars\n\t\t};\n\n\t\tlet cliCommand;\n\t\tif (Is.arrayValue(commandLineArgs.options)) {\n\t\t\tregisterCommands();\n\t\t\tcliCommand = constructCliCommand(finalEnvVars, commandLineArgs);\n\t\t}\n\n\t\tif (Is.object(cliCommand)) {\n\t\t\tfinalEnvVars[`${nodeOptions.envPrefix}SILENT`] ??= \"true\";\n\t\t} else {\n\t\t\tif (Is.empty(nodeOptions?.openApiSpecFile)) {\n\t\t\t\tconst specFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"docs\", \"open-api\", \"spec.json\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(specFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.openApiSpecFile = specFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.openApiSpecFile)) {\n\t\t\t\tCLIDisplay.value(\"OpenAPI Spec File\", nodeOptions.openApiSpecFile);\n\t\t\t}\n\n\t\t\tif (Is.empty(nodeOptions?.favIconFile)) {\n\t\t\t\tconst favIconFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"static\", \"favicon.png\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(favIconFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.favIconFile = favIconFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.favIconFile)) {\n\t\t\t\tCLIDisplay.value(\"Favicon File\", nodeOptions.favIconFile);\n\t\t\t}\n\t\t}\n\n\t\tconst { nodeEngineConfig, nodeEnvVars, availableContextIdKeys } = await buildConfiguration(\n\t\t\tfinalEnvVars,\n\t\t\tnodeOptions,\n\t\t\tserverInfo\n\t\t);\n\n\t\tCLIDisplay.break();\n\n\t\tconst startResult = await start(\n\t\t\tnodeOptions,\n\t\t\tnodeEngineConfig,\n\t\t\tnodeEnvVars,\n\t\t\tcliCommand,\n\t\t\tavailableContextIdKeys\n\t\t);\n\n\t\tif (!Is.empty(startResult)) {\n\t\t\tshowErrorDetails = false;\n\n\t\t\tlet isShuttingDown = false;\n\t\t\tfor (const signal of [\"SIGHUP\", \"SIGINT\", \"SIGTERM\"]) {\n\t\t\t\tprocess.on(signal, async () => {\n\t\t\t\t\tif (!isShuttingDown) {\n\t\t\t\t\t\tisShuttingDown = true;\n\t\t\t\t\t\tCLIDisplay.value(\"Terminate Signal\", signal);\n\t\t\t\t\t\tawait startResult.shutdown();\n\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn startResult;\n\t} catch (err) {\n\t\tif (nodeOptions?.disableProcessExitOnFailure ?? false) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tif (showErrorDetails) {\n\t\t\tconst baseError = BaseError.fromError(err);\n\t\t\tif (baseError.source === \"node\") {\n\t\t\t\tObjectHelper.propertyDelete(err, \"stack\");\n\t\t\t}\n\t\t\tCLIDisplay.error(err);\n\t\t}\n\n\t\t// eslint-disable-next-line unicorn/no-process-exit\n\t\tprocess.exit(1);\n\t}\n}\n\n/**\n * Build the configuration for the TWIN Node.\n * @param processEnv The environment variables from the process.\n * @param options The options for running the server.\n * @param serverInfo The server information.\n * @returns A promise that resolves to the engine server configuration, environment prefix, environment variables,\n * and options.\n */\nexport async function buildConfiguration(\n\tprocessEnv: {\n\t\t[id: string]: string;\n\t},\n\toptions: INodeOptions,\n\tserverInfo: IServerInfo\n): Promise<{\n\tnodeEnvVars: INodeEnvironmentVariables & { [id: string]: string | unknown };\n\tnodeEngineConfig: INodeEngineConfig;\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[];\n}> {\n\tconst availableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[] = [];\n\n\tlet defaultEnvOnly = false;\n\tif (Is.empty(options?.envFilenames)) {\n\t\tconst envFile = path.resolve(path.join(options.executionDirectory ?? \"\", \".env\"));\n\t\tCLIDisplay.value(\"Default Environment File\", envFile);\n\t\toptions ??= {};\n\t\toptions.envFilenames = [envFile];\n\t\tdefaultEnvOnly = true;\n\t}\n\n\tif (Is.arrayValue(options?.envFilenames)) {\n\t\tconst output = dotenv.config({\n\t\t\tpath: options?.envFilenames,\n\t\t\tquiet: true\n\t\t});\n\n\t\t// We don't want to throw an error if the default environment file is not found.\n\t\t// Only if we have custom environment files.\n\t\tif (!defaultEnvOnly && output.error) {\n\t\t\tthrow output.error;\n\t\t}\n\n\t\tif (Is.objectValue(output.parsed)) {\n\t\t\tfor (const [key, value] of Object.entries(output.parsed)) {\n\t\t\t\t// Only set environment variables that are not already set in\n\t\t\t\t// the process environment or provided via options.envVars\n\t\t\t\tprocessEnv[key] ??= value;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst envVars = EnvHelper.envToJson<{ [id: string]: string | unknown }>(\n\t\tprocessEnv,\n\t\toptions.envPrefix ?? \"\"\n\t);\n\n\t// Expand any environment variables that use the @file: syntax\n\tconst keys = Object.keys(envVars);\n\tfor (const key of keys) {\n\t\tif (\n\t\t\tIs.stringValue(envVars[key]) &&\n\t\t\t(envVars[key].startsWith(\"@text:\") || envVars[key].startsWith(\"@json:\"))\n\t\t) {\n\t\t\tconst filePath = envVars[key].slice(6).trim();\n\t\t\tconst embeddedFile = path.resolve(path.join(options.executionDirectory ?? \"\", filePath));\n\n\t\t\tif (envVars[key].startsWith(\"@text:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from text file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadTextFile(embeddedFile);\n\t\t\t} else if (envVars[key].startsWith(\"@json:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from JSON file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadJsonFile(embeddedFile);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Extend the environment variables with any additional custom configuration.\n\tif (Is.function(options?.extendEnvVars)) {\n\t\tCLIDisplay.task(\"Extending Environment Variables\");\n\t\tawait options.extendEnvVars(envVars);\n\t}\n\n\t// Build the engine configuration from the environment variables.\n\tconst coreConfig = await buildEngineConfiguration(envVars, availableContextIdKeys);\n\tconst engineServerConfig = await buildEngineServerConfiguration(\n\t\tenvVars,\n\t\tavailableContextIdKeys,\n\t\tcoreConfig,\n\t\tserverInfo,\n\t\toptions?.openApiSpecFile,\n\t\toptions?.favIconFile\n\t);\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.arrayValue(options?.configFilenames)) {\n\t\tfor (const configFile of options.configFilenames) {\n\t\t\tCLIDisplay.value(\"Loading Configuration File\", configFile);\n\t\t\tconst configFilePath = path.resolve(path.join(options.executionDirectory ?? \"\", configFile));\n\t\t\tconst config = await loadJsonFile(configFilePath);\n\t\t\tObject.assign(engineServerConfig, config);\n\t\t}\n\t}\n\n\tif (Is.objectValue(options?.config)) {\n\t\tCLIDisplay.task(\"Merging Custom Configuration\");\n\t\tObject.assign(engineServerConfig, options.config);\n\t}\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.function(options?.extendConfig)) {\n\t\tCLIDisplay.task(\"Extending Configuration\");\n\t\tawait options.extendConfig(envVars, engineServerConfig);\n\t}\n\n\tconst nodeEngineConfig = await extensionsConfiguration(envVars, engineServerConfig);\n\n\treturn { nodeEngineConfig, nodeEnvVars: envVars, availableContextIdKeys };\n}\n\n/**\n * Override module imports to support protocol-based loading (npm:, https:) and local files.\n * @param executionDirectory The execution directory for resolving local module paths.\n * @param envVars The environment variables containing extension configuration (optional, uses defaults if not provided).\n */\nexport function overrideModuleImport(\n\texecutionDirectory: string,\n\tenvVars?: INodeEnvironmentVariables\n): void {\n\tconst maxSizeMb = Coerce.number(envVars?.extensionsMaxSizeMb) ?? 10;\n\tconst cacheDirectory = envVars?.extensionsCacheDirectory;\n\n\tModuleHelper.overrideImport(async moduleName => {\n\t\tif (moduleCache[moduleName]) {\n\t\t\treturn {\n\t\t\t\tmodule: moduleCache[moduleName],\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\tconst parsed = parseModuleProtocol(moduleName);\n\t\tlet resolvedPath: string | undefined;\n\n\t\tswitch (parsed.protocol) {\n\t\t\tcase ModuleProtocol.Npm: {\n\t\t\t\tconst result = await handleNpmProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tcacheDirectory\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Https: {\n\t\t\t\tconst result = await handleHttpsProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tmaxSizeMb,\n\t\t\t\t\tcacheDirectory,\n\t\t\t\t\tenvVars?.extensionsCacheTtlHours,\n\t\t\t\t\tenvVars?.extensionsForceRefresh\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Http: {\n\t\t\t\tthrow new GeneralError(\"node\", \"insecureProtocol\", { protocol: ModuleProtocol.Http });\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Local: {\n\t\t\t\tlet localFilename = path.resolve(moduleName);\n\n\t\t\t\tlet exists = await fileExists(localFilename);\n\t\t\t\tif (!exists) {\n\t\t\t\t\tlocalFilename = path.resolve(executionDirectory, moduleName);\n\t\t\t\t\texists = await fileExists(localFilename);\n\t\t\t\t}\n\n\t\t\t\tif (exists) {\n\t\t\t\t\tresolvedPath = localFilename;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Default: {\n\t\t\t\ttry {\n\t\t\t\t\tconst packagePath = path.resolve(getNpmRootPath(), moduleName);\n\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Continue to fallback resolution\n\t\t\t\t}\n\n\t\t\t\t// Fallback: resolve from npm protocol cache directory (installed via handleNpmProtocol)\n\t\t\t\ttry {\n\t\t\t\t\tconst cacheNpmRoot = path.resolve(\n\t\t\t\t\t\tgetExtensionsCacheDir(executionDirectory, ModuleProtocol.Npm, cacheDirectory),\n\t\t\t\t\t\t\"node_modules\"\n\t\t\t\t\t);\n\n\t\t\t\t\tconst packagePath = path.resolve(cacheNpmRoot, moduleName);\n\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// No cached resolution either; fall through\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Common module loading and caching logic\n\t\tif (resolvedPath) {\n\t\t\tconst module = await import(createModuleImportUrl(resolvedPath));\n\t\t\tmoduleCache[moduleName] = module;\n\t\t\treturn {\n\t\t\t\tmodule,\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tmodule: undefined,\n\t\t\tuseDefault: true\n\t\t};\n\t});\n}\n\n/**\n * Get the root path for npm modules by executing \"npm root\" command and cache it.\n * @returns The root path for npm modules.\n */\nfunction getNpmRootPath(): string {\n\tnpmRootCache ??= execSync(\"npm root\").toString().trim().replace(/\\\\/g, \"/\");\n\treturn npmRootCache;\n}\n"]}
@@ -66,3 +66,10 @@ export declare function isTaskSchedulerRequired(envVars: IEngineEnvironmentVaria
66
66
  * @returns True if automation is enabled.
67
67
  */
68
68
  export declare function isAutomationRequired(envVars: IEngineEnvironmentVariables): boolean;
69
+ /**
70
+ * Checks if the telemetry subsystem is required.
71
+ * Returns true when any component that depends on the telemetry subsystem is enabled.
72
+ * @param envVars The environment variables.
73
+ * @returns True if telemetry is enabled.
74
+ */
75
+ export declare function isTelemetryRequired(envVars: IEngineEnvironmentVariables): boolean;
@@ -352,6 +352,18 @@ export interface IEngineEnvironmentVariables {
352
352
  * The port to use for the Open Telemetry Prometheus metrics server, only required if using open-telemetry as telemetry connector and prometheus as reader, defaults to 9464.
353
353
  */
354
354
  openTelemetryPrometheusPort?: string;
355
+ /**
356
+ * Polling interval in seconds for the telemetry metrics collector. Defaults to 60.
357
+ */
358
+ telemetryMetricsCollectorIntervalSeconds?: string;
359
+ /**
360
+ * The type of telemetry metrics producers, can be a comma separated list: system, process.
361
+ */
362
+ telemetryMetricsProducers?: string;
363
+ /**
364
+ * Maximum number of values retained per telemetry metric (count-based history cap). Defaults to 1440.
365
+ */
366
+ telemetryMetricsProducerMaxHistory?: string;
355
367
  /**
356
368
  * The type of faucet connector: entity-storage, iota.
357
369
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,112 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.38](https://github.com/iotaledger/twin-node/compare/node-core-v0.0.3-next.37...node-core-v0.0.3-next.38) (2026-05-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * add auth admin component ([1661e57](https://github.com/iotaledger/twin-node/commit/1661e57a699d5cf9ebde333e3cbc3aaea89d7c9c))
9
+ * add automation ([cfc63b4](https://github.com/iotaledger/twin-node/commit/cfc63b465c139280f696877df21d54dc6a065a7e))
10
+ * add CLI commands and remove automated bootstrap code ([#69](https://github.com/iotaledger/twin-node/issues/69)) ([6e40933](https://github.com/iotaledger/twin-node/commit/6e40933d8bb820b380e1074fc88feeedca0ef7d9))
11
+ * add context id features ([#53](https://github.com/iotaledger/twin-node/issues/53)) ([827adf5](https://github.com/iotaledger/twin-node/commit/827adf52cb87fca53cec52b27e67f7a9dba2c088))
12
+ * add data space connector ([5a57087](https://github.com/iotaledger/twin-node/commit/5a57087d938265d3a4a812ff7c83d130ea4e103c))
13
+ * add data space connector ([f7a3644](https://github.com/iotaledger/twin-node/commit/f7a364477ec664e333e5ad018795acec6ee61edc))
14
+ * add data space connector ([157e8b0](https://github.com/iotaledger/twin-node/commit/157e8b0a76e3a8a63c1991924f7f963eb83e27ae))
15
+ * add extend engine and server methods ([ec09c7e](https://github.com/iotaledger/twin-node/commit/ec09c7eb882d9f5797f2fd372e96cad1a3716f59))
16
+ * add extend engine and server methods ([0136a6f](https://github.com/iotaledger/twin-node/commit/0136a6f3f4e1a82b1427ee9618b8a17c79bc7fda))
17
+ * add extensions support ([476d5a8](https://github.com/iotaledger/twin-node/commit/476d5a864026a2f78e5b02bc9eb81359777a4a45))
18
+ * add isDefault flag to logging connectors ([358e839](https://github.com/iotaledger/twin-node/commit/358e8394819dab9832d3a9ebfac74b897b7d5f40))
19
+ * add missing export ([e8eb621](https://github.com/iotaledger/twin-node/commit/e8eb6213937a202520b164a9970a891004122b61))
20
+ * add module cache and improve resolution ([482be05](https://github.com/iotaledger/twin-node/commit/482be056c37a598033250ea8a7288a33cf3470b4))
21
+ * add module override for better local import resolution ([ba00d17](https://github.com/iotaledger/twin-node/commit/ba00d17beea0a9a1851c89ad7c6a33256051c818))
22
+ * add notarization ([#121](https://github.com/iotaledger/twin-node/issues/121)) ([b2a11df](https://github.com/iotaledger/twin-node/commit/b2a11df92c7b5026f73f08a018c0586ebe008e92))
23
+ * add obligation enforcers and multi instance support ([#89](https://github.com/iotaledger/twin-node/issues/89)) ([d81af99](https://github.com/iotaledger/twin-node/commit/d81af99b8c4db6e9a1370b7065bf6d9d222c71ed))
24
+ * add rights management ([78fba62](https://github.com/iotaledger/twin-node/commit/78fba62f82afdbe615d55dd90eca8ee70ea62fc0))
25
+ * add rights management components ([0fc6293](https://github.com/iotaledger/twin-node/commit/0fc629332db24494bd73003625c7bf3f939a2597))
26
+ * add support for dynamodb connection timeout ([63051b0](https://github.com/iotaledger/twin-node/commit/63051b0d22138079115dfac921e7f0c45eaad34e))
27
+ * add synchronised storage config ([e315869](https://github.com/iotaledger/twin-node/commit/e315869adbffcd7fe5d3ce151dd35f662f6134a9))
28
+ * add trust and rights management plugin support ([cdeb504](https://github.com/iotaledger/twin-node/commit/cdeb504ee5986a347466162b9afa781645b4a54c))
29
+ * add trust ttl ([#73](https://github.com/iotaledger/twin-node/issues/73)) ([911cee7](https://github.com/iotaledger/twin-node/commit/911cee771bba490143bb1574ca8360f7cf8baa1a))
30
+ * add validate-locales ([1a19dcb](https://github.com/iotaledger/twin-node/commit/1a19dcb005c2f0e3103e290db28c48a3464094cb))
31
+ * add vault prefix configuration ([#75](https://github.com/iotaledger/twin-node/issues/75)) ([1d4afb1](https://github.com/iotaledger/twin-node/commit/1d4afb1b1a8aa60795898eeb9e7f5153c279527d))
32
+ * adding npm and https protocols to load extensions ([#45](https://github.com/iotaledger/twin-node/issues/45)) ([33940b7](https://github.com/iotaledger/twin-node/commit/33940b7e771a0c5af32c18d442deb26a8631fd02))
33
+ * additional options for enabling components ([e13d772](https://github.com/iotaledger/twin-node/commit/e13d7721a0dd7143d456fff246622cbe63dbd0f1))
34
+ * additional route logging env vars ([7152c88](https://github.com/iotaledger/twin-node/commit/7152c887c3ba76778e2d9e68ba57198b8d81d802))
35
+ * additional run options ([c35e5bb](https://github.com/iotaledger/twin-node/commit/c35e5bbb8a80fe6a36628d41f64585b3723d9ad7))
36
+ * additional startup logging ([0740293](https://github.com/iotaledger/twin-node/commit/0740293b366032f2907046603abf587c9c324aff))
37
+ * additional stop interlock ([b3a2757](https://github.com/iotaledger/twin-node/commit/b3a2757325af0e7b258a9f97f1b52e86087e6301))
38
+ * align node module with dataspace rename and control plane integ… ([#95](https://github.com/iotaledger/twin-node/issues/95)) ([8129868](https://github.com/iotaledger/twin-node/commit/812986886fb5d779dd380956c4e6cc47c2d73530))
39
+ * authentication services ([#118](https://github.com/iotaledger/twin-node/issues/118)) ([311a7f8](https://github.com/iotaledger/twin-node/commit/311a7f882db1e50a83e94d2dae32fefc68debb47))
40
+ * bootstrap legacy skip ([469d950](https://github.com/iotaledger/twin-node/commit/469d9505bd0497c271ba291641f63786200cb548))
41
+ * cache the npm root to increase startup speed ([f10ea9e](https://github.com/iotaledger/twin-node/commit/f10ea9e22cc202f320df5fb21507b886c1f7345b))
42
+ * custom REST paths ([#99](https://github.com/iotaledger/twin-node/issues/99)) ([dcab1b2](https://github.com/iotaledger/twin-node/commit/dcab1b2b23c13b4c9f39c3c1c67284f56e732bd1))
43
+ * don't override existing env vars with env files ([ebccac2](https://github.com/iotaledger/twin-node/commit/ebccac297c3156076f17c246a8abd994f8f20e61))
44
+ * env var simplification ([460b0f2](https://github.com/iotaledger/twin-node/commit/460b0f20a73cb482f7443af502f261d5f9d01759))
45
+ * env-prefix option and user-update cli command ([#83](https://github.com/iotaledger/twin-node/issues/83)) ([fc48efa](https://github.com/iotaledger/twin-node/commit/fc48efa7ad72173def048170c3afb5eeb9f1b292))
46
+ * eslint migration to flat config ([080db74](https://github.com/iotaledger/twin-node/commit/080db746390230f78725d214bc957da2efee9eb1))
47
+ * first metrics in the core and app for testing ([#139](https://github.com/iotaledger/twin-node/issues/139)) ([abe17bb](https://github.com/iotaledger/twin-node/commit/abe17bb9a6261dcb7fd46253221182fbb1dc2259))
48
+ * health and url transformer ([#131](https://github.com/iotaledger/twin-node/issues/131)) ([3658903](https://github.com/iotaledger/twin-node/commit/36589036b9bea120880fc395b0d123a89032cf40))
49
+ * improve bootstrapping and shutdown behaviour ([#66](https://github.com/iotaledger/twin-node/issues/66)) ([65b3452](https://github.com/iotaledger/twin-node/commit/65b345240334bfff48b52e136cc486cd7ac7f290))
50
+ * improve default options and spec ([b538721](https://github.com/iotaledger/twin-node/commit/b538721902e7f65021d2715148ba59409ccce035))
51
+ * improve error handling for extensions and logging ([bd84fde](https://github.com/iotaledger/twin-node/commit/bd84fde67e5a9db6ac66730397992401ca52e88c))
52
+ * improve error reporting ([fcd39a1](https://github.com/iotaledger/twin-node/commit/fcd39a18da2a6ce33965a99ca5f2f36f4aba712f))
53
+ * improve node logging ([63d6ea6](https://github.com/iotaledger/twin-node/commit/63d6ea661c2c76985d98addb8d905ad6f0c7f164))
54
+ * improve node logging ([c25b9c6](https://github.com/iotaledger/twin-node/commit/c25b9c6779bdb76f341df072c39b4c2fae4565a3))
55
+ * initial commit ([522f1e5](https://github.com/iotaledger/twin-node/commit/522f1e515348f9b1dd1eeb3170b1249e2b0b5371))
56
+ * migrate env config from engine to node ([5da29b8](https://github.com/iotaledger/twin-node/commit/5da29b8d714495308320d237a68e84355bba2b47))
57
+ * multi-tenant env wiring, trust auto-enable, tenant-token vault key, engine-driven callbackPath ([#128](https://github.com/iotaledger/twin-node/issues/128)) ([0de4d35](https://github.com/iotaledger/twin-node/commit/0de4d356fb2f825afae5469005d475700f510ee4))
58
+ * node app use JavaScript ([14fe08c](https://github.com/iotaledger/twin-node/commit/14fe08cb760dd885a5dac9056a4d5dbc3d61df64))
59
+ * remove dap and darp ([36c3ffb](https://github.com/iotaledger/twin-node/commit/36c3ffb31af65a0e3025859dab675efeee043155))
60
+ * remove unused properties ([d8344b5](https://github.com/iotaledger/twin-node/commit/d8344b5aee5dc1c8104d75fad5093097f6530168))
61
+ * separate script directory from exec directory ([f6bb4db](https://github.com/iotaledger/twin-node/commit/f6bb4dbea1f1e200e0640fa154c6997ef99c99b4))
62
+ * support multiple entity and blob storage connectors ([a489f79](https://github.com/iotaledger/twin-node/commit/a489f7907544aef5708d5111e9f72985e1377bae))
63
+ * support public origin and hosting service ([#77](https://github.com/iotaledger/twin-node/issues/77)) ([3b9039f](https://github.com/iotaledger/twin-node/commit/3b9039fcba7f7038c06f8fd6a5ccc9fdbbf535b3))
64
+ * typescript 6 update ([ce2e3ca](https://github.com/iotaledger/twin-node/commit/ce2e3ca5219587709f7b9cf6c65909b48fba11b5))
65
+ * update background tasks and add fedcat filters ([1fd297e](https://github.com/iotaledger/twin-node/commit/1fd297e29f60b5bb3909638b68e326c5b0e2d77d))
66
+ * update context usage ([2215440](https://github.com/iotaledger/twin-node/commit/2215440801dea3955885b6579ad9b98b7a5d87ea))
67
+ * update dependencies ([aab05b5](https://github.com/iotaledger/twin-node/commit/aab05b552152a208a504fb9a080603f1990d4f79))
68
+ * update dependencies ([6cb3d3a](https://github.com/iotaledger/twin-node/commit/6cb3d3a63f7b976f80074ddecfba034b7e92f919))
69
+ * update dependencies ([9d25f16](https://github.com/iotaledger/twin-node/commit/9d25f16f1d554cd38f3bec28fdf7f8fff892ceaf))
70
+ * update engine ([a40b377](https://github.com/iotaledger/twin-node/commit/a40b37726c3b61c6bb40265ec0006d1071ffac7e))
71
+ * update engine ([4b438e2](https://github.com/iotaledger/twin-node/commit/4b438e22c27d784ee6cc964b7cb4401e9699ab16))
72
+ * update engine dependency ([db290df](https://github.com/iotaledger/twin-node/commit/db290df3b18374f7d86da575c6048657b98c355b))
73
+ * update engine dependency ([3494c31](https://github.com/iotaledger/twin-node/commit/3494c3144fd5ce6d3a9f2936c7890ab36795aeaa))
74
+ * update for livez endpoint ([9fc2e6a](https://github.com/iotaledger/twin-node/commit/9fc2e6ade38b3ec9591399a633d02b1e5fe07910))
75
+ * update framework components ([4bee2b9](https://github.com/iotaledger/twin-node/commit/4bee2b9d3651df09b8550a9ed226be1b46031854))
76
+ * update framework core ([8bd769a](https://github.com/iotaledger/twin-node/commit/8bd769a4451f5f1f6be3f115a5e94eeb05bce7f1))
77
+ * update order of logging ([2161938](https://github.com/iotaledger/twin-node/commit/2161938c969b18e4678459a69090287e5ccdb404))
78
+ * update order of logging ([b295f31](https://github.com/iotaledger/twin-node/commit/b295f315f7c5b611d229d9e5314d414da05828b9))
79
+ * update rights management ([5c992c6](https://github.com/iotaledger/twin-node/commit/5c992c6b0d72f3eeaa39ee267e096d9a3f477f4e))
80
+ * update rights management components ([176a0d6](https://github.com/iotaledger/twin-node/commit/176a0d611f88360fc845ae233b26ee0b43d7cb23))
81
+ * update rights management dependencies ([97ad02e](https://github.com/iotaledger/twin-node/commit/97ad02e4b74cfe5e722f74da2fc2229bbf004c0a))
82
+ * update to latest engine ([00d4974](https://github.com/iotaledger/twin-node/commit/00d4974f9cfb02bf48505cfb4af4a7aba1df4b3d))
83
+ * update to latest engine config ([347386c](https://github.com/iotaledger/twin-node/commit/347386c0609e717dc20c456ad2264c83df793c59))
84
+ * updated context id features ([ef7be07](https://github.com/iotaledger/twin-node/commit/ef7be07d44dccdeacf10f90cb4ffde0303faa6fa))
85
+ * updating linting ([feacd17](https://github.com/iotaledger/twin-node/commit/feacd178bb025bcd29a0ae6e4b8e79f23a989169))
86
+ * use features instead of disableNodeIdentity ([2e6109b](https://github.com/iotaledger/twin-node/commit/2e6109bd1de825e0f5396fc120d99ad7b3929852))
87
+
88
+
89
+ ### Bug Fixes
90
+
91
+ * adding a condition to verify if the password exists when bootstrapping ([6030a42](https://github.com/iotaledger/twin-node/commit/6030a42bdaf581678d96932fd0b809396bf7b8b0))
92
+ * adding a condition to verify if the password exists when bootstrapping ([c66f396](https://github.com/iotaledger/twin-node/commit/c66f396717394161a7647d1f08b3d87729d96e96))
93
+ * bootstrap legacy fails on second run ([c0a4e6d](https://github.com/iotaledger/twin-node/commit/c0a4e6d6f8d1bf385412a22fed2a0974e219abaa))
94
+ * bootstrap vault key skip logic ([#112](https://github.com/iotaledger/twin-node/issues/112)) ([4084368](https://github.com/iotaledger/twin-node/commit/4084368f0762c3a1b8e214ac30f5545297c88ea6))
95
+ * broken docs ([61479fd](https://github.com/iotaledger/twin-node/commit/61479fd618f766d22c5aafec5277e1a89e22b453))
96
+ * improve calculation of execution directory ([106d65d](https://github.com/iotaledger/twin-node/commit/106d65d7ad5524e2e147b681d68f9476c024cfaa))
97
+ * only register DID context keys when nodeIdentityEnabled is true ([#140](https://github.com/iotaledger/twin-node/issues/140)) ([21f1c10](https://github.com/iotaledger/twin-node/commit/21f1c107adbd715518414f7255ead970b809b4b3))
98
+ * org identity verification methods ([18f158b](https://github.com/iotaledger/twin-node/commit/18f158b2f63930e20e94437c17ed43421771a458))
99
+ * pr comments [#1](https://github.com/iotaledger/twin-node/issues/1) ([66e795b](https://github.com/iotaledger/twin-node/commit/66e795b16c372ab131ec1de30085aee90e4dbbd0))
100
+ * synchronised storage construction ([#102](https://github.com/iotaledger/twin-node/issues/102)) ([58b61e9](https://github.com/iotaledger/twin-node/commit/58b61e9a67f499a35bea17e5d2dc6a1efc2cb893))
101
+ * test with latest dependencies ([91123b7](https://github.com/iotaledger/twin-node/commit/91123b71d0e7b51700a5d5452b2a0c9fc5c5256e))
102
+
103
+ ## [0.0.3-next.37](https://github.com/iotaledger/twin-node/compare/node-core-v0.0.3-next.36...node-core-v0.0.3-next.37) (2026-05-19)
104
+
105
+
106
+ ### Bug Fixes
107
+
108
+ * only register DID context keys when nodeIdentityEnabled is true ([#140](https://github.com/iotaledger/twin-node/issues/140)) ([21f1c10](https://github.com/iotaledger/twin-node/commit/21f1c107adbd715518414f7255ead970b809b4b3))
109
+
3
110
  ## [0.0.3-next.36](https://github.com/iotaledger/twin-node/compare/node-core-v0.0.3-next.35...node-core-v0.0.3-next.36) (2026-05-12)
4
111
 
5
112
 
@@ -0,0 +1,20 @@
1
+ # Function: isTelemetryRequired()
2
+
3
+ > **isTelemetryRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the telemetry subsystem is required.
6
+ Returns true when any component that depends on the telemetry subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if telemetry is enabled.
@@ -49,6 +49,7 @@
49
49
  - [isRightsManagementRequired](functions/isRightsManagementRequired.md)
50
50
  - [isTaskSchedulerRequired](functions/isTaskSchedulerRequired.md)
51
51
  - [isAutomationRequired](functions/isAutomationRequired.md)
52
+ - [isTelemetryRequired](functions/isTelemetryRequired.md)
52
53
  - [buildEngineServerConfiguration](functions/buildEngineServerConfiguration.md)
53
54
  - [isAuthEntityStorageRequired](functions/isAuthEntityStorageRequired.md)
54
55
  - [extensionsConfiguration](functions/extensionsConfiguration.md)
@@ -706,6 +706,30 @@ The port to use for the Open Telemetry Prometheus metrics server, only required
706
706
 
707
707
  ***
708
708
 
709
+ ### telemetryMetricsCollectorIntervalSeconds? {#telemetrymetricscollectorintervalseconds}
710
+
711
+ > `optional` **telemetryMetricsCollectorIntervalSeconds?**: `string`
712
+
713
+ Polling interval in seconds for the telemetry metrics collector. Defaults to 60.
714
+
715
+ ***
716
+
717
+ ### telemetryMetricsProducers? {#telemetrymetricsproducers}
718
+
719
+ > `optional` **telemetryMetricsProducers?**: `string`
720
+
721
+ The type of telemetry metrics producers, can be a comma separated list: system, process.
722
+
723
+ ***
724
+
725
+ ### telemetryMetricsProducerMaxHistory? {#telemetrymetricsproducermaxhistory}
726
+
727
+ > `optional` **telemetryMetricsProducerMaxHistory?**: `string`
728
+
729
+ Maximum number of values retained per telemetry metric (count-based history cap). Defaults to 1440.
730
+
731
+ ***
732
+
709
733
  ### faucetConnector? {#faucetconnector}
710
734
 
711
735
  > `optional` **faucetConnector?**: `string`
@@ -1058,6 +1058,42 @@ The port to use for the Open Telemetry Prometheus metrics server, only required
1058
1058
 
1059
1059
  ***
1060
1060
 
1061
+ ### telemetryMetricsCollectorIntervalSeconds? {#telemetrymetricscollectorintervalseconds}
1062
+
1063
+ > `optional` **telemetryMetricsCollectorIntervalSeconds?**: `string`
1064
+
1065
+ Polling interval in seconds for the telemetry metrics collector. Defaults to 60.
1066
+
1067
+ #### Inherited from
1068
+
1069
+ [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`telemetryMetricsCollectorIntervalSeconds`](IEngineEnvironmentVariables.md#telemetrymetricscollectorintervalseconds)
1070
+
1071
+ ***
1072
+
1073
+ ### telemetryMetricsProducers? {#telemetrymetricsproducers}
1074
+
1075
+ > `optional` **telemetryMetricsProducers?**: `string`
1076
+
1077
+ The type of telemetry metrics producers, can be a comma separated list: system, process.
1078
+
1079
+ #### Inherited from
1080
+
1081
+ [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`telemetryMetricsProducers`](IEngineEnvironmentVariables.md#telemetrymetricsproducers)
1082
+
1083
+ ***
1084
+
1085
+ ### telemetryMetricsProducerMaxHistory? {#telemetrymetricsproducermaxhistory}
1086
+
1087
+ > `optional` **telemetryMetricsProducerMaxHistory?**: `string`
1088
+
1089
+ Maximum number of values retained per telemetry metric (count-based history cap). Defaults to 1440.
1090
+
1091
+ #### Inherited from
1092
+
1093
+ [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`telemetryMetricsProducerMaxHistory`](IEngineEnvironmentVariables.md#telemetrymetricsproducermaxhistory)
1094
+
1095
+ ***
1096
+
1061
1097
  ### faucetConnector? {#faucetconnector}
1062
1098
 
1063
1099
  > `optional` **faucetConnector?**: `string`