@azysinovacao/piece-kanbn 0.0.2 → 0.0.4
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 +4 -11
- package/{dist → src}/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +434 -0
- package/{dist → src}/lib/actions/create-board.d.ts +2 -1
- package/src/lib/actions/create-board.d.ts.map +1 -0
- package/{dist → src}/lib/actions/create-card.d.ts +4 -3
- package/src/lib/actions/create-card.d.ts.map +1 -0
- package/{dist → src}/lib/actions/move-card.d.ts +5 -4
- package/src/lib/actions/move-card.d.ts.map +1 -0
- package/src/lib/common/client.d.ts +3 -0
- package/src/lib/common/client.d.ts.map +1 -0
- package/src/lib/common/props.d.ts +5 -0
- package/src/lib/common/props.d.ts.map +1 -0
- package/{dist → src}/lib/triggers/card-events.d.ts +5 -4
- package/src/lib/triggers/card-events.d.ts.map +1 -0
- package/dist/index.js +0 -38
- package/dist/lib/actions/create-board.js +0 -36
- package/dist/lib/actions/create-card.js +0 -32
- package/dist/lib/actions/move-card.js +0 -24
- package/dist/lib/common/client.d.ts +0 -1
- package/dist/lib/common/client.js +0 -8
- package/dist/lib/common/props.d.ts +0 -4
- package/dist/lib/common/props.js +0 -64
- package/dist/lib/triggers/card-events.js +0 -72
package/package.json
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azysinovacao/piece-kanbn",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"files": ["dist"],
|
|
8
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
9
6
|
"scripts": {
|
|
10
|
-
"build": "tsc"
|
|
7
|
+
"build": "tsc -p tsconfig.json --emitDeclarationOnly"
|
|
11
8
|
},
|
|
12
9
|
"dependencies": {
|
|
13
10
|
"@activepieces/pieces-common": "0.11.7",
|
|
14
11
|
"@activepieces/pieces-framework": "0.25.5",
|
|
15
12
|
"@activepieces/shared": "0.38.4",
|
|
16
|
-
"@azysinovacao/kanbn-client": "^0.1.0",
|
|
17
13
|
"tslib": "2.6.2"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"typescript": "^5.5.0"
|
|
21
14
|
}
|
|
22
15
|
}
|
package/{dist → src}/index.d.ts
RENAMED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const kanbnAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
2
2
|
export declare const kanbn: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,mEAKpB,CAAC;AAEH,eAAO,MAAM,KAAK,mHAqBhB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/@azysinovacao/kanbn-client/index.cjs
|
|
34
|
+
var require_kanbn_client = __commonJS({
|
|
35
|
+
"node_modules/@azysinovacao/kanbn-client/index.cjs"(exports2, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
function clean(obj) {
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const [k, v] of Object.entries(obj)) if (v !== void 0) out[k] = v;
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
function toBytes(data, base64) {
|
|
43
|
+
if (base64) return Buffer.from(base64, "base64");
|
|
44
|
+
if (Buffer.isBuffer(data)) return data;
|
|
45
|
+
if (data instanceof Uint8Array) return Buffer.from(data);
|
|
46
|
+
if (data instanceof ArrayBuffer) return Buffer.from(new Uint8Array(data));
|
|
47
|
+
if (typeof data === "string") return Buffer.from(data, "utf8");
|
|
48
|
+
throw new Error("kanbn attach: forneca data (Buffer/Uint8Array/string) ou base64.");
|
|
49
|
+
}
|
|
50
|
+
function createKanbn2(token, options = {}) {
|
|
51
|
+
if (!token) throw new Error("kanbn: token obrigatorio (ex.: inputs.token).");
|
|
52
|
+
const base = (options.base || "https://kan.bn/api/v1").replace(/\/+$/, "");
|
|
53
|
+
const retries = options.retries == null ? 3 : options.retries;
|
|
54
|
+
async function req(method, path, { json, params } = {}) {
|
|
55
|
+
let url = base + path;
|
|
56
|
+
if (params) {
|
|
57
|
+
const sp = new URLSearchParams();
|
|
58
|
+
for (const [k, v] of Object.entries(params)) {
|
|
59
|
+
if (v !== void 0 && v !== null) sp.append(k, String(v));
|
|
60
|
+
}
|
|
61
|
+
const s = sp.toString();
|
|
62
|
+
if (s) url += "?" + s;
|
|
63
|
+
}
|
|
64
|
+
const hasBody = method === "POST" || method === "PUT";
|
|
65
|
+
const headers = { Authorization: `Bearer ${token}`, "Content-Type": "application/json" };
|
|
66
|
+
const body = hasBody ? JSON.stringify(json == null ? {} : json) : void 0;
|
|
67
|
+
let last;
|
|
68
|
+
for (let attempt = 0; attempt < retries; attempt++) {
|
|
69
|
+
const r = await fetch(url, { method, headers, body });
|
|
70
|
+
const text = await r.text();
|
|
71
|
+
if (r.status === 500 && /deadlock/i.test(text)) {
|
|
72
|
+
last = text;
|
|
73
|
+
await new Promise((res) => setTimeout(res, 400 * (attempt + 1)));
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (r.status >= 400) throw new Error(`kanbn ${method} ${path} -> HTTP ${r.status}: ${text}`);
|
|
77
|
+
return text ? JSON.parse(text) : { ok: true };
|
|
78
|
+
}
|
|
79
|
+
throw new Error(`kanbn ${method} ${path} -> falhou apos retries (deadlock): ${last}`);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
raw: req,
|
|
83
|
+
// escotilha de fuga: req(method, path, {json, params})
|
|
84
|
+
// ---- identidade / util ----
|
|
85
|
+
whoami: () => req("GET", "/users/me"),
|
|
86
|
+
searchWorkspace: (wsId, query) => req("GET", `/workspaces/${wsId}/search`, { params: { query } }),
|
|
87
|
+
// ---- workspaces ----
|
|
88
|
+
listWorkspaces: () => req("GET", "/workspaces"),
|
|
89
|
+
getWorkspace: (wsId) => req("GET", `/workspaces/${wsId}`),
|
|
90
|
+
createWorkspace: ({ name, description, slug } = {}) => req("POST", "/workspaces", { json: clean({ name, description, slug }) }),
|
|
91
|
+
deleteWorkspace: (wsId) => req("DELETE", `/workspaces/${wsId}`),
|
|
92
|
+
// ---- boards ----
|
|
93
|
+
createBoard: (wsId, { name, lists = [], labels = [], type = "regular", sourceBoardPublicId } = {}) => req("POST", `/workspaces/${wsId}/boards`, { json: clean({ name, lists, labels, type, sourceBoardPublicId }) }),
|
|
94
|
+
listBoards: (wsId, { archived, type } = {}) => req("GET", `/workspaces/${wsId}/boards`, { params: clean({ archived: archived ? "true" : void 0, type }) }),
|
|
95
|
+
getBoard: (boardId2, { isTemplate } = {}) => req("GET", `/boards/${boardId2}`, { params: isTemplate ? { type: "template" } : void 0 }),
|
|
96
|
+
updateBoard: (boardId2, fields = {}) => req("PUT", `/boards/${boardId2}`, { json: clean(fields) }),
|
|
97
|
+
archiveBoard: (boardId2, archived = true) => req("PUT", `/boards/${boardId2}`, { json: { isArchived: archived } }),
|
|
98
|
+
deleteBoard: (boardId2) => req("DELETE", `/boards/${boardId2}`),
|
|
99
|
+
// ---- templates ----
|
|
100
|
+
createTemplate: (wsId, { name, lists = [], labels = [] } = {}) => req("POST", `/workspaces/${wsId}/boards`, { json: { name, lists, labels, type: "template" } }),
|
|
101
|
+
listTemplates: (wsId) => req("GET", `/workspaces/${wsId}/boards`, { params: { type: "template" } }),
|
|
102
|
+
instantiateTemplate: (wsId, { name, sourceTemplatePublicId } = {}) => req("POST", `/workspaces/${wsId}/boards`, {
|
|
103
|
+
json: { name, lists: [], labels: [], type: "regular", sourceBoardPublicId: sourceTemplatePublicId }
|
|
104
|
+
}),
|
|
105
|
+
// ---- lists (colunas) ----
|
|
106
|
+
createList: (boardId2, name) => req("POST", "/lists", { json: { name, boardPublicId: boardId2 } }),
|
|
107
|
+
updateList: (listId2, fields = {}) => req("PUT", `/lists/${listId2}`, { json: clean(fields) }),
|
|
108
|
+
deleteList: (listId2) => req("DELETE", `/lists/${listId2}`),
|
|
109
|
+
// ---- cards ----
|
|
110
|
+
createCard: ({ listPublicId, title, description = "", labelPublicIds = [], memberPublicIds = [], position = "end", dueDate } = {}) => req("POST", "/cards", { json: clean({ listPublicId, title, description, labelPublicIds, memberPublicIds, position, dueDate }) }),
|
|
111
|
+
getCard: (cardId2) => req("GET", `/cards/${cardId2}`),
|
|
112
|
+
updateCard: (cardId2, fields = {}) => req("PUT", `/cards/${cardId2}`, { json: clean(fields) }),
|
|
113
|
+
moveCard: (cardId2, targetListPublicId, index = 0) => req("PUT", `/cards/${cardId2}`, { json: { listPublicId: targetListPublicId, index } }),
|
|
114
|
+
deleteCard: (cardId2) => req("DELETE", `/cards/${cardId2}`),
|
|
115
|
+
duplicateCard: (cardId2, { listPublicId, title, copyLabels = true, copyMembers = false, copyChecklists = true, index } = {}) => req("POST", `/cards/${cardId2}/duplicate`, { json: clean({ listPublicId, title, copyLabels, copyMembers, copyChecklists, index }) }),
|
|
116
|
+
toggleCardLabel: (cardId2, labelId) => req("PUT", `/cards/${cardId2}/labels/${labelId}`),
|
|
117
|
+
toggleCardMember: (cardId2, memberId) => req("PUT", `/cards/${cardId2}/members/${memberId}`),
|
|
118
|
+
addComment: (cardId2, comment) => req("POST", `/cards/${cardId2}/comments`, { json: { comment } }),
|
|
119
|
+
addChecklist: (cardId2, name) => req("POST", `/cards/${cardId2}/checklists`, { json: { name } }),
|
|
120
|
+
addChecklistItem: (checklistId, title) => req("POST", `/checklists/${checklistId}/items`, { json: { title } }),
|
|
121
|
+
getCardActivities: (cardId2, { limit = 50, cursor } = {}) => req("GET", `/cards/${cardId2}/activities`, { params: clean({ limit, cursor }) }),
|
|
122
|
+
// ---- labels ----
|
|
123
|
+
createLabel: (boardId2, { name, colourCode } = {}) => req("POST", "/labels", { json: { name, boardPublicId: boardId2, colourCode } }),
|
|
124
|
+
// ---- anexos (S3 em 1 chamada) ----
|
|
125
|
+
attachFile: async (cardId2, { filename, contentType = "application/octet-stream", data, base64 } = {}) => {
|
|
126
|
+
const bytes = toBytes(data, base64);
|
|
127
|
+
if (bytes.length > 52428800) throw new Error(`kanbn attach: ${bytes.length} bytes excede 50 MB.`);
|
|
128
|
+
const pres = await req("POST", `/cards/${cardId2}/attachments/upload-url`, { json: { filename, contentType, size: bytes.length } });
|
|
129
|
+
const put = await fetch(pres.url, { method: "PUT", headers: { "Content-Type": contentType }, body: bytes });
|
|
130
|
+
if (put.status >= 400) throw new Error(`kanbn attach: PUT S3 HTTP ${put.status}: ${await put.text()}`);
|
|
131
|
+
return req("POST", `/cards/${cardId2}/attachments/confirm`, {
|
|
132
|
+
json: { s3Key: pres.key, filename, originalFilename: filename, contentType, size: bytes.length }
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
deleteAttachment: (attachmentId) => req("DELETE", `/attachments/${attachmentId}`),
|
|
136
|
+
// ---- membros / convites ----
|
|
137
|
+
inviteMember: (wsId, email) => req("POST", `/workspaces/${wsId}/members/invite`, { json: { email } }),
|
|
138
|
+
setMemberRole: (wsId, memberId, role) => req("PUT", `/workspaces/${wsId}/members/${memberId}/role`, { json: { role } }),
|
|
139
|
+
removeMember: (wsId, memberId) => req("DELETE", `/workspaces/${wsId}/members/${memberId}`),
|
|
140
|
+
getWorkspaceInviteLink: (wsId) => req("GET", `/workspaces/${wsId}/invite`),
|
|
141
|
+
// ---- webhooks ----
|
|
142
|
+
createWebhook: (wsId, { name, url, events = ["card.created", "card.updated", "card.moved", "card.deleted"], secret } = {}) => req("POST", `/workspaces/${wsId}/webhooks`, { json: clean({ name, url, events, secret }) }),
|
|
143
|
+
listWebhooks: (wsId) => req("GET", `/workspaces/${wsId}/webhooks`),
|
|
144
|
+
updateWebhook: (wsId, whId, fields = {}) => req("PUT", `/workspaces/${wsId}/webhooks/${whId}`, { json: clean(fields) }),
|
|
145
|
+
testWebhook: (wsId, whId) => req("POST", `/workspaces/${wsId}/webhooks/${whId}/test`),
|
|
146
|
+
deleteWebhook: (wsId, whId) => req("DELETE", `/workspaces/${wsId}/webhooks/${whId}`)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
module2.exports = { createKanbn: createKanbn2 };
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// src/index.ts
|
|
154
|
+
var index_exports = {};
|
|
155
|
+
__export(index_exports, {
|
|
156
|
+
kanbn: () => kanbn,
|
|
157
|
+
kanbnAuth: () => kanbnAuth
|
|
158
|
+
});
|
|
159
|
+
module.exports = __toCommonJS(index_exports);
|
|
160
|
+
var import_pieces_common = require("@activepieces/pieces-common");
|
|
161
|
+
var import_pieces_framework6 = require("@activepieces/pieces-framework");
|
|
162
|
+
var import_shared = require("@activepieces/shared");
|
|
163
|
+
|
|
164
|
+
// src/lib/actions/create-card.ts
|
|
165
|
+
var import_pieces_framework2 = require("@activepieces/pieces-framework");
|
|
166
|
+
|
|
167
|
+
// node_modules/@azysinovacao/kanbn-client/index.mjs
|
|
168
|
+
var import_index = __toESM(require_kanbn_client(), 1);
|
|
169
|
+
var createKanbn = import_index.default.createKanbn;
|
|
170
|
+
|
|
171
|
+
// src/lib/common/client.ts
|
|
172
|
+
var tokenOf = (auth) => typeof auth === "string" ? auth : auth?.value ?? auth?.access_token ?? String(auth ?? "");
|
|
173
|
+
var makeKanbn = (auth) => createKanbn(tokenOf(auth));
|
|
174
|
+
|
|
175
|
+
// src/lib/common/props.ts
|
|
176
|
+
var import_pieces_framework = require("@activepieces/pieces-framework");
|
|
177
|
+
var fail = (e) => ({
|
|
178
|
+
disabled: true,
|
|
179
|
+
options: [],
|
|
180
|
+
placeholder: "Erro: " + String(e?.message ?? e).slice(0, 200)
|
|
181
|
+
});
|
|
182
|
+
var workspaceId = import_pieces_framework.Property.Dropdown({
|
|
183
|
+
displayName: "Workspace",
|
|
184
|
+
description: "Workspace do Kan.bn",
|
|
185
|
+
required: true,
|
|
186
|
+
auth: kanbnAuth,
|
|
187
|
+
refreshers: ["auth"],
|
|
188
|
+
options: async ({ auth }) => {
|
|
189
|
+
if (!auth) return { disabled: true, options: [], placeholder: "Conecte sua conta primeiro" };
|
|
190
|
+
try {
|
|
191
|
+
const kanbn2 = makeKanbn(auth);
|
|
192
|
+
const ws = await kanbn2.listWorkspaces();
|
|
193
|
+
return { options: ws.map((w) => ({ label: w.workspace.name, value: w.workspace.publicId })) };
|
|
194
|
+
} catch (e) {
|
|
195
|
+
return fail(e);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
var boardId = import_pieces_framework.Property.Dropdown({
|
|
200
|
+
displayName: "Board",
|
|
201
|
+
required: true,
|
|
202
|
+
auth: kanbnAuth,
|
|
203
|
+
refreshers: ["auth", "workspaceId"],
|
|
204
|
+
options: async ({ auth, workspaceId: workspaceId2 }) => {
|
|
205
|
+
if (!auth || !workspaceId2)
|
|
206
|
+
return { disabled: true, options: [], placeholder: "Selecione o workspace" };
|
|
207
|
+
try {
|
|
208
|
+
const kanbn2 = makeKanbn(auth);
|
|
209
|
+
const boards = await kanbn2.listBoards(workspaceId2);
|
|
210
|
+
return { options: boards.map((b) => ({ label: b.name, value: b.publicId })) };
|
|
211
|
+
} catch (e) {
|
|
212
|
+
return fail(e);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
var listId = import_pieces_framework.Property.Dropdown({
|
|
217
|
+
displayName: "Coluna (lista)",
|
|
218
|
+
required: true,
|
|
219
|
+
auth: kanbnAuth,
|
|
220
|
+
refreshers: ["auth", "boardId"],
|
|
221
|
+
options: async ({ auth, boardId: boardId2 }) => {
|
|
222
|
+
if (!auth || !boardId2)
|
|
223
|
+
return { disabled: true, options: [], placeholder: "Selecione o board" };
|
|
224
|
+
try {
|
|
225
|
+
const kanbn2 = makeKanbn(auth);
|
|
226
|
+
const board = await kanbn2.getBoard(boardId2);
|
|
227
|
+
return { options: (board.lists || []).map((l) => ({ label: l.name, value: l.publicId })) };
|
|
228
|
+
} catch (e) {
|
|
229
|
+
return fail(e);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
var cardId = import_pieces_framework.Property.Dropdown({
|
|
234
|
+
displayName: "Card",
|
|
235
|
+
required: true,
|
|
236
|
+
auth: kanbnAuth,
|
|
237
|
+
refreshers: ["auth", "boardId"],
|
|
238
|
+
options: async ({ auth, boardId: boardId2 }) => {
|
|
239
|
+
if (!auth || !boardId2)
|
|
240
|
+
return { disabled: true, options: [], placeholder: "Selecione o board" };
|
|
241
|
+
try {
|
|
242
|
+
const kanbn2 = makeKanbn(auth);
|
|
243
|
+
const board = await kanbn2.getBoard(boardId2);
|
|
244
|
+
const cards = (board.lists || []).flatMap(
|
|
245
|
+
(l) => (l.cards || []).map((c) => ({ label: `${l.name}: ${c.title}`, value: c.publicId }))
|
|
246
|
+
);
|
|
247
|
+
return { options: cards };
|
|
248
|
+
} catch (e) {
|
|
249
|
+
return fail(e);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// src/lib/actions/create-card.ts
|
|
255
|
+
var createCard = (0, import_pieces_framework2.createAction)({
|
|
256
|
+
name: "create_card",
|
|
257
|
+
// permanente — não renomear após publicar
|
|
258
|
+
auth: kanbnAuth,
|
|
259
|
+
displayName: "Criar Card",
|
|
260
|
+
description: "Cria um card numa coluna do board.",
|
|
261
|
+
props: {
|
|
262
|
+
workspaceId,
|
|
263
|
+
// dirige os dropdowns encadeados
|
|
264
|
+
boardId,
|
|
265
|
+
listId,
|
|
266
|
+
title: import_pieces_framework2.Property.ShortText({ displayName: "T\xEDtulo", required: true }),
|
|
267
|
+
description: import_pieces_framework2.Property.LongText({ displayName: "Descri\xE7\xE3o", required: false }),
|
|
268
|
+
dueDate: import_pieces_framework2.Property.DateTime({ displayName: "Data de vencimento", required: false })
|
|
269
|
+
},
|
|
270
|
+
async run(context) {
|
|
271
|
+
const kanbn2 = makeKanbn(context.auth);
|
|
272
|
+
const { listId: listId2, title, description, dueDate } = context.propsValue;
|
|
273
|
+
return await kanbn2.createCard({
|
|
274
|
+
listPublicId: listId2,
|
|
275
|
+
title,
|
|
276
|
+
description: description ?? "",
|
|
277
|
+
dueDate: dueDate ?? null
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// src/lib/actions/move-card.ts
|
|
283
|
+
var import_pieces_framework3 = require("@activepieces/pieces-framework");
|
|
284
|
+
var moveCard = (0, import_pieces_framework3.createAction)({
|
|
285
|
+
name: "move_card",
|
|
286
|
+
// permanente
|
|
287
|
+
auth: kanbnAuth,
|
|
288
|
+
displayName: "Mover Card",
|
|
289
|
+
description: "Move um card para outra coluna (dispara o webhook card.moved).",
|
|
290
|
+
props: {
|
|
291
|
+
workspaceId,
|
|
292
|
+
boardId,
|
|
293
|
+
cardId,
|
|
294
|
+
listId
|
|
295
|
+
// coluna de destino
|
|
296
|
+
},
|
|
297
|
+
async run(context) {
|
|
298
|
+
const kanbn2 = makeKanbn(context.auth);
|
|
299
|
+
const { cardId: cardId2, listId: listId2 } = context.propsValue;
|
|
300
|
+
return await kanbn2.moveCard(cardId2, listId2);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// src/lib/actions/create-board.ts
|
|
305
|
+
var import_pieces_framework4 = require("@activepieces/pieces-framework");
|
|
306
|
+
var createBoard = (0, import_pieces_framework4.createAction)({
|
|
307
|
+
name: "create_board",
|
|
308
|
+
// permanente
|
|
309
|
+
auth: kanbnAuth,
|
|
310
|
+
displayName: "Criar Board",
|
|
311
|
+
description: "Cria um board no workspace, com colunas e labels iniciais.",
|
|
312
|
+
props: {
|
|
313
|
+
workspaceId,
|
|
314
|
+
name: import_pieces_framework4.Property.ShortText({ displayName: "Nome do board", required: true }),
|
|
315
|
+
lists: import_pieces_framework4.Property.Array({
|
|
316
|
+
displayName: "Colunas",
|
|
317
|
+
description: "Nomes das colunas iniciais (ex.: A Fazer, Fazendo, Feito).",
|
|
318
|
+
required: false
|
|
319
|
+
}),
|
|
320
|
+
labels: import_pieces_framework4.Property.Array({
|
|
321
|
+
displayName: "Labels",
|
|
322
|
+
description: "Nomes das labels iniciais (ex.: Urgente).",
|
|
323
|
+
required: false
|
|
324
|
+
})
|
|
325
|
+
},
|
|
326
|
+
async run(context) {
|
|
327
|
+
const kanbn2 = makeKanbn(context.auth);
|
|
328
|
+
const { workspaceId: workspaceId2, name, lists, labels } = context.propsValue;
|
|
329
|
+
return await kanbn2.createBoard(workspaceId2, {
|
|
330
|
+
name,
|
|
331
|
+
lists: lists ?? [],
|
|
332
|
+
labels: labels ?? []
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
// src/lib/triggers/card-events.ts
|
|
338
|
+
var import_pieces_framework5 = require("@activepieces/pieces-framework");
|
|
339
|
+
var cardEvents = (0, import_pieces_framework5.createTrigger)({
|
|
340
|
+
auth: kanbnAuth,
|
|
341
|
+
name: "card_events",
|
|
342
|
+
// permanente
|
|
343
|
+
displayName: "Evento de Card",
|
|
344
|
+
description: "Dispara quando um card \xE9 criado, atualizado, movido ou deletado.",
|
|
345
|
+
type: import_pieces_framework5.TriggerStrategy.WEBHOOK,
|
|
346
|
+
props: {
|
|
347
|
+
workspaceId,
|
|
348
|
+
events: import_pieces_framework5.Property.StaticMultiSelectDropdown({
|
|
349
|
+
displayName: "Eventos",
|
|
350
|
+
required: true,
|
|
351
|
+
defaultValue: ["card.created", "card.updated", "card.moved", "card.deleted"],
|
|
352
|
+
options: {
|
|
353
|
+
options: [
|
|
354
|
+
{ label: "Card criado", value: "card.created" },
|
|
355
|
+
{ label: "Card atualizado", value: "card.updated" },
|
|
356
|
+
{ label: "Card movido", value: "card.moved" },
|
|
357
|
+
{ label: "Card deletado", value: "card.deleted" }
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
})
|
|
361
|
+
},
|
|
362
|
+
sampleData: {
|
|
363
|
+
event: "card.moved",
|
|
364
|
+
timestamp: "2026-06-06T17:04:48.933Z",
|
|
365
|
+
data: {
|
|
366
|
+
card: {
|
|
367
|
+
id: "204957",
|
|
368
|
+
publicId: "8dc6mnkc7c7b",
|
|
369
|
+
title: "Card Webhook",
|
|
370
|
+
description: "teste de evento",
|
|
371
|
+
dueDate: null,
|
|
372
|
+
listId: "e8zx58da8hqy",
|
|
373
|
+
boardId: "e9thky5yuk4s"
|
|
374
|
+
},
|
|
375
|
+
board: { id: "e9thky5yuk4s", name: "Processo Comercial" },
|
|
376
|
+
list: { id: "e8zx58da8hqy", name: "Fazendo" },
|
|
377
|
+
user: { id: "994bd877-...", name: "Ips" },
|
|
378
|
+
changes: { listId: { from: "u78jjteil0s3", to: "e8zx58da8hqy" } }
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
async onEnable(context) {
|
|
382
|
+
const kanbn2 = makeKanbn(context.auth);
|
|
383
|
+
const wh = await kanbn2.createWebhook(context.propsValue.workspaceId, {
|
|
384
|
+
name: "Activepieces",
|
|
385
|
+
url: context.webhookUrl,
|
|
386
|
+
events: context.propsValue.events
|
|
387
|
+
});
|
|
388
|
+
await context.store.put("kanbn_webhook_id", wh.publicId);
|
|
389
|
+
},
|
|
390
|
+
async onDisable(context) {
|
|
391
|
+
const id = await context.store.get("kanbn_webhook_id");
|
|
392
|
+
if (id) {
|
|
393
|
+
const kanbn2 = makeKanbn(context.auth);
|
|
394
|
+
await kanbn2.deleteWebhook(context.propsValue.workspaceId, id);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
async run(context) {
|
|
398
|
+
return [context.payload.body];
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// src/index.ts
|
|
403
|
+
var kanbnAuth = import_pieces_framework6.PieceAuth.SecretText({
|
|
404
|
+
displayName: "API Key",
|
|
405
|
+
required: true,
|
|
406
|
+
description: "Chave da API do Kan.bn (gere em https://kan.bn/settings). Use a chave do usu\xE1rio de automa\xE7\xE3o para rastreabilidade."
|
|
407
|
+
});
|
|
408
|
+
var kanbn = (0, import_pieces_framework6.createPiece)({
|
|
409
|
+
displayName: "Kan.bn",
|
|
410
|
+
description: "Quadros Kanban open source (alternativa ao Trello): boards, listas, cards, labels, anexos e webhooks.",
|
|
411
|
+
logoUrl: "https://kan.bn/logo.png",
|
|
412
|
+
// TODO: confirmar URL pública do logo
|
|
413
|
+
minimumSupportedRelease: "0.36.1",
|
|
414
|
+
categories: [import_shared.PieceCategory.PRODUCTIVITY],
|
|
415
|
+
authors: ["azysinovacao"],
|
|
416
|
+
auth: kanbnAuth,
|
|
417
|
+
actions: [
|
|
418
|
+
createCard,
|
|
419
|
+
moveCard,
|
|
420
|
+
createBoard,
|
|
421
|
+
// Fallback HTTP genérico p/ qualquer endpoint não coberto pelas actions:
|
|
422
|
+
(0, import_pieces_common.createCustomApiCallAction)({
|
|
423
|
+
baseUrl: () => "https://kan.bn/api/v1",
|
|
424
|
+
auth: kanbnAuth,
|
|
425
|
+
authMapping: async (auth) => ({ Authorization: `Bearer ${auth}` })
|
|
426
|
+
})
|
|
427
|
+
],
|
|
428
|
+
triggers: [cardEvents]
|
|
429
|
+
});
|
|
430
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
431
|
+
0 && (module.exports = {
|
|
432
|
+
kanbn,
|
|
433
|
+
kanbnAuth
|
|
434
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const createBoard: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
2
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
3
|
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
4
|
lists: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
5
5
|
labels: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
6
6
|
}>;
|
|
7
|
+
//# sourceMappingURL=create-board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-board.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-board.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;EA4BtB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const createCard: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
3
|
-
boardId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
4
|
-
listId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
2
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
boardId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
5
5
|
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
6
|
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
7
7
|
dueDate: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
8
8
|
}>;
|
|
9
|
+
//# sourceMappingURL=create-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-card.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-card.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;;;;;;EAuBrB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const moveCard: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
3
|
-
boardId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
4
|
-
cardId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
5
|
-
listId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
2
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
boardId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
cardId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
5
|
+
listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
6
6
|
}>;
|
|
7
|
+
//# sourceMappingURL=move-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move-card.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/move-card.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;EAgBnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,SAAU,OAAO,KAAG,MAGyC,CAAC;AAGlF,eAAO,MAAM,SAAS,SAAU,OAAO,QAA+B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
2
|
+
export declare const boardId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
export declare const listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
export declare const cardId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
5
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,WAAW,4IAgBtB,CAAC;AAEH,eAAO,MAAM,OAAO,4IAgBlB,CAAC;AAEH,eAAO,MAAM,MAAM,4IAgBjB,CAAC;AAEH,eAAO,MAAM,MAAM,4IAmBjB,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
2
|
export declare const cardEvents: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
3
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
4
|
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
5
5
|
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
6
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
6
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
7
7
|
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
8
8
|
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
9
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
10
10
|
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
11
11
|
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
12
|
-
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<
|
|
12
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
13
13
|
events: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true>;
|
|
14
14
|
}>;
|
|
15
|
+
//# sourceMappingURL=card-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-events.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/card-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAQ1F,eAAO,MAAM,UAAU;;;;;;;;;;;;EA6DrB,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.kanbn = exports.kanbnAuth = void 0;
|
|
4
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const shared_1 = require("@activepieces/shared");
|
|
7
|
-
const create_card_1 = require("./lib/actions/create-card");
|
|
8
|
-
const move_card_1 = require("./lib/actions/move-card");
|
|
9
|
-
const create_board_1 = require("./lib/actions/create-board");
|
|
10
|
-
const card_events_1 = require("./lib/triggers/card-events");
|
|
11
|
-
// Auth: API key do Kan.bn (SecretText) -> context.auth é string.
|
|
12
|
-
// Exportada para actions/triggers importarem via `import { kanbnAuth } from '../../'`.
|
|
13
|
-
exports.kanbnAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
14
|
-
displayName: 'API Key',
|
|
15
|
-
required: true,
|
|
16
|
-
description: 'Chave da API do Kan.bn (gere em https://kan.bn/settings). Use a chave do usuário de automação para rastreabilidade.',
|
|
17
|
-
});
|
|
18
|
-
exports.kanbn = (0, pieces_framework_1.createPiece)({
|
|
19
|
-
displayName: 'Kan.bn',
|
|
20
|
-
description: 'Quadros Kanban open source (alternativa ao Trello): boards, listas, cards, labels, anexos e webhooks.',
|
|
21
|
-
logoUrl: 'https://kan.bn/logo.png', // TODO: confirmar URL pública do logo
|
|
22
|
-
minimumSupportedRelease: '0.36.1',
|
|
23
|
-
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
24
|
-
authors: ['azysinovacao'],
|
|
25
|
-
auth: exports.kanbnAuth,
|
|
26
|
-
actions: [
|
|
27
|
-
create_card_1.createCard,
|
|
28
|
-
move_card_1.moveCard,
|
|
29
|
-
create_board_1.createBoard,
|
|
30
|
-
// Fallback HTTP genérico p/ qualquer endpoint não coberto pelas actions:
|
|
31
|
-
(0, pieces_common_1.createCustomApiCallAction)({
|
|
32
|
-
baseUrl: () => 'https://kan.bn/api/v1',
|
|
33
|
-
auth: exports.kanbnAuth,
|
|
34
|
-
authMapping: async (auth) => ({ Authorization: `Bearer ${auth}` }),
|
|
35
|
-
}),
|
|
36
|
-
],
|
|
37
|
-
triggers: [card_events_1.cardEvents],
|
|
38
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBoard = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const __1 = require("../../");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const props_1 = require("../common/props");
|
|
8
|
-
exports.createBoard = (0, pieces_framework_1.createAction)({
|
|
9
|
-
name: 'create_board', // permanente
|
|
10
|
-
auth: __1.kanbnAuth,
|
|
11
|
-
displayName: 'Criar Board',
|
|
12
|
-
description: 'Cria um board no workspace, com colunas e labels iniciais.',
|
|
13
|
-
props: {
|
|
14
|
-
workspaceId: props_1.workspaceId,
|
|
15
|
-
name: pieces_framework_1.Property.ShortText({ displayName: 'Nome do board', required: true }),
|
|
16
|
-
lists: pieces_framework_1.Property.Array({
|
|
17
|
-
displayName: 'Colunas',
|
|
18
|
-
description: 'Nomes das colunas iniciais (ex.: A Fazer, Fazendo, Feito).',
|
|
19
|
-
required: false,
|
|
20
|
-
}),
|
|
21
|
-
labels: pieces_framework_1.Property.Array({
|
|
22
|
-
displayName: 'Labels',
|
|
23
|
-
description: 'Nomes das labels iniciais (ex.: Urgente).',
|
|
24
|
-
required: false,
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
async run(context) {
|
|
28
|
-
const kanbn = (0, client_1.makeKanbn)(context.auth);
|
|
29
|
-
const { workspaceId, name, lists, labels } = context.propsValue;
|
|
30
|
-
return await kanbn.createBoard(workspaceId, {
|
|
31
|
-
name,
|
|
32
|
-
lists: lists ?? [],
|
|
33
|
-
labels: labels ?? [],
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCard = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const __1 = require("../../");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const props_1 = require("../common/props");
|
|
8
|
-
exports.createCard = (0, pieces_framework_1.createAction)({
|
|
9
|
-
name: 'create_card', // permanente — não renomear após publicar
|
|
10
|
-
auth: __1.kanbnAuth,
|
|
11
|
-
displayName: 'Criar Card',
|
|
12
|
-
description: 'Cria um card numa coluna do board.',
|
|
13
|
-
props: {
|
|
14
|
-
workspaceId: props_1.workspaceId, // dirige os dropdowns encadeados
|
|
15
|
-
boardId: // dirige os dropdowns encadeados
|
|
16
|
-
props_1.boardId,
|
|
17
|
-
listId: props_1.listId,
|
|
18
|
-
title: pieces_framework_1.Property.ShortText({ displayName: 'Título', required: true }),
|
|
19
|
-
description: pieces_framework_1.Property.LongText({ displayName: 'Descrição', required: false }),
|
|
20
|
-
dueDate: pieces_framework_1.Property.DateTime({ displayName: 'Data de vencimento', required: false }),
|
|
21
|
-
},
|
|
22
|
-
async run(context) {
|
|
23
|
-
const kanbn = (0, client_1.makeKanbn)(context.auth);
|
|
24
|
-
const { listId, title, description, dueDate } = context.propsValue;
|
|
25
|
-
return await kanbn.createCard({
|
|
26
|
-
listPublicId: listId,
|
|
27
|
-
title,
|
|
28
|
-
description: description ?? '',
|
|
29
|
-
dueDate: dueDate ?? null,
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.moveCard = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const __1 = require("../../");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const props_1 = require("../common/props");
|
|
8
|
-
exports.moveCard = (0, pieces_framework_1.createAction)({
|
|
9
|
-
name: 'move_card', // permanente
|
|
10
|
-
auth: __1.kanbnAuth,
|
|
11
|
-
displayName: 'Mover Card',
|
|
12
|
-
description: 'Move um card para outra coluna (dispara o webhook card.moved).',
|
|
13
|
-
props: {
|
|
14
|
-
workspaceId: props_1.workspaceId,
|
|
15
|
-
boardId: props_1.boardId,
|
|
16
|
-
cardId: props_1.cardId,
|
|
17
|
-
listId: props_1.listId, // coluna de destino
|
|
18
|
-
},
|
|
19
|
-
async run(context) {
|
|
20
|
-
const kanbn = (0, client_1.makeKanbn)(context.auth);
|
|
21
|
-
const { cardId, listId } = context.propsValue;
|
|
22
|
-
return await kanbn.moveCard(cardId, listId);
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const makeKanbn: (auth: string) => any;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeKanbn = void 0;
|
|
4
|
-
const kanbn_client_1 = require("@azysinovacao/kanbn-client");
|
|
5
|
-
// Ponte: a Piece NÃO reimplementa a API — só instancia a lib compartilhada.
|
|
6
|
-
// `auth` é o SecretText (string) = chave do usuário de automação (Ips).
|
|
7
|
-
const makeKanbn = (auth) => (0, kanbn_client_1.createKanbn)(auth);
|
|
8
|
-
exports.makeKanbn = makeKanbn;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
2
|
-
export declare const boardId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
-
export declare const listId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
-
export declare const cardId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/dist/lib/common/props.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cardId = exports.listId = exports.boardId = exports.workspaceId = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const __1 = require("../../");
|
|
6
|
-
const client_1 = require("./client");
|
|
7
|
-
// Dropdowns dinâmicos encadeados — UX correta (o usuário escolhe por NOME, nunca digita ID).
|
|
8
|
-
// Cada um usa a lib compartilhada para buscar as opções.
|
|
9
|
-
exports.workspaceId = pieces_framework_1.Property.Dropdown({
|
|
10
|
-
displayName: 'Workspace',
|
|
11
|
-
description: 'Workspace do Kan.bn',
|
|
12
|
-
required: true,
|
|
13
|
-
auth: __1.kanbnAuth, // se o TS reclamar deste campo, remova-o (refreshers:['auth'] basta)
|
|
14
|
-
refreshers: ['auth'],
|
|
15
|
-
options: async ({ auth }) => {
|
|
16
|
-
if (!auth)
|
|
17
|
-
return { disabled: true, options: [], placeholder: 'Conecte sua conta primeiro' };
|
|
18
|
-
const kanbn = (0, client_1.makeKanbn)(auth);
|
|
19
|
-
const ws = await kanbn.listWorkspaces();
|
|
20
|
-
return {
|
|
21
|
-
options: ws.map((w) => ({ label: w.workspace.name, value: w.workspace.publicId })),
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
exports.boardId = pieces_framework_1.Property.Dropdown({
|
|
26
|
-
displayName: 'Board',
|
|
27
|
-
required: true,
|
|
28
|
-
auth: __1.kanbnAuth,
|
|
29
|
-
refreshers: ['auth', 'workspaceId'],
|
|
30
|
-
options: async ({ auth, workspaceId }) => {
|
|
31
|
-
if (!auth || !workspaceId)
|
|
32
|
-
return { disabled: true, options: [], placeholder: 'Selecione o workspace' };
|
|
33
|
-
const kanbn = (0, client_1.makeKanbn)(auth);
|
|
34
|
-
const boards = await kanbn.listBoards(workspaceId);
|
|
35
|
-
return { options: boards.map((b) => ({ label: b.name, value: b.publicId })) };
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
exports.listId = pieces_framework_1.Property.Dropdown({
|
|
39
|
-
displayName: 'Coluna (lista)',
|
|
40
|
-
required: true,
|
|
41
|
-
auth: __1.kanbnAuth,
|
|
42
|
-
refreshers: ['auth', 'boardId'],
|
|
43
|
-
options: async ({ auth, boardId }) => {
|
|
44
|
-
if (!auth || !boardId)
|
|
45
|
-
return { disabled: true, options: [], placeholder: 'Selecione o board' };
|
|
46
|
-
const kanbn = (0, client_1.makeKanbn)(auth);
|
|
47
|
-
const board = await kanbn.getBoard(boardId);
|
|
48
|
-
return { options: (board.lists || []).map((l) => ({ label: l.name, value: l.publicId })) };
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
exports.cardId = pieces_framework_1.Property.Dropdown({
|
|
52
|
-
displayName: 'Card',
|
|
53
|
-
required: true,
|
|
54
|
-
auth: __1.kanbnAuth,
|
|
55
|
-
refreshers: ['auth', 'boardId'],
|
|
56
|
-
options: async ({ auth, boardId }) => {
|
|
57
|
-
if (!auth || !boardId)
|
|
58
|
-
return { disabled: true, options: [], placeholder: 'Selecione o board' };
|
|
59
|
-
const kanbn = (0, client_1.makeKanbn)(auth);
|
|
60
|
-
const board = await kanbn.getBoard(boardId);
|
|
61
|
-
const cards = (board.lists || []).flatMap((l) => (l.cards || []).map((c) => ({ label: `${l.name}: ${c.title}`, value: c.publicId })));
|
|
62
|
-
return { options: cards };
|
|
63
|
-
},
|
|
64
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cardEvents = void 0;
|
|
4
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
-
const __1 = require("../../");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const props_1 = require("../common/props");
|
|
8
|
-
// Trigger WEBHOOK (a API do Kan.bn suporta webhooks nativos de card).
|
|
9
|
-
// onEnable registra o webhook via lib apontando para context.webhookUrl;
|
|
10
|
-
// onDisable remove. O payload real foi capturado em teste (sampleData abaixo).
|
|
11
|
-
exports.cardEvents = (0, pieces_framework_1.createTrigger)({
|
|
12
|
-
auth: __1.kanbnAuth,
|
|
13
|
-
name: 'card_events', // permanente
|
|
14
|
-
displayName: 'Evento de Card',
|
|
15
|
-
description: 'Dispara quando um card é criado, atualizado, movido ou deletado.',
|
|
16
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
17
|
-
props: {
|
|
18
|
-
workspaceId: props_1.workspaceId,
|
|
19
|
-
events: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
20
|
-
displayName: 'Eventos',
|
|
21
|
-
required: true,
|
|
22
|
-
defaultValue: ['card.created', 'card.updated', 'card.moved', 'card.deleted'],
|
|
23
|
-
options: {
|
|
24
|
-
options: [
|
|
25
|
-
{ label: 'Card criado', value: 'card.created' },
|
|
26
|
-
{ label: 'Card atualizado', value: 'card.updated' },
|
|
27
|
-
{ label: 'Card movido', value: 'card.moved' },
|
|
28
|
-
{ label: 'Card deletado', value: 'card.deleted' },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
sampleData: {
|
|
34
|
-
event: 'card.moved',
|
|
35
|
-
timestamp: '2026-06-06T17:04:48.933Z',
|
|
36
|
-
data: {
|
|
37
|
-
card: {
|
|
38
|
-
id: '204957',
|
|
39
|
-
publicId: '8dc6mnkc7c7b',
|
|
40
|
-
title: 'Card Webhook',
|
|
41
|
-
description: 'teste de evento',
|
|
42
|
-
dueDate: null,
|
|
43
|
-
listId: 'e8zx58da8hqy',
|
|
44
|
-
boardId: 'e9thky5yuk4s',
|
|
45
|
-
},
|
|
46
|
-
board: { id: 'e9thky5yuk4s', name: 'Processo Comercial' },
|
|
47
|
-
list: { id: 'e8zx58da8hqy', name: 'Fazendo' },
|
|
48
|
-
user: { id: '994bd877-...', name: 'Ips' },
|
|
49
|
-
changes: { listId: { from: 'u78jjteil0s3', to: 'e8zx58da8hqy' } },
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
async onEnable(context) {
|
|
53
|
-
const kanbn = (0, client_1.makeKanbn)(context.auth);
|
|
54
|
-
const wh = await kanbn.createWebhook(context.propsValue.workspaceId, {
|
|
55
|
-
name: 'Activepieces',
|
|
56
|
-
url: context.webhookUrl,
|
|
57
|
-
events: context.propsValue.events,
|
|
58
|
-
});
|
|
59
|
-
await context.store.put('kanbn_webhook_id', wh.publicId);
|
|
60
|
-
},
|
|
61
|
-
async onDisable(context) {
|
|
62
|
-
const id = await context.store.get('kanbn_webhook_id');
|
|
63
|
-
if (id) {
|
|
64
|
-
const kanbn = (0, client_1.makeKanbn)(context.auth);
|
|
65
|
-
await kanbn.deleteWebhook(context.propsValue.workspaceId, id);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
async run(context) {
|
|
69
|
-
// O Kan.bn entrega 1 evento por requisição.
|
|
70
|
-
return [context.payload.body];
|
|
71
|
-
},
|
|
72
|
-
});
|