@twin.org/node-core 0.9.1-next.1 → 0.9.1-next.11
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 +52 -7
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/cli.js +41 -12
- package/dist/es/cli.js.map +1 -1
- package/dist/es/commands/bootstrapLegacy.js +1 -1
- package/dist/es/commands/bootstrapLegacy.js.map +1 -1
- package/dist/es/commands/help.js +10 -1
- package/dist/es/commands/help.js.map +1 -1
- package/dist/es/commands/identityCreate.js +3 -3
- package/dist/es/commands/identityCreate.js.map +1 -1
- package/dist/es/commands/identityList.js +65 -0
- package/dist/es/commands/identityList.js.map +1 -0
- package/dist/es/commands/identityResolve.js +83 -0
- package/dist/es/commands/identityResolve.js.map +1 -0
- package/dist/es/commands/nodeIdentityGet.js +68 -0
- package/dist/es/commands/nodeIdentityGet.js.map +1 -0
- package/dist/es/commands/{nodeSetIdentity.js → nodeIdentitySet.js} +16 -15
- package/dist/es/commands/nodeIdentitySet.js.map +1 -0
- package/dist/es/commands/nodeOrgIdGet.js +55 -0
- package/dist/es/commands/nodeOrgIdGet.js.map +1 -0
- package/dist/es/commands/{setNodeOrgId.js → nodeOrgIdSet.js} +15 -13
- package/dist/es/commands/nodeOrgIdSet.js.map +1 -0
- package/dist/es/commands/orgUsersList.js +94 -0
- package/dist/es/commands/orgUsersList.js.map +1 -0
- package/dist/es/commands/tenantGet.js +68 -0
- package/dist/es/commands/tenantGet.js.map +1 -0
- package/dist/es/commands/tenantList.js +69 -0
- package/dist/es/commands/tenantList.js.map +1 -0
- package/dist/es/commands/tenantListByOrg.js +80 -0
- package/dist/es/commands/tenantListByOrg.js.map +1 -0
- package/dist/es/commands/{setTenantOrgId.js → tenantOrgIdSet.js} +16 -15
- package/dist/es/commands/tenantOrgIdSet.js.map +1 -0
- package/dist/es/commands/userGet.js +77 -0
- package/dist/es/commands/userGet.js.map +1 -0
- package/dist/es/models/ICliCommandDefinition.js.map +1 -1
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/engineEnvironmentVariableKeys.js +13 -0
- package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -1
- package/dist/es/node.js +4 -35
- package/dist/es/node.js.map +1 -1
- package/dist/types/commands/identityList.d.ts +17 -0
- package/dist/types/commands/identityResolve.d.ts +24 -0
- package/dist/types/commands/nodeIdentityGet.d.ts +20 -0
- package/dist/types/commands/{nodeSetIdentity.d.ts → nodeIdentitySet.d.ts} +2 -2
- package/dist/types/commands/nodeOrgIdGet.d.ts +19 -0
- package/dist/types/commands/{setNodeOrgId.d.ts → nodeOrgIdSet.d.ts} +2 -2
- package/dist/types/commands/orgUsersList.d.ts +27 -0
- package/dist/types/commands/tenantGet.d.ts +22 -0
- package/dist/types/commands/tenantList.d.ts +22 -0
- package/dist/types/commands/tenantListByOrg.d.ts +22 -0
- package/dist/types/commands/{setTenantOrgId.d.ts → tenantOrgIdSet.d.ts} +2 -2
- package/dist/types/commands/userGet.d.ts +24 -0
- package/dist/types/models/ICliCommandDefinition.d.ts +8 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +73 -5
- package/docs/changelog.md +72 -0
- package/docs/reference/interfaces/ICliCommandDefinition.md +16 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +145 -5
- package/locales/en.json +229 -14
- package/package.json +2 -3
- package/dist/es/commands/nodeSetIdentity.js.map +0 -1
- package/dist/es/commands/setNodeOrgId.js.map +0 -1
- 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
|
|
5
|
-
"nodeOrganizationIdNotSet": "The node organization is not set, please set it using the \"
|
|
6
|
-
"tenantsWithoutOrganizationId": "The following tenants have no organization ID assigned. Use the \"
|
|
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 \"
|
|
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
|
-
"
|
|
64
|
+
"nodeIdentitySet": {
|
|
59
65
|
"identityNotFound": "The identity with DID \"{notFoundId}\" was not found in the system."
|
|
60
66
|
},
|
|
61
|
-
"
|
|
62
|
-
"notAvailableInMultiTenantMode": "The
|
|
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,15 +115,18 @@
|
|
|
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",
|
|
101
|
-
"options": "options"
|
|
128
|
+
"options": "options",
|
|
129
|
+
"singleTenantOnly": "single-tenant only"
|
|
102
130
|
}
|
|
103
131
|
},
|
|
104
132
|
"bootstrap-legacy": {
|
|
@@ -339,9 +367,9 @@
|
|
|
339
367
|
"publicKeyHex": "Public Key Hex"
|
|
340
368
|
}
|
|
341
369
|
},
|
|
342
|
-
"node-set
|
|
370
|
+
"node-identity-set": {
|
|
343
371
|
"description": "Set the node identity",
|
|
344
|
-
"example": "node-set
|
|
372
|
+
"example": "node-identity-set --identity=\"did:iota...\"",
|
|
345
373
|
"params": {
|
|
346
374
|
"env-prefix": {
|
|
347
375
|
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
@@ -465,6 +493,31 @@
|
|
|
465
493
|
"updated": "Updated tenant"
|
|
466
494
|
}
|
|
467
495
|
},
|
|
496
|
+
"user-get": {
|
|
497
|
+
"description": "Get a user by email address",
|
|
498
|
+
"example": "user-get --email=\"bob@example.com\"",
|
|
499
|
+
"params": {
|
|
500
|
+
"env-prefix": {
|
|
501
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
502
|
+
},
|
|
503
|
+
"email": {
|
|
504
|
+
"description": "The email address of the user to retrieve."
|
|
505
|
+
},
|
|
506
|
+
"tenant-id": {
|
|
507
|
+
"description": "The tenant ID to retrieve the user from (multi-tenant mode only)."
|
|
508
|
+
},
|
|
509
|
+
"load-env": {
|
|
510
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
"labels": {
|
|
514
|
+
"retrieving": "Retrieving user",
|
|
515
|
+
"email": "Email",
|
|
516
|
+
"identity": "Identity",
|
|
517
|
+
"organization": "Organization",
|
|
518
|
+
"scope": "Scope"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
468
521
|
"user-create": {
|
|
469
522
|
"description": "Create a user",
|
|
470
523
|
"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 +660,24 @@
|
|
|
607
660
|
"publicKeyHex": "Public Key Hex"
|
|
608
661
|
}
|
|
609
662
|
},
|
|
610
|
-
"
|
|
663
|
+
"node-org-id-get": {
|
|
664
|
+
"description": "Get the organization ID currently assigned to the node",
|
|
665
|
+
"example": "node-org-id-get",
|
|
666
|
+
"params": {
|
|
667
|
+
"env-prefix": {
|
|
668
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
669
|
+
},
|
|
670
|
+
"load-env": {
|
|
671
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
"labels": {
|
|
675
|
+
"organizationId": "Organization ID"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
"node-org-id-set": {
|
|
611
679
|
"description": "Set the node organization ID",
|
|
612
|
-
"example": "
|
|
680
|
+
"example": "node-org-id-set --organization-id=\"did:iota:...\"",
|
|
613
681
|
"params": {
|
|
614
682
|
"env-prefix": {
|
|
615
683
|
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
@@ -625,9 +693,9 @@
|
|
|
625
693
|
"stored": "The node organization ID has been stored"
|
|
626
694
|
}
|
|
627
695
|
},
|
|
628
|
-
"
|
|
696
|
+
"tenant-org-id-set": {
|
|
629
697
|
"description": "Set the organization ID for a tenant",
|
|
630
|
-
"example": "
|
|
698
|
+
"example": "tenant-org-id-set --tenant-id=\"0011..aabb\" --organization-id=\"did:iota:...\"",
|
|
631
699
|
"params": {
|
|
632
700
|
"env-prefix": {
|
|
633
701
|
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
@@ -697,6 +765,153 @@
|
|
|
697
765
|
"importing": "Importing key",
|
|
698
766
|
"imported": "Imported key"
|
|
699
767
|
}
|
|
768
|
+
},
|
|
769
|
+
"tenant-list": {
|
|
770
|
+
"description": "List all tenants",
|
|
771
|
+
"example": "tenant-list",
|
|
772
|
+
"params": {
|
|
773
|
+
"env-prefix": {
|
|
774
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
775
|
+
},
|
|
776
|
+
"load-env": {
|
|
777
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
"labels": {
|
|
781
|
+
"listing": "Listing tenants",
|
|
782
|
+
"tenantId": "Tenant ID",
|
|
783
|
+
"apiKey": "API Key",
|
|
784
|
+
"organizationId": "Organization ID",
|
|
785
|
+
"label": "Label",
|
|
786
|
+
"count": "Total tenants"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
"tenant-get": {
|
|
790
|
+
"description": "Get the full configuration record for a single tenant",
|
|
791
|
+
"example": "tenant-get --tenant-id=\"0011..aabb\"",
|
|
792
|
+
"params": {
|
|
793
|
+
"env-prefix": {
|
|
794
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
795
|
+
},
|
|
796
|
+
"tenant-id": {
|
|
797
|
+
"description": "The tenant ID to retrieve."
|
|
798
|
+
},
|
|
799
|
+
"load-env": {
|
|
800
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
"labels": {
|
|
804
|
+
"retrieving": "Retrieving tenant",
|
|
805
|
+
"tenantId": "Tenant ID",
|
|
806
|
+
"apiKey": "API Key",
|
|
807
|
+
"organizationId": "Organization ID",
|
|
808
|
+
"label": "Label",
|
|
809
|
+
"publicOrigin": "Public Origin",
|
|
810
|
+
"dateCreated": "Date Created",
|
|
811
|
+
"dateModified": "Date Modified"
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
"tenant-list-by-org": {
|
|
815
|
+
"description": "List all tenants associated with a given organization DID",
|
|
816
|
+
"example": "tenant-list-by-org --org-id=\"did:iota:...\"",
|
|
817
|
+
"params": {
|
|
818
|
+
"env-prefix": {
|
|
819
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
820
|
+
},
|
|
821
|
+
"org-id": {
|
|
822
|
+
"description": "The organization DID to filter tenants by."
|
|
823
|
+
},
|
|
824
|
+
"load-env": {
|
|
825
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
"labels": {
|
|
829
|
+
"listing": "Listing tenants for organization",
|
|
830
|
+
"tenantId": "Tenant ID",
|
|
831
|
+
"apiKey": "API Key",
|
|
832
|
+
"organizationId": "Organization ID",
|
|
833
|
+
"label": "Label",
|
|
834
|
+
"count": "Total tenants"
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
"node-identity-get": {
|
|
838
|
+
"description": "Get the identity currently assigned to the node",
|
|
839
|
+
"example": "node-identity-get",
|
|
840
|
+
"params": {
|
|
841
|
+
"env-prefix": {
|
|
842
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
843
|
+
},
|
|
844
|
+
"load-env": {
|
|
845
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
"labels": {
|
|
849
|
+
"resolving": "Resolving node identity",
|
|
850
|
+
"did": "DID",
|
|
851
|
+
"verificationMethods": "Verification Methods"
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
"identity-list": {
|
|
855
|
+
"description": "List all identities held in custody by the node",
|
|
856
|
+
"example": "identity-list",
|
|
857
|
+
"params": {
|
|
858
|
+
"env-prefix": {
|
|
859
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
860
|
+
},
|
|
861
|
+
"load-env": {
|
|
862
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
"labels": {
|
|
866
|
+
"listing": "Listing identities",
|
|
867
|
+
"did": "DID",
|
|
868
|
+
"controller": "Controller",
|
|
869
|
+
"count": "Total identities"
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
"identity-resolve": {
|
|
873
|
+
"description": "Resolve an identity DID to its full document",
|
|
874
|
+
"example": "identity-resolve --identity=\"did:iota:...\"",
|
|
875
|
+
"params": {
|
|
876
|
+
"env-prefix": {
|
|
877
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
878
|
+
},
|
|
879
|
+
"identity": {
|
|
880
|
+
"description": "The DID to resolve."
|
|
881
|
+
},
|
|
882
|
+
"load-env": {
|
|
883
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
884
|
+
},
|
|
885
|
+
"output-json": {
|
|
886
|
+
"description": "Path to a .json file to store the resolved DID document."
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
"labels": {
|
|
890
|
+
"resolving": "Resolving identity",
|
|
891
|
+
"did": "DID"
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
"org-users-list": {
|
|
895
|
+
"description": "List all users belonging to an organization DID",
|
|
896
|
+
"example": "org-users-list --org-did=\"did:iota:...\"",
|
|
897
|
+
"params": {
|
|
898
|
+
"env-prefix": {
|
|
899
|
+
"description": "Prefix to use for standard .env files e.g. TWIN_."
|
|
900
|
+
},
|
|
901
|
+
"org-did": {
|
|
902
|
+
"description": "The organization DID to list users for. Defaults to the node organization ID in single-tenant mode."
|
|
903
|
+
},
|
|
904
|
+
"load-env": {
|
|
905
|
+
"description": "Comma separated list of paths to .env files to read input parameters from."
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
"labels": {
|
|
909
|
+
"listing": "Listing organization users",
|
|
910
|
+
"email": "Email",
|
|
911
|
+
"identity": "Identity",
|
|
912
|
+
"scope": "Scope",
|
|
913
|
+
"count": "Total users"
|
|
914
|
+
}
|
|
700
915
|
}
|
|
701
916
|
}
|
|
702
917
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/node-core",
|
|
3
|
-
"version": "0.9.1-next.
|
|
3
|
+
"version": "0.9.1-next.11",
|
|
4
4
|
"description": "TWIN Node Core for serving APIs using the specified configuration",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-auth-entity-storage-service": "next",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"@twin.org/identity-models": "next",
|
|
33
33
|
"@twin.org/logging-connector-opentelemetry": "next",
|
|
34
34
|
"@twin.org/modules": "next",
|
|
35
|
-
"@twin.org/rights-management-rest-client": "next",
|
|
36
35
|
"@twin.org/standards-w3c-did": "next",
|
|
37
36
|
"@twin.org/standards-w3c-odrl": "next",
|
|
38
37
|
"@twin.org/telemetry-connector-opentelemetry": "next",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeSetIdentity.js","sourceRoot":"","sources":["../../../src/commands/nodeSetIdentity.ts"],"names":[],"mappings":"AAAA,gCAAgC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AA8B,EAC9B,MAEC;IAED,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE1D,UAAU,CAAC,IAAI,CACd,IAAI,CAAC,aAAa,CAAC,8DAA8D,CAAC,CAClF,CAAC;IACF,MAAM,oCAAoC,GAAG,UAAU,CAAC,yBAAyB,CAChF,2BAA2B,CAC3B,CAAC;IAEF,MAAM,yBAAyB,GAAG,gCAAgC,CAAC,GAAG,CACrE,oCAAoC,CACpC,CAAC;IAEF,MAAM,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,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MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,KAAK,CAAC,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC;IACjD,UAAU,CAAC,aAAa,EAAE,CAAC;IAE3B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,iDAAiD,CAAC,CAAC,CAAC;IAEvF,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 { 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,E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AM,oBAAoB,GAAG,gBAAgB,CAAC,GAAG,CAAwB,IAAI,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,oBAAoB,CAAC,MAAM,CAAC;QACjC,GAAG,MAAM;QACT,cAAc,EAAE,iBAAiB;KACjC,CAAC,CAAC;IAEH,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,CAAC;QAC3C,UAAU,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;AACF,CAAC","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"]}
|