@plasmicapp/data-sources 0.1.107 → 0.1.109

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.
@@ -11,6 +11,307 @@ var ph = require('@plasmicapp/host');
11
11
  var fetch = _interopDefault(require('@plasmicapp/isomorphic-unfetch'));
12
12
  var stringify = _interopDefault(require('fast-stringify'));
13
13
 
14
+ function _regeneratorRuntime() {
15
+ _regeneratorRuntime = function () {
16
+ return e;
17
+ };
18
+ var t,
19
+ e = {},
20
+ r = Object.prototype,
21
+ n = r.hasOwnProperty,
22
+ o = Object.defineProperty || function (t, e, r) {
23
+ t[e] = r.value;
24
+ },
25
+ i = "function" == typeof Symbol ? Symbol : {},
26
+ a = i.iterator || "@@iterator",
27
+ c = i.asyncIterator || "@@asyncIterator",
28
+ u = i.toStringTag || "@@toStringTag";
29
+ function define(t, e, r) {
30
+ return Object.defineProperty(t, e, {
31
+ value: r,
32
+ enumerable: !0,
33
+ configurable: !0,
34
+ writable: !0
35
+ }), t[e];
36
+ }
37
+ try {
38
+ define({}, "");
39
+ } catch (t) {
40
+ define = function (t, e, r) {
41
+ return t[e] = r;
42
+ };
43
+ }
44
+ function wrap(t, e, r, n) {
45
+ var i = e && e.prototype instanceof Generator ? e : Generator,
46
+ a = Object.create(i.prototype),
47
+ c = new Context(n || []);
48
+ return o(a, "_invoke", {
49
+ value: makeInvokeMethod(t, r, c)
50
+ }), a;
51
+ }
52
+ function tryCatch(t, e, r) {
53
+ try {
54
+ return {
55
+ type: "normal",
56
+ arg: t.call(e, r)
57
+ };
58
+ } catch (t) {
59
+ return {
60
+ type: "throw",
61
+ arg: t
62
+ };
63
+ }
64
+ }
65
+ e.wrap = wrap;
66
+ var h = "suspendedStart",
67
+ l = "suspendedYield",
68
+ f = "executing",
69
+ s = "completed",
70
+ y = {};
71
+ function Generator() {}
72
+ function GeneratorFunction() {}
73
+ function GeneratorFunctionPrototype() {}
74
+ var p = {};
75
+ define(p, a, function () {
76
+ return this;
77
+ });
78
+ var d = Object.getPrototypeOf,
79
+ v = d && d(d(values([])));
80
+ v && v !== r && n.call(v, a) && (p = v);
81
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
82
+ function defineIteratorMethods(t) {
83
+ ["next", "throw", "return"].forEach(function (e) {
84
+ define(t, e, function (t) {
85
+ return this._invoke(e, t);
86
+ });
87
+ });
88
+ }
89
+ function AsyncIterator(t, e) {
90
+ function invoke(r, o, i, a) {
91
+ var c = tryCatch(t[r], t, o);
92
+ if ("throw" !== c.type) {
93
+ var u = c.arg,
94
+ h = u.value;
95
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
96
+ invoke("next", t, i, a);
97
+ }, function (t) {
98
+ invoke("throw", t, i, a);
99
+ }) : e.resolve(h).then(function (t) {
100
+ u.value = t, i(u);
101
+ }, function (t) {
102
+ return invoke("throw", t, i, a);
103
+ });
104
+ }
105
+ a(c.arg);
106
+ }
107
+ var r;
108
+ o(this, "_invoke", {
109
+ value: function (t, n) {
110
+ function callInvokeWithMethodAndArg() {
111
+ return new e(function (e, r) {
112
+ invoke(t, n, e, r);
113
+ });
114
+ }
115
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
116
+ }
117
+ });
118
+ }
119
+ function makeInvokeMethod(e, r, n) {
120
+ var o = h;
121
+ return function (i, a) {
122
+ if (o === f) throw new Error("Generator is already running");
123
+ if (o === s) {
124
+ if ("throw" === i) throw a;
125
+ return {
126
+ value: t,
127
+ done: !0
128
+ };
129
+ }
130
+ for (n.method = i, n.arg = a;;) {
131
+ var c = n.delegate;
132
+ if (c) {
133
+ var u = maybeInvokeDelegate(c, n);
134
+ if (u) {
135
+ if (u === y) continue;
136
+ return u;
137
+ }
138
+ }
139
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
140
+ if (o === h) throw o = s, n.arg;
141
+ n.dispatchException(n.arg);
142
+ } else "return" === n.method && n.abrupt("return", n.arg);
143
+ o = f;
144
+ var p = tryCatch(e, r, n);
145
+ if ("normal" === p.type) {
146
+ if (o = n.done ? s : l, p.arg === y) continue;
147
+ return {
148
+ value: p.arg,
149
+ done: n.done
150
+ };
151
+ }
152
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
153
+ }
154
+ };
155
+ }
156
+ function maybeInvokeDelegate(e, r) {
157
+ var n = r.method,
158
+ o = e.iterator[n];
159
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
160
+ var i = tryCatch(o, e.iterator, r.arg);
161
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
162
+ var a = i.arg;
163
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
164
+ }
165
+ function pushTryEntry(t) {
166
+ var e = {
167
+ tryLoc: t[0]
168
+ };
169
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
170
+ }
171
+ function resetTryEntry(t) {
172
+ var e = t.completion || {};
173
+ e.type = "normal", delete e.arg, t.completion = e;
174
+ }
175
+ function Context(t) {
176
+ this.tryEntries = [{
177
+ tryLoc: "root"
178
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
179
+ }
180
+ function values(e) {
181
+ if (e || "" === e) {
182
+ var r = e[a];
183
+ if (r) return r.call(e);
184
+ if ("function" == typeof e.next) return e;
185
+ if (!isNaN(e.length)) {
186
+ var o = -1,
187
+ i = function next() {
188
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
189
+ return next.value = t, next.done = !0, next;
190
+ };
191
+ return i.next = i;
192
+ }
193
+ }
194
+ throw new TypeError(typeof e + " is not iterable");
195
+ }
196
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
197
+ value: GeneratorFunctionPrototype,
198
+ configurable: !0
199
+ }), o(GeneratorFunctionPrototype, "constructor", {
200
+ value: GeneratorFunction,
201
+ configurable: !0
202
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
203
+ var e = "function" == typeof t && t.constructor;
204
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
205
+ }, e.mark = function (t) {
206
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
207
+ }, e.awrap = function (t) {
208
+ return {
209
+ __await: t
210
+ };
211
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
212
+ return this;
213
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
214
+ void 0 === i && (i = Promise);
215
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
216
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
217
+ return t.done ? t.value : a.next();
218
+ });
219
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
220
+ return this;
221
+ }), define(g, "toString", function () {
222
+ return "[object Generator]";
223
+ }), e.keys = function (t) {
224
+ var e = Object(t),
225
+ r = [];
226
+ for (var n in e) r.push(n);
227
+ return r.reverse(), function next() {
228
+ for (; r.length;) {
229
+ var t = r.pop();
230
+ if (t in e) return next.value = t, next.done = !1, next;
231
+ }
232
+ return next.done = !0, next;
233
+ };
234
+ }, e.values = values, Context.prototype = {
235
+ constructor: Context,
236
+ reset: function (e) {
237
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
238
+ },
239
+ stop: function () {
240
+ this.done = !0;
241
+ var t = this.tryEntries[0].completion;
242
+ if ("throw" === t.type) throw t.arg;
243
+ return this.rval;
244
+ },
245
+ dispatchException: function (e) {
246
+ if (this.done) throw e;
247
+ var r = this;
248
+ function handle(n, o) {
249
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
250
+ }
251
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
252
+ var i = this.tryEntries[o],
253
+ a = i.completion;
254
+ if ("root" === i.tryLoc) return handle("end");
255
+ if (i.tryLoc <= this.prev) {
256
+ var c = n.call(i, "catchLoc"),
257
+ u = n.call(i, "finallyLoc");
258
+ if (c && u) {
259
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
260
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
261
+ } else if (c) {
262
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
263
+ } else {
264
+ if (!u) throw new Error("try statement without catch or finally");
265
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
266
+ }
267
+ }
268
+ }
269
+ },
270
+ abrupt: function (t, e) {
271
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
272
+ var o = this.tryEntries[r];
273
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
274
+ var i = o;
275
+ break;
276
+ }
277
+ }
278
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
279
+ var a = i ? i.completion : {};
280
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
281
+ },
282
+ complete: function (t, e) {
283
+ if ("throw" === t.type) throw t.arg;
284
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
285
+ },
286
+ finish: function (t) {
287
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
288
+ var r = this.tryEntries[e];
289
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
290
+ }
291
+ },
292
+ catch: function (t) {
293
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
294
+ var r = this.tryEntries[e];
295
+ if (r.tryLoc === t) {
296
+ var n = r.completion;
297
+ if ("throw" === n.type) {
298
+ var o = n.arg;
299
+ resetTryEntry(r);
300
+ }
301
+ return o;
302
+ }
303
+ }
304
+ throw new Error("illegal catch attempt");
305
+ },
306
+ delegateYield: function (e, r, n) {
307
+ return this.delegate = {
308
+ iterator: values(e),
309
+ resultName: r,
310
+ nextLoc: n
311
+ }, "next" === this.method && (this.arg = t), y;
312
+ }
313
+ }, e;
314
+ }
14
315
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
15
316
  try {
16
317
  var info = gen[key](arg);
@@ -56,753 +357,84 @@ function _extends() {
56
357
  return _extends.apply(this, arguments);
57
358
  }
58
359
 
59
- function createCommonjsModule(fn, module) {
60
- return module = { exports: {} }, fn(module, module.exports), module.exports;
61
- }
62
-
63
- var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
64
- /**
65
- * Copyright (c) 2014-present, Facebook, Inc.
66
- *
67
- * This source code is licensed under the MIT license found in the
68
- * LICENSE file in the root directory of this source tree.
69
- */
70
-
71
- var runtime = function (exports) {
72
-
73
- var Op = Object.prototype;
74
- var hasOwn = Op.hasOwnProperty;
75
- var undefined$1; // More compressible than void 0.
76
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
77
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
78
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
79
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
80
- function define(obj, key, value) {
81
- Object.defineProperty(obj, key, {
82
- value: value,
83
- enumerable: true,
84
- configurable: true,
85
- writable: true
86
- });
87
- return obj[key];
88
- }
89
- try {
90
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
91
- define({}, "");
92
- } catch (err) {
93
- define = function define(obj, key, value) {
94
- return obj[key] = value;
95
- };
96
- }
97
- function wrap(innerFn, outerFn, self, tryLocsList) {
98
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
99
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
100
- var generator = Object.create(protoGenerator.prototype);
101
- var context = new Context(tryLocsList || []);
102
-
103
- // The ._invoke method unifies the implementations of the .next,
104
- // .throw, and .return methods.
105
- generator._invoke = makeInvokeMethod(innerFn, self, context);
106
- return generator;
107
- }
108
- exports.wrap = wrap;
109
-
110
- // Try/catch helper to minimize deoptimizations. Returns a completion
111
- // record like context.tryEntries[i].completion. This interface could
112
- // have been (and was previously) designed to take a closure to be
113
- // invoked without arguments, but in all the cases we care about we
114
- // already have an existing method we want to call, so there's no need
115
- // to create a new function object. We can even get away with assuming
116
- // the method takes exactly one argument, since that happens to be true
117
- // in every case, so we don't have to touch the arguments object. The
118
- // only additional allocation required is the completion record, which
119
- // has a stable shape and so hopefully should be cheap to allocate.
120
- function tryCatch(fn, obj, arg) {
121
- try {
122
- return {
123
- type: "normal",
124
- arg: fn.call(obj, arg)
125
- };
126
- } catch (err) {
127
- return {
128
- type: "throw",
129
- arg: err
130
- };
131
- }
132
- }
133
- var GenStateSuspendedStart = "suspendedStart";
134
- var GenStateSuspendedYield = "suspendedYield";
135
- var GenStateExecuting = "executing";
136
- var GenStateCompleted = "completed";
137
-
138
- // Returning this object from the innerFn has the same effect as
139
- // breaking out of the dispatch switch statement.
140
- var ContinueSentinel = {};
141
-
142
- // Dummy constructor functions that we use as the .constructor and
143
- // .constructor.prototype properties for functions that return Generator
144
- // objects. For full spec compliance, you may wish to configure your
145
- // minifier not to mangle the names of these two functions.
146
- function Generator() {}
147
- function GeneratorFunction() {}
148
- function GeneratorFunctionPrototype() {}
149
-
150
- // This is a polyfill for %IteratorPrototype% for environments that
151
- // don't natively support it.
152
- var IteratorPrototype = {};
153
- define(IteratorPrototype, iteratorSymbol, function () {
154
- return this;
155
- });
156
- var getProto = Object.getPrototypeOf;
157
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
158
- if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
159
- // This environment has a native %IteratorPrototype%; use it instead
160
- // of the polyfill.
161
- IteratorPrototype = NativeIteratorPrototype;
162
- }
163
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
164
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
165
- define(Gp, "constructor", GeneratorFunctionPrototype);
166
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
167
- GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
168
-
169
- // Helper for defining the .next, .throw, and .return methods of the
170
- // Iterator interface in terms of a single ._invoke method.
171
- function defineIteratorMethods(prototype) {
172
- ["next", "throw", "return"].forEach(function (method) {
173
- define(prototype, method, function (arg) {
174
- return this._invoke(method, arg);
175
- });
176
- });
177
- }
178
- exports.isGeneratorFunction = function (genFun) {
179
- var ctor = typeof genFun === "function" && genFun.constructor;
180
- return ctor ? ctor === GeneratorFunction ||
181
- // For the native GeneratorFunction constructor, the best we can
182
- // do is to check its .name property.
183
- (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
184
- };
185
- exports.mark = function (genFun) {
186
- if (Object.setPrototypeOf) {
187
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
188
- } else {
189
- genFun.__proto__ = GeneratorFunctionPrototype;
190
- define(genFun, toStringTagSymbol, "GeneratorFunction");
191
- }
192
- genFun.prototype = Object.create(Gp);
193
- return genFun;
194
- };
195
-
196
- // Within the body of any async function, `await x` is transformed to
197
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
198
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
199
- // meant to be awaited.
200
- exports.awrap = function (arg) {
201
- return {
202
- __await: arg
203
- };
204
- };
205
- function AsyncIterator(generator, PromiseImpl) {
206
- function invoke(method, arg, resolve, reject) {
207
- var record = tryCatch(generator[method], generator, arg);
208
- if (record.type === "throw") {
209
- reject(record.arg);
210
- } else {
211
- var result = record.arg;
212
- var value = result.value;
213
- if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
214
- return PromiseImpl.resolve(value.__await).then(function (value) {
215
- invoke("next", value, resolve, reject);
216
- }, function (err) {
217
- invoke("throw", err, resolve, reject);
218
- });
219
- }
220
- return PromiseImpl.resolve(value).then(function (unwrapped) {
221
- // When a yielded Promise is resolved, its final value becomes
222
- // the .value of the Promise<{value,done}> result for the
223
- // current iteration.
224
- result.value = unwrapped;
225
- resolve(result);
226
- }, function (error) {
227
- // If a rejected Promise was yielded, throw the rejection back
228
- // into the async generator function so it can be handled there.
229
- return invoke("throw", error, resolve, reject);
230
- });
231
- }
232
- }
233
- var previousPromise;
234
- function enqueue(method, arg) {
235
- function callInvokeWithMethodAndArg() {
236
- return new PromiseImpl(function (resolve, reject) {
237
- invoke(method, arg, resolve, reject);
238
- });
239
- }
240
- return previousPromise =
241
- // If enqueue has been called before, then we want to wait until
242
- // all previous Promises have been resolved before calling invoke,
243
- // so that results are always delivered in the correct order. If
244
- // enqueue has not been called before, then it is important to
245
- // call invoke immediately, without waiting on a callback to fire,
246
- // so that the async generator function has the opportunity to do
247
- // any necessary setup in a predictable way. This predictability
248
- // is why the Promise constructor synchronously invokes its
249
- // executor callback, and why async functions synchronously
250
- // execute code before the first await. Since we implement simple
251
- // async functions in terms of async generators, it is especially
252
- // important to get this right, even though it requires care.
253
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
254
- // Avoid propagating failures to Promises returned by later
255
- // invocations of the iterator.
256
- callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
257
- }
258
-
259
- // Define the unified helper method that is used to implement .next,
260
- // .throw, and .return (see defineIteratorMethods).
261
- this._invoke = enqueue;
262
- }
263
- defineIteratorMethods(AsyncIterator.prototype);
264
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
265
- return this;
266
- });
267
- exports.AsyncIterator = AsyncIterator;
268
-
269
- // Note that simple async functions are implemented on top of
270
- // AsyncIterator objects; they just return a Promise for the value of
271
- // the final result produced by the iterator.
272
- exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
273
- if (PromiseImpl === void 0) PromiseImpl = Promise;
274
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
275
- return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
276
- : iter.next().then(function (result) {
277
- return result.done ? result.value : iter.next();
278
- });
279
- };
280
- function makeInvokeMethod(innerFn, self, context) {
281
- var state = GenStateSuspendedStart;
282
- return function invoke(method, arg) {
283
- if (state === GenStateExecuting) {
284
- throw new Error("Generator is already running");
285
- }
286
- if (state === GenStateCompleted) {
287
- if (method === "throw") {
288
- throw arg;
289
- }
290
-
291
- // Be forgiving, per 25.3.3.3.3 of the spec:
292
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
293
- return doneResult();
294
- }
295
- context.method = method;
296
- context.arg = arg;
297
- while (true) {
298
- var delegate = context.delegate;
299
- if (delegate) {
300
- var delegateResult = maybeInvokeDelegate(delegate, context);
301
- if (delegateResult) {
302
- if (delegateResult === ContinueSentinel) continue;
303
- return delegateResult;
304
- }
305
- }
306
- if (context.method === "next") {
307
- // Setting context._sent for legacy support of Babel's
308
- // function.sent implementation.
309
- context.sent = context._sent = context.arg;
310
- } else if (context.method === "throw") {
311
- if (state === GenStateSuspendedStart) {
312
- state = GenStateCompleted;
313
- throw context.arg;
314
- }
315
- context.dispatchException(context.arg);
316
- } else if (context.method === "return") {
317
- context.abrupt("return", context.arg);
318
- }
319
- state = GenStateExecuting;
320
- var record = tryCatch(innerFn, self, context);
321
- if (record.type === "normal") {
322
- // If an exception is thrown from innerFn, we leave state ===
323
- // GenStateExecuting and loop back for another invocation.
324
- state = context.done ? GenStateCompleted : GenStateSuspendedYield;
325
- if (record.arg === ContinueSentinel) {
326
- continue;
327
- }
328
- return {
329
- value: record.arg,
330
- done: context.done
331
- };
332
- } else if (record.type === "throw") {
333
- state = GenStateCompleted;
334
- // Dispatch the exception by looping back around to the
335
- // context.dispatchException(context.arg) call above.
336
- context.method = "throw";
337
- context.arg = record.arg;
338
- }
339
- }
340
- };
341
- }
342
-
343
- // Call delegate.iterator[context.method](context.arg) and handle the
344
- // result, either by returning a { value, done } result from the
345
- // delegate iterator, or by modifying context.method and context.arg,
346
- // setting context.delegate to null, and returning the ContinueSentinel.
347
- function maybeInvokeDelegate(delegate, context) {
348
- var method = delegate.iterator[context.method];
349
- if (method === undefined$1) {
350
- // A .throw or .return when the delegate iterator has no .throw
351
- // method always terminates the yield* loop.
352
- context.delegate = null;
353
- if (context.method === "throw") {
354
- // Note: ["return"] must be used for ES3 parsing compatibility.
355
- if (delegate.iterator["return"]) {
356
- // If the delegate iterator has a return method, give it a
357
- // chance to clean up.
358
- context.method = "return";
359
- context.arg = undefined$1;
360
- maybeInvokeDelegate(delegate, context);
361
- if (context.method === "throw") {
362
- // If maybeInvokeDelegate(context) changed context.method from
363
- // "return" to "throw", let that override the TypeError below.
364
- return ContinueSentinel;
365
- }
366
- }
367
- context.method = "throw";
368
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
369
- }
370
- return ContinueSentinel;
371
- }
372
- var record = tryCatch(method, delegate.iterator, context.arg);
373
- if (record.type === "throw") {
374
- context.method = "throw";
375
- context.arg = record.arg;
376
- context.delegate = null;
377
- return ContinueSentinel;
378
- }
379
- var info = record.arg;
380
- if (!info) {
381
- context.method = "throw";
382
- context.arg = new TypeError("iterator result is not an object");
383
- context.delegate = null;
384
- return ContinueSentinel;
385
- }
386
- if (info.done) {
387
- // Assign the result of the finished delegate to the temporary
388
- // variable specified by delegate.resultName (see delegateYield).
389
- context[delegate.resultName] = info.value;
390
-
391
- // Resume execution at the desired location (see delegateYield).
392
- context.next = delegate.nextLoc;
393
-
394
- // If context.method was "throw" but the delegate handled the
395
- // exception, let the outer generator proceed normally. If
396
- // context.method was "next", forget context.arg since it has been
397
- // "consumed" by the delegate iterator. If context.method was
398
- // "return", allow the original .return call to continue in the
399
- // outer generator.
400
- if (context.method !== "return") {
401
- context.method = "next";
402
- context.arg = undefined$1;
403
- }
404
- } else {
405
- // Re-yield the result returned by the delegate method.
406
- return info;
407
- }
408
-
409
- // The delegate iterator is finished, so forget it and continue with
410
- // the outer generator.
411
- context.delegate = null;
412
- return ContinueSentinel;
413
- }
414
-
415
- // Define Generator.prototype.{next,throw,return} in terms of the
416
- // unified ._invoke helper method.
417
- defineIteratorMethods(Gp);
418
- define(Gp, toStringTagSymbol, "Generator");
419
-
420
- // A Generator should always return itself as the iterator object when the
421
- // @@iterator function is called on it. Some browsers' implementations of the
422
- // iterator prototype chain incorrectly implement this, causing the Generator
423
- // object to not be returned from this call. This ensures that doesn't happen.
424
- // See https://github.com/facebook/regenerator/issues/274 for more details.
425
- define(Gp, iteratorSymbol, function () {
426
- return this;
427
- });
428
- define(Gp, "toString", function () {
429
- return "[object Generator]";
430
- });
431
- function pushTryEntry(locs) {
432
- var entry = {
433
- tryLoc: locs[0]
434
- };
435
- if (1 in locs) {
436
- entry.catchLoc = locs[1];
437
- }
438
- if (2 in locs) {
439
- entry.finallyLoc = locs[2];
440
- entry.afterLoc = locs[3];
441
- }
442
- this.tryEntries.push(entry);
443
- }
444
- function resetTryEntry(entry) {
445
- var record = entry.completion || {};
446
- record.type = "normal";
447
- delete record.arg;
448
- entry.completion = record;
449
- }
450
- function Context(tryLocsList) {
451
- // The root entry object (effectively a try statement without a catch
452
- // or a finally block) gives us a place to store values thrown from
453
- // locations where there is no enclosing try statement.
454
- this.tryEntries = [{
455
- tryLoc: "root"
456
- }];
457
- tryLocsList.forEach(pushTryEntry, this);
458
- this.reset(true);
459
- }
460
- exports.keys = function (object) {
461
- var keys = [];
462
- for (var key in object) {
463
- keys.push(key);
464
- }
465
- keys.reverse();
466
-
467
- // Rather than returning an object with a next method, we keep
468
- // things simple and return the next function itself.
469
- return function next() {
470
- while (keys.length) {
471
- var key = keys.pop();
472
- if (key in object) {
473
- next.value = key;
474
- next.done = false;
475
- return next;
476
- }
477
- }
478
-
479
- // To avoid creating an additional object, we just hang the .value
480
- // and .done properties off the next function object itself. This
481
- // also ensures that the minifier will not anonymize the function.
482
- next.done = true;
483
- return next;
484
- };
485
- };
486
- function values(iterable) {
487
- if (iterable) {
488
- var iteratorMethod = iterable[iteratorSymbol];
489
- if (iteratorMethod) {
490
- return iteratorMethod.call(iterable);
491
- }
492
- if (typeof iterable.next === "function") {
493
- return iterable;
494
- }
495
- if (!isNaN(iterable.length)) {
496
- var i = -1,
497
- next = function next() {
498
- while (++i < iterable.length) {
499
- if (hasOwn.call(iterable, i)) {
500
- next.value = iterable[i];
501
- next.done = false;
502
- return next;
503
- }
504
- }
505
- next.value = undefined$1;
506
- next.done = true;
507
- return next;
508
- };
509
- return next.next = next;
510
- }
511
- }
512
-
513
- // Return an iterator with no values.
514
- return {
515
- next: doneResult
516
- };
517
- }
518
- exports.values = values;
519
- function doneResult() {
520
- return {
521
- value: undefined$1,
522
- done: true
523
- };
524
- }
525
- Context.prototype = {
526
- constructor: Context,
527
- reset: function reset(skipTempReset) {
528
- this.prev = 0;
529
- this.next = 0;
530
- // Resetting context._sent for legacy support of Babel's
531
- // function.sent implementation.
532
- this.sent = this._sent = undefined$1;
533
- this.done = false;
534
- this.delegate = null;
535
- this.method = "next";
536
- this.arg = undefined$1;
537
- this.tryEntries.forEach(resetTryEntry);
538
- if (!skipTempReset) {
539
- for (var name in this) {
540
- // Not sure about the optimal order of these conditions:
541
- if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
542
- this[name] = undefined$1;
543
- }
544
- }
545
- }
546
- },
547
- stop: function stop() {
548
- this.done = true;
549
- var rootEntry = this.tryEntries[0];
550
- var rootRecord = rootEntry.completion;
551
- if (rootRecord.type === "throw") {
552
- throw rootRecord.arg;
553
- }
554
- return this.rval;
555
- },
556
- dispatchException: function dispatchException(exception) {
557
- if (this.done) {
558
- throw exception;
559
- }
560
- var context = this;
561
- function handle(loc, caught) {
562
- record.type = "throw";
563
- record.arg = exception;
564
- context.next = loc;
565
- if (caught) {
566
- // If the dispatched exception was caught by a catch block,
567
- // then let that catch block handle the exception normally.
568
- context.method = "next";
569
- context.arg = undefined$1;
570
- }
571
- return !!caught;
572
- }
573
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
574
- var entry = this.tryEntries[i];
575
- var record = entry.completion;
576
- if (entry.tryLoc === "root") {
577
- // Exception thrown outside of any try block that could handle
578
- // it, so set the completion value of the entire function to
579
- // throw the exception.
580
- return handle("end");
581
- }
582
- if (entry.tryLoc <= this.prev) {
583
- var hasCatch = hasOwn.call(entry, "catchLoc");
584
- var hasFinally = hasOwn.call(entry, "finallyLoc");
585
- if (hasCatch && hasFinally) {
586
- if (this.prev < entry.catchLoc) {
587
- return handle(entry.catchLoc, true);
588
- } else if (this.prev < entry.finallyLoc) {
589
- return handle(entry.finallyLoc);
590
- }
591
- } else if (hasCatch) {
592
- if (this.prev < entry.catchLoc) {
593
- return handle(entry.catchLoc, true);
594
- }
595
- } else if (hasFinally) {
596
- if (this.prev < entry.finallyLoc) {
597
- return handle(entry.finallyLoc);
598
- }
599
- } else {
600
- throw new Error("try statement without catch or finally");
601
- }
602
- }
603
- }
604
- },
605
- abrupt: function abrupt(type, arg) {
606
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
607
- var entry = this.tryEntries[i];
608
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
609
- var finallyEntry = entry;
610
- break;
611
- }
612
- }
613
- if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
614
- // Ignore the finally entry if control is not jumping to a
615
- // location outside the try/catch block.
616
- finallyEntry = null;
617
- }
618
- var record = finallyEntry ? finallyEntry.completion : {};
619
- record.type = type;
620
- record.arg = arg;
621
- if (finallyEntry) {
622
- this.method = "next";
623
- this.next = finallyEntry.finallyLoc;
624
- return ContinueSentinel;
625
- }
626
- return this.complete(record);
627
- },
628
- complete: function complete(record, afterLoc) {
629
- if (record.type === "throw") {
630
- throw record.arg;
631
- }
632
- if (record.type === "break" || record.type === "continue") {
633
- this.next = record.arg;
634
- } else if (record.type === "return") {
635
- this.rval = this.arg = record.arg;
636
- this.method = "return";
637
- this.next = "end";
638
- } else if (record.type === "normal" && afterLoc) {
639
- this.next = afterLoc;
640
- }
641
- return ContinueSentinel;
642
- },
643
- finish: function finish(finallyLoc) {
644
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
645
- var entry = this.tryEntries[i];
646
- if (entry.finallyLoc === finallyLoc) {
647
- this.complete(entry.completion, entry.afterLoc);
648
- resetTryEntry(entry);
649
- return ContinueSentinel;
650
- }
651
- }
652
- },
653
- "catch": function _catch(tryLoc) {
654
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
655
- var entry = this.tryEntries[i];
656
- if (entry.tryLoc === tryLoc) {
657
- var record = entry.completion;
658
- if (record.type === "throw") {
659
- var thrown = record.arg;
660
- resetTryEntry(entry);
661
- }
662
- return thrown;
663
- }
664
- }
665
-
666
- // The context.catch method must only be called with a location
667
- // argument that corresponds to a known catch block.
668
- throw new Error("illegal catch attempt");
669
- },
670
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
671
- this.delegate = {
672
- iterator: values(iterable),
673
- resultName: resultName,
674
- nextLoc: nextLoc
675
- };
676
- if (this.method === "next") {
677
- // Deliberately forget the last sent value so that we don't
678
- // accidentally pass it on to the delegate.
679
- this.arg = undefined$1;
680
- }
681
- return ContinueSentinel;
682
- }
683
- };
684
-
685
- // Regardless of whether this script is executing as a CommonJS module
686
- // or not, return the runtime object so that we can declare the variable
687
- // regeneratorRuntime in the outer scope, which allows this module to be
688
- // injected easily by `bin/regenerator --include-runtime script.js`.
689
- return exports;
690
- }(
691
- // If this script is executing as a CommonJS module, use module.exports
692
- // as the regeneratorRuntime namespace. Otherwise create a new empty
693
- // object. Either way, the resulting object will be used to initialize
694
- // the regeneratorRuntime variable at the top of this file.
695
- module.exports );
696
- try {
697
- regeneratorRuntime = runtime;
698
- } catch (accidentalStrictMode) {
699
- // This module should not be running in strict mode, so the above
700
- // assignment should always work unless something is misconfigured. Just
701
- // in case runtime.js accidentally runs in strict mode, in modern engines
702
- // we can explicitly access globalThis. In older engines we can escape
703
- // strict mode using a global Function call. This could conceivably fail
704
- // if a Content Security Policy forbids using Function, but in that case
705
- // the proper solution is to fix the accidental strict mode problem. If
706
- // you've misconfigured your bundler to force strict mode and applied a
707
- // CSP to forbid Function, and you're not willing to fix either of those
708
- // problems, please detail your unique predicament in a GitHub issue.
709
- if (typeof globalThis === "object") {
710
- globalThis.regeneratorRuntime = runtime;
711
- } else {
712
- Function("r", "regeneratorRuntime = r")(runtime);
713
- }
714
- }
715
- });
716
-
360
+ var _executePlasmicDataOp2, _executePlasmicDataOp3;
717
361
  var DEFAULT_HOST = 'https://data.plasmic.app';
