@activepieces/shared 0.18.4 → 0.18.5
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/package.json +1 -1
- package/src/lib/ai/ai-sdk.d.ts +1 -0
- package/src/lib/flows/flow-version.d.ts +1 -1
- package/src/lib/flows/flow-version.js +1 -1
- package/src/lib/flows/operations/migrations/index.js +2 -0
- package/src/lib/flows/operations/migrations/index.js.map +1 -1
- package/src/lib/flows/operations/migrations/migrate-v5-http-to-webhook.d.ts +2 -0
- package/src/lib/flows/operations/migrations/migrate-v5-http-to-webhook.js +42 -0
- package/src/lib/flows/operations/migrations/migrate-v5-http-to-webhook.js.map +1 -0
package/package.json
CHANGED
package/src/lib/ai/ai-sdk.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Static } from '@sinclair/typebox';
|
|
2
2
|
import { ApId } from '../common/id-generator';
|
|
3
3
|
export type FlowVersionId = ApId;
|
|
4
|
-
export declare const LATEST_SCHEMA_VERSION = "
|
|
4
|
+
export declare const LATEST_SCHEMA_VERSION = "6";
|
|
5
5
|
export declare enum FlowVersionState {
|
|
6
6
|
LOCKED = "LOCKED",
|
|
7
7
|
DRAFT = "DRAFT"
|
|
@@ -5,7 +5,7 @@ const typebox_1 = require("@sinclair/typebox");
|
|
|
5
5
|
const base_model_1 = require("../common/base-model");
|
|
6
6
|
const user_1 = require("../user");
|
|
7
7
|
const trigger_1 = require("./triggers/trigger");
|
|
8
|
-
exports.LATEST_SCHEMA_VERSION = '
|
|
8
|
+
exports.LATEST_SCHEMA_VERSION = '6';
|
|
9
9
|
var FlowVersionState;
|
|
10
10
|
(function (FlowVersionState) {
|
|
11
11
|
FlowVersionState["LOCKED"] = "LOCKED";
|
|
@@ -6,12 +6,14 @@ const migrate_v1_connection_ids_1 = require("./migrate-v1-connection-ids");
|
|
|
6
6
|
const migrate_v2_agent_piece_1 = require("./migrate-v2-agent-piece");
|
|
7
7
|
const migrate_v3_agent_piece_1 = require("./migrate-v3-agent-piece");
|
|
8
8
|
const migrate_v4_agent_piece_1 = require("./migrate-v4-agent-piece");
|
|
9
|
+
const migrate_v5_http_to_webhook_1 = require("./migrate-v5-http-to-webhook");
|
|
9
10
|
const migrations = [
|
|
10
11
|
migrate_v0_branch_to_router_1.migrateBranchToRouter,
|
|
11
12
|
migrate_v1_connection_ids_1.migrateConnectionIds,
|
|
12
13
|
migrate_v2_agent_piece_1.migrateAgentPieceV2,
|
|
13
14
|
migrate_v3_agent_piece_1.migrateAgentPieceV3,
|
|
14
15
|
migrate_v4_agent_piece_1.migrateAgentPieceV4,
|
|
16
|
+
migrate_v5_http_to_webhook_1.migrateHttpToWebhookV5,
|
|
15
17
|
];
|
|
16
18
|
const apply = (flowVersion) => {
|
|
17
19
|
return migrations.reduce((acc, migration) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/src/lib/flows/operations/migrations/index.ts"],"names":[],"mappings":";;;AACA,+EAAqE;AACrE,2EAAkE;AAClE,qEAA8D;AAC9D,qEAA8D;AAC9D,qEAA8D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/src/lib/flows/operations/migrations/index.ts"],"names":[],"mappings":";;;AACA,+EAAqE;AACrE,2EAAkE;AAClE,qEAA8D;AAC9D,qEAA8D;AAC9D,qEAA8D;AAC9D,6EAAqE;AAOrE,MAAM,UAAU,GAAgB;IAC5B,mDAAqB;IACrB,gDAAoB;IACpB,4CAAmB;IACnB,4CAAmB;IACnB,4CAAmB;IACnB,mDAAsB;CACzB,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,WAAwB,EAAE,EAAE;IACvC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;QACxC,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,mBAAmB,EAAE,CAAC;YACtD,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjC,CAAC;QACD,OAAO,GAAG,CAAA;IACd,CAAC,EAAE,WAAW,CAAC,CAAA;AACnB,CAAC,CAAA;AAEY,QAAA,cAAc,GAAG;IAC1B,KAAK;CACR,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateHttpToWebhookV5 = void 0;
|
|
4
|
+
const action_1 = require("../../actions/action");
|
|
5
|
+
const flow_structure_util_1 = require("../../util/flow-structure-util");
|
|
6
|
+
const HTTP_PIECE_NAME = '@activepieces/piece-http';
|
|
7
|
+
const WEBHOOK_PIECE_NAME = '@activepieces/piece-webhook';
|
|
8
|
+
const HTTP_RETURN_RESPONSE_ACTION = 'return_response';
|
|
9
|
+
const WEBHOOK_RETURN_RESPONSE_ACTION = 'return_response';
|
|
10
|
+
exports.migrateHttpToWebhookV5 = {
|
|
11
|
+
targetSchemaVersion: '5',
|
|
12
|
+
migrate: (flowVersion) => {
|
|
13
|
+
const newVersion = flow_structure_util_1.flowStructureUtil.transferFlow(flowVersion, (step) => {
|
|
14
|
+
if (step.type === action_1.FlowActionType.PIECE &&
|
|
15
|
+
step.settings.pieceName === HTTP_PIECE_NAME &&
|
|
16
|
+
step.settings.actionName === HTTP_RETURN_RESPONSE_ACTION) {
|
|
17
|
+
const httpInput = step.settings.input || {};
|
|
18
|
+
const fields = {};
|
|
19
|
+
if (httpInput['body'] && typeof httpInput['body'] === 'object' && 'data' in httpInput['body']) {
|
|
20
|
+
fields['body'] = httpInput['body']['data'];
|
|
21
|
+
}
|
|
22
|
+
if (httpInput['status'] !== undefined) {
|
|
23
|
+
fields['status'] = httpInput['status'];
|
|
24
|
+
}
|
|
25
|
+
if (httpInput['headers']) {
|
|
26
|
+
fields['headers'] = httpInput['headers'];
|
|
27
|
+
}
|
|
28
|
+
const webhookInput = {
|
|
29
|
+
respond: 'stop',
|
|
30
|
+
responseType: httpInput['body_type'] || 'json',
|
|
31
|
+
fields,
|
|
32
|
+
};
|
|
33
|
+
return Object.assign(Object.assign({}, step), { settings: Object.assign(Object.assign({}, step.settings), { pieceName: WEBHOOK_PIECE_NAME, pieceVersion: '0.1.20', actionName: WEBHOOK_RETURN_RESPONSE_ACTION, input: webhookInput, inputUiInfo: {
|
|
34
|
+
customizedInputs: {},
|
|
35
|
+
} }) });
|
|
36
|
+
}
|
|
37
|
+
return step;
|
|
38
|
+
});
|
|
39
|
+
return Object.assign(Object.assign({}, newVersion), { schemaVersion: '6' });
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=migrate-v5-http-to-webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-v5-http-to-webhook.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/src/lib/flows/operations/migrations/migrate-v5-http-to-webhook.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AAErD,wEAAkE;AAGlE,MAAM,eAAe,GAAG,0BAA0B,CAAA;AAClD,MAAM,kBAAkB,GAAG,6BAA6B,CAAA;AACxD,MAAM,2BAA2B,GAAG,iBAAiB,CAAA;AACrD,MAAM,8BAA8B,GAAG,iBAAiB,CAAA;AAE3C,QAAA,sBAAsB,GAAc;IAC7C,mBAAmB,EAAE,GAAG;IACxB,OAAO,EAAE,CAAC,WAAwB,EAAe,EAAE;QAC/C,MAAM,UAAU,GAAG,uCAAiB,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;YACpE,IACI,IAAI,CAAC,IAAI,KAAK,uBAAc,CAAC,KAAK;gBAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,KAAK,eAAe;gBAC3C,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,2BAA2B,EAC1D,CAAC;gBACC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,C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