@innoways/ajv 3.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.
@@ -0,0 +1,939 @@
1
+ 'use strict';
2
+
3
+ var Ajv2019 = require('ajv/dist/2019');
4
+ var ajvKeywords = require('ajv-keywords');
5
+ var ajvErrors = require('ajv-errors');
6
+ var addFormats = require('ajv-formats');
7
+ var addDripFormats = require('@jdfed/drip-form-plugin-formats');
8
+ var addDripKeywords = require('@jdfed/drip-form-plugin-keywords');
9
+ var draft7MetaSchema = require('ajv/dist/refs/json-schema-draft-07.json');
10
+ var draft6MetaSchema = require('ajv/dist/refs/json-schema-draft-06.json');
11
+ var apply = require('ajv-formats-draft2019');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var Ajv2019__default = /*#__PURE__*/_interopDefaultLegacy(Ajv2019);
16
+ var ajvKeywords__default = /*#__PURE__*/_interopDefaultLegacy(ajvKeywords);
17
+ var ajvErrors__default = /*#__PURE__*/_interopDefaultLegacy(ajvErrors);
18
+ var addFormats__default = /*#__PURE__*/_interopDefaultLegacy(addFormats);
19
+ var addDripFormats__default = /*#__PURE__*/_interopDefaultLegacy(addDripFormats);
20
+ var addDripKeywords__default = /*#__PURE__*/_interopDefaultLegacy(addDripKeywords);
21
+ var draft7MetaSchema__default = /*#__PURE__*/_interopDefaultLegacy(draft7MetaSchema);
22
+ var draft6MetaSchema__default = /*#__PURE__*/_interopDefaultLegacy(draft6MetaSchema);
23
+ var apply__default = /*#__PURE__*/_interopDefaultLegacy(apply);
24
+
25
+ function unwrapExports (x) {
26
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
27
+ }
28
+
29
+ function createCommonjsModule(fn, basedir, module) {
30
+ return module = {
31
+ path: basedir,
32
+ exports: {},
33
+ require: function (path, base) {
34
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
35
+ }
36
+ }, fn(module, module.exports), module.exports;
37
+ }
38
+
39
+ function commonjsRequire () {
40
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
41
+ }
42
+
43
+ var asyncToGenerator = createCommonjsModule(function (module) {
44
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
45
+ try {
46
+ var info = gen[key](arg);
47
+ var value = info.value;
48
+ } catch (error) {
49
+ reject(error);
50
+ return;
51
+ }
52
+
53
+ if (info.done) {
54
+ resolve(value);
55
+ } else {
56
+ Promise.resolve(value).then(_next, _throw);
57
+ }
58
+ }
59
+
60
+ function _asyncToGenerator(fn) {
61
+ return function () {
62
+ var self = this,
63
+ args = arguments;
64
+ return new Promise(function (resolve, reject) {
65
+ var gen = fn.apply(self, args);
66
+
67
+ function _next(value) {
68
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
69
+ }
70
+
71
+ function _throw(err) {
72
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
73
+ }
74
+
75
+ _next(undefined);
76
+ });
77
+ };
78
+ }
79
+
80
+ module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
81
+ });
82
+ var _asyncToGenerator = unwrapExports(asyncToGenerator);
83
+
84
+ var defineProperty = createCommonjsModule(function (module) {
85
+ function _defineProperty(obj, key, value) {
86
+ if (key in obj) {
87
+ Object.defineProperty(obj, key, {
88
+ value: value,
89
+ enumerable: true,
90
+ configurable: true,
91
+ writable: true
92
+ });
93
+ } else {
94
+ obj[key] = value;
95
+ }
96
+
97
+ return obj;
98
+ }
99
+
100
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
101
+ });
102
+ var _defineProperty = unwrapExports(defineProperty);
103
+
104
+ var _typeof_1 = createCommonjsModule(function (module) {
105
+ function _typeof(obj) {
106
+ "@babel/helpers - typeof";
107
+
108
+ return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
109
+ return typeof obj;
110
+ } : function (obj) {
111
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
112
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
113
+ }
114
+
115
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
116
+ });
117
+
118
+ var _typeof = unwrapExports(_typeof_1);
119
+
120
+ var runtime_1 = createCommonjsModule(function (module) {
121
+ /**
122
+ * Copyright (c) 2014-present, Facebook, Inc.
123
+ *
124
+ * This source code is licensed under the MIT license found in the
125
+ * LICENSE file in the root directory of this source tree.
126
+ */
127
+ var runtime = function (exports) {
128
+
129
+ var Op = Object.prototype;
130
+ var hasOwn = Op.hasOwnProperty;
131
+ var undefined$1; // More compressible than void 0.
132
+
133
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
134
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
135
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
136
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
137
+
138
+ function define(obj, key, value) {
139
+ Object.defineProperty(obj, key, {
140
+ value: value,
141
+ enumerable: true,
142
+ configurable: true,
143
+ writable: true
144
+ });
145
+ return obj[key];
146
+ }
147
+
148
+ try {
149
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
150
+ define({}, "");
151
+ } catch (err) {
152
+ define = function define(obj, key, value) {
153
+ return obj[key] = value;
154
+ };
155
+ }
156
+
157
+ function wrap(innerFn, outerFn, self, tryLocsList) {
158
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
159
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
160
+ var generator = Object.create(protoGenerator.prototype);
161
+ var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
162
+ // .throw, and .return methods.
163
+
164
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
165
+ return generator;
166
+ }
167
+
168
+ exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
169
+ // record like context.tryEntries[i].completion. This interface could
170
+ // have been (and was previously) designed to take a closure to be
171
+ // invoked without arguments, but in all the cases we care about we
172
+ // already have an existing method we want to call, so there's no need
173
+ // to create a new function object. We can even get away with assuming
174
+ // the method takes exactly one argument, since that happens to be true
175
+ // in every case, so we don't have to touch the arguments object. The
176
+ // only additional allocation required is the completion record, which
177
+ // has a stable shape and so hopefully should be cheap to allocate.
178
+
179
+ function tryCatch(fn, obj, arg) {
180
+ try {
181
+ return {
182
+ type: "normal",
183
+ arg: fn.call(obj, arg)
184
+ };
185
+ } catch (err) {
186
+ return {
187
+ type: "throw",
188
+ arg: err
189
+ };
190
+ }
191
+ }
192
+
193
+ var GenStateSuspendedStart = "suspendedStart";
194
+ var GenStateSuspendedYield = "suspendedYield";
195
+ var GenStateExecuting = "executing";
196
+ var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
197
+ // breaking out of the dispatch switch statement.
198
+
199
+ var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
200
+ // .constructor.prototype properties for functions that return Generator
201
+ // objects. For full spec compliance, you may wish to configure your
202
+ // minifier not to mangle the names of these two functions.
203
+
204
+ function Generator() {}
205
+
206
+ function GeneratorFunction() {}
207
+
208
+ function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
209
+ // don't natively support it.
210
+
211
+
212
+ var IteratorPrototype = {};
213
+ define(IteratorPrototype, iteratorSymbol, function () {
214
+ return this;
215
+ });
216
+ var getProto = Object.getPrototypeOf;
217
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
218
+
219
+ if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
220
+ // This environment has a native %IteratorPrototype%; use it instead
221
+ // of the polyfill.
222
+ IteratorPrototype = NativeIteratorPrototype;
223
+ }
224
+
225
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
226
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
227
+ define(Gp, "constructor", GeneratorFunctionPrototype);
228
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
229
+ GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
230
+ // Iterator interface in terms of a single ._invoke method.
231
+
232
+ function defineIteratorMethods(prototype) {
233
+ ["next", "throw", "return"].forEach(function (method) {
234
+ define(prototype, method, function (arg) {
235
+ return this._invoke(method, arg);
236
+ });
237
+ });
238
+ }
239
+
240
+ exports.isGeneratorFunction = function (genFun) {
241
+ var ctor = typeof genFun === "function" && genFun.constructor;
242
+ return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
243
+ // do is to check its .name property.
244
+ (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
245
+ };
246
+
247
+ exports.mark = function (genFun) {
248
+ if (Object.setPrototypeOf) {
249
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
250
+ } else {
251
+ genFun.__proto__ = GeneratorFunctionPrototype;
252
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
253
+ }
254
+
255
+ genFun.prototype = Object.create(Gp);
256
+ return genFun;
257
+ }; // Within the body of any async function, `await x` is transformed to
258
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
259
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
260
+ // meant to be awaited.
261
+
262
+
263
+ exports.awrap = function (arg) {
264
+ return {
265
+ __await: arg
266
+ };
267
+ };
268
+
269
+ function AsyncIterator(generator, PromiseImpl) {
270
+ function invoke(method, arg, resolve, reject) {
271
+ var record = tryCatch(generator[method], generator, arg);
272
+
273
+ if (record.type === "throw") {
274
+ reject(record.arg);
275
+ } else {
276
+ var result = record.arg;
277
+ var value = result.value;
278
+
279
+ if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
280
+ return PromiseImpl.resolve(value.__await).then(function (value) {
281
+ invoke("next", value, resolve, reject);
282
+ }, function (err) {
283
+ invoke("throw", err, resolve, reject);
284
+ });
285
+ }
286
+
287
+ return PromiseImpl.resolve(value).then(function (unwrapped) {
288
+ // When a yielded Promise is resolved, its final value becomes
289
+ // the .value of the Promise<{value,done}> result for the
290
+ // current iteration.
291
+ result.value = unwrapped;
292
+ resolve(result);
293
+ }, function (error) {
294
+ // If a rejected Promise was yielded, throw the rejection back
295
+ // into the async generator function so it can be handled there.
296
+ return invoke("throw", error, resolve, reject);
297
+ });
298
+ }
299
+ }
300
+
301
+ var previousPromise;
302
+
303
+ function enqueue(method, arg) {
304
+ function callInvokeWithMethodAndArg() {
305
+ return new PromiseImpl(function (resolve, reject) {
306
+ invoke(method, arg, resolve, reject);
307
+ });
308
+ }
309
+
310
+ return previousPromise = // If enqueue has been called before, then we want to wait until
311
+ // all previous Promises have been resolved before calling invoke,
312
+ // so that results are always delivered in the correct order. If
313
+ // enqueue has not been called before, then it is important to
314
+ // call invoke immediately, without waiting on a callback to fire,
315
+ // so that the async generator function has the opportunity to do
316
+ // any necessary setup in a predictable way. This predictability
317
+ // is why the Promise constructor synchronously invokes its
318
+ // executor callback, and why async functions synchronously
319
+ // execute code before the first await. Since we implement simple
320
+ // async functions in terms of async generators, it is especially
321
+ // important to get this right, even though it requires care.
322
+ previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
323
+ // invocations of the iterator.
324
+ callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
325
+ } // Define the unified helper method that is used to implement .next,
326
+ // .throw, and .return (see defineIteratorMethods).
327
+
328
+
329
+ this._invoke = enqueue;
330
+ }
331
+
332
+ defineIteratorMethods(AsyncIterator.prototype);
333
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
334
+ return this;
335
+ });
336
+ exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
337
+ // AsyncIterator objects; they just return a Promise for the value of
338
+ // the final result produced by the iterator.
339
+
340
+ exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
341
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
342
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
343
+ return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
344
+ : iter.next().then(function (result) {
345
+ return result.done ? result.value : iter.next();
346
+ });
347
+ };
348
+
349
+ function makeInvokeMethod(innerFn, self, context) {
350
+ var state = GenStateSuspendedStart;
351
+ return function invoke(method, arg) {
352
+ if (state === GenStateExecuting) {
353
+ throw new Error("Generator is already running");
354
+ }
355
+
356
+ if (state === GenStateCompleted) {
357
+ if (method === "throw") {
358
+ throw arg;
359
+ } // Be forgiving, per 25.3.3.3.3 of the spec:
360
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
361
+
362
+
363
+ return doneResult();
364
+ }
365
+
366
+ context.method = method;
367
+ context.arg = arg;
368
+
369
+ while (true) {
370
+ var delegate = context.delegate;
371
+
372
+ if (delegate) {
373
+ var delegateResult = maybeInvokeDelegate(delegate, context);
374
+
375
+ if (delegateResult) {
376
+ if (delegateResult === ContinueSentinel) continue;
377
+ return delegateResult;
378
+ }
379
+ }
380
+
381
+ if (context.method === "next") {
382
+ // Setting context._sent for legacy support of Babel's
383
+ // function.sent implementation.
384
+ context.sent = context._sent = context.arg;
385
+ } else if (context.method === "throw") {
386
+ if (state === GenStateSuspendedStart) {
387
+ state = GenStateCompleted;
388
+ throw context.arg;
389
+ }
390
+
391
+ context.dispatchException(context.arg);
392
+ } else if (context.method === "return") {
393
+ context.abrupt("return", context.arg);
394
+ }
395
+
396
+ state = GenStateExecuting;
397
+ var record = tryCatch(innerFn, self, context);
398
+
399
+ if (record.type === "normal") {
400
+ // If an exception is thrown from innerFn, we leave state ===
401
+ // GenStateExecuting and loop back for another invocation.
402
+ state = context.done ? GenStateCompleted : GenStateSuspendedYield;
403
+
404
+ if (record.arg === ContinueSentinel) {
405
+ continue;
406
+ }
407
+
408
+ return {
409
+ value: record.arg,
410
+ done: context.done
411
+ };
412
+ } else if (record.type === "throw") {
413
+ state = GenStateCompleted; // Dispatch the exception by looping back around to the
414
+ // context.dispatchException(context.arg) call above.
415
+
416
+ context.method = "throw";
417
+ context.arg = record.arg;
418
+ }
419
+ }
420
+ };
421
+ } // Call delegate.iterator[context.method](context.arg) and handle the
422
+ // result, either by returning a { value, done } result from the
423
+ // delegate iterator, or by modifying context.method and context.arg,
424
+ // setting context.delegate to null, and returning the ContinueSentinel.
425
+
426
+
427
+ function maybeInvokeDelegate(delegate, context) {
428
+ var method = delegate.iterator[context.method];
429
+
430
+ if (method === undefined$1) {
431
+ // A .throw or .return when the delegate iterator has no .throw
432
+ // method always terminates the yield* loop.
433
+ context.delegate = null;
434
+
435
+ if (context.method === "throw") {
436
+ // Note: ["return"] must be used for ES3 parsing compatibility.
437
+ if (delegate.iterator["return"]) {
438
+ // If the delegate iterator has a return method, give it a
439
+ // chance to clean up.
440
+ context.method = "return";
441
+ context.arg = undefined$1;
442
+ maybeInvokeDelegate(delegate, context);
443
+
444
+ if (context.method === "throw") {
445
+ // If maybeInvokeDelegate(context) changed context.method from
446
+ // "return" to "throw", let that override the TypeError below.
447
+ return ContinueSentinel;
448
+ }
449
+ }
450
+
451
+ context.method = "throw";
452
+ context.arg = new TypeError("The iterator does not provide a 'throw' method");
453
+ }
454
+
455
+ return ContinueSentinel;
456
+ }
457
+
458
+ var record = tryCatch(method, delegate.iterator, context.arg);
459
+
460
+ if (record.type === "throw") {
461
+ context.method = "throw";
462
+ context.arg = record.arg;
463
+ context.delegate = null;
464
+ return ContinueSentinel;
465
+ }
466
+
467
+ var info = record.arg;
468
+
469
+ if (!info) {
470
+ context.method = "throw";
471
+ context.arg = new TypeError("iterator result is not an object");
472
+ context.delegate = null;
473
+ return ContinueSentinel;
474
+ }
475
+
476
+ if (info.done) {
477
+ // Assign the result of the finished delegate to the temporary
478
+ // variable specified by delegate.resultName (see delegateYield).
479
+ context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
480
+
481
+ context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
482
+ // exception, let the outer generator proceed normally. If
483
+ // context.method was "next", forget context.arg since it has been
484
+ // "consumed" by the delegate iterator. If context.method was
485
+ // "return", allow the original .return call to continue in the
486
+ // outer generator.
487
+
488
+ if (context.method !== "return") {
489
+ context.method = "next";
490
+ context.arg = undefined$1;
491
+ }
492
+ } else {
493
+ // Re-yield the result returned by the delegate method.
494
+ return info;
495
+ } // The delegate iterator is finished, so forget it and continue with
496
+ // the outer generator.
497
+
498
+
499
+ context.delegate = null;
500
+ return ContinueSentinel;
501
+ } // Define Generator.prototype.{next,throw,return} in terms of the
502
+ // unified ._invoke helper method.
503
+
504
+
505
+ defineIteratorMethods(Gp);
506
+ define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
507
+ // @@iterator function is called on it. Some browsers' implementations of the
508
+ // iterator prototype chain incorrectly implement this, causing the Generator
509
+ // object to not be returned from this call. This ensures that doesn't happen.
510
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
511
+
512
+ define(Gp, iteratorSymbol, function () {
513
+ return this;
514
+ });
515
+ define(Gp, "toString", function () {
516
+ return "[object Generator]";
517
+ });
518
+
519
+ function pushTryEntry(locs) {
520
+ var entry = {
521
+ tryLoc: locs[0]
522
+ };
523
+
524
+ if (1 in locs) {
525
+ entry.catchLoc = locs[1];
526
+ }
527
+
528
+ if (2 in locs) {
529
+ entry.finallyLoc = locs[2];
530
+ entry.afterLoc = locs[3];
531
+ }
532
+
533
+ this.tryEntries.push(entry);
534
+ }
535
+
536
+ function resetTryEntry(entry) {
537
+ var record = entry.completion || {};
538
+ record.type = "normal";
539
+ delete record.arg;
540
+ entry.completion = record;
541
+ }
542
+
543
+ function Context(tryLocsList) {
544
+ // The root entry object (effectively a try statement without a catch
545
+ // or a finally block) gives us a place to store values thrown from
546
+ // locations where there is no enclosing try statement.
547
+ this.tryEntries = [{
548
+ tryLoc: "root"
549
+ }];
550
+ tryLocsList.forEach(pushTryEntry, this);
551
+ this.reset(true);
552
+ }
553
+
554
+ exports.keys = function (object) {
555
+ var keys = [];
556
+
557
+ for (var key in object) {
558
+ keys.push(key);
559
+ }
560
+
561
+ keys.reverse(); // Rather than returning an object with a next method, we keep
562
+ // things simple and return the next function itself.
563
+
564
+ return function next() {
565
+ while (keys.length) {
566
+ var key = keys.pop();
567
+
568
+ if (key in object) {
569
+ next.value = key;
570
+ next.done = false;
571
+ return next;
572
+ }
573
+ } // To avoid creating an additional object, we just hang the .value
574
+ // and .done properties off the next function object itself. This
575
+ // also ensures that the minifier will not anonymize the function.
576
+
577
+
578
+ next.done = true;
579
+ return next;
580
+ };
581
+ };
582
+
583
+ function values(iterable) {
584
+ if (iterable) {
585
+ var iteratorMethod = iterable[iteratorSymbol];
586
+
587
+ if (iteratorMethod) {
588
+ return iteratorMethod.call(iterable);
589
+ }
590
+
591
+ if (typeof iterable.next === "function") {
592
+ return iterable;
593
+ }
594
+
595
+ if (!isNaN(iterable.length)) {
596
+ var i = -1,
597
+ next = function next() {
598
+ while (++i < iterable.length) {
599
+ if (hasOwn.call(iterable, i)) {
600
+ next.value = iterable[i];
601
+ next.done = false;
602
+ return next;
603
+ }
604
+ }
605
+
606
+ next.value = undefined$1;
607
+ next.done = true;
608
+ return next;
609
+ };
610
+
611
+ return next.next = next;
612
+ }
613
+ } // Return an iterator with no values.
614
+
615
+
616
+ return {
617
+ next: doneResult
618
+ };
619
+ }
620
+
621
+ exports.values = values;
622
+
623
+ function doneResult() {
624
+ return {
625
+ value: undefined$1,
626
+ done: true
627
+ };
628
+ }
629
+
630
+ Context.prototype = {
631
+ constructor: Context,
632
+ reset: function reset(skipTempReset) {
633
+ this.prev = 0;
634
+ this.next = 0; // Resetting context._sent for legacy support of Babel's
635
+ // function.sent implementation.
636
+
637
+ this.sent = this._sent = undefined$1;
638
+ this.done = false;
639
+ this.delegate = null;
640
+ this.method = "next";
641
+ this.arg = undefined$1;
642
+ this.tryEntries.forEach(resetTryEntry);
643
+
644
+ if (!skipTempReset) {
645
+ for (var name in this) {
646
+ // Not sure about the optimal order of these conditions:
647
+ if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
648
+ this[name] = undefined$1;
649
+ }
650
+ }
651
+ }
652
+ },
653
+ stop: function stop() {
654
+ this.done = true;
655
+ var rootEntry = this.tryEntries[0];
656
+ var rootRecord = rootEntry.completion;
657
+
658
+ if (rootRecord.type === "throw") {
659
+ throw rootRecord.arg;
660
+ }
661
+
662
+ return this.rval;
663
+ },
664
+ dispatchException: function dispatchException(exception) {
665
+ if (this.done) {
666
+ throw exception;
667
+ }
668
+
669
+ var context = this;
670
+
671
+ function handle(loc, caught) {
672
+ record.type = "throw";
673
+ record.arg = exception;
674
+ context.next = loc;
675
+
676
+ if (caught) {
677
+ // If the dispatched exception was caught by a catch block,
678
+ // then let that catch block handle the exception normally.
679
+ context.method = "next";
680
+ context.arg = undefined$1;
681
+ }
682
+
683
+ return !!caught;
684
+ }
685
+
686
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
687
+ var entry = this.tryEntries[i];
688
+ var record = entry.completion;
689
+
690
+ if (entry.tryLoc === "root") {
691
+ // Exception thrown outside of any try block that could handle
692
+ // it, so set the completion value of the entire function to
693
+ // throw the exception.
694
+ return handle("end");
695
+ }
696
+
697
+ if (entry.tryLoc <= this.prev) {
698
+ var hasCatch = hasOwn.call(entry, "catchLoc");
699
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
700
+
701
+ if (hasCatch && hasFinally) {
702
+ if (this.prev < entry.catchLoc) {
703
+ return handle(entry.catchLoc, true);
704
+ } else if (this.prev < entry.finallyLoc) {
705
+ return handle(entry.finallyLoc);
706
+ }
707
+ } else if (hasCatch) {
708
+ if (this.prev < entry.catchLoc) {
709
+ return handle(entry.catchLoc, true);
710
+ }
711
+ } else if (hasFinally) {
712
+ if (this.prev < entry.finallyLoc) {
713
+ return handle(entry.finallyLoc);
714
+ }
715
+ } else {
716
+ throw new Error("try statement without catch or finally");
717
+ }
718
+ }
719
+ }
720
+ },
721
+ abrupt: function abrupt(type, arg) {
722
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
723
+ var entry = this.tryEntries[i];
724
+
725
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
726
+ var finallyEntry = entry;
727
+ break;
728
+ }
729
+ }
730
+
731
+ if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
732
+ // Ignore the finally entry if control is not jumping to a
733
+ // location outside the try/catch block.
734
+ finallyEntry = null;
735
+ }
736
+
737
+ var record = finallyEntry ? finallyEntry.completion : {};
738
+ record.type = type;
739
+ record.arg = arg;
740
+
741
+ if (finallyEntry) {
742
+ this.method = "next";
743
+ this.next = finallyEntry.finallyLoc;
744
+ return ContinueSentinel;
745
+ }
746
+
747
+ return this.complete(record);
748
+ },
749
+ complete: function complete(record, afterLoc) {
750
+ if (record.type === "throw") {
751
+ throw record.arg;
752
+ }
753
+
754
+ if (record.type === "break" || record.type === "continue") {
755
+ this.next = record.arg;
756
+ } else if (record.type === "return") {
757
+ this.rval = this.arg = record.arg;
758
+ this.method = "return";
759
+ this.next = "end";
760
+ } else if (record.type === "normal" && afterLoc) {
761
+ this.next = afterLoc;
762
+ }
763
+
764
+ return ContinueSentinel;
765
+ },
766
+ finish: function finish(finallyLoc) {
767
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
768
+ var entry = this.tryEntries[i];
769
+
770
+ if (entry.finallyLoc === finallyLoc) {
771
+ this.complete(entry.completion, entry.afterLoc);
772
+ resetTryEntry(entry);
773
+ return ContinueSentinel;
774
+ }
775
+ }
776
+ },
777
+ "catch": function _catch(tryLoc) {
778
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
779
+ var entry = this.tryEntries[i];
780
+
781
+ if (entry.tryLoc === tryLoc) {
782
+ var record = entry.completion;
783
+
784
+ if (record.type === "throw") {
785
+ var thrown = record.arg;
786
+ resetTryEntry(entry);
787
+ }
788
+
789
+ return thrown;
790
+ }
791
+ } // The context.catch method must only be called with a location
792
+ // argument that corresponds to a known catch block.
793
+
794
+
795
+ throw new Error("illegal catch attempt");
796
+ },
797
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
798
+ this.delegate = {
799
+ iterator: values(iterable),
800
+ resultName: resultName,
801
+ nextLoc: nextLoc
802
+ };
803
+
804
+ if (this.method === "next") {
805
+ // Deliberately forget the last sent value so that we don't
806
+ // accidentally pass it on to the delegate.
807
+ this.arg = undefined$1;
808
+ }
809
+
810
+ return ContinueSentinel;
811
+ }
812
+ }; // Regardless of whether this script is executing as a CommonJS module
813
+ // or not, return the runtime object so that we can declare the variable
814
+ // regeneratorRuntime in the outer scope, which allows this module to be
815
+ // injected easily by `bin/regenerator --include-runtime script.js`.
816
+
817
+ return exports;
818
+ }( // If this script is executing as a CommonJS module, use module.exports
819
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
820
+ // object. Either way, the resulting object will be used to initialize
821
+ // the regeneratorRuntime variable at the top of this file.
822
+ module.exports );
823
+
824
+ try {
825
+ regeneratorRuntime = runtime;
826
+ } catch (accidentalStrictMode) {
827
+ // This module should not be running in strict mode, so the above
828
+ // assignment should always work unless something is misconfigured. Just
829
+ // in case runtime.js accidentally runs in strict mode, in modern engines
830
+ // we can explicitly access globalThis. In older engines we can escape
831
+ // strict mode using a global Function call. This could conceivably fail
832
+ // if a Content Security Policy forbids using Function, but in that case
833
+ // the proper solution is to fix the accidental strict mode problem. If
834
+ // you've misconfigured your bundler to force strict mode and applied a
835
+ // CSP to forbid Function, and you're not willing to fix either of those
836
+ // problems, please detail your unique predicament in a GitHub issue.
837
+ if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
838
+ globalThis.regeneratorRuntime = runtime;
839
+ } else {
840
+ Function("r", "regeneratorRuntime = r")(runtime);
841
+ }
842
+ }
843
+ });
844
+
845
+ var regenerator = runtime_1;
846
+
847
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
848
+
849
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
850
+
851
+ /**
852
+ * 生成ajv示例,并加载drip-form官方插件
853
+ */
854
+ function registerAjv(options) {
855
+ // 默认使用草案2019
856
+ var ajv = new Ajv2019__default["default"](_objectSpread({
857
+ // 不允许type:['string','number']等联合模式 推荐使用anyOf代替
858
+ allowUnionTypes: false,
859
+ //支持default关键字输出到formData
860
+ useDefaults: true,
861
+ // 展示所有错误信息。为false时,检测到错误立马返回,后续错误不会返回
862
+ allErrors: true,
863
+ // 错误信息包含schema、parentSchema
864
+ verbose: true,
865
+ // 支持$data引用,参考:https://ajv.js.org/guide/combining-schemas.html#data-reference
866
+ $data: true,
867
+ // 支持鉴别关键字 参考:https://ajv.js.org/json-schema.html#discriminator
868
+ discriminator: true,
869
+ // 是否删除数据中Schema未定义的字段
870
+ removeAdditional: false
871
+ }, options)); // 支持草案7
872
+
873
+ ajv.addMetaSchema(draft7MetaSchema__default["default"], 'http://json-schema.org/draft-07/schema#'); // 支持草案6
874
+
875
+ ajv.addMetaSchema(draft6MetaSchema__default["default"], 'draft6'); // 添加ajv-keywords关键字
876
+
877
+ ajvKeywords__default["default"](ajv); // 添加ajv-errors
878
+
879
+ ajvErrors__default["default"](ajv); // 添加ajv-formats
880
+
881
+ addFormats__default["default"](ajv); // 添加draft2019的formats
882
+
883
+ apply__default["default"](ajv); // 添加drip-form官方忽略关键字(添加customFormat是为了node校验支持旧版的语法)
884
+
885
+ ajv.addVocabulary(['validateTime', 'showError', 'requiredMode', '$container', // 用于绑定generator 切换的fieldKey
886
+ '$fieldKey', 'customFormat', // v1需要过滤该字段
887
+ 'transformToObject', 'flow']); // 加载drip-form官方keywords插件
888
+
889
+ addDripKeywords__default["default"](ajv); // 加载drip-form官方formats插件
890
+
891
+ addDripFormats__default["default"](ajv);
892
+ return ajv;
893
+ }
894
+
895
+ function loadAjvPlugins(ajv, plugins) {
896
+ if (plugins) {
897
+ if (Array.isArray(plugins)) {
898
+ plugins.map( /*#__PURE__*/function () {
899
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(plugin) {
900
+ return regenerator.wrap(function _callee$(_context) {
901
+ while (1) {
902
+ switch (_context.prev = _context.next) {
903
+ case 0:
904
+ try {
905
+ plugin(ajv);
906
+ } catch (error) {
907
+ console.error("\u52A0\u8F7D".concat(plugins, "\u9519\u8BEF"));
908
+ console.error(error);
909
+ }
910
+
911
+ case 1:
912
+ case "end":
913
+ return _context.stop();
914
+ }
915
+ }
916
+ }, _callee);
917
+ }));
918
+
919
+ return function (_x) {
920
+ return _ref.apply(this, arguments);
921
+ };
922
+ }());
923
+ } else if (typeof plugins === 'function') {
924
+ try {
925
+ plugins(ajv);
926
+ } catch (error) {
927
+ console.error('加载插件错误');
928
+ console.error(error);
929
+ }
930
+ }
931
+ }
932
+ }
933
+
934
+ var index = {
935
+ registerAjv: registerAjv,
936
+ loadAjvPlugins: loadAjvPlugins
937
+ };
938
+
939
+ module.exports = index;