718
362
  var UNAUTHORIZED_MESSAGE = 'You do not have permission to perform this operation. Login to get access or contact the app owner to get access.';
719
363
  function executePlasmicDataOp(_x, _x2) {
720
- return _executePlasmicDataOp2.apply(this, arguments);
721
- }
722
- function _executePlasmicDataOp2() {
723
- _executePlasmicDataOp2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(op, opts) {
364
+ return (_executePlasmicDataOp2 = _executePlasmicDataOp2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(op, opts) {
724
365
  var func, res;
725
- return runtime_1.wrap(function _callee$(_context) {
726
- while (1) {
727
- switch (_context.prev = _context.next) {
728
- case 0:
729
- func = getConfig('__PLASMIC_EXECUTE_DATA_OP', _executePlasmicDataOp);
730
- _context.next = 3;
731
- return query.wrapLoadingFetcher(func)(op, opts);
732
- case 3:
733
- res = _context.sent;
734
- return _context.abrupt("return", res);
735
- case 5:
736
- case "end":
737
- return _context.stop();
738
- }
366
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
367
+ while (1) switch (_context.prev = _context.next) {
368
+ case 0:
369
+ func = getConfig('__PLASMIC_EXECUTE_DATA_OP', _executePlasmicDataOp);
370
+ _context.next = 3;
371
+ return query.wrapLoadingFetcher(func)(op, opts);
372
+ case 3:
373
+ res = _context.sent;
374
+ return _context.abrupt("return", res);
375
+ case 5:
376
+ case "end":
377
+ return _context.stop();
739
378
  }
740
379
  }, _callee);
741
- }));
742
- return _executePlasmicDataOp2.apply(this, arguments);
380
+ }))).apply(this, arguments);
743
381
  }
