@twin.org/node-core 0.9.1-next.3 → 0.9.1-next.5

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 (56) hide show
  1. package/dist/es/cli.js +41 -12
  2. package/dist/es/cli.js.map +1 -1
  3. package/dist/es/commands/help.js +4 -0
  4. package/dist/es/commands/help.js.map +1 -1
  5. package/dist/es/commands/identityCreate.js +3 -3
  6. package/dist/es/commands/identityCreate.js.map +1 -1
  7. package/dist/es/commands/identityList.js +65 -0
  8. package/dist/es/commands/identityList.js.map +1 -0
  9. package/dist/es/commands/identityResolve.js +83 -0
  10. package/dist/es/commands/identityResolve.js.map +1 -0
  11. package/dist/es/commands/nodeIdentityGet.js +68 -0
  12. package/dist/es/commands/nodeIdentityGet.js.map +1 -0
  13. package/dist/es/commands/{nodeSetIdentity.js → nodeIdentitySet.js} +16 -15
  14. package/dist/es/commands/nodeIdentitySet.js.map +1 -0
  15. package/dist/es/commands/nodeOrgIdGet.js +54 -0
  16. package/dist/es/commands/nodeOrgIdGet.js.map +1 -0
  17. package/dist/es/commands/{setNodeOrgId.js → nodeOrgIdSet.js} +14 -13
  18. package/dist/es/commands/nodeOrgIdSet.js.map +1 -0
  19. package/dist/es/commands/orgUsersList.js +94 -0
  20. package/dist/es/commands/orgUsersList.js.map +1 -0
  21. package/dist/es/commands/tenantGet.js +68 -0
  22. package/dist/es/commands/tenantGet.js.map +1 -0
  23. package/dist/es/commands/tenantList.js +69 -0
  24. package/dist/es/commands/tenantList.js.map +1 -0
  25. package/dist/es/commands/tenantListByOrg.js +80 -0
  26. package/dist/es/commands/tenantListByOrg.js.map +1 -0
  27. package/dist/es/commands/{setTenantOrgId.js → tenantOrgIdSet.js} +16 -15
  28. package/dist/es/commands/tenantOrgIdSet.js.map +1 -0
  29. package/dist/es/commands/userGet.js +77 -0
  30. package/dist/es/commands/userGet.js.map +1 -0
  31. package/dist/es/models/ICliCommandDefinition.js.map +1 -1
  32. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  33. package/dist/es/node.js +1 -1
  34. package/dist/es/node.js.map +1 -1
  35. package/dist/types/commands/identityList.d.ts +17 -0
  36. package/dist/types/commands/identityResolve.d.ts +22 -0
  37. package/dist/types/commands/nodeIdentityGet.d.ts +20 -0
  38. package/dist/types/commands/{nodeSetIdentity.d.ts → nodeIdentitySet.d.ts} +2 -2
  39. package/dist/types/commands/nodeOrgIdGet.d.ts +19 -0
  40. package/dist/types/commands/{setNodeOrgId.d.ts → nodeOrgIdSet.d.ts} +2 -2
  41. package/dist/types/commands/orgUsersList.d.ts +27 -0
  42. package/dist/types/commands/tenantGet.d.ts +22 -0
  43. package/dist/types/commands/tenantList.d.ts +22 -0
  44. package/dist/types/commands/tenantListByOrg.d.ts +22 -0
  45. package/dist/types/commands/{setTenantOrgId.d.ts → tenantOrgIdSet.d.ts} +2 -2
  46. package/dist/types/commands/userGet.d.ts +24 -0
  47. package/dist/types/models/ICliCommandDefinition.d.ts +4 -0
  48. package/dist/types/models/IEngineEnvironmentVariables.d.ts +12 -4
  49. package/docs/changelog.md +14 -0
  50. package/docs/reference/interfaces/ICliCommandDefinition.md +8 -0
  51. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +12 -4
  52. package/locales/en.json +225 -13
  53. package/package.json +1 -1
  54. package/dist/es/commands/nodeSetIdentity.js.map +0 -1
  55. package/dist/es/commands/setNodeOrgId.js.map +0 -1
  56. package/dist/es/commands/setTenantOrgId.js.map +0 -1
