@activepieces/framework
Advanced tools
Comparing version
{ | ||
"name": "@activepieces/framework", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"type": "commonjs", | ||
@@ -12,3 +12,3 @@ "dependencies": { | ||
"peerDependencies": { | ||
"@activepieces/shared": "0.1.1", | ||
"@activepieces/shared": "0.1.2", | ||
"tslib": "2.4.1" | ||
@@ -15,0 +15,0 @@ }, |
@@ -28,3 +28,2 @@ import { AppConnectionValue, TriggerStrategy } from "@activepieces/shared"; | ||
store: Store; | ||
connections: ConnectionsManager; | ||
} | ||
@@ -31,0 +30,0 @@ export interface ActionContext<T> { |
@@ -17,2 +17,3 @@ import type { Trigger } from './trigger/trigger'; | ||
payload: EventPayload; | ||
appWebhookUrl: string; | ||
}) => boolean; | ||
@@ -30,2 +31,3 @@ } | undefined; | ||
payload: EventPayload; | ||
appWebhookUrl: string; | ||
}) => boolean; | ||
@@ -52,2 +54,3 @@ } | undefined, actions: Action[], triggers: Trigger[], description?: string); | ||
payload: EventPayload; | ||
appWebhookUrl: string; | ||
}) => boolean; | ||
@@ -54,0 +57,0 @@ } | undefined; |
@@ -13,4 +13,5 @@ import { TriggerBase, TriggerStrategy } from '@activepieces/shared'; | ||
readonly run: (ctx: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>; | ||
readonly sampleData: unknown; | ||
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[]>, sampleData: unknown); | ||
readonly test: (ctx: TriggerContext<StaticPropsValue<T>>) => Promise<unknown>; | ||
sampleData: unknown; | ||
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); | ||
} | ||
@@ -27,4 +28,5 @@ export declare type Trigger = ITrigger<any, TriggerStrategy>; | ||
run: (context: TriggerContext<StaticPropsValue<T>>) => Promise<unknown[]>; | ||
sampleData?: unknown; | ||
test?: (context: TriggerContext<StaticPropsValue<T>>) => Promise<unknown>; | ||
sampleData: unknown | ((context: TriggerContext<StaticPropsValue<T>>) => Promise<unknown>); | ||
}): Trigger; | ||
export {}; |
@@ -5,3 +5,3 @@ "use strict"; | ||
class ITrigger { | ||
constructor(name, displayName, description, props, type, onEnable, onDisable, run, sampleData) { | ||
constructor(name, displayName, description, props, type, onEnable, onDisable, run, test, sampleData) { | ||
this.name = name; | ||
@@ -15,2 +15,3 @@ this.displayName = displayName; | ||
this.run = run; | ||
this.test = test; | ||
this.sampleData = sampleData; | ||
@@ -20,5 +21,6 @@ } | ||
function createTrigger(request) { | ||
return new ITrigger(request.name, request.displayName, request.description, request.props, request.type, request.onEnable, request.onDisable, request.run, request.sampleData); | ||
var _a; | ||
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); | ||
} | ||
exports.createTrigger = createTrigger; | ||
//# sourceMappingURL=trigger.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59046
1.02%860
0.7%