@activepieces/pieces-framework 0.20.2 → 0.21.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.
- package/package.json +3 -2
- package/src/lib/action/action.d.ts +5 -5
- package/src/lib/{context.d.ts → context/index.d.ts} +27 -16
- package/src/lib/{context.js → context/index.js} +1 -1
- package/src/lib/context/index.js.map +1 -0
- package/src/lib/context/versioning.d.ts +15 -0
- package/src/lib/context/versioning.js +24 -0
- package/src/lib/context/versioning.js.map +1 -0
- package/src/lib/index.d.ts +1 -0
- package/src/lib/index.js +1 -0
- package/src/lib/index.js.map +1 -1
- package/src/lib/piece-metadata.d.ts +11 -3
- package/src/lib/piece-metadata.js +1 -0
- package/src/lib/piece-metadata.js.map +1 -1
- package/src/lib/piece.d.ts +14 -10
- package/src/lib/piece.js +12 -2
- package/src/lib/piece.js.map +1 -1
- package/src/lib/property/authentication/oauth2-prop.d.ts +1 -1
- package/src/lib/property/input/dropdown/dropdown-prop.d.ts +17 -6
- package/src/lib/property/input/dropdown/dropdown-prop.js.map +1 -1
- package/src/lib/property/input/dynamic-prop.d.ts +9 -4
- package/src/lib/property/input/index.d.ts +5 -4
- package/src/lib/property/input/index.js.map +1 -1
- package/src/lib/trigger/trigger.d.ts +7 -7
- package/src/lib/context.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/pieces-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@sinclair/typebox": "0.34.11",
|
|
7
7
|
"deepmerge-ts": "7.1.0",
|
|
8
8
|
"nanoid": "3.3.8",
|
|
9
9
|
"semver": "7.6.0",
|
|
10
|
-
"
|
|
10
|
+
"socket.io-client": "4.8.1",
|
|
11
|
+
"@activepieces/shared": "0.27.0",
|
|
11
12
|
"tslib": "2.6.2"
|
|
12
13
|
},
|
|
13
14
|
"resolutions": {
|
|
@@ -3,7 +3,7 @@ import { ActionContext } from '../context';
|
|
|
3
3
|
import { ActionBase } from '../piece-metadata';
|
|
4
4
|
import { InputPropertyMap } from '../property';
|
|
5
5
|
import { PieceAuthProperty } from '../property/authentication';
|
|
6
|
-
export type ActionRunner<PieceAuth extends PieceAuthProperty, ActionProps extends InputPropertyMap> = (ctx: ActionContext<PieceAuth, ActionProps>) => Promise<unknown | void>;
|
|
6
|
+
export type ActionRunner<PieceAuth extends 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,7 +15,7 @@ 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 | undefined, ActionProps extends InputPropertyMap> = {
|
|
19
19
|
/**
|
|
20
20
|
* A dummy parameter used to infer {@code PieceAuth} type
|
|
21
21
|
*/
|
|
@@ -29,7 +29,7 @@ type CreateActionParams<PieceAuth extends PieceAuthProperty, ActionProps extends
|
|
|
29
29
|
requireAuth?: boolean;
|
|
30
30
|
errorHandlingOptions?: ErrorHandlingOptionsParam;
|
|
31
31
|
};
|
|
32
|
-
export declare class IAction<PieceAuth extends PieceAuthProperty, ActionProps extends InputPropertyMap> implements ActionBase {
|
|
32
|
+
export declare class IAction<PieceAuth extends PieceAuthProperty | undefined = PieceAuthProperty, ActionProps extends InputPropertyMap = InputPropertyMap> implements ActionBase {
|
|
33
33
|
readonly name: string;
|
|
34
34
|
readonly displayName: string;
|
|
35
35
|
readonly description: string;
|
|
@@ -40,6 +40,6 @@ export declare class IAction<PieceAuth extends PieceAuthProperty, ActionProps ex
|
|
|
40
40
|
readonly errorHandlingOptions: ErrorHandlingOptionsParam;
|
|
41
41
|
constructor(name: string, displayName: string, description: string, props: ActionProps, run: ActionRunner<PieceAuth, ActionProps>, test: ActionRunner<PieceAuth, ActionProps>, requireAuth: boolean, errorHandlingOptions: ErrorHandlingOptionsParam);
|
|
42
42
|
}
|
|
43
|
-
export type Action<PieceAuth extends PieceAuthProperty =
|
|
44
|
-
export declare const createAction: <PieceAuth extends PieceAuthProperty =
|
|
43
|
+
export type Action<PieceAuth extends PieceAuthProperty | undefined = PieceAuthProperty, ActionProps extends InputPropertyMap = any> = IAction<PieceAuth, ActionProps>;
|
|
44
|
+
export declare const createAction: <PieceAuth extends PieceAuthProperty | undefined = undefined, ActionProps extends InputPropertyMap = any>(params: CreateActionParams<PieceAuth, ActionProps>) => IAction<PieceAuth, ActionProps>;
|
|
45
45
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AppConnectionValue, ExecutionType, FlowRunId, PopulatedFlow, ProjectId, RespondResponse, ResumePayload, SeekPage, TriggerPayload, TriggerStrategy } from '@activepieces/shared';
|
|
2
|
-
import { InputPropertyMap,
|
|
3
|
-
import { PieceAuthProperty } from '
|
|
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 | undefined, Props extends InputPropertyMap> = {
|
|
6
6
|
flows: FlowsContext;
|
|
7
7
|
step: StepContext;
|
|
8
|
-
auth:
|
|
8
|
+
auth: PieceAuth extends undefined ? undefined : AppConnectionValueForAuthProperty<Exclude<PieceAuth, undefined>>;
|
|
9
9
|
propsValue: StaticPropsValue<Props>;
|
|
10
10
|
store: Store;
|
|
11
11
|
project: {
|
|
@@ -14,7 +14,10 @@ type BaseContext<PieceAuth extends PieceAuthProperty, Props extends InputPropert
|
|
|
14
14
|
};
|
|
15
15
|
connections: ConnectionsManager;
|
|
16
16
|
};
|
|
17
|
-
type
|
|
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 | 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;
|
|
20
|
+
type AppWebhookTriggerHookContext<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
|
|
18
21
|
webhookUrl: string;
|
|
19
22
|
payload: TriggerPayload;
|
|
20
23
|
app: {
|
|
@@ -24,20 +27,21 @@ type AppWebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerPr
|
|
|
24
27
|
}): void;
|
|
25
28
|
};
|
|
26
29
|
};
|
|
27
|
-
type PollingTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
|
|
30
|
+
type PollingTriggerHookContext<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
|
|
28
31
|
setSchedule(schedule: {
|
|
29
32
|
cronExpression: string;
|
|
30
33
|
timezone?: string;
|
|
31
34
|
}): void;
|
|
32
35
|
};
|
|
33
|
-
type WebhookTriggerHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
|
|
36
|
+
type WebhookTriggerHookContext<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap> = BaseContext<PieceAuth, TriggerProps> & {
|
|
34
37
|
webhookUrl: string;
|
|
35
38
|
payload: TriggerPayload;
|
|
39
|
+
server: ServerContext;
|
|
36
40
|
};
|
|
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> & {
|
|
41
|
+
export type TriggerHookContext<PieceAuth extends 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
42
|
server: ServerContext;
|
|
39
43
|
} : never;
|
|
40
|
-
export type TestOrRunHookContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, S extends TriggerStrategy> = TriggerHookContext<PieceAuth, TriggerProps, S> & {
|
|
44
|
+
export type TestOrRunHookContext<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap, S extends TriggerStrategy> = TriggerHookContext<PieceAuth, TriggerProps, S> & {
|
|
41
45
|
files: FilesService;
|
|
42
46
|
};
|
|
43
47
|
export type StopHookParams = {
|
|
@@ -90,7 +94,7 @@ export type RunContext = {
|
|
|
90
94
|
pause: PauseHook;
|
|
91
95
|
respond: RespondHook;
|
|
92
96
|
};
|
|
93
|
-
export type OnStartContext<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = Omit<BaseContext<PieceAuth, TriggerProps>, 'flows'> & {
|
|
97
|
+
export type OnStartContext<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap> = Omit<BaseContext<PieceAuth, TriggerProps>, 'flows'> & {
|
|
94
98
|
run: Pick<RunContext, 'id'>;
|
|
95
99
|
payload: unknown;
|
|
96
100
|
};
|
|
@@ -101,24 +105,31 @@ export type OutputContext = {
|
|
|
101
105
|
};
|
|
102
106
|
}) => Promise<void>;
|
|
103
107
|
};
|
|
104
|
-
|
|
108
|
+
type BaseActionContext<ET extends ExecutionType, PieceAuth extends PieceAuthProperty | undefined, ActionProps extends InputPropertyMap> = BaseContext<PieceAuth, ActionProps> & {
|
|
105
109
|
executionType: ET;
|
|
106
110
|
tags: TagsManager;
|
|
107
111
|
server: ServerContext;
|
|
108
112
|
files: FilesService;
|
|
109
113
|
output: OutputContext;
|
|
110
|
-
|
|
114
|
+
agent: AgentContext;
|
|
111
115
|
run: RunContext;
|
|
112
116
|
generateResumeUrl: (params: {
|
|
113
117
|
queryParams: Record<string, string>;
|
|
114
118
|
sync?: boolean;
|
|
115
119
|
}) => string;
|
|
116
120
|
};
|
|
117
|
-
type BeginExecutionActionContext<PieceAuth extends PieceAuthProperty =
|
|
118
|
-
type ResumeExecutionActionContext<PieceAuth extends PieceAuthProperty =
|
|
121
|
+
type BeginExecutionActionContext<PieceAuth extends PieceAuthProperty | undefined = undefined, ActionProps extends InputPropertyMap = InputPropertyMap> = BaseActionContext<ExecutionType.BEGIN, PieceAuth, ActionProps>;
|
|
122
|
+
type ResumeExecutionActionContext<PieceAuth extends PieceAuthProperty | undefined = undefined, ActionProps extends InputPropertyMap = InputPropertyMap> = BaseActionContext<ExecutionType.RESUME, PieceAuth, ActionProps> & {
|
|
119
123
|
resumePayload: ResumePayload;
|
|
120
124
|
};
|
|
121
|
-
export type ActionContext<PieceAuth extends PieceAuthProperty =
|
|
125
|
+
export type ActionContext<PieceAuth extends PieceAuthProperty | undefined = undefined, ActionProps extends InputPropertyMap = InputPropertyMap> = BeginExecutionActionContext<PieceAuth, ActionProps> | ResumeExecutionActionContext<PieceAuth, ActionProps>;
|
|
126
|
+
export type ConstructToolParams = {
|
|
127
|
+
tools: AgentTool[];
|
|
128
|
+
model: unknown;
|
|
129
|
+
};
|
|
130
|
+
export interface AgentContext {
|
|
131
|
+
tools: (params: ConstructToolParams) => Promise<Record<string, unknown>>;
|
|
132
|
+
}
|
|
122
133
|
export interface FilesService {
|
|
123
134
|
write({ fileName, data, }: {
|
|
124
135
|
fileName: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/framework/src/lib/context/index.ts"],"names":[],"mappings":";;;AAuQA,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,+DAA+D;AAClD,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"}
|
package/src/lib/index.d.ts
CHANGED
package/src/lib/index.js
CHANGED
|
@@ -9,4 +9,5 @@ tslib_1.__exportStar(require("./piece"), exports);
|
|
|
9
9
|
tslib_1.__exportStar(require("./piece-metadata"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./validators/index"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./i18n"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./context/versioning"), exports);
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/src/lib/index.js.map
CHANGED
|
@@ -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,6DAAkC;AAClC,iDAAsB;AACtB,+DAAoC"}
|
|
@@ -4,6 +4,7 @@ import { ErrorHandlingOptionsParam } from "./action/action";
|
|
|
4
4
|
import { PieceAuthProperty } from "./property/authentication";
|
|
5
5
|
import { Static } from "@sinclair/typebox";
|
|
6
6
|
import { LocalesEnum, PackageType, PieceCategory, PieceType, ProjectId, TriggerStrategy, TriggerTestStrategy, WebhookHandshakeConfiguration } from "@activepieces/shared";
|
|
7
|
+
import { ContextVersion } from "./context/versioning";
|
|
7
8
|
declare const I18nForPiece: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
8
9
|
nl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>>;
|
|
9
10
|
en: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>>;
|
|
@@ -156,6 +157,9 @@ export type PieceBase = {
|
|
|
156
157
|
minimumSupportedRelease?: string;
|
|
157
158
|
maximumSupportedRelease?: string;
|
|
158
159
|
i18n?: Partial<Record<LocalesEnum, Record<string, string>>>;
|
|
160
|
+
getContextInfo: (() => {
|
|
161
|
+
version: ContextVersion;
|
|
162
|
+
}) | undefined;
|
|
159
163
|
};
|
|
160
164
|
export declare const ActionBase: import("@sinclair/typebox").TObject<{
|
|
161
165
|
name: import("@sinclair/typebox").TString;
|
|
@@ -1403,9 +1407,12 @@ export declare const PieceMetadata: import("@sinclair/typebox").TObject<{
|
|
|
1403
1407
|
testStrategy: import("@sinclair/typebox").TEnum<typeof TriggerTestStrategy>;
|
|
1404
1408
|
}>>;
|
|
1405
1409
|
}>;
|
|
1406
|
-
export type PieceMetadata = PieceBase & {
|
|
1410
|
+
export type PieceMetadata = Omit<PieceBase, 'getContextInfo'> & {
|
|
1407
1411
|
actions: Record<string, ActionBase>;
|
|
1408
1412
|
triggers: Record<string, TriggerBase>;
|
|
1413
|
+
contextInfo: {
|
|
1414
|
+
version: ContextVersion;
|
|
1415
|
+
} | undefined;
|
|
1409
1416
|
};
|
|
1410
1417
|
export declare const PieceMetadataSummary: import("@sinclair/typebox").TObject<{
|
|
1411
1418
|
displayName: import("@sinclair/typebox").TString;
|
|
@@ -2097,6 +2104,7 @@ declare const PiecePackageMetadata: import("@sinclair/typebox").TObject<{
|
|
|
2097
2104
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
2098
2105
|
pieceType: import("@sinclair/typebox").TEnum<typeof PieceType>;
|
|
2099
2106
|
packageType: import("@sinclair/typebox").TEnum<typeof PackageType>;
|
|
2107
|
+
platformId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
2100
2108
|
archiveId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
2101
2109
|
}>;
|
|
2102
2110
|
type PiecePackageMetadata = Static<typeof PiecePackageMetadata>;
|
|
@@ -2205,7 +2213,7 @@ export declare const PieceMetadataModel: import("@sinclair/typebox").TObject<{
|
|
|
2205
2213
|
version: import("@sinclair/typebox").TString;
|
|
2206
2214
|
logoUrl: import("@sinclair/typebox").TString;
|
|
2207
2215
|
authors: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
2208
|
-
platformId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString
|
|
2216
|
+
platformId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>>;
|
|
2209
2217
|
directoryPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
2210
2218
|
categories: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<typeof PieceCategory>>>;
|
|
2211
2219
|
minimumSupportedRelease: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -2888,7 +2896,7 @@ export declare const PieceMetadataModelSummary: import("@sinclair/typebox").TObj
|
|
|
2888
2896
|
version: import("@sinclair/typebox").TString;
|
|
2889
2897
|
logoUrl: import("@sinclair/typebox").TString;
|
|
2890
2898
|
authors: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
2891
|
-
platformId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString
|
|
2899
|
+
platformId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>>;
|
|
2892
2900
|
directoryPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
2893
2901
|
categories: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<typeof PieceCategory>>>;
|
|
2894
2902
|
minimumSupportedRelease: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -64,6 +64,7 @@ const PiecePackageMetadata = typebox_1.Type.Object({
|
|
|
64
64
|
tags: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
|
|
65
65
|
pieceType: typebox_1.Type.Enum(shared_1.PieceType),
|
|
66
66
|
packageType: typebox_1.Type.Enum(shared_1.PackageType),
|
|
67
|
+
platformId: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
67
68
|
archiveId: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
68
69
|
});
|
|
69
70
|
exports.PieceMetadataModel = typebox_1.Type.Composite([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piece-metadata.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece-metadata.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAA8D;AAC9D,4CAA4D;AAC5D,8DAA8D;AAC9D,+CAAiD;AACjD,iDAA0K;
|
|
1
|
+
{"version":3,"file":"piece-metadata.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece-metadata.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,+CAA8D;AAC9D,4CAA4D;AAC5D,8DAA8D;AAC9D,+CAAiD;AACjD,iDAA0K;AAG1K,MAAM,YAAY,GAAI,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,oBAAW,CAAC,EAAE,cAAI,CAAC,MAAM,CAAC,cAAI,CAAC,MAAM,EAAE,EAAE,cAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAErH,QAAA,SAAS,GAAG,cAAI,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;IAChC,IAAI,EAAE,cAAI,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,cAAI,CAAC,MAAM,EAAE;IAC1B,OAAO,EAAE,cAAI,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,cAAI,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;IACvC,OAAO,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;IAClC,UAAU,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;IACxC,aAAa,EAAE,cAAI,CAAC,Q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AkB,GAAG,cAAI,CAAC,SAAS,CAAC;IAC/C,qBAAa;IACb,oBAAoB;CACrB,CAAC,CAAA;AAGW,QAAA,yBAAyB,GAAG,cAAI,CAAC,SAAS,CAAC;IACtD,4BAAoB;IACpB,oBAAoB;CACrB,CAAC,CAAA;AAGW,QAAA,uBAAuB,GAAG,cAAI,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,cAAI,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,cAAI,CAAC,MAAM,EAAE;CACvB,CAAC,CAAA"}
|
package/src/lib/piece.d.ts
CHANGED
|
@@ -4,27 +4,31 @@ import { EventPayload, ParseEventResponse, PieceCategory } from '@activepieces/s
|
|
|
4
4
|
import { PieceBase, PieceMetadata } from './piece-metadata';
|
|
5
5
|
import { PieceAuthProperty } from './property/authentication';
|
|
6
6
|
import { ServerContext } from './context';
|
|
7
|
-
|
|
7
|
+
import { ContextVersion } from './context/versioning';
|
|
8
|
+
export declare class Piece<PieceAuth extends PieceAuthProperty | undefined = PieceAuthProperty> implements Omit<PieceBase, 'version' | 'name'> {
|
|
8
9
|
readonly displayName: string;
|
|
9
10
|
readonly logoUrl: string;
|
|
10
11
|
readonly authors: string[];
|
|
11
12
|
readonly events: PieceEventProcessors | undefined;
|
|
12
13
|
readonly categories: PieceCategory[];
|
|
13
14
|
readonly auth?: PieceAuth | undefined;
|
|
14
|
-
readonly minimumSupportedRelease
|
|
15
|
+
readonly minimumSupportedRelease: string;
|
|
15
16
|
readonly maximumSupportedRelease?: string | undefined;
|
|
16
17
|
readonly description: string;
|
|
17
18
|
private readonly _actions;
|
|
18
19
|
private readonly _triggers;
|
|
19
|
-
|
|
20
|
+
getContextInfo: (() => {
|
|
21
|
+
version: ContextVersion;
|
|
22
|
+
}) | undefined;
|
|
23
|
+
constructor(displayName: string, logoUrl: string, authors: string[], events: PieceEventProcessors | undefined, actions: Action<PieceAuth>[], triggers: Trigger<PieceAuth>[], categories: PieceCategory[], auth?: PieceAuth | undefined, minimumSupportedRelease?: string, maximumSupportedRelease?: string | undefined, description?: string);
|
|
20
24
|
metadata(): BackwardCompatiblePieceMetadata;
|
|
21
|
-
getAction(actionName: string): Action | undefined;
|
|
22
|
-
getTrigger(triggerName: string): Trigger | undefined;
|
|
23
|
-
actions(): Record<string, Action
|
|
24
|
-
triggers(): Record<string, Trigger
|
|
25
|
+
getAction(actionName: string): Action<PieceAuth> | undefined;
|
|
26
|
+
getTrigger(triggerName: string): Trigger<PieceAuth> | undefined;
|
|
27
|
+
actions(): Record<string, Action<PieceAuth>>;
|
|
28
|
+
triggers(): Record<string, Trigger<PieceAuth>>;
|
|
25
29
|
}
|
|
26
|
-
export declare const createPiece: <PieceAuth extends PieceAuthProperty>(params: CreatePieceParams<PieceAuth>) => Piece<PieceAuth>;
|
|
27
|
-
type CreatePieceParams<PieceAuth extends PieceAuthProperty
|
|
30
|
+
export declare const createPiece: <PieceAuth extends PieceAuthProperty | undefined>(params: CreatePieceParams<PieceAuth>) => Piece<PieceAuth>;
|
|
31
|
+
type CreatePieceParams<PieceAuth extends PieceAuthProperty | undefined> = {
|
|
28
32
|
displayName: string;
|
|
29
33
|
logoUrl: string;
|
|
30
34
|
authors: string[];
|
|
@@ -48,7 +52,7 @@ type PieceEventProcessors = {
|
|
|
48
52
|
appWebhookUrl: string;
|
|
49
53
|
}) => boolean;
|
|
50
54
|
};
|
|
51
|
-
type BackwardCompatiblePieceMetadata = Omit<PieceMetadata, 'name' | 'version' | 'authors' | 'i18n'> & {
|
|
55
|
+
type BackwardCompatiblePieceMetadata = Omit<PieceMetadata, 'name' | 'version' | 'authors' | 'i18n' | 'getContextInfo'> & {
|
|
52
56
|
authors?: PieceMetadata['authors'];
|
|
53
57
|
i18n?: PieceMetadata['i18n'];
|
|
54
58
|
};
|
package/src/lib/piece.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPiece = exports.Piece = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const versioning_1 = require("./context/versioning");
|
|
6
|
+
const semver = tslib_1.__importStar(require("semver"));
|
|
4
7
|
class Piece {
|
|
5
|
-
constructor(displayName, logoUrl, authors, events, actions, triggers, categories, auth, minimumSupportedRelease, maximumSupportedRelease, description = '') {
|
|
8
|
+
constructor(displayName, logoUrl, authors, events, actions, triggers, categories, auth, minimumSupportedRelease = versioning_1.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION, maximumSupportedRelease, description = '') {
|
|
6
9
|
this.displayName = displayName;
|
|
7
10
|
this.logoUrl = logoUrl;
|
|
8
11
|
this.authors = authors;
|
|
@@ -14,10 +17,16 @@ class Piece {
|
|
|
14
17
|
this.description = description;
|
|
15
18
|
this._actions = {};
|
|
16
19
|
this._triggers = {};
|
|
20
|
+
// this method didn't exist in older version
|
|
21
|
+
this.getContextInfo = () => ({ version: versioning_1.LATEST_CONTEXT_VERSION });
|
|
22
|
+
if (!semver.valid(minimumSupportedRelease) || semver.lt(minimumSupportedRelease, versioning_1.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION)) {
|
|
23
|
+
this.minimumSupportedRelease = versioning_1.MINIMUM_SUPPORTED_RELEASE_AFTER_LATEST_CONTEXT_VERSION;
|
|
24
|
+
}
|
|
17
25
|
actions.forEach((action) => (this._actions[action.name] = action));
|
|
18
26
|
triggers.forEach((trigger) => (this._triggers[trigger.name] = trigger));
|
|
19
27
|
}
|
|
20
28
|
metadata() {
|
|
29
|
+
var _a;
|
|
21
30
|
return {
|
|
22
31
|
displayName: this.displayName,
|
|
23
32
|
logoUrl: this.logoUrl,
|
|
@@ -28,7 +37,8 @@ class Piece {
|
|
|
28
37
|
authors: this.authors,
|
|
29
38
|
auth: this.auth,
|
|
30
39
|
minimumSupportedRelease: this.minimumSupportedRelease,
|
|
31
|
-
maximumSupportedRelease: this.maximumSupportedRelease
|
|
40
|
+
maximumSupportedRelease: this.maximumSupportedRelease,
|
|
41
|
+
contextInfo: (_a = this.getContextInfo) === null || _a === void 0 ? void 0 : _a.call(this)
|
|
32
42
|
};
|
|
33
43
|
}
|
|
34
44
|
getAction(actionName) {
|
package/src/lib/piece.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piece.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"piece.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/piece.ts"],"names":[],"mappings":";;;;AAUA,qDAAsI;AACtI,uDAAiC;AAIjC,MAAa,KAAK;IAOhB,YACkB,WAAmB,EACnB,OAAe,EACf,OAAiB,EACjB,MAAwC,EACxD,OAA4B,EAC5B,QAA8B,EACd,UAA2B,EAC3B,IAAgB,EAChB,0BAAkC,mEAAsD,EACxF,uBAAgC,EAChC,cAAc,EAAE;QAVhB,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAU;QACjB,WAAM,GAAN,MAAM,CAAkC;QAGxC,eAAU,GAAV,UAAU,CAAiB;QAC3B,SAAI,GAAJ,IAAI,CAAY;QAChB,4BAAuB,GAAvB,uBAAuB,CAAiE;QACxF,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,gBAAW,GAAX,WAAW,CAAK;QAfjB,aAAQ,GAAsC,EAAE,CAAC;QACjD,cAAS,GAAuC,EAAE,CAAC;QACpE,4CAA4C;QACrC,mBAAc,GAAoD,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,mCAAsB,EAAE,CAAC,CAAC;QAcnH,IAAG,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,mEAAsD,CAAC,EAAE,CAAC;YACxI,IAAI,CAAC,uBAAuB,GAAG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M,CAAC,OAAO,EACd,MAAA,MAAM,CAAC,OAAO,mCAAI,EAAE,EACpB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAA,MAAM,CAAC,UAAU,mCAAI,EAAE,EACvB,MAAA,MAAM,CAAC,IAAI,mCAAI,SAAS,EACxB,MAAM,CAAC,uBAAuB,EAC9B,MAAM,CAAC,uBAAuB,EAC9B,MAAM,CAAC,WAAW,CACnB,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,WAAW,eAgBtB"}
|
|
@@ -182,5 +182,5 @@ export declare const OAuth2Property: import("@sinclair/typebox").TObject<{
|
|
|
182
182
|
grantType: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TEnum<typeof OAuth2GrantType>, import("@sinclair/typebox").TLiteral<"both_client_credentials_and_authorization_code">]>, import("@sinclair/typebox").TSchema]>;
|
|
183
183
|
extra: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>, import("@sinclair/typebox").TSchema]>;
|
|
184
184
|
}>;
|
|
185
|
-
export type OAuth2Property<T extends OAuth2Props> = BasePieceAuthSchema<OAuth2PropertyValue
|
|
185
|
+
export type OAuth2Property<T extends OAuth2Props> = BasePieceAuthSchema<OAuth2PropertyValue<T>> & OAuth2ExtraProps & TPropertyValue<OAuth2PropertyValue<T>, PropertyType.OAUTH2, true>;
|
|
186
186
|
export {};
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { BasePropertySchema, TPropertyValue } from "../common";
|
|
2
2
|
import { DropdownState } from "./common";
|
|
3
|
-
import { PropertyContext } from "../../../context";
|
|
3
|
+
import { AppConnectionValueForAuthProperty, PropertyContext } from "../../../context";
|
|
4
4
|
import { PropertyType } from "../property-type";
|
|
5
|
-
|
|
5
|
+
import { PieceAuthProperty } from "../../authentication";
|
|
6
|
+
type DynamicDropdownOptions<T, PieceAuth extends PieceAuthProperty | undefined = undefined> = (propsValue: Record<string, unknown> & {
|
|
7
|
+
auth?: PieceAuth extends undefined ? undefined : AppConnectionValueForAuthProperty<Exclude<PieceAuth, undefined>>;
|
|
8
|
+
}, ctx: PropertyContext) => Promise<DropdownState<T>>;
|
|
6
9
|
export declare const DropdownProperty: import("@sinclair/typebox").TObject<{
|
|
7
10
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
8
11
|
[x: number]: import("@sinclair/typebox").TSchema;
|
|
9
12
|
displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
10
13
|
description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
11
14
|
}>;
|
|
12
|
-
export type DropdownProperty<T, R extends boolean> = BasePropertySchema & {
|
|
15
|
+
export type DropdownProperty<T, R extends boolean, PieceAuth extends PieceAuthProperty | undefined = undefined> = BasePropertySchema & {
|
|
16
|
+
/**
|
|
17
|
+
* A dummy property used to infer {@code PieceAuth} type
|
|
18
|
+
*/
|
|
19
|
+
auth: PieceAuth;
|
|
13
20
|
refreshers: string[];
|
|
14
21
|
refreshOnSearch?: boolean;
|
|
15
|
-
options: DynamicDropdownOptions<T>;
|
|
22
|
+
options: DynamicDropdownOptions<T, PieceAuth>;
|
|
16
23
|
} & TPropertyValue<T, PropertyType.DROPDOWN, R>;
|
|
17
24
|
export declare const MultiSelectDropdownProperty: import("@sinclair/typebox").TObject<{
|
|
18
25
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
@@ -20,9 +27,13 @@ export declare const MultiSelectDropdownProperty: import("@sinclair/typebox").TO
|
|
|
20
27
|
displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
21
28
|
description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
22
29
|
}>;
|
|
23
|
-
export type MultiSelectDropdownProperty<T, R extends boolean> = BasePropertySchema & {
|
|
30
|
+
export type MultiSelectDropdownProperty<T, R extends boolean, PieceAuth extends PieceAuthProperty | undefined = undefined> = BasePropertySchema & {
|
|
31
|
+
/**
|
|
32
|
+
* A dummy property used to infer {@code PieceAuth} type
|
|
33
|
+
*/
|
|
34
|
+
auth: PieceAuth;
|
|
24
35
|
refreshers: string[];
|
|
25
36
|
refreshOnSearch?: boolean;
|
|
26
|
-
options: DynamicDropdownOptions<T>;
|
|
37
|
+
options: DynamicDropdownOptions<T, PieceAuth>;
|
|
27
38
|
} & TPropertyValue<T[], PropertyType.MULTI_SELECT_DROPDOWN, R>;
|
|
28
39
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-prop.js","sourceRoot":"","sources":["../../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/dropdown/dropdown-prop.ts"],"names":[],"mappings":";;;AAAA,sCAA+D;AAG/D,+CAAyC;AACzC,oDAAgD;
|
|
1
|
+
{"version":3,"file":"dropdown-prop.js","sourceRoot":"","sources":["../../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/dropdown/dropdown-prop.ts"],"names":[],"mappings":";;;AAAA,sCAA+D;AAG/D,+CAAyC;AACzC,oDAAgD;AAUnC,QAAA,gBAAgB,GAAG,cAAI,CAAC,SAAS,CAAC;IAC7C,2BAAkB;IAClB,IAAA,uBAAc,EAAC,cAAI,CAAC,OAAO,EAAE,EAAE,4BAAY,CAAC,QAAQ,CAAC;IACrD,cAAI,CAAC,MAAM,CAAC;QACV,UAAU,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;KACtC,CAAC;CACH,CAAC,CAAC;AAaU,QAAA,2BAA2B,GAAG,cAAI,CAAC,SAAS,CAAC;IACxD,2BAAkB;IAClB,IAAA,uBAAc,EAAC,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC,EAAE,4BAAY,CAAC,qBAAqB,CAAC;IAC9E,cAAI,CAAC,MAAM,CAAC;QACV,UAAU,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;KACtC,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { StaticDropdownProperty, StaticMultiSelectDropdownProperty } from "./dropdown/static-dropdown";
|
|
2
2
|
import { ShortTextProperty } from "./text-property";
|
|
3
3
|
import { BasePropertySchema, TPropertyValue } from "./common";
|
|
4
|
-
import { PropertyContext } from "../../context";
|
|
4
|
+
import { AppConnectionValueForAuthProperty, PropertyContext } from "../../context";
|
|
5
5
|
import { PropertyType } from "./property-type";
|
|
6
6
|
import { JsonProperty } from "./json-property";
|
|
7
7
|
import { ArrayProperty } from "./array-property";
|
|
8
|
-
import { InputPropertyMap } from "..";
|
|
8
|
+
import { InputPropertyMap, PieceAuthProperty } from "..";
|
|
9
9
|
export declare const DynamicProp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
10
10
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
11
11
|
[x: number]: import("@sinclair/typebox").TSchema;
|
|
@@ -223,7 +223,12 @@ export declare const DynamicProperties: import("@sinclair/typebox").TObject<{
|
|
|
223
223
|
displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
224
224
|
description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
225
225
|
}>;
|
|
226
|
-
export type DynamicProperties<R extends boolean> = BasePropertySchema & {
|
|
227
|
-
|
|
226
|
+
export type DynamicProperties<R extends boolean, PieceAuth extends PieceAuthProperty | undefined = undefined> = BasePropertySchema & {
|
|
227
|
+
auth: PieceAuth;
|
|
228
|
+
props: DynamicPropertiesOptions<PieceAuth>;
|
|
228
229
|
refreshers: string[];
|
|
229
230
|
} & TPropertyValue<DynamicPropsValue, PropertyType.DYNAMIC, R>;
|
|
231
|
+
type DynamicPropertiesOptions<PieceAuth extends PieceAuthProperty | undefined = undefined> = (propsValue: Record<string, unknown> & {
|
|
232
|
+
auth?: PieceAuth extends undefined ? undefined : AppConnectionValueForAuthProperty<Exclude<PieceAuth, undefined>>;
|
|
233
|
+
}, ctx: PropertyContext) => Promise<InputPropertyMap>;
|
|
234
|
+
export {};
|
|
@@ -13,6 +13,7 @@ import { ObjectProperty } from './object-property';
|
|
|
13
13
|
import { LongTextProperty, ShortTextProperty } from './text-property';
|
|
14
14
|
import { CustomProperty, CustomPropertyCodeFunctionParams } from './custom-property';
|
|
15
15
|
import { ColorProperty } from './color-property';
|
|
16
|
+
import { PieceAuthProperty } from '../authentication';
|
|
16
17
|
export declare const InputProperty: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
17
18
|
[x: string]: import("@sinclair/typebox").TSchema;
|
|
18
19
|
[x: number]: import("@sinclair/typebox").TSchema;
|
|
@@ -173,7 +174,7 @@ export declare const InputProperty: import("@sinclair/typebox").TUnion<[import("
|
|
|
173
174
|
displayName: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
174
175
|
description: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TSchema]>;
|
|
175
176
|
}>]>;
|
|
176
|
-
export type InputProperty = ShortTextProperty<boolean> | LongTextProperty<boolean> | MarkDownProperty | CheckboxProperty<boolean> | DropdownProperty<any, boolean> | StaticDropdownProperty<any, boolean> | NumberProperty<boolean> | ArrayProperty<boolean> | ObjectProperty<boolean> | JsonProperty<boolean> | MultiSelectDropdownProperty<unknown, boolean> | StaticMultiSelectDropdownProperty<unknown, boolean> | DynamicProperties<boolean> | DateTimeProperty<boolean> | FileProperty<boolean> | CustomProperty<boolean> | ColorProperty<boolean>;
|
|
177
|
+
export type InputProperty = ShortTextProperty<boolean> | LongTextProperty<boolean> | MarkDownProperty | CheckboxProperty<boolean> | DropdownProperty<any, boolean, PieceAuthProperty | undefined> | StaticDropdownProperty<any, boolean> | NumberProperty<boolean> | ArrayProperty<boolean> | ObjectProperty<boolean> | JsonProperty<boolean> | MultiSelectDropdownProperty<unknown, boolean, PieceAuthProperty | undefined> | StaticMultiSelectDropdownProperty<unknown, boolean> | DynamicProperties<boolean, PieceAuthProperty | undefined> | DateTimeProperty<boolean> | FileProperty<boolean> | CustomProperty<boolean> | ColorProperty<boolean>;
|
|
177
178
|
type Properties<T> = Omit<T, 'valueSchema' | 'type' | 'defaultValidators' | 'defaultProcessors'>;
|
|
178
179
|
export declare const Property: {
|
|
179
180
|
ShortText<R extends boolean>(request: Properties<ShortTextProperty<R>>): R extends true ? ShortTextProperty<true> : ShortTextProperty<false>;
|
|
@@ -187,10 +188,10 @@ export declare const Property: {
|
|
|
187
188
|
Json<R extends boolean>(request: Properties<JsonProperty<R>>): R extends true ? JsonProperty<true> : JsonProperty<false>;
|
|
188
189
|
Array<R extends boolean>(request: Properties<ArrayProperty<R>>): R extends true ? ArrayProperty<true> : ArrayProperty<false>;
|
|
189
190
|
Object<R extends boolean>(request: Properties<ObjectProperty<R>>): R extends true ? ObjectProperty<true> : ObjectProperty<false>;
|
|
190
|
-
Dropdown<T, R extends boolean = boolean>(request: Properties<DropdownProperty<T, R>>): R extends true ? DropdownProperty<T, true> : DropdownProperty<T, false>;
|
|
191
|
+
Dropdown<T, R extends boolean = boolean, PieceAuth extends PieceAuthProperty | undefined = undefined>(request: Properties<DropdownProperty<T, R, PieceAuth>>): R extends true ? DropdownProperty<T, true, PieceAuth> : DropdownProperty<T, false, PieceAuth>;
|
|
191
192
|
StaticDropdown<T, R extends boolean = boolean>(request: Properties<StaticDropdownProperty<T, R>>): R extends true ? StaticDropdownProperty<T, true> : StaticDropdownProperty<T, false>;
|
|
192
|
-
MultiSelectDropdown<T, R extends boolean = boolean>(request: Properties<MultiSelectDropdownProperty<T, R>>): R extends true ? MultiSelectDropdownProperty<T, true> : MultiSelectDropdownProperty<T, false>;
|
|
193
|
-
DynamicProperties<R extends boolean = boolean>(request: Properties<DynamicProperties<R>>): R extends true ? DynamicProperties<true> : DynamicProperties<false>;
|
|
193
|
+
MultiSelectDropdown<T, R extends boolean = boolean, PieceAuth extends PieceAuthProperty | undefined = undefined>(request: Properties<MultiSelectDropdownProperty<T, R, PieceAuth>>): R extends true ? MultiSelectDropdownProperty<T, true, PieceAuth> : MultiSelectDropdownProperty<T, false, PieceAuth>;
|
|
194
|
+
DynamicProperties<R extends boolean = boolean, PieceAuth extends PieceAuthProperty | undefined = undefined>(request: Properties<DynamicProperties<R, PieceAuth>>): R extends true ? DynamicProperties<true, PieceAuth> : DynamicProperties<false, PieceAuth>;
|
|
194
195
|
StaticMultiSelectDropdown<T, R extends boolean = boolean>(request: Properties<StaticMultiSelectDropdownProperty<T, R>>): R extends true ? StaticMultiSelectDropdownProperty<T, true> : StaticMultiSelectDropdownProperty<T, false>;
|
|
195
196
|
DateTime<R extends boolean>(request: Properties<DateTimeProperty<R>>): R extends true ? DateTimeProperty<true> : DateTimeProperty<false>;
|
|
196
197
|
File<R extends boolean>(request: Properties<FileProperty<R>>): R extends true ? FileProperty<true> : FileProperty<false>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/index.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,qDAAiD;AACjD,2DAAuD;AACvD,6DAAwD;AACxD,4DAGkC;AAClC,gEAGoC;AACpC,iDAAmD;AACnD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,iDAAuD;AACvD,uDAAmD;AACnD,uDAAmD;AACnD,mDAA+C;AAC/C,mDAAsE;AAEtE,qDAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/framework/src/lib/property/input/index.ts"],"names":[],"mapp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Q,CACN,OAAwC;QAExC,OAAO,gCACF,OAAO,KACV,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,4BAAY,CAAC,SAAS,GAGH,CAAC;IAC9B,CAAC;IACD,IAAI,CACF,OAAoC;QAEpC,OAAO,gCACF,OAAO,KACV,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,4BAAY,CAAC,IAAI,GACgD,CAAC;IAC5E,CAAC;IACD,MAAM,CACJ,OASC;QAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrC,OAAO,gCACF,OAAO,KACV,IAAI,EACJ,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,4BAAY,CAAC,MAAM,GACkD,CAAC;IAChF,CAAC;IACD,KAAK,CACH,OAAqC;QAErC,OAAO,gCACF,OAAO,KACV,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,4BAAY,CAAC,KAAK,GAGF,CAAC;IAC3B,CAAC;CACF,CAAC"}
|
|
@@ -10,7 +10,7 @@ export declare enum WebhookRenewStrategy {
|
|
|
10
10
|
CRON = "CRON",
|
|
11
11
|
NONE = "NONE"
|
|
12
12
|
}
|
|
13
|
-
type OnStartRunner<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> = (ctx: OnStartContext<PieceAuth, TriggerProps>) => Promise<unknown | void>;
|
|
13
|
+
type OnStartRunner<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap> = (ctx: OnStartContext<PieceAuth, TriggerProps>) => Promise<unknown | void>;
|
|
14
14
|
export declare const WebhookRenewConfiguration: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
15
15
|
strategy: import("@sinclair/typebox").TLiteral<WebhookRenewStrategy.CRON>;
|
|
16
16
|
cronExpression: import("@sinclair/typebox").TString;
|
|
@@ -23,7 +23,7 @@ export interface WebhookResponse {
|
|
|
23
23
|
body?: any;
|
|
24
24
|
headers?: Record<string, string>;
|
|
25
25
|
}
|
|
26
|
-
type BaseTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = {
|
|
26
|
+
type BaseTriggerParams<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = {
|
|
27
27
|
name: string;
|
|
28
28
|
displayName: string;
|
|
29
29
|
description: string;
|
|
@@ -38,14 +38,14 @@ type BaseTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends
|
|
|
38
38
|
onStart?: OnStartRunner<PieceAuth, TriggerProps>;
|
|
39
39
|
sampleData: unknown;
|
|
40
40
|
};
|
|
41
|
-
type WebhookTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = BaseTriggerParams<PieceAuth, TriggerProps, TS> & {
|
|
41
|
+
type WebhookTriggerParams<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = BaseTriggerParams<PieceAuth, TriggerProps, TS> & {
|
|
42
42
|
handshakeConfiguration?: WebhookHandshakeConfiguration;
|
|
43
43
|
onHandshake?: (context: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>;
|
|
44
44
|
renewConfiguration?: WebhookRenewConfiguration;
|
|
45
45
|
onRenew?(context: TriggerHookContext<PieceAuth, TriggerProps, TS>): Promise<void>;
|
|
46
46
|
};
|
|
47
|
-
type CreateTriggerParams<PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = TS extends TriggerStrategy.WEBHOOK ? WebhookTriggerParams<PieceAuth, TriggerProps, TS> : BaseTriggerParams<PieceAuth, TriggerProps, TS>;
|
|
48
|
-
export declare class ITrigger<TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap> implements TriggerBase {
|
|
47
|
+
type CreateTriggerParams<PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap, TS extends TriggerStrategy> = TS extends TriggerStrategy.WEBHOOK ? WebhookTriggerParams<PieceAuth, TriggerProps, TS> : BaseTriggerParams<PieceAuth, TriggerProps, TS>;
|
|
48
|
+
export declare class ITrigger<TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap> implements TriggerBase {
|
|
49
49
|
readonly name: string;
|
|
50
50
|
readonly displayName: string;
|
|
51
51
|
readonly description: string;
|
|
@@ -65,5 +65,5 @@ export declare class ITrigger<TS extends TriggerStrategy, PieceAuth extends Piec
|
|
|
65
65
|
readonly testStrategy: TriggerTestStrategy;
|
|
66
66
|
constructor(name: string, displayName: string, description: string, requireAuth: boolean, props: TriggerProps, type: TS, handshakeConfiguration: WebhookHandshakeConfiguration, onHandshake: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<WebhookResponse>, renewConfiguration: WebhookRenewConfiguration, onRenew: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onEnable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onDisable: (ctx: TriggerHookContext<PieceAuth, TriggerProps, TS>) => Promise<void>, onStart: OnStartRunner<PieceAuth, TriggerProps>, run: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, test: (ctx: TestOrRunHookContext<PieceAuth, TriggerProps, TS>) => Promise<unknown[]>, sampleData: unknown, testStrategy: TriggerTestStrategy);
|
|
67
67
|
}
|
|
68
|
-
export type Trigger<PieceAuth extends PieceAuthProperty =
|
|
69
|
-
export declare const createTrigger: <TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty, TriggerProps extends InputPropertyMap>(params: CreateTriggerParams<PieceAuth, TriggerProps, TS>) => ITrigger<TriggerStrategy.WEBHOOK, PieceAuth, TriggerProps> | ITrigger<TriggerStrategy.POLLING, PieceAuth, TriggerProps> | ITrigger<TriggerStrategy.APP_WEBHOOK, PieceAuth, TriggerProps>;
|
|
68
|
+
export type Trigger<PieceAuth extends PieceAuthProperty | undefined = PieceAuthProperty, TriggerProps extends InputPropertyMap = any, S extends TriggerStrategy = TriggerStrategy> = ITrigger<S, PieceAuth, TriggerProps>;
|
|
69
|
+
export declare const createTrigger: <TS extends TriggerStrategy, PieceAuth extends PieceAuthProperty | undefined, TriggerProps extends InputPropertyMap>(params: CreateTriggerParams<PieceAuth, TriggerProps, TS>) => ITrigger<TriggerStrategy.WEBHOOK, PieceAuth, TriggerProps> | ITrigger<TriggerStrategy.POLLING, PieceAuth, TriggerProps> | ITrigger<TriggerStrategy.APP_WEBHOOK, PieceAuth, TriggerProps>;
|
package/src/lib/context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/framework/src/lib/context.ts"],"names":[],"mappings":";;;AAwOA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iDAAiD;IACjD,oCAAsB,CAAA;IACtB,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB"}
|