@rockcarver/frodo-lib
Version:
A library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.
548 lines • 25.9 kB
TypeScript
import { type CircleOfTrustSkeleton } from '../api/CirclesOfTrustApi';
import { type InnerNodeRefSkeletonInterface, type NodeRefSkeletonInterface, type NodeSkeleton } from '../api/NodeApi';
import { type Saml2ProviderSkeleton } from '../api/Saml2Api';
import { type ScriptSkeleton } from '../api/ScriptApi';
import { type SocialIdpSkeleton } from '../api/SocialIdentityProvidersApi';
import { type TreeSkeleton } from '../api/TreeApi';
import { State } from '../shared/State';
import { type EmailTemplateSkeleton } from './EmailTemplateOps';
import { type ExportMetaData } from './OpsTypes';
import { type ThemeSkeleton } from './ThemeOps';
export type Journey = {
/**
* Create an empty single tree export template
* @returns {SingleTreeExportInterface} an empty single tree export template
*/
createSingleTreeExportTemplate(): SingleTreeExportInterface;
/**
* Create an empty multi tree export template
* @returns {MultiTreeExportInterface} an empty multi tree export template
*/
createMultiTreeExportTemplate(): MultiTreeExportInterface;
/**
* Create export data for a tree/journey with all its nodes and dependencies. The export data can be written to a file as is.
* @param {string} treeId tree id/name
* @param {TreeExportOptions} options export options
* @returns {Promise<SingleTreeExportInterface>} a promise that resolves to an object containing the tree and all its nodes and dependencies
*/
exportJourney(treeId: string, options?: TreeExportOptions): Promise<SingleTreeExportInterface>;
/**
* Create export data for all trees/journeys with all their nodes and dependencies. The export data can be written to a file as is.
* @param {TreeExportOptions} options export options
* @returns {Promise<MultiTreeExportInterface>} a promise that resolves to an object containing the trees and all their nodes and dependencies
*/
exportJourneys(options?: TreeExportOptions): Promise<MultiTreeExportInterface>;
/**
* Read all journeys without dependencies.
* @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array of journey objects
*/
readJourneys(): Promise<TreeSkeleton[]>;
/**
* Read journey without dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
readJourney(journeyId: string): Promise<TreeSkeleton>;
/**
* Create journey without dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
createJourney(journeyId: string, journeyData: TreeSkeleton): Promise<TreeSkeleton>;
/**
* Update journey without dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
updateJourney(journeyId: string, journeyData: TreeSkeleton): Promise<TreeSkeleton>;
/**
* Import journey
* @param {SingleTreeExportInterface} treeObject tree object containing tree and all its dependencies
* @param {TreeImportOptions} options import options
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
importJourney(treeObject: SingleTreeExportInterface, options: TreeImportOptions): Promise<TreeSkeleton>;
/**
* Resolve journey dependencies
* @param {string[]} installedJorneys Map of installed journeys
* @param {Record<string, SingleTreeExportInterface>} journeyMap Map of journeys to resolve dependencies for
* @param {string[]} unresolvedJourneys Map to hold the names of unresolved journeys and their dependencies
* @param {string[]} resolvedJourneys Array to hold the names of resolved journeys
* @param {int} index Depth of recursion
*/
resolveDependencies(installedJorneys: any, journeyMap: any, unresolvedJourneys: any, resolvedJourneys: any, index?: number): Promise<void>;
/**
* Import journeys
* @param {MultiTreeExportInterface} importData map of trees object
* @param {TreeImportOptions} options import options
*/
importJourneys(importData: MultiTreeExportInterface, options: TreeImportOptions): Promise<TreeSkeleton[]>;
/**
* Get the node reference obbject for a node object. Node reference objects
* are used in a tree flow definition and within page nodes to reference
* nodes. Among other things, node references contain all the non-configuration
* meta data that exists for readaility, like the x/y coordinates of the node
* and the display name chosen by the tree designer. The dislay name is the
* only intuitive link between the graphical representation of the tree and
* the node configurations that make up the tree.
* @param nodeObj node object to retrieve the node reference object for
* @param singleTreeExport tree export with or without dependencies
* @returns {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} node reference object
*/
getNodeRef(nodeObj: NodeSkeleton, singleTreeExport: SingleTreeExportInterface): NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface;
/**
* Default tree export resolver used to resolve a tree id/name to a full export
* w/o dependencies of that tree from a platform instance.
* @param {string} treeId id/name of the tree to resolve
* @returns {TreeExportResolverInterface} tree export
*/
onlineTreeExportResolver: TreeExportResolverInterface;
/**
* Tree export resolver used to resolve a tree id/name to a full export
* of that tree from individual `treename.journey.json` export files.
* @param {string} treeId id/name of the tree to resolve
* @returns {TreeExportResolverInterface} tree export
*/
fileByIdTreeExportResolver: TreeExportResolverInterface;
/**
* Factory that creates a tree export resolver used to resolve a tree id
* to a full export of that tree from a multi-tree export file.
* @param {string} file multi-tree export file
* @returns {TreeExportResolverInterface} tree export resolver
*/
createFileParamTreeExportResolver(file: string): TreeExportResolverInterface;
/**
* Get tree dependencies (all descendent inner trees)
* @param {SingleTreeExportInterface} treeExport single tree export
* @param {string[]} resolvedTreeIds list of tree ids wich have already been resolved
* @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function
* @returns {Promise<TreeDependencyMapInterface>} a promise that resolves to a tree dependency map
*/
getTreeDescendents(treeExport: SingleTreeExportInterface, resolveTreeExport: TreeExportResolverInterface, resolvedTreeIds?: string[]): Promise<TreeDependencyMapInterface>;
/**
* Analyze if a journey contains any custom nodes considering the detected or the overridden version.
* @param {SingleTreeExportInterface} journey Journey/tree configuration object
* @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
*/
isCustomJourney(journey: SingleTreeExportInterface): boolean;
/**
* Analyze if a journey contains any premium nodes considering the detected or the overridden version.
* @param {SingleTreeExportInterface} journey Journey/tree configuration object
* @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
*/
isPremiumJourney(journey: SingleTreeExportInterface): boolean;
/**
* Analyze if a journey contains any cloud-only nodes considering the detected or the overridden version.
* @param {SingleTreeExportInterface} journey Journey/tree configuration object
* @returns {boolean} True if the journey/tree contains any cloud-only nodes, false otherwise.
*/
isCloudOnlyJourney(journey: SingleTreeExportInterface): boolean;
/**
* Get a journey's classifications, which can be one or multiple of:
* - standard: can run on any instance of a ForgeRock platform
* - cloud: utilize nodes, which are exclusively available in the ForgeRock Identity Cloud
* - premium: utilizes nodes, which come at a premium
* - custom: utilizes nodes not included in the ForgeRock platform release
* @param {SingleTreeExportInterface} journey journey export data
* @returns {JourneyClassificationType[]} an array of one or multiple classifications
*/
getJourneyClassification(journey: SingleTreeExportInterface): JourneyClassificationType[];
/**
* Delete a journey
* @param {string} journeyId journey id/name
* @param {Object} options deep=true also delete all the nodes and inner nodes, verbose=true print verbose info
*/
deleteJourney(journeyId: string, options: {
deep: boolean;
verbose: boolean;
progress?: boolean;
}): Promise<DeleteJourneyStatus>;
/**
* Delete all journeys
* @param {Object} options deep=true also delete all the nodes and inner nodes, verbose=true print verbose info
*/
deleteJourneys(options: {
deep: boolean;
verbose: boolean;
}): Promise<DeleteJourneysStatus>;
/**
* Enable a journey
* @param journeyId journey id/name
* @returns {Promise<TreeSkeleton>} the updated tree/journey object
*/
enableJourney(journeyId: string): Promise<TreeSkeleton>;
/**
* Disable a journey
* @param journeyId journey id/name
* @returns {Promise<TreeSkeleton>} the updated tree/journey object
*/
disableJourney(journeyId: string): Promise<TreeSkeleton>;
/**
* Get all the journeys/trees without all their nodes and dependencies.
* @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array of journey objects
* @deprecated since v2.0.0 use {@link Journey.readJourneys | readJourneys} instead
* ```javascript
* readJourneys(): Promise<TreeSkeleton[]>
* ```
* @group Deprecated
*/
getJourneys(): Promise<TreeSkeleton[]>;
/**
* Get a journey/tree without all its nodes and dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
* @deprecated since v2.0.0 use {@link Journey.readJourney | readJourney} instead
* ```javascript
* readJourney(journeyId: string): Promise<TreeSkeleton>
* ```
* @group Deprecated
*/
getJourney(journeyId: string): Promise<TreeSkeleton>;
/**
* Import journeys
* @param {MultiTreeExportInterface} importData map of trees object
* @param {TreeImportOptions} options import options
* @deprecated since v2.0.0 use {@link Journey.importJourneys | importJourneys} instead
* ```javascript
* importJourneys(importData: MultiTreeExportInterface, options: TreeImportOptions): Promise<TreeSkeleton[]>
* ```
* @group Deprecated
*/
importAllJourneys(importData: MultiTreeExportInterface, options: TreeImportOptions): Promise<TreeSkeleton[]>;
/**
* Find all node configuration objects that are no longer referenced by any tree
* @returns {Promise<NodeSkeleton[]>} a promise that resolves to an array of orphaned nodes
* @deprecated since v2.0.0 use {@link Node.findOrphanedNodes | findOrphanedNodes} in the {@link Node} module instead
* @group Deprecated
*/
findOrphanedNodes(): Promise<NodeSkeleton[]>;
/**
* Remove orphaned nodes
* @param {NodeSkeleton[]} orphanedNodes Pass in an array of orphaned node configuration objects to remove
* @returns {Promise<NodeSkeleton[]>} a promise that resolves to an array nodes that encountered errors deleting
* @deprecated since v2.0.0 use {@link Node.removeOrphanedNodes | removeOrphanedNodes} in the {@link Node} module instead
* @group Deprecated
*/
removeOrphanedNodes(orphanedNodes: NodeSkeleton[]): Promise<NodeSkeleton[]>;
};
declare const _default: (state: State) => Journey;
export default _default;
/**
* Tree export options
*/
export interface TreeExportOptions {
/**
* Where applicable, use string arrays to store multi-line text (e.g. scripts).
*/
useStringArrays: boolean;
/**
* Include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).
*/
deps: boolean;
/**
* Include x and y coordinate positions of the journey/tree nodes.
*/
coords: boolean;
}
/**
* Tree import options
*/
export interface TreeImportOptions {
/**
* Generate new UUIDs for all nodes during import.
*/
reUuid: boolean;
/**
* Include any dependencies (scripts, email templates, SAML entity providers and circles of trust, social identity providers, themes).
*/
deps: boolean;
}
export interface SingleTreeExportInterface {
meta?: ExportMetaData;
innerNodes?: Record<string, NodeSkeleton>;
innernodes?: Record<string, NodeSkeleton>;
nodes: Record<string, NodeSkeleton>;
scripts: Record<string, ScriptSkeleton>;
emailTemplates: Record<string, EmailTemplateSkeleton>;
socialIdentityProviders: Record<string, SocialIdpSkeleton>;
themes: ThemeSkeleton[];
saml2Entities: Record<string, Saml2ProviderSkeleton>;
circlesOfTrust: Record<string, CircleOfTrustSkeleton>;
tree: TreeSkeleton;
}
export interface MultiTreeExportInterface {
meta?: ExportMetaData;
trees: Record<string, SingleTreeExportInterface>;
}
export type JourneyClassificationType = 'standard' | 'custom' | 'cloud' | 'premium';
export declare enum JourneyClassification {
STANDARD = "standard",
CUSTOM = "custom",
CLOUD = "cloud",
PREMIUM = "premium"
}
export interface TreeDependencyMapInterface {
[k: string]: TreeDependencyMapInterface[];
}
export interface TreeExportResolverInterface {
(treeId: string, state: State): Promise<SingleTreeExportInterface>;
}
export declare function hasScriptDependency(nodeConfig: NodeSkeleton): boolean;
/**
* Updates coordinates of the nodes in a tree to the same as the nodes on the server if the nodes on the tree do not exist.
* @param {TreeSkeleton} tree The tree being imported
* @param {string} nodesAttributeName The name (key) of the attribute on the tree that has nodes
* @param {TreeSkeleton} serverTree The current tree on the server
* @returns {TreeSkeleton} The current tree on the server
*/
export declare function updateCoordinates({ tree, nodesAttributeName, serverTree, state, }: {
tree: TreeSkeleton;
nodesAttributeName: string;
serverTree: TreeSkeleton | null;
state: State;
}): Promise<TreeSkeleton | null>;
/**
* Create export data for a tree/journey with all its nodes and dependencies. The export data can be written to a file as is.
* @param {string} journeyId journey id/name
* @param {TreeExportOptions} options export options
* @returns {Promise<SingleTreeExportInterface>} a promise that resolves to an object containing the tree and all its nodes and dependencies
*/
export declare function exportJourney({ journeyId, options, state, }: {
journeyId: string;
options?: TreeExportOptions;
state: State;
}): Promise<SingleTreeExportInterface>;
/**
* Create export data for all trees/journeys with all their nodes and dependencies. The export data can be written to a file as is.
* @param {TreeExportOptions} options export options
* @returns {Promise<MultiTreeExportInterface>} a promise that resolves to an object containing the trees and all their nodes and dependencies
*/
export declare function exportJourneys({ options, state, }: {
options?: TreeExportOptions;
state: State;
}): Promise<MultiTreeExportInterface>;
/**
* Get all the journeys/trees without all their nodes and dependencies.
* @returns {Promise<TreeSkeleton[]>} a promise that resolves to an array of journey objects
*/
export declare function readJourneys({ state, }: {
state: State;
}): Promise<TreeSkeleton[]>;
/**
* Get a journey/tree without all its nodes and dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
export declare function readJourney({ journeyId, state, }: {
journeyId: string;
state: State;
}): Promise<TreeSkeleton>;
/**
* Create journey without dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
export declare function createJourney({ journeyId, journeyData, state, }: {
journeyId: string;
journeyData: TreeSkeleton;
state: State;
}): Promise<TreeSkeleton>;
/**
* Update or create journey without dependencies.
* @param {string} journeyId journey id/name
* @returns {Promise<TreeSkeleton>} a promise that resolves to a journey object
*/
export declare function updateJourney({ journeyId, journeyData, state, }: {
journeyId: string;
journeyData: TreeSkeleton;
state: State;
}): Promise<TreeSkeleton>;
/**
* Import a tree with all dependencies from a `SingleTreeExportInterface` object (typically read from a file)
* @param {SingleTreeExportInterface} importData tree object containing tree and all its dependencies
* @param {TreeImportOptions} options import options
* @returns {Promise<TreeSkeleton>} a promise that resolves to true if no errors occurred during import
*/
export declare function importJourney({ importData, options, state, }: {
importData: SingleTreeExportInterface;
options: TreeImportOptions;
state: State;
}): Promise<TreeSkeleton>;
/**
* Resolve inner tree dependencies
* @param {string[]} existingJorneys Array of existing journey names
* @param {MultiTreeExportInterface} candidateJourneys Map of journeys to resolve dependencies for
* @param {{ [k: string]: string[] }} unresolvedJourneys Map of unresolved journey names and their dependencies
* @param {string[]} resolvedJourneys Array of resolved journey names
* @param {number} index Depth of recursion
* @returns {Promise<{unresolvedJourneys: { [k: string]: string[] }; resolvedJourneys: string[];}>} a promise resolving to a dependency status object
*/
export declare function resolveInnerTreeDependencies({ existingJorneys, candidateJourneys, unresolvedJourneys, resolvedJourneys, index, }: {
existingJorneys: string[];
candidateJourneys: MultiTreeExportInterface;
unresolvedJourneys?: {
[k: string]: string[];
};
resolvedJourneys?: string[];
index?: number;
}): Promise<{
unresolvedJourneys: {
[k: string]: string[];
};
resolvedJourneys: string[];
}>;
/**
* Resolve journey dependencies
* @param {string[]} installedJorneys Map of installed journeys
* @param {Record<string, SingleTreeExportInterface>} journeyMap Map of journeys to resolve dependencies for
* @param {string[]} unresolvedJourneys Map to hold the names of unresolved journeys and their dependencies
* @param {string[]} resolvedJourneys Array to hold the names of resolved journeys
* @param {number} index Depth of recursion
*/
export declare function resolveDependencies(installedJorneys: string[], journeyMap: Record<string, SingleTreeExportInterface>, unresolvedJourneys: {
[k: string]: string[];
}, resolvedJourneys: string[], index?: number): Promise<void>;
/**
* Import journeys
* @param {MultiTreeExportInterface} importData map of trees object
* @param {TreeImportOptions} options import options
*/
export declare function importJourneys({ importData, options, state, }: {
importData: MultiTreeExportInterface;
options: TreeImportOptions;
state: State;
}): Promise<TreeSkeleton[]>;
/**
* Get the node reference obbject for a node object. Node reference objects
* are used in a tree flow definition and within page nodes to reference
* nodes. Among other things, node references contain all the non-configuration
* meta data that exists for readaility, like the x/y coordinates of the node
* and the display name chosen by the tree designer. The dislay name is the
* only intuitive link between the graphical representation of the tree and
* the node configurations that make up the tree.
* @param nodeObj node object to retrieve the node reference object for
* @param singleTreeExport tree export with or without dependencies
* @returns {NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface} node reference object
*/
export declare function getNodeRef(nodeObj: NodeSkeleton, singleTreeExport: SingleTreeExportInterface): NodeRefSkeletonInterface | InnerNodeRefSkeletonInterface;
/**
* Default tree export resolver used to resolve a tree id/name to a full export
* w/o dependencies of that tree from a platform instance.
* @param {string} treeId id/name of the tree to resolve
* @returns {TreeExportResolverInterface} tree export
*/
export declare const onlineTreeExportResolver: TreeExportResolverInterface;
/**
* Tree export resolver used to resolve a tree id/name to a full export
* of that tree from individual `treename.journey.json` export files.
* @param {string} treeId id/name of the tree to resolve
* @returns {TreeExportResolverInterface} tree export
*/
export declare const fileByIdTreeExportResolver: TreeExportResolverInterface;
/**
* Factory that creates a tree export resolver used to resolve a tree id
* to a full export of that tree from a multi-tree export file.
* @param {string} file multi-tree export file
* @returns {TreeExportResolverInterface} tree export resolver
*/
export declare function createFileParamTreeExportResolver(file: string, state: State): TreeExportResolverInterface;
/**
* Get tree dependencies (all descendent inner trees)
* @param {SingleTreeExportInterface} treeExport single tree export
* @param {string[]} resolvedTreeIds list of tree ids wich have already been resolved
* @param {TreeExportResolverInterface} resolveTreeExport tree export resolver callback function
* @returns {Promise<TreeDependencyMapInterface>} a promise that resolves to a tree dependency map
*/
export declare function getTreeDescendents({ treeExport, resolveTreeExport, resolvedTreeIds, state, }: {
treeExport: SingleTreeExportInterface;
resolveTreeExport: TreeExportResolverInterface;
resolvedTreeIds: string[];
state: State;
}): Promise<TreeDependencyMapInterface>;
/**
* Analyze if a journey contains any custom nodes considering the detected or the overridden version.
* @param {SingleTreeExportInterface} journey Journey/tree configuration object
* @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
*/
export declare function isCustomJourney({ journey, state, }: {
journey: SingleTreeExportInterface;
state: State;
}): boolean;
/**
* Analyze if a journey contains any premium nodes considering the detected or the overridden version.
* @param {SingleTreeExportInterface} journey Journey/tree configuration object
* @returns {boolean} True if the journey/tree contains any custom nodes, false otherwise.
*/
export declare function isPremiumJourney(journey: SingleTreeExportInterface): boolean;
/**
* Analyze if a journey contains any cloud-only nodes considering the detected or the overridden version.
* @param {SingleTreeExportInterface} journey Journey/tree configuration object
* @returns {boolean} True if the journey/tree contains any cloud-only nodes, false otherwise.
*/
export declare function isCloudOnlyJourney(journey: SingleTreeExportInterface): boolean;
/**
* Get a journey's classifications, which can be one or multiple of:
* - standard: can run on any instance of a ForgeRock platform
* - cloud: utilize nodes, which are exclusively available in the ForgeRock Identity Cloud
* - premium: utilizes nodes, which come at a premium
* - custom: utilizes nodes not included in the ForgeRock platform release
* @param {SingleTreeExportInterface} journey journey export data
* @returns {JourneyClassification[]} an array of one or multiple classifications
*/
export declare function getJourneyClassification({ journey, state, }: {
journey: SingleTreeExportInterface;
state: State;
}): JourneyClassificationType[];
export type DeleteJourneyStatus = {
status: string;
nodes: {
status?: string;
};
};
/**
* Delete a journey
* @param {string} journeyId journey id/name
* @param {Object} options deep=true also delete all the nodes and inner nodes, verbose=true print verbose info
*/
export declare function deleteJourney({ journeyId, options, state, }: {
journeyId: string;
options: {
deep: boolean;
verbose: boolean;
progress?: boolean;
};
state: State;
}): Promise<DeleteJourneyStatus>;
export type DeleteJourneysStatus = {
[k: string]: DeleteJourneyStatus;
};
/**
* Delete all journeys
* @param {Object} options deep=true also delete all the nodes and inner nodes, verbose=true print verbose info
*/
export declare function deleteJourneys({ options, state, }: {
options?: {
deep: boolean;
verbose: boolean;
};
state: State;
}): Promise<DeleteJourneysStatus>;
/**
* Enable a journey
* @param journeyId journey id/name
* @returns {Promise<TreeSkeleton>} updated tree/journey object
*/
export declare function enableJourney({ journeyId, state, }: {
journeyId: string;
state: State;
}): Promise<TreeSkeleton>;
/**
* Disable a journey
* @param journeyId journey id/name
* @returns {Promise<TreeSkeleton>} true if the operation was successful, false otherwise
*/
export declare function disableJourney({ journeyId, state, }: {
journeyId: string;
state: State;
}): Promise<TreeSkeleton>;
//# sourceMappingURL=JourneyOps.d.ts.map