@activepieces/piece-wrike 0.1.5 → 0.1.7
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 +7 -12
- package/src/index.js +23 -52
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-comment.d.ts +0 -7
- package/src/lib/actions/add-comment.d.ts.map +0 -1
- package/src/lib/actions/add-comment.js +0 -63
- package/src/lib/actions/add-comment.js.map +0 -1
- package/src/lib/actions/create-folder.d.ts +0 -11
- package/src/lib/actions/create-folder.d.ts.map +0 -1
- package/src/lib/actions/create-folder.js +0 -109
- package/src/lib/actions/create-folder.js.map +0 -1
- package/src/lib/actions/create-project.d.ts +0 -10
- package/src/lib/actions/create-project.d.ts.map +0 -1
- package/src/lib/actions/create-project.js +0 -102
- package/src/lib/actions/create-project.js.map +0 -1
- package/src/lib/actions/create-task.d.ts +0 -13
- package/src/lib/actions/create-task.d.ts.map +0 -1
- package/src/lib/actions/create-task.js +0 -144
- package/src/lib/actions/create-task.js.map +0 -1
- package/src/lib/actions/find-folder.d.ts +0 -10
- package/src/lib/actions/find-folder.d.ts.map +0 -1
- package/src/lib/actions/find-folder.js +0 -110
- package/src/lib/actions/find-folder.js.map +0 -1
- package/src/lib/actions/find-task.d.ts +0 -13
- package/src/lib/actions/find-task.d.ts.map +0 -1
- package/src/lib/actions/find-task.js +0 -158
- package/src/lib/actions/find-task.js.map +0 -1
- package/src/lib/actions/update-task.d.ts +0 -13
- package/src/lib/actions/update-task.d.ts.map +0 -1
- package/src/lib/actions/update-task.js +0 -144
- package/src/lib/actions/update-task.js.map +0 -1
- package/src/lib/actions/upload-attachment.d.ts +0 -7
- package/src/lib/actions/upload-attachment.d.ts.map +0 -1
- package/src/lib/actions/upload-attachment.js +0 -66
- package/src/lib/actions/upload-attachment.js.map +0 -1
- package/src/lib/common/auth.d.ts +0 -2
- package/src/lib/common/auth.d.ts.map +0 -1
- package/src/lib/common/auth.js +0 -22
- package/src/lib/common/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -13
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -24
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/triggers/new-folder.d.ts +0 -11
- package/src/lib/triggers/new-folder.d.ts.map +0 -1
- package/src/lib/triggers/new-folder.js +0 -84
- package/src/lib/triggers/new-folder.js.map +0 -1
- package/src/lib/triggers/new-subtask.d.ts +0 -11
- package/src/lib/triggers/new-subtask.d.ts.map +0 -1
- package/src/lib/triggers/new-subtask.js +0 -85
- package/src/lib/triggers/new-subtask.js.map +0 -1
- package/src/lib/triggers/new-task.d.ts +0 -11
- package/src/lib/triggers/new-task.d.ts.map +0 -1
- package/src/lib/triggers/new-task.js +0 -84
- package/src/lib/triggers/new-task.js.map +0 -1
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findTask = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const auth_1 = require("../common/auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.findTask = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'find_task',
|
|
11
|
-
displayName: 'Find Task',
|
|
12
|
-
description: 'Retrieve a task by its ID or lookup fields',
|
|
13
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Look up Wrike tasks: pass a task ID to fetch that exact task (other criteria are ignored), or omit it to search/filter by title, folder, status, importance, assignees, or authors with sorting and page size. Use when an agent needs to find or read tasks before acting on them. Read-only and idempotent.', idempotent: true },
|
|
15
|
-
auth: auth_1.wrikeAuth,
|
|
16
|
-
props: {
|
|
17
|
-
taskId: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Task ID',
|
|
19
|
-
description: 'The ID of the task to retrieve. If provided, other search criteria will be ignored.',
|
|
20
|
-
required: false,
|
|
21
|
-
}),
|
|
22
|
-
title: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'Task Title',
|
|
24
|
-
description: 'Search for tasks by title (partial match)',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
folderId: pieces_framework_1.Property.ShortText({
|
|
28
|
-
displayName: 'Folder ID',
|
|
29
|
-
description: 'Search for tasks within a specific folder',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
33
|
-
displayName: 'Status',
|
|
34
|
-
description: 'Filter tasks by status',
|
|
35
|
-
required: false,
|
|
36
|
-
options: {
|
|
37
|
-
options: [
|
|
38
|
-
{ label: 'Active', value: 'Active' },
|
|
39
|
-
{ label: 'Completed', value: 'Completed' },
|
|
40
|
-
{ label: 'Deferred', value: 'Deferred' },
|
|
41
|
-
{ label: 'Cancelled', value: 'Cancelled' },
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
importance: pieces_framework_1.Property.StaticDropdown({
|
|
46
|
-
displayName: 'Importance',
|
|
47
|
-
description: 'Filter tasks by importance/priority',
|
|
48
|
-
required: false,
|
|
49
|
-
options: {
|
|
50
|
-
options: [
|
|
51
|
-
{ label: 'Low', value: 'Low' },
|
|
52
|
-
{ label: 'Normal', value: 'Normal' },
|
|
53
|
-
{ label: 'High', value: 'High' },
|
|
54
|
-
{ label: 'Critical', value: 'Critical' },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
assignees: pieces_framework_1.Property.Array({
|
|
59
|
-
displayName: 'Assignee IDs',
|
|
60
|
-
description: 'Filter tasks by assignee user IDs',
|
|
61
|
-
required: false,
|
|
62
|
-
properties: {
|
|
63
|
-
userId: pieces_framework_1.Property.ShortText({
|
|
64
|
-
displayName: 'User ID',
|
|
65
|
-
required: true,
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
authors: pieces_framework_1.Property.Array({
|
|
70
|
-
displayName: 'Author IDs',
|
|
71
|
-
description: 'Filter tasks by author user IDs',
|
|
72
|
-
required: false,
|
|
73
|
-
properties: {
|
|
74
|
-
userId: pieces_framework_1.Property.ShortText({
|
|
75
|
-
displayName: 'User ID',
|
|
76
|
-
required: true,
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
}),
|
|
80
|
-
pageSize: pieces_framework_1.Property.Number({
|
|
81
|
-
displayName: 'Page Size',
|
|
82
|
-
description: 'Maximum number of tasks to return (max 1000)',
|
|
83
|
-
required: false,
|
|
84
|
-
defaultValue: 100,
|
|
85
|
-
}),
|
|
86
|
-
sortField: pieces_framework_1.Property.StaticDropdown({
|
|
87
|
-
displayName: 'Sort Field',
|
|
88
|
-
description: 'Field to sort tasks by',
|
|
89
|
-
required: false,
|
|
90
|
-
options: {
|
|
91
|
-
options: [
|
|
92
|
-
{ label: 'Created Date', value: 'CreatedDate' },
|
|
93
|
-
{ label: 'Updated Date', value: 'UpdatedDate' },
|
|
94
|
-
{ label: 'Due Date', value: 'DueDate' },
|
|
95
|
-
{ label: 'Start Date', value: 'StartDate' },
|
|
96
|
-
{ label: 'Completed Date', value: 'CompletedDate' },
|
|
97
|
-
{ label: 'Title', value: 'Title' },
|
|
98
|
-
{ label: 'Status', value: 'Status' },
|
|
99
|
-
{ label: 'Importance', value: 'Importance' },
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
}),
|
|
103
|
-
sortOrder: pieces_framework_1.Property.StaticDropdown({
|
|
104
|
-
displayName: 'Sort Order',
|
|
105
|
-
description: 'Sort order for results',
|
|
106
|
-
required: false,
|
|
107
|
-
options: {
|
|
108
|
-
options: [
|
|
109
|
-
{ label: 'Ascending', value: 'Asc' },
|
|
110
|
-
{ label: 'Descending', value: 'Desc' },
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
}),
|
|
114
|
-
},
|
|
115
|
-
run(context) {
|
|
116
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
const props = context.propsValue;
|
|
118
|
-
const { taskId, title, folderId, status, importance, assignees, authors, pageSize, sortField, sortOrder } = props;
|
|
119
|
-
if (taskId) {
|
|
120
|
-
const response = yield client_1.wrikeCommon.apiCall({
|
|
121
|
-
auth: context.auth,
|
|
122
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
123
|
-
resourceUri: `/tasks/${taskId}`,
|
|
124
|
-
});
|
|
125
|
-
return response.body;
|
|
126
|
-
}
|
|
127
|
-
const queryParams = {};
|
|
128
|
-
if (title)
|
|
129
|
-
queryParams['title'] = title;
|
|
130
|
-
if (folderId)
|
|
131
|
-
queryParams['folderId'] = folderId;
|
|
132
|
-
if (status)
|
|
133
|
-
queryParams['status'] = status;
|
|
134
|
-
if (importance)
|
|
135
|
-
queryParams['importance'] = importance;
|
|
136
|
-
if (pageSize)
|
|
137
|
-
queryParams['pageSize'] = pageSize.toString();
|
|
138
|
-
if (sortField)
|
|
139
|
-
queryParams['sortField'] = sortField;
|
|
140
|
-
if (sortOrder)
|
|
141
|
-
queryParams['sortOrder'] = sortOrder;
|
|
142
|
-
if (assignees && assignees.length > 0) {
|
|
143
|
-
queryParams['responsibles'] = assignees.map((assignee) => assignee.userId).join(',');
|
|
144
|
-
}
|
|
145
|
-
if (authors && authors.length > 0) {
|
|
146
|
-
queryParams['authors'] = authors.map((author) => author.userId).join(',');
|
|
147
|
-
}
|
|
148
|
-
const response = yield client_1.wrikeCommon.apiCall({
|
|
149
|
-
auth: context.auth,
|
|
150
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
151
|
-
resourceUri: '/tasks',
|
|
152
|
-
queryParams,
|
|
153
|
-
});
|
|
154
|
-
return response.body;
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
//# sourceMappingUR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,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,QAAQ;gBACrB,WAAW;aACd,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const updateTask: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
taskId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
5
|
-
status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
-
importance: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
-
assignees: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
8
|
-
start_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
9
|
-
due_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
10
|
-
duration: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
-
customFields: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=update-task.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-task.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-task.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;;;;;EAoIrB,CAAC"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateTask = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const auth_1 = require("../common/auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.updateTask = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'update_task',
|
|
11
|
-
displayName: 'Update Task',
|
|
12
|
-
description: 'Update fields of an existing task in Wrike',
|
|
13
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Update an existing Wrike task identified by its task ID, setting only the provided fields (title, description, status, importance, assignees, dates, duration, custom fields); supplied assignees replace the existing ones. Use when an agent needs to modify a known task rather than create one. Requires the task ID; re-running with the same input leaves the task in the same state, so it is idempotent.', idempotent: true },
|
|
15
|
-
auth: auth_1.wrikeAuth,
|
|
16
|
-
props: {
|
|
17
|
-
taskId: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Task ID',
|
|
19
|
-
description: 'The ID of the task to update',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
title: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'Task Title',
|
|
24
|
-
description: 'The new title of the task',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
description: pieces_framework_1.Property.LongText({
|
|
28
|
-
displayName: 'Description',
|
|
29
|
-
description: 'The new description of the task',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
33
|
-
displayName: 'Status',
|
|
34
|
-
description: 'The new status of the task',
|
|
35
|
-
required: false,
|
|
36
|
-
options: {
|
|
37
|
-
options: [
|
|
38
|
-
{ label: 'Active', value: 'Active' },
|
|
39
|
-
{ label: 'Completed', value: 'Completed' },
|
|
40
|
-
{ label: 'Deferred', value: 'Deferred' },
|
|
41
|
-
{ label: 'Cancelled', value: 'Cancelled' },
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
importance: pieces_framework_1.Property.StaticDropdown({
|
|
46
|
-
displayName: 'Importance',
|
|
47
|
-
description: 'The new importance/priority of the task',
|
|
48
|
-
required: false,
|
|
49
|
-
options: {
|
|
50
|
-
options: [
|
|
51
|
-
{ label: 'Low', value: 'Low' },
|
|
52
|
-
{ label: 'Normal', value: 'Normal' },
|
|
53
|
-
{ label: 'High', value: 'High' },
|
|
54
|
-
{ label: 'Critical', value: 'Critical' },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
assignees: pieces_framework_1.Property.Array({
|
|
59
|
-
displayName: 'Assignees',
|
|
60
|
-
description: 'User IDs to assign to the task (replaces existing assignees)',
|
|
61
|
-
required: false,
|
|
62
|
-
properties: {
|
|
63
|
-
userId: pieces_framework_1.Property.ShortText({
|
|
64
|
-
displayName: 'User ID',
|
|
65
|
-
required: true,
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
start_date: pieces_framework_1.Property.DateTime({
|
|
70
|
-
displayName: 'Start Date',
|
|
71
|
-
description: 'Task start date (format: YYYY-MM-DD)',
|
|
72
|
-
required: false,
|
|
73
|
-
}),
|
|
74
|
-
due_date: pieces_framework_1.Property.DateTime({
|
|
75
|
-
displayName: 'Due Date',
|
|
76
|
-
description: 'Task due date (format: YYYY-MM-DD)',
|
|
77
|
-
required: false,
|
|
78
|
-
}),
|
|
79
|
-
duration: pieces_framework_1.Property.Number({
|
|
80
|
-
displayName: 'Duration',
|
|
81
|
-
description: 'Task duration in minutes',
|
|
82
|
-
required: false,
|
|
83
|
-
}),
|
|
84
|
-
customFields: pieces_framework_1.Property.Array({
|
|
85
|
-
displayName: 'Custom Fields',
|
|
86
|
-
description: 'Custom field values to update for the task',
|
|
87
|
-
required: false,
|
|
88
|
-
properties: {
|
|
89
|
-
fieldId: pieces_framework_1.Property.ShortText({
|
|
90
|
-
displayName: 'Field ID',
|
|
91
|
-
description: 'Custom field identifier',
|
|
92
|
-
required: true,
|
|
93
|
-
}),
|
|
94
|
-
value: pieces_framework_1.Property.ShortText({
|
|
95
|
-
displayName: 'Value',
|
|
96
|
-
description: 'New field value',
|
|
97
|
-
required: true,
|
|
98
|
-
}),
|
|
99
|
-
},
|
|
100
|
-
}),
|
|
101
|
-
},
|
|
102
|
-
run(context) {
|
|
103
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const props = context.propsValue;
|
|
105
|
-
const { taskId, title, description, status, importance, assignees, start_date, due_date, duration, customFields } = props;
|
|
106
|
-
const taskData = {};
|
|
107
|
-
if (title)
|
|
108
|
-
taskData['title'] = title;
|
|
109
|
-
if (description !== undefined)
|
|
110
|
-
taskData['description'] = description;
|
|
111
|
-
if (status)
|
|
112
|
-
taskData['status'] = status;
|
|
113
|
-
if (importance)
|
|
114
|
-
taskData['importance'] = importance;
|
|
115
|
-
if (assignees && assignees.length > 0) {
|
|
116
|
-
taskData['responsibles'] = assignees.map((assignee) => assignee.userId);
|
|
117
|
-
}
|
|
118
|
-
const dates = {};
|
|
119
|
-
if (start_date)
|
|
120
|
-
dates['start'] = start_date;
|
|
121
|
-
if (due_date)
|
|
122
|
-
dates['due'] = due_date;
|
|
123
|
-
if (duration)
|
|
124
|
-
dates['duration'] = duration;
|
|
125
|
-
if (Object.keys(dates).length > 0) {
|
|
126
|
-
taskData['dates'] = dates;
|
|
127
|
-
}
|
|
128
|
-
if (customFields && customFields.length > 0) {
|
|
129
|
-
taskData['customFields'] = customFields.map((field) => ({
|
|
130
|
-
id: field.fieldId,
|
|
131
|
-
value: field.value,
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
const response = yield client_1.wrikeCommon.apiCall({
|
|
135
|
-
auth: context.auth,
|
|
136
|
-
method: pieces_common_1.HttpMethod.PUT,
|
|
137
|
-
resourceUri: `/tasks/${taskId}`,
|
|
138
|
-
body: taskData,
|
|
139
|
-
});
|
|
140
|
-
return response.body;
|
|
141
|
-
});
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
//# sourceMappingURL=update-task.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-task.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-task.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA2C;AAC3C,6CAA+C;AAElC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kZAAkZ,EAAE,UAAU,EAAE,IAAI,EAAE;IACjc,IAAI,EAAE,gBAAS;IACf,KAAK,EAAE;QACH,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,UAAU,EAA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KAAK,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC;YAC5C,IAAI,QAAQ;gBAAE,KAAK,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YACtC,IAAI,QAAQ;gBAAE,KAAK,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;YAC3C,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChC,QAAQ,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YAC9B,CAAC;YAED,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1C,QAAQ,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;oBACzD,EAAE,EAAE,KAAK,CAAC,OAAO;oBACjB,KAAK,EAAE,KAAK,CAAC,KAAK;iBACrB,CAAC,CAAC,CAAC;YACR,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,oBAAW,CAAC,OAAO,CAAC;gBACvC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,UAAU,MAAM,EAAE;gBAC/B,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const uploadAttachment: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
2
|
-
entityType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
3
|
-
entityId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
file: import("@activepieces/pieces-framework").FileProperty<true>;
|
|
5
|
-
fileName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=upload-attachment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-attachment.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/upload-attachment.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;EAwD3B,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadAttachment = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const auth_1 = require("../common/auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.uploadAttachment = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'upload_attachment',
|
|
11
|
-
displayName: 'Upload Attachment',
|
|
12
|
-
description: 'Upload a file and attach it to a task or folder',
|
|
13
|
-
audience: 'both',
|
|
14
|
-
aiMetadata: { description: 'Upload a file and attach it to a Wrike task or folder, chosen via the entity type and entity ID, with an optional custom file name. Use when an agent needs to add a document or asset to an item. Each call uploads a new attachment, so it is not idempotent.', idempotent: false },
|
|
15
|
-
auth: auth_1.wrikeAuth,
|
|
16
|
-
props: {
|
|
17
|
-
entityType: pieces_framework_1.Property.StaticDropdown({
|
|
18
|
-
displayName: 'Entity Type',
|
|
19
|
-
description: 'Select whether to attach the file to a task or folder',
|
|
20
|
-
required: true,
|
|
21
|
-
options: {
|
|
22
|
-
options: [
|
|
23
|
-
{ label: 'Task', value: 'tasks' },
|
|
24
|
-
{ label: 'Folder', value: 'folders' },
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
entityId: pieces_framework_1.Property.ShortText({
|
|
29
|
-
displayName: 'Entity ID',
|
|
30
|
-
description: 'The ID of the task or folder to attach the file to',
|
|
31
|
-
required: true,
|
|
32
|
-
}),
|
|
33
|
-
file: pieces_framework_1.Property.File({
|
|
34
|
-
displayName: 'File',
|
|
35
|
-
description: 'The file to upload and attach',
|
|
36
|
-
required: true,
|
|
37
|
-
}),
|
|
38
|
-
fileName: pieces_framework_1.Property.ShortText({
|
|
39
|
-
displayName: 'File Name',
|
|
40
|
-
description: 'Optional custom name for the uploaded file',
|
|
41
|
-
required: false,
|
|
42
|
-
}),
|
|
43
|
-
},
|
|
44
|
-
run(context) {
|
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const props = context.propsValue;
|
|
47
|
-
const { entityType, entityId, file, fileName } = props;
|
|
48
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
49
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
50
|
-
url: `${client_1.wrikeCommon.baseUrl}/${entityType}/${entityId}/attachments`,
|
|
51
|
-
body: file.data,
|
|
52
|
-
authentication: {
|
|
53
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
54
|
-
token: context.auth.access_token,
|
|
55
|
-
},
|
|
56
|
-
headers: {
|
|
57
|
-
'Content-Type': 'application/octet-stream',
|
|
58
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
59
|
-
'X-File-Name': fileName || file.filename,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
return response.body;
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=upload-attachment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-attachment.js","sourceRoot":"","sources":["../../../../src/lib/actions/upload-attachment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyF;AACzF,yCAA2C;AAC3C,6CAA+C;AAElC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,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AE,IAAI,CAAC,IAAI;gBACf,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;iBACnC;gBACD,OAAO,EAAE;oBACL,cAAc,EAAE,0BAA0B;oBAC1C,kBAAkB,EAAE,gBAAgB;oBACpC,aAAa,EAAE,QAAQ,IAAI,IAAI,CAAC,QAAQ;iBAC3C;aACJ,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
package/src/lib/common/auth.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,+GAgBpB,CAAC"}
|
package/src/lib/common/auth.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrikeAuth = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
exports.wrikeAuth = pieces_framework_1.PieceAuth.OAuth2({
|
|
6
|
-
description: `
|
|
7
|
-
To obtain your OAuth2 credentials:
|
|
8
|
-
|
|
9
|
-
1. Go to Wrike (https://www.wrike.com/)
|
|
10
|
-
2. Sign in to your account or create one
|
|
11
|
-
3. Go to Apps & Integrations (https://www.wrike.com/apps/)
|
|
12
|
-
4. Click "Create new app" or use an existing one
|
|
13
|
-
5. For local development, add \`http://localhost:4200/redirect\` to the allowed redirect URIs
|
|
14
|
-
6. For production, add \`https://cloud.activepieces.com/redirect\` to the allowed redirect URIs
|
|
15
|
-
7. Copy the Client ID and Client Secret
|
|
16
|
-
`,
|
|
17
|
-
authUrl: 'https://login.wrike.com/oauth2/authorize/v4',
|
|
18
|
-
tokenUrl: 'https://login.wrike.com/oauth2/token',
|
|
19
|
-
required: true,
|
|
20
|
-
scope: []
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAE9C,QAAA,SAAS,GAAG,4BAAS,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE;;;;;;;;;;KAUZ;IACD,OAAO,EAAE,6CAA6C;IACtD,QAAQ,EAAE,sCAAsC;IAChD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,EAAE;CACZ,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { HttpMethod } from '@activepieces/pieces-common';
|
|
2
|
-
import { OAuth2PropertyValue } from '@activepieces/pieces-framework';
|
|
3
|
-
export declare const wrikeCommon: {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
apiCall({ auth, method, resourceUri, body, queryParams, }: {
|
|
6
|
-
auth: OAuth2PropertyValue;
|
|
7
|
-
method: HttpMethod;
|
|
8
|
-
resourceUri: string;
|
|
9
|
-
body?: any;
|
|
10
|
-
queryParams?: Record<string, string>;
|
|
11
|
-
}): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAsB,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAIrE,eAAO,MAAM,WAAW;;+DASjB;QACC,IAAI,EAAE,mBAAmB,CAAC;QAC1B,MAAM,EAAE,UAAU,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC;CAYJ,CAAC"}
|
package/src/lib/common/client.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrikeCommon = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const WRIKE_API_BASE_URL = 'https://www.wrike.com/api/v4';
|
|
7
|
-
exports.wrikeCommon = {
|
|
8
|
-
baseUrl: WRIKE_API_BASE_URL,
|
|
9
|
-
apiCall(_a) {
|
|
10
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, resourceUri, body = undefined, queryParams = undefined, }) {
|
|
11
|
-
return yield pieces_common_1.httpClient.sendRequest({
|
|
12
|
-
method: method,
|
|
13
|
-
url: `${WRIKE_API_BASE_URL}${resourceUri}`,
|
|
14
|
-
body,
|
|
15
|
-
queryParams,
|
|
16
|
-
authentication: {
|
|
17
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
18
|
-
token: auth.access_token,
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;;;AAAA,+DAAyF;AAGzF,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAE7C,QAAA,WAAW,GAAG;IACvB,OAAO,EAAE,kBAAkB;IAErB,OAAO;qEAAC,EACV,IAAI,EACJ,MAAM,EACN,WAAW,EACX,IAAI,GAAG,SAAS,EAChB,WAAW,GAAG,SAAS,GAO1B;YACG,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAChC,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,GAAG,kBAAkB,GAAG,WAAW,EAAE;gBAC1C,IAAI;gBACJ,WAAW;gBACX,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAI,CAAC,YAAY;iBAC3B;aACJ,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const newFolder: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
3
|
-
parentFolderId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
5
|
-
parentFolderId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
7
|
-
parentFolderId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
9
|
-
parentFolderId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=new-folder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-folder.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AAGhF,eAAO,MAAM,SAAS;;;;;;;;EAyFpB,CAAC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newFolder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../common/auth");
|
|
7
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
-
const pieces_framework_2 = require("@activepieces/pieces-framework");
|
|
9
|
-
const client_1 = require("../common/client");
|
|
10
|
-
exports.newFolder = (0, pieces_framework_2.createTrigger)({
|
|
11
|
-
name: 'new_folder',
|
|
12
|
-
displayName: 'New Folder',
|
|
13
|
-
description: 'Fires when a new folder (or project) is created in Wrike.',
|
|
14
|
-
aiMetadata: {
|
|
15
|
-
description: 'Fires when a new folder or project is created in Wrike, registered via a webhook on the FolderCreated event; can be scoped to a single parent folder so it only fires for folders created underneath it.',
|
|
16
|
-
},
|
|
17
|
-
auth: auth_1.wrikeAuth,
|
|
18
|
-
type: pieces_framework_2.TriggerStrategy.WEBHOOK,
|
|
19
|
-
props: {
|
|
20
|
-
parentFolderId: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Parent Folder ID',
|
|
22
|
-
description: 'Optional: Only trigger for folders created in this specific parent folder',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
26
|
-
sampleData: {
|
|
27
|
-
folderId: 'IEAAABDMI4AB5FML',
|
|
28
|
-
webhookId: 'IEAAABDMJAAAABA7',
|
|
29
|
-
eventAuthorId: 'KUAAABLG',
|
|
30
|
-
eventType: 'FolderCreated',
|
|
31
|
-
lastUpdatedDate: '2024-09-05T07:49:34Z',
|
|
32
|
-
},
|
|
33
|
-
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
-
const webhookUrl = context.webhookUrl;
|
|
35
|
-
const { parentFolderId } = context.propsValue;
|
|
36
|
-
const webhookData = {
|
|
37
|
-
hookUrl: webhookUrl,
|
|
38
|
-
};
|
|
39
|
-
if (parentFolderId) {
|
|
40
|
-
webhookData['folderId'] = parentFolderId;
|
|
41
|
-
}
|
|
42
|
-
const request = {
|
|
43
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
44
|
-
url: `${client_1.wrikeCommon.baseUrl}/webhooks`,
|
|
45
|
-
body: webhookData,
|
|
46
|
-
headers: {
|
|
47
|
-
Authorization: `Bearer ${context.auth.access_token}`,
|
|
48
|
-
'Content-Type': 'application/json',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
const { status, body } = yield pieces_common_1.httpClient.sendRequest(request);
|
|
52
|
-
if (status !== 200) {
|
|
53
|
-
throw new Error(`Failed to register webhook. Status: ${status}, Body: ${JSON.stringify(body)}`);
|
|
54
|
-
}
|
|
55
|
-
yield context.store.put('webhook_id', body.data[0].id);
|
|
56
|
-
}),
|
|
57
|
-
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
const webhookId = yield context.store.get('webhook_id');
|
|
59
|
-
if (webhookId) {
|
|
60
|
-
const request = {
|
|
61
|
-
method: pieces_common_1.HttpMethod.DELETE,
|
|
62
|
-
url: `${client_1.wrikeCommon.baseUrl}/webhooks/${webhookId}`,
|
|
63
|
-
headers: {
|
|
64
|
-
Authorization: `Bearer ${context.auth.access_token}`,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
try {
|
|
68
|
-
yield pieces_common_1.httpClient.sendRequest(request);
|
|
69
|
-
yield context.store.delete('webhook_id');
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
console.warn('Failed to unregister webhook:', error);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}),
|
|
76
|
-
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
const payload = context.payload.body;
|
|
78
|
-
if (payload && payload.eventType === 'FolderCreated') {
|
|
79
|
-
return payload;
|
|
80
|
-
}
|
|
81
|
-
return [];
|
|
82
|
-
}),
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=new-folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-folder.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-folder.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,yCAA2C;AAC3C,+DAIqC;AACrC,qEAAgF;AAChF,6CAA+C;AAElC,QAAA,SAAS,GAAG,IAAA,gCAAa,EAAC;IACrC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,2DAA2D;IACxE,UAAU,EAAE;QACV,WAAW,EAAE,0MAA0M;KACxN;IACD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EACT,2EAA2E;YAC7E,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,kBAAkB;QAC5B,SAAS,EAAE,kBAAkB;QAC7B,aAAa,EAAE,UAAU;QACzB,SAAS,EAAE,eAAe;QAC1B,eAAe,EAAE,sBAAsB;KACxC;IAED,QAAQ,EAAE,CAAO,OAAO,EAAE,EAAE;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;QAE9C,MAAM,WAAW,GAAwB;YACvC,OAAO,EAAE,UAAU;SACpB,CAAC;QAEF,IAAI,cAAc,EAAE,CAAC;YACnB,WAAW,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC;QAC3C,CAAC;QAED,MAAM,OAAO,GAAgB;YAC3B,M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,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,GAAG,EAAE,CAAO,OAAO,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAW,CAAC;QAE5C,IAAI,OAAO,IAAI,OAAO,CAAC,SAAS,KAAK,eAAe,EAAE,CAAC;YACrD,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const newSubtask: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
3
|
-
parentTaskId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
5
|
-
parentTaskId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
7
|
-
parentTaskId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
|
|
9
|
-
parentTaskId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=new-subtask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-subtask.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-subtask.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAiB,MAAM,gCAAgC,CAAC;AAGhF,eAAO,MAAM,UAAU;;;;;;;;EA0FrB,CAAC"}
|