@twin.org/node-core 0.9.2-next.10 → 0.9.2-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/builders/engineEnvBuilder.js +12 -9
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +32 -14
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/builders/extensionsBuilder.js +5 -4
- package/dist/es/builders/extensionsBuilder.js.map +1 -1
- package/dist/es/builders/helper/envHelpers.js +3 -2
- package/dist/es/builders/helper/envHelpers.js.map +1 -1
- package/dist/es/cli.js +2 -1
- package/dist/es/cli.js.map +1 -1
- package/dist/es/commands/bootstrapDev.js +5 -5
- package/dist/es/commands/bootstrapDev.js.map +1 -1
- package/dist/es/commands/userCreate.js +8 -3
- package/dist/es/commands/userCreate.js.map +1 -1
- package/dist/es/commands/userUpdate.js +5 -2
- package/dist/es/commands/userUpdate.js.map +1 -1
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
- package/dist/es/models/engineEnvironmentVariableKeys.js +4 -0
- package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -1
- package/dist/es/models/engineServerEnvironmentVariableKeys.js +2 -1
- package/dist/es/models/engineServerEnvironmentVariableKeys.js.map +1 -1
- package/dist/es/node.js +3 -7
- package/dist/es/node.js.map +1 -1
- package/dist/es/start.js +3 -2
- package/dist/es/start.js.map +1 -1
- package/dist/types/builders/helper/envHelpers.d.ts +2 -1
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +16 -0
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
- package/docs/changelog.md +15 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +32 -0
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +8 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
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AAC,GAAG,CACxD,uCAAuC,CACvC,CAAC;IAEF,IAAI,CAAC;QACJ,OAAO,MAAM,4BAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,iBAAiB,CAC/B,UAA4D,EAC5D,QAAgB;IAEhB,MAAM,+BAA+B,GACpC,UAAU,CAAC,iCAAiC,CAAC,sBAAsB,CAAC,CAAC;IAEtE,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,+BAA+B,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,GAAG,CAC9C,+BAA+B,CAC/B,CAAC;IAEF,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO;YACN,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,EAAE;SAC1C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationAdminComponent } from \"@twin.org/api-auth-entity-storage-models\";\nimport type { ITenantAdminComponent } from \"@twin.org/api-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, GeneralError, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { identityCreate } from \"./identityCreate.js\";\nimport { identityVerificationMethodCreate } from \"./identityVerificationMethodCreate.js\";\nimport { tenantCreate } from \"./tenantCreate.js\";\nimport { userCreate } from \"./userCreate.js\";\nimport { vaultKeyCreate } from \"./vaultKeyCreate.js\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\n\nconst COMMAND_NAME = \"bootstrap-dev\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionBootstrapDev(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\taliases: [\"bootstrap-legacy\"],\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.bootstrap-dev.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.bootstrap-dev.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresOrgIdentity: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-dev.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-dev.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => bootstrapDev(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for development bootstrap.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @returns A promise that resolves when the bootstrap sequence has completed.\n */\nexport async function bootstrapDev(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: IEnvironmentVariables,\n\tparams: {}\n): Promise<void> {\n\tconst features = (envVars.features ?? \"admin-user,wallet\")\n\t\t.split(\",\")\n\t\t.map(f => f.trim())\n\t\t.filter(f => f.length > 0);\n\n\tconst state = engineCore.getState();\n\tconst requireWallet = features.includes(\"wallet\");\n\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\tlet nodeId = state.nodeId ?? envVars.nodeIdentity;\n\tlet organizationId = tenantEnabled ? undefined : state.nodeOrganizationId;\n\tlet tenant: { id: string; organizationId: string } | undefined;\n\n\tif (features.length === 0) {\n\t\tthrow new GeneralError(\"bootstrapDev\", \"noFeaturesEnabled\");\n\t}\n\n\tCLIDisplay.break();\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeIdentityCreate\")\n\t);\n\n\tconst nodeIdentity = await identityCreate(engineCore, envVars, {\n\t\tidentity: nodeId,\n\t\tmnemonic: envVars.nodeMnemonic,\n\t\tfundWallet: requireWallet,\n\t\tnodeId: true\n\t});\n\n\tnodeId = nodeIdentity.did;\n\n\tCLIDisplay.break();\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeAuthKeyCreate\")\n\t);\n\tawait vaultKeyCreate(engineCore, envVars, {\n\t\tidentity: nodeId,\n\t\tkeyType: \"Ed25519\",\n\t\tkeyId: envVars.authSigningKeyId,\n\t\toverwriteMode: \"skip\"\n\t});\n\n\t// Always create the organisation identity first so it can be associated with\n\t// the tenant (multi-tenant) or the node (single-tenant) immediately after.\n\t// The trust verification method is always added to the organisation identities.\n\tawait ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.organisationCreate\")\n\t\t);\n\n\t\tif (tenantEnabled) {\n\t\t\tconst existingTenant = Is.stringValue(envVars.tenantId)\n\t\t\t\t? await resolveTenantById(engineCore, envVars.tenantId)\n\t\t\t\t: await resolveDefaultTenant(engineCore);\n\t\t\torganizationId = existingTenant?.organizationId;\n\t\t}\n\n\t\tconst organisation = await identityCreate(engineCore, envVars, {\n\t\t\tidentity: organizationId ?? envVars.organizationIdentity,\n\t\t\tmnemonic: envVars.organizationMnemonic,\n\t\t\tfundWallet: requireWallet\n\t\t});\n\t\torganizationId = organisation.did;\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.trustVerificationMethodCreate\")\n\t\t);\n\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\tidentity: organisation.did,\n\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\tverificationMethodId: envVars.trustVerificationMethodId,\n\t\t\toverwriteMode: \"skip\"\n\t\t});\n\n\t\tif (Coerce.boolean(envVars.blobStorageEnableEncryption) ?? false) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.blobStorageKeyCreate\")\n\t\t\t);\n\t\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\t\tidentity: organizationId,\n\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\tkeyId: envVars.blobStorageEncryptionKeyId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\tconst defaultAttestationConnectorType =\n\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"attestationConnector\");\n\t\tif (!Is.empty(defaultAttestationConnectorType)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.attestationMethodCreate\")\n\t\t\t);\n\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\tidentity: organizationId,\n\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\tverificationMethodId: envVars.attestationVerificationMethodId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\tconst defaultImmutableProofComponentType =\n\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"immutableProofComponent\");\n\n\t\tif (!Is.empty(defaultImmutableProofComponentType)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.immutableProofMethodCreate\")\n\t\t\t);\n\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\tidentity: organizationId,\n\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\tverificationMethodId: envVars.immutableProofVerificationMethodId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\t// In single-tenant mode, record the org DID in state so the node can resolve its\n\t\t// organisation without a tenant lookup.\n\t\tif (!tenantEnabled && !Is.stringValue(state.nodeOrganizationId)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeOrganizationIdSet\")\n\t\t\t);\n\t\t\tstate.nodeOrganizationId = organisation.did;\n\t\t\tengineCore.setStateDirty();\n\t\t\tCLIDisplay.done();\n\t\t}\n\t});\n\n\tif (tenantEnabled) {\n\t\tawait ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {\n\t\t\t// Resolve an existing tenant so a re-run does not create a duplicate.\n\t\t\t// When a specific tenant ID is configured, look it up directly;\n\t\t\t// otherwise search for the first tenant labelled \"Tenant\".\n\t\t\tif (Is.stringValue(envVars.tenantId)) {\n\t\t\t\ttenant = await resolveTenantById(engineCore, envVars.tenantId);\n\t\t\t} else {\n\t\t\t\ttenant = await resolveDefaultTenant(engineCore);\n\t\t\t}\n\n\t\t\t// Still empty so create a new tenant for the node and associate it with the organisation.\n\t\t\tif (Is.empty(tenant)) {\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeTenantCreate\")\n\t\t\t\t);\n\t\t\t\tconst tenantDetails = await tenantCreate(engineCore, envVars, {\n\t\t\t\t\ttenantId: envVars.tenantId,\n\t\t\t\t\tapiKey: envVars.tenantApiKey,\n\t\t\t\t\tlabel: \"Tenant\",\n\t\t\t\t\torganizationId\n\t\t\t\t});\n\n\t\t\t\ttenant = {\n\t\t\t\t\tid: tenantDetails.tenantId,\n\t\t\t\t\torganizationId: organizationId ?? tenantDetails.organizationId ?? \"\"\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\t}\n\n\tif (features.includes(\"admin-user\")) {\n\t\tawait ContextIdStore.run(\n\t\t\t{ [ContextIdKeys.Node]: nodeId, [ContextIdKeys.Tenant]: tenant?.id },\n\t\t\tasync () => {\n\t\t\t\tconst orgDid = await resolveOrganizationDid(engineCore, tenantEnabled, tenant?.id);\n\t\t\t\tconst effectiveAdminEmail =\n\t\t\t\t\tenvVars.adminUserName ?? `admin@${tenantEnabled ? \"tenant\" : \"node\"}`;\n\t\t\t\tconst adminUser = await resolveDefaultAdminUser(engineCore, effectiveAdminEmail);\n\t\t\t\tlet userDid = adminUser?.userIdentity;\n\n\t\t\t\tif (Is.empty(adminUser)) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.adminIdentityCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tconst result = await identityCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: envVars.adminUserIdentity,\n\t\t\t\t\t\tmnemonic: envVars.adminUserMnemonic,\n\t\t\t\t\t\tcontroller: orgDid\n\t\t\t\t\t});\n\n\t\t\t\t\tuserDid = result.did;\n\t\t\t\t}\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.adminUserCreate\")\n\t\t\t\t);\n\t\t\t\tawait userCreate(engineCore, envVars, {\n\t\t\t\t\tuserIdentity: userDid,\n\t\t\t\t\torganizationIdentity: orgDid,\n\t\t\t\t\ttenantId: tenant?.id,\n\t\t\t\t\temail: envVars.adminUserName ?? `admin@${tenantEnabled ? \"tenant\" : \"node\"}`,\n\t\t\t\t\tpassword: envVars.adminUserPassword,\n\t\t\t\t\tscope:\n\t\t\t\t\t\tenvVars.adminUserScope ??\n\t\t\t\t\t\t(tenantEnabled ? [\"tenant-admin\", \"user-admin\"] : [\"user-admin\"]).join(\",\"),\n\t\t\t\t\tgivenName: tenantEnabled ? \"Tenant\" : \"Node\",\n\t\t\t\t\tfamilyName: \"Admin\",\n\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n}\n\n/**\n * Resolve the organisation DID from node state (single-tenant) or the tenant entry (multi-tenant).\n * @param engineCore The engine core.\n * @param tenantEnabled Whether multi-tenancy is enabled.\n * @param tenantId The active tenant ID (multi-tenant only).\n * @returns The organisation DID.\n * @throws GeneralError if the organisation has not been associated yet.\n * @internal\n */\nasync function resolveOrganizationDid(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\ttenantEnabled: boolean,\n\ttenantId: string | undefined\n): Promise<string> {\n\tif (tenantEnabled) {\n\t\tif (Is.stringValue(tenantId)) {\n\t\t\tconst tenantAdminComponentType =\n\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\t\t\tif (Is.stringValue(tenantAdminComponentType)) {\n\t\t\t\tconst tenantAdminComponent =\n\t\t\t\t\tComponentFactory.get<ITenantAdminComponent>(tenantAdminComponentType);\n\t\t\t\tconst tenant = await tenantAdminComponent.get(tenantId);\n\t\t\t\tif (Is.stringValue(tenant.organizationId)) {\n\t\t\t\t\treturn tenant.organizationId;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst state = engineCore.getState();\n\t\tif (Is.stringValue(state.nodeOrganizationId)) {\n\t\t\treturn state.nodeOrganizationId;\n\t\t}\n\t}\n\n\tthrow new GeneralError(\"bootstrapDev\", \"organizationNotSet\");\n}\n\n/**\n * Resolve the default tenant id for re-bootstrap when multi-tenancy is enabled.\n * @param engineCore The engine core.\n * @returns The tenant id if one exists in storage.\n * @internal\n */\nasync function resolveDefaultTenant(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>\n): Promise<{ id: string; organizationId: string } | undefined> {\n\tconst tenantAdminServiceComponentType =\n\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\n\tif (!Is.stringValue(tenantAdminServiceComponentType)) {\n\t\treturn undefined;\n\t}\n\n\tconst tenantAdminService = ComponentFactory.get<ITenantAdminComponent>(\n\t\ttenantAdminServiceComponentType\n\t);\n\n\tlet cursor: string | undefined;\n\tlet firstTenant: { id: string; organizationId: string } | undefined;\n\n\tdo {\n\t\tconst result = await tenantAdminService.query(\n\t\t\tundefined,\n\t\t\t[\"id\", \"organizationId\", \"label\"],\n\t\t\tcursor\n\t\t);\n\t\tconst nodeTenant = result.tenants.find(tenant => tenant.label === \"Tenant\");\n\t\tif (nodeTenant) {\n\t\t\treturn {\n\t\t\t\tid: nodeTenant.id,\n\t\t\t\torganizationId: nodeTenant.organizationId ?? \"\"\n\t\t\t};\n\t\t}\n\n\t\tif (Is.empty(firstTenant) && Is.arrayValue(result.tenants)) {\n\t\t\tfirstTenant = {\n\t\t\t\tid: result.tenants[0].id,\n\t\t\t\torganizationId: result.tenants[0].organizationId ?? \"\"\n\t\t\t};\n\t\t}\n\n\t\tcursor = result.cursor;\n\t} while (Is.stringValue(cursor));\n\n\tif (!Is.empty(firstTenant)) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.tenantFallback\"),\n\t\t\tfirstTenant.id\n\t\t);\n\t}\n\n\treturn firstTenant;\n}\n\n/**\n * Resolve the admin user by email for idempotent re-bootstrap.\n * @param engineCore The engine core.\n * @param email The email address of the admin user to look up.\n * @returns The admin user if one exists in storage.\n * @internal\n */\nasync function resolveDefaultAdminUser(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\temail: string\n): Promise<{ email: string; userIdentity: string; organizationIdentity: string } | undefined> {\n\tconst defaultAuthenticationAdminComponentType = engineCore.getRegisteredInstanceType(\n\t\t\"authenticationAdminComponent\"\n\t);\n\tconst authenticationAdminComponent = ComponentFactory.get<IAuthenticationAdminComponent>(\n\t\tdefaultAuthenticationAdminComponentType\n\t);\n\n\ttry {\n\t\treturn await authenticationAdminComponent.get(email);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolve a tenant by its specific ID for idempotent re-bootstrap.\n * @param engineCore The engine core.\n * @param tenantId The tenant ID to look up.\n * @returns The tenant if found, otherwise undefined.\n * @internal\n */\nasync function resolveTenantById(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\ttenantId: string\n): Promise<{ id: string; organizationId: string } | undefined> {\n\tconst tenantAdminServiceComponentType =\n\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\n\tif (!Is.stringValue(tenantAdminServiceComponentType)) {\n\t\treturn undefined;\n\t}\n\n\tconst tenantAdminService = ComponentFactory.get<ITenantAdminComponent>(\n\t\ttenantAdminServiceComponentType\n\t);\n\n\ttry {\n\t\tconst found = await tenantAdminService.get(tenantId);\n\t\treturn {\n\t\t\tid: found.id,\n\t\t\torganizationId: found.organizationId ?? \"\"\n\t\t};\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bootstrapDev.js","sourceRoot":"","sources":["../../../src/commands/bootstrapDev.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,C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A+B,GACpC,UAAU,CAAC,iCAAiC,CAAC,sBAAsB,CAAC,CAAC;IAEtE,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,+BAA+B,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,GAAG,CAC9C,+BAA+B,CAC/B,CAAC;IAEF,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO;YACN,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,EAAE;SAC1C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IAuthenticationAdminComponent } from \"@twin.org/api-auth-entity-storage-models\";\nimport type { ITenantAdminComponent } from \"@twin.org/api-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, GeneralError, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { identityCreate } from \"./identityCreate.js\";\nimport { identityVerificationMethodCreate } from \"./identityVerificationMethodCreate.js\";\nimport { tenantCreate } from \"./tenantCreate.js\";\nimport { userCreate } from \"./userCreate.js\";\nimport { vaultKeyCreate } from \"./vaultKeyCreate.js\";\nimport { commaSeparatedListToArray } from \"../builders/helper/envHelpers.js\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\nimport type { INodeEngineConfig } from \"../models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"../models/INodeEngineState.js\";\n\nconst COMMAND_NAME = \"bootstrap-dev\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionBootstrapDev(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\taliases: [\"bootstrap-legacy\"],\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.bootstrap-dev.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.bootstrap-dev.example\"),\n\t\trequiresNodeIdentity: false,\n\t\trequiresOrgIdentity: false,\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-dev.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.bootstrap-dev.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => bootstrapDev(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for development bootstrap.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @returns A promise that resolves when the bootstrap sequence has completed.\n */\nexport async function bootstrapDev(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: IEnvironmentVariables,\n\tparams: {}\n): Promise<void> {\n\tconst features = commaSeparatedListToArray(envVars.features ?? \"admin-user,wallet\");\n\n\tconst state = engineCore.getState();\n\tconst requireWallet = features.includes(\"wallet\");\n\tconst tenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;\n\tlet nodeId = state.nodeId ?? envVars.nodeIdentity;\n\tlet organizationId = tenantEnabled ? undefined : state.nodeOrganizationId;\n\tlet tenant: { id: string; organizationId: string } | undefined;\n\n\tif (features.length === 0) {\n\t\tthrow new GeneralError(\"bootstrapDev\", \"noFeaturesEnabled\");\n\t}\n\n\tCLIDisplay.break();\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeIdentityCreate\")\n\t);\n\n\tconst nodeIdentity = await identityCreate(engineCore, envVars, {\n\t\tidentity: nodeId,\n\t\tmnemonic: envVars.nodeMnemonic,\n\t\tfundWallet: requireWallet,\n\t\tnodeId: true\n\t});\n\n\tnodeId = nodeIdentity.did;\n\n\tCLIDisplay.break();\n\tCLIDisplay.section(\n\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeAuthKeyCreate\")\n\t);\n\tawait vaultKeyCreate(engineCore, envVars, {\n\t\tidentity: nodeId,\n\t\tkeyType: \"Ed25519\",\n\t\tkeyId: envVars.authSigningKeyId,\n\t\toverwriteMode: \"skip\"\n\t});\n\n\t// Always create the organisation identity first so it can be associated with\n\t// the tenant (multi-tenant) or the node (single-tenant) immediately after.\n\t// The trust verification method is always added to the organisation identities.\n\tawait ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.organisationCreate\")\n\t\t);\n\n\t\tif (tenantEnabled) {\n\t\t\tconst existingTenant = Is.stringValue(envVars.tenantId)\n\t\t\t\t? await resolveTenantById(engineCore, envVars.tenantId)\n\t\t\t\t: await resolveDefaultTenant(engineCore);\n\t\t\torganizationId = existingTenant?.organizationId;\n\t\t}\n\n\t\tconst organisation = await identityCreate(engineCore, envVars, {\n\t\t\tidentity: organizationId ?? envVars.organizationIdentity,\n\t\t\tmnemonic: envVars.organizationMnemonic,\n\t\t\tfundWallet: requireWallet\n\t\t});\n\t\torganizationId = organisation.did;\n\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.trustVerificationMethodCreate\")\n\t\t);\n\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\tidentity: organisation.did,\n\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\tverificationMethodId: envVars.trustVerificationMethodId,\n\t\t\toverwriteMode: \"skip\"\n\t\t});\n\n\t\tif (Coerce.boolean(envVars.blobStorageEnableEncryption) ?? false) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.blobStorageKeyCreate\")\n\t\t\t);\n\t\t\tawait vaultKeyCreate(engineCore, envVars, {\n\t\t\t\tidentity: organizationId,\n\t\t\t\tkeyType: \"ChaCha20Poly1305\",\n\t\t\t\tkeyId: envVars.blobStorageEncryptionKeyId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\tconst defaultAttestationConnectorType =\n\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"attestationConnector\");\n\t\tif (!Is.empty(defaultAttestationConnectorType)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.attestationMethodCreate\")\n\t\t\t);\n\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\tidentity: organizationId,\n\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\tverificationMethodId: envVars.attestationVerificationMethodId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\tconst defaultImmutableProofComponentType =\n\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"immutableProofComponent\");\n\n\t\tif (!Is.empty(defaultImmutableProofComponentType)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.immutableProofMethodCreate\")\n\t\t\t);\n\t\t\tawait identityVerificationMethodCreate(engineCore, envVars, {\n\t\t\t\tidentity: organizationId,\n\t\t\t\tverificationMethodType: \"assertionMethod\",\n\t\t\t\tverificationMethodId: envVars.immutableProofVerificationMethodId,\n\t\t\t\toverwriteMode: \"skip\"\n\t\t\t});\n\t\t}\n\n\t\t// In single-tenant mode, record the org DID in state so the node can resolve its\n\t\t// organisation without a tenant lookup.\n\t\tif (!tenantEnabled && !Is.stringValue(state.nodeOrganizationId)) {\n\t\t\tCLIDisplay.break();\n\t\t\tCLIDisplay.section(\n\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeOrganizationIdSet\")\n\t\t\t);\n\t\t\tstate.nodeOrganizationId = organisation.did;\n\t\t\tengineCore.setStateDirty();\n\t\t\tCLIDisplay.done();\n\t\t}\n\t});\n\n\tif (tenantEnabled) {\n\t\tawait ContextIdStore.run({ [ContextIdKeys.Node]: nodeId }, async () => {\n\t\t\t// Resolve an existing tenant so a re-run does not create a duplicate.\n\t\t\t// When a specific tenant ID is configured, look it up directly;\n\t\t\t// otherwise search for the first tenant labelled \"Tenant\".\n\t\t\tif (Is.stringValue(envVars.tenantId)) {\n\t\t\t\ttenant = await resolveTenantById(engineCore, envVars.tenantId);\n\t\t\t} else {\n\t\t\t\ttenant = await resolveDefaultTenant(engineCore);\n\t\t\t}\n\n\t\t\t// Still empty so create a new tenant for the node and associate it with the organisation.\n\t\t\tif (Is.empty(tenant)) {\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.nodeTenantCreate\")\n\t\t\t\t);\n\t\t\t\tconst tenantDetails = await tenantCreate(engineCore, envVars, {\n\t\t\t\t\ttenantId: envVars.tenantId,\n\t\t\t\t\tapiKey: envVars.tenantApiKey,\n\t\t\t\t\tlabel: \"Tenant\",\n\t\t\t\t\torganizationId\n\t\t\t\t});\n\n\t\t\t\ttenant = {\n\t\t\t\t\tid: tenantDetails.tenantId,\n\t\t\t\t\torganizationId: organizationId ?? tenantDetails.organizationId ?? \"\"\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\t}\n\n\tif (features.includes(\"admin-user\")) {\n\t\tawait ContextIdStore.run(\n\t\t\t{ [ContextIdKeys.Node]: nodeId, [ContextIdKeys.Tenant]: tenant?.id },\n\t\t\tasync () => {\n\t\t\t\tconst orgDid = await resolveOrganizationDid(engineCore, tenantEnabled, tenant?.id);\n\t\t\t\tconst effectiveAdminEmail =\n\t\t\t\t\tenvVars.adminUserName ?? `admin@${tenantEnabled ? \"tenant\" : \"node\"}`;\n\t\t\t\tconst adminUser = await resolveDefaultAdminUser(engineCore, effectiveAdminEmail);\n\t\t\t\tlet userDid = adminUser?.userIdentity;\n\n\t\t\t\tif (Is.empty(adminUser)) {\n\t\t\t\t\tCLIDisplay.break();\n\t\t\t\t\tCLIDisplay.section(\n\t\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.adminIdentityCreate\")\n\t\t\t\t\t);\n\t\t\t\t\tconst result = await identityCreate(engineCore, envVars, {\n\t\t\t\t\t\tidentity: envVars.adminUserIdentity,\n\t\t\t\t\t\tmnemonic: envVars.adminUserMnemonic,\n\t\t\t\t\t\tcontroller: orgDid\n\t\t\t\t\t});\n\n\t\t\t\t\tuserDid = result.did;\n\t\t\t\t}\n\n\t\t\t\tCLIDisplay.break();\n\t\t\t\tCLIDisplay.section(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.adminUserCreate\")\n\t\t\t\t);\n\t\t\t\tawait userCreate(engineCore, envVars, {\n\t\t\t\t\tuserIdentity: userDid,\n\t\t\t\t\torganizationIdentity: orgDid,\n\t\t\t\t\ttenantId: tenant?.id,\n\t\t\t\t\temail: envVars.adminUserName ?? `admin@${tenantEnabled ? \"tenant\" : \"node\"}`,\n\t\t\t\t\tpassword: envVars.adminUserPassword,\n\t\t\t\t\tscope:\n\t\t\t\t\t\tenvVars.adminUserScope ??\n\t\t\t\t\t\t(tenantEnabled\n\t\t\t\t\t\t\t? [\"global-admin\", \"tenant-admin\", \"user-admin\"]\n\t\t\t\t\t\t\t: [\"global-admin\", \"user-admin\"]\n\t\t\t\t\t\t).join(\",\"),\n\t\t\t\t\tgivenName: tenantEnabled ? \"Tenant\" : \"Node\",\n\t\t\t\t\tfamilyName: \"Admin\",\n\t\t\t\t\toverwriteMode: \"skip\"\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n}\n\n/**\n * Resolve the organisation DID from node state (single-tenant) or the tenant entry (multi-tenant).\n * @param engineCore The engine core.\n * @param tenantEnabled Whether multi-tenancy is enabled.\n * @param tenantId The active tenant ID (multi-tenant only).\n * @returns The organisation DID.\n * @throws GeneralError if the organisation has not been associated yet.\n * @internal\n */\nasync function resolveOrganizationDid(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\ttenantEnabled: boolean,\n\ttenantId: string | undefined\n): Promise<string> {\n\tif (tenantEnabled) {\n\t\tif (Is.stringValue(tenantId)) {\n\t\t\tconst tenantAdminComponentType =\n\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\t\t\tif (Is.stringValue(tenantAdminComponentType)) {\n\t\t\t\tconst tenantAdminComponent =\n\t\t\t\t\tComponentFactory.get<ITenantAdminComponent>(tenantAdminComponentType);\n\t\t\t\tconst tenant = await tenantAdminComponent.get(tenantId);\n\t\t\t\tif (Is.stringValue(tenant.organizationId)) {\n\t\t\t\t\treturn tenant.organizationId;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst state = engineCore.getState();\n\t\tif (Is.stringValue(state.nodeOrganizationId)) {\n\t\t\treturn state.nodeOrganizationId;\n\t\t}\n\t}\n\n\tthrow new GeneralError(\"bootstrapDev\", \"organizationNotSet\");\n}\n\n/**\n * Resolve the default tenant id for re-bootstrap when multi-tenancy is enabled.\n * @param engineCore The engine core.\n * @returns The tenant id if one exists in storage.\n * @internal\n */\nasync function resolveDefaultTenant(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>\n): Promise<{ id: string; organizationId: string } | undefined> {\n\tconst tenantAdminServiceComponentType =\n\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\n\tif (!Is.stringValue(tenantAdminServiceComponentType)) {\n\t\treturn undefined;\n\t}\n\n\tconst tenantAdminService = ComponentFactory.get<ITenantAdminComponent>(\n\t\ttenantAdminServiceComponentType\n\t);\n\n\tlet cursor: string | undefined;\n\tlet firstTenant: { id: string; organizationId: string } | undefined;\n\n\tdo {\n\t\tconst result = await tenantAdminService.query(\n\t\t\tundefined,\n\t\t\t[\"id\", \"organizationId\", \"label\"],\n\t\t\tcursor\n\t\t);\n\t\tconst nodeTenant = result.tenants.find(tenant => tenant.label === \"Tenant\");\n\t\tif (nodeTenant) {\n\t\t\treturn {\n\t\t\t\tid: nodeTenant.id,\n\t\t\t\torganizationId: nodeTenant.organizationId ?? \"\"\n\t\t\t};\n\t\t}\n\n\t\tif (Is.empty(firstTenant) && Is.arrayValue(result.tenants)) {\n\t\t\tfirstTenant = {\n\t\t\t\tid: result.tenants[0].id,\n\t\t\t\torganizationId: result.tenants[0].organizationId ?? \"\"\n\t\t\t};\n\t\t}\n\n\t\tcursor = result.cursor;\n\t} while (Is.stringValue(cursor));\n\n\tif (!Is.empty(firstTenant)) {\n\t\tCLIDisplay.value(\n\t\t\tI18n.formatMessage(\"node.cli.commands.bootstrap-dev.labels.tenantFallback\"),\n\t\t\tfirstTenant.id\n\t\t);\n\t}\n\n\treturn firstTenant;\n}\n\n/**\n * Resolve the admin user by email for idempotent re-bootstrap.\n * @param engineCore The engine core.\n * @param email The email address of the admin user to look up.\n * @returns The admin user if one exists in storage.\n * @internal\n */\nasync function resolveDefaultAdminUser(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\temail: string\n): Promise<{ email: string; userIdentity: string; organizationIdentity: string } | undefined> {\n\tconst defaultAuthenticationAdminComponentType = engineCore.getRegisteredInstanceType(\n\t\t\"authenticationAdminComponent\"\n\t);\n\tconst authenticationAdminComponent = ComponentFactory.get<IAuthenticationAdminComponent>(\n\t\tdefaultAuthenticationAdminComponentType\n\t);\n\n\ttry {\n\t\treturn await authenticationAdminComponent.get(email);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolve a tenant by its specific ID for idempotent re-bootstrap.\n * @param engineCore The engine core.\n * @param tenantId The tenant ID to look up.\n * @returns The tenant if found, otherwise undefined.\n * @internal\n */\nasync function resolveTenantById(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\ttenantId: string\n): Promise<{ id: string; organizationId: string } | undefined> {\n\tconst tenantAdminServiceComponentType =\n\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\n\tif (!Is.stringValue(tenantAdminServiceComponentType)) {\n\t\treturn undefined;\n\t}\n\n\tconst tenantAdminService = ComponentFactory.get<ITenantAdminComponent>(\n\t\ttenantAdminServiceComponentType\n\t);\n\n\ttry {\n\t\tconst found = await tenantAdminService.get(tenantId);\n\t\treturn {\n\t\t\tid: found.id,\n\t\t\torganizationId: found.organizationId ?? \"\"\n\t\t};\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScopeHelper } from "@twin.org/api-models";
|
|
1
2
|
import { CLIDisplay, CLIUtils } from "@twin.org/cli-core";
|
|
2
3
|
import { ContextIdKeys, ContextIdStore } from "@twin.org/context";
|
|
3
4
|
import { Coerce, ComponentFactory, GeneralError, Guards, I18n, Is } from "@twin.org/core";
|
|
@@ -177,10 +178,14 @@ export async function userCreate(engineCore, envVars, params) {
|
|
|
177
178
|
password: params.password ?? PasswordGenerator.generate(16),
|
|
178
179
|
userIdentity: paramsUserIdentity,
|
|
179
180
|
organizationIdentity: paramsOrganizationIdentity,
|
|
180
|
-
scope: params.scope
|
|
181
|
+
scope: ScopeHelper.toArray(params.scope)
|
|
181
182
|
};
|
|
182
183
|
CLIDisplay.task(I18n.formatMessage("node.cli.commands.user-create.labels.storingUser"));
|
|
183
|
-
await ContextIdStore.run({
|
|
184
|
+
await ContextIdStore.run({
|
|
185
|
+
...currentContextIds,
|
|
186
|
+
[ContextIdKeys.Tenant]: params.tenantId,
|
|
187
|
+
scope: ScopeHelper.toString(user.scope)
|
|
188
|
+
}, async () => {
|
|
184
189
|
if (existingUser) {
|
|
185
190
|
await authenticationAdminComponent.update(user);
|
|
186
191
|
}
|
|
@@ -212,7 +217,7 @@ export async function userCreate(engineCore, envVars, params) {
|
|
|
212
217
|
organizationDid: paramsOrganizationIdentity,
|
|
213
218
|
email: paramsEmail,
|
|
214
219
|
password: user.password,
|
|
215
|
-
scope: params.scope
|
|
220
|
+
scope: ScopeHelper.toArray(params.scope),
|
|
216
221
|
givenName: params.givenName ?? "",
|
|
217
222
|
familyName: params.familyName ?? ""
|
|
218
223
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userCreate.js","sourceRoot":"","sources":["../../../src/commands/userCreate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,GAAG,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAKjF,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,kBAE9C;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO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AE;gBACjC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE;aACnC,CAAC;YAEF,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;gBACvC,MAAM,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC9D,CAAC;YAED,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,MAAM,QAAQ,CAAC,YAAY,CAC1B,MAAM,CAAC,SAAS,EAChB;oBACC,GAAG,MAAM,CAAC,eAAe,QAAQ,MAAM,CAAC,YAAY,GAAG;oBACvD,GAAG,MAAM,CAAC,eAAe,qBAAqB,MAAM,CAAC,oBAAoB,GAAG;oBAC5E,GAAG,MAAM,CAAC,eAAe,UAAU,WAAW,GAAG;oBACjD,GAAG,MAAM,CAAC,eAAe,aAAa,IAAI,CAAC,QAAQ,GAAG;oBACtD,GAAG,MAAM,CAAC,eAAe,UAAU,MAAM,CAAC,KAAK,IAAI,EAAE,GAAG;oBACxD,GAAG,MAAM,CAAC,eAAe,eAAe,MAAM,CAAC,SAAS,IAAI,EAAE,GAAG;oBACjE,GAAG,MAAM,CAAC,eAAe,gBAAgB,MAAM,CAAC,UAAU,IAAI,EAAE,GAAG;iBACnE,EACD,KAAK,CACL,CAAC;YACH,CAAC;QACF,CAAC;QAED,UAAU,CAAC,IAAI,EAAE,CAAC;QAElB,OAAO,IAAI,CAAC;IACb,CAAC,CACD,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport { PasswordGenerator } from \"@twin.org/crypto\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did, IdentityProfileConnectorFactory } from \"@twin.org/identity-models\";\nimport type { Person, WithContext } from \"schema-dts\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"user-create\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionUserCreate(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-create.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.user-create.example\"),\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"user-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.user-identity.description\"\n\t\t\t\t)\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"organization-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.organization-identity.description\"\n\t\t\t\t)\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"tenant-id\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"hex(32)\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.tenant-id.description\"\n\t\t\t\t)\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"email\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"email\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-create.params.email.description\")\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"password\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.password.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"scope\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-create.params.scope.description\"),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"given-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.given-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"family-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.family-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"overwrite-mode\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.overwrite-mode.description\"\n\t\t\t\t),\n\t\t\t\toptions: [\"skip\", \"overwrite\", \"error\"],\n\t\t\t\tdefaultValue: \"skip\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-json\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.output-json.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.output-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.output-env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => userCreate(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for creating a user.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.userIdentity The DID for the user.\n * @param params.organizationIdentity The organization DID for the user.\n * @param params.tenantId The tenant ID for the user.\n * @param params.email The email for the user.\n * @param params.password The password for the user.\n * @param params.scope The scope for the user.\n * @param params.givenName The given name for the user.\n * @param params.familyName The family name for the user.\n * @param params.overwriteMode The mode to use when a user with the same identity already exists.\n * @param params.outputJson The output .json file to store the command output.\n * @param params.outputEnv The output .env file to store the command output.\n * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.\n * @returns The created user details or undefined if skipped.\n */\nexport async function userCreate(\n\tengineCore: IEngineCore,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\tuserIdentity?: string;\n\t\torganizationIdentity?: string;\n\t\ttenantId?: string;\n\t\temail?: string;\n\t\tpassword?: string;\n\t\tscope?: string;\n\t\tgivenName?: string;\n\t\tfamilyName?: string;\n\t\toverwriteMode?: \"skip\" | \"overwrite\" | \"error\";\n\t\toutputJson?: string;\n\t\toutputEnv?: string;\n\t\toutputEnvPrefix?: string;\n\t}\n): Promise<\n\t| {\n\t\t\tdid: string;\n\t\t\torganizationDid: string;\n\t\t\temail: string;\n\t\t\tpassword: string;\n\t\t\tscope: string[];\n\t\t\tgivenName: string;\n\t\t\tfamilyName: string;\n\t }\n\t| undefined\n> {\n\tconst paramsEmail = params.email;\n\tconst paramsUserIdentity = params.userIdentity;\n\tconst paramsOrganizationIdentity = params.organizationIdentity;\n\tGuards.email(\"userCreate\", \"email\", paramsEmail);\n\tDid.guard(\"userCreate\", \"user-identity\", paramsUserIdentity);\n\tDid.guard(\"userCreate\", \"organization-identity\", paramsOrganizationIdentity);\n\tif (Is.stringValue(params.tenantId)) {\n\t\tGuards.stringHexLength(\"userCreate\", \"tenant-id\", params.tenantId, 32);\n\t} else if (Coerce.boolean(envVars.tenantEnabled) ?? false) {\n\t\tthrow new GeneralError(\"userCreate\", \"tenantIdRequired\");\n\t}\n\n\tif (Is.stringValue(params.password) && params.password.length < 16) {\n\t\tthrow new GeneralError(\"userCreate\", \"passwordTooShort\", { minLength: 16 });\n\t}\n\n\tconst defaultIdentityProfileConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityProfileConnector\"\n\t);\n\tconst identityProfileConnector = IdentityProfileConnectorFactory.get(\n\t\tdefaultIdentityProfileConnectorType\n\t);\n\n\tconst defaultAuthenticationAdminComponentType = engineCore.getRegisteredInstanceType(\n\t\t\"authenticationAdminComponent\"\n\t);\n\tconst authenticationAdminComponent = ComponentFactory.get<IAuthenticationAdminComponent>(\n\t\tdefaultAuthenticationAdminComponentType\n\t);\n\n\tlet createUser = true;\n\n\tconst currentContextIds = (await ContextIdStore.getContextIds()) ?? {};\n\tconst returnJson = await ContextIdStore.run(\n\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\tasync () => {\n\t\t\tlet existingUser: IAuthenticationUser | undefined;\n\t\t\ttry {\n\t\t\t\texistingUser = await authenticationAdminComponent.get(paramsEmail);\n\t\t\t} catch {}\n\n\t\t\tif (!Is.empty(existingUser)) {\n\t\t\t\tif (params.overwriteMode === \"error\") {\n\t\t\t\t\tthrow new GeneralError(\"userCreate\", \"userAlreadyExists\");\n\t\t\t\t} else if (params.overwriteMode === \"skip\") {\n\t\t\t\t\tcreateUser = false;\n\t\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.skipping\"));\n\t\t\t\t} else if (params.overwriteMode === \"overwrite\") {\n\t\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.overwriting\"));\n\t\t\t\t\tconst userToRemove = existingUser;\n\t\t\t\t\tawait ContextIdStore.run(\n\t\t\t\t\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\tawait authenticationAdminComponent.remove(userToRemove.email);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tawait identityProfileConnector.remove(userToRemove.userIdentity);\n\t\t\t\t\texistingUser = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet json;\n\t\t\tif (createUser) {\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.creating\"));\n\n\t\t\t\tconst user: IAuthenticationUser & { password: string } = {\n\t\t\t\t\temail: paramsEmail,\n\t\t\t\t\tpassword: params.password ?? PasswordGenerator.generate(16),\n\t\t\t\t\tuserIdentity: paramsUserIdentity,\n\t\t\t\t\torganizationIdentity: paramsOrganizationIdentity,\n\t\t\t\t\tscope: params.scope?.split(\",\").map(s => s.trim()) ?? []\n\t\t\t\t};\n\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.storingUser\"));\n\n\t\t\t\tawait ContextIdStore.run(\n\t\t\t\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\tif (existingUser) {\n\t\t\t\t\t\t\tawait authenticationAdminComponent.update(user);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tawait authenticationAdminComponent.create(user);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst name = `${params.givenName ?? \"\"} ${params.familyName ?? \"\"}`.trim();\n\t\t\t\tconst publicProfile: WithContext<Person> = {\n\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\tname: name.length > 0 ? name : undefined\n\t\t\t\t};\n\t\t\t\tconst privateProfile: WithContext<Person> = {\n\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\tgivenName: params.givenName,\n\t\t\t\t\tfamilyName: params.familyName,\n\t\t\t\t\temail: paramsEmail\n\t\t\t\t};\n\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.storingProfile\"));\n\t\t\t\tawait identityProfileConnector.create(paramsUserIdentity, publicProfile, privateProfile);\n\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.userCreated\"));\n\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.user-create.labels.email\"),\n\t\t\t\t\tuser.email\n\t\t\t\t);\n\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.user-create.labels.password\"),\n\t\t\t\t\tuser.password\n\t\t\t\t);\n\n\t\t\t\tCLIDisplay.break();\n\n\t\t\t\tjson = {\n\t\t\t\t\tdid: paramsUserIdentity,\n\t\t\t\t\torganizationDid: paramsOrganizationIdentity,\n\t\t\t\t\temail: paramsEmail,\n\t\t\t\t\tpassword: user.password,\n\t\t\t\t\tscope: params.scope?.split(\",\").map(s => s.trim()) ?? [],\n\t\t\t\t\tgivenName: params.givenName ?? \"\",\n\t\t\t\t\tfamilyName: params.familyName ?? \"\"\n\t\t\t\t};\n\n\t\t\t\tif (Is.stringValue(params.outputJson)) {\n\t\t\t\t\tawait CLIUtils.writeJsonFile(params.outputJson, json, false);\n\t\t\t\t}\n\n\t\t\t\tif (Is.stringValue(params.outputEnv)) {\n\t\t\t\t\tawait CLIUtils.writeEnvFile(\n\t\t\t\t\t\tparams.outputEnv,\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}DID=\"${params.userIdentity}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}ORGANIZATION_DID=\"${params.organizationIdentity}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}EMAIL=\"${paramsEmail}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}PASSWORD=\"${user.password}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}SCOPE=\"${params.scope ?? \"\"}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}GIVEN_NAME=\"${params.givenName ?? \"\"}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}FAMILY_NAME=\"${params.familyName ?? \"\"}\"`\n\t\t\t\t\t\t],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tCLIDisplay.done();\n\n\t\t\treturn json;\n\t\t}\n\t);\n\n\treturn returnJson;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"userCreate.js","sourceRoot":"","sources":["../../../src/commands/userCreate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EA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X-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { ScopeHelper } from \"@twin.org/api-models\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport { PasswordGenerator } from \"@twin.org/crypto\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did, IdentityProfileConnectorFactory } from \"@twin.org/identity-models\";\nimport type { Person, WithContext } from \"schema-dts\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"user-create\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionUserCreate(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-create.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.user-create.example\"),\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"user-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.user-identity.description\"\n\t\t\t\t)\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"organization-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.organization-identity.description\"\n\t\t\t\t)\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"tenant-id\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"hex(32)\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.tenant-id.description\"\n\t\t\t\t)\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"email\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"email\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-create.params.email.description\")\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"password\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.password.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"scope\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-create.params.scope.description\"),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"given-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.given-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"family-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.family-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"overwrite-mode\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.overwrite-mode.description\"\n\t\t\t\t),\n\t\t\t\toptions: [\"skip\", \"overwrite\", \"error\"],\n\t\t\t\tdefaultValue: \"skip\",\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-json\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.output-json.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.output-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"output-env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-create.params.output-env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => userCreate(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for creating a user.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.userIdentity The DID for the user.\n * @param params.organizationIdentity The organization DID for the user.\n * @param params.tenantId The tenant ID for the user.\n * @param params.email The email for the user.\n * @param params.password The password for the user.\n * @param params.scope The scope for the user.\n * @param params.givenName The given name for the user.\n * @param params.familyName The family name for the user.\n * @param params.overwriteMode The mode to use when a user with the same identity already exists.\n * @param params.outputJson The output .json file to store the command output.\n * @param params.outputEnv The output .env file to store the command output.\n * @param params.outputEnvPrefix The prefix to use for variables in the output .env file.\n * @returns The created user details or undefined if skipped.\n */\nexport async function userCreate(\n\tengineCore: IEngineCore,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\tuserIdentity?: string;\n\t\torganizationIdentity?: string;\n\t\ttenantId?: string;\n\t\temail?: string;\n\t\tpassword?: string;\n\t\tscope?: string;\n\t\tgivenName?: string;\n\t\tfamilyName?: string;\n\t\toverwriteMode?: \"skip\" | \"overwrite\" | \"error\";\n\t\toutputJson?: string;\n\t\toutputEnv?: string;\n\t\toutputEnvPrefix?: string;\n\t}\n): Promise<\n\t| {\n\t\t\tdid: string;\n\t\t\torganizationDid: string;\n\t\t\temail: string;\n\t\t\tpassword: string;\n\t\t\tscope: string[];\n\t\t\tgivenName: string;\n\t\t\tfamilyName: string;\n\t }\n\t| undefined\n> {\n\tconst paramsEmail = params.email;\n\tconst paramsUserIdentity = params.userIdentity;\n\tconst paramsOrganizationIdentity = params.organizationIdentity;\n\tGuards.email(\"userCreate\", \"email\", paramsEmail);\n\tDid.guard(\"userCreate\", \"user-identity\", paramsUserIdentity);\n\tDid.guard(\"userCreate\", \"organization-identity\", paramsOrganizationIdentity);\n\tif (Is.stringValue(params.tenantId)) {\n\t\tGuards.stringHexLength(\"userCreate\", \"tenant-id\", params.tenantId, 32);\n\t} else if (Coerce.boolean(envVars.tenantEnabled) ?? false) {\n\t\tthrow new GeneralError(\"userCreate\", \"tenantIdRequired\");\n\t}\n\n\tif (Is.stringValue(params.password) && params.password.length < 16) {\n\t\tthrow new GeneralError(\"userCreate\", \"passwordTooShort\", { minLength: 16 });\n\t}\n\n\tconst defaultIdentityProfileConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityProfileConnector\"\n\t);\n\tconst identityProfileConnector = IdentityProfileConnectorFactory.get(\n\t\tdefaultIdentityProfileConnectorType\n\t);\n\n\tconst defaultAuthenticationAdminComponentType = engineCore.getRegisteredInstanceType(\n\t\t\"authenticationAdminComponent\"\n\t);\n\tconst authenticationAdminComponent = ComponentFactory.get<IAuthenticationAdminComponent>(\n\t\tdefaultAuthenticationAdminComponentType\n\t);\n\n\tlet createUser = true;\n\n\tconst currentContextIds = (await ContextIdStore.getContextIds()) ?? {};\n\tconst returnJson = await ContextIdStore.run(\n\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\tasync () => {\n\t\t\tlet existingUser: IAuthenticationUser | undefined;\n\t\t\ttry {\n\t\t\t\texistingUser = await authenticationAdminComponent.get(paramsEmail);\n\t\t\t} catch {}\n\n\t\t\tif (!Is.empty(existingUser)) {\n\t\t\t\tif (params.overwriteMode === \"error\") {\n\t\t\t\t\tthrow new GeneralError(\"userCreate\", \"userAlreadyExists\");\n\t\t\t\t} else if (params.overwriteMode === \"skip\") {\n\t\t\t\t\tcreateUser = false;\n\t\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.skipping\"));\n\t\t\t\t} else if (params.overwriteMode === \"overwrite\") {\n\t\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.overwriting\"));\n\t\t\t\t\tconst userToRemove = existingUser;\n\t\t\t\t\tawait ContextIdStore.run(\n\t\t\t\t\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\tawait authenticationAdminComponent.remove(userToRemove.email);\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tawait identityProfileConnector.remove(userToRemove.userIdentity);\n\t\t\t\t\texistingUser = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet json;\n\t\t\tif (createUser) {\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.creating\"));\n\n\t\t\t\tconst user: IAuthenticationUser & { password: string } = {\n\t\t\t\t\temail: paramsEmail,\n\t\t\t\t\tpassword: params.password ?? PasswordGenerator.generate(16),\n\t\t\t\t\tuserIdentity: paramsUserIdentity,\n\t\t\t\t\torganizationIdentity: paramsOrganizationIdentity,\n\t\t\t\t\tscope: ScopeHelper.toArray(params.scope)\n\t\t\t\t};\n\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.storingUser\"));\n\n\t\t\t\tawait ContextIdStore.run(\n\t\t\t\t\t{\n\t\t\t\t\t\t...currentContextIds,\n\t\t\t\t\t\t[ContextIdKeys.Tenant]: params.tenantId,\n\t\t\t\t\t\tscope: ScopeHelper.toString(user.scope)\n\t\t\t\t\t},\n\t\t\t\t\tasync () => {\n\t\t\t\t\t\tif (existingUser) {\n\t\t\t\t\t\t\tawait authenticationAdminComponent.update(user);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tawait authenticationAdminComponent.create(user);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst name = `${params.givenName ?? \"\"} ${params.familyName ?? \"\"}`.trim();\n\t\t\t\tconst publicProfile: WithContext<Person> = {\n\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\tname: name.length > 0 ? name : undefined\n\t\t\t\t};\n\t\t\t\tconst privateProfile: WithContext<Person> = {\n\t\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\t\"@type\": \"Person\",\n\t\t\t\t\tgivenName: params.givenName,\n\t\t\t\t\tfamilyName: params.familyName,\n\t\t\t\t\temail: paramsEmail\n\t\t\t\t};\n\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.storingProfile\"));\n\t\t\t\tawait identityProfileConnector.create(paramsUserIdentity, publicProfile, privateProfile);\n\n\t\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-create.labels.userCreated\"));\n\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.user-create.labels.email\"),\n\t\t\t\t\tuser.email\n\t\t\t\t);\n\n\t\t\t\tCLIDisplay.value(\n\t\t\t\t\tI18n.formatMessage(\"node.cli.commands.user-create.labels.password\"),\n\t\t\t\t\tuser.password\n\t\t\t\t);\n\n\t\t\t\tCLIDisplay.break();\n\n\t\t\t\tjson = {\n\t\t\t\t\tdid: paramsUserIdentity,\n\t\t\t\t\torganizationDid: paramsOrganizationIdentity,\n\t\t\t\t\temail: paramsEmail,\n\t\t\t\t\tpassword: user.password,\n\t\t\t\t\tscope: ScopeHelper.toArray(params.scope),\n\t\t\t\t\tgivenName: params.givenName ?? \"\",\n\t\t\t\t\tfamilyName: params.familyName ?? \"\"\n\t\t\t\t};\n\n\t\t\t\tif (Is.stringValue(params.outputJson)) {\n\t\t\t\t\tawait CLIUtils.writeJsonFile(params.outputJson, json, false);\n\t\t\t\t}\n\n\t\t\t\tif (Is.stringValue(params.outputEnv)) {\n\t\t\t\t\tawait CLIUtils.writeEnvFile(\n\t\t\t\t\t\tparams.outputEnv,\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}DID=\"${params.userIdentity}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}ORGANIZATION_DID=\"${params.organizationIdentity}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}EMAIL=\"${paramsEmail}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}PASSWORD=\"${user.password}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}SCOPE=\"${params.scope ?? \"\"}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}GIVEN_NAME=\"${params.givenName ?? \"\"}\"`,\n\t\t\t\t\t\t\t`${params.outputEnvPrefix}FAMILY_NAME=\"${params.familyName ?? \"\"}\"`\n\t\t\t\t\t\t],\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tCLIDisplay.done();\n\n\t\t\treturn json;\n\t\t}\n\t);\n\n\treturn returnJson;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScopeHelper } from "@twin.org/api-models";
|
|
1
2
|
import { CLIDisplay } from "@twin.org/cli-core";
|
|
2
3
|
import { ContextIdKeys, ContextIdStore } from "@twin.org/context";
|
|
3
4
|
import { Coerce, ComponentFactory, GeneralError, Guards, I18n, Is } from "@twin.org/core";
|
|
@@ -116,7 +117,7 @@ export async function userUpdate(engineCore, envVars, params) {
|
|
|
116
117
|
email: paramsEmail,
|
|
117
118
|
userIdentity: paramsUserIdentity,
|
|
118
119
|
organizationIdentity: paramsOrganizationIdentity,
|
|
119
|
-
scope: params.scope
|
|
120
|
+
scope: ScopeHelper.toArray(params.scope)
|
|
120
121
|
};
|
|
121
122
|
CLIDisplay.task(I18n.formatMessage("node.cli.commands.user-update.labels.storingUser"));
|
|
122
123
|
const existingUser = await authenticationAdminComponent.get(paramsEmail);
|
|
@@ -142,7 +143,9 @@ export async function userUpdate(engineCore, envVars, params) {
|
|
|
142
143
|
did: params.userIdentity ?? existingUser.userIdentity,
|
|
143
144
|
organizationDid: params.organizationIdentity ?? existingUser.organizationIdentity,
|
|
144
145
|
email: paramsEmail,
|
|
145
|
-
scope: params.scope
|
|
146
|
+
scope: Is.stringValue(params.scope)
|
|
147
|
+
? ScopeHelper.toArray(params.scope)
|
|
148
|
+
: existingUser.scope,
|
|
146
149
|
givenName: params.givenName ?? "",
|
|
147
150
|
familyName: params.familyName ?? ""
|
|
148
151
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userUpdate.js","sourceRoot":"","sources":["../../../src/commands/userUpdate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAE,GAAG,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAA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AC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,YAAY,CAAC,KAAK;YACxE,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE;SACnC,CAAC;QAEF,UAAU,CAAC,IAAI,EAAE,CAAC;QAElB,OAAO,IAAI,CAAC;IACb,CAAC,CACD,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did, IdentityProfileConnectorFactory } from \"@twin.org/identity-models\";\nimport type { Person, WithContext } from \"schema-dts\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"user-update\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionUserUpdate(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-update.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.user-update.example\"),\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"user-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.user-identity.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"organization-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.organization-identity.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"tenant-id\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"hex(32)\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.tenant-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"email\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"email\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-update.params.email.description\")\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"scope\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-update.params.scope.description\"),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"given-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.given-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"family-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.family-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => userUpdate(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for updating a user.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.userIdentity The DID for the user.\n * @param params.organizationIdentity The organization DID for the user.\n * @param params.tenantId The tenant ID for the user.\n * @param params.email The email for the user.\n * @param params.scope The scope for the user.\n * @param params.givenName The given name for the user.\n * @param params.familyName The family name for the user.\n * @returns The updated user details or undefined if skipped.\n */\nexport async function userUpdate(\n\tengineCore: IEngineCore,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\tuserIdentity?: string;\n\t\torganizationIdentity?: string;\n\t\ttenantId?: string;\n\t\temail?: string;\n\t\tscope?: string;\n\t\tgivenName?: string;\n\t\tfamilyName?: string;\n\t}\n): Promise<\n\t| {\n\t\t\tdid: string;\n\t\t\torganizationDid: string;\n\t\t\temail: string;\n\t\t\tscope: string[];\n\t\t\tgivenName: string;\n\t\t\tfamilyName: string;\n\t }\n\t| undefined\n> {\n\tconst paramsEmail = params.email;\n\tconst paramsUserIdentity = params.userIdentity;\n\tconst paramsOrganizationIdentity = params.organizationIdentity;\n\n\tGuards.email(\"userUpdate\", \"email\", paramsEmail);\n\tif (Is.stringValue(paramsUserIdentity)) {\n\t\tDid.guard(\"userUpdate\", \"user-identity\", paramsUserIdentity);\n\t}\n\tif (Is.stringValue(paramsOrganizationIdentity)) {\n\t\tDid.guard(\"userUpdate\", \"organization-identity\", paramsOrganizationIdentity);\n\t}\n\tif (Is.stringValue(params.tenantId)) {\n\t\tGuards.stringHexLength(\"userUpdate\", \"tenant-id\", params.tenantId, 32);\n\t} else if (Coerce.boolean(envVars.tenantEnabled) ?? false) {\n\t\tthrow new GeneralError(\"userUpdate\", \"tenantIdRequired\");\n\t}\n\n\tconst defaultIdentityProfileConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityProfileConnector\"\n\t);\n\tconst identityProfileConnector = IdentityProfileConnectorFactory.get(\n\t\tdefaultIdentityProfileConnectorType\n\t);\n\n\tconst defaultAuthenticationAdminComponentType = engineCore.getRegisteredInstanceType(\n\t\t\"authenticationAdminComponent\"\n\t);\n\tconst authenticationAdminComponent = ComponentFactory.get<IAuthenticationAdminComponent>(\n\t\tdefaultAuthenticationAdminComponentType\n\t);\n\n\tconst currentContextIds = (await ContextIdStore.getContextIds()) ?? {};\n\tconst returnJson = await ContextIdStore.run(\n\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\tasync () => {\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.updating\"));\n\n\t\t\tconst user: Partial<IAuthenticationUser> = {\n\t\t\t\temail: paramsEmail,\n\t\t\t\tuserIdentity: paramsUserIdentity,\n\t\t\t\torganizationIdentity: paramsOrganizationIdentity,\n\t\t\t\tscope: params.scope?.split(\",\").map(s => s.trim())\n\t\t\t};\n\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.storingUser\"));\n\n\t\t\tconst existingUser = await authenticationAdminComponent.get(paramsEmail);\n\t\t\tawait authenticationAdminComponent.update(user);\n\n\t\t\tconst name = `${params.givenName ?? \"\"} ${params.familyName ?? \"\"}`.trim();\n\t\t\tconst publicProfile: WithContext<Person> = {\n\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\"@type\": \"Person\",\n\t\t\t\tname: name.length > 0 ? name : undefined\n\t\t\t};\n\t\t\tconst privateProfile: WithContext<Person> = {\n\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\"@type\": \"Person\",\n\t\t\t\tgivenName: params.givenName,\n\t\t\t\tfamilyName: params.familyName,\n\t\t\t\temail: paramsEmail\n\t\t\t};\n\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.storingProfile\"));\n\t\t\tawait identityProfileConnector.update(\n\t\t\t\texistingUser.userIdentity,\n\t\t\t\tpublicProfile,\n\t\t\t\tprivateProfile\n\t\t\t);\n\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.userUpdated\"));\n\n\t\t\tCLIDisplay.break();\n\n\t\t\tconst json = {\n\t\t\t\tdid: params.userIdentity ?? existingUser.userIdentity,\n\t\t\t\torganizationDid: params.organizationIdentity ?? existingUser.organizationIdentity,\n\t\t\t\temail: paramsEmail,\n\t\t\t\tscope: params.scope?.split(\",\").map(s => s.trim()) ?? existingUser.scope,\n\t\t\t\tgivenName: params.givenName ?? \"\",\n\t\t\t\tfamilyName: params.familyName ?? \"\"\n\t\t\t};\n\n\t\t\tCLIDisplay.done();\n\n\t\t\treturn json;\n\t\t}\n\t);\n\n\treturn returnJson;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"userUpdate.js","sourceRoot":"","sources":["../../../src/commands/userUpdate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAE,GAAG,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAKjF,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,kBAE9C;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,IAAI,CAAC,a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ACb,CAAC,CACD,CAAC;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIAuthenticationAdminComponent,\n\tIAuthenticationUser\n} from \"@twin.org/api-auth-entity-storage-models\";\nimport { ScopeHelper } from \"@twin.org/api-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { Coerce, ComponentFactory, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did, IdentityProfileConnectorFactory } from \"@twin.org/identity-models\";\nimport type { Person, WithContext } from \"schema-dts\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"user-update\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionUserUpdate(commandDefinitions: {\n\t[id: string]: ICliCommandDefinition;\n}): void {\n\tcommandDefinitions[COMMAND_NAME] = {\n\t\tcommand: COMMAND_NAME,\n\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-update.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.user-update.example\"),\n\t\tparams: [\n\t\t\t{\n\t\t\t\tkey: \"env-prefix\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.env-prefix.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"user-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.user-identity.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"organization-identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"DID\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.organization-identity.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"tenant-id\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"hex(32)\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.tenant-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"email\",\n\t\t\t\ttype: \"string\",\n\t\t\t\textendedType: \"email\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-update.params.email.description\")\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"scope\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\"node.cli.commands.user-update.params.scope.description\"),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"given-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.given-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"family-name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.family-name.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"load-env\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.user-update.params.load-env.description\"\n\t\t\t\t),\n\t\t\t\trequired: false\n\t\t\t}\n\t\t],\n\t\taction: async (engineCore, envVars, params) => userUpdate(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for updating a user.\n * @param engineCore The engine core.\n * @param envVars The environment variables for the node.\n * @param params The parameters for the command.\n * @param params.userIdentity The DID for the user.\n * @param params.organizationIdentity The organization DID for the user.\n * @param params.tenantId The tenant ID for the user.\n * @param params.email The email for the user.\n * @param params.scope The scope for the user.\n * @param params.givenName The given name for the user.\n * @param params.familyName The family name for the user.\n * @returns The updated user details or undefined if skipped.\n */\nexport async function userUpdate(\n\tengineCore: IEngineCore,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\tuserIdentity?: string;\n\t\torganizationIdentity?: string;\n\t\ttenantId?: string;\n\t\temail?: string;\n\t\tscope?: string;\n\t\tgivenName?: string;\n\t\tfamilyName?: string;\n\t}\n): Promise<\n\t| {\n\t\t\tdid: string;\n\t\t\torganizationDid: string;\n\t\t\temail: string;\n\t\t\tscope: string[];\n\t\t\tgivenName: string;\n\t\t\tfamilyName: string;\n\t }\n\t| undefined\n> {\n\tconst paramsEmail = params.email;\n\tconst paramsUserIdentity = params.userIdentity;\n\tconst paramsOrganizationIdentity = params.organizationIdentity;\n\n\tGuards.email(\"userUpdate\", \"email\", paramsEmail);\n\tif (Is.stringValue(paramsUserIdentity)) {\n\t\tDid.guard(\"userUpdate\", \"user-identity\", paramsUserIdentity);\n\t}\n\tif (Is.stringValue(paramsOrganizationIdentity)) {\n\t\tDid.guard(\"userUpdate\", \"organization-identity\", paramsOrganizationIdentity);\n\t}\n\tif (Is.stringValue(params.tenantId)) {\n\t\tGuards.stringHexLength(\"userUpdate\", \"tenant-id\", params.tenantId, 32);\n\t} else if (Coerce.boolean(envVars.tenantEnabled) ?? false) {\n\t\tthrow new GeneralError(\"userUpdate\", \"tenantIdRequired\");\n\t}\n\n\tconst defaultIdentityProfileConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityProfileConnector\"\n\t);\n\tconst identityProfileConnector = IdentityProfileConnectorFactory.get(\n\t\tdefaultIdentityProfileConnectorType\n\t);\n\n\tconst defaultAuthenticationAdminComponentType = engineCore.getRegisteredInstanceType(\n\t\t\"authenticationAdminComponent\"\n\t);\n\tconst authenticationAdminComponent = ComponentFactory.get<IAuthenticationAdminComponent>(\n\t\tdefaultAuthenticationAdminComponentType\n\t);\n\n\tconst currentContextIds = (await ContextIdStore.getContextIds()) ?? {};\n\tconst returnJson = await ContextIdStore.run(\n\t\t{ ...currentContextIds, [ContextIdKeys.Tenant]: params.tenantId },\n\t\tasync () => {\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.updating\"));\n\n\t\t\tconst user: Partial<IAuthenticationUser> = {\n\t\t\t\temail: paramsEmail,\n\t\t\t\tuserIdentity: paramsUserIdentity,\n\t\t\t\torganizationIdentity: paramsOrganizationIdentity,\n\t\t\t\tscope: ScopeHelper.toArray(params.scope)\n\t\t\t};\n\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.storingUser\"));\n\n\t\t\tconst existingUser = await authenticationAdminComponent.get(paramsEmail);\n\t\t\tawait authenticationAdminComponent.update(user);\n\n\t\t\tconst name = `${params.givenName ?? \"\"} ${params.familyName ?? \"\"}`.trim();\n\t\t\tconst publicProfile: WithContext<Person> = {\n\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\"@type\": \"Person\",\n\t\t\t\tname: name.length > 0 ? name : undefined\n\t\t\t};\n\t\t\tconst privateProfile: WithContext<Person> = {\n\t\t\t\t\"@context\": \"https://schema.org\",\n\t\t\t\t\"@type\": \"Person\",\n\t\t\t\tgivenName: params.givenName,\n\t\t\t\tfamilyName: params.familyName,\n\t\t\t\temail: paramsEmail\n\t\t\t};\n\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.storingProfile\"));\n\t\t\tawait identityProfileConnector.update(\n\t\t\t\texistingUser.userIdentity,\n\t\t\t\tpublicProfile,\n\t\t\t\tprivateProfile\n\t\t\t);\n\n\t\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.user-update.labels.userUpdated\"));\n\n\t\t\tCLIDisplay.break();\n\n\t\t\tconst json = {\n\t\t\t\tdid: params.userIdentity ?? existingUser.userIdentity,\n\t\t\t\torganizationDid: params.organizationIdentity ?? existingUser.organizationIdentity,\n\t\t\t\temail: paramsEmail,\n\t\t\t\tscope: Is.stringValue(params.scope)\n\t\t\t\t\t? ScopeHelper.toArray(params.scope)\n\t\t\t\t\t: existingUser.scope,\n\t\t\t\tgivenName: params.givenName ?? \"\",\n\t\t\t\tfamilyName: params.familyName ?? \"\"\n\t\t\t};\n\n\t\t\tCLIDisplay.done();\n\n\t\t\treturn json;\n\t\t}\n\t);\n\n\treturn returnJson;\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 * Controls how unrecognised TWIN_* environment variables are handled at startup.\n\t * \"error\" (default): throws a startup error, allowing CI and production deployments\n\t * to hard-fail on misconfigured or misspelled variable names.\n\t * \"warn\": logs a warning and continues.\n\t * \"ignore\": skips validation entirely.\n\t * Any other value is rejected at startup.\n\t * @default \"error\"\n\t */\n\tstrictEnv?: string;\n\n\t/**\n\t * Comma-separated list of raw environment variable names to exempt from the unknown-key check.\n\t * Use this to allowlist variables introduced by custom extensions that are not part of the\n\t * core interface, e.g. TWIN_MY_EXTENSION_SECRET.\n\t */\n\tenvAllowList?: 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 * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * Enable schema migration, defaults to true.\n\t */\n\tschemaMigrationEnabled?: 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 in milliseconds.\n\t */\n\tawsDynamodbConnectionTimeout?: 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\tgcpFirestoreEndpoint?: 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 * ScyllaDB connection pool: number of connections per local host.\n\t */\n\tscylladbPoolCoreConnectionsPerHost?: string;\n\n\t/**\n\t * ScyllaDB connection pool: maximum requests per connection.\n\t */\n\tscylladbPoolMaxRequestsPerConnection?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: string;\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 * MySQL connection pool: maximum number of connections.\n\t */\n\tmySqlPoolConnectionLimit?: string;\n\n\t/**\n\t * MySQL connection pool: maximum number of idle connections.\n\t */\n\tmySqlPoolMaxIdle?: string;\n\n\t/**\n\t * MySQL connection pool: milliseconds before an idle connection is removed.\n\t */\n\tmySqlPoolIdleTimeout?: string;\n\n\t/**\n\t * MySQL connection pool: enable TCP keep-alive.\n\t */\n\tmySqlPoolEnableKeepAlive?: string;\n\n\t/**\n\t * MySQL connection pool: wait for a connection when pool is full.\n\t */\n\tmySqlPoolWaitForConnections?: string;\n\n\t/**\n\t * MySQL connection pool: maximum queued requests (0 = unlimited).\n\t */\n\tmySqlPoolQueueLimit?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: string;\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 * MongoDB connection pool: maximum number of connections.\n\t */\n\tmongoDbPoolMaxPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: minimum number of connections to maintain.\n\t */\n\tmongoDbPoolMinPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds a connection can remain idle before removal.\n\t */\n\tmongoDbPoolMaxIdleTime?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds to wait for a connection before throwing.\n\t */\n\tmongoDbPoolWaitQueueTimeout?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: string;\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 * PostgreSQL connection pool: maximum number of connections.\n\t */\n\tpostgreSqlPoolMax?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds a connection can remain idle before being closed.\n\t */\n\tpostgreSqlPoolIdleTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds to wait when establishing a connection.\n\t */\n\tpostgreSqlPoolConnectTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: maximum seconds a connection can remain open.\n\t */\n\tpostgreSqlPoolMaxLifetime?: 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 * 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, open-telemetry, file.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The batch size for the logging task, set to 1 for no batching.\n\t */\n\tloggingBatchSize?: string;\n\n\t/**\n\t * The batch flush interval in seconds for the logging task, how often to flush the logs when using batching, defaults to 5 seconds.\n\t */\n\tloggingBatchFlushInterval?: string;\n\n\t/**\n\t * Delete log entries older than this many minutes for the entity-storage logging connector.\n\t * Set to 0 to disable age-based retention.\n\t * @default 2880 (2 days)\n\t */\n\tloggingRetainFor?: string;\n\n\t/**\n\t * Keep at most this many log entries for the entity-storage logging connector.\n\t * Set to 0 to disable count-based retention.\n\t * @default 10000\n\t */\n\tloggingMaxEntries?: string;\n\n\t/**\n\t * How often the retention cleanup task runs in minutes for the entity-storage logging connector.\n\t * Set to 0 to disable periodic cleanup.\n\t * @default 5\n\t */\n\tloggingRetentionInterval?: string;\n\n\t/**\n\t * Maximum number of entries deleted per cleanup batch for the entity-storage logging connector.\n\t * Keeping this value smaller helps avoid spikes in database load.\n\t * @default 1000\n\t */\n\tloggingRetentionBatchSize?: string;\n\n\t/**\n\t * A list of components to exclude from logging, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\tloggingSilentComponents?: string;\n\n\t/**\n\t * The directory to write log files into when using the file logging connector. Required when TWIN_LOGGING_CONNECTOR includes \"file\".\n\t */\n\tloggingFileDirectory?: string;\n\n\t/**\n\t * The log filename when using the file logging connector, defaults to \"app.log\".\n\t */\n\tloggingFileFilename?: string;\n\n\t/**\n\t * The maximum log file size in bytes before rotation when using the file logging connector, defaults to 10485760 (10 MB). Set to 0 or negative to disable rotation.\n\t */\n\tloggingFileMaxFileSizeBytes?: string;\n\n\t/**\n\t * The number of rotated log files to retain when using the file logging connector, defaults to 5. Set to 0 or negative to keep all rotated files.\n\t */\n\tloggingFileMaxRetainedFiles?: string;\n\n\t/**\n\t * The name of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to twin-logging.\n\t */\n\topenTelemetryLoggingLoggerName?: string;\n\n\t/**\n\t * The version of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to 1.0.0.\n\t */\n\topenTelemetryLoggingLoggerVersion?: string;\n\n\t/**\n\t * The OTLP endpoint URL for the OpenTelemetry logging exporter, required when using open-telemetry as logging connector, e.g. http://localhost:4318/v1/logs.\n\t */\n\topenTelemetryLoggingPrometheusEndpoint?: string;\n\n\t/**\n\t * The log record processor to use for the OpenTelemetry logging exporter, either batch or simple, defaults to batch.\n\t */\n\topenTelemetryLoggingProcessor?: 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\ttelemetryMetricsCollectorInterval?: 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 mutex timeout in milliseconds for the telemetry connector.\n\t */\n\ttelemetryMutexTimeout?: string;\n\n\t/**\n\t * The type of tracing connector: entity-storage, open-telemetry.\n\t */\n\ttracingConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry tracer to use, only required if using open-telemetry as tracing connector, defaults to twin-node.\n\t */\n\topenTelemetryTracingTracerName?: string;\n\n\t/**\n\t * The version of the Open Telemetry tracing specification to use, only required if using open-telemetry as tracing connector, defaults to 1.0.0.\n\t */\n\topenTelemetryTracingTracerVersion?: string;\n\n\t/**\n\t * The OTLP HTTP endpoint to push spans to, e.g. http://localhost:4318/v1/traces. Required when using open-telemetry as tracing connector.\n\t */\n\topenTelemetryTracingEndpoint?: string;\n\n\t/**\n\t * The span processor: batch (default) or simple. Only used when TWIN_TRACING_CONNECTOR=open-telemetry.\n\t */\n\topenTelemetryTracingProcessor?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the tracing connector.\n\t */\n\ttracingMutexTimeout?: 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 NFT deployed package id, for custom deployments.\n\t */\n\tnftPackageId?: 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 TTL in milliseconds for caching resolved DIDs when using the IOTA identity connector. Omit to use the connector default.\n\t */\n\tidentityDidResolutionCacheTtl?: string;\n\n\t/**\n\t * The maximum number of DID documents to hold in the resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheCapacity?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the DID resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheMutexTimeout?: 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 * 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 gas budget, in nanos.\n\t */\n\tiotaGasBudget?: string;\n\n\t/**\n\t * IOTA gas reservation duration, in seconds.\n\t */\n\tiotaGasReservationDuration?: 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 * The IOTA Identity deployed package id, for custom deployments.\n\t */\n\tiotaIdentityPackageId?: 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 number of times to retry a proof task when it fails, 0 to disable retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryCount?: string;\n\n\t/**\n\t * The interval in seconds to wait between proof task retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryInterval?: string;\n\n\t/**\n\t * The time in minutes to retain the record of a failed proof task.\n\t * Set to -1 to retain failures forever.\n\t * @default 10080\n\t */\n\timmutableProofTaskFailureRetainFor?: string;\n\n\t/**\n\t * How often in minutes the immutable proof reconciliation sweep runs.\n\t * @default 30\n\t */\n\timmutableProofSweepInterval?: string;\n\n\t/**\n\t * The minimum age in minutes before a proof with no notarization is considered stuck.\n\t * @default 180\n\t */\n\timmutableProofSweepStaleThreshold?: string;\n\n\t/**\n\t * The number of sweep attempts made before a proof is parked.\n\t * @default 5\n\t */\n\timmutableProofSweepMaxAttempts?: string;\n\n\t/**\n\t * The maximum number of proofs to re-enqueue per tenant per sweep cycle.\n\t * @default 10\n\t */\n\timmutableProofSweepBatchLimit?: string;\n\n\t/**\n\t * The minimum time in minutes between sweep attempts for the same proof.\n\t * @default 60\n\t */\n\timmutableProofSweepBackoff?: string;\n\n\t/**\n\t * ISO 8601 date-time used to treat older missing-task proofs as retryable.\n\t */\n\timmutableProofSweepAssumeRetryableBefore?: 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 * Enable the task scheduler regardless of which other components are active, defaults to false.\n\t */\n\ttaskSchedulerEnabled?: 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 * Enable the federated catalogue, defaults to false, automatically enabled if remote endpoint, filters or dataspace is enabled.\n\t */\n\tfederatedCatalogueEnabled?: 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 * Federated catalog remote endpoint, if set will use a REST client instead of local service.\n\t */\n\tfederatedCatalogueRemoteEndpoint?: string;\n\n\t/**\n\t * The path prefix used by the federated catalogue REST client when forwarding requests to the remote endpoint, defaults to \"federated-catalogue\".\n\t */\n\tfederatedCatalogueRestClientPathPrefix?: 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 in seconds.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtl?: string;\n\n\t/**\n\t * The allow lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesAllow?: string;\n\n\t/**\n\t * The deny lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesDeny?: 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 seconds, set to -1 to keep forever.\n\t * @default 600\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval in seconds for cleaning up the activity logs.\n\t * @default 3600\n\t */\n\tdataspaceActivityLogsCleanupInterval?: string;\n\n\t/**\n\t * The TTL in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheTtl?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheMutexTimeout?: string;\n\n\t/**\n\t * The number of times to retry failed data plane tasks.\n\t */\n\tdataspaceRetryCount?: string;\n\n\t/**\n\t * Maximum HTTP retry attempts per push delivery task execution.\n\t */\n\tdataspacePushRetryCount?: string;\n\n\t/**\n\t * Base delay in milliseconds for exponential backoff between push HTTP retries.\n\t */\n\tdataspacePushRetryBaseDelay?: string;\n\n\t/**\n\t * Timeout in milliseconds for each push delivery HTTP POST request.\n\t */\n\tdataspacePushTimeout?: string;\n\n\t/**\n\t * Interval in milliseconds between orphaned push subscription cleanup scans.\n\t */\n\tdataspacePushSubscriptionCleanupInterval?: string;\n\n\t/**\n\t * Base route path for the data plane service (path only, not full URL).\n\t * Combined with the public origin to form the `dataAddress.endpoint` sent to PULL consumers\n\t * and the inbox URL sent to PUSH providers.\n\t *\n\t * This must be the mount-point prefix of the data plane routes, NOT a specific route path.\n\t * Do NOT append sub-paths such as `/entities` or `/inbox` - those are appended automatically\n\t * by each transfer handler and by the data plane REST client.\n\t *\n\t * REQUIRED if PULL or PUSH transfers are supported.\n\t * If not specified, PULL and PUSH transfers will not be available.\n\t *\n\t * Example: \"dataspace\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Whether the provider immediately starts a transfer once it has been requested.\n\t * When false the transfer stays in REQUESTED until the provider explicitly calls transferStarted.\n\t * @default false\n\t */\n\tdataspaceAutoStartTransfers?: string;\n\n\t/**\n\t * How long in seconds a negotiation may sit without progress before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledNegotiationTimeout?: string;\n\n\t/**\n\t * How long in seconds a consumer-initiated transfer may sit in REQUESTED without the provider\n\t * progressing it before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledTransferTimeout?: string;\n\n\t/**\n\t * How long in seconds a provider transfer may stay idle before the idle policy marks it as stalled.\n\t */\n\tdataspaceProviderTransferIdleTimeout?: string;\n\n\t/**\n\t * How frequently in seconds the provider idle transfer policy sweep runs.\n\t */\n\tdataspaceProviderTransferPolicySweepInterval?: string;\n\n\t/**\n\t * Path under which the dataspace control plane is mounted (path only, not full URL).\n\t * This must match the control-plane REST mount, as it is combined with the public\n\t * origin to build the consumer's advertised callback address.\n\t * @default \"dataspace-control-plane\"\n\t */\n\tdataspaceCallbackPath?: 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\thealthInterval?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks at startup, defaults to 2.\n\t * This allows components that take a long time to initialize to be healthy before the first health check is performed.\n\t */\n\thealthStartupInterval?: string;\n\n\t/**\n\t * The interval in seconds for running the application health lifecycle (init, application, teardown), defaults to 300.\n\t */\n\thealthApplicationInterval?: 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 * The default mutex timeout in milliseconds, used when no component-specific timeout is set, defaults to 5000 if omitted.\n\t */\n\tmutexTimeoutDefault?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item graph component.\n\t */\n\tauditableItemGraphMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item stream component.\n\t */\n\tauditableItemStreamMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the federated catalogue component.\n\t */\n\tfederatedCatalogueMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the document management component.\n\t */\n\tdocumentManagementMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the logging component.\n\t */\n\tloggingMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the memory and file entity storage connectors.\n\t */\n\tentityStorageMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the rights management component.\n\t */\n\trightsManagementMutexTimeout?: 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 * Controls how unrecognised TWIN_* environment variables are handled at startup.\n\t * \"error\" (default): throws a startup error, allowing CI and production deployments\n\t * to hard-fail on misconfigured or misspelled variable names.\n\t * \"warn\": logs a warning and continues.\n\t * \"ignore\": skips validation entirely.\n\t * Any other value is rejected at startup.\n\t * @default \"error\"\n\t */\n\tstrictEnv?: string;\n\n\t/**\n\t * Comma-separated list of raw environment variable names to exempt from the unknown-key check.\n\t * Use this to allowlist variables introduced by custom extensions that are not part of the\n\t * core interface, e.g. TWIN_MY_EXTENSION_SECRET.\n\t */\n\tenvAllowList?: 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 * Is multi-tenant support enabled, defaults to false.\n\t */\n\ttenantEnabled?: string;\n\n\t/**\n\t * Enable schema migration, defaults to true.\n\t */\n\tschemaMigrationEnabled?: 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 in milliseconds.\n\t */\n\tawsDynamodbConnectionTimeout?: 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\tgcpFirestoreEndpoint?: 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 * ScyllaDB connection pool: number of connections per local host.\n\t */\n\tscylladbPoolCoreConnectionsPerHost?: string;\n\n\t/**\n\t * ScyllaDB connection pool: maximum requests per connection.\n\t */\n\tscylladbPoolMaxRequestsPerConnection?: string;\n\n\t/**\n\t * MySQL host.\n\t */\n\tmySqlHost?: string;\n\n\t/**\n\t * MySQL port.\n\t */\n\tmySqlPort?: string;\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 * MySQL connection pool: maximum number of connections.\n\t */\n\tmySqlPoolConnectionLimit?: string;\n\n\t/**\n\t * MySQL connection pool: maximum number of idle connections.\n\t */\n\tmySqlPoolMaxIdle?: string;\n\n\t/**\n\t * MySQL connection pool: milliseconds before an idle connection is removed.\n\t */\n\tmySqlPoolIdleTimeout?: string;\n\n\t/**\n\t * MySQL connection pool: enable TCP keep-alive.\n\t */\n\tmySqlPoolEnableKeepAlive?: string;\n\n\t/**\n\t * MySQL connection pool: wait for a connection when pool is full.\n\t */\n\tmySqlPoolWaitForConnections?: string;\n\n\t/**\n\t * MySQL connection pool: maximum queued requests (0 = unlimited).\n\t */\n\tmySqlPoolQueueLimit?: string;\n\n\t/**\n\t * MongoDB host.\n\t */\n\tmongoDbHost?: string;\n\n\t/**\n\t * MongoDB port.\n\t */\n\tmongoDbPort?: string;\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 * MongoDB connection pool: maximum number of connections.\n\t */\n\tmongoDbPoolMaxPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: minimum number of connections to maintain.\n\t */\n\tmongoDbPoolMinPoolSize?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds a connection can remain idle before removal.\n\t */\n\tmongoDbPoolMaxIdleTime?: string;\n\n\t/**\n\t * MongoDB connection pool: milliseconds to wait for a connection before throwing.\n\t */\n\tmongoDbPoolWaitQueueTimeout?: string;\n\n\t/**\n\t * PostgreSQl host.\n\t */\n\tpostgreSqlHost?: string;\n\n\t/**\n\t * PostgreSQl port.\n\t */\n\tpostgreSqlPort?: string;\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 * PostgreSQL connection pool: maximum number of connections.\n\t */\n\tpostgreSqlPoolMax?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds a connection can remain idle before being closed.\n\t */\n\tpostgreSqlPoolIdleTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: seconds to wait when establishing a connection.\n\t */\n\tpostgreSqlPoolConnectTimeout?: string;\n\n\t/**\n\t * PostgreSQL connection pool: maximum seconds a connection can remain open.\n\t */\n\tpostgreSqlPoolMaxLifetime?: 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 * 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, open-telemetry, file.\n\t */\n\tloggingConnector?: string;\n\n\t/**\n\t * The batch size for the logging task, set to 1 for no batching.\n\t */\n\tloggingBatchSize?: string;\n\n\t/**\n\t * The batch flush interval in seconds for the logging task, how often to flush the logs when using batching, defaults to 5 seconds.\n\t */\n\tloggingBatchFlushInterval?: string;\n\n\t/**\n\t * Delete log entries older than this many minutes for the entity-storage logging connector.\n\t * Set to 0 to disable age-based retention.\n\t * @default 2880 (2 days)\n\t */\n\tloggingRetainFor?: string;\n\n\t/**\n\t * Keep at most this many log entries for the entity-storage logging connector.\n\t * Set to 0 to disable count-based retention.\n\t * @default 10000\n\t */\n\tloggingMaxEntries?: string;\n\n\t/**\n\t * How often the retention cleanup task runs in minutes for the entity-storage logging connector.\n\t * Set to 0 to disable periodic cleanup.\n\t * @default 5\n\t */\n\tloggingRetentionInterval?: string;\n\n\t/**\n\t * Maximum number of entries deleted per cleanup batch for the entity-storage logging connector.\n\t * Keeping this value smaller helps avoid spikes in database load.\n\t * @default 1000\n\t */\n\tloggingRetentionBatchSize?: string;\n\n\t/**\n\t * A list of components to exclude from logging, can be a comma separated list of component Class names e.g. \"ComponentA,ComponentB\".\n\t */\n\tloggingSilentComponents?: string;\n\n\t/**\n\t * The directory to write log files into when using the file logging connector. Required when TWIN_LOGGING_CONNECTOR includes \"file\".\n\t */\n\tloggingFileDirectory?: string;\n\n\t/**\n\t * The log filename when using the file logging connector, defaults to \"app.log\".\n\t */\n\tloggingFileFilename?: string;\n\n\t/**\n\t * The maximum log file size in bytes before rotation when using the file logging connector, defaults to 10485760 (10 MB). Set to 0 or negative to disable rotation.\n\t */\n\tloggingFileMaxFileSizeBytes?: string;\n\n\t/**\n\t * The number of rotated log files to retain when using the file logging connector, defaults to 5. Set to 0 or negative to keep all rotated files.\n\t */\n\tloggingFileMaxRetainedFiles?: string;\n\n\t/**\n\t * The name of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to twin-logging.\n\t */\n\topenTelemetryLoggingLoggerName?: string;\n\n\t/**\n\t * The version of the OpenTelemetry logger, only required if using open-telemetry as logging connector, defaults to 1.0.0.\n\t */\n\topenTelemetryLoggingLoggerVersion?: string;\n\n\t/**\n\t * The OTLP endpoint URL for the OpenTelemetry logging exporter, required when using open-telemetry as logging connector, e.g. http://localhost:4318/v1/logs.\n\t */\n\topenTelemetryLoggingPrometheusEndpoint?: string;\n\n\t/**\n\t * The log record processor to use for the OpenTelemetry logging exporter, either batch or simple, defaults to batch.\n\t */\n\topenTelemetryLoggingProcessor?: 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\ttelemetryMetricsCollectorInterval?: 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 mutex timeout in milliseconds for the telemetry connector.\n\t */\n\ttelemetryMutexTimeout?: string;\n\n\t/**\n\t * The type of tracing connector: entity-storage, open-telemetry.\n\t */\n\ttracingConnector?: string;\n\n\t/**\n\t * The name of the Open Telemetry tracer to use, only required if using open-telemetry as tracing connector, defaults to twin-node.\n\t */\n\topenTelemetryTracingTracerName?: string;\n\n\t/**\n\t * The version of the Open Telemetry tracing specification to use, only required if using open-telemetry as tracing connector, defaults to 1.0.0.\n\t */\n\topenTelemetryTracingTracerVersion?: string;\n\n\t/**\n\t * The OTLP HTTP endpoint to push spans to, e.g. http://localhost:4318/v1/traces. Required when using open-telemetry as tracing connector.\n\t */\n\topenTelemetryTracingEndpoint?: string;\n\n\t/**\n\t * The span processor: batch (default) or simple. Only used when TWIN_TRACING_CONNECTOR=open-telemetry.\n\t */\n\topenTelemetryTracingProcessor?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the tracing connector.\n\t */\n\ttracingMutexTimeout?: 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 NFT deployed package id, for custom deployments.\n\t */\n\tnftPackageId?: 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 TTL in milliseconds for caching resolved DIDs when using the IOTA identity connector. Omit to use the connector default.\n\t */\n\tidentityDidResolutionCacheTtl?: string;\n\n\t/**\n\t * The maximum number of DID documents to hold in the resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheCapacity?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the DID resolution cache. Only used when using the IOTA identity connector and caching is enabled.\n\t */\n\tidentityDidResolutionCacheMutexTimeout?: string;\n\n\t/**\n\t * The number of times to retry resolving a DID after a write operation (create, update, or delete) to confirm propagation. Only used when using the IOTA identity connector.\n\t */\n\tidentityDidResolutionRetries?: string;\n\n\t/**\n\t * The delay in milliseconds between DID resolution retries after a write operation. Only used when using the IOTA identity connector.\n\t */\n\tidentityDidResolutionRetryDelay?: 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 * 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 gas budget, in nanos.\n\t */\n\tiotaGasBudget?: string;\n\n\t/**\n\t * IOTA gas reservation duration, in seconds.\n\t */\n\tiotaGasReservationDuration?: 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 * The IOTA Identity deployed package id, for custom deployments.\n\t */\n\tiotaIdentityPackageId?: 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 number of times to retry a proof task when it fails, 0 to disable retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryCount?: string;\n\n\t/**\n\t * The interval in seconds to wait between proof task retries.\n\t * @default 5\n\t */\n\timmutableProofTaskRetryInterval?: string;\n\n\t/**\n\t * The time in minutes to retain the record of a failed proof task.\n\t * Set to -1 to retain failures forever.\n\t * @default 10080\n\t */\n\timmutableProofTaskFailureRetainFor?: string;\n\n\t/**\n\t * How often in minutes the immutable proof reconciliation sweep runs.\n\t * @default 30\n\t */\n\timmutableProofSweepInterval?: string;\n\n\t/**\n\t * The minimum age in minutes before a proof with no notarization is considered stuck.\n\t * @default 180\n\t */\n\timmutableProofSweepStaleThreshold?: string;\n\n\t/**\n\t * The number of sweep attempts made before a proof is parked.\n\t * @default 5\n\t */\n\timmutableProofSweepMaxAttempts?: string;\n\n\t/**\n\t * The maximum number of proofs to re-enqueue per tenant per sweep cycle.\n\t * @default 10\n\t */\n\timmutableProofSweepBatchLimit?: string;\n\n\t/**\n\t * The minimum time in minutes between sweep attempts for the same proof.\n\t * @default 60\n\t */\n\timmutableProofSweepBackoff?: string;\n\n\t/**\n\t * ISO 8601 date-time used to treat older missing-task proofs as retryable.\n\t */\n\timmutableProofSweepAssumeRetryableBefore?: 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 * Enable the task scheduler regardless of which other components are active, defaults to false.\n\t */\n\ttaskSchedulerEnabled?: 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 * Enable the federated catalogue, defaults to false, automatically enabled if remote endpoint, filters or dataspace is enabled.\n\t */\n\tfederatedCatalogueEnabled?: 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 * Federated catalog remote endpoint, if set will use a REST client instead of local service.\n\t */\n\tfederatedCatalogueRemoteEndpoint?: string;\n\n\t/**\n\t * The path prefix used by the federated catalogue REST client when forwarding requests to the remote endpoint, defaults to \"federated-catalogue\".\n\t */\n\tfederatedCatalogueRestClientPathPrefix?: 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 in seconds.\n\t * Defaults to undefined for never expiring.\n\t */\n\ttrustJwtTtl?: string;\n\n\t/**\n\t * The allow lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesAllow?: string;\n\n\t/**\n\t * The deny lists for the trust identity verifier, comma separated list of identities.\n\t */\n\ttrustIdentitiesDeny?: 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 seconds, set to -1 to keep forever.\n\t * @default 600\n\t */\n\tdataspaceRetainActivityLogsFor?: string;\n\n\t/**\n\t * The interval in seconds for cleaning up the activity logs.\n\t * @default 3600\n\t */\n\tdataspaceActivityLogsCleanupInterval?: string;\n\n\t/**\n\t * The TTL in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheTtl?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the dataspace agreement cache.\n\t */\n\tdataspaceAgreementCacheMutexTimeout?: string;\n\n\t/**\n\t * The time in milliseconds after which an unused agreement is eligible for removal.\n\t */\n\tdataspaceAgreementUnusedThreshold?: string;\n\n\t/**\n\t * The interval in milliseconds between agreement sweep runs.\n\t */\n\tdataspaceAgreementSweepInterval?: string;\n\n\t/**\n\t * The number of times to retry failed data plane tasks.\n\t */\n\tdataspaceRetryCount?: string;\n\n\t/**\n\t * Maximum HTTP retry attempts per push delivery task execution.\n\t */\n\tdataspacePushRetryCount?: string;\n\n\t/**\n\t * Base delay in milliseconds for exponential backoff between push HTTP retries.\n\t */\n\tdataspacePushRetryBaseDelay?: string;\n\n\t/**\n\t * Timeout in milliseconds for each push delivery HTTP POST request.\n\t */\n\tdataspacePushTimeout?: string;\n\n\t/**\n\t * Interval in milliseconds between orphaned push subscription cleanup scans.\n\t */\n\tdataspacePushSubscriptionCleanupInterval?: string;\n\n\t/**\n\t * Base route path for the data plane service (path only, not full URL).\n\t * Combined with the public origin to form the `dataAddress.endpoint` sent to PULL consumers\n\t * and the inbox URL sent to PUSH providers.\n\t *\n\t * This must be the mount-point prefix of the data plane routes, NOT a specific route path.\n\t * Do NOT append sub-paths such as `/entities` or `/inbox` - those are appended automatically\n\t * by each transfer handler and by the data plane REST client.\n\t *\n\t * REQUIRED if PULL or PUSH transfers are supported.\n\t * If not specified, PULL and PUSH transfers will not be available.\n\t *\n\t * Example: \"dataspace\"\n\t */\n\tdataspaceDataPlanePath?: string;\n\n\t/**\n\t * Whether the provider immediately starts a transfer once it has been requested.\n\t * When false the transfer stays in REQUESTED until the provider explicitly calls transferStarted.\n\t * @default false\n\t */\n\tdataspaceAutoStartTransfers?: string;\n\n\t/**\n\t * How long in seconds a negotiation may sit without progress before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledNegotiationTimeout?: string;\n\n\t/**\n\t * How long in seconds a consumer-initiated transfer may sit in REQUESTED without the provider\n\t * progressing it before it is treated as timed out.\n\t * @default 30\n\t */\n\tdataspaceStalledTransferTimeout?: string;\n\n\t/**\n\t * How long in seconds a provider transfer may stay idle before the idle policy marks it as stalled.\n\t */\n\tdataspaceProviderTransferIdleTimeout?: string;\n\n\t/**\n\t * How frequently in seconds the provider idle transfer policy sweep runs.\n\t */\n\tdataspaceProviderTransferPolicySweepInterval?: string;\n\n\t/**\n\t * Path under which the dataspace control plane is mounted (path only, not full URL).\n\t * This must match the control-plane REST mount, as it is combined with the public\n\t * origin to build the consumer's advertised callback address.\n\t * @default \"dataspace-control-plane\"\n\t */\n\tdataspaceCallbackPath?: 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\thealthInterval?: string;\n\n\t/**\n\t * The interval in seconds for performing health checks at startup, defaults to 2.\n\t * This allows components that take a long time to initialize to be healthy before the first health check is performed.\n\t */\n\thealthStartupInterval?: string;\n\n\t/**\n\t * The interval in seconds for running the application health lifecycle (init, application, teardown), defaults to 300.\n\t */\n\thealthApplicationInterval?: 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 * The default mutex timeout in milliseconds, used when no component-specific timeout is set, defaults to 5000 if omitted.\n\t */\n\tmutexTimeoutDefault?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item graph component.\n\t */\n\tauditableItemGraphMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the auditable item stream component.\n\t */\n\tauditableItemStreamMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the federated catalogue component.\n\t */\n\tfederatedCatalogueMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the document management component.\n\t */\n\tdocumentManagementMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the logging component.\n\t */\n\tloggingMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the memory and file entity storage connectors.\n\t */\n\tentityStorageMutexTimeout?: string;\n\n\t/**\n\t * The mutex timeout in milliseconds for the rights management component.\n\t */\n\trightsManagementMutexTimeout?: 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineServerEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineServerEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine server environment variables.\n */\nexport interface IEngineServerEnvironmentVariables {\n\t/**\n\t * The port to serve the API from.\n\t */\n\tport?: string;\n\n\t/**\n\t * The host to serve the API from.\n\t */\n\thost?: string;\n\n\t/**\n\t * The CORS origins to allow, defaults to *.\n\t */\n\tcorsOrigins?: string;\n\n\t/**\n\t * The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.\n\t */\n\thttpMethods?: string;\n\n\t/**\n\t * The CORS headers to allow.\n\t */\n\thttpAllowedHeaders?: string;\n\n\t/**\n\t * The CORS headers to expose.\n\t */\n\thttpExposedHeaders?: string;\n\n\t/**\n\t * The public origin URL for the API e.g. https://api.example.com:1234\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The type of auth admin processor to use on the API: entity-storage.\n\t */\n\tauthAdminProcessorType?: string;\n\n\t/**\n\t * The type of auth processor to use on the API: entity-storage.\n\t */\n\tauthProcessorType?: string;\n\n\t/**\n\t * The id of the key in the vault to use for signing in auth operations.\n\t */\n\tauthSigningKeyId?: string;\n\n\t/**\n\t * The HTTP header name used to pass the API key on requests, defaults to x-api-key.\n\t */\n\tauthApiKeyHeader?: string;\n\n\t/**\n\t * Additional MIME type processors to include, comma separated.\n\t */\n\tmimeTypeProcessors?: string;\n\n\t/**\n\t * Include the body in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingIncludeBody?: string;\n\n\t/**\n\t * Include the full base 64 output in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingFullBase64?: string;\n\n\t/**\n\t * List of properties to obfuscate in the REST logging output, comma separated.\n\t */\n\trouteLoggingObfuscateProperties?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IEngineServerEnvironmentVariables.js","sourceRoot":"","sources":["../../../src/models/IEngineServerEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The engine server environment variables.\n */\nexport interface IEngineServerEnvironmentVariables {\n\t/**\n\t * The port to serve the API from.\n\t */\n\tport?: string;\n\n\t/**\n\t * The host to serve the API from.\n\t */\n\thost?: string;\n\n\t/**\n\t * The CORS origins to allow, defaults to *.\n\t */\n\tcorsOrigins?: string;\n\n\t/**\n\t * The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.\n\t */\n\thttpMethods?: string;\n\n\t/**\n\t * The CORS headers to allow.\n\t */\n\thttpAllowedHeaders?: string;\n\n\t/**\n\t * The CORS headers to expose.\n\t */\n\thttpExposedHeaders?: string;\n\n\t/**\n\t * The public origin URL for the API e.g. https://api.example.com:1234\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The type of auth admin processor to use on the API: entity-storage.\n\t */\n\tauthAdminProcessorType?: string;\n\n\t/**\n\t * The type of auth processor to use on the API: entity-storage.\n\t */\n\tauthProcessorType?: string;\n\n\t/**\n\t * The id of the key in the vault to use for signing in auth operations.\n\t */\n\tauthSigningKeyId?: string;\n\n\t/**\n\t * The HTTP header name used to pass the API key on requests, defaults to x-api-key.\n\t */\n\tauthApiKeyHeader?: string;\n\n\t/**\n\t * Additional MIME type processors to include, comma separated.\n\t */\n\tmimeTypeProcessors?: string;\n\n\t/**\n\t * Include the body in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingIncludeBody?: string;\n\n\t/**\n\t * Include the full base 64 output in the REST logging output, useful for debugging.\n\t */\n\trouteLoggingFullBase64?: string;\n\n\t/**\n\t * List of properties to obfuscate in the REST logging output, comma separated.\n\t */\n\trouteLoggingObfuscateProperties?: string;\n\n\t/**\n\t * Comma-separated list of URL path prefixes excluded from metrics collection.\n\t */\n\trouteMetricsExcludePaths?: string;\n}\n"]}
|
|
@@ -168,6 +168,8 @@ const engineEnvironmentVariableKeysInternal = {
|
|
|
168
168
|
identityDidResolutionCacheTtl: true,
|
|
169
169
|
identityDidResolutionCacheCapacity: true,
|
|
170
170
|
identityDidResolutionCacheMutexTimeout: true,
|
|
171
|
+
identityDidResolutionRetries: true,
|
|
172
|
+
identityDidResolutionRetryDelay: true,
|
|
171
173
|
identityResolverConnector: true,
|
|
172
174
|
identityProfileConnector: true,
|
|
173
175
|
universalResolverEndpoint: true,
|
|
@@ -236,6 +238,8 @@ const engineEnvironmentVariableKeysInternal = {
|
|
|
236
238
|
dataspaceActivityLogsCleanupInterval: true,
|
|
237
239
|
dataspaceAgreementCacheTtl: true,
|
|
238
240
|
dataspaceAgreementCacheMutexTimeout: true,
|
|
241
|
+
dataspaceAgreementUnusedThreshold: true,
|
|
242
|
+
dataspaceAgreementSweepInterval: true,
|
|
239
243
|
dataspaceRetryCount: true,
|
|
240
244
|
dataspacePushRetryCount: true,
|
|
241
245
|
dataspacePushRetryBaseDelay: true,
|