google-sheets-mapper 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/dist/google-sheets-mapper.cjs.development.js +370 -760
- package/dist/google-sheets-mapper.cjs.development.js.map +1 -1
- package/dist/google-sheets-mapper.cjs.production.min.js +1 -1
- package/dist/google-sheets-mapper.cjs.production.min.js.map +1 -1
- package/dist/google-sheets-mapper.esm.js +370 -760
- package/dist/google-sheets-mapper.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/types.d.ts +8 -4
- package/dist/utils.d.ts +6 -3
- package/package.json +5 -25
- package/src/index.ts +4 -4
- package/src/types.ts +9 -4
- package/src/utils.ts +32 -19
|
@@ -2,893 +2,484 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
var info = gen[key](arg);
|
|
8
|
-
var value = info.value;
|
|
9
|
-
} catch (error) {
|
|
10
|
-
reject(error);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (info.done) {
|
|
15
|
-
resolve(value);
|
|
16
|
-
} else {
|
|
17
|
-
Promise.resolve(value).then(_next, _throw);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _asyncToGenerator(fn) {
|
|
22
|
-
return function () {
|
|
23
|
-
var self = this,
|
|
24
|
-
args = arguments;
|
|
25
|
-
return new Promise(function (resolve, reject) {
|
|
26
|
-
var gen = fn.apply(self, args);
|
|
27
|
-
|
|
28
|
-
function _next(value) {
|
|
29
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _throw(err) {
|
|
33
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
_next(undefined);
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _inheritsLoose(subClass, superClass) {
|
|
42
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
43
|
-
subClass.prototype.constructor = subClass;
|
|
44
|
-
subClass.__proto__ = superClass;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _getPrototypeOf(o) {
|
|
48
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
49
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
50
|
-
};
|
|
51
|
-
return _getPrototypeOf(o);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _setPrototypeOf(o, p) {
|
|
55
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
56
|
-
o.__proto__ = p;
|
|
57
|
-
return o;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return _setPrototypeOf(o, p);
|
|
61
|
-
}
|
|
5
|
+
function _regeneratorRuntime() {
|
|
6
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
62
7
|
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
if (Reflect.construct.sham) return false;
|
|
66
|
-
if (typeof Proxy === "function") return true;
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
70
|
-
return true;
|
|
71
|
-
} catch (e) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function _construct(Parent, args, Class) {
|
|
77
|
-
if (_isNativeReflectConstruct()) {
|
|
78
|
-
_construct = Reflect.construct;
|
|
79
|
-
} else {
|
|
80
|
-
_construct = function _construct(Parent, args, Class) {
|
|
81
|
-
var a = [null];
|
|
82
|
-
a.push.apply(a, args);
|
|
83
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
84
|
-
var instance = new Constructor();
|
|
85
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
86
|
-
return instance;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return _construct.apply(null, arguments);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _isNativeFunction(fn) {
|
|
94
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function _wrapNativeSuper(Class) {
|
|
98
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
99
|
-
|
|
100
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
101
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
102
|
-
|
|
103
|
-
if (typeof Class !== "function") {
|
|
104
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (typeof _cache !== "undefined") {
|
|
108
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
109
|
-
|
|
110
|
-
_cache.set(Class, Wrapper);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function Wrapper() {
|
|
114
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
118
|
-
constructor: {
|
|
119
|
-
value: Wrapper,
|
|
120
|
-
enumerable: false,
|
|
121
|
-
writable: true,
|
|
122
|
-
configurable: true
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
8
|
+
_regeneratorRuntime = function () {
|
|
9
|
+
return exports;
|
|
126
10
|
};
|
|
127
11
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return self;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function createCommonjsModule(fn, module) {
|
|
140
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
var runtime_1 = createCommonjsModule(function (module) {
|
|
144
|
-
/**
|
|
145
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
146
|
-
*
|
|
147
|
-
* This source code is licensed under the MIT license found in the
|
|
148
|
-
* LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
var runtime = (function (exports) {
|
|
152
|
-
|
|
153
|
-
var Op = Object.prototype;
|
|
154
|
-
var hasOwn = Op.hasOwnProperty;
|
|
155
|
-
var undefined$1; // More compressible than void 0.
|
|
156
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
157
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
158
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
159
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
12
|
+
var exports = {},
|
|
13
|
+
Op = Object.prototype,
|
|
14
|
+
hasOwn = Op.hasOwnProperty,
|
|
15
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
16
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
17
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
18
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
160
19
|
|
|
161
20
|
function define(obj, key, value) {
|
|
162
|
-
Object.defineProperty(obj, key, {
|
|
21
|
+
return Object.defineProperty(obj, key, {
|
|
163
22
|
value: value,
|
|
164
|
-
enumerable:
|
|
165
|
-
configurable:
|
|
166
|
-
writable:
|
|
167
|
-
});
|
|
168
|
-
return obj[key];
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
configurable: !0,
|
|
25
|
+
writable: !0
|
|
26
|
+
}), obj[key];
|
|
169
27
|
}
|
|
28
|
+
|
|
170
29
|
try {
|
|
171
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
172
30
|
define({}, "");
|
|
173
31
|
} catch (err) {
|
|
174
|
-
define = function(obj, key, value) {
|
|
32
|
+
define = function (obj, key, value) {
|
|
175
33
|
return obj[key] = value;
|
|
176
34
|
};
|
|
177
35
|
}
|
|
178
36
|
|
|
179
37
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
38
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
39
|
+
generator = Object.create(protoGenerator.prototype),
|
|
40
|
+
context = new Context(tryLocsList || []);
|
|
41
|
+
return generator._invoke = function (innerFn, self, context) {
|
|
42
|
+
var state = "suspendedStart";
|
|
43
|
+
return function (method, arg) {
|
|
44
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
45
|
+
|
|
46
|
+
if ("completed" === state) {
|
|
47
|
+
if ("throw" === method) throw arg;
|
|
48
|
+
return doneResult();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (context.method = method, context.arg = arg;;) {
|
|
52
|
+
var delegate = context.delegate;
|
|
184
53
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
54
|
+
if (delegate) {
|
|
55
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
188
56
|
|
|
189
|
-
|
|
57
|
+
if (delegateResult) {
|
|
58
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
59
|
+
return delegateResult;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
64
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
65
|
+
context.dispatchException(context.arg);
|
|
66
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
67
|
+
state = "executing";
|
|
68
|
+
var record = tryCatch(innerFn, self, context);
|
|
69
|
+
|
|
70
|
+
if ("normal" === record.type) {
|
|
71
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
72
|
+
return {
|
|
73
|
+
value: record.arg,
|
|
74
|
+
done: context.done
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}(innerFn, self, context), generator;
|
|
190
82
|
}
|
|
191
|
-
exports.wrap = wrap;
|
|
192
83
|
|
|
193
|
-
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
194
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
195
|
-
// have been (and was previously) designed to take a closure to be
|
|
196
|
-
// invoked without arguments, but in all the cases we care about we
|
|
197
|
-
// already have an existing method we want to call, so there's no need
|
|
198
|
-
// to create a new function object. We can even get away with assuming
|
|
199
|
-
// the method takes exactly one argument, since that happens to be true
|
|
200
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
201
|
-
// only additional allocation required is the completion record, which
|
|
202
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
203
84
|
function tryCatch(fn, obj, arg) {
|
|
204
85
|
try {
|
|
205
|
-
return {
|
|
86
|
+
return {
|
|
87
|
+
type: "normal",
|
|
88
|
+
arg: fn.call(obj, arg)
|
|
89
|
+
};
|
|
206
90
|
} catch (err) {
|
|
207
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
type: "throw",
|
|
93
|
+
arg: err
|
|
94
|
+
};
|
|
208
95
|
}
|
|
209
96
|
}
|
|
210
97
|
|
|
211
|
-
|
|
212
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
213
|
-
var GenStateExecuting = "executing";
|
|
214
|
-
var GenStateCompleted = "completed";
|
|
215
|
-
|
|
216
|
-
// Returning this object from the innerFn has the same effect as
|
|
217
|
-
// breaking out of the dispatch switch statement.
|
|
98
|
+
exports.wrap = wrap;
|
|
218
99
|
var ContinueSentinel = {};
|
|
219
100
|
|
|
220
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
221
|
-
// .constructor.prototype properties for functions that return Generator
|
|
222
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
223
|
-
// minifier not to mangle the names of these two functions.
|
|
224
101
|
function Generator() {}
|
|
102
|
+
|
|
225
103
|
function GeneratorFunction() {}
|
|
104
|
+
|
|
226
105
|
function GeneratorFunctionPrototype() {}
|
|
227
106
|
|
|
228
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
229
|
-
// don't natively support it.
|
|
230
107
|
var IteratorPrototype = {};
|
|
231
|
-
IteratorPrototype
|
|
108
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
232
109
|
return this;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
NativeIteratorPrototype !== Op &&
|
|
239
|
-
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
240
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
241
|
-
// of the polyfill.
|
|
242
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
243
|
-
}
|
|
110
|
+
});
|
|
111
|
+
var getProto = Object.getPrototypeOf,
|
|
112
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
113
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
114
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
244
115
|
|
|
245
|
-
var Gp = GeneratorFunctionPrototype.prototype =
|
|
246
|
-
Generator.prototype = Object.create(IteratorPrototype);
|
|
247
|
-
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
248
|
-
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
249
|
-
GeneratorFunction.displayName = define(
|
|
250
|
-
GeneratorFunctionPrototype,
|
|
251
|
-
toStringTagSymbol,
|
|
252
|
-
"GeneratorFunction"
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
// Helper for defining the .next, .throw, and .return methods of the
|
|
256
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
257
116
|
function defineIteratorMethods(prototype) {
|
|
258
|
-
["next", "throw", "return"].forEach(function(method) {
|
|
259
|
-
define(prototype, method, function(arg) {
|
|
117
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
118
|
+
define(prototype, method, function (arg) {
|
|
260
119
|
return this._invoke(method, arg);
|
|
261
120
|
});
|
|
262
121
|
});
|
|
263
122
|
}
|
|
264
123
|
|
|
265
|
-
exports.isGeneratorFunction = function(genFun) {
|
|
266
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
267
|
-
return ctor
|
|
268
|
-
? ctor === GeneratorFunction ||
|
|
269
|
-
// For the native GeneratorFunction constructor, the best we can
|
|
270
|
-
// do is to check its .name property.
|
|
271
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
272
|
-
: false;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
exports.mark = function(genFun) {
|
|
276
|
-
if (Object.setPrototypeOf) {
|
|
277
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
278
|
-
} else {
|
|
279
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
280
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
281
|
-
}
|
|
282
|
-
genFun.prototype = Object.create(Gp);
|
|
283
|
-
return genFun;
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// Within the body of any async function, `await x` is transformed to
|
|
287
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
288
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
289
|
-
// meant to be awaited.
|
|
290
|
-
exports.awrap = function(arg) {
|
|
291
|
-
return { __await: arg };
|
|
292
|
-
};
|
|
293
|
-
|
|
294
124
|
function AsyncIterator(generator, PromiseImpl) {
|
|
295
125
|
function invoke(method, arg, resolve, reject) {
|
|
296
126
|
var record = tryCatch(generator[method], generator, arg);
|
|
297
|
-
if (record.type === "throw") {
|
|
298
|
-
reject(record.arg);
|
|
299
|
-
} else {
|
|
300
|
-
var result = record.arg;
|
|
301
|
-
var value = result.value;
|
|
302
|
-
if (value &&
|
|
303
|
-
typeof value === "object" &&
|
|
304
|
-
hasOwn.call(value, "__await")) {
|
|
305
|
-
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|
306
|
-
invoke("next", value, resolve, reject);
|
|
307
|
-
}, function(err) {
|
|
308
|
-
invoke("throw", err, resolve, reject);
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
127
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
128
|
+
if ("throw" !== record.type) {
|
|
129
|
+
var result = record.arg,
|
|
130
|
+
value = result.value;
|
|
131
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
132
|
+
invoke("next", value, resolve, reject);
|
|
133
|
+
}, function (err) {
|
|
134
|
+
invoke("throw", err, resolve, reject);
|
|
135
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
136
|
+
result.value = unwrapped, resolve(result);
|
|
137
|
+
}, function (error) {
|
|
321
138
|
return invoke("throw", error, resolve, reject);
|
|
322
139
|
});
|
|
323
140
|
}
|
|
141
|
+
|
|
142
|
+
reject(record.arg);
|
|
324
143
|
}
|
|
325
144
|
|
|
326
145
|
var previousPromise;
|
|
327
146
|
|
|
328
|
-
function
|
|
147
|
+
this._invoke = function (method, arg) {
|
|
329
148
|
function callInvokeWithMethodAndArg() {
|
|
330
|
-
return new PromiseImpl(function(resolve, reject) {
|
|
149
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
331
150
|
invoke(method, arg, resolve, reject);
|
|
332
151
|
});
|
|
333
152
|
}
|
|
334
153
|
|
|
335
|
-
return previousPromise =
|
|
336
|
-
// If enqueue has been called before, then we want to wait until
|
|
337
|
-
// all previous Promises have been resolved before calling invoke,
|
|
338
|
-
// so that results are always delivered in the correct order. If
|
|
339
|
-
// enqueue has not been called before, then it is important to
|
|
340
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
341
|
-
// so that the async generator function has the opportunity to do
|
|
342
|
-
// any necessary setup in a predictable way. This predictability
|
|
343
|
-
// is why the Promise constructor synchronously invokes its
|
|
344
|
-
// executor callback, and why async functions synchronously
|
|
345
|
-
// execute code before the first await. Since we implement simple
|
|
346
|
-
// async functions in terms of async generators, it is especially
|
|
347
|
-
// important to get this right, even though it requires care.
|
|
348
|
-
previousPromise ? previousPromise.then(
|
|
349
|
-
callInvokeWithMethodAndArg,
|
|
350
|
-
// Avoid propagating failures to Promises returned by later
|
|
351
|
-
// invocations of the iterator.
|
|
352
|
-
callInvokeWithMethodAndArg
|
|
353
|
-
) : callInvokeWithMethodAndArg();
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// Define the unified helper method that is used to implement .next,
|
|
357
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
358
|
-
this._invoke = enqueue;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
362
|
-
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
363
|
-
return this;
|
|
364
|
-
};
|
|
365
|
-
exports.AsyncIterator = AsyncIterator;
|
|
366
|
-
|
|
367
|
-
// Note that simple async functions are implemented on top of
|
|
368
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
369
|
-
// the final result produced by the iterator.
|
|
370
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
371
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
372
|
-
|
|
373
|
-
var iter = new AsyncIterator(
|
|
374
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
375
|
-
PromiseImpl
|
|
376
|
-
);
|
|
377
|
-
|
|
378
|
-
return exports.isGeneratorFunction(outerFn)
|
|
379
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
380
|
-
: iter.next().then(function(result) {
|
|
381
|
-
return result.done ? result.value : iter.next();
|
|
382
|
-
});
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
386
|
-
var state = GenStateSuspendedStart;
|
|
387
|
-
|
|
388
|
-
return function invoke(method, arg) {
|
|
389
|
-
if (state === GenStateExecuting) {
|
|
390
|
-
throw new Error("Generator is already running");
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (state === GenStateCompleted) {
|
|
394
|
-
if (method === "throw") {
|
|
395
|
-
throw arg;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
399
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
400
|
-
return doneResult();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
context.method = method;
|
|
404
|
-
context.arg = arg;
|
|
405
|
-
|
|
406
|
-
while (true) {
|
|
407
|
-
var delegate = context.delegate;
|
|
408
|
-
if (delegate) {
|
|
409
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
410
|
-
if (delegateResult) {
|
|
411
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
412
|
-
return delegateResult;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (context.method === "next") {
|
|
417
|
-
// Setting context._sent for legacy support of Babel's
|
|
418
|
-
// function.sent implementation.
|
|
419
|
-
context.sent = context._sent = context.arg;
|
|
420
|
-
|
|
421
|
-
} else if (context.method === "throw") {
|
|
422
|
-
if (state === GenStateSuspendedStart) {
|
|
423
|
-
state = GenStateCompleted;
|
|
424
|
-
throw context.arg;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
context.dispatchException(context.arg);
|
|
428
|
-
|
|
429
|
-
} else if (context.method === "return") {
|
|
430
|
-
context.abrupt("return", context.arg);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
state = GenStateExecuting;
|
|
434
|
-
|
|
435
|
-
var record = tryCatch(innerFn, self, context);
|
|
436
|
-
if (record.type === "normal") {
|
|
437
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
438
|
-
// GenStateExecuting and loop back for another invocation.
|
|
439
|
-
state = context.done
|
|
440
|
-
? GenStateCompleted
|
|
441
|
-
: GenStateSuspendedYield;
|
|
442
|
-
|
|
443
|
-
if (record.arg === ContinueSentinel) {
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
return {
|
|
448
|
-
value: record.arg,
|
|
449
|
-
done: context.done
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
} else if (record.type === "throw") {
|
|
453
|
-
state = GenStateCompleted;
|
|
454
|
-
// Dispatch the exception by looping back around to the
|
|
455
|
-
// context.dispatchException(context.arg) call above.
|
|
456
|
-
context.method = "throw";
|
|
457
|
-
context.arg = record.arg;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
154
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
460
155
|
};
|
|
461
156
|
}
|
|
462
157
|
|
|
463
|
-
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
464
|
-
// result, either by returning a { value, done } result from the
|
|
465
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
466
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
467
158
|
function maybeInvokeDelegate(delegate, context) {
|
|
468
159
|
var method = delegate.iterator[context.method];
|
|
469
|
-
if (method === undefined$1) {
|
|
470
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
471
|
-
// method always terminates the yield* loop.
|
|
472
|
-
context.delegate = null;
|
|
473
|
-
|
|
474
|
-
if (context.method === "throw") {
|
|
475
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
476
|
-
if (delegate.iterator["return"]) {
|
|
477
|
-
// If the delegate iterator has a return method, give it a
|
|
478
|
-
// chance to clean up.
|
|
479
|
-
context.method = "return";
|
|
480
|
-
context.arg = undefined$1;
|
|
481
|
-
maybeInvokeDelegate(delegate, context);
|
|
482
|
-
|
|
483
|
-
if (context.method === "throw") {
|
|
484
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
485
|
-
// "return" to "throw", let that override the TypeError below.
|
|
486
|
-
return ContinueSentinel;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
160
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
161
|
+
if (undefined === method) {
|
|
162
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
163
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
164
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
493
165
|
}
|
|
494
166
|
|
|
495
167
|
return ContinueSentinel;
|
|
496
168
|
}
|
|
497
169
|
|
|
498
170
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
499
|
-
|
|
500
|
-
if (record.type === "throw") {
|
|
501
|
-
context.method = "throw";
|
|
502
|
-
context.arg = record.arg;
|
|
503
|
-
context.delegate = null;
|
|
504
|
-
return ContinueSentinel;
|
|
505
|
-
}
|
|
506
|
-
|
|
171
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
507
172
|
var info = record.arg;
|
|
508
|
-
|
|
509
|
-
if (! info) {
|
|
510
|
-
context.method = "throw";
|
|
511
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
512
|
-
context.delegate = null;
|
|
513
|
-
return ContinueSentinel;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if (info.done) {
|
|
517
|
-
// Assign the result of the finished delegate to the temporary
|
|
518
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
519
|
-
context[delegate.resultName] = info.value;
|
|
520
|
-
|
|
521
|
-
// Resume execution at the desired location (see delegateYield).
|
|
522
|
-
context.next = delegate.nextLoc;
|
|
523
|
-
|
|
524
|
-
// If context.method was "throw" but the delegate handled the
|
|
525
|
-
// exception, let the outer generator proceed normally. If
|
|
526
|
-
// context.method was "next", forget context.arg since it has been
|
|
527
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
528
|
-
// "return", allow the original .return call to continue in the
|
|
529
|
-
// outer generator.
|
|
530
|
-
if (context.method !== "return") {
|
|
531
|
-
context.method = "next";
|
|
532
|
-
context.arg = undefined$1;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
} else {
|
|
536
|
-
// Re-yield the result returned by the delegate method.
|
|
537
|
-
return info;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
// The delegate iterator is finished, so forget it and continue with
|
|
541
|
-
// the outer generator.
|
|
542
|
-
context.delegate = null;
|
|
543
|
-
return ContinueSentinel;
|
|
173
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
544
174
|
}
|
|
545
175
|
|
|
546
|
-
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
547
|
-
// unified ._invoke helper method.
|
|
548
|
-
defineIteratorMethods(Gp);
|
|
549
|
-
|
|
550
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
551
|
-
|
|
552
|
-
// A Generator should always return itself as the iterator object when the
|
|
553
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
554
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
555
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
556
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
557
|
-
Gp[iteratorSymbol] = function() {
|
|
558
|
-
return this;
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
Gp.toString = function() {
|
|
562
|
-
return "[object Generator]";
|
|
563
|
-
};
|
|
564
|
-
|
|
565
176
|
function pushTryEntry(locs) {
|
|
566
|
-
var entry = {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
if (2 in locs) {
|
|
573
|
-
entry.finallyLoc = locs[2];
|
|
574
|
-
entry.afterLoc = locs[3];
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
this.tryEntries.push(entry);
|
|
177
|
+
var entry = {
|
|
178
|
+
tryLoc: locs[0]
|
|
179
|
+
};
|
|
180
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
578
181
|
}
|
|
579
182
|
|
|
580
183
|
function resetTryEntry(entry) {
|
|
581
184
|
var record = entry.completion || {};
|
|
582
|
-
record.type = "normal";
|
|
583
|
-
delete record.arg;
|
|
584
|
-
entry.completion = record;
|
|
185
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
585
186
|
}
|
|
586
187
|
|
|
587
188
|
function Context(tryLocsList) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
592
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
593
|
-
this.reset(true);
|
|
189
|
+
this.tryEntries = [{
|
|
190
|
+
tryLoc: "root"
|
|
191
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
594
192
|
}
|
|
595
193
|
|
|
596
|
-
exports.keys = function(object) {
|
|
597
|
-
var keys = [];
|
|
598
|
-
for (var key in object) {
|
|
599
|
-
keys.push(key);
|
|
600
|
-
}
|
|
601
|
-
keys.reverse();
|
|
602
|
-
|
|
603
|
-
// Rather than returning an object with a next method, we keep
|
|
604
|
-
// things simple and return the next function itself.
|
|
605
|
-
return function next() {
|
|
606
|
-
while (keys.length) {
|
|
607
|
-
var key = keys.pop();
|
|
608
|
-
if (key in object) {
|
|
609
|
-
next.value = key;
|
|
610
|
-
next.done = false;
|
|
611
|
-
return next;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
// To avoid creating an additional object, we just hang the .value
|
|
616
|
-
// and .done properties off the next function object itself. This
|
|
617
|
-
// also ensures that the minifier will not anonymize the function.
|
|
618
|
-
next.done = true;
|
|
619
|
-
return next;
|
|
620
|
-
};
|
|
621
|
-
};
|
|
622
|
-
|
|
623
194
|
function values(iterable) {
|
|
624
195
|
if (iterable) {
|
|
625
196
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
626
|
-
if (iteratorMethod)
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
if (typeof iterable.next === "function") {
|
|
631
|
-
return iterable;
|
|
632
|
-
}
|
|
197
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
198
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
633
199
|
|
|
634
200
|
if (!isNaN(iterable.length)) {
|
|
635
|
-
var i = -1,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
next.value = iterable[i];
|
|
639
|
-
next.done = false;
|
|
640
|
-
return next;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
201
|
+
var i = -1,
|
|
202
|
+
next = function next() {
|
|
203
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
643
204
|
|
|
644
|
-
next.value = undefined
|
|
645
|
-
next.done = true;
|
|
646
|
-
|
|
647
|
-
return next;
|
|
205
|
+
return next.value = undefined, next.done = !0, next;
|
|
648
206
|
};
|
|
649
207
|
|
|
650
208
|
return next.next = next;
|
|
651
209
|
}
|
|
652
210
|
}
|
|
653
211
|
|
|
654
|
-
|
|
655
|
-
|
|
212
|
+
return {
|
|
213
|
+
next: doneResult
|
|
214
|
+
};
|
|
656
215
|
}
|
|
657
|
-
exports.values = values;
|
|
658
216
|
|
|
659
217
|
function doneResult() {
|
|
660
|
-
return {
|
|
218
|
+
return {
|
|
219
|
+
value: undefined,
|
|
220
|
+
done: !0
|
|
221
|
+
};
|
|
661
222
|
}
|
|
662
223
|
|
|
663
|
-
|
|
664
|
-
constructor
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
this[name] = undefined$1;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
},
|
|
224
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
225
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
226
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
227
|
+
}, exports.mark = function (genFun) {
|
|
228
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
229
|
+
}, exports.awrap = function (arg) {
|
|
230
|
+
return {
|
|
231
|
+
__await: arg
|
|
232
|
+
};
|
|
233
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
234
|
+
return this;
|
|
235
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
236
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
237
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
238
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
239
|
+
return result.done ? result.value : iter.next();
|
|
240
|
+
});
|
|
241
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
242
|
+
return this;
|
|
243
|
+
}), define(Gp, "toString", function () {
|
|
244
|
+
return "[object Generator]";
|
|
245
|
+
}), exports.keys = function (object) {
|
|
246
|
+
var keys = [];
|
|
691
247
|
|
|
692
|
-
|
|
693
|
-
this.done = true;
|
|
248
|
+
for (var key in object) keys.push(key);
|
|
694
249
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
250
|
+
return keys.reverse(), function next() {
|
|
251
|
+
for (; keys.length;) {
|
|
252
|
+
var key = keys.pop();
|
|
253
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
699
254
|
}
|
|
700
255
|
|
|
256
|
+
return next.done = !0, next;
|
|
257
|
+
};
|
|
258
|
+
}, exports.values = values, Context.prototype = {
|
|
259
|
+
constructor: Context,
|
|
260
|
+
reset: function (skipTempReset) {
|
|
261
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
262
|
+
},
|
|
263
|
+
stop: function () {
|
|
264
|
+
this.done = !0;
|
|
265
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
266
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
701
267
|
return this.rval;
|
|
702
268
|
},
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
if (this.done) {
|
|
706
|
-
throw exception;
|
|
707
|
-
}
|
|
708
|
-
|
|
269
|
+
dispatchException: function (exception) {
|
|
270
|
+
if (this.done) throw exception;
|
|
709
271
|
var context = this;
|
|
710
|
-
function handle(loc, caught) {
|
|
711
|
-
record.type = "throw";
|
|
712
|
-
record.arg = exception;
|
|
713
|
-
context.next = loc;
|
|
714
|
-
|
|
715
|
-
if (caught) {
|
|
716
|
-
// If the dispatched exception was caught by a catch block,
|
|
717
|
-
// then let that catch block handle the exception normally.
|
|
718
|
-
context.method = "next";
|
|
719
|
-
context.arg = undefined$1;
|
|
720
|
-
}
|
|
721
272
|
|
|
722
|
-
|
|
273
|
+
function handle(loc, caught) {
|
|
274
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
723
275
|
}
|
|
724
276
|
|
|
725
277
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
726
|
-
var entry = this.tryEntries[i]
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
if (entry.tryLoc === "root") {
|
|
730
|
-
// Exception thrown outside of any try block that could handle
|
|
731
|
-
// it, so set the completion value of the entire function to
|
|
732
|
-
// throw the exception.
|
|
733
|
-
return handle("end");
|
|
734
|
-
}
|
|
278
|
+
var entry = this.tryEntries[i],
|
|
279
|
+
record = entry.completion;
|
|
280
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
735
281
|
|
|
736
282
|
if (entry.tryLoc <= this.prev) {
|
|
737
|
-
var hasCatch = hasOwn.call(entry, "catchLoc")
|
|
738
|
-
|
|
283
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
284
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
739
285
|
|
|
740
286
|
if (hasCatch && hasFinally) {
|
|
741
|
-
if (this.prev < entry.catchLoc)
|
|
742
|
-
|
|
743
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
744
|
-
return handle(entry.finallyLoc);
|
|
745
|
-
}
|
|
746
|
-
|
|
287
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
288
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
747
289
|
} else if (hasCatch) {
|
|
748
|
-
if (this.prev < entry.catchLoc)
|
|
749
|
-
return handle(entry.catchLoc, true);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
} else if (hasFinally) {
|
|
753
|
-
if (this.prev < entry.finallyLoc) {
|
|
754
|
-
return handle(entry.finallyLoc);
|
|
755
|
-
}
|
|
756
|
-
|
|
290
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
757
291
|
} else {
|
|
758
|
-
throw new Error("try statement without catch or finally");
|
|
292
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
293
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
759
294
|
}
|
|
760
295
|
}
|
|
761
296
|
}
|
|
762
297
|
},
|
|
763
|
-
|
|
764
|
-
abrupt: function(type, arg) {
|
|
298
|
+
abrupt: function (type, arg) {
|
|
765
299
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
766
300
|
var entry = this.tryEntries[i];
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
this.prev < entry.finallyLoc) {
|
|
301
|
+
|
|
302
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
770
303
|
var finallyEntry = entry;
|
|
771
304
|
break;
|
|
772
305
|
}
|
|
773
306
|
}
|
|
774
307
|
|
|
775
|
-
|
|
776
|
-
(type === "break" ||
|
|
777
|
-
type === "continue") &&
|
|
778
|
-
finallyEntry.tryLoc <= arg &&
|
|
779
|
-
arg <= finallyEntry.finallyLoc) {
|
|
780
|
-
// Ignore the finally entry if control is not jumping to a
|
|
781
|
-
// location outside the try/catch block.
|
|
782
|
-
finallyEntry = null;
|
|
783
|
-
}
|
|
784
|
-
|
|
308
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
785
309
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
786
|
-
record.type = type;
|
|
787
|
-
record.arg = arg;
|
|
788
|
-
|
|
789
|
-
if (finallyEntry) {
|
|
790
|
-
this.method = "next";
|
|
791
|
-
this.next = finallyEntry.finallyLoc;
|
|
792
|
-
return ContinueSentinel;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
return this.complete(record);
|
|
310
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
796
311
|
},
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
throw record.arg;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
if (record.type === "break" ||
|
|
804
|
-
record.type === "continue") {
|
|
805
|
-
this.next = record.arg;
|
|
806
|
-
} else if (record.type === "return") {
|
|
807
|
-
this.rval = this.arg = record.arg;
|
|
808
|
-
this.method = "return";
|
|
809
|
-
this.next = "end";
|
|
810
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
811
|
-
this.next = afterLoc;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
return ContinueSentinel;
|
|
312
|
+
complete: function (record, afterLoc) {
|
|
313
|
+
if ("throw" === record.type) throw record.arg;
|
|
314
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
815
315
|
},
|
|
816
|
-
|
|
817
|
-
finish: function(finallyLoc) {
|
|
316
|
+
finish: function (finallyLoc) {
|
|
818
317
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
819
318
|
var entry = this.tryEntries[i];
|
|
820
|
-
if (entry.finallyLoc === finallyLoc)
|
|
821
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
822
|
-
resetTryEntry(entry);
|
|
823
|
-
return ContinueSentinel;
|
|
824
|
-
}
|
|
319
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
825
320
|
}
|
|
826
321
|
},
|
|
827
|
-
|
|
828
|
-
"catch": function(tryLoc) {
|
|
322
|
+
catch: function (tryLoc) {
|
|
829
323
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
830
324
|
var entry = this.tryEntries[i];
|
|
325
|
+
|
|
831
326
|
if (entry.tryLoc === tryLoc) {
|
|
832
327
|
var record = entry.completion;
|
|
833
|
-
|
|
328
|
+
|
|
329
|
+
if ("throw" === record.type) {
|
|
834
330
|
var thrown = record.arg;
|
|
835
331
|
resetTryEntry(entry);
|
|
836
332
|
}
|
|
333
|
+
|
|
837
334
|
return thrown;
|
|
838
335
|
}
|
|
839
336
|
}
|
|
840
337
|
|
|
841
|
-
// The context.catch method must only be called with a location
|
|
842
|
-
// argument that corresponds to a known catch block.
|
|
843
338
|
throw new Error("illegal catch attempt");
|
|
844
339
|
},
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
this.delegate = {
|
|
340
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
341
|
+
return this.delegate = {
|
|
848
342
|
iterator: values(iterable),
|
|
849
343
|
resultName: resultName,
|
|
850
344
|
nextLoc: nextLoc
|
|
851
|
-
};
|
|
345
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
346
|
+
}
|
|
347
|
+
}, exports;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
351
|
+
try {
|
|
352
|
+
var info = gen[key](arg);
|
|
353
|
+
var value = info.value;
|
|
354
|
+
} catch (error) {
|
|
355
|
+
reject(error);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (info.done) {
|
|
360
|
+
resolve(value);
|
|
361
|
+
} else {
|
|
362
|
+
Promise.resolve(value).then(_next, _throw);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function _asyncToGenerator(fn) {
|
|
367
|
+
return function () {
|
|
368
|
+
var self = this,
|
|
369
|
+
args = arguments;
|
|
370
|
+
return new Promise(function (resolve, reject) {
|
|
371
|
+
var gen = fn.apply(self, args);
|
|
852
372
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
// accidentally pass it on to the delegate.
|
|
856
|
-
this.arg = undefined$1;
|
|
373
|
+
function _next(value) {
|
|
374
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
857
375
|
}
|
|
858
376
|
|
|
859
|
-
|
|
377
|
+
function _throw(err) {
|
|
378
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
_next(undefined);
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function _inheritsLoose(subClass, superClass) {
|
|
387
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
388
|
+
subClass.prototype.constructor = subClass;
|
|
389
|
+
|
|
390
|
+
_setPrototypeOf(subClass, superClass);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function _getPrototypeOf(o) {
|
|
394
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
395
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
396
|
+
};
|
|
397
|
+
return _getPrototypeOf(o);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function _setPrototypeOf(o, p) {
|
|
401
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
402
|
+
o.__proto__ = p;
|
|
403
|
+
return o;
|
|
404
|
+
};
|
|
405
|
+
return _setPrototypeOf(o, p);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function _isNativeReflectConstruct() {
|
|
409
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
410
|
+
if (Reflect.construct.sham) return false;
|
|
411
|
+
if (typeof Proxy === "function") return true;
|
|
412
|
+
|
|
413
|
+
try {
|
|
414
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
415
|
+
return true;
|
|
416
|
+
} catch (e) {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function _construct(Parent, args, Class) {
|
|
422
|
+
if (_isNativeReflectConstruct()) {
|
|
423
|
+
_construct = Reflect.construct.bind();
|
|
424
|
+
} else {
|
|
425
|
+
_construct = function _construct(Parent, args, Class) {
|
|
426
|
+
var a = [null];
|
|
427
|
+
a.push.apply(a, args);
|
|
428
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
429
|
+
var instance = new Constructor();
|
|
430
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
431
|
+
return instance;
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return _construct.apply(null, arguments);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function _isNativeFunction(fn) {
|
|
439
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function _wrapNativeSuper(Class) {
|
|
443
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
444
|
+
|
|
445
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
446
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
447
|
+
|
|
448
|
+
if (typeof Class !== "function") {
|
|
449
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (typeof _cache !== "undefined") {
|
|
453
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
454
|
+
|
|
455
|
+
_cache.set(Class, Wrapper);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function Wrapper() {
|
|
459
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
860
460
|
}
|
|
461
|
+
|
|
462
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
463
|
+
constructor: {
|
|
464
|
+
value: Wrapper,
|
|
465
|
+
enumerable: false,
|
|
466
|
+
writable: true,
|
|
467
|
+
configurable: true
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
861
471
|
};
|
|
862
472
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
// object. Either way, the resulting object will be used to initialize
|
|
873
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
874
|
-
module.exports
|
|
875
|
-
));
|
|
876
|
-
|
|
877
|
-
try {
|
|
878
|
-
regeneratorRuntime = runtime;
|
|
879
|
-
} catch (accidentalStrictMode) {
|
|
880
|
-
// This module should not be running in strict mode, so the above
|
|
881
|
-
// assignment should always work unless something is misconfigured. Just
|
|
882
|
-
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
883
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
884
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
885
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
886
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
887
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
888
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
889
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
473
|
+
return _wrapNativeSuper(Class);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function _assertThisInitialized(self) {
|
|
477
|
+
if (self === void 0) {
|
|
478
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
return self;
|
|
890
482
|
}
|
|
891
|
-
});
|
|
892
483
|
|
|
893
484
|
var GOOGLE_API_URL = 'https://sheets.googleapis.com/v4/spreadsheets';
|
|
894
485
|
|
|
@@ -930,9 +521,9 @@ var ApiResponseError = /*#__PURE__*/function (_Error) {
|
|
|
930
521
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
931
522
|
|
|
932
523
|
var makeFetch = /*#__PURE__*/function () {
|
|
933
|
-
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
524
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, config) {
|
|
934
525
|
var response;
|
|
935
|
-
return
|
|
526
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
936
527
|
while (1) {
|
|
937
528
|
switch (_context.prev = _context.next) {
|
|
938
529
|
case 0:
|
|
@@ -995,14 +586,25 @@ var mapRecords = function mapRecords(records, headerData) {
|
|
|
995
586
|
});
|
|
996
587
|
};
|
|
997
588
|
|
|
998
|
-
var mapData = function mapData(
|
|
589
|
+
var mapData = function mapData(_ref2) {
|
|
590
|
+
var sheets = _ref2.sheets,
|
|
591
|
+
_ref2$sheetsOptions = _ref2.sheetsOptions,
|
|
592
|
+
sheetsOptions = _ref2$sheetsOptions === void 0 ? [] : _ref2$sheetsOptions;
|
|
999
593
|
return sheets.map(function (sheet) {
|
|
1000
594
|
var id = sheet.range.split('!')[0].replace(/'/g, '');
|
|
1001
595
|
var rows = sheet.values || [];
|
|
1002
596
|
|
|
1003
597
|
if (rows.length > 0) {
|
|
1004
|
-
var
|
|
1005
|
-
|
|
598
|
+
var _sheetsOptionsSheet$h;
|
|
599
|
+
|
|
600
|
+
var sheetsOptionsSheet = sheetsOptions.find(function (sheet) {
|
|
601
|
+
return sheet.id === id;
|
|
602
|
+
});
|
|
603
|
+
var headerRowIndex = (_sheetsOptionsSheet$h = sheetsOptionsSheet == null ? void 0 : sheetsOptionsSheet.headerRowIndex) != null ? _sheetsOptionsSheet$h : 0;
|
|
604
|
+
var header = rows[headerRowIndex];
|
|
605
|
+
var records = rows.filter(function (_, index) {
|
|
606
|
+
return index > headerRowIndex;
|
|
607
|
+
});
|
|
1006
608
|
var recordsData = mapRecords(records, header);
|
|
1007
609
|
return {
|
|
1008
610
|
id: id,
|
|
@@ -1017,22 +619,25 @@ var mapData = function mapData(sheets) {
|
|
|
1017
619
|
});
|
|
1018
620
|
};
|
|
1019
621
|
var fetchBatchData = /*#__PURE__*/function () {
|
|
1020
|
-
var
|
|
1021
|
-
var apiKey, sheetId,
|
|
622
|
+
var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
623
|
+
var apiKey, sheetId, _ref3$sheetsOptions, sheetsOptions, sheetsNames, url;
|
|
1022
624
|
|
|
1023
|
-
return
|
|
625
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1024
626
|
while (1) {
|
|
1025
627
|
switch (_context2.prev = _context2.next) {
|
|
1026
628
|
case 0:
|
|
1027
|
-
apiKey =
|
|
629
|
+
apiKey = _ref3.apiKey, sheetId = _ref3.sheetId, _ref3$sheetsOptions = _ref3.sheetsOptions, sheetsOptions = _ref3$sheetsOptions === void 0 ? [] : _ref3$sheetsOptions;
|
|
630
|
+
sheetsNames = sheetsOptions.map(function (option) {
|
|
631
|
+
return option.id;
|
|
632
|
+
});
|
|
1028
633
|
url = getBatchUrl(sheetId, sheetsNames, apiKey);
|
|
1029
|
-
_context2.next =
|
|
634
|
+
_context2.next = 5;
|
|
1030
635
|
return makeFetch(url);
|
|
1031
636
|
|
|
1032
|
-
case
|
|
637
|
+
case 5:
|
|
1033
638
|
return _context2.abrupt("return", _context2.sent);
|
|
1034
639
|
|
|
1035
|
-
case
|
|
640
|
+
case 6:
|
|
1036
641
|
case "end":
|
|
1037
642
|
return _context2.stop();
|
|
1038
643
|
}
|
|
@@ -1041,18 +646,18 @@ var fetchBatchData = /*#__PURE__*/function () {
|
|
|
1041
646
|
}));
|
|
1042
647
|
|
|
1043
648
|
return function fetchBatchData(_x3) {
|
|
1044
|
-
return
|
|
649
|
+
return _ref4.apply(this, arguments);
|
|
1045
650
|
};
|
|
1046
651
|
}();
|
|
1047
652
|
var fetchAllSheetsData = /*#__PURE__*/function () {
|
|
1048
|
-
var
|
|
1049
|
-
var apiKey, sheetId, urlTitles, _yield$makeFetch, sheets,
|
|
653
|
+
var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
|
|
654
|
+
var apiKey, sheetId, urlTitles, _yield$makeFetch, sheets, sheetsOptions;
|
|
1050
655
|
|
|
1051
|
-
return
|
|
656
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1052
657
|
while (1) {
|
|
1053
658
|
switch (_context3.prev = _context3.next) {
|
|
1054
659
|
case 0:
|
|
1055
|
-
apiKey =
|
|
660
|
+
apiKey = _ref5.apiKey, sheetId = _ref5.sheetId;
|
|
1056
661
|
urlTitles = getSheetsTitleUrl(sheetId, apiKey);
|
|
1057
662
|
_context3.next = 4;
|
|
1058
663
|
return makeFetch(urlTitles);
|
|
@@ -1060,14 +665,16 @@ var fetchAllSheetsData = /*#__PURE__*/function () {
|
|
|
1060
665
|
case 4:
|
|
1061
666
|
_yield$makeFetch = _context3.sent;
|
|
1062
667
|
sheets = _yield$makeFetch.sheets;
|
|
1063
|
-
|
|
1064
|
-
return
|
|
668
|
+
sheetsOptions = sheets.map(function (sheet) {
|
|
669
|
+
return {
|
|
670
|
+
id: sheet.properties.title
|
|
671
|
+
};
|
|
1065
672
|
});
|
|
1066
673
|
_context3.next = 9;
|
|
1067
674
|
return fetchBatchData({
|
|
675
|
+
apiKey: apiKey,
|
|
1068
676
|
sheetId: sheetId,
|
|
1069
|
-
|
|
1070
|
-
apiKey: apiKey
|
|
677
|
+
sheetsOptions: sheetsOptions
|
|
1071
678
|
});
|
|
1072
679
|
|
|
1073
680
|
case 9:
|
|
@@ -1082,23 +689,23 @@ var fetchAllSheetsData = /*#__PURE__*/function () {
|
|
|
1082
689
|
}));
|
|
1083
690
|
|
|
1084
691
|
return function fetchAllSheetsData(_x4) {
|
|
1085
|
-
return
|
|
692
|
+
return _ref6.apply(this, arguments);
|
|
1086
693
|
};
|
|
1087
694
|
}();
|
|
1088
695
|
|
|
1089
696
|
var GoogleSheetsMapper = {
|
|
1090
697
|
fetchGoogleSheetsData: function fetchGoogleSheetsData(_ref) {
|
|
1091
|
-
return _asyncToGenerator( /*#__PURE__*/
|
|
1092
|
-
var apiKey, sheetId, _ref$
|
|
698
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
699
|
+
var apiKey, sheetId, _ref$sheetsOptions, sheetsOptions, response;
|
|
1093
700
|
|
|
1094
|
-
return
|
|
701
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1095
702
|
while (1) {
|
|
1096
703
|
switch (_context.prev = _context.next) {
|
|
1097
704
|
case 0:
|
|
1098
|
-
apiKey = _ref.apiKey, sheetId = _ref.sheetId, _ref$
|
|
705
|
+
apiKey = _ref.apiKey, sheetId = _ref.sheetId, _ref$sheetsOptions = _ref.sheetsOptions, sheetsOptions = _ref$sheetsOptions === void 0 ? [] : _ref$sheetsOptions;
|
|
1099
706
|
_context.prev = 1;
|
|
1100
707
|
|
|
1101
|
-
if (!(
|
|
708
|
+
if (!(sheetsOptions.length === 0)) {
|
|
1102
709
|
_context.next = 8;
|
|
1103
710
|
break;
|
|
1104
711
|
}
|
|
@@ -1119,7 +726,7 @@ var GoogleSheetsMapper = {
|
|
|
1119
726
|
return fetchBatchData({
|
|
1120
727
|
apiKey: apiKey,
|
|
1121
728
|
sheetId: sheetId,
|
|
1122
|
-
|
|
729
|
+
sheetsOptions: sheetsOptions
|
|
1123
730
|
});
|
|
1124
731
|
|
|
1125
732
|
case 10:
|
|
@@ -1127,7 +734,10 @@ var GoogleSheetsMapper = {
|
|
|
1127
734
|
|
|
1128
735
|
case 11:
|
|
1129
736
|
response = _context.t0;
|
|
1130
|
-
return _context.abrupt("return", mapData(
|
|
737
|
+
return _context.abrupt("return", mapData({
|
|
738
|
+
sheets: response.valueRanges,
|
|
739
|
+
sheetsOptions: sheetsOptions
|
|
740
|
+
}));
|
|
1131
741
|
|
|
1132
742
|
case 15:
|
|
1133
743
|
_context.prev = 15;
|