Skip to content

Commit

Permalink
Fix: Importing forms, flows and flow connections dependencies (#1001)
Browse files Browse the repository at this point in the history
* Add order to processChanges methods in FlowVault, Flow, and Forms

* Remove account_name from create connection object in Flow Vault Connections

* update unit test Flow Vault Connections

* Add fields to strip for create and update operations for flow
  • Loading branch information
kushalshit27 authored Dec 16, 2024
1 parent 7c5c4a6 commit 8b22b42
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/tools/auth0/handlers/flowVaultConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PatchFlowsVaultConnectionsByIdRequest,
} from 'auth0';
import { isArray, isEmpty } from 'lodash';
import DefaultHandler from './default';
import DefaultHandler, { order } from './default';
import { Asset, Assets, CalculatedChanges } from '../../../types';
import constants from '../../constants';
import log from '../../../logger';
Expand Down Expand Up @@ -57,6 +57,7 @@ export default class FlowVaultHandler extends DefaultHandler {
return this.existing;
}

@order('50')
async processChanges(assets: Assets): Promise<void> {
const { flowVaultConnections } = assets;

Expand Down Expand Up @@ -124,6 +125,9 @@ export default class FlowVaultHandler extends DefaultHandler {
if ('ready' in conn) {
delete conn.ready;
}
if ('account_name' in conn) {
delete conn.account_name;
}
const { data: created } = await this.client.flows.createConnection(conn);
return created;
}
Expand Down
3 changes: 3 additions & 0 deletions src/tools/auth0/handlers/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export default class FlowHandler extends DefaultHandler {
...options,
type: 'flows',
id: 'id',
stripCreateFields: ['created_at', 'updated_at', 'executed_at'],
stripUpdateFields: ['created_at', 'updated_at', 'executed_at'],
});
}

Expand Down Expand Up @@ -69,6 +71,7 @@ export default class FlowHandler extends DefaultHandler {
return this.existing;
}

@order('60')
async processChanges(assets: Assets): Promise<void> {
const { flows } = assets;

Expand Down
3 changes: 2 additions & 1 deletion src/tools/auth0/handlers/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PostForms201Response,
} from 'auth0';
import dotProp from 'dot-prop';
import DefaultHandler from './default';
import DefaultHandler, { order } from './default';
import log from '../../../logger';
import { Asset, Assets, CalculatedChanges } from '../../../types';
import { paginate } from '../client';
Expand Down Expand Up @@ -128,6 +128,7 @@ export default class FormsHandler extends DefaultHandler {
return forms;
}

@order('70')
async processChanges(assets: Assets): Promise<void> {
const { forms } = assets;

Expand Down
1 change: 1 addition & 0 deletions test/tools/auth0/handlers/flowVaultConnections.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const sampleFlowVaultConnections = {
id: 'ac_9AXxPP59pJx5ZtA471cSAy',
name: 'Sample Connection',
app_id: 'HTTP',
account_name: 'Sample Account name',
ready: false,
};

Expand Down

0 comments on commit 8b22b42

Please sign in to comment.