@thescaffold/jsx-blobs 0.0.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/README.md +159 -0
- package/common/init/config.d.ts +2 -0
- package/common/init/index.d.ts +2 -0
- package/common/queue/index.d.ts +4 -0
- package/common/utils/functions.d.ts +15 -0
- package/common/utils/values.d.ts +109 -0
- package/files/index.d.ts +10 -0
- package/index.d.ts +9 -0
- package/index.js +8 -0
- package/jsx-blobs.cjs.development.js +1408 -0
- package/jsx-blobs.cjs.development.js.map +1 -0
- package/jsx-blobs.cjs.production.min.js +2 -0
- package/jsx-blobs.cjs.production.min.js.map +1 -0
- package/jsx-blobs.esm.js +1392 -0
- package/jsx-blobs.esm.js.map +1 -0
- package/package.json +16 -0
- package/platform/base-entity-service.service.d.ts +13 -0
- package/platform/base-service.service.d.ts +9 -0
- package/platform/index.d.ts +2 -0
- package/request/batch.d.ts +1 -0
- package/request/index.d.ts +2 -0
- package/request/methods.d.ts +8 -0
|
@@ -0,0 +1,1408 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _asyncIterator(r) {
|
|
4
|
+
var n,
|
|
5
|
+
t,
|
|
6
|
+
o,
|
|
7
|
+
e = 2;
|
|
8
|
+
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
|
9
|
+
if (t && null != (n = r[t])) return n.call(r);
|
|
10
|
+
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
|
|
11
|
+
t = "@@asyncIterator", o = "@@iterator";
|
|
12
|
+
}
|
|
13
|
+
throw new TypeError("Object is not async iterable");
|
|
14
|
+
}
|
|
15
|
+
function AsyncFromSyncIterator(r) {
|
|
16
|
+
function AsyncFromSyncIteratorContinuation(r) {
|
|
17
|
+
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
|
|
18
|
+
var n = r.done;
|
|
19
|
+
return Promise.resolve(r.value).then(function (r) {
|
|
20
|
+
return {
|
|
21
|
+
value: r,
|
|
22
|
+
done: n
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return AsyncFromSyncIterator = function (r) {
|
|
27
|
+
this.s = r, this.n = r.next;
|
|
28
|
+
}, AsyncFromSyncIterator.prototype = {
|
|
29
|
+
s: null,
|
|
30
|
+
n: null,
|
|
31
|
+
next: function () {
|
|
32
|
+
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
|
33
|
+
},
|
|
34
|
+
return: function (r) {
|
|
35
|
+
var n = this.s.return;
|
|
36
|
+
return void 0 === n ? Promise.resolve({
|
|
37
|
+
value: r,
|
|
38
|
+
done: !0
|
|
39
|
+
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
40
|
+
},
|
|
41
|
+
throw: function (r) {
|
|
42
|
+
var n = this.s.return;
|
|
43
|
+
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
44
|
+
}
|
|
45
|
+
}, new AsyncFromSyncIterator(r);
|
|
46
|
+
}
|
|
47
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
48
|
+
try {
|
|
49
|
+
var i = n[a](c),
|
|
50
|
+
u = i.value;
|
|
51
|
+
} catch (n) {
|
|
52
|
+
return void e(n);
|
|
53
|
+
}
|
|
54
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
55
|
+
}
|
|
56
|
+
function _asyncToGenerator(n) {
|
|
57
|
+
return function () {
|
|
58
|
+
var t = this,
|
|
59
|
+
e = arguments;
|
|
60
|
+
return new Promise(function (r, o) {
|
|
61
|
+
var a = n.apply(t, e);
|
|
62
|
+
function _next(n) {
|
|
63
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
64
|
+
}
|
|
65
|
+
function _throw(n) {
|
|
66
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
67
|
+
}
|
|
68
|
+
_next(void 0);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function _extends() {
|
|
73
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
74
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
75
|
+
var t = arguments[e];
|
|
76
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
77
|
+
}
|
|
78
|
+
return n;
|
|
79
|
+
}, _extends.apply(null, arguments);
|
|
80
|
+
}
|
|
81
|
+
function _inheritsLoose(t, o) {
|
|
82
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
83
|
+
}
|
|
84
|
+
function _regeneratorRuntime() {
|
|
85
|
+
_regeneratorRuntime = function () {
|
|
86
|
+
return e;
|
|
87
|
+
};
|
|
88
|
+
var t,
|
|
89
|
+
e = {},
|
|
90
|
+
r = Object.prototype,
|
|
91
|
+
n = r.hasOwnProperty,
|
|
92
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
93
|
+
t[e] = r.value;
|
|
94
|
+
},
|
|
95
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
96
|
+
a = i.iterator || "@@iterator",
|
|
97
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
98
|
+
u = i.toStringTag || "@@toStringTag";
|
|
99
|
+
function define(t, e, r) {
|
|
100
|
+
return Object.defineProperty(t, e, {
|
|
101
|
+
value: r,
|
|
102
|
+
enumerable: !0,
|
|
103
|
+
configurable: !0,
|
|
104
|
+
writable: !0
|
|
105
|
+
}), t[e];
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
define({}, "");
|
|
109
|
+
} catch (t) {
|
|
110
|
+
define = function (t, e, r) {
|
|
111
|
+
return t[e] = r;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function wrap(t, e, r, n) {
|
|
115
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
116
|
+
a = Object.create(i.prototype),
|
|
117
|
+
c = new Context(n || []);
|
|
118
|
+
return o(a, "_invoke", {
|
|
119
|
+
value: makeInvokeMethod(t, r, c)
|
|
120
|
+
}), a;
|
|
121
|
+
}
|
|
122
|
+
function tryCatch(t, e, r) {
|
|
123
|
+
try {
|
|
124
|
+
return {
|
|
125
|
+
type: "normal",
|
|
126
|
+
arg: t.call(e, r)
|
|
127
|
+
};
|
|
128
|
+
} catch (t) {
|
|
129
|
+
return {
|
|
130
|
+
type: "throw",
|
|
131
|
+
arg: t
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
e.wrap = wrap;
|
|
136
|
+
var h = "suspendedStart",
|
|
137
|
+
l = "suspendedYield",
|
|
138
|
+
f = "executing",
|
|
139
|
+
s = "completed",
|
|
140
|
+
y = {};
|
|
141
|
+
function Generator() {}
|
|
142
|
+
function GeneratorFunction() {}
|
|
143
|
+
function GeneratorFunctionPrototype() {}
|
|
144
|
+
var p = {};
|
|
145
|
+
define(p, a, function () {
|
|
146
|
+
return this;
|
|
147
|
+
});
|
|
148
|
+
var d = Object.getPrototypeOf,
|
|
149
|
+
v = d && d(d(values([])));
|
|
150
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
151
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
152
|
+
function defineIteratorMethods(t) {
|
|
153
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
154
|
+
define(t, e, function (t) {
|
|
155
|
+
return this._invoke(e, t);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function AsyncIterator(t, e) {
|
|
160
|
+
function invoke(r, o, i, a) {
|
|
161
|
+
var c = tryCatch(t[r], t, o);
|
|
162
|
+
if ("throw" !== c.type) {
|
|
163
|
+
var u = c.arg,
|
|
164
|
+
h = u.value;
|
|
165
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
166
|
+
invoke("next", t, i, a);
|
|
167
|
+
}, function (t) {
|
|
168
|
+
invoke("throw", t, i, a);
|
|
169
|
+
}) : e.resolve(h).then(function (t) {
|
|
170
|
+
u.value = t, i(u);
|
|
171
|
+
}, function (t) {
|
|
172
|
+
return invoke("throw", t, i, a);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
a(c.arg);
|
|
176
|
+
}
|
|
177
|
+
var r;
|
|
178
|
+
o(this, "_invoke", {
|
|
179
|
+
value: function (t, n) {
|
|
180
|
+
function callInvokeWithMethodAndArg() {
|
|
181
|
+
return new e(function (e, r) {
|
|
182
|
+
invoke(t, n, e, r);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function makeInvokeMethod(e, r, n) {
|
|
190
|
+
var o = h;
|
|
191
|
+
return function (i, a) {
|
|
192
|
+
if (o === f) throw Error("Generator is already running");
|
|
193
|
+
if (o === s) {
|
|
194
|
+
if ("throw" === i) throw a;
|
|
195
|
+
return {
|
|
196
|
+
value: t,
|
|
197
|
+
done: !0
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
for (n.method = i, n.arg = a;;) {
|
|
201
|
+
var c = n.delegate;
|
|
202
|
+
if (c) {
|
|
203
|
+
var u = maybeInvokeDelegate(c, n);
|
|
204
|
+
if (u) {
|
|
205
|
+
if (u === y) continue;
|
|
206
|
+
return u;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
210
|
+
if (o === h) throw o = s, n.arg;
|
|
211
|
+
n.dispatchException(n.arg);
|
|
212
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
213
|
+
o = f;
|
|
214
|
+
var p = tryCatch(e, r, n);
|
|
215
|
+
if ("normal" === p.type) {
|
|
216
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
217
|
+
return {
|
|
218
|
+
value: p.arg,
|
|
219
|
+
done: n.done
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function maybeInvokeDelegate(e, r) {
|
|
227
|
+
var n = r.method,
|
|
228
|
+
o = e.iterator[n];
|
|
229
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
230
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
231
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
232
|
+
var a = i.arg;
|
|
233
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
234
|
+
}
|
|
235
|
+
function pushTryEntry(t) {
|
|
236
|
+
var e = {
|
|
237
|
+
tryLoc: t[0]
|
|
238
|
+
};
|
|
239
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
240
|
+
}
|
|
241
|
+
function resetTryEntry(t) {
|
|
242
|
+
var e = t.completion || {};
|
|
243
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
244
|
+
}
|
|
245
|
+
function Context(t) {
|
|
246
|
+
this.tryEntries = [{
|
|
247
|
+
tryLoc: "root"
|
|
248
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
249
|
+
}
|
|
250
|
+
function values(e) {
|
|
251
|
+
if (e || "" === e) {
|
|
252
|
+
var r = e[a];
|
|
253
|
+
if (r) return r.call(e);
|
|
254
|
+
if ("function" == typeof e.next) return e;
|
|
255
|
+
if (!isNaN(e.length)) {
|
|
256
|
+
var o = -1,
|
|
257
|
+
i = function next() {
|
|
258
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
259
|
+
return next.value = t, next.done = !0, next;
|
|
260
|
+
};
|
|
261
|
+
return i.next = i;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
265
|
+
}
|
|
266
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
267
|
+
value: GeneratorFunctionPrototype,
|
|
268
|
+
configurable: !0
|
|
269
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
270
|
+
value: GeneratorFunction,
|
|
271
|
+
configurable: !0
|
|
272
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
273
|
+
var e = "function" == typeof t && t.constructor;
|
|
274
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
275
|
+
}, e.mark = function (t) {
|
|
276
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
277
|
+
}, e.awrap = function (t) {
|
|
278
|
+
return {
|
|
279
|
+
__await: t
|
|
280
|
+
};
|
|
281
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
282
|
+
return this;
|
|
283
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
284
|
+
void 0 === i && (i = Promise);
|
|
285
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
286
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
287
|
+
return t.done ? t.value : a.next();
|
|
288
|
+
});
|
|
289
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
290
|
+
return this;
|
|
291
|
+
}), define(g, "toString", function () {
|
|
292
|
+
return "[object Generator]";
|
|
293
|
+
}), e.keys = function (t) {
|
|
294
|
+
var e = Object(t),
|
|
295
|
+
r = [];
|
|
296
|
+
for (var n in e) r.push(n);
|
|
297
|
+
return r.reverse(), function next() {
|
|
298
|
+
for (; r.length;) {
|
|
299
|
+
var t = r.pop();
|
|
300
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
301
|
+
}
|
|
302
|
+
return next.done = !0, next;
|
|
303
|
+
};
|
|
304
|
+
}, e.values = values, Context.prototype = {
|
|
305
|
+
constructor: Context,
|
|
306
|
+
reset: function (e) {
|
|
307
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
308
|
+
},
|
|
309
|
+
stop: function () {
|
|
310
|
+
this.done = !0;
|
|
311
|
+
var t = this.tryEntries[0].completion;
|
|
312
|
+
if ("throw" === t.type) throw t.arg;
|
|
313
|
+
return this.rval;
|
|
314
|
+
},
|
|
315
|
+
dispatchException: function (e) {
|
|
316
|
+
if (this.done) throw e;
|
|
317
|
+
var r = this;
|
|
318
|
+
function handle(n, o) {
|
|
319
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
320
|
+
}
|
|
321
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
322
|
+
var i = this.tryEntries[o],
|
|
323
|
+
a = i.completion;
|
|
324
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
325
|
+
if (i.tryLoc <= this.prev) {
|
|
326
|
+
var c = n.call(i, "catchLoc"),
|
|
327
|
+
u = n.call(i, "finallyLoc");
|
|
328
|
+
if (c && u) {
|
|
329
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
330
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
331
|
+
} else if (c) {
|
|
332
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
333
|
+
} else {
|
|
334
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
335
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
abrupt: function (t, e) {
|
|
341
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
342
|
+
var o = this.tryEntries[r];
|
|
343
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
344
|
+
var i = o;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
349
|
+
var a = i ? i.completion : {};
|
|
350
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
351
|
+
},
|
|
352
|
+
complete: function (t, e) {
|
|
353
|
+
if ("throw" === t.type) throw t.arg;
|
|
354
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
355
|
+
},
|
|
356
|
+
finish: function (t) {
|
|
357
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
358
|
+
var r = this.tryEntries[e];
|
|
359
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
catch: function (t) {
|
|
363
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
364
|
+
var r = this.tryEntries[e];
|
|
365
|
+
if (r.tryLoc === t) {
|
|
366
|
+
var n = r.completion;
|
|
367
|
+
if ("throw" === n.type) {
|
|
368
|
+
var o = n.arg;
|
|
369
|
+
resetTryEntry(r);
|
|
370
|
+
}
|
|
371
|
+
return o;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
throw Error("illegal catch attempt");
|
|
375
|
+
},
|
|
376
|
+
delegateYield: function (e, r, n) {
|
|
377
|
+
return this.delegate = {
|
|
378
|
+
iterator: values(e),
|
|
379
|
+
resultName: r,
|
|
380
|
+
nextLoc: n
|
|
381
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
382
|
+
}
|
|
383
|
+
}, e;
|
|
384
|
+
}
|
|
385
|
+
function _setPrototypeOf(t, e) {
|
|
386
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
387
|
+
return t.__proto__ = e, t;
|
|
388
|
+
}, _setPrototypeOf(t, e);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
var config = {
|
|
392
|
+
server: '',
|
|
393
|
+
credential: '',
|
|
394
|
+
sourceId: ''
|
|
395
|
+
};
|
|
396
|
+
var getConfig = function getConfig() {
|
|
397
|
+
return config;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
exports.CategoryType = void 0;
|
|
401
|
+
(function (CategoryType) {
|
|
402
|
+
CategoryType["Form"] = "form";
|
|
403
|
+
CategoryType["File"] = "file";
|
|
404
|
+
CategoryType["Webhook"] = "webhook";
|
|
405
|
+
CategoryType["Job"] = "job";
|
|
406
|
+
CategoryType["Event"] = "event";
|
|
407
|
+
CategoryType["Log"] = "log";
|
|
408
|
+
CategoryType["Motion"] = "motion";
|
|
409
|
+
CategoryType["Message"] = "message";
|
|
410
|
+
CategoryType["Others"] = "others";
|
|
411
|
+
})(exports.CategoryType || (exports.CategoryType = {}));
|
|
412
|
+
exports.LogType = void 0;
|
|
413
|
+
(function (LogType) {
|
|
414
|
+
LogType["INFO"] = "info";
|
|
415
|
+
LogType["WARN"] = "warn";
|
|
416
|
+
LogType["ERROR"] = "error";
|
|
417
|
+
})(exports.LogType || (exports.LogType = {}));
|
|
418
|
+
var mimeMap = {
|
|
419
|
+
// --- Text & Documents ---
|
|
420
|
+
txt: 'text/plain',
|
|
421
|
+
csv: 'text/csv',
|
|
422
|
+
html: 'text/html',
|
|
423
|
+
htm: 'text/html',
|
|
424
|
+
css: 'text/css',
|
|
425
|
+
js: 'application/javascript',
|
|
426
|
+
json: 'application/json',
|
|
427
|
+
xml: 'application/xml',
|
|
428
|
+
md: 'text/markdown',
|
|
429
|
+
yaml: 'application/x-yaml',
|
|
430
|
+
yml: 'application/x-yaml',
|
|
431
|
+
pdf: 'application/pdf',
|
|
432
|
+
rtf: 'application/rtf',
|
|
433
|
+
doc: 'application/msword',
|
|
434
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
435
|
+
xls: 'application/vnd.ms-excel',
|
|
436
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
437
|
+
ppt: 'application/vnd.ms-powerpoint',
|
|
438
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
439
|
+
// --- Images ---
|
|
440
|
+
jpg: 'image/jpeg',
|
|
441
|
+
jpeg: 'image/jpeg',
|
|
442
|
+
png: 'image/png',
|
|
443
|
+
gif: 'image/gif',
|
|
444
|
+
svg: 'image/svg+xml',
|
|
445
|
+
webp: 'image/webp',
|
|
446
|
+
bmp: 'image/bmp',
|
|
447
|
+
ico: 'image/x-icon',
|
|
448
|
+
tif: 'image/tiff',
|
|
449
|
+
tiff: 'image/tiff',
|
|
450
|
+
avif: 'image/avif',
|
|
451
|
+
heic: 'image/heic',
|
|
452
|
+
// --- Audio ---
|
|
453
|
+
mp3: 'audio/mpeg',
|
|
454
|
+
wav: 'audio/wav',
|
|
455
|
+
ogg: 'audio/ogg',
|
|
456
|
+
m4a: 'audio/mp4',
|
|
457
|
+
flac: 'audio/flac',
|
|
458
|
+
aac: 'audio/aac',
|
|
459
|
+
// --- Video ---
|
|
460
|
+
mp4: 'video/mp4',
|
|
461
|
+
webm: 'video/webm',
|
|
462
|
+
mov: 'video/quicktime',
|
|
463
|
+
avi: 'video/x-msvideo',
|
|
464
|
+
mkv: 'video/x-matroska',
|
|
465
|
+
mpeg: 'video/mpeg',
|
|
466
|
+
// --- Archives & Packages ---
|
|
467
|
+
zip: 'application/zip',
|
|
468
|
+
gz: 'application/gzip',
|
|
469
|
+
tar: 'application/x-tar',
|
|
470
|
+
rar: 'application/vnd.rar',
|
|
471
|
+
'7z': 'application/x-7z-compressed',
|
|
472
|
+
bz2: 'application/x-bzip2',
|
|
473
|
+
jar: 'application/java-archive',
|
|
474
|
+
// --- Fonts ---
|
|
475
|
+
ttf: 'font/ttf',
|
|
476
|
+
otf: 'font/otf',
|
|
477
|
+
woff: 'font/woff',
|
|
478
|
+
woff2: 'font/woff2',
|
|
479
|
+
// --- Code / Config ---
|
|
480
|
+
sh: 'application/x-sh',
|
|
481
|
+
py: 'text/x-python',
|
|
482
|
+
ts: 'application/typescript',
|
|
483
|
+
tsx: 'application/typescript',
|
|
484
|
+
jsx: 'text/jsx',
|
|
485
|
+
java: 'text/x-java-source',
|
|
486
|
+
go: 'text/x-go',
|
|
487
|
+
rs: 'text/rust',
|
|
488
|
+
cpp: 'text/x-c++src',
|
|
489
|
+
c: 'text/x-c',
|
|
490
|
+
sql: 'application/sql',
|
|
491
|
+
env: 'text/plain',
|
|
492
|
+
// --- Others ---
|
|
493
|
+
bin: 'application/octet-stream',
|
|
494
|
+
exe: 'application/x-msdownload',
|
|
495
|
+
wasm: 'application/wasm',
|
|
496
|
+
dmg: 'application/x-apple-diskimage',
|
|
497
|
+
iso: 'application/x-iso9660-image'
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
var isNode = function isNode() {
|
|
501
|
+
return typeof window === 'undefined';
|
|
502
|
+
};
|
|
503
|
+
var isBrowser = function isBrowser() {
|
|
504
|
+
return !isNode();
|
|
505
|
+
};
|
|
506
|
+
var isObject = function isObject(x) {
|
|
507
|
+
return typeof x === 'object' && !Array.isArray(x) && x !== null;
|
|
508
|
+
};
|
|
509
|
+
var _recursiveMerge = function recursiveMerge(target) {
|
|
510
|
+
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
511
|
+
sources[_key - 1] = arguments[_key];
|
|
512
|
+
}
|
|
513
|
+
for (var _i = 0, _sources = sources; _i < _sources.length; _i++) {
|
|
514
|
+
var source = _sources[_i];
|
|
515
|
+
for (var key in source) {
|
|
516
|
+
if (isObject(source[key])) {
|
|
517
|
+
if (!target[key]) {
|
|
518
|
+
target[key] = {};
|
|
519
|
+
}
|
|
520
|
+
_recursiveMerge(target[key], source[key]);
|
|
521
|
+
} else {
|
|
522
|
+
target[key] = source[key];
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return target;
|
|
527
|
+
};
|
|
528
|
+
var managedLog = function managedLog(title, message, config) {
|
|
529
|
+
var _config$logs;
|
|
530
|
+
for (var _len2 = arguments.length, types = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
531
|
+
types[_key2 - 3] = arguments[_key2];
|
|
532
|
+
}
|
|
533
|
+
(_config$logs = config.logs) == null || _config$logs.forEach(function (allowed) {
|
|
534
|
+
if (types.includes(allowed)) {
|
|
535
|
+
if (config.debug === true) {
|
|
536
|
+
console[allowed](title, message);
|
|
537
|
+
} else {
|
|
538
|
+
console[allowed](title);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
var sleep = function sleep(ms) {
|
|
544
|
+
return new Promise(function (resolve) {
|
|
545
|
+
setTimeout(resolve, ms);
|
|
546
|
+
});
|
|
547
|
+
};
|
|
548
|
+
var isFunction = function isFunction(value) {
|
|
549
|
+
return typeof value === 'function';
|
|
550
|
+
};
|
|
551
|
+
var streamFileChunks = /*#__PURE__*/function () {
|
|
552
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, callback, chunkSize) {
|
|
553
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
554
|
+
while (1) switch (_context.prev = _context.next) {
|
|
555
|
+
case 0:
|
|
556
|
+
if (chunkSize === void 0) {
|
|
557
|
+
chunkSize = 512 * 1024;
|
|
558
|
+
}
|
|
559
|
+
if (!isNode()) {
|
|
560
|
+
_context.next = 3;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
return _context.abrupt("return", streamFileChunksForNode(input, callback, chunkSize));
|
|
564
|
+
case 3:
|
|
565
|
+
if (!isBrowser()) {
|
|
566
|
+
_context.next = 5;
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
return _context.abrupt("return", streamFileChunksForBrowser(input, callback, chunkSize));
|
|
570
|
+
case 5:
|
|
571
|
+
console.error('Unknown environment for streamChunks');
|
|
572
|
+
return _context.abrupt("return", 0);
|
|
573
|
+
case 7:
|
|
574
|
+
case "end":
|
|
575
|
+
return _context.stop();
|
|
576
|
+
}
|
|
577
|
+
}, _callee);
|
|
578
|
+
}));
|
|
579
|
+
return function streamFileChunks(_x, _x2, _x3) {
|
|
580
|
+
return _ref.apply(this, arguments);
|
|
581
|
+
};
|
|
582
|
+
}();
|
|
583
|
+
var streamFileChunksForNode = /*#__PURE__*/function () {
|
|
584
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, callback, chunkSize) {
|
|
585
|
+
var fs, stream, index, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, base64;
|
|
586
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
587
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
588
|
+
case 0:
|
|
589
|
+
if (chunkSize === void 0) {
|
|
590
|
+
chunkSize = 512 * 1024;
|
|
591
|
+
}
|
|
592
|
+
if (!(typeof path !== 'string' || path.length < 1)) {
|
|
593
|
+
_context2.next = 3;
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
return _context2.abrupt("return", 0);
|
|
597
|
+
case 3:
|
|
598
|
+
_context2.next = 5;
|
|
599
|
+
return import('fs');
|
|
600
|
+
case 5:
|
|
601
|
+
fs = _context2.sent;
|
|
602
|
+
stream = fs.createReadStream(path, {
|
|
603
|
+
highWaterMark: chunkSize
|
|
604
|
+
});
|
|
605
|
+
index = 0;
|
|
606
|
+
_iteratorAbruptCompletion = false;
|
|
607
|
+
_didIteratorError = false;
|
|
608
|
+
_context2.prev = 10;
|
|
609
|
+
_iterator = _asyncIterator(stream);
|
|
610
|
+
case 12:
|
|
611
|
+
_context2.next = 14;
|
|
612
|
+
return _iterator.next();
|
|
613
|
+
case 14:
|
|
614
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
615
|
+
_context2.next = 22;
|
|
616
|
+
break;
|
|
617
|
+
}
|
|
618
|
+
chunk = _step.value;
|
|
619
|
+
base64 = chunk.toString('base64');
|
|
620
|
+
_context2.next = 19;
|
|
621
|
+
return callback(base64, index++);
|
|
622
|
+
case 19:
|
|
623
|
+
_iteratorAbruptCompletion = false;
|
|
624
|
+
_context2.next = 12;
|
|
625
|
+
break;
|
|
626
|
+
case 22:
|
|
627
|
+
_context2.next = 28;
|
|
628
|
+
break;
|
|
629
|
+
case 24:
|
|
630
|
+
_context2.prev = 24;
|
|
631
|
+
_context2.t0 = _context2["catch"](10);
|
|
632
|
+
_didIteratorError = true;
|
|
633
|
+
_iteratorError = _context2.t0;
|
|
634
|
+
case 28:
|
|
635
|
+
_context2.prev = 28;
|
|
636
|
+
_context2.prev = 29;
|
|
637
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
638
|
+
_context2.next = 33;
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
_context2.next = 33;
|
|
642
|
+
return _iterator["return"]();
|
|
643
|
+
case 33:
|
|
644
|
+
_context2.prev = 33;
|
|
645
|
+
if (!_didIteratorError) {
|
|
646
|
+
_context2.next = 36;
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
throw _iteratorError;
|
|
650
|
+
case 36:
|
|
651
|
+
return _context2.finish(33);
|
|
652
|
+
case 37:
|
|
653
|
+
return _context2.finish(28);
|
|
654
|
+
case 38:
|
|
655
|
+
return _context2.abrupt("return", index);
|
|
656
|
+
case 39:
|
|
657
|
+
case "end":
|
|
658
|
+
return _context2.stop();
|
|
659
|
+
}
|
|
660
|
+
}, _callee2, null, [[10, 24, 28, 38], [29,, 33, 37]]);
|
|
661
|
+
}));
|
|
662
|
+
return function streamFileChunksForNode(_x4, _x5, _x6) {
|
|
663
|
+
return _ref2.apply(this, arguments);
|
|
664
|
+
};
|
|
665
|
+
}();
|
|
666
|
+
var streamFileChunksForBrowser = /*#__PURE__*/function () {
|
|
667
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(files, callback, chunkSize) {
|
|
668
|
+
var file, reader, index, buffer, _yield$reader$read, done, value, combined, chunk, base64, _base;
|
|
669
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
670
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
671
|
+
case 0:
|
|
672
|
+
if (chunkSize === void 0) {
|
|
673
|
+
chunkSize = 512 * 1024;
|
|
674
|
+
}
|
|
675
|
+
if (!(!(files instanceof FileList) || files.length < 1)) {
|
|
676
|
+
_context3.next = 3;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
return _context3.abrupt("return", 0);
|
|
680
|
+
case 3:
|
|
681
|
+
file = files[0];
|
|
682
|
+
reader = file.stream().getReader();
|
|
683
|
+
index = 0;
|
|
684
|
+
buffer = new Uint8Array();
|
|
685
|
+
case 7:
|
|
686
|
+
_context3.next = 10;
|
|
687
|
+
return reader.read();
|
|
688
|
+
case 10:
|
|
689
|
+
_yield$reader$read = _context3.sent;
|
|
690
|
+
done = _yield$reader$read.done;
|
|
691
|
+
value = _yield$reader$read.value;
|
|
692
|
+
if (!done) {
|
|
693
|
+
_context3.next = 15;
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
return _context3.abrupt("break", 29);
|
|
697
|
+
case 15:
|
|
698
|
+
combined = new Uint8Array(buffer.length + value.length);
|
|
699
|
+
combined.set(buffer);
|
|
700
|
+
combined.set(value, buffer.length);
|
|
701
|
+
buffer = combined;
|
|
702
|
+
case 19:
|
|
703
|
+
if (!(buffer.length >= chunkSize)) {
|
|
704
|
+
_context3.next = 27;
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
chunk = buffer.slice(0, chunkSize);
|
|
708
|
+
buffer = buffer.slice(chunkSize);
|
|
709
|
+
base64 = uint8ToBase64(chunk);
|
|
710
|
+
_context3.next = 25;
|
|
711
|
+
return callback(base64, index++);
|
|
712
|
+
case 25:
|
|
713
|
+
_context3.next = 19;
|
|
714
|
+
break;
|
|
715
|
+
case 27:
|
|
716
|
+
_context3.next = 7;
|
|
717
|
+
break;
|
|
718
|
+
case 29:
|
|
719
|
+
if (!(buffer.length > 0)) {
|
|
720
|
+
_context3.next = 33;
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
_base = uint8ToBase64(buffer);
|
|
724
|
+
_context3.next = 33;
|
|
725
|
+
return callback(_base, index++);
|
|
726
|
+
case 33:
|
|
727
|
+
return _context3.abrupt("return", index);
|
|
728
|
+
case 34:
|
|
729
|
+
case "end":
|
|
730
|
+
return _context3.stop();
|
|
731
|
+
}
|
|
732
|
+
}, _callee3);
|
|
733
|
+
}));
|
|
734
|
+
return function streamFileChunksForBrowser(_x7, _x8, _x9) {
|
|
735
|
+
return _ref3.apply(this, arguments);
|
|
736
|
+
};
|
|
737
|
+
}();
|
|
738
|
+
var getFileMeta = /*#__PURE__*/function () {
|
|
739
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(input) {
|
|
740
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
741
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
742
|
+
case 0:
|
|
743
|
+
if (!isNode()) {
|
|
744
|
+
_context4.next = 2;
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
return _context4.abrupt("return", getFileMetaForNode(input));
|
|
748
|
+
case 2:
|
|
749
|
+
if (!isBrowser()) {
|
|
750
|
+
_context4.next = 4;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
return _context4.abrupt("return", getFileMetaForBrowser(input));
|
|
754
|
+
case 4:
|
|
755
|
+
console.error('Unknown environment for getFileMeta');
|
|
756
|
+
return _context4.abrupt("return", []);
|
|
757
|
+
case 6:
|
|
758
|
+
case "end":
|
|
759
|
+
return _context4.stop();
|
|
760
|
+
}
|
|
761
|
+
}, _callee4);
|
|
762
|
+
}));
|
|
763
|
+
return function getFileMeta(_x10) {
|
|
764
|
+
return _ref4.apply(this, arguments);
|
|
765
|
+
};
|
|
766
|
+
}();
|
|
767
|
+
var getFileMetaForNode = /*#__PURE__*/function () {
|
|
768
|
+
var _ref5 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(path) {
|
|
769
|
+
var fs, p, stats, size, ext, name, mimeType;
|
|
770
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
771
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
772
|
+
case 0:
|
|
773
|
+
if (!(typeof path !== 'string' || path.length < 1)) {
|
|
774
|
+
_context5.next = 2;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
return _context5.abrupt("return", []);
|
|
778
|
+
case 2:
|
|
779
|
+
_context5.next = 4;
|
|
780
|
+
return import('fs');
|
|
781
|
+
case 4:
|
|
782
|
+
fs = _context5.sent;
|
|
783
|
+
_context5.next = 7;
|
|
784
|
+
return import('path');
|
|
785
|
+
case 7:
|
|
786
|
+
p = _context5.sent;
|
|
787
|
+
_context5.prev = 8;
|
|
788
|
+
_context5.next = 11;
|
|
789
|
+
return fs.promises.stat(path);
|
|
790
|
+
case 11:
|
|
791
|
+
stats = _context5.sent;
|
|
792
|
+
size = stats.size;
|
|
793
|
+
ext = p.extname(path).replace('.', '').toLowerCase();
|
|
794
|
+
name = p.basename(path);
|
|
795
|
+
mimeType = mimeMap[ext] || 'application/octet-stream';
|
|
796
|
+
return _context5.abrupt("return", [ext, mimeType, size, name]);
|
|
797
|
+
case 19:
|
|
798
|
+
_context5.prev = 19;
|
|
799
|
+
_context5.t0 = _context5["catch"](8);
|
|
800
|
+
console.error("Error getting file meta for " + path + ":", _context5.t0);
|
|
801
|
+
return _context5.abrupt("return", []);
|
|
802
|
+
case 23:
|
|
803
|
+
case "end":
|
|
804
|
+
return _context5.stop();
|
|
805
|
+
}
|
|
806
|
+
}, _callee5, null, [[8, 19]]);
|
|
807
|
+
}));
|
|
808
|
+
return function getFileMetaForNode(_x11) {
|
|
809
|
+
return _ref5.apply(this, arguments);
|
|
810
|
+
};
|
|
811
|
+
}();
|
|
812
|
+
var getFileMetaForBrowser = /*#__PURE__*/function () {
|
|
813
|
+
var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(files) {
|
|
814
|
+
var _file$name$split$pop;
|
|
815
|
+
var file, ext, mimeType, size, name;
|
|
816
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
817
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
818
|
+
case 0:
|
|
819
|
+
if (!(!(files instanceof FileList) || files.length < 1)) {
|
|
820
|
+
_context6.next = 2;
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
return _context6.abrupt("return", []);
|
|
824
|
+
case 2:
|
|
825
|
+
file = files[0];
|
|
826
|
+
ext = ((_file$name$split$pop = file.name.split('.').pop()) == null ? void 0 : _file$name$split$pop.toLowerCase()) || '';
|
|
827
|
+
mimeType = file.type || "application/" + (ext || 'octet-stream');
|
|
828
|
+
size = file.size;
|
|
829
|
+
name = file.name;
|
|
830
|
+
return _context6.abrupt("return", [ext, mimeType, size, name]);
|
|
831
|
+
case 8:
|
|
832
|
+
case "end":
|
|
833
|
+
return _context6.stop();
|
|
834
|
+
}
|
|
835
|
+
}, _callee6);
|
|
836
|
+
}));
|
|
837
|
+
return function getFileMetaForBrowser(_x12) {
|
|
838
|
+
return _ref6.apply(this, arguments);
|
|
839
|
+
};
|
|
840
|
+
}();
|
|
841
|
+
var uint8ToBase64 = function uint8ToBase64(bytes) {
|
|
842
|
+
var binary = '';
|
|
843
|
+
var chunkSize = 0x8000;
|
|
844
|
+
var len = bytes.length;
|
|
845
|
+
for (var i = 0; i < len; i += chunkSize) {
|
|
846
|
+
var sub = bytes.subarray(i, i + chunkSize);
|
|
847
|
+
binary += String.fromCharCode.apply(String, sub);
|
|
848
|
+
}
|
|
849
|
+
return btoa(binary);
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
var axios = /*#__PURE__*/require('axios');
|
|
853
|
+
var raw = axios;
|
|
854
|
+
var request = /*#__PURE__*/function () {
|
|
855
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(method, url, body, queries, headers) {
|
|
856
|
+
var config, _request, response, _response;
|
|
857
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
858
|
+
while (1) switch (_context.prev = _context.next) {
|
|
859
|
+
case 0:
|
|
860
|
+
config = getConfig();
|
|
861
|
+
_context.prev = 1;
|
|
862
|
+
_request = {
|
|
863
|
+
method: method,
|
|
864
|
+
url: url,
|
|
865
|
+
headers: _extends({
|
|
866
|
+
'content-type': 'application/json',
|
|
867
|
+
authorization: "bearer " + config.credential
|
|
868
|
+
}, headers),
|
|
869
|
+
data: body,
|
|
870
|
+
params: queries
|
|
871
|
+
};
|
|
872
|
+
managedLog('BATCH REQUEST', _request, config, exports.LogType.INFO);
|
|
873
|
+
_context.next = 6;
|
|
874
|
+
return raw.request(_request, {
|
|
875
|
+
validateStatus: function validateStatus(status) {
|
|
876
|
+
return status < 500;
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
case 6:
|
|
880
|
+
response = _context.sent;
|
|
881
|
+
managedLog('BATCH RESPONSE', response.data, config, exports.LogType.INFO);
|
|
882
|
+
return _context.abrupt("return", [true, response.status, response.statusText, null, response.data]);
|
|
883
|
+
case 11:
|
|
884
|
+
_context.prev = 11;
|
|
885
|
+
_context.t0 = _context["catch"](1);
|
|
886
|
+
managedLog('BATCH ERROR', _context.t0, config, exports.LogType.ERROR);
|
|
887
|
+
if (!_context.t0.response) {
|
|
888
|
+
_context.next = 19;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
// The request was made and the server responded with a status code
|
|
892
|
+
// that falls out of the range of 2xx
|
|
893
|
+
_response = _context.t0.response;
|
|
894
|
+
return _context.abrupt("return", [false, _response.status, _response.statusText, null, _response.data]);
|
|
895
|
+
case 19:
|
|
896
|
+
if (!_context.t0.request) {
|
|
897
|
+
_context.next = 23;
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
return _context.abrupt("return", [false, 503, 'Service is Down', 'Unable to get any response from the ', _context.t0]);
|
|
901
|
+
case 23:
|
|
902
|
+
return _context.abrupt("return", [false, 403, 'Service is Down', 'Could not make the request, check and try again.', _context.t0]);
|
|
903
|
+
case 24:
|
|
904
|
+
case "end":
|
|
905
|
+
return _context.stop();
|
|
906
|
+
}
|
|
907
|
+
}, _callee, null, [[1, 11]]);
|
|
908
|
+
}));
|
|
909
|
+
return function request(_x, _x2, _x3, _x4, _x5) {
|
|
910
|
+
return _ref.apply(this, arguments);
|
|
911
|
+
};
|
|
912
|
+
}();
|
|
913
|
+
var requestWithError = /*#__PURE__*/function () {
|
|
914
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(method, url, body, queries, headers) {
|
|
915
|
+
var _yield$request, status, httpStatus, title, message, response, _response$message;
|
|
916
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
917
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
918
|
+
case 0:
|
|
919
|
+
_context2.next = 2;
|
|
920
|
+
return request(method, url, body, queries, headers);
|
|
921
|
+
case 2:
|
|
922
|
+
_yield$request = _context2.sent;
|
|
923
|
+
status = _yield$request[0];
|
|
924
|
+
httpStatus = _yield$request[1];
|
|
925
|
+
title = _yield$request[2];
|
|
926
|
+
message = _yield$request[3];
|
|
927
|
+
response = _yield$request[4];
|
|
928
|
+
if (!(status !== true)) {
|
|
929
|
+
_context2.next = 10;
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
throw new Error(httpStatus + ": " + title + " " + ((_response$message = response == null ? void 0 : response.message) != null ? _response$message : message));
|
|
933
|
+
case 10:
|
|
934
|
+
return _context2.abrupt("return", response);
|
|
935
|
+
case 11:
|
|
936
|
+
case "end":
|
|
937
|
+
return _context2.stop();
|
|
938
|
+
}
|
|
939
|
+
}, _callee2);
|
|
940
|
+
}));
|
|
941
|
+
return function requestWithError(_x6, _x7, _x8, _x9, _x10) {
|
|
942
|
+
return _ref2.apply(this, arguments);
|
|
943
|
+
};
|
|
944
|
+
}();
|
|
945
|
+
var post = function post(url, body, queries, headers) {
|
|
946
|
+
return request('POST', url, body, queries, headers);
|
|
947
|
+
};
|
|
948
|
+
var get = function get(url, queries, headers) {
|
|
949
|
+
return request('GET', url, null, queries, headers);
|
|
950
|
+
};
|
|
951
|
+
var patch = function patch(url, body, queries, headers) {
|
|
952
|
+
return request('PATCH', url, body, queries, headers);
|
|
953
|
+
};
|
|
954
|
+
var put = function put(url, body, queries, headers) {
|
|
955
|
+
return request('PUT', url, body, queries, headers);
|
|
956
|
+
};
|
|
957
|
+
var remove = function remove(url, body, queries, headers) {
|
|
958
|
+
return request('DELETE', url, body, queries, headers);
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
var init$1 = /*#__PURE__*/function () {
|
|
962
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
963
|
+
var config, _yield$post, status, httpStatus, title, message, response;
|
|
964
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
965
|
+
while (1) switch (_context.prev = _context.next) {
|
|
966
|
+
case 0:
|
|
967
|
+
config = getConfig();
|
|
968
|
+
_context.next = 3;
|
|
969
|
+
return post(config.server + "/apps/blobs/upload/init", _extends({}, file));
|
|
970
|
+
case 3:
|
|
971
|
+
_yield$post = _context.sent;
|
|
972
|
+
status = _yield$post[0];
|
|
973
|
+
httpStatus = _yield$post[1];
|
|
974
|
+
title = _yield$post[2];
|
|
975
|
+
message = _yield$post[3];
|
|
976
|
+
response = _yield$post[4];
|
|
977
|
+
if (!(status !== true)) {
|
|
978
|
+
_context.next = 12;
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
console.error('INIT ERROR', title, message, httpStatus);
|
|
982
|
+
return _context.abrupt("return", null);
|
|
983
|
+
case 12:
|
|
984
|
+
return _context.abrupt("return", response);
|
|
985
|
+
case 13:
|
|
986
|
+
case "end":
|
|
987
|
+
return _context.stop();
|
|
988
|
+
}
|
|
989
|
+
}, _callee);
|
|
990
|
+
}));
|
|
991
|
+
return function init(_x) {
|
|
992
|
+
return _ref.apply(this, arguments);
|
|
993
|
+
};
|
|
994
|
+
}();
|
|
995
|
+
var batch = /*#__PURE__*/function () {
|
|
996
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pages) {
|
|
997
|
+
var config, _yield$post2, status, httpStatus, title, message, response;
|
|
998
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
999
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1000
|
+
case 0:
|
|
1001
|
+
config = getConfig();
|
|
1002
|
+
_context2.next = 3;
|
|
1003
|
+
return post(config.server + "/apps/blobs/upload/batch", {
|
|
1004
|
+
pages: pages
|
|
1005
|
+
});
|
|
1006
|
+
case 3:
|
|
1007
|
+
_yield$post2 = _context2.sent;
|
|
1008
|
+
status = _yield$post2[0];
|
|
1009
|
+
httpStatus = _yield$post2[1];
|
|
1010
|
+
title = _yield$post2[2];
|
|
1011
|
+
message = _yield$post2[3];
|
|
1012
|
+
response = _yield$post2[4];
|
|
1013
|
+
if (!(status !== true)) {
|
|
1014
|
+
_context2.next = 12;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
console.error('BATCH ERROR', title, message, httpStatus);
|
|
1018
|
+
return _context2.abrupt("return", null);
|
|
1019
|
+
case 12:
|
|
1020
|
+
return _context2.abrupt("return", response);
|
|
1021
|
+
case 13:
|
|
1022
|
+
case "end":
|
|
1023
|
+
return _context2.stop();
|
|
1024
|
+
}
|
|
1025
|
+
}, _callee2);
|
|
1026
|
+
}));
|
|
1027
|
+
return function batch(_x2) {
|
|
1028
|
+
return _ref2.apply(this, arguments);
|
|
1029
|
+
};
|
|
1030
|
+
}();
|
|
1031
|
+
var verify = /*#__PURE__*/function () {
|
|
1032
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file) {
|
|
1033
|
+
var config, _yield$post3, status, httpStatus, title, message, response;
|
|
1034
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1035
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1036
|
+
case 0:
|
|
1037
|
+
config = getConfig();
|
|
1038
|
+
_context3.next = 3;
|
|
1039
|
+
return post(config.server + "/apps/blobs/upload/verify", _extends({}, file));
|
|
1040
|
+
case 3:
|
|
1041
|
+
_yield$post3 = _context3.sent;
|
|
1042
|
+
status = _yield$post3[0];
|
|
1043
|
+
httpStatus = _yield$post3[1];
|
|
1044
|
+
title = _yield$post3[2];
|
|
1045
|
+
message = _yield$post3[3];
|
|
1046
|
+
response = _yield$post3[4];
|
|
1047
|
+
if (!(status !== true)) {
|
|
1048
|
+
_context3.next = 12;
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
console.error('VERIFY ERROR', title, message, httpStatus);
|
|
1052
|
+
return _context3.abrupt("return", null);
|
|
1053
|
+
case 12:
|
|
1054
|
+
return _context3.abrupt("return", response);
|
|
1055
|
+
case 13:
|
|
1056
|
+
case "end":
|
|
1057
|
+
return _context3.stop();
|
|
1058
|
+
}
|
|
1059
|
+
}, _callee3);
|
|
1060
|
+
}));
|
|
1061
|
+
return function verify(_x3) {
|
|
1062
|
+
return _ref3.apply(this, arguments);
|
|
1063
|
+
};
|
|
1064
|
+
}();
|
|
1065
|
+
var upload = /*#__PURE__*/function () {
|
|
1066
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(input, parentId, tags) {
|
|
1067
|
+
var meta, ext, mimeType, size, name, file, totalChunks, nFile;
|
|
1068
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1069
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1070
|
+
case 0:
|
|
1071
|
+
_context5.next = 2;
|
|
1072
|
+
return getFileMeta(input);
|
|
1073
|
+
case 2:
|
|
1074
|
+
meta = _context5.sent;
|
|
1075
|
+
if (meta) {
|
|
1076
|
+
_context5.next = 5;
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
return _context5.abrupt("return", [false, 'Failed to read file metadata']);
|
|
1080
|
+
case 5:
|
|
1081
|
+
ext = meta[0], mimeType = meta[1], size = meta[2], name = meta[3];
|
|
1082
|
+
if (!(!ext || !mimeType || !size || !name)) {
|
|
1083
|
+
_context5.next = 8;
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
return _context5.abrupt("return", [false, 'Invalid file metadata']);
|
|
1087
|
+
case 8:
|
|
1088
|
+
_context5.next = 10;
|
|
1089
|
+
return init$1({
|
|
1090
|
+
type: ext,
|
|
1091
|
+
parentId: parentId,
|
|
1092
|
+
name: name,
|
|
1093
|
+
tags: tags,
|
|
1094
|
+
size: size,
|
|
1095
|
+
mime: mimeType
|
|
1096
|
+
});
|
|
1097
|
+
case 10:
|
|
1098
|
+
file = _context5.sent;
|
|
1099
|
+
if (!(!file || !file.id)) {
|
|
1100
|
+
_context5.next = 13;
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
return _context5.abrupt("return", [false, 'Failed to init file upload']);
|
|
1104
|
+
case 13:
|
|
1105
|
+
_context5.next = 15;
|
|
1106
|
+
return streamFileChunks(input, /*#__PURE__*/function () {
|
|
1107
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(chunk, index) {
|
|
1108
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1109
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1110
|
+
case 0:
|
|
1111
|
+
_context4.next = 2;
|
|
1112
|
+
return batch([{
|
|
1113
|
+
fileId: file.id,
|
|
1114
|
+
index: index,
|
|
1115
|
+
raw: chunk
|
|
1116
|
+
}]);
|
|
1117
|
+
case 2:
|
|
1118
|
+
case "end":
|
|
1119
|
+
return _context4.stop();
|
|
1120
|
+
}
|
|
1121
|
+
}, _callee4);
|
|
1122
|
+
}));
|
|
1123
|
+
return function (_x7, _x8) {
|
|
1124
|
+
return _ref5.apply(this, arguments);
|
|
1125
|
+
};
|
|
1126
|
+
}());
|
|
1127
|
+
case 15:
|
|
1128
|
+
totalChunks = _context5.sent;
|
|
1129
|
+
if (totalChunks) {
|
|
1130
|
+
_context5.next = 18;
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
return _context5.abrupt("return", [false, 'Failed to upload file chunks']);
|
|
1134
|
+
case 18:
|
|
1135
|
+
_context5.next = 20;
|
|
1136
|
+
return verify({
|
|
1137
|
+
type: ext,
|
|
1138
|
+
parentId: parentId,
|
|
1139
|
+
name: name,
|
|
1140
|
+
tags: tags,
|
|
1141
|
+
size: size,
|
|
1142
|
+
mime: mimeType
|
|
1143
|
+
});
|
|
1144
|
+
case 20:
|
|
1145
|
+
nFile = _context5.sent;
|
|
1146
|
+
if (!(!nFile || !nFile.id)) {
|
|
1147
|
+
_context5.next = 23;
|
|
1148
|
+
break;
|
|
1149
|
+
}
|
|
1150
|
+
return _context5.abrupt("return", [false, 'Failed to verify file upload']);
|
|
1151
|
+
case 23:
|
|
1152
|
+
if (!((nFile == null ? void 0 : nFile.pagesCount) !== totalChunks)) {
|
|
1153
|
+
_context5.next = 25;
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
return _context5.abrupt("return", [false, 'Uploaded chunks count does not match']);
|
|
1157
|
+
case 25:
|
|
1158
|
+
return _context5.abrupt("return", [true, nFile.id]);
|
|
1159
|
+
case 26:
|
|
1160
|
+
case "end":
|
|
1161
|
+
return _context5.stop();
|
|
1162
|
+
}
|
|
1163
|
+
}, _callee5);
|
|
1164
|
+
}));
|
|
1165
|
+
return function upload(_x4, _x5, _x6) {
|
|
1166
|
+
return _ref4.apply(this, arguments);
|
|
1167
|
+
};
|
|
1168
|
+
}();
|
|
1169
|
+
/**
|
|
1170
|
+
* return the full URL for the given file ID
|
|
1171
|
+
* @param id
|
|
1172
|
+
*/
|
|
1173
|
+
var download = function download(id) {
|
|
1174
|
+
var config = getConfig();
|
|
1175
|
+
return config.server + "/apps/blobs/download/" + id;
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* global in-memory queue store
|
|
1180
|
+
* not exported, only used by this module
|
|
1181
|
+
*/
|
|
1182
|
+
var store = [];
|
|
1183
|
+
var push = function push() {
|
|
1184
|
+
for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1185
|
+
items[_key] = arguments[_key];
|
|
1186
|
+
}
|
|
1187
|
+
store.push.apply(store, items);
|
|
1188
|
+
managedLog("QUEUE - " + items.length + " ITEM(S) ADDED", items, getConfig(), exports.LogType.INFO);
|
|
1189
|
+
};
|
|
1190
|
+
var pop = function pop(length) {
|
|
1191
|
+
if (length === void 0) {
|
|
1192
|
+
length = 12;
|
|
1193
|
+
}
|
|
1194
|
+
var items = store.splice(0, length);
|
|
1195
|
+
managedLog("QUEUE - " + items.length + " ITEM(S) REMOVED", items, getConfig(), exports.LogType.INFO);
|
|
1196
|
+
return items;
|
|
1197
|
+
};
|
|
1198
|
+
var length = function length() {
|
|
1199
|
+
return store.length;
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
var limit = 25;
|
|
1203
|
+
var retryTracker = 0;
|
|
1204
|
+
var run = /*#__PURE__*/function () {
|
|
1205
|
+
var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1206
|
+
var config, handler;
|
|
1207
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1208
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1209
|
+
case 0:
|
|
1210
|
+
config = getConfig();
|
|
1211
|
+
handler = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1212
|
+
var items, _yield$post, status, _config$batch, _config$batch3, _config$batch4, _config$batch2;
|
|
1213
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1214
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1215
|
+
case 0:
|
|
1216
|
+
if (!(length() < 1)) {
|
|
1217
|
+
_context.next = 3;
|
|
1218
|
+
break;
|
|
1219
|
+
}
|
|
1220
|
+
managedLog('BATCH RUN', 'Nothing to process', getConfig(), exports.LogType.INFO);
|
|
1221
|
+
return _context.abrupt("return");
|
|
1222
|
+
case 3:
|
|
1223
|
+
items = pop(limit);
|
|
1224
|
+
_context.prev = 4;
|
|
1225
|
+
_context.next = 7;
|
|
1226
|
+
return post(config.server + "/apps/blobs/upload", {
|
|
1227
|
+
items: items
|
|
1228
|
+
});
|
|
1229
|
+
case 7:
|
|
1230
|
+
_yield$post = _context.sent;
|
|
1231
|
+
status = _yield$post[0];
|
|
1232
|
+
if (status) {
|
|
1233
|
+
_context.next = 26;
|
|
1234
|
+
break;
|
|
1235
|
+
}
|
|
1236
|
+
push.apply(void 0, items);
|
|
1237
|
+
managedLog('BATCH RUN', items.length + " sent back to queue", getConfig(), exports.LogType.INFO, exports.LogType.ERROR);
|
|
1238
|
+
++retryTracker;
|
|
1239
|
+
if (!(retryTracker > ((_config$batch = config.batch) == null ? void 0 : _config$batch.limit))) {
|
|
1240
|
+
_context.next = 22;
|
|
1241
|
+
break;
|
|
1242
|
+
}
|
|
1243
|
+
clearInterval(handler);
|
|
1244
|
+
managedLog('BATCH RETRY LIMIT EXHAUSTED', {
|
|
1245
|
+
retryTracker: retryTracker,
|
|
1246
|
+
giveUpAfter: (_config$batch2 = config.batch) == null ? void 0 : _config$batch2.limit
|
|
1247
|
+
}, config, exports.LogType.INFO, exports.LogType.ERROR);
|
|
1248
|
+
managedLog('BATCH RUN', "Processed stopped due to retry limit exhausted", getConfig(), exports.LogType.INFO, exports.LogType.ERROR);
|
|
1249
|
+
return _context.abrupt("return");
|
|
1250
|
+
case 22:
|
|
1251
|
+
managedLog('BATCH RUN', "Sleeping for " + ((_config$batch3 = config.batch) == null ? void 0 : _config$batch3.backoff) + "ms", getConfig(), exports.LogType.INFO, exports.LogType.ERROR);
|
|
1252
|
+
_context.next = 25;
|
|
1253
|
+
return sleep((_config$batch4 = config.batch) == null ? void 0 : _config$batch4.backoff);
|
|
1254
|
+
case 25:
|
|
1255
|
+
return _context.abrupt("return");
|
|
1256
|
+
case 26:
|
|
1257
|
+
retryTracker = 0;
|
|
1258
|
+
managedLog('BATCH RUN', items.length + " sent to server", getConfig(), exports.LogType.INFO);
|
|
1259
|
+
_context.next = 33;
|
|
1260
|
+
break;
|
|
1261
|
+
case 30:
|
|
1262
|
+
_context.prev = 30;
|
|
1263
|
+
_context.t0 = _context["catch"](4);
|
|
1264
|
+
console.error(_context.t0);
|
|
1265
|
+
case 33:
|
|
1266
|
+
case "end":
|
|
1267
|
+
return _context.stop();
|
|
1268
|
+
}
|
|
1269
|
+
}, _callee, null, [[4, 30]]);
|
|
1270
|
+
})), config.batch.interval);
|
|
1271
|
+
case 2:
|
|
1272
|
+
case "end":
|
|
1273
|
+
return _context2.stop();
|
|
1274
|
+
}
|
|
1275
|
+
}, _callee2);
|
|
1276
|
+
}));
|
|
1277
|
+
return function run() {
|
|
1278
|
+
return _ref.apply(this, arguments);
|
|
1279
|
+
};
|
|
1280
|
+
}();
|
|
1281
|
+
|
|
1282
|
+
var init = function init(c) {
|
|
1283
|
+
var cf = isFunction(c) ? c() : c;
|
|
1284
|
+
var config = _recursiveMerge(getConfig(), cf);
|
|
1285
|
+
if (!config.server || config.server == '') {
|
|
1286
|
+
managedLog('INIT CONFIG VALIDATION', config, config, exports.LogType.ERROR);
|
|
1287
|
+
throw new Error('Invalid configuration - server not defined');
|
|
1288
|
+
}
|
|
1289
|
+
if (!config.sourceId || config.sourceId == '') {
|
|
1290
|
+
managedLog('INIT CONFIG VALIDATION', config, config, exports.LogType.ERROR);
|
|
1291
|
+
throw new Error('Invalid configuration - sourceId not defined');
|
|
1292
|
+
}
|
|
1293
|
+
managedLog('INIT ACTIVE CONFIG', config, config, exports.LogType.INFO);
|
|
1294
|
+
run();
|
|
1295
|
+
managedLog('INIT', 'Batch processing started', config, exports.LogType.INFO);
|
|
1296
|
+
// register SDK as source
|
|
1297
|
+
// push({
|
|
1298
|
+
// category: CategoryType.Event,
|
|
1299
|
+
// payload: {
|
|
1300
|
+
// id: sourceId,
|
|
1301
|
+
// category: CategoryType.Event,
|
|
1302
|
+
// key: 'sdk',
|
|
1303
|
+
// typeKey: 'javascript',
|
|
1304
|
+
// name: 'Blobs SDK Javascript',
|
|
1305
|
+
// desc: null,
|
|
1306
|
+
// },
|
|
1307
|
+
// type: 'apps.emitr.source.register',
|
|
1308
|
+
// });
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
var BaseServiceService = /*#__PURE__*/function () {
|
|
1312
|
+
function BaseServiceService() {
|
|
1313
|
+
this.name = void 0;
|
|
1314
|
+
}
|
|
1315
|
+
var _proto = BaseServiceService.prototype;
|
|
1316
|
+
_proto.request = /*#__PURE__*/function () {
|
|
1317
|
+
var _request = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(method, url, body, queries, headers) {
|
|
1318
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1319
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1320
|
+
case 0:
|
|
1321
|
+
return _context.abrupt("return", requestWithError(method, url, body, queries, headers));
|
|
1322
|
+
case 1:
|
|
1323
|
+
case "end":
|
|
1324
|
+
return _context.stop();
|
|
1325
|
+
}
|
|
1326
|
+
}, _callee);
|
|
1327
|
+
}));
|
|
1328
|
+
function request(_x, _x2, _x3, _x4, _x5) {
|
|
1329
|
+
return _request.apply(this, arguments);
|
|
1330
|
+
}
|
|
1331
|
+
return request;
|
|
1332
|
+
}();
|
|
1333
|
+
_proto.post = function post(path, body, queries, headers) {
|
|
1334
|
+
return this.request('POST', this.name + "/" + path, body, queries, headers);
|
|
1335
|
+
};
|
|
1336
|
+
_proto.put = function put(path, body, queries, headers) {
|
|
1337
|
+
return this.request('PUT', this.name + "/" + path, body, queries, headers);
|
|
1338
|
+
};
|
|
1339
|
+
_proto.get = function get(path, queries, headers) {
|
|
1340
|
+
return this.request('GET', this.name + "/" + path, null, queries, headers);
|
|
1341
|
+
};
|
|
1342
|
+
_proto.patch = function patch(path, body, queries, headers) {
|
|
1343
|
+
return this.request('PATCH', this.name + "/" + path, body, queries, headers);
|
|
1344
|
+
};
|
|
1345
|
+
_proto["delete"] = function _delete(path, queries, headers) {
|
|
1346
|
+
return this.request('DELETE', this.name + "/" + path, null, queries, headers);
|
|
1347
|
+
};
|
|
1348
|
+
return BaseServiceService;
|
|
1349
|
+
}();
|
|
1350
|
+
|
|
1351
|
+
var BaseEntityServiceService = /*#__PURE__*/function (_BaseServiceService) {
|
|
1352
|
+
function BaseEntityServiceService() {
|
|
1353
|
+
return _BaseServiceService.apply(this, arguments) || this;
|
|
1354
|
+
}
|
|
1355
|
+
_inheritsLoose(BaseEntityServiceService, _BaseServiceService);
|
|
1356
|
+
var _proto = BaseEntityServiceService.prototype;
|
|
1357
|
+
_proto.create = function create(body, queries, headers) {
|
|
1358
|
+
return this.post("" + this.name, body, queries, headers);
|
|
1359
|
+
};
|
|
1360
|
+
_proto.upsert = function upsert(body, queries, headers) {
|
|
1361
|
+
return this.put("" + this.name, body, queries, headers);
|
|
1362
|
+
};
|
|
1363
|
+
_proto.getOne = function getOne(id, queries, headers) {
|
|
1364
|
+
return this.get(this.name + "/" + id, queries, headers);
|
|
1365
|
+
};
|
|
1366
|
+
_proto.getMany = function getMany(queries, headers) {
|
|
1367
|
+
return this.get("" + this.name, queries, headers);
|
|
1368
|
+
};
|
|
1369
|
+
_proto.update = function update(id, body, queries, headers) {
|
|
1370
|
+
return this.patch(this.name + "/" + id, body, queries, headers);
|
|
1371
|
+
};
|
|
1372
|
+
_proto.remove = function remove(id, queries, headers) {
|
|
1373
|
+
return this["delete"](this.name + "/" + id, queries, headers);
|
|
1374
|
+
};
|
|
1375
|
+
_proto.getRelative = function getRelative(id, relative, queries, headers) {
|
|
1376
|
+
return this.get(this.name + "/" + id + "/" + relative, queries, headers);
|
|
1377
|
+
};
|
|
1378
|
+
_proto.getMetrics = function getMetrics(queries, headers) {
|
|
1379
|
+
if (queries === void 0) {
|
|
1380
|
+
queries = {};
|
|
1381
|
+
}
|
|
1382
|
+
return this.get(this.name + "/metrics", queries, headers);
|
|
1383
|
+
};
|
|
1384
|
+
_proto.find = function find(queries, type, headers) {
|
|
1385
|
+
if (type === void 0) {
|
|
1386
|
+
type = 'latest';
|
|
1387
|
+
}
|
|
1388
|
+
return this.get(this.name + "/find/" + type, queries, headers);
|
|
1389
|
+
};
|
|
1390
|
+
return BaseEntityServiceService;
|
|
1391
|
+
}(BaseServiceService);
|
|
1392
|
+
|
|
1393
|
+
exports.BaseEntityServiceService = BaseEntityServiceService;
|
|
1394
|
+
exports.BaseServiceService = BaseServiceService;
|
|
1395
|
+
exports.download = download;
|
|
1396
|
+
exports.get = get;
|
|
1397
|
+
exports.init = init;
|
|
1398
|
+
exports.mimeMap = mimeMap;
|
|
1399
|
+
exports.patch = patch;
|
|
1400
|
+
exports.post = post;
|
|
1401
|
+
exports.put = put;
|
|
1402
|
+
exports.raw = raw;
|
|
1403
|
+
exports.remove = remove;
|
|
1404
|
+
exports.request = request;
|
|
1405
|
+
exports.requestWithError = requestWithError;
|
|
1406
|
+
exports.run = run;
|
|
1407
|
+
exports.upload = upload;
|
|
1408
|
+
//# sourceMappingURL=jsx-blobs.cjs.development.js.map
|