@twin.org/node-core 0.0.3-next.52 → 0.0.3-next.54

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.
Files changed (72) hide show
  1. package/dist/es/builders/engineEnvBuilder.js +20 -39
  2. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  3. package/dist/es/builders/engineServerEnvBuilder.js +42 -30
  4. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  5. package/dist/es/cli.js +6 -2
  6. package/dist/es/cli.js.map +1 -1
  7. package/dist/es/commands/bootstrapLegacy.js +204 -102
  8. package/dist/es/commands/bootstrapLegacy.js.map +1 -1
  9. package/dist/es/commands/identityCreate.js +52 -3
  10. package/dist/es/commands/identityCreate.js.map +1 -1
  11. package/dist/es/commands/identityImports.js +1 -0
  12. package/dist/es/commands/identityImports.js.map +1 -1
  13. package/dist/es/commands/identityVerifiableCredentialCreate.js +1 -0
  14. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -1
  15. package/dist/es/commands/identityVerificationMethodCreate.js +14 -11
  16. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -1
  17. package/dist/es/commands/identityVerificationMethodImport.js +1 -0
  18. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -1
  19. package/dist/es/commands/nodeSetIdentity.js +5 -0
  20. package/dist/es/commands/nodeSetIdentity.js.map +1 -1
  21. package/dist/es/commands/removeTenantOrgAlias.js +81 -0
  22. package/dist/es/commands/removeTenantOrgAlias.js.map +1 -0
  23. package/dist/es/commands/setNodeOrgId.js +60 -0
  24. package/dist/es/commands/setNodeOrgId.js.map +1 -0
  25. package/dist/es/commands/setTenantOrgId.js +158 -0
  26. package/dist/es/commands/setTenantOrgId.js.map +1 -0
  27. package/dist/es/commands/tenantCreate.js +41 -7
  28. package/dist/es/commands/tenantCreate.js.map +1 -1
  29. package/dist/es/commands/vaultKeyCreate.js +1 -0
  30. package/dist/es/commands/vaultKeyCreate.js.map +1 -1
  31. package/dist/es/commands/vaultKeyImport.js +1 -0
  32. package/dist/es/commands/vaultKeyImport.js.map +1 -1
  33. package/dist/es/defaults.js +1 -3
  34. package/dist/es/defaults.js.map +1 -1
  35. package/dist/es/models/ICliCommandDefinition.js.map +1 -1
  36. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  37. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  38. package/dist/es/models/INodeEngineState.js.map +1 -1
  39. package/dist/es/node.js +2 -2
  40. package/dist/es/node.js.map +1 -1
  41. package/dist/es/start.js +76 -14
  42. package/dist/es/start.js.map +1 -1
  43. package/dist/es/utils.js +1 -1
  44. package/dist/es/utils.js.map +1 -1
  45. package/dist/types/builders/engineEnvBuilder.d.ts +2 -13
  46. package/dist/types/commands/bootstrapLegacy.d.ts +7 -7
  47. package/dist/types/commands/identityCreate.d.ts +6 -0
  48. package/dist/types/commands/removeTenantOrgAlias.d.ts +22 -0
  49. package/dist/types/commands/setNodeOrgId.d.ts +22 -0
  50. package/dist/types/commands/setTenantOrgId.d.ts +55 -0
  51. package/dist/types/commands/tenantCreate.d.ts +3 -0
  52. package/dist/types/defaults.d.ts +0 -1
  53. package/dist/types/models/ICliCommandDefinition.d.ts +5 -0
  54. package/dist/types/models/IEngineEnvironmentVariables.d.ts +8 -8
  55. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
  56. package/dist/types/models/INodeEngineState.d.ts +5 -0
  57. package/docs/changelog.md +14 -0
  58. package/docs/reference/functions/buildEngineConfiguration.md +1 -7
  59. package/docs/reference/functions/isRightsManagementRequired.md +1 -1
  60. package/docs/reference/index.md +0 -2
  61. package/docs/reference/interfaces/ICliCommandDefinition.md +14 -0
  62. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +16 -16
  63. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +32 -24
  64. package/docs/reference/interfaces/INodeEngineState.md +9 -0
  65. package/docs/reference/interfaces/INodeEnvironmentVariables.md +36 -24
  66. package/locales/en.json +103 -38
  67. package/package.json +1 -1
  68. package/dist/es/commands/tenantToken.js +0 -97
  69. package/dist/es/commands/tenantToken.js.map +0 -1
  70. package/dist/types/commands/tenantToken.d.ts +0 -28
  71. package/docs/reference/functions/isUrlTransformerRequired.md +0 -20
  72. package/docs/reference/variables/URL_TRANSFORMER_ENCRYPTION_KEY_ID.md +0 -3
