Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions src/api/NodeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const nodeURLTemplate =
'%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s/%s';
const createNodeURLTemplate =
'%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_action=create';
const nodeSchemaURLTemplate =
'%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s?_action=schema';
const customNodeTypeURLTemplate = '%s/json/node-designer/node-type';
const queryAllCustomNodesURLTemplate =
customNodeTypeURLTemplate + '?_queryFilter=true';
Expand Down Expand Up @@ -256,6 +258,54 @@ export async function createNode({
return data;
}

/**
* Get node schema by type
* @param {string} nodeType node type
* @returns {Promise<NodeSkeleton>} a promise that resolves to a node object
*/
export async function getNodeSchema({
nodeType,
state,
}: {
nodeType: string;
state: State;
}): Promise<NodeSkeleton> {
const urlString = util.format(
nodeSchemaURLTemplate,
state.getHost(),
getCurrentRealmPath(state),
nodeType
);
const { data } = await generateAmApi({
resource: getNodeApiConfig(),
state,
}).post(
urlString,
{},
{
withCredentials: true,
// headers: { 'Accept-Encoding': 'gzip, deflate, br' },
}
);
return data;
}

/**
* Get custom node schema by service name
* @param {string} serviceName custom node service name (not the '_id' and without the 'designer-' prefix)
* @returns {Promise<NodeSkeleton>} a promise that resolves to a node object
*/
export async function getCustomNodeSchema({
serviceName,
state,
}: {
serviceName: string;
state: State;
}): Promise<NodeSkeleton> {
const nodeType = `designer-${serviceName}`;
return getNodeSchema({ nodeType, state });
}

/**
* Put node by uuid and type
* @param {string} nodeId node uuid
Expand Down
1 change: 1 addition & 0 deletions src/ops/ConfigOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ export async function importFullConfiguration({
importData: importData.global,
options: {
reUuid: reUuidCustomNodes,
wait: false,
},
resultCallback: errorCallback,
state,
Expand Down
12 changes: 10 additions & 2 deletions src/ops/JourneyOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1765,13 +1765,21 @@ export async function importJourney({
Object.entries(importData.nodeTypes).length > 0
) {
if (verbose)
printMessage({ message: ' - Custom Nodes:', newline: false, state });
printMessage({ message: '\n - Custom Nodes:', newline: false, state });
await importCustomNodes({
importData: importData as CustomNodeExportInterface,
options: {
reUuid: false,
wait: true,
},
resultCallback: (err) => {
resultCallback: (err, node) => {
if (verbose)
printMessage({
message: `\n - ${node['serviceName']} (${node['displayName']})`,
type: 'info',
newline: false,
state,
});
if (err) errors.push(err);
},
state,
Expand Down
Loading