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