@activepieces/pieces-framework 0.3.13
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/README.md +11 -0
- package/package.json +13 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/action/action.d.ts +22 -0
- package/src/lib/action/action.js +18 -0
- package/src/lib/action/action.js.map +1 -0
- package/src/lib/context.d.ts +46 -0
- package/src/lib/context.js +9 -0
- package/src/lib/context.js.map +1 -0
- package/src/lib/index.d.ts +6 -0
- package/src/lib/index.js +10 -0
- package/src/lib/index.js.map +1 -0
- package/src/lib/piece-metadata.d.ts +29 -0
- package/src/lib/piece-metadata.js +3 -0
- package/src/lib/piece-metadata.js.map +1 -0
- package/src/lib/piece.d.ts +61 -0
- package/src/lib/piece.js +50 -0
- package/src/lib/piece.js.map +1 -0
- package/src/lib/property/base-prop.d.ts +19 -0
- package/src/lib/property/base-prop.js +3 -0
- package/src/lib/property/base-prop.js.map +1 -0
- package/src/lib/property/basic-auth-prop.d.ts +17 -0
- package/src/lib/property/basic-auth-prop.js +3 -0
- package/src/lib/property/basic-auth-prop.js.map +1 -0
- package/src/lib/property/custom-auth-prop.d.ts +12 -0
- package/src/lib/property/custom-auth-prop.js +3 -0
- package/src/lib/property/custom-auth-prop.js.map +1 -0
- package/src/lib/property/dropdown-prop.d.ts +27 -0
- package/src/lib/property/dropdown-prop.js +3 -0
- package/src/lib/property/dropdown-prop.js.map +1 -0
- package/src/lib/property/dynamic-prop.d.ts +11 -0
- package/src/lib/property/dynamic-prop.js +3 -0
- package/src/lib/property/dynamic-prop.js.map +1 -0
- package/src/lib/property/index.d.ts +7 -0
- package/src/lib/property/index.js +11 -0
- package/src/lib/property/index.js.map +1 -0
- package/src/lib/property/oauth2-prop.d.ts +24 -0
- package/src/lib/property/oauth2-prop.js +3 -0
- package/src/lib/property/oauth2-prop.js.map +1 -0
- package/src/lib/property/property.d.ts +53 -0
- package/src/lib/property/property.js +73 -0
- package/src/lib/property/property.js.map +1 -0
- package/src/lib/trigger/trigger.d.ts +35 -0
- package/src/lib/trigger/trigger.js +29 -0
- package/src/lib/trigger/trigger.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# pieces-framework
|
|
2
|
+
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
Run `nx build pieces-framework` to build the library.
|
|
8
|
+
|
|
9
|
+
## Running unit tests
|
|
10
|
+
|
|
11
|
+
Run `nx test pieces-framework` to execute the unit tests via [Jest](https://jestjs.io).
|
package/package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/pieces-framework",
|
|
3
|
+
"version": "0.3.13",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@sinclair/typebox": "0.26.8",
|
|
7
|
+
"nanoid": "3.3.4",
|
|
8
|
+
"@activepieces/shared": "0.3.11",
|
|
9
|
+
"tslib": "2.4.1"
|
|
10
|
+
},
|
|
11
|
+
"main": "./src/index.js",
|
|
12
|
+
"types": "./src/index.d.ts"
|
|
13
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/framework/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAqB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ActionContext } from '../context';
|
|
2
|
+
import { ActionBase } from '../piece-metadata';
|
|
3
|
+
import { PiecePropertyMap, StaticPropsValue } from '../property/property';
|
|
4
|
+
declare class IAction<T extends PiecePropertyMap> implements ActionBase {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly displayName: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly props: T;
|
|
9
|
+
readonly run: (ctx: ActionContext<StaticPropsValue<T>>) => Promise<unknown | void>;
|
|
10
|
+
readonly sampleData: unknown;
|
|
11
|
+
constructor(name: string, displayName: string, description: string, props: T, run: (ctx: ActionContext<StaticPropsValue<T>>) => Promise<unknown | void>, sampleData?: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare type Action = IAction<any>;
|
|
14
|
+
export declare function createAction<T extends PiecePropertyMap>(request: {
|
|
15
|
+
name: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
description: string;
|
|
18
|
+
props: T;
|
|
19
|
+
run: (context: ActionContext<StaticPropsValue<T>>) => Promise<unknown | void>;
|
|
20
|
+
sampleData?: unknown;
|
|
21
|
+
}): Action;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAction = void 0;
|
|
4
|
+
class IAction {
|
|
5
|
+
constructor(name, displayName, description, props, run, sampleData = {}) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.displayName = displayName;
|
|
8
|
+
this.description = description;
|
|
9
|
+
this.props = props;
|
|
10
|
+
this.run = run;
|
|
11
|
+
this.sampleData = sampleData;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function createAction(request) {
|
|
15
|
+
return new IAction(request.name, request.displayName, request.description, request.props, request.run, request.sampleData);
|
|
16
|
+
}
|
|
17
|
+
exports.createAction = createAction;
|
|
18
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/action/action.ts"],"names":[],"mappings":";;;AAIA,MAAM,OAAO;IACX,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAQ,EACR,GAEY,EACZ,aAAsB,EAAE;QAPxB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAG;QACR,QAAG,GAAH,GAAG,CAES;QACZ,eAAU,GAAV,UAAU,CAAc;IACvC,CAAC;CACL;AAID,SAAgB,YAAY,CAA6B,OAOxD;IACC,OAAO,IAAI,OAAO,CAChB,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,UAAU,CACnB,CAAC;AACJ,CAAC;AAhBD,oCAgBC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AppConnectionValue, ScheduleOptions } from "@activepieces/shared";
|
|
2
|
+
import { TriggerStrategy } from "./trigger/trigger";
|
|
3
|
+
export declare type TriggerHookContext<T, S extends TriggerStrategy> = S extends TriggerStrategy.APP_WEBHOOK ? {
|
|
4
|
+
webhookUrl: string;
|
|
5
|
+
app: {
|
|
6
|
+
createListeners({ events, identifierValue }: {
|
|
7
|
+
events: string[];
|
|
8
|
+
identifierValue: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
propsValue: T;
|
|
12
|
+
store: Store;
|
|
13
|
+
} : S extends TriggerStrategy.POLLING ? {
|
|
14
|
+
propsValue: T;
|
|
15
|
+
setSchedule(schedule: ScheduleOptions): void;
|
|
16
|
+
store: Store;
|
|
17
|
+
} : {
|
|
18
|
+
webhookUrl: string;
|
|
19
|
+
propsValue: T;
|
|
20
|
+
store: Store;
|
|
21
|
+
};
|
|
22
|
+
export interface TriggerContext<T> {
|
|
23
|
+
payload: Record<string, never> | {
|
|
24
|
+
body: any;
|
|
25
|
+
headers: Record<string, string>;
|
|
26
|
+
queryParams: Record<string, string>;
|
|
27
|
+
};
|
|
28
|
+
propsValue: T;
|
|
29
|
+
store: Store;
|
|
30
|
+
}
|
|
31
|
+
export interface ActionContext<T> {
|
|
32
|
+
propsValue: T;
|
|
33
|
+
store: Store;
|
|
34
|
+
connections: ConnectionsManager;
|
|
35
|
+
}
|
|
36
|
+
export interface ConnectionsManager {
|
|
37
|
+
get(key: string): Promise<AppConnectionValue | Record<string, unknown> | string | null>;
|
|
38
|
+
}
|
|
39
|
+
export interface Store {
|
|
40
|
+
put<T>(key: string, value: T, scope?: StoreScope): Promise<T>;
|
|
41
|
+
get<T>(key: string, scope?: StoreScope): Promise<T | null>;
|
|
42
|
+
}
|
|
43
|
+
export declare enum StoreScope {
|
|
44
|
+
COLLECTION = "COLLECTION",
|
|
45
|
+
FLOW = "FLOW"
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StoreScope = void 0;
|
|
4
|
+
var StoreScope;
|
|
5
|
+
(function (StoreScope) {
|
|
6
|
+
StoreScope["COLLECTION"] = "COLLECTION";
|
|
7
|
+
StoreScope["FLOW"] = "FLOW";
|
|
8
|
+
})(StoreScope = exports.StoreScope || (exports.StoreScope = {}));
|
|
9
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../../../packages/pieces/framework/src/lib/context.ts"],"names":[],"mappings":";;;AA+CA,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,uCAAyB,CAAA;IACzB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
|
package/src/lib/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./action/action"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./property"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./trigger/trigger"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./context"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./piece"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./piece-metadata"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/framework/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,0DAA+B;AAC/B,qDAA0B;AAC1B,4DAAiC;AACjC,oDAAyB;AACzB,kDAAuB;AACvB,2DAAgC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PiecePropertyMap } from "./property";
|
|
2
|
+
import { TriggerStrategy } from "./trigger/trigger";
|
|
3
|
+
export declare type PieceBase = {
|
|
4
|
+
name: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
logoUrl: string;
|
|
7
|
+
description: string;
|
|
8
|
+
version: string;
|
|
9
|
+
minimumSupportedRelease?: string;
|
|
10
|
+
maximumSupportedRelease?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type ActionBase = {
|
|
13
|
+
name: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
description: string;
|
|
16
|
+
sampleData: unknown;
|
|
17
|
+
props: PiecePropertyMap;
|
|
18
|
+
};
|
|
19
|
+
export declare type TriggerBase = ActionBase & {
|
|
20
|
+
type: TriggerStrategy;
|
|
21
|
+
};
|
|
22
|
+
export declare type PieceMetadata = PieceBase & {
|
|
23
|
+
actions: Record<string, ActionBase>;
|
|
24
|
+
triggers: Record<string, TriggerBase>;
|
|
25
|
+
};
|
|
26
|
+
export declare type PieceMetadataSummary = Omit<PieceMetadata, "actions" | "triggers"> & {
|
|
27
|
+
actions: number;
|
|
28
|
+
triggers: number;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piece-metadata.js","sourceRoot":"","sources":["../../../../../../packages/pieces/framework/src/lib/piece-metadata.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Trigger } from './trigger/trigger';
|
|
2
|
+
import { Action } from './action/action';
|
|
3
|
+
import { EventPayload, ParseEventResponse } from '@activepieces/shared';
|
|
4
|
+
import { PieceBase, PieceMetadata } from './piece-metadata';
|
|
5
|
+
export declare class Piece implements PieceBase {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly displayName: string;
|
|
8
|
+
readonly logoUrl: string;
|
|
9
|
+
readonly authors: string[];
|
|
10
|
+
readonly version: string;
|
|
11
|
+
readonly events: {
|
|
12
|
+
parseAndReply: (ctx: {
|
|
13
|
+
payload: EventPayload;
|
|
14
|
+
}) => ParseEventResponse;
|
|
15
|
+
verify: (ctx: {
|
|
16
|
+
webhookSecret: string;
|
|
17
|
+
payload: EventPayload;
|
|
18
|
+
appWebhookUrl: string;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
} | undefined;
|
|
21
|
+
readonly minimumSupportedRelease?: string | undefined;
|
|
22
|
+
readonly maximumSupportedRelease?: string | undefined;
|
|
23
|
+
readonly description: string;
|
|
24
|
+
private readonly _actions;
|
|
25
|
+
private readonly _triggers;
|
|
26
|
+
constructor(name: string, displayName: string, logoUrl: string, authors: string[], version: string, events: {
|
|
27
|
+
parseAndReply: (ctx: {
|
|
28
|
+
payload: EventPayload;
|
|
29
|
+
}) => ParseEventResponse;
|
|
30
|
+
verify: (ctx: {
|
|
31
|
+
webhookSecret: string;
|
|
32
|
+
payload: EventPayload;
|
|
33
|
+
appWebhookUrl: string;
|
|
34
|
+
}) => boolean;
|
|
35
|
+
} | undefined, actions: Action[], triggers: Trigger[], minimumSupportedRelease?: string | undefined, maximumSupportedRelease?: string | undefined, description?: string);
|
|
36
|
+
getAction(actionName: string): Action | undefined;
|
|
37
|
+
getTrigger(triggerName: string): Trigger | undefined;
|
|
38
|
+
metadata(): PieceMetadata;
|
|
39
|
+
}
|
|
40
|
+
export declare const createPiece: (request: {
|
|
41
|
+
name: string;
|
|
42
|
+
displayName: string;
|
|
43
|
+
logoUrl: string;
|
|
44
|
+
authors?: string[] | undefined;
|
|
45
|
+
actions: Action[];
|
|
46
|
+
triggers: Trigger[];
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
events?: {
|
|
49
|
+
parseAndReply: (ctx: {
|
|
50
|
+
payload: EventPayload;
|
|
51
|
+
}) => ParseEventResponse;
|
|
52
|
+
verify: (ctx: {
|
|
53
|
+
webhookSecret: string;
|
|
54
|
+
payload: EventPayload;
|
|
55
|
+
appWebhookUrl: string;
|
|
56
|
+
}) => boolean;
|
|
57
|
+
} | undefined;
|
|
58
|
+
version: string;
|
|
59
|
+
minimumSupportedRelease?: string | undefined;
|
|
60
|
+
maximumSupportedRelease?: string | undefined;
|
|
61
|
+
}) => Piece;
|
package/src/lib/piece.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPiece = exports.Piece = void 0;
|
|
4
|
+
class Piece {
|
|
5
|
+
constructor(name, displayName, logoUrl, authors, version, events, actions, triggers, minimumSupportedRelease, maximumSupportedRelease, description = '') {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.displayName = displayName;
|
|
8
|
+
this.logoUrl = logoUrl;
|
|
9
|
+
this.authors = authors;
|
|
10
|
+
this.version = version;
|
|
11
|
+
this.events = events;
|
|
12
|
+
this.minimumSupportedRelease = minimumSupportedRelease;
|
|
13
|
+
this.maximumSupportedRelease = maximumSupportedRelease;
|
|
14
|
+
this.description = description;
|
|
15
|
+
this._actions = Object.fromEntries(actions.map((action) => [action.name, action]));
|
|
16
|
+
this._triggers = Object.fromEntries(triggers.map((trigger) => [trigger.name, trigger]));
|
|
17
|
+
}
|
|
18
|
+
getAction(actionName) {
|
|
19
|
+
if (!(actionName in this._actions)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return this._actions[actionName];
|
|
23
|
+
}
|
|
24
|
+
getTrigger(triggerName) {
|
|
25
|
+
if (!(triggerName in this._triggers)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return this._triggers[triggerName];
|
|
29
|
+
}
|
|
30
|
+
metadata() {
|
|
31
|
+
return {
|
|
32
|
+
name: this.name,
|
|
33
|
+
displayName: this.displayName,
|
|
34
|
+
logoUrl: this.logoUrl,
|
|
35
|
+
actions: this._actions,
|
|
36
|
+
triggers: this._triggers,
|
|
37
|
+
description: this.description,
|
|
38
|
+
version: this.version,
|
|
39
|
+
minimumSupportedRelease: this.minimumSupportedRelease,
|
|
40
|
+
maximumSupportedRelease: this.maximumSupportedRelease,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Piece = Piece;
|
|
45
|
+
const createPiece = (request) => {
|
|
46
|
+
var _a;
|
|
47
|
+
return new Piece(request.name, request.displayName, request.logoUrl, (_a = request.authors) !== null && _a !== void 0 ? _a : [], request.version, request.events, request.actions, request.triggers, request.minimumSupportedRelease, request.maximumSupportedRelease, request.description);
|
|
48
|
+
};
|
|
49
|
+
exports.createPiece = createPiece;
|
|
50
|
+
//# sourceMappingURL=piece.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piece.js","sourceRoot":"","sources":["../../../../../../packages/pieces/framework/src/lib/piece.ts"],"names":[],"mappings":";;;AAKA,MAAa,KAAK;IAIhB,YACkB,IAAY,EACZ,WAAmB,EACnB,OAAe,EACf,OAAiB,EACjB,OAAe,EACf,MAGH,EACb,OAAiB,EACjB,QAAmB,EACH,uBAAgC,EAChC,uBAAgC,EAChC,cAAsB,EAAE;QAbxB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAA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,IAAI,CAAC,uBAAuB;SACtD,CAAC;IACJ,CAAC;CACF;AAxDD,sBAwDC;AAEM,MAAM,WAAW,GAAG,CAAC,OAe3B,EAAS,EAAE;;IACV,OAAA,IAAI,KAAK,CACP,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,OAAO,EACf,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,EACrB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,uBAAuB,EAC/B,OAAO,CAAC,uBAAuB,EAC/B,OAAO,CAAC,WAAW,CACpB,CAAA;CAAA,CAAC;AA5BS,QAAA,WAAW,eA4BpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PropertyType } from "./property";
|
|
2
|
+
export declare type BasePropertySchema = {
|
|
3
|
+
displayName: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type TPropertyValue<T, U extends PropertyType, REQUIRED extends boolean> = {
|
|
7
|
+
valueSchema: T;
|
|
8
|
+
type: U;
|
|
9
|
+
required: REQUIRED;
|
|
10
|
+
defaultValue?: U extends PropertyType.ARRAY ? unknown[] : U extends PropertyType.JSON ? object : U extends PropertyType.CHECKBOX ? boolean : U extends PropertyType.LONG_TEXT ? string : U extends PropertyType.SHORT_TEXT ? string : U extends PropertyType.NUMBER ? string : U extends PropertyType.DROPDOWN ? unknown : U extends PropertyType.MULTI_SELECT_DROPDOWN ? unknown[] : U extends PropertyType.STATIC_MULTI_SELECT_DROPDOWN ? unknown[] : U extends PropertyType.STATIC_DROPDOWN ? unknown : unknown;
|
|
11
|
+
};
|
|
12
|
+
export declare type ShortTextProperty<R extends boolean> = BasePropertySchema & TPropertyValue<string, PropertyType.SHORT_TEXT, R>;
|
|
13
|
+
export declare type LongTextProperty<R extends boolean> = BasePropertySchema & TPropertyValue<string, PropertyType.LONG_TEXT, R>;
|
|
14
|
+
export declare type SecretTextProperty<R extends boolean> = BasePropertySchema & TPropertyValue<string, PropertyType.SECRET_TEXT, R>;
|
|
15
|
+
export declare type CheckboxProperty<R extends boolean> = BasePropertySchema & TPropertyValue<boolean, PropertyType.CHECKBOX, R>;
|
|
16
|
+
export declare type NumberProperty<R extends boolean> = BasePropertySchema & TPropertyValue<number, PropertyType.NUMBER, R>;
|
|
17
|
+
export declare type ArrayProperty<R extends boolean> = BasePropertySchema & TPropertyValue<unknown[], PropertyType.ARRAY, R>;
|
|
18
|
+
export declare type ObjectProperty<R extends boolean> = BasePropertySchema & TPropertyValue<Record<string, unknown>, PropertyType.OBJECT, R>;
|
|
19
|
+
export declare type JsonProperty<R extends boolean> = BasePropertySchema & TPropertyValue<Record<string, unknown>, PropertyType.JSON, R>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-prop.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/base-prop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropertyType } from "./property";
|
|
2
|
+
import { BasePropertySchema, TPropertyValue } from "./base-prop";
|
|
3
|
+
export declare type BasicAuthPropertySchema = BasePropertySchema & {
|
|
4
|
+
username: {
|
|
5
|
+
displayName: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
};
|
|
8
|
+
password: {
|
|
9
|
+
displayName: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare type BasicAuthPropertyValue = {
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
};
|
|
17
|
+
export declare type BasicAuthProperty<R extends boolean> = BasicAuthPropertySchema & TPropertyValue<BasicAuthPropertyValue, PropertyType.BASIC_AUTH, R>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-auth-prop.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/basic-auth-prop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropertyType } from "./property";
|
|
2
|
+
import { BasePropertySchema, CheckboxProperty, NumberProperty, SecretTextProperty, ShortTextProperty, TPropertyValue } from "./base-prop";
|
|
3
|
+
import { StaticDropdownProperty } from "./dropdown-prop";
|
|
4
|
+
import { StaticPropsValue } from "./property";
|
|
5
|
+
export interface CustomAuthProps {
|
|
6
|
+
[name: string]: ShortTextProperty<boolean> | SecretTextProperty<boolean> | NumberProperty<boolean> | StaticDropdownProperty<unknown, boolean> | CheckboxProperty<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare type CustomAuthPropertyValue<T extends CustomAuthProps> = StaticPropsValue<T>;
|
|
9
|
+
export declare type CustomAuthPropertySchema<T> = BasePropertySchema & {
|
|
10
|
+
props: T;
|
|
11
|
+
};
|
|
12
|
+
export declare type CustomAuthProperty<R extends boolean, T extends CustomAuthProps> = CustomAuthPropertySchema<T> & TPropertyValue<CustomAuthPropertyValue<T>, PropertyType.CUSTOM_AUTH, R>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-auth-prop.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/custom-auth-prop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PropertyType } from "./property";
|
|
2
|
+
import { BasePropertySchema, TPropertyValue } from "./base-prop";
|
|
3
|
+
import { BasicAuthPropertyValue } from "./basic-auth-prop";
|
|
4
|
+
import { OAuth2PropertyValue } from "./oauth2-prop";
|
|
5
|
+
export declare type DropdownState<T> = {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
options: DropdownOption<T>[];
|
|
9
|
+
};
|
|
10
|
+
export declare type DropdownOption<T> = {
|
|
11
|
+
label: string;
|
|
12
|
+
value: T;
|
|
13
|
+
};
|
|
14
|
+
export declare type DropdownProperty<T, R extends boolean> = BasePropertySchema & {
|
|
15
|
+
refreshers: string[];
|
|
16
|
+
options: (propsValue: Record<string, undefined | OAuth2PropertyValue | number | string | object | BasicAuthPropertyValue | unknown[]>) => Promise<DropdownState<T>>;
|
|
17
|
+
} & TPropertyValue<T, PropertyType.DROPDOWN, R>;
|
|
18
|
+
export declare type StaticDropdownProperty<T, R extends boolean> = BasePropertySchema & {
|
|
19
|
+
options: DropdownState<T>;
|
|
20
|
+
} & TPropertyValue<T, PropertyType.STATIC_DROPDOWN, R>;
|
|
21
|
+
export declare type MultiSelectDropdownProperty<T, R extends boolean> = BasePropertySchema & {
|
|
22
|
+
refreshers: string[];
|
|
23
|
+
options: (propsValue: Record<string, OAuth2PropertyValue | number | string | object | BasicAuthPropertyValue | unknown[]>) => Promise<DropdownState<T>>;
|
|
24
|
+
} & TPropertyValue<T[], PropertyType.MULTI_SELECT_DROPDOWN, R>;
|
|
25
|
+
export declare type StaticMultiSelectDropdownProperty<T, R extends boolean> = BasePropertySchema & {
|
|
26
|
+
options: DropdownState<T>;
|
|
27
|
+
} & TPropertyValue<T[], PropertyType.STATIC_MULTI_SELECT_DROPDOWN, R>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-prop.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/dropdown-prop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropertyType } from "./property";
|
|
2
|
+
import { BasePropertySchema, NumberProperty, ShortTextProperty, TPropertyValue } from "./base-prop";
|
|
3
|
+
import { StaticDropdownProperty, StaticMultiSelectDropdownProperty } from "./dropdown-prop";
|
|
4
|
+
declare type DynamicProp = ShortTextProperty<boolean> | NumberProperty<boolean> | StaticDropdownProperty<any, boolean> | StaticMultiSelectDropdownProperty<any, boolean>;
|
|
5
|
+
export declare type DynamicPropsValue = Record<string, DynamicProp['valueSchema']>;
|
|
6
|
+
export declare type DynamicPropsSchema = BasePropertySchema & {
|
|
7
|
+
props: (propsValue: Record<string, DynamicPropsValue>) => Promise<Record<string, DynamicProp>>;
|
|
8
|
+
refreshers: string[];
|
|
9
|
+
};
|
|
10
|
+
export declare type DynamicProperties<R extends boolean> = DynamicPropsSchema & TPropertyValue<DynamicPropsValue, PropertyType.DYNAMIC, R>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-prop.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/dynamic-prop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./base-prop"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./basic-auth-prop"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./dropdown-prop"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./oauth2-prop"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./property"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./dynamic-prop"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./custom-auth-prop"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,4DAAkC;AAClC,0DAAgC;AAChC,wDAA8B;AAC9B,qDAA2B;AAC3B,yDAA+B;AAC/B,6DAAmC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropertyType } from "./property";
|
|
2
|
+
import { BasePropertySchema, NumberProperty, SecretTextProperty, ShortTextProperty, TPropertyValue } from "./base-prop";
|
|
3
|
+
import { StaticDropdownProperty } from "./dropdown-prop";
|
|
4
|
+
import { StaticPropsValue } from "./property";
|
|
5
|
+
declare type OAuthProp = ShortTextProperty<true> | SecretTextProperty<true> | NumberProperty<true> | StaticDropdownProperty<any, true>;
|
|
6
|
+
export interface OAuth2Props {
|
|
7
|
+
[name: string]: ShortTextProperty<boolean> | SecretTextProperty<boolean> | NumberProperty<boolean> | StaticDropdownProperty<unknown, boolean>;
|
|
8
|
+
}
|
|
9
|
+
export declare type OAuthPropsValue<T extends OAuth2Props> = StaticPropsValue<T>;
|
|
10
|
+
export declare type OAuth2PropertySchema = BasePropertySchema & {
|
|
11
|
+
props?: Record<string, OAuthProp>;
|
|
12
|
+
authUrl: string;
|
|
13
|
+
tokenUrl: string;
|
|
14
|
+
scope: string[];
|
|
15
|
+
pkce?: boolean;
|
|
16
|
+
extra?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
export declare type OAuth2PropertyValue<T extends OAuth2Props = any> = {
|
|
19
|
+
access_token: string;
|
|
20
|
+
props?: OAuthPropsValue<T>;
|
|
21
|
+
data: Record<string, any>;
|
|
22
|
+
};
|
|
23
|
+
export declare type OAuth2Property<R extends boolean, T extends OAuth2Props> = OAuth2PropertySchema & TPropertyValue<OAuth2PropertyValue<T>, PropertyType.OAUTH2, R>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth2-prop.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/oauth2-prop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ArrayProperty, CheckboxProperty, JsonProperty, LongTextProperty, NumberProperty, ObjectProperty, SecretTextProperty, ShortTextProperty } from "./base-prop";
|
|
2
|
+
import { BasicAuthProperty } from "./basic-auth-prop";
|
|
3
|
+
import { CustomAuthProperty, CustomAuthProps } from "./custom-auth-prop";
|
|
4
|
+
import { DropdownProperty, MultiSelectDropdownProperty, StaticDropdownProperty, StaticMultiSelectDropdownProperty } from "./dropdown-prop";
|
|
5
|
+
import { DynamicProperties } from "./dynamic-prop";
|
|
6
|
+
import { OAuth2Property, OAuth2Props } from "./oauth2-prop";
|
|
7
|
+
export declare enum PropertyType {
|
|
8
|
+
SHORT_TEXT = "SHORT_TEXT",
|
|
9
|
+
LONG_TEXT = "LONG_TEXT",
|
|
10
|
+
DROPDOWN = "DROPDOWN",
|
|
11
|
+
STATIC_DROPDOWN = "STATIC_DROPDOWN",
|
|
12
|
+
NUMBER = "NUMBER",
|
|
13
|
+
CHECKBOX = "CHECKBOX",
|
|
14
|
+
OAUTH2 = "OAUTH2",
|
|
15
|
+
SECRET_TEXT = "SECRET_TEXT",
|
|
16
|
+
ARRAY = "ARRAY",
|
|
17
|
+
OBJECT = "OBJECT",
|
|
18
|
+
BASIC_AUTH = "BASIC_AUTH",
|
|
19
|
+
JSON = "JSON",
|
|
20
|
+
MULTI_SELECT_DROPDOWN = "MULTI_SELECT_DROPDOWN",
|
|
21
|
+
STATIC_MULTI_SELECT_DROPDOWN = "STATIC_MULTI_SELECT_DROPDOWN",
|
|
22
|
+
DYNAMIC = "DYNAMIC",
|
|
23
|
+
CUSTOM_AUTH = "CUSTOM_AUTH"
|
|
24
|
+
}
|
|
25
|
+
export declare type PieceProperty = ShortTextProperty<boolean> | LongTextProperty<boolean> | OAuth2Property<boolean, OAuth2Props> | CheckboxProperty<boolean> | DropdownProperty<any, boolean> | StaticDropdownProperty<any, boolean> | NumberProperty<boolean> | SecretTextProperty<boolean> | BasicAuthProperty<boolean> | ArrayProperty<boolean> | ObjectProperty<boolean> | JsonProperty<boolean> | MultiSelectDropdownProperty<unknown, boolean> | StaticMultiSelectDropdownProperty<unknown, boolean> | DynamicProperties<boolean> | CustomAuthProperty<boolean, CustomAuthProps>;
|
|
26
|
+
export interface PiecePropertyMap {
|
|
27
|
+
[name: string]: PieceProperty;
|
|
28
|
+
}
|
|
29
|
+
export declare type StaticPropsValue<T extends PiecePropertyMap> = {
|
|
30
|
+
[P in keyof T]: T[P] extends {
|
|
31
|
+
required: true;
|
|
32
|
+
} ? T[P]['valueSchema'] : T[P]['valueSchema'] | undefined;
|
|
33
|
+
};
|
|
34
|
+
export declare const Property: {
|
|
35
|
+
ShortText<R extends boolean>(request: Properties<ShortTextProperty<R>>): R extends true ? ShortTextProperty<true> : ShortTextProperty<false>;
|
|
36
|
+
Checkbox<R_1 extends boolean>(request: Properties<CheckboxProperty<R_1>>): R_1 extends true ? CheckboxProperty<true> : CheckboxProperty<false>;
|
|
37
|
+
LongText<R_2 extends boolean>(request: Properties<LongTextProperty<R_2>>): R_2 extends true ? LongTextProperty<true> : LongTextProperty<false>;
|
|
38
|
+
Number<R_3 extends boolean>(request: Properties<NumberProperty<R_3>>): R_3 extends true ? NumberProperty<true> : NumberProperty<false>;
|
|
39
|
+
Json<R_4 extends boolean>(request: Properties<JsonProperty<R_4>>): R_4 extends true ? JsonProperty<true> : JsonProperty<false>;
|
|
40
|
+
Array<R_5 extends boolean>(request: Properties<ArrayProperty<R_5>>): R_5 extends true ? ArrayProperty<true> : ArrayProperty<false>;
|
|
41
|
+
Object<R_6 extends boolean>(request: Properties<ObjectProperty<R_6>>): R_6 extends true ? ObjectProperty<true> : ObjectProperty<false>;
|
|
42
|
+
SecretText<R_7 extends boolean>(request: Properties<SecretTextProperty<R_7>>): R_7 extends true ? SecretTextProperty<true> : SecretTextProperty<false>;
|
|
43
|
+
BasicAuth<R_8 extends boolean>(request: Properties<BasicAuthProperty<R_8>>): R_8 extends true ? BasicAuthProperty<true> : BasicAuthProperty<false>;
|
|
44
|
+
CustomAuth<R_9 extends boolean, T extends CustomAuthProps>(request: Properties<CustomAuthProperty<R_9, T>>): R_9 extends true ? CustomAuthProperty<true, T> : CustomAuthProperty<false, T>;
|
|
45
|
+
OAuth2<R_10 extends boolean, T_1 extends OAuth2Props>(request: Properties<OAuth2Property<R_10, T_1>>): R_10 extends true ? OAuth2Property<true, T_1> : OAuth2Property<false, T_1>;
|
|
46
|
+
Dropdown<T_2, R_11 extends boolean = boolean>(request: Properties<DropdownProperty<T_2, R_11>>): R_11 extends true ? DropdownProperty<T_2, true> : DropdownProperty<T_2, false>;
|
|
47
|
+
StaticDropdown<T_3, R_12 extends boolean = boolean>(request: Properties<StaticDropdownProperty<T_3, R_12>>): R_12 extends true ? StaticDropdownProperty<T_3, true> : StaticDropdownProperty<T_3, false>;
|
|
48
|
+
MultiSelectDropdown<T_4, R_13 extends boolean = boolean>(request: Properties<MultiSelectDropdownProperty<T_4, R_13>>): R_13 extends true ? MultiSelectDropdownProperty<T_4, true> : MultiSelectDropdownProperty<T_4, false>;
|
|
49
|
+
DynamicProperties<R_14 extends boolean = boolean>(request: Properties<DynamicProperties<R_14>>): R_14 extends true ? DynamicProperties<true> : DynamicProperties<false>;
|
|
50
|
+
StaticMultiSelectDropdown<T_5, R_15 extends boolean = boolean>(request: Properties<StaticMultiSelectDropdownProperty<T_5, R_15>>): R_15 extends true ? StaticMultiSelectDropdownProperty<T_5, true> : StaticMultiSelectDropdownProperty<T_5, false>;
|
|
51
|
+
};
|
|
52
|
+
declare type Properties<T> = Omit<T, "valueSchema" | "type">;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Property = exports.PropertyType = void 0;
|
|
4
|
+
var PropertyType;
|
|
5
|
+
(function (PropertyType) {
|
|
6
|
+
PropertyType["SHORT_TEXT"] = "SHORT_TEXT";
|
|
7
|
+
PropertyType["LONG_TEXT"] = "LONG_TEXT";
|
|
8
|
+
PropertyType["DROPDOWN"] = "DROPDOWN";
|
|
9
|
+
PropertyType["STATIC_DROPDOWN"] = "STATIC_DROPDOWN";
|
|
10
|
+
PropertyType["NUMBER"] = "NUMBER";
|
|
11
|
+
PropertyType["CHECKBOX"] = "CHECKBOX";
|
|
12
|
+
PropertyType["OAUTH2"] = "OAUTH2";
|
|
13
|
+
PropertyType["SECRET_TEXT"] = "SECRET_TEXT";
|
|
14
|
+
PropertyType["ARRAY"] = "ARRAY";
|
|
15
|
+
PropertyType["OBJECT"] = "OBJECT";
|
|
16
|
+
PropertyType["BASIC_AUTH"] = "BASIC_AUTH";
|
|
17
|
+
PropertyType["JSON"] = "JSON";
|
|
18
|
+
PropertyType["MULTI_SELECT_DROPDOWN"] = "MULTI_SELECT_DROPDOWN";
|
|
19
|
+
PropertyType["STATIC_MULTI_SELECT_DROPDOWN"] = "STATIC_MULTI_SELECT_DROPDOWN";
|
|
20
|
+
PropertyType["DYNAMIC"] = "DYNAMIC";
|
|
21
|
+
PropertyType["CUSTOM_AUTH"] = "CUSTOM_AUTH";
|
|
22
|
+
})(PropertyType = exports.PropertyType || (exports.PropertyType = {}));
|
|
23
|
+
exports.Property = {
|
|
24
|
+
ShortText(request) {
|
|
25
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.SHORT_TEXT });
|
|
26
|
+
},
|
|
27
|
+
Checkbox(request) {
|
|
28
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.CHECKBOX });
|
|
29
|
+
},
|
|
30
|
+
LongText(request) {
|
|
31
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.LONG_TEXT });
|
|
32
|
+
},
|
|
33
|
+
Number(request) {
|
|
34
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.NUMBER });
|
|
35
|
+
},
|
|
36
|
+
Json(request) {
|
|
37
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.JSON });
|
|
38
|
+
},
|
|
39
|
+
Array(request) {
|
|
40
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.ARRAY });
|
|
41
|
+
},
|
|
42
|
+
Object(request) {
|
|
43
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.OBJECT });
|
|
44
|
+
},
|
|
45
|
+
SecretText(request) {
|
|
46
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.SECRET_TEXT });
|
|
47
|
+
},
|
|
48
|
+
BasicAuth(request) {
|
|
49
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.BASIC_AUTH });
|
|
50
|
+
},
|
|
51
|
+
CustomAuth(request) {
|
|
52
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.CUSTOM_AUTH });
|
|
53
|
+
},
|
|
54
|
+
OAuth2(request) {
|
|
55
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.OAUTH2 });
|
|
56
|
+
},
|
|
57
|
+
Dropdown(request) {
|
|
58
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.DROPDOWN });
|
|
59
|
+
},
|
|
60
|
+
StaticDropdown(request) {
|
|
61
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.STATIC_DROPDOWN });
|
|
62
|
+
},
|
|
63
|
+
MultiSelectDropdown(request) {
|
|
64
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.MULTI_SELECT_DROPDOWN });
|
|
65
|
+
},
|
|
66
|
+
DynamicProperties(request) {
|
|
67
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.DYNAMIC });
|
|
68
|
+
},
|
|
69
|
+
StaticMultiSelectDropdown(request) {
|
|
70
|
+
return Object.assign(Object.assign({}, request), { valueSchema: undefined, type: PropertyType.STATIC_MULTI_SELECT_DROPDOWN });
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/framework/src/lib/property/property.ts"],"names":[],"mappings":";;;AAgBA,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACvB,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,qCAAqB,CAAA;IAC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AAK,OAAO,KAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,CAAC,4BAA4B,GAA0H,CAAC;IACxN,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TriggerContext, TriggerHookContext } from '../context';
|
|
2
|
+
import { TriggerBase } from '../piece-metadata';
|
|
3
|
+
import { PiecePropertyMap, StaticPropsValue } from '../property/property';
|
|
4
|
+
export declare enum TriggerStrategy {
|
|
5
|
+
POLLING = "POLLING",
|
|
6
|
+
WEBHOOK = "WEBHOOK",
|
|
7
|
+
APP_WEBHOOK = "APP_WEBHOOK"
|
|
8
|
+
}
|
|
9
|
+
declare class ITrigger<T extends PiecePropertyMap, S extends TriggerStrategy> implements TriggerBase {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly displayName: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly props: T;
|
|
14
|
+
readonly type: S;
|
|
15
|
+
readonly onEnable: (ctx: TriggerHookContext<StaticPropsValue<T>, S>) => Promise<void>;
|
|
16
|
+
readonly onDisable: (ctx: TriggerHookContext<StaticPropsValue<T>, S>) => Promise<void>;
|
|
17
|
+
readonly run: (ctx: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>;
|
|
18
|
+
readonly test: (ctx: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>;
|
|
19
|
+
sampleData: unknown;
|
|
20
|
+
constructor(name: string, displayName: string, description: string, props: T, type: S, onEnable: (ctx: TriggerHookContext<StaticPropsValue<T>, S>) => Promise<void>, onDisable: (ctx: TriggerHookContext<StaticPropsValue<T>, S>) => Promise<void>, run: (ctx: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>, test: (ctx: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>, sampleData: unknown);
|
|
21
|
+
}
|
|
22
|
+
export declare type Trigger = ITrigger<any, TriggerStrategy>;
|
|
23
|
+
export declare function createTrigger<T extends PiecePropertyMap, S extends TriggerStrategy>(request: {
|
|
24
|
+
name: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
description: string;
|
|
27
|
+
props: T;
|
|
28
|
+
type: S;
|
|
29
|
+
onEnable: (context: TriggerHookContext<StaticPropsValue<T>, S>) => Promise<void>;
|
|
30
|
+
onDisable: (context: TriggerHookContext<StaticPropsValue<T>, S>) => Promise<void>;
|
|
31
|
+
run: (context: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>;
|
|
32
|
+
test?: (context: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>;
|
|
33
|
+
sampleData: unknown | ((context: TriggerContext<StaticPropsValue<T>>) => Promise<unknown>);
|
|
34
|
+
}): Trigger;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTrigger = exports.TriggerStrategy = void 0;
|
|
4
|
+
var TriggerStrategy;
|
|
5
|
+
(function (TriggerStrategy) {
|
|
6
|
+
TriggerStrategy["POLLING"] = "POLLING";
|
|
7
|
+
TriggerStrategy["WEBHOOK"] = "WEBHOOK";
|
|
8
|
+
TriggerStrategy["APP_WEBHOOK"] = "APP_WEBHOOK";
|
|
9
|
+
})(TriggerStrategy = exports.TriggerStrategy || (exports.TriggerStrategy = {}));
|
|
10
|
+
class ITrigger {
|
|
11
|
+
constructor(name, displayName, description, props, type, onEnable, onDisable, run, test, sampleData) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.displayName = displayName;
|
|
14
|
+
this.description = description;
|
|
15
|
+
this.props = props;
|
|
16
|
+
this.type = type;
|
|
17
|
+
this.onEnable = onEnable;
|
|
18
|
+
this.onDisable = onDisable;
|
|
19
|
+
this.run = run;
|
|
20
|
+
this.test = test;
|
|
21
|
+
this.sampleData = sampleData;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function createTrigger(request) {
|
|
25
|
+
var _a;
|
|
26
|
+
return new ITrigger(request.name, request.displayName, request.description, request.props, request.type, request.onEnable, request.onDisable, request.run, (_a = request.test) !== null && _a !== void 0 ? _a : (() => Promise.resolve([request.sampleData])), request.sampleData);
|
|
27
|
+
}
|
|
28
|
+
exports.createTrigger = createTrigger;
|
|
29
|
+
//# sourceMappingURL=trigger.js.map
|
|
@@ -0,0 +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,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAED,MAAM,QAAQ;IACZ,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,KAAQ,EACR,IAAO,EACP,QAEE,EACF,SAEE,EACF,GAEO,EACP,IAEO,EAChB,UAAmB;QAjBV,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAQ;QACnB,UAAK,GAAL,KAAK,CAAG;QACR,SAAI,GAAJ,IAAI,CAAG;QACP,aAAQ,GAAR,QAAQ,CAEN;QACF,cAAS,GAAT,SAAS,CAEP;QACF,QAAG,GAAH,GAAG,CAEI;QACP,SAAI,GAAJ,IAAI,CAEG;QAChB,eAAU,GAAV,UAAU,CAAS;IACxB,CAAC;CACN;AAID,SAAgB,aAAa,CAAwD,OAWpF;;IACC,OAAO,IAAI,QAAQ,CACjB,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,GAAG,EACX,MAAA,OAAO,CAAC,IAAI,mCAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAC7D,OAAO,CAAC,UAAU,CACnB,CAAC;AACJ,CAAC;AAxBD,sCAwBC"}
|