@workbuddy/piece-workbuddy-edge 1.0.0 → 1.0.2
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 +2 -2
- package/src/lib/actions/jobs.d.ts +2 -2
- package/src/lib/actions/jobs.d.ts.map +1 -1
- package/src/lib/actions/jobs.js +24 -4
- package/src/lib/actions/jobs.js.map +1 -1
- package/src/lib/actions/jobs.ts +24 -4
- package/src/lib/triggers/activity.d.ts +24 -12
- package/src/lib/triggers/activity.d.ts.map +1 -1
- package/src/lib/triggers/activity.js +45 -21
- package/src/lib/triggers/activity.js.map +1 -1
- package/src/lib/triggers/activity.ts +39 -24
- package/src/lib/triggers/bill.d.ts +64 -16
- package/src/lib/triggers/bill.d.ts.map +1 -1
- package/src/lib/triggers/bill.js +152 -28
- package/src/lib/triggers/bill.js.map +1 -1
- package/src/lib/triggers/bill.ts +136 -32
- package/src/lib/triggers/invoice.d.ts +64 -16
- package/src/lib/triggers/invoice.d.ts.map +1 -1
- package/src/lib/triggers/invoice.js +152 -28
- package/src/lib/triggers/invoice.js.map +1 -1
- package/src/lib/triggers/invoice.ts +136 -32
- package/src/lib/triggers/job.d.ts +144 -16
- package/src/lib/triggers/job.d.ts.map +1 -1
- package/src/lib/triggers/job.js +292 -28
- package/src/lib/triggers/job.js.map +1 -1
- package/src/lib/triggers/job.ts +256 -32
- package/src/lib/triggers/lead.d.ts +112 -16
- package/src/lib/triggers/lead.d.ts.map +1 -1
- package/src/lib/triggers/lead.js +200 -28
- package/src/lib/triggers/lead.js.map +1 -1
- package/src/lib/triggers/lead.ts +172 -32
- package/src/lib/triggers/opportunity.d.ts +80 -16
- package/src/lib/triggers/opportunity.d.ts.map +1 -1
- package/src/lib/triggers/opportunity.js +144 -28
- package/src/lib/triggers/opportunity.js.map +1 -1
- package/src/lib/triggers/opportunity.ts +124 -32
- package/src/lib/triggers/quote.d.ts +64 -16
- package/src/lib/triggers/quote.d.ts.map +1 -1
- package/src/lib/triggers/quote.js +152 -28
- package/src/lib/triggers/quote.js.map +1 -1
- package/src/lib/triggers/quote.ts +136 -32
- package/src/lib/triggers/stage.d.ts +112 -16
- package/src/lib/triggers/stage.d.ts.map +1 -1
- package/src/lib/triggers/stage.js +236 -28
- package/src/lib/triggers/stage.js.map +1 -1
- package/src/lib/triggers/stage.ts +212 -32
- package/src/lib/triggers/task.d.ts +16 -16
- package/src/lib/triggers/task.d.ts.map +1 -1
- package/src/lib/triggers/task.js +32 -28
- package/src/lib/triggers/task.js.map +1 -1
- package/src/lib/triggers/task.ts +28 -32
- package/src/lib/actions/mcp-context.d.ts +0 -16
- package/src/lib/actions/mcp-context.d.ts.map +0 -1
- package/src/lib/actions/mcp-context.js +0 -82
- package/src/lib/actions/mcp-context.js.map +0 -1
- package/src/lib/actions/mcp-context.ts +0 -86
- package/src/lib/actions/webhooks.d.ts +0 -48
- package/src/lib/actions/webhooks.d.ts.map +0 -1
- package/src/lib/actions/webhooks.js +0 -292
- package/src/lib/actions/webhooks.js.map +0 -1
- package/src/lib/actions/webhooks.ts +0 -318
- package/src/lib/triggers/allocation.d.ts +0 -53
- package/src/lib/triggers/allocation.d.ts.map +0 -1
- package/src/lib/triggers/allocation.js +0 -181
- package/src/lib/triggers/allocation.js.map +0 -1
- package/src/lib/triggers/allocation.ts +0 -198
- package/src/lib/triggers/form.d.ts +0 -19
- package/src/lib/triggers/form.d.ts.map +0 -1
- package/src/lib/triggers/form.js +0 -65
- package/src/lib/triggers/form.js.map +0 -1
- package/src/lib/triggers/form.ts +0 -68
- package/src/lib/triggers/item.d.ts +0 -53
- package/src/lib/triggers/item.d.ts.map +0 -1
- package/src/lib/triggers/item.js +0 -181
- package/src/lib/triggers/item.js.map +0 -1
- package/src/lib/triggers/item.ts +0 -198
- package/src/lib/triggers/site.d.ts +0 -19
- package/src/lib/triggers/site.d.ts.map +0 -1
- package/src/lib/triggers/site.js +0 -65
- package/src/lib/triggers/site.js.map +0 -1
- package/src/lib/triggers/site.ts +0 -68
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const allocation_created_trigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
18
|
-
}>, {}>;
|
|
19
|
-
export declare const allocation_changed_trigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
20
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
21
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
22
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
23
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
24
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
26
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
28
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
30
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
31
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
32
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
34
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
35
|
-
}>, {}>;
|
|
36
|
-
export declare const allocation_deleted_trigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
37
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
38
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
39
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
40
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
41
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
42
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
43
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
44
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
45
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
46
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
47
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
48
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
49
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
50
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
51
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
52
|
-
}>, {}>;
|
|
53
|
-
//# sourceMappingURL=allocation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allocation.d.ts","sourceRoot":"","sources":["allocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAI1F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;OA+DrC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;OA+DrC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;OA+DrC,CAAC"}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allocation_deleted_trigger = exports.allocation_changed_trigger = exports.allocation_created_trigger = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
exports.allocation_created_trigger = (0, pieces_framework_1.createTrigger)({
|
|
8
|
-
name: 'AllocationCreated',
|
|
9
|
-
auth: auth_1.workbuddyAuth,
|
|
10
|
-
displayName: 'Allocation Created',
|
|
11
|
-
description: 'Triggered when a new allocation is created',
|
|
12
|
-
props: {},
|
|
13
|
-
sampleData: {},
|
|
14
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
-
async onEnable(context) {
|
|
16
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
17
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
18
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
19
|
-
const response = await pieces_common_1.httpClient.sendRequest({
|
|
20
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
21
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
22
|
-
headers: {
|
|
23
|
-
Authorization: `Bearer ${token}`,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
26
|
-
},
|
|
27
|
-
body: {
|
|
28
|
-
name: `Activepieces: Allocation Created`,
|
|
29
|
-
eventName: 'Allocation Created',
|
|
30
|
-
target: context.webhookUrl,
|
|
31
|
-
active: true,
|
|
32
|
-
workflow: {
|
|
33
|
-
platform: 'activepieces',
|
|
34
|
-
integrationId: context.webhookUrl,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
// Store webhook ID for cleanup
|
|
39
|
-
await context.store.put('webhookId', response.body.id);
|
|
40
|
-
},
|
|
41
|
-
async onDisable(context) {
|
|
42
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
43
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
44
|
-
const webhookId = await context.store.get('webhookId');
|
|
45
|
-
if (webhookId) {
|
|
46
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
47
|
-
await pieces_common_1.httpClient.sendRequest({
|
|
48
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
49
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
50
|
-
headers: {
|
|
51
|
-
Authorization: `Bearer ${token}`,
|
|
52
|
-
'Content-Type': 'application/json',
|
|
53
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
54
|
-
},
|
|
55
|
-
body: {
|
|
56
|
-
active: false,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
async run(context) {
|
|
62
|
-
return [context.payload.body];
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
exports.allocation_changed_trigger = (0, pieces_framework_1.createTrigger)({
|
|
66
|
-
name: 'AllocationChanged',
|
|
67
|
-
auth: auth_1.workbuddyAuth,
|
|
68
|
-
displayName: 'Allocation Changed',
|
|
69
|
-
description: 'Triggered when an allocation is modified',
|
|
70
|
-
props: {},
|
|
71
|
-
sampleData: {},
|
|
72
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
73
|
-
async onEnable(context) {
|
|
74
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
75
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
76
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
77
|
-
const response = await pieces_common_1.httpClient.sendRequest({
|
|
78
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
79
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
80
|
-
headers: {
|
|
81
|
-
Authorization: `Bearer ${token}`,
|
|
82
|
-
'Content-Type': 'application/json',
|
|
83
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
84
|
-
},
|
|
85
|
-
body: {
|
|
86
|
-
name: `Activepieces: Allocation Changed`,
|
|
87
|
-
eventName: 'Allocation Changed',
|
|
88
|
-
target: context.webhookUrl,
|
|
89
|
-
active: true,
|
|
90
|
-
workflow: {
|
|
91
|
-
platform: 'activepieces',
|
|
92
|
-
integrationId: context.webhookUrl,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
// Store webhook ID for cleanup
|
|
97
|
-
await context.store.put('webhookId', response.body.id);
|
|
98
|
-
},
|
|
99
|
-
async onDisable(context) {
|
|
100
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
101
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
102
|
-
const webhookId = await context.store.get('webhookId');
|
|
103
|
-
if (webhookId) {
|
|
104
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
105
|
-
await pieces_common_1.httpClient.sendRequest({
|
|
106
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
107
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
108
|
-
headers: {
|
|
109
|
-
Authorization: `Bearer ${token}`,
|
|
110
|
-
'Content-Type': 'application/json',
|
|
111
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
112
|
-
},
|
|
113
|
-
body: {
|
|
114
|
-
active: false,
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
async run(context) {
|
|
120
|
-
return [context.payload.body];
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
exports.allocation_deleted_trigger = (0, pieces_framework_1.createTrigger)({
|
|
124
|
-
name: 'AllocationDeleted',
|
|
125
|
-
auth: auth_1.workbuddyAuth,
|
|
126
|
-
displayName: 'Allocation Deleted',
|
|
127
|
-
description: 'Triggered when an allocation is deleted',
|
|
128
|
-
props: {},
|
|
129
|
-
sampleData: {},
|
|
130
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
131
|
-
async onEnable(context) {
|
|
132
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
133
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
134
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
135
|
-
const response = await pieces_common_1.httpClient.sendRequest({
|
|
136
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
137
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
138
|
-
headers: {
|
|
139
|
-
Authorization: `Bearer ${token}`,
|
|
140
|
-
'Content-Type': 'application/json',
|
|
141
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
142
|
-
},
|
|
143
|
-
body: {
|
|
144
|
-
name: `Activepieces: Allocation Deleted`,
|
|
145
|
-
eventName: 'Allocation Deleted',
|
|
146
|
-
target: context.webhookUrl,
|
|
147
|
-
active: true,
|
|
148
|
-
workflow: {
|
|
149
|
-
platform: 'activepieces',
|
|
150
|
-
integrationId: context.webhookUrl,
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
// Store webhook ID for cleanup
|
|
155
|
-
await context.store.put('webhookId', response.body.id);
|
|
156
|
-
},
|
|
157
|
-
async onDisable(context) {
|
|
158
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
159
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
160
|
-
const webhookId = await context.store.get('webhookId');
|
|
161
|
-
if (webhookId) {
|
|
162
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
163
|
-
await pieces_common_1.httpClient.sendRequest({
|
|
164
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
165
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
166
|
-
headers: {
|
|
167
|
-
Authorization: `Bearer ${token}`,
|
|
168
|
-
'Content-Type': 'application/json',
|
|
169
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
170
|
-
},
|
|
171
|
-
body: {
|
|
172
|
-
active: false,
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
async run(context) {
|
|
178
|
-
return [context.payload.body];
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=allocation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"allocation.js","sourceRoot":"","sources":["allocation.ts"],"names":[],"mappings":";;;AAAA,qEAA0F;AAC1F,+DAAqE;AACrE,kCAAwD;AAE3C,QAAA,0BAA0B,GAAG,IAAA,gCAAa,EAAC;IACtD,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,4CAA4C;IACzD,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IAE7B,KAAK,CAAC,QAAQ,CAAC,OAAO;QACpB,MAAM,KAAK,GAAG,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAE3C,kFAAkF;QAClF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAiB;YAC5D,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,OAAO,yBAAyB;YACxC,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,cAAc,EAAE,kBAAkB;gBAClC,qBAAqB,EAAE,SAAS;aACjC;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,kCAAkC;gBACxC,SAAS,EAAE,oBAAoB;gBAC/B,MAAM,EAAE,OAAO,CAAC,UAAU;gBAC1B,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE;oBACR,QAAQ,EAAE,cAAc;oBACxB,aAAa,EAAE,OAAO,CAAC,UAAU;iBAClC;aACF;SACF,CAAC,CAAC;QAEH,+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C/B,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAO;QACrB,MAAM,KAAK,GAAG,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3C,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,WAAW,CAAC,CAAC;QAE/D,IAAI,SAAS,EAAE,CAAC;YACd,kEAAkE;YAClE,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,GAAG,OAAO,2BAA2B,SAAS,EAAE;gBACrD,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,KAAK,EAAE;oBAChC,cAAc,EAAE,kBAAkB;oBAClC,qBAAqB,EAAE,SAAS;iBACjC;gBACD,IAAI,EAAE;oBACJ,MAAM,EAAE,KAAK;iBACd;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAO;QACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { createTrigger, TriggerStrategy, Property } from '@activepieces/pieces-framework';
|
|
2
|
-
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
|
3
|
-
import { workbuddyAuth, getAccessToken } from '../auth';
|
|
4
|
-
|
|
5
|
-
export const allocation_created_trigger = createTrigger({
|
|
6
|
-
name: 'AllocationCreated',
|
|
7
|
-
auth: workbuddyAuth,
|
|
8
|
-
displayName: 'Allocation Created',
|
|
9
|
-
description: 'Triggered when a new allocation is created',
|
|
10
|
-
props: {},
|
|
11
|
-
sampleData: {},
|
|
12
|
-
type: TriggerStrategy.WEBHOOK,
|
|
13
|
-
|
|
14
|
-
async onEnable(context) {
|
|
15
|
-
const token = await getAccessToken(context.auth);
|
|
16
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
17
|
-
|
|
18
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
19
|
-
const response = await httpClient.sendRequest<{ id: string }>({
|
|
20
|
-
method: HttpMethod.POST,
|
|
21
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
22
|
-
headers: {
|
|
23
|
-
Authorization: `Bearer ${token}`,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
26
|
-
},
|
|
27
|
-
body: {
|
|
28
|
-
name: `Activepieces: Allocation Created`,
|
|
29
|
-
eventName: 'Allocation Created',
|
|
30
|
-
target: context.webhookUrl,
|
|
31
|
-
active: true,
|
|
32
|
-
workflow: {
|
|
33
|
-
platform: 'activepieces',
|
|
34
|
-
integrationId: context.webhookUrl,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Store webhook ID for cleanup
|
|
40
|
-
await context.store.put('webhookId', response.body.id);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
async onDisable(context) {
|
|
44
|
-
const token = await getAccessToken(context.auth);
|
|
45
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
46
|
-
const webhookId = await context.store.get<string>('webhookId');
|
|
47
|
-
|
|
48
|
-
if (webhookId) {
|
|
49
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
50
|
-
await httpClient.sendRequest({
|
|
51
|
-
method: HttpMethod.PATCH,
|
|
52
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
53
|
-
headers: {
|
|
54
|
-
Authorization: `Bearer ${token}`,
|
|
55
|
-
'Content-Type': 'application/json',
|
|
56
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
57
|
-
},
|
|
58
|
-
body: {
|
|
59
|
-
active: false,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
async run(context) {
|
|
66
|
-
return [context.payload.body];
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export const allocation_changed_trigger = createTrigger({
|
|
71
|
-
name: 'AllocationChanged',
|
|
72
|
-
auth: workbuddyAuth,
|
|
73
|
-
displayName: 'Allocation Changed',
|
|
74
|
-
description: 'Triggered when an allocation is modified',
|
|
75
|
-
props: {},
|
|
76
|
-
sampleData: {},
|
|
77
|
-
type: TriggerStrategy.WEBHOOK,
|
|
78
|
-
|
|
79
|
-
async onEnable(context) {
|
|
80
|
-
const token = await getAccessToken(context.auth);
|
|
81
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
82
|
-
|
|
83
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
84
|
-
const response = await httpClient.sendRequest<{ id: string }>({
|
|
85
|
-
method: HttpMethod.POST,
|
|
86
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
87
|
-
headers: {
|
|
88
|
-
Authorization: `Bearer ${token}`,
|
|
89
|
-
'Content-Type': 'application/json',
|
|
90
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
91
|
-
},
|
|
92
|
-
body: {
|
|
93
|
-
name: `Activepieces: Allocation Changed`,
|
|
94
|
-
eventName: 'Allocation Changed',
|
|
95
|
-
target: context.webhookUrl,
|
|
96
|
-
active: true,
|
|
97
|
-
workflow: {
|
|
98
|
-
platform: 'activepieces',
|
|
99
|
-
integrationId: context.webhookUrl,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Store webhook ID for cleanup
|
|
105
|
-
await context.store.put('webhookId', response.body.id);
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
async onDisable(context) {
|
|
109
|
-
const token = await getAccessToken(context.auth);
|
|
110
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
111
|
-
const webhookId = await context.store.get<string>('webhookId');
|
|
112
|
-
|
|
113
|
-
if (webhookId) {
|
|
114
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
115
|
-
await httpClient.sendRequest({
|
|
116
|
-
method: HttpMethod.PATCH,
|
|
117
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
118
|
-
headers: {
|
|
119
|
-
Authorization: `Bearer ${token}`,
|
|
120
|
-
'Content-Type': 'application/json',
|
|
121
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
122
|
-
},
|
|
123
|
-
body: {
|
|
124
|
-
active: false,
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
async run(context) {
|
|
131
|
-
return [context.payload.body];
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
export const allocation_deleted_trigger = createTrigger({
|
|
136
|
-
name: 'AllocationDeleted',
|
|
137
|
-
auth: workbuddyAuth,
|
|
138
|
-
displayName: 'Allocation Deleted',
|
|
139
|
-
description: 'Triggered when an allocation is deleted',
|
|
140
|
-
props: {},
|
|
141
|
-
sampleData: {},
|
|
142
|
-
type: TriggerStrategy.WEBHOOK,
|
|
143
|
-
|
|
144
|
-
async onEnable(context) {
|
|
145
|
-
const token = await getAccessToken(context.auth);
|
|
146
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
147
|
-
|
|
148
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
149
|
-
const response = await httpClient.sendRequest<{ id: string }>({
|
|
150
|
-
method: HttpMethod.POST,
|
|
151
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
152
|
-
headers: {
|
|
153
|
-
Authorization: `Bearer ${token}`,
|
|
154
|
-
'Content-Type': 'application/json',
|
|
155
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
156
|
-
},
|
|
157
|
-
body: {
|
|
158
|
-
name: `Activepieces: Allocation Deleted`,
|
|
159
|
-
eventName: 'Allocation Deleted',
|
|
160
|
-
target: context.webhookUrl,
|
|
161
|
-
active: true,
|
|
162
|
-
workflow: {
|
|
163
|
-
platform: 'activepieces',
|
|
164
|
-
integrationId: context.webhookUrl,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Store webhook ID for cleanup
|
|
170
|
-
await context.store.put('webhookId', response.body.id);
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
async onDisable(context) {
|
|
174
|
-
const token = await getAccessToken(context.auth);
|
|
175
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
176
|
-
const webhookId = await context.store.get<string>('webhookId');
|
|
177
|
-
|
|
178
|
-
if (webhookId) {
|
|
179
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
180
|
-
await httpClient.sendRequest({
|
|
181
|
-
method: HttpMethod.PATCH,
|
|
182
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
183
|
-
headers: {
|
|
184
|
-
Authorization: `Bearer ${token}`,
|
|
185
|
-
'Content-Type': 'application/json',
|
|
186
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
187
|
-
},
|
|
188
|
-
body: {
|
|
189
|
-
active: false,
|
|
190
|
-
},
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
async run(context) {
|
|
196
|
-
return [context.payload.body];
|
|
197
|
-
},
|
|
198
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const form_submitted_trigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
-
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
-
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
18
|
-
}>, {}>;
|
|
19
|
-
//# sourceMappingURL=form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAI1F,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;OA+DjC,CAAC"}
|
package/src/lib/triggers/form.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.form_submitted_trigger = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
exports.form_submitted_trigger = (0, pieces_framework_1.createTrigger)({
|
|
8
|
-
name: 'FormSubmitted',
|
|
9
|
-
auth: auth_1.workbuddyAuth,
|
|
10
|
-
displayName: 'Form Submitted',
|
|
11
|
-
description: 'Triggered when a form is submitted',
|
|
12
|
-
props: {},
|
|
13
|
-
sampleData: {},
|
|
14
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
-
async onEnable(context) {
|
|
16
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
17
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
18
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
19
|
-
const response = await pieces_common_1.httpClient.sendRequest({
|
|
20
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
21
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
22
|
-
headers: {
|
|
23
|
-
Authorization: `Bearer ${token}`,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
26
|
-
},
|
|
27
|
-
body: {
|
|
28
|
-
name: `Activepieces: Form Submitted`,
|
|
29
|
-
eventName: 'Form Submitted',
|
|
30
|
-
target: context.webhookUrl,
|
|
31
|
-
active: true,
|
|
32
|
-
workflow: {
|
|
33
|
-
platform: 'activepieces',
|
|
34
|
-
integrationId: context.webhookUrl,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
// Store webhook ID for cleanup
|
|
39
|
-
await context.store.put('webhookId', response.body.id);
|
|
40
|
-
},
|
|
41
|
-
async onDisable(context) {
|
|
42
|
-
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
43
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
44
|
-
const webhookId = await context.store.get('webhookId');
|
|
45
|
-
if (webhookId) {
|
|
46
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
47
|
-
await pieces_common_1.httpClient.sendRequest({
|
|
48
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
49
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
50
|
-
headers: {
|
|
51
|
-
Authorization: `Bearer ${token}`,
|
|
52
|
-
'Content-Type': 'application/json',
|
|
53
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
54
|
-
},
|
|
55
|
-
body: {
|
|
56
|
-
active: false,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
async run(context) {
|
|
62
|
-
return [context.payload.body];
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["form.ts"],"names":[],"mappings":";;;AAAA,qEAA0F;AAC1F,+DAAqE;AACrE,kCAAwD;AAE3C,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAClD,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IAE7B,KAAK,CAAC,QAAQ,CAAC,OAAO;QACpB,MAAM,KAAK,GAAG,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAE3C,kFAAkF;QAClF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAiB;YAC5D,MAAM,EAAE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C,OAAO;QACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF,CAAC,CAAC"}
|
package/src/lib/triggers/form.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { createTrigger, TriggerStrategy, Property } from '@activepieces/pieces-framework';
|
|
2
|
-
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
|
|
3
|
-
import { workbuddyAuth, getAccessToken } from '../auth';
|
|
4
|
-
|
|
5
|
-
export const form_submitted_trigger = createTrigger({
|
|
6
|
-
name: 'FormSubmitted',
|
|
7
|
-
auth: workbuddyAuth,
|
|
8
|
-
displayName: 'Form Submitted',
|
|
9
|
-
description: 'Triggered when a form is submitted',
|
|
10
|
-
props: {},
|
|
11
|
-
sampleData: {},
|
|
12
|
-
type: TriggerStrategy.WEBHOOK,
|
|
13
|
-
|
|
14
|
-
async onEnable(context) {
|
|
15
|
-
const token = await getAccessToken(context.auth);
|
|
16
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
17
|
-
|
|
18
|
-
// Register webhook with WorkBuddy (server handles upsert - reactivates if exists)
|
|
19
|
-
const response = await httpClient.sendRequest<{ id: string }>({
|
|
20
|
-
method: HttpMethod.POST,
|
|
21
|
-
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
22
|
-
headers: {
|
|
23
|
-
Authorization: `Bearer ${token}`,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
26
|
-
},
|
|
27
|
-
body: {
|
|
28
|
-
name: `Activepieces: Form Submitted`,
|
|
29
|
-
eventName: 'Form Submitted',
|
|
30
|
-
target: context.webhookUrl,
|
|
31
|
-
active: true,
|
|
32
|
-
workflow: {
|
|
33
|
-
platform: 'activepieces',
|
|
34
|
-
integrationId: context.webhookUrl,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Store webhook ID for cleanup
|
|
40
|
-
await context.store.put('webhookId', response.body.id);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
async onDisable(context) {
|
|
44
|
-
const token = await getAccessToken(context.auth);
|
|
45
|
-
const baseUrl = context.auth.props.baseUrl;
|
|
46
|
-
const webhookId = await context.store.get<string>('webhookId');
|
|
47
|
-
|
|
48
|
-
if (webhookId) {
|
|
49
|
-
// Deactivate webhook (server keeps it for potential reactivation)
|
|
50
|
-
await httpClient.sendRequest({
|
|
51
|
-
method: HttpMethod.PATCH,
|
|
52
|
-
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
53
|
-
headers: {
|
|
54
|
-
Authorization: `Bearer ${token}`,
|
|
55
|
-
'Content-Type': 'application/json',
|
|
56
|
-
'X-WorkBuddy-Version': '2026-01',
|
|
57
|
-
},
|
|
58
|
-
body: {
|
|
59
|
-
active: false,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
async run(context) {
|
|
66
|
-
return [context.payload.body];
|
|
67
|
-
},
|
|
68
|
-
});
|