@activepieces/pieces-framework 0.6.14 → 0.6.16

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/pieces-framework",
3
- "version": "0.6.14",
3
+ "version": "0.6.16",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "@sinclair/typebox": "^0.26.3",
@@ -8,9 +8,8 @@
8
8
  "dayjs": "^1.11.8",
9
9
  "is-base64": "^1.1.0",
10
10
  "nanoid": "^3.3.4",
11
- "object-sizeof": "^2.6.3",
12
11
  "semver": "7.5.4",
13
- "@activepieces/shared": "0.7.3",
12
+ "@activepieces/shared": "0.8.1",
14
13
  "tslib": "2.6.1"
15
14
  },
16
15
  "main": "./src/index.js",
@@ -12,6 +12,7 @@ type CreateActionParams<PieceAuth extends PieceAuthProperty, ActionProps extends
12
12
  description: string;
13
13
  props: ActionProps;
14
14
  run: ActionRunner<PieceAuth, ActionProps>;
15
+ test?: ActionRunner<PieceAuth, ActionProps>;
15
16
  requireAuth?: boolean;
16
17
  };
17
18
  export declare class IAction<PieceAuth extends PieceAuthProperty, ActionProps extends NonAuthPiecePropertyMap> implements ActionBase {
@@ -20,8 +21,9 @@ export declare class IAction<PieceAuth extends PieceAuthProperty, ActionProps ex
20
21
  readonly description: string;
21
22
  readonly props: ActionProps;
22
23
  readonly run: ActionRunner<PieceAuth, ActionProps>;
24
+ readonly test: ActionRunner<PieceAuth, ActionProps>;
23
25
  readonly requireAuth: boolean;
24
- constructor(name: string, displayName: string, description: string, props: ActionProps, run: ActionRunner<PieceAuth, ActionProps>, requireAuth: boolean);
26
+ constructor(name: string, displayName: string, description: string, props: ActionProps, run: ActionRunner<PieceAuth, ActionProps>, test: ActionRunner<PieceAuth, ActionProps>, requireAuth: boolean);
25
27
  }
26
28
  export type Action<PieceAuth extends PieceAuthProperty = any, ActionProps extends NonAuthPiecePropertyMap = any> = IAction<PieceAuth, ActionProps>;
27
29
  export declare const createAction: <PieceAuth extends PieceAuthProperty = PieceAuthProperty, ActionProps extends NonAuthPiecePropertyMap = any>(params: CreateActionParams<PieceAuth, ActionProps>) => IAction<PieceAuth, ActionProps>;
@@ -2,19 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createAction = exports.IAction = void 0;
4
4
  class IAction {
5
- constructor(name, displayName, description, props, run, requireAuth) {
5
+ constructor(name, displayName, description, props, run, test, requireAuth) {
6
6
  this.name = name;
7
7
  this.displayName = displayName;
8
8
  this.description = description;
9
9
  this.props = props;
10
10
  this.run = run;
11
+ this.test = test;
11
12
  this.requireAuth = requireAuth;
12
13
  }
13
14
  }
14
15
  exports.IAction = IAction;
15
16
  const createAction = (params) => {
16
- var _a;
17
- return new IAction(params.name, params.displayName, params.description, params.props, params.run, (_a = params.requireAuth) !== null && _a !== void 0 ? _a : true);
17
+ var _a, _b;
18
+ return new IAction(params.name, params.displayName, params.description, params.props, params.run, (_a = params.test) !== null && _a !== void 0 ? _a : params.run, (_b = params.requireAuth) !== null && _b !== void 0 ? _b : true);
18
19
  };
19
20
  exports.createAction = createAction;
20
21
  //# sourceMappingURL=action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/action/action.ts"],"names":[],"mappings":";;;AAoBA,MAAa,OAAO;IAClB,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAkB,EAClB,GAAyC,EACzC,WAAoB;QALpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAa;QAClB,QAAG,GAAH,GAAG,CAAsC;QACzC,gBAAW,GAAX,WAAW,CAAS;IAClC,CAAC;CACN;AATD,0BASC;AAOM,MAAM,YAAY,GAAG,CAI1B,MAAkD,EAClD,EAAE;;IACF,OAAO,IAAI,OAAO,CAChB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,GAAG,EACV,MAAA,MAAM,CAAC,WAAW,mCAAI,IAAI,CAC3B,CAAA;AACH,CAAC,CAAA;AAdY,QAAA,YAAY,gBAcxB"}
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/action/action.ts"],"names":[],"mappings":";;;AAqBA,MAAa,OAAO;IAClB,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAkB,EAClB,GAAyC,EACzC,IAA0C,EAC1C,WAAoB;QANpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAa;QAClB,QAAG,GAAH,GAAG,CAAsC;QACzC,SAAI,GAAJ,IAAI,CAAsC;QAC1C,gBAAW,GAAX,WAAW,CAAS;IAClC,CAAC;CACN;AAVD,0BAUC;AAOM,MAAM,YAAY,GAAG,CAI1B,MAAkD,EAClD,EAAE;;IACF,OAAO,IAAI,OAAO,CAChB,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,GAAG,EACV,MAAA,MAAM,CAAC,IAAI,mCAAI,MAAM,CAAC,GAAG,EACzB,MAAA,MAAM,CAAC,WAAW,mCAAI,IAAI,CAC3B,CAAA;AACH,CAAC,CAAA;AAfY,QAAA,YAAY,gBAexB"}
@@ -5,7 +5,6 @@ import { NonAuthPiecePropertyMap, PieceAuthProperty, PiecePropValueSchema, Piece
5
5
  type BaseContext<PieceAuth extends PieceAuthProperty, Props extends PiecePropertyMap> = {
6
6
  auth: PiecePropValueSchema<PieceAuth>;
7
7
  propsValue: StaticPropsValue<Props>;
8
- files: FilesService;
9
8
  store: Store;
10
9
  };
11
10
  type AppWebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends PiecePropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
@@ -29,6 +28,9 @@ type WebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps
29
28
  payload: TriggerPayload;
30
29
  };
31
30
  export type TriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends PiecePropertyMap, S extends TriggerStrategy> = S extends TriggerStrategy.APP_WEBHOOK ? AppWebhookTriggerHookContext<PieceAuth, TriggerProps> : S extends TriggerStrategy.POLLING ? PollingTriggerHookContext<PieceAuth, TriggerProps> : S extends TriggerStrategy.WEBHOOK ? WebhookTriggerHookContext<PieceAuth, TriggerProps> : never;
31
+ export type TestOrRunHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends PiecePropertyMap, S extends TriggerStrategy> = TriggerHookContext<PieceAuth, TriggerProps, S> & {
32
+ files: FilesService;
33
+ };
32
34
  export type StopHookParams = {
33
35
  response: StopResponse;
34
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../../packages/pieces/framework/src/lib/context.ts"],"names":[],"mappings":";;;AAkHA,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,iDAAiD;IACjD,oCAAsB,CAAA;IACtB,2BAAa,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../../packages/pieces/framework/src/lib/context.ts"],"names":[],"mappings":";;;AAyHA,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,iDAAiD;IACjD,oCAAsB,CAAA;IACtB,2BAAa,CAAA;AACjB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
@@ -1,4 +1,4 @@
1
- import { TriggerHookContext } from '../context';
1
+ import { TestOrRunHookContext, TriggerHookContext } from '../context';
2
2
  import { TriggerBase } from '../piece-metadata';
3
3
  import { NonAuthPiecePropertyMap, PieceAuthProperty } from '../property/property';
4
4
  export declare enum TriggerStrategy {
@@ -35,8 +35,8 @@ type CreateTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps exten
35
35
  onEnable: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
36
36
  onHandshake?: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>;
37
37
  onDisable: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
38
- run: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
39
- test?: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
38
+ run: (context: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
39
+ test?: (context: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
40
40
  requireAuth?: boolean;
41
41
  sampleData: unknown;
42
42
  };
@@ -50,11 +50,11 @@ export declare class ITrigger<TS extends TriggerStrategy, PieceAuth extends Piec
50
50
  readonly onEnable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
51
51
  readonly onHandshake: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>;
52
52
  readonly onDisable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>;
53
- readonly run: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
54
- readonly test: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
53
+ readonly run: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
54
+ readonly test: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>;
55
55
  sampleData: unknown;
56
56
  readonly requireAuth: boolean;
57
- constructor(name: string, displayName: string, description: string, props: TriggerProps, type: TS, handshakeConfiguration: WebhookHandshakeConfiguration, onEnable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onHandshake: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>, onDisable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, run: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, test: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, sampleData: unknown, requireAuth?: boolean);
57
+ constructor(name: string, displayName: string, description: string, props: TriggerProps, type: TS, handshakeConfiguration: WebhookHandshakeConfiguration, onEnable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onHandshake: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>, onDisable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, run: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, test: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, sampleData: unknown, requireAuth?: boolean);
58
58
  }
59
59
  export type Trigger<PieceAuth extends PieceAuthProperty = any, TriggerProps extends NonAuthPiecePropertyMap = any, S extends TriggerStrategy = TriggerStrategy> = ITrigger<S, PieceAuth, TriggerProps>;
60
60
  export declare const createTrigger: <TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty, TriggerProps extends NonAuthPiecePropertyMap>(params: CreateTriggerParams<PieceAuth, TriggerProps, TS>) => ITrigger<TS, PieceAuth, TriggerProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/trigger/trigger.ts"],"names":[],"mappings":";;;;AAIA,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,8CAA2B,CAAA;AAC7B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AAC,OAAA,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA,GAAA,CAAC,EACrD,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,GAAG,EACV,MAAA,MAAM,CAAC,IAAI,mCAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAC3D,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,WAAW,CACnB,CAAA;AACH,CAAC,CAAA;AApBY,QAAA,aAAa,iBAoBzB"}
1
+ {"version":3,"file":"trigger.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/trigger/trigger.ts"],"names":[],"mappings":";;;;AAIA,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,8CAA2B,CAAA;AAC7B,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,yCAAa,CAAA;IACb,6DAAiC,CAAA;IACjC,2DAA+B,CAAA;IAC/B,qEAAyC,CAAA;AAC3C,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC;AAqCD,MAAa,QAAQ;IAKnB,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAmB,EACnB,IAAQ,EACR,sBAAqD,EACrD,QAAiF,EACjF,WAA+F,EAC/F,SAAkF,EAClF,GAAmF,EACnF,IAAoF,EAC7F,UAAmB,EACV,cAAuB,IAAI;QAZ3B,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAc;QACnB,SAAI,GAAJ,IAAI,CAAI;QACR,2BAAsB,GAAtB,sBAAsB,CAA+B;QACrD,aAAQ,GAAR,QAAQ,CAAyE;QACjF,gBAAW,GAAX,WAAW,CAAoF;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