@wecode-team/cms-supabase-api 0.1.50 → 0.1.52-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/handlers/configs.d.ts +23 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +1465 -615
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1467 -614
- package/dist/index.js.map +1 -1
- package/dist/utils/route-helpers.d.ts +9 -5
- package/package.json +2 -1
- package/supabase-setup.sql +25 -0
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ function _interopNamespaceDefault(e) {
|
|
|
25
25
|
var jwt__namespace = /*#__PURE__*/_interopNamespaceDefault(jwt);
|
|
26
26
|
var bcrypt__namespace = /*#__PURE__*/_interopNamespaceDefault(bcrypt);
|
|
27
27
|
|
|
28
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
28
|
+
function asyncGeneratorStep$1(n, t, e, r, o, a, c) {
|
|
29
29
|
try {
|
|
30
30
|
var i = n[a](c),
|
|
31
31
|
u = i.value;
|
|
@@ -34,390 +34,391 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
|
34
34
|
}
|
|
35
35
|
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
36
36
|
}
|
|
37
|
-
function _asyncToGenerator(n) {
|
|
37
|
+
function _asyncToGenerator$1(n) {
|
|
38
38
|
return function () {
|
|
39
39
|
var t = this,
|
|
40
40
|
e = arguments;
|
|
41
41
|
return new Promise(function (r, o) {
|
|
42
42
|
var a = n.apply(t, e);
|
|
43
43
|
function _next(n) {
|
|
44
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
44
|
+
asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n);
|
|
45
45
|
}
|
|
46
46
|
function _throw(n) {
|
|
47
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
47
|
+
asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n);
|
|
48
48
|
}
|
|
49
49
|
_next(void 0);
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function _typeof$1(o) {
|
|
55
|
-
"@babel/helpers - typeof";
|
|
56
|
-
|
|
57
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
58
|
-
return typeof o;
|
|
59
|
-
} : function (o) {
|
|
60
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
61
|
-
}, _typeof$1(o);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
54
|
function getDefaultExportFromCjs (x) {
|
|
65
55
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
66
56
|
}
|
|
67
57
|
|
|
68
|
-
var regeneratorRuntime$
|
|
58
|
+
var regeneratorRuntime$2 = {exports: {}};
|
|
69
59
|
|
|
70
|
-
var OverloadYield = {exports: {}};
|
|
60
|
+
var OverloadYield$1 = {exports: {}};
|
|
71
61
|
|
|
72
62
|
(function (module) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
var OverloadYieldExports = OverloadYield.exports;
|
|
63
|
+
function _OverloadYield(e, d) {
|
|
64
|
+
this.v = e, this.k = d;
|
|
65
|
+
}
|
|
66
|
+
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
67
|
+
} (OverloadYield$1));
|
|
79
68
|
|
|
80
|
-
var
|
|
69
|
+
var OverloadYieldExports$1 = OverloadYield$1.exports;
|
|
81
70
|
|
|
82
|
-
var
|
|
71
|
+
var regenerator$3 = {exports: {}};
|
|
72
|
+
|
|
73
|
+
var regeneratorDefine$1 = {exports: {}};
|
|
83
74
|
|
|
84
75
|
(function (module) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
76
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
77
|
+
var i = Object.defineProperty;
|
|
78
|
+
try {
|
|
79
|
+
i({}, "", {});
|
|
80
|
+
} catch (e) {
|
|
81
|
+
i = 0;
|
|
82
|
+
}
|
|
83
|
+
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
|
|
84
|
+
function o(r, n) {
|
|
85
|
+
_regeneratorDefine(e, r, function (e) {
|
|
86
|
+
return this._invoke(r, n, e);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
r ? i ? i(e, r, {
|
|
90
|
+
value: n,
|
|
91
|
+
enumerable: !t,
|
|
92
|
+
configurable: !t,
|
|
93
|
+
writable: !t
|
|
94
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
95
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
|
|
96
|
+
}
|
|
97
|
+
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
98
|
+
} (regeneratorDefine$1));
|
|
99
|
+
|
|
100
|
+
var regeneratorDefineExports$1 = regeneratorDefine$1.exports;
|
|
109
101
|
|
|
110
102
|
(function (module) {
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
var regeneratorExports = regenerator$1.exports;
|
|
103
|
+
var regeneratorDefine = regeneratorDefineExports$1;
|
|
104
|
+
function _regenerator() {
|
|
105
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
106
|
+
var e,
|
|
107
|
+
t,
|
|
108
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
109
|
+
n = r.iterator || "@@iterator",
|
|
110
|
+
o = r.toStringTag || "@@toStringTag";
|
|
111
|
+
function i(r, n, o, i) {
|
|
112
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
113
|
+
u = Object.create(c.prototype);
|
|
114
|
+
return regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
115
|
+
var i,
|
|
116
|
+
c,
|
|
117
|
+
u,
|
|
118
|
+
f = 0,
|
|
119
|
+
p = o || [],
|
|
120
|
+
y = !1,
|
|
121
|
+
G = {
|
|
122
|
+
p: 0,
|
|
123
|
+
n: 0,
|
|
124
|
+
v: e,
|
|
125
|
+
a: d,
|
|
126
|
+
f: d.bind(e, 4),
|
|
127
|
+
d: function d(t, r) {
|
|
128
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
function d(r, n) {
|
|
132
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
133
|
+
var o,
|
|
134
|
+
i = p[t],
|
|
135
|
+
d = G.p,
|
|
136
|
+
l = i[2];
|
|
137
|
+
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));
|
|
138
|
+
}
|
|
139
|
+
if (o || r > 1) return a;
|
|
140
|
+
throw y = !0, n;
|
|
141
|
+
}
|
|
142
|
+
return function (o, p, l) {
|
|
143
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
144
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
145
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
146
|
+
try {
|
|
147
|
+
if (f = 2, i) {
|
|
148
|
+
if (c || (o = "next"), t = i[o]) {
|
|
149
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
150
|
+
if (!t.done) return t;
|
|
151
|
+
u = t.value, c < 2 && (c = 0);
|
|
152
|
+
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
153
|
+
i = e;
|
|
154
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
155
|
+
} catch (t) {
|
|
156
|
+
i = e, c = 1, u = t;
|
|
157
|
+
} finally {
|
|
158
|
+
f = 1;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
value: t,
|
|
163
|
+
done: y
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
}(r, o, i), !0), u;
|
|
167
|
+
}
|
|
168
|
+
var a = {};
|
|
169
|
+
function Generator() {}
|
|
170
|
+
function GeneratorFunction() {}
|
|
171
|
+
function GeneratorFunctionPrototype() {}
|
|
172
|
+
t = Object.getPrototypeOf;
|
|
173
|
+
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
|
|
174
|
+
return this;
|
|
175
|
+
}), t),
|
|
176
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
177
|
+
function f(e) {
|
|
178
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
179
|
+
}
|
|
180
|
+
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 () {
|
|
181
|
+
return this;
|
|
182
|
+
}), regeneratorDefine(u, "toString", function () {
|
|
183
|
+
return "[object Generator]";
|
|
184
|
+
}), (module.exports = _regenerator = function _regenerator() {
|
|
185
|
+
return {
|
|
186
|
+
w: i,
|
|
187
|
+
m: f
|
|
188
|
+
};
|
|
189
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
190
|
+
}
|
|
191
|
+
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
192
|
+
} (regenerator$3));
|
|
202
193
|
|
|
203
|
-
var
|
|
194
|
+
var regeneratorExports$1 = regenerator$3.exports;
|
|
204
195
|
|
|
205
|
-
var
|
|
196
|
+
var regeneratorAsync$1 = {exports: {}};
|
|
206
197
|
|
|
207
|
-
var
|
|
198
|
+
var regeneratorAsyncGen$1 = {exports: {}};
|
|
199
|
+
|
|
200
|
+
var regeneratorAsyncIterator$1 = {exports: {}};
|
|
208
201
|
|
|
209
202
|
(function (module) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
203
|
+
var OverloadYield = OverloadYieldExports$1;
|
|
204
|
+
var regeneratorDefine = regeneratorDefineExports$1;
|
|
205
|
+
function AsyncIterator(t, e) {
|
|
206
|
+
function n(r, o, i, f) {
|
|
207
|
+
try {
|
|
208
|
+
var c = t[r](o),
|
|
209
|
+
u = c.value;
|
|
210
|
+
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
211
|
+
n("next", t, i, f);
|
|
212
|
+
}, function (t) {
|
|
213
|
+
n("throw", t, i, f);
|
|
214
|
+
}) : e.resolve(u).then(function (t) {
|
|
215
|
+
c.value = t, i(c);
|
|
216
|
+
}, function (t) {
|
|
217
|
+
return n("throw", t, i, f);
|
|
218
|
+
});
|
|
219
|
+
} catch (t) {
|
|
220
|
+
f(t);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
var r;
|
|
224
|
+
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
225
|
+
return this;
|
|
226
|
+
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
227
|
+
function f() {
|
|
228
|
+
return new e(function (e, r) {
|
|
229
|
+
n(t, i, e, r);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return r = r ? r.then(f, f) : f();
|
|
233
|
+
}, !0);
|
|
234
|
+
}
|
|
235
|
+
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
236
|
+
} (regeneratorAsyncIterator$1));
|
|
237
|
+
|
|
238
|
+
var regeneratorAsyncIteratorExports$1 = regeneratorAsyncIterator$1.exports;
|
|
245
239
|
|
|
246
240
|
(function (module) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
241
|
+
var regenerator = regeneratorExports$1;
|
|
242
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports$1;
|
|
243
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
244
|
+
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
|
|
245
|
+
}
|
|
246
|
+
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
247
|
+
} (regeneratorAsyncGen$1));
|
|
248
|
+
|
|
249
|
+
var regeneratorAsyncGenExports$1 = regeneratorAsyncGen$1.exports;
|
|
255
250
|
|
|
256
251
|
(function (module) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
var regeneratorAsyncExports = regeneratorAsync.exports;
|
|
252
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports$1;
|
|
253
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
254
|
+
var a = regeneratorAsyncGen(n, e, r, t, o);
|
|
255
|
+
return a.next().then(function (n) {
|
|
256
|
+
return n.done ? n.value : a.next();
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
260
|
+
} (regeneratorAsync$1));
|
|
267
261
|
|
|
268
|
-
var
|
|
262
|
+
var regeneratorAsyncExports$1 = regeneratorAsync$1.exports;
|
|
263
|
+
|
|
264
|
+
var regeneratorKeys$1 = {exports: {}};
|
|
269
265
|
|
|
270
266
|
(function (module) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
var regeneratorKeysExports = regeneratorKeys.exports;
|
|
267
|
+
function _regeneratorKeys(e) {
|
|
268
|
+
var n = Object(e),
|
|
269
|
+
r = [];
|
|
270
|
+
for (var t in n) r.unshift(t);
|
|
271
|
+
return function e() {
|
|
272
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
273
|
+
return e.done = !0, e;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
277
|
+
} (regeneratorKeys$1));
|
|
283
278
|
|
|
284
|
-
var
|
|
279
|
+
var regeneratorKeysExports$1 = regeneratorKeys$1.exports;
|
|
285
280
|
|
|
286
|
-
var
|
|
281
|
+
var regeneratorValues$1 = {exports: {}};
|
|
282
|
+
|
|
283
|
+
var _typeof$3 = {exports: {}};
|
|
287
284
|
|
|
288
285
|
(function (module) {
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
function _typeof(o) {
|
|
287
|
+
"@babel/helpers - typeof";
|
|
291
288
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
289
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
290
|
+
return typeof o;
|
|
291
|
+
} : function (o) {
|
|
292
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
293
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
294
|
+
}
|
|
295
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
296
|
+
} (_typeof$3));
|
|
297
|
+
|
|
298
|
+
var _typeofExports$1 = _typeof$3.exports;
|
|
301
299
|
|
|
302
300
|
(function (module) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
301
|
+
var _typeof = _typeofExports$1["default"];
|
|
302
|
+
function _regeneratorValues(e) {
|
|
303
|
+
if (null != e) {
|
|
304
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
305
|
+
r = 0;
|
|
306
|
+
if (t) return t.call(e);
|
|
307
|
+
if ("function" == typeof e.next) return e;
|
|
308
|
+
if (!isNaN(e.length)) return {
|
|
309
|
+
next: function next() {
|
|
310
|
+
return e && r >= e.length && (e = void 0), {
|
|
311
|
+
value: e && e[r++],
|
|
312
|
+
done: !e
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
318
|
+
}
|
|
319
|
+
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
320
|
+
} (regeneratorValues$1));
|
|
321
|
+
|
|
322
|
+
var regeneratorValuesExports$1 = regeneratorValues$1.exports;
|
|
324
323
|
|
|
325
324
|
(function (module) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
325
|
+
var OverloadYield = OverloadYieldExports$1;
|
|
326
|
+
var regenerator = regeneratorExports$1;
|
|
327
|
+
var regeneratorAsync = regeneratorAsyncExports$1;
|
|
328
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports$1;
|
|
329
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports$1;
|
|
330
|
+
var regeneratorKeys = regeneratorKeysExports$1;
|
|
331
|
+
var regeneratorValues = regeneratorValuesExports$1;
|
|
332
|
+
function _regeneratorRuntime() {
|
|
334
333
|
|
|
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
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
334
|
+
var r = regenerator(),
|
|
335
|
+
e = r.m(_regeneratorRuntime),
|
|
336
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
337
|
+
function n(r) {
|
|
338
|
+
var e = "function" == typeof r && r.constructor;
|
|
339
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
340
|
+
}
|
|
341
|
+
var o = {
|
|
342
|
+
"throw": 1,
|
|
343
|
+
"return": 2,
|
|
344
|
+
"break": 3,
|
|
345
|
+
"continue": 3
|
|
346
|
+
};
|
|
347
|
+
function a(r) {
|
|
348
|
+
var e, t;
|
|
349
|
+
return function (n) {
|
|
350
|
+
e || (e = {
|
|
351
|
+
stop: function stop() {
|
|
352
|
+
return t(n.a, 2);
|
|
353
|
+
},
|
|
354
|
+
"catch": function _catch() {
|
|
355
|
+
return n.v;
|
|
356
|
+
},
|
|
357
|
+
abrupt: function abrupt(r, e) {
|
|
358
|
+
return t(n.a, o[r], e);
|
|
359
|
+
},
|
|
360
|
+
delegateYield: function delegateYield(r, o, a) {
|
|
361
|
+
return e.resultName = o, t(n.d, regeneratorValues(r), a);
|
|
362
|
+
},
|
|
363
|
+
finish: function finish(r) {
|
|
364
|
+
return t(n.f, r);
|
|
365
|
+
}
|
|
366
|
+
}, t = function t(r, _t, o) {
|
|
367
|
+
n.p = e.prev, n.n = e.next;
|
|
368
|
+
try {
|
|
369
|
+
return r(_t, o);
|
|
370
|
+
} finally {
|
|
371
|
+
e.next = n.n;
|
|
372
|
+
}
|
|
373
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
374
|
+
try {
|
|
375
|
+
return r.call(this, e);
|
|
376
|
+
} finally {
|
|
377
|
+
n.p = e.prev, n.n = e.next;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
382
|
+
return {
|
|
383
|
+
wrap: function wrap(e, t, n, o) {
|
|
384
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
385
|
+
},
|
|
386
|
+
isGeneratorFunction: n,
|
|
387
|
+
mark: r.m,
|
|
388
|
+
awrap: function awrap(r, e) {
|
|
389
|
+
return new OverloadYield(r, e);
|
|
390
|
+
},
|
|
391
|
+
AsyncIterator: regeneratorAsyncIterator,
|
|
392
|
+
async: function async(r, e, t, o, u) {
|
|
393
|
+
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
|
|
394
|
+
},
|
|
395
|
+
keys: regeneratorKeys,
|
|
396
|
+
values: regeneratorValues
|
|
397
|
+
};
|
|
398
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
399
|
+
}
|
|
400
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
401
|
+
} (regeneratorRuntime$2));
|
|
402
|
+
|
|
403
|
+
var regeneratorRuntimeExports$1 = regeneratorRuntime$2.exports;
|
|
404
404
|
|
|
405
405
|
// TODO(Babel 8): Remove this file.
|
|
406
406
|
|
|
407
|
-
var runtime = regeneratorRuntimeExports();
|
|
408
|
-
var regenerator = runtime;
|
|
407
|
+
var runtime$1 = regeneratorRuntimeExports$1();
|
|
408
|
+
var regenerator$2 = runtime$1;
|
|
409
409
|
|
|
410
410
|
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
411
411
|
try {
|
|
412
|
-
regeneratorRuntime = runtime;
|
|
412
|
+
regeneratorRuntime = runtime$1;
|
|
413
413
|
} catch (accidentalStrictMode) {
|
|
414
|
-
if (
|
|
415
|
-
globalThis.regeneratorRuntime = runtime;
|
|
414
|
+
if (typeof globalThis === "object") {
|
|
415
|
+
globalThis.regeneratorRuntime = runtime$1;
|
|
416
416
|
} else {
|
|
417
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
417
|
+
Function("r", "regeneratorRuntime = r")(runtime$1);
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
|
|
420
|
+
|
|
421
|
+
var _regeneratorRuntime$1 = /*@__PURE__*/getDefaultExportFromCjs(regenerator$2);
|
|
421
422
|
|
|
422
423
|
var supabaseInstance = null;
|
|
423
424
|
/**
|
|
@@ -457,9 +458,9 @@ function testConnection() {
|
|
|
457
458
|
* 通过直接创建表和函数来避免手动执行 SQL 文件
|
|
458
459
|
*/
|
|
459
460
|
function _testConnection() {
|
|
460
|
-
_testConnection = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
461
|
+
_testConnection = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
|
461
462
|
var supabase, _yield$supabase$from$, error, _t;
|
|
462
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
463
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
463
464
|
while (1) switch (_context.prev = _context.next) {
|
|
464
465
|
case 0:
|
|
465
466
|
_context.prev = 0;
|
|
@@ -498,9 +499,9 @@ function executeSupabaseSetup() {
|
|
|
498
499
|
* 初始化CMS系统表
|
|
499
500
|
*/
|
|
500
501
|
function _executeSupabaseSetup() {
|
|
501
|
-
_executeSupabaseSetup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
502
|
+
_executeSupabaseSetup = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2() {
|
|
502
503
|
var supabase, createTableSQL, _yield$supabase$from$2, tableError, fullSetupSQL, functionsToCheck, missingFunctions, _i, _functionsToCheck, funcName, _t3;
|
|
503
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
504
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
504
505
|
while (1) switch (_context2.prev = _context2.next) {
|
|
505
506
|
case 0:
|
|
506
507
|
_context2.prev = 0;
|
|
@@ -630,9 +631,9 @@ function initializeCmsSystem() {
|
|
|
630
631
|
* 关闭Supabase连接(实际上Supabase客户端不需要显式关闭)
|
|
631
632
|
*/
|
|
632
633
|
function _initializeCmsSystem() {
|
|
633
|
-
_initializeCmsSystem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
634
|
+
_initializeCmsSystem = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3() {
|
|
634
635
|
var setupSuccess, supabase, _yield$supabase$rpc, error, _t4;
|
|
635
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
636
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
636
637
|
while (1) switch (_context3.prev = _context3.next) {
|
|
637
638
|
case 0:
|
|
638
639
|
_context3.prev = 0;
|
|
@@ -679,8 +680,8 @@ function closeSupabase() {
|
|
|
679
680
|
* 用户可以复制此脚本到 Supabase SQL 编辑器中执行
|
|
680
681
|
*/
|
|
681
682
|
function _closeSupabase() {
|
|
682
|
-
_closeSupabase = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
683
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
683
|
+
_closeSupabase = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4() {
|
|
684
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
684
685
|
while (1) switch (_context4.prev = _context4.next) {
|
|
685
686
|
case 0:
|
|
686
687
|
supabaseInstance = null;
|
|
@@ -700,34 +701,44 @@ var feishuAlertConfig = {
|
|
|
700
701
|
crudErrorWebhookUrls: ["https://open.feishu.cn/open-apis/bot/v2/hook/784e9470-c1fd-4e38-97a2-b9a1856c00b1"]
|
|
701
702
|
};
|
|
702
703
|
|
|
703
|
-
function _classCallCheck(a, n) {
|
|
704
|
+
function _classCallCheck$1(a, n) {
|
|
704
705
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
705
706
|
}
|
|
706
707
|
|
|
707
|
-
function
|
|
708
|
-
|
|
708
|
+
function _typeof$2(o) {
|
|
709
|
+
"@babel/helpers - typeof";
|
|
710
|
+
|
|
711
|
+
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
712
|
+
return typeof o;
|
|
713
|
+
} : function (o) {
|
|
714
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
715
|
+
}, _typeof$2(o);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
function toPrimitive$1(t, r) {
|
|
719
|
+
if ("object" != _typeof$2(t) || !t) return t;
|
|
709
720
|
var e = t[Symbol.toPrimitive];
|
|
710
721
|
if (void 0 !== e) {
|
|
711
722
|
var i = e.call(t, r || "default");
|
|
712
|
-
if ("object" != _typeof$
|
|
723
|
+
if ("object" != _typeof$2(i)) return i;
|
|
713
724
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
714
725
|
}
|
|
715
726
|
return ("string" === r ? String : Number)(t);
|
|
716
727
|
}
|
|
717
728
|
|
|
718
|
-
function toPropertyKey(t) {
|
|
719
|
-
var i = toPrimitive(t, "string");
|
|
720
|
-
return "symbol" == _typeof$
|
|
729
|
+
function toPropertyKey$1(t) {
|
|
730
|
+
var i = toPrimitive$1(t, "string");
|
|
731
|
+
return "symbol" == _typeof$2(i) ? i : i + "";
|
|
721
732
|
}
|
|
722
733
|
|
|
723
|
-
function _defineProperties(e, r) {
|
|
734
|
+
function _defineProperties$1(e, r) {
|
|
724
735
|
for (var t = 0; t < r.length; t++) {
|
|
725
736
|
var o = r[t];
|
|
726
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
737
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$1(o.key), o);
|
|
727
738
|
}
|
|
728
739
|
}
|
|
729
|
-
function _createClass(e, r, t) {
|
|
730
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
740
|
+
function _createClass$1(e, r, t) {
|
|
741
|
+
return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", {
|
|
731
742
|
writable: !1
|
|
732
743
|
}), e;
|
|
733
744
|
}
|
|
@@ -735,19 +746,19 @@ function _createClass(e, r, t) {
|
|
|
735
746
|
// CMS 模型服务类
|
|
736
747
|
var CmsModelService = /*#__PURE__*/function () {
|
|
737
748
|
function CmsModelService() {
|
|
738
|
-
_classCallCheck(this, CmsModelService);
|
|
749
|
+
_classCallCheck$1(this, CmsModelService);
|
|
739
750
|
this.tableName = "_cms_models";
|
|
740
751
|
this.supabase = getSupabase();
|
|
741
752
|
}
|
|
742
753
|
/**
|
|
743
754
|
* 创建新的CMS模型
|
|
744
755
|
*/
|
|
745
|
-
return _createClass(CmsModelService, [{
|
|
756
|
+
return _createClass$1(CmsModelService, [{
|
|
746
757
|
key: "create",
|
|
747
758
|
value: (function () {
|
|
748
|
-
var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
|
759
|
+
var _create = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(data) {
|
|
749
760
|
var _yield$this$supabase$, result, error;
|
|
750
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
761
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
751
762
|
while (1) switch (_context.prev = _context.next) {
|
|
752
763
|
case 0:
|
|
753
764
|
_context.next = 1;
|
|
@@ -781,9 +792,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
781
792
|
}, {
|
|
782
793
|
key: "findById",
|
|
783
794
|
value: (function () {
|
|
784
|
-
var _findById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
|
795
|
+
var _findById = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(id) {
|
|
785
796
|
var _yield$this$supabase$2, data, error;
|
|
786
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
797
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
787
798
|
while (1) switch (_context2.prev = _context2.next) {
|
|
788
799
|
case 0:
|
|
789
800
|
_context2.next = 1;
|
|
@@ -823,9 +834,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
823
834
|
}, {
|
|
824
835
|
key: "findByTableName",
|
|
825
836
|
value: (function () {
|
|
826
|
-
var _findByTableName = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tableName) {
|
|
837
|
+
var _findByTableName = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(tableName) {
|
|
827
838
|
var _yield$this$supabase$3, data, error;
|
|
828
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
839
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
829
840
|
while (1) switch (_context3.prev = _context3.next) {
|
|
830
841
|
case 0:
|
|
831
842
|
_context3.next = 1;
|
|
@@ -865,9 +876,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
865
876
|
}, {
|
|
866
877
|
key: "findAll",
|
|
867
878
|
value: (function () {
|
|
868
|
-
var _findAll = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
879
|
+
var _findAll = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4() {
|
|
869
880
|
var _yield$this$supabase$4, data, error;
|
|
870
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
881
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
871
882
|
while (1) switch (_context4.prev = _context4.next) {
|
|
872
883
|
case 0:
|
|
873
884
|
_context4.next = 1;
|
|
@@ -903,9 +914,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
903
914
|
}, {
|
|
904
915
|
key: "update",
|
|
905
916
|
value: (function () {
|
|
906
|
-
var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, data) {
|
|
917
|
+
var _update = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(id, data) {
|
|
907
918
|
var _yield$this$supabase$5, result, error;
|
|
908
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
919
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
909
920
|
while (1) switch (_context5.prev = _context5.next) {
|
|
910
921
|
case 0:
|
|
911
922
|
_context5.next = 1;
|
|
@@ -939,9 +950,9 @@ var CmsModelService = /*#__PURE__*/function () {
|
|
|
939
950
|
}, {
|
|
940
951
|
key: "delete",
|
|
941
952
|
value: (function () {
|
|
942
|
-
var _delete2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
|
|
953
|
+
var _delete2 = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(id) {
|
|
943
954
|
var _yield$this$supabase$6, error;
|
|
944
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
955
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
945
956
|
while (1) switch (_context6.prev = _context6.next) {
|
|
946
957
|
case 0:
|
|
947
958
|
_context6.next = 1;
|
|
@@ -987,9 +998,9 @@ function initializeCmsModel() {
|
|
|
987
998
|
}
|
|
988
999
|
// 为了向后兼容,导出服务类作为默认导出
|
|
989
1000
|
function _initializeCmsModel() {
|
|
990
|
-
_initializeCmsModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
1001
|
+
_initializeCmsModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7() {
|
|
991
1002
|
var supabase, createTableSQL, _yield$supabase$rpc, error, _t;
|
|
992
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
1003
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
993
1004
|
while (1) switch (_context7.prev = _context7.next) {
|
|
994
1005
|
case 0:
|
|
995
1006
|
_context7.prev = 0;
|
|
@@ -1025,8 +1036,8 @@ function _initializeCmsModel() {
|
|
|
1025
1036
|
return _initializeCmsModel.apply(this, arguments);
|
|
1026
1037
|
}
|
|
1027
1038
|
|
|
1028
|
-
function _defineProperty(e, r, t) {
|
|
1029
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1039
|
+
function _defineProperty$1(e, r, t) {
|
|
1040
|
+
return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
1030
1041
|
value: t,
|
|
1031
1042
|
enumerable: !0,
|
|
1032
1043
|
configurable: !0,
|
|
@@ -1034,11 +1045,11 @@ function _defineProperty(e, r, t) {
|
|
|
1034
1045
|
}) : e[r] = t, e;
|
|
1035
1046
|
}
|
|
1036
1047
|
|
|
1037
|
-
function ownKeys$
|
|
1038
|
-
function _objectSpread$
|
|
1039
|
-
function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$
|
|
1040
|
-
function _unsupportedIterableToArray$
|
|
1041
|
-
function _arrayLikeToArray$
|
|
1048
|
+
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; }
|
|
1049
|
+
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; }
|
|
1050
|
+
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; } } }; }
|
|
1051
|
+
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; } }
|
|
1052
|
+
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; }
|
|
1042
1053
|
// 字段类型映射到PostgreSQL类型
|
|
1043
1054
|
var fieldTypeMapping = {
|
|
1044
1055
|
string: "text",
|
|
@@ -1056,20 +1067,20 @@ var fieldTypeMapping = {
|
|
|
1056
1067
|
};
|
|
1057
1068
|
var DynamicTableService = /*#__PURE__*/function () {
|
|
1058
1069
|
function DynamicTableService() {
|
|
1059
|
-
_classCallCheck(this, DynamicTableService);
|
|
1070
|
+
_classCallCheck$1(this, DynamicTableService);
|
|
1060
1071
|
this.supabase = getSupabase();
|
|
1061
1072
|
}
|
|
1062
1073
|
/**
|
|
1063
1074
|
* 默认按 created_at 倒序(新数据在前)。
|
|
1064
1075
|
* 兼容:如果表不存在 created_at 字段,则回退按 id 倒序。
|
|
1065
1076
|
*/
|
|
1066
|
-
return _createClass(DynamicTableService, [{
|
|
1077
|
+
return _createClass$1(DynamicTableService, [{
|
|
1067
1078
|
key: "orderByCreatedAtOrFallback",
|
|
1068
1079
|
value: (function () {
|
|
1069
|
-
var _orderByCreatedAtOrFallback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(buildQuery, offset, limit) {
|
|
1080
|
+
var _orderByCreatedAtOrFallback = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(buildQuery, offset, limit) {
|
|
1070
1081
|
var _first$error;
|
|
1071
1082
|
var first, msg, isMissingCreatedAt, second;
|
|
1072
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
1083
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
1073
1084
|
while (1) switch (_context.prev = _context.next) {
|
|
1074
1085
|
case 0:
|
|
1075
1086
|
_context.next = 1;
|
|
@@ -1200,9 +1211,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1200
1211
|
}, {
|
|
1201
1212
|
key: "createTable",
|
|
1202
1213
|
value: (function () {
|
|
1203
|
-
var _createTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(tableName, schema, baseTableName) {
|
|
1214
|
+
var _createTable = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(tableName, schema, baseTableName) {
|
|
1204
1215
|
var tablePrefix, createTableSQL, foreignKeys, _yield$this$supabase$, error, _t;
|
|
1205
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
1216
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
1206
1217
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1207
1218
|
case 0:
|
|
1208
1219
|
_context2.prev = 0;
|
|
@@ -1296,9 +1307,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1296
1307
|
}, {
|
|
1297
1308
|
key: "dropTable",
|
|
1298
1309
|
value: (function () {
|
|
1299
|
-
var _dropTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tableName) {
|
|
1310
|
+
var _dropTable = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(tableName) {
|
|
1300
1311
|
var _yield$this$supabase$2, error, _t2;
|
|
1301
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
1312
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
1302
1313
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1303
1314
|
case 0:
|
|
1304
1315
|
_context3.prev = 0;
|
|
@@ -1341,9 +1352,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1341
1352
|
}, {
|
|
1342
1353
|
key: "dropAllForeignKeys",
|
|
1343
1354
|
value: (function () {
|
|
1344
|
-
var _dropAllForeignKeys = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(tableName) {
|
|
1355
|
+
var _dropAllForeignKeys = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(tableName) {
|
|
1345
1356
|
var parts, baseTableName, dropFKSQL, _yield$this$supabase$3, error, _t3;
|
|
1346
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
1357
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
1347
1358
|
while (1) switch (_context4.prev = _context4.next) {
|
|
1348
1359
|
case 0:
|
|
1349
1360
|
_context4.prev = 0;
|
|
@@ -1393,9 +1404,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1393
1404
|
}, {
|
|
1394
1405
|
key: "dropForeignKeyByName",
|
|
1395
1406
|
value: (function () {
|
|
1396
|
-
var _dropForeignKeyByName = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(tableName, constraintName) {
|
|
1407
|
+
var _dropForeignKeyByName = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(tableName, constraintName) {
|
|
1397
1408
|
var dropSQL, _yield$this$supabase$4, error, _t4;
|
|
1398
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
1409
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
1399
1410
|
while (1) switch (_context5.prev = _context5.next) {
|
|
1400
1411
|
case 0:
|
|
1401
1412
|
_context5.prev = 0;
|
|
@@ -1439,9 +1450,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1439
1450
|
}, {
|
|
1440
1451
|
key: "dropForeignKey",
|
|
1441
1452
|
value: (function () {
|
|
1442
|
-
var _dropForeignKey = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(tableName, constraintName) {
|
|
1453
|
+
var _dropForeignKey = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(tableName, constraintName) {
|
|
1443
1454
|
var _yield$this$supabase$5, error, _t5;
|
|
1444
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
1455
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
1445
1456
|
while (1) switch (_context6.prev = _context6.next) {
|
|
1446
1457
|
case 0:
|
|
1447
1458
|
_context6.prev = 0;
|
|
@@ -1483,9 +1494,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1483
1494
|
}, {
|
|
1484
1495
|
key: "tableExists",
|
|
1485
1496
|
value: (function () {
|
|
1486
|
-
var _tableExists = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(tableName) {
|
|
1497
|
+
var _tableExists = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(tableName) {
|
|
1487
1498
|
var _yield$this$supabase$6, data, error, _t6;
|
|
1488
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
1499
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
1489
1500
|
while (1) switch (_context7.prev = _context7.next) {
|
|
1490
1501
|
case 0:
|
|
1491
1502
|
_context7.prev = 0;
|
|
@@ -1527,9 +1538,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1527
1538
|
}, {
|
|
1528
1539
|
key: "getTableStructure",
|
|
1529
1540
|
value: (function () {
|
|
1530
|
-
var _getTableStructure = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(tableName) {
|
|
1541
|
+
var _getTableStructure = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee8(tableName) {
|
|
1531
1542
|
var _yield$this$supabase$7, data, error, _t7;
|
|
1532
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
1543
|
+
return _regeneratorRuntime$1.wrap(function (_context8) {
|
|
1533
1544
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1534
1545
|
case 0:
|
|
1535
1546
|
_context8.prev = 0;
|
|
@@ -1571,9 +1582,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1571
1582
|
}, {
|
|
1572
1583
|
key: "executeQuery",
|
|
1573
1584
|
value: (function () {
|
|
1574
|
-
var _executeQuery = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(sql, values) {
|
|
1585
|
+
var _executeQuery = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee9(sql, values) {
|
|
1575
1586
|
var finalSql, _yield$this$supabase$8, data, error, _t8;
|
|
1576
|
-
return _regeneratorRuntime.wrap(function (_context9) {
|
|
1587
|
+
return _regeneratorRuntime$1.wrap(function (_context9) {
|
|
1577
1588
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1578
1589
|
case 0:
|
|
1579
1590
|
_context9.prev = 0;
|
|
@@ -1624,7 +1635,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1624
1635
|
}, {
|
|
1625
1636
|
key: "getTableData",
|
|
1626
1637
|
value: (function () {
|
|
1627
|
-
var _getTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(tableName) {
|
|
1638
|
+
var _getTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee0(tableName) {
|
|
1628
1639
|
var _this = this;
|
|
1629
1640
|
var page,
|
|
1630
1641
|
limit,
|
|
@@ -1637,7 +1648,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1637
1648
|
count,
|
|
1638
1649
|
_args0 = arguments,
|
|
1639
1650
|
_t9;
|
|
1640
|
-
return _regeneratorRuntime.wrap(function (_context0) {
|
|
1651
|
+
return _regeneratorRuntime$1.wrap(function (_context0) {
|
|
1641
1652
|
while (1) switch (_context0.prev = _context0.next) {
|
|
1642
1653
|
case 0:
|
|
1643
1654
|
page = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 1;
|
|
@@ -1696,7 +1707,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1696
1707
|
}, {
|
|
1697
1708
|
key: "getTableDataWithSearch",
|
|
1698
1709
|
value: (function () {
|
|
1699
|
-
var _getTableDataWithSearch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(tableName) {
|
|
1710
|
+
var _getTableDataWithSearch = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee1(tableName) {
|
|
1700
1711
|
var _this2 = this;
|
|
1701
1712
|
var page,
|
|
1702
1713
|
limit,
|
|
@@ -1710,7 +1721,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1710
1721
|
count,
|
|
1711
1722
|
_args1 = arguments,
|
|
1712
1723
|
_t0;
|
|
1713
|
-
return _regeneratorRuntime.wrap(function (_context1) {
|
|
1724
|
+
return _regeneratorRuntime$1.wrap(function (_context1) {
|
|
1714
1725
|
while (1) switch (_context1.prev = _context1.next) {
|
|
1715
1726
|
case 0:
|
|
1716
1727
|
page = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : 1;
|
|
@@ -1772,7 +1783,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1772
1783
|
}, {
|
|
1773
1784
|
key: "insertData",
|
|
1774
1785
|
value: (function () {
|
|
1775
|
-
var _insertData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(tableName, data) {
|
|
1786
|
+
var _insertData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee10(tableName, data) {
|
|
1776
1787
|
var autoFixForeignKey,
|
|
1777
1788
|
_yield$this$supabase$9,
|
|
1778
1789
|
result,
|
|
@@ -1784,7 +1795,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1784
1795
|
_dropResult,
|
|
1785
1796
|
_args10 = arguments,
|
|
1786
1797
|
_t1;
|
|
1787
|
-
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1798
|
+
return _regeneratorRuntime$1.wrap(function (_context10) {
|
|
1788
1799
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1789
1800
|
case 0:
|
|
1790
1801
|
autoFixForeignKey = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : true;
|
|
@@ -1874,7 +1885,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1874
1885
|
}, {
|
|
1875
1886
|
key: "updateData",
|
|
1876
1887
|
value: (function () {
|
|
1877
|
-
var _updateData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(tableName, id, data) {
|
|
1888
|
+
var _updateData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11(tableName, id, data) {
|
|
1878
1889
|
var autoFixForeignKey,
|
|
1879
1890
|
_yield$this$supabase$0,
|
|
1880
1891
|
result,
|
|
@@ -1886,7 +1897,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1886
1897
|
_dropResult2,
|
|
1887
1898
|
_args11 = arguments,
|
|
1888
1899
|
_t10;
|
|
1889
|
-
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1900
|
+
return _regeneratorRuntime$1.wrap(function (_context11) {
|
|
1890
1901
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1891
1902
|
case 0:
|
|
1892
1903
|
autoFixForeignKey = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : true;
|
|
@@ -1974,9 +1985,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
1974
1985
|
}, {
|
|
1975
1986
|
key: "deleteData",
|
|
1976
1987
|
value: (function () {
|
|
1977
|
-
var _deleteData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(tableName, id) {
|
|
1988
|
+
var _deleteData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee12(tableName, id) {
|
|
1978
1989
|
var _yield$this$supabase$1, result, error, _t11;
|
|
1979
|
-
return _regeneratorRuntime.wrap(function (_context12) {
|
|
1990
|
+
return _regeneratorRuntime$1.wrap(function (_context12) {
|
|
1980
1991
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1981
1992
|
case 0:
|
|
1982
1993
|
_context12.prev = 0;
|
|
@@ -2017,9 +2028,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2017
2028
|
}, {
|
|
2018
2029
|
key: "getDataById",
|
|
2019
2030
|
value: (function () {
|
|
2020
|
-
var _getDataById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(tableName, id) {
|
|
2031
|
+
var _getDataById = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee13(tableName, id) {
|
|
2021
2032
|
var _yield$this$supabase$10, data, error, _t12;
|
|
2022
|
-
return _regeneratorRuntime.wrap(function (_context13) {
|
|
2033
|
+
return _regeneratorRuntime$1.wrap(function (_context13) {
|
|
2023
2034
|
while (1) switch (_context13.prev = _context13.next) {
|
|
2024
2035
|
case 0:
|
|
2025
2036
|
_context13.prev = 0;
|
|
@@ -2067,9 +2078,9 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2067
2078
|
}, {
|
|
2068
2079
|
key: "getRelationOptions",
|
|
2069
2080
|
value: (function () {
|
|
2070
|
-
var _getRelationOptions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(params) {
|
|
2081
|
+
var _getRelationOptions = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee14(params) {
|
|
2071
2082
|
var tableName, _params$displayField, displayField, _params$limit, limit, search, query, _yield$query, data, error, _t13;
|
|
2072
|
-
return _regeneratorRuntime.wrap(function (_context14) {
|
|
2083
|
+
return _regeneratorRuntime$1.wrap(function (_context14) {
|
|
2073
2084
|
while (1) switch (_context14.prev = _context14.next) {
|
|
2074
2085
|
case 0:
|
|
2075
2086
|
_context14.prev = 0;
|
|
@@ -2091,7 +2102,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2091
2102
|
throw error;
|
|
2092
2103
|
case 2:
|
|
2093
2104
|
return _context14.abrupt("return", (data || []).map(function (item) {
|
|
2094
|
-
return _objectSpread$
|
|
2105
|
+
return _objectSpread$4({
|
|
2095
2106
|
id: item.id,
|
|
2096
2107
|
label: item[displayField] || "ID: ".concat(item.id)
|
|
2097
2108
|
}, item);
|
|
@@ -2124,7 +2135,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2124
2135
|
}, {
|
|
2125
2136
|
key: "getTableDataWithRelations",
|
|
2126
2137
|
value: (function () {
|
|
2127
|
-
var _getTableDataWithRelations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(tableName, schema) {
|
|
2138
|
+
var _getTableDataWithRelations = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee15(tableName, schema) {
|
|
2128
2139
|
var _this3 = this;
|
|
2129
2140
|
var page,
|
|
2130
2141
|
limit,
|
|
@@ -2138,7 +2149,7 @@ var DynamicTableService = /*#__PURE__*/function () {
|
|
|
2138
2149
|
count,
|
|
2139
2150
|
_args15 = arguments,
|
|
2140
2151
|
_t14;
|
|
2141
|
-
return _regeneratorRuntime.wrap(function (_context15) {
|
|
2152
|
+
return _regeneratorRuntime$1.wrap(function (_context15) {
|
|
2142
2153
|
while (1) switch (_context15.prev = _context15.next) {
|
|
2143
2154
|
case 0:
|
|
2144
2155
|
page = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : 1;
|
|
@@ -2204,28 +2215,28 @@ function getDynamicTableService() {
|
|
|
2204
2215
|
return defaultService$1;
|
|
2205
2216
|
}
|
|
2206
2217
|
|
|
2207
|
-
function ownKeys$
|
|
2208
|
-
function _objectSpread$
|
|
2218
|
+
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; }
|
|
2219
|
+
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$1(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; }
|
|
2209
2220
|
var AuthService = /*#__PURE__*/function () {
|
|
2210
2221
|
function AuthService() {
|
|
2211
|
-
_classCallCheck(this, AuthService);
|
|
2222
|
+
_classCallCheck$1(this, AuthService);
|
|
2212
2223
|
this.supabase = getSupabase();
|
|
2213
2224
|
this.defaultTableName = 'cms_users';
|
|
2214
2225
|
}
|
|
2215
2226
|
/**
|
|
2216
2227
|
* 根据用户名查询用户
|
|
2217
2228
|
*/
|
|
2218
|
-
return _createClass(AuthService, [{
|
|
2229
|
+
return _createClass$1(AuthService, [{
|
|
2219
2230
|
key: "findUserByUsername",
|
|
2220
2231
|
value: (function () {
|
|
2221
|
-
var _findUserByUsername = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(username) {
|
|
2232
|
+
var _findUserByUsername = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(username) {
|
|
2222
2233
|
var tableName,
|
|
2223
2234
|
_yield$this$supabase$,
|
|
2224
2235
|
users,
|
|
2225
2236
|
error,
|
|
2226
2237
|
_args = arguments,
|
|
2227
2238
|
_t;
|
|
2228
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
2239
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
2229
2240
|
while (1) switch (_context.prev = _context.next) {
|
|
2230
2241
|
case 0:
|
|
2231
2242
|
tableName = _args.length > 1 && _args[1] !== undefined ? _args[1] : this.defaultTableName;
|
|
@@ -2273,14 +2284,14 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2273
2284
|
}, {
|
|
2274
2285
|
key: "findUserById",
|
|
2275
2286
|
value: (function () {
|
|
2276
|
-
var _findUserById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(userId) {
|
|
2287
|
+
var _findUserById = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(userId) {
|
|
2277
2288
|
var tableName,
|
|
2278
2289
|
_yield$this$supabase$2,
|
|
2279
2290
|
users,
|
|
2280
2291
|
error,
|
|
2281
2292
|
_args2 = arguments,
|
|
2282
2293
|
_t2;
|
|
2283
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
2294
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
2284
2295
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2285
2296
|
case 0:
|
|
2286
2297
|
tableName = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : this.defaultTableName;
|
|
@@ -2328,14 +2339,14 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2328
2339
|
}, {
|
|
2329
2340
|
key: "checkUsernameExists",
|
|
2330
2341
|
value: (function () {
|
|
2331
|
-
var _checkUsernameExists = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(username) {
|
|
2342
|
+
var _checkUsernameExists = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(username) {
|
|
2332
2343
|
var tableName,
|
|
2333
2344
|
_yield$this$supabase$3,
|
|
2334
2345
|
users,
|
|
2335
2346
|
error,
|
|
2336
2347
|
_args3 = arguments,
|
|
2337
2348
|
_t3;
|
|
2338
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
2349
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
2339
2350
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2340
2351
|
case 0:
|
|
2341
2352
|
tableName = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : this.defaultTableName;
|
|
@@ -2377,12 +2388,12 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2377
2388
|
}, {
|
|
2378
2389
|
key: "createUser",
|
|
2379
2390
|
value: (function () {
|
|
2380
|
-
var _createUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(userData) {
|
|
2391
|
+
var _createUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(userData) {
|
|
2381
2392
|
var finalUserData, _yield$this$supabase$4, result, error, _t4;
|
|
2382
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
2393
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
2383
2394
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2384
2395
|
case 0:
|
|
2385
|
-
finalUserData = _objectSpread$
|
|
2396
|
+
finalUserData = _objectSpread$3({
|
|
2386
2397
|
tableName: this.defaultTableName
|
|
2387
2398
|
}, userData);
|
|
2388
2399
|
_context4.prev = 1;
|
|
@@ -2427,7 +2438,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2427
2438
|
}, {
|
|
2428
2439
|
key: "updateUser",
|
|
2429
2440
|
value: (function () {
|
|
2430
|
-
var _updateUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(userId) {
|
|
2441
|
+
var _updateUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(userId) {
|
|
2431
2442
|
var updateData,
|
|
2432
2443
|
finalUpdateData,
|
|
2433
2444
|
_yield$this$supabase$5,
|
|
@@ -2435,12 +2446,12 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2435
2446
|
error,
|
|
2436
2447
|
_args5 = arguments,
|
|
2437
2448
|
_t5;
|
|
2438
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
2449
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
2439
2450
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2440
2451
|
case 0:
|
|
2441
2452
|
updateData = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
2442
2453
|
// 设置默认值
|
|
2443
|
-
finalUpdateData = _objectSpread$
|
|
2454
|
+
finalUpdateData = _objectSpread$3({
|
|
2444
2455
|
tableName: this.defaultTableName
|
|
2445
2456
|
}, updateData);
|
|
2446
2457
|
_context5.prev = 1;
|
|
@@ -2481,13 +2492,13 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2481
2492
|
}, {
|
|
2482
2493
|
key: "deleteUser",
|
|
2483
2494
|
value: (function () {
|
|
2484
|
-
var _deleteUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(userId) {
|
|
2495
|
+
var _deleteUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(userId) {
|
|
2485
2496
|
var tableName,
|
|
2486
2497
|
_yield$this$supabase$6,
|
|
2487
2498
|
error,
|
|
2488
2499
|
_args6 = arguments,
|
|
2489
2500
|
_t6;
|
|
2490
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
2501
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
2491
2502
|
while (1) switch (_context6.prev = _context6.next) {
|
|
2492
2503
|
case 0:
|
|
2493
2504
|
tableName = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : this.defaultTableName;
|
|
@@ -2528,7 +2539,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2528
2539
|
}, {
|
|
2529
2540
|
key: "getUserList",
|
|
2530
2541
|
value: (function () {
|
|
2531
|
-
var _getUserList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
2542
|
+
var _getUserList = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7() {
|
|
2532
2543
|
var page,
|
|
2533
2544
|
limit,
|
|
2534
2545
|
tableName,
|
|
@@ -2539,7 +2550,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2539
2550
|
count,
|
|
2540
2551
|
_args7 = arguments,
|
|
2541
2552
|
_t7;
|
|
2542
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
2553
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
2543
2554
|
while (1) switch (_context7.prev = _context7.next) {
|
|
2544
2555
|
case 0:
|
|
2545
2556
|
page = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : 1;
|
|
@@ -2595,7 +2606,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2595
2606
|
}, {
|
|
2596
2607
|
key: "searchUsers",
|
|
2597
2608
|
value: (function () {
|
|
2598
|
-
var _searchUsers = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(searchValue) {
|
|
2609
|
+
var _searchUsers = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee8(searchValue) {
|
|
2599
2610
|
var page,
|
|
2600
2611
|
limit,
|
|
2601
2612
|
tableName,
|
|
@@ -2606,7 +2617,7 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2606
2617
|
count,
|
|
2607
2618
|
_args8 = arguments,
|
|
2608
2619
|
_t8;
|
|
2609
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
2620
|
+
return _regeneratorRuntime$1.wrap(function (_context8) {
|
|
2610
2621
|
while (1) switch (_context8.prev = _context8.next) {
|
|
2611
2622
|
case 0:
|
|
2612
2623
|
page = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : 1;
|
|
@@ -2662,13 +2673,13 @@ var AuthService = /*#__PURE__*/function () {
|
|
|
2662
2673
|
}, {
|
|
2663
2674
|
key: "updateLastLogin",
|
|
2664
2675
|
value: (function () {
|
|
2665
|
-
var _updateLastLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userId) {
|
|
2676
|
+
var _updateLastLogin = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee9(userId) {
|
|
2666
2677
|
var tableName,
|
|
2667
2678
|
_yield$this$supabase$9,
|
|
2668
2679
|
error,
|
|
2669
2680
|
_args9 = arguments,
|
|
2670
2681
|
_t9;
|
|
2671
|
-
return _regeneratorRuntime.wrap(function (_context9) {
|
|
2682
|
+
return _regeneratorRuntime$1.wrap(function (_context9) {
|
|
2672
2683
|
while (1) switch (_context9.prev = _context9.next) {
|
|
2673
2684
|
case 0:
|
|
2674
2685
|
tableName = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : this.defaultTableName;
|
|
@@ -2734,30 +2745,30 @@ function _objectWithoutProperties(e, t) {
|
|
|
2734
2745
|
return i;
|
|
2735
2746
|
}
|
|
2736
2747
|
|
|
2737
|
-
function _assertThisInitialized(e) {
|
|
2748
|
+
function _assertThisInitialized$1(e) {
|
|
2738
2749
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2739
2750
|
return e;
|
|
2740
2751
|
}
|
|
2741
2752
|
|
|
2742
|
-
function _possibleConstructorReturn(t, e) {
|
|
2743
|
-
if (e && ("object" == _typeof$
|
|
2753
|
+
function _possibleConstructorReturn$1(t, e) {
|
|
2754
|
+
if (e && ("object" == _typeof$2(e) || "function" == typeof e)) return e;
|
|
2744
2755
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
2745
|
-
return _assertThisInitialized(t);
|
|
2756
|
+
return _assertThisInitialized$1(t);
|
|
2746
2757
|
}
|
|
2747
2758
|
|
|
2748
|
-
function _getPrototypeOf(t) {
|
|
2749
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
2759
|
+
function _getPrototypeOf$1(t) {
|
|
2760
|
+
return _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
2750
2761
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2751
|
-
}, _getPrototypeOf(t);
|
|
2762
|
+
}, _getPrototypeOf$1(t);
|
|
2752
2763
|
}
|
|
2753
2764
|
|
|
2754
|
-
function _setPrototypeOf(t, e) {
|
|
2755
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
2765
|
+
function _setPrototypeOf$1(t, e) {
|
|
2766
|
+
return _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
2756
2767
|
return t.__proto__ = e, t;
|
|
2757
|
-
}, _setPrototypeOf(t, e);
|
|
2768
|
+
}, _setPrototypeOf$1(t, e);
|
|
2758
2769
|
}
|
|
2759
2770
|
|
|
2760
|
-
function _inherits(t, e) {
|
|
2771
|
+
function _inherits$1(t, e) {
|
|
2761
2772
|
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
2762
2773
|
t.prototype = Object.create(e && e.prototype, {
|
|
2763
2774
|
constructor: {
|
|
@@ -2767,10 +2778,10 @@ function _inherits(t, e) {
|
|
|
2767
2778
|
}
|
|
2768
2779
|
}), Object.defineProperty(t, "prototype", {
|
|
2769
2780
|
writable: !1
|
|
2770
|
-
}), e && _setPrototypeOf(t, e);
|
|
2781
|
+
}), e && _setPrototypeOf$1(t, e);
|
|
2771
2782
|
}
|
|
2772
2783
|
|
|
2773
|
-
function _isNativeFunction(t) {
|
|
2784
|
+
function _isNativeFunction$1(t) {
|
|
2774
2785
|
try {
|
|
2775
2786
|
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
2776
2787
|
} catch (n) {
|
|
@@ -2778,34 +2789,34 @@ function _isNativeFunction(t) {
|
|
|
2778
2789
|
}
|
|
2779
2790
|
}
|
|
2780
2791
|
|
|
2781
|
-
function _isNativeReflectConstruct$
|
|
2792
|
+
function _isNativeReflectConstruct$3() {
|
|
2782
2793
|
try {
|
|
2783
2794
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
2784
2795
|
} catch (t) {}
|
|
2785
|
-
return (_isNativeReflectConstruct$
|
|
2796
|
+
return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() {
|
|
2786
2797
|
return !!t;
|
|
2787
2798
|
})();
|
|
2788
2799
|
}
|
|
2789
2800
|
|
|
2790
|
-
function _construct(t, e, r) {
|
|
2791
|
-
if (_isNativeReflectConstruct$
|
|
2801
|
+
function _construct$1(t, e, r) {
|
|
2802
|
+
if (_isNativeReflectConstruct$3()) return Reflect.construct.apply(null, arguments);
|
|
2792
2803
|
var o = [null];
|
|
2793
2804
|
o.push.apply(o, e);
|
|
2794
2805
|
var p = new (t.bind.apply(t, o))();
|
|
2795
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
2806
|
+
return r && _setPrototypeOf$1(p, r.prototype), p;
|
|
2796
2807
|
}
|
|
2797
2808
|
|
|
2798
|
-
function _wrapNativeSuper(t) {
|
|
2809
|
+
function _wrapNativeSuper$1(t) {
|
|
2799
2810
|
var r = "function" == typeof Map ? new Map() : void 0;
|
|
2800
|
-
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
2801
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
|
2811
|
+
return _wrapNativeSuper$1 = function _wrapNativeSuper(t) {
|
|
2812
|
+
if (null === t || !_isNativeFunction$1(t)) return t;
|
|
2802
2813
|
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
2803
2814
|
if (void 0 !== r) {
|
|
2804
2815
|
if (r.has(t)) return r.get(t);
|
|
2805
2816
|
r.set(t, Wrapper);
|
|
2806
2817
|
}
|
|
2807
2818
|
function Wrapper() {
|
|
2808
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
2819
|
+
return _construct$1(t, arguments, _getPrototypeOf$1(this).constructor);
|
|
2809
2820
|
}
|
|
2810
2821
|
return Wrapper.prototype = Object.create(t.prototype, {
|
|
2811
2822
|
constructor: {
|
|
@@ -2814,42 +2825,557 @@ function _wrapNativeSuper(t) {
|
|
|
2814
2825
|
writable: !0,
|
|
2815
2826
|
configurable: !0
|
|
2816
2827
|
}
|
|
2817
|
-
}), _setPrototypeOf(Wrapper, t);
|
|
2818
|
-
}, _wrapNativeSuper(t);
|
|
2828
|
+
}), _setPrototypeOf$1(Wrapper, t);
|
|
2829
|
+
}, _wrapNativeSuper$1(t);
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
function _typeof$1(o) {
|
|
2833
|
+
"@babel/helpers - typeof";
|
|
2834
|
+
|
|
2835
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
2836
|
+
return typeof o;
|
|
2837
|
+
} : function (o) {
|
|
2838
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2839
|
+
}, _typeof$1(o);
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
function toPrimitive(t, r) {
|
|
2843
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
2844
|
+
var e = t[Symbol.toPrimitive];
|
|
2845
|
+
if (void 0 !== e) {
|
|
2846
|
+
var i = e.call(t, r || "default");
|
|
2847
|
+
if ("object" != _typeof$1(i)) return i;
|
|
2848
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2849
|
+
}
|
|
2850
|
+
return ("string" === r ? String : Number)(t);
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
function toPropertyKey(t) {
|
|
2854
|
+
var i = toPrimitive(t, "string");
|
|
2855
|
+
return "symbol" == _typeof$1(i) ? i : i + "";
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
function _defineProperty(e, r, t) {
|
|
2859
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2860
|
+
value: t,
|
|
2861
|
+
enumerable: !0,
|
|
2862
|
+
configurable: !0,
|
|
2863
|
+
writable: !0
|
|
2864
|
+
}) : e[r] = t, e;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
2868
|
+
try {
|
|
2869
|
+
var i = n[a](c),
|
|
2870
|
+
u = i.value;
|
|
2871
|
+
} catch (n) {
|
|
2872
|
+
return void e(n);
|
|
2873
|
+
}
|
|
2874
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
2875
|
+
}
|
|
2876
|
+
function _asyncToGenerator(n) {
|
|
2877
|
+
return function () {
|
|
2878
|
+
var t = this,
|
|
2879
|
+
e = arguments;
|
|
2880
|
+
return new Promise(function (r, o) {
|
|
2881
|
+
var a = n.apply(t, e);
|
|
2882
|
+
function _next(n) {
|
|
2883
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
2884
|
+
}
|
|
2885
|
+
function _throw(n) {
|
|
2886
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
2887
|
+
}
|
|
2888
|
+
_next(void 0);
|
|
2889
|
+
});
|
|
2890
|
+
};
|
|
2819
2891
|
}
|
|
2820
2892
|
|
|
2821
|
-
function _arrayLikeToArray$
|
|
2893
|
+
function _arrayLikeToArray$3(r, a) {
|
|
2822
2894
|
(null == a || a > r.length) && (a = r.length);
|
|
2823
2895
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
2824
2896
|
return n;
|
|
2825
2897
|
}
|
|
2826
2898
|
|
|
2827
|
-
function _arrayWithoutHoles(r) {
|
|
2828
|
-
if (Array.isArray(r)) return _arrayLikeToArray$
|
|
2829
|
-
}
|
|
2899
|
+
function _arrayWithoutHoles$1(r) {
|
|
2900
|
+
if (Array.isArray(r)) return _arrayLikeToArray$3(r);
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
function _iterableToArray$1(r) {
|
|
2904
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
2905
|
+
}
|
|
2906
|
+
|
|
2907
|
+
function _unsupportedIterableToArray$3(r, a) {
|
|
2908
|
+
if (r) {
|
|
2909
|
+
if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
|
|
2910
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
2911
|
+
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;
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
function _nonIterableSpread$1() {
|
|
2916
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
function _toConsumableArray$1(r) {
|
|
2920
|
+
return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$1();
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
function _defineProperties(e, r) {
|
|
2924
|
+
for (var t = 0; t < r.length; t++) {
|
|
2925
|
+
var o = r[t];
|
|
2926
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
function _createClass(e, r, t) {
|
|
2930
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
2931
|
+
writable: !1
|
|
2932
|
+
}), e;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
function _classCallCheck(a, n) {
|
|
2936
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
function _assertThisInitialized(e) {
|
|
2940
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2941
|
+
return e;
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
function _possibleConstructorReturn(t, e) {
|
|
2945
|
+
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e;
|
|
2946
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
2947
|
+
return _assertThisInitialized(t);
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
function _getPrototypeOf(t) {
|
|
2951
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
2952
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2953
|
+
}, _getPrototypeOf(t);
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
function _setPrototypeOf(t, e) {
|
|
2957
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
2958
|
+
return t.__proto__ = e, t;
|
|
2959
|
+
}, _setPrototypeOf(t, e);
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
function _inherits(t, e) {
|
|
2963
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
2964
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
2965
|
+
constructor: {
|
|
2966
|
+
value: t,
|
|
2967
|
+
writable: !0,
|
|
2968
|
+
configurable: !0
|
|
2969
|
+
}
|
|
2970
|
+
}), Object.defineProperty(t, "prototype", {
|
|
2971
|
+
writable: !1
|
|
2972
|
+
}), e && _setPrototypeOf(t, e);
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
function _isNativeFunction(t) {
|
|
2976
|
+
try {
|
|
2977
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
2978
|
+
} catch (n) {
|
|
2979
|
+
return "function" == typeof t;
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
function _isNativeReflectConstruct$2() {
|
|
2984
|
+
try {
|
|
2985
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
2986
|
+
} catch (t) {}
|
|
2987
|
+
return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct() {
|
|
2988
|
+
return !!t;
|
|
2989
|
+
})();
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
function _construct(t, e, r) {
|
|
2993
|
+
if (_isNativeReflectConstruct$2()) return Reflect.construct.apply(null, arguments);
|
|
2994
|
+
var o = [null];
|
|
2995
|
+
o.push.apply(o, e);
|
|
2996
|
+
var p = new (t.bind.apply(t, o))();
|
|
2997
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
function _wrapNativeSuper(t) {
|
|
3001
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
3002
|
+
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
3003
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
3004
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
3005
|
+
if (void 0 !== r) {
|
|
3006
|
+
if (r.has(t)) return r.get(t);
|
|
3007
|
+
r.set(t, Wrapper);
|
|
3008
|
+
}
|
|
3009
|
+
function Wrapper() {
|
|
3010
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
3011
|
+
}
|
|
3012
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
3013
|
+
constructor: {
|
|
3014
|
+
value: Wrapper,
|
|
3015
|
+
enumerable: !1,
|
|
3016
|
+
writable: !0,
|
|
3017
|
+
configurable: !0
|
|
3018
|
+
}
|
|
3019
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
3020
|
+
}, _wrapNativeSuper(t);
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
3024
|
+
|
|
3025
|
+
var OverloadYield = {exports: {}};
|
|
3026
|
+
|
|
3027
|
+
(function (module) {
|
|
3028
|
+
function _OverloadYield(e, d) {
|
|
3029
|
+
this.v = e, this.k = d;
|
|
3030
|
+
}
|
|
3031
|
+
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3032
|
+
})(OverloadYield);
|
|
3033
|
+
var OverloadYieldExports = OverloadYield.exports;
|
|
3034
|
+
|
|
3035
|
+
var regenerator$1 = {exports: {}};
|
|
3036
|
+
|
|
3037
|
+
var regeneratorDefine = {exports: {}};
|
|
3038
|
+
|
|
3039
|
+
(function (module) {
|
|
3040
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
3041
|
+
var i = Object.defineProperty;
|
|
3042
|
+
try {
|
|
3043
|
+
i({}, "", {});
|
|
3044
|
+
} catch (e) {
|
|
3045
|
+
i = 0;
|
|
3046
|
+
}
|
|
3047
|
+
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
|
|
3048
|
+
function o(r, n) {
|
|
3049
|
+
_regeneratorDefine(e, r, function (e) {
|
|
3050
|
+
return this._invoke(r, n, e);
|
|
3051
|
+
});
|
|
3052
|
+
}
|
|
3053
|
+
r ? i ? i(e, r, {
|
|
3054
|
+
value: n,
|
|
3055
|
+
enumerable: !t,
|
|
3056
|
+
configurable: !t,
|
|
3057
|
+
writable: !t
|
|
3058
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
3059
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t);
|
|
3060
|
+
}
|
|
3061
|
+
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3062
|
+
})(regeneratorDefine);
|
|
3063
|
+
var regeneratorDefineExports = regeneratorDefine.exports;
|
|
3064
|
+
|
|
3065
|
+
(function (module) {
|
|
3066
|
+
var regeneratorDefine = regeneratorDefineExports;
|
|
3067
|
+
function _regenerator() {
|
|
3068
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3069
|
+
var e,
|
|
3070
|
+
t,
|
|
3071
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
3072
|
+
n = r.iterator || "@@iterator",
|
|
3073
|
+
o = r.toStringTag || "@@toStringTag";
|
|
3074
|
+
function i(r, n, o, i) {
|
|
3075
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
3076
|
+
u = Object.create(c.prototype);
|
|
3077
|
+
return regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
3078
|
+
var i,
|
|
3079
|
+
c,
|
|
3080
|
+
u,
|
|
3081
|
+
f = 0,
|
|
3082
|
+
p = o || [],
|
|
3083
|
+
y = !1,
|
|
3084
|
+
G = {
|
|
3085
|
+
p: 0,
|
|
3086
|
+
n: 0,
|
|
3087
|
+
v: e,
|
|
3088
|
+
a: d,
|
|
3089
|
+
f: d.bind(e, 4),
|
|
3090
|
+
d: function d(t, r) {
|
|
3091
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
3092
|
+
}
|
|
3093
|
+
};
|
|
3094
|
+
function d(r, n) {
|
|
3095
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
3096
|
+
var o,
|
|
3097
|
+
i = p[t],
|
|
3098
|
+
d = G.p,
|
|
3099
|
+
l = i[2];
|
|
3100
|
+
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));
|
|
3101
|
+
}
|
|
3102
|
+
if (o || r > 1) return a;
|
|
3103
|
+
throw y = !0, n;
|
|
3104
|
+
}
|
|
3105
|
+
return function (o, p, l) {
|
|
3106
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
3107
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
3108
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
3109
|
+
try {
|
|
3110
|
+
if (f = 2, i) {
|
|
3111
|
+
if (c || (o = "next"), t = i[o]) {
|
|
3112
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
3113
|
+
if (!t.done) return t;
|
|
3114
|
+
u = t.value, c < 2 && (c = 0);
|
|
3115
|
+
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
3116
|
+
i = e;
|
|
3117
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
3118
|
+
} catch (t) {
|
|
3119
|
+
i = e, c = 1, u = t;
|
|
3120
|
+
} finally {
|
|
3121
|
+
f = 1;
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
return {
|
|
3125
|
+
value: t,
|
|
3126
|
+
done: y
|
|
3127
|
+
};
|
|
3128
|
+
};
|
|
3129
|
+
}(r, o, i), !0), u;
|
|
3130
|
+
}
|
|
3131
|
+
var a = {};
|
|
3132
|
+
function Generator() {}
|
|
3133
|
+
function GeneratorFunction() {}
|
|
3134
|
+
function GeneratorFunctionPrototype() {}
|
|
3135
|
+
t = Object.getPrototypeOf;
|
|
3136
|
+
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function () {
|
|
3137
|
+
return this;
|
|
3138
|
+
}), t),
|
|
3139
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
3140
|
+
function f(e) {
|
|
3141
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
3142
|
+
}
|
|
3143
|
+
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 () {
|
|
3144
|
+
return this;
|
|
3145
|
+
}), regeneratorDefine(u, "toString", function () {
|
|
3146
|
+
return "[object Generator]";
|
|
3147
|
+
}), (module.exports = _regenerator = function _regenerator() {
|
|
3148
|
+
return {
|
|
3149
|
+
w: i,
|
|
3150
|
+
m: f
|
|
3151
|
+
};
|
|
3152
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
3153
|
+
}
|
|
3154
|
+
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3155
|
+
})(regenerator$1);
|
|
3156
|
+
var regeneratorExports = regenerator$1.exports;
|
|
3157
|
+
|
|
3158
|
+
var regeneratorAsync = {exports: {}};
|
|
3159
|
+
|
|
3160
|
+
var regeneratorAsyncGen = {exports: {}};
|
|
3161
|
+
|
|
3162
|
+
var regeneratorAsyncIterator = {exports: {}};
|
|
3163
|
+
|
|
3164
|
+
(function (module) {
|
|
3165
|
+
var OverloadYield = OverloadYieldExports;
|
|
3166
|
+
var regeneratorDefine = regeneratorDefineExports;
|
|
3167
|
+
function AsyncIterator(t, e) {
|
|
3168
|
+
function n(r, o, i, f) {
|
|
3169
|
+
try {
|
|
3170
|
+
var c = t[r](o),
|
|
3171
|
+
u = c.value;
|
|
3172
|
+
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
3173
|
+
n("next", t, i, f);
|
|
3174
|
+
}, function (t) {
|
|
3175
|
+
n("throw", t, i, f);
|
|
3176
|
+
}) : e.resolve(u).then(function (t) {
|
|
3177
|
+
c.value = t, i(c);
|
|
3178
|
+
}, function (t) {
|
|
3179
|
+
return n("throw", t, i, f);
|
|
3180
|
+
});
|
|
3181
|
+
} catch (t) {
|
|
3182
|
+
f(t);
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
var r;
|
|
3186
|
+
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
3187
|
+
return this;
|
|
3188
|
+
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
3189
|
+
function f() {
|
|
3190
|
+
return new e(function (e, r) {
|
|
3191
|
+
n(t, i, e, r);
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
return r = r ? r.then(f, f) : f();
|
|
3195
|
+
}, !0);
|
|
3196
|
+
}
|
|
3197
|
+
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3198
|
+
})(regeneratorAsyncIterator);
|
|
3199
|
+
var regeneratorAsyncIteratorExports = regeneratorAsyncIterator.exports;
|
|
3200
|
+
|
|
3201
|
+
(function (module) {
|
|
3202
|
+
var regenerator = regeneratorExports;
|
|
3203
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports;
|
|
3204
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
3205
|
+
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
|
|
3206
|
+
}
|
|
3207
|
+
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3208
|
+
})(regeneratorAsyncGen);
|
|
3209
|
+
var regeneratorAsyncGenExports = regeneratorAsyncGen.exports;
|
|
3210
|
+
|
|
3211
|
+
(function (module) {
|
|
3212
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports;
|
|
3213
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
3214
|
+
var a = regeneratorAsyncGen(n, e, r, t, o);
|
|
3215
|
+
return a.next().then(function (n) {
|
|
3216
|
+
return n.done ? n.value : a.next();
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3220
|
+
})(regeneratorAsync);
|
|
3221
|
+
var regeneratorAsyncExports = regeneratorAsync.exports;
|
|
3222
|
+
|
|
3223
|
+
var regeneratorKeys = {exports: {}};
|
|
3224
|
+
|
|
3225
|
+
(function (module) {
|
|
3226
|
+
function _regeneratorKeys(e) {
|
|
3227
|
+
var n = Object(e),
|
|
3228
|
+
r = [];
|
|
3229
|
+
for (var t in n) r.unshift(t);
|
|
3230
|
+
return function e() {
|
|
3231
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
3232
|
+
return e.done = !0, e;
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3236
|
+
})(regeneratorKeys);
|
|
3237
|
+
var regeneratorKeysExports = regeneratorKeys.exports;
|
|
3238
|
+
|
|
3239
|
+
var regeneratorValues = {exports: {}};
|
|
3240
|
+
|
|
3241
|
+
var _typeof = {exports: {}};
|
|
3242
|
+
|
|
3243
|
+
(function (module) {
|
|
3244
|
+
function _typeof(o) {
|
|
3245
|
+
"@babel/helpers - typeof";
|
|
3246
|
+
|
|
3247
|
+
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
3248
|
+
return typeof o;
|
|
3249
|
+
} : function (o) {
|
|
3250
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
3251
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
|
|
3252
|
+
}
|
|
3253
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3254
|
+
})(_typeof);
|
|
3255
|
+
var _typeofExports = _typeof.exports;
|
|
3256
|
+
|
|
3257
|
+
(function (module) {
|
|
3258
|
+
var _typeof = _typeofExports["default"];
|
|
3259
|
+
function _regeneratorValues(e) {
|
|
3260
|
+
if (null != e) {
|
|
3261
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
3262
|
+
r = 0;
|
|
3263
|
+
if (t) return t.call(e);
|
|
3264
|
+
if ("function" == typeof e.next) return e;
|
|
3265
|
+
if (!isNaN(e.length)) return {
|
|
3266
|
+
next: function next() {
|
|
3267
|
+
return e && r >= e.length && (e = void 0), {
|
|
3268
|
+
value: e && e[r++],
|
|
3269
|
+
done: !e
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
};
|
|
3273
|
+
}
|
|
3274
|
+
throw new TypeError(_typeof(e) + " is not iterable");
|
|
3275
|
+
}
|
|
3276
|
+
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3277
|
+
})(regeneratorValues);
|
|
3278
|
+
var regeneratorValuesExports = regeneratorValues.exports;
|
|
3279
|
+
|
|
3280
|
+
(function (module) {
|
|
3281
|
+
var OverloadYield = OverloadYieldExports;
|
|
3282
|
+
var regenerator = regeneratorExports;
|
|
3283
|
+
var regeneratorAsync = regeneratorAsyncExports;
|
|
3284
|
+
var regeneratorAsyncGen = regeneratorAsyncGenExports;
|
|
3285
|
+
var regeneratorAsyncIterator = regeneratorAsyncIteratorExports;
|
|
3286
|
+
var regeneratorKeys = regeneratorKeysExports;
|
|
3287
|
+
var regeneratorValues = regeneratorValuesExports;
|
|
3288
|
+
function _regeneratorRuntime() {
|
|
3289
|
+
|
|
3290
|
+
var r = regenerator(),
|
|
3291
|
+
e = r.m(_regeneratorRuntime),
|
|
3292
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
3293
|
+
function n(r) {
|
|
3294
|
+
var e = "function" == typeof r && r.constructor;
|
|
3295
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
3296
|
+
}
|
|
3297
|
+
var o = {
|
|
3298
|
+
"throw": 1,
|
|
3299
|
+
"return": 2,
|
|
3300
|
+
"break": 3,
|
|
3301
|
+
"continue": 3
|
|
3302
|
+
};
|
|
3303
|
+
function a(r) {
|
|
3304
|
+
var e, t;
|
|
3305
|
+
return function (n) {
|
|
3306
|
+
e || (e = {
|
|
3307
|
+
stop: function stop() {
|
|
3308
|
+
return t(n.a, 2);
|
|
3309
|
+
},
|
|
3310
|
+
"catch": function _catch() {
|
|
3311
|
+
return n.v;
|
|
3312
|
+
},
|
|
3313
|
+
abrupt: function abrupt(r, e) {
|
|
3314
|
+
return t(n.a, o[r], e);
|
|
3315
|
+
},
|
|
3316
|
+
delegateYield: function delegateYield(r, o, a) {
|
|
3317
|
+
return e.resultName = o, t(n.d, regeneratorValues(r), a);
|
|
3318
|
+
},
|
|
3319
|
+
finish: function finish(r) {
|
|
3320
|
+
return t(n.f, r);
|
|
3321
|
+
}
|
|
3322
|
+
}, t = function t(r, _t, o) {
|
|
3323
|
+
n.p = e.prev, n.n = e.next;
|
|
3324
|
+
try {
|
|
3325
|
+
return r(_t, o);
|
|
3326
|
+
} finally {
|
|
3327
|
+
e.next = n.n;
|
|
3328
|
+
}
|
|
3329
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
3330
|
+
try {
|
|
3331
|
+
return r.call(this, e);
|
|
3332
|
+
} finally {
|
|
3333
|
+
n.p = e.prev, n.n = e.next;
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
3338
|
+
return {
|
|
3339
|
+
wrap: function wrap(e, t, n, o) {
|
|
3340
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
3341
|
+
},
|
|
3342
|
+
isGeneratorFunction: n,
|
|
3343
|
+
mark: r.m,
|
|
3344
|
+
awrap: function awrap(r, e) {
|
|
3345
|
+
return new OverloadYield(r, e);
|
|
3346
|
+
},
|
|
3347
|
+
AsyncIterator: regeneratorAsyncIterator,
|
|
3348
|
+
async: function async(r, e, t, o, u) {
|
|
3349
|
+
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u);
|
|
3350
|
+
},
|
|
3351
|
+
keys: regeneratorKeys,
|
|
3352
|
+
values: regeneratorValues
|
|
3353
|
+
};
|
|
3354
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports)();
|
|
3355
|
+
}
|
|
3356
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3357
|
+
})(regeneratorRuntime$1);
|
|
3358
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
3359
|
+
|
|
3360
|
+
// TODO(Babel 8): Remove this file.
|
|
2830
3361
|
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
}
|
|
3362
|
+
var runtime = regeneratorRuntimeExports();
|
|
3363
|
+
var regenerator = runtime;
|
|
2834
3364
|
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
3365
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
3366
|
+
try {
|
|
3367
|
+
regeneratorRuntime = runtime;
|
|
3368
|
+
} catch (accidentalStrictMode) {
|
|
3369
|
+
if ((typeof globalThis === "undefined" ? "undefined" : _typeof$1(globalThis)) === "object") {
|
|
3370
|
+
globalThis.regeneratorRuntime = runtime;
|
|
3371
|
+
} else {
|
|
3372
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
2840
3373
|
}
|
|
2841
3374
|
}
|
|
3375
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
2842
3376
|
|
|
2843
|
-
function
|
|
2844
|
-
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
function _toConsumableArray(r) {
|
|
2848
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
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; }
|
|
2852
|
-
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; }
|
|
3377
|
+
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; }
|
|
3378
|
+
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; }
|
|
2853
3379
|
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)); }
|
|
2854
3380
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
2855
3381
|
// src/error.ts
|
|
@@ -2954,7 +3480,7 @@ function validateExtension(fileName, allowedExtensions) {
|
|
|
2954
3480
|
throw new OssError(ErrorCode.INVALID_PARAMS, "\u6587\u4EF6 \"".concat(fileName, "\" \u7F3A\u5C11\u6269\u5C55\u540D"));
|
|
2955
3481
|
}
|
|
2956
3482
|
if (!whitelist.has(ext)) {
|
|
2957
|
-
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(", ")));
|
|
3483
|
+
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(", ")));
|
|
2958
3484
|
}
|
|
2959
3485
|
}
|
|
2960
3486
|
function validateMagicBytes(_x, _x2) {
|
|
@@ -3377,7 +3903,7 @@ var DEFAULT_LIMITS = {
|
|
|
3377
3903
|
other: 10 * 1024 * 1024
|
|
3378
3904
|
};
|
|
3379
3905
|
function getSizeLimit(fileName, limits) {
|
|
3380
|
-
var merged = _objectSpread$
|
|
3906
|
+
var merged = _objectSpread$2(_objectSpread$2({}, DEFAULT_LIMITS), limits);
|
|
3381
3907
|
if (isImage(fileName)) return merged.image;
|
|
3382
3908
|
if (isVideo(fileName)) return merged.video;
|
|
3383
3909
|
return merged.other;
|
|
@@ -3405,7 +3931,7 @@ function _compressImageBlob() {
|
|
|
3405
3931
|
return _regeneratorRuntime.wrap(function (_context10) {
|
|
3406
3932
|
while (1) switch (_context10.prev = _context10.next) {
|
|
3407
3933
|
case 0:
|
|
3408
|
-
opts = _objectSpread$
|
|
3934
|
+
opts = _objectSpread$2(_objectSpread$2({}, DEFAULT_COMPRESS), options);
|
|
3409
3935
|
if (!(typeof createImageBitmap === "undefined" || typeof OffscreenCanvas === "undefined")) {
|
|
3410
3936
|
_context10.next = 1;
|
|
3411
3937
|
break;
|
|
@@ -3471,7 +3997,7 @@ function _processFile() {
|
|
|
3471
3997
|
return _regeneratorRuntime.wrap(function (_context11) {
|
|
3472
3998
|
while (1) switch (_context11.prev = _context11.next) {
|
|
3473
3999
|
case 0:
|
|
3474
|
-
opts = _objectSpread$
|
|
4000
|
+
opts = _objectSpread$2(_objectSpread$2({}, DEFAULT_COMPRESS), compress);
|
|
3475
4001
|
if (!(opts.enabled && isImage(fileName))) {
|
|
3476
4002
|
_context11.next = 2;
|
|
3477
4003
|
break;
|
|
@@ -3535,7 +4061,7 @@ function createOssClient() {
|
|
|
3535
4061
|
var allowedExtensions = options.allowedExtensions;
|
|
3536
4062
|
function mergeRetry(override) {
|
|
3537
4063
|
if (!defaultRetry && !override) return void 0;
|
|
3538
|
-
return _objectSpread$
|
|
4064
|
+
return _objectSpread$2(_objectSpread$2({}, defaultRetry), override);
|
|
3539
4065
|
}
|
|
3540
4066
|
function resolveCompress(override) {
|
|
3541
4067
|
if (override === false) return {
|
|
@@ -3545,7 +4071,7 @@ function createOssClient() {
|
|
|
3545
4071
|
enabled: false
|
|
3546
4072
|
};
|
|
3547
4073
|
var base = _typeof$1(defaultCompress) === "object" ? defaultCompress : {};
|
|
3548
|
-
return override ? _objectSpread$
|
|
4074
|
+
return override ? _objectSpread$2(_objectSpread$2({}, base), override) : Object.keys(base).length ? base : void 0;
|
|
3549
4075
|
}
|
|
3550
4076
|
function uploadOne(_x25, _x26, _x27, _x28) {
|
|
3551
4077
|
return _uploadOne.apply(this, arguments);
|
|
@@ -3631,7 +4157,7 @@ function createOssClient() {
|
|
|
3631
4157
|
var i = index++;
|
|
3632
4158
|
var item = files[i];
|
|
3633
4159
|
running++;
|
|
3634
|
-
var fileOpts = _objectSpread$
|
|
4160
|
+
var fileOpts = _objectSpread$2({
|
|
3635
4161
|
retry: opts === null || opts === void 0 ? void 0 : opts.retry,
|
|
3636
4162
|
compress: opts === null || opts === void 0 ? void 0 : opts.compress
|
|
3637
4163
|
}, item.options);
|
|
@@ -3762,7 +4288,7 @@ function createOssClient() {
|
|
|
3762
4288
|
}
|
|
3763
4289
|
|
|
3764
4290
|
var _excluded$1 = ["accessKeyId", "accessKeySecret"];
|
|
3765
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
4291
|
+
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)); }
|
|
3766
4292
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
3767
4293
|
var DEFAULT_MAX_SIZE = 2 * 1024 * 1024;
|
|
3768
4294
|
var DEFAULT_SIGNED_URL_EXPIRES_IN = 60 * 60;
|
|
@@ -3770,15 +4296,15 @@ var OssUploadError = /*#__PURE__*/function (_Error) {
|
|
|
3770
4296
|
function OssUploadError(message) {
|
|
3771
4297
|
var _this;
|
|
3772
4298
|
var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
|
|
3773
|
-
_classCallCheck(this, OssUploadError);
|
|
4299
|
+
_classCallCheck$1(this, OssUploadError);
|
|
3774
4300
|
_this = _callSuper(this, OssUploadError, [message]);
|
|
3775
4301
|
_this.name = "OssUploadError";
|
|
3776
4302
|
_this.status = status;
|
|
3777
4303
|
return _this;
|
|
3778
4304
|
}
|
|
3779
|
-
_inherits(OssUploadError, _Error);
|
|
3780
|
-
return _createClass(OssUploadError);
|
|
3781
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
4305
|
+
_inherits$1(OssUploadError, _Error);
|
|
4306
|
+
return _createClass$1(OssUploadError);
|
|
4307
|
+
}(/*#__PURE__*/_wrapNativeSuper$1(Error));
|
|
3782
4308
|
function sanitizePathSegment(value) {
|
|
3783
4309
|
return String(value || "").trim().replace(/[^a-zA-Z0-9/_-]+/g, "-").replace(/\/{2,}/g, "/").replace(/^\/+|\/+$/g, "");
|
|
3784
4310
|
}
|
|
@@ -3843,7 +4369,7 @@ function normalizeSdkError(error) {
|
|
|
3843
4369
|
}
|
|
3844
4370
|
var OssUploadService = /*#__PURE__*/function () {
|
|
3845
4371
|
function OssUploadService(config) {
|
|
3846
|
-
_classCallCheck(this, OssUploadService);
|
|
4372
|
+
_classCallCheck$1(this, OssUploadService);
|
|
3847
4373
|
this.config = normalizeConfig(config);
|
|
3848
4374
|
this.client = createOssClient({
|
|
3849
4375
|
baseURL: this.config.baseURL,
|
|
@@ -3851,7 +4377,7 @@ var OssUploadService = /*#__PURE__*/function () {
|
|
|
3851
4377
|
retry: this.config.retry
|
|
3852
4378
|
});
|
|
3853
4379
|
}
|
|
3854
|
-
return _createClass(OssUploadService, [{
|
|
4380
|
+
return _createClass$1(OssUploadService, [{
|
|
3855
4381
|
key: "getConfig",
|
|
3856
4382
|
value: function getConfig() {
|
|
3857
4383
|
var _this$config = this.config;
|
|
@@ -3863,9 +4389,9 @@ var OssUploadService = /*#__PURE__*/function () {
|
|
|
3863
4389
|
}, {
|
|
3864
4390
|
key: "upload",
|
|
3865
4391
|
value: function () {
|
|
3866
|
-
var _upload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(input) {
|
|
4392
|
+
var _upload = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(input) {
|
|
3867
4393
|
var sessionId, maxSize, objectKey, result, url, resolvedUrl, _t;
|
|
3868
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4394
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
3869
4395
|
while (1) switch (_context.prev = _context.next) {
|
|
3870
4396
|
case 0:
|
|
3871
4397
|
sessionId = String(input.sessionId || "").trim();
|
|
@@ -3977,9 +4503,9 @@ function ensureAdminRegistryTable(_x) {
|
|
|
3977
4503
|
return _ensureAdminRegistryTable.apply(this, arguments);
|
|
3978
4504
|
}
|
|
3979
4505
|
function _ensureAdminRegistryTable() {
|
|
3980
|
-
_ensureAdminRegistryTable = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(supabase) {
|
|
4506
|
+
_ensureAdminRegistryTable = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(supabase) {
|
|
3981
4507
|
var _yield$supabase$from$, error;
|
|
3982
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4508
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
3983
4509
|
while (1) switch (_context.prev = _context.next) {
|
|
3984
4510
|
case 0:
|
|
3985
4511
|
if (!ensured) {
|
|
@@ -4020,9 +4546,9 @@ function getSessionAdminRow(_x2, _x3) {
|
|
|
4020
4546
|
return _getSessionAdminRow.apply(this, arguments);
|
|
4021
4547
|
}
|
|
4022
4548
|
function _getSessionAdminRow() {
|
|
4023
|
-
_getSessionAdminRow = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(supabase, sessionId) {
|
|
4549
|
+
_getSessionAdminRow = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(supabase, sessionId) {
|
|
4024
4550
|
var sid, _yield$supabase$from$2, data, error;
|
|
4025
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
4551
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
4026
4552
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4027
4553
|
case 0:
|
|
4028
4554
|
sid = normalizeSessionId(sessionId);
|
|
@@ -4051,9 +4577,9 @@ function getSessionAdminRowByEmail(_x4, _x5, _x6) {
|
|
|
4051
4577
|
return _getSessionAdminRowByEmail.apply(this, arguments);
|
|
4052
4578
|
}
|
|
4053
4579
|
function _getSessionAdminRowByEmail() {
|
|
4054
|
-
_getSessionAdminRowByEmail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(supabase, sessionId, email) {
|
|
4580
|
+
_getSessionAdminRowByEmail = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(supabase, sessionId, email) {
|
|
4055
4581
|
var row, normalizedEmail, rowEmail;
|
|
4056
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
4582
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
4057
4583
|
while (1) switch (_context3.prev = _context3.next) {
|
|
4058
4584
|
case 0:
|
|
4059
4585
|
_context3.next = 1;
|
|
@@ -4087,9 +4613,9 @@ function isUserSessionAdmin(_x7, _x8, _x9) {
|
|
|
4087
4613
|
return _isUserSessionAdmin.apply(this, arguments);
|
|
4088
4614
|
}
|
|
4089
4615
|
function _isUserSessionAdmin() {
|
|
4090
|
-
_isUserSessionAdmin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(supabase, sessionId, userId) {
|
|
4616
|
+
_isUserSessionAdmin = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(supabase, sessionId, userId) {
|
|
4091
4617
|
var row;
|
|
4092
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
4618
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
4093
4619
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4094
4620
|
case 0:
|
|
4095
4621
|
_context4.next = 1;
|
|
@@ -4161,9 +4687,9 @@ function postWebhook(_x, _x2) {
|
|
|
4161
4687
|
return _postWebhook.apply(this, arguments);
|
|
4162
4688
|
}
|
|
4163
4689
|
function _postWebhook() {
|
|
4164
|
-
_postWebhook = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(webhook, body) {
|
|
4690
|
+
_postWebhook = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(webhook, body) {
|
|
4165
4691
|
var response;
|
|
4166
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4692
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
4167
4693
|
while (1) switch (_context.prev = _context.next) {
|
|
4168
4694
|
case 0:
|
|
4169
4695
|
_context.next = 1;
|
|
@@ -4193,9 +4719,9 @@ function notifyCmsCrudErrorToFeishu(_x3, _x4) {
|
|
|
4193
4719
|
return _notifyCmsCrudErrorToFeishu.apply(this, arguments);
|
|
4194
4720
|
}
|
|
4195
4721
|
function _notifyCmsCrudErrorToFeishu() {
|
|
4196
|
-
_notifyCmsCrudErrorToFeishu = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, options) {
|
|
4722
|
+
_notifyCmsCrudErrorToFeishu = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, options) {
|
|
4197
4723
|
var webhookUrls, body, results, failed;
|
|
4198
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
4724
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
4199
4725
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4200
4726
|
case 0:
|
|
4201
4727
|
webhookUrls = getWebhookUrls();
|
|
@@ -4247,9 +4773,9 @@ function reportCmsCrudErrorToFeishu(c, options) {
|
|
|
4247
4773
|
});
|
|
4248
4774
|
}
|
|
4249
4775
|
|
|
4250
|
-
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$
|
|
4251
|
-
function _unsupportedIterableToArray$
|
|
4252
|
-
function _arrayLikeToArray$
|
|
4776
|
+
function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(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; } } }; }
|
|
4777
|
+
function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(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$2(r, a) : void 0; } }
|
|
4778
|
+
function _arrayLikeToArray$2(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; }
|
|
4253
4779
|
var RESERVED_STATUS_FIELD = "status";
|
|
4254
4780
|
var PUBLISH_STATUS_VALUES = new Set(["draft", "published"]);
|
|
4255
4781
|
// 初始化Supabase连接和CMS系统
|
|
@@ -4257,9 +4783,9 @@ function initializeSystem() {
|
|
|
4257
4783
|
return _initializeSystem.apply(this, arguments);
|
|
4258
4784
|
}
|
|
4259
4785
|
function _initializeSystem() {
|
|
4260
|
-
_initializeSystem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
4786
|
+
_initializeSystem = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
|
|
4261
4787
|
var _t;
|
|
4262
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
4788
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
4263
4789
|
while (1) switch (_context.prev = _context.next) {
|
|
4264
4790
|
case 0:
|
|
4265
4791
|
_context.prev = 0;
|
|
@@ -4350,9 +4876,9 @@ function getModels(_x) {
|
|
|
4350
4876
|
}
|
|
4351
4877
|
// POST - 创建新模型
|
|
4352
4878
|
function _getModels() {
|
|
4353
|
-
_getModels = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
4879
|
+
_getModels = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
4354
4880
|
var cmsModelService, page, limit, name, sessionId, models, tablePrefix, total, offset, paginatedModels, response, _response, _t2;
|
|
4355
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
4881
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
4356
4882
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4357
4883
|
case 0:
|
|
4358
4884
|
_context2.prev = 0;
|
|
@@ -4421,9 +4947,9 @@ function createModel(_x2) {
|
|
|
4421
4947
|
}
|
|
4422
4948
|
// PUT - 更新模型
|
|
4423
4949
|
function _createModel() {
|
|
4424
|
-
_createModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c) {
|
|
4950
|
+
_createModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c) {
|
|
4425
4951
|
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;
|
|
4426
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
4952
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
4427
4953
|
while (1) switch (_context3.prev = _context3.next) {
|
|
4428
4954
|
case 0:
|
|
4429
4955
|
_context3.prev = 0;
|
|
@@ -4572,9 +5098,9 @@ function updateModel(_x3) {
|
|
|
4572
5098
|
}
|
|
4573
5099
|
// DELETE - 删除模型
|
|
4574
5100
|
function _updateModel() {
|
|
4575
|
-
_updateModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(c) {
|
|
5101
|
+
_updateModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(c) {
|
|
4576
5102
|
var cmsModelService, body, id, name, json_schema, _response0, model, _response1, schemaValidationError, _response10, updateData, updatedModel, response, _response11, _t4;
|
|
4577
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
5103
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
4578
5104
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4579
5105
|
case 0:
|
|
4580
5106
|
_context4.prev = 0;
|
|
@@ -4667,9 +5193,9 @@ function deleteModel(_x4) {
|
|
|
4667
5193
|
return _deleteModel.apply(this, arguments);
|
|
4668
5194
|
}
|
|
4669
5195
|
function _deleteModel() {
|
|
4670
|
-
_deleteModel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(c) {
|
|
5196
|
+
_deleteModel = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(c) {
|
|
4671
5197
|
var cmsModelService, dynamicTableService, idStr, _response12, id, model, _response13, tableDropped, _response14, response, _response15, _t5;
|
|
4672
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
5198
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
4673
5199
|
while (1) switch (_context5.prev = _context5.next) {
|
|
4674
5200
|
case 0:
|
|
4675
5201
|
_context5.prev = 0;
|
|
@@ -4782,12 +5308,26 @@ function _iterableToArrayLimit(r, l) {
|
|
|
4782
5308
|
}
|
|
4783
5309
|
}
|
|
4784
5310
|
|
|
5311
|
+
function _arrayLikeToArray$1(r, a) {
|
|
5312
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5313
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
5314
|
+
return n;
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5317
|
+
function _unsupportedIterableToArray$1(r, a) {
|
|
5318
|
+
if (r) {
|
|
5319
|
+
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
5320
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
5321
|
+
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$1(r, a) : void 0;
|
|
5322
|
+
}
|
|
5323
|
+
}
|
|
5324
|
+
|
|
4785
5325
|
function _nonIterableRest() {
|
|
4786
5326
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4787
5327
|
}
|
|
4788
5328
|
|
|
4789
5329
|
function _slicedToArray(r, e) {
|
|
4790
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$
|
|
5330
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest();
|
|
4791
5331
|
}
|
|
4792
5332
|
|
|
4793
5333
|
var _excluded = ["id", "created_at", "updated_at"],
|
|
@@ -4796,8 +5336,8 @@ var _excluded = ["id", "created_at", "updated_at"],
|
|
|
4796
5336
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n2 = 0, F = function F() {}; return { s: F, n: function n() { return _n2 >= r.length ? { done: !0 } : { done: !1, value: r[_n2++] }; }, 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; } } }; }
|
|
4797
5337
|
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; } }
|
|
4798
5338
|
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; }
|
|
4799
|
-
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; }
|
|
4800
|
-
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; }
|
|
5339
|
+
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; }
|
|
5340
|
+
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; }
|
|
4801
5341
|
function normalizeJsonLikeFields(schemaFields, payload) {
|
|
4802
5342
|
if (!schemaFields || schemaFields.length === 0) return payload;
|
|
4803
5343
|
var jsonLikeFieldNames = new Set(schemaFields.filter(function (f) {
|
|
@@ -4806,7 +5346,7 @@ function normalizeJsonLikeFields(schemaFields, payload) {
|
|
|
4806
5346
|
return f.name;
|
|
4807
5347
|
}));
|
|
4808
5348
|
if (jsonLikeFieldNames.size === 0) return payload;
|
|
4809
|
-
var normalized = _objectSpread({}, payload);
|
|
5349
|
+
var normalized = _objectSpread$1({}, payload);
|
|
4810
5350
|
for (var _i = 0, _Object$entries = Object.entries(payload); _i < _Object$entries.length; _i++) {
|
|
4811
5351
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
4812
5352
|
key = _Object$entries$_i[0],
|
|
@@ -5023,9 +5563,9 @@ function getTableData(_x, _x2) {
|
|
|
5023
5563
|
}
|
|
5024
5564
|
// POST - 创建新数据
|
|
5025
5565
|
function _getTableData() {
|
|
5026
|
-
_getTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c, tableName) {
|
|
5566
|
+
_getTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c, tableName) {
|
|
5027
5567
|
var _model$json_schema, validationResponse, dynamicTableService, cmsModelService, page, limit, search, filtersStr, model, schemaFields, filters, _response, parsed, normalized, _response2, result, searchableFields, response, _response3, _t, _t2;
|
|
5028
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
5568
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
5029
5569
|
while (1) switch (_context.prev = _context.next) {
|
|
5030
5570
|
case 0:
|
|
5031
5571
|
_context.prev = 0;
|
|
@@ -5171,9 +5711,9 @@ function createTableData(_x3, _x4) {
|
|
|
5171
5711
|
}
|
|
5172
5712
|
// PUT - 更新数据
|
|
5173
5713
|
function _createTableData() {
|
|
5174
|
-
_createTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, tableName) {
|
|
5714
|
+
_createTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, tableName) {
|
|
5175
5715
|
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;
|
|
5176
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
5716
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
5177
5717
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5178
5718
|
case 0:
|
|
5179
5719
|
_context2.prev = 0;
|
|
@@ -5263,9 +5803,9 @@ function updateTableData(_x5, _x6) {
|
|
|
5263
5803
|
}
|
|
5264
5804
|
// DELETE - 删除数据
|
|
5265
5805
|
function _updateTableData() {
|
|
5266
|
-
_updateTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c, tableName) {
|
|
5806
|
+
_updateTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c, tableName) {
|
|
5267
5807
|
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;
|
|
5268
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
5808
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
5269
5809
|
while (1) switch (_context3.prev = _context3.next) {
|
|
5270
5810
|
case 0:
|
|
5271
5811
|
_context3.prev = 0;
|
|
@@ -5400,9 +5940,9 @@ function deleteTableData(_x7, _x8) {
|
|
|
5400
5940
|
}
|
|
5401
5941
|
// GET - 获取关联表选项列表 (用于下拉选择)
|
|
5402
5942
|
function _deleteTableData() {
|
|
5403
|
-
_deleteTableData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(c, tableName) {
|
|
5943
|
+
_deleteTableData = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(c, tableName) {
|
|
5404
5944
|
var validationResponse, dynamicTableService, id, _response10, recordId, _response11, existingData, _response12, result, response, _response13, _t7;
|
|
5405
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
5945
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
5406
5946
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5407
5947
|
case 0:
|
|
5408
5948
|
_context4.prev = 0;
|
|
@@ -5489,9 +6029,9 @@ function getRelationOptions(_x9, _x0) {
|
|
|
5489
6029
|
}
|
|
5490
6030
|
// GET - 获取表数据(带关联数据)
|
|
5491
6031
|
function _getRelationOptions() {
|
|
5492
|
-
_getRelationOptions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(c, tableName) {
|
|
6032
|
+
_getRelationOptions = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(c, tableName) {
|
|
5493
6033
|
var validationResponse, dynamicTableService, displayField, limit, search, params, options, response, _response14, _t8;
|
|
5494
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
6034
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
5495
6035
|
while (1) switch (_context5.prev = _context5.next) {
|
|
5496
6036
|
case 0:
|
|
5497
6037
|
_context5.prev = 0;
|
|
@@ -5545,9 +6085,9 @@ function getTableDataWithRelations(_x1, _x10) {
|
|
|
5545
6085
|
// DELETE - 删除表的所有外键约束
|
|
5546
6086
|
// 用于解决外键约束引用错误表的问题
|
|
5547
6087
|
function _getTableDataWithRelations() {
|
|
5548
|
-
_getTableDataWithRelations = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(c, tableName) {
|
|
6088
|
+
_getTableDataWithRelations = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(c, tableName) {
|
|
5549
6089
|
var validationResponse, dynamicTableService, cmsModelService, page, limit, model, result, response, hasRelations, _result, _response15, _result2, _response16, _response17, _t9;
|
|
5550
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
6090
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
5551
6091
|
while (1) switch (_context6.prev = _context6.next) {
|
|
5552
6092
|
case 0:
|
|
5553
6093
|
_context6.prev = 0;
|
|
@@ -5632,9 +6172,9 @@ function dropForeignKeys(_x11, _x12) {
|
|
|
5632
6172
|
return _dropForeignKeys.apply(this, arguments);
|
|
5633
6173
|
}
|
|
5634
6174
|
function _dropForeignKeys() {
|
|
5635
|
-
_dropForeignKeys = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(c, tableName) {
|
|
6175
|
+
_dropForeignKeys = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(c, tableName) {
|
|
5636
6176
|
var validationResponse, dynamicTableService, result, response, _response18, _response19, _t0;
|
|
5637
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
6177
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
5638
6178
|
while (1) switch (_context7.prev = _context7.next) {
|
|
5639
6179
|
case 0:
|
|
5640
6180
|
_context7.prev = 0;
|
|
@@ -5695,9 +6235,9 @@ var JWT_EXPIRES_IN = '24h';
|
|
|
5695
6235
|
*/
|
|
5696
6236
|
var AuthUtils = /*#__PURE__*/function () {
|
|
5697
6237
|
function AuthUtils() {
|
|
5698
|
-
_classCallCheck(this, AuthUtils);
|
|
6238
|
+
_classCallCheck$1(this, AuthUtils);
|
|
5699
6239
|
}
|
|
5700
|
-
return _createClass(AuthUtils, null, [{
|
|
6240
|
+
return _createClass$1(AuthUtils, null, [{
|
|
5701
6241
|
key: "generateToken",
|
|
5702
6242
|
value:
|
|
5703
6243
|
/**
|
|
@@ -5733,8 +6273,8 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5733
6273
|
}, {
|
|
5734
6274
|
key: "validatePassword",
|
|
5735
6275
|
value: (function () {
|
|
5736
|
-
var _validatePassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(plainPassword, hashedPassword) {
|
|
5737
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
6276
|
+
var _validatePassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(plainPassword, hashedPassword) {
|
|
6277
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
5738
6278
|
while (1) switch (_context.prev = _context.next) {
|
|
5739
6279
|
case 0:
|
|
5740
6280
|
return _context.abrupt("return", bcrypt__namespace.compare(plainPassword, hashedPassword));
|
|
@@ -5756,8 +6296,8 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5756
6296
|
}, {
|
|
5757
6297
|
key: "hashPassword",
|
|
5758
6298
|
value: (function () {
|
|
5759
|
-
var _hashPassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(password) {
|
|
5760
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
6299
|
+
var _hashPassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(password) {
|
|
6300
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
5761
6301
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5762
6302
|
case 0:
|
|
5763
6303
|
return _context2.abrupt("return", bcrypt__namespace.hash(password, 10));
|
|
@@ -5798,9 +6338,9 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5798
6338
|
}, {
|
|
5799
6339
|
key: "authenticateUser",
|
|
5800
6340
|
value: (function () {
|
|
5801
|
-
var _authenticateUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(username, password, tableName) {
|
|
6341
|
+
var _authenticateUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(username, password, tableName) {
|
|
5802
6342
|
var authService, user, isPasswordValid, _t;
|
|
5803
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
6343
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
5804
6344
|
while (1) switch (_context3.prev = _context3.next) {
|
|
5805
6345
|
case 0:
|
|
5806
6346
|
authService = this.getAuthService(); // 查询用户
|
|
@@ -5869,9 +6409,9 @@ var AuthUtils = /*#__PURE__*/function () {
|
|
|
5869
6409
|
}, {
|
|
5870
6410
|
key: "verifyTokenAndGetUser",
|
|
5871
6411
|
value: (function () {
|
|
5872
|
-
var _verifyTokenAndGetUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(token, tableName) {
|
|
6412
|
+
var _verifyTokenAndGetUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(token, tableName) {
|
|
5873
6413
|
var decoded, authService, userInfo, message, _t2;
|
|
5874
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
6414
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
5875
6415
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5876
6416
|
case 0:
|
|
5877
6417
|
_context4.prev = 0;
|
|
@@ -5996,9 +6536,9 @@ function forgotPassword(_x, _x2) {
|
|
|
5996
6536
|
}
|
|
5997
6537
|
// POST - 通过邮箱验证码重置密码
|
|
5998
6538
|
function _forgotPassword() {
|
|
5999
|
-
_forgotPassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, tableName) {
|
|
6539
|
+
_forgotPassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, tableName) {
|
|
6000
6540
|
var _body$username, i18n, body, account, supabase, sessionId, adminRow, _i18n, _t3;
|
|
6001
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
6541
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
6002
6542
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6003
6543
|
case 0:
|
|
6004
6544
|
_context2.prev = 0;
|
|
@@ -6070,9 +6610,9 @@ function resetPassword(_x3, _x4) {
|
|
|
6070
6610
|
return _resetPassword.apply(this, arguments);
|
|
6071
6611
|
}
|
|
6072
6612
|
function _resetPassword() {
|
|
6073
|
-
_resetPassword = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c, tableName) {
|
|
6613
|
+
_resetPassword = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c, tableName) {
|
|
6074
6614
|
var _body$username2, _body$code, i18n, body, account, code, password, supabase, sessionId, adminRow, verifyResult, _yield$supabase$auth$2, updateError, _i18n2, _t4;
|
|
6075
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
6615
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
6076
6616
|
while (1) switch (_context3.prev = _context3.next) {
|
|
6077
6617
|
case 0:
|
|
6078
6618
|
_context3.prev = 0;
|
|
@@ -6190,8 +6730,8 @@ function insertAdminRegistryRow(_x5, _x6, _x7, _x8) {
|
|
|
6190
6730
|
return _insertAdminRegistryRow.apply(this, arguments);
|
|
6191
6731
|
}
|
|
6192
6732
|
function _insertAdminRegistryRow() {
|
|
6193
|
-
_insertAdminRegistryRow = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(supabase, sessionId, userId, account) {
|
|
6194
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
6733
|
+
_insertAdminRegistryRow = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(supabase, sessionId, userId, account) {
|
|
6734
|
+
return _regeneratorRuntime$1.wrap(function (_context4) {
|
|
6195
6735
|
while (1) switch (_context4.prev = _context4.next) {
|
|
6196
6736
|
case 0:
|
|
6197
6737
|
_context4.next = 1;
|
|
@@ -6218,9 +6758,9 @@ function getEffectiveRoleForSession(_x9, _x0) {
|
|
|
6218
6758
|
return _getEffectiveRoleForSession.apply(this, arguments);
|
|
6219
6759
|
} // POST - 用户登录
|
|
6220
6760
|
function _getEffectiveRoleForSession() {
|
|
6221
|
-
_getEffectiveRoleForSession = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(user, sessionId) {
|
|
6761
|
+
_getEffectiveRoleForSession = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(user, sessionId) {
|
|
6222
6762
|
var supabase, sid, role, ok;
|
|
6223
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
6763
|
+
return _regeneratorRuntime$1.wrap(function (_context5) {
|
|
6224
6764
|
while (1) switch (_context5.prev = _context5.next) {
|
|
6225
6765
|
case 0:
|
|
6226
6766
|
supabase = getSupabase();
|
|
@@ -6256,9 +6796,9 @@ function login(_x1, _x10) {
|
|
|
6256
6796
|
}
|
|
6257
6797
|
// GET - 是否允许注册(首次进入需要创建管理员账号)
|
|
6258
6798
|
function _login() {
|
|
6259
|
-
_login = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(c, tableName) {
|
|
6799
|
+
_login = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(c, tableName) {
|
|
6260
6800
|
var _data$session, body, username, password, supabase, sessionId, email, _yield$supabase$auth$3, data, error, token, user, role, _t5;
|
|
6261
|
-
return _regeneratorRuntime.wrap(function (_context6) {
|
|
6801
|
+
return _regeneratorRuntime$1.wrap(function (_context6) {
|
|
6262
6802
|
while (1) switch (_context6.prev = _context6.next) {
|
|
6263
6803
|
case 0:
|
|
6264
6804
|
_context6.prev = 0;
|
|
@@ -6351,9 +6891,9 @@ function signupStatus(_x11, _x12) {
|
|
|
6351
6891
|
}
|
|
6352
6892
|
// POST - 首次注册管理员(每个 session_id 只允许一个)
|
|
6353
6893
|
function _signupStatus() {
|
|
6354
|
-
_signupStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(c, tableName) {
|
|
6894
|
+
_signupStatus = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(c, tableName) {
|
|
6355
6895
|
var supabase, sessionId, ok, row, data, _t6;
|
|
6356
|
-
return _regeneratorRuntime.wrap(function (_context7) {
|
|
6896
|
+
return _regeneratorRuntime$1.wrap(function (_context7) {
|
|
6357
6897
|
while (1) switch (_context7.prev = _context7.next) {
|
|
6358
6898
|
case 0:
|
|
6359
6899
|
_context7.prev = 0;
|
|
@@ -6410,9 +6950,9 @@ function signup(_x13, _x14) {
|
|
|
6410
6950
|
}
|
|
6411
6951
|
// POST - 验证token
|
|
6412
6952
|
function _signup() {
|
|
6413
|
-
_signup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(c, tableName) {
|
|
6953
|
+
_signup = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee8(c, tableName) {
|
|
6414
6954
|
var _body$username3, _data$session2, body, account, password, supabase, sessionId, email, ok, existing, _yield$supabase$auth$4, data, error, insertRes, token, user, role, _t7;
|
|
6415
|
-
return _regeneratorRuntime.wrap(function (_context8) {
|
|
6955
|
+
return _regeneratorRuntime$1.wrap(function (_context8) {
|
|
6416
6956
|
while (1) switch (_context8.prev = _context8.next) {
|
|
6417
6957
|
case 0:
|
|
6418
6958
|
_context8.prev = 0;
|
|
@@ -6577,9 +7117,9 @@ function verifyAuth(_x15, _x16) {
|
|
|
6577
7117
|
}
|
|
6578
7118
|
// GET - 获取当前用户信息
|
|
6579
7119
|
function _verifyAuth() {
|
|
6580
|
-
_verifyAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(c, tableName) {
|
|
7120
|
+
_verifyAuth = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee9(c, tableName) {
|
|
6581
7121
|
var authHeader, token, supabase, _yield$supabase$auth$5, data, error, sessionId, role, decoded, message, responseMessage, _t8, _t9;
|
|
6582
|
-
return _regeneratorRuntime.wrap(function (_context9) {
|
|
7122
|
+
return _regeneratorRuntime$1.wrap(function (_context9) {
|
|
6583
7123
|
while (1) switch (_context9.prev = _context9.next) {
|
|
6584
7124
|
case 0:
|
|
6585
7125
|
_context9.prev = 0;
|
|
@@ -6657,9 +7197,9 @@ function getCurrentUser(_x17, _x18) {
|
|
|
6657
7197
|
}
|
|
6658
7198
|
// 中间件:验证 Supabase JWT token
|
|
6659
7199
|
function _getCurrentUser() {
|
|
6660
|
-
_getCurrentUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(c, tableName) {
|
|
7200
|
+
_getCurrentUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee0(c, tableName) {
|
|
6661
7201
|
var authHeader, token, supabase, _yield$supabase$auth$6, data, error, user, sessionId, role, _t0;
|
|
6662
|
-
return _regeneratorRuntime.wrap(function (_context0) {
|
|
7202
|
+
return _regeneratorRuntime$1.wrap(function (_context0) {
|
|
6663
7203
|
while (1) switch (_context0.prev = _context0.next) {
|
|
6664
7204
|
case 0:
|
|
6665
7205
|
_context0.prev = 0;
|
|
@@ -6730,7 +7270,7 @@ function _getCurrentUser() {
|
|
|
6730
7270
|
}
|
|
6731
7271
|
function requireAuth(handler) {
|
|
6732
7272
|
return /*#__PURE__*/function () {
|
|
6733
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c) {
|
|
7273
|
+
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c) {
|
|
6734
7274
|
var authHeader,
|
|
6735
7275
|
token,
|
|
6736
7276
|
supabase,
|
|
@@ -6742,7 +7282,7 @@ function requireAuth(handler) {
|
|
|
6742
7282
|
_key,
|
|
6743
7283
|
_args = arguments,
|
|
6744
7284
|
_t2;
|
|
6745
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7285
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
6746
7286
|
while (1) switch (_context.prev = _context.next) {
|
|
6747
7287
|
case 0:
|
|
6748
7288
|
_context.prev = 0;
|
|
@@ -6824,10 +7364,10 @@ function resolveUploadMaxSize(_x, _x2) {
|
|
|
6824
7364
|
return _resolveUploadMaxSize.apply(this, arguments);
|
|
6825
7365
|
}
|
|
6826
7366
|
function _resolveUploadMaxSize() {
|
|
6827
|
-
_resolveUploadMaxSize = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(tableName, fieldName) {
|
|
7367
|
+
_resolveUploadMaxSize = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(tableName, fieldName) {
|
|
6828
7368
|
var _model$json_schema;
|
|
6829
7369
|
var cmsModelService, model;
|
|
6830
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7370
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
6831
7371
|
while (1) switch (_context.prev = _context.next) {
|
|
6832
7372
|
case 0:
|
|
6833
7373
|
if (!(!tableName || !fieldName)) {
|
|
@@ -6857,9 +7397,9 @@ function uploadToOss(_x3) {
|
|
|
6857
7397
|
return _uploadToOss.apply(this, arguments);
|
|
6858
7398
|
}
|
|
6859
7399
|
function _uploadToOss() {
|
|
6860
|
-
_uploadToOss = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
7400
|
+
_uploadToOss = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
6861
7401
|
var formData, file, fieldName, tableName, uploadService, result, status, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8;
|
|
6862
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7402
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
6863
7403
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6864
7404
|
case 0:
|
|
6865
7405
|
_context2.prev = 0;
|
|
@@ -6930,6 +7470,241 @@ function _uploadToOss() {
|
|
|
6930
7470
|
return _uploadToOss.apply(this, arguments);
|
|
6931
7471
|
}
|
|
6932
7472
|
|
|
7473
|
+
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; }
|
|
7474
|
+
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; }
|
|
7475
|
+
var CONFIG_NAMESPACE_RE = /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;
|
|
7476
|
+
var CONFIG_SESSION_RE = /^[a-zA-Z0-9_]{1,128}$/;
|
|
7477
|
+
function getConfigSessionId(c) {
|
|
7478
|
+
return normalizeSessionId(c.req.header("X-Session-Id") || c.req.header("x-session-id"));
|
|
7479
|
+
}
|
|
7480
|
+
function validateConfigSessionId(sessionId) {
|
|
7481
|
+
if (!sessionId) return "缺少 X-Session-Id,无法访问配置中心";
|
|
7482
|
+
if (!CONFIG_SESSION_RE.test(sessionId)) {
|
|
7483
|
+
return "X-Session-Id 格式不合法";
|
|
7484
|
+
}
|
|
7485
|
+
return null;
|
|
7486
|
+
}
|
|
7487
|
+
function getConfigsTableName(sessionId) {
|
|
7488
|
+
return "".concat(sessionId.replace(/-/g, '_'), "__config__");
|
|
7489
|
+
}
|
|
7490
|
+
function normalizeValues(values) {
|
|
7491
|
+
if (!values || _typeof$2(values) !== "object" || Array.isArray(values)) {
|
|
7492
|
+
return {};
|
|
7493
|
+
}
|
|
7494
|
+
return values;
|
|
7495
|
+
}
|
|
7496
|
+
function buildFieldStatus(values) {
|
|
7497
|
+
return Object.fromEntries(Object.entries(values).map(function (_ref) {
|
|
7498
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
7499
|
+
key = _ref2[0],
|
|
7500
|
+
value = _ref2[1];
|
|
7501
|
+
return [key, {
|
|
7502
|
+
configured: value !== null && value !== undefined && String(value).trim() !== ""
|
|
7503
|
+
}];
|
|
7504
|
+
}));
|
|
7505
|
+
}
|
|
7506
|
+
function validateNamespace(namespace) {
|
|
7507
|
+
if (!namespace) return "缺少 namespace";
|
|
7508
|
+
if (!CONFIG_NAMESPACE_RE.test(namespace)) {
|
|
7509
|
+
return "namespace 只能包含字母、数字、下划线和连字符,且必须以字母开头";
|
|
7510
|
+
}
|
|
7511
|
+
return null;
|
|
7512
|
+
}
|
|
7513
|
+
function toConfigResponse(row, fallbackNamespace) {
|
|
7514
|
+
var values = normalizeValues(row === null || row === void 0 ? void 0 : row.values);
|
|
7515
|
+
return {
|
|
7516
|
+
id: row === null || row === void 0 ? void 0 : row.id,
|
|
7517
|
+
namespace: (row === null || row === void 0 ? void 0 : row.namespace) || fallbackNamespace,
|
|
7518
|
+
values: values,
|
|
7519
|
+
fields: buildFieldStatus(values),
|
|
7520
|
+
created_at: row === null || row === void 0 ? void 0 : row.created_at,
|
|
7521
|
+
updated_at: row === null || row === void 0 ? void 0 : row.updated_at
|
|
7522
|
+
};
|
|
7523
|
+
}
|
|
7524
|
+
function getConfig(_x) {
|
|
7525
|
+
return _getConfig.apply(this, arguments);
|
|
7526
|
+
}
|
|
7527
|
+
function _getConfig() {
|
|
7528
|
+
_getConfig = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c) {
|
|
7529
|
+
var namespace, namespaceError, _response, sessionId, sessionError, _response2, tableName, supabase, _yield$supabase$from$, data, error, response, _response3, _t;
|
|
7530
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
7531
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7532
|
+
case 0:
|
|
7533
|
+
_context.prev = 0;
|
|
7534
|
+
namespace = (c.req.query("namespace") || "").trim();
|
|
7535
|
+
namespaceError = validateNamespace(namespace);
|
|
7536
|
+
if (!namespaceError) {
|
|
7537
|
+
_context.next = 1;
|
|
7538
|
+
break;
|
|
7539
|
+
}
|
|
7540
|
+
_response = {
|
|
7541
|
+
success: false,
|
|
7542
|
+
message: namespaceError
|
|
7543
|
+
};
|
|
7544
|
+
return _context.abrupt("return", c.json(_response, 200));
|
|
7545
|
+
case 1:
|
|
7546
|
+
sessionId = getConfigSessionId(c);
|
|
7547
|
+
sessionError = validateConfigSessionId(sessionId);
|
|
7548
|
+
if (!sessionError) {
|
|
7549
|
+
_context.next = 2;
|
|
7550
|
+
break;
|
|
7551
|
+
}
|
|
7552
|
+
_response2 = {
|
|
7553
|
+
success: false,
|
|
7554
|
+
message: sessionError
|
|
7555
|
+
};
|
|
7556
|
+
return _context.abrupt("return", c.json(_response2, 200));
|
|
7557
|
+
case 2:
|
|
7558
|
+
tableName = getConfigsTableName(sessionId);
|
|
7559
|
+
supabase = getSupabase();
|
|
7560
|
+
_context.next = 3;
|
|
7561
|
+
return supabase.from(tableName).select("*").eq("namespace", namespace).maybeSingle();
|
|
7562
|
+
case 3:
|
|
7563
|
+
_yield$supabase$from$ = _context.sent;
|
|
7564
|
+
data = _yield$supabase$from$.data;
|
|
7565
|
+
error = _yield$supabase$from$.error;
|
|
7566
|
+
if (!error) {
|
|
7567
|
+
_context.next = 4;
|
|
7568
|
+
break;
|
|
7569
|
+
}
|
|
7570
|
+
throw error;
|
|
7571
|
+
case 4:
|
|
7572
|
+
response = {
|
|
7573
|
+
success: true,
|
|
7574
|
+
data: toConfigResponse(data, namespace)
|
|
7575
|
+
};
|
|
7576
|
+
return _context.abrupt("return", c.json(response, 200));
|
|
7577
|
+
case 5:
|
|
7578
|
+
_context.prev = 5;
|
|
7579
|
+
_t = _context["catch"](0);
|
|
7580
|
+
console.error("获取配置失败:", _t);
|
|
7581
|
+
_response3 = {
|
|
7582
|
+
success: false,
|
|
7583
|
+
message: "获取配置失败",
|
|
7584
|
+
error: _t.message
|
|
7585
|
+
};
|
|
7586
|
+
return _context.abrupt("return", c.json(_response3, 500));
|
|
7587
|
+
case 6:
|
|
7588
|
+
case "end":
|
|
7589
|
+
return _context.stop();
|
|
7590
|
+
}
|
|
7591
|
+
}, _callee, null, [[0, 5]]);
|
|
7592
|
+
}));
|
|
7593
|
+
return _getConfig.apply(this, arguments);
|
|
7594
|
+
}
|
|
7595
|
+
function updateConfig(_x2) {
|
|
7596
|
+
return _updateConfig.apply(this, arguments);
|
|
7597
|
+
}
|
|
7598
|
+
function _updateConfig() {
|
|
7599
|
+
_updateConfig = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
7600
|
+
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;
|
|
7601
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
7602
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7603
|
+
case 0:
|
|
7604
|
+
_context2.prev = 0;
|
|
7605
|
+
namespace = (c.req.param("namespace") || "").trim();
|
|
7606
|
+
namespaceError = validateNamespace(namespace);
|
|
7607
|
+
if (!namespaceError) {
|
|
7608
|
+
_context2.next = 1;
|
|
7609
|
+
break;
|
|
7610
|
+
}
|
|
7611
|
+
_response4 = {
|
|
7612
|
+
success: false,
|
|
7613
|
+
message: namespaceError
|
|
7614
|
+
};
|
|
7615
|
+
return _context2.abrupt("return", c.json(_response4, 200));
|
|
7616
|
+
case 1:
|
|
7617
|
+
_context2.next = 2;
|
|
7618
|
+
return c.req.json();
|
|
7619
|
+
case 2:
|
|
7620
|
+
body = _context2.sent;
|
|
7621
|
+
values = normalizeValues(body === null || body === void 0 ? void 0 : body.values);
|
|
7622
|
+
sessionId = getConfigSessionId(c);
|
|
7623
|
+
sessionError = validateConfigSessionId(sessionId);
|
|
7624
|
+
if (!sessionError) {
|
|
7625
|
+
_context2.next = 3;
|
|
7626
|
+
break;
|
|
7627
|
+
}
|
|
7628
|
+
_response5 = {
|
|
7629
|
+
success: false,
|
|
7630
|
+
message: sessionError
|
|
7631
|
+
};
|
|
7632
|
+
return _context2.abrupt("return", c.json(_response5, 200));
|
|
7633
|
+
case 3:
|
|
7634
|
+
tableName = getConfigsTableName(sessionId);
|
|
7635
|
+
supabase = getSupabase();
|
|
7636
|
+
_context2.next = 4;
|
|
7637
|
+
return supabase.from(tableName).select("values").eq("namespace", namespace).maybeSingle();
|
|
7638
|
+
case 4:
|
|
7639
|
+
_yield$supabase$from$2 = _context2.sent;
|
|
7640
|
+
existing = _yield$supabase$from$2.data;
|
|
7641
|
+
existingError = _yield$supabase$from$2.error;
|
|
7642
|
+
if (!existingError) {
|
|
7643
|
+
_context2.next = 5;
|
|
7644
|
+
break;
|
|
7645
|
+
}
|
|
7646
|
+
throw existingError;
|
|
7647
|
+
case 5:
|
|
7648
|
+
nextValues = _objectSpread(_objectSpread({}, normalizeValues(existing === null || existing === void 0 ? void 0 : existing.values)), values);
|
|
7649
|
+
_context2.next = 6;
|
|
7650
|
+
return supabase.from(tableName).upsert({
|
|
7651
|
+
namespace: namespace,
|
|
7652
|
+
values: nextValues,
|
|
7653
|
+
updated_at: new Date().toISOString()
|
|
7654
|
+
}, {
|
|
7655
|
+
onConflict: "namespace"
|
|
7656
|
+
}).select("*").single();
|
|
7657
|
+
case 6:
|
|
7658
|
+
_yield$supabase$from$3 = _context2.sent;
|
|
7659
|
+
data = _yield$supabase$from$3.data;
|
|
7660
|
+
error = _yield$supabase$from$3.error;
|
|
7661
|
+
if (!error) {
|
|
7662
|
+
_context2.next = 7;
|
|
7663
|
+
break;
|
|
7664
|
+
}
|
|
7665
|
+
throw error;
|
|
7666
|
+
case 7:
|
|
7667
|
+
response = {
|
|
7668
|
+
success: true,
|
|
7669
|
+
message: "配置保存成功",
|
|
7670
|
+
data: toConfigResponse(data, namespace)
|
|
7671
|
+
};
|
|
7672
|
+
return _context2.abrupt("return", c.json(response, 200));
|
|
7673
|
+
case 8:
|
|
7674
|
+
_context2.prev = 8;
|
|
7675
|
+
_t2 = _context2["catch"](0);
|
|
7676
|
+
console.error("保存配置失败:", _t2);
|
|
7677
|
+
_response6 = {
|
|
7678
|
+
success: false,
|
|
7679
|
+
message: "保存配置失败",
|
|
7680
|
+
error: _t2.message
|
|
7681
|
+
};
|
|
7682
|
+
return _context2.abrupt("return", c.json(_response6, 500));
|
|
7683
|
+
case 9:
|
|
7684
|
+
case "end":
|
|
7685
|
+
return _context2.stop();
|
|
7686
|
+
}
|
|
7687
|
+
}, _callee2, null, [[0, 8]]);
|
|
7688
|
+
}));
|
|
7689
|
+
return _updateConfig.apply(this, arguments);
|
|
7690
|
+
}
|
|
7691
|
+
|
|
7692
|
+
function _arrayWithoutHoles(r) {
|
|
7693
|
+
if (Array.isArray(r)) return _arrayLikeToArray$1(r);
|
|
7694
|
+
}
|
|
7695
|
+
|
|
7696
|
+
function _iterableToArray(r) {
|
|
7697
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
7698
|
+
}
|
|
7699
|
+
|
|
7700
|
+
function _nonIterableSpread() {
|
|
7701
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7702
|
+
}
|
|
7703
|
+
|
|
7704
|
+
function _toConsumableArray(r) {
|
|
7705
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread();
|
|
7706
|
+
}
|
|
7707
|
+
|
|
6933
7708
|
var AUTH_REQUIRED = "CMS_AUTH_REQUIRED";
|
|
6934
7709
|
var AUTH_INVALID = "CMS_AUTH_INVALID";
|
|
6935
7710
|
var CMS_FORBIDDEN = "CMS_FORBIDDEN";
|
|
@@ -6941,9 +7716,9 @@ function getRoleFromSupabaseUser$1(user) {
|
|
|
6941
7716
|
return appRole !== null && appRole !== void 0 ? appRole : userRole;
|
|
6942
7717
|
}
|
|
6943
7718
|
var requireJwtAuth = /*#__PURE__*/function () {
|
|
6944
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c, next) {
|
|
7719
|
+
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c, next) {
|
|
6945
7720
|
var authHeader, token, supabase, _yield$supabase$auth$, data, error, auth;
|
|
6946
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7721
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
6947
7722
|
while (1) switch (_context.prev = _context.next) {
|
|
6948
7723
|
case 0:
|
|
6949
7724
|
authHeader = c.req.header("Authorization") || null;
|
|
@@ -7005,10 +7780,10 @@ var requireJwtAuth = /*#__PURE__*/function () {
|
|
|
7005
7780
|
};
|
|
7006
7781
|
}();
|
|
7007
7782
|
var requireAdminRole = /*#__PURE__*/function () {
|
|
7008
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c, next) {
|
|
7783
|
+
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, next) {
|
|
7009
7784
|
var _user$user_metadata2;
|
|
7010
7785
|
var auth, role, sessionId, user, userSessionId, supabase, ok, isAdmin;
|
|
7011
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7786
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
7012
7787
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7013
7788
|
case 0:
|
|
7014
7789
|
auth = c.auth;
|
|
@@ -7104,9 +7879,9 @@ function supabaseLogin(_x) {
|
|
|
7104
7879
|
}
|
|
7105
7880
|
// POST - 校验 Supabase JWT(需要 Authorization: Bearer <token>)
|
|
7106
7881
|
function _supabaseLogin() {
|
|
7107
|
-
_supabaseLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(c) {
|
|
7882
|
+
_supabaseLogin = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c) {
|
|
7108
7883
|
var _body$email, _data$session, body, email, password, supabase, _yield$supabase$auth$, data, error, token, user, role, _t;
|
|
7109
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
7884
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
7110
7885
|
while (1) switch (_context.prev = _context.next) {
|
|
7111
7886
|
case 0:
|
|
7112
7887
|
_context.prev = 0;
|
|
@@ -7181,9 +7956,9 @@ function supabaseVerify(_x2) {
|
|
|
7181
7956
|
}
|
|
7182
7957
|
// GET - 当前用户(需要 Authorization: Bearer <token>)
|
|
7183
7958
|
function _supabaseVerify() {
|
|
7184
|
-
_supabaseVerify = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(c) {
|
|
7959
|
+
_supabaseVerify = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c) {
|
|
7185
7960
|
var token, supabase, _yield$supabase$auth$2, data, error, _t2;
|
|
7186
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
7961
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
7187
7962
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7188
7963
|
case 0:
|
|
7189
7964
|
_context2.prev = 0;
|
|
@@ -7238,9 +8013,9 @@ function supabaseCurrentUser(_x3) {
|
|
|
7238
8013
|
return _supabaseCurrentUser.apply(this, arguments);
|
|
7239
8014
|
}
|
|
7240
8015
|
function _supabaseCurrentUser() {
|
|
7241
|
-
_supabaseCurrentUser = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(c) {
|
|
8016
|
+
_supabaseCurrentUser = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(c) {
|
|
7242
8017
|
var token, supabase, _yield$supabase$auth$3, data, error, user, role, _t3;
|
|
7243
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
8018
|
+
return _regeneratorRuntime$1.wrap(function (_context3) {
|
|
7244
8019
|
while (1) switch (_context3.prev = _context3.next) {
|
|
7245
8020
|
case 0:
|
|
7246
8021
|
_context3.prev = 0;
|
|
@@ -7298,64 +8073,128 @@ function _supabaseCurrentUser() {
|
|
|
7298
8073
|
return _supabaseCurrentUser.apply(this, arguments);
|
|
7299
8074
|
}
|
|
7300
8075
|
|
|
8076
|
+
function isSkipAuthRequest(c) {
|
|
8077
|
+
return c.req.header("X-CMS-Skip-Auth") === "true";
|
|
8078
|
+
}
|
|
8079
|
+
function withAdmin() {
|
|
8080
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8081
|
+
if (!options.skipAuth) {
|
|
8082
|
+
return [requireJwtAuth, requireAdminRole];
|
|
8083
|
+
}
|
|
8084
|
+
// 路由免鉴权
|
|
8085
|
+
return [(/*#__PURE__*/function () {
|
|
8086
|
+
var _ref = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(c, next) {
|
|
8087
|
+
return _regeneratorRuntime$1.wrap(function (_context) {
|
|
8088
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8089
|
+
case 0:
|
|
8090
|
+
if (!isSkipAuthRequest(c)) {
|
|
8091
|
+
_context.next = 2;
|
|
8092
|
+
break;
|
|
8093
|
+
}
|
|
8094
|
+
_context.next = 1;
|
|
8095
|
+
return next();
|
|
8096
|
+
case 1:
|
|
8097
|
+
return _context.abrupt("return");
|
|
8098
|
+
case 2:
|
|
8099
|
+
_context.next = 3;
|
|
8100
|
+
return requireJwtAuth(c, next);
|
|
8101
|
+
case 3:
|
|
8102
|
+
case "end":
|
|
8103
|
+
return _context.stop();
|
|
8104
|
+
}
|
|
8105
|
+
}, _callee);
|
|
8106
|
+
}));
|
|
8107
|
+
return function (_x, _x2) {
|
|
8108
|
+
return _ref.apply(this, arguments);
|
|
8109
|
+
};
|
|
8110
|
+
}()), (/*#__PURE__*/function () {
|
|
8111
|
+
var _ref2 = _asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(c, next) {
|
|
8112
|
+
return _regeneratorRuntime$1.wrap(function (_context2) {
|
|
8113
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8114
|
+
case 0:
|
|
8115
|
+
if (!isSkipAuthRequest(c)) {
|
|
8116
|
+
_context2.next = 2;
|
|
8117
|
+
break;
|
|
8118
|
+
}
|
|
8119
|
+
_context2.next = 1;
|
|
8120
|
+
return next();
|
|
8121
|
+
case 1:
|
|
8122
|
+
return _context2.abrupt("return");
|
|
8123
|
+
case 2:
|
|
8124
|
+
_context2.next = 3;
|
|
8125
|
+
return requireAdminRole(c, next);
|
|
8126
|
+
case 3:
|
|
8127
|
+
case "end":
|
|
8128
|
+
return _context2.stop();
|
|
8129
|
+
}
|
|
8130
|
+
}, _callee2);
|
|
8131
|
+
}));
|
|
8132
|
+
return function (_x3, _x4) {
|
|
8133
|
+
return _ref2.apply(this, arguments);
|
|
8134
|
+
};
|
|
8135
|
+
}())];
|
|
8136
|
+
}
|
|
7301
8137
|
// 创建模型路由处理器
|
|
7302
8138
|
function createModelRoute(app) {
|
|
8139
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7303
8140
|
// CMS 管理接口:要求登录 + admin 权限(兼容 Supabase Auth JWT / 旧 CMS JWT)
|
|
7304
|
-
app.get("/models",
|
|
7305
|
-
app.post("/models",
|
|
7306
|
-
app.put("/models",
|
|
7307
|
-
app["delete"]("/models",
|
|
8141
|
+
app.get.apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [getModels]));
|
|
8142
|
+
app.post.apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [createModel]));
|
|
8143
|
+
app.put.apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [updateModel]));
|
|
8144
|
+
app["delete"].apply(app, ["/models"].concat(_toConsumableArray(withAdmin(options)), [deleteModel]));
|
|
7308
8145
|
return app;
|
|
7309
8146
|
}
|
|
7310
8147
|
// 创建数据表路由处理器(固定表名)
|
|
7311
8148
|
function createDataRoute(app, tableName) {
|
|
7312
|
-
|
|
8149
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
8150
|
+
app.get.apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7313
8151
|
return getTableData(c, tableName);
|
|
7314
|
-
});
|
|
7315
|
-
app.post("/data/".concat(tableName),
|
|
8152
|
+
}]));
|
|
8153
|
+
app.post.apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7316
8154
|
return createTableData(c, tableName);
|
|
7317
|
-
});
|
|
7318
|
-
app.put("/data/".concat(tableName),
|
|
8155
|
+
}]));
|
|
8156
|
+
app.put.apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7319
8157
|
return updateTableData(c, tableName);
|
|
7320
|
-
});
|
|
7321
|
-
app["delete"]("/data/".concat(tableName),
|
|
8158
|
+
}]));
|
|
8159
|
+
app["delete"].apply(app, ["/data/".concat(tableName)].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
7322
8160
|
return deleteTableData(c, tableName);
|
|
7323
|
-
});
|
|
8161
|
+
}]));
|
|
7324
8162
|
return app;
|
|
7325
8163
|
}
|
|
7326
8164
|
// 动态创建数据表路由处理器(从URL参数获取表名)
|
|
7327
8165
|
function createDynamicDataRoute(app) {
|
|
8166
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7328
8167
|
// 获取关联表选项(放在 :tableName 路由之前,避免被匹配)
|
|
7329
|
-
app.get("/relation/:tableName/options",
|
|
7330
|
-
var tableName = c.req.param("tableName");
|
|
8168
|
+
app.get.apply(app, ["/relation/:tableName/options"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8169
|
+
var tableName = c.req.param("tableName") || "";
|
|
7331
8170
|
return getRelationOptions(c, tableName);
|
|
7332
|
-
});
|
|
8171
|
+
}]));
|
|
7333
8172
|
// 获取带关联数据的表数据
|
|
7334
|
-
app.get("/data/:tableName/with-relations",
|
|
7335
|
-
var tableName = c.req.param("tableName");
|
|
8173
|
+
app.get.apply(app, ["/data/:tableName/with-relations"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8174
|
+
var tableName = c.req.param("tableName") || "";
|
|
7336
8175
|
return getTableDataWithRelations(c, tableName);
|
|
7337
|
-
});
|
|
7338
|
-
app.get("/data/:tableName",
|
|
7339
|
-
var tableName = c.req.param("tableName");
|
|
8176
|
+
}]));
|
|
8177
|
+
app.get.apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8178
|
+
var tableName = c.req.param("tableName") || "";
|
|
7340
8179
|
return getTableData(c, tableName);
|
|
7341
|
-
});
|
|
7342
|
-
app.post("/data/:tableName",
|
|
7343
|
-
var tableName = c.req.param("tableName");
|
|
8180
|
+
}]));
|
|
8181
|
+
app.post.apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8182
|
+
var tableName = c.req.param("tableName") || "";
|
|
7344
8183
|
return createTableData(c, tableName);
|
|
7345
|
-
});
|
|
7346
|
-
app.put("/data/:tableName",
|
|
7347
|
-
var tableName = c.req.param("tableName");
|
|
8184
|
+
}]));
|
|
8185
|
+
app.put.apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8186
|
+
var tableName = c.req.param("tableName") || "";
|
|
7348
8187
|
return updateTableData(c, tableName);
|
|
7349
|
-
});
|
|
7350
|
-
app["delete"]("/data/:tableName",
|
|
7351
|
-
var tableName = c.req.param("tableName");
|
|
8188
|
+
}]));
|
|
8189
|
+
app["delete"].apply(app, ["/data/:tableName"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8190
|
+
var tableName = c.req.param("tableName") || "";
|
|
7352
8191
|
return deleteTableData(c, tableName);
|
|
7353
|
-
});
|
|
8192
|
+
}]));
|
|
7354
8193
|
// 删除表的所有外键约束(用于解决外键引用错误表的问题)
|
|
7355
|
-
app["delete"]("/data/:tableName/foreign-keys",
|
|
7356
|
-
var tableName = c.req.param("tableName");
|
|
8194
|
+
app["delete"].apply(app, ["/data/:tableName/foreign-keys"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8195
|
+
var tableName = c.req.param("tableName") || "";
|
|
7357
8196
|
return dropForeignKeys(c, tableName);
|
|
7358
|
-
});
|
|
8197
|
+
}]));
|
|
7359
8198
|
return app;
|
|
7360
8199
|
}
|
|
7361
8200
|
// 动态创建认证路由处理器(从URL参数获取表名)
|
|
@@ -7438,13 +8277,24 @@ function createAuthRoute(app, tableName) {
|
|
|
7438
8277
|
return app;
|
|
7439
8278
|
}
|
|
7440
8279
|
function createOssUploadRoute(app) {
|
|
7441
|
-
|
|
8280
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8281
|
+
app.post.apply(app, ["/upload"].concat(_toConsumableArray(withAdmin(options)), [uploadToOss]));
|
|
8282
|
+
return app;
|
|
8283
|
+
}
|
|
8284
|
+
function createConfigRoute(app) {
|
|
8285
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8286
|
+
app.get.apply(app, ["/configs"].concat(_toConsumableArray(withAdmin(options)), [getConfig]));
|
|
8287
|
+
app.put.apply(app, ["/configs/:namespace"].concat(_toConsumableArray(withAdmin(options)), [function (c) {
|
|
8288
|
+
return updateConfig(c);
|
|
8289
|
+
}]));
|
|
7442
8290
|
return app;
|
|
7443
8291
|
}
|
|
7444
8292
|
// 一键创建所有CMS路由
|
|
7445
8293
|
function createCmsRoutes(app) {
|
|
7446
|
-
|
|
7447
|
-
|
|
8294
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8295
|
+
createModelRoute(app, options);
|
|
8296
|
+
createConfigRoute(app, options);
|
|
8297
|
+
createDynamicDataRoute(app, options);
|
|
7448
8298
|
createDynamicAuthRoute(app);
|
|
7449
8299
|
return app;
|
|
7450
8300
|
}
|
|
@@ -7459,6 +8309,7 @@ exports.closeDatabase = closeSupabase;
|
|
|
7459
8309
|
exports.closeSupabase = closeSupabase;
|
|
7460
8310
|
exports.createAuthRoute = createAuthRoute;
|
|
7461
8311
|
exports.createCmsRoutes = createCmsRoutes;
|
|
8312
|
+
exports.createConfigRoute = createConfigRoute;
|
|
7462
8313
|
exports.createDataRoute = createDataRoute;
|
|
7463
8314
|
exports.createDynamicAuthRoute = createDynamicAuthRoute;
|
|
7464
8315
|
exports.createDynamicDataRoute = createDynamicDataRoute;
|
|
@@ -7474,6 +8325,7 @@ exports.feishuAlertConfig = feishuAlertConfig;
|
|
|
7474
8325
|
exports.forgotPassword = forgotPassword;
|
|
7475
8326
|
exports.getAuthService = getAuthService;
|
|
7476
8327
|
exports.getCmsModelService = getCmsModelService;
|
|
8328
|
+
exports.getConfig = getConfig;
|
|
7477
8329
|
exports.getCurrentUser = getCurrentUser;
|
|
7478
8330
|
exports.getDatabase = getSupabase;
|
|
7479
8331
|
exports.getDynamicTableService = getDynamicTableService;
|
|
@@ -7498,6 +8350,7 @@ exports.signup = signup;
|
|
|
7498
8350
|
exports.signupStatus = signupStatus;
|
|
7499
8351
|
exports.syncDatabase = initializeCmsSystem;
|
|
7500
8352
|
exports.testConnection = testConnection;
|
|
8353
|
+
exports.updateConfig = updateConfig;
|
|
7501
8354
|
exports.updateModel = updateModel;
|
|
7502
8355
|
exports.updateTableData = updateTableData;
|
|
7503
8356
|
exports.uploadToOss = uploadToOss;
|