@dereekb/trello 13.38.0 → 13.40.0
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/nestjs/package.json +10 -10
- package/package.json +11 -12
- package/index.cjs.default.js +0 -1
- package/index.cjs.js +0 -2033
- package/index.cjs.mjs +0 -2
- package/nestjs/index.cjs.default.js +0 -1
- package/nestjs/index.cjs.js +0 -1170
- package/nestjs/index.cjs.mjs +0 -2
package/index.cjs.js
DELETED
|
@@ -1,2033 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fetch = require('@dereekb/util/fetch');
|
|
4
|
-
var makeError = require('make-error');
|
|
5
|
-
var util = require('@dereekb/util');
|
|
6
|
-
|
|
7
|
-
function _assert_this_initialized(self) {
|
|
8
|
-
if (self === void 0) {
|
|
9
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
10
|
-
}
|
|
11
|
-
return self;
|
|
12
|
-
}
|
|
13
|
-
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
|
-
try {
|
|
15
|
-
var info = gen[key](arg);
|
|
16
|
-
var value = info.value;
|
|
17
|
-
} catch (error) {
|
|
18
|
-
reject(error);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (info.done) {
|
|
22
|
-
resolve(value);
|
|
23
|
-
} else {
|
|
24
|
-
Promise.resolve(value).then(_next, _throw);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function _async_to_generator$4(fn) {
|
|
28
|
-
return function() {
|
|
29
|
-
var self = this, args = arguments;
|
|
30
|
-
return new Promise(function(resolve, reject) {
|
|
31
|
-
var gen = fn.apply(self, args);
|
|
32
|
-
function _next(value) {
|
|
33
|
-
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
|
|
34
|
-
}
|
|
35
|
-
function _throw(err) {
|
|
36
|
-
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
|
-
}
|
|
38
|
-
_next(undefined);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function _call_super(_this, derived, args) {
|
|
43
|
-
derived = _get_prototype_of(derived);
|
|
44
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
45
|
-
}
|
|
46
|
-
function _class_call_check(instance, Constructor) {
|
|
47
|
-
if (!(instance instanceof Constructor)) {
|
|
48
|
-
throw new TypeError("Cannot call a class as a function");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function _defineProperties(target, props) {
|
|
52
|
-
for(var i = 0; i < props.length; i++){
|
|
53
|
-
var descriptor = props[i];
|
|
54
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
55
|
-
descriptor.configurable = true;
|
|
56
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
57
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
61
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
62
|
-
return Constructor;
|
|
63
|
-
}
|
|
64
|
-
function _define_property$2(obj, key, value) {
|
|
65
|
-
if (key in obj) {
|
|
66
|
-
Object.defineProperty(obj, key, {
|
|
67
|
-
value: value,
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
obj[key] = value;
|
|
74
|
-
}
|
|
75
|
-
return obj;
|
|
76
|
-
}
|
|
77
|
-
function _get_prototype_of(o) {
|
|
78
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
79
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
80
|
-
};
|
|
81
|
-
return _get_prototype_of(o);
|
|
82
|
-
}
|
|
83
|
-
function _inherits(subClass, superClass) {
|
|
84
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
85
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
86
|
-
}
|
|
87
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
88
|
-
constructor: {
|
|
89
|
-
value: subClass,
|
|
90
|
-
writable: true,
|
|
91
|
-
configurable: true
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
95
|
-
}
|
|
96
|
-
function _instanceof(left, right) {
|
|
97
|
-
"@swc/helpers - instanceof";
|
|
98
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
99
|
-
return !!right[Symbol.hasInstance](left);
|
|
100
|
-
} else {
|
|
101
|
-
return left instanceof right;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function _possible_constructor_return(self, call) {
|
|
105
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
106
|
-
return call;
|
|
107
|
-
}
|
|
108
|
-
return _assert_this_initialized(self);
|
|
109
|
-
}
|
|
110
|
-
function _set_prototype_of(o, p) {
|
|
111
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
112
|
-
o.__proto__ = p;
|
|
113
|
-
return o;
|
|
114
|
-
};
|
|
115
|
-
return _set_prototype_of(o, p);
|
|
116
|
-
}
|
|
117
|
-
function _type_of(obj) {
|
|
118
|
-
"@swc/helpers - typeof";
|
|
119
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
120
|
-
}
|
|
121
|
-
function _is_native_reflect_construct() {
|
|
122
|
-
try {
|
|
123
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
124
|
-
} catch (_) {}
|
|
125
|
-
return (_is_native_reflect_construct = function() {
|
|
126
|
-
return !!result;
|
|
127
|
-
})();
|
|
128
|
-
}
|
|
129
|
-
function _ts_generator$4(thisArg, body) {
|
|
130
|
-
var f, y, t, _ = {
|
|
131
|
-
label: 0,
|
|
132
|
-
sent: function() {
|
|
133
|
-
if (t[0] & 1) throw t[1];
|
|
134
|
-
return t[1];
|
|
135
|
-
},
|
|
136
|
-
trys: [],
|
|
137
|
-
ops: []
|
|
138
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
139
|
-
return d(g, "next", {
|
|
140
|
-
value: verb(0)
|
|
141
|
-
}), d(g, "throw", {
|
|
142
|
-
value: verb(1)
|
|
143
|
-
}), d(g, "return", {
|
|
144
|
-
value: verb(2)
|
|
145
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
146
|
-
value: function() {
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
}), g;
|
|
150
|
-
function verb(n) {
|
|
151
|
-
return function(v) {
|
|
152
|
-
return step([
|
|
153
|
-
n,
|
|
154
|
-
v
|
|
155
|
-
]);
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
function step(op) {
|
|
159
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
160
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
161
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
162
|
-
if (y = 0, t) op = [
|
|
163
|
-
op[0] & 2,
|
|
164
|
-
t.value
|
|
165
|
-
];
|
|
166
|
-
switch(op[0]){
|
|
167
|
-
case 0:
|
|
168
|
-
case 1:
|
|
169
|
-
t = op;
|
|
170
|
-
break;
|
|
171
|
-
case 4:
|
|
172
|
-
_.label++;
|
|
173
|
-
return {
|
|
174
|
-
value: op[1],
|
|
175
|
-
done: false
|
|
176
|
-
};
|
|
177
|
-
case 5:
|
|
178
|
-
_.label++;
|
|
179
|
-
y = op[1];
|
|
180
|
-
op = [
|
|
181
|
-
0
|
|
182
|
-
];
|
|
183
|
-
continue;
|
|
184
|
-
case 7:
|
|
185
|
-
op = _.ops.pop();
|
|
186
|
-
_.trys.pop();
|
|
187
|
-
continue;
|
|
188
|
-
default:
|
|
189
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
190
|
-
_ = 0;
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
194
|
-
_.label = op[1];
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
198
|
-
_.label = t[1];
|
|
199
|
-
t = op;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
if (t && _.label < t[2]) {
|
|
203
|
-
_.label = t[2];
|
|
204
|
-
_.ops.push(op);
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
if (t[2]) _.ops.pop();
|
|
208
|
-
_.trys.pop();
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
op = body.call(thisArg, _);
|
|
212
|
-
} catch (e) {
|
|
213
|
-
op = [
|
|
214
|
-
6,
|
|
215
|
-
e
|
|
216
|
-
];
|
|
217
|
-
y = 0;
|
|
218
|
-
} finally{
|
|
219
|
-
f = t = 0;
|
|
220
|
-
}
|
|
221
|
-
if (op[0] & 5) throw op[1];
|
|
222
|
-
return {
|
|
223
|
-
value: op[0] ? op[1] : void 0,
|
|
224
|
-
done: true
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Base Trello server error.
|
|
230
|
-
*/ var TrelloServerError = /*#__PURE__*/ function(BaseError) {
|
|
231
|
-
_inherits(TrelloServerError, BaseError);
|
|
232
|
-
function TrelloServerError(message, data) {
|
|
233
|
-
_class_call_check(this, TrelloServerError);
|
|
234
|
-
var _this;
|
|
235
|
-
_this = _call_super(this, TrelloServerError, [
|
|
236
|
-
message
|
|
237
|
-
]), _define_property$2(_this, "data", void 0);
|
|
238
|
-
_this.data = data;
|
|
239
|
-
return _this;
|
|
240
|
-
}
|
|
241
|
-
_create_class(TrelloServerError, [
|
|
242
|
-
{
|
|
243
|
-
key: "status",
|
|
244
|
-
get: function get() {
|
|
245
|
-
return this.data.status;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
]);
|
|
249
|
-
return TrelloServerError;
|
|
250
|
-
}(makeError.BaseError);
|
|
251
|
-
/**
|
|
252
|
-
* Trello server error that retains the originating fetch response.
|
|
253
|
-
*/ var TrelloServerFetchResponseError = /*#__PURE__*/ function(TrelloServerError) {
|
|
254
|
-
_inherits(TrelloServerFetchResponseError, TrelloServerError);
|
|
255
|
-
function TrelloServerFetchResponseError(message, data, responseError) {
|
|
256
|
-
_class_call_check(this, TrelloServerFetchResponseError);
|
|
257
|
-
var _this;
|
|
258
|
-
_this = _call_super(this, TrelloServerFetchResponseError, [
|
|
259
|
-
message,
|
|
260
|
-
data
|
|
261
|
-
]), _define_property$2(_this, "responseError", void 0);
|
|
262
|
-
_this.responseError = responseError;
|
|
263
|
-
return _this;
|
|
264
|
-
}
|
|
265
|
-
return TrelloServerFetchResponseError;
|
|
266
|
-
}(TrelloServerError);
|
|
267
|
-
/**
|
|
268
|
-
* Trello returned 401 — typically a revoked or otherwise invalid token.
|
|
269
|
-
*
|
|
270
|
-
* @see https://developer.atlassian.com/cloud/trello/guides/rest-api/authorization/
|
|
271
|
-
*/ var TrelloInvalidTokenError = /*#__PURE__*/ function(TrelloServerFetchResponseError) {
|
|
272
|
-
_inherits(TrelloInvalidTokenError, TrelloServerFetchResponseError);
|
|
273
|
-
function TrelloInvalidTokenError() {
|
|
274
|
-
_class_call_check(this, TrelloInvalidTokenError);
|
|
275
|
-
return _call_super(this, TrelloInvalidTokenError, arguments);
|
|
276
|
-
}
|
|
277
|
-
return TrelloInvalidTokenError;
|
|
278
|
-
}(TrelloServerFetchResponseError);
|
|
279
|
-
/**
|
|
280
|
-
* Trello returned 429 — too many requests.
|
|
281
|
-
*/ var TrelloTooManyRequestsError = /*#__PURE__*/ function(TrelloServerFetchResponseError) {
|
|
282
|
-
_inherits(TrelloTooManyRequestsError, TrelloServerFetchResponseError);
|
|
283
|
-
function TrelloTooManyRequestsError() {
|
|
284
|
-
_class_call_check(this, TrelloTooManyRequestsError);
|
|
285
|
-
return _call_super(this, TrelloTooManyRequestsError, arguments);
|
|
286
|
-
}
|
|
287
|
-
_create_class(TrelloTooManyRequestsError, [
|
|
288
|
-
{
|
|
289
|
-
key: "retryAfter",
|
|
290
|
-
get: function get() {
|
|
291
|
-
var headerValue = this.responseError.response.headers.get('Retry-After');
|
|
292
|
-
return headerValue ? Number(headerValue) : undefined;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
]);
|
|
296
|
-
return TrelloTooManyRequestsError;
|
|
297
|
-
}(TrelloServerFetchResponseError);
|
|
298
|
-
/**
|
|
299
|
-
* Creates a logTrelloServerErrorFunction that logs the error to console.
|
|
300
|
-
*
|
|
301
|
-
* @param trelloApiNamePrefix - Prefix to use when logging.
|
|
302
|
-
* @returns Logs Trello server errors to the console.
|
|
303
|
-
*
|
|
304
|
-
* @__NO_SIDE_EFFECTS__
|
|
305
|
-
*/ function logTrelloServerErrorFunction(trelloApiNamePrefix) {
|
|
306
|
-
return function(error) {
|
|
307
|
-
if (_instanceof(error, TrelloServerFetchResponseError)) {
|
|
308
|
-
console.log("".concat(trelloApiNamePrefix, "Error(").concat(error.responseError.response.status, "): "), {
|
|
309
|
-
error: error,
|
|
310
|
-
errorData: error.data
|
|
311
|
-
});
|
|
312
|
-
} else if (_instanceof(error, TrelloServerError)) {
|
|
313
|
-
console.log("".concat(trelloApiNamePrefix, "Error(status:").concat(error.status, "): "), {
|
|
314
|
-
error: error
|
|
315
|
-
});
|
|
316
|
-
} else {
|
|
317
|
-
console.log("".concat(trelloApiNamePrefix, "Error(name:").concat(error.name, "): "), {
|
|
318
|
-
error: error
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
var logTrelloErrorToConsole = logTrelloServerErrorFunction('Trello');
|
|
324
|
-
/**
|
|
325
|
-
* Parses a FetchResponseError into a typed Trello API error.
|
|
326
|
-
*
|
|
327
|
-
* @param responseError - The fetch response error to parse.
|
|
328
|
-
* @returns A typed Trello error, or undefined if the response could not be parsed.
|
|
329
|
-
*/ function parseTrelloApiError(responseError) {
|
|
330
|
-
return _async_to_generator$4(function() {
|
|
331
|
-
var response, bodyText, bodyJson, data, message, result;
|
|
332
|
-
return _ts_generator$4(this, function(_state) {
|
|
333
|
-
switch(_state.label){
|
|
334
|
-
case 0:
|
|
335
|
-
response = responseError.response;
|
|
336
|
-
return [
|
|
337
|
-
4,
|
|
338
|
-
response.clone().text().catch(function() {
|
|
339
|
-
return '';
|
|
340
|
-
})
|
|
341
|
-
];
|
|
342
|
-
case 1:
|
|
343
|
-
bodyText = _state.sent();
|
|
344
|
-
try {
|
|
345
|
-
bodyJson = bodyText ? JSON.parse(bodyText) : undefined;
|
|
346
|
-
} catch (unused) {
|
|
347
|
-
bodyJson = undefined;
|
|
348
|
-
}
|
|
349
|
-
data = {
|
|
350
|
-
status: response.status,
|
|
351
|
-
bodyText: bodyText,
|
|
352
|
-
bodyJson: bodyJson
|
|
353
|
-
};
|
|
354
|
-
message = bodyText || "Trello request failed with status ".concat(response.status);
|
|
355
|
-
switch(response.status){
|
|
356
|
-
case 401:
|
|
357
|
-
result = new TrelloInvalidTokenError(message, data, responseError);
|
|
358
|
-
break;
|
|
359
|
-
case 429:
|
|
360
|
-
result = new TrelloTooManyRequestsError(message, data, responseError);
|
|
361
|
-
break;
|
|
362
|
-
default:
|
|
363
|
-
result = new TrelloServerFetchResponseError(message, data, responseError);
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
366
|
-
return [
|
|
367
|
-
2,
|
|
368
|
-
result
|
|
369
|
-
];
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
})();
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Wraps a ConfiguredFetch to translate FetchResponseError into typed Trello errors.
|
|
376
|
-
*
|
|
377
|
-
* @param fetch - The fetch to wrap.
|
|
378
|
-
* @param logError - Optional logger.
|
|
379
|
-
* @returns A ConfiguredFetch that throws typed Trello errors for known error responses.
|
|
380
|
-
*
|
|
381
|
-
* @__NO_SIDE_EFFECTS__
|
|
382
|
-
*/ function handleTrelloErrorFetch(fetch$1) {
|
|
383
|
-
var logError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : logTrelloErrorToConsole;
|
|
384
|
-
return function(x, y) {
|
|
385
|
-
return _async_to_generator$4(function() {
|
|
386
|
-
var e, error;
|
|
387
|
-
return _ts_generator$4(this, function(_state) {
|
|
388
|
-
switch(_state.label){
|
|
389
|
-
case 0:
|
|
390
|
-
_state.trys.push([
|
|
391
|
-
0,
|
|
392
|
-
2,
|
|
393
|
-
,
|
|
394
|
-
5
|
|
395
|
-
]);
|
|
396
|
-
return [
|
|
397
|
-
4,
|
|
398
|
-
fetch$1(x, y)
|
|
399
|
-
];
|
|
400
|
-
case 1:
|
|
401
|
-
return [
|
|
402
|
-
2,
|
|
403
|
-
_state.sent()
|
|
404
|
-
];
|
|
405
|
-
case 2:
|
|
406
|
-
e = _state.sent();
|
|
407
|
-
if (!_instanceof(e, fetch.FetchResponseError)) return [
|
|
408
|
-
3,
|
|
409
|
-
4
|
|
410
|
-
];
|
|
411
|
-
return [
|
|
412
|
-
4,
|
|
413
|
-
parseTrelloApiError(e)
|
|
414
|
-
];
|
|
415
|
-
case 3:
|
|
416
|
-
error = _state.sent();
|
|
417
|
-
if (error) {
|
|
418
|
-
logError(error);
|
|
419
|
-
throw error;
|
|
420
|
-
}
|
|
421
|
-
_state.label = 4;
|
|
422
|
-
case 4:
|
|
423
|
-
throw e;
|
|
424
|
-
case 5:
|
|
425
|
-
return [
|
|
426
|
-
2
|
|
427
|
-
];
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
})();
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Documented per-token rate limit: 100 requests per 10 seconds.
|
|
436
|
-
*
|
|
437
|
-
* @see https://developer.atlassian.com/cloud/trello/guides/rest-api/rate-limits/
|
|
438
|
-
*/ var DEFAULT_TRELLO_API_RATE_LIMIT = 100;
|
|
439
|
-
/**
|
|
440
|
-
* Reset period for the per-token rate limit (10 seconds).
|
|
441
|
-
*/ var DEFAULT_TRELLO_API_RATE_LIMIT_RESET_PERIOD = util.MS_IN_SECOND * 10;
|
|
442
|
-
/**
|
|
443
|
-
* Creates a rate-limited fetch handler configured for the Trello API.
|
|
444
|
-
*
|
|
445
|
-
* Backs off after 429 responses and respects the documented per-token rate limit.
|
|
446
|
-
*
|
|
447
|
-
* @param config - Optional configuration for rate limiting behavior.
|
|
448
|
-
* @returns A configured rate-limited fetch handler.
|
|
449
|
-
*
|
|
450
|
-
* @__NO_SIDE_EFFECTS__
|
|
451
|
-
*/ function trelloRateLimitedFetchHandler(config) {
|
|
452
|
-
var _ref, _ref1;
|
|
453
|
-
var limit = (_ref = config === null || config === void 0 ? void 0 : config.maxRateLimit) !== null && _ref !== void 0 ? _ref : DEFAULT_TRELLO_API_RATE_LIMIT;
|
|
454
|
-
var resetPeriod = (_ref1 = config === null || config === void 0 ? void 0 : config.resetPeriod) !== null && _ref1 !== void 0 ? _ref1 : DEFAULT_TRELLO_API_RATE_LIMIT_RESET_PERIOD;
|
|
455
|
-
var rateLimiter = util.resetPeriodPromiseRateLimiter({
|
|
456
|
-
limit: limit,
|
|
457
|
-
startLimitAt: Math.max(2, Math.ceil(limit / 10)),
|
|
458
|
-
cooldownRate: 1,
|
|
459
|
-
exponentRate: 1.1,
|
|
460
|
-
maxWaitTime: util.MS_IN_SECOND * 10,
|
|
461
|
-
resetPeriod: resetPeriod
|
|
462
|
-
});
|
|
463
|
-
return fetch.rateLimitedFetchHandler({
|
|
464
|
-
rateLimiter: rateLimiter,
|
|
465
|
-
updateWithResponse: function updateWithResponse(response) {
|
|
466
|
-
// Trello does not document rate limit headers, but it does return 429 when exceeded.
|
|
467
|
-
// Schedule a retry after the rate limiter cooldown when a 429 is observed.
|
|
468
|
-
return response.status === 429;
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Trello API URL (versioned).
|
|
475
|
-
*/ var TRELLO_API_URL = 'https://api.trello.com/1';
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Builds a Trello API factory.
|
|
479
|
-
*
|
|
480
|
-
* Auth uses Trello's `Authorization: OAuth oauth_consumer_key=..., oauth_token=...` header form so credentials never appear in URLs or logs.
|
|
481
|
-
*
|
|
482
|
-
* @param factoryConfig - Factory-level configuration shared across created Trello instances.
|
|
483
|
-
* @returns A factory function that creates a configured Trello API instance.
|
|
484
|
-
*
|
|
485
|
-
* @__NO_SIDE_EFFECTS__
|
|
486
|
-
*/ function trelloFactory() {
|
|
487
|
-
var factoryConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
488
|
-
var logTrelloServerErrorFunction = factoryConfig.logTrelloServerErrorFunction;
|
|
489
|
-
var fetchHandler = trelloRateLimitedFetchHandler(factoryConfig.rateLimiterConfig);
|
|
490
|
-
return function(config) {
|
|
491
|
-
var _config_apiUrl;
|
|
492
|
-
var authHeader = 'OAuth oauth_consumer_key="'.concat(config.apiKey, '", oauth_token="').concat(config.apiToken, '"');
|
|
493
|
-
var baseFetch = fetch.fetchApiFetchService.makeFetch({
|
|
494
|
-
baseUrl: (_config_apiUrl = config.apiUrl) !== null && _config_apiUrl !== void 0 ? _config_apiUrl : TRELLO_API_URL,
|
|
495
|
-
baseRequest: function baseRequest() {
|
|
496
|
-
return {
|
|
497
|
-
headers: {
|
|
498
|
-
'Content-Type': 'application/json',
|
|
499
|
-
Authorization: authHeader
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
},
|
|
503
|
-
fetchHandler: fetchHandler,
|
|
504
|
-
timeout: 20 * 1000,
|
|
505
|
-
requireOkResponse: true,
|
|
506
|
-
useTimeout: true
|
|
507
|
-
});
|
|
508
|
-
var fetch$1 = handleTrelloErrorFetch(baseFetch, logTrelloServerErrorFunction);
|
|
509
|
-
var fetchJsonInst = fetch.fetchJsonFunction(fetch$1, {
|
|
510
|
-
handleFetchJsonParseErrorFunction: fetch.returnNullHandleFetchJsonParseErrorFunction
|
|
511
|
-
});
|
|
512
|
-
var trelloContext = {
|
|
513
|
-
fetch: fetch$1,
|
|
514
|
-
fetchJson: fetchJsonInst,
|
|
515
|
-
config: config,
|
|
516
|
-
trelloRateLimiter: fetchHandler._rateLimiter
|
|
517
|
-
};
|
|
518
|
-
var trello = {
|
|
519
|
-
trelloContext: trelloContext
|
|
520
|
-
};
|
|
521
|
-
return trello;
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
526
|
-
try {
|
|
527
|
-
var info = gen[key](arg);
|
|
528
|
-
var value = info.value;
|
|
529
|
-
} catch (error) {
|
|
530
|
-
reject(error);
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
if (info.done) {
|
|
534
|
-
resolve(value);
|
|
535
|
-
} else {
|
|
536
|
-
Promise.resolve(value).then(_next, _throw);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function _async_to_generator$3(fn) {
|
|
540
|
-
return function() {
|
|
541
|
-
var self = this, args = arguments;
|
|
542
|
-
return new Promise(function(resolve, reject) {
|
|
543
|
-
var gen = fn.apply(self, args);
|
|
544
|
-
function _next(value) {
|
|
545
|
-
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
546
|
-
}
|
|
547
|
-
function _throw(err) {
|
|
548
|
-
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
549
|
-
}
|
|
550
|
-
_next(undefined);
|
|
551
|
-
});
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
function _object_without_properties$4(source, excluded) {
|
|
555
|
-
if (source == null) return {};
|
|
556
|
-
var target = {}, sourceKeys, key, i;
|
|
557
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
558
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
559
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
560
|
-
key = sourceKeys[i];
|
|
561
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
562
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
563
|
-
target[key] = source[key];
|
|
564
|
-
}
|
|
565
|
-
return target;
|
|
566
|
-
}
|
|
567
|
-
target = _object_without_properties_loose$4(source, excluded);
|
|
568
|
-
if (Object.getOwnPropertySymbols) {
|
|
569
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
570
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
571
|
-
key = sourceKeys[i];
|
|
572
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
573
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
574
|
-
target[key] = source[key];
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
return target;
|
|
578
|
-
}
|
|
579
|
-
function _object_without_properties_loose$4(source, excluded) {
|
|
580
|
-
if (source == null) return {};
|
|
581
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
582
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
583
|
-
key = sourceKeys[i];
|
|
584
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
585
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
586
|
-
target[key] = source[key];
|
|
587
|
-
}
|
|
588
|
-
return target;
|
|
589
|
-
}
|
|
590
|
-
function _ts_generator$3(thisArg, body) {
|
|
591
|
-
var f, y, t, _ = {
|
|
592
|
-
label: 0,
|
|
593
|
-
sent: function() {
|
|
594
|
-
if (t[0] & 1) throw t[1];
|
|
595
|
-
return t[1];
|
|
596
|
-
},
|
|
597
|
-
trys: [],
|
|
598
|
-
ops: []
|
|
599
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
600
|
-
return d(g, "next", {
|
|
601
|
-
value: verb(0)
|
|
602
|
-
}), d(g, "throw", {
|
|
603
|
-
value: verb(1)
|
|
604
|
-
}), d(g, "return", {
|
|
605
|
-
value: verb(2)
|
|
606
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
607
|
-
value: function() {
|
|
608
|
-
return this;
|
|
609
|
-
}
|
|
610
|
-
}), g;
|
|
611
|
-
function verb(n) {
|
|
612
|
-
return function(v) {
|
|
613
|
-
return step([
|
|
614
|
-
n,
|
|
615
|
-
v
|
|
616
|
-
]);
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
function step(op) {
|
|
620
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
621
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
622
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
623
|
-
if (y = 0, t) op = [
|
|
624
|
-
op[0] & 2,
|
|
625
|
-
t.value
|
|
626
|
-
];
|
|
627
|
-
switch(op[0]){
|
|
628
|
-
case 0:
|
|
629
|
-
case 1:
|
|
630
|
-
t = op;
|
|
631
|
-
break;
|
|
632
|
-
case 4:
|
|
633
|
-
_.label++;
|
|
634
|
-
return {
|
|
635
|
-
value: op[1],
|
|
636
|
-
done: false
|
|
637
|
-
};
|
|
638
|
-
case 5:
|
|
639
|
-
_.label++;
|
|
640
|
-
y = op[1];
|
|
641
|
-
op = [
|
|
642
|
-
0
|
|
643
|
-
];
|
|
644
|
-
continue;
|
|
645
|
-
case 7:
|
|
646
|
-
op = _.ops.pop();
|
|
647
|
-
_.trys.pop();
|
|
648
|
-
continue;
|
|
649
|
-
default:
|
|
650
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
651
|
-
_ = 0;
|
|
652
|
-
continue;
|
|
653
|
-
}
|
|
654
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
655
|
-
_.label = op[1];
|
|
656
|
-
break;
|
|
657
|
-
}
|
|
658
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
659
|
-
_.label = t[1];
|
|
660
|
-
t = op;
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
if (t && _.label < t[2]) {
|
|
664
|
-
_.label = t[2];
|
|
665
|
-
_.ops.push(op);
|
|
666
|
-
break;
|
|
667
|
-
}
|
|
668
|
-
if (t[2]) _.ops.pop();
|
|
669
|
-
_.trys.pop();
|
|
670
|
-
continue;
|
|
671
|
-
}
|
|
672
|
-
op = body.call(thisArg, _);
|
|
673
|
-
} catch (e) {
|
|
674
|
-
op = [
|
|
675
|
-
6,
|
|
676
|
-
e
|
|
677
|
-
];
|
|
678
|
-
y = 0;
|
|
679
|
-
} finally{
|
|
680
|
-
f = t = 0;
|
|
681
|
-
}
|
|
682
|
-
if (op[0] & 5) throw op[1];
|
|
683
|
-
return {
|
|
684
|
-
value: op[0] ? op[1] : void 0,
|
|
685
|
-
done: true
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-get.
|
|
691
|
-
*
|
|
692
|
-
* @param context - The Trello API context.
|
|
693
|
-
* @returns Retrieves a board by id.
|
|
694
|
-
*/ function getBoard(context) {
|
|
695
|
-
return function(input) {
|
|
696
|
-
return context.fetchJson("/boards/".concat(input.boardId), 'GET');
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-post.
|
|
701
|
-
*
|
|
702
|
-
* @param context - The Trello API context.
|
|
703
|
-
* @returns Creates a new board.
|
|
704
|
-
*/ function createBoard(context) {
|
|
705
|
-
return function(input) {
|
|
706
|
-
var queryString = fetch.makeUrlSearchParams(input);
|
|
707
|
-
return context.fetchJson("/boards?".concat(queryString), 'POST');
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-put.
|
|
712
|
-
*
|
|
713
|
-
* @param context - The Trello API context.
|
|
714
|
-
* @returns Updates an existing board.
|
|
715
|
-
*/ function updateBoard(context) {
|
|
716
|
-
return function(input) {
|
|
717
|
-
var boardId = input.boardId, body = _object_without_properties$4(input, [
|
|
718
|
-
"boardId"
|
|
719
|
-
]);
|
|
720
|
-
return context.fetchJson("/boards/".concat(boardId), 'PUT', body);
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-delete.
|
|
725
|
-
*
|
|
726
|
-
* @param context - The Trello API context.
|
|
727
|
-
* @returns Deletes a board.
|
|
728
|
-
*/ function deleteBoard(context) {
|
|
729
|
-
return function(input) {
|
|
730
|
-
return _async_to_generator$3(function() {
|
|
731
|
-
return _ts_generator$3(this, function(_state) {
|
|
732
|
-
switch(_state.label){
|
|
733
|
-
case 0:
|
|
734
|
-
return [
|
|
735
|
-
4,
|
|
736
|
-
context.fetchJson("/boards/".concat(input.boardId), 'DELETE')
|
|
737
|
-
];
|
|
738
|
-
case 1:
|
|
739
|
-
_state.sent();
|
|
740
|
-
return [
|
|
741
|
-
2
|
|
742
|
-
];
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
})();
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-lists-get.
|
|
750
|
-
*
|
|
751
|
-
* @param context - The Trello API context.
|
|
752
|
-
* @returns Lists all lists on a board.
|
|
753
|
-
*/ function listBoardLists(context) {
|
|
754
|
-
return function(input) {
|
|
755
|
-
var boardId = input.boardId, query = _object_without_properties$4(input, [
|
|
756
|
-
"boardId"
|
|
757
|
-
]);
|
|
758
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
759
|
-
return context.fetchJson("/boards/".concat(boardId, "/lists?").concat(queryString), 'GET');
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-cards-get.
|
|
764
|
-
*
|
|
765
|
-
* @param context - The Trello API context.
|
|
766
|
-
* @returns Lists all cards on a board.
|
|
767
|
-
*/ function listBoardCards(context) {
|
|
768
|
-
return function(input) {
|
|
769
|
-
var boardId = input.boardId, query = _object_without_properties$4(input, [
|
|
770
|
-
"boardId"
|
|
771
|
-
]);
|
|
772
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
773
|
-
return context.fetchJson("/boards/".concat(boardId, "/cards?").concat(queryString), 'GET');
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-labels-get.
|
|
778
|
-
*
|
|
779
|
-
* @param context - The Trello API context.
|
|
780
|
-
* @returns Lists every label defined on a board.
|
|
781
|
-
*/ function listBoardLabels(context) {
|
|
782
|
-
return function(input) {
|
|
783
|
-
var boardId = input.boardId, query = _object_without_properties$4(input, [
|
|
784
|
-
"boardId"
|
|
785
|
-
]);
|
|
786
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
787
|
-
return context.fetchJson("/boards/".concat(boardId, "/labels?").concat(queryString), 'GET');
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-members-get.
|
|
792
|
-
*
|
|
793
|
-
* @param context - The Trello API context.
|
|
794
|
-
* @returns Lists all members of a board.
|
|
795
|
-
*/ function listBoardMembers(context) {
|
|
796
|
-
return function(input) {
|
|
797
|
-
return context.fetchJson("/boards/".concat(input.boardId, "/members"), 'GET');
|
|
798
|
-
};
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-actions-get.
|
|
802
|
-
*
|
|
803
|
-
* Returns the board action stream. Useful for list-movement audits via `filter: 'updateCard:idList'` paired with
|
|
804
|
-
* the {@link TrelloUpdateCardIdListActionData} payload type — answers "which cards moved into list X since time Y?".
|
|
805
|
-
*
|
|
806
|
-
* @param context - The Trello API context.
|
|
807
|
-
* @returns Lists actions on a board.
|
|
808
|
-
*/ function listBoardActions(context) {
|
|
809
|
-
return function(input) {
|
|
810
|
-
var boardId = input.boardId, query = _object_without_properties$4(input, [
|
|
811
|
-
"boardId"
|
|
812
|
-
]);
|
|
813
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
814
|
-
return context.fetchJson("/boards/".concat(boardId, "/actions?").concat(queryString), 'GET');
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
function _object_without_properties$3(source, excluded) {
|
|
819
|
-
if (source == null) return {};
|
|
820
|
-
var target = {}, sourceKeys, key, i;
|
|
821
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
822
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
823
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
824
|
-
key = sourceKeys[i];
|
|
825
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
826
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
827
|
-
target[key] = source[key];
|
|
828
|
-
}
|
|
829
|
-
return target;
|
|
830
|
-
}
|
|
831
|
-
target = _object_without_properties_loose$3(source, excluded);
|
|
832
|
-
if (Object.getOwnPropertySymbols) {
|
|
833
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
834
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
835
|
-
key = sourceKeys[i];
|
|
836
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
837
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
838
|
-
target[key] = source[key];
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
return target;
|
|
842
|
-
}
|
|
843
|
-
function _object_without_properties_loose$3(source, excluded) {
|
|
844
|
-
if (source == null) return {};
|
|
845
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
846
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
847
|
-
key = sourceKeys[i];
|
|
848
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
849
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
850
|
-
target[key] = source[key];
|
|
851
|
-
}
|
|
852
|
-
return target;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-get.
|
|
856
|
-
*
|
|
857
|
-
* @param context - The Trello API context.
|
|
858
|
-
* @returns Retrieves a list by id.
|
|
859
|
-
*/ function getList(context) {
|
|
860
|
-
return function(input) {
|
|
861
|
-
return context.fetchJson("/lists/".concat(input.listId), 'GET');
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-post.
|
|
866
|
-
*
|
|
867
|
-
* @param context - The Trello API context.
|
|
868
|
-
* @returns Creates a new list on a board.
|
|
869
|
-
*/ function createList(context) {
|
|
870
|
-
return function(input) {
|
|
871
|
-
var queryString = fetch.makeUrlSearchParams(input);
|
|
872
|
-
return context.fetchJson("/lists?".concat(queryString), 'POST');
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-put.
|
|
877
|
-
*
|
|
878
|
-
* @param context - The Trello API context.
|
|
879
|
-
* @returns Updates an existing list.
|
|
880
|
-
*/ function updateList(context) {
|
|
881
|
-
return function(input) {
|
|
882
|
-
var listId = input.listId, body = _object_without_properties$3(input, [
|
|
883
|
-
"listId"
|
|
884
|
-
]);
|
|
885
|
-
return context.fetchJson("/lists/".concat(listId), 'PUT', body);
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-cards-get.
|
|
890
|
-
*
|
|
891
|
-
* @param context - The Trello API context.
|
|
892
|
-
* @returns Lists all cards on a list.
|
|
893
|
-
*/ function listCardsInList(context) {
|
|
894
|
-
return function(input) {
|
|
895
|
-
var listId = input.listId, query = _object_without_properties$3(input, [
|
|
896
|
-
"listId"
|
|
897
|
-
]);
|
|
898
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
899
|
-
return context.fetchJson("/lists/".concat(listId, "/cards?").concat(queryString), 'GET');
|
|
900
|
-
};
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
904
|
-
try {
|
|
905
|
-
var info = gen[key](arg);
|
|
906
|
-
var value = info.value;
|
|
907
|
-
} catch (error) {
|
|
908
|
-
reject(error);
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
if (info.done) {
|
|
912
|
-
resolve(value);
|
|
913
|
-
} else {
|
|
914
|
-
Promise.resolve(value).then(_next, _throw);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
function _async_to_generator$2(fn) {
|
|
918
|
-
return function() {
|
|
919
|
-
var self = this, args = arguments;
|
|
920
|
-
return new Promise(function(resolve, reject) {
|
|
921
|
-
var gen = fn.apply(self, args);
|
|
922
|
-
function _next(value) {
|
|
923
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
924
|
-
}
|
|
925
|
-
function _throw(err) {
|
|
926
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
927
|
-
}
|
|
928
|
-
_next(undefined);
|
|
929
|
-
});
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
function _define_property$1(obj, key, value) {
|
|
933
|
-
if (key in obj) {
|
|
934
|
-
Object.defineProperty(obj, key, {
|
|
935
|
-
value: value,
|
|
936
|
-
enumerable: true,
|
|
937
|
-
configurable: true,
|
|
938
|
-
writable: true
|
|
939
|
-
});
|
|
940
|
-
} else {
|
|
941
|
-
obj[key] = value;
|
|
942
|
-
}
|
|
943
|
-
return obj;
|
|
944
|
-
}
|
|
945
|
-
function _object_spread$1(target) {
|
|
946
|
-
for(var i = 1; i < arguments.length; i++){
|
|
947
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
948
|
-
var ownKeys = Object.keys(source);
|
|
949
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
950
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
951
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
952
|
-
}));
|
|
953
|
-
}
|
|
954
|
-
ownKeys.forEach(function(key) {
|
|
955
|
-
_define_property$1(target, key, source[key]);
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
return target;
|
|
959
|
-
}
|
|
960
|
-
function _object_without_properties$2(source, excluded) {
|
|
961
|
-
if (source == null) return {};
|
|
962
|
-
var target = {}, sourceKeys, key, i;
|
|
963
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
964
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
965
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
966
|
-
key = sourceKeys[i];
|
|
967
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
968
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
969
|
-
target[key] = source[key];
|
|
970
|
-
}
|
|
971
|
-
return target;
|
|
972
|
-
}
|
|
973
|
-
target = _object_without_properties_loose$2(source, excluded);
|
|
974
|
-
if (Object.getOwnPropertySymbols) {
|
|
975
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
976
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
977
|
-
key = sourceKeys[i];
|
|
978
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
979
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
980
|
-
target[key] = source[key];
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
return target;
|
|
984
|
-
}
|
|
985
|
-
function _object_without_properties_loose$2(source, excluded) {
|
|
986
|
-
if (source == null) return {};
|
|
987
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
988
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
989
|
-
key = sourceKeys[i];
|
|
990
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
991
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
992
|
-
target[key] = source[key];
|
|
993
|
-
}
|
|
994
|
-
return target;
|
|
995
|
-
}
|
|
996
|
-
function _ts_generator$2(thisArg, body) {
|
|
997
|
-
var f, y, t, _ = {
|
|
998
|
-
label: 0,
|
|
999
|
-
sent: function() {
|
|
1000
|
-
if (t[0] & 1) throw t[1];
|
|
1001
|
-
return t[1];
|
|
1002
|
-
},
|
|
1003
|
-
trys: [],
|
|
1004
|
-
ops: []
|
|
1005
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
1006
|
-
return d(g, "next", {
|
|
1007
|
-
value: verb(0)
|
|
1008
|
-
}), d(g, "throw", {
|
|
1009
|
-
value: verb(1)
|
|
1010
|
-
}), d(g, "return", {
|
|
1011
|
-
value: verb(2)
|
|
1012
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
1013
|
-
value: function() {
|
|
1014
|
-
return this;
|
|
1015
|
-
}
|
|
1016
|
-
}), g;
|
|
1017
|
-
function verb(n) {
|
|
1018
|
-
return function(v) {
|
|
1019
|
-
return step([
|
|
1020
|
-
n,
|
|
1021
|
-
v
|
|
1022
|
-
]);
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
function step(op) {
|
|
1026
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1027
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
1028
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1029
|
-
if (y = 0, t) op = [
|
|
1030
|
-
op[0] & 2,
|
|
1031
|
-
t.value
|
|
1032
|
-
];
|
|
1033
|
-
switch(op[0]){
|
|
1034
|
-
case 0:
|
|
1035
|
-
case 1:
|
|
1036
|
-
t = op;
|
|
1037
|
-
break;
|
|
1038
|
-
case 4:
|
|
1039
|
-
_.label++;
|
|
1040
|
-
return {
|
|
1041
|
-
value: op[1],
|
|
1042
|
-
done: false
|
|
1043
|
-
};
|
|
1044
|
-
case 5:
|
|
1045
|
-
_.label++;
|
|
1046
|
-
y = op[1];
|
|
1047
|
-
op = [
|
|
1048
|
-
0
|
|
1049
|
-
];
|
|
1050
|
-
continue;
|
|
1051
|
-
case 7:
|
|
1052
|
-
op = _.ops.pop();
|
|
1053
|
-
_.trys.pop();
|
|
1054
|
-
continue;
|
|
1055
|
-
default:
|
|
1056
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1057
|
-
_ = 0;
|
|
1058
|
-
continue;
|
|
1059
|
-
}
|
|
1060
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1061
|
-
_.label = op[1];
|
|
1062
|
-
break;
|
|
1063
|
-
}
|
|
1064
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1065
|
-
_.label = t[1];
|
|
1066
|
-
t = op;
|
|
1067
|
-
break;
|
|
1068
|
-
}
|
|
1069
|
-
if (t && _.label < t[2]) {
|
|
1070
|
-
_.label = t[2];
|
|
1071
|
-
_.ops.push(op);
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
if (t[2]) _.ops.pop();
|
|
1075
|
-
_.trys.pop();
|
|
1076
|
-
continue;
|
|
1077
|
-
}
|
|
1078
|
-
op = body.call(thisArg, _);
|
|
1079
|
-
} catch (e) {
|
|
1080
|
-
op = [
|
|
1081
|
-
6,
|
|
1082
|
-
e
|
|
1083
|
-
];
|
|
1084
|
-
y = 0;
|
|
1085
|
-
} finally{
|
|
1086
|
-
f = t = 0;
|
|
1087
|
-
}
|
|
1088
|
-
if (op[0] & 5) throw op[1];
|
|
1089
|
-
return {
|
|
1090
|
-
value: op[0] ? op[1] : void 0,
|
|
1091
|
-
done: true
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
/**
|
|
1096
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-get.
|
|
1097
|
-
*
|
|
1098
|
-
* @param context - The Trello API context.
|
|
1099
|
-
* @returns Retrieves a card by id.
|
|
1100
|
-
*/ function getCard(context) {
|
|
1101
|
-
return function(input) {
|
|
1102
|
-
return context.fetchJson("/cards/".concat(input.cardId), 'GET');
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post.
|
|
1107
|
-
*
|
|
1108
|
-
* @param context - The Trello API context.
|
|
1109
|
-
* @returns Creates a card on a list.
|
|
1110
|
-
*/ function createCard(context) {
|
|
1111
|
-
return function(input) {
|
|
1112
|
-
var idLabels = input.idLabels, idMembers = input.idMembers, rest = _object_without_properties$2(input, [
|
|
1113
|
-
"idLabels",
|
|
1114
|
-
"idMembers"
|
|
1115
|
-
]);
|
|
1116
|
-
var query = _object_spread$1({}, rest);
|
|
1117
|
-
if (idLabels) {
|
|
1118
|
-
query['idLabels'] = idLabels.join(',');
|
|
1119
|
-
}
|
|
1120
|
-
if (idMembers) {
|
|
1121
|
-
query['idMembers'] = idMembers.join(',');
|
|
1122
|
-
}
|
|
1123
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
1124
|
-
return context.fetchJson("/cards?".concat(queryString), 'POST');
|
|
1125
|
-
};
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put.
|
|
1129
|
-
*
|
|
1130
|
-
* @param context - The Trello API context.
|
|
1131
|
-
* @returns Updates an existing card.
|
|
1132
|
-
*/ function updateCard(context) {
|
|
1133
|
-
return function(input) {
|
|
1134
|
-
var cardId = input.cardId, idLabels = input.idLabels, idMembers = input.idMembers, rest = _object_without_properties$2(input, [
|
|
1135
|
-
"cardId",
|
|
1136
|
-
"idLabels",
|
|
1137
|
-
"idMembers"
|
|
1138
|
-
]);
|
|
1139
|
-
var body = _object_spread$1({}, rest);
|
|
1140
|
-
if (idLabels) {
|
|
1141
|
-
body['idLabels'] = idLabels.join(',');
|
|
1142
|
-
}
|
|
1143
|
-
if (idMembers) {
|
|
1144
|
-
body['idMembers'] = idMembers.join(',');
|
|
1145
|
-
}
|
|
1146
|
-
return context.fetchJson("/cards/".concat(cardId), 'PUT', body);
|
|
1147
|
-
};
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-delete.
|
|
1151
|
-
*
|
|
1152
|
-
* @param context - The Trello API context.
|
|
1153
|
-
* @returns Deletes a card.
|
|
1154
|
-
*/ function deleteCard(context) {
|
|
1155
|
-
return function(input) {
|
|
1156
|
-
return _async_to_generator$2(function() {
|
|
1157
|
-
return _ts_generator$2(this, function(_state) {
|
|
1158
|
-
switch(_state.label){
|
|
1159
|
-
case 0:
|
|
1160
|
-
return [
|
|
1161
|
-
4,
|
|
1162
|
-
context.fetchJson("/cards/".concat(input.cardId), 'DELETE')
|
|
1163
|
-
];
|
|
1164
|
-
case 1:
|
|
1165
|
-
_state.sent();
|
|
1166
|
-
return [
|
|
1167
|
-
2
|
|
1168
|
-
];
|
|
1169
|
-
}
|
|
1170
|
-
});
|
|
1171
|
-
})();
|
|
1172
|
-
};
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-get.
|
|
1176
|
-
*
|
|
1177
|
-
* Comments are returned as actions with `type === 'commentCard'`; pass `filter: 'commentCard'` and the generic
|
|
1178
|
-
* type parameter `TrelloCommentCardActionData` to get a comment-typed result.
|
|
1179
|
-
*
|
|
1180
|
-
* @param context - The Trello API context.
|
|
1181
|
-
* @returns Lists actions on a card.
|
|
1182
|
-
*/ function listCardActions(context) {
|
|
1183
|
-
return function(input) {
|
|
1184
|
-
var cardId = input.cardId, query = _object_without_properties$2(input, [
|
|
1185
|
-
"cardId"
|
|
1186
|
-
]);
|
|
1187
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
1188
|
-
return context.fetchJson("/cards/".concat(cardId, "/actions?").concat(queryString), 'GET');
|
|
1189
|
-
};
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-comments-post.
|
|
1193
|
-
*
|
|
1194
|
-
* @param context - The Trello API context.
|
|
1195
|
-
* @returns Adds a comment to a card.
|
|
1196
|
-
*/ function addCommentToCard(context) {
|
|
1197
|
-
return function(input) {
|
|
1198
|
-
var queryString = fetch.makeUrlSearchParams({
|
|
1199
|
-
text: input.text
|
|
1200
|
-
});
|
|
1201
|
-
return context.fetchJson("/cards/".concat(input.cardId, "/actions/comments?").concat(queryString), 'POST');
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
/**
|
|
1205
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post.
|
|
1206
|
-
*
|
|
1207
|
-
* @param context - The Trello API context.
|
|
1208
|
-
* @returns Adds a member to a card.
|
|
1209
|
-
*/ function addMemberToCard(context) {
|
|
1210
|
-
return function(input) {
|
|
1211
|
-
var queryString = fetch.makeUrlSearchParams({
|
|
1212
|
-
value: input.memberId
|
|
1213
|
-
});
|
|
1214
|
-
return context.fetchJson("/cards/".concat(input.cardId, "/idMembers?").concat(queryString), 'POST');
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post.
|
|
1219
|
-
*
|
|
1220
|
-
* @param context - The Trello API context.
|
|
1221
|
-
* @returns Adds an existing label to a card.
|
|
1222
|
-
*/ function addLabelToCard(context) {
|
|
1223
|
-
return function(input) {
|
|
1224
|
-
var queryString = fetch.makeUrlSearchParams({
|
|
1225
|
-
value: input.labelId
|
|
1226
|
-
});
|
|
1227
|
-
return context.fetchJson("/cards/".concat(input.cardId, "/idLabels?").concat(queryString), 'POST');
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1232
|
-
try {
|
|
1233
|
-
var info = gen[key](arg);
|
|
1234
|
-
var value = info.value;
|
|
1235
|
-
} catch (error) {
|
|
1236
|
-
reject(error);
|
|
1237
|
-
return;
|
|
1238
|
-
}
|
|
1239
|
-
if (info.done) {
|
|
1240
|
-
resolve(value);
|
|
1241
|
-
} else {
|
|
1242
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
function _async_to_generator$1(fn) {
|
|
1246
|
-
return function() {
|
|
1247
|
-
var self = this, args = arguments;
|
|
1248
|
-
return new Promise(function(resolve, reject) {
|
|
1249
|
-
var gen = fn.apply(self, args);
|
|
1250
|
-
function _next(value) {
|
|
1251
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
1252
|
-
}
|
|
1253
|
-
function _throw(err) {
|
|
1254
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1255
|
-
}
|
|
1256
|
-
_next(undefined);
|
|
1257
|
-
});
|
|
1258
|
-
};
|
|
1259
|
-
}
|
|
1260
|
-
function _object_without_properties$1(source, excluded) {
|
|
1261
|
-
if (source == null) return {};
|
|
1262
|
-
var target = {}, sourceKeys, key, i;
|
|
1263
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
1264
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
1265
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
1266
|
-
key = sourceKeys[i];
|
|
1267
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1268
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1269
|
-
target[key] = source[key];
|
|
1270
|
-
}
|
|
1271
|
-
return target;
|
|
1272
|
-
}
|
|
1273
|
-
target = _object_without_properties_loose$1(source, excluded);
|
|
1274
|
-
if (Object.getOwnPropertySymbols) {
|
|
1275
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
1276
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
1277
|
-
key = sourceKeys[i];
|
|
1278
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1279
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1280
|
-
target[key] = source[key];
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
return target;
|
|
1284
|
-
}
|
|
1285
|
-
function _object_without_properties_loose$1(source, excluded) {
|
|
1286
|
-
if (source == null) return {};
|
|
1287
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
1288
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
1289
|
-
key = sourceKeys[i];
|
|
1290
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1291
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1292
|
-
target[key] = source[key];
|
|
1293
|
-
}
|
|
1294
|
-
return target;
|
|
1295
|
-
}
|
|
1296
|
-
function _ts_generator$1(thisArg, body) {
|
|
1297
|
-
var f, y, t, _ = {
|
|
1298
|
-
label: 0,
|
|
1299
|
-
sent: function() {
|
|
1300
|
-
if (t[0] & 1) throw t[1];
|
|
1301
|
-
return t[1];
|
|
1302
|
-
},
|
|
1303
|
-
trys: [],
|
|
1304
|
-
ops: []
|
|
1305
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
1306
|
-
return d(g, "next", {
|
|
1307
|
-
value: verb(0)
|
|
1308
|
-
}), d(g, "throw", {
|
|
1309
|
-
value: verb(1)
|
|
1310
|
-
}), d(g, "return", {
|
|
1311
|
-
value: verb(2)
|
|
1312
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
1313
|
-
value: function() {
|
|
1314
|
-
return this;
|
|
1315
|
-
}
|
|
1316
|
-
}), g;
|
|
1317
|
-
function verb(n) {
|
|
1318
|
-
return function(v) {
|
|
1319
|
-
return step([
|
|
1320
|
-
n,
|
|
1321
|
-
v
|
|
1322
|
-
]);
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
function step(op) {
|
|
1326
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1327
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
1328
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1329
|
-
if (y = 0, t) op = [
|
|
1330
|
-
op[0] & 2,
|
|
1331
|
-
t.value
|
|
1332
|
-
];
|
|
1333
|
-
switch(op[0]){
|
|
1334
|
-
case 0:
|
|
1335
|
-
case 1:
|
|
1336
|
-
t = op;
|
|
1337
|
-
break;
|
|
1338
|
-
case 4:
|
|
1339
|
-
_.label++;
|
|
1340
|
-
return {
|
|
1341
|
-
value: op[1],
|
|
1342
|
-
done: false
|
|
1343
|
-
};
|
|
1344
|
-
case 5:
|
|
1345
|
-
_.label++;
|
|
1346
|
-
y = op[1];
|
|
1347
|
-
op = [
|
|
1348
|
-
0
|
|
1349
|
-
];
|
|
1350
|
-
continue;
|
|
1351
|
-
case 7:
|
|
1352
|
-
op = _.ops.pop();
|
|
1353
|
-
_.trys.pop();
|
|
1354
|
-
continue;
|
|
1355
|
-
default:
|
|
1356
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1357
|
-
_ = 0;
|
|
1358
|
-
continue;
|
|
1359
|
-
}
|
|
1360
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1361
|
-
_.label = op[1];
|
|
1362
|
-
break;
|
|
1363
|
-
}
|
|
1364
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1365
|
-
_.label = t[1];
|
|
1366
|
-
t = op;
|
|
1367
|
-
break;
|
|
1368
|
-
}
|
|
1369
|
-
if (t && _.label < t[2]) {
|
|
1370
|
-
_.label = t[2];
|
|
1371
|
-
_.ops.push(op);
|
|
1372
|
-
break;
|
|
1373
|
-
}
|
|
1374
|
-
if (t[2]) _.ops.pop();
|
|
1375
|
-
_.trys.pop();
|
|
1376
|
-
continue;
|
|
1377
|
-
}
|
|
1378
|
-
op = body.call(thisArg, _);
|
|
1379
|
-
} catch (e) {
|
|
1380
|
-
op = [
|
|
1381
|
-
6,
|
|
1382
|
-
e
|
|
1383
|
-
];
|
|
1384
|
-
y = 0;
|
|
1385
|
-
} finally{
|
|
1386
|
-
f = t = 0;
|
|
1387
|
-
}
|
|
1388
|
-
if (op[0] & 5) throw op[1];
|
|
1389
|
-
return {
|
|
1390
|
-
value: op[0] ? op[1] : void 0,
|
|
1391
|
-
done: true
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
/**
|
|
1396
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-get.
|
|
1397
|
-
*
|
|
1398
|
-
* @param context - The Trello API context.
|
|
1399
|
-
* @returns Lists attachments on a card.
|
|
1400
|
-
*/ function listCardAttachments(context) {
|
|
1401
|
-
return function(input) {
|
|
1402
|
-
var cardId = input.cardId, query = _object_without_properties$1(input, [
|
|
1403
|
-
"cardId"
|
|
1404
|
-
]);
|
|
1405
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
1406
|
-
return context.fetchJson("/cards/".concat(cardId, "/attachments?").concat(queryString), 'GET');
|
|
1407
|
-
};
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-idattachment-get.
|
|
1411
|
-
*
|
|
1412
|
-
* @param context - The Trello API context.
|
|
1413
|
-
* @returns Retrieves a single attachment on a card.
|
|
1414
|
-
*/ function getCardAttachment(context) {
|
|
1415
|
-
return function(input) {
|
|
1416
|
-
var cardId = input.cardId, attachmentId = input.attachmentId, query = _object_without_properties$1(input, [
|
|
1417
|
-
"cardId",
|
|
1418
|
-
"attachmentId"
|
|
1419
|
-
]);
|
|
1420
|
-
var queryString = fetch.makeUrlSearchParams(query);
|
|
1421
|
-
return context.fetchJson("/cards/".concat(cardId, "/attachments/").concat(attachmentId, "?").concat(queryString), 'GET');
|
|
1422
|
-
};
|
|
1423
|
-
}
|
|
1424
|
-
/**
|
|
1425
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post.
|
|
1426
|
-
*
|
|
1427
|
-
* Supports both file uploads (multipart/form-data) and url-only attachments. Pass exactly one of `file` or `url`.
|
|
1428
|
-
*
|
|
1429
|
-
* @param context - The Trello API context.
|
|
1430
|
-
* @returns Adds an attachment (file or url) to a card.
|
|
1431
|
-
*/ function addAttachmentToCard(context) {
|
|
1432
|
-
return function(input) {
|
|
1433
|
-
return _async_to_generator$1(function() {
|
|
1434
|
-
var cardId, name, file, url, setCover, mimeType, formData, _file_mimeType, fileMimeType, blob, response;
|
|
1435
|
-
return _ts_generator$1(this, function(_state) {
|
|
1436
|
-
switch(_state.label){
|
|
1437
|
-
case 0:
|
|
1438
|
-
cardId = input.cardId, name = input.name, file = input.file, url = input.url, setCover = input.setCover, mimeType = input.mimeType;
|
|
1439
|
-
if (file && url || !file && !url) {
|
|
1440
|
-
throw new Error('addAttachmentToCard requires exactly one of `file` or `url`.');
|
|
1441
|
-
}
|
|
1442
|
-
formData = new FormData();
|
|
1443
|
-
if (name) {
|
|
1444
|
-
formData.append('name', name);
|
|
1445
|
-
}
|
|
1446
|
-
if (setCover !== undefined) {
|
|
1447
|
-
formData.append('setCover', setCover ? 'true' : 'false');
|
|
1448
|
-
}
|
|
1449
|
-
if (file) {
|
|
1450
|
-
fileMimeType = (_file_mimeType = file.mimeType) !== null && _file_mimeType !== void 0 ? _file_mimeType : 'application/octet-stream';
|
|
1451
|
-
blob = new Blob([
|
|
1452
|
-
file.content
|
|
1453
|
-
], {
|
|
1454
|
-
type: fileMimeType
|
|
1455
|
-
});
|
|
1456
|
-
formData.append('file', blob, file.fileName);
|
|
1457
|
-
} else if (url) {
|
|
1458
|
-
formData.append('url', url);
|
|
1459
|
-
if (mimeType) {
|
|
1460
|
-
formData.append('mimeType', mimeType);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
return [
|
|
1464
|
-
4,
|
|
1465
|
-
context.fetch("/cards/".concat(cardId, "/attachments"), {
|
|
1466
|
-
method: 'POST',
|
|
1467
|
-
body: formData,
|
|
1468
|
-
headers: {
|
|
1469
|
-
'Content-Type': ''
|
|
1470
|
-
}
|
|
1471
|
-
})
|
|
1472
|
-
];
|
|
1473
|
-
case 1:
|
|
1474
|
-
response = _state.sent();
|
|
1475
|
-
return [
|
|
1476
|
-
4,
|
|
1477
|
-
response.json()
|
|
1478
|
-
];
|
|
1479
|
-
case 2:
|
|
1480
|
-
return [
|
|
1481
|
-
2,
|
|
1482
|
-
_state.sent()
|
|
1483
|
-
];
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
})();
|
|
1487
|
-
};
|
|
1488
|
-
}
|
|
1489
|
-
/**
|
|
1490
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-idattachment-delete.
|
|
1491
|
-
*
|
|
1492
|
-
* @param context - The Trello API context.
|
|
1493
|
-
* @returns Removes an attachment from a card.
|
|
1494
|
-
*/ function deleteAttachmentFromCard(context) {
|
|
1495
|
-
return function(input) {
|
|
1496
|
-
return _async_to_generator$1(function() {
|
|
1497
|
-
return _ts_generator$1(this, function(_state) {
|
|
1498
|
-
switch(_state.label){
|
|
1499
|
-
case 0:
|
|
1500
|
-
return [
|
|
1501
|
-
4,
|
|
1502
|
-
context.fetchJson("/cards/".concat(input.cardId, "/attachments/").concat(input.attachmentId), 'DELETE')
|
|
1503
|
-
];
|
|
1504
|
-
case 1:
|
|
1505
|
-
_state.sent();
|
|
1506
|
-
return [
|
|
1507
|
-
2
|
|
1508
|
-
];
|
|
1509
|
-
}
|
|
1510
|
-
});
|
|
1511
|
-
})();
|
|
1512
|
-
};
|
|
1513
|
-
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Downloads the raw bytes of a card attachment via the authenticated Trello download endpoint:
|
|
1516
|
-
* `GET /cards/{id}/attachments/{idAttachment}/download/{filename}`.
|
|
1517
|
-
*
|
|
1518
|
-
* The configured Trello fetch automatically attaches the OAuth `Authorization` header required by Trello
|
|
1519
|
-
* for private file downloads.
|
|
1520
|
-
*
|
|
1521
|
-
* @param context - The Trello API context.
|
|
1522
|
-
* @returns Downloads the attachment bytes along with its metadata.
|
|
1523
|
-
*
|
|
1524
|
-
* @see https://developer.atlassian.com/cloud/trello/guides/rest-api/file-attachments/
|
|
1525
|
-
*/ function downloadCardAttachment(context) {
|
|
1526
|
-
var getAttachment = getCardAttachment(context);
|
|
1527
|
-
return function(input) {
|
|
1528
|
-
return _async_to_generator$1(function() {
|
|
1529
|
-
var _input_attachment, attachment, _tmp, fileName, response, mimeType;
|
|
1530
|
-
return _ts_generator$1(this, function(_state) {
|
|
1531
|
-
switch(_state.label){
|
|
1532
|
-
case 0:
|
|
1533
|
-
if (!((_input_attachment = input.attachment) !== null && _input_attachment !== void 0)) return [
|
|
1534
|
-
3,
|
|
1535
|
-
1
|
|
1536
|
-
];
|
|
1537
|
-
_tmp = _input_attachment;
|
|
1538
|
-
return [
|
|
1539
|
-
3,
|
|
1540
|
-
3
|
|
1541
|
-
];
|
|
1542
|
-
case 1:
|
|
1543
|
-
return [
|
|
1544
|
-
4,
|
|
1545
|
-
getAttachment({
|
|
1546
|
-
cardId: input.cardId,
|
|
1547
|
-
attachmentId: input.attachmentId
|
|
1548
|
-
})
|
|
1549
|
-
];
|
|
1550
|
-
case 2:
|
|
1551
|
-
_tmp = _state.sent();
|
|
1552
|
-
_state.label = 3;
|
|
1553
|
-
case 3:
|
|
1554
|
-
attachment = _tmp;
|
|
1555
|
-
fileName = attachment.fileName || attachment.name;
|
|
1556
|
-
return [
|
|
1557
|
-
4,
|
|
1558
|
-
context.fetch("/cards/".concat(input.cardId, "/attachments/").concat(input.attachmentId, "/download/").concat(encodeURIComponent(fileName)), {
|
|
1559
|
-
method: 'GET'
|
|
1560
|
-
})
|
|
1561
|
-
];
|
|
1562
|
-
case 4:
|
|
1563
|
-
response = _state.sent();
|
|
1564
|
-
mimeType = attachment.mimeType;
|
|
1565
|
-
return [
|
|
1566
|
-
2,
|
|
1567
|
-
{
|
|
1568
|
-
attachment: attachment,
|
|
1569
|
-
response: response,
|
|
1570
|
-
arrayBuffer: function arrayBuffer() {
|
|
1571
|
-
return response.arrayBuffer();
|
|
1572
|
-
},
|
|
1573
|
-
blob: function blob() {
|
|
1574
|
-
return _async_to_generator$1(function() {
|
|
1575
|
-
var buffer;
|
|
1576
|
-
return _ts_generator$1(this, function(_state) {
|
|
1577
|
-
switch(_state.label){
|
|
1578
|
-
case 0:
|
|
1579
|
-
return [
|
|
1580
|
-
4,
|
|
1581
|
-
response.arrayBuffer()
|
|
1582
|
-
];
|
|
1583
|
-
case 1:
|
|
1584
|
-
buffer = _state.sent();
|
|
1585
|
-
return [
|
|
1586
|
-
2,
|
|
1587
|
-
new Blob([
|
|
1588
|
-
buffer
|
|
1589
|
-
], mimeType ? {
|
|
1590
|
-
type: mimeType
|
|
1591
|
-
} : undefined)
|
|
1592
|
-
];
|
|
1593
|
-
}
|
|
1594
|
-
});
|
|
1595
|
-
})();
|
|
1596
|
-
},
|
|
1597
|
-
text: function text() {
|
|
1598
|
-
return response.text();
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
];
|
|
1602
|
-
}
|
|
1603
|
-
});
|
|
1604
|
-
})();
|
|
1605
|
-
};
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
/**
|
|
1609
|
-
* Https://developer.atlassian.com/cloud/trello/rest/api-group-members/#api-members-id-get.
|
|
1610
|
-
*
|
|
1611
|
-
* @param context - The Trello API context.
|
|
1612
|
-
* @returns Retrieves a member by id (or `me`).
|
|
1613
|
-
*/ function getMember(context) {
|
|
1614
|
-
return function(input) {
|
|
1615
|
-
return context.fetchJson("/members/".concat(input.memberId), 'GET');
|
|
1616
|
-
};
|
|
1617
|
-
}
|
|
1618
|
-
/**
|
|
1619
|
-
* Convenience wrapper around `getMember({ memberId: 'me' })`.
|
|
1620
|
-
*
|
|
1621
|
-
* @param context - The Trello API context.
|
|
1622
|
-
* @returns Retrieves the authenticated user.
|
|
1623
|
-
*/ function getMe(context) {
|
|
1624
|
-
return function() {
|
|
1625
|
-
return context.fetchJson("/members/me", 'GET');
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1630
|
-
try {
|
|
1631
|
-
var info = gen[key](arg);
|
|
1632
|
-
var value = info.value;
|
|
1633
|
-
} catch (error) {
|
|
1634
|
-
reject(error);
|
|
1635
|
-
return;
|
|
1636
|
-
}
|
|
1637
|
-
if (info.done) {
|
|
1638
|
-
resolve(value);
|
|
1639
|
-
} else {
|
|
1640
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
function _async_to_generator(fn) {
|
|
1644
|
-
return function() {
|
|
1645
|
-
var self = this, args = arguments;
|
|
1646
|
-
return new Promise(function(resolve, reject) {
|
|
1647
|
-
var gen = fn.apply(self, args);
|
|
1648
|
-
function _next(value) {
|
|
1649
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1650
|
-
}
|
|
1651
|
-
function _throw(err) {
|
|
1652
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1653
|
-
}
|
|
1654
|
-
_next(undefined);
|
|
1655
|
-
});
|
|
1656
|
-
};
|
|
1657
|
-
}
|
|
1658
|
-
function _object_without_properties(source, excluded) {
|
|
1659
|
-
if (source == null) return {};
|
|
1660
|
-
var target = {}, sourceKeys, key, i;
|
|
1661
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
1662
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
1663
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
1664
|
-
key = sourceKeys[i];
|
|
1665
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1666
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1667
|
-
target[key] = source[key];
|
|
1668
|
-
}
|
|
1669
|
-
return target;
|
|
1670
|
-
}
|
|
1671
|
-
target = _object_without_properties_loose(source, excluded);
|
|
1672
|
-
if (Object.getOwnPropertySymbols) {
|
|
1673
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
1674
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
1675
|
-
key = sourceKeys[i];
|
|
1676
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1677
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1678
|
-
target[key] = source[key];
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
return target;
|
|
1682
|
-
}
|
|
1683
|
-
function _object_without_properties_loose(source, excluded) {
|
|
1684
|
-
if (source == null) return {};
|
|
1685
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
1686
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
1687
|
-
key = sourceKeys[i];
|
|
1688
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1689
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1690
|
-
target[key] = source[key];
|
|
1691
|
-
}
|
|
1692
|
-
return target;
|
|
1693
|
-
}
|
|
1694
|
-
function _ts_generator(thisArg, body) {
|
|
1695
|
-
var f, y, t, _ = {
|
|
1696
|
-
label: 0,
|
|
1697
|
-
sent: function() {
|
|
1698
|
-
if (t[0] & 1) throw t[1];
|
|
1699
|
-
return t[1];
|
|
1700
|
-
},
|
|
1701
|
-
trys: [],
|
|
1702
|
-
ops: []
|
|
1703
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
1704
|
-
return d(g, "next", {
|
|
1705
|
-
value: verb(0)
|
|
1706
|
-
}), d(g, "throw", {
|
|
1707
|
-
value: verb(1)
|
|
1708
|
-
}), d(g, "return", {
|
|
1709
|
-
value: verb(2)
|
|
1710
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
1711
|
-
value: function() {
|
|
1712
|
-
return this;
|
|
1713
|
-
}
|
|
1714
|
-
}), g;
|
|
1715
|
-
function verb(n) {
|
|
1716
|
-
return function(v) {
|
|
1717
|
-
return step([
|
|
1718
|
-
n,
|
|
1719
|
-
v
|
|
1720
|
-
]);
|
|
1721
|
-
};
|
|
1722
|
-
}
|
|
1723
|
-
function step(op) {
|
|
1724
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1725
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
1726
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1727
|
-
if (y = 0, t) op = [
|
|
1728
|
-
op[0] & 2,
|
|
1729
|
-
t.value
|
|
1730
|
-
];
|
|
1731
|
-
switch(op[0]){
|
|
1732
|
-
case 0:
|
|
1733
|
-
case 1:
|
|
1734
|
-
t = op;
|
|
1735
|
-
break;
|
|
1736
|
-
case 4:
|
|
1737
|
-
_.label++;
|
|
1738
|
-
return {
|
|
1739
|
-
value: op[1],
|
|
1740
|
-
done: false
|
|
1741
|
-
};
|
|
1742
|
-
case 5:
|
|
1743
|
-
_.label++;
|
|
1744
|
-
y = op[1];
|
|
1745
|
-
op = [
|
|
1746
|
-
0
|
|
1747
|
-
];
|
|
1748
|
-
continue;
|
|
1749
|
-
case 7:
|
|
1750
|
-
op = _.ops.pop();
|
|
1751
|
-
_.trys.pop();
|
|
1752
|
-
continue;
|
|
1753
|
-
default:
|
|
1754
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1755
|
-
_ = 0;
|
|
1756
|
-
continue;
|
|
1757
|
-
}
|
|
1758
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1759
|
-
_.label = op[1];
|
|
1760
|
-
break;
|
|
1761
|
-
}
|
|
1762
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1763
|
-
_.label = t[1];
|
|
1764
|
-
t = op;
|
|
1765
|
-
break;
|
|
1766
|
-
}
|
|
1767
|
-
if (t && _.label < t[2]) {
|
|
1768
|
-
_.label = t[2];
|
|
1769
|
-
_.ops.push(op);
|
|
1770
|
-
break;
|
|
1771
|
-
}
|
|
1772
|
-
if (t[2]) _.ops.pop();
|
|
1773
|
-
_.trys.pop();
|
|
1774
|
-
continue;
|
|
1775
|
-
}
|
|
1776
|
-
op = body.call(thisArg, _);
|
|
1777
|
-
} catch (e) {
|
|
1778
|
-
op = [
|
|
1779
|
-
6,
|
|
1780
|
-
e
|
|
1781
|
-
];
|
|
1782
|
-
y = 0;
|
|
1783
|
-
} finally{
|
|
1784
|
-
f = t = 0;
|
|
1785
|
-
}
|
|
1786
|
-
if (op[0] & 5) throw op[1];
|
|
1787
|
-
return {
|
|
1788
|
-
value: op[0] ? op[1] : void 0,
|
|
1789
|
-
done: true
|
|
1790
|
-
};
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Trello validates the callback URL with a HEAD request before creation. The endpoint MUST return 200.
|
|
1795
|
-
*
|
|
1796
|
-
* https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#creating-a-webhook
|
|
1797
|
-
*
|
|
1798
|
-
* @param context - The Trello API context.
|
|
1799
|
-
* @returns Registers a new webhook.
|
|
1800
|
-
*/ function createWebhook(context) {
|
|
1801
|
-
return function(input) {
|
|
1802
|
-
var queryString = fetch.makeUrlSearchParams(input);
|
|
1803
|
-
return context.fetchJson("/webhooks?".concat(queryString), 'POST');
|
|
1804
|
-
};
|
|
1805
|
-
}
|
|
1806
|
-
/**
|
|
1807
|
-
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#retrieving-a-webhook.
|
|
1808
|
-
*
|
|
1809
|
-
* @param context - The Trello API context.
|
|
1810
|
-
* @returns Retrieves a webhook by id.
|
|
1811
|
-
*/ function getWebhook(context) {
|
|
1812
|
-
return function(input) {
|
|
1813
|
-
return context.fetchJson("/webhooks/".concat(input.webhookId), 'GET');
|
|
1814
|
-
};
|
|
1815
|
-
}
|
|
1816
|
-
/**
|
|
1817
|
-
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#updating-a-webhook.
|
|
1818
|
-
*
|
|
1819
|
-
* @param context - The Trello API context.
|
|
1820
|
-
* @returns Updates an existing webhook.
|
|
1821
|
-
*/ function updateWebhook(context) {
|
|
1822
|
-
return function(input) {
|
|
1823
|
-
var webhookId = input.webhookId, body = _object_without_properties(input, [
|
|
1824
|
-
"webhookId"
|
|
1825
|
-
]);
|
|
1826
|
-
return context.fetchJson("/webhooks/".concat(webhookId), 'PUT', body);
|
|
1827
|
-
};
|
|
1828
|
-
}
|
|
1829
|
-
/**
|
|
1830
|
-
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#deleting-a-webhook.
|
|
1831
|
-
*
|
|
1832
|
-
* @param context - The Trello API context.
|
|
1833
|
-
* @returns Deletes a webhook.
|
|
1834
|
-
*/ function deleteWebhook(context) {
|
|
1835
|
-
return function(input) {
|
|
1836
|
-
return _async_to_generator(function() {
|
|
1837
|
-
return _ts_generator(this, function(_state) {
|
|
1838
|
-
switch(_state.label){
|
|
1839
|
-
case 0:
|
|
1840
|
-
return [
|
|
1841
|
-
4,
|
|
1842
|
-
context.fetchJson("/webhooks/".concat(input.webhookId), 'DELETE')
|
|
1843
|
-
];
|
|
1844
|
-
case 1:
|
|
1845
|
-
_state.sent();
|
|
1846
|
-
return [
|
|
1847
|
-
2
|
|
1848
|
-
];
|
|
1849
|
-
}
|
|
1850
|
-
});
|
|
1851
|
-
})();
|
|
1852
|
-
};
|
|
1853
|
-
}
|
|
1854
|
-
/**
|
|
1855
|
-
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/.
|
|
1856
|
-
*
|
|
1857
|
-
* @param context - The Trello API context.
|
|
1858
|
-
* @returns Lists all webhooks registered for a token.
|
|
1859
|
-
*/ function listWebhooksForToken(context) {
|
|
1860
|
-
return function(input) {
|
|
1861
|
-
var _ref;
|
|
1862
|
-
var token = (_ref = input === null || input === void 0 ? void 0 : input.apiToken) !== null && _ref !== void 0 ? _ref : context.config.apiToken;
|
|
1863
|
-
return context.fetchJson("/tokens/".concat(token, "/webhooks"), 'GET');
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
function _define_property(obj, key, value) {
|
|
1868
|
-
if (key in obj) {
|
|
1869
|
-
Object.defineProperty(obj, key, {
|
|
1870
|
-
value: value,
|
|
1871
|
-
enumerable: true,
|
|
1872
|
-
configurable: true,
|
|
1873
|
-
writable: true
|
|
1874
|
-
});
|
|
1875
|
-
} else {
|
|
1876
|
-
obj[key] = value;
|
|
1877
|
-
}
|
|
1878
|
-
return obj;
|
|
1879
|
-
}
|
|
1880
|
-
function _object_spread(target) {
|
|
1881
|
-
for(var i = 1; i < arguments.length; i++){
|
|
1882
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
1883
|
-
var ownKeys = Object.keys(source);
|
|
1884
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1885
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1886
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1887
|
-
}));
|
|
1888
|
-
}
|
|
1889
|
-
ownKeys.forEach(function(key) {
|
|
1890
|
-
_define_property(target, key, source[key]);
|
|
1891
|
-
});
|
|
1892
|
-
}
|
|
1893
|
-
return target;
|
|
1894
|
-
}
|
|
1895
|
-
function ownKeys(object, enumerableOnly) {
|
|
1896
|
-
var keys = Object.keys(object);
|
|
1897
|
-
if (Object.getOwnPropertySymbols) {
|
|
1898
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1899
|
-
keys.push.apply(keys, symbols);
|
|
1900
|
-
}
|
|
1901
|
-
return keys;
|
|
1902
|
-
}
|
|
1903
|
-
function _object_spread_props(target, source) {
|
|
1904
|
-
source = source != null ? source : {};
|
|
1905
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
1906
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1907
|
-
} else {
|
|
1908
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
1909
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
return target;
|
|
1913
|
-
}
|
|
1914
|
-
/**
|
|
1915
|
-
* Maximum allowed `limit` value for most Trello collection endpoints.
|
|
1916
|
-
*
|
|
1917
|
-
* @see https://developer.atlassian.com/cloud/trello/rest/
|
|
1918
|
-
*/ var TRELLO_MAX_PAGE_LIMIT = 1000;
|
|
1919
|
-
/**
|
|
1920
|
-
* Default reader that pulls `id` off the item. Works for most Trello resource types.
|
|
1921
|
-
*
|
|
1922
|
-
* @param item - The page item whose id to read.
|
|
1923
|
-
* @returns The item's id.
|
|
1924
|
-
*/ var defaultTrelloPageItemIdReader = function defaultTrelloPageItemIdReader(item) {
|
|
1925
|
-
return item.id;
|
|
1926
|
-
};
|
|
1927
|
-
/**
|
|
1928
|
-
* Reader that pulls the action id off a Trello action item.
|
|
1929
|
-
*
|
|
1930
|
-
* @param item - The action page item whose id to read.
|
|
1931
|
-
* @returns The item's action id.
|
|
1932
|
-
*/ var trelloActionIdReader = function trelloActionIdReader(item) {
|
|
1933
|
-
return item.id;
|
|
1934
|
-
};
|
|
1935
|
-
/**
|
|
1936
|
-
* Wraps a raw Trello collection fetch into a {@link TrelloPageResult}.
|
|
1937
|
-
*
|
|
1938
|
-
* @param input - The page filter that was used.
|
|
1939
|
-
* @param data - The raw page items.
|
|
1940
|
-
* @param idReader - Function to read the id from the last item.
|
|
1941
|
-
* @returns A page result with the data and a cursor for the next page.
|
|
1942
|
-
*
|
|
1943
|
-
* @__NO_SIDE_EFFECTS__
|
|
1944
|
-
*/ function buildTrelloPageResult(input, data, idReader) {
|
|
1945
|
-
var _input_limit;
|
|
1946
|
-
var limit = (_input_limit = input.limit) !== null && _input_limit !== void 0 ? _input_limit : data.length;
|
|
1947
|
-
var hasMore = data.length === limit && data.length > 0;
|
|
1948
|
-
var lastItem = hasMore ? data.at(-1) : undefined;
|
|
1949
|
-
var nextBefore = lastItem === undefined ? undefined : idReader(lastItem);
|
|
1950
|
-
return {
|
|
1951
|
-
data: data,
|
|
1952
|
-
limit: limit,
|
|
1953
|
-
nextBefore: nextBefore
|
|
1954
|
-
};
|
|
1955
|
-
}
|
|
1956
|
-
/**
|
|
1957
|
-
* Creates a FetchPageFactory using the input TrelloFetchPageFetchFunction.
|
|
1958
|
-
*
|
|
1959
|
-
* @param fetch - Function that fetches a single page of results from the Trello API.
|
|
1960
|
-
* @param defaults - Optional default pagination configuration.
|
|
1961
|
-
* @returns A configured FetchPageFactory that handles Trello's cursor-based pagination using `before`.
|
|
1962
|
-
*
|
|
1963
|
-
* @__NO_SIDE_EFFECTS__
|
|
1964
|
-
*/ function trelloFetchPageFactory(fetch$1, defaults) {
|
|
1965
|
-
return fetch.fetchPageFactory(_object_spread_props(_object_spread({}, defaults), {
|
|
1966
|
-
fetch: fetch$1,
|
|
1967
|
-
readFetchPageResultInfo: function readFetchPageResultInfo(result) {
|
|
1968
|
-
return {
|
|
1969
|
-
nextPageCursor: result.nextBefore,
|
|
1970
|
-
hasNext: Boolean(result.nextBefore)
|
|
1971
|
-
};
|
|
1972
|
-
},
|
|
1973
|
-
buildInputForNextPage: function buildInputForNextPage(pageResult, input, options) {
|
|
1974
|
-
var _options_maxItemsPerPage;
|
|
1975
|
-
return _object_spread_props(_object_spread({}, input), {
|
|
1976
|
-
before: pageResult.nextPageCursor,
|
|
1977
|
-
limit: (_options_maxItemsPerPage = options.maxItemsPerPage) !== null && _options_maxItemsPerPage !== void 0 ? _options_maxItemsPerPage : input.limit
|
|
1978
|
-
});
|
|
1979
|
-
}
|
|
1980
|
-
}));
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
exports.DEFAULT_TRELLO_API_RATE_LIMIT = DEFAULT_TRELLO_API_RATE_LIMIT;
|
|
1984
|
-
exports.DEFAULT_TRELLO_API_RATE_LIMIT_RESET_PERIOD = DEFAULT_TRELLO_API_RATE_LIMIT_RESET_PERIOD;
|
|
1985
|
-
exports.TRELLO_API_URL = TRELLO_API_URL;
|
|
1986
|
-
exports.TRELLO_MAX_PAGE_LIMIT = TRELLO_MAX_PAGE_LIMIT;
|
|
1987
|
-
exports.TrelloInvalidTokenError = TrelloInvalidTokenError;
|
|
1988
|
-
exports.TrelloServerError = TrelloServerError;
|
|
1989
|
-
exports.TrelloServerFetchResponseError = TrelloServerFetchResponseError;
|
|
1990
|
-
exports.TrelloTooManyRequestsError = TrelloTooManyRequestsError;
|
|
1991
|
-
exports.addAttachmentToCard = addAttachmentToCard;
|
|
1992
|
-
exports.addCommentToCard = addCommentToCard;
|
|
1993
|
-
exports.addLabelToCard = addLabelToCard;
|
|
1994
|
-
exports.addMemberToCard = addMemberToCard;
|
|
1995
|
-
exports.buildTrelloPageResult = buildTrelloPageResult;
|
|
1996
|
-
exports.createBoard = createBoard;
|
|
1997
|
-
exports.createCard = createCard;
|
|
1998
|
-
exports.createList = createList;
|
|
1999
|
-
exports.createWebhook = createWebhook;
|
|
2000
|
-
exports.defaultTrelloPageItemIdReader = defaultTrelloPageItemIdReader;
|
|
2001
|
-
exports.deleteAttachmentFromCard = deleteAttachmentFromCard;
|
|
2002
|
-
exports.deleteBoard = deleteBoard;
|
|
2003
|
-
exports.deleteCard = deleteCard;
|
|
2004
|
-
exports.deleteWebhook = deleteWebhook;
|
|
2005
|
-
exports.downloadCardAttachment = downloadCardAttachment;
|
|
2006
|
-
exports.getBoard = getBoard;
|
|
2007
|
-
exports.getCard = getCard;
|
|
2008
|
-
exports.getCardAttachment = getCardAttachment;
|
|
2009
|
-
exports.getList = getList;
|
|
2010
|
-
exports.getMe = getMe;
|
|
2011
|
-
exports.getMember = getMember;
|
|
2012
|
-
exports.getWebhook = getWebhook;
|
|
2013
|
-
exports.handleTrelloErrorFetch = handleTrelloErrorFetch;
|
|
2014
|
-
exports.listBoardActions = listBoardActions;
|
|
2015
|
-
exports.listBoardCards = listBoardCards;
|
|
2016
|
-
exports.listBoardLabels = listBoardLabels;
|
|
2017
|
-
exports.listBoardLists = listBoardLists;
|
|
2018
|
-
exports.listBoardMembers = listBoardMembers;
|
|
2019
|
-
exports.listCardActions = listCardActions;
|
|
2020
|
-
exports.listCardAttachments = listCardAttachments;
|
|
2021
|
-
exports.listCardsInList = listCardsInList;
|
|
2022
|
-
exports.listWebhooksForToken = listWebhooksForToken;
|
|
2023
|
-
exports.logTrelloErrorToConsole = logTrelloErrorToConsole;
|
|
2024
|
-
exports.logTrelloServerErrorFunction = logTrelloServerErrorFunction;
|
|
2025
|
-
exports.parseTrelloApiError = parseTrelloApiError;
|
|
2026
|
-
exports.trelloActionIdReader = trelloActionIdReader;
|
|
2027
|
-
exports.trelloFactory = trelloFactory;
|
|
2028
|
-
exports.trelloFetchPageFactory = trelloFetchPageFactory;
|
|
2029
|
-
exports.trelloRateLimitedFetchHandler = trelloRateLimitedFetchHandler;
|
|
2030
|
-
exports.updateBoard = updateBoard;
|
|
2031
|
-
exports.updateCard = updateCard;
|
|
2032
|
-
exports.updateList = updateList;
|
|
2033
|
-
exports.updateWebhook = updateWebhook;
|