@gewis/planka-client 2.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/LICENSE.txt +674 -0
- package/README.md +65 -0
- package/dist/planka-client.d.ts +1406 -0
- package/dist/planka-client.js +470 -0
- package/dist/planka-client.umd.cjs +1 -0
- package/package.json +69 -0
- package/src/index.ts +2 -0
- package/src/services.ts +951 -0
- package/src/types.ts +1042 -0
@@ -0,0 +1,470 @@
|
|
1
|
+
var z = Object.defineProperty;
|
2
|
+
var P = (e, a, r) => a in e ? z(e, a, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[a] = r;
|
3
|
+
var x = (e, a, r) => P(e, typeof a != "symbol" ? a + "" : a, r);
|
4
|
+
var k = async (e, a) => {
|
5
|
+
let r = typeof a == "function" ? await a(e) : a;
|
6
|
+
if (r) return e.scheme === "bearer" ? `Bearer ${r}` : e.scheme === "basic" ? `Basic ${btoa(r)}` : r;
|
7
|
+
}, A = (e, a, r) => {
|
8
|
+
typeof r == "string" || r instanceof Blob ? e.append(a, r) : e.append(a, JSON.stringify(r));
|
9
|
+
}, v = { bodySerializer: (e) => {
|
10
|
+
let a = new FormData();
|
11
|
+
return Object.entries(e).forEach(([r, u]) => {
|
12
|
+
u != null && (Array.isArray(u) ? u.forEach((d) => A(a, r, d)) : A(a, r, u));
|
13
|
+
}), a;
|
14
|
+
} }, E = { bodySerializer: (e) => JSON.stringify(e, (a, r) => typeof r == "bigint" ? r.toString() : r) }, _ = (e) => {
|
15
|
+
switch (e) {
|
16
|
+
case "label":
|
17
|
+
return ".";
|
18
|
+
case "matrix":
|
19
|
+
return ";";
|
20
|
+
case "simple":
|
21
|
+
return ",";
|
22
|
+
default:
|
23
|
+
return "&";
|
24
|
+
}
|
25
|
+
}, B = (e) => {
|
26
|
+
switch (e) {
|
27
|
+
case "form":
|
28
|
+
return ",";
|
29
|
+
case "pipeDelimited":
|
30
|
+
return "|";
|
31
|
+
case "spaceDelimited":
|
32
|
+
return "%20";
|
33
|
+
default:
|
34
|
+
return ",";
|
35
|
+
}
|
36
|
+
}, L = (e) => {
|
37
|
+
switch (e) {
|
38
|
+
case "label":
|
39
|
+
return ".";
|
40
|
+
case "matrix":
|
41
|
+
return ";";
|
42
|
+
case "simple":
|
43
|
+
return ",";
|
44
|
+
default:
|
45
|
+
return "&";
|
46
|
+
}
|
47
|
+
}, $ = ({ allowReserved: e, explode: a, name: r, style: u, value: d }) => {
|
48
|
+
if (!a) {
|
49
|
+
let c = (e ? d : d.map((s) => encodeURIComponent(s))).join(B(u));
|
50
|
+
switch (u) {
|
51
|
+
case "label":
|
52
|
+
return `.${c}`;
|
53
|
+
case "matrix":
|
54
|
+
return `;${r}=${c}`;
|
55
|
+
case "simple":
|
56
|
+
return c;
|
57
|
+
default:
|
58
|
+
return `${r}=${c}`;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
let n = _(u), l = d.map((c) => u === "label" || u === "simple" ? e ? c : encodeURIComponent(c) : w({ allowReserved: e, name: r, value: c })).join(n);
|
62
|
+
return u === "label" || u === "matrix" ? n + l : l;
|
63
|
+
}, w = ({ allowReserved: e, name: a, value: r }) => {
|
64
|
+
if (r == null) return "";
|
65
|
+
if (typeof r == "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
66
|
+
return `${a}=${e ? r : encodeURIComponent(r)}`;
|
67
|
+
}, O = ({ allowReserved: e, explode: a, name: r, style: u, value: d }) => {
|
68
|
+
if (d instanceof Date) return `${r}=${d.toISOString()}`;
|
69
|
+
if (u !== "deepObject" && !a) {
|
70
|
+
let c = [];
|
71
|
+
Object.entries(d).forEach(([i, f]) => {
|
72
|
+
c = [...c, i, e ? f : encodeURIComponent(f)];
|
73
|
+
});
|
74
|
+
let s = c.join(",");
|
75
|
+
switch (u) {
|
76
|
+
case "form":
|
77
|
+
return `${r}=${s}`;
|
78
|
+
case "label":
|
79
|
+
return `.${s}`;
|
80
|
+
case "matrix":
|
81
|
+
return `;${r}=${s}`;
|
82
|
+
default:
|
83
|
+
return s;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
let n = L(u), l = Object.entries(d).map(([c, s]) => w({ allowReserved: e, name: u === "deepObject" ? `${r}[${c}]` : c, value: s })).join(n);
|
87
|
+
return u === "label" || u === "matrix" ? n + l : l;
|
88
|
+
}, N = /\{[^{}]+\}/g, W = ({ path: e, url: a }) => {
|
89
|
+
let r = a, u = a.match(N);
|
90
|
+
if (u) for (let d of u) {
|
91
|
+
let n = !1, l = d.substring(1, d.length - 1), c = "simple";
|
92
|
+
l.endsWith("*") && (n = !0, l = l.substring(0, l.length - 1)), l.startsWith(".") ? (l = l.substring(1), c = "label") : l.startsWith(";") && (l = l.substring(1), c = "matrix");
|
93
|
+
let s = e[l];
|
94
|
+
if (s == null) continue;
|
95
|
+
if (Array.isArray(s)) {
|
96
|
+
r = r.replace(d, $({ explode: n, name: l, style: c, value: s }));
|
97
|
+
continue;
|
98
|
+
}
|
99
|
+
if (typeof s == "object") {
|
100
|
+
r = r.replace(d, O({ explode: n, name: l, style: c, value: s }));
|
101
|
+
continue;
|
102
|
+
}
|
103
|
+
if (c === "matrix") {
|
104
|
+
r = r.replace(d, `;${w({ name: l, value: s })}`);
|
105
|
+
continue;
|
106
|
+
}
|
107
|
+
let i = encodeURIComponent(c === "label" ? `.${s}` : s);
|
108
|
+
r = r.replace(d, i);
|
109
|
+
}
|
110
|
+
return r;
|
111
|
+
}, T = ({ allowReserved: e, array: a, object: r } = {}) => (u) => {
|
112
|
+
let d = [];
|
113
|
+
if (u && typeof u == "object") for (let n in u) {
|
114
|
+
let l = u[n];
|
115
|
+
if (l != null) {
|
116
|
+
if (Array.isArray(l)) {
|
117
|
+
d = [...d, $({ allowReserved: e, explode: !0, name: n, style: "form", value: l, ...a })];
|
118
|
+
continue;
|
119
|
+
}
|
120
|
+
if (typeof l == "object") {
|
121
|
+
d = [...d, O({ allowReserved: e, explode: !0, name: n, style: "deepObject", value: l, ...r })];
|
122
|
+
continue;
|
123
|
+
}
|
124
|
+
d = [...d, w({ allowReserved: e, name: n, value: l })];
|
125
|
+
}
|
126
|
+
}
|
127
|
+
return d.join("&");
|
128
|
+
}, D = (e) => {
|
129
|
+
var r;
|
130
|
+
if (!e) return "stream";
|
131
|
+
let a = (r = e.split(";")[0]) == null ? void 0 : r.trim();
|
132
|
+
if (a) {
|
133
|
+
if (a.startsWith("application/json") || a.endsWith("+json")) return "json";
|
134
|
+
if (a === "multipart/form-data") return "formData";
|
135
|
+
if (["application/", "audio/", "image/", "video/"].some((u) => a.startsWith(u))) return "blob";
|
136
|
+
if (a.startsWith("text/")) return "text";
|
137
|
+
}
|
138
|
+
}, M = async ({ security: e, ...a }) => {
|
139
|
+
for (let r of e) {
|
140
|
+
let u = await k(r, a.auth);
|
141
|
+
if (!u) continue;
|
142
|
+
let d = r.name ?? "Authorization";
|
143
|
+
switch (r.in) {
|
144
|
+
case "query":
|
145
|
+
a.query || (a.query = {}), a.query[d] = u;
|
146
|
+
break;
|
147
|
+
case "header":
|
148
|
+
default:
|
149
|
+
a.headers.set(d, u);
|
150
|
+
break;
|
151
|
+
}
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
}, U = (e) => H({ baseUrl: e.baseUrl, path: e.path, query: e.query, querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : T(e.querySerializer), url: e.url }), H = ({ baseUrl: e, path: a, query: r, querySerializer: u, url: d }) => {
|
155
|
+
let n = d.startsWith("/") ? d : `/${d}`, l = (e ?? "") + n;
|
156
|
+
a && (l = W({ path: a, url: l }));
|
157
|
+
let c = r ? u(r) : "";
|
158
|
+
return c.startsWith("?") && (c = c.substring(1)), c && (l += `?${c}`), l;
|
159
|
+
}, I = (e, a) => {
|
160
|
+
var u;
|
161
|
+
let r = { ...e, ...a };
|
162
|
+
return (u = r.baseUrl) != null && u.endsWith("/") && (r.baseUrl = r.baseUrl.substring(0, r.baseUrl.length - 1)), r.headers = S(e.headers, a.headers), r;
|
163
|
+
}, S = (...e) => {
|
164
|
+
let a = new Headers();
|
165
|
+
for (let r of e) {
|
166
|
+
if (!r || typeof r != "object") continue;
|
167
|
+
let u = r instanceof Headers ? r.entries() : Object.entries(r);
|
168
|
+
for (let [d, n] of u) if (n === null) a.delete(d);
|
169
|
+
else if (Array.isArray(n)) for (let l of n) a.append(d, l);
|
170
|
+
else n !== void 0 && a.set(d, typeof n == "object" ? JSON.stringify(n) : n);
|
171
|
+
}
|
172
|
+
return a;
|
173
|
+
}, C = class {
|
174
|
+
constructor() {
|
175
|
+
x(this, "_fns");
|
176
|
+
this._fns = [];
|
177
|
+
}
|
178
|
+
clear() {
|
179
|
+
this._fns = [];
|
180
|
+
}
|
181
|
+
exists(e) {
|
182
|
+
return this._fns.indexOf(e) !== -1;
|
183
|
+
}
|
184
|
+
eject(e) {
|
185
|
+
let a = this._fns.indexOf(e);
|
186
|
+
a !== -1 && (this._fns = [...this._fns.slice(0, a), ...this._fns.slice(a + 1)]);
|
187
|
+
}
|
188
|
+
use(e) {
|
189
|
+
this._fns = [...this._fns, e];
|
190
|
+
}
|
191
|
+
}, J = () => ({ error: new C(), request: new C(), response: new C() }), V = T({ allowReserved: !1, array: { explode: !0, style: "form" }, object: { explode: !0, style: "deepObject" } }), F = { "Content-Type": "application/json" }, q = (e = {}) => ({ ...E, headers: F, parseAs: "auto", querySerializer: V, ...e }), G = (e = {}) => {
|
192
|
+
let a = I(q(), e), r = () => ({ ...a }), u = (l) => (a = I(a, l), r()), d = J(), n = async (l) => {
|
193
|
+
let c = { ...a, ...l, fetch: l.fetch ?? a.fetch ?? globalThis.fetch, headers: S(a.headers, l.headers) };
|
194
|
+
c.security && await M({ ...c, security: c.security }), c.body && c.bodySerializer && (c.body = c.bodySerializer(c.body)), c.body || c.headers.delete("Content-Type");
|
195
|
+
let s = U(c), i = { redirect: "follow", ...c }, f = new Request(s, i);
|
196
|
+
for (let m of d.request._fns) f = await m(f, c);
|
197
|
+
let R = c.fetch, h = await R(f);
|
198
|
+
for (let m of d.response._fns) h = await m(h, f, c);
|
199
|
+
let y = { request: f, response: h };
|
200
|
+
if (h.ok) {
|
201
|
+
if (h.status === 204 || h.headers.get("Content-Length") === "0") return { data: {}, ...y };
|
202
|
+
let m = (c.parseAs === "auto" ? D(h.headers.get("Content-Type")) : c.parseAs) ?? "json";
|
203
|
+
if (m === "stream") return { data: h.body, ...y };
|
204
|
+
let j = await h[m]();
|
205
|
+
return m === "json" && (c.responseValidator && await c.responseValidator(j), c.responseTransformer && (j = await c.responseTransformer(j))), { data: j, ...y };
|
206
|
+
}
|
207
|
+
let g = await h.text();
|
208
|
+
try {
|
209
|
+
g = JSON.parse(g);
|
210
|
+
} catch {
|
211
|
+
}
|
212
|
+
let b = g;
|
213
|
+
for (let m of d.error._fns) b = await m(g, h, f, c);
|
214
|
+
if (b = b || {}, c.throwOnError) throw b;
|
215
|
+
return { error: b, ...y };
|
216
|
+
};
|
217
|
+
return { buildUrl: U, connect: (l) => n({ ...l, method: "CONNECT" }), delete: (l) => n({ ...l, method: "DELETE" }), get: (l) => n({ ...l, method: "GET" }), getConfig: r, head: (l) => n({ ...l, method: "HEAD" }), interceptors: d, options: (l) => n({ ...l, method: "OPTIONS" }), patch: (l) => n({ ...l, method: "PATCH" }), post: (l) => n({ ...l, method: "POST" }), put: (l) => n({ ...l, method: "PUT" }), request: n, setConfig: u, trace: (l) => n({ ...l, method: "TRACE" }) };
|
218
|
+
};
|
219
|
+
const t = G(q()), K = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
220
|
+
...e,
|
221
|
+
url: "/api/config"
|
222
|
+
}), X = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
223
|
+
...e,
|
224
|
+
url: "/api/access-tokens"
|
225
|
+
}), Y = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
226
|
+
...e,
|
227
|
+
url: "/api/access-tokens/exchange-using-oidc"
|
228
|
+
}), Z = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
229
|
+
...e,
|
230
|
+
url: "/api/access-tokens/me"
|
231
|
+
}), p = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
232
|
+
...e,
|
233
|
+
url: "/api/users"
|
234
|
+
}), o = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
235
|
+
...e,
|
236
|
+
url: "/api/users"
|
237
|
+
}), ee = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
238
|
+
...e,
|
239
|
+
url: "/api/users/{id}"
|
240
|
+
}), re = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
241
|
+
...e,
|
242
|
+
url: "/api/users/{id}"
|
243
|
+
}), ae = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
244
|
+
...e,
|
245
|
+
url: "/api/users/{id}/email"
|
246
|
+
}), te = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
247
|
+
...e,
|
248
|
+
url: "/api/users/{id}/password"
|
249
|
+
}), le = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
250
|
+
...e,
|
251
|
+
url: "/api/users/{id}/username"
|
252
|
+
}), ce = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
253
|
+
...v,
|
254
|
+
...e,
|
255
|
+
headers: {
|
256
|
+
"Content-Type": null
|
257
|
+
},
|
258
|
+
url: "/api/users/{id}/avatar"
|
259
|
+
}), ue = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
260
|
+
...e,
|
261
|
+
url: "/api/users/{id}"
|
262
|
+
}), de = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
263
|
+
...e,
|
264
|
+
url: "/api/projects"
|
265
|
+
}), ne = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
266
|
+
...e,
|
267
|
+
url: "/api/projects"
|
268
|
+
}), se = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
269
|
+
...e,
|
270
|
+
url: "/api/projects/{id}"
|
271
|
+
}), he = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
272
|
+
...e,
|
273
|
+
url: "/api/projects/{id}"
|
274
|
+
}), fe = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
275
|
+
...v,
|
276
|
+
...e,
|
277
|
+
headers: {
|
278
|
+
"Content-Type": null
|
279
|
+
},
|
280
|
+
url: "/api/projects/{id}/background-image"
|
281
|
+
}), me = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
282
|
+
...e,
|
283
|
+
url: "/api/projects/{id}"
|
284
|
+
}), ie = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
285
|
+
...e,
|
286
|
+
url: "/api/projects/{projectId}/managers"
|
287
|
+
}), be = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
288
|
+
...e,
|
289
|
+
url: "/api/project-managers/{id}"
|
290
|
+
}), ye = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
291
|
+
...e,
|
292
|
+
url: "/api/projects/{projectId}/boards"
|
293
|
+
}), ge = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
294
|
+
...e,
|
295
|
+
url: "/api/boards/{id}"
|
296
|
+
}), je = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
297
|
+
...e,
|
298
|
+
url: "/api/boards/{id}"
|
299
|
+
}), we = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
300
|
+
...e,
|
301
|
+
url: "/api/boards/{id}"
|
302
|
+
}), Ce = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
303
|
+
...e,
|
304
|
+
url: "/api/boards/{boardId}/memberships"
|
305
|
+
}), ve = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
306
|
+
...e,
|
307
|
+
url: "/api/board-memberships/{id}"
|
308
|
+
}), xe = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
309
|
+
...e,
|
310
|
+
url: "/api/board-memberships/{id}"
|
311
|
+
}), Ae = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
312
|
+
...e,
|
313
|
+
url: "/api/boards/{boardId}/labels"
|
314
|
+
}), Ue = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
315
|
+
...e,
|
316
|
+
url: "/api/labels/{id}"
|
317
|
+
}), Ie = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
318
|
+
...e,
|
319
|
+
url: "/api/labels/{id}"
|
320
|
+
}), $e = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
321
|
+
...e,
|
322
|
+
url: "/api/boards/{boardId}/lists"
|
323
|
+
}), Oe = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
324
|
+
...e,
|
325
|
+
url: "/api/lists/{id}"
|
326
|
+
}), Te = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
327
|
+
...e,
|
328
|
+
url: "/api/lists/{id}/sort"
|
329
|
+
}), Se = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
330
|
+
...e,
|
331
|
+
url: "/api/lists/{id}"
|
332
|
+
}), qe = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
333
|
+
...e,
|
334
|
+
url: "/api/lists/{listId}/cards"
|
335
|
+
}), Re = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
336
|
+
...e,
|
337
|
+
url: "/api/cards/{id}"
|
338
|
+
}), ze = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
339
|
+
...e,
|
340
|
+
url: "/api/cards/{id}"
|
341
|
+
}), Pe = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
342
|
+
...e,
|
343
|
+
url: "/api/cards/{id}/duplicate"
|
344
|
+
}), ke = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
345
|
+
...e,
|
346
|
+
url: "/api/cards/{id}"
|
347
|
+
}), Ee = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
348
|
+
...e,
|
349
|
+
url: "/api/cards/{cardId}/memberships"
|
350
|
+
}), _e = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
351
|
+
...e,
|
352
|
+
url: "/api/cards/{cardId}/memberships"
|
353
|
+
}), Be = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
354
|
+
...e,
|
355
|
+
url: "/api/cards/{cardId}/labels"
|
356
|
+
}), Le = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
357
|
+
...e,
|
358
|
+
url: "/api/cards/{cardId}/labels/{labelId}"
|
359
|
+
}), Ne = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
360
|
+
...e,
|
361
|
+
url: "/api/cards/{cardId}/tasks"
|
362
|
+
}), We = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
363
|
+
...e,
|
364
|
+
url: "/api/tasks/{id}"
|
365
|
+
}), De = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
366
|
+
...e,
|
367
|
+
url: "/api/tasks/{id}"
|
368
|
+
}), Me = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
369
|
+
...v,
|
370
|
+
...e,
|
371
|
+
headers: {
|
372
|
+
"Content-Type": null
|
373
|
+
},
|
374
|
+
url: "/api/cards/{cardId}/attachments"
|
375
|
+
}), He = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
376
|
+
...e,
|
377
|
+
url: "/api/attachments/{id}"
|
378
|
+
}), Je = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
379
|
+
...e,
|
380
|
+
url: "/api/attachments/{id}"
|
381
|
+
}), Ve = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
382
|
+
...e,
|
383
|
+
url: "/attachments/{id}/download/{filename}"
|
384
|
+
}), Fe = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
385
|
+
...e,
|
386
|
+
url: "/attachments/{id}/download/thumbnails/cover-256.{extension}"
|
387
|
+
}), Ge = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
388
|
+
...e,
|
389
|
+
url: "/api/cards/{cardId}/actions"
|
390
|
+
}), Qe = (e) => ((e == null ? void 0 : e.client) ?? t).post({
|
391
|
+
...e,
|
392
|
+
url: "/api/cards/{cardId}/comment-actions"
|
393
|
+
}), Ke = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
394
|
+
...e,
|
395
|
+
url: "/api/comment-actions/{id}"
|
396
|
+
}), Xe = (e) => ((e == null ? void 0 : e.client) ?? t).delete({
|
397
|
+
...e,
|
398
|
+
url: "/api/comment-actions/{id}"
|
399
|
+
}), Ye = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
400
|
+
...e,
|
401
|
+
url: "/api/notifications"
|
402
|
+
}), Ze = (e) => ((e == null ? void 0 : e.client) ?? t).get({
|
403
|
+
...e,
|
404
|
+
url: "/api/notifications/{id}"
|
405
|
+
}), pe = (e) => ((e == null ? void 0 : e.client) ?? t).patch({
|
406
|
+
...e,
|
407
|
+
url: "/api/notifications/{ids}"
|
408
|
+
});
|
409
|
+
export {
|
410
|
+
X as authorize,
|
411
|
+
Y as authorizeOidc,
|
412
|
+
t as client,
|
413
|
+
Me as createAttachment,
|
414
|
+
ye as createBoard,
|
415
|
+
Ce as createBoardMembership,
|
416
|
+
qe as createCard,
|
417
|
+
Be as createCardLabel,
|
418
|
+
Ee as createCardMembership,
|
419
|
+
Qe as createCommentAction,
|
420
|
+
Ae as createLabel,
|
421
|
+
$e as createList,
|
422
|
+
ne as createProject,
|
423
|
+
ie as createProjectManager,
|
424
|
+
Ne as createTask,
|
425
|
+
o as createUser,
|
426
|
+
Je as deleteAttachment,
|
427
|
+
we as deleteBoard,
|
428
|
+
xe as deleteBoardMembership,
|
429
|
+
ke as deleteCard,
|
430
|
+
Le as deleteCardLabel,
|
431
|
+
_e as deleteCardMembership,
|
432
|
+
Xe as deleteCommentAction,
|
433
|
+
Ie as deleteLabel,
|
434
|
+
Se as deleteList,
|
435
|
+
me as deleteProject,
|
436
|
+
be as deleteProjectManager,
|
437
|
+
De as deleteTask,
|
438
|
+
ue as deleteUser,
|
439
|
+
Pe as duplicateCard,
|
440
|
+
Ve as getAttachment,
|
441
|
+
Fe as getAttachmentThumbnail,
|
442
|
+
ge as getBoard,
|
443
|
+
Re as getCard,
|
444
|
+
Ge as getCardActions,
|
445
|
+
K as getConfig,
|
446
|
+
Ze as getNotification,
|
447
|
+
Ye as getNotifications,
|
448
|
+
se as getProject,
|
449
|
+
de as getProjects,
|
450
|
+
ee as getUser,
|
451
|
+
p as getUsers,
|
452
|
+
Te as sortList,
|
453
|
+
Z as unauthorize,
|
454
|
+
He as updateAttachment,
|
455
|
+
je as updateBoard,
|
456
|
+
ve as updateBoardMembership,
|
457
|
+
ze as updateCard,
|
458
|
+
Ke as updateCommentAction,
|
459
|
+
Ue as updateLabel,
|
460
|
+
Oe as updateList,
|
461
|
+
pe as updateNotifications,
|
462
|
+
he as updateProject,
|
463
|
+
fe as updateProjectBackgroundImage,
|
464
|
+
We as updateTask,
|
465
|
+
re as updateUser,
|
466
|
+
ce as updateUserAvatar,
|
467
|
+
ae as updateUserEmail,
|
468
|
+
te as updateUserPassword,
|
469
|
+
le as updateUserUsername
|
470
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(r,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(r=typeof globalThis<"u"?globalThis:r||self,m(r["planka-client"]={}))})(this,function(r){"use strict";var xe=Object.defineProperty;var pe=(r,m,g)=>m in r?xe(r,m,{enumerable:!0,configurable:!0,writable:!0,value:g}):r[m]=g;var L=(r,m,g)=>pe(r,typeof m!="symbol"?m+"":m,g);var m=async(e,c)=>{let a=typeof c=="function"?await c(e):c;if(a)return e.scheme==="bearer"?`Bearer ${a}`:e.scheme==="basic"?`Basic ${btoa(a)}`:a},g=(e,c,a)=>{typeof a=="string"||a instanceof Blob?e.append(c,a):e.append(c,JSON.stringify(a))},v={bodySerializer:e=>{let c=new FormData;return Object.entries(e).forEach(([a,d])=>{d!=null&&(Array.isArray(d)?d.forEach(n=>g(c,a,n)):g(c,a,d))}),c}},k={bodySerializer:e=>JSON.stringify(e,(c,a)=>typeof a=="bigint"?a.toString():a)},z=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},R=e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},E=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},I=({allowReserved:e,explode:c,name:a,style:d,value:n})=>{if(!c){let u=(e?n:n.map(h=>encodeURIComponent(h))).join(R(d));switch(d){case"label":return`.${u}`;case"matrix":return`;${a}=${u}`;case"simple":return u;default:return`${a}=${u}`}}let i=z(d),l=n.map(u=>d==="label"||d==="simple"?e?u:encodeURIComponent(u):C({allowReserved:e,name:a,value:u})).join(i);return d==="label"||d==="matrix"?i+l:l},C=({allowReserved:e,name:c,value:a})=>{if(a==null)return"";if(typeof a=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${c}=${e?a:encodeURIComponent(a)}`},P=({allowReserved:e,explode:c,name:a,style:d,value:n})=>{if(n instanceof Date)return`${a}=${n.toISOString()}`;if(d!=="deepObject"&&!c){let u=[];Object.entries(n).forEach(([y,s])=>{u=[...u,y,e?s:encodeURIComponent(s)]});let h=u.join(",");switch(d){case"form":return`${a}=${h}`;case"label":return`.${h}`;case"matrix":return`;${a}=${h}`;default:return h}}let i=E(d),l=Object.entries(n).map(([u,h])=>C({allowReserved:e,name:d==="deepObject"?`${a}[${u}]`:u,value:h})).join(i);return d==="label"||d==="matrix"?i+l:l},M=/\{[^{}]+\}/g,N=({path:e,url:c})=>{let a=c,d=c.match(M);if(d)for(let n of d){let i=!1,l=n.substring(1,n.length-1),u="simple";l.endsWith("*")&&(i=!0,l=l.substring(0,l.length-1)),l.startsWith(".")?(l=l.substring(1),u="label"):l.startsWith(";")&&(l=l.substring(1),u="matrix");let h=e[l];if(h==null)continue;if(Array.isArray(h)){a=a.replace(n,I({explode:i,name:l,style:u,value:h}));continue}if(typeof h=="object"){a=a.replace(n,P({explode:i,name:l,style:u,value:h}));continue}if(u==="matrix"){a=a.replace(n,`;${C({name:l,value:h})}`);continue}let y=encodeURIComponent(u==="label"?`.${h}`:h);a=a.replace(n,y)}return a},O=({allowReserved:e,array:c,object:a}={})=>d=>{let n=[];if(d&&typeof d=="object")for(let i in d){let l=d[i];if(l!=null){if(Array.isArray(l)){n=[...n,I({allowReserved:e,explode:!0,name:i,style:"form",value:l,...c})];continue}if(typeof l=="object"){n=[...n,P({allowReserved:e,explode:!0,name:i,style:"deepObject",value:l,...a})];continue}n=[...n,C({allowReserved:e,name:i,value:l})]}}return n.join("&")},_=e=>{var a;if(!e)return"stream";let c=(a=e.split(";")[0])==null?void 0:a.trim();if(c){if(c.startsWith("application/json")||c.endsWith("+json"))return"json";if(c==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(d=>c.startsWith(d)))return"blob";if(c.startsWith("text/"))return"text"}},W=async({security:e,...c})=>{for(let a of e){let d=await m(a,c.auth);if(!d)continue;let n=a.name??"Authorization";switch(a.in){case"query":c.query||(c.query={}),c.query[n]=d;break;case"header":default:c.headers.set(n,d);break}return}},S=e=>D({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:O(e.querySerializer),url:e.url}),D=({baseUrl:e,path:c,query:a,querySerializer:d,url:n})=>{let i=n.startsWith("/")?n:`/${n}`,l=(e??"")+i;c&&(l=N({path:c,url:l}));let u=a?d(a):"";return u.startsWith("?")&&(u=u.substring(1)),u&&(l+=`?${u}`),l},$=(e,c)=>{var d;let a={...e,...c};return(d=a.baseUrl)!=null&&d.endsWith("/")&&(a.baseUrl=a.baseUrl.substring(0,a.baseUrl.length-1)),a.headers=q(e.headers,c.headers),a},q=(...e)=>{let c=new Headers;for(let a of e){if(!a||typeof a!="object")continue;let d=a instanceof Headers?a.entries():Object.entries(a);for(let[n,i]of d)if(i===null)c.delete(n);else if(Array.isArray(i))for(let l of i)c.append(n,l);else i!==void 0&&c.set(n,typeof i=="object"?JSON.stringify(i):i)}return c},T=class{constructor(){L(this,"_fns");this._fns=[]}clear(){this._fns=[]}exists(e){return this._fns.indexOf(e)!==-1}eject(e){let c=this._fns.indexOf(e);c!==-1&&(this._fns=[...this._fns.slice(0,c),...this._fns.slice(c+1)])}use(e){this._fns=[...this._fns,e]}},H=()=>({error:new T,request:new T,response:new T}),J=O({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),V={"Content-Type":"application/json"},B=(e={})=>({...k,headers:V,parseAs:"auto",querySerializer:J,...e}),F=(e={})=>{let c=$(B(),e),a=()=>({...c}),d=l=>(c=$(c,l),a()),n=H(),i=async l=>{let u={...c,...l,fetch:l.fetch??c.fetch??globalThis.fetch,headers:q(c.headers,l.headers)};u.security&&await W({...u,security:u.security}),u.body&&u.bodySerializer&&(u.body=u.bodySerializer(u.body)),u.body||u.headers.delete("Content-Type");let h=S(u),y={redirect:"follow",...u},s=new Request(h,y);for(let b of n.request._fns)s=await b(s,u);let Ze=u.fetch,f=await Ze(s);for(let b of n.response._fns)f=await b(f,s,u);let w={request:s,response:f};if(f.ok){if(f.status===204||f.headers.get("Content-Length")==="0")return{data:{},...w};let b=(u.parseAs==="auto"?_(f.headers.get("Content-Type")):u.parseAs)??"json";if(b==="stream")return{data:f.body,...w};let U=await f[b]();return b==="json"&&(u.responseValidator&&await u.responseValidator(U),u.responseTransformer&&(U=await u.responseTransformer(U))),{data:U,...w}}let A=await f.text();try{A=JSON.parse(A)}catch{}let j=A;for(let b of n.error._fns)j=await b(A,f,s,u);if(j=j||{},u.throwOnError)throw j;return{error:j,...w}};return{buildUrl:S,connect:l=>i({...l,method:"CONNECT"}),delete:l=>i({...l,method:"DELETE"}),get:l=>i({...l,method:"GET"}),getConfig:a,head:l=>i({...l,method:"HEAD"}),interceptors:n,options:l=>i({...l,method:"OPTIONS"}),patch:l=>i({...l,method:"PATCH"}),post:l=>i({...l,method:"POST"}),put:l=>i({...l,method:"PUT"}),request:i,setConfig:d,trace:l=>i({...l,method:"TRACE"})}};const t=F(B()),G=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/config"}),Q=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/access-tokens"}),K=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/access-tokens/exchange-using-oidc"}),X=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/access-tokens/me"}),Y=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/users"}),Z=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/users"}),x=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/users/{id}"}),p=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/users/{id}"}),o=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/users/{id}/email"}),ee=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/users/{id}/password"}),re=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/users/{id}/username"}),ae=e=>((e==null?void 0:e.client)??t).post({...v,...e,headers:{"Content-Type":null},url:"/api/users/{id}/avatar"}),te=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/users/{id}"}),le=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/projects"}),ce=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/projects"}),ue=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/projects/{id}"}),de=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/projects/{id}"}),ne=e=>((e==null?void 0:e.client)??t).post({...v,...e,headers:{"Content-Type":null},url:"/api/projects/{id}/background-image"}),ie=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/projects/{id}"}),he=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/projects/{projectId}/managers"}),me=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/project-managers/{id}"}),fe=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/projects/{projectId}/boards"}),se=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/boards/{id}"}),be=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/boards/{id}"}),ge=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/boards/{id}"}),ye=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/boards/{boardId}/memberships"}),je=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/board-memberships/{id}"}),Ce=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/board-memberships/{id}"}),we=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/boards/{boardId}/labels"}),Ae=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/labels/{id}"}),Ue=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/labels/{id}"}),ve=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/boards/{boardId}/lists"}),Te=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/lists/{id}"}),Ie=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/lists/{id}/sort"}),Pe=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/lists/{id}"}),Oe=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/lists/{listId}/cards"}),Se=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/cards/{id}"}),$e=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/cards/{id}"}),qe=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/cards/{id}/duplicate"}),Be=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/cards/{id}"}),Le=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/cards/{cardId}/memberships"}),ke=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/cards/{cardId}/memberships"}),ze=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/cards/{cardId}/labels"}),Re=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/cards/{cardId}/labels/{labelId}"}),Ee=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/cards/{cardId}/tasks"}),Me=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/tasks/{id}"}),Ne=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/tasks/{id}"}),_e=e=>((e==null?void 0:e.client)??t).post({...v,...e,headers:{"Content-Type":null},url:"/api/cards/{cardId}/attachments"}),We=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/attachments/{id}"}),De=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/attachments/{id}"}),He=e=>((e==null?void 0:e.client)??t).get({...e,url:"/attachments/{id}/download/{filename}"}),Je=e=>((e==null?void 0:e.client)??t).get({...e,url:"/attachments/{id}/download/thumbnails/cover-256.{extension}"}),Ve=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/cards/{cardId}/actions"}),Fe=e=>((e==null?void 0:e.client)??t).post({...e,url:"/api/cards/{cardId}/comment-actions"}),Ge=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/comment-actions/{id}"}),Qe=e=>((e==null?void 0:e.client)??t).delete({...e,url:"/api/comment-actions/{id}"}),Ke=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/notifications"}),Xe=e=>((e==null?void 0:e.client)??t).get({...e,url:"/api/notifications/{id}"}),Ye=e=>((e==null?void 0:e.client)??t).patch({...e,url:"/api/notifications/{ids}"});r.authorize=Q,r.authorizeOidc=K,r.client=t,r.createAttachment=_e,r.createBoard=fe,r.createBoardMembership=ye,r.createCard=Oe,r.createCardLabel=ze,r.createCardMembership=Le,r.createCommentAction=Fe,r.createLabel=we,r.createList=ve,r.createProject=ce,r.createProjectManager=he,r.createTask=Ee,r.createUser=Z,r.deleteAttachment=De,r.deleteBoard=ge,r.deleteBoardMembership=Ce,r.deleteCard=Be,r.deleteCardLabel=Re,r.deleteCardMembership=ke,r.deleteCommentAction=Qe,r.deleteLabel=Ue,r.deleteList=Pe,r.deleteProject=ie,r.deleteProjectManager=me,r.deleteTask=Ne,r.deleteUser=te,r.duplicateCard=qe,r.getAttachment=He,r.getAttachmentThumbnail=Je,r.getBoard=se,r.getCard=Se,r.getCardActions=Ve,r.getConfig=G,r.getNotification=Xe,r.getNotifications=Ke,r.getProject=ue,r.getProjects=le,r.getUser=x,r.getUsers=Y,r.sortList=Ie,r.unauthorize=X,r.updateAttachment=We,r.updateBoard=be,r.updateBoardMembership=je,r.updateCard=$e,r.updateCommentAction=Ge,r.updateLabel=Ae,r.updateList=Te,r.updateNotifications=Ye,r.updateProject=de,r.updateProjectBackgroundImage=ne,r.updateTask=Me,r.updateUser=p,r.updateUserAvatar=ae,r.updateUserEmail=o,r.updateUserPassword=ee,r.updateUserUsername=re,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
{
|
2
|
+
"name": "@gewis/planka-client",
|
3
|
+
"version": "2.0.1",
|
4
|
+
"license": "AGPL-3.0-or-later",
|
5
|
+
"private": false,
|
6
|
+
"scripts": {
|
7
|
+
"build": "tsc --noEmit && vite build",
|
8
|
+
"test": "vitest run",
|
9
|
+
"example": "tsx example/example.ts",
|
10
|
+
"release-major": "release-it --ci major --git.commitMessage=\"chore: release ${version}\" --git.requireBranch=main --no-github.release --no-npm.publish",
|
11
|
+
"release": "release-it --ci minor --git.commitMessage=\"chore: release ${version}\" --git.requireBranch=main --no-github.release --no-npm.publish",
|
12
|
+
"lint": "eslint src --max-warnings=1",
|
13
|
+
"lint-fix": "eslint src --fix",
|
14
|
+
"format": "prettier --check ./src/",
|
15
|
+
"format-fix": "prettier --write ./src/",
|
16
|
+
"prepublishOnly": "yarn install --frozen-lockfile && yarn build"
|
17
|
+
},
|
18
|
+
"main": "dist/planka-client.umd.cjs",
|
19
|
+
"module": "dist/planka-client.js",
|
20
|
+
"types": "dist/planka-client.d.ts",
|
21
|
+
"type": "module",
|
22
|
+
"exports": {
|
23
|
+
".": {
|
24
|
+
"import": "./dist/planka-client.js",
|
25
|
+
"require": "./dist/planka-client.umd.cjs",
|
26
|
+
"types": "./dist/planka-client.d.ts"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"files": [
|
30
|
+
"dist/",
|
31
|
+
"src/",
|
32
|
+
"package.json",
|
33
|
+
"LICENSE.txt",
|
34
|
+
"README.md"
|
35
|
+
],
|
36
|
+
"author": "Gijs de Man",
|
37
|
+
"repository": {
|
38
|
+
"type": "git",
|
39
|
+
"url": "git+https://github.com/GEWIS/planka-client.git"
|
40
|
+
},
|
41
|
+
"bugs": {
|
42
|
+
"url": "https://github.com/GEWIS/planka-client/issues"
|
43
|
+
},
|
44
|
+
"homepage": "https://github.com/GEWIS/planka-client#readme",
|
45
|
+
"devDependencies": {
|
46
|
+
"@gewis/eslint-config-typescript": "^2.2.0",
|
47
|
+
"@gewis/prettier-config": "^2.2.0",
|
48
|
+
"@gewis/release-config": "^2.2.0",
|
49
|
+
"@types/node": "^22.13.1",
|
50
|
+
"eslint": "^9.20.1",
|
51
|
+
"husky": "^9.1.7",
|
52
|
+
"lint-staged": "^15.4.3",
|
53
|
+
"prettier": "^3.5.1",
|
54
|
+
"ts-node": "^10.9.2",
|
55
|
+
"tsx": "^4.19.2",
|
56
|
+
"typescript": "^5.7.2",
|
57
|
+
"typescript-eslint": "^8.24.0",
|
58
|
+
"vite": "^5.4.14",
|
59
|
+
"vite-plugin-dts": "^4.3.0",
|
60
|
+
"vitest": "^2.1.9"
|
61
|
+
},
|
62
|
+
"dependencies": {
|
63
|
+
"@hey-api/client-fetch": "^0.8.1"
|
64
|
+
},
|
65
|
+
"engines": {
|
66
|
+
"node": ">=22.0.0"
|
67
|
+
},
|
68
|
+
"packageManager": "yarn@1.22.22"
|
69
|
+
}
|
package/src/index.ts
ADDED