@rockcarver/frodo-lib 0.12.5 → 0.12.7

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 (49) hide show
  1. package/CHANGELOG.md +32 -8
  2. package/cjs/api/ApiTypes.js +42 -0
  3. package/cjs/api/ApiTypes.js.map +1 -0
  4. package/cjs/api/Saml2Api.js +1 -1
  5. package/cjs/api/Saml2Api.js.map +1 -1
  6. package/cjs/index.js +17 -1
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/ops/JourneyOps.js +282 -151
  9. package/cjs/ops/JourneyOps.js.map +1 -1
  10. package/cjs/ops/NodeOps.js +31 -15
  11. package/cjs/ops/NodeOps.js.map +1 -1
  12. package/cjs/ops/OpsTypes.js +34 -0
  13. package/cjs/ops/OpsTypes.js.map +1 -0
  14. package/cjs/ops/Saml2Ops.js +3 -0
  15. package/cjs/ops/Saml2Ops.js.map +1 -1
  16. package/cjs/ops/utils/Console.js +18 -1
  17. package/cjs/ops/utils/Console.js.map +1 -1
  18. package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
  19. package/cjs/storage/SessionStorage.js +4 -0
  20. package/cjs/storage/SessionStorage.js.map +1 -1
  21. package/esm/api/ApiTypes.mjs +33 -0
  22. package/esm/api/Saml2Api.mjs +1 -1
  23. package/esm/index.mjs +5 -0
  24. package/esm/ops/JourneyOps.mjs +208 -119
  25. package/esm/ops/NodeOps.mjs +28 -15
  26. package/esm/ops/OpsTypes.mjs +25 -0
  27. package/esm/ops/Saml2Ops.mjs +1 -1
  28. package/esm/ops/utils/Console.mjs +16 -1
  29. package/esm/storage/SessionStorage.mjs +4 -0
  30. package/package.json +3 -2
  31. package/types/api/ApiTypes.d.ts +102 -0
  32. package/types/api/ApiTypes.d.ts.map +1 -0
  33. package/types/api/Saml2Api.d.ts +1 -1
  34. package/types/api/Saml2Api.d.ts.map +1 -1
  35. package/types/index.d.ts +3 -0
  36. package/types/index.d.ts.map +1 -1
  37. package/types/ops/JourneyOps.d.ts +83 -87
  38. package/types/ops/JourneyOps.d.ts.map +1 -1
  39. package/types/ops/NodeOps.d.ts +10 -0
  40. package/types/ops/NodeOps.d.ts.map +1 -1
  41. package/types/ops/OpsTypes.d.ts +78 -0
  42. package/types/ops/OpsTypes.d.ts.map +1 -0
  43. package/types/ops/Saml2Ops.d.ts +6 -0
  44. package/types/ops/Saml2Ops.d.ts.map +1 -1
  45. package/types/ops/utils/Console.d.ts +9 -1
  46. package/types/ops/utils/Console.d.ts.map +1 -1
  47. package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
  48. package/types/storage/SessionStorage.d.ts +4 -0
  49. package/types/storage/SessionStorage.d.ts.map +1 -1
@@ -11,7 +11,6 @@ import storage from '../../storage/SessionStorage';
11
11
  * type="data" will be written to stderr.
12
12
  * @param {boolean} [newline=true] Whether to add a newline at the end of message
13
13
  * messages returned
14
- *
15
14
  */
16
15
 
17
16
  export function printMessage(message, type = 'text', newline = true) {
@@ -21,6 +20,22 @@ export function printMessage(message, type = 'text', newline = true) {
21
20
  handler(message, type, newline);
22
21
  }
23
22
  }