@@ -60,18 +60,6 @@ The name of the state file.
60
60
 
61
61
  ***
62
62
 
63
- ### nodeIdentityEnabled? {#nodeidentityenabled}
64
-
65
- > `optional` **nodeIdentityEnabled?**: `string`
66
-
67
- Does the node have a unique ID, defaults to true.
68
-
69
- #### Inherited from
70
-
71
- [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`nodeIdentityEnabled`](IEngineEnvironmentVariables.md#nodeidentityenabled)
72
-
73
- ***
74
-
75
63
  ### tenantEnabled? {#tenantenabled}
76
64
 
77
65
  > `optional` **tenantEnabled?**: `string`
@@ -866,6 +854,18 @@ The batch flush interval in seconds for the logging task, how often to flush the
866
854
 
867
855
  ***
868
856
 
857
+ ### loggingSilentComponents? {#loggingsilentcomponents}
858
+
859
+ > `optional` **loggingSilentComponents?**: `string`
860
+
861
+ A list of components to exclude from logging, can be a comma separated list of component Class names e.g. "ComponentA,ComponentB".
862
+
863
+ #### Inherited from
864
+
865
+ [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`loggingSilentComponents`](IEngineEnvironmentVariables.md#loggingsilentcomponents)
866
+
867
+ ***
868
+
869
869
  ### eventBusConnector? {#eventbusconnector}
870
870
 
871
871
  > `optional` **eventBusConnector?**: `string`
@@ -1394,6 +1394,18 @@ The type of the default data extractor, can be a comma separated list: json-path
1394
1394
 
1395
1395
  ***
1396
1396
 
1397
+ ### taskSchedulerEnabled? {#taskschedulerenabled}
1398
+
1399
+ > `optional` **taskSchedulerEnabled?**: `string`
1400
+
1401
+ Enable the task scheduler regardless of which other components are active, defaults to false.
1402
+
1403
+ #### Inherited from
1404
+
1405
+ [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`taskSchedulerEnabled`](IEngineEnvironmentVariables.md#taskschedulerenabled)
1406
+
1407
+ ***
1408
+
1397
1409
  ### auditableItemGraphEnabled? {#auditableitemgraphenabled}
1398
1410
 
1399
1411
  > `optional` **auditableItemGraphEnabled?**: `string`
@@ -1743,18 +1755,6 @@ This allows components that take a long time to initialize to be healthy before
1743
1755
 
1744
1756
  ***
1745
1757
 
1746
- ### urlTransformerEncryptionKeyId? {#urltransformerencryptionkeyid}
1747
-
1748
- > `optional` **urlTransformerEncryptionKeyId?**: `string`
1749
-
1750
- The id of the key in the vault to use for encrypting parameters in url transformer.
1751
-
1752
- #### Inherited from
1753
-
1754
- [`IEngineEnvironmentVariables`](IEngineEnvironmentVariables.md).[`urlTransformerEncryptionKeyId`](IEngineEnvironmentVariables.md#urltransformerencryptionkeyid)
1755
-
1756
- ***
1757
-
1758
1758
  ### automationActionTypes? {#automationactiontypes}
1759
1759
 
1760
1760
  > `optional` **automationActionTypes?**: `string`
@@ -1860,6 +1860,14 @@ The id of the key in the vault to use for signing in auth operations.
1860
1860
 
1861
1861
  ***
1862
1862
 
1863
+ ### authApiKeyHeader? {#authapikeyheader}
1864
+
1865
+ > `optional` **authApiKeyHeader?**: `string`
1866
+
1867
+ The HTTP header name used to pass the API key on requests, defaults to x-api-key.
1868
+
1869
+ ***
1870
+
1863
1871
  ### hostingParamEncryptionKeyId? {#hostingparamencryptionkeyid}
1864
1872
 
1865
1873
  > `optional` **hostingParamEncryptionKeyId?**: `string`
@@ -13,3 +13,12 @@ The engine state for the node.
13
13
  > `optional` **nodeId?**: `string`
14
14
 
15
15
  The identity for the node.
16
+
17
+ ***
18
+
19
+ ### nodeOrganizationId? {#nodeorganizationid}
20
+
21
+ > `optional` **nodeOrganizationId?**: `string`
22
+
23
+ This is the default organization used in the context ids when a user is not authenticated.
24
+ It is not used in multi-tenant mode, which gets the organization from the tenant table.
@@ -56,18 +56,6 @@ The name of the state file.
56
56
 
57
57
  ***
58
58
 
59
- ### nodeIdentityEnabled? {#nodeidentityenabled}
60
-
61
- > `optional` **nodeIdentityEnabled?**: `string`
62
-
63
- Does the node have a unique ID, defaults to true.
64
-
65
- #### Inherited from
66
-
67
- [`IEngineServerEnvironmentVariables`](IEngineServerEnvironmentVariables.md).[`nodeIdentityEnabled`](IEngineServerEnvironmentVariables.md#nodeidentityenabled)
68
-
69
- ***
70
-
71
59
  ### tenantEnabled? {#tenantenabled}
72
60
 
73
61
  > `optional` **tenantEnabled?**: `string`
@@ -862,6 +850,18 @@ The batch flush interval in seconds for the logging task, how often to flush the
862
850
 
863
851
  ***
864
852
 
853
+ ### loggingSilentComponents? {#loggingsilentcomponents}
854
+
855
+ > `optional` **loggingSilentComponents?**: `string`
856
+
857
+ A list of components to exclude from logging, can be a comma separated list of component Class names e.g. "ComponentA,ComponentB".
858
+
859
+ #### Inherited from
860
+
861
+ [`IEngineServerEnvironmentVariables`](IEngineServerEnvironmentVariables.md).[`loggingSilentComponents`](IEngineServerEnvironmentVariables.md#loggingsilentcomponents)
862
+
863
+ ***
864
+
865
865
  ### eventBusConnector? {#eventbusconnector}
866
866
 
867
867
  > `optional` **eventBusConnector?**: `string`
@@ -1390,6 +1390,18 @@ The type of the default data extractor, can be a comma separated list: json-path
1390
1390
 
1391
1391
  ***
1392
1392
 
1393
+ ### taskSchedulerEnabled? {#taskschedulerenabled}
1394
+
1395
+ > `optional` **taskSchedulerEnabled?**: `string`
1396
+
1397
+ Enable the task scheduler regardless of which other components are active, defaults to false.
1398
+
1399
+ #### Inherited from
1400
+
1401
+ [`IEngineServerEnvironmentVariables`](IEngineServerEnvironmentVariables.md).[`taskSchedulerEnabled`](IEngineServerEnvironmentVariables.md#taskschedulerenabled)
1402
+
1403
+ ***
1404
+
1393
1405
  ### auditableItemGraphEnabled? {#auditableitemgraphenabled}
1394
1406
 
1395
1407
  > `optional` **auditableItemGraphEnabled?**: `string`
@@ -1739,18 +1751,6 @@ This allows components that take a long time to initialize to be healthy before
1739
1751
 
1740
1752
  ***
1741
1753
 
1742
- ### urlTransformerEncryptionKeyId? {#urltransformerencryptionkeyid}
1743
-
1744
- > `optional` **urlTransformerEncryptionKeyId?**: `string`
1745
-
1746
- The id of the key in the vault to use for encrypting parameters in url transformer.
1747
-
1748
- #### Inherited from
1749
-
1750
- [`IEngineServerEnvironmentVariables`](IEngineServerEnvironmentVariables.md).[`urlTransformerEncryptionKeyId`](IEngineServerEnvironmentVariables.md#urltransformerencryptionkeyid)
1751
-
1752
- ***
1753
-
1754
1754
  ### automationActionTypes? {#automationactiontypes}
1755
1755
 
1756
1756
  > `optional` **automationActionTypes?**: `string`
@@ -1896,6 +1896,18 @@ The id of the key in the vault to use for signing in auth operations.
1896
1896
 
1897
1897
  ***
1898
1898
 
1899
+ ### authApiKeyHeader? {#authapikeyheader}
1900
+
1901
+ > `optional` **authApiKeyHeader?**: `string`
1902
+
1903
+ The HTTP header name used to pass the API key on requests, defaults to x-api-key.
1904
+
1905
+ #### Inherited from
1906
+
1907
+ [`IEngineServerEnvironmentVariables`](IEngineServerEnvironmentVariables.md).[`authApiKeyHeader`](IEngineServerEnvironmentVariables.md#authapikeyheader)
1908
+
1909
+ ***
1910
+
1899
1911
  ### hostingParamEncryptionKeyId? {#hostingparamencryptionkeyid}
1900
1912
 
1901
1913
  > `optional` **hostingParamEncryptionKeyId?**: `string`
package/locales/en.json CHANGED
@@ -2,6 +2,8 @@
2
2
  "error": {
3
3
  "node": {
4
4
  "nodeIdentityNotSet": "The node identity is enabled in config but is not set, please set it using the \"node-set-identity\" CLI command.",
5
+ "nodeOrganizationIdNotSet": "The node organization is not set, please set it using the \"set-node-org-id\".",
6
+ "tenantsWithoutOrganizationId": "The following tenants have no organization ID assigned. Use the \"set-tenant-org-id\" command to assign one before starting the node: {tenantIds}",
5
7
  "storageFileRootNotSet": "{storageFileRoot} is not set, the server will not start without it, please set it in the shell or create a .env file",
6
8
  "extensionLoadingError": "Failed to load extension \"{extension}\"",
7
9
  "insecureProtocol": "Cannot load extension from insecure protocol: {protocol}. Only HTTPS is allowed for remote extensions.",
@@ -15,10 +17,13 @@
15
17
  "invalidPublicOrigin": "The public origin \"{publicOrigin}\" is not a valid origin URL, it should be in the format \"protocol://host[:port]\"."
16
18
  },
17
19
  "bootstrapLegacy": {
18
- "noFeaturesEnabled": "No features are enabled in legacy bootstrap mode, at least one feature must be enabled."
20
+ "noFeaturesEnabled": "No features are enabled in legacy bootstrap mode, at least one feature must be enabled.",
21
+ "organizationNotSet": "The organisation identity has not been set. Run \"set-node-org-id\"."
19
22
  },
20
23
  "identityCreate": {
21
- "invalidMnemonic": "The mnemonic is invalid, it should be 24 words from the standard wordlist."
24
+ "invalidMnemonic": "The mnemonic is invalid, it should be 24 words from the standard wordlist.",
25
+ "onlyOneAssignmentOptionAllowed": "Only one of node-id, node-organization-id, or tenant-organization-id can be set at the same time.",
26
+ "nodeOrganizationIdNotAvailableInMultiTenantMode": "The node-organization-id option is not available in multi-tenant mode, use tenant-organization-id instead."
22
27
  },
23
28
  "identityImport": {
24
29
  "identityNotFound": "The identity was not found, it must be created on-chain already.",
@@ -33,11 +38,6 @@
33
38
  "tenantCreate": {
34
39
  "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
35
40
  },
36
- "tenantToken": {
37
- "tenantIdOrApiKeyRequired": "Either a tenant ID or an API key must be provided.",
38
- "urlTransformerComponentNotRegistered": "The URL transformer component is not registered, ensure the node is configured correctly.",
39
- "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
40
- },
41
41
  "tenantImport": {
42
42
  "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
43
43
  },
@@ -57,6 +57,17 @@
57
57
  },
58
58
  "nodeSetIdentity": {
59
59
  "identityNotFound": "The identity with DID \"{notFoundId}\" was not found in the system."
60
+ },
61
+ "setNodeOrgId": {
62
+ "notAvailableInMultiTenantMode": "The set-node-org-id command is not available in multi-tenant mode, use set-tenant-org-id instead."
63
+ },
64
+ "applyOrganizationIdToTenant": {
65
+ "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command.",
66
+ "organizationIdAlreadyInUse": "The organization ID \"{organizationId}\" is already assigned to tenant \"{conflictingTenantId}\"."
67
+ },
68
+ "removeTenantOrgAlias": {
69
+ "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command.",
70
+ "aliasNotFound": "The alias \"{alias}\" was not found in the tenant organization legacy list."
60
71
  }
61
72
  },
62
73
  "node": {
@@ -71,6 +82,7 @@
71
82
  "extensionHttpsDownloading": "Downloading HTTPS extension",
72
83
  "extensionCacheExpired": "Cache expired for extension: {url}",
73
84
  "extensionForceRefresh": "Force refresh enabled for extension: {url}",
85
+ "tenantOrganizationIdAutoAssigned": "Legacy migration: automatically assigned organization ID \"{organizationId}\" to tenant \"{tenantId}\".",
74
86
  "cli": {
75
87
  "commands": {
76
88
  "command": "Command",
@@ -99,16 +111,16 @@
99
111
  "labels": {
100
112
  "nodeIdentityCreate": "Creating node identity",
101
113
  "nodeAuthKeyCreate": "Creating node auth key",
102
- "trustVerificationMethodCreate": "Creating trust verification method for node identity",
103
- "nodeIdentitySet": "Setting node identity",
114
+ "trustVerificationMethodCreate": "Creating trust verification method for organisation identity",
104
115
  "nodeTenantCreate": "Creating node tenant",
105
116
  "organisationCreate": "Creating organisation identity",
106
117
  "blobStorageKeyCreate": "Creating blob storage encryption key for organisation identity",
107
118
  "attestationMethodCreate": "Creating attestation method for organisation identity",
108
119
  "immutableProofMethodCreate": "Creating immutable proof method for organisation identity",
120
+ "nodeOrganizationIdSet": "Setting node organisation ID",
109
121
  "adminIdentityCreate": "Creating admin user identity",
110
122
  "adminUserCreate": "Creating admin user",
111
- "urlTransformParamKeyAdd": "Adding URL transform parameter encryption key"
123
+ "tenantFallback": "No Node-labelled tenant found; using first available tenant"
112
124
  }
113
125
  },
114
126
  "identity-create": {
@@ -141,6 +153,15 @@
141
153
  },
142
154
  "output-env-prefix": {
143
155
  "description": "Prefix to use for variables in the output .env file."
156
+ },
157
+ "node-id": {
158
+ "description": "If true, set the created identity DID as the node identity."
159
+ },
160
+ "node-organization-id": {
161
+ "description": "If true, set the created identity DID as the node organization ID (not available in multi-tenant mode)."
162
+ },
163
+ "tenant-organization-id": {
164
+ "description": "The tenant ID to set the created identity DID as the organization ID for (requires multi-tenant mode)."
144
165
  }
145
166
  },
146
167
  "labels": {
@@ -148,12 +169,12 @@
148
169
  "processingMnemonic": "Processing mnemonic",
149
170
  "readingMnemonic": "Reading mnemonic",
150
171
  "storingMnemonic": "Storing mnemonic",
151
- "existingMnemonic": "Mnemonic already exists",
172
+ "existingMnemonic": "Mnemonic already exists, skipping creation",
152
173
  "noExistingMnemonic": "No existing mnemonic found",
153
174
  "generatingMnemonic": "Generating mnemonic",
154
175
  "processingIdentity": "Processing identity",
155
176
  "resolvingIdentity": "Resolving identity",
156
- "existingIdentity": "Identity already exists",
177
+ "existingIdentity": "Identity already exists, skipping creation",
157
178
  "noIdentityFound": "No identity found",
158
179
  "creatingIdentity": "Creating identity",
159
180
  "createdIdentity": "Created identity",
@@ -330,12 +351,13 @@
330
351
  },
331
352
  "labels": {
332
353
  "resolvingIdentity": "Resolving identity",
333
- "stored": "The node identity has been stored"
354
+ "stored": "The node identity has been stored",
355
+ "skipping": "The node identity has not changed, skipping"
334
356
  }
335
357
  },
336
358
  "tenant-create": {
337
359
  "description": "Create a tenant with associated api key",
338
- "example": "tenant-create --tenant-id=\"0011..aabb\" --api-key=\"aabb..0099\" --label=\"My Tenant\" --public-origin=\"https://example.com:1234\"",
360
+ "example": "tenant-create --tenant-id=\"0011..aabb\" --api-key=\"aabb..0099\" --organization-id=\"did:iota:...\" --label=\"My Tenant\" --public-origin=\"https://example.com:1234\"",
339
361
  "params": {
340
362
  "env-prefix": {
341
363
  "description": "Prefix to use for standard .env files e.g. TWIN_."
@@ -346,6 +368,9 @@
346
368
  "api-key": {
347
369
  "description": "The API key to associate with the tenant id. If not provided, a random key will be generated."
348
370
  },
371
+ "organization-id": {
372
+ "description": "The organization DID to associate with the tenant."
373
+ },
349
374
  "label": {
350
375
  "description": "A descriptive label for the tenant."
351
376
  },
@@ -369,6 +394,7 @@
369
394
  "creating": "Creating tenant",
370
395
  "tenantId": "Tenant ID",
371
396
  "apiKey": "API Key",
397
+ "organizationId": "Organization ID",
372
398
  "label": "Label",
373
399
  "publicOrigin": "Public Origin"
374
400
  }
@@ -429,30 +455,6 @@
429
455
  "updated": "Updated tenant"
430
456
  }
431
457
  },
432
- "tenant-token": {
433
- "description": "Generate the x-enc-tenant-token token value for a tenant",
434
- "example": "tenant-token --tenant-id=\"0011..aabb\"",
435
- "params": {
436
- "tenant-id": {
437
- "description": "The tenant ID to generate the token for."
438
- },
439
- "api-key": {
440
- "description": "The API key to look up the tenant ID from."
441
- },
442
- "load-env": {
443
- "description": "Comma separated list of paths to .env files to read input parameters from."
444
- },
445
- "output-json": {
446
- "description": "Path to a .json file to store the command output."
447
- }
448
- },
449
- "labels": {
450
- "lookingUp": "Looking up tenant",
451
- "generating": "Generating tenant token",
452
- "tenantId": "Tenant ID",
453
- "token": "Token"
454
- }
455
- },
456
458
  "user-create": {
457
459
  "description": "Create a user",
458
460
  "example": "user-create --user-identity=\"did:iota:....\" --organization-identity=\"did:iota:....\" --email=\"bob@examples.com\" --password=\"pass1234\" --scope=\"tenant-admin\" --givenName=\"Bob\" --familyName=\"Smith\"",
@@ -595,6 +597,69 @@
595
597
  "publicKeyHex": "Public Key Hex"
596
598
  }
597
599
  },
600
+ "set-node-org-id": {
601
+ "description": "Set the node organization ID",
602
+ "example": "set-node-org-id --organization-id=\"did:iota:...\"",
603
+ "params": {
604
+ "env-prefix": {
605
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
606
+ },
607
+ "organization-id": {
608
+ "description": "The organization DID to set as the node organization ID."
609
+ },
610
+ "load-env": {
611
+ "description": "Comma separated list of paths to .env files to read input parameters from."
612
+ }
613
+ },
614
+ "labels": {
615
+ "stored": "The node organization ID has been stored"
616
+ }
617
+ },
618
+ "set-tenant-org-id": {
619
+ "description": "Set the organization ID for a tenant",
620
+ "example": "set-tenant-org-id --tenant-id=\"0011..aabb\" --organization-id=\"did:iota:...\"",
621
+ "params": {
622
+ "env-prefix": {
623
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
624
+ },
625
+ "tenant-id": {
626
+ "description": "The tenant ID to update."
627
+ },
628
+ "organization-id": {
629
+ "description": "The organization DID to set as the tenant organization ID."
630
+ },
631
+ "load-env": {
632
+ "description": "Comma separated list of paths to .env files to read input parameters from."
633
+ }
634
+ },
635
+ "labels": {
636
+ "updating": "Updating tenant organization ID",
637
+ "stored": "The tenant organization ID has been stored"
638
+ }
639
+ },
640
+ "remove-tenant-org-alias": {
641
+ "description": "Remove an alias from the tenant organization ID legacy list",
642
+ "example": "remove-tenant-org-alias --tenant-id=\"0011..aabb\" --alias=\"did:iota:...\"",
643
+ "params": {
644
+ "env-prefix": {
645
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
646
+ },
647
+ "tenant-id": {
648
+ "description": "The tenant ID to update."
649
+ },
650
+ "alias": {
651
+ "description": "The organization DID alias to remove from the legacy list."
652
+ },
653
+ "load-env": {
654
+ "description": "Comma separated list of paths to .env files to read input parameters from."
655
+ }
656
+ },
657
+ "labels": {
658
+ "reading": "Reading tenant",
659
+ "updating": "Removing alias from tenant organization legacy list",
660
+ "removed": "The alias has been removed from the tenant organization legacy list"
661
+ }
662
+ },
598
663
  "vault-key-import": {
599
664
  "description": "Import a vault key for an identity",
600
665
  "example": "vault-key-import --identity=\"did:iota:....\" --key-id=\"my-key\" --key-type=Ed25519 --private-key-hex=\"15...a2\"",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/node-core",
3
- "version": "0.0.3-next.52",
3
+ "version": "0.0.3-next.54",
4
4
  "description": "TWIN Node Core for serving APIs using the specified configuration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,97 +0,0 @@
1
- import { CLIDisplay, CLIUtils } from "@twin.org/cli-core";
2
- import { ComponentFactory, GeneralError, Guards, I18n, Is } from "@twin.org/core";
3
- const COMMAND_NAME = "tenant-token";
4
- /**
5
- * Get the command definition parameters.
6
- * @param commandDefinitions The registered command definitions.
7
- */
8
- export function getCommandDefinitionTenantToken(commandDefinitions) {
9
- commandDefinitions[COMMAND_NAME] = {
10
- command: COMMAND_NAME,
11
- description: I18n.formatMessage("node.cli.commands.tenant-token.description"),
12
- example: I18n.formatMessage("node.cli.commands.tenant-token.example"),
13
- params: [
14
- {
15
- key: "tenant-id",
16
- type: "string",
17
- extendedType: "hex(32)",
18
- description: I18n.formatMessage("node.cli.commands.tenant-token.params.tenant-id.description"),
19
- required: false
20
- },
21
- {
22
- key: "api-key",
23
- type: "string",
24
- extendedType: "hex(32)",
25
- description: I18n.formatMessage("node.cli.commands.tenant-token.params.api-key.description"),
26
- required: false
27
- },
28
- {
29
- key: "load-env",
30
- type: "string",
31
- description: I18n.formatMessage("node.cli.commands.tenant-token.params.load-env.description"),
32
- required: false
33
- },
34
- {
35
- key: "output-json",
36
- type: "string",
37
- description: I18n.formatMessage("node.cli.commands.tenant-token.params.output-json.description"),
38
- required: false
39
- }
40
- ],
41
- action: async (engineCore, envVars, params) => tenantToken(engineCore, envVars, params)
42
- };
43
- }
44
- /**
45
- * Command for generating the x-enc-tenant-token token value for a tenant.
46
- * @param engineCore The engine core.
47
- * @param envVars The environment variables for the node.
48
- * @param params The parameters for the command.
49
- * @param params.tenantId The tenant ID to generate the token for.
50
- * @param params.apiKey The API key to look up the tenant ID from.
51
- * @param params.outputJson The output .json file to store the command output.
52
- * @returns The tenant ID and generated encrypted token.
53
- */
54
- export async function tenantToken(engineCore, envVars, params) {
55
- if (!Is.stringValue(params.tenantId) && !Is.stringValue(params.apiKey)) {
56
- throw new GeneralError("tenantToken", "tenantIdOrApiKeyRequired");
57
- }
58
- if (Is.stringValue(params.tenantId)) {
59
- Guards.stringHexLength("tenantToken", "tenant-id", params.tenantId, 32);
60
- }
61
- if (Is.stringValue(params.apiKey)) {
62
- Guards.stringHexLength("tenantToken", "api-key", params.apiKey, 32);
63
- }
64
- const urlTransformerComponentType = engineCore.getRegisteredInstanceTypeOptional("urlTransformerComponent");
65
- if (!Is.stringValue(urlTransformerComponentType)) {
66
- throw new GeneralError("tenantToken", "urlTransformerComponentNotRegistered");
67
- }
68
- const urlTransformer = ComponentFactory.get(urlTransformerComponentType);
69
- // CLI commands skip component starts (engineCore.start(true)), so the URL transformer
70
- // service's _nodeId is never initialized. Starting it here within the ContextIdStore
71
- // context (set by executeCommand) lets it pick up the nodeId correctly.
72
- await urlTransformer.start?.();
73
- let tenantId = params.tenantId;
74
- if (!Is.stringValue(tenantId)) {
75
- const tenantAdminServiceComponentType = engineCore.getRegisteredInstanceTypeOptional("tenantAdminComponent");
76
- if (!Is.stringValue(tenantAdminServiceComponentType)) {
77
- throw new GeneralError("tenantToken", "tenantAdminComponentNotRegistered");
78
- }
79
- const tenantAdminService = ComponentFactory.get(tenantAdminServiceComponentType);
80
- CLIDisplay.task(I18n.formatMessage("node.cli.commands.tenant-token.labels.lookingUp"));
81
- const tenant = await tenantAdminService.getByApiKey(params.apiKey);
82
- tenantId = tenant.id;
83
- }
84
- CLIDisplay.task(I18n.formatMessage("node.cli.commands.tenant-token.labels.generating"));
85
- const token = await urlTransformer.encryptParam(tenantId);
86
- CLIDisplay.break();
87
- CLIDisplay.value(I18n.formatMessage("node.cli.commands.tenant-token.labels.tenantId"), tenantId);
88
- CLIDisplay.value(I18n.formatMessage("node.cli.commands.tenant-token.labels.token"), token);
89
- CLIDisplay.break();
90
- const json = { tenantId, token };
91
- if (Is.stringValue(params.outputJson)) {
92
- await CLIUtils.writeJsonFile(params.outputJson, json, false);
93
- }
94
- CLIDisplay.done();
95
- return json;
96
- }
97
- //# sourceMappingURL=tenantToken.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tenantToken.js","sourceRoot":"","sources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 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ITenantAdminComponent, IUrlTransformerComponent } from \"@twin.org/api-models\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { ComponentFactory, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { INodeEnvironmentVariables } from \"../models/INodeEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"tenant-token\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionTenantToken(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.tenant-token.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.tenant-token.example\"),\n\t\tparams: [\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.tenant-token.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: \"api-key\",\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.tenant-token.params.api-key.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.tenant-token.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.tenant-token.params.output-json.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) => tenantToken(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for generating the x-enc-tenant-token token value for a tenant.\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.tenantId The tenant ID to generate the token for.\n * @param params.apiKey The API key to look up the tenant ID from.\n * @param params.outputJson The output .json file to store the command output.\n * @returns The tenant ID and generated encrypted token.\n */\nexport async function tenantToken(\n\tengineCore: IEngineCore,\n\tenvVars: INodeEnvironmentVariables,\n\tparams: {\n\t\ttenantId?: string;\n\t\tapiKey?: string;\n\t\toutputJson?: string;\n\t}\n): Promise<{ tenantId: string; token: string }> {\n\tif (!Is.stringValue(params.tenantId) && !Is.stringValue(params.apiKey)) {\n\t\tthrow new GeneralError(\"tenantToken\", \"tenantIdOrApiKeyRequired\");\n\t}\n\n\tif (Is.stringValue(params.tenantId)) {\n\t\tGuards.stringHexLength(\"tenantToken\", \"tenant-id\", params.tenantId, 32);\n\t}\n\n\tif (Is.stringValue(params.apiKey)) {\n\t\tGuards.stringHexLength(\"tenantToken\", \"api-key\", params.apiKey, 32);\n\t}\n\n\tconst urlTransformerComponentType =\n\t\tengineCore.getRegisteredInstanceTypeOptional(\"urlTransformerComponent\");\n\n\tif (!Is.stringValue(urlTransformerComponentType)) {\n\t\tthrow new GeneralError(\"tenantToken\", \"urlTransformerComponentNotRegistered\");\n\t}\n\n\tconst urlTransformer = ComponentFactory.get<IUrlTransformerComponent>(\n\t\turlTransformerComponentType\n\t);\n\n\t// CLI commands skip component starts (engineCore.start(true)), so the URL transformer\n\t// service's _nodeId is never initialized. Starting it here within the ContextIdStore\n\t// context (set by executeCommand) lets it pick up the nodeId correctly.\n\tawait urlTransformer.start?.();\n\n\tlet tenantId = params.tenantId;\n\n\tif (!Is.stringValue(tenantId)) {\n\t\tconst tenantAdminServiceComponentType =\n\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\n\t\tif (!Is.stringValue(tenantAdminServiceComponentType)) {\n\t\t\tthrow new GeneralError(\"tenantToken\", \"tenantAdminComponentNotRegistered\");\n\t\t}\n\n\t\tconst tenantAdminService = ComponentFactory.get<ITenantAdminComponent>(\n\t\t\ttenantAdminServiceComponentType\n\t\t);\n\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.tenant-token.labels.lookingUp\"));\n\n\t\tconst tenant = await tenantAdminService.getByApiKey(params.apiKey as string);\n\t\ttenantId = tenant.id;\n\t}\n\n\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.tenant-token.labels.generating\"));\n\n\tconst token = await urlTransformer.encryptParam(tenantId);\n\n\tCLIDisplay.break();\n\tCLIDisplay.value(I18n.formatMessage(\"node.cli.commands.tenant-token.labels.tenantId\"), tenantId);\n\tCLIDisplay.value(I18n.formatMessage(\"node.cli.commands.tenant-token.labels.token\"), token);\n\tCLIDisplay.break();\n\n\tconst json = { tenantId, token };\n\tif (Is.stringValue(params.outputJson)) {\n\t\tawait CLIUtils.writeJsonFile(params.outputJson, json, false);\n\t}\n\n\tCLIDisplay.done();\n\n\treturn json;\n}\n"]}
@@ -1,28 +0,0 @@
1
- import type { IEngineCore } from "@twin.org/engine-models";
2
- import type { ICliCommandDefinition } from "../models/ICliCommandDefinition.js";
3
- import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables.js";
4
- /**
5
- * Get the command definition parameters.
6
- * @param commandDefinitions The registered command definitions.
7
- */
8
- export declare function getCommandDefinitionTenantToken(commandDefinitions: {
9
- [id: string]: ICliCommandDefinition;
10
- }): void;
11
- /**
12
- * Command for generating the x-enc-tenant-token token value for a tenant.
13
- * @param engineCore The engine core.
14
- * @param envVars The environment variables for the node.
15
- * @param params The parameters for the command.
16
- * @param params.tenantId The tenant ID to generate the token for.
17
- * @param params.apiKey The API key to look up the tenant ID from.
18
- * @param params.outputJson The output .json file to store the command output.
19
- * @returns The tenant ID and generated encrypted token.
20
- */
21
- export declare function tenantToken(engineCore: IEngineCore, envVars: INodeEnvironmentVariables, params: {
22
- tenantId?: string;
23
- apiKey?: string;
24
- outputJson?: string;
25
- }): Promise<{
26
- tenantId: string;
27
- token: string;
28
- }>;
@@ -1,20 +0,0 @@
1
- # Function: isUrlTransformerRequired()
2
-
3
- > **isUrlTransformerRequired**(`envVars`): `boolean`
4
-
5
- Checks if the URL transformer subsystem is required.
6
- Returns true when any component that depends on the URL transformer subsystem is enabled.
7
-
8
- ## Parameters
9
-
10
- ### envVars
11
-
12
- [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
-
14
- The environment variables.
15
-
16
- ## Returns
17
-
18
- `boolean`
19
-
20
- True if rights-management, dataspace, federated-catalogue, tenant, or auth entity storage is enabled.
@@ -1,3 +0,0 @@
1
- # Variable: URL\_TRANSFORMER\_ENCRYPTION\_KEY\_ID
2
-
3
- > `const` **URL\_TRANSFORMER\_ENCRYPTION\_KEY\_ID**: `"param-encryption"` = `"param-encryption"`