@plasmicpkgs/plasmic-cms 0.0.138 → 0.0.140
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/plasmic-cms.cjs.development.js +138 -395
- package/dist/plasmic-cms.cjs.development.js.map +1 -1
- package/dist/plasmic-cms.cjs.production.min.js +1 -1
- package/dist/plasmic-cms.cjs.production.min.js.map +1 -1
- package/dist/plasmic-cms.esm.js +138 -395
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/plasmic-cms.esm.js
CHANGED
|
@@ -13,80 +13,64 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
13
13
|
reject(error);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
if (info.done) {
|
|
18
17
|
resolve(value);
|
|
19
18
|
} else {
|
|
20
19
|
Promise.resolve(value).then(_next, _throw);
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
function _asyncToGenerator(fn) {
|
|
25
23
|
return function () {
|
|
26
24
|
var self = this,
|
|
27
|
-
|
|
25
|
+
args = arguments;
|
|
28
26
|
return new Promise(function (resolve, reject) {
|
|
29
27
|
var gen = fn.apply(self, args);
|
|
30
|
-
|
|
31
28
|
function _next(value) {
|
|
32
29
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
function _throw(err) {
|
|
36
32
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
_next(undefined);
|
|
40
35
|
});
|
|
41
36
|
};
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
function _extends() {
|
|
45
|
-
_extends = Object.assign
|
|
39
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
46
40
|
for (var i = 1; i < arguments.length; i++) {
|
|
47
41
|
var source = arguments[i];
|
|
48
|
-
|
|
49
42
|
for (var key in source) {
|
|
50
43
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
51
44
|
target[key] = source[key];
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
|
-
|
|
56
48
|
return target;
|
|
57
49
|
};
|
|
58
|
-
|
|
59
50
|
return _extends.apply(this, arguments);
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
function _inheritsLoose(subClass, superClass) {
|
|
63
53
|
subClass.prototype = Object.create(superClass.prototype);
|
|
64
54
|
subClass.prototype.constructor = subClass;
|
|
65
|
-
|
|
66
55
|
_setPrototypeOf(subClass, superClass);
|
|
67
56
|
}
|
|
68
|
-
|
|
69
57
|
function _getPrototypeOf(o) {
|
|
70
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
58
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
71
59
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
72
60
|
};
|
|
73
61
|
return _getPrototypeOf(o);
|
|
74
62
|
}
|
|
75
|
-
|
|
76
63
|
function _setPrototypeOf(o, p) {
|
|
77
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
64
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
78
65
|
o.__proto__ = p;
|
|
79
66
|
return o;
|
|
80
67
|
};
|
|
81
|
-
|
|
82
68
|
return _setPrototypeOf(o, p);
|
|
83
69
|
}
|
|
84
|
-
|
|
85
70
|
function _isNativeReflectConstruct() {
|
|
86
71
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
87
72
|
if (Reflect.construct.sham) return false;
|
|
88
73
|
if (typeof Proxy === "function") return true;
|
|
89
|
-
|
|
90
74
|
try {
|
|
91
75
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
92
76
|
return true;
|
|
@@ -94,10 +78,9 @@ function _isNativeReflectConstruct() {
|
|
|
94
78
|
return false;
|
|
95
79
|
}
|
|
96
80
|
}
|
|
97
|
-
|
|
98
81
|
function _construct(Parent, args, Class) {
|
|
99
82
|
if (_isNativeReflectConstruct()) {
|
|
100
|
-
_construct = Reflect.construct;
|
|
83
|
+
_construct = Reflect.construct.bind();
|
|
101
84
|
} else {
|
|
102
85
|
_construct = function _construct(Parent, args, Class) {
|
|
103
86
|
var a = [null];
|
|
@@ -108,34 +91,25 @@ function _construct(Parent, args, Class) {
|
|
|
108
91
|
return instance;
|
|
109
92
|
};
|
|
110
93
|
}
|
|
111
|
-
|
|
112
94
|
return _construct.apply(null, arguments);
|
|
113
95
|
}
|
|
114
|
-
|
|
115
96
|
function _isNativeFunction(fn) {
|
|
116
97
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
117
98
|
}
|
|
118
|
-
|
|
119
99
|
function _wrapNativeSuper(Class) {
|
|
120
100
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
121
|
-
|
|
122
101
|
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
123
102
|
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
124
|
-
|
|
125
103
|
if (typeof Class !== "function") {
|
|
126
104
|
throw new TypeError("Super expression must either be null or a function");
|
|
127
105
|
}
|
|
128
|
-
|
|
129
106
|
if (typeof _cache !== "undefined") {
|
|
130
107
|
if (_cache.has(Class)) return _cache.get(Class);
|
|
131
|
-
|
|
132
108
|
_cache.set(Class, Wrapper);
|
|
133
109
|
}
|
|
134
|
-
|
|
135
110
|
function Wrapper() {
|
|
136
111
|
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
137
112
|
}
|
|
138
|
-
|
|
139
113
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
140
114
|
constructor: {
|
|
141
115
|
value: Wrapper,
|
|
@@ -146,22 +120,18 @@ function _wrapNativeSuper(Class) {
|
|
|
146
120
|
});
|
|
147
121
|
return _setPrototypeOf(Wrapper, Class);
|
|
148
122
|
};
|
|
149
|
-
|
|
150
123
|
return _wrapNativeSuper(Class);
|
|
151
124
|
}
|
|
152
|
-
|
|
153
125
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
154
126
|
if (source == null) return {};
|
|
155
127
|
var target = {};
|
|
156
128
|
var sourceKeys = Object.keys(source);
|
|
157
129
|
var key, i;
|
|
158
|
-
|
|
159
130
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
160
131
|
key = sourceKeys[i];
|
|
161
132
|
if (excluded.indexOf(key) >= 0) continue;
|
|
162
133
|
target[key] = source[key];
|
|
163
134
|
}
|
|
164
|
-
|
|
165
135
|
return target;
|
|
166
136
|
}
|
|
167
137
|
|
|
@@ -176,17 +146,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
176
146
|
* This source code is licensed under the MIT license found in the
|
|
177
147
|
* LICENSE file in the root directory of this source tree.
|
|
178
148
|
*/
|
|
149
|
+
|
|
179
150
|
var runtime = function (exports) {
|
|
180
151
|
|
|
181
152
|
var Op = Object.prototype;
|
|
182
153
|
var hasOwn = Op.hasOwnProperty;
|
|
183
154
|
var undefined$1; // More compressible than void 0.
|
|
184
|
-
|
|
185
155
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
186
156
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
187
157
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
188
158
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
189
|
-
|
|
190
159
|
function define(obj, key, value) {
|
|
191
160
|
Object.defineProperty(obj, key, {
|
|
192
161
|
value: value,
|
|
@@ -196,7 +165,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
196
165
|
});
|
|
197
166
|
return obj[key];
|
|
198
167
|
}
|
|
199
|
-
|
|
200
168
|
try {
|
|
201
169
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
202
170
|
define({}, "");
|
|
@@ -205,19 +173,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
205
173
|
return obj[key] = value;
|
|
206
174
|
};
|
|
207
175
|
}
|
|
208
|
-
|
|
209
176
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
210
177
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
211
178
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
212
179
|
var generator = Object.create(protoGenerator.prototype);
|
|
213
|
-
var context = new Context(tryLocsList || []);
|
|
214
|
-
// .throw, and .return methods.
|
|
180
|
+
var context = new Context(tryLocsList || []);
|
|
215
181
|
|
|
182
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
183
|
+
// .throw, and .return methods.
|
|
216
184
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
217
185
|
return generator;
|
|
218
186
|
}
|
|
187
|
+
exports.wrap = wrap;
|
|
219
188
|
|
|
220
|
-
|
|
189
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
221
190
|
// record like context.tryEntries[i].completion. This interface could
|
|
222
191
|
// have been (and was previously) designed to take a closure to be
|
|
223
192
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -227,7 +196,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
227
196
|
// in every case, so we don't have to touch the arguments object. The
|
|
228
197
|
// only additional allocation required is the completion record, which
|
|
229
198
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
230
|
-
|
|
231
199
|
function tryCatch(fn, obj, arg) {
|
|
232
200
|
try {
|
|
233
201
|
return {
|
|
@@ -241,46 +209,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
241
209
|
};
|
|
242
210
|
}
|
|
243
211
|
}
|
|
244
|
-
|
|
245
212
|
var GenStateSuspendedStart = "suspendedStart";
|
|
246
213
|
var GenStateSuspendedYield = "suspendedYield";
|
|
247
214
|
var GenStateExecuting = "executing";
|
|
248
|
-
var GenStateCompleted = "completed";
|
|
215
|
+
var GenStateCompleted = "completed";
|
|
216
|
+
|
|
217
|
+
// Returning this object from the innerFn has the same effect as
|
|
249
218
|
// breaking out of the dispatch switch statement.
|
|
219
|
+
var ContinueSentinel = {};
|
|
250
220
|
|
|
251
|
-
|
|
221
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
252
222
|
// .constructor.prototype properties for functions that return Generator
|
|
253
223
|
// objects. For full spec compliance, you may wish to configure your
|
|
254
224
|
// minifier not to mangle the names of these two functions.
|
|
255
|
-
|
|
256
225
|
function Generator() {}
|
|
257
|
-
|
|
258
226
|
function GeneratorFunction() {}
|
|
227
|
+
function GeneratorFunctionPrototype() {}
|
|
259
228
|
|
|
260
|
-
|
|
229
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
261
230
|
// don't natively support it.
|
|
262
|
-
|
|
263
|
-
|
|
264
231
|
var IteratorPrototype = {};
|
|
265
232
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
266
233
|
return this;
|
|
267
234
|
});
|
|
268
235
|
var getProto = Object.getPrototypeOf;
|
|
269
236
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
270
|
-
|
|
271
237
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
272
238
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
273
239
|
// of the polyfill.
|
|
274
240
|
IteratorPrototype = NativeIteratorPrototype;
|
|
275
241
|
}
|
|
276
|
-
|
|
277
242
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
278
243
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
279
244
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
280
245
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
281
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
282
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
246
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
283
247
|
|
|
248
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
249
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
284
250
|
function defineIteratorMethods(prototype) {
|
|
285
251
|
["next", "throw", "return"].forEach(function (method) {
|
|
286
252
|
define(prototype, method, function (arg) {
|
|
@@ -288,14 +254,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
288
254
|
});
|
|
289
255
|
});
|
|
290
256
|
}
|
|
291
|
-
|
|
292
257
|
exports.isGeneratorFunction = function (genFun) {
|
|
293
258
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
294
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
259
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
260
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
295
261
|
// do is to check its .name property.
|
|
296
262
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
297
263
|
};
|
|
298
|
-
|
|
299
264
|
exports.mark = function (genFun) {
|
|
300
265
|
if (Object.setPrototypeOf) {
|
|
301
266
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -303,31 +268,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
303
268
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
304
269
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
305
270
|
}
|
|
306
|
-
|
|
307
271
|
genFun.prototype = Object.create(Gp);
|
|
308
272
|
return genFun;
|
|
309
|
-
};
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Within the body of any async function, `await x` is transformed to
|
|
310
276
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
311
277
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
312
278
|
// meant to be awaited.
|
|
313
|
-
|
|
314
|
-
|
|
315
279
|
exports.awrap = function (arg) {
|
|
316
280
|
return {
|
|
317
281
|
__await: arg
|
|
318
282
|
};
|
|
319
283
|
};
|
|
320
|
-
|
|
321
284
|
function AsyncIterator(generator, PromiseImpl) {
|
|
322
285
|
function invoke(method, arg, resolve, reject) {
|
|
323
286
|
var record = tryCatch(generator[method], generator, arg);
|
|
324
|
-
|
|
325
287
|
if (record.type === "throw") {
|
|
326
288
|
reject(record.arg);
|
|
327
289
|
} else {
|
|
328
290
|
var result = record.arg;
|
|
329
291
|
var value = result.value;
|
|
330
|
-
|
|
331
292
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
332
293
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
333
294
|
invoke("next", value, resolve, reject);
|
|
@@ -335,7 +296,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
335
296
|
invoke("throw", err, resolve, reject);
|
|
336
297
|
});
|
|
337
298
|
}
|
|
338
|
-
|
|
339
299
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
340
300
|
// When a yielded Promise is resolved, its final value becomes
|
|
341
301
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -349,17 +309,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
349
309
|
});
|
|
350
310
|
}
|
|
351
311
|
}
|
|
352
|
-
|
|
353
312
|
var previousPromise;
|
|
354
|
-
|
|
355
313
|
function enqueue(method, arg) {
|
|
356
314
|
function callInvokeWithMethodAndArg() {
|
|
357
315
|
return new PromiseImpl(function (resolve, reject) {
|
|
358
316
|
invoke(method, arg, resolve, reject);
|
|
359
317
|
});
|
|
360
318
|
}
|
|
361
|
-
|
|
362
|
-
|
|
319
|
+
return previousPromise =
|
|
320
|
+
// If enqueue has been called before, then we want to wait until
|
|
363
321
|
// all previous Promises have been resolved before calling invoke,
|
|
364
322
|
// so that results are always delivered in the correct order. If
|
|
365
323
|
// enqueue has not been called before, then it is important to
|
|
@@ -371,24 +329,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
371
329
|
// execute code before the first await. Since we implement simple
|
|
372
330
|
// async functions in terms of async generators, it is especially
|
|
373
331
|
// important to get this right, even though it requires care.
|
|
374
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
332
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
333
|
+
// Avoid propagating failures to Promises returned by later
|
|
375
334
|
// invocations of the iterator.
|
|
376
335
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
377
|
-
}
|
|
378
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
379
|
-
|
|
336
|
+
}
|
|
380
337
|
|
|
338
|
+
// Define the unified helper method that is used to implement .next,
|
|
339
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
381
340
|
this._invoke = enqueue;
|
|
382
341
|
}
|
|
383
|
-
|
|
384
342
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
385
343
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
386
344
|
return this;
|
|
387
345
|
});
|
|
388
|
-
exports.AsyncIterator = AsyncIterator;
|
|
346
|
+
exports.AsyncIterator = AsyncIterator;
|
|
347
|
+
|
|
348
|
+
// Note that simple async functions are implemented on top of
|
|
389
349
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
390
350
|
// the final result produced by the iterator.
|
|
391
|
-
|
|
392
351
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
393
352
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
394
353
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -397,39 +356,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
397
356
|
return result.done ? result.value : iter.next();
|
|
398
357
|
});
|
|
399
358
|
};
|
|
400
|
-
|
|
401
359
|
function makeInvokeMethod(innerFn, self, context) {
|
|
402
360
|
var state = GenStateSuspendedStart;
|
|
403
361
|
return function invoke(method, arg) {
|
|
404
362
|
if (state === GenStateExecuting) {
|
|
405
363
|
throw new Error("Generator is already running");
|
|
406
364
|
}
|
|
407
|
-
|
|
408
365
|
if (state === GenStateCompleted) {
|
|
409
366
|
if (method === "throw") {
|
|
410
367
|
throw arg;
|
|
411
|
-
}
|
|
412
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
413
|
-
|
|
368
|
+
}
|
|
414
369
|
|
|
370
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
371
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
415
372
|
return doneResult();
|
|
416
373
|
}
|
|
417
|
-
|
|
418
374
|
context.method = method;
|
|
419
375
|
context.arg = arg;
|
|
420
|
-
|
|
421
376
|
while (true) {
|
|
422
377
|
var delegate = context.delegate;
|
|
423
|
-
|
|
424
378
|
if (delegate) {
|
|
425
379
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
426
|
-
|
|
427
380
|
if (delegateResult) {
|
|
428
381
|
if (delegateResult === ContinueSentinel) continue;
|
|
429
382
|
return delegateResult;
|
|
430
383
|
}
|
|
431
384
|
}
|
|
432
|
-
|
|
433
385
|
if (context.method === "next") {
|
|
434
386
|
// Setting context._sent for legacy support of Babel's
|
|
435
387
|
// function.sent implementation.
|
|
@@ -439,51 +391,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
439
391
|
state = GenStateCompleted;
|
|
440
392
|
throw context.arg;
|
|
441
393
|
}
|
|
442
|
-
|
|
443
394
|
context.dispatchException(context.arg);
|
|
444
395
|
} else if (context.method === "return") {
|
|
445
396
|
context.abrupt("return", context.arg);
|
|
446
397
|
}
|
|
447
|
-
|
|
448
398
|
state = GenStateExecuting;
|
|
449
399
|
var record = tryCatch(innerFn, self, context);
|
|
450
|
-
|
|
451
400
|
if (record.type === "normal") {
|
|
452
401
|
// If an exception is thrown from innerFn, we leave state ===
|
|
453
402
|
// GenStateExecuting and loop back for another invocation.
|
|
454
403
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
455
|
-
|
|
456
404
|
if (record.arg === ContinueSentinel) {
|
|
457
405
|
continue;
|
|
458
406
|
}
|
|
459
|
-
|
|
460
407
|
return {
|
|
461
408
|
value: record.arg,
|
|
462
409
|
done: context.done
|
|
463
410
|
};
|
|
464
411
|
} else if (record.type === "throw") {
|
|
465
|
-
state = GenStateCompleted;
|
|
412
|
+
state = GenStateCompleted;
|
|
413
|
+
// Dispatch the exception by looping back around to the
|
|
466
414
|
// context.dispatchException(context.arg) call above.
|
|
467
|
-
|
|
468
415
|
context.method = "throw";
|
|
469
416
|
context.arg = record.arg;
|
|
470
417
|
}
|
|
471
418
|
}
|
|
472
419
|
};
|
|
473
|
-
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
474
423
|
// result, either by returning a { value, done } result from the
|
|
475
424
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
476
425
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
477
|
-
|
|
478
|
-
|
|
479
426
|
function maybeInvokeDelegate(delegate, context) {
|
|
480
427
|
var method = delegate.iterator[context.method];
|
|
481
|
-
|
|
482
428
|
if (method === undefined$1) {
|
|
483
429
|
// A .throw or .return when the delegate iterator has no .throw
|
|
484
430
|
// method always terminates the yield* loop.
|
|
485
431
|
context.delegate = null;
|
|
486
|
-
|
|
487
432
|
if (context.method === "throw") {
|
|
488
433
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
489
434
|
if (delegate.iterator["return"]) {
|
|
@@ -492,51 +437,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
492
437
|
context.method = "return";
|
|
493
438
|
context.arg = undefined$1;
|
|
494
439
|
maybeInvokeDelegate(delegate, context);
|
|
495
|
-
|
|
496
440
|
if (context.method === "throw") {
|
|
497
441
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
498
442
|
// "return" to "throw", let that override the TypeError below.
|
|
499
443
|
return ContinueSentinel;
|
|
500
444
|
}
|
|
501
445
|
}
|
|
502
|
-
|
|
503
446
|
context.method = "throw";
|
|
504
447
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
505
448
|
}
|
|
506
|
-
|
|
507
449
|
return ContinueSentinel;
|
|
508
450
|
}
|
|
509
|
-
|
|
510
451
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
511
|
-
|
|
512
452
|
if (record.type === "throw") {
|
|
513
453
|
context.method = "throw";
|
|
514
454
|
context.arg = record.arg;
|
|
515
455
|
context.delegate = null;
|
|
516
456
|
return ContinueSentinel;
|
|
517
457
|
}
|
|
518
|
-
|
|
519
458
|
var info = record.arg;
|
|
520
|
-
|
|
521
459
|
if (!info) {
|
|
522
460
|
context.method = "throw";
|
|
523
461
|
context.arg = new TypeError("iterator result is not an object");
|
|
524
462
|
context.delegate = null;
|
|
525
463
|
return ContinueSentinel;
|
|
526
464
|
}
|
|
527
|
-
|
|
528
465
|
if (info.done) {
|
|
529
466
|
// Assign the result of the finished delegate to the temporary
|
|
530
467
|
// variable specified by delegate.resultName (see delegateYield).
|
|
531
|
-
context[delegate.resultName] = info.value;
|
|
468
|
+
context[delegate.resultName] = info.value;
|
|
469
|
+
|
|
470
|
+
// Resume execution at the desired location (see delegateYield).
|
|
471
|
+
context.next = delegate.nextLoc;
|
|
532
472
|
|
|
533
|
-
|
|
473
|
+
// If context.method was "throw" but the delegate handled the
|
|
534
474
|
// exception, let the outer generator proceed normally. If
|
|
535
475
|
// context.method was "next", forget context.arg since it has been
|
|
536
476
|
// "consumed" by the delegate iterator. If context.method was
|
|
537
477
|
// "return", allow the original .return call to continue in the
|
|
538
478
|
// outer generator.
|
|
539
|
-
|
|
540
479
|
if (context.method !== "return") {
|
|
541
480
|
context.method = "next";
|
|
542
481
|
context.arg = undefined$1;
|
|
@@ -544,54 +483,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
544
483
|
} else {
|
|
545
484
|
// Re-yield the result returned by the delegate method.
|
|
546
485
|
return info;
|
|
547
|
-
}
|
|
548
|
-
// the outer generator.
|
|
549
|
-
|
|
486
|
+
}
|
|
550
487
|
|
|
488
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
489
|
+
// the outer generator.
|
|
551
490
|
context.delegate = null;
|
|
552
491
|
return ContinueSentinel;
|
|
553
|
-
}
|
|
554
|
-
// unified ._invoke helper method.
|
|
555
|
-
|
|
492
|
+
}
|
|
556
493
|
|
|
494
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
495
|
+
// unified ._invoke helper method.
|
|
557
496
|
defineIteratorMethods(Gp);
|
|
558
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
497
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
498
|
+
|
|
499
|
+
// A Generator should always return itself as the iterator object when the
|
|
559
500
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
560
501
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
561
502
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
562
503
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
563
|
-
|
|
564
504
|
define(Gp, iteratorSymbol, function () {
|
|
565
505
|
return this;
|
|
566
506
|
});
|
|
567
507
|
define(Gp, "toString", function () {
|
|
568
508
|
return "[object Generator]";
|
|
569
509
|
});
|
|
570
|
-
|
|
571
510
|
function pushTryEntry(locs) {
|
|
572
511
|
var entry = {
|
|
573
512
|
tryLoc: locs[0]
|
|
574
513
|
};
|
|
575
|
-
|
|
576
514
|
if (1 in locs) {
|
|
577
515
|
entry.catchLoc = locs[1];
|
|
578
516
|
}
|
|
579
|
-
|
|
580
517
|
if (2 in locs) {
|
|
581
518
|
entry.finallyLoc = locs[2];
|
|
582
519
|
entry.afterLoc = locs[3];
|
|
583
520
|
}
|
|
584
|
-
|
|
585
521
|
this.tryEntries.push(entry);
|
|
586
522
|
}
|
|
587
|
-
|
|
588
523
|
function resetTryEntry(entry) {
|
|
589
524
|
var record = entry.completion || {};
|
|
590
525
|
record.type = "normal";
|
|
591
526
|
delete record.arg;
|
|
592
527
|
entry.completion = record;
|
|
593
528
|
}
|
|
594
|
-
|
|
595
529
|
function Context(tryLocsList) {
|
|
596
530
|
// The root entry object (effectively a try statement without a catch
|
|
597
531
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -602,97 +536,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
602
536
|
tryLocsList.forEach(pushTryEntry, this);
|
|
603
537
|
this.reset(true);
|
|
604
538
|
}
|
|
605
|
-
|
|
606
539
|
exports.keys = function (object) {
|
|
607
540
|
var keys = [];
|
|
608
|
-
|
|
609
541
|
for (var key in object) {
|
|
610
542
|
keys.push(key);
|
|
611
543
|
}
|
|
544
|
+
keys.reverse();
|
|
612
545
|
|
|
613
|
-
|
|
546
|
+
// Rather than returning an object with a next method, we keep
|
|
614
547
|
// things simple and return the next function itself.
|
|
615
|
-
|
|
616
548
|
return function next() {
|
|
617
549
|
while (keys.length) {
|
|
618
550
|
var key = keys.pop();
|
|
619
|
-
|
|
620
551
|
if (key in object) {
|
|
621
552
|
next.value = key;
|
|
622
553
|
next.done = false;
|
|
623
554
|
return next;
|
|
624
555
|
}
|
|
625
|
-
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// To avoid creating an additional object, we just hang the .value
|
|
626
559
|
// and .done properties off the next function object itself. This
|
|
627
560
|
// also ensures that the minifier will not anonymize the function.
|
|
628
|
-
|
|
629
|
-
|
|
630
561
|
next.done = true;
|
|
631
562
|
return next;
|
|
632
563
|
};
|
|
633
564
|
};
|
|
634
|
-
|
|
635
565
|
function values(iterable) {
|
|
636
566
|
if (iterable) {
|
|
637
567
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
638
|
-
|
|
639
568
|
if (iteratorMethod) {
|
|
640
569
|
return iteratorMethod.call(iterable);
|
|
641
570
|
}
|
|
642
|
-
|
|
643
571
|
if (typeof iterable.next === "function") {
|
|
644
572
|
return iterable;
|
|
645
573
|
}
|
|
646
|
-
|
|
647
574
|
if (!isNaN(iterable.length)) {
|
|
648
575
|
var i = -1,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
576
|
+
next = function next() {
|
|
577
|
+
while (++i < iterable.length) {
|
|
578
|
+
if (hasOwn.call(iterable, i)) {
|
|
579
|
+
next.value = iterable[i];
|
|
580
|
+
next.done = false;
|
|
581
|
+
return next;
|
|
582
|
+
}
|
|
655
583
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return next;
|
|
661
|
-
};
|
|
662
|
-
|
|
584
|
+
next.value = undefined$1;
|
|
585
|
+
next.done = true;
|
|
586
|
+
return next;
|
|
587
|
+
};
|
|
663
588
|
return next.next = next;
|
|
664
589
|
}
|
|
665
|
-
}
|
|
666
|
-
|
|
590
|
+
}
|
|
667
591
|
|
|
592
|
+
// Return an iterator with no values.
|
|
668
593
|
return {
|
|
669
594
|
next: doneResult
|
|
670
595
|
};
|
|
671
596
|
}
|
|
672
|
-
|
|
673
597
|
exports.values = values;
|
|
674
|
-
|
|
675
598
|
function doneResult() {
|
|
676
599
|
return {
|
|
677
600
|
value: undefined$1,
|
|
678
601
|
done: true
|
|
679
602
|
};
|
|
680
603
|
}
|
|
681
|
-
|
|
682
604
|
Context.prototype = {
|
|
683
605
|
constructor: Context,
|
|
684
606
|
reset: function reset(skipTempReset) {
|
|
685
607
|
this.prev = 0;
|
|
686
|
-
this.next = 0;
|
|
608
|
+
this.next = 0;
|
|
609
|
+
// Resetting context._sent for legacy support of Babel's
|
|
687
610
|
// function.sent implementation.
|
|
688
|
-
|
|
689
611
|
this.sent = this._sent = undefined$1;
|
|
690
612
|
this.done = false;
|
|
691
613
|
this.delegate = null;
|
|
692
614
|
this.method = "next";
|
|
693
615
|
this.arg = undefined$1;
|
|
694
616
|
this.tryEntries.forEach(resetTryEntry);
|
|
695
|
-
|
|
696
617
|
if (!skipTempReset) {
|
|
697
618
|
for (var name in this) {
|
|
698
619
|
// Not sure about the optimal order of these conditions:
|
|
@@ -706,50 +627,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
706
627
|
this.done = true;
|
|
707
628
|
var rootEntry = this.tryEntries[0];
|
|
708
629
|
var rootRecord = rootEntry.completion;
|
|
709
|
-
|
|
710
630
|
if (rootRecord.type === "throw") {
|
|
711
631
|
throw rootRecord.arg;
|
|
712
632
|
}
|
|
713
|
-
|
|
714
633
|
return this.rval;
|
|
715
634
|
},
|
|
716
635
|
dispatchException: function dispatchException(exception) {
|
|
717
636
|
if (this.done) {
|
|
718
637
|
throw exception;
|
|
719
638
|
}
|
|
720
|
-
|
|
721
639
|
var context = this;
|
|
722
|
-
|
|
723
640
|
function handle(loc, caught) {
|
|
724
641
|
record.type = "throw";
|
|
725
642
|
record.arg = exception;
|
|
726
643
|
context.next = loc;
|
|
727
|
-
|
|
728
644
|
if (caught) {
|
|
729
645
|
// If the dispatched exception was caught by a catch block,
|
|
730
646
|
// then let that catch block handle the exception normally.
|
|
731
647
|
context.method = "next";
|
|
732
648
|
context.arg = undefined$1;
|
|
733
649
|
}
|
|
734
|
-
|
|
735
650
|
return !!caught;
|
|
736
651
|
}
|
|
737
|
-
|
|
738
652
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
739
653
|
var entry = this.tryEntries[i];
|
|
740
654
|
var record = entry.completion;
|
|
741
|
-
|
|
742
655
|
if (entry.tryLoc === "root") {
|
|
743
656
|
// Exception thrown outside of any try block that could handle
|
|
744
657
|
// it, so set the completion value of the entire function to
|
|
745
658
|
// throw the exception.
|
|
746
659
|
return handle("end");
|
|
747
660
|
}
|
|
748
|
-
|
|
749
661
|
if (entry.tryLoc <= this.prev) {
|
|
750
662
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
751
663
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
752
|
-
|
|
753
664
|
if (hasCatch && hasFinally) {
|
|
754
665
|
if (this.prev < entry.catchLoc) {
|
|
755
666
|
return handle(entry.catchLoc, true);
|
|
@@ -773,36 +684,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
773
684
|
abrupt: function abrupt(type, arg) {
|
|
774
685
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
775
686
|
var entry = this.tryEntries[i];
|
|
776
|
-
|
|
777
687
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
778
688
|
var finallyEntry = entry;
|
|
779
689
|
break;
|
|
780
690
|
}
|
|
781
691
|
}
|
|
782
|
-
|
|
783
692
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
784
693
|
// Ignore the finally entry if control is not jumping to a
|
|
785
694
|
// location outside the try/catch block.
|
|
786
695
|
finallyEntry = null;
|
|
787
696
|
}
|
|
788
|
-
|
|
789
697
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
790
698
|
record.type = type;
|
|
791
699
|
record.arg = arg;
|
|
792
|
-
|
|
793
700
|
if (finallyEntry) {
|
|
794
701
|
this.method = "next";
|
|
795
702
|
this.next = finallyEntry.finallyLoc;
|
|
796
703
|
return ContinueSentinel;
|
|
797
704
|
}
|
|
798
|
-
|
|
799
705
|
return this.complete(record);
|
|
800
706
|
},
|
|
801
707
|
complete: function complete(record, afterLoc) {
|
|
802
708
|
if (record.type === "throw") {
|
|
803
709
|
throw record.arg;
|
|
804
710
|
}
|
|
805
|
-
|
|
806
711
|
if (record.type === "break" || record.type === "continue") {
|
|
807
712
|
this.next = record.arg;
|
|
808
713
|
} else if (record.type === "return") {
|
|
@@ -812,13 +717,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
812
717
|
} else if (record.type === "normal" && afterLoc) {
|
|
813
718
|
this.next = afterLoc;
|
|
814
719
|
}
|
|
815
|
-
|
|
816
720
|
return ContinueSentinel;
|
|
817
721
|
},
|
|
818
722
|
finish: function finish(finallyLoc) {
|
|
819
723
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
820
724
|
var entry = this.tryEntries[i];
|
|
821
|
-
|
|
822
725
|
if (entry.finallyLoc === finallyLoc) {
|
|
823
726
|
this.complete(entry.completion, entry.afterLoc);
|
|
824
727
|
resetTryEntry(entry);
|
|
@@ -829,21 +732,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
829
732
|
"catch": function _catch(tryLoc) {
|
|
830
733
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
831
734
|
var entry = this.tryEntries[i];
|
|
832
|
-
|
|
833
735
|
if (entry.tryLoc === tryLoc) {
|
|
834
736
|
var record = entry.completion;
|
|
835
|
-
|
|
836
737
|
if (record.type === "throw") {
|
|
837
738
|
var thrown = record.arg;
|
|
838
739
|
resetTryEntry(entry);
|
|
839
740
|
}
|
|
840
|
-
|
|
841
741
|
return thrown;
|
|
842
742
|
}
|
|
843
|
-
}
|
|
844
|
-
// argument that corresponds to a known catch block.
|
|
845
|
-
|
|
743
|
+
}
|
|
846
744
|
|
|
745
|
+
// The context.catch method must only be called with a location
|
|
746
|
+
// argument that corresponds to a known catch block.
|
|
847
747
|
throw new Error("illegal catch attempt");
|
|
848
748
|
},
|
|
849
749
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -852,27 +752,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
852
752
|
resultName: resultName,
|
|
853
753
|
nextLoc: nextLoc
|
|
854
754
|
};
|
|
855
|
-
|
|
856
755
|
if (this.method === "next") {
|
|
857
756
|
// Deliberately forget the last sent value so that we don't
|
|
858
757
|
// accidentally pass it on to the delegate.
|
|
859
758
|
this.arg = undefined$1;
|
|
860
759
|
}
|
|
861
|
-
|
|
862
760
|
return ContinueSentinel;
|
|
863
761
|
}
|
|
864
|
-
};
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
865
765
|
// or not, return the runtime object so that we can declare the variable
|
|
866
766
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
867
767
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
868
|
-
|
|
869
768
|
return exports;
|
|
870
|
-
}(
|
|
769
|
+
}(
|
|
770
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
871
771
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
872
772
|
// object. Either way, the resulting object will be used to initialize
|
|
873
773
|
// the regeneratorRuntime variable at the top of this file.
|
|
874
774
|
module.exports );
|
|
875
|
-
|
|
876
775
|
try {
|
|
877
776
|
regeneratorRuntime = runtime;
|
|
878
777
|
} catch (accidentalStrictMode) {
|
|
@@ -904,31 +803,24 @@ function queryParamsToApi(params) {
|
|
|
904
803
|
}] : undefined
|
|
905
804
|
};
|
|
906
805
|
}
|
|
907
|
-
|
|
908
806
|
var HttpError = /*#__PURE__*/function (_Error) {
|
|
909
807
|
_inheritsLoose(HttpError, _Error);
|
|
910
|
-
|
|
911
808
|
function HttpError(status, message) {
|
|
912
809
|
var _this;
|
|
913
|
-
|
|
914
810
|
_this = _Error.call(this, message) || this;
|
|
915
811
|
_this.status = status;
|
|
916
812
|
return _this;
|
|
917
813
|
}
|
|
918
|
-
|
|
919
814
|
return HttpError;
|
|
920
815
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
921
816
|
var API = /*#__PURE__*/function () {
|
|
922
817
|
function API(config) {
|
|
923
818
|
this.config = config;
|
|
924
819
|
}
|
|
925
|
-
|
|
926
820
|
var _proto = API.prototype;
|
|
927
|
-
|
|
928
821
|
_proto.get = /*#__PURE__*/function () {
|
|
929
822
|
var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(endpoint, params) {
|
|
930
823
|
var url, response, message, _json$error, json;
|
|
931
|
-
|
|
932
824
|
return runtime_1.wrap(function _callee$(_context) {
|
|
933
825
|
while (1) {
|
|
934
826
|
switch (_context.prev = _context.next) {
|
|
@@ -936,7 +828,6 @@ var API = /*#__PURE__*/function () {
|
|
|
936
828
|
if (params === void 0) {
|
|
937
829
|
params = {};
|
|
938
830
|
}
|
|
939
|
-
|
|
940
831
|
url = new URL(this.config.host + "/api/v1/cms/databases/" + this.config.databaseId + endpoint);
|
|
941
832
|
url.search = new URLSearchParams(params).toString();
|
|
942
833
|
_context.next = 5;
|
|
@@ -948,38 +839,28 @@ var API = /*#__PURE__*/function () {
|
|
|
948
839
|
},
|
|
949
840
|
mode: "cors"
|
|
950
841
|
});
|
|
951
|
-
|
|
952
842
|
case 5:
|
|
953
843
|
response = _context.sent;
|
|
954
|
-
|
|
955
844
|
if (!(response.status !== 200)) {
|
|
956
845
|
_context.next = 12;
|
|
957
846
|
break;
|
|
958
847
|
}
|
|
959
|
-
|
|
960
848
|
_context.next = 9;
|
|
961
849
|
return response.text();
|
|
962
|
-
|
|
963
850
|
case 9:
|
|
964
851
|
message = _context.sent;
|
|
965
|
-
|
|
966
852
|
try {
|
|
967
853
|
json = JSON.parse(message);
|
|
968
|
-
|
|
969
854
|
if ((_json$error = json.error) != null && _json$error.message) {
|
|
970
855
|
message = json.error.message;
|
|
971
856
|
}
|
|
972
857
|
} catch (_unused) {}
|
|
973
|
-
|
|
974
858
|
throw new HttpError(response.status, message);
|
|
975
|
-
|
|
976
859
|
case 12:
|
|
977
860
|
_context.next = 14;
|
|
978
861
|
return response.json();
|
|
979
|
-
|
|
980
862
|
case 14:
|
|
981
863
|
return _context.abrupt("return", _context.sent);
|
|
982
|
-
|
|
983
864
|
case 15:
|
|
984
865
|
case "end":
|
|
985
866
|
return _context.stop();
|
|
@@ -987,14 +868,11 @@ var API = /*#__PURE__*/function () {
|
|
|
987
868
|
}
|
|
988
869
|
}, _callee, this);
|
|
989
870
|
}));
|
|
990
|
-
|
|
991
871
|
function get(_x, _x2) {
|
|
992
872
|
return _get.apply(this, arguments);
|
|
993
873
|
}
|
|
994
|
-
|
|
995
874
|
return get;
|
|
996
875
|
}();
|
|
997
|
-
|
|
998
876
|
_proto.fetchTables = /*#__PURE__*/function () {
|
|
999
877
|
var _fetchTables = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1000
878
|
var response;
|
|
@@ -1005,17 +883,14 @@ var API = /*#__PURE__*/function () {
|
|
|
1005
883
|
_context2.prev = 0;
|
|
1006
884
|
_context2.next = 3;
|
|
1007
885
|
return this.get("");
|
|
1008
|
-
|
|
1009
886
|
case 3:
|
|
1010
887
|
response = _context2.sent;
|
|
1011
888
|
return _context2.abrupt("return", response.tables);
|
|
1012
|
-
|
|
1013
889
|
case 7:
|
|
1014
890
|
_context2.prev = 7;
|
|
1015
891
|
_context2.t0 = _context2["catch"](0);
|
|
1016
892
|
console.error(_context2.t0);
|
|
1017
893
|
throw _context2.t0;
|
|
1018
|
-
|
|
1019
894
|
case 11:
|
|
1020
895
|
case "end":
|
|
1021
896
|
return _context2.stop();
|
|
@@ -1023,14 +898,11 @@ var API = /*#__PURE__*/function () {
|
|
|
1023
898
|
}
|
|
1024
899
|
}, _callee2, this, [[0, 7]]);
|
|
1025
900
|
}));
|
|
1026
|
-
|
|
1027
901
|
function fetchTables() {
|
|
1028
902
|
return _fetchTables.apply(this, arguments);
|
|
1029
903
|
}
|
|
1030
|
-
|
|
1031
904
|
return fetchTables;
|
|
1032
905
|
}();
|
|
1033
|
-
|
|
1034
906
|
_proto.query = /*#__PURE__*/function () {
|
|
1035
907
|
var _query = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(table, params) {
|
|
1036
908
|
var response;
|
|
@@ -1041,7 +913,6 @@ var API = /*#__PURE__*/function () {
|
|
|
1041
913
|
if (params === void 0) {
|
|
1042
914
|
params = {};
|
|
1043
915
|
}
|
|
1044
|
-
|
|
1045
916
|
_context3.prev = 1;
|
|
1046
917
|
_context3.next = 4;
|
|
1047
918
|
return this.get("/tables/" + table + "/query", {
|
|
@@ -1049,17 +920,14 @@ var API = /*#__PURE__*/function () {
|
|
|
1049
920
|
draft: Number(params.useDraft),
|
|
1050
921
|
locale: this.config.locale
|
|
1051
922
|
});
|
|
1052
|
-
|
|
1053
923
|
case 4:
|
|
1054
924
|
response = _context3.sent;
|
|
1055
925
|
return _context3.abrupt("return", response.rows);
|
|
1056
|
-
|
|
1057
926
|
case 8:
|
|
1058
927
|
_context3.prev = 8;
|
|
1059
928
|
_context3.t0 = _context3["catch"](1);
|
|
1060
929
|
console.error(_context3.t0);
|
|
1061
930
|
throw _context3.t0;
|
|
1062
|
-
|
|
1063
931
|
case 12:
|
|
1064
932
|
case "end":
|
|
1065
933
|
return _context3.stop();
|
|
@@ -1067,21 +935,17 @@ var API = /*#__PURE__*/function () {
|
|
|
1067
935
|
}
|
|
1068
936
|
}, _callee3, this, [[1, 8]]);
|
|
1069
937
|
}));
|
|
1070
|
-
|
|
1071
938
|
function query(_x3, _x4) {
|
|
1072
939
|
return _query.apply(this, arguments);
|
|
1073
940
|
}
|
|
1074
|
-
|
|
1075
941
|
return query;
|
|
1076
942
|
}();
|
|
1077
|
-
|
|
1078
943
|
return API;
|
|
1079
944
|
}();
|
|
1080
945
|
function mkApi(config) {
|
|
1081
946
|
if (!config) {
|
|
1082
947
|
throw new Error("Component must be wrapped in 'CMS Data Provider'.");
|
|
1083
948
|
}
|
|
1084
|
-
|
|
1085
949
|
return new API(config);
|
|
1086
950
|
}
|
|
1087
951
|
|
|
@@ -1093,23 +957,19 @@ var mkQueryContextKey = function mkQueryContextKey(table) {
|
|
|
1093
957
|
return "" + contextPrefix + capitalizeFirst(table) + collectionResultSuffix;
|
|
1094
958
|
};
|
|
1095
959
|
var itemContextSuffix = "Item";
|
|
1096
|
-
|
|
1097
960
|
var mkRowContextKey = function mkRowContextKey(table) {
|
|
1098
961
|
return "" + contextPrefix + capitalizeFirst(table) + itemContextSuffix;
|
|
1099
962
|
};
|
|
1100
|
-
|
|
1101
963
|
function capitalizeFirst(str) {
|
|
1102
964
|
var _str$;
|
|
1103
|
-
|
|
1104
965
|
return ((_str$ = str[0]) == null ? void 0 : _str$.toUpperCase()) + str.slice(1);
|
|
1105
966
|
}
|
|
1106
|
-
|
|
1107
967
|
function useDatabase() {
|
|
1108
968
|
return useSelector(databaseContextKey);
|
|
1109
969
|
}
|
|
1110
970
|
function DatabaseProvider(_ref) {
|
|
1111
971
|
var config = _ref.config,
|
|
1112
|
-
|
|
972
|
+
children = _ref.children;
|
|
1113
973
|
return React.createElement(DataProvider, {
|
|
1114
974
|
name: databaseContextKey,
|
|
1115
975
|
data: config,
|
|
@@ -1121,25 +981,23 @@ function useTables() {
|
|
|
1121
981
|
}
|
|
1122
982
|
function TablesProvider(_ref2) {
|
|
1123
983
|
var children = _ref2.children,
|
|
1124
|
-
|
|
984
|
+
tables = _ref2.tables;
|
|
1125
985
|
return React.createElement(DataProvider, {
|
|
1126
986
|
name: tablesContextKey,
|
|
1127
987
|
data: tables,
|
|
1128
988
|
hidden: true
|
|
1129
989
|
}, children);
|
|
1130
990
|
}
|
|
1131
|
-
|
|
1132
991
|
function getClosestMatchingKeys(env, suffix) {
|
|
1133
992
|
return [].concat(Object.keys(env).reverse()).filter(function (k) {
|
|
1134
993
|
return k.endsWith(suffix);
|
|
1135
994
|
});
|
|
1136
995
|
}
|
|
1137
|
-
|
|
1138
996
|
function QueryResultProvider(_ref3) {
|
|
1139
997
|
var children = _ref3.children,
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
998
|
+
table = _ref3.table,
|
|
999
|
+
rows = _ref3.rows,
|
|
1000
|
+
hidden = _ref3.hidden;
|
|
1143
1001
|
return React.createElement(DataProvider, {
|
|
1144
1002
|
name: mkQueryContextKey(table),
|
|
1145
1003
|
data: rows,
|
|
@@ -1149,15 +1007,12 @@ function QueryResultProvider(_ref3) {
|
|
|
1149
1007
|
function useTablesWithDataLoaded() {
|
|
1150
1008
|
var env = useDataEnv();
|
|
1151
1009
|
var tables = useTables();
|
|
1152
|
-
|
|
1153
1010
|
if (!env) {
|
|
1154
1011
|
return undefined;
|
|
1155
1012
|
}
|
|
1156
|
-
|
|
1157
1013
|
if (!tables) {
|
|
1158
1014
|
return undefined;
|
|
1159
1015
|
}
|
|
1160
|
-
|
|
1161
1016
|
var matchingKeys = getClosestMatchingKeys(env, itemContextSuffix);
|
|
1162
1017
|
return tables.filter(function (table) {
|
|
1163
1018
|
return matchingKeys.some(function (key) {
|
|
@@ -1167,28 +1022,24 @@ function useTablesWithDataLoaded() {
|
|
|
1167
1022
|
}
|
|
1168
1023
|
function useRow(tables, table) {
|
|
1169
1024
|
var env = useDataEnv();
|
|
1170
|
-
|
|
1171
1025
|
if (!env) {
|
|
1172
1026
|
return undefined;
|
|
1173
1027
|
}
|
|
1174
|
-
|
|
1175
1028
|
if (!table && tables && tables.length > 0) {
|
|
1176
1029
|
table = tables[0].identifier;
|
|
1177
1030
|
}
|
|
1178
|
-
|
|
1179
1031
|
if (table) {
|
|
1180
1032
|
return {
|
|
1181
1033
|
table: table,
|
|
1182
1034
|
row: env[mkRowContextKey(table)]
|
|
1183
1035
|
};
|
|
1184
1036
|
}
|
|
1185
|
-
|
|
1186
1037
|
return undefined;
|
|
1187
1038
|
}
|
|
1188
1039
|
function RowProvider(_ref4) {
|
|
1189
1040
|
var children = _ref4.children,
|
|
1190
|
-
|
|
1191
|
-
|
|
1041
|
+
table = _ref4.table,
|
|
1042
|
+
row = _ref4.row;
|
|
1192
1043
|
return React.createElement(DataProvider, {
|
|
1193
1044
|
name: mkRowContextKey(table),
|
|
1194
1045
|
data: row
|
|
@@ -1199,7 +1050,6 @@ function mkTableOptions(tables) {
|
|
|
1199
1050
|
if (!tables) {
|
|
1200
1051
|
return [];
|
|
1201
1052
|
}
|
|
1202
|
-
|
|
1203
1053
|
return tables.map(function (table) {
|
|
1204
1054
|
return {
|
|
1205
1055
|
value: table.identifier,
|
|
@@ -1211,23 +1061,18 @@ function mkFieldOptions(tables, tableIdentifier, types) {
|
|
|
1211
1061
|
if (!tables) {
|
|
1212
1062
|
return [];
|
|
1213
1063
|
}
|
|
1214
|
-
|
|
1215
1064
|
var table = tables.find(function (t) {
|
|
1216
1065
|
return t.identifier === tableIdentifier;
|
|
1217
1066
|
});
|
|
1218
|
-
|
|
1219
1067
|
if (!table) {
|
|
1220
1068
|
return [];
|
|
1221
1069
|
}
|
|
1222
|
-
|
|
1223
1070
|
var fields = table.schema.fields;
|
|
1224
|
-
|
|
1225
1071
|
if (types) {
|
|
1226
1072
|
fields = fields.filter(function (f) {
|
|
1227
1073
|
return types.includes(f.type);
|
|
1228
1074
|
});
|
|
1229
1075
|
}
|
|
1230
|
-
|
|
1231
1076
|
return fields.map(function (f) {
|
|
1232
1077
|
return {
|
|
1233
1078
|
value: f.identifier,
|
|
@@ -1237,18 +1082,15 @@ function mkFieldOptions(tables, tableIdentifier, types) {
|
|
|
1237
1082
|
}
|
|
1238
1083
|
|
|
1239
1084
|
var _excluded = ["className", "table", "field", "dateFormat", "setControlContextData"],
|
|
1240
|
-
|
|
1085
|
+
_excluded2 = ["table", "field", "valueProp", "children", "setControlContextData"];
|
|
1241
1086
|
var modulePath = "@plasmicpkgs/plasmic-cms";
|
|
1242
1087
|
var componentPrefix = "hostless-plasmic-cms";
|
|
1243
|
-
|
|
1244
1088
|
function renderMaybeData(maybeData, renderFn, loaderProps, inEditor, loadingMessage, forceLoadingState) {
|
|
1245
1089
|
if ("error" in maybeData) {
|
|
1246
1090
|
var error = maybeData.error;
|
|
1247
|
-
|
|
1248
1091
|
if (!inEditor) {
|
|
1249
1092
|
return React.createElement(React.Fragment, null, loadingMessage != null ? loadingMessage : React.createElement("div", null, "Loading..."));
|
|
1250
1093
|
}
|
|
1251
|
-
|
|
1252
1094
|
if (error && error instanceof HttpError && error.status === 404) {
|
|
1253
1095
|
if (loaderProps.hideIfNotFound) {
|
|
1254
1096
|
return null;
|
|
@@ -1259,14 +1101,11 @@ function renderMaybeData(maybeData, renderFn, loaderProps, inEditor, loadingMess
|
|
|
1259
1101
|
return React.createElement("div", null, "Error: ", error == null ? void 0 : error.message);
|
|
1260
1102
|
}
|
|
1261
1103
|
}
|
|
1262
|
-
|
|
1263
1104
|
if (!("data" in maybeData) || forceLoadingState) {
|
|
1264
1105
|
return React.createElement(React.Fragment, null, loadingMessage != null ? loadingMessage : React.createElement("div", null, "Loading..."));
|
|
1265
1106
|
}
|
|
1266
|
-
|
|
1267
1107
|
return renderFn(maybeData.data);
|
|
1268
1108
|
}
|
|
1269
|
-
|
|
1270
1109
|
var defaultHost = "https://studio.plasmic.app";
|
|
1271
1110
|
var cmsCredentialsProviderMeta = {
|
|
1272
1111
|
name: componentPrefix + "-credentials-provider",
|
|
@@ -1302,10 +1141,10 @@ var cmsCredentialsProviderMeta = {
|
|
|
1302
1141
|
};
|
|
1303
1142
|
function CmsCredentialsProvider(_ref) {
|
|
1304
1143
|
var children = _ref.children,
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1144
|
+
databaseId = _ref.databaseId,
|
|
1145
|
+
databaseToken = _ref.databaseToken,
|
|
1146
|
+
host = _ref.host,
|
|
1147
|
+
locale = _ref.locale;
|
|
1309
1148
|
var config = {
|
|
1310
1149
|
databaseId: databaseId,
|
|
1311
1150
|
databaseToken: databaseToken,
|
|
@@ -1316,7 +1155,6 @@ function CmsCredentialsProvider(_ref) {
|
|
|
1316
1155
|
config: config
|
|
1317
1156
|
}, React.createElement(TablesFetcher, null, children));
|
|
1318
1157
|
}
|
|
1319
|
-
|
|
1320
1158
|
function TablesFetcher(_ref2) {
|
|
1321
1159
|
var children = _ref2.children;
|
|
1322
1160
|
var databaseConfig = useDatabase();
|
|
@@ -1333,16 +1171,12 @@ function TablesFetcher(_ref2) {
|
|
|
1333
1171
|
_context.next = 2;
|
|
1334
1172
|
break;
|
|
1335
1173
|
}
|
|
1336
|
-
|
|
1337
1174
|
return _context.abrupt("return", []);
|
|
1338
|
-
|
|
1339
1175
|
case 2:
|
|
1340
1176
|
_context.next = 4;
|
|
1341
1177
|
return mkApi(databaseConfig).fetchTables();
|
|
1342
|
-
|
|
1343
1178
|
case 4:
|
|
1344
1179
|
return _context.abrupt("return", _context.sent);
|
|
1345
|
-
|
|
1346
1180
|
case 5:
|
|
1347
1181
|
case "end":
|
|
1348
1182
|
return _context.stop();
|
|
@@ -1355,11 +1189,9 @@ function TablesFetcher(_ref2) {
|
|
|
1355
1189
|
tables: maybeData.data
|
|
1356
1190
|
}, inEditor && maybeData.error ? React.createElement("div", null, "CMS Error: ", maybeData.error.message) : children);
|
|
1357
1191
|
}
|
|
1358
|
-
|
|
1359
1192
|
function isDatabaseConfigured(config) {
|
|
1360
1193
|
return (config == null ? void 0 : config.databaseId) && (config == null ? void 0 : config.databaseToken);
|
|
1361
1194
|
}
|
|
1362
|
-
|
|
1363
1195
|
var cmsQueryRepeaterMeta = {
|
|
1364
1196
|
name: componentPrefix + "-query-repeater",
|
|
1365
1197
|
displayName: "CMS Data Loader",
|
|
@@ -1419,7 +1251,6 @@ var cmsQueryRepeaterMeta = {
|
|
|
1419
1251
|
description: "Field (from model schema) to filter by",
|
|
1420
1252
|
options: function options(_ref4, ctx) {
|
|
1421
1253
|
var _ctx$table;
|
|
1422
|
-
|
|
1423
1254
|
var table = _ref4.table;
|
|
1424
1255
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table, ["number", "boolean", "text", "long-text"]);
|
|
1425
1256
|
}
|
|
@@ -1491,31 +1322,28 @@ var cmsQueryRepeaterMeta = {
|
|
|
1491
1322
|
};
|
|
1492
1323
|
function CmsQueryRepeater(_ref5) {
|
|
1493
1324
|
var table = _ref5.table,
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1325
|
+
children = _ref5.children,
|
|
1326
|
+
setControlContextData = _ref5.setControlContextData,
|
|
1327
|
+
where = _ref5.where,
|
|
1328
|
+
useDraft = _ref5.useDraft,
|
|
1329
|
+
orderBy = _ref5.orderBy,
|
|
1330
|
+
desc = _ref5.desc,
|
|
1331
|
+
limit = _ref5.limit,
|
|
1332
|
+
emptyMessage = _ref5.emptyMessage,
|
|
1333
|
+
forceEmptyState = _ref5.forceEmptyState,
|
|
1334
|
+
loadingMessage = _ref5.loadingMessage,
|
|
1335
|
+
forceLoadingState = _ref5.forceLoadingState,
|
|
1336
|
+
noLayout = _ref5.noLayout,
|
|
1337
|
+
noAutoRepeat = _ref5.noAutoRepeat,
|
|
1338
|
+
className = _ref5.className,
|
|
1339
|
+
filterField = _ref5.filterField,
|
|
1340
|
+
filterValue = _ref5.filterValue;
|
|
1510
1341
|
var databaseConfig = useDatabase();
|
|
1511
1342
|
var tables = useTables();
|
|
1512
|
-
|
|
1513
1343
|
if (filterField && filterValue) {
|
|
1514
1344
|
var _where;
|
|
1515
|
-
|
|
1516
1345
|
where = (_where = {}, _where[filterField] = filterValue, _where);
|
|
1517
1346
|
}
|
|
1518
|
-
|
|
1519
1347
|
var params = {
|
|
1520
1348
|
where: where,
|
|
1521
1349
|
useDraft: useDraft,
|
|
@@ -1523,18 +1351,15 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1523
1351
|
desc: desc,
|
|
1524
1352
|
limit: limit
|
|
1525
1353
|
};
|
|
1526
|
-
|
|
1527
1354
|
if (!table && tables && tables.length > 0) {
|
|
1528
1355
|
table = tables[0].identifier;
|
|
1529
1356
|
}
|
|
1530
|
-
|
|
1531
1357
|
var cacheKey = JSON.stringify({
|
|
1532
1358
|
component: "CmsQueryLoader",
|
|
1533
1359
|
table: table,
|
|
1534
1360
|
databaseConfig: databaseConfig,
|
|
1535
1361
|
params: params
|
|
1536
1362
|
});
|
|
1537
|
-
|
|
1538
1363
|
if (tables) {
|
|
1539
1364
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1540
1365
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
@@ -1542,7 +1367,6 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1542
1367
|
table: table
|
|
1543
1368
|
});
|
|
1544
1369
|
}
|
|
1545
|
-
|
|
1546
1370
|
var maybeData = usePlasmicQueryData(cacheKey, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1547
1371
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1548
1372
|
while (1) {
|
|
@@ -1552,17 +1376,13 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1552
1376
|
_context2.next = 2;
|
|
1553
1377
|
break;
|
|
1554
1378
|
}
|
|
1555
|
-
|
|
1556
1379
|
throw new Error("You must specify a CMS ID and API key");
|
|
1557
|
-
|
|
1558
1380
|
case 2:
|
|
1559
1381
|
if (table) {
|
|
1560
1382
|
_context2.next = 6;
|
|
1561
1383
|
break;
|
|
1562
1384
|
}
|
|
1563
|
-
|
|
1564
1385
|
throw new Error("You must select a model to query");
|
|
1565
|
-
|
|
1566
1386
|
case 6:
|
|
1567
1387
|
if (!(tables && !tables.find(function (t) {
|
|
1568
1388
|
return t.identifier === table;
|
|
@@ -1570,12 +1390,9 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1570
1390
|
_context2.next = 10;
|
|
1571
1391
|
break;
|
|
1572
1392
|
}
|
|
1573
|
-
|
|
1574
1393
|
throw new Error("There is no model called \"" + table + "\"");
|
|
1575
|
-
|
|
1576
1394
|
case 10:
|
|
1577
1395
|
return _context2.abrupt("return", mkApi(databaseConfig).query(table, params));
|
|
1578
|
-
|
|
1579
1396
|
case 11:
|
|
1580
1397
|
case "end":
|
|
1581
1398
|
return _context2.stop();
|
|
@@ -1591,7 +1408,6 @@ function CmsQueryRepeater(_ref5) {
|
|
|
1591
1408
|
rows: rows
|
|
1592
1409
|
}, emptyMessage);
|
|
1593
1410
|
}
|
|
1594
|
-
|
|
1595
1411
|
return noAutoRepeat ? children : React.createElement(QueryResultProvider, {
|
|
1596
1412
|
table: table,
|
|
1597
1413
|
rows: rows
|
|
@@ -1635,13 +1451,11 @@ var cmsRowFieldMeta = {
|
|
|
1635
1451
|
description: "Field (from model schema) to use.",
|
|
1636
1452
|
options: function options(_ref7, ctx) {
|
|
1637
1453
|
var _ctx$table2;
|
|
1638
|
-
|
|
1639
1454
|
var table = _ref7.table;
|
|
1640
1455
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table2 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table2 : table, ["number", "boolean", "text", "long-text", "date-time", "rich-text", "image", "file"]);
|
|
1641
1456
|
},
|
|
1642
1457
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1643
1458
|
var _ctx$fieldMeta, _ctx$fieldMeta2;
|
|
1644
|
-
|
|
1645
1459
|
return (ctx == null ? void 0 : (_ctx$fieldMeta = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta.name) || (ctx == null ? void 0 : (_ctx$fieldMeta2 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta2.identifier);
|
|
1646
1460
|
}
|
|
1647
1461
|
},
|
|
@@ -1650,29 +1464,23 @@ var cmsRowFieldMeta = {
|
|
|
1650
1464
|
displayName: "Date Format",
|
|
1651
1465
|
hidden: function hidden(_ref8, ctx) {
|
|
1652
1466
|
var field = _ref8.field;
|
|
1653
|
-
|
|
1654
1467
|
if (!ctx) {
|
|
1655
1468
|
return true;
|
|
1656
1469
|
}
|
|
1657
|
-
|
|
1658
1470
|
var tableIdentifier = ctx.table,
|
|
1659
|
-
|
|
1471
|
+
tables = ctx.tables;
|
|
1660
1472
|
var table = tables == null ? void 0 : tables.find(function (t) {
|
|
1661
1473
|
return t.identifier === tableIdentifier;
|
|
1662
1474
|
});
|
|
1663
|
-
|
|
1664
1475
|
if (!table) {
|
|
1665
1476
|
return true;
|
|
1666
1477
|
}
|
|
1667
|
-
|
|
1668
1478
|
var fieldMeta = table.schema.fields.find(function (f) {
|
|
1669
1479
|
return f.identifier === field;
|
|
1670
1480
|
});
|
|
1671
|
-
|
|
1672
1481
|
if (!fieldMeta) {
|
|
1673
1482
|
return true;
|
|
1674
1483
|
}
|
|
1675
|
-
|
|
1676
1484
|
return fieldMeta.type !== "date-time";
|
|
1677
1485
|
},
|
|
1678
1486
|
options: [{
|
|
@@ -1723,37 +1531,31 @@ var cmsRowFieldMeta = {
|
|
|
1723
1531
|
};
|
|
1724
1532
|
function CmsRowField(_ref9) {
|
|
1725
1533
|
var _res$row$data;
|
|
1726
|
-
|
|
1727
1534
|
var className = _ref9.className,
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1535
|
+
table = _ref9.table,
|
|
1536
|
+
field = _ref9.field,
|
|
1537
|
+
dateFormat = _ref9.dateFormat,
|
|
1538
|
+
setControlContextData = _ref9.setControlContextData,
|
|
1539
|
+
rest = _objectWithoutPropertiesLoose(_ref9, _excluded);
|
|
1734
1540
|
var tables = useTablesWithDataLoaded();
|
|
1735
1541
|
var res = useRow(tables, table);
|
|
1736
1542
|
var unknown = React.createElement("div", Object.assign({
|
|
1737
1543
|
className: className
|
|
1738
1544
|
}, rest), "Field ", table != null ? table : "Unknown Model", ".", field != null ? field : "Unknown Field");
|
|
1739
|
-
|
|
1740
1545
|
if (!res) {
|
|
1741
1546
|
return unknown;
|
|
1742
1547
|
}
|
|
1743
|
-
|
|
1744
1548
|
if (!res.row) {
|
|
1745
1549
|
return React.createElement("div", {
|
|
1746
1550
|
className: className
|
|
1747
1551
|
}, "Error: No CMS Entry found");
|
|
1748
1552
|
}
|
|
1749
|
-
|
|
1750
1553
|
var fieldMeta = deriveInferredTableField({
|
|
1751
1554
|
table: res.table,
|
|
1752
1555
|
tables: tables,
|
|
1753
1556
|
field: field,
|
|
1754
1557
|
typeFilters: ["text", "long-text", "rich-text"]
|
|
1755
1558
|
});
|
|
1756
|
-
|
|
1757
1559
|
if (tables) {
|
|
1758
1560
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1759
1561
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
@@ -1763,34 +1565,27 @@ function CmsRowField(_ref9) {
|
|
|
1763
1565
|
fieldMeta: fieldMeta
|
|
1764
1566
|
});
|
|
1765
1567
|
}
|
|
1766
|
-
|
|
1767
1568
|
if (!fieldMeta) {
|
|
1768
1569
|
return unknown;
|
|
1769
1570
|
}
|
|
1770
|
-
|
|
1771
1571
|
var data = (_res$row$data = res.row.data) == null ? void 0 : _res$row$data[fieldMeta.identifier];
|
|
1772
|
-
|
|
1773
1572
|
if (!data) {
|
|
1774
1573
|
return null;
|
|
1775
1574
|
}
|
|
1776
|
-
|
|
1777
1575
|
if (fieldMeta.type === "date-time" && dateFormat) {
|
|
1778
1576
|
data = dayjs(data).format(dateFormat);
|
|
1779
1577
|
}
|
|
1780
|
-
|
|
1781
1578
|
return data ? renderValue(data, fieldMeta.type, _extends({
|
|
1782
1579
|
className: className
|
|
1783
1580
|
}, rest)) : null;
|
|
1784
1581
|
}
|
|
1785
1582
|
var DEFAULT_TYPE_FILTERS = ["text"];
|
|
1786
|
-
|
|
1787
1583
|
function deriveInferredTableField(opts) {
|
|
1788
1584
|
var _tables$find;
|
|
1789
|
-
|
|
1790
1585
|
var table = opts.table,
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1586
|
+
tables = opts.tables,
|
|
1587
|
+
field = opts.field,
|
|
1588
|
+
typeFilters = opts.typeFilters;
|
|
1794
1589
|
if (!table) return undefined;
|
|
1795
1590
|
var schema = tables == null ? void 0 : (_tables$find = tables.find(function (t) {
|
|
1796
1591
|
return t.identifier === table;
|
|
@@ -1802,11 +1597,9 @@ function deriveInferredTableField(opts) {
|
|
|
1802
1597
|
});
|
|
1803
1598
|
return fieldMeta;
|
|
1804
1599
|
}
|
|
1805
|
-
|
|
1806
1600
|
function assertNever(_) {
|
|
1807
1601
|
throw new Error("unexpected branch taken");
|
|
1808
1602
|
}
|
|
1809
|
-
|
|
1810
1603
|
function renderValue(value, type, props) {
|
|
1811
1604
|
switch (type) {
|
|
1812
1605
|
case "number":
|
|
@@ -1815,7 +1608,6 @@ function renderValue(value, type, props) {
|
|
|
1815
1608
|
case "long-text":
|
|
1816
1609
|
case "date-time":
|
|
1817
1610
|
return React.createElement("div", Object.assign({}, props), value);
|
|
1818
|
-
|
|
1819
1611
|
case "rich-text":
|
|
1820
1612
|
return React.createElement("div", Object.assign({
|
|
1821
1613
|
dangerouslySetInnerHTML: {
|
|
@@ -1825,7 +1617,6 @@ function renderValue(value, type, props) {
|
|
|
1825
1617
|
whiteSpace: "normal"
|
|
1826
1618
|
}
|
|
1827
1619
|
}, props));
|
|
1828
|
-
|
|
1829
1620
|
case "image":
|
|
1830
1621
|
if (value && typeof value === "object" && value.url && value.imageMeta) {
|
|
1831
1622
|
return React.createElement("img", Object.assign({
|
|
@@ -1834,9 +1625,7 @@ function renderValue(value, type, props) {
|
|
|
1834
1625
|
height: value.imageMeta.height
|
|
1835
1626
|
}, props));
|
|
1836
1627
|
}
|
|
1837
|
-
|
|
1838
1628
|
return null;
|
|
1839
|
-
|
|
1840
1629
|
case "file":
|
|
1841
1630
|
if (value && typeof value === "object" && value.url && value.name) {
|
|
1842
1631
|
return React.createElement("a", Object.assign({
|
|
@@ -1844,14 +1633,11 @@ function renderValue(value, type, props) {
|
|
|
1844
1633
|
target: "_blank"
|
|
1845
1634
|
}, props), value.name);
|
|
1846
1635
|
}
|
|
1847
|
-
|
|
1848
1636
|
return null;
|
|
1849
|
-
|
|
1850
1637
|
default:
|
|
1851
1638
|
assertNever();
|
|
1852
1639
|
}
|
|
1853
1640
|
}
|
|
1854
|
-
|
|
1855
1641
|
var cmsRowLinkMeta = {
|
|
1856
1642
|
name: componentPrefix + "-row-link",
|
|
1857
1643
|
displayName: "CMS Entry Link",
|
|
@@ -1883,13 +1669,11 @@ var cmsRowLinkMeta = {
|
|
|
1883
1669
|
description: "Field (from model schema) to use.",
|
|
1884
1670
|
options: function options(_ref10, ctx) {
|
|
1885
1671
|
var _ctx$table3;
|
|
1886
|
-
|
|
1887
1672
|
var table = _ref10.table;
|
|
1888
1673
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
|
|
1889
1674
|
},
|
|
1890
1675
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
1891
1676
|
var _ctx$fieldMeta3, _ctx$fieldMeta4;
|
|
1892
|
-
|
|
1893
1677
|
return (ctx == null ? void 0 : (_ctx$fieldMeta3 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta3.name) || (ctx == null ? void 0 : (_ctx$fieldMeta4 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta4.identifier);
|
|
1894
1678
|
}
|
|
1895
1679
|
},
|
|
@@ -1905,7 +1689,6 @@ var cmsRowLinkMeta = {
|
|
|
1905
1689
|
description: "Prefix to prepend to prop value.",
|
|
1906
1690
|
hidden: function hidden(_, ctx) {
|
|
1907
1691
|
var _ctx$fieldMeta5;
|
|
1908
|
-
|
|
1909
1692
|
return (ctx == null ? void 0 : (_ctx$fieldMeta5 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta5.type) === "file";
|
|
1910
1693
|
}
|
|
1911
1694
|
},
|
|
@@ -1915,7 +1698,6 @@ var cmsRowLinkMeta = {
|
|
|
1915
1698
|
description: "Suffix to append to prop value.",
|
|
1916
1699
|
hidden: function hidden(_, ctx) {
|
|
1917
1700
|
var _ctx$fieldMeta6;
|
|
1918
|
-
|
|
1919
1701
|
return (ctx == null ? void 0 : (_ctx$fieldMeta6 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta6.type) === "file";
|
|
1920
1702
|
}
|
|
1921
1703
|
}
|
|
@@ -1923,28 +1705,24 @@ var cmsRowLinkMeta = {
|
|
|
1923
1705
|
};
|
|
1924
1706
|
function CmsRowLink(_ref11) {
|
|
1925
1707
|
var _res$row$data2;
|
|
1926
|
-
|
|
1927
1708
|
var table = _ref11.table,
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1709
|
+
field = _ref11.field,
|
|
1710
|
+
hrefProp = _ref11.hrefProp,
|
|
1711
|
+
children = _ref11.children,
|
|
1712
|
+
setControlContextData = _ref11.setControlContextData,
|
|
1713
|
+
prefix = _ref11.prefix,
|
|
1714
|
+
suffix = _ref11.suffix;
|
|
1934
1715
|
var tables = useTablesWithDataLoaded();
|
|
1935
1716
|
var res = useRow(tables, table);
|
|
1936
|
-
|
|
1937
1717
|
if (!res || !res.row) {
|
|
1938
1718
|
return React.createElement(React.Fragment, null, children);
|
|
1939
1719
|
}
|
|
1940
|
-
|
|
1941
1720
|
var fieldMeta = deriveInferredTableField({
|
|
1942
1721
|
table: res.table,
|
|
1943
1722
|
tables: tables,
|
|
1944
1723
|
field: field,
|
|
1945
1724
|
typeFilters: ["file", "text"]
|
|
1946
1725
|
});
|
|
1947
|
-
|
|
1948
1726
|
if (tables) {
|
|
1949
1727
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1950
1728
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
@@ -1954,23 +1732,18 @@ function CmsRowLink(_ref11) {
|
|
|
1954
1732
|
fieldMeta: fieldMeta
|
|
1955
1733
|
});
|
|
1956
1734
|
}
|
|
1957
|
-
|
|
1958
1735
|
if (!fieldMeta) {
|
|
1959
1736
|
return React.createElement(React.Fragment, null, children);
|
|
1960
1737
|
}
|
|
1961
|
-
|
|
1962
1738
|
if (!children) {
|
|
1963
1739
|
return null;
|
|
1964
1740
|
}
|
|
1965
|
-
|
|
1966
1741
|
var value = ((_res$row$data2 = res.row.data) == null ? void 0 : _res$row$data2[fieldMeta.identifier]) || "";
|
|
1967
1742
|
var childrenWithProps = React.Children.map(children, function (child) {
|
|
1968
1743
|
if (React.isValidElement(child)) {
|
|
1969
1744
|
var _React$cloneElement;
|
|
1970
|
-
|
|
1971
1745
|
return React.cloneElement(child, (_React$cloneElement = {}, _React$cloneElement[hrefProp] = fieldMeta.type === "file" ? value.url : prefix || suffix ? "" + (prefix || "") + value + (suffix || "") : value, _React$cloneElement));
|
|
1972
1746
|
}
|
|
1973
|
-
|
|
1974
1747
|
return child;
|
|
1975
1748
|
});
|
|
1976
1749
|
return React.createElement(React.Fragment, null, childrenWithProps != null ? childrenWithProps : null);
|
|
@@ -2005,13 +1778,11 @@ var cmsRowImageMeta = {
|
|
|
2005
1778
|
description: "Field (from model schema) to use.",
|
|
2006
1779
|
options: function options(_ref12, ctx) {
|
|
2007
1780
|
var _ctx$table4;
|
|
2008
|
-
|
|
2009
1781
|
var table = _ref12.table;
|
|
2010
1782
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table, ["image"]);
|
|
2011
1783
|
},
|
|
2012
1784
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2013
1785
|
var _ctx$fieldMeta7, _ctx$fieldMeta8;
|
|
2014
|
-
|
|
2015
1786
|
return (ctx == null ? void 0 : (_ctx$fieldMeta7 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta7.name) || (ctx == null ? void 0 : (_ctx$fieldMeta8 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta8.identifier);
|
|
2016
1787
|
}
|
|
2017
1788
|
},
|
|
@@ -2025,26 +1796,22 @@ var cmsRowImageMeta = {
|
|
|
2025
1796
|
};
|
|
2026
1797
|
function CmsRowImage(_ref13) {
|
|
2027
1798
|
var _res$row$data3;
|
|
2028
|
-
|
|
2029
1799
|
var table = _ref13.table,
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
1800
|
+
field = _ref13.field,
|
|
1801
|
+
srcProp = _ref13.srcProp,
|
|
1802
|
+
children = _ref13.children,
|
|
1803
|
+
setControlContextData = _ref13.setControlContextData;
|
|
2034
1804
|
var tables = useTablesWithDataLoaded();
|
|
2035
1805
|
var res = useRow(tables, table);
|
|
2036
|
-
|
|
2037
1806
|
if (!res || !res.row) {
|
|
2038
1807
|
return React.createElement(React.Fragment, null, children);
|
|
2039
1808
|
}
|
|
2040
|
-
|
|
2041
1809
|
var fieldMeta = deriveInferredTableField({
|
|
2042
1810
|
table: res.table,
|
|
2043
1811
|
tables: tables,
|
|
2044
1812
|
field: field,
|
|
2045
1813
|
typeFilters: ["image"]
|
|
2046
1814
|
});
|
|
2047
|
-
|
|
2048
1815
|
if (tables) {
|
|
2049
1816
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2050
1817
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
@@ -2054,29 +1821,23 @@ function CmsRowImage(_ref13) {
|
|
|
2054
1821
|
fieldMeta: fieldMeta
|
|
2055
1822
|
});
|
|
2056
1823
|
}
|
|
2057
|
-
|
|
2058
1824
|
if (!fieldMeta) {
|
|
2059
1825
|
return React.createElement(React.Fragment, null, children);
|
|
2060
1826
|
}
|
|
2061
|
-
|
|
2062
1827
|
var value = ((_res$row$data3 = res.row.data) == null ? void 0 : _res$row$data3[fieldMeta.identifier]) || "";
|
|
2063
1828
|
var childrenWithProps = React.Children.map(children, function (child) {
|
|
2064
1829
|
if (React.isValidElement(child) && value) {
|
|
2065
1830
|
var _React$cloneElement3;
|
|
2066
|
-
|
|
2067
1831
|
if (typeof value === "object" && value.url && value.imageMeta) {
|
|
2068
1832
|
var _React$cloneElement2;
|
|
2069
|
-
|
|
2070
1833
|
return React.cloneElement(child, (_React$cloneElement2 = {}, _React$cloneElement2[srcProp] = {
|
|
2071
1834
|
src: value.url,
|
|
2072
1835
|
fullHeight: value.imageMeta.height,
|
|
2073
1836
|
fullWidth: value.imageMeta.width
|
|
2074
1837
|
}, _React$cloneElement2));
|
|
2075
1838
|
}
|
|
2076
|
-
|
|
2077
1839
|
return React.cloneElement(child, (_React$cloneElement3 = {}, _React$cloneElement3[srcProp] = value, _React$cloneElement3));
|
|
2078
1840
|
}
|
|
2079
|
-
|
|
2080
1841
|
return child;
|
|
2081
1842
|
});
|
|
2082
1843
|
return React.createElement(React.Fragment, null, childrenWithProps);
|
|
@@ -2107,13 +1868,11 @@ var cmsRowFieldValueMeta = {
|
|
|
2107
1868
|
description: "Field (from model schema) to use.",
|
|
2108
1869
|
options: function options(_ref14, ctx) {
|
|
2109
1870
|
var _ctx$table5;
|
|
2110
|
-
|
|
2111
1871
|
var table = _ref14.table;
|
|
2112
1872
|
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table5 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table5 : table);
|
|
2113
1873
|
},
|
|
2114
1874
|
defaultValueHint: function defaultValueHint(_, ctx) {
|
|
2115
1875
|
var _ctx$fieldMeta9, _ctx$fieldMeta10;
|
|
2116
|
-
|
|
2117
1876
|
return (ctx == null ? void 0 : (_ctx$fieldMeta9 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta9.name) || (ctx == null ? void 0 : (_ctx$fieldMeta10 = ctx.fieldMeta) == null ? void 0 : _ctx$fieldMeta10.identifier);
|
|
2118
1877
|
}
|
|
2119
1878
|
},
|
|
@@ -2127,28 +1886,23 @@ var cmsRowFieldValueMeta = {
|
|
|
2127
1886
|
};
|
|
2128
1887
|
function CmsRowFieldValue(_ref15) {
|
|
2129
1888
|
var _res$row$data4;
|
|
2130
|
-
|
|
2131
1889
|
var table = _ref15.table,
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
1890
|
+
field = _ref15.field,
|
|
1891
|
+
valueProp = _ref15.valueProp,
|
|
1892
|
+
children = _ref15.children,
|
|
1893
|
+
setControlContextData = _ref15.setControlContextData,
|
|
1894
|
+
rest = _objectWithoutPropertiesLoose(_ref15, _excluded2);
|
|
2138
1895
|
var tables = useTablesWithDataLoaded();
|
|
2139
1896
|
var res = useRow(tables, table);
|
|
2140
|
-
|
|
2141
1897
|
if (!res || !res.row) {
|
|
2142
1898
|
return React.createElement(React.Fragment, null, children);
|
|
2143
1899
|
}
|
|
2144
|
-
|
|
2145
1900
|
var fieldMeta = deriveInferredTableField({
|
|
2146
1901
|
table: res.table,
|
|
2147
1902
|
tables: tables,
|
|
2148
1903
|
field: field,
|
|
2149
1904
|
typeFilters: ["text"]
|
|
2150
1905
|
});
|
|
2151
|
-
|
|
2152
1906
|
if (tables) {
|
|
2153
1907
|
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2154
1908
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
@@ -2158,19 +1912,15 @@ function CmsRowFieldValue(_ref15) {
|
|
|
2158
1912
|
fieldMeta: fieldMeta
|
|
2159
1913
|
});
|
|
2160
1914
|
}
|
|
2161
|
-
|
|
2162
1915
|
if (!fieldMeta) {
|
|
2163
1916
|
return React.createElement(React.Fragment, null, children);
|
|
2164
1917
|
}
|
|
2165
|
-
|
|
2166
1918
|
var value = ((_res$row$data4 = res.row.data) == null ? void 0 : _res$row$data4[fieldMeta.identifier]) || "";
|
|
2167
1919
|
var childrenWithProps = React.Children.map(children, function (child) {
|
|
2168
1920
|
if (React.isValidElement(child)) {
|
|
2169
1921
|
var _extends2;
|
|
2170
|
-
|
|
2171
1922
|
return React.cloneElement(child, _extends({}, rest, (_extends2 = {}, _extends2[valueProp] = value, _extends2)));
|
|
2172
1923
|
}
|
|
2173
|
-
|
|
2174
1924
|
return child;
|
|
2175
1925
|
});
|
|
2176
1926
|
return React.createElement(React.Fragment, null, childrenWithProps);
|
|
@@ -2186,7 +1936,6 @@ function registerAll(loader) {
|
|
|
2186
1936
|
registerComponent(Component, defaultMeta);
|
|
2187
1937
|
}
|
|
2188
1938
|
};
|
|
2189
|
-
|
|
2190
1939
|
var _registerGlobalContext = function _registerGlobalContext(Component, defaultMeta) {
|
|
2191
1940
|
if (loader) {
|
|
2192
1941
|
loader.registerGlobalContext(Component, defaultMeta);
|
|
@@ -2194,17 +1943,11 @@ function registerAll(loader) {
|
|
|
2194
1943
|
registerGlobalContext(Component, defaultMeta);
|
|
2195
1944
|
}
|
|
2196
1945
|
};
|
|
2197
|
-
|
|
2198
1946
|
_registerGlobalContext(CmsCredentialsProvider, cmsCredentialsProviderMeta);
|
|
2199
|
-
|
|
2200
1947
|
_registerComponent(CmsQueryRepeater, cmsQueryRepeaterMeta);
|
|
2201
|
-
|
|
2202
1948
|
_registerComponent(CmsRowField, cmsRowFieldMeta);
|
|
2203
|
-
|
|
2204
1949
|
_registerComponent(CmsRowLink, cmsRowLinkMeta);
|
|
2205
|
-
|
|
2206
1950
|
_registerComponent(CmsRowImage, cmsRowImageMeta);
|
|
2207
|
-
|
|
2208
1951
|
_registerComponent(CmsRowFieldValue, cmsRowFieldValueMeta);
|
|
2209
1952
|
}
|
|
2210
1953
|
|