23
+ /**
24
+ * Handles debug output. The caller decides and implements how
25
+ * the messages are handled, by implementing the handler function
26
+ * on its side. `handler` is optional, and if not included by the caller,
27
+ * the data and messages will be lost.
28
+ *
29
+ * @param {string | unknown} message The string message to return
30
+ */
31
+
32
+ export function debugMessage(message) {
33
+ const handler = storage.session.getDebugHandler();
34
+
35
+ if (handler) {
36
+ handler(message);
37
+ }
38
+ }
24
39
  /**
25
40
  * Calls a callback on client to create a progress indicator.
26
41
  * The actual implementation of the indicator is left to the client
@@ -50,6 +50,10 @@ export default {
50
50
  getMasterKeyPath: () => _sessionStorage['masterKeyPath'],
51
51
  setPrintHandler: printHandler => _sessionStorage['printHandler'] = printHandler,
52
52
  getPrintHandler: () => _sessionStorage['printHandler'],
53
+ setErrorHandler: errorHandler => _sessionStorage['errorHandler'] = errorHandler,
54
+ getErrorHandler: () => _sessionStorage['errorHandler'],
55
+ setDebugHandler: debugHandler => _sessionStorage['debugHandler'] = debugHandler,
56
+ getDebugHandler: () => _sessionStorage['debugHandler'],
53
57
  setCreateProgressHandler: handler => _sessionStorage['createProgressHandler'] = handler,
54
58
  getCreateProgressHandler: () => _sessionStorage['createProgressHandler'],
55
59
  setUpdateProgressHandler: handler => _sessionStorage['updateProgressHandler'] = handler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-lib",
3
- "version": "0.12.5",
3
+ "version": "0.12.7",
4
4
  "type": "commonjs",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.mjs",
@@ -16,7 +16,8 @@
16
16
  "test": "npx gulp && node --no-warnings --experimental-vm-modules --experimental-specifier-resolution=node node_modules/jest/bin/jest.js --silent",
17
17
  "test:debug": "npx gulp && node --no-warnings --experimental-vm-modules --experimental-specifier-resolution=node node_modules/jest/bin/jest.js --verbose=true --silent=false",
18
18
  "lint": "npx eslint --ext .ts --ignore-path .gitignore .",
19
- "build": "npx gulp"
19
+ "build": "npx gulp",
20
+ "watch": "npx gulp watch"
20
21
  },
21
22
  "jest": {
22
23
  "roots": [
@@ -0,0 +1,102 @@
1
+ interface ObjectSkeletonInterface {
2
+ _id: string;
3
+ _rev?: number;
4
+ [k: string]: string | number | ObjectSkeletonInterface;
5
+ }
6
+ export interface UiConfigInterface {
7
+ categories: string;
8
+ }
9
+ export interface NodeRefSkeletonInterface {
10
+ connections: Record<string, string>;
11
+ displayName: string;
12
+ nodeType: string;
13
+ x: number;
14
+ y: number;
15
+ }
16
+ export interface InnerNodeRefSkeletonInterface {
17
+ _id: string;
18
+ displayName: string;
19
+ nodeType: string;
20
+ }
21
+ export declare type TreeSkeleton = ObjectSkeletonInterface & {
22
+ entryNodeId: string;
23
+ nodes: Record<string, NodeRefSkeletonInterface>;
24
+ identityResource?: string;
25
+ uiConfig?: UiConfigInterface;
26
+ enabled?: boolean;
27
+ };
28
+ export declare type AmServiceType = ObjectSkeletonInterface & {
29
+ name: string;
30
+ };
31
+ export declare type NodeSkeleton = ObjectSkeletonInterface & {
32
+ _type: AmServiceType;
33
+ nodes?: InnerNodeRefSkeletonInterface[];
34
+ tree?: string;
35
+ identityResource?: string;
36
+ };
37
+ export declare type SocialIdpSkeleton = ObjectSkeletonInterface & {
38
+ _type: AmServiceType;
39
+ enabled: boolean;
40
+ };
41
+ export declare type EmailTemplateSkeleton = ObjectSkeletonInterface & {
42
+ defaultLocale?: string;
43
+ displayName?: string;
44
+ enabled?: boolean;
45
+ from: string;
46
+ subject: Record<string, string>;
47
+ };
48
+ export declare type ThemeSkeleton = ObjectSkeletonInterface & {
49
+ name: string;
50
+ isDefault: boolean;
51
+ linkedTrees: string[];
52
+ };
53
+ export declare enum ScriptLanguage {
54
+ GROOVY = "GROOVY",
55
+ JAVASCRIPT = "JAVASCRIPT"
56
+ }
57
+ export declare enum ScriptContext {
58
+ OAUTH2_ACCESS_TOKEN_MODIFICATION = "OAUTH2_ACCESS_TOKEN_MODIFICATION",
59
+ AUTHENTICATION_CLIENT_SIDE = "AUTHENTICATION_CLIENT_SIDE",
60
+ AUTHENTICATION_TREE_DECISION_NODE = "AUTHENTICATION_TREE_DECISION_NODE",
61
+ AUTHENTICATION_SERVER_SIDE = "AUTHENTICATION_SERVER_SIDE",
62
+ SOCIAL_IDP_PROFILE_TRANSFORMATION = "SOCIAL_IDP_PROFILE_TRANSFORMATION",
63
+ OAUTH2_VALIDATE_SCOPE = "OAUTH2_VALIDATE_SCOPE",
64
+ CONFIG_PROVIDER_NODE = "CONFIG_PROVIDER_NODE",
65
+ OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER = "OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER",
66
+ OAUTH2_EVALUATE_SCOPE = "OAUTH2_EVALUATE_SCOPE",
67
+ POLICY_CONDITION = "POLICY_CONDITION",
68
+ OIDC_CLAIMS = "OIDC_CLAIMS",
69
+ SAML2_IDP_ADAPTER = "SAML2_IDP_ADAPTER",
70
+ SAML2_IDP_ATTRIBUTE_MAPPER = "SAML2_IDP_ATTRIBUTE_MAPPER",
71
+ OAUTH2_MAY_ACT = "OAUTH2_MAY_ACT"
72
+ }
73
+ export declare type ScriptSkeleton = ObjectSkeletonInterface & {
74
+ name: string;
75
+ description: string;
76
+ isDefault: boolean;
77
+ script: string;
78
+ language: ScriptLanguage;
79
+ context: ScriptContext;
80
+ createdBy: string;
81
+ creationDate: number;
82
+ lastModifiedBy: string;
83
+ lastModifiedDate: number;
84
+ };
85
+ export declare enum Saml2ProiderLocation {
86
+ HOSTED = "hosted",
87
+ REMOTE = "remote"
88
+ }
89
+ export declare type Saml2ProviderSkeleton = ObjectSkeletonInterface & {
90
+ entityId: string;
91
+ entityLocation: Saml2ProiderLocation;
92
+ serviceProvider: unknown;
93
+ identityProvider: unknown;
94
+ attributeQueryProvider: unknown;
95
+ xacmlPolicyEnforcementPoint: unknown;
96
+ };
97
+ export declare type CircleOfTrustSkeleton = ObjectSkeletonInterface & {
98
+ _type: AmServiceType;
99
+ status: string;
100
+ trustedProviders: string[];
101
+ };
102
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/api/ApiTypes.ts"],"names":[],"mappings":"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","file":"ApiTypes.d.ts","sourcesContent":["interface ObjectSkeletonInterface {\n _id: string;\n _rev?: number;\n [k: string]: string | number | ObjectSkeletonInterface;\n}\n\nexport interface UiConfigInterface {\n categories: string;\n}\n\nexport interface NodeRefSkeletonInterface {\n connections: Record<string, string>;\n displayName: string;\n nodeType: string;\n x: number;\n y: number;\n}\n\nexport interface InnerNodeRefSkeletonInterface {\n _id: string;\n displayName: string;\n nodeType: string;\n}\n\nexport type TreeSkeleton = ObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = ObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type EmailTemplateSkeleton = ObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n};\n\nexport type ThemeSkeleton = ObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport enum ScriptLanguage {\n GROOVY = 'GROOVY',\n JAVASCRIPT = 'JAVASCRIPT',\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION = 'OAUTH2_ACCESS_TOKEN_MODIFICATION',\n AUTHENTICATION_CLIENT_SIDE = 'AUTHENTICATION_CLIENT_SIDE',\n AUTHENTICATION_TREE_DECISION_NODE = 'AUTHENTICATION_TREE_DECISION_NODE',\n AUTHENTICATION_SERVER_SIDE = 'AUTHENTICATION_SERVER_SIDE',\n SOCIAL_IDP_PROFILE_TRANSFORMATION = 'SOCIAL_IDP_PROFILE_TRANSFORMATION',\n OAUTH2_VALIDATE_SCOPE = 'OAUTH2_VALIDATE_SCOPE',\n CONFIG_PROVIDER_NODE = 'CONFIG_PROVIDER_NODE',\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER = 'OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER',\n OAUTH2_EVALUATE_SCOPE = 'OAUTH2_EVALUATE_SCOPE',\n POLICY_CONDITION = 'POLICY_CONDITION',\n OIDC_CLAIMS = 'OIDC_CLAIMS',\n SAML2_IDP_ADAPTER = 'SAML2_IDP_ADAPTER',\n SAML2_IDP_ATTRIBUTE_MAPPER = 'SAML2_IDP_ATTRIBUTE_MAPPER',\n OAUTH2_MAY_ACT = 'OAUTH2_MAY_ACT',\n}\n\nexport type ScriptSkeleton = ObjectSkeletonInterface & {\n name: string;\n description: string;\n isDefault: boolean;\n script: string;\n language: ScriptLanguage;\n context: ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\nexport enum Saml2ProiderLocation {\n HOSTED = 'hosted',\n REMOTE = 'remote',\n}\n\nexport type Saml2ProviderSkeleton = ObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n status: string;\n trustedProviders: string[];\n};\n"]}
@@ -5,7 +5,7 @@
5
5
  export declare function getProviders(): Promise<any>;
6
6
  /**
7
7
  * Find all providers matching the filter and return the requested fields
8
- * @param {string} filter CREST filter string, eg "entityId+eq+'${entityId}'"
8
+ * @param {string} filter CREST filter string, eg "entityId+eq+'${entityId}'" or "true" for all providers
9
9
  * @param {string} fields Comma-delimited list of fields to include in the response
10
10
  * @returns {Promise} a promise that resolves to an object containing an array of saml2 entities
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/Saml2Api.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,wBAAsB,YAAY,iBAUjC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,SAAS,EAAE,MAAM,SAAM,gBAYhE;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,gBAanB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,QAAQ,KAAA,gBAazC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,KAAA,UAO9C;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,KAAA,gBAQjD;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,QAAQ,KAAA,EAAE,YAAY,KAAA,EAAE,QAAQ,KAAA,gBA8BpE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,QAAQ,KAAA,EAAE,YAAY,KAAA,gBAgB1D","file":"Saml2Api.d.ts","sourcesContent":["import util from 'util';\nimport _ from 'lodash';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst providerByLocationAndIdURLTemplate = '%s/json%s/realm-config/saml2/%s/%s';\nconst createHostedProviderURLTemplate =\n '%s/json%s/realm-config/saml2/hosted/?_action=create';\nconst createRemoteProviderURLTemplate =\n '%s/json%s/realm-config/saml2/remote/?_action=importEntity';\nconst queryAllProvidersURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=true';\nconst queryProvidersByEntityIdURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=%s&_fields=%s';\nconst metadataByEntityIdURLTemplate =\n '%s/saml2/jsp/exportmetadata.jsp?entityid=%s&realm=%s';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/saml2`,\n apiVersion,\n };\n};\n\n/**\n * Get all SAML2 entity providers\n * @returns {Promise} a promise that resolves to an array of saml2 entity stubs\n */\nexport async function getProviders() {\n const urlString = util.format(\n queryAllProvidersURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Find all providers matching the filter and return the requested fields\n * @param {string} filter CREST filter string, eg \"entityId+eq+'${entityId}'\"\n * @param {string} fields Comma-delimited list of fields to include in the response\n * @returns {Promise} a promise that resolves to an object containing an array of saml2 entities\n */\nexport async function findProviders(filter = 'true', fields = '*') {\n const urlString = util.format(\n queryProvidersByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n encodeURIComponent(filter),\n fields\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Geta SAML2 entity provider by location and id\n * @param {string} location Entity provider location (hosted or remote)\n * @param {string} entityId64 Base64-encoded provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function getProviderByLocationAndId(\n location: string,\n entityId64: string\n) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n entityId64\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get SAML2 entity provider by entity id\n * @param {string} entityId Provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object or null\n */\nexport async function getProvider(entityId) {\n const response = await findProviders(`entityId eq '${entityId}'`, 'location');\n switch (response.resultCount) {\n case 0:\n throw new Error(`No provider with entity id '${entityId}' found`);\n case 1: {\n const { location } = response.result[0];\n const id = response.result[0]._id;\n return getProviderByLocationAndId(location, id);\n }\n default:\n throw new Error(`Multiple providers with entity id '${entityId}' found`);\n }\n}\n\n/**\n * Get a SAML2 entity provider's metadata URL by entity id\n * @param {string} entityId SAML2 entity id\n * @returns {string} the URL to get the metadata from\n */\nexport function getProviderMetadataUrl(entityId) {\n return util.format(\n metadataByEntityIdURLTemplate,\n storage.session.getTenant(),\n encodeURIComponent(entityId),\n storage.session.getRealm()\n );\n}\n\n/**\n * Get a SAML2 entity provider's metadata by entity id\n * @param {String} entityId SAML2 entity id\n * @returns {Promise} a promise that resolves to an object containing a SAML2 metadata\n */\nexport async function getProviderMetadata(entityId) {\n const { data } = await generateAmApi(getApiConfig()).get(\n getProviderMetadataUrl(entityId),\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Create a SAML2 entity provider\n * @param {String} location 'hosted' or 'remote'\n * @param {Object} providerData Object representing a SAML entity provider\n * @param {String} metaData Base64-encoded metadata XML. Only required for remote providers\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function createProvider(location, providerData, metaData) {\n let postData = _.cloneDeep(providerData);\n let urlString = util.format(\n createHostedProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n\n if (location === 'remote') {\n /**\n * Remote entity providers must be created using XML metadata\n */\n urlString = util.format(\n createRemoteProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n postData = {\n standardMetadata: metaData,\n };\n }\n\n const { data } = await generateAmApi(getApiConfig()).post(\n urlString,\n postData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Update SAML2 entity provider\n * @param {String} location Entity provider location (hosted or remote)\n * @param {Object} providerData Object representing a SAML entity provider\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function updateProvider(location, providerData) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n providerData._id\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n providerData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n"]}
1
+ {"version":3,"sources":["../src/api/Saml2Api.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,wBAAsB,YAAY,iBAUjC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,SAAS,EAAE,MAAM,SAAM,gBAYhE;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,gBAanB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,QAAQ,KAAA,gBAazC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,KAAA,UAO9C;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,KAAA,gBAQjD;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,QAAQ,KAAA,EAAE,YAAY,KAAA,EAAE,QAAQ,KAAA,gBA8BpE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,QAAQ,KAAA,EAAE,YAAY,KAAA,gBAgB1D","file":"Saml2Api.d.ts","sourcesContent":["import util from 'util';\nimport _ from 'lodash';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport storage from '../storage/SessionStorage';\n\nconst providerByLocationAndIdURLTemplate = '%s/json%s/realm-config/saml2/%s/%s';\nconst createHostedProviderURLTemplate =\n '%s/json%s/realm-config/saml2/hosted/?_action=create';\nconst createRemoteProviderURLTemplate =\n '%s/json%s/realm-config/saml2/remote/?_action=importEntity';\nconst queryAllProvidersURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=true';\nconst queryProvidersByEntityIdURLTemplate =\n '%s/json%s/realm-config/saml2?_queryFilter=%s&_fields=%s';\nconst metadataByEntityIdURLTemplate =\n '%s/saml2/jsp/exportmetadata.jsp?entityid=%s&realm=%s';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/saml2`,\n apiVersion,\n };\n};\n\n/**\n * Get all SAML2 entity providers\n * @returns {Promise} a promise that resolves to an array of saml2 entity stubs\n */\nexport async function getProviders() {\n const urlString = util.format(\n queryAllProvidersURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Find all providers matching the filter and return the requested fields\n * @param {string} filter CREST filter string, eg \"entityId+eq+'${entityId}'\" or \"true\" for all providers\n * @param {string} fields Comma-delimited list of fields to include in the response\n * @returns {Promise} a promise that resolves to an object containing an array of saml2 entities\n */\nexport async function findProviders(filter = 'true', fields = '*') {\n const urlString = util.format(\n queryProvidersByEntityIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n encodeURIComponent(filter),\n fields\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Geta SAML2 entity provider by location and id\n * @param {string} location Entity provider location (hosted or remote)\n * @param {string} entityId64 Base64-encoded provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function getProviderByLocationAndId(\n location: string,\n entityId64: string\n) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n entityId64\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get SAML2 entity provider by entity id\n * @param {string} entityId Provider entity id\n * @returns {Promise} a promise that resolves to a saml2 entity provider object or null\n */\nexport async function getProvider(entityId) {\n const response = await findProviders(`entityId eq '${entityId}'`, 'location');\n switch (response.resultCount) {\n case 0:\n throw new Error(`No provider with entity id '${entityId}' found`);\n case 1: {\n const { location } = response.result[0];\n const id = response.result[0]._id;\n return getProviderByLocationAndId(location, id);\n }\n default:\n throw new Error(`Multiple providers with entity id '${entityId}' found`);\n }\n}\n\n/**\n * Get a SAML2 entity provider's metadata URL by entity id\n * @param {string} entityId SAML2 entity id\n * @returns {string} the URL to get the metadata from\n */\nexport function getProviderMetadataUrl(entityId) {\n return util.format(\n metadataByEntityIdURLTemplate,\n storage.session.getTenant(),\n encodeURIComponent(entityId),\n storage.session.getRealm()\n );\n}\n\n/**\n * Get a SAML2 entity provider's metadata by entity id\n * @param {String} entityId SAML2 entity id\n * @returns {Promise} a promise that resolves to an object containing a SAML2 metadata\n */\nexport async function getProviderMetadata(entityId) {\n const { data } = await generateAmApi(getApiConfig()).get(\n getProviderMetadataUrl(entityId),\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Create a SAML2 entity provider\n * @param {String} location 'hosted' or 'remote'\n * @param {Object} providerData Object representing a SAML entity provider\n * @param {String} metaData Base64-encoded metadata XML. Only required for remote providers\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function createProvider(location, providerData, metaData) {\n let postData = _.cloneDeep(providerData);\n let urlString = util.format(\n createHostedProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n\n if (location === 'remote') {\n /**\n * Remote entity providers must be created using XML metadata\n */\n urlString = util.format(\n createRemoteProviderURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath()\n );\n postData = {\n standardMetadata: metaData,\n };\n }\n\n const { data } = await generateAmApi(getApiConfig()).post(\n urlString,\n postData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n\n/**\n * Update SAML2 entity provider\n * @param {String} location Entity provider location (hosted or remote)\n * @param {Object} providerData Object representing a SAML entity provider\n * @returns {Promise} a promise that resolves to a saml2 entity provider object\n */\nexport async function updateProvider(location, providerData) {\n const urlString = util.format(\n providerByLocationAndIdURLTemplate,\n storage.session.getTenant(),\n getCurrentRealmPath(),\n location,\n providerData._id\n );\n const { data } = await generateAmApi(getApiConfig()).put(\n urlString,\n providerData,\n {\n withCredentials: true,\n }\n );\n return data;\n}\n"]}
package/types/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export declare function getVersion(): string;
2
+ export * as TypesRaw from './api/ApiTypes';
2
3
  export * as NodeRaw from './api/NodeApi';
3
4
  export * as TreeRaw from './api/TreeApi';
4
5
  export * as StartupRaw from './api/StartupApi';
5
6
  export * as SecretsRaw from './api/SecretsApi';
6
7
  export * as VariablesRaw from './api/VariablesApi';
8
+ export * as Types from './ops/OpsTypes';
7
9
  export * as Admin from './ops/AdminOps';
8
10
  export * as Authenticate from './ops/AuthenticateOps';
9
11
  export * as CirclesOfTrust from './ops/CirclesOfTrustOps';
@@ -16,6 +18,7 @@ export * as Log from './ops/LogOps';
16
18
  export * as ManagedObject from './ops/ManagedObjectOps';
17
19
  export * as OAuth2Client from './ops/OAuth2ClientOps';
18
20
  export * as Organization from './ops/OrganizationOps';
21
+ export * as Node from './ops/NodeOps';
19
22
  export * as Realm from './ops/RealmOps';
20
23
  export * as Saml2 from './ops/Saml2Ops';
21
24
  export * as Script from './ops/ScriptOps';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAUA,wBAAgB,UAAU,WAEzB;AAGD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAG9C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAIlD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC","file":"index.d.ts","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')\n);\n\nexport function getVersion() {\n return `v${pkg.version}`;\n}\n\n// Api Layer\nexport * as NodeRaw from './api/NodeApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as SecretsRaw from './api/SecretsApi';\nexport * as VariablesRaw from './api/VariablesApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdpOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml2 from './ops/Saml2Ops';\nexport * as Script from './ops/ScriptOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAaA,wBAAgB,UAAU,WAEzB;AAGD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,aAAa,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAG9C,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAIlD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC","file":"index.d.ts","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport Color from 'colors';\n\nColor.enable();\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst pkg = JSON.parse(\n fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')\n);\n\nexport function getVersion() {\n return `v${pkg.version}`;\n}\n\n// Api Layer\nexport * as TypesRaw from './api/ApiTypes';\nexport * as NodeRaw from './api/NodeApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as StartupRaw from './api/StartupApi';\nexport * as SecretsRaw from './api/SecretsApi';\nexport * as VariablesRaw from './api/VariablesApi';\n\n// Ops Layer\nexport * as Types from './ops/OpsTypes';\nexport * as Admin from './ops/AdminOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Idp from './ops/IdpOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Log from './ops/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Node from './ops/NodeOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml2 from './ops/Saml2Ops';\nexport * as Script from './ops/ScriptOps';\nexport * as Secrets from './ops/SecretsOps';\nexport * as Startup from './ops/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Variables from './ops/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './storage/SessionStorage';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\n"]}
@@ -1,46 +1,23 @@
1
- interface SingleJourneyExportTemplate {
2
- meta?: Record<string, unknown>;
3
- innerNodes?: Record<string, unknown>;
4
- innernodes?: Record<string, unknown>;
5
- nodes?: Record<string, unknown>;
6
- scripts?: Record<string, unknown>;
7
- emailTemplates?: Record<string, unknown>;
8
- socialIdentityProviders?: Record<string, unknown>;
9
- themes?: unknown[];
10
- saml2Entities?: Record<string, unknown>;
11
- circlesOfTrust?: Record<string, unknown>;
12
- tree: Record<string, unknown>;
13
- }
14
- export declare function createSingleJourneyExportTemplate(): SingleJourneyExportTemplate;
15
- interface MultiJourneyExportTemplate {
16
- meta?: Record<string, unknown>;
17
- trees: Record<string, SingleJourneyExportTemplate>;
18
- }
19
- export declare function createMultiJourneyExportTemplate(): MultiJourneyExportTemplate;
20
- /**
21
- * Export options
22
- */
23
- interface ExportOptions {
24
- /**
25
- * Where applicable, use string arrays to store multi-line text (e.g. scripts).
26
- */
27
- useStringArrays: boolean;
28
- /**
29
- * Include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).
30
- */
31
- deps: boolean;
32
- /**
33
- * Verbose output during command execution. May or may not produce additional output.
34
- */
35
- verbose: boolean;
36
- }
1
+ import { JourneyClassification, TreeExportResolverInterface } from './OpsTypes';
2
+ import { InnerNodeRefSkeletonInterface, NodeRefSkeletonInterface, NodeSkeleton } from '../api/ApiTypes';
3
+ import { SingleTreeExportInterface, MultiTreeExportInterface, TreeDependencyMapInterface, TreeExportOptions, TreeImportOptions } from './OpsTypes';
4
+ /**
5
+ * Create an empty single tree export template
6
+ * @returns {SingleTreeExportInterface} an empty single tree export template
7
+ */
8
+ export declare function createSingleTreeExportTemplate(): SingleTreeExportInterface;
9
+ /**
10
+ * Create an empty multi tree export template
11
+ * @returns {MultiTreeExportInterface} an empty multi tree export template
12
+ */
13
+ export declare function createMultiTreeExportTemplate(): MultiTreeExportInterface;
37
14
  /**
38
15
  * Create export data for a tree/journey with all its nodes and dependencies. The export data can be written to a file as is.
39
16
  * @param {string} treeId tree id/name
40
- * @param {ExportOptions} options export options
41
- * @returns {Promise<SingleJourneyExportTemplate>} a promise that resolves to an object containing the tree and all its nodes and dependencies
17
+ * @param {TreeExportOptions} options export options
18
+ * @returns {Promise<SingleTreeExportInterface>} a promise that resolves to an object containing the tree and all its nodes and dependencies
42
19
  */
43
- export declare function exportJourney(treeId: string, options?: ExportOptions): Promise<SingleJourneyExportTemplate>;
20
+ export declare function exportJourney(treeId: string, options?: TreeExportOptions): Promise<SingleTreeExportInterface>;
44
21
  /**
45
22
  * Get all the journeys/trees without all their nodes and dependencies.
46
23
  * @returns {Promise<unknown[]>} a promise that resolves to an array of journey objects
@@ -50,72 +27,92 @@ export declare function getJourneys(): Promise<unknown[]>;
50
27
  * Export journey by id/name to file
51
28
  * @param {string} journeyId journey id/name
52
29
  * @param {string} file optional export file name
53
- * @param {ExportOptions} options export options
30
+ * @param {TreeExportOptions} options export options
54
31
  */
55
- export declare function exportJourneyToFile(journeyId: string, file: string, options: ExportOptions): Promise<void>;
32
+ export declare function exportJourneyToFile(journeyId: string, file: string, options: TreeExportOptions): Promise<void>;
56
33
  /**
57
34
  * Export all journeys to file
58
35
  * @param {string} file optional export file name
59
- * @param {ExportOptions} options export options
36
+ * @param {TreeExportOptions} options export options
60
37
  */
61
- export declare function exportJourneysToFile(file: string, options: ExportOptions): Promise<void>;
38
+ export declare function exportJourneysToFile(file: string, options?: TreeExportOptions): Promise<void>;
62
39
  /**
63
40
  * Export all journeys to separate files
64
- * @param {ExportOptions} options export options
65
- */
66
- export declare function exportJourneysToFiles(options: ExportOptions): Promise<void>;
67
- /**
68
- * Import options
69
- */
70
- interface ImportOptions {
71
- /**
72
- * Generate new UUIDs for all nodes during import.
73
- */
74
- reUuid: boolean;
75
- /**
76
- * Include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).
77
- */
78
- deps: boolean;
79
- /**
80
- * Verbose output during command execution. May or may not produce additional output.
81
- */
82
- verbose: boolean;
83
- }
41
+ * @param {TreeExportOptions} options export options
42
+ */
43
+ export declare function exportJourneysToFiles(options: TreeExportOptions): Promise<void>;
84
44
  /**
85
45
  * Helper to import a tree with all dependencies from an import data object (typically read from a file)
86
- * @param {SingleJourneyExportTemplate} treeObject tree object containing tree and all its dependencies
87
- * @param {ImportOptions} options import options
46
+ * @param {SingleTreeExportInterface} treeObject tree object containing tree and all its dependencies
47
+ * @param {TreeImportOptions} options import options
88
48
  */
89
- export declare function importJourney(treeObject: SingleJourneyExportTemplate, options: ImportOptions): Promise<void>;
49
+ export declare function importJourney(treeObject: SingleTreeExportInterface, options: TreeImportOptions): Promise<void>;
90
50
  /**
91
51
  * Import a journey from file
92
52
  * @param {string} journeyId journey id/name
93
53
  * @param {string} file import file name
94
- * @param {ImportOptions} options import options
54
+ * @param {TreeImportOptions} options import options
95
55
  */
96
- export declare function importJourneyFromFile(journeyId: string, file: string, options: ImportOptions): Promise<void>;
56
+ export declare function importJourneyFromFile(journeyId: string, file: string, options: TreeImportOptions): Promise<void>;
97
57
  /**
98
58
  * Import first journey from file
99
59
  * @param {string} file import file name
100
- * @param {ImportOptions} options import options
60
+ * @param {TreeImportOptions} options import options
101
61
  */
102
- export declare function importFirstJourneyFromFile(file: string, options: ImportOptions): Promise<void>;
62
+ export declare function importFirstJourneyFromFile(file: string, options: TreeImportOptions): Promise<void>;
103
63
  /**
104
64
  * Import all journeys from file
105
65
  * @param {string} file import file name
106
- * @param {ImportOptions} options import options
66
+ * @param {TreeImportOptions} options import options
107
67
  */
108
- export declare function importJourneysFromFile(file: string, options: ImportOptions): Promise<void>;
68
+ export declare function importJourneysFromFile(file: string, options: TreeImportOptions): Promise<void>;
109
69
  /**
110
70
  * Import all journeys from separate files
111
- * @param {ImportOptions} options import options
71
+ * @param {TreeImportOptions} options import options
72
+ */
73
+ export declare function importJourneysFromFiles(options: TreeImportOptions): Promise<void>;
74
+ /**
75
+ * Get the node reference obbject for a node object. Node reference objects
76
+ * are used in a tree flow definition and within page nodes to reference
77
+ * nodes. Among other things, node references contain all the non-configuration
78
+ * meta data that exists for readaility, like the x/y coordinates of the node
79
+ * and the display name chosen by the tree designer. The dislay name is the
80
+ * only intuitive link between the graphical representation of the tree and
81
+ * the node configurations that make up the tree.
82
+ * @param nodeObj node object to retrieve the node reference object for
83
+ * @param singleTreeExport tree export with or without dependencies
84
+ * @returns {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} node reference object
85
+ */
86
+ export declare function getNodeRef(nodeObj: NodeSkeleton, singleTreeExport: SingleTreeExportInterface): NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface;
87
+ /**
88
+ * Default tree export resolver used to resolve a tree id/name to a full export
89
+ * w/o dependencies of that tree from a platform instance.
90
+ * @param {string} treeId id/name of the tree to resolve
91
+ * @returns {TreeExportResolverInterface} tree export
92
+ */
93
+ export declare const onlineTreeExportResolver: TreeExportResolverInterface;
94
+ /**
95
+ * Tree export resolver used to resolve a tree id/name to a full export
96
+ * of that tree from individual `treename.journey.json` export files.
97
+ * @param {string} treeId id/name of the tree to resolve
98
+ * @returns {TreeExportResolverInterface} tree export
99
+ */
100
+ export declare const fileByIdTreeExportResolver: TreeExportResolverInterface;
101
+ /**
102
+ * Factory that creates a tree export resolver used to resolve a tree id
103
+ * to a full export of that tree from a multi-tree export file.
104
+ * @param {string} file multi-tree export file
105
+ * @returns {TreeExportResolverInterface} tree export resolver
112
106
  */
113
- export declare function importJourneysFromFiles(options: ImportOptions): Promise<void>;
107
+ export declare function createFileParamTreeExportResolver(file: string): TreeExportResolverInterface;
114
108
  /**
115
- * Describe a journey
116
- * @param {SingleJourneyExportTemplate} journeyData journey export object
109
+ * Get tree dependencies (all descendent inner trees)
110
+ * @param {SingleTreeExportInterface} treeExport single tree export
111
+ * @param {string[]} resolvedTreeIds list of tree ids wich have already been resolved
112
+ * @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function
113
+ * @returns {Promise<TreeDependencyMapInterface>} a promise that resolves to a tree dependency map
117
114
  */
118
- export declare function describeJourney(journeyData: SingleJourneyExportTemplate): void;
115
+ export declare function getTreeDescendents(treeExport: SingleTreeExportInterface, resolveTreeExport?: TreeExportResolverInterface, resolvedTreeIds?: string[]): Promise<TreeDependencyMapInterface>;
119
116
  /**
120
117
  * Find all node configuration objects that are no longer referenced by any tree
121
118
  * @returns {Promise<unknown[]>} a promise that resolves to an array of orphaned nodes
@@ -129,31 +126,31 @@ export declare function findOrphanedNodes(): Promise<unknown[]>;
129
126
  export declare function removeOrphanedNodes(orphanedNodes: unknown[]): Promise<unknown[]>;
130
127
  /**
131
128
  * Analyze if a journey contains any custom nodes considering the detected or the overridden version.
132
- * @param {SingleJourneyExportTemplate} journey Journey/tree configuration object
129
+ * @param {SingleTreeExportInterface} journey Journey/tree configuration object
133
130
  * @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
134
131
  */
135
- export declare function isCustomJourney(journey: SingleJourneyExportTemplate): boolean;
132
+ export declare function isCustomJourney(journey: SingleTreeExportInterface): boolean;
136
133
  /**
137
134
  * Analyze if a journey contains any premium nodes considering the detected or the overridden version.
138
- * @param {SingleJourneyExportTemplate} journey Journey/tree configuration object
135
+ * @param {SingleTreeExportInterface} journey Journey/tree configuration object
139
136
  * @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
140
137
  */
141
- export declare function isPremiumJourney(journey: SingleJourneyExportTemplate): boolean;
138
+ export declare function isPremiumJourney(journey: SingleTreeExportInterface): boolean;
142
139
  /**
143
140
  * Analyze if a journey contains any cloud-only nodes considering the detected or the overridden version.
144
- * @param {SingleJourneyExportTemplate} journey Journey/tree configuration object
141
+ * @param {SingleTreeExportInterface} journey Journey/tree configuration object
145
142
  * @returns {boolean} True if the journey/tree contains any cloud-only nodes, false otherwise.
146
143
  */
147
- export declare function isCloudOnlyJourney(journey: SingleJourneyExportTemplate): boolean;
144
+ export declare function isCloudOnlyJourney(journey: SingleTreeExportInterface): boolean;
148
145
  /**
149
146
  * Get a journey's classifications, which can be one or multiple of:
150
147
  * - standard: can run on any instance of a ForgeRock platform
151
148
  * - cloud: utilize nodes, which are exclusively available in the ForgeRock Identity Cloud
152
149
  * - premium: utilizes nodes, which come at a premium
153
- * @param {SingleJourneyExportTemplate} journey journey export data
154
- * @returns {string[]} an array of one or multiple classifications
150
+ * @param {SingleTreeExportInterface} journey journey export data
151
+ * @returns {JourneyClassification[]} an array of one or multiple classifications
155
152
  */
156
- export declare function getJourneyClassification(journey: SingleJourneyExportTemplate): string[];
153
+ export declare function getJourneyClassification(journey: SingleTreeExportInterface): JourneyClassification[];
157
154
  /**
158
155
  * List all the journeys/trees
159
156
  * @param {boolean} long Long version, all the fields
@@ -174,4 +171,3 @@ export declare function deleteJourney(journeyId: string, options: any, progress?
174
171
  * @param {Object} options deep=true also delete all the nodes and inner nodes, verbose=true print verbose info
175
172
  */
176
173
  export declare function deleteJourneys(options: any): Promise<{}>;
177
- export {};