744
382
  function _executePlasmicDataOp(_x3, _x4) {
745
- return _executePlasmicDataOp3.apply(this, arguments);
746
- }
747
- function _executePlasmicDataOp3() {
748
- _executePlasmicDataOp3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(op, opts) {
383
+ return (_executePlasmicDataOp3 = _executePlasmicDataOp3 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(op, opts) {
749
384
  var _op$userArgs;
750
385
  var host, url, resp, text;
751
- return runtime_1.wrap(function _callee2$(_context2) {
752
- while (1) {
753
- switch (_context2.prev = _context2.next) {
754
- case 0:
755
- if (!op.roleId) {
756
- _context2.next = 4;
757
- break;
758
- }
759
- if (!(!(opts != null && opts.user) || !opts.user.roleIds.includes(op.roleId))) {
760
- _context2.next = 4;
761
- break;
762
- }
763
- console.error(UNAUTHORIZED_MESSAGE);
764
- throw new Error(UNAUTHORIZED_MESSAGE);
765
- case 4:
766
- host = getConfig('__PLASMIC_DATA_HOST', DEFAULT_HOST);
767
- url = host + "/api/v1/server-data/sources/" + op.sourceId + "/execute";
768
- _context2.next = 8;
769
- return fetch(url, {
770
- method: 'POST',
771
- headers: _extends({
772
- 'Content-Type': 'application/json'
773
- }, (opts == null ? void 0 : opts.userAuthToken) && {
774
- 'x-plasmic-data-user-auth-token': opts.userAuthToken
775
- }),
776
- body: stringify({
777
- opId: op.opId,
778
- userArgs: (_op$userArgs = op.userArgs) != null ? _op$userArgs : {},
779
- paginate: opts == null ? void 0 : opts.paginate
780
- })
781
- });
782
- case 8:
783
- resp = _context2.sent;
784
- if (!(resp.status !== 200)) {
785
- _context2.next = 14;
786
- break;
787
- }
788
- _context2.next = 12;
789
- return resp.text();
790
- case 12:
791
- text = _context2.sent;
792
- throw new Error(text);
793
- case 14:
794
- _context2.next = 16;
795
- return resp.json();
796
- case 16:
797
- return _context2.abrupt("return", _context2.sent);
798
- case 17:
799
- case "end":
800
- return _context2.stop();
801
- }
386
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
387
+ while (1) switch (_context2.prev = _context2.next) {
388
+ case 0:
389
+ if (!op.roleId) {
390
+ _context2.next = 4;
391
+ break;
392
+ }
393
+ if (!(!(opts != null && opts.user) || !opts.user.roleIds.includes(op.roleId))) {
394
+ _context2.next = 4;
395
+ break;
396
+ }
397
+ console.error(UNAUTHORIZED_MESSAGE);
398
+ throw new Error(UNAUTHORIZED_MESSAGE);
399
+ case 4:
400
+ host = getConfig('__PLASMIC_DATA_HOST', DEFAULT_HOST);
401
+ url = host + "/api/v1/server-data/sources/" + op.sourceId + "/execute";
402
+ _context2.next = 8;
403
+ return fetch(url, {
404
+ method: 'POST',
405
+ headers: _extends({
406
+ 'Content-Type': 'application/json'
407
+ }, (opts == null ? void 0 : opts.userAuthToken) && {
408
+ 'x-plasmic-data-user-auth-token': opts.userAuthToken
409
+ }),
410
+ body: stringify({
411
+ opId: op.opId,
412
+ userArgs: (_op$userArgs = op.userArgs) != null ? _op$userArgs : {},
413
+ paginate: opts == null ? void 0 : opts.paginate
414
+ })
415
+ });
416
+ case 8:
417
+ resp = _context2.sent;
418
+ if (!(resp.status !== 200)) {
419
+ _context2.next = 14;
420
+ break;
421
+ }
422
+ _context2.next = 12;
423
+ return resp.text();
424
+ case 12:
425
+ text = _context2.sent;
426
+ throw new Error(text);
427
+ case 14:
428
+ _context2.next = 16;
429
+ return resp.json();
430
+ case 16:
431
+ return _context2.abrupt("return", _context2.sent);
432
+ case 17:
433
+ case "end":
434
+ return _context2.stop();
802
435
  }
803
436
  }, _callee2);
804
- }));
805
- return _executePlasmicDataOp3.apply(this, arguments);
437
+ }))).apply(this, arguments);
806
438
  }
