@activepieces/piece-todos 0.0.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/README.md +7 -0
- package/package.json +36 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +18 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-todo.d.ts +7 -0
- package/src/lib/actions/create-todo.js +160 -0
- package/src/lib/actions/create-todo.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-todos",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.8.2",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.23.8",
|
|
16
|
+
"@activepieces/pieces-common": "0.4.3",
|
|
17
|
+
"@activepieces/pieces-framework": "0.7.46",
|
|
18
|
+
"@activepieces/shared": "0.10.158",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"@tryfabric/martian": {
|
|
24
|
+
"@notionhq/client": "$@notionhq/client"
|
|
25
|
+
},
|
|
26
|
+
"vite": {
|
|
27
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"resolutions": {
|
|
31
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
32
|
+
},
|
|
33
|
+
"main": "./src/index.js",
|
|
34
|
+
"type": "commonjs",
|
|
35
|
+
"types": "./src/index.d.ts"
|
|
36
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const todos: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").PieceAuthProperty>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.todos = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const create_todo_1 = require("./lib/actions/create-todo");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
exports.todos = (0, pieces_framework_1.createPiece)({
|
|
8
|
+
displayName: 'Todos',
|
|
9
|
+
description: 'Create tasks for project members to take actions, useful for approvals, reviews, and manual actions performed by humans',
|
|
10
|
+
auth: pieces_framework_1.PieceAuth.None(),
|
|
11
|
+
minimumSupportedRelease: '0.48.1',
|
|
12
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/manual-tasks.svg',
|
|
13
|
+
authors: ['hazemadelkhalel'],
|
|
14
|
+
categories: [shared_1.PieceCategory.CORE, shared_1.PieceCategory.FLOW_CONTROL],
|
|
15
|
+
actions: [create_todo_1.createTodo],
|
|
16
|
+
triggers: [],
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/todos/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,2DAAuD;AACvD,iDAAqD;AAExC,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,WAAW,EACT,yHAAyH;IAC3H,IAAI,EAAE,4BAAS,CAAC,IAAI,EAAE;IACtB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,OAAO,EAAE,CAAC,iBAAiB,CAAC;IAC5B,UAAU,EAAE,CAAC,sBAAa,CAAC,IAAI,EAAE,sBAAa,CAAC,YAAY,CAAC;IAC5D,OAAO,EAAE,CAAC,wBAAU,CAAC;IACrB,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const createTodo: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
routerMarkdown: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
5
|
+
assigneeId: import("@activepieces/pieces-framework").DropdownProperty<string, false>;
|
|
6
|
+
statusOptions: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTodo = 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 shared_1 = require("@activepieces/shared");
|
|
8
|
+
const routerMarkdown = `
|
|
9
|
+
Use the **Router piece** to create different paths based on the todo's status.
|
|
10
|
+
`;
|
|
11
|
+
exports.createTodo = (0, pieces_framework_1.createAction)({
|
|
12
|
+
name: 'createTodo',
|
|
13
|
+
displayName: 'Create Todo',
|
|
14
|
+
description: 'Creates a todo for a user, requiring them to respond or take action.',
|
|
15
|
+
props: {
|
|
16
|
+
routerMarkdown: pieces_framework_1.Property.MarkDown({
|
|
17
|
+
value: routerMarkdown,
|
|
18
|
+
variant: shared_1.MarkdownVariant.INFO,
|
|
19
|
+
}),
|
|
20
|
+
title: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Title',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
description: pieces_framework_1.Property.LongText({
|
|
25
|
+
displayName: 'Description',
|
|
26
|
+
description: 'These details will be displayed for the assignee. Add the full context so they can take proper action, You can also use markdown formatting.',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
assigneeId: pieces_framework_1.Property.Dropdown({
|
|
30
|
+
displayName: 'Assignee',
|
|
31
|
+
required: false,
|
|
32
|
+
options: (_, context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const baseApiUrl = context.server.publicUrl;
|
|
34
|
+
const apiKey = context.server.token;
|
|
35
|
+
const users = yield listAssignee(baseApiUrl, apiKey);
|
|
36
|
+
console.log('HELLLOOOO');
|
|
37
|
+
console.log(JSON.stringify(users, null, 2));
|
|
38
|
+
return {
|
|
39
|
+
options: users.data.map((user) => ({
|
|
40
|
+
value: user.id,
|
|
41
|
+
label: `${user.firstName} ${user.lastName}`,
|
|
42
|
+
})),
|
|
43
|
+
};
|
|
44
|
+
}),
|
|
45
|
+
refreshers: [],
|
|
46
|
+
}),
|
|
47
|
+
statusOptions: pieces_framework_1.Property.Array({
|
|
48
|
+
displayName: 'Status Options',
|
|
49
|
+
required: true,
|
|
50
|
+
properties: {
|
|
51
|
+
name: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Name',
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
variant: pieces_framework_1.Property.StaticDropdown({
|
|
56
|
+
displayName: 'Variant',
|
|
57
|
+
required: true,
|
|
58
|
+
defaultValue: shared_1.STATUS_VARIANT.POSITIVE,
|
|
59
|
+
options: {
|
|
60
|
+
options: Object.values(shared_1.STATUS_VARIANT).map((variant) => ({
|
|
61
|
+
value: variant,
|
|
62
|
+
label: variant,
|
|
63
|
+
})),
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
errorHandlingOptions: {
|
|
70
|
+
continueOnFailure: {
|
|
71
|
+
hide: true,
|
|
72
|
+
},
|
|
73
|
+
retryOnFailure: {
|
|
74
|
+
hide: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
test(context) {
|
|
78
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
if (context.executionType === shared_1.ExecutionType.BEGIN) {
|
|
80
|
+
context.run.pause({
|
|
81
|
+
pauseMetadata: {
|
|
82
|
+
type: shared_1.PauseType.WEBHOOK,
|
|
83
|
+
response: {},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
const response = yield sendTodoApproval(context, true);
|
|
87
|
+
return response.body;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return {
|
|
91
|
+
status: context.resumePayload.queryParams['status'],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
run(context) {
|
|
97
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
if (context.executionType === shared_1.ExecutionType.BEGIN) {
|
|
99
|
+
context.run.pause({
|
|
100
|
+
pauseMetadata: {
|
|
101
|
+
type: shared_1.PauseType.WEBHOOK,
|
|
102
|
+
response: {},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const response = yield sendTodoApproval(context, false);
|
|
106
|
+
return response.body;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return {
|
|
110
|
+
status: context.resumePayload.queryParams['status'],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
function sendTodoApproval(context, isTest) {
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
const requestBody = {
|
|
120
|
+
title: context.propsValue.title,
|
|
121
|
+
description: (_a = context.propsValue.description) !== null && _a !== void 0 ? _a : undefined,
|
|
122
|
+
statusOptions: context.propsValue.statusOptions.map((option) => ({
|
|
123
|
+
name: option.name,
|
|
124
|
+
description: option.description,
|
|
125
|
+
variant: option.variant,
|
|
126
|
+
})),
|
|
127
|
+
flowId: context.flows.current.id,
|
|
128
|
+
runId: isTest ? undefined : context.run.id,
|
|
129
|
+
assigneeId: (_b = context.propsValue.assigneeId) !== null && _b !== void 0 ? _b : undefined,
|
|
130
|
+
approvalUrl: context.generateResumeUrl({
|
|
131
|
+
queryParams: { action: 'approve' },
|
|
132
|
+
}),
|
|
133
|
+
};
|
|
134
|
+
const request = {
|
|
135
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
136
|
+
url: `${context.server.publicUrl}v1/todos`,
|
|
137
|
+
body: requestBody,
|
|
138
|
+
authentication: {
|
|
139
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
140
|
+
token: context.server.token,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function listAssignee(publicUrl, token) {
|
|
147
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const request = {
|
|
149
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
150
|
+
url: `${publicUrl}v1/todos/assignees`,
|
|
151
|
+
authentication: {
|
|
152
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
153
|
+
token: token,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
const res = yield pieces_common_1.httpClient.sendRequest(request);
|
|
157
|
+
return res.body;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=create-todo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-todo.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/todos/src/lib/actions/create-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