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