807
439
  function getConfig(key, defaultValue) {
808
440
  if (typeof globalThis === 'undefined') {
@@ -959,29 +591,27 @@ function usePlasmicDataMutationOp(dataOp) {
959
591
  userArgs = _ref.userArgs;
960
592
  var ctx = dataSourcesContext.usePlasmicDataSourceContext();
961
593
  var userToken = ctx == null ? void 0 : ctx.userAuthToken;
962
- return React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
963
- return runtime_1.wrap(function _callee$(_context) {
964
- while (1) {
965
- switch (_context.prev = _context.next) {
966
- case 0:
967
- if (!(!sourceId || !opId)) {
968
- _context.next = 2;
969
- break;
970
- }
971
- return _context.abrupt("return", undefined);
972
- case 2:
973
- return _context.abrupt("return", executePlasmicDataOp({
974
- sourceId: sourceId,
975
- opId: opId,
976
- userArgs: userArgs
977
- }, {
978
- userAuthToken: userToken || undefined,
979
- user: ctx == null ? void 0 : ctx.user
980
- }));
981
- case 3:
982
- case "end":
983
- return _context.stop();
984
- }
594
+ return React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
595
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
596
+ while (1) switch (_context.prev = _context.next) {
597
+ case 0:
598
+ if (!(!sourceId || !opId)) {
599
+ _context.next = 2;
600
+ break;
601
+ }
602
+ return _context.abrupt("return", undefined);
603
+ case 2:
604
+ return _context.abrupt("return", executePlasmicDataOp({
605
+ sourceId: sourceId,
606
+ opId: opId,
607
+ userArgs: userArgs
608
+ }, {
609
+ userAuthToken: userToken || undefined,
610
+ user: ctx == null ? void 0 : ctx.user
611
+ }));
612
+ case 3:
613
+ case "end":
614
+ return _context.stop();
985
615
  }
986
616
  }, _callee);
987
617
  })), [sourceId, opId, userArgs, userToken]);