package/locales/en.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "error": {
3
3
  "node": {
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}",
4
+ "nodeIdentityNotSet": "The node identity is enabled in config but is not set, please set it using the \"node-identity-set\" CLI command.",
5
+ "nodeOrganizationIdNotSet": "The node organization is not set, please set it using the \"node-org-id-set\".",
6
+ "tenantsWithoutOrganizationId": "The following tenants have no organization ID assigned. Use the \"tenant-org-id-set\" command to assign one before starting the node: {tenantIds}",
7
7
  "storageFileRootNotSet": "{storageFileRoot} is not set, the server will not start without it, please set it in the shell or create a .env file",
8
8
  "extensionLoadingError": "Failed to load extension \"{extension}\"",
9
9
  "insecureProtocol": "Cannot load extension from insecure protocol: {protocol}. Only HTTPS is allowed for remote extensions.",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "bootstrapLegacy": {
20
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\"."
21
+ "organizationNotSet": "The organisation identity has not been set. Run \"node-org-id-set\"."
22
22
  },
23
23
  "identityCreate": {
24
24
  "invalidMnemonic": "The mnemonic is invalid, it should be 24 words from the standard wordlist.",
@@ -49,17 +49,27 @@
49
49
  "userAlreadyExists": "The user with ID already exists and overwriteMode is set to \"error\".",
50
50
  "tenantIdRequired": "The tenant ID is required when multi-tenancy is enabled."
51
51
  },
52
+ "userGet": {
53
+ "tenantIdRequired": "The tenant ID is required when multi-tenancy is enabled."
54
+ },
52
55
  "userUpdate": {
53
56
  "tenantIdRequired": "The tenant ID is required when multi-tenancy is enabled."
54
57
  },
58
+ "orgUsersList": {
59
+ "orgDidRequired": "The organization DID is required in multi-tenant mode. Provide --org-did or switch to single-tenant mode."
60
+ },
55
61
  "vaultKeyCreate": {
56
62
  "vaultKeyAlreadyExists": "The vault key with ID already exists and overwriteMode is set to \"error\"."
57
63
  },
58
- "nodeSetIdentity": {
64
+ "nodeIdentitySet": {
59
65
  "identityNotFound": "The identity with DID \"{notFoundId}\" was not found in the system."
60
66
  },
61
- "setNodeOrgId": {
62
- "notAvailableInMultiTenantMode": "The set-node-org-id command is not available in multi-tenant mode, use set-tenant-org-id instead."
67
+ "nodeOrgIdGet": {
68
+ "notAvailableInMultiTenantMode": "The node-org-id-get command is not available in multi-tenant mode, use tenant-org-id-set instead.",
69
+ "nodeOrganizationIdNotSet": "The node organization ID is not set. Use \"node-org-id-set\" to set it first."
70
+ },
71
+ "nodeOrgIdSet": {
72
+ "notAvailableInMultiTenantMode": "The node-org-id-set command is not available in multi-tenant mode, use tenant-org-id-set instead."
63
73
  },
64
74
  "applyOrganizationIdToTenant": {
65
75
  "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
@@ -67,6 +77,21 @@
67
77
  "removeTenantOrgAlias": {
68
78
  "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command.",
69
79
  "aliasNotFound": "The alias \"{alias}\" was not found in the tenant organization legacy list."
80
+ },
81
+ "tenantList": {
82
+ "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
83
+ },
84
+ "tenantGet": {
85
+ "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
86
+ },
87
+ "tenantListByOrg": {
88
+ "tenantAdminComponentNotRegistered": "Multi-tenant support must be enabled to use this command."
89
+ },
90
+ "nodeIdentityGet": {
91
+ "nodeIdentityNotSet": "The node identity is not set. Use \"node-identity-set\" to set it first."
92
+ },
93
+ "identityResolve": {
94
+ "identityNotFound": "The identity \"{identity}\" was not found."
70
95
  }
71
96
  },
72
97
  "warn": {
@@ -90,11 +115,13 @@
90
115
  "cli": {
91
116
  "commands": {
92
117
  "command": "Command",
118
+ "deprecatedAlias": "\"{alias}\" is a deprecated alias, please use \"{command}\" instead.",
93
119
  "help": {
94
120
  "description": "Display help information about CLI commands",
95
121
  "labels": {
96
122
  "commands": "All the commands available are listed below, for more information use the --help option with a specific command.",
97
123
  "example": "Example",
124
+ "aliases": "Deprecated aliases",
98
125
  "optional": "optional",
99
126
  "required": "required",
100
127
  "default": "default",
@@ -339,9 +366,9 @@
339
366
  "publicKeyHex": "Public Key Hex"
340
367
  }
341
368
  },
342
- "node-set-identity": {
369
+ "node-identity-set": {
343
370
  "description": "Set the node identity",
344
- "example": "node-set-identity --identity=\"did:iota...\"",
371
+ "example": "node-identity-set --identity=\"did:iota...\"",
345
372
  "params": {
346
373
  "env-prefix": {
347
374
  "description": "Prefix to use for standard .env files e.g. TWIN_."
@@ -465,6 +492,31 @@
465
492
  "updated": "Updated tenant"
466
493
  }
467
494
  },
495
+ "user-get": {
496
+ "description": "Get a user by email address",
497
+ "example": "user-get --email=\"bob@example.com\"",
498
+ "params": {
499
+ "env-prefix": {
500
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
501
+ },
502
+ "email": {
503
+ "description": "The email address of the user to retrieve."
504
+ },
505
+ "tenant-id": {
506
+ "description": "The tenant ID to retrieve the user from (multi-tenant mode only)."
507
+ },
508
+ "load-env": {
509
+ "description": "Comma separated list of paths to .env files to read input parameters from."
510
+ }
511
+ },
512
+ "labels": {
513
+ "retrieving": "Retrieving user",
514
+ "email": "Email",
515
+ "identity": "Identity",
516
+ "organization": "Organization",
517
+ "scope": "Scope"
518
+ }
519
+ },
468
520
  "user-create": {
469
521
  "description": "Create a user",
470
522
  "example": "user-create --user-identity=\"did:iota:....\" --organization-identity=\"did:iota:....\" --email=\"bob@examples.com\" --password=\"pass1234\" --scope=\"tenant-admin\" --givenName=\"Bob\" --familyName=\"Smith\"",
@@ -607,9 +659,24 @@
607
659
  "publicKeyHex": "Public Key Hex"
608
660
  }
609
661
  },
610
- "set-node-org-id": {
662
+ "node-org-id-get": {
663
+ "description": "Get the organization ID currently assigned to the node",
664
+ "example": "node-org-id-get",
665
+ "params": {
666
+ "env-prefix": {
667
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
668
+ },
669
+ "load-env": {
670
+ "description": "Comma separated list of paths to .env files to read input parameters from."
671
+ }
672
+ },
673
+ "labels": {
674
+ "organizationId": "Organization ID"
675
+ }
676
+ },
677
+ "node-org-id-set": {
611
678
  "description": "Set the node organization ID",
612
- "example": "set-node-org-id --organization-id=\"did:iota:...\"",
679
+ "example": "node-org-id-set --organization-id=\"did:iota:...\"",
613
680
  "params": {
614
681
  "env-prefix": {
615
682
  "description": "Prefix to use for standard .env files e.g. TWIN_."
@@ -625,9 +692,9 @@
625
692
  "stored": "The node organization ID has been stored"
626
693
  }
627
694
  },
628
- "set-tenant-org-id": {
695
+ "tenant-org-id-set": {
629
696
  "description": "Set the organization ID for a tenant",
630
- "example": "set-tenant-org-id --tenant-id=\"0011..aabb\" --organization-id=\"did:iota:...\"",
697
+ "example": "tenant-org-id-set --tenant-id=\"0011..aabb\" --organization-id=\"did:iota:...\"",
631
698
  "params": {
632
699
  "env-prefix": {
633
700
  "description": "Prefix to use for standard .env files e.g. TWIN_."
@@ -697,6 +764,151 @@
697
764
  "importing": "Importing key",
698
765
  "imported": "Imported key"
699
766
  }
767
+ },
768
+ "tenant-list": {
769
+ "description": "List all tenants",
770
+ "example": "tenant-list",
771
+ "params": {
772
+ "env-prefix": {
773
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
774
+ },
775
+ "load-env": {
776
+ "description": "Comma separated list of paths to .env files to read input parameters from."
777
+ }
778
+ },
779
+ "labels": {
780
+ "listing": "Listing tenants",
781
+ "tenantId": "Tenant ID",
782
+ "apiKey": "API Key",
783
+ "organizationId": "Organization ID",
784
+ "label": "Label",
785
+ "count": "Total tenants"
786
+ }
787
+ },
788
+ "tenant-get": {
789
+ "description": "Get the full configuration record for a single tenant",
790
+ "example": "tenant-get --tenant-id=\"0011..aabb\"",
791
+ "params": {
792
+ "env-prefix": {
793
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
794
+ },
795
+ "tenant-id": {
796
+ "description": "The tenant ID to retrieve."
797
+ },
798
+ "load-env": {
799
+ "description": "Comma separated list of paths to .env files to read input parameters from."
800
+ }
801
+ },
802
+ "labels": {
803
+ "retrieving": "Retrieving tenant",
804
+ "tenantId": "Tenant ID",
805
+ "apiKey": "API Key",
806
+ "organizationId": "Organization ID",
807
+ "label": "Label",
808
+ "publicOrigin": "Public Origin",
809
+ "dateCreated": "Date Created",
810
+ "dateModified": "Date Modified"
811
+ }
812
+ },
813
+ "tenant-list-by-org": {
814
+ "description": "List all tenants associated with a given organization DID",
815
+ "example": "tenant-list-by-org --org-id=\"did:iota:...\"",
816
+ "params": {
817
+ "env-prefix": {
818
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
819
+ },
820
+ "org-id": {
821
+ "description": "The organization DID to filter tenants by."
822
+ },
823
+ "load-env": {
824
+ "description": "Comma separated list of paths to .env files to read input parameters from."
825
+ }
826
+ },
827
+ "labels": {
828
+ "listing": "Listing tenants for organization",
829
+ "tenantId": "Tenant ID",
830
+ "apiKey": "API Key",
831
+ "organizationId": "Organization ID",
832
+ "label": "Label",
833
+ "count": "Total tenants"
834
+ }
835
+ },
836
+ "node-identity-get": {
837
+ "description": "Get the identity currently assigned to the node",
838
+ "example": "node-identity-get",
839
+ "params": {
840
+ "env-prefix": {
841
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
842
+ },
843
+ "load-env": {
844
+ "description": "Comma separated list of paths to .env files to read input parameters from."
845
+ }
846
+ },
847
+ "labels": {
848
+ "resolving": "Resolving node identity",
849
+ "did": "DID",
850
+ "verificationMethods": "Verification Methods"
851
+ }
852
+ },
853
+ "identity-list": {
854
+ "description": "List all identities held in custody by the node",
855
+ "example": "identity-list",
856
+ "params": {
857
+ "env-prefix": {
858
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
859
+ },
860
+ "load-env": {
861
+ "description": "Comma separated list of paths to .env files to read input parameters from."
862
+ }
863
+ },
864
+ "labels": {
865
+ "listing": "Listing identities",
866
+ "did": "DID",
867
+ "controller": "Controller",
868
+ "count": "Total identities"
869
+ }
870
+ },
871
+ "identity-resolve": {
872
+ "description": "Resolve an identity DID to its full document",
873
+ "example": "identity-resolve --identity=\"did:iota:...\"",
874
+ "params": {
875
+ "env-prefix": {
876
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
877
+ },
878
+ "identity": {
879
+ "description": "The DID to resolve."
880
+ },
881
+ "load-env": {
882
+ "description": "Comma separated list of paths to .env files to read input parameters from."
883
+ }
884
+ },
885
+ "labels": {
886
+ "resolving": "Resolving identity",
887
+ "did": "DID",
888
+ "verificationMethods": "Verification Methods"
889
+ }
890
+ },
891
+ "org-users-list": {
892
+ "description": "List all users belonging to an organization DID",
893
+ "example": "org-users-list --org-did=\"did:iota:...\"",
894
+ "params": {
895
+ "env-prefix": {
896
+ "description": "Prefix to use for standard .env files e.g. TWIN_."
897
+ },
898
+ "org-did": {
899
+ "description": "The organization DID to list users for. Defaults to the node organization ID in single-tenant mode."
900
+ },
901
+ "load-env": {
902
+ "description": "Comma separated list of paths to .env files to read input parameters from."
903
+ }
904
+ },
905
+ "labels": {
906
+ "listing": "Listing organization users",
907
+ "email": "Email",
908
+ "identity": "Identity",
909
+ "scope": "Scope",
910
+ "count": "Total users"
911
+ }
700
912
  }
701
913
  }
702
914
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/node-core",
3
- "version": "0.9.1-next.3",
3
+ "version": "0.9.1-next.5",
4
4
  "description": "TWIN Node Core for serving APIs using the specified configuration",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeSetIdentity.js","sourceRoot":"","sources":["../../../src/commands/nodeSetIdentity.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAMlF,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CAAC,kBAEnD;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;Q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AAM,gBAAgB,GAAG,MAAM,yBAAyB,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1F,IAAI,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,aAAa,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IAEpC,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,qDAAqD,CAAC,CAAC,CAAC;QAC3F,OAAO;IACR,CAAC;IAED,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC/B,UAAU,CAAC,aAAa,EAAE,CAAC;IAE3B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mDAAmD,CAAC,CAAC,CAAC;IAEzF,UAAU,CAAC,IAAI,EAAE,CAAC;AACnB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { I18n, Is, NotFoundError } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did, IdentityResolverConnectorFactory } from \"@twin.org/identity-models\";\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 = \"node-set-identity\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionNodeSetIdentity(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.node-set-identity.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.node-set-identity.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.node-set-identity.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: \"identity\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tdescription: I18n.formatMessage(\n\t\t\t\t\t\"node.cli.commands.node-set-identity.params.identity.description\"\n\t\t\t\t),\n\t\t\t\textendedType: \"did\",\n\t\t\t\trequired: true\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.node-set-identity.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) => nodeSetIdentity(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for setting a node identity.\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.identity The DID to set for the node.\n * @returns A promise that resolves when the node identity has been persisted.\n */\nexport async function nodeSetIdentity(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\tidentity?: string;\n\t}\n): Promise<void> {\n\tDid.guard(\"nodeSetIdentity\", \"identity\", params.identity);\n\n\tCLIDisplay.task(\n\t\tI18n.formatMessage(\"node.cli.commands.node-set-identity.labels.resolvingIdentity\")\n\t);\n\tconst defaultIdentityResolverConnectorType = engineCore.getRegisteredInstanceType(\n\t\t\"identityResolverConnector\"\n\t);\n\n\tconst identityResolverConnector = IdentityResolverConnectorFactory.get(\n\t\tdefaultIdentityResolverConnectorType\n\t);\n\n\tconst identityDocument = await identityResolverConnector.resolveDocument(params.identity);\n\tif (Is.empty(identityDocument)) {\n\t\tthrow new NotFoundError(\"nodeSetIdentity\", \"identityNotFound\", params.identity);\n\t}\n\n\tconst state = engineCore.getState();\n\n\tif (state.nodeId === params.identity) {\n\t\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.node-set-identity.labels.skipping\"));\n\t\treturn;\n\t}\n\n\tstate.nodeId = params.identity;\n\tengineCore.setStateDirty();\n\n\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.node-set-identity.labels.stored\"));\n\n\tCLIDisplay.done();\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"setNodeOrgId.js","sourceRoot":"","sources":["../../../src/commands/setNodeOrgId.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAMhD,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAAC,kBAEhD;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,+CAA+C,CAAC;QAChF,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,2CAA2C,CAAC;QACxE,oBAAoB,EAAE,KAAK;QAC3B,mBAAmB,EAAE,KAAK;QAC1B,MAAM,EAAE;YACP;gBACC,GAAG,EAAE,YAAY;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,IAAI,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.org/cli-core\";\nimport { Coerce, GeneralError, I18n } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did } from \"@twin.org/identity-models\";\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 = \"set-node-org-id\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionSetNodeOrgId(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.set-node-org-id.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.set-node-org-id.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.set-node-org-id.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: \"organization-id\",\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.set-node-org-id.params.organization-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\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.set-node-org-id.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) => setNodeOrgId(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for setting the node organization ID.\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.organizationId The organization ID to set.\n * @returns A promise that resolves when the node organization ID has been persisted.\n * @throws GeneralError if called while multi-tenant mode is enabled.\n */\nexport async function setNodeOrgId(\n\tengineCore: IEngineCore<INodeEngineConfig, INodeEngineState>,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\torganizationId?: string;\n\t}\n): Promise<void> {\n\tif (Coerce.boolean(envVars.tenantEnabled) ?? false) {\n\t\tthrow new GeneralError(\"setNodeOrgId\", \"notAvailableInMultiTenantMode\");\n\t}\n\n\tDid.guard(\"setNodeOrgId\", \"organizationId\", params.organizationId);\n\n\tconst state = engineCore.getState();\n\tstate.nodeOrganizationId = params.organizationId;\n\tengineCore.setStateDirty();\n\n\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.set-node-org-id.labels.stored\"));\n\n\tCLIDisplay.done();\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"setTenantOrgId.js","sourceRoot":"","sources":["../../../src/commands/setTenantOrgId.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAIhD,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,kBAElD;IACA,kBAAkB,CAAC,YAAY,CAAC,GAAG;QAClC,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC;QAClF,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,6CAA6C,CAAC;QAC1E,oBAAoB,EAAE,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","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ITenantAdminComponent } from \"@twin.org/api-models\";\nimport { CLIDisplay } from \"@twin.org/cli-core\";\nimport { ComponentFactory, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport type { IEngineCore } from \"@twin.org/engine-models\";\nimport { Did } from \"@twin.org/identity-models\";\nimport type { ICliCommandDefinition } from \"../models/ICliCommandDefinition.js\";\nimport type { IEnvironmentVariables } from \"../models/IEnvironmentVariables.js\";\n\nconst COMMAND_NAME = \"set-tenant-org-id\";\n\n/**\n * Get the command definition parameters.\n * @param commandDefinitions The registered command definitions.\n */\nexport function getCommandDefinitionSetTenantOrgId(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.set-tenant-org-id.description\"),\n\t\texample: I18n.formatMessage(\"node.cli.commands.set-tenant-org-id.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.set-tenant-org-id.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: \"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.set-tenant-org-id.params.tenant-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkey: \"organization-id\",\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.set-tenant-org-id.params.organization-id.description\"\n\t\t\t\t),\n\t\t\t\trequired: true\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.set-tenant-org-id.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) => setTenantOrgId(engineCore, envVars, params)\n\t};\n}\n\n/**\n * Command for setting the organization ID on 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 update.\n * @param params.organizationId The organization ID to set.\n * @returns A promise that resolves when the tenant organization ID has been stored.\n */\nexport async function setTenantOrgId(\n\tengineCore: IEngineCore,\n\tenvVars: IEnvironmentVariables,\n\tparams: {\n\t\ttenantId?: string;\n\t\torganizationId?: string;\n\t}\n): Promise<void> {\n\tGuards.stringHexLength(\"setTenantOrgId\", \"tenant-id\", params.tenantId, 32);\n\n\tDid.guard(\"setTenantOrgId\", \"organizationId\", params.organizationId);\n\n\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.set-tenant-org-id.labels.updating\"));\n\tCLIDisplay.spinnerStart();\n\n\tawait applyOrganizationIdToTenant(engineCore, params.tenantId, params.organizationId);\n\n\tCLIDisplay.spinnerStop();\n\tCLIDisplay.task(I18n.formatMessage(\"node.cli.commands.set-tenant-org-id.labels.stored\"));\n\n\tCLIDisplay.done();\n}\n\n/**\n * Apply a new organization ID to a tenant.\n * @param engineCore The engine core used to look up the tenantAdminComponent.\n * @param tenantId The ID of the tenant to update.\n * @param newOrganizationId The new organization DID to set.\n * @param options Optional display and behaviour overrides.\n * @param options.sectionLabel When set, emits a CLI section header before and done marker after.\n * @param options.required When false, returns silently when the component is not registered (default true).\n * @returns A promise that resolves when the tenant record has been updated.\n * @throws GeneralError if the component is required but not registered.\n */\nexport async function applyOrganizationIdToTenant(\n\tengineCore: IEngineCore,\n\ttenantId: string,\n\tnewOrganizationId: string,\n\toptions?: { sectionLabel?: string; required?: boolean }\n): Promise<void> {\n\tconst type = engineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\");\n\n\tif (!Is.stringValue(type)) {\n\t\tif (options?.required ?? true) {\n\t\t\tthrow new GeneralError(\"applyOrganizationIdToTenant\", \"tenantAdminComponentNotRegistered\");\n\t\t}\n\t\treturn;\n\t}\n\n\tif (Is.stringValue(options?.sectionLabel)) {\n\t\tCLIDisplay.break();\n\t\tCLIDisplay.section(options.sectionLabel);\n\t}\n\n\tconst tenantAdminComponent = ComponentFactory.get<ITenantAdminComponent>(type);\n\n\tconst tenant = await tenantAdminComponent.get(tenantId);\n\tawait tenantAdminComponent.update({\n\t\t...tenant,\n\t\torganizationId: newOrganizationId\n\t});\n\n\tif (Is.stringValue(options?.sectionLabel)) {\n\t\tCLIDisplay.done();\n\t}\n}\n"]}