@wecode-team/cms-supabase-api 0.1.52 → 0.1.53-beta.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/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1321 -661
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1321 -661
- package/dist/index.js.map +1 -1
- package/dist/utils/route-helpers.d.ts +9 -6
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { sendCode, verifyCode } from '@wecode-team/email-verify';
|
|
|
3
3
|
import * as jwt from 'jsonwebtoken';
|
|
4
4
|
import * as bcrypt from 'bcryptjs';
|
|
5
5
|
|
|
6
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
6
|
+
function asyncGeneratorStep$1(n, t, e, r, o, a, c) {
|
|
7
7
|
try {
|
|
8
8
|
var i = n[a](c),
|
|
9
9
|
u = i.value;
|
|
@@ -12,390 +12,391 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
|
12
12
|
}
|
|
13
13
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
14
14
|
}
|
|
15
|
-
function _asyncToGenerator(n) {
|
|
15
|
+
function _asyncToGenerator$1(n) {
|
|
16
16
|
return function () {
|
|
17
17
|
var t = this,
|
|
18
18
|
e = arguments;
|
|
19
19
|
return new Promise(function (r, o) {
|
|
20
20
|
var a = n.apply(t, e);
|
|
21
21
|
function _next(n) {
|
|
22
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
22
|
+
asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n);
|
|
23
23
|
}
|
|
24
24
|
function _throw(n) {
|
|
25
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
25
|
+
asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n);
|
|
26
26
|
}
|
|
27
27
|
_next(void 0);
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function _typeof$1(o) {
|
|
33
|
-
"@babel/helpers - typeof";
|
|
34
|
-
|
|
35
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
36
|
-
return typeof o;
|
|
37
|
-
} : function (o) {
|
|
38
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
39
|
-
}, _typeof$1(o);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
32
|
function getDefaultExportFromCjs (x) {
|
|
43
33
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
44
34
|
}
|
|
45
35
|
|
|
46
|
-
var regeneratorRuntime$
|
|
36
|
+
var regeneratorRuntime$2 = {exports: {}};
|
|
47
37
|
|
|
48
|
-
var OverloadYield = {exports: {}};
|
|
38
|
+
var OverloadYield$1 = {exports: {}};
|
|
49
39
|
|
|
50
40
|
(function (module) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
var OverloadYieldExports = OverloadYield.exports;
|
|
41
|
+
function _OverloadYield(e, d) {
|
|
42
|
+
this.v = e, this.k = d;
|
|
43
|
+
}
|
|
44
|
+
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
45
|
+
} (OverloadYield$1));
|
|
57
46
|
|
|
58
|
-
var
|
|
47
|
+
var OverloadYieldExports$1 = OverloadYield$1.exports;
|
|
59
48
|
|
|
60
|
-
var
|
|
49
|
+
var regenerator$3 = {exports: {}};
|
|
50
|
+
|
|
51
|
+
var regeneratorDefine$1 = {exports: {}};
|
|
61
52
|
|
|
62
53
|
(function (module) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
54
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
55
|
+
var i = Object.defineProperty;
|
|
56
|
+
try {
|
|
57
|
+
i({}, "", {});
|
|
58
|
+
} catch (e) {
|
|
59
|
+
i = 0;
|
|
60
|
+
}
|
|
61
|
+
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
|
|
62
|
+
function o(r, n) {
|
|
63
|
+
_regeneratorDefine(e, r, function (e) {
|
|
64
|
+
return this._invoke(r, n, e);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
r ? i ? i(e, r, {
|
|
68
|
+
value: n,
|
|
69
|
+
enumerable: !t,
|
|
70
|
+
configurable: !t,
|
|
71
|
+
writable: !t
|
|
72
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
73
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
|
|
74
|
+
}
|
|
75
|
+
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
76
|
+
} (regeneratorDefine$1));
|
|
77
|
+
|
|
78
|
+
var regeneratorDefineExports$1 = regeneratorDefine$1.exports;
|
|
87
79
|
|
|
88
80
|
(function (module) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
var regeneratorExports = regenerator$1.exports;
|
|
81
|
+
var regeneratorDefine = regeneratorDefineExports$1;
|
|
82
|
+
function _regenerator() {
|
|
83
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
84
|
+
var e,
|
|
85
|
+
t,
|
|
86
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
87
|
+
n = r.iterator || "@@iterator",
|
|
88
|
+
o = r.toStringTag || "@@toStringTag";
|
|
89
|
+
function i(r, n, o, i) {
|
|
90
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
91
|
+
u = Object.create(c.prototype);
|
|
92
|
+
return regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
93
|
+
var i,
|
|
94
|
+
c,
|
|
95
|
+
u,
|
|
96
|
+
f = 0,
|
|
97
|
+
p = o || [],
|
|
98
|
+
y = !1,
|
|
99
|
+
G = {
|
|
100
|
+
p: 0,
|
|
101
|
+
n: 0,
|
|
102
|
+
v: e,
|
|
103
|
+
a: d,
|
|
104
|
+
f: d.bind(e, 4),
|
|
105
|
+
d: function d(t, r) {
|
|
106
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function d(r, n) {
|
|
110
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
111
|
+
var o,
|
|
112
|
+
i = p[t],
|
|
113
|
+
d = G.p,
|
|
114
|
+
l = i[2];
|
|
115
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
116
|
+
}
|
|
117
|
+
if (o || r > 1) return a;
|
|
118
|
+
throw y = !0, n;
|
|
119
|
+
}
|
|
120
|
+
return function (o, p, l) {
|
|
121
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
122
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
123
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
124
|
+
try {
|
|
125
|
+
if (f = 2, i) {
|
|
126
|
+
if (c || (o = "next"), t = i[o]) {
|
|
127
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
128
|
+
if (!t.done) return t;
|
|
129
|
+
u = t.value, c < 2 && (c = 0);
|
|
130
|
+
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
131
|
+
i = e;
|
|
132
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
133
|
+
} catch (t) {
|
|
134
|
+
i = e, c = 1, u = t;
|
|
135
|
+
} finally {
|
|
136
|
+
f = 1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
value: t,
|
|
141
|
+
done: y
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
}(r, o, i), !0), u;
|
|
145
|
+
}
|
|
146
|
+
var a = {};
|
|
147
|
+
function Generator() {}
|
|
148
|
+
function GeneratorFunction() {}
|
|
149
|
+
function GeneratorFunctionPrototype() {}
|
|
150
|
+
t = Object.getPrototypeOf;
|
|
151
|
+
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
|
|
152
|
+
return this;
|
|
153
|
+
}), t),
|
|
154
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
155
|
+
function f(e) {
|
|
156
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
157
|
+
}
|
|
158
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function () {
|
|
159
|
+
return this;
|
|
160
|
+
}), regeneratorDefine(u, "toString", function () {
|
|
161
|
+
return "[object Generator]";
|
|
162
|
+
}), (module.exports = _regenerator = function _regenerator() {
|
|
163
|
+
return {
|
|
164
|
+
w: i,
|
|
165
|
+
m: f
|
|
166
|
+
};
|
|
167
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
168
|
+
}
|
|
169
|
+
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
170
|
+
} (regenerator$3));
|
|
180
171
|
|
|
181
|
-
var
|
|
172
|
+
var regeneratorExports$1 = regenerator$3.exports;
|
|
182
173
|
|
|
183
|
-
var
|
|
174
|
+
var regeneratorAsync$1 = {exports: {}};
|
|
184
175
|
|
|
185
|
-
var
|
|
176
|
+
var regeneratorAsyncGen$1 = {exports: {}};
|
|
177
|
+
|
|
178
|
+
var regeneratorAsyncIterator$1 = {exports: {}};
|
|
186
179
|
|
|
187
180
|
(function (module) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
181
|
+
var OverloadYield = OverloadYieldExports$1;
|
|
182
|
+
var regeneratorDefine = regeneratorDefineExports$1;
|
|
183
|
+
function AsyncIterator(t, e) {
|
|
184
|
+
function n(r, o, i, f) {
|
|
185
|
+
try {
|
|
186
|
+
var c = t[r](o),
|
|
187
|
+
u = c.value;
|
|
188
|
+
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
189
|
+
n("next", t, i, f);
|
|
190
|
+
}, function (t) {
|
|
191
|
+
n("throw", t, i, f);
|
|
192
|
+
}) : e.resolve(u).then(function (t) {
|
|
193
|
+
c.value = t, i(c);
|
|
194
|
+
}, function (t) {
|
|
195
|
+
return n("throw", t, i, f);
|
|
196
|
+
});
|
|
197
|
+
} catch (t) {
|
|
198
|
+
f(t);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
var r;
|
|
202
|
+
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
203
|
+
return this;
|
|
204
|
+
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
205
|
+
function f() {
|
|
206
|
+
return new e(function (e, r) {
|
|
207
|
+
n(t, i, e, r);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return r = r ? r.then(f, f) : f();
|
|
211
|
+
}, !0);
|
|
212
|
+
}
|
|
213
|
+
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
214
|
+
} (regeneratorAsyncIterator$1));
|
|
215
|
+
|
|
216
|
+
var regeneratorAsyncIteratorExports$1 = regeneratorAsyncIterator$1.exports;
|
|
223
217
|
|
|
224
218
|
(function (module) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
219
|
+
var regenerator = regeneratorExports$1;
|
|
220
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports$1;
|
|
221
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
222
|
+
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
|
|
223
|
+
}
|
|
224
|
+
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
225
|
+
} (regeneratorAsyncGen$1));
|
|
226
|
+
|
|
227
|
+
var regeneratorAsyncGenExports$1 = regeneratorAsyncGen$1.exports;
|
|
233
228
|
|
|
234
229
|
(function (module) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
var regeneratorAsyncExports = regeneratorAsync.exports;
|
|
230
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports$1;
|
|
231
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
232
|
+
var a = regeneratorAsyncGen(n, e, r, t, o);
|
|
233
|
+
return a.next().then(function (n) {
|
|
234
|
+
return n.done ? n.value : a.next();
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
238
|
+
} (regeneratorAsync$1));
|
|
245
239
|
|
|
246
|
-
var
|
|
240
|
+
var regeneratorAsyncExports$1 = regeneratorAsync$1.exports;
|
|
241
|
+
|
|
242
|
+
var regeneratorKeys$1 = {exports: {}};
|
|
247
243
|
|
|
248
244
|
(function (module) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
var regeneratorKeysExports = regeneratorKeys.exports;
|
|
245
|
+
function _regeneratorKeys(e) {
|
|
246
|
+
var n = Object(e),
|
|
247
|
+
r = [];
|
|
248
|
+
for (var t in n) r.unshift(t);
|
|
249
|
+
return function e() {
|
|
250
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
251
|
+
return e.done = !0, e;
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
255
|
+
} (regeneratorKeys$1));
|
|
261
256
|
|
|
262
|
-
var
|
|
257
|
+
var regeneratorKeysExports$1 = regeneratorKeys$1.exports;
|
|
263
258
|
|
|
264
|
-
var
|
|
259
|
+
var regeneratorValues$1 = {exports: {}};
|
|
260
|
+
|
|
261
|
+
var _typeof$3 = {exports: {}};
|
|
265
262
|
|
|
266
263
|
(function (module) {
|
|
267
|
-
|
|
268
|
-
|
|
264
|
+
function _typeof(o) {
|
|
265
|
+
"@babel/helpers - typeof";
|
|
269
266
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
267
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
268
|
+
return typeof o;
|
|
269
|
+
} : function (o) {
|
|
270
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
271
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
272
|
+
}
|
|
273
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
274
|
+
} (_typeof$3));
|
|
275
|
+
|
|
276
|
+
var _typeofExports$1 = _typeof$3.exports;
|
|
279
277
|
|
|
280
278
|
(function (module) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
279
|
+
var _typeof = _typeofExports$1["default"];
|
|
280
|
+
function _regeneratorValues(e) {
|
|
281
|
+
if (null != e) {
|
|
282
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
283
|
+
r = 0;
|
|
284
|
+
if (t) return t.call(e);
|
|
285
|
+
if ("function" == typeof e.next) return e;
|
|
286
|
+
if (!isNaN(e.length)) return {
|
|
287
|
+
next: function next() {
|
|
288
|
+
return e && r >= e.length && (e = void 0), {
|
|
289
|
+
value: e && e[r++],
|
|
290
|
+
done: !e
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
296
|
+
}
|
|
297
|
+
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
298
|
+
} (regeneratorValues$1));
|
|
299
|
+
|
|
300
|
+
var regeneratorValuesExports$1 = regeneratorValues$1.exports;
|
|
302
301
|
|
|
303
302
|
(function (module) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
303
|
+
var OverloadYield = OverloadYieldExports$1;
|
|
304
|
+
var regenerator = regeneratorExports$1;
|
|
305
|
+
var regeneratorAsync = regeneratorAsyncExports$1;
|
|
306
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports$1;
|
|
307
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports$1;
|
|
308
|
+
var regeneratorKeys = regeneratorKeysExports$1;
|
|
309
|
+
var regeneratorValues = regeneratorValuesExports$1;
|
|
310
|
+
function _regeneratorRuntime() {
|
|
312
311
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
312
|
+
var r = regenerator(),
|
|
313
|
+
e = r.m(_regeneratorRuntime),
|
|
314
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
315
|
+
function n(r) {
|
|
316
|
+
var e = "function" == typeof r && r.constructor;
|
|
317
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
318
|
+
}
|
|
319
|
+
var o = {
|
|
320
|
+
"throw": 1,
|
|
321
|
+
"return": 2,
|
|
322
|
+
"break": 3,
|
|
323
|
+
"continue": 3
|
|
324
|
+
};
|
|
325
|
+
function a(r) {
|
|
326
|
+
var e, t;
|
|
327
|
+
return function (n) {
|
|
328
|
+
e || (e = {
|
|
329
|
+
stop: function stop() {
|
|
330
|
+
return t(n.a, 2);
|
|
331
|
+
},
|
|
332
|
+
"catch": function _catch() {
|
|
333
|
+
return n.v;
|
|
334
|
+
},
|
|
335
|
+
abrupt: function abrupt(r, e) {
|
|
336
|
+
return t(n.a, o[r], e);
|
|
337
|
+
},
|
|
338
|
+
delegateYield: function delegateYield(r, o, a) {
|
|
339
|
+
return e.resultName = o, t(n.d, regeneratorValues(r), a);
|
|
340
|
+
},
|
|
341
|
+
finish: function finish(r) {
|
|
342
|
+
return t(n.f, r);
|
|
343
|
+
}
|
|
344
|
+
}, t = function t(r, _t, o) {
|
|
345
|
+
n.p = e.prev, n.n = e.next;
|
|
346
|
+
try {
|
|
347
|
+
return r(_t, o);
|
|
348
|
+
} finally {
|
|
349
|
+
e.next = n.n;
|
|
350
|
+
}
|
|
351
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
352
|
+
try {
|
|
353
|
+
return r.call(this, e);
|
|
354
|
+
} finally {
|
|
355
|
+
n.p = e.prev, n.n = e.next;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
360
|
+
return {
|
|
361
|
+
wrap: function wrap(e, t, n, o) {
|
|
362
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
363
|
+
},
|
|
364
|
+
isGeneratorFunction: n,
|
|
365
|
+
mark: r.m,
|
|
366
|
+
awrap: function awrap(r, e) {
|
|
367
|
+
return new OverloadYield(r, e);
|
|
368
|
+
},
|
|
369
|
+
AsyncIterator: regeneratorAsyncIterator,
|
|
370
|
+
async: function async(r, e, t, o, u) {
|
|
371
|
+
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
|
|
372
|
+
},
|
|
373
|
+
keys: regeneratorKeys,
|
|
374
|
+
values: regeneratorValues
|
|
375
|
+
};
|
|
376
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
377
|
+
}
|
|
378
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
379
|
+
} (regeneratorRuntime$2));
|
|
380
|
+
|
|
381
|
+
var regeneratorRuntimeExports$1 = regeneratorRuntime$2.exports;
|
|
382
382
|
|
|
383
383
|
// TODO(Babel 8): Remove this file.
|
|
384
384
|
|
|
385
|
-
var runtime = regeneratorRuntimeExports();
|
|
386
|
-
var regenerator = runtime;
|
|
385
|
+
var runtime$1 = regeneratorRuntimeExports$1();
|
|
386
|
+
var regenerator$2 = runtime$1;
|
|
387
387
|
|
|
388
388
|
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
389
389
|
try {
|
|
390
|
-
regeneratorRuntime = runtime;
|
|
390
|
+
regeneratorRuntime = runtime$1;
|
|
391
391
|
} catch (accidentalStrictMode) {
|
|
392
|
-
if (
|
|
393
|
-
globalThis.regeneratorRuntime = runtime;
|
|
392
|
+
if (typeof globalThis === "object") {
|
|
393
|
+
globalThis.regeneratorRuntime = runtime$1;
|
|
394
394
|
} else {
|
|
395
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
395
|
+
Function("r", "regeneratorRuntime = r")(runtime$1);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
|
|
398
|
+
|
|
399
|
+
var _regeneratorRuntime$1 = /*@__PURE__*/getDefaultExportFromCjs(regenerator$2);
|
|
399
400
|
|
|
400
401
|
var supabaseInstance = null;
|
|
401
402
|
/**
|
|
@@ -435,9 +436,9 @@ function testConnection() {
|
|
|
435
436
|
* 通过直接创建表和函数来避免手动执行 SQL 文件
|
|
436
437
|
*/
|
|
437
438
|
function _testConnection() {
|
|
438
|
-
_testConnection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
439
|
+
_testConnection = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
|
439
440
|
var supabase, _yield$supabase$from$, error, _t;
|
|
440
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
441
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
441
442
|
while (1) switch (_context.prev = _context.next) {
|
|
442
443
|
case 0:
|
|
443
444
|
_context.prev = 0;
|
|
@@ -476,9 +477,9 @@ function executeSupabaseSetup() {
|
|
|
476
477
|
* 初始化CMS系统表
|
|
477
478
|
*/
|
|
478
479
|
function _executeSupabaseSetup() {
|
|
479
|
-
_executeSupabaseSetup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
480
|
+
_executeSupabaseSetup = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2() {
|
|
480
481
|
var supabase, createTableSQL, _yield$supabase$from$2, tableError, fullSetupSQL, functionsToCheck, missingFunctions, _i, _functionsToCheck, funcName, _t3;
|
|
481
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
482
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
482
483
|
while (1) switch (_context2.prev = _context2.next) {
|
|
483
484
|
case 0:
|
|
484
485
|
_context2.prev = 0;
|
|
@@ -608,9 +609,9 @@ function initializeCmsSystem() {
|
|
|
608
609
|
* 关闭Supabase连接(实际上Supabase客户端不需要显式关闭)
|
|
609
610
|
*/
|
|
610
611
|
function _initializeCmsSystem() {
|
|
611
|
-
_initializeCmsSystem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
612
|
+
_initializeCmsSystem = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3() {
|
|
612
613
|
var setupSuccess, supabase, _yield$supabase$rpc, error, _t4;
|
|
613
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
614
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
614
615
|
while (1) switch (_context3.prev = _context3.next) {
|
|
615
616
|
case 0:
|
|
616
617
|
_context3.prev = 0;
|
|
@@ -657,8 +658,8 @@ function closeSupabase() {
|
|
|
657
658
|
* 用户可以复制此脚本到 Supabase SQL 编辑器中执行
|
|
658
659
|
*/
|
|
659
660
|
function _closeSupabase() {
|
|
660
|
-
_closeSupabase = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
661
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
661
|
+
_closeSupabase = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4() {
|
|
662
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
662
663
|
while (1) switch (_context4.prev = _context4.next) {
|
|
663
664
|
case 0:
|
|
664
665
|
supabaseInstance = null;
|
|
@@ -678,34 +679,44 @@ var feishuAlertConfig = {
|
|
|
678
679
|
crudErrorWebhookUrls: ["https://open.feishu.cn/open-apis/bot/v2/hook/784e9470-c1fd-4e38-97a2-b9a1856c00b1"]
|
|
679
680
|
};
|
|
680
681
|
|
|
681
|
-
function _classCallCheck(a, n) {
|
|
682
|
+
function _classCallCheck$1(a, n) {
|
|
682
683
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
683
684
|
}
|
|
684
685
|
|
|
685
|
-
function
|
|
686
|
-
|
|
686
|
+
function _typeof$2(o) {
|
|
687
|
+
"@babel/helpers - typeof";
|
|
688
|
+
|
|
689
|
+
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
690
|
+
return typeof o;
|
|
691
|
+
} : function (o) {
|
|
692
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
693
|
+
}, _typeof$2(o);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
function toPrimitive$1(t, r) {
|
|
697
|
+
if ("object" != _typeof$2(t) || !t) return t;
|
|
687
698
|
var e = t[Symbol.toPrimitive];
|
|
688
699
|
if (void 0 !== e) {
|
|
689
700
|
var i = e.call(t, r || "default");
|
|
690
|
-
if ("object" != _typeof$
|
|
701
|
+
if ("object" != _typeof$2(i)) return i;
|
|
691
702
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
692
703
|
}
|
|
693
704
|
return ("string" === r ? String : Number)(t);
|
|
694
705
|
}
|
|
695
706
|
|
|
696
|
-
function toPropertyKey(t) {
|
|
697
|
-
var i = toPrimitive(t, "string");
|
|
698
|
-
return "symbol" == _typeof$
|
|
707
|
+
function toPropertyKey$1(t) {
|
|
708
|
+
var i = toPrimitive$1(t, "string");
|
|
709
|
+
return "symbol" == _typeof$2(i) ? i : i + "";
|
|
699
710
|
}
|
|
700
711
|
|
|
701
|
-
function _defineProperties(e, r) {
|
|
712
|
+
function _defineProperties$1(e, r) {
|
|
702
713
|
for (var t = 0; t < r.length; t++) {
|
|
703
714
|
var o = r[t];
|
|
704
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
715
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$1(o.key), o);
|
|
705
716
|
}
|
|
706
717
|
}
|
|
707
|
-
function _createClass(e, r, t) {
|
|
708
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
718
|
+
function _createClass$1(e, r, t) {
|
|
719
|
+
return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", {
|
|
709
720
|
writable: !1
|
|
710
721
|
}), e;
|
|
711
722
|
}
|
|
@@ -713,19 +724,19 @@ function _createClass(e, r, t) {
|
|
|
713
724
|
// CMS 模型服务类
|
|
714
725
|
var CmsModelService = /*#__PURE__*/function () {
|
|
715
726
|
function CmsModelService() {
|
|
716
|
-
_classCallCheck(this, CmsModelService);
|
|
727
|
+
_classCallCheck$1(this, CmsModelService);
|
|
717
728
|
this.tableName = "_cms_models";
|
|
718
729
|
this.supabase = getSupabase();
|
|
719
730
|
}
|
|
720
731
|
/**
|
|
721
732
|
* 创建新的CMS模型
|
|
722
733
|
*/
|
|
723
|
-
return _createClass(CmsModelService, [{
|
|
734
|
+
return _createClass$1(CmsModelService, [{
|
|
724
735
|
key: "create",
|
|
725
736
|
value: (function () {
|
|
726
|
-
var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
737
|
+
var _create = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(data) {
|
|
727
738
|
var _yield$this$supabase$, result, error;
|
|
728
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
739
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
729
740
|
while (1) switch (_context.prev = _context.next) {
|
|
730
741
|
case 0:
|
|
731
742
|
_context.next = 1;
|
|
@@ -759,9 +770,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
759
770
|
}, {
|
|
760
771
|
key: "findById",
|
|
761
772
|
value: (function () {
|
|
762
|
-
var _findById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
|
773
|
+
var _findById = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(id) {
|
|
763
774
|
var _yield$this$supabase$2, data, error;
|
|
764
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
775
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
765
776
|
while (1) switch (_context2.prev = _context2.next) {
|
|
766
777
|
case 0:
|
|
767
778
|
_context2.next = 1;
|
|
@@ -801,9 +812,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
801
812
|
}, {
|
|
802
813
|
key: "findByTableName",
|
|
803
814
|
value: (function () {
|
|
804
|
-
var _findByTableName = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tableName) {
|
|
815
|
+
var _findByTableName = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(tableName) {
|
|
805
816
|
var _yield$this$supabase$3, data, error;
|
|
806
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
817
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
807
818
|
while (1) switch (_context3.prev = _context3.next) {
|
|
808
819
|
case 0:
|
|
809
820
|
_context3.next = 1;
|
|
@@ -843,9 +854,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
843
854
|
}, {
|
|
844
855
|
key: "findAll",
|
|
845
856
|
value: (function () {
|
|
846
|
-
var _findAll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
857
|
+
var _findAll = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4() {
|
|
847
858
|
var _yield$this$supabase$4, data, error;
|
|
848
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
859
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
849
860
|
while (1) switch (_context4.prev = _context4.next) {
|
|
850
861
|
case 0:
|
|
851
862
|
_context4.next = 1;
|
|
@@ -881,9 +892,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
881
892
|
}, {
|
|
882
893
|
key: "update",
|
|
883
894
|
value: (function () {
|
|
884
|
-
var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, data) {
|
|
895
|
+
var _update = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(id, data) {
|
|
885
896
|
var _yield$this$supabase$5, result, error;
|
|
886
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
897
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
887
898
|
while (1) switch (_context5.prev = _context5.next) {
|
|
888
899
|
case 0:
|
|
889
900
|
_context5.next = 1;
|
|
@@ -917,9 +928,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
917
928
|
}, {
|
|
918
929
|
key: "delete",
|
|
919
930
|
value: (function () {
|
|
920
|
-
var _delete2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
|
|
931
|
+
var _delete2 = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(id) {
|
|
921
932
|
var _yield$this$supabase$6, error;
|
|
922
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
933
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
923
934
|
while (1) switch (_context6.prev = _context6.next) {
|
|
924
935
|
case 0:
|
|
925
936
|
_context6.next = 1;
|
|
@@ -965,9 +976,9 @@ function initializeCmsModel() {
|
|
|
965
976
|
}
|
|
966
977
|
// 为了向后兼容,导出服务类作为默认导出
|
|
967
978
|
function _initializeCmsModel() {
|
|
968
|
-
_initializeCmsModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
979
|
+
_initializeCmsModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7() {
|
|
969
980
|
var supabase, createTableSQL, _yield$supabase$rpc, error, _t;
|
|
970
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
981
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
971
982
|
while (1) switch (_context7.prev = _context7.next) {
|
|
972
983
|
case 0:
|
|
973
984
|
_context7.prev = 0;
|
|
@@ -1003,8 +1014,8 @@ function _initializeCmsModel() {
|
|
|
1003
1014
|
return _initializeCmsModel.apply(this, arguments);
|
|
1004
1015
|
}
|
|
1005
1016
|
|
|
1006
|
-
function _defineProperty(e, r, t) {
|
|
1007
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1017
|
+
function _defineProperty$1(e, r, t) {
|
|
1018
|
+
return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
1008
1019
|
value: t,
|
|
1009
1020
|
enumerable: !0,
|
|
1010
1021
|
configurable: !0,
|
|
@@ -1012,11 +1023,11 @@ function _defineProperty(e, r, t) {
|
|
|
1012
1023
|
}) : e[r] = t, e;
|
|
1013
1024
|
}
|
|
1014
1025
|
|
|
1015
|
-
function ownKeys$
|
|
1016
|
-
function _objectSpread$
|
|
1017
|
-
function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$
|
|
1018
|
-
function _unsupportedIterableToArray$
|
|
1019
|
-
function _arrayLikeToArray$
|
|
1026
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1027
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1028
|
+
function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
1029
|
+
function _unsupportedIterableToArray$4(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$4(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0; } }
|
|
1030
|
+
function _arrayLikeToArray$4(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
1020
1031
|
// 字段类型映射到PostgreSQL类型
|
|
1021
1032
|
var fieldTypeMapping = {
|
|
1022
1033
|
string: "text",
|
|
@@ -1034,20 +1045,20 @@ var fieldTypeMapping = {
|
|
|
1034
1045
|
};
|
|
1035
1046
|
var DynamicTableService = /*#__PURE__*/function () {
|
|
1036
1047
|
function DynamicTableService() {
|
|
1037
|
-
_classCallCheck(this, DynamicTableService);
|
|
1048
|
+
_classCallCheck$1(this, DynamicTableService);
|
|
1038
1049
|
this.supabase = getSupabase();
|
|
1039
1050
|
}
|
|
1040
1051
|
/**
|
|
1041
1052
|
* 默认按 created_at 倒序(新数据在前)。
|
|
1042
1053
|
* 兼容:如果表不存在 created_at 字段,则回退按 id 倒序。
|
|
1043
1054
|
*/
|
|
1044
|
-
return _createClass(DynamicTableService, [{
|
|
1055
|
+
return _createClass$1(DynamicTableService, [{
|
|
1045
1056
|
key: "orderByCreatedAtOrFallback",
|
|
1046
1057
|
value: (function () {
|
|
1047
|
-
var _orderByCreatedAtOrFallback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(buildQuery, offset, limit) {
|
|
1058
|
+
var _orderByCreatedAtOrFallback = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(buildQuery, offset, limit) {
|
|
1048
1059
|
var _first$error;
|
|
1049
1060
|
var first, msg, isMissingCreatedAt, second;
|
|
1050
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
1061
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
1051
1062
|
while (1) switch (_context.prev = _context.next) {
|
|
1052
1063
|
case 0:
|
|
1053
1064
|
_context.next = 1;
|
|
@@ -1178,9 +1189,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1178
1189
|
}, {
|
|
1179
1190
|
key: "createTable",
|
|
1180
1191
|
value: (function () {
|
|
1181
|
-
var _createTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(tableName, schema, baseTableName) {
|
|
1192
|
+
var _createTable = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(tableName, schema, baseTableName) {
|
|
1182
1193
|
var tablePrefix, createTableSQL, foreignKeys, _yield$this$supabase$, error, _t;
|
|
1183
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
1194
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
1184
1195
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1185
1196
|
case 0:
|
|
1186
1197
|
_context2.prev = 0;
|
|
@@ -1274,9 +1285,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1274
1285
|
}, {
|
|
1275
1286
|
key: "dropTable",
|
|
1276
1287
|
value: (function () {
|
|
1277
|
-
var _dropTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tableName) {
|
|
1288
|
+
var _dropTable = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(tableName) {
|
|
1278
1289
|
var _yield$this$supabase$2, error, _t2;
|
|
1279
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
1290
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
1280
1291
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1281
1292
|
case 0:
|
|
1282
1293
|
_context3.prev = 0;
|
|
@@ -1319,9 +1330,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1319
1330
|
}, {
|
|
1320
1331
|
key: "dropAllForeignKeys",
|
|
1321
1332
|
value: (function () {
|
|
1322
|
-
var _dropAllForeignKeys = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(tableName) {
|
|
1333
|
+
var _dropAllForeignKeys = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(tableName) {
|
|
1323
1334
|
var parts, baseTableName, dropFKSQL, _yield$this$supabase$3, error, _t3;
|
|
1324
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
1335
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
1325
1336
|
while (1) switch (_context4.prev = _context4.next) {
|
|
1326
1337
|
case 0:
|
|
1327
1338
|
_context4.prev = 0;
|
|
@@ -1371,9 +1382,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1371
1382
|
}, {
|
|
1372
1383
|
key: "dropForeignKeyByName",
|
|
1373
1384
|
value: (function () {
|
|
1374
|
-
var _dropForeignKeyByName = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(tableName, constraintName) {
|
|
1385
|
+
var _dropForeignKeyByName = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(tableName, constraintName) {
|
|
1375
1386
|
var dropSQL, _yield$this$supabase$4, error, _t4;
|
|
1376
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
1387
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
1377
1388
|
while (1) switch (_context5.prev = _context5.next) {
|
|
1378
1389
|
case 0:
|
|
1379
1390
|
_context5.prev = 0;
|
|
@@ -1417,9 +1428,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1417
1428
|
}, {
|
|
1418
1429
|
key: "dropForeignKey",
|
|
1419
1430
|
value: (function () {
|
|
1420
|
-
var _dropForeignKey = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(tableName, constraintName) {
|
|
1431
|
+
var _dropForeignKey = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(tableName, constraintName) {
|
|
1421
1432
|
var _yield$this$supabase$5, error, _t5;
|
|
1422
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
1433
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
1423
1434
|
while (1) switch (_context6.prev = _context6.next) {
|
|
1424
1435
|
case 0:
|
|
1425
1436
|
_context6.prev = 0;
|
|
@@ -1461,9 +1472,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1461
1472
|
}, {
|
|
1462
1473
|
key: "tableExists",
|
|
1463
1474
|
value: (function () {
|
|
1464
|
-
var _tableExists = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(tableName) {
|
|
1475
|
+
var _tableExists = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(tableName) {
|
|
1465
1476
|
var _yield$this$supabase$6, data, error, _t6;
|
|
1466
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
1477
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
1467
1478
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1468
1479
|
case 0:
|
|
1469
1480
|
_context7.prev = 0;
|
|
@@ -1505,9 +1516,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1505
1516
|
}, {
|
|
1506
1517
|
key: "getTableStructure",
|
|
1507
1518
|
value: (function () {
|
|
1508
|
-
var _getTableStructure = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(tableName) {
|
|
1519
|
+
var _getTableStructure = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee8(tableName) {
|
|
1509
1520
|
var _yield$this$supabase$7, data, error, _t7;
|
|
1510
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
1521
|
+
return _regeneratorRuntime$1.wrap(function (_context8) {
|
|
1511
1522
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1512
1523
|
case 0:
|
|
1513
1524
|
_context8.prev = 0;
|
|
@@ -1549,9 +1560,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1549
1560
|
}, {
|
|
1550
1561
|
key: "executeQuery",
|
|
1551
1562
|
value: (function () {
|
|
1552
|
-
var _executeQuery = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(sql, values) {
|
|
1563
|
+
var _executeQuery = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee9(sql, values) {
|
|
1553
1564
|
var finalSql, _yield$this$supabase$8, data, error, _t8;
|
|
1554
|
-
return _regeneratorRuntime.wrap(function (_context9) {
|
|
1565
|
+
return _regeneratorRuntime$1.wrap(function (_context9) {
|
|
1555
1566
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1556
1567
|
case 0:
|
|
1557
1568
|
_context9.prev = 0;
|
|
@@ -1602,7 +1613,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1602
1613
|
}, {
|
|
1603
1614
|
key: "getTableData",
|
|
1604
1615
|
value: (function () {
|
|
1605
|
-
var _getTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(tableName) {
|
|
1616
|
+
var _getTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee0(tableName) {
|
|
1606
1617
|
var _this = this;
|
|
1607
1618
|
var page,
|
|
1608
1619
|
limit,
|
|
@@ -1615,7 +1626,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1615
1626
|
count,
|
|
1616
1627
|
_args0 = arguments,
|
|
1617
1628
|
_t9;
|
|
1618
|
-
return _regeneratorRuntime.wrap(function (_context0) {
|
|
1629
|
+
return _regeneratorRuntime$1.wrap(function (_context0) {
|
|
1619
1630
|
while (1) switch (_context0.prev = _context0.next) {
|
|
1620
1631
|
case 0:
|
|
1621
1632
|
page = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 1;
|
|
@@ -1674,7 +1685,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1674
1685
|
}, {
|
|
1675
1686
|
key: "getTableDataWithSearch",
|
|
1676
1687
|
value: (function () {
|
|
1677
|
-
var _getTableDataWithSearch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(tableName) {
|
|
1688
|
+
var _getTableDataWithSearch = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee1(tableName) {
|
|
1678
1689
|
var _this2 = this;
|
|
1679
1690
|
var page,
|
|
1680
1691
|
limit,
|
|
@@ -1688,7 +1699,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1688
1699
|
count,
|
|
1689
1700
|
_args1 = arguments,
|
|
1690
1701
|
_t0;
|
|
1691
|
-
return _regeneratorRuntime.wrap(function (_context1) {
|
|
1702
|
+
return _regeneratorRuntime$1.wrap(function (_context1) {
|
|
1692
1703
|
while (1) switch (_context1.prev = _context1.next) {
|
|
1693
1704
|
case 0:
|
|
1694
1705
|
page = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : 1;
|
|
@@ -1750,7 +1761,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1750
1761
|
}, {
|
|
1751
1762
|
key: "insertData",
|
|
1752
1763
|
value: (function () {
|
|
1753
|
-
var _insertData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(tableName, data) {
|
|
1764
|
+
var _insertData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee10(tableName, data) {
|
|
1754
1765
|
var autoFixForeignKey,
|
|
1755
1766
|
_yield$this$supabase$9,
|
|
1756
1767
|
result,
|
|
@@ -1762,7 +1773,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1762
1773
|
_dropResult,
|
|
1763
1774
|
_args10 = arguments,
|
|
1764
1775
|
_t1;
|
|
1765
|
-
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1776
|
+
return _regeneratorRuntime$1.wrap(function (_context10) {
|
|
1766
1777
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1767
1778
|
case 0:
|
|
1768
1779
|
autoFixForeignKey = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : true;
|
|
@@ -1852,7 +1863,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1852
1863
|
}, {
|
|
1853
1864
|
key: "updateData",
|
|
1854
1865
|
value: (function () {
|
|
1855
|
-
var _updateData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(tableName, id, data) {
|
|
1866
|
+
var _updateData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11(tableName, id, data) {
|
|
1856
1867
|
var autoFixForeignKey,
|
|
1857
1868
|
_yield$this$supabase$0,
|
|
1858
1869
|
result,
|
|
@@ -1864,7 +1875,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1864
1875
|
_dropResult2,
|
|
1865
1876
|
_args11 = arguments,
|
|
1866
1877
|
_t10;
|
|
1867
|
-
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1878
|
+
return _regeneratorRuntime$1.wrap(function (_context11) {
|
|
1868
1879
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1869
1880
|
case 0:
|
|
1870
1881
|
autoFixForeignKey = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : true;
|
|
@@ -1952,9 +1963,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1952
1963
|
}, {
|
|
1953
1964
|
key: "deleteData",
|
|
1954
1965
|
value: (function () {
|
|
1955
|
-
var _deleteData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(tableName, id) {
|
|
1966
|
+
var _deleteData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee12(tableName, id) {
|
|
1956
1967
|
var _yield$this$supabase$1, result, error, _t11;
|
|
1957
|
-
return _regeneratorRuntime.wrap(function (_context12) {
|
|
1968
|
+
return _regeneratorRuntime$1.wrap(function (_context12) {
|
|
1958
1969
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1959
1970
|
case 0:
|
|
1960
1971
|
_context12.prev = 0;
|
|
@@ -1995,9 +2006,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1995
2006
|
}, {
|
|
1996
2007
|
key: "getDataById",
|
|
1997
2008
|
value: (function () {
|
|
1998
|
-
var _getDataById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(tableName, id) {
|
|
2009
|
+
var _getDataById = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee13(tableName, id) {
|
|
1999
2010
|
var _yield$this$supabase$10, data, error, _t12;
|
|
2000
|
-
return _regeneratorRuntime.wrap(function (_context13) {
|
|
2011
|
+
return _regeneratorRuntime$1.wrap(function (_context13) {
|
|
2001
2012
|
while (1) switch (_context13.prev = _context13.next) {
|
|
2002
2013
|
case 0:
|
|
2003
2014
|
_context13.prev = 0;
|
|
@@ -2045,9 +2056,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2045
2056
|
}, {
|
|
2046
2057
|
key: "getRelationOptions",
|
|
2047
2058
|
value: (function () {
|
|
2048
|
-
var _getRelationOptions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(params) {
|
|
2059
|
+
var _getRelationOptions = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee14(params) {
|
|
2049
2060
|
var tableName, _params$displayField, displayField, _params$limit, limit, search, query, _yield$query, data, error, _t13;
|
|
2050
|
-
return _regeneratorRuntime.wrap(function (_context14) {
|
|
2061
|
+
return _regeneratorRuntime$1.wrap(function (_context14) {
|
|
2051
2062
|
while (1) switch (_context14.prev = _context14.next) {
|
|
2052
2063
|
case 0:
|
|
2053
2064
|
_context14.prev = 0;
|
|
@@ -2069,7 +2080,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2069
2080
|
throw error;
|
|
2070
2081
|
case 2:
|
|
2071
2082
|
return _context14.abrupt("return", (data || []).map(function (item) {
|
|
2072
|
-
return _objectSpread$
|
|
2083
|
+
return _objectSpread$5({
|
|
2073
2084
|
id: item.id,
|
|
2074
2085
|
label: item[displayField] || "ID: ".concat(item.id)
|
|
2075
2086
|
}, item);
|
|
@@ -2102,7 +2113,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2102
2113
|
}, {
|
|
2103
2114
|
key: "getTableDataWithRelations",
|
|
2104
2115
|
value: (function () {
|
|
2105
|
-
var _getTableDataWithRelations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(tableName, schema) {
|
|
2116
|
+
var _getTableDataWithRelations = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee15(tableName, schema) {
|
|
2106
2117
|
var _this3 = this;
|
|
2107
2118
|
var page,
|
|
2108
2119
|
limit,
|
|
@@ -2116,7 +2127,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2116
2127
|
count,
|
|
2117
2128
|
_args15 = arguments,
|
|
2118
2129
|
_t14;
|
|
2119
|
-
return _regeneratorRuntime.wrap(function (_context15) {
|
|
2130
|
+
return _regeneratorRuntime$1.wrap(function (_context15) {
|
|
2120
2131
|
while (1) switch (_context15.prev = _context15.next) {
|
|
2121
2132
|
case 0:
|
|
2122
2133
|
page = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : 1;
|
|
@@ -2182,28 +2193,28 @@ function getDynamicTableService() {
|
|
|
2182
2193
|
return defaultService$1;
|
|
2183
2194
|
}
|
|
2184
2195
|
|
|
2185
|
-
function ownKeys$
|
|
2186
|
-
function _objectSpread$
|
|
2196
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2197
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2187
2198
|
var AuthService = /*#__PURE__*/function () {
|
|
2188
2199
|
function AuthService() {
|
|
2189
|
-
_classCallCheck(this, AuthService);
|
|
2200
|
+
_classCallCheck$1(this, AuthService);
|
|
2190
2201
|
this.supabase = getSupabase();
|
|
2191
2202
|
this.defaultTableName = 'cms_users';
|
|
2192
2203
|
}
|
|
2193
2204
|
/**
|
|
2194
2205
|
* 根据用户名查询用户
|
|
2195
2206
|
*/
|
|
2196
|
-
return _createClass(AuthService, [{
|
|
2207
|
+
return _createClass$1(AuthService, [{
|
|
2197
2208
|
key: "findUserByUsername",
|
|
2198
2209
|
value: (function () {
|
|
2199
|
-
var _findUserByUsername = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(username) {
|
|
2210
|
+
var _findUserByUsername = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(username) {
|
|
2200
2211
|
var tableName,
|
|
2201
2212
|
_yield$this$supabase$,
|
|
2202
2213
|
users,
|
|
2203
2214
|
error,
|
|
2204
2215
|
_args = arguments,
|
|
2205
2216
|
_t;
|
|
2206
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
2217
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
2207
2218
|
while (1) switch (_context.prev = _context.next) {
|
|
2208
2219
|
case 0:
|
|
2209
2220
|
tableName = _args.length > 1 && _args[1] !== undefined ? _args[1] : this.defaultTableName;
|
|
@@ -2251,14 +2262,14 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2251
2262
|
}, {
|
|
2252
2263
|
key: "findUserById",
|
|
2253
2264
|
value: (function () {
|
|
2254
|
-
var _findUserById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(userId) {
|
|
2265
|
+
var _findUserById = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(userId) {
|
|
2255
2266
|
var tableName,
|
|
2256
2267
|
_yield$this$supabase$2,
|
|
2257
2268
|
users,
|
|
2258
2269
|
error,
|
|
2259
2270
|
_args2 = arguments,
|
|
2260
2271
|
_t2;
|
|
2261
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
2272
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
2262
2273
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2263
2274
|
case 0:
|
|
2264
2275
|
tableName = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : this.defaultTableName;
|
|
@@ -2306,14 +2317,14 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2306
2317
|
}, {
|
|
2307
2318
|
key: "checkUsernameExists",
|
|
2308
2319
|
value: (function () {
|
|
2309
|
-
var _checkUsernameExists = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(username) {
|
|
2320
|
+
var _checkUsernameExists = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(username) {
|
|
2310
2321
|
var tableName,
|
|
2311
2322
|
_yield$this$supabase$3,
|
|
2312
2323
|
users,
|
|
2313
2324
|
error,
|
|
2314
2325
|
_args3 = arguments,
|
|
2315
2326
|
_t3;
|
|
2316
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
2327
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
2317
2328
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2318
2329
|
case 0:
|
|
2319
2330
|
tableName = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : this.defaultTableName;
|
|
@@ -2355,12 +2366,12 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2355
2366
|
}, {
|
|
2356
2367
|
key: "createUser",
|
|
2357
2368
|
value: (function () {
|
|
2358
|
-
var _createUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(userData) {
|
|
2369
|
+
var _createUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(userData) {
|
|
2359
2370
|
var finalUserData, _yield$this$supabase$4, result, error, _t4;
|
|
2360
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
2371
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
2361
2372
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2362
2373
|
case 0:
|
|
2363
|
-
finalUserData = _objectSpread$
|
|
2374
|
+
finalUserData = _objectSpread$4({
|
|
2364
2375
|
tableName: this.defaultTableName
|
|
2365
2376
|
}, userData);
|
|
2366
2377
|
_context4.prev = 1;
|
|
@@ -2405,7 +2416,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2405
2416
|
}, {
|
|
2406
2417
|
key: "updateUser",
|
|
2407
2418
|
value: (function () {
|
|
2408
|
-
var _updateUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(userId) {
|
|
2419
|
+
var _updateUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(userId) {
|
|
2409
2420
|
var updateData,
|
|
2410
2421
|
finalUpdateData,
|
|
2411
2422
|
_yield$this$supabase$5,
|
|
@@ -2413,12 +2424,12 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2413
2424
|
error,
|
|
2414
2425
|
_args5 = arguments,
|
|
2415
2426
|
_t5;
|
|
2416
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
2427
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
2417
2428
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2418
2429
|
case 0:
|
|
2419
2430
|
updateData = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
2420
2431
|
// 设置默认值
|
|
2421
|
-
finalUpdateData = _objectSpread$
|
|
2432
|
+
finalUpdateData = _objectSpread$4({
|
|
2422
2433
|
tableName: this.defaultTableName
|
|
2423
2434
|
}, updateData);
|
|
2424
2435
|
_context5.prev = 1;
|
|
@@ -2459,13 +2470,13 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2459
2470
|
}, {
|
|
2460
2471
|
key: "deleteUser",
|
|
2461
2472
|
value: (function () {
|
|
2462
|
-
var _deleteUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(userId) {
|
|
2473
|
+
var _deleteUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(userId) {
|
|
2463
2474
|
var tableName,
|
|
2464
2475
|
_yield$this$supabase$6,
|
|
2465
2476
|
error,
|
|
2466
2477
|
_args6 = arguments,
|
|
2467
2478
|
_t6;
|
|
2468
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
2479
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
2469
2480
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2470
2481
|
case 0:
|
|
2471
2482
|
tableName = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : this.defaultTableName;
|
|
@@ -2506,7 +2517,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2506
2517
|
}, {
|
|
2507
2518
|
key: "getUserList",
|
|
2508
2519
|
value: (function () {
|
|
2509
|
-
var _getUserList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
2520
|
+
var _getUserList = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7() {
|
|
2510
2521
|
var page,
|
|
2511
2522
|
limit,
|
|
2512
2523
|
tableName,
|
|
@@ -2517,7 +2528,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2517
2528
|
count,
|
|
2518
2529
|
_args7 = arguments,
|
|
2519
2530
|
_t7;
|
|
2520
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
2531
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
2521
2532
|
while (1) switch (_context7.prev = _context7.next) {
|
|
2522
2533
|
case 0:
|
|
2523
2534
|
page = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : 1;
|
|
@@ -2573,7 +2584,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2573
2584
|
}, {
|
|
2574
2585
|
key: "searchUsers",
|
|
2575
2586
|
value: (function () {
|
|
2576
|
-
var _searchUsers = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(searchValue) {
|
|
2587
|
+
var _searchUsers = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee8(searchValue) {
|
|
2577
2588
|
var page,
|
|
2578
2589
|
limit,
|
|
2579
2590
|
tableName,
|
|
@@ -2584,7 +2595,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2584
2595
|
count,
|
|
2585
2596
|
_args8 = arguments,
|
|
2586
2597
|
_t8;
|
|
2587
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
2598
|
+
return _regeneratorRuntime$1.wrap(function (_context8) {
|
|
2588
2599
|
while (1) switch (_context8.prev = _context8.next) {
|
|
2589
2600
|
case 0:
|
|
2590
2601
|
page = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : 1;
|
|
@@ -2640,13 +2651,13 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2640
2651
|
}, {
|
|
2641
2652
|
key: "updateLastLogin",
|
|
2642
2653
|
value: (function () {
|
|
2643
|
-
var _updateLastLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userId) {
|
|
2654
|
+
var _updateLastLogin = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee9(userId) {
|
|
2644
2655
|
var tableName,
|
|
2645
2656
|
_yield$this$supabase$9,
|
|
2646
2657
|
error,
|
|
2647
2658
|
_args9 = arguments,
|
|
2648
2659
|
_t9;
|
|
2649
|
-
return _regeneratorRuntime.wrap(function (_context9) {
|
|
2660
|
+
return _regeneratorRuntime$1.wrap(function (_context9) {
|
|
2650
2661
|
while (1) switch (_context9.prev = _context9.next) {
|
|
2651
2662
|
case 0:
|
|
2652
2663
|
tableName = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : this.defaultTableName;
|
|
@@ -2712,30 +2723,30 @@ function _objectWithoutProperties(e, t) {
|
|
|
2712
2723
|
return i;
|
|
2713
2724
|
}
|
|
2714
2725
|
|
|
2715
|
-
function _assertThisInitialized(e) {
|
|
2726
|
+
function _assertThisInitialized$1(e) {
|
|
2716
2727
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2717
2728
|
return e;
|
|
2718
2729
|
}
|
|
2719
2730
|
|
|
2720
|
-
function _possibleConstructorReturn(t, e) {
|
|
2721
|
-
if (e && ("object" == _typeof$
|
|
2731
|
+
function _possibleConstructorReturn$1(t, e) {
|
|
2732
|
+
if (e && ("object" == _typeof$2(e) || "function" == typeof e)) return e;
|
|
2722
2733
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
2723
|
-
return _assertThisInitialized(t);
|
|
2734
|
+
return _assertThisInitialized$1(t);
|
|
2724
2735
|
}
|
|
2725
2736
|
|
|
2726
|
-
function _getPrototypeOf(t) {
|
|
2727
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
2737
|
+
function _getPrototypeOf$1(t) {
|
|
2738
|
+
return _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
2728
2739
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2729
|
-
}, _getPrototypeOf(t);
|
|
2740
|
+
}, _getPrototypeOf$1(t);
|
|
2730
2741
|
}
|
|
2731
2742
|
|
|
2732
|
-
function _setPrototypeOf(t, e) {
|
|
2733
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
2743
|
+
function _setPrototypeOf$1(t, e) {
|
|
2744
|
+
return _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
2734
2745
|
return t.__proto__ = e, t;
|
|
2735
|
-
}, _setPrototypeOf(t, e);
|
|
2746
|
+
}, _setPrototypeOf$1(t, e);
|
|
2736
2747
|
}
|
|
2737
2748
|
|
|
2738
|
-
function _inherits(t, e) {
|
|
2749
|
+
function _inherits$1(t, e) {
|
|
2739
2750
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
2740
2751
|
t.prototype = Object.create(e && e.prototype, {
|
|
2741
2752
|
constructor: {
|
|
@@ -2745,10 +2756,10 @@ function _inherits(t, e) {
|
|
|
2745
2756
|
}
|
|
2746
2757
|
}), Object.defineProperty(t, "prototype", {
|
|
2747
2758
|
writable: !1
|
|
2748
|
-
}), e && _setPrototypeOf(t, e);
|
|
2759
|
+
}), e && _setPrototypeOf$1(t, e);
|
|
2749
2760
|
}
|
|
2750
2761
|
|
|
2751
|
-
function _isNativeFunction(t) {
|
|
2762
|
+
function _isNativeFunction$1(t) {
|
|
2752
2763
|
try {
|
|
2753
2764
|
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
2754
2765
|
} catch (n) {
|
|
@@ -2756,34 +2767,34 @@ function _isNativeFunction(t) {
|
|
|
2756
2767
|
}
|
|
2757
2768
|
}
|
|
2758
2769
|
|
|
2759
|
-
function _isNativeReflectConstruct$
|
|
2770
|
+
function _isNativeReflectConstruct$3() {
|
|
2760
2771
|
try {
|
|
2761
2772
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
2762
2773
|
} catch (t) {}
|
|
2763
|
-
return (_isNativeReflectConstruct$
|
|
2774
|
+
return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() {
|
|
2764
2775
|
return !!t;
|
|
2765
2776
|
})();
|
|
2766
2777
|
}
|
|
2767
2778
|
|
|
2768
|
-
function _construct(t, e, r) {
|
|
2769
|
-
if (_isNativeReflectConstruct$
|
|
2779
|
+
function _construct$1(t, e, r) {
|
|
2780
|
+
if (_isNativeReflectConstruct$3()) return Reflect.construct.apply(null, arguments);
|
|
2770
2781
|
var o = [null];
|
|
2771
2782
|
o.push.apply(o, e);
|
|
2772
2783
|
var p = new (t.bind.apply(t, o))();
|
|
2773
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
2784
|
+
return r && _setPrototypeOf$1(p, r.prototype), p;
|
|
2774
2785
|
}
|
|
2775
2786
|
|
|
2776
|
-
function _wrapNativeSuper(t) {
|
|
2787
|
+
function _wrapNativeSuper$1(t) {
|
|
2777
2788
|
var r = "function" == typeof Map ? new Map() : void 0;
|
|
2778
|
-
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
2779
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
|
2789
|
+
return _wrapNativeSuper$1 = function _wrapNativeSuper(t) {
|
|
2790
|
+
if (null === t || !_isNativeFunction$1(t)) return t;
|
|
2780
2791
|
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
2781
2792
|
if (void 0 !== r) {
|
|
2782
2793
|
if (r.has(t)) return r.get(t);
|
|
2783
2794
|
r.set(t, Wrapper);
|
|
2784
2795
|
}
|
|
2785
2796
|
function Wrapper() {
|
|
2786
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
2797
|
+
return _construct$1(t, arguments, _getPrototypeOf$1(this).constructor);
|
|
2787
2798
|
}
|
|
2788
2799
|
return Wrapper.prototype = Object.create(t.prototype, {
|
|
2789
2800
|
constructor: {
|
|
@@ -2792,42 +2803,557 @@ function _wrapNativeSuper(t) {
|
|
|
2792
2803
|
writable: !0,
|
|
2793
2804
|
configurable: !0
|
|
2794
2805
|
}
|
|
2795
|
-
}), _setPrototypeOf(Wrapper, t);
|
|
2796
|
-
}, _wrapNativeSuper(t);
|
|
2806
|
+
}), _setPrototypeOf$1(Wrapper, t);
|
|
2807
|
+
}, _wrapNativeSuper$1(t);
|
|
2797
2808
|
}
|
|
2798
2809
|
|
|
2799
|
-
function
|
|
2810
|
+
function _typeof$1(o) {
|
|
2811
|
+
"@babel/helpers - typeof";
|
|
2812
|
+
|
|
2813
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
2814
|
+
return typeof o;
|
|
2815
|
+
} : function (o) {
|
|
2816
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2817
|
+
}, _typeof$1(o);
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
function toPrimitive(t, r) {
|
|
2821
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
2822
|
+
var e = t[Symbol.toPrimitive];
|
|
2823
|
+
if (void 0 !== e) {
|
|
2824
|
+
var i = e.call(t, r || "default");
|
|
2825
|
+
if ("object" != _typeof$1(i)) return i;
|
|
2826
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2827
|
+
}
|
|
2828
|
+
return ("string" === r ? String : Number)(t);
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
function toPropertyKey(t) {
|
|
2832
|
+
var i = toPrimitive(t, "string");
|
|
2833
|
+
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
function _defineProperty(e, r, t) {
|
|
2837
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2838
|
+
value: t,
|
|
2839
|
+
enumerable: !0,
|
|
2840
|
+
configurable: !0,
|
|
2841
|
+
writable: !0
|
|
2842
|
+
}) : e[r] = t, e;
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
2846
|
+
try {
|
|
2847
|
+
var i = n[a](c),
|
|
2848
|
+
u = i.value;
|
|
2849
|
+
} catch (n) {
|
|
2850
|
+
return void e(n);
|
|
2851
|
+
}
|
|
2852
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
2853
|
+
}
|
|
2854
|
+
function _asyncToGenerator(n) {
|
|
2855
|
+
return function () {
|
|
2856
|
+
var t = this,
|
|
2857
|
+
e = arguments;
|
|
2858
|
+
return new Promise(function (r, o) {
|
|
2859
|
+
var a = n.apply(t, e);
|
|
2860
|
+
function _next(n) {
|
|
2861
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
2862
|
+
}
|
|
2863
|
+
function _throw(n) {
|
|
2864
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
2865
|
+
}
|
|
2866
|
+
_next(void 0);
|
|
2867
|
+
});
|
|
2868
|
+
};
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
function _arrayLikeToArray$3(r, a) {
|
|
2800
2872
|
(null == a || a > r.length) && (a = r.length);
|
|
2801
2873
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2802
2874
|
return n;
|
|
2803
2875
|
}
|
|
2804
2876
|
|
|
2805
|
-
function _arrayWithoutHoles(r) {
|
|
2806
|
-
if (Array.isArray(r)) return _arrayLikeToArray$
|
|
2807
|
-
}
|
|
2877
|
+
function _arrayWithoutHoles$1(r) {
|
|
2878
|
+
if (Array.isArray(r)) return _arrayLikeToArray$3(r);
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
function _iterableToArray$1(r) {
|
|
2882
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
function _unsupportedIterableToArray$3(r, a) {
|
|
2886
|
+
if (r) {
|
|
2887
|
+
if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
|
|
2888
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
2889
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
function _nonIterableSpread$1() {
|
|
2894
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
function _toConsumableArray$1(r) {
|
|
2898
|
+
return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$1();
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
function _defineProperties(e, r) {
|
|
2902
|
+
for (var t = 0; t < r.length; t++) {
|
|
2903
|
+
var o = r[t];
|
|
2904
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
function _createClass(e, r, t) {
|
|
2908
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
2909
|
+
writable: !1
|
|
2910
|
+
}), e;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
function _classCallCheck(a, n) {
|
|
2914
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
function _assertThisInitialized(e) {
|
|
2918
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2919
|
+
return e;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
function _possibleConstructorReturn(t, e) {
|
|
2923
|
+
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e;
|
|
2924
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
2925
|
+
return _assertThisInitialized(t);
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
function _getPrototypeOf(t) {
|
|
2929
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
2930
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2931
|
+
}, _getPrototypeOf(t);
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
function _setPrototypeOf(t, e) {
|
|
2935
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
2936
|
+
return t.__proto__ = e, t;
|
|
2937
|
+
}, _setPrototypeOf(t, e);
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
function _inherits(t, e) {
|
|
2941
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
2942
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
2943
|
+
constructor: {
|
|
2944
|
+
value: t,
|
|
2945
|
+
writable: !0,
|
|
2946
|
+
configurable: !0
|
|
2947
|
+
}
|
|
2948
|
+
}), Object.defineProperty(t, "prototype", {
|
|
2949
|
+
writable: !1
|
|
2950
|
+
}), e && _setPrototypeOf(t, e);
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
function _isNativeFunction(t) {
|
|
2954
|
+
try {
|
|
2955
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
2956
|
+
} catch (n) {
|
|
2957
|
+
return "function" == typeof t;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
function _isNativeReflectConstruct$2() {
|
|
2962
|
+
try {
|
|
2963
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
2964
|
+
} catch (t) {}
|
|
2965
|
+
return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct() {
|
|
2966
|
+
return !!t;
|
|
2967
|
+
})();
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
function _construct(t, e, r) {
|
|
2971
|
+
if (_isNativeReflectConstruct$2()) return Reflect.construct.apply(null, arguments);
|
|
2972
|
+
var o = [null];
|
|
2973
|
+
o.push.apply(o, e);
|
|
2974
|
+
var p = new (t.bind.apply(t, o))();
|
|
2975
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
function _wrapNativeSuper(t) {
|
|
2979
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
2980
|
+
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
2981
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
2982
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
2983
|
+
if (void 0 !== r) {
|
|
2984
|
+
if (r.has(t)) return r.get(t);
|
|
2985
|
+
r.set(t, Wrapper);
|
|
2986
|
+
}
|
|
2987
|
+
function Wrapper() {
|
|
2988
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
2989
|
+
}
|
|
2990
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
2991
|
+
constructor: {
|
|
2992
|
+
value: Wrapper,
|
|
2993
|
+
enumerable: !1,
|
|
2994
|
+
writable: !0,
|
|
2995
|
+
configurable: !0
|
|
2996
|
+
}
|
|
2997
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
2998
|
+
}, _wrapNativeSuper(t);
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
3002
|
+
|
|
3003
|
+
var OverloadYield = {exports: {}};
|
|
3004
|
+
|
|
3005
|
+
(function (module) {
|
|
3006
|
+
function _OverloadYield(e, d) {
|
|
3007
|
+
this.v = e, this.k = d;
|
|
3008
|
+
}
|
|
3009
|
+
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3010
|
+
})(OverloadYield);
|
|
3011
|
+
var OverloadYieldExports = OverloadYield.exports;
|
|
3012
|
+
|
|
3013
|
+
var regenerator$1 = {exports: {}};
|
|
3014
|
+
|
|
3015
|
+
var regeneratorDefine = {exports: {}};
|
|
3016
|
+
|
|
3017
|
+
(function (module) {
|
|
3018
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
3019
|
+
var i = Object.defineProperty;
|
|
3020
|
+
try {
|
|
3021
|
+
i({}, "", {});
|
|
3022
|
+
} catch (e) {
|
|
3023
|
+
i = 0;
|
|
3024
|
+
}
|
|
3025
|
+
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
|
|
3026
|
+
function o(r, n) {
|
|
3027
|
+
_regeneratorDefine(e, r, function (e) {
|
|
3028
|
+
return this._invoke(r, n, e);
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
r ? i ? i(e, r, {
|
|
3032
|
+
value: n,
|
|
3033
|
+
enumerable: !t,
|
|
3034
|
+
configurable: !t,
|
|
3035
|
+
writable: !t
|
|
3036
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
3037
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
|
|
3038
|
+
}
|
|
3039
|
+
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3040
|
+
})(regeneratorDefine);
|
|
3041
|
+
var regeneratorDefineExports = regeneratorDefine.exports;
|
|
3042
|
+
|
|
3043
|
+
(function (module) {
|
|
3044
|
+
var regeneratorDefine = regeneratorDefineExports;
|
|
3045
|
+
function _regenerator() {
|
|
3046
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3047
|
+
var e,
|
|
3048
|
+
t,
|
|
3049
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
3050
|
+
n = r.iterator || "@@iterator",
|
|
3051
|
+
o = r.toStringTag || "@@toStringTag";
|
|
3052
|
+
function i(r, n, o, i) {
|
|
3053
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
3054
|
+
u = Object.create(c.prototype);
|
|
3055
|
+
return regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
3056
|
+
var i,
|
|
3057
|
+
c,
|
|
3058
|
+
u,
|
|
3059
|
+
f = 0,
|
|
3060
|
+
p = o || [],
|
|
3061
|
+
y = !1,
|
|
3062
|
+
G = {
|
|
3063
|
+
p: 0,
|
|
3064
|
+
n: 0,
|
|
3065
|
+
v: e,
|
|
3066
|
+
a: d,
|
|
3067
|
+
f: d.bind(e, 4),
|
|
3068
|
+
d: function d(t, r) {
|
|
3069
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
3072
|
+
function d(r, n) {
|
|
3073
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
3074
|
+
var o,
|
|
3075
|
+
i = p[t],
|
|
3076
|
+
d = G.p,
|
|
3077
|
+
l = i[2];
|
|
3078
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
3079
|
+
}
|
|
3080
|
+
if (o || r > 1) return a;
|
|
3081
|
+
throw y = !0, n;
|
|
3082
|
+
}
|
|
3083
|
+
return function (o, p, l) {
|
|
3084
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
3085
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
3086
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
3087
|
+
try {
|
|
3088
|
+
if (f = 2, i) {
|
|
3089
|
+
if (c || (o = "next"), t = i[o]) {
|
|
3090
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
3091
|
+
if (!t.done) return t;
|
|
3092
|
+
u = t.value, c < 2 && (c = 0);
|
|
3093
|
+
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
3094
|
+
i = e;
|
|
3095
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
3096
|
+
} catch (t) {
|
|
3097
|
+
i = e, c = 1, u = t;
|
|
3098
|
+
} finally {
|
|
3099
|
+
f = 1;
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
return {
|
|
3103
|
+
value: t,
|
|
3104
|
+
done: y
|
|
3105
|
+
};
|
|
3106
|
+
};
|
|
3107
|
+
}(r, o, i), !0), u;
|
|
3108
|
+
}
|
|
3109
|
+
var a = {};
|
|
3110
|
+
function Generator() {}
|
|
3111
|
+
function GeneratorFunction() {}
|
|
3112
|
+
function GeneratorFunctionPrototype() {}
|
|
3113
|
+
t = Object.getPrototypeOf;
|
|
3114
|
+
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
|
|
3115
|
+
return this;
|
|
3116
|
+
}), t),
|
|
3117
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
3118
|
+
function f(e) {
|
|
3119
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
3120
|
+
}
|
|
3121
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function () {
|
|
3122
|
+
return this;
|
|
3123
|
+
}), regeneratorDefine(u, "toString", function () {
|
|
3124
|
+
return "[object Generator]";
|
|
3125
|
+
}), (module.exports = _regenerator = function _regenerator() {
|
|
3126
|
+
return {
|
|
3127
|
+
w: i,
|
|
3128
|
+
m: f
|
|
3129
|
+
};
|
|
3130
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
3131
|
+
}
|
|
3132
|
+
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3133
|
+
})(regenerator$1);
|
|
3134
|
+
var regeneratorExports = regenerator$1.exports;
|
|
3135
|
+
|
|
3136
|
+
var regeneratorAsync = {exports: {}};
|
|
3137
|
+
|
|
3138
|
+
var regeneratorAsyncGen = {exports: {}};
|
|
3139
|
+
|
|
3140
|
+
var regeneratorAsyncIterator = {exports: {}};
|
|
3141
|
+
|
|
3142
|
+
(function (module) {
|
|
3143
|
+
var OverloadYield = OverloadYieldExports;
|
|
3144
|
+
var regeneratorDefine = regeneratorDefineExports;
|
|
3145
|
+
function AsyncIterator(t, e) {
|
|
3146
|
+
function n(r, o, i, f) {
|
|
3147
|
+
try {
|
|
3148
|
+
var c = t[r](o),
|
|
3149
|
+
u = c.value;
|
|
3150
|
+
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
3151
|
+
n("next", t, i, f);
|
|
3152
|
+
}, function (t) {
|
|
3153
|
+
n("throw", t, i, f);
|
|
3154
|
+
}) : e.resolve(u).then(function (t) {
|
|
3155
|
+
c.value = t, i(c);
|
|
3156
|
+
}, function (t) {
|
|
3157
|
+
return n("throw", t, i, f);
|
|
3158
|
+
});
|
|
3159
|
+
} catch (t) {
|
|
3160
|
+
f(t);
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
var r;
|
|
3164
|
+
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
3165
|
+
return this;
|
|
3166
|
+
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
3167
|
+
function f() {
|
|
3168
|
+
return new e(function (e, r) {
|
|
3169
|
+
n(t, i, e, r);
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
return r = r ? r.then(f, f) : f();
|
|
3173
|
+
}, !0);
|
|
3174
|
+
}
|
|
3175
|
+
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3176
|
+
})(regeneratorAsyncIterator);
|
|
3177
|
+
var regeneratorAsyncIteratorExports = regeneratorAsyncIterator.exports;
|
|
3178
|
+
|
|
3179
|
+
(function (module) {
|
|
3180
|
+
var regenerator = regeneratorExports;
|
|
3181
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports;
|
|
3182
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
3183
|
+
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
|
|
3184
|
+
}
|
|
3185
|
+
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3186
|
+
})(regeneratorAsyncGen);
|
|
3187
|
+
var regeneratorAsyncGenExports = regeneratorAsyncGen.exports;
|
|
3188
|
+
|
|
3189
|
+
(function (module) {
|
|
3190
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports;
|
|
3191
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
3192
|
+
var a = regeneratorAsyncGen(n, e, r, t, o);
|
|
3193
|
+
return a.next().then(function (n) {
|
|
3194
|
+
return n.done ? n.value : a.next();
|
|
3195
|
+
});
|
|
3196
|
+
}
|
|
3197
|
+
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3198
|
+
})(regeneratorAsync);
|
|
3199
|
+
var regeneratorAsyncExports = regeneratorAsync.exports;
|
|
3200
|
+
|
|
3201
|
+
var regeneratorKeys = {exports: {}};
|
|
3202
|
+
|
|
3203
|
+
(function (module) {
|
|
3204
|
+
function _regeneratorKeys(e) {
|
|
3205
|
+
var n = Object(e),
|
|
3206
|
+
r = [];
|
|
3207
|
+
for (var t in n) r.unshift(t);
|
|
3208
|
+
return function e() {
|
|
3209
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
3210
|
+
return e.done = !0, e;
|
|
3211
|
+
};
|
|
3212
|
+
}
|
|
3213
|
+
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3214
|
+
})(regeneratorKeys);
|
|
3215
|
+
var regeneratorKeysExports = regeneratorKeys.exports;
|
|
3216
|
+
|
|
3217
|
+
var regeneratorValues = {exports: {}};
|
|
3218
|
+
|
|
3219
|
+
var _typeof = {exports: {}};
|
|
3220
|
+
|
|
3221
|
+
(function (module) {
|
|
3222
|
+
function _typeof(o) {
|
|
3223
|
+
"@babel/helpers - typeof";
|
|
3224
|
+
|
|
3225
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
3226
|
+
return typeof o;
|
|
3227
|
+
} : function (o) {
|
|
3228
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
3229
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
3230
|
+
}
|
|
3231
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3232
|
+
})(_typeof);
|
|
3233
|
+
var _typeofExports = _typeof.exports;
|
|
3234
|
+
|
|
3235
|
+
(function (module) {
|
|
3236
|
+
var _typeof = _typeofExports["default"];
|
|
3237
|
+
function _regeneratorValues(e) {
|
|
3238
|
+
if (null != e) {
|
|
3239
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
3240
|
+
r = 0;
|
|
3241
|
+
if (t) return t.call(e);
|
|
3242
|
+
if ("function" == typeof e.next) return e;
|
|
3243
|
+
if (!isNaN(e.length)) return {
|
|
3244
|
+
next: function next() {
|
|
3245
|
+
return e && r >= e.length && (e = void 0), {
|
|
3246
|
+
value: e && e[r++],
|
|
3247
|
+
done: !e
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
};
|
|
3251
|
+
}
|
|
3252
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
3253
|
+
}
|
|
3254
|
+
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3255
|
+
})(regeneratorValues);
|
|
3256
|
+
var regeneratorValuesExports = regeneratorValues.exports;
|
|
3257
|
+
|
|
3258
|
+
(function (module) {
|
|
3259
|
+
var OverloadYield = OverloadYieldExports;
|
|
3260
|
+
var regenerator = regeneratorExports;
|
|
3261
|
+
var regeneratorAsync = regeneratorAsyncExports;
|
|
3262
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports;
|
|
3263
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports;
|
|
3264
|
+
var regeneratorKeys = regeneratorKeysExports;
|
|
3265
|
+
var regeneratorValues = regeneratorValuesExports;
|
|
3266
|
+
function _regeneratorRuntime() {
|
|
3267
|
+
|
|
3268
|
+
var r = regenerator(),
|
|
3269
|
+
e = r.m(_regeneratorRuntime),
|
|
3270
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
3271
|
+
function n(r) {
|
|
3272
|
+
var e = "function" == typeof r && r.constructor;
|
|
3273
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
3274
|
+
}
|
|
3275
|
+
var o = {
|
|
3276
|
+
"throw": 1,
|
|
3277
|
+
"return": 2,
|
|
3278
|
+
"break": 3,
|
|
3279
|
+
"continue": 3
|
|
3280
|
+
};
|
|
3281
|
+
function a(r) {
|
|
3282
|
+
var e, t;
|
|
3283
|
+
return function (n) {
|
|
3284
|
+
e || (e = {
|
|
3285
|
+
stop: function stop() {
|
|
3286
|
+
return t(n.a, 2);
|
|
3287
|
+
},
|
|
3288
|
+
"catch": function _catch() {
|
|
3289
|
+
return n.v;
|
|
3290
|
+
},
|
|
3291
|
+
abrupt: function abrupt(r, e) {
|
|
3292
|
+
return t(n.a, o[r], e);
|
|
3293
|
+
},
|
|
3294
|
+
delegateYield: function delegateYield(r, o, a) {
|
|
3295
|
+
return e.resultName = o, t(n.d, regeneratorValues(r), a);
|
|
3296
|
+
},
|
|
3297
|
+
finish: function finish(r) {
|
|
3298
|
+
return t(n.f, r);
|
|
3299
|
+
}
|
|
3300
|
+
}, t = function t(r, _t, o) {
|
|
3301
|
+
n.p = e.prev, n.n = e.next;
|
|
3302
|
+
try {
|
|
3303
|
+
return r(_t, o);
|
|
3304
|
+
} finally {
|
|
3305
|
+
e.next = n.n;
|
|
3306
|
+
}
|
|
3307
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
3308
|
+
try {
|
|
3309
|
+
return r.call(this, e);
|
|
3310
|
+
} finally {
|
|
3311
|
+
n.p = e.prev, n.n = e.next;
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
}
|
|
3315
|
+
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
3316
|
+
return {
|
|
3317
|
+
wrap: function wrap(e, t, n, o) {
|
|
3318
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
3319
|
+
},
|
|
3320
|
+
isGeneratorFunction: n,
|
|
3321
|
+
mark: r.m,
|
|
3322
|
+
awrap: function awrap(r, e) {
|
|
3323
|
+
return new OverloadYield(r, e);
|
|
3324
|
+
},
|
|
3325
|
+
AsyncIterator: regeneratorAsyncIterator,
|
|
3326
|
+
async: function async(r, e, t, o, u) {
|
|
3327
|
+
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
|
|
3328
|
+
},
|
|
3329
|
+
keys: regeneratorKeys,
|
|
3330
|
+
values: regeneratorValues
|
|
3331
|
+
};
|
|
3332
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
3333
|
+
}
|
|
3334
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3335
|
+
})(regeneratorRuntime$1);
|
|
3336
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
3337
|
+
|
|
3338
|
+
// TODO(Babel 8): Remove this file.
|
|
2808
3339
|
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
}
|
|
3340
|
+
var runtime = regeneratorRuntimeExports();
|
|
3341
|
+
var regenerator = runtime;
|
|
2812
3342
|
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
3343
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
3344
|
+
try {
|
|
3345
|
+
regeneratorRuntime = runtime;
|
|
3346
|
+
} catch (accidentalStrictMode) {
|
|
3347
|
+
if ((typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis)) === "object") {
|
|
3348
|
+
globalThis.regeneratorRuntime = runtime;
|
|
3349
|
+
} else {
|
|
3350
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
2818
3351
|
}
|
|
2819
3352
|
}
|
|
3353
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
2820
3354
|
|
|
2821
|
-
function
|
|
2822
|
-
|
|
2823
|
-
}
|
|
2824
|
-
|
|
2825
|
-
function _toConsumableArray(r) {
|
|
2826
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
|
|
2827
|
-
}
|
|
2828
|
-
|
|
2829
|
-
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2830
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3355
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3356
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2831
3357
|
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
2832
3358
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
2833
3359
|
// src/error.ts
|
|
@@ -2932,7 +3458,7 @@ function validateExtension(fileName, allowedExtensions) {
|
|
|
2932
3458
|
throw new OssError(ErrorCode.INVALID_PARAMS, "\u6587\u4EF6 \"".concat(fileName, "\" \u7F3A\u5C11\u6269\u5C55\u540D"));
|
|
2933
3459
|
}
|
|
2934
3460
|
if (!whitelist.has(ext)) {
|
|
2935
|
-
throw new OssError(ErrorCode.INVALID_PARAMS, "\u6587\u4EF6\u7C7B\u578B \".".concat(ext, "\" \u4E0D\u5728\u5141\u8BB8\u5217\u8868\u4E2D\uFF0C\u5141\u8BB8\u7684\u7C7B\u578B\uFF1A").concat(_toConsumableArray(whitelist).join(", ")));
|
|
3461
|
+
throw new OssError(ErrorCode.INVALID_PARAMS, "\u6587\u4EF6\u7C7B\u578B \".".concat(ext, "\" \u4E0D\u5728\u5141\u8BB8\u5217\u8868\u4E2D\uFF0C\u5141\u8BB8\u7684\u7C7B\u578B\uFF1A").concat(_toConsumableArray$1(whitelist).join(", ")));
|
|
2936
3462
|
}
|
|
2937
3463
|
}
|
|
2938
3464
|
function validateMagicBytes(_x, _x2) {
|
|
@@ -3355,7 +3881,7 @@ var DEFAULT_LIMITS = {
|
|
|
3355
3881
|
other: 10 * 1024 * 1024
|
|
3356
3882
|
};
|
|
3357
3883
|
function getSizeLimit(fileName, limits) {
|
|
3358
|
-
var merged = _objectSpread$
|
|
3884
|
+
var merged = _objectSpread$3(_objectSpread$3({}, DEFAULT_LIMITS), limits);
|
|
3359
3885
|
if (isImage(fileName)) return merged.image;
|
|
3360
3886
|
if (isVideo(fileName)) return merged.video;
|
|
3361
3887
|
return merged.other;
|
|
@@ -3383,7 +3909,7 @@ function _compressImageBlob() {
|
|
|
3383
3909
|
return _regeneratorRuntime.wrap(function (_context10) {
|
|
3384
3910
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3385
3911
|
case 0:
|
|
3386
|
-
opts = _objectSpread$
|
|
3912
|
+
opts = _objectSpread$3(_objectSpread$3({}, DEFAULT_COMPRESS), options);
|
|
3387
3913
|
if (!(typeof createImageBitmap === "undefined" || typeof OffscreenCanvas === "undefined")) {
|
|
3388
3914
|
_context10.next = 1;
|
|
3389
3915
|
break;
|
|
@@ -3449,7 +3975,7 @@ function _processFile() {
|
|
|
3449
3975
|
return _regeneratorRuntime.wrap(function (_context11) {
|
|
3450
3976
|
while (1) switch (_context11.prev = _context11.next) {
|
|
3451
3977
|
case 0:
|
|
3452
|
-
opts = _objectSpread$
|
|
3978
|
+
opts = _objectSpread$3(_objectSpread$3({}, DEFAULT_COMPRESS), compress);
|
|
3453
3979
|
if (!(opts.enabled && isImage(fileName))) {
|
|
3454
3980
|
_context11.next = 2;
|
|
3455
3981
|
break;
|
|
@@ -3513,7 +4039,7 @@ function createOssClient() {
|
|
|
3513
4039
|
var allowedExtensions = options.allowedExtensions;
|
|
3514
4040
|
function mergeRetry(override) {
|
|
3515
4041
|
if (!defaultRetry && !override) return void 0;
|
|
3516
|
-
return _objectSpread$
|
|
4042
|
+
return _objectSpread$3(_objectSpread$3({}, defaultRetry), override);
|
|
3517
4043
|
}
|
|
3518
4044
|
function resolveCompress(override) {
|
|
3519
4045
|
if (override === false) return {
|
|
@@ -3523,7 +4049,7 @@ function createOssClient() {
|
|
|
3523
4049
|
enabled: false
|
|
3524
4050
|
};
|
|
3525
4051
|
var base = _typeof$1(defaultCompress) === "object" ? defaultCompress : {};
|
|
3526
|
-
return override ? _objectSpread$
|
|
4052
|
+
return override ? _objectSpread$3(_objectSpread$3({}, base), override) : Object.keys(base).length ? base : void 0;
|
|
3527
4053
|
}
|
|
3528
4054
|
function uploadOne(_x25, _x26, _x27, _x28) {
|
|
3529
4055
|
return _uploadOne.apply(this, arguments);
|
|
@@ -3609,7 +4135,7 @@ function createOssClient() {
|
|
|
3609
4135
|
var i = index++;
|
|
3610
4136
|
var item = files[i];
|
|
3611
4137
|
running++;
|
|
3612
|
-
var fileOpts = _objectSpread$
|
|
4138
|
+
var fileOpts = _objectSpread$3({
|
|
3613
4139
|
retry: opts === null || opts === void 0 ? void 0 : opts.retry,
|
|
3614
4140
|
compress: opts === null || opts === void 0 ? void 0 : opts.compress
|
|
3615
4141
|
}, item.options);
|
|
@@ -3740,7 +4266,7 @@ function createOssClient() {
|
|
|
3740
4266
|
}
|
|
3741
4267
|
|
|
3742
4268
|
var _excluded$1 = ["accessKeyId", "accessKeySecret"];
|
|
3743
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
4269
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf$1(o), _possibleConstructorReturn$1(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf$1(t).constructor) : o.apply(t, e)); }
|
|
3744
4270
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
3745
4271
|
var DEFAULT_MAX_SIZE = 2 * 1024 * 1024;
|
|
3746
4272
|
var DEFAULT_SIGNED_URL_EXPIRES_IN = 60 * 60;
|
|
@@ -3748,15 +4274,15 @@ var OssUploadError = /*#__PURE__*/function (_Error) {
|
|
|
3748
4274
|
function OssUploadError(message) {
|
|
3749
4275
|
var _this;
|
|
3750
4276
|
var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
|
|
3751
|
-
_classCallCheck(this, OssUploadError);
|
|
4277
|
+
_classCallCheck$1(this, OssUploadError);
|
|
3752
4278
|
_this = _callSuper(this, OssUploadError, [message]);
|
|
3753
4279
|
_this.name = "OssUploadError";
|
|
3754
4280
|
_this.status = status;
|
|
3755
4281
|
return _this;
|
|
3756
4282
|
}
|
|
3757
|
-
_inherits(OssUploadError, _Error);
|
|
3758
|
-
return _createClass(OssUploadError);
|
|
3759
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
4283
|
+
_inherits$1(OssUploadError, _Error);
|
|
4284
|
+
return _createClass$1(OssUploadError);
|
|
4285
|
+
}(/*#__PURE__*/_wrapNativeSuper$1(Error));
|
|
3760
4286
|
function sanitizePathSegment(value) {
|
|
3761
4287
|
return String(value || "").trim().replace(/[^a-zA-Z0-9/_-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^\/+|\/+$/g, "");
|
|
3762
4288
|
}
|
|
@@ -3821,7 +4347,7 @@ function normalizeSdkError(error) {
|
|
|
3821
4347
|
}
|
|
3822
4348
|
var OssUploadService = /*#__PURE__*/function () {
|
|
3823
4349
|
function OssUploadService(config) {
|
|
3824
|
-
_classCallCheck(this, OssUploadService);
|
|
4350
|
+
_classCallCheck$1(this, OssUploadService);
|
|
3825
4351
|
this.config = normalizeConfig(config);
|
|
3826
4352
|
this.client = createOssClient({
|
|
3827
4353
|
baseURL: this.config.baseURL,
|
|
@@ -3829,7 +4355,7 @@ var OssUploadService = /*#__PURE__*/function () {
|
|
|
3829
4355
|
retry: this.config.retry
|
|
3830
4356
|
});
|
|
3831
4357
|
}
|
|
3832
|
-
return _createClass(OssUploadService, [{
|
|
4358
|
+
return _createClass$1(OssUploadService, [{
|
|
3833
4359
|
key: "getConfig",
|
|
3834
4360
|
value: function getConfig() {
|
|
3835
4361
|
var _this$config = this.config;
|
|
@@ -3841,9 +4367,9 @@ var OssUploadService = /*#__PURE__*/function () {
|
|
|
3841
4367
|
}, {
|
|
3842
4368
|
key: "upload",
|
|
3843
4369
|
value: function () {
|
|
3844
|
-
var _upload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(input) {
|
|
4370
|
+
var _upload = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(input) {
|
|
3845
4371
|
var sessionId, maxSize, objectKey, result, url, resolvedUrl, _t;
|
|
3846
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4372
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
3847
4373
|
while (1) switch (_context.prev = _context.next) {
|
|
3848
4374
|
case 0:
|
|
3849
4375
|
sessionId = String(input.sessionId || "").trim();
|
|
@@ -3955,9 +4481,9 @@ function ensureAdminRegistryTable(_x) {
|
|
|
3955
4481
|
return _ensureAdminRegistryTable.apply(this, arguments);
|
|
3956
4482
|
}
|
|
3957
4483
|
function _ensureAdminRegistryTable() {
|
|
3958
|
-
_ensureAdminRegistryTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(supabase) {
|
|
4484
|
+
_ensureAdminRegistryTable = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(supabase) {
|
|
3959
4485
|
var _yield$supabase$from$, error;
|
|
3960
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4486
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
3961
4487
|
while (1) switch (_context.prev = _context.next) {
|
|
3962
4488
|
case 0:
|
|
3963
4489
|
if (!ensured) {
|
|
@@ -3998,9 +4524,9 @@ function getSessionAdminRow(_x2, _x3) {
|
|
|
3998
4524
|
return _getSessionAdminRow.apply(this, arguments);
|
|
3999
4525
|
}
|
|
4000
4526
|
function _getSessionAdminRow() {
|
|
4001
|
-
_getSessionAdminRow = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(supabase, sessionId) {
|
|
4527
|
+
_getSessionAdminRow = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(supabase, sessionId) {
|
|
4002
4528
|
var sid, _yield$supabase$from$2, data, error;
|
|
4003
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
4529
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
4004
4530
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4005
4531
|
case 0:
|
|
4006
4532
|
sid = normalizeSessionId(sessionId);
|
|
@@ -4029,9 +4555,9 @@ function getSessionAdminRowByEmail(_x4, _x5, _x6) {
|
|
|
4029
4555
|
return _getSessionAdminRowByEmail.apply(this, arguments);
|
|
4030
4556
|
}
|
|
4031
4557
|
function _getSessionAdminRowByEmail() {
|
|
4032
|
-
_getSessionAdminRowByEmail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(supabase, sessionId, email) {
|
|
4558
|
+
_getSessionAdminRowByEmail = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(supabase, sessionId, email) {
|
|
4033
4559
|
var row, normalizedEmail, rowEmail;
|
|
4034
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
4560
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
4035
4561
|
while (1) switch (_context3.prev = _context3.next) {
|
|
4036
4562
|
case 0:
|
|
4037
4563
|
_context3.next = 1;
|
|
@@ -4065,9 +4591,9 @@ function isUserSessionAdmin(_x7, _x8, _x9) {
|
|
|
4065
4591
|
return _isUserSessionAdmin.apply(this, arguments);
|
|
4066
4592
|
}
|
|
4067
4593
|
function _isUserSessionAdmin() {
|
|
4068
|
-
_isUserSessionAdmin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(supabase, sessionId, userId) {
|
|
4594
|
+
_isUserSessionAdmin = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(supabase, sessionId, userId) {
|
|
4069
4595
|
var row;
|
|
4070
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
4596
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
4071
4597
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4072
4598
|
case 0:
|
|
4073
4599
|
_context4.next = 1;
|
|
@@ -4090,6 +4616,62 @@ function _isUserSessionAdmin() {
|
|
|
4090
4616
|
return _isUserSessionAdmin.apply(this, arguments);
|
|
4091
4617
|
}
|
|
4092
4618
|
|
|
4619
|
+
function _arrayWithHoles(r) {
|
|
4620
|
+
if (Array.isArray(r)) return r;
|
|
4621
|
+
}
|
|
4622
|
+
|
|
4623
|
+
function _iterableToArrayLimit(r, l) {
|
|
4624
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4625
|
+
if (null != t) {
|
|
4626
|
+
var e,
|
|
4627
|
+
n,
|
|
4628
|
+
i,
|
|
4629
|
+
u,
|
|
4630
|
+
a = [],
|
|
4631
|
+
f = !0,
|
|
4632
|
+
o = !1;
|
|
4633
|
+
try {
|
|
4634
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
4635
|
+
if (Object(t) !== t) return;
|
|
4636
|
+
f = !1;
|
|
4637
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
4638
|
+
} catch (r) {
|
|
4639
|
+
o = !0, n = r;
|
|
4640
|
+
} finally {
|
|
4641
|
+
try {
|
|
4642
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
4643
|
+
} finally {
|
|
4644
|
+
if (o) throw n;
|
|
4645
|
+
}
|
|
4646
|
+
}
|
|
4647
|
+
return a;
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
|
|
4651
|
+
function _arrayLikeToArray$2(r, a) {
|
|
4652
|
+
(null == a || a > r.length) && (a = r.length);
|
|
4653
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4654
|
+
return n;
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
function _unsupportedIterableToArray$2(r, a) {
|
|
4658
|
+
if (r) {
|
|
4659
|
+
if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
|
|
4660
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
4661
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
|
|
4665
|
+
function _nonIterableRest() {
|
|
4666
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
function _slicedToArray(r, e) {
|
|
4670
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest();
|
|
4671
|
+
}
|
|
4672
|
+
|
|
4673
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4674
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4093
4675
|
var ACTION_LABELS = {
|
|
4094
4676
|
create: "创建",
|
|
4095
4677
|
read: "查询",
|
|
@@ -4105,9 +4687,44 @@ function getWebhookUrls() {
|
|
|
4105
4687
|
return item.trim();
|
|
4106
4688
|
}).filter(Boolean);
|
|
4107
4689
|
}
|
|
4690
|
+
function safeJsonStringify(value) {
|
|
4691
|
+
var seen = new WeakSet();
|
|
4692
|
+
try {
|
|
4693
|
+
return JSON.stringify(value, function (_key, currentValue) {
|
|
4694
|
+
if (typeof currentValue === "bigint") {
|
|
4695
|
+
return currentValue.toString();
|
|
4696
|
+
}
|
|
4697
|
+
if (_typeof$2(currentValue) === "object" && currentValue !== null) {
|
|
4698
|
+
if (seen.has(currentValue)) {
|
|
4699
|
+
return "[Circular]";
|
|
4700
|
+
}
|
|
4701
|
+
seen.add(currentValue);
|
|
4702
|
+
}
|
|
4703
|
+
return currentValue;
|
|
4704
|
+
}, 2);
|
|
4705
|
+
} catch (_unused) {
|
|
4706
|
+
return "";
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
function serializeError(error) {
|
|
4710
|
+
var extraFields = Object.fromEntries(Object.entries(error).filter(function (_ref) {
|
|
4711
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
4712
|
+
value = _ref2[1];
|
|
4713
|
+
return value !== undefined;
|
|
4714
|
+
}));
|
|
4715
|
+
return _objectSpread$2({
|
|
4716
|
+
name: error.name,
|
|
4717
|
+
message: error.message
|
|
4718
|
+
}, extraFields);
|
|
4719
|
+
}
|
|
4108
4720
|
function getErrorMessage(error) {
|
|
4109
4721
|
if (error instanceof Error) {
|
|
4110
|
-
|
|
4722
|
+
var serializedError = safeJsonStringify(serializeError(error));
|
|
4723
|
+
return serializedError || error.message;
|
|
4724
|
+
}
|
|
4725
|
+
if (_typeof$2(error) === "object" && error !== null) {
|
|
4726
|
+
var _serializedError = safeJsonStringify(error);
|
|
4727
|
+
return _serializedError || String(error);
|
|
4111
4728
|
}
|
|
4112
4729
|
return String(error);
|
|
4113
4730
|
}
|
|
@@ -4127,8 +4744,8 @@ function getSessionId(c) {
|
|
|
4127
4744
|
function buildAlertText(c, options) {
|
|
4128
4745
|
var _options$modelId, _options$recordId;
|
|
4129
4746
|
var actionLabel = ACTION_LABELS[options.action];
|
|
4130
|
-
|
|
4131
|
-
var lines = ["\u5305\u540D: @wecode-team/cms-supabase-api", "\u5BBF\u4E3B\u9879\u76EE\u6807\u8BC6(sessionId): ".concat(getSessionId(c)), "\u64CD\u4F5C\
|
|
4747
|
+
TARGET_LABELS[options.target];
|
|
4748
|
+
var lines = ["\u5305\u540D: @wecode-team/cms-supabase-api", "\u5BBF\u4E3B\u9879\u76EE\u6807\u8BC6(sessionId): ".concat(getSessionId(c)), "\u64CD\u4F5C\u7C7B\u578B: ".concat(actionLabel), "\u6570\u636E\u8868\u540D: ".concat(options.tableName || "-"), "\u6A21\u578B ID: ".concat((_options$modelId = options.modelId) !== null && _options$modelId !== void 0 ? _options$modelId : "-"), "\u8BB0\u5F55 ID: ".concat((_options$recordId = options.recordId) !== null && _options$recordId !== void 0 ? _options$recordId : "-"), "\u65F6\u95F4: ".concat(new Date().toISOString()), "\u9519\u8BEF\u4FE1\u606F: ".concat(getErrorMessage(options.error)), "\u8BF7\u6C42\u4FE1\u606F:\n".concat(buildRequestSummary(c))];
|
|
4132
4749
|
var stack = getErrorStack(options.error);
|
|
4133
4750
|
if (stack) {
|
|
4134
4751
|
lines.push("\u9519\u8BEF\u5806\u6808:\n".concat(stack));
|
|
@@ -4139,9 +4756,9 @@ function postWebhook(_x, _x2) {
|
|
|
4139
4756
|
return _postWebhook.apply(this, arguments);
|
|
4140
4757
|
}
|
|
4141
4758
|
function _postWebhook() {
|
|
4142
|
-
_postWebhook = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(webhook, body) {
|
|
4759
|
+
_postWebhook = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(webhook, body) {
|
|
4143
4760
|
var response;
|
|
4144
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4761
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
4145
4762
|
while (1) switch (_context.prev = _context.next) {
|
|
4146
4763
|
case 0:
|
|
4147
4764
|
_context.next = 1;
|
|
@@ -4171,9 +4788,9 @@ function notifyCmsCrudErrorToFeishu(_x3, _x4) {
|
|
|
4171
4788
|
return _notifyCmsCrudErrorToFeishu.apply(this, arguments);
|
|
4172
4789
|
}
|
|
4173
4790
|
function _notifyCmsCrudErrorToFeishu() {
|
|
4174
|
-
_notifyCmsCrudErrorToFeishu = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, options) {
|
|
4791
|
+
_notifyCmsCrudErrorToFeishu = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, options) {
|
|
4175
4792
|
var webhookUrls, body, results, failed;
|
|
4176
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
4793
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
4177
4794
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4178
4795
|
case 0:
|
|
4179
4796
|
webhookUrls = getWebhookUrls();
|
|
@@ -4235,9 +4852,9 @@ function initializeSystem() {
|
|
|
4235
4852
|
return _initializeSystem.apply(this, arguments);
|
|
4236
4853
|
}
|
|
4237
4854
|
function _initializeSystem() {
|
|
4238
|
-
_initializeSystem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
4855
|
+
_initializeSystem = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
|
4239
4856
|
var _t;
|
|
4240
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4857
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
4241
4858
|
while (1) switch (_context.prev = _context.next) {
|
|
4242
4859
|
case 0:
|
|
4243
4860
|
_context.prev = 0;
|
|
@@ -4328,9 +4945,9 @@ function getModels(_x) {
|
|
|
4328
4945
|
}
|
|
4329
4946
|
// POST - 创建新模型
|
|
4330
4947
|
function _getModels() {
|
|
4331
|
-
_getModels = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
4948
|
+
_getModels = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
4332
4949
|
var cmsModelService, page, limit, name, sessionId, models, tablePrefix, total, offset, paginatedModels, response, _response, _t2;
|
|
4333
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
4950
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
4334
4951
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4335
4952
|
case 0:
|
|
4336
4953
|
_context2.prev = 0;
|
|
@@ -4399,9 +5016,9 @@ function createModel(_x2) {
|
|
|
4399
5016
|
}
|
|
4400
5017
|
// PUT - 更新模型
|
|
4401
5018
|
function _createModel() {
|
|
4402
|
-
_createModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c) {
|
|
5019
|
+
_createModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c) {
|
|
4403
5020
|
var cmsModelService, dynamicTableService, body, name, table_name, json_schema, _response2, sessionId, tableNameError, _response3, schemaValidationError, _response4, existingModel, _response5, allModels, nameExists, _response6, tableExists, _response7, tableCreated, _response8, newModel, response, _response9, _t3;
|
|
4404
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
5021
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
4405
5022
|
while (1) switch (_context3.prev = _context3.next) {
|
|
4406
5023
|
case 0:
|
|
4407
5024
|
_context3.prev = 0;
|
|
@@ -4550,9 +5167,9 @@ function updateModel(_x3) {
|
|
|
4550
5167
|
}
|
|
4551
5168
|
// DELETE - 删除模型
|
|
4552
5169
|
function _updateModel() {
|
|
4553
|
-
_updateModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(c) {
|
|
5170
|
+
_updateModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(c) {
|
|
4554
5171
|
var cmsModelService, body, id, name, json_schema, _response0, model, _response1, schemaValidationError, _response10, updateData, updatedModel, response, _response11, _t4;
|
|
4555
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
5172
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
4556
5173
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4557
5174
|
case 0:
|
|
4558
5175
|
_context4.prev = 0;
|
|
@@ -4645,9 +5262,9 @@ function deleteModel(_x4) {
|
|
|
4645
5262
|
return _deleteModel.apply(this, arguments);
|
|
4646
5263
|
}
|
|
4647
5264
|
function _deleteModel() {
|
|
4648
|
-
_deleteModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(c) {
|
|
5265
|
+
_deleteModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(c) {
|
|
4649
5266
|
var cmsModelService, dynamicTableService, idStr, _response12, id, model, _response13, tableDropped, _response14, response, _response15, _t5;
|
|
4650
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
5267
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
4651
5268
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4652
5269
|
case 0:
|
|
4653
5270
|
_context5.prev = 0;
|
|
@@ -4728,46 +5345,6 @@ function _deleteModel() {
|
|
|
4728
5345
|
return _deleteModel.apply(this, arguments);
|
|
4729
5346
|
}
|
|
4730
5347
|
|
|
4731
|
-
function _arrayWithHoles(r) {
|
|
4732
|
-
if (Array.isArray(r)) return r;
|
|
4733
|
-
}
|
|
4734
|
-
|
|
4735
|
-
function _iterableToArrayLimit(r, l) {
|
|
4736
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4737
|
-
if (null != t) {
|
|
4738
|
-
var e,
|
|
4739
|
-
n,
|
|
4740
|
-
i,
|
|
4741
|
-
u,
|
|
4742
|
-
a = [],
|
|
4743
|
-
f = !0,
|
|
4744
|
-
o = !1;
|
|
4745
|
-
try {
|
|
4746
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
4747
|
-
if (Object(t) !== t) return;
|
|
4748
|
-
f = !1;
|
|
4749
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
4750
|
-
} catch (r) {
|
|
4751
|
-
o = !0, n = r;
|
|
4752
|
-
} finally {
|
|
4753
|
-
try {
|
|
4754
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
4755
|
-
} finally {
|
|
4756
|
-
if (o) throw n;
|
|
4757
|
-
}
|
|
4758
|
-
}
|
|
4759
|
-
return a;
|
|
4760
|
-
}
|
|
4761
|
-
}
|
|
4762
|
-
|
|
4763
|
-
function _nonIterableRest() {
|
|
4764
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4765
|
-
}
|
|
4766
|
-
|
|
4767
|
-
function _slicedToArray(r, e) {
|
|
4768
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest();
|
|
4769
|
-
}
|
|
4770
|
-
|
|
4771
5348
|
var _excluded = ["id", "created_at", "updated_at"],
|
|
4772
5349
|
_excluded2 = ["id"],
|
|
4773
5350
|
_excluded3 = ["created_at", "updated_at"];
|
|
@@ -4775,7 +5352,7 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
4775
5352
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4776
5353
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4777
5354
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4778
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5355
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4779
5356
|
function normalizeJsonLikeFields(schemaFields, payload) {
|
|
4780
5357
|
if (!schemaFields || schemaFields.length === 0) return payload;
|
|
4781
5358
|
var jsonLikeFieldNames = new Set(schemaFields.filter(function (f) {
|
|
@@ -5001,9 +5578,9 @@ function getTableData(_x, _x2) {
|
|
|
5001
5578
|
}
|
|
5002
5579
|
// POST - 创建新数据
|
|
5003
5580
|
function _getTableData() {
|
|
5004
|
-
_getTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c, tableName) {
|
|
5581
|
+
_getTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c, tableName) {
|
|
5005
5582
|
var _model$json_schema, validationResponse, dynamicTableService, cmsModelService, page, limit, search, filtersStr, model, schemaFields, filters, _response, parsed, normalized, _response2, result, searchableFields, response, _response3, _t, _t2;
|
|
5006
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
5583
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
5007
5584
|
while (1) switch (_context.prev = _context.next) {
|
|
5008
5585
|
case 0:
|
|
5009
5586
|
_context.prev = 0;
|
|
@@ -5149,9 +5726,9 @@ function createTableData(_x3, _x4) {
|
|
|
5149
5726
|
}
|
|
5150
5727
|
// PUT - 更新数据
|
|
5151
5728
|
function _createTableData() {
|
|
5152
|
-
_createTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, tableName) {
|
|
5729
|
+
_createTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, tableName) {
|
|
5153
5730
|
var _model$json_schema2, validationResponse, dynamicTableService, cmsModelService, body, rawData, data, _i2, _Object$entries2, _Object$entries2$_i, key, value, model, normalizedData, _response4, result, response, _response5, _t3, _t4;
|
|
5154
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
5731
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
5155
5732
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5156
5733
|
case 0:
|
|
5157
5734
|
_context2.prev = 0;
|
|
@@ -5241,9 +5818,9 @@ function updateTableData(_x5, _x6) {
|
|
|
5241
5818
|
}
|
|
5242
5819
|
// DELETE - 删除数据
|
|
5243
5820
|
function _updateTableData() {
|
|
5244
|
-
_updateTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c, tableName) {
|
|
5821
|
+
_updateTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c, tableName) {
|
|
5245
5822
|
var _model$json_schema3, validationResponse, dynamicTableService, cmsModelService, body, id, data, recordId, _response6, _response7, existingData, _response8, rawUpdateData, updateData, _i3, _Object$entries3, _Object$entries3$_i, key, value, model, _response9, result, _response0, response, _response1, _t5, _t6;
|
|
5246
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
5823
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
5247
5824
|
while (1) switch (_context3.prev = _context3.next) {
|
|
5248
5825
|
case 0:
|
|
5249
5826
|
_context3.prev = 0;
|
|
@@ -5378,9 +5955,9 @@ function deleteTableData(_x7, _x8) {
|
|
|
5378
5955
|
}
|
|
5379
5956
|
// GET - 获取关联表选项列表 (用于下拉选择)
|
|
5380
5957
|
function _deleteTableData() {
|
|
5381
|
-
_deleteTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(c, tableName) {
|
|
5958
|
+
_deleteTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(c, tableName) {
|
|
5382
5959
|
var validationResponse, dynamicTableService, id, _response10, recordId, _response11, existingData, _response12, result, response, _response13, _t7;
|
|
5383
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
5960
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
5384
5961
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5385
5962
|
case 0:
|
|
5386
5963
|
_context4.prev = 0;
|
|
@@ -5467,9 +6044,9 @@ function getRelationOptions(_x9, _x0) {
|
|
|
5467
6044
|
}
|
|
5468
6045
|
// GET - 获取表数据(带关联数据)
|
|
5469
6046
|
function _getRelationOptions() {
|
|
5470
|
-
_getRelationOptions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(c, tableName) {
|
|
6047
|
+
_getRelationOptions = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(c, tableName) {
|
|
5471
6048
|
var validationResponse, dynamicTableService, displayField, limit, search, params, options, response, _response14, _t8;
|
|
5472
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
6049
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
5473
6050
|
while (1) switch (_context5.prev = _context5.next) {
|
|
5474
6051
|
case 0:
|
|
5475
6052
|
_context5.prev = 0;
|
|
@@ -5523,9 +6100,9 @@ function getTableDataWithRelations(_x1, _x10) {
|
|
|
5523
6100
|
// DELETE - 删除表的所有外键约束
|
|
5524
6101
|
// 用于解决外键约束引用错误表的问题
|
|
5525
6102
|
function _getTableDataWithRelations() {
|
|
5526
|
-
_getTableDataWithRelations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(c, tableName) {
|
|
6103
|
+
_getTableDataWithRelations = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(c, tableName) {
|
|
5527
6104
|
var validationResponse, dynamicTableService, cmsModelService, page, limit, model, result, response, hasRelations, _result, _response15, _result2, _response16, _response17, _t9;
|
|
5528
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
6105
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
5529
6106
|
while (1) switch (_context6.prev = _context6.next) {
|
|
5530
6107
|
case 0:
|
|
5531
6108
|
_context6.prev = 0;
|
|
@@ -5610,9 +6187,9 @@ function dropForeignKeys(_x11, _x12) {
|
|
|
5610
6187
|
return _dropForeignKeys.apply(this, arguments);
|
|
5611
6188
|
}
|
|
5612
6189
|
function _dropForeignKeys() {
|
|
5613
|
-
_dropForeignKeys = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(c, tableName) {
|
|
6190
|
+
_dropForeignKeys = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(c, tableName) {
|
|
5614
6191
|
var validationResponse, dynamicTableService, result, response, _response18, _response19, _t0;
|
|
5615
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
6192
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
5616
6193
|
while (1) switch (_context7.prev = _context7.next) {
|
|
5617
6194
|
case 0:
|
|
5618
6195
|
_context7.prev = 0;
|
|
@@ -5673,9 +6250,9 @@ var JWT_EXPIRES_IN = '24h';
|
|
|
5673
6250
|
*/
|
|
5674
6251
|
var AuthUtils = /*#__PURE__*/function () {
|
|
5675
6252
|
function AuthUtils() {
|
|
5676
|
-
_classCallCheck(this, AuthUtils);
|
|
6253
|
+
_classCallCheck$1(this, AuthUtils);
|
|
5677
6254
|
}
|
|
5678
|
-
return _createClass(AuthUtils, null, [{
|
|
6255
|
+
return _createClass$1(AuthUtils, null, [{
|
|
5679
6256
|
key: "generateToken",
|
|
5680
6257
|
value:
|
|
5681
6258
|
/**
|
|
@@ -5711,8 +6288,8 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5711
6288
|
}, {
|
|
5712
6289
|
key: "validatePassword",
|
|
5713
6290
|
value: (function () {
|
|
5714
|
-
var _validatePassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(plainPassword, hashedPassword) {
|
|
5715
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
6291
|
+
var _validatePassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(plainPassword, hashedPassword) {
|
|
6292
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
5716
6293
|
while (1) switch (_context.prev = _context.next) {
|
|
5717
6294
|
case 0:
|
|
5718
6295
|
return _context.abrupt("return", bcrypt.compare(plainPassword, hashedPassword));
|
|
@@ -5734,8 +6311,8 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5734
6311
|
}, {
|
|
5735
6312
|
key: "hashPassword",
|
|
5736
6313
|
value: (function () {
|
|
5737
|
-
var _hashPassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(password) {
|
|
5738
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
6314
|
+
var _hashPassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(password) {
|
|
6315
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
5739
6316
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5740
6317
|
case 0:
|
|
5741
6318
|
return _context2.abrupt("return", bcrypt.hash(password, 10));
|
|
@@ -5776,9 +6353,9 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5776
6353
|
}, {
|
|
5777
6354
|
key: "authenticateUser",
|
|
5778
6355
|
value: (function () {
|
|
5779
|
-
var _authenticateUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(username, password, tableName) {
|
|
6356
|
+
var _authenticateUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(username, password, tableName) {
|
|
5780
6357
|
var authService, user, isPasswordValid, _t;
|
|
5781
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
6358
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
5782
6359
|
while (1) switch (_context3.prev = _context3.next) {
|
|
5783
6360
|
case 0:
|
|
5784
6361
|
authService = this.getAuthService(); // 查询用户
|
|
@@ -5847,9 +6424,9 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5847
6424
|
}, {
|
|
5848
6425
|
key: "verifyTokenAndGetUser",
|
|
5849
6426
|
value: (function () {
|
|
5850
|
-
var _verifyTokenAndGetUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(token, tableName) {
|
|
6427
|
+
var _verifyTokenAndGetUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(token, tableName) {
|
|
5851
6428
|
var decoded, authService, userInfo, message, _t2;
|
|
5852
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
6429
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
5853
6430
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5854
6431
|
case 0:
|
|
5855
6432
|
_context4.prev = 0;
|
|
@@ -5974,9 +6551,9 @@ function forgotPassword(_x, _x2) {
|
|
|
5974
6551
|
}
|
|
5975
6552
|
// POST - 通过邮箱验证码重置密码
|
|
5976
6553
|
function _forgotPassword() {
|
|
5977
|
-
_forgotPassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, tableName) {
|
|
6554
|
+
_forgotPassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, tableName) {
|
|
5978
6555
|
var _body$username, i18n, body, account, supabase, sessionId, adminRow, _i18n, _t3;
|
|
5979
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
6556
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
5980
6557
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5981
6558
|
case 0:
|
|
5982
6559
|
_context2.prev = 0;
|
|
@@ -6048,9 +6625,9 @@ function resetPassword(_x3, _x4) {
|
|
|
6048
6625
|
return _resetPassword.apply(this, arguments);
|
|
6049
6626
|
}
|
|
6050
6627
|
function _resetPassword() {
|
|
6051
|
-
_resetPassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c, tableName) {
|
|
6628
|
+
_resetPassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c, tableName) {
|
|
6052
6629
|
var _body$username2, _body$code, i18n, body, account, code, password, supabase, sessionId, adminRow, verifyResult, _yield$supabase$auth$2, updateError, _i18n2, _t4;
|
|
6053
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
6630
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
6054
6631
|
while (1) switch (_context3.prev = _context3.next) {
|
|
6055
6632
|
case 0:
|
|
6056
6633
|
_context3.prev = 0;
|
|
@@ -6168,8 +6745,8 @@ function insertAdminRegistryRow(_x5, _x6, _x7, _x8) {
|
|
|
6168
6745
|
return _insertAdminRegistryRow.apply(this, arguments);
|
|
6169
6746
|
}
|
|
6170
6747
|
function _insertAdminRegistryRow() {
|
|
6171
|
-
_insertAdminRegistryRow = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(supabase, sessionId, userId, account) {
|
|
6172
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
6748
|
+
_insertAdminRegistryRow = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(supabase, sessionId, userId, account) {
|
|
6749
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
6173
6750
|
while (1) switch (_context4.prev = _context4.next) {
|
|
6174
6751
|
case 0:
|
|
6175
6752
|
_context4.next = 1;
|
|
@@ -6196,9 +6773,9 @@ function getEffectiveRoleForSession(_x9, _x0) {
|
|
|
6196
6773
|
return _getEffectiveRoleForSession.apply(this, arguments);
|
|
6197
6774
|
} // POST - 用户登录
|
|
6198
6775
|
function _getEffectiveRoleForSession() {
|
|
6199
|
-
_getEffectiveRoleForSession = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(user, sessionId) {
|
|
6776
|
+
_getEffectiveRoleForSession = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(user, sessionId) {
|
|
6200
6777
|
var supabase, sid, role, ok;
|
|
6201
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
6778
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
6202
6779
|
while (1) switch (_context5.prev = _context5.next) {
|
|
6203
6780
|
case 0:
|
|
6204
6781
|
supabase = getSupabase();
|
|
@@ -6234,9 +6811,9 @@ function login(_x1, _x10) {
|
|
|
6234
6811
|
}
|
|
6235
6812
|
// GET - 是否允许注册(首次进入需要创建管理员账号)
|
|
6236
6813
|
function _login() {
|
|
6237
|
-
_login = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(c, tableName) {
|
|
6814
|
+
_login = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(c, tableName) {
|
|
6238
6815
|
var _data$session, body, username, password, supabase, sessionId, email, _yield$supabase$auth$3, data, error, token, user, role, _t5;
|
|
6239
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
6816
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
6240
6817
|
while (1) switch (_context6.prev = _context6.next) {
|
|
6241
6818
|
case 0:
|
|
6242
6819
|
_context6.prev = 0;
|
|
@@ -6329,9 +6906,9 @@ function signupStatus(_x11, _x12) {
|
|
|
6329
6906
|
}
|
|
6330
6907
|
// POST - 首次注册管理员(每个 session_id 只允许一个)
|
|
6331
6908
|
function _signupStatus() {
|
|
6332
|
-
_signupStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(c, tableName) {
|
|
6909
|
+
_signupStatus = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(c, tableName) {
|
|
6333
6910
|
var supabase, sessionId, ok, row, data, _t6;
|
|
6334
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
6911
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
6335
6912
|
while (1) switch (_context7.prev = _context7.next) {
|
|
6336
6913
|
case 0:
|
|
6337
6914
|
_context7.prev = 0;
|
|
@@ -6388,9 +6965,9 @@ function signup(_x13, _x14) {
|
|
|
6388
6965
|
}
|
|
6389
6966
|
// POST - 验证token
|
|
6390
6967
|
function _signup() {
|
|
6391
|
-
_signup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(c, tableName) {
|
|
6968
|
+
_signup = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee8(c, tableName) {
|
|
6392
6969
|
var _body$username3, _data$session2, body, account, password, supabase, sessionId, email, ok, existing, _yield$supabase$auth$4, data, error, insertRes, token, user, role, _t7;
|
|
6393
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
6970
|
+
return _regeneratorRuntime$1.wrap(function (_context8) {
|
|
6394
6971
|
while (1) switch (_context8.prev = _context8.next) {
|
|
6395
6972
|
case 0:
|
|
6396
6973
|
_context8.prev = 0;
|
|
@@ -6555,9 +7132,9 @@ function verifyAuth(_x15, _x16) {
|
|
|
6555
7132
|
}
|
|
6556
7133
|
// GET - 获取当前用户信息
|
|
6557
7134
|
function _verifyAuth() {
|
|
6558
|
-
_verifyAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(c, tableName) {
|
|
7135
|
+
_verifyAuth = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee9(c, tableName) {
|
|
6559
7136
|
var authHeader, token, supabase, _yield$supabase$auth$5, data, error, sessionId, role, decoded, message, responseMessage, _t8, _t9;
|
|
6560
|
-
return _regeneratorRuntime.wrap(function (_context9) {
|
|
7137
|
+
return _regeneratorRuntime$1.wrap(function (_context9) {
|
|
6561
7138
|
while (1) switch (_context9.prev = _context9.next) {
|
|
6562
7139
|
case 0:
|
|
6563
7140
|
_context9.prev = 0;
|
|
@@ -6635,9 +7212,9 @@ function getCurrentUser(_x17, _x18) {
|
|
|
6635
7212
|
}
|
|
6636
7213
|
// 中间件:验证 Supabase JWT token
|
|
6637
7214
|
function _getCurrentUser() {
|
|
6638
|
-
_getCurrentUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(c, tableName) {
|
|
7215
|
+
_getCurrentUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee0(c, tableName) {
|
|
6639
7216
|
var authHeader, token, supabase, _yield$supabase$auth$6, data, error, user, sessionId, role, _t0;
|
|
6640
|
-
return _regeneratorRuntime.wrap(function (_context0) {
|
|
7217
|
+
return _regeneratorRuntime$1.wrap(function (_context0) {
|
|
6641
7218
|
while (1) switch (_context0.prev = _context0.next) {
|
|
6642
7219
|
case 0:
|
|
6643
7220
|
_context0.prev = 0;
|
|
@@ -6708,7 +7285,7 @@ function _getCurrentUser() {
|
|
|
6708
7285
|
}
|
|
6709
7286
|
function requireAuth(handler) {
|
|
6710
7287
|
return /*#__PURE__*/function () {
|
|
6711
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c) {
|
|
7288
|
+
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c) {
|
|
6712
7289
|
var authHeader,
|
|
6713
7290
|
token,
|
|
6714
7291
|
supabase,
|
|
@@ -6720,7 +7297,7 @@ function requireAuth(handler) {
|
|
|
6720
7297
|
_key,
|
|
6721
7298
|
_args = arguments,
|
|
6722
7299
|
_t2;
|
|
6723
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7300
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
6724
7301
|
while (1) switch (_context.prev = _context.next) {
|
|
6725
7302
|
case 0:
|
|
6726
7303
|
_context.prev = 0;
|
|
@@ -6802,10 +7379,10 @@ function resolveUploadMaxSize(_x, _x2) {
|
|
|
6802
7379
|
return _resolveUploadMaxSize.apply(this, arguments);
|
|
6803
7380
|
}
|
|
6804
7381
|
function _resolveUploadMaxSize() {
|
|
6805
|
-
_resolveUploadMaxSize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(tableName, fieldName) {
|
|
7382
|
+
_resolveUploadMaxSize = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(tableName, fieldName) {
|
|
6806
7383
|
var _model$json_schema;
|
|
6807
7384
|
var cmsModelService, model;
|
|
6808
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7385
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
6809
7386
|
while (1) switch (_context.prev = _context.next) {
|
|
6810
7387
|
case 0:
|
|
6811
7388
|
if (!(!tableName || !fieldName)) {
|
|
@@ -6835,9 +7412,9 @@ function uploadToOss(_x3) {
|
|
|
6835
7412
|
return _uploadToOss.apply(this, arguments);
|
|
6836
7413
|
}
|
|
6837
7414
|
function _uploadToOss() {
|
|
6838
|
-
_uploadToOss = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
7415
|
+
_uploadToOss = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
6839
7416
|
var formData, file, fieldName, tableName, uploadService, result, status, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8;
|
|
6840
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7417
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
6841
7418
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6842
7419
|
case 0:
|
|
6843
7420
|
_context2.prev = 0;
|
|
@@ -6909,7 +7486,7 @@ function _uploadToOss() {
|
|
|
6909
7486
|
}
|
|
6910
7487
|
|
|
6911
7488
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6912
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7489
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6913
7490
|
var CONFIG_NAMESPACE_RE = /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;
|
|
6914
7491
|
var CONFIG_SESSION_RE = /^[a-zA-Z0-9_]{1,128}$/;
|
|
6915
7492
|
function getConfigSessionId(c) {
|
|
@@ -6926,7 +7503,7 @@ function getConfigsTableName(sessionId) {
|
|
|
6926
7503
|
return "".concat(sessionId.replace(/-/g, '_'), "__config__");
|
|
6927
7504
|
}
|
|
6928
7505
|
function normalizeValues(values) {
|
|
6929
|
-
if (!values || _typeof$
|
|
7506
|
+
if (!values || _typeof$2(values) !== "object" || Array.isArray(values)) {
|
|
6930
7507
|
return {};
|
|
6931
7508
|
}
|
|
6932
7509
|
return values;
|
|
@@ -6963,9 +7540,9 @@ function getConfig(_x) {
|
|
|
6963
7540
|
return _getConfig.apply(this, arguments);
|
|
6964
7541
|
}
|
|
6965
7542
|
function _getConfig() {
|
|
6966
|
-
_getConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c) {
|
|
7543
|
+
_getConfig = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c) {
|
|
6967
7544
|
var namespace, namespaceError, _response, sessionId, sessionError, _response2, tableName, supabase, _yield$supabase$from$, data, error, response, _response3, _t;
|
|
6968
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7545
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
6969
7546
|
while (1) switch (_context.prev = _context.next) {
|
|
6970
7547
|
case 0:
|
|
6971
7548
|
_context.prev = 0;
|
|
@@ -7034,9 +7611,9 @@ function updateConfig(_x2) {
|
|
|
7034
7611
|
return _updateConfig.apply(this, arguments);
|
|
7035
7612
|
}
|
|
7036
7613
|
function _updateConfig() {
|
|
7037
|
-
_updateConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
7614
|
+
_updateConfig = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
7038
7615
|
var namespace, namespaceError, _response4, body, values, sessionId, sessionError, _response5, tableName, supabase, _yield$supabase$from$2, existing, existingError, nextValues, _yield$supabase$from$3, data, error, response, _response6, _t2;
|
|
7039
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7616
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
7040
7617
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7041
7618
|
case 0:
|
|
7042
7619
|
_context2.prev = 0;
|
|
@@ -7127,6 +7704,22 @@ function _updateConfig() {
|
|
|
7127
7704
|
return _updateConfig.apply(this, arguments);
|
|
7128
7705
|
}
|
|
7129
7706
|
|
|
7707
|
+
function _arrayWithoutHoles(r) {
|
|
7708
|
+
if (Array.isArray(r)) return _arrayLikeToArray$2(r);
|
|
7709
|
+
}
|
|
7710
|
+
|
|
7711
|
+
function _iterableToArray(r) {
|
|
7712
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
7713
|
+
}
|
|
7714
|
+
|
|
7715
|
+
function _nonIterableSpread() {
|
|
7716
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7717
|
+
}
|
|
7718
|
+
|
|
7719
|
+
function _toConsumableArray(r) {
|
|
7720
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
|
|
7721
|
+
}
|
|
7722
|
+
|
|
7130
7723
|
var AUTH_REQUIRED = "CMS_AUTH_REQUIRED";
|
|
7131
7724
|
var AUTH_INVALID = "CMS_AUTH_INVALID";
|
|
7132
7725
|
var CMS_FORBIDDEN = "CMS_FORBIDDEN";
|
|
@@ -7138,9 +7731,9 @@ function getRoleFromSupabaseUser$1(user) {
|
|
|
7138
7731
|
return appRole !== null && appRole !== void 0 ? appRole : userRole;
|
|
7139
7732
|
}
|
|
7140
7733
|
var requireJwtAuth = /*#__PURE__*/function () {
|
|
7141
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c, next) {
|
|
7734
|
+
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c, next) {
|
|
7142
7735
|
var authHeader, token, supabase, _yield$supabase$auth$, data, error, auth;
|
|
7143
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7736
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
7144
7737
|
while (1) switch (_context.prev = _context.next) {
|
|
7145
7738
|
case 0:
|
|
7146
7739
|
authHeader = c.req.header("Authorization") || null;
|
|
@@ -7202,10 +7795,10 @@ var requireJwtAuth = /*#__PURE__*/function () {
|
|
|
7202
7795
|
};
|
|
7203
7796
|
}();
|
|
7204
7797
|
var requireAdminRole = /*#__PURE__*/function () {
|
|
7205
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, next) {
|
|
7798
|
+
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, next) {
|
|
7206
7799
|
var _user$user_metadata2;
|
|
7207
7800
|
var auth, role, sessionId, user, userSessionId, supabase, ok, isAdmin;
|
|
7208
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7801
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
7209
7802
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7210
7803
|
case 0:
|
|
7211
7804
|
auth = c.auth;
|
|
@@ -7301,9 +7894,9 @@ function supabaseLogin(_x) {
|
|
|
7301
7894
|
}
|
|
7302
7895
|
// POST - 校验 Supabase JWT(需要 Authorization: Bearer <token>)
|
|
7303
7896
|
function _supabaseLogin() {
|
|
7304
|
-
_supabaseLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c) {
|
|
7897
|
+
_supabaseLogin = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c) {
|
|
7305
7898
|
var _body$email, _data$session, body, email, password, supabase, _yield$supabase$auth$, data, error, token, user, role, _t;
|
|
7306
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7899
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
7307
7900
|
while (1) switch (_context.prev = _context.next) {
|
|
7308
7901
|
case 0:
|
|
7309
7902
|
_context.prev = 0;
|
|
@@ -7378,9 +7971,9 @@ function supabaseVerify(_x2) {
|
|
|
7378
7971
|
}
|
|
7379
7972
|
// GET - 当前用户(需要 Authorization: Bearer <token>)
|
|
7380
7973
|
function _supabaseVerify() {
|
|
7381
|
-
_supabaseVerify = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
7974
|
+
_supabaseVerify = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
7382
7975
|
var token, supabase, _yield$supabase$auth$2, data, error, _t2;
|
|
7383
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7976
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
7384
7977
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7385
7978
|
case 0:
|
|
7386
7979
|
_context2.prev = 0;
|
|
@@ -7435,9 +8028,9 @@ function supabaseCurrentUser(_x3) {
|
|
|
7435
8028
|
return _supabaseCurrentUser.apply(this, arguments);
|
|
7436
8029
|
}
|
|
7437
8030
|
function _supabaseCurrentUser() {
|
|
7438
|
-
_supabaseCurrentUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c) {
|
|
8031
|
+
_supabaseCurrentUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c) {
|
|
7439
8032
|
var token, supabase, _yield$supabase$auth$3, data, error, user, role, _t3;
|
|
7440
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
8033
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
7441
8034
|
while (1) switch (_context3.prev = _context3.next) {
|
|
7442
8035
|
case 0:
|
|
7443
8036
|
_context3.prev = 0;
|
|
@@ -7495,64 +8088,128 @@ function _supabaseCurrentUser() {
|
|
|
7495
8088
|
return _supabaseCurrentUser.apply(this, arguments);
|
|
7496
8089
|
}
|
|
7497
8090
|
|
|
8091
|
+
function isSkipAuthRequest(c) {
|
|
8092
|
+
return c.req.header("X-CMS-Skip-Auth") === "true";
|
|
8093
|
+
}
|
|
8094
|
+
function withAdmin() {
|
|
8095
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8096
|
+
if (!options.skipAuth) {
|
|
8097
|
+
return [requireJwtAuth, requireAdminRole];
|
|
8098
|
+
}
|
|
8099
|
+
// 路由免鉴权
|
|
8100
|
+
return [(/*#__PURE__*/function () {
|
|
8101
|
+
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c, next) {
|
|
8102
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
8103
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8104
|
+
case 0:
|
|
8105
|
+
if (!isSkipAuthRequest(c)) {
|
|
8106
|
+
_context.next = 2;
|
|
8107
|
+
break;
|
|
8108
|
+
}
|
|
8109
|
+
_context.next = 1;
|
|
8110
|
+
return next();
|
|
8111
|
+
case 1:
|
|
8112
|
+
return _context.abrupt("return");
|
|
8113
|
+
case 2:
|
|
8114
|
+
_context.next = 3;
|
|
8115
|
+
return requireJwtAuth(c, next);
|
|
8116
|
+
case 3:
|
|
8117
|
+
case "end":
|
|
8118
|
+
return _context.stop();
|
|
8119
|
+
}
|
|
8120
|
+
}, _callee);
|
|
8121
|
+
}));
|
|
8122
|
+
return function (_x, _x2) {
|
|
8123
|
+
return _ref.apply(this, arguments);
|
|
8124
|
+
};
|
|
8125
|
+
}()), (/*#__PURE__*/function () {
|
|
8126
|
+
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, next) {
|
|
8127
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
8128
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8129
|
+
case 0:
|
|
8130
|
+
if (!isSkipAuthRequest(c)) {
|
|
8131
|
+
_context2.next = 2;
|
|
8132
|
+
break;
|
|
8133
|
+
}
|
|
8134
|
+
_context2.next = 1;
|
|
8135
|
+
return next();
|
|
8136
|
+
case 1:
|
|
8137
|
+
return _context2.abrupt("return");
|
|
8138
|
+
case 2:
|
|
8139
|
+
_context2.next = 3;
|
|
8140
|
+
return requireAdminRole(c, next);
|
|
8141
|
+
case 3:
|
|
8142
|
+
case "end":
|
|
8143
|
+
return _context2.stop();
|
|
8144
|
+
}
|
|
8145
|
+
}, _callee2);
|
|
8146
|
+
}));
|
|
8147
|
+
return function (_x3, _x4) {
|
|
8148
|
+
return _ref2.apply(this, arguments);
|
|
8149
|
+
};
|
|
8150
|
+
}())];
|
|
8151
|
+
}
|
|
7498
8152
|
// 创建模型路由处理器
|
|
7499
8153
|
function createModelRoute(app) {
|
|
8154
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7500
8155
|
// CMS 管理接口:要求登录 + admin 权限(兼容 Supabase Auth JWT / 旧 CMS JWT)
|
|
7501
|
-
app.get("/models",
|
|
7502
|
-
app.post("/models",
|
|
7503
|
-
app.put("/models",
|
|
7504
|
-
app["delete"]("/models",
|
|
8156
|
+
app.get.apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [getModels]));
|
|
8157
|
+
app.post.apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [createModel]));
|
|
8158
|
+
app.put.apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [updateModel]));
|
|
8159
|
+
app["delete"].apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [deleteModel]));
|
|
7505
8160
|
return app;
|
|
7506
8161
|
}
|
|
7507
8162
|
// 创建数据表路由处理器(固定表名)
|
|
7508
8163
|
function createDataRoute(app, tableName) {
|
|
7509
|
-
|
|
8164
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8165
|
+
app.get.apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7510
8166
|
return getTableData(c, tableName);
|
|
7511
|
-
});
|
|
7512
|
-
app.post("/data/".concat(tableName),
|
|
8167
|
+
}]));
|
|
8168
|
+
app.post.apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7513
8169
|
return createTableData(c, tableName);
|
|
7514
|
-
});
|
|
7515
|
-
app.put("/data/".concat(tableName),
|
|
8170
|
+
}]));
|
|
8171
|
+
app.put.apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7516
8172
|
return updateTableData(c, tableName);
|
|
7517
|
-
});
|
|
7518
|
-
app["delete"]("/data/".concat(tableName),
|
|
8173
|
+
}]));
|
|
8174
|
+
app["delete"].apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7519
8175
|
return deleteTableData(c, tableName);
|
|
7520
|
-
});
|
|
8176
|
+
}]));
|
|
7521
8177
|
return app;
|
|
7522
8178
|
}
|
|
7523
8179
|
// 动态创建数据表路由处理器(从URL参数获取表名)
|
|
7524
8180
|
function createDynamicDataRoute(app) {
|
|
8181
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7525
8182
|
// 获取关联表选项(放在 :tableName 路由之前,避免被匹配)
|
|
7526
|
-
app.get("/relation/:tableName/options",
|
|
7527
|
-
var tableName = c.req.param("tableName");
|
|
8183
|
+
app.get.apply(app, ["/relation/:tableName/options"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8184
|
+
var tableName = c.req.param("tableName") || "";
|
|
7528
8185
|
return getRelationOptions(c, tableName);
|
|
7529
|
-
});
|
|
8186
|
+
}]));
|
|
7530
8187
|
// 获取带关联数据的表数据
|
|
7531
|
-
app.get("/data/:tableName/with-relations",
|
|
7532
|
-
var tableName = c.req.param("tableName");
|
|
8188
|
+
app.get.apply(app, ["/data/:tableName/with-relations"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8189
|
+
var tableName = c.req.param("tableName") || "";
|
|
7533
8190
|
return getTableDataWithRelations(c, tableName);
|
|
7534
|
-
});
|
|
7535
|
-
app.get("/data/:tableName",
|
|
7536
|
-
var tableName = c.req.param("tableName");
|
|
8191
|
+
}]));
|
|
8192
|
+
app.get.apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8193
|
+
var tableName = c.req.param("tableName") || "";
|
|
7537
8194
|
return getTableData(c, tableName);
|
|
7538
|
-
});
|
|
7539
|
-
app.post("/data/:tableName",
|
|
7540
|
-
var tableName = c.req.param("tableName");
|
|
8195
|
+
}]));
|
|
8196
|
+
app.post.apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8197
|
+
var tableName = c.req.param("tableName") || "";
|
|
7541
8198
|
return createTableData(c, tableName);
|
|
7542
|
-
});
|
|
7543
|
-
app.put("/data/:tableName",
|
|
7544
|
-
var tableName = c.req.param("tableName");
|
|
8199
|
+
}]));
|
|
8200
|
+
app.put.apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8201
|
+
var tableName = c.req.param("tableName") || "";
|
|
7545
8202
|
return updateTableData(c, tableName);
|
|
7546
|
-
});
|
|
7547
|
-
app["delete"]("/data/:tableName",
|
|
7548
|
-
var tableName = c.req.param("tableName");
|
|
8203
|
+
}]));
|
|
8204
|
+
app["delete"].apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8205
|
+
var tableName = c.req.param("tableName") || "";
|
|
7549
8206
|
return deleteTableData(c, tableName);
|
|
7550
|
-
});
|
|
8207
|
+
}]));
|
|
7551
8208
|
// 删除表的所有外键约束(用于解决外键引用错误表的问题)
|
|
7552
|
-
app["delete"]("/data/:tableName/foreign-keys",
|
|
7553
|
-
var tableName = c.req.param("tableName");
|
|
8209
|
+
app["delete"].apply(app, ["/data/:tableName/foreign-keys"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8210
|
+
var tableName = c.req.param("tableName") || "";
|
|
7554
8211
|
return dropForeignKeys(c, tableName);
|
|
7555
|
-
});
|
|
8212
|
+
}]));
|
|
7556
8213
|
return app;
|
|
7557
8214
|
}
|
|
7558
8215
|
// 动态创建认证路由处理器(从URL参数获取表名)
|
|
@@ -7635,21 +8292,24 @@ function createAuthRoute(app, tableName) {
|
|
|
7635
8292
|
return app;
|
|
7636
8293
|
}
|
|
7637
8294
|
function createOssUploadRoute(app) {
|
|
7638
|
-
|
|
8295
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8296
|
+
app.post.apply(app, ["/upload"].concat(_toConsumableArray(withAdmin(options)), [uploadToOss]));
|
|
7639
8297
|
return app;
|
|
7640
8298
|
}
|
|
7641
8299
|
function createConfigRoute(app) {
|
|
7642
|
-
|
|
7643
|
-
app.
|
|
8300
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8301
|
+
app.get.apply(app, ["/configs"].concat(_toConsumableArray(withAdmin(options)), [getConfig]));
|
|
8302
|
+
app.put.apply(app, ["/configs/:namespace"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7644
8303
|
return updateConfig(c);
|
|
7645
|
-
});
|
|
8304
|
+
}]));
|
|
7646
8305
|
return app;
|
|
7647
8306
|
}
|
|
7648
8307
|
// 一键创建所有CMS路由
|
|
7649
8308
|
function createCmsRoutes(app) {
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
8309
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8310
|
+
createModelRoute(app, options);
|
|
8311
|
+
createConfigRoute(app, options);
|
|
8312
|
+
createDynamicDataRoute(app, options);
|
|
7653
8313
|
createDynamicAuthRoute(app);
|
|
7654
8314
|
return app;
|
|
7655
8315
|
}
|