@activepieces/pieces-framework 0.20.3 → 0.22.0

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.
Files changed (39) hide show
  1. package/package.json +2 -2
  2. package/src/lib/action/action.d.ts +14 -11
  3. package/src/lib/action/action.js.map +1 -1
  4. package/src/lib/{context.d.ts → context/index.d.ts} +20 -16
  5. package/src/lib/{context.js → context/index.js} +1 -1
  6. package/src/lib/context/index.js.map +1 -0
  7. package/src/lib/context/versioning.d.ts +15 -0
  8. package/src/lib/context/versioning.js +24 -0
  9. package/src/lib/context/versioning.js.map +1 -0
  10. package/src/lib/index.d.ts +1 -1
  11. package/src/lib/index.js +1 -1
  12. package/src/lib/index.js.map +1 -1
  13. package/src/lib/piece-metadata.d.ts +494 -12
  14. package/src/lib/piece-metadata.js +1 -1
  15. package/src/lib/piece-metadata.js.map +1 -1
  16. package/src/lib/piece.d.ts +12 -8
  17. package/src/lib/piece.js +20 -4
  18. package/src/lib/piece.js.map +1 -1
  19. package/src/lib/property/authentication/index.d.ts +12 -2
  20. package/src/lib/property/authentication/index.js +22 -4
  21. package/src/lib/property/authentication/index.js.map +1 -1
  22. package/src/lib/property/authentication/oauth2-prop.d.ts +2 -2
  23. package/src/lib/property/index.d.ts +523 -520
  24. package/src/lib/property/index.js +5 -1
  25. package/src/lib/property/index.js.map +1 -1
  26. package/src/lib/property/input/dropdown/dropdown-prop.d.ts +17 -6
  27. package/src/lib/property/input/dropdown/dropdown-prop.js.map +1 -1
  28. package/src/lib/property/input/dynamic-prop.d.ts +9 -4
  29. package/src/lib/property/input/index.d.ts +5 -4
  30. package/src/lib/property/input/index.js.map +1 -1
  31. package/src/lib/property/util.d.ts +8 -0
  32. package/src/lib/property/util.js +121 -0
  33. package/src/lib/property/util.js.map +1 -0
  34. package/src/lib/trigger/trigger.d.ts +23 -23
  35. package/src/lib/trigger/trigger.js.map +1 -1
  36. package/src/lib/context.js.map +0 -1
  37. package/src/lib/validators/index.d.ts +0 -1
  38. package/src/lib/validators/index.js +0 -5
  39. package/src/lib/validators/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/pieces-framework",
3
- "version": "0.20.3",
3
+ "version": "0.22.0",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "@sinclair/typebox": "0.34.11",
@@ -8,7 +8,7 @@
8
8
  "nanoid": "3.3.8",
9
9
  "semver": "7.6.0",
10
10
  "socket.io-client": "4.8.1",
11
- "@activepieces/shared": "0.26.2",
11
+ "@activepieces/shared": "0.28.0",
12
12
  "tslib": "2.6.2"
13
13
  },
14
14
  "resolutions": {
@@ -2,8 +2,8 @@ import { Static } from '@sinclair/typebox';
2
2
  import { ActionContext } from '../context';
3
3
  import { ActionBase } from '../piece-metadata';
4
4
  import { InputPropertyMap } from '../property';
5
- import { PieceAuthProperty } from '../property/authentication';
6
- export type ActionRunner<PieceAuth extends PieceAuthProperty, ActionProps extends InputPropertyMap> = (ctx: ActionContext<PieceAuth, ActionProps>) => Promise<unknown | void>;
5
+ import { ExtractPieceAuthPropertyTypeForMethods, PieceAuthProperty } from '../property/authentication';
6
+ export type ActionRunner<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = PieceAuthProperty, ActionProps extends InputPropertyMap = InputPropertyMap> = (ctx: ActionContext<PieceAuth, ActionProps>) => Promise<unknown | void>;
7
7
  export declare const ErrorHandlingOptionsParam: import("@sinclair/typebox").TObject<{
8
8
  retryOnFailure: import("@sinclair/typebox").TObject<{
9
9
  defaultValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
@@ -15,31 +15,34 @@ export declare const ErrorHandlingOptionsParam: import("@sinclair/typebox").TObj
15
15
  }>;
16
16
  }>;
17
17
  export type ErrorHandlingOptionsParam = Static<typeof ErrorHandlingOptionsParam>;
18
- type CreateActionParams<PieceAuth extends PieceAuthProperty, ActionProps extends InputPropertyMap> = {
18
+ type CreateActionParams<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, ActionProps extends InputPropertyMap> = {
19
19
  /**
20
20
  * A dummy parameter used to infer {@code PieceAuth} type
21
21
  */
22
22
  name: string;
23
+ /**
24
+ * this parameter is used to infer the type of the piece auth value in run and test methods
25
+ */
23
26
  auth?: PieceAuth;
24
27
  displayName: string;
25
28
  description: string;
26
29
  props: ActionProps;
27
- run: ActionRunner<PieceAuth, ActionProps>;
28
- test?: ActionRunner<PieceAuth, ActionProps>;
30
+ run: ActionRunner<ExtractPieceAuthPropertyTypeForMethods<PieceAuth>, ActionProps>;
31
+ test?: ActionRunner<ExtractPieceAuthPropertyTypeForMethods<PieceAuth>, ActionProps>;
29
32
  requireAuth?: boolean;
30
33
  errorHandlingOptions?: ErrorHandlingOptionsParam;
31
34
  };
32
- export declare class IAction<PieceAuth extends PieceAuthProperty, ActionProps extends InputPropertyMap> implements ActionBase {
35
+ export declare class IAction<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = PieceAuthProperty, ActionProps extends InputPropertyMap = InputPropertyMap> implements ActionBase {
33
36
  readonly name: string;
34
37
  readonly displayName: string;
35
38
  readonly description: string;
36
39
  readonly props: ActionProps;
37
- readonly run: ActionRunner<PieceAuth, ActionProps>;
38
- readonly test: ActionRunner<PieceAuth, ActionProps>;
40
+ readonly run: ActionRunner<ExtractPieceAuthPropertyTypeForMethods<PieceAuth>, ActionProps>;
41
+ readonly test: ActionRunner<ExtractPieceAuthPropertyTypeForMethods<PieceAuth>, ActionProps>;
39
42
  readonly requireAuth: boolean;
40
43
  readonly errorHandlingOptions: ErrorHandlingOptionsParam;
41
- constructor(name: string, displayName: string, description: string, props: ActionProps, run: ActionRunner<PieceAuth, ActionProps>, test: ActionRunner<PieceAuth, ActionProps>, requireAuth: boolean, errorHandlingOptions: ErrorHandlingOptionsParam);
44
+ constructor(name: string, displayName: string, description: string, props: ActionProps, run: ActionRunner<ExtractPieceAuthPropertyTypeForMethods<PieceAuth>, ActionProps>, test: ActionRunner<ExtractPieceAuthPropertyTypeForMethods<PieceAuth>, ActionProps>, requireAuth: boolean, errorHandlingOptions: ErrorHandlingOptionsParam);
42
45
  }
43
- export type Action<PieceAuth extends PieceAuthProperty = any, ActionProps extends InputPropertyMap = any> = IAction<PieceAuth, ActionProps>;
44
- export declare const createAction: <PieceAuth extends PieceAuthProperty = PieceAuthProperty, ActionProps extends InputPropertyMap = any>(params: CreateActionParams<PieceAuth, ActionProps>) => IAction<PieceAuth, ActionProps>;
46
+ export type Action<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = PieceAuthProperty, ActionProps extends InputPropertyMap = any> = IAction<PieceAuth, ActionProps>;
47
+ export declare const createAction: <PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = PieceAuthProperty, ActionProps extends InputPropertyMap = any>(params: CreateActionParams<PieceAuth, ActionProps>) => IAction<PieceAuth, ActionProps>;
45
48
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/action/action.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AASpC,QAAA,yBAAyB,GAAG,cAAI,CAAC,MAAM,CAAC;IACnD,cAAc,EAAE,cAAI,CAAC,MAAM,CAAC;QAC1B,YAAY,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;KACpC,CAAC;IACF,iBAAiB,EAAE,cAAI,CAAC,MAAM,CAAC;QAC7B,YAAY,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;KACpC,CAAC;CACH,CAAC,CAAA;AAkBF,MAAa,OAAO;IAClB,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAkB,EAClB,GAAyC,EACzC,IAA0C,EAC1C,WAAoB,EACpB,oBAA+C;QAP/C,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;QACpB,yBAAoB,GAApB,oBAAoB,CAA2B;IAC7D,CAAC;CACN;AAXD,0BAWC;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,EAC1B,MAAA,MAAM,CAAC,oBAAoB,mCAAI;QAC7B,iBAAiB,EAAE;YACjB,YAAY,EAAE,KAAK;SACpB;QACD,cAAc,EAAE;YACd,YAAY,EAAE,KAAK;SACpB;KACF,CACF,CAAA;AACH,CAAC,CAAA;AAvBY,QAAA,YAAY,gBAuBxB"}
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/action/action.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AASpC,QAAA,yBAAyB,GAAG,cAAI,CAAC,MAAM,CAAC;IACnD,cAAc,EAAE,cAAI,CAAC,MAAM,CAAC;QAC1B,YAAY,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;KACpC,CAAC;IACF,iBAAiB,EAAE,cAAI,CAAC,MAAM,CAAC;QAC7B,YAAY,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;KACpC,CAAC;CACH,CAAC,CAAA;AAqBF,MAAa,OAAO;IAClB,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAkB,EAClB,GAAiF,EACjF,IAAkF,EAClF,WAAoB,EACpB,oBAA+C;QAP/C,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAa;QAClB,QAAG,GAAH,GAAG,CAA8E;QACjF,SAAI,GAAJ,IAAI,CAA8E;QAClF,gBAAW,GAAX,WAAW,CAAS;QACpB,yBAAoB,GAApB,oBAAoB,CAA2B;IAC7D,CAAC;CACN;AAXD,0BAWC;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,EAC1B,MAAA,MAAM,CAAC,oBAAoB,mCAAI;QAC7B,iBAAiB,EAAE;YACjB,YAAY,EAAE,KAAK;SACpB;QACD,cAAc,EAAE;YACd,YAAY,EAAE,KAAK;SACpB;KACF,CACF,CAAA;AACH,CAAC,CAAA;AAvBY,QAAA,YAAY,gBAuBxB"}
@@ -1,11 +1,11 @@
1
- import { AgentTool, AppConnectionValue, ExecutionType, FlowRunId, PopulatedFlow, ProjectId, RespondResponse, ResumePayload, SeekPage, TriggerPayload, TriggerStrategy } from '@activepieces/shared';
2
- import { InputPropertyMap, PiecePropValueSchema, StaticPropsValue } from './property';
3
- import { PieceAuthProperty } from './property/authentication';
1
+ import { AgentTool, AppConnectionType, AppConnectionValue, ExecutionType, FlowRunId, PopulatedFlow, ProjectId, RespondResponse, ResumePayload, SeekPage, TriggerPayload, TriggerStrategy } from '@activepieces/shared';
2
+ import { BasicAuthProperty, CustomAuthProperty, InputPropertyMap, OAuth2Property, SecretTextProperty, StaticPropsValue } from '../property';
3
+ import { PieceAuthProperty } from '../property/authentication';
4
4
  import { DelayPauseMetadata, PauseMetadata, WebhookPauseMetadata } from '@activepieces/shared';
5
- type BaseContext<PieceAuth extends PieceAuthProperty, Props extends InputPropertyMap> = {
5
+ export type BaseContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, Props extends InputPropertyMap> = {
6
6
  flows: FlowsContext;
7
7
  step: StepContext;
8
- auth: PiecePropValueSchema<PieceAuth>;
8
+ auth: AppConnectionValueForAuthProperty<PieceAuth>;
9
9
  propsValue: StaticPropsValue<Props>;
10
10
  store: Store;
11
11
  project: {
@@ -14,7 +14,11 @@ type BaseContext<PieceAuth extends PieceAuthProperty, Props extends InputPropert
14
14
  };
15
15
  connections: ConnectionsManager;
16
16
  };
17
- type AppWebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
17
+ type ExtractCustomAuthProps<T> = T extends CustomAuthProperty<infer Props> ? Props : never;
18
+ type ExtractOAuth2Props<T> = T extends OAuth2Property<infer Props> ? Props : never;
19
+ export type AppConnectionValueForAuthProperty<T extends PieceAuthProperty | PieceAuthProperty[] | undefined> = T extends PieceAuthProperty[] ? AppConnectionValueForSingleAuthProperty<T[number]> : T extends PieceAuthProperty ? AppConnectionValueForSingleAuthProperty<T> : T extends undefined ? undefined : never;
20
+ type AppConnectionValueForSingleAuthProperty<T extends PieceAuthProperty | undefined> = T extends SecretTextProperty<boolean> ? AppConnectionValue<AppConnectionType.SECRET_TEXT> : T extends BasicAuthProperty ? AppConnectionValue<AppConnectionType.BASIC_AUTH> : T extends CustomAuthProperty<any> ? AppConnectionValue<AppConnectionType.CUSTOM_AUTH, StaticPropsValue<ExtractCustomAuthProps<T>>> : T extends OAuth2Property<any> ? AppConnectionValue<AppConnectionType.OAUTH2, StaticPropsValue<ExtractOAuth2Props<T>>> : T extends undefined ? undefined : never;
21
+ type AppWebhookTriggerHookContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
18
22
  webhookUrl: string;
19
23
  payload: TriggerPayload;
20
24
  app: {
@@ -24,20 +28,21 @@ type AppWebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerPr
24
28
  }): void;
25
29
  };
26
30
  };
27
- type PollingTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
31
+ type PollingTriggerHookContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
28
32
  setSchedule(schedule: {
29
33
  cronExpression: string;
30
34
  timezone?: string;
31
35
  }): void;
32
36
  };
33
- type WebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
37
+ type WebhookTriggerHookContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
34
38
  webhookUrl: string;
35
39
  payload: TriggerPayload;
40
+ server: ServerContext;
36
41
  };
37
- export type TriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, 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> & {
42
+ export type TriggerHookContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, TriggerProps extends InputPropertyMap, 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> & {
38
43
  server: ServerContext;
39
44
  } : never;
40
- export type TestOrRunHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, S extends TriggerStrategy> = TriggerHookContext<PieceAuth, TriggerProps, S> & {
45
+ export type TestOrRunHookContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, TriggerProps extends InputPropertyMap, S extends TriggerStrategy> = TriggerHookContext<PieceAuth, TriggerProps, S> & {
41
46
  files: FilesService;
42
47
  };
43
48
  export type StopHookParams = {
@@ -90,7 +95,7 @@ export type RunContext = {
90
95
  pause: PauseHook;
91
96
  respond: RespondHook;
92
97
  };
93
- export type OnStartContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = Omit<BaseContext<PieceAuth, TriggerProps>, 'flows'> & {
98
+ export type OnStartContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, TriggerProps extends InputPropertyMap> = Omit<BaseContext<PieceAuth, TriggerProps>, 'flows'> & {
94
99
  run: Pick<RunContext, 'id'>;
95
100
  payload: unknown;
96
101
  };
@@ -101,13 +106,12 @@ export type OutputContext = {
101
106
  };
102
107
  }) => Promise<void>;
103
108
  };
104
- export type BaseActionContext<ET extends ExecutionType, PieceAuth extends PieceAuthProperty, ActionProps extends InputPropertyMap> = BaseContext<PieceAuth, ActionProps> & {
109
+ type BaseActionContext<ET extends ExecutionType, PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined, ActionProps extends InputPropertyMap> = BaseContext<PieceAuth, ActionProps> & {
105
110
  executionType: ET;
106
111
  tags: TagsManager;
107
112
  server: ServerContext;
108
113
  files: FilesService;
109
114
  output: OutputContext;
110
- serverUrl: string;
111
115
  agent: AgentContext;
112
116
  run: RunContext;
113
117
  generateResumeUrl: (params: {
@@ -115,11 +119,11 @@ export type BaseActionContext<ET extends ExecutionType, PieceAuth extends PieceA
115
119
  sync?: boolean;
116
120
  }) => string;
117
121
  };
118
- type BeginExecutionActionContext<PieceAuth extends PieceAuthProperty = PieceAuthProperty, ActionProps extends InputPropertyMap = InputPropertyMap> = BaseActionContext<ExecutionType.BEGIN, PieceAuth, ActionProps>;
119
- type ResumeExecutionActionContext<PieceAuth extends PieceAuthProperty = PieceAuthProperty, ActionProps extends InputPropertyMap = InputPropertyMap> = BaseActionContext<ExecutionType.RESUME, PieceAuth, ActionProps> & {
122
+ type BeginExecutionActionContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = undefined, ActionProps extends InputPropertyMap = InputPropertyMap> = BaseActionContext<ExecutionType.BEGIN, PieceAuth, ActionProps>;
123
+ type ResumeExecutionActionContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = undefined, ActionProps extends InputPropertyMap = InputPropertyMap> = BaseActionContext<ExecutionType.RESUME, PieceAuth, ActionProps> & {
120
124
  resumePayload: ResumePayload;
121
125
  };
122
- export type ActionContext<PieceAuth extends PieceAuthProperty = PieceAuthProperty, ActionProps extends InputPropertyMap = InputPropertyMap> = BeginExecutionActionContext<PieceAuth, ActionProps> | ResumeExecutionActionContext<PieceAuth, ActionProps>;
126
+ export type ActionContext<PieceAuth extends PieceAuthProperty | PieceAuthProperty[] | undefined = undefined, ActionProps extends InputPropertyMap = InputPropertyMap> = BeginExecutionActionContext<PieceAuth, ActionProps> | ResumeExecutionActionContext<PieceAuth, ActionProps>;
123
127
  export type ConstructToolParams = {
124
128
  tools: AgentTool[];
125
129
  model: unknown;
@@ -7,4 +7,4 @@ var StoreScope;
7
7
  StoreScope["PROJECT"] = "COLLECTION";
8
8
  StoreScope["FLOW"] = "FLOW";
9
9
  })(StoreScope || (exports.StoreScope = StoreScope = {}));
10
- //# sourceMappingURL=context.js.map
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/context/index.ts"],"names":[],"mappings":";;;AA4QA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iDAAiD;IACjD,oCAAsB,CAAA;IACtB,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
@@ -0,0 +1,15 @@
1
+ import { ActionContext } from ".";
2
+ import { InputPropertyMap, PieceAuthProperty } from "../property";
3
+ export declare enum ContextVersion {
4
+ V1 = "1"
5
+ }
6
+ export declare const LATEST_CONTEXT_VERSION = ContextVersion.V1;
7
+ export declare const MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION = "0.73.0";
8
+ export declare const backwardCompatabilityContextUtils: {
9
+ makeActionContextBackwardCompatible({ context, contextVersion }: MakeActionContextBackwardCompatibleParams): ActionContext<PieceAuthProperty, InputPropertyMap>;
10
+ };
11
+ type MakeActionContextBackwardCompatibleParams = {
12
+ context: ActionContext<PieceAuthProperty, InputPropertyMap>;
13
+ contextVersion: ContextVersion | undefined;
14
+ };
15
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.backwardCompatabilityContextUtils = exports.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION = exports.LATEST_CONTEXT_VERSION = exports.ContextVersion = void 0;
4
+ var ContextVersion;
5
+ (function (ContextVersion) {
6
+ ContextVersion["V1"] = "1";
7
+ })(ContextVersion || (exports.ContextVersion = ContextVersion = {}));
8
+ //bump these two constants after creating a new context version
9
+ exports.LATEST_CONTEXT_VERSION = ContextVersion.V1;
10
+ exports.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION = '0.73.0';
11
+ exports.backwardCompatabilityContextUtils = {
12
+ makeActionContextBackwardCompatible({ context, contextVersion }) {
13
+ switch (contextVersion) {
14
+ case undefined:
15
+ return migrateActionContextV1ToV0(context);
16
+ case ContextVersion.V1:
17
+ return context;
18
+ }
19
+ }
20
+ };
21
+ function migrateActionContextV1ToV0(context) {
22
+ return Object.assign(Object.assign({}, context), { serverUrl: context.server.publicUrl });
23
+ }
24
+ //# sourceMappingURL=versioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versioning.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/context/versioning.ts"],"names":[],"mappings":";;;AAGA,IAAY,cAEX;AAFD,WAAY,cAAc;IACtB,0BAAQ,CAAA;AACZ,CAAC,EAFW,cAAc,8BAAd,cAAc,QAEzB;AACD,gEAAgE;AACnD,QAAA,sBAAsB,GAAG,cAAc,CAAC,EAAE,CAAC;AAC3C,QAAA,sDAAsD,GAAG,QAAQ,CAAC;AAElE,QAAA,iCAAiC,GAAG;IAC7C,mCAAmC,CAAC,EAAE,OAAO,EAAE,cAAc,EAA6C;QACtG,QAAQ,cAAc,EAAE,CAAC;YACrB,KAAK,SAAS;gBACV,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC;YAC/C,KAAK,cAAc,CAAC,EAAE;gBAClB,OAAO,OAAO,CAAC;QACvB,CAAC;IACL,CAAC;CACJ,CAAA;AAED,SAAS,0BAA0B,CAAC,OAA0D;IAC1F,OAAO,gCACA,OAAO,KACV,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,GAC0B,CAAA;AACrE,CAAC"}
@@ -4,5 +4,5 @@ export * from './trigger/trigger';
4
4
  export * from './context';
5
5
  export * from './piece';
6
6
  export * from './piece-metadata';
7
- export * from './validators/index';
8
7
  export * from './i18n';
8
+ export * from './context/versioning';
package/src/lib/index.js CHANGED
@@ -7,6 +7,6 @@ tslib_1.__exportStar(require("./trigger/trigger"), exports);
7
7
  tslib_1.__exportStar(require("./context"), exports);
8
8
  tslib_1.__exportStar(require("./piece"), exports);
9
9
  tslib_1.__exportStar(require("./piece-metadata"), exports);
10
- tslib_1.__exportStar(require("./validators/index"), exports);
11
10
  tslib_1.__exportStar(require("./i18n"), exports);
11
+ tslib_1.__exportStar(require("./context/versioning"), exports);
12
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,qDAA2B;AAC3B,4DAAkC;AAClC,oDAA0B;AAC1B,kDAAwB;AACxB,2DAAiC;AACjC,6DAAkC;AAClC,iDAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,qDAA2B;AAC3B,4DAAkC;AAClC,oDAA0B;AAC1B,kDAAwB;AACxB,2DAAiC;AACjC,iDAAsB;AACtB,+DAAoC"}