@coasy/piece-coasy 0.1.0 → 0.1.2-dev.1
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/.eslintrc.json +5 -1
- package/dist/packages/pieces/community/framework/packages/pieces/community/framework/README.md +11 -0
- package/dist/packages/shared/packages/shared/README.md +7 -0
- package/package.json +1 -1
- package/src/lib/actions/create-voucher.ts +14 -14
- package/src/lib/common/triggers.ts +40 -25
- package/src/lib/triggers/cancelled-membership.ts +38 -21
- package/src/lib/triggers/cancelled-order-item.ts +48 -21
- package/src/lib/triggers/cancelled-order.ts +48 -21
- package/src/lib/triggers/cancelled-orderprocess.ts +40 -22
- package/src/lib/triggers/cancelled-subscription.ts +38 -21
- package/src/lib/triggers/get-events.ts +27 -20
- package/src/lib/triggers/new-event-participant.ts +43 -21
- package/src/lib/triggers/new-lead.ts +33 -22
- package/src/lib/triggers/new-membership.ts +38 -21
- package/src/lib/triggers/new-order-item.ts +46 -25
- package/src/lib/triggers/new-order.ts +48 -21
- package/src/lib/triggers/new-subscription.ts +38 -21
- package/src/lib/triggers/new-webinar-participant.ts +48 -30
- package/src/lib/triggers/webinar-participant-attend.ts +50 -38
- package/src/lib/triggers/webinar-participant-reminder.ts +48 -37
package/.eslintrc.json
CHANGED
package/dist/packages/pieces/community/framework/packages/pieces/community/framework/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
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { createAction, Property } from
|
|
2
|
-
import { coasyAuth } from
|
|
3
|
-
import { CoasyClient } from
|
|
1
|
+
import { createAction, Property } from "@activepieces/pieces-framework";
|
|
2
|
+
import { coasyAuth } from "../..";
|
|
3
|
+
import { CoasyClient } from "../common/coasyClient";
|
|
4
4
|
|
|
5
5
|
export const createVoucher = createAction({
|
|
6
6
|
auth: coasyAuth,
|
|
7
|
-
name:
|
|
8
|
-
displayName:
|
|
9
|
-
description:
|
|
7
|
+
name: "createVoucher",
|
|
8
|
+
displayName: "Create Voucher",
|
|
9
|
+
description: "Creates a new voucher",
|
|
10
10
|
props: {
|
|
11
11
|
offerId: Property.ShortText({
|
|
12
|
-
displayName:
|
|
13
|
-
description:
|
|
14
|
-
required: true
|
|
15
|
-
})
|
|
12
|
+
displayName: "Offer ID",
|
|
13
|
+
description: "ID of offer",
|
|
14
|
+
required: true
|
|
15
|
+
})
|
|
16
16
|
},
|
|
17
17
|
async run(configValue) {
|
|
18
18
|
const { propsValue, auth } = configValue;
|
|
19
19
|
const client = new CoasyClient(
|
|
20
|
-
auth.baseUrl ??
|
|
20
|
+
auth.baseUrl ?? "https://backend.api.prod.coasy.io",
|
|
21
21
|
auth.apiKey
|
|
22
22
|
);
|
|
23
23
|
const request = {
|
|
24
|
-
offerId: propsValue.offerId
|
|
24
|
+
offerId: propsValue.offerId
|
|
25
25
|
};
|
|
26
|
-
return client.action(
|
|
27
|
-
}
|
|
26
|
+
return client.action("createVoucher", request);
|
|
27
|
+
}
|
|
28
28
|
});
|
|
@@ -1,58 +1,73 @@
|
|
|
1
|
-
|
|
2
1
|
import { CoasyClient } from './coasyClient';
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
SecretTextProperty,
|
|
5
|
+
ShortTextProperty,
|
|
6
|
+
StaticPropsValue,
|
|
7
|
+
Store,
|
|
8
|
+
} from '@activepieces/pieces-framework';
|
|
5
9
|
|
|
6
10
|
export interface CreateTriggerRequest {
|
|
7
11
|
triggerName: string;
|
|
8
12
|
webhookUrl: string;
|
|
9
|
-
auth:
|
|
10
|
-
baseUrl: ShortTextProperty<false
|
|
11
|
-
apiKey: SecretTextProperty<true
|
|
12
|
-
}
|
|
13
|
+
auth: StaticPropsValue<{
|
|
14
|
+
baseUrl: ShortTextProperty<false>;
|
|
15
|
+
apiKey: SecretTextProperty<true>;
|
|
16
|
+
}>;
|
|
13
17
|
filter: any;
|
|
14
18
|
store: Store;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export interface DestroyTriggerRequest {
|
|
18
22
|
triggerName: string;
|
|
19
|
-
auth:
|
|
20
|
-
baseUrl: ShortTextProperty<false
|
|
21
|
-
apiKey: SecretTextProperty<true
|
|
22
|
-
}
|
|
23
|
+
auth: StaticPropsValue<{
|
|
24
|
+
baseUrl: ShortTextProperty<false>;
|
|
25
|
+
apiKey: SecretTextProperty<true>;
|
|
26
|
+
}>;
|
|
23
27
|
store: Store;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
export interface TestTriggerRequest {
|
|
27
31
|
triggerName: string;
|
|
28
|
-
auth:
|
|
29
|
-
baseUrl: ShortTextProperty<false
|
|
30
|
-
apiKey: SecretTextProperty<true
|
|
31
|
-
}
|
|
32
|
+
auth: StaticPropsValue<{
|
|
33
|
+
baseUrl: ShortTextProperty<false>;
|
|
34
|
+
apiKey: SecretTextProperty<true>;
|
|
35
|
+
}>;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
export const createCoasyTrigger = async (request: CreateTriggerRequest) => {
|
|
35
|
-
const { triggerName, webhookUrl, filter, auth, store} = request;
|
|
36
|
-
const client = new CoasyClient(
|
|
39
|
+
const { triggerName, webhookUrl, filter, auth, store } = request;
|
|
40
|
+
const client = new CoasyClient(
|
|
41
|
+
auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
42
|
+
auth.apiKey
|
|
43
|
+
);
|
|
37
44
|
const response = await client.createTrigger(triggerName, webhookUrl, filter);
|
|
38
45
|
if (!response.id) throw new Error(`Failed to create Trigger!`);
|
|
39
46
|
await store.put<string>(`${triggerName}__WEBHOOK_ID`, response.id);
|
|
40
47
|
};
|
|
41
48
|
|
|
42
|
-
export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) =>
|
|
43
|
-
const { triggerName, auth, store} = request;
|
|
49
|
+
export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) => {
|
|
50
|
+
const { triggerName, auth, store } = request;
|
|
44
51
|
const webhookId = await store.get<string>(`${triggerName}__WEBHOOK_ID`);
|
|
45
52
|
if (!webhookId) throw new Error(`Webhook Id not found!`);
|
|
46
53
|
|
|
47
|
-
const client = new CoasyClient(
|
|
54
|
+
const client = new CoasyClient(
|
|
55
|
+
auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
56
|
+
auth.apiKey
|
|
57
|
+
);
|
|
48
58
|
await client.destroyTrigger(webhookId);
|
|
49
|
-
}
|
|
59
|
+
};
|
|
50
60
|
|
|
51
|
-
export const testCoasyTrigger = async (
|
|
52
|
-
|
|
61
|
+
export const testCoasyTrigger = async (
|
|
62
|
+
request: TestTriggerRequest
|
|
63
|
+
): Promise<any[]> => {
|
|
64
|
+
const { triggerName, auth } = request;
|
|
53
65
|
|
|
54
|
-
const client = new CoasyClient(
|
|
66
|
+
const client = new CoasyClient(
|
|
67
|
+
auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
68
|
+
auth.apiKey
|
|
69
|
+
);
|
|
55
70
|
const response = await client.listTriggerEvents(triggerName);
|
|
56
71
|
|
|
57
|
-
return [{ test: true}];
|
|
58
|
-
}
|
|
72
|
+
return [{ test: true, response }];
|
|
73
|
+
};
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_MEMBERSHIP';
|
|
6
14
|
|
|
7
15
|
export const cancelledMembership = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledMembership',
|
|
10
18
|
displayName: 'Cancelled Membership',
|
|
11
19
|
description: 'Triggers when a customer requests a membership cancellation.',
|
|
12
|
-
props: {
|
|
20
|
+
props: {
|
|
21
|
+
membershipTypeIds: Property.Array({
|
|
22
|
+
displayName: 'Membership Type IDs',
|
|
23
|
+
description: 'IDs of membership types to react to',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
13
27
|
sampleData: {},
|
|
14
28
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
onEnable: (context) =>
|
|
30
|
+
createCoasyTrigger({
|
|
31
|
+
triggerName,
|
|
32
|
+
webhookUrl: context.webhookUrl,
|
|
33
|
+
auth: context.auth,
|
|
34
|
+
filter: context.propsValue,
|
|
35
|
+
store: context.store,
|
|
36
|
+
}),
|
|
37
|
+
onDisable: (context) =>
|
|
38
|
+
destroyCoasyTrigger({
|
|
39
|
+
triggerName,
|
|
40
|
+
auth: context.auth,
|
|
41
|
+
store: context.store,
|
|
42
|
+
}),
|
|
43
|
+
test: (context) =>
|
|
44
|
+
testCoasyTrigger({
|
|
45
|
+
triggerName,
|
|
46
|
+
auth: context.auth,
|
|
47
|
+
}),
|
|
31
48
|
async run(context) {
|
|
32
49
|
return [context.payload.body];
|
|
33
|
-
}
|
|
50
|
+
},
|
|
34
51
|
});
|
|
@@ -1,34 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_ORDER_ITEM';
|
|
6
14
|
|
|
7
15
|
export const cancelledOrderItem = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledOrderItem',
|
|
10
18
|
displayName: 'Cancelled Order Item',
|
|
11
19
|
description: 'Triggers when an order item is cancelled.',
|
|
12
|
-
props: {
|
|
20
|
+
props: {
|
|
21
|
+
mainOfferIds: Property.Array({
|
|
22
|
+
displayName: 'Main Offer IDs',
|
|
23
|
+
description: 'IDs of main offers to react to',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
selectedPaymentPlans: Property.Array({
|
|
27
|
+
displayName: 'Selected Payment Plans',
|
|
28
|
+
description: 'Payment plans to filter by',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
selectedShippingOptions: Property.Array({
|
|
32
|
+
displayName: 'Selected Shipping Options',
|
|
33
|
+
description: 'Shipping options to filter by',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
13
37
|
sampleData: {},
|
|
14
38
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
onEnable: (context) =>
|
|
40
|
+
createCoasyTrigger({
|
|
41
|
+
triggerName,
|
|
42
|
+
webhookUrl: context.webhookUrl,
|
|
43
|
+
auth: context.auth,
|
|
44
|
+
filter: context.propsValue,
|
|
45
|
+
store: context.store,
|
|
46
|
+
}),
|
|
47
|
+
onDisable: (context) =>
|
|
48
|
+
destroyCoasyTrigger({
|
|
49
|
+
triggerName,
|
|
50
|
+
auth: context.auth,
|
|
51
|
+
store: context.store,
|
|
52
|
+
}),
|
|
53
|
+
test: (context) =>
|
|
54
|
+
testCoasyTrigger({
|
|
55
|
+
triggerName,
|
|
56
|
+
auth: context.auth,
|
|
57
|
+
}),
|
|
31
58
|
async run(context) {
|
|
32
59
|
return [context.payload.body];
|
|
33
|
-
}
|
|
60
|
+
},
|
|
34
61
|
});
|
|
@@ -1,34 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_ORDER';
|
|
6
14
|
|
|
7
15
|
export const cancelledOrder = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledOrder',
|
|
10
18
|
displayName: 'Cancelled Order',
|
|
11
19
|
description: 'Triggers when an order is cancelled.',
|
|
12
|
-
props: {
|
|
20
|
+
props: {
|
|
21
|
+
mainOfferIds: Property.Array({
|
|
22
|
+
displayName: 'Main Offer IDs',
|
|
23
|
+
description: 'IDs of main offers to react to',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
selectedPaymentPlans: Property.Array({
|
|
27
|
+
displayName: 'Selected Payment Plans',
|
|
28
|
+
description: 'Payment plans to filter by',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
selectedShippingOptions: Property.Array({
|
|
32
|
+
displayName: 'Selected Shipping Options',
|
|
33
|
+
description: 'Shipping options to filter by',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
13
37
|
sampleData: {},
|
|
14
38
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
onEnable: (context) =>
|
|
40
|
+
createCoasyTrigger({
|
|
41
|
+
triggerName,
|
|
42
|
+
webhookUrl: context.webhookUrl,
|
|
43
|
+
auth: context.auth,
|
|
44
|
+
filter: context.propsValue,
|
|
45
|
+
store: context.store,
|
|
46
|
+
}),
|
|
47
|
+
onDisable: (context) =>
|
|
48
|
+
destroyCoasyTrigger({
|
|
49
|
+
triggerName,
|
|
50
|
+
auth: context.auth,
|
|
51
|
+
store: context.store,
|
|
52
|
+
}),
|
|
53
|
+
test: (context) =>
|
|
54
|
+
testCoasyTrigger({
|
|
55
|
+
triggerName,
|
|
56
|
+
auth: context.auth,
|
|
57
|
+
}),
|
|
31
58
|
async run(context) {
|
|
32
59
|
return [context.payload.body];
|
|
33
|
-
}
|
|
60
|
+
},
|
|
34
61
|
});
|
|
@@ -1,34 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_ORDERPROCESS';
|
|
6
14
|
|
|
7
15
|
export const cancelledOrderprocess = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledOrderprocess',
|
|
10
18
|
displayName: 'Cancelled Order Process',
|
|
11
|
-
description:
|
|
12
|
-
|
|
19
|
+
description:
|
|
20
|
+
'Triggers when a customer starts checkout but does not finish within 1 hour.',
|
|
21
|
+
props: {
|
|
22
|
+
mainOfferIds: Property.Array({
|
|
23
|
+
displayName: 'Main Offer IDs',
|
|
24
|
+
description: 'IDs of main offers to react to',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
13
28
|
sampleData: {},
|
|
14
29
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
onEnable: (context) =>
|
|
31
|
+
createCoasyTrigger({
|
|
32
|
+
triggerName,
|
|
33
|
+
webhookUrl: context.webhookUrl,
|
|
34
|
+
auth: context.auth,
|
|
35
|
+
filter: context.propsValue,
|
|
36
|
+
store: context.store,
|
|
37
|
+
}),
|
|
38
|
+
onDisable: (context) =>
|
|
39
|
+
destroyCoasyTrigger({
|
|
40
|
+
triggerName,
|
|
41
|
+
auth: context.auth,
|
|
42
|
+
store: context.store,
|
|
43
|
+
}),
|
|
44
|
+
test: (context) =>
|
|
45
|
+
testCoasyTrigger({
|
|
46
|
+
triggerName,
|
|
47
|
+
auth: context.auth,
|
|
48
|
+
}),
|
|
31
49
|
async run(context) {
|
|
32
50
|
return [context.payload.body];
|
|
33
|
-
}
|
|
51
|
+
},
|
|
34
52
|
});
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_SUBSCRIPTION';
|
|
6
14
|
|
|
7
15
|
export const cancelledSubscription = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledSubscription',
|
|
10
18
|
displayName: 'Cancelled Subscription',
|
|
11
19
|
description: 'Triggers when a customer requests a subscription cancellation.',
|
|
12
|
-
props: {
|
|
20
|
+
props: {
|
|
21
|
+
membershipTypeIds: Property.Array({
|
|
22
|
+
displayName: 'Membership Type IDs',
|
|
23
|
+
description: 'IDs of membership types to react to',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
13
27
|
sampleData: {},
|
|
14
28
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
onEnable: (context) =>
|
|
30
|
+
createCoasyTrigger({
|
|
31
|
+
triggerName,
|
|
32
|
+
webhookUrl: context.webhookUrl,
|
|
33
|
+
auth: context.auth,
|
|
34
|
+
filter: context.propsValue,
|
|
35
|
+
store: context.store,
|
|
36
|
+
}),
|
|
37
|
+
onDisable: (context) =>
|
|
38
|
+
destroyCoasyTrigger({
|
|
39
|
+
triggerName,
|
|
40
|
+
auth: context.auth,
|
|
41
|
+
store: context.store,
|
|
42
|
+
}),
|
|
43
|
+
test: (context) =>
|
|
44
|
+
testCoasyTrigger({
|
|
45
|
+
triggerName,
|
|
46
|
+
auth: context.auth,
|
|
47
|
+
}),
|
|
31
48
|
async run(context) {
|
|
32
49
|
return [context.payload.body];
|
|
33
|
-
}
|
|
50
|
+
},
|
|
34
51
|
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { createTrigger,
|
|
1
|
+
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
2
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createCoasyTrigger,
|
|
5
|
+
destroyCoasyTrigger,
|
|
6
|
+
testCoasyTrigger,
|
|
7
|
+
} from '../common/triggers';
|
|
4
8
|
|
|
5
|
-
const triggerName =
|
|
9
|
+
const triggerName = 'GET_EVENTS';
|
|
6
10
|
|
|
7
11
|
export const getEvents = createTrigger({
|
|
8
12
|
auth: coasyAuth,
|
|
@@ -12,23 +16,26 @@ export const getEvents = createTrigger({
|
|
|
12
16
|
props: {},
|
|
13
17
|
sampleData: {},
|
|
14
18
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
onEnable: (context) =>
|
|
20
|
+
createCoasyTrigger({
|
|
21
|
+
triggerName,
|
|
22
|
+
webhookUrl: context.webhookUrl,
|
|
23
|
+
auth: context.auth,
|
|
24
|
+
filter: context.propsValue,
|
|
25
|
+
store: context.store,
|
|
26
|
+
}),
|
|
27
|
+
onDisable: (context) =>
|
|
28
|
+
destroyCoasyTrigger({
|
|
29
|
+
triggerName,
|
|
30
|
+
auth: context.auth,
|
|
31
|
+
store: context.store,
|
|
32
|
+
}),
|
|
33
|
+
test: (context) =>
|
|
34
|
+
testCoasyTrigger({
|
|
35
|
+
triggerName,
|
|
36
|
+
auth: context.auth,
|
|
37
|
+
}),
|
|
31
38
|
async run(context) {
|
|
32
39
|
return [context.payload.body];
|
|
33
|
-
}
|
|
40
|
+
},
|
|
34
41
|
});
|