@hyperjump/json-schema 0.18.4 → 0.20.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 +1 -1
- package/dist/json-schema-amd.js +4191 -3081
- package/dist/json-schema-amd.js.map +1 -1
- package/dist/json-schema-amd.min.js +2 -1
- package/dist/json-schema-amd.min.js.map +1 -1
- package/dist/json-schema-cjs.js +2403 -1293
- package/dist/json-schema-cjs.js.map +1 -1
- package/dist/json-schema-cjs.min.js +2 -1
- package/dist/json-schema-cjs.min.js.map +1 -1
- package/dist/json-schema-esm.js +2404 -1281
- package/dist/json-schema-esm.js.map +1 -1
- package/dist/json-schema-esm.min.js +2 -1
- package/dist/json-schema-esm.min.js.map +1 -1
- package/dist/json-schema-iife.js +4195 -3085
- package/dist/json-schema-iife.js.map +1 -1
- package/dist/json-schema-iife.min.js +2 -1
- package/dist/json-schema-iife.min.js.map +1 -1
- package/dist/json-schema-system.js +4194 -3071
- package/dist/json-schema-system.js.map +1 -1
- package/dist/json-schema-system.min.js +2 -1
- package/dist/json-schema-system.min.js.map +1 -1
- package/dist/json-schema-umd.js +4194 -3084
- package/dist/json-schema-umd.js.map +1 -1
- package/dist/json-schema-umd.min.js +2 -1
- package/dist/json-schema-umd.min.js.map +1 -1
- package/lib/draft-04.js +6 -6
- package/lib/draft-06.js +6 -6
- package/lib/draft-07.js +6 -6
- package/lib/draft-2019-09.js +7 -7
- package/lib/draft-2020-12.js +7 -7
- package/package.json +20 -19
package/dist/json-schema-cjs.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
|
+
|
|
7
|
+
var justCurryIt = curry$a;
|
|
6
8
|
|
|
7
9
|
/*
|
|
8
10
|
function add(a, b, c) {
|
|
@@ -27,7 +29,7 @@ var justCurryIt = curry;
|
|
|
27
29
|
milesToKm(10); // 16.2
|
|
28
30
|
*/
|
|
29
31
|
|
|
30
|
-
function curry(fn, arity) {
|
|
32
|
+
function curry$a(fn, arity) {
|
|
31
33
|
return function curried() {
|
|
32
34
|
if (arity == null) {
|
|
33
35
|
arity = fn.length;
|
|
@@ -43,13 +45,8 @@ function curry(fn, arity) {
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
var
|
|
48
|
+
var pubsub = {exports: {}};
|
|
47
49
|
|
|
48
|
-
function createCommonjsModule(fn, module) {
|
|
49
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var pubsub = createCommonjsModule(function (module, exports) {
|
|
53
50
|
/**
|
|
54
51
|
* Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk
|
|
55
52
|
* License: MIT - http://mrgnrdrck.mit-license.org
|
|
@@ -57,600 +54,1854 @@ var pubsub = createCommonjsModule(function (module, exports) {
|
|
|
57
54
|
* https://github.com/mroderick/PubSubJS
|
|
58
55
|
*/
|
|
59
56
|
|
|
60
|
-
(function (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
(function (module, exports) {
|
|
58
|
+
(function (root, factory){
|
|
59
|
+
|
|
60
|
+
var PubSub = {};
|
|
61
|
+
|
|
62
|
+
if (root.PubSub) {
|
|
63
|
+
PubSub = root.PubSub;
|
|
64
|
+
console.warn("PubSub already loaded, using existing version");
|
|
65
|
+
} else {
|
|
66
|
+
root.PubSub = PubSub;
|
|
67
|
+
factory(PubSub);
|
|
68
|
+
}
|
|
69
|
+
// CommonJS and Node.js module support
|
|
70
|
+
{
|
|
71
|
+
if (module !== undefined && module.exports) {
|
|
72
|
+
exports = module.exports = PubSub; // Node.js specific `module.exports`
|
|
73
|
+
}
|
|
74
|
+
exports.PubSub = PubSub; // CommonJS module 1.1.1 spec
|
|
75
|
+
module.exports = exports = PubSub; // CommonJS
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){
|
|
79
|
+
|
|
80
|
+
var messages = {},
|
|
81
|
+
lastUid = -1,
|
|
82
|
+
ALL_SUBSCRIBING_MSG = '*';
|
|
83
|
+
|
|
84
|
+
function hasKeys(obj){
|
|
85
|
+
var key;
|
|
86
|
+
|
|
87
|
+
for (key in obj){
|
|
88
|
+
if ( Object.prototype.hasOwnProperty.call(obj, key) ){
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns a function that throws the passed exception, for use as argument for setTimeout
|
|
97
|
+
* @alias throwException
|
|
98
|
+
* @function
|
|
99
|
+
* @param { Object } ex An Error object
|
|
100
|
+
*/
|
|
101
|
+
function throwException( ex ){
|
|
102
|
+
return function reThrowException(){
|
|
103
|
+
throw ex;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function callSubscriberWithDelayedExceptions( subscriber, message, data ){
|
|
108
|
+
try {
|
|
109
|
+
subscriber( message, data );
|
|
110
|
+
} catch( ex ){
|
|
111
|
+
setTimeout( throwException( ex ), 0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function callSubscriberWithImmediateExceptions( subscriber, message, data ){
|
|
116
|
+
subscriber( message, data );
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function deliverMessage( originalMessage, matchedMessage, data, immediateExceptions ){
|
|
120
|
+
var subscribers = messages[matchedMessage],
|
|
121
|
+
callSubscriber = immediateExceptions ? callSubscriberWithImmediateExceptions : callSubscriberWithDelayedExceptions,
|
|
122
|
+
s;
|
|
123
|
+
|
|
124
|
+
if ( !Object.prototype.hasOwnProperty.call( messages, matchedMessage ) ) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (s in subscribers){
|
|
129
|
+
if ( Object.prototype.hasOwnProperty.call(subscribers, s)){
|
|
130
|
+
callSubscriber( subscribers[s], originalMessage, data );
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function createDeliveryFunction( message, data, immediateExceptions ){
|
|
136
|
+
return function deliverNamespaced(){
|
|
137
|
+
var topic = String( message ),
|
|
138
|
+
position = topic.lastIndexOf( '.' );
|
|
139
|
+
|
|
140
|
+
// deliver the message as it is now
|
|
141
|
+
deliverMessage(message, message, data, immediateExceptions);
|
|
142
|
+
|
|
143
|
+
// trim the hierarchy and deliver message to each level
|
|
144
|
+
while( position !== -1 ){
|
|
145
|
+
topic = topic.substr( 0, position );
|
|
146
|
+
position = topic.lastIndexOf('.');
|
|
147
|
+
deliverMessage( message, topic, data, immediateExceptions );
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function hasDirectSubscribersFor( message ) {
|
|
155
|
+
var topic = String( message ),
|
|
156
|
+
found = Boolean(Object.prototype.hasOwnProperty.call( messages, topic ) && hasKeys(messages[topic]));
|
|
157
|
+
|
|
158
|
+
return found;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function messageHasSubscribers( message ){
|
|
162
|
+
var topic = String( message ),
|
|
163
|
+
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
|
|
164
|
+
position = topic.lastIndexOf( '.' );
|
|
165
|
+
|
|
166
|
+
while ( !found && position !== -1 ){
|
|
167
|
+
topic = topic.substr( 0, position );
|
|
168
|
+
position = topic.lastIndexOf( '.' );
|
|
169
|
+
found = hasDirectSubscribersFor(topic);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return found;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function publish( message, data, sync, immediateExceptions ){
|
|
176
|
+
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
177
|
+
|
|
178
|
+
var deliver = createDeliveryFunction( message, data, immediateExceptions ),
|
|
179
|
+
hasSubscribers = messageHasSubscribers( message );
|
|
180
|
+
|
|
181
|
+
if ( !hasSubscribers ){
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if ( sync === true ){
|
|
186
|
+
deliver();
|
|
187
|
+
} else {
|
|
188
|
+
setTimeout( deliver, 0 );
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Publishes the message, passing the data to it's subscribers
|
|
195
|
+
* @function
|
|
196
|
+
* @alias publish
|
|
197
|
+
* @param { String } message The message to publish
|
|
198
|
+
* @param {} data The data to pass to subscribers
|
|
199
|
+
* @return { Boolean }
|
|
200
|
+
*/
|
|
201
|
+
PubSub.publish = function( message, data ){
|
|
202
|
+
return publish( message, data, false, PubSub.immediateExceptions );
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Publishes the message synchronously, passing the data to it's subscribers
|
|
207
|
+
* @function
|
|
208
|
+
* @alias publishSync
|
|
209
|
+
* @param { String } message The message to publish
|
|
210
|
+
* @param {} data The data to pass to subscribers
|
|
211
|
+
* @return { Boolean }
|
|
212
|
+
*/
|
|
213
|
+
PubSub.publishSync = function( message, data ){
|
|
214
|
+
return publish( message, data, true, PubSub.immediateExceptions );
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Subscribes the passed function to the passed message. Every returned token is unique and should be stored if you need to unsubscribe
|
|
219
|
+
* @function
|
|
220
|
+
* @alias subscribe
|
|
221
|
+
* @param { String } message The message to subscribe to
|
|
222
|
+
* @param { Function } func The function to call when a new message is published
|
|
223
|
+
* @return { String }
|
|
224
|
+
*/
|
|
225
|
+
PubSub.subscribe = function( message, func ){
|
|
226
|
+
if ( typeof func !== 'function'){
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
231
|
+
|
|
232
|
+
// message is not registered yet
|
|
233
|
+
if ( !Object.prototype.hasOwnProperty.call( messages, message ) ){
|
|
234
|
+
messages[message] = {};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// forcing token as String, to allow for future expansions without breaking usage
|
|
238
|
+
// and allow for easy use as key names for the 'messages' object
|
|
239
|
+
var token = 'uid_' + String(++lastUid);
|
|
240
|
+
messages[message][token] = func;
|
|
241
|
+
|
|
242
|
+
// return token for unsubscribing
|
|
243
|
+
return token;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
PubSub.subscribeAll = function( func ){
|
|
247
|
+
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Subscribes the passed function to the passed message once
|
|
252
|
+
* @function
|
|
253
|
+
* @alias subscribeOnce
|
|
254
|
+
* @param { String } message The message to subscribe to
|
|
255
|
+
* @param { Function } func The function to call when a new message is published
|
|
256
|
+
* @return { PubSub }
|
|
257
|
+
*/
|
|
258
|
+
PubSub.subscribeOnce = function( message, func ){
|
|
259
|
+
var token = PubSub.subscribe( message, function(){
|
|
260
|
+
// before func apply, unsubscribe message
|
|
261
|
+
PubSub.unsubscribe( token );
|
|
262
|
+
func.apply( this, arguments );
|
|
263
|
+
});
|
|
264
|
+
return PubSub;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Clears all subscriptions
|
|
269
|
+
* @function
|
|
270
|
+
* @public
|
|
271
|
+
* @alias clearAllSubscriptions
|
|
272
|
+
*/
|
|
273
|
+
PubSub.clearAllSubscriptions = function clearAllSubscriptions(){
|
|
274
|
+
messages = {};
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Clear subscriptions by the topic
|
|
279
|
+
* @function
|
|
280
|
+
* @public
|
|
281
|
+
* @alias clearAllSubscriptions
|
|
282
|
+
* @return { int }
|
|
283
|
+
*/
|
|
284
|
+
PubSub.clearSubscriptions = function clearSubscriptions(topic){
|
|
285
|
+
var m;
|
|
286
|
+
for (m in messages){
|
|
287
|
+
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
288
|
+
delete messages[m];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
Count subscriptions by the topic
|
|
295
|
+
* @function
|
|
296
|
+
* @public
|
|
297
|
+
* @alias countSubscriptions
|
|
298
|
+
* @return { Array }
|
|
299
|
+
*/
|
|
300
|
+
PubSub.countSubscriptions = function countSubscriptions(topic){
|
|
301
|
+
var m;
|
|
302
|
+
// eslint-disable-next-line no-unused-vars
|
|
303
|
+
var token;
|
|
304
|
+
var count = 0;
|
|
305
|
+
for (m in messages) {
|
|
306
|
+
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0) {
|
|
307
|
+
for (token in messages[m]) {
|
|
308
|
+
count++;
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return count;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
Gets subscriptions by the topic
|
|
319
|
+
* @function
|
|
320
|
+
* @public
|
|
321
|
+
* @alias getSubscriptions
|
|
322
|
+
*/
|
|
323
|
+
PubSub.getSubscriptions = function getSubscriptions(topic){
|
|
324
|
+
var m;
|
|
325
|
+
var list = [];
|
|
326
|
+
for (m in messages){
|
|
327
|
+
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
328
|
+
list.push(m);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return list;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Removes subscriptions
|
|
336
|
+
*
|
|
337
|
+
* - When passed a token, removes a specific subscription.
|
|
338
|
+
*
|
|
339
|
+
* - When passed a function, removes all subscriptions for that function
|
|
340
|
+
*
|
|
341
|
+
* - When passed a topic, removes all subscriptions for that topic (hierarchy)
|
|
342
|
+
* @function
|
|
343
|
+
* @public
|
|
344
|
+
* @alias subscribeOnce
|
|
345
|
+
* @param { String | Function } value A token, function or topic to unsubscribe from
|
|
346
|
+
* @example // Unsubscribing with a token
|
|
347
|
+
* var token = PubSub.subscribe('mytopic', myFunc);
|
|
348
|
+
* PubSub.unsubscribe(token);
|
|
349
|
+
* @example // Unsubscribing with a function
|
|
350
|
+
* PubSub.unsubscribe(myFunc);
|
|
351
|
+
* @example // Unsubscribing from a topic
|
|
352
|
+
* PubSub.unsubscribe('mytopic');
|
|
353
|
+
*/
|
|
354
|
+
PubSub.unsubscribe = function(value){
|
|
355
|
+
var descendantTopicExists = function(topic) {
|
|
356
|
+
var m;
|
|
357
|
+
for ( m in messages ){
|
|
358
|
+
if ( Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0 ){
|
|
359
|
+
// a descendant of the topic exists:
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return false;
|
|
365
|
+
},
|
|
366
|
+
isTopic = typeof value === 'string' && ( Object.prototype.hasOwnProperty.call(messages, value) || descendantTopicExists(value) ),
|
|
367
|
+
isToken = !isTopic && typeof value === 'string',
|
|
368
|
+
isFunction = typeof value === 'function',
|
|
369
|
+
result = false,
|
|
370
|
+
m, message, t;
|
|
371
|
+
|
|
372
|
+
if (isTopic){
|
|
373
|
+
PubSub.clearSubscriptions(value);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
for ( m in messages ){
|
|
378
|
+
if ( Object.prototype.hasOwnProperty.call( messages, m ) ){
|
|
379
|
+
message = messages[m];
|
|
380
|
+
|
|
381
|
+
if ( isToken && message[value] ){
|
|
382
|
+
delete message[value];
|
|
383
|
+
result = value;
|
|
384
|
+
// tokens are unique, so we can just stop here
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (isFunction) {
|
|
389
|
+
for ( t in message ){
|
|
390
|
+
if (Object.prototype.hasOwnProperty.call(message, t) && message[t] === value){
|
|
391
|
+
delete message[t];
|
|
392
|
+
result = true;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return result;
|
|
400
|
+
};
|
|
401
|
+
}));
|
|
402
|
+
} (pubsub, pubsub.exports));
|
|
403
|
+
|
|
404
|
+
var uri_all = {exports: {}};
|
|
405
|
+
|
|
406
|
+
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
407
|
+
|
|
408
|
+
(function (module, exports) {
|
|
409
|
+
(function (global, factory) {
|
|
410
|
+
factory(exports) ;
|
|
411
|
+
}(commonjsGlobal, (function (exports) {
|
|
412
|
+
function merge() {
|
|
413
|
+
for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
|
|
414
|
+
sets[_key] = arguments[_key];
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (sets.length > 1) {
|
|
418
|
+
sets[0] = sets[0].slice(0, -1);
|
|
419
|
+
var xl = sets.length - 1;
|
|
420
|
+
for (var x = 1; x < xl; ++x) {
|
|
421
|
+
sets[x] = sets[x].slice(1, -1);
|
|
422
|
+
}
|
|
423
|
+
sets[xl] = sets[xl].slice(1);
|
|
424
|
+
return sets.join('');
|
|
425
|
+
} else {
|
|
426
|
+
return sets[0];
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function subexp(str) {
|
|
430
|
+
return "(?:" + str + ")";
|
|
431
|
+
}
|
|
432
|
+
function typeOf(o) {
|
|
433
|
+
return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
|
|
434
|
+
}
|
|
435
|
+
function toUpperCase(str) {
|
|
436
|
+
return str.toUpperCase();
|
|
437
|
+
}
|
|
438
|
+
function toArray(obj) {
|
|
439
|
+
return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
|
|
440
|
+
}
|
|
441
|
+
function assign(target, source) {
|
|
442
|
+
var obj = target;
|
|
443
|
+
if (source) {
|
|
444
|
+
for (var key in source) {
|
|
445
|
+
obj[key] = source[key];
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return obj;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function buildExps(isIRI) {
|
|
452
|
+
var ALPHA$$ = "[A-Za-z]",
|
|
453
|
+
DIGIT$$ = "[0-9]",
|
|
454
|
+
HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
|
|
455
|
+
PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
|
|
456
|
+
//expanded
|
|
457
|
+
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
|
|
458
|
+
SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
|
|
459
|
+
RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
|
|
460
|
+
UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
|
|
461
|
+
//subset, excludes bidi control characters
|
|
462
|
+
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
|
|
463
|
+
//subset
|
|
464
|
+
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
|
|
465
|
+
subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
|
|
466
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
|
|
467
|
+
var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
|
|
468
|
+
//relaxed parsing rules
|
|
469
|
+
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
|
470
|
+
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
|
471
|
+
LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
|
|
472
|
+
IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
|
|
473
|
+
// 6( h16 ":" ) ls32
|
|
474
|
+
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
|
|
475
|
+
// "::" 5( h16 ":" ) ls32
|
|
476
|
+
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
|
|
477
|
+
//[ h16 ] "::" 4( h16 ":" ) ls32
|
|
478
|
+
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
|
|
479
|
+
//[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
|
480
|
+
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
|
|
481
|
+
//[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
|
482
|
+
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
|
|
483
|
+
//[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
|
484
|
+
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
|
|
485
|
+
//[ *4( h16 ":" ) h16 ] "::" ls32
|
|
486
|
+
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
|
|
487
|
+
//[ *5( h16 ":" ) h16 ] "::" h16
|
|
488
|
+
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
|
|
489
|
+
//[ *6( h16 ":" ) h16 ] "::"
|
|
490
|
+
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
|
491
|
+
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
|
|
492
|
+
//RFC 6874, with relaxed parsing rules
|
|
493
|
+
subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
|
|
494
|
+
//RFC 6874
|
|
495
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
|
|
496
|
+
var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
|
|
497
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
|
|
498
|
+
subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
|
|
499
|
+
return {
|
|
500
|
+
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
|
501
|
+
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
502
|
+
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
503
|
+
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
504
|
+
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
505
|
+
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
|
506
|
+
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
|
507
|
+
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
508
|
+
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
|
|
509
|
+
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
|
510
|
+
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
|
|
511
|
+
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
|
512
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
var URI_PROTOCOL = buildExps(false);
|
|
516
|
+
|
|
517
|
+
var IRI_PROTOCOL = buildExps(true);
|
|
518
|
+
|
|
519
|
+
var slicedToArray = function () {
|
|
520
|
+
function sliceIterator(arr, i) {
|
|
521
|
+
var _arr = [];
|
|
522
|
+
var _n = true;
|
|
523
|
+
var _d = false;
|
|
524
|
+
var _e = undefined;
|
|
525
|
+
|
|
526
|
+
try {
|
|
527
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
528
|
+
_arr.push(_s.value);
|
|
529
|
+
|
|
530
|
+
if (i && _arr.length === i) break;
|
|
531
|
+
}
|
|
532
|
+
} catch (err) {
|
|
533
|
+
_d = true;
|
|
534
|
+
_e = err;
|
|
535
|
+
} finally {
|
|
536
|
+
try {
|
|
537
|
+
if (!_n && _i["return"]) _i["return"]();
|
|
538
|
+
} finally {
|
|
539
|
+
if (_d) throw _e;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return _arr;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return function (arr, i) {
|
|
547
|
+
if (Array.isArray(arr)) {
|
|
548
|
+
return arr;
|
|
549
|
+
} else if (Symbol.iterator in Object(arr)) {
|
|
550
|
+
return sliceIterator(arr, i);
|
|
551
|
+
} else {
|
|
552
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
}();
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
var toConsumableArray = function (arr) {
|
|
570
|
+
if (Array.isArray(arr)) {
|
|
571
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
572
|
+
|
|
573
|
+
return arr2;
|
|
574
|
+
} else {
|
|
575
|
+
return Array.from(arr);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/** Highest positive signed 32-bit float value */
|
|
580
|
+
|
|
581
|
+
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
|
582
|
+
|
|
583
|
+
/** Bootstring parameters */
|
|
584
|
+
var base = 36;
|
|
585
|
+
var tMin = 1;
|
|
586
|
+
var tMax = 26;
|
|
587
|
+
var skew = 38;
|
|
588
|
+
var damp = 700;
|
|
589
|
+
var initialBias = 72;
|
|
590
|
+
var initialN = 128; // 0x80
|
|
591
|
+
var delimiter = '-'; // '\x2D'
|
|
592
|
+
|
|
593
|
+
/** Regular expressions */
|
|
594
|
+
var regexPunycode = /^xn--/;
|
|
595
|
+
var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
|
|
596
|
+
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
597
|
+
|
|
598
|
+
/** Error messages */
|
|
599
|
+
var errors = {
|
|
600
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
601
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
602
|
+
'invalid-input': 'Invalid input'
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
/** Convenience shortcuts */
|
|
606
|
+
var baseMinusTMin = base - tMin;
|
|
607
|
+
var floor = Math.floor;
|
|
608
|
+
var stringFromCharCode = String.fromCharCode;
|
|
609
|
+
|
|
610
|
+
/*--------------------------------------------------------------------------*/
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* A generic error utility function.
|
|
614
|
+
* @private
|
|
615
|
+
* @param {String} type The error type.
|
|
616
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
617
|
+
*/
|
|
618
|
+
function error$1(type) {
|
|
619
|
+
throw new RangeError(errors[type]);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* A generic `Array#map` utility function.
|
|
624
|
+
* @private
|
|
625
|
+
* @param {Array} array The array to iterate over.
|
|
626
|
+
* @param {Function} callback The function that gets called for every array
|
|
627
|
+
* item.
|
|
628
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
629
|
+
*/
|
|
630
|
+
function map(array, fn) {
|
|
631
|
+
var result = [];
|
|
632
|
+
var length = array.length;
|
|
633
|
+
while (length--) {
|
|
634
|
+
result[length] = fn(array[length]);
|
|
635
|
+
}
|
|
636
|
+
return result;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
641
|
+
* addresses.
|
|
642
|
+
* @private
|
|
643
|
+
* @param {String} domain The domain name or email address.
|
|
644
|
+
* @param {Function} callback The function that gets called for every
|
|
645
|
+
* character.
|
|
646
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
647
|
+
* function.
|
|
648
|
+
*/
|
|
649
|
+
function mapDomain(string, fn) {
|
|
650
|
+
var parts = string.split('@');
|
|
651
|
+
var result = '';
|
|
652
|
+
if (parts.length > 1) {
|
|
653
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
654
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
655
|
+
result = parts[0] + '@';
|
|
656
|
+
string = parts[1];
|
|
657
|
+
}
|
|
658
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
659
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
660
|
+
var labels = string.split('.');
|
|
661
|
+
var encoded = map(labels, fn).join('.');
|
|
662
|
+
return result + encoded;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
667
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
668
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
669
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
670
|
+
* matching UTF-16.
|
|
671
|
+
* @see `punycode.ucs2.encode`
|
|
672
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
673
|
+
* @memberOf punycode.ucs2
|
|
674
|
+
* @name decode
|
|
675
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
676
|
+
* @returns {Array} The new array of code points.
|
|
677
|
+
*/
|
|
678
|
+
function ucs2decode(string) {
|
|
679
|
+
var output = [];
|
|
680
|
+
var counter = 0;
|
|
681
|
+
var length = string.length;
|
|
682
|
+
while (counter < length) {
|
|
683
|
+
var value = string.charCodeAt(counter++);
|
|
684
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
685
|
+
// It's a high surrogate, and there is a next character.
|
|
686
|
+
var extra = string.charCodeAt(counter++);
|
|
687
|
+
if ((extra & 0xFC00) == 0xDC00) {
|
|
688
|
+
// Low surrogate.
|
|
689
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
690
|
+
} else {
|
|
691
|
+
// It's an unmatched surrogate; only append this code unit, in case the
|
|
692
|
+
// next code unit is the high surrogate of a surrogate pair.
|
|
693
|
+
output.push(value);
|
|
694
|
+
counter--;
|
|
695
|
+
}
|
|
696
|
+
} else {
|
|
697
|
+
output.push(value);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return output;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Creates a string based on an array of numeric code points.
|
|
705
|
+
* @see `punycode.ucs2.decode`
|
|
706
|
+
* @memberOf punycode.ucs2
|
|
707
|
+
* @name encode
|
|
708
|
+
* @param {Array} codePoints The array of numeric code points.
|
|
709
|
+
* @returns {String} The new Unicode string (UCS-2).
|
|
710
|
+
*/
|
|
711
|
+
var ucs2encode = function ucs2encode(array) {
|
|
712
|
+
return String.fromCodePoint.apply(String, toConsumableArray(array));
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Converts a basic code point into a digit/integer.
|
|
717
|
+
* @see `digitToBasic()`
|
|
718
|
+
* @private
|
|
719
|
+
* @param {Number} codePoint The basic numeric code point value.
|
|
720
|
+
* @returns {Number} The numeric value of a basic code point (for use in
|
|
721
|
+
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
722
|
+
* the code point does not represent a value.
|
|
723
|
+
*/
|
|
724
|
+
var basicToDigit = function basicToDigit(codePoint) {
|
|
725
|
+
if (codePoint - 0x30 < 0x0A) {
|
|
726
|
+
return codePoint - 0x16;
|
|
727
|
+
}
|
|
728
|
+
if (codePoint - 0x41 < 0x1A) {
|
|
729
|
+
return codePoint - 0x41;
|
|
730
|
+
}
|
|
731
|
+
if (codePoint - 0x61 < 0x1A) {
|
|
732
|
+
return codePoint - 0x61;
|
|
733
|
+
}
|
|
734
|
+
return base;
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Converts a digit/integer into a basic code point.
|
|
739
|
+
* @see `basicToDigit()`
|
|
740
|
+
* @private
|
|
741
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
742
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
743
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
744
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
745
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
746
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
747
|
+
*/
|
|
748
|
+
var digitToBasic = function digitToBasic(digit, flag) {
|
|
749
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
750
|
+
// 26..35 map to ASCII 0..9
|
|
751
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
756
|
+
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
757
|
+
* @private
|
|
758
|
+
*/
|
|
759
|
+
var adapt = function adapt(delta, numPoints, firstTime) {
|
|
760
|
+
var k = 0;
|
|
761
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
762
|
+
delta += floor(delta / numPoints);
|
|
763
|
+
for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
764
|
+
delta = floor(delta / baseMinusTMin);
|
|
765
|
+
}
|
|
766
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
771
|
+
* symbols.
|
|
772
|
+
* @memberOf punycode
|
|
773
|
+
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
774
|
+
* @returns {String} The resulting string of Unicode symbols.
|
|
775
|
+
*/
|
|
776
|
+
var decode = function decode(input) {
|
|
777
|
+
// Don't use UCS-2.
|
|
778
|
+
var output = [];
|
|
779
|
+
var inputLength = input.length;
|
|
780
|
+
var i = 0;
|
|
781
|
+
var n = initialN;
|
|
782
|
+
var bias = initialBias;
|
|
783
|
+
|
|
784
|
+
// Handle the basic code points: let `basic` be the number of input code
|
|
785
|
+
// points before the last delimiter, or `0` if there is none, then copy
|
|
786
|
+
// the first basic code points to the output.
|
|
787
|
+
|
|
788
|
+
var basic = input.lastIndexOf(delimiter);
|
|
789
|
+
if (basic < 0) {
|
|
790
|
+
basic = 0;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
for (var j = 0; j < basic; ++j) {
|
|
794
|
+
// if it's not a basic code point
|
|
795
|
+
if (input.charCodeAt(j) >= 0x80) {
|
|
796
|
+
error$1('not-basic');
|
|
797
|
+
}
|
|
798
|
+
output.push(input.charCodeAt(j));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
802
|
+
// points were copied; start at the beginning otherwise.
|
|
803
|
+
|
|
804
|
+
for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
|
|
805
|
+
|
|
806
|
+
// `index` is the index of the next character to be consumed.
|
|
807
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
808
|
+
// which gets added to `i`. The overflow checking is easier
|
|
809
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
810
|
+
// value at the end to obtain `delta`.
|
|
811
|
+
var oldi = i;
|
|
812
|
+
for (var w = 1, k = base;; /* no condition */k += base) {
|
|
813
|
+
|
|
814
|
+
if (index >= inputLength) {
|
|
815
|
+
error$1('invalid-input');
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
var digit = basicToDigit(input.charCodeAt(index++));
|
|
819
|
+
|
|
820
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
821
|
+
error$1('overflow');
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
i += digit * w;
|
|
825
|
+
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
826
|
+
|
|
827
|
+
if (digit < t) {
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
var baseMinusT = base - t;
|
|
832
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
833
|
+
error$1('overflow');
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
w *= baseMinusT;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var out = output.length + 1;
|
|
840
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
841
|
+
|
|
842
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
843
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
844
|
+
if (floor(i / out) > maxInt - n) {
|
|
845
|
+
error$1('overflow');
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
n += floor(i / out);
|
|
849
|
+
i %= out;
|
|
850
|
+
|
|
851
|
+
// Insert `n` at position `i` of the output.
|
|
852
|
+
output.splice(i++, 0, n);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
return String.fromCodePoint.apply(String, output);
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
860
|
+
* Punycode string of ASCII-only symbols.
|
|
861
|
+
* @memberOf punycode
|
|
862
|
+
* @param {String} input The string of Unicode symbols.
|
|
863
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
864
|
+
*/
|
|
865
|
+
var encode = function encode(input) {
|
|
866
|
+
var output = [];
|
|
867
|
+
|
|
868
|
+
// Convert the input in UCS-2 to an array of Unicode code points.
|
|
869
|
+
input = ucs2decode(input);
|
|
870
|
+
|
|
871
|
+
// Cache the length.
|
|
872
|
+
var inputLength = input.length;
|
|
873
|
+
|
|
874
|
+
// Initialize the state.
|
|
875
|
+
var n = initialN;
|
|
876
|
+
var delta = 0;
|
|
877
|
+
var bias = initialBias;
|
|
878
|
+
|
|
879
|
+
// Handle the basic code points.
|
|
880
|
+
var _iteratorNormalCompletion = true;
|
|
881
|
+
var _didIteratorError = false;
|
|
882
|
+
var _iteratorError = undefined;
|
|
883
|
+
|
|
884
|
+
try {
|
|
885
|
+
for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
886
|
+
var _currentValue2 = _step.value;
|
|
887
|
+
|
|
888
|
+
if (_currentValue2 < 0x80) {
|
|
889
|
+
output.push(stringFromCharCode(_currentValue2));
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
} catch (err) {
|
|
893
|
+
_didIteratorError = true;
|
|
894
|
+
_iteratorError = err;
|
|
895
|
+
} finally {
|
|
896
|
+
try {
|
|
897
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
898
|
+
_iterator.return();
|
|
899
|
+
}
|
|
900
|
+
} finally {
|
|
901
|
+
if (_didIteratorError) {
|
|
902
|
+
throw _iteratorError;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
var basicLength = output.length;
|
|
908
|
+
var handledCPCount = basicLength;
|
|
909
|
+
|
|
910
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
911
|
+
// `basicLength` is the number of basic code points.
|
|
912
|
+
|
|
913
|
+
// Finish the basic string with a delimiter unless it's empty.
|
|
914
|
+
if (basicLength) {
|
|
915
|
+
output.push(delimiter);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// Main encoding loop:
|
|
919
|
+
while (handledCPCount < inputLength) {
|
|
920
|
+
|
|
921
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
922
|
+
// larger one:
|
|
923
|
+
var m = maxInt;
|
|
924
|
+
var _iteratorNormalCompletion2 = true;
|
|
925
|
+
var _didIteratorError2 = false;
|
|
926
|
+
var _iteratorError2 = undefined;
|
|
927
|
+
|
|
928
|
+
try {
|
|
929
|
+
for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
930
|
+
var currentValue = _step2.value;
|
|
931
|
+
|
|
932
|
+
if (currentValue >= n && currentValue < m) {
|
|
933
|
+
m = currentValue;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
938
|
+
// but guard against overflow.
|
|
939
|
+
} catch (err) {
|
|
940
|
+
_didIteratorError2 = true;
|
|
941
|
+
_iteratorError2 = err;
|
|
942
|
+
} finally {
|
|
943
|
+
try {
|
|
944
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
945
|
+
_iterator2.return();
|
|
946
|
+
}
|
|
947
|
+
} finally {
|
|
948
|
+
if (_didIteratorError2) {
|
|
949
|
+
throw _iteratorError2;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
var handledCPCountPlusOne = handledCPCount + 1;
|
|
955
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
956
|
+
error$1('overflow');
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
960
|
+
n = m;
|
|
961
|
+
|
|
962
|
+
var _iteratorNormalCompletion3 = true;
|
|
963
|
+
var _didIteratorError3 = false;
|
|
964
|
+
var _iteratorError3 = undefined;
|
|
965
|
+
|
|
966
|
+
try {
|
|
967
|
+
for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
968
|
+
var _currentValue = _step3.value;
|
|
969
|
+
|
|
970
|
+
if (_currentValue < n && ++delta > maxInt) {
|
|
971
|
+
error$1('overflow');
|
|
972
|
+
}
|
|
973
|
+
if (_currentValue == n) {
|
|
974
|
+
// Represent delta as a generalized variable-length integer.
|
|
975
|
+
var q = delta;
|
|
976
|
+
for (var k = base;; /* no condition */k += base) {
|
|
977
|
+
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
978
|
+
if (q < t) {
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
var qMinusT = q - t;
|
|
982
|
+
var baseMinusT = base - t;
|
|
983
|
+
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
|
|
984
|
+
q = floor(qMinusT / baseMinusT);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
988
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
989
|
+
delta = 0;
|
|
990
|
+
++handledCPCount;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
} catch (err) {
|
|
994
|
+
_didIteratorError3 = true;
|
|
995
|
+
_iteratorError3 = err;
|
|
996
|
+
} finally {
|
|
997
|
+
try {
|
|
998
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
999
|
+
_iterator3.return();
|
|
1000
|
+
}
|
|
1001
|
+
} finally {
|
|
1002
|
+
if (_didIteratorError3) {
|
|
1003
|
+
throw _iteratorError3;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
++delta;
|
|
1009
|
+
++n;
|
|
1010
|
+
}
|
|
1011
|
+
return output.join('');
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
1016
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
1017
|
+
* it doesn't matter if you call it on a string that has already been
|
|
1018
|
+
* converted to Unicode.
|
|
1019
|
+
* @memberOf punycode
|
|
1020
|
+
* @param {String} input The Punycoded domain name or email address to
|
|
1021
|
+
* convert to Unicode.
|
|
1022
|
+
* @returns {String} The Unicode representation of the given Punycode
|
|
1023
|
+
* string.
|
|
1024
|
+
*/
|
|
1025
|
+
var toUnicode = function toUnicode(input) {
|
|
1026
|
+
return mapDomain(input, function (string) {
|
|
1027
|
+
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
1028
|
+
});
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
1033
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
1034
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
1035
|
+
* ASCII.
|
|
1036
|
+
* @memberOf punycode
|
|
1037
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
1038
|
+
* Unicode string.
|
|
1039
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
1040
|
+
* email address.
|
|
1041
|
+
*/
|
|
1042
|
+
var toASCII = function toASCII(input) {
|
|
1043
|
+
return mapDomain(input, function (string) {
|
|
1044
|
+
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
|
|
1045
|
+
});
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
/*--------------------------------------------------------------------------*/
|
|
1049
|
+
|
|
1050
|
+
/** Define the public API */
|
|
1051
|
+
var punycode = {
|
|
1052
|
+
/**
|
|
1053
|
+
* A string representing the current Punycode.js version number.
|
|
1054
|
+
* @memberOf punycode
|
|
1055
|
+
* @type String
|
|
1056
|
+
*/
|
|
1057
|
+
'version': '2.1.0',
|
|
1058
|
+
/**
|
|
1059
|
+
* An object of methods to convert from JavaScript's internal character
|
|
1060
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
1061
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
1062
|
+
* @memberOf punycode
|
|
1063
|
+
* @type Object
|
|
1064
|
+
*/
|
|
1065
|
+
'ucs2': {
|
|
1066
|
+
'decode': ucs2decode,
|
|
1067
|
+
'encode': ucs2encode
|
|
1068
|
+
},
|
|
1069
|
+
'decode': decode,
|
|
1070
|
+
'encode': encode,
|
|
1071
|
+
'toASCII': toASCII,
|
|
1072
|
+
'toUnicode': toUnicode
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* URI.js
|
|
1077
|
+
*
|
|
1078
|
+
* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
|
|
1079
|
+
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
1080
|
+
* @see http://github.com/garycourt/uri-js
|
|
1081
|
+
*/
|
|
1082
|
+
/**
|
|
1083
|
+
* Copyright 2011 Gary Court. All rights reserved.
|
|
1084
|
+
*
|
|
1085
|
+
* Redistribution and use in source and binary forms, with or without modification, are
|
|
1086
|
+
* permitted provided that the following conditions are met:
|
|
1087
|
+
*
|
|
1088
|
+
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
1089
|
+
* conditions and the following disclaimer.
|
|
1090
|
+
*
|
|
1091
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
1092
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
1093
|
+
* provided with the distribution.
|
|
1094
|
+
*
|
|
1095
|
+
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
1096
|
+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
1097
|
+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
|
|
1098
|
+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
1099
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1100
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
1101
|
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
1102
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
1103
|
+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1104
|
+
*
|
|
1105
|
+
* The views and conclusions contained in the software and documentation are those of the
|
|
1106
|
+
* authors and should not be interpreted as representing official policies, either expressed
|
|
1107
|
+
* or implied, of Gary Court.
|
|
1108
|
+
*/
|
|
1109
|
+
var SCHEMES = {};
|
|
1110
|
+
function pctEncChar(chr) {
|
|
1111
|
+
var c = chr.charCodeAt(0);
|
|
1112
|
+
var e = void 0;
|
|
1113
|
+
if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
|
|
1114
|
+
return e;
|
|
1115
|
+
}
|
|
1116
|
+
function pctDecChars(str) {
|
|
1117
|
+
var newStr = "";
|
|
1118
|
+
var i = 0;
|
|
1119
|
+
var il = str.length;
|
|
1120
|
+
while (i < il) {
|
|
1121
|
+
var c = parseInt(str.substr(i + 1, 2), 16);
|
|
1122
|
+
if (c < 128) {
|
|
1123
|
+
newStr += String.fromCharCode(c);
|
|
1124
|
+
i += 3;
|
|
1125
|
+
} else if (c >= 194 && c < 224) {
|
|
1126
|
+
if (il - i >= 6) {
|
|
1127
|
+
var c2 = parseInt(str.substr(i + 4, 2), 16);
|
|
1128
|
+
newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
|
|
1129
|
+
} else {
|
|
1130
|
+
newStr += str.substr(i, 6);
|
|
1131
|
+
}
|
|
1132
|
+
i += 6;
|
|
1133
|
+
} else if (c >= 224) {
|
|
1134
|
+
if (il - i >= 9) {
|
|
1135
|
+
var _c = parseInt(str.substr(i + 4, 2), 16);
|
|
1136
|
+
var c3 = parseInt(str.substr(i + 7, 2), 16);
|
|
1137
|
+
newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
|
|
1138
|
+
} else {
|
|
1139
|
+
newStr += str.substr(i, 9);
|
|
1140
|
+
}
|
|
1141
|
+
i += 9;
|
|
1142
|
+
} else {
|
|
1143
|
+
newStr += str.substr(i, 3);
|
|
1144
|
+
i += 3;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
return newStr;
|
|
1148
|
+
}
|
|
1149
|
+
function _normalizeComponentEncoding(components, protocol) {
|
|
1150
|
+
function decodeUnreserved(str) {
|
|
1151
|
+
var decStr = pctDecChars(str);
|
|
1152
|
+
return !decStr.match(protocol.UNRESERVED) ? str : decStr;
|
|
1153
|
+
}
|
|
1154
|
+
if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
|
|
1155
|
+
if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1156
|
+
if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1157
|
+
if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1158
|
+
if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1159
|
+
if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1160
|
+
return components;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
function _stripLeadingZeros(str) {
|
|
1164
|
+
return str.replace(/^0*(.*)/, "$1") || "0";
|
|
1165
|
+
}
|
|
1166
|
+
function _normalizeIPv4(host, protocol) {
|
|
1167
|
+
var matches = host.match(protocol.IPV4ADDRESS) || [];
|
|
1168
|
+
|
|
1169
|
+
var _matches = slicedToArray(matches, 2),
|
|
1170
|
+
address = _matches[1];
|
|
1171
|
+
|
|
1172
|
+
if (address) {
|
|
1173
|
+
return address.split(".").map(_stripLeadingZeros).join(".");
|
|
1174
|
+
} else {
|
|
1175
|
+
return host;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function _normalizeIPv6(host, protocol) {
|
|
1179
|
+
var matches = host.match(protocol.IPV6ADDRESS) || [];
|
|
1180
|
+
|
|
1181
|
+
var _matches2 = slicedToArray(matches, 3),
|
|
1182
|
+
address = _matches2[1],
|
|
1183
|
+
zone = _matches2[2];
|
|
1184
|
+
|
|
1185
|
+
if (address) {
|
|
1186
|
+
var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
|
|
1187
|
+
_address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
|
|
1188
|
+
last = _address$toLowerCase$2[0],
|
|
1189
|
+
first = _address$toLowerCase$2[1];
|
|
1190
|
+
|
|
1191
|
+
var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
|
|
1192
|
+
var lastFields = last.split(":").map(_stripLeadingZeros);
|
|
1193
|
+
var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
|
|
1194
|
+
var fieldCount = isLastFieldIPv4Address ? 7 : 8;
|
|
1195
|
+
var lastFieldsStart = lastFields.length - fieldCount;
|
|
1196
|
+
var fields = Array(fieldCount);
|
|
1197
|
+
for (var x = 0; x < fieldCount; ++x) {
|
|
1198
|
+
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
|
|
1199
|
+
}
|
|
1200
|
+
if (isLastFieldIPv4Address) {
|
|
1201
|
+
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
|
|
1202
|
+
}
|
|
1203
|
+
var allZeroFields = fields.reduce(function (acc, field, index) {
|
|
1204
|
+
if (!field || field === "0") {
|
|
1205
|
+
var lastLongest = acc[acc.length - 1];
|
|
1206
|
+
if (lastLongest && lastLongest.index + lastLongest.length === index) {
|
|
1207
|
+
lastLongest.length++;
|
|
1208
|
+
} else {
|
|
1209
|
+
acc.push({ index: index, length: 1 });
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return acc;
|
|
1213
|
+
}, []);
|
|
1214
|
+
var longestZeroFields = allZeroFields.sort(function (a, b) {
|
|
1215
|
+
return b.length - a.length;
|
|
1216
|
+
})[0];
|
|
1217
|
+
var newHost = void 0;
|
|
1218
|
+
if (longestZeroFields && longestZeroFields.length > 1) {
|
|
1219
|
+
var newFirst = fields.slice(0, longestZeroFields.index);
|
|
1220
|
+
var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
|
|
1221
|
+
newHost = newFirst.join(":") + "::" + newLast.join(":");
|
|
1222
|
+
} else {
|
|
1223
|
+
newHost = fields.join(":");
|
|
1224
|
+
}
|
|
1225
|
+
if (zone) {
|
|
1226
|
+
newHost += "%" + zone;
|
|
1227
|
+
}
|
|
1228
|
+
return newHost;
|
|
1229
|
+
} else {
|
|
1230
|
+
return host;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
|
|
1234
|
+
var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
|
|
1235
|
+
function parse(uriString) {
|
|
1236
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1237
|
+
|
|
1238
|
+
var components = {};
|
|
1239
|
+
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
1240
|
+
if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
|
|
1241
|
+
var matches = uriString.match(URI_PARSE);
|
|
1242
|
+
if (matches) {
|
|
1243
|
+
if (NO_MATCH_IS_UNDEFINED) {
|
|
1244
|
+
//store each component
|
|
1245
|
+
components.scheme = matches[1];
|
|
1246
|
+
components.userinfo = matches[3];
|
|
1247
|
+
components.host = matches[4];
|
|
1248
|
+
components.port = parseInt(matches[5], 10);
|
|
1249
|
+
components.path = matches[6] || "";
|
|
1250
|
+
components.query = matches[7];
|
|
1251
|
+
components.fragment = matches[8];
|
|
1252
|
+
//fix port number
|
|
1253
|
+
if (isNaN(components.port)) {
|
|
1254
|
+
components.port = matches[5];
|
|
1255
|
+
}
|
|
1256
|
+
} else {
|
|
1257
|
+
//IE FIX for improper RegExp matching
|
|
1258
|
+
//store each component
|
|
1259
|
+
components.scheme = matches[1] || undefined;
|
|
1260
|
+
components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
|
|
1261
|
+
components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
|
|
1262
|
+
components.port = parseInt(matches[5], 10);
|
|
1263
|
+
components.path = matches[6] || "";
|
|
1264
|
+
components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
|
|
1265
|
+
components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
|
|
1266
|
+
//fix port number
|
|
1267
|
+
if (isNaN(components.port)) {
|
|
1268
|
+
components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
if (components.host) {
|
|
1272
|
+
//normalize IP hosts
|
|
1273
|
+
components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
|
|
1274
|
+
}
|
|
1275
|
+
//determine reference type
|
|
1276
|
+
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
|
|
1277
|
+
components.reference = "same-document";
|
|
1278
|
+
} else if (components.scheme === undefined) {
|
|
1279
|
+
components.reference = "relative";
|
|
1280
|
+
} else if (components.fragment === undefined) {
|
|
1281
|
+
components.reference = "absolute";
|
|
1282
|
+
} else {
|
|
1283
|
+
components.reference = "uri";
|
|
1284
|
+
}
|
|
1285
|
+
//check for reference errors
|
|
1286
|
+
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
|
|
1287
|
+
components.error = components.error || "URI is not a " + options.reference + " reference.";
|
|
1288
|
+
}
|
|
1289
|
+
//find scheme handler
|
|
1290
|
+
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
1291
|
+
//check if scheme can't handle IRIs
|
|
1292
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
1293
|
+
//if host component is a domain name
|
|
1294
|
+
if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
|
|
1295
|
+
//convert Unicode IDN -> ASCII IDN
|
|
1296
|
+
try {
|
|
1297
|
+
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
|
|
1298
|
+
} catch (e) {
|
|
1299
|
+
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
//convert IRI -> URI
|
|
1303
|
+
_normalizeComponentEncoding(components, URI_PROTOCOL);
|
|
1304
|
+
} else {
|
|
1305
|
+
//normalize encodings
|
|
1306
|
+
_normalizeComponentEncoding(components, protocol);
|
|
1307
|
+
}
|
|
1308
|
+
//perform scheme specific parsing
|
|
1309
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
1310
|
+
schemeHandler.parse(components, options);
|
|
1311
|
+
}
|
|
1312
|
+
} else {
|
|
1313
|
+
components.error = components.error || "URI can not be parsed.";
|
|
1314
|
+
}
|
|
1315
|
+
return components;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
function _recomposeAuthority(components, options) {
|
|
1319
|
+
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
1320
|
+
var uriTokens = [];
|
|
1321
|
+
if (components.userinfo !== undefined) {
|
|
1322
|
+
uriTokens.push(components.userinfo);
|
|
1323
|
+
uriTokens.push("@");
|
|
1324
|
+
}
|
|
1325
|
+
if (components.host !== undefined) {
|
|
1326
|
+
//normalize IP hosts, add brackets and escape zone separator for IPv6
|
|
1327
|
+
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
|
|
1328
|
+
return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
|
|
1329
|
+
}));
|
|
1330
|
+
}
|
|
1331
|
+
if (typeof components.port === "number" || typeof components.port === "string") {
|
|
1332
|
+
uriTokens.push(":");
|
|
1333
|
+
uriTokens.push(String(components.port));
|
|
1334
|
+
}
|
|
1335
|
+
return uriTokens.length ? uriTokens.join("") : undefined;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
var RDS1 = /^\.\.?\//;
|
|
1339
|
+
var RDS2 = /^\/\.(\/|$)/;
|
|
1340
|
+
var RDS3 = /^\/\.\.(\/|$)/;
|
|
1341
|
+
var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
1342
|
+
function removeDotSegments(input) {
|
|
1343
|
+
var output = [];
|
|
1344
|
+
while (input.length) {
|
|
1345
|
+
if (input.match(RDS1)) {
|
|
1346
|
+
input = input.replace(RDS1, "");
|
|
1347
|
+
} else if (input.match(RDS2)) {
|
|
1348
|
+
input = input.replace(RDS2, "/");
|
|
1349
|
+
} else if (input.match(RDS3)) {
|
|
1350
|
+
input = input.replace(RDS3, "/");
|
|
1351
|
+
output.pop();
|
|
1352
|
+
} else if (input === "." || input === "..") {
|
|
1353
|
+
input = "";
|
|
1354
|
+
} else {
|
|
1355
|
+
var im = input.match(RDS5);
|
|
1356
|
+
if (im) {
|
|
1357
|
+
var s = im[0];
|
|
1358
|
+
input = input.slice(s.length);
|
|
1359
|
+
output.push(s);
|
|
1360
|
+
} else {
|
|
1361
|
+
throw new Error("Unexpected dot segment condition");
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
return output.join("");
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
function serialize(components) {
|
|
1369
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1370
|
+
|
|
1371
|
+
var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
1372
|
+
var uriTokens = [];
|
|
1373
|
+
//find scheme handler
|
|
1374
|
+
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
1375
|
+
//perform scheme specific serialization
|
|
1376
|
+
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
|
|
1377
|
+
if (components.host) {
|
|
1378
|
+
//if host component is an IPv6 address
|
|
1379
|
+
if (protocol.IPV6ADDRESS.test(components.host)) ;
|
|
1380
|
+
//TODO: normalize IPv6 address as per RFC 5952
|
|
1381
|
+
|
|
1382
|
+
//if host component is a domain name
|
|
1383
|
+
else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
|
|
1384
|
+
//convert IDN via punycode
|
|
1385
|
+
try {
|
|
1386
|
+
components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
|
|
1387
|
+
} catch (e) {
|
|
1388
|
+
components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
//normalize encoding
|
|
1393
|
+
_normalizeComponentEncoding(components, protocol);
|
|
1394
|
+
if (options.reference !== "suffix" && components.scheme) {
|
|
1395
|
+
uriTokens.push(components.scheme);
|
|
1396
|
+
uriTokens.push(":");
|
|
1397
|
+
}
|
|
1398
|
+
var authority = _recomposeAuthority(components, options);
|
|
1399
|
+
if (authority !== undefined) {
|
|
1400
|
+
if (options.reference !== "suffix") {
|
|
1401
|
+
uriTokens.push("//");
|
|
1402
|
+
}
|
|
1403
|
+
uriTokens.push(authority);
|
|
1404
|
+
if (components.path && components.path.charAt(0) !== "/") {
|
|
1405
|
+
uriTokens.push("/");
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
if (components.path !== undefined) {
|
|
1409
|
+
var s = components.path;
|
|
1410
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
1411
|
+
s = removeDotSegments(s);
|
|
1412
|
+
}
|
|
1413
|
+
if (authority === undefined) {
|
|
1414
|
+
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
|
|
1415
|
+
}
|
|
1416
|
+
uriTokens.push(s);
|
|
1417
|
+
}
|
|
1418
|
+
if (components.query !== undefined) {
|
|
1419
|
+
uriTokens.push("?");
|
|
1420
|
+
uriTokens.push(components.query);
|
|
1421
|
+
}
|
|
1422
|
+
if (components.fragment !== undefined) {
|
|
1423
|
+
uriTokens.push("#");
|
|
1424
|
+
uriTokens.push(components.fragment);
|
|
1425
|
+
}
|
|
1426
|
+
return uriTokens.join(""); //merge tokens into a string
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
function resolveComponents(base, relative) {
|
|
1430
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1431
|
+
var skipNormalization = arguments[3];
|
|
1432
|
+
|
|
1433
|
+
var target = {};
|
|
1434
|
+
if (!skipNormalization) {
|
|
1435
|
+
base = parse(serialize(base, options), options); //normalize base components
|
|
1436
|
+
relative = parse(serialize(relative, options), options); //normalize relative components
|
|
1437
|
+
}
|
|
1438
|
+
options = options || {};
|
|
1439
|
+
if (!options.tolerant && relative.scheme) {
|
|
1440
|
+
target.scheme = relative.scheme;
|
|
1441
|
+
//target.authority = relative.authority;
|
|
1442
|
+
target.userinfo = relative.userinfo;
|
|
1443
|
+
target.host = relative.host;
|
|
1444
|
+
target.port = relative.port;
|
|
1445
|
+
target.path = removeDotSegments(relative.path || "");
|
|
1446
|
+
target.query = relative.query;
|
|
1447
|
+
} else {
|
|
1448
|
+
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
1449
|
+
//target.authority = relative.authority;
|
|
1450
|
+
target.userinfo = relative.userinfo;
|
|
1451
|
+
target.host = relative.host;
|
|
1452
|
+
target.port = relative.port;
|
|
1453
|
+
target.path = removeDotSegments(relative.path || "");
|
|
1454
|
+
target.query = relative.query;
|
|
1455
|
+
} else {
|
|
1456
|
+
if (!relative.path) {
|
|
1457
|
+
target.path = base.path;
|
|
1458
|
+
if (relative.query !== undefined) {
|
|
1459
|
+
target.query = relative.query;
|
|
1460
|
+
} else {
|
|
1461
|
+
target.query = base.query;
|
|
1462
|
+
}
|
|
1463
|
+
} else {
|
|
1464
|
+
if (relative.path.charAt(0) === "/") {
|
|
1465
|
+
target.path = removeDotSegments(relative.path);
|
|
1466
|
+
} else {
|
|
1467
|
+
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
1468
|
+
target.path = "/" + relative.path;
|
|
1469
|
+
} else if (!base.path) {
|
|
1470
|
+
target.path = relative.path;
|
|
1471
|
+
} else {
|
|
1472
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
1473
|
+
}
|
|
1474
|
+
target.path = removeDotSegments(target.path);
|
|
1475
|
+
}
|
|
1476
|
+
target.query = relative.query;
|
|
1477
|
+
}
|
|
1478
|
+
//target.authority = base.authority;
|
|
1479
|
+
target.userinfo = base.userinfo;
|
|
1480
|
+
target.host = base.host;
|
|
1481
|
+
target.port = base.port;
|
|
1482
|
+
}
|
|
1483
|
+
target.scheme = base.scheme;
|
|
1484
|
+
}
|
|
1485
|
+
target.fragment = relative.fragment;
|
|
1486
|
+
return target;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
function resolve(baseURI, relativeURI, options) {
|
|
1490
|
+
var schemelessOptions = assign({ scheme: 'null' }, options);
|
|
1491
|
+
return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
function normalize(uri, options) {
|
|
1495
|
+
if (typeof uri === "string") {
|
|
1496
|
+
uri = serialize(parse(uri, options), options);
|
|
1497
|
+
} else if (typeOf(uri) === "object") {
|
|
1498
|
+
uri = parse(serialize(uri, options), options);
|
|
1499
|
+
}
|
|
1500
|
+
return uri;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
function equal(uriA, uriB, options) {
|
|
1504
|
+
if (typeof uriA === "string") {
|
|
1505
|
+
uriA = serialize(parse(uriA, options), options);
|
|
1506
|
+
} else if (typeOf(uriA) === "object") {
|
|
1507
|
+
uriA = serialize(uriA, options);
|
|
1508
|
+
}
|
|
1509
|
+
if (typeof uriB === "string") {
|
|
1510
|
+
uriB = serialize(parse(uriB, options), options);
|
|
1511
|
+
} else if (typeOf(uriB) === "object") {
|
|
1512
|
+
uriB = serialize(uriB, options);
|
|
1513
|
+
}
|
|
1514
|
+
return uriA === uriB;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
function escapeComponent(str, options) {
|
|
1518
|
+
return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
function unescapeComponent(str, options) {
|
|
1522
|
+
return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
var handler = {
|
|
1526
|
+
scheme: "http",
|
|
1527
|
+
domainHost: true,
|
|
1528
|
+
parse: function parse(components, options) {
|
|
1529
|
+
//report missing host
|
|
1530
|
+
if (!components.host) {
|
|
1531
|
+
components.error = components.error || "HTTP URIs must have a host.";
|
|
1532
|
+
}
|
|
1533
|
+
return components;
|
|
1534
|
+
},
|
|
1535
|
+
serialize: function serialize(components, options) {
|
|
1536
|
+
var secure = String(components.scheme).toLowerCase() === "https";
|
|
1537
|
+
//normalize the default port
|
|
1538
|
+
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
|
1539
|
+
components.port = undefined;
|
|
1540
|
+
}
|
|
1541
|
+
//normalize the empty path
|
|
1542
|
+
if (!components.path) {
|
|
1543
|
+
components.path = "/";
|
|
1544
|
+
}
|
|
1545
|
+
//NOTE: We do not parse query strings for HTTP URIs
|
|
1546
|
+
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
1547
|
+
//and not the HTTP spec.
|
|
1548
|
+
return components;
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
var handler$1 = {
|
|
1553
|
+
scheme: "https",
|
|
1554
|
+
domainHost: handler.domainHost,
|
|
1555
|
+
parse: handler.parse,
|
|
1556
|
+
serialize: handler.serialize
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
function isSecure(wsComponents) {
|
|
1560
|
+
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
|
1561
|
+
}
|
|
1562
|
+
//RFC 6455
|
|
1563
|
+
var handler$2 = {
|
|
1564
|
+
scheme: "ws",
|
|
1565
|
+
domainHost: true,
|
|
1566
|
+
parse: function parse(components, options) {
|
|
1567
|
+
var wsComponents = components;
|
|
1568
|
+
//indicate if the secure flag is set
|
|
1569
|
+
wsComponents.secure = isSecure(wsComponents);
|
|
1570
|
+
//construct resouce name
|
|
1571
|
+
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
|
1572
|
+
wsComponents.path = undefined;
|
|
1573
|
+
wsComponents.query = undefined;
|
|
1574
|
+
return wsComponents;
|
|
1575
|
+
},
|
|
1576
|
+
serialize: function serialize(wsComponents, options) {
|
|
1577
|
+
//normalize the default port
|
|
1578
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
1579
|
+
wsComponents.port = undefined;
|
|
1580
|
+
}
|
|
1581
|
+
//ensure scheme matches secure flag
|
|
1582
|
+
if (typeof wsComponents.secure === 'boolean') {
|
|
1583
|
+
wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
|
|
1584
|
+
wsComponents.secure = undefined;
|
|
1585
|
+
}
|
|
1586
|
+
//reconstruct path from resource name
|
|
1587
|
+
if (wsComponents.resourceName) {
|
|
1588
|
+
var _wsComponents$resourc = wsComponents.resourceName.split('?'),
|
|
1589
|
+
_wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
|
|
1590
|
+
path = _wsComponents$resourc2[0],
|
|
1591
|
+
query = _wsComponents$resourc2[1];
|
|
1592
|
+
|
|
1593
|
+
wsComponents.path = path && path !== '/' ? path : undefined;
|
|
1594
|
+
wsComponents.query = query;
|
|
1595
|
+
wsComponents.resourceName = undefined;
|
|
1596
|
+
}
|
|
1597
|
+
//forbid fragment component
|
|
1598
|
+
wsComponents.fragment = undefined;
|
|
1599
|
+
return wsComponents;
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
var handler$3 = {
|
|
1604
|
+
scheme: "wss",
|
|
1605
|
+
domainHost: handler$2.domainHost,
|
|
1606
|
+
parse: handler$2.parse,
|
|
1607
|
+
serialize: handler$2.serialize
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
var O = {};
|
|
1611
|
+
//RFC 3986
|
|
1612
|
+
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
|
|
1613
|
+
var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
|
|
1614
|
+
var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
|
|
1615
|
+
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
|
|
1616
|
+
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
|
|
1617
|
+
//const WSP$$ = "[\\x20\\x09]";
|
|
1618
|
+
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
|
|
1619
|
+
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
|
|
1620
|
+
//const VCHAR$$ = "[\\x21-\\x7E]";
|
|
1621
|
+
//const WSP$$ = "[\\x20\\x09]";
|
|
1622
|
+
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
|
|
1623
|
+
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
|
|
1624
|
+
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
|
|
1625
|
+
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
|
|
1626
|
+
var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
|
|
1627
|
+
var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
|
|
1628
|
+
var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
|
|
1629
|
+
var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
|
|
1630
|
+
var UNRESERVED = new RegExp(UNRESERVED$$, "g");
|
|
1631
|
+
var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
|
|
1632
|
+
var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
|
|
1633
|
+
var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
|
|
1634
|
+
var NOT_HFVALUE = NOT_HFNAME;
|
|
1635
|
+
function decodeUnreserved(str) {
|
|
1636
|
+
var decStr = pctDecChars(str);
|
|
1637
|
+
return !decStr.match(UNRESERVED) ? str : decStr;
|
|
1638
|
+
}
|
|
1639
|
+
var handler$4 = {
|
|
1640
|
+
scheme: "mailto",
|
|
1641
|
+
parse: function parse$$1(components, options) {
|
|
1642
|
+
var mailtoComponents = components;
|
|
1643
|
+
var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
|
|
1644
|
+
mailtoComponents.path = undefined;
|
|
1645
|
+
if (mailtoComponents.query) {
|
|
1646
|
+
var unknownHeaders = false;
|
|
1647
|
+
var headers = {};
|
|
1648
|
+
var hfields = mailtoComponents.query.split("&");
|
|
1649
|
+
for (var x = 0, xl = hfields.length; x < xl; ++x) {
|
|
1650
|
+
var hfield = hfields[x].split("=");
|
|
1651
|
+
switch (hfield[0]) {
|
|
1652
|
+
case "to":
|
|
1653
|
+
var toAddrs = hfield[1].split(",");
|
|
1654
|
+
for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
|
|
1655
|
+
to.push(toAddrs[_x]);
|
|
1656
|
+
}
|
|
1657
|
+
break;
|
|
1658
|
+
case "subject":
|
|
1659
|
+
mailtoComponents.subject = unescapeComponent(hfield[1], options);
|
|
1660
|
+
break;
|
|
1661
|
+
case "body":
|
|
1662
|
+
mailtoComponents.body = unescapeComponent(hfield[1], options);
|
|
1663
|
+
break;
|
|
1664
|
+
default:
|
|
1665
|
+
unknownHeaders = true;
|
|
1666
|
+
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
if (unknownHeaders) mailtoComponents.headers = headers;
|
|
1671
|
+
}
|
|
1672
|
+
mailtoComponents.query = undefined;
|
|
1673
|
+
for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
|
|
1674
|
+
var addr = to[_x2].split("@");
|
|
1675
|
+
addr[0] = unescapeComponent(addr[0]);
|
|
1676
|
+
if (!options.unicodeSupport) {
|
|
1677
|
+
//convert Unicode IDN -> ASCII IDN
|
|
1678
|
+
try {
|
|
1679
|
+
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
|
|
1680
|
+
} catch (e) {
|
|
1681
|
+
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
|
|
1682
|
+
}
|
|
1683
|
+
} else {
|
|
1684
|
+
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
|
|
1685
|
+
}
|
|
1686
|
+
to[_x2] = addr.join("@");
|
|
1687
|
+
}
|
|
1688
|
+
return mailtoComponents;
|
|
1689
|
+
},
|
|
1690
|
+
serialize: function serialize$$1(mailtoComponents, options) {
|
|
1691
|
+
var components = mailtoComponents;
|
|
1692
|
+
var to = toArray(mailtoComponents.to);
|
|
1693
|
+
if (to) {
|
|
1694
|
+
for (var x = 0, xl = to.length; x < xl; ++x) {
|
|
1695
|
+
var toAddr = String(to[x]);
|
|
1696
|
+
var atIdx = toAddr.lastIndexOf("@");
|
|
1697
|
+
var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
|
|
1698
|
+
var domain = toAddr.slice(atIdx + 1);
|
|
1699
|
+
//convert IDN via punycode
|
|
1700
|
+
try {
|
|
1701
|
+
domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
|
|
1702
|
+
} catch (e) {
|
|
1703
|
+
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
1704
|
+
}
|
|
1705
|
+
to[x] = localPart + "@" + domain;
|
|
1706
|
+
}
|
|
1707
|
+
components.path = to.join(",");
|
|
1708
|
+
}
|
|
1709
|
+
var headers = mailtoComponents.headers = mailtoComponents.headers || {};
|
|
1710
|
+
if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
|
|
1711
|
+
if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
|
|
1712
|
+
var fields = [];
|
|
1713
|
+
for (var name in headers) {
|
|
1714
|
+
if (headers[name] !== O[name]) {
|
|
1715
|
+
fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
if (fields.length) {
|
|
1719
|
+
components.query = fields.join("&");
|
|
1720
|
+
}
|
|
1721
|
+
return components;
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1725
|
+
var URN_PARSE = /^([^\:]+)\:(.*)/;
|
|
1726
|
+
//RFC 2141
|
|
1727
|
+
var handler$5 = {
|
|
1728
|
+
scheme: "urn",
|
|
1729
|
+
parse: function parse$$1(components, options) {
|
|
1730
|
+
var matches = components.path && components.path.match(URN_PARSE);
|
|
1731
|
+
var urnComponents = components;
|
|
1732
|
+
if (matches) {
|
|
1733
|
+
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
1734
|
+
var nid = matches[1].toLowerCase();
|
|
1735
|
+
var nss = matches[2];
|
|
1736
|
+
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
1737
|
+
var schemeHandler = SCHEMES[urnScheme];
|
|
1738
|
+
urnComponents.nid = nid;
|
|
1739
|
+
urnComponents.nss = nss;
|
|
1740
|
+
urnComponents.path = undefined;
|
|
1741
|
+
if (schemeHandler) {
|
|
1742
|
+
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
1743
|
+
}
|
|
1744
|
+
} else {
|
|
1745
|
+
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
|
1746
|
+
}
|
|
1747
|
+
return urnComponents;
|
|
1748
|
+
},
|
|
1749
|
+
serialize: function serialize$$1(urnComponents, options) {
|
|
1750
|
+
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
1751
|
+
var nid = urnComponents.nid;
|
|
1752
|
+
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
1753
|
+
var schemeHandler = SCHEMES[urnScheme];
|
|
1754
|
+
if (schemeHandler) {
|
|
1755
|
+
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
1756
|
+
}
|
|
1757
|
+
var uriComponents = urnComponents;
|
|
1758
|
+
var nss = urnComponents.nss;
|
|
1759
|
+
uriComponents.path = (nid || options.nid) + ":" + nss;
|
|
1760
|
+
return uriComponents;
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
|
1765
|
+
//RFC 4122
|
|
1766
|
+
var handler$6 = {
|
|
1767
|
+
scheme: "urn:uuid",
|
|
1768
|
+
parse: function parse(urnComponents, options) {
|
|
1769
|
+
var uuidComponents = urnComponents;
|
|
1770
|
+
uuidComponents.uuid = uuidComponents.nss;
|
|
1771
|
+
uuidComponents.nss = undefined;
|
|
1772
|
+
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
|
1773
|
+
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
|
1774
|
+
}
|
|
1775
|
+
return uuidComponents;
|
|
1776
|
+
},
|
|
1777
|
+
serialize: function serialize(uuidComponents, options) {
|
|
1778
|
+
var urnComponents = uuidComponents;
|
|
1779
|
+
//normalize UUID
|
|
1780
|
+
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
1781
|
+
return urnComponents;
|
|
1782
|
+
}
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1785
|
+
SCHEMES[handler.scheme] = handler;
|
|
1786
|
+
SCHEMES[handler$1.scheme] = handler$1;
|
|
1787
|
+
SCHEMES[handler$2.scheme] = handler$2;
|
|
1788
|
+
SCHEMES[handler$3.scheme] = handler$3;
|
|
1789
|
+
SCHEMES[handler$4.scheme] = handler$4;
|
|
1790
|
+
SCHEMES[handler$5.scheme] = handler$5;
|
|
1791
|
+
SCHEMES[handler$6.scheme] = handler$6;
|
|
1792
|
+
|
|
1793
|
+
exports.SCHEMES = SCHEMES;
|
|
1794
|
+
exports.pctEncChar = pctEncChar;
|
|
1795
|
+
exports.pctDecChars = pctDecChars;
|
|
1796
|
+
exports.parse = parse;
|
|
1797
|
+
exports.removeDotSegments = removeDotSegments;
|
|
1798
|
+
exports.serialize = serialize;
|
|
1799
|
+
exports.resolveComponents = resolveComponents;
|
|
1800
|
+
exports.resolve = resolve;
|
|
1801
|
+
exports.normalize = normalize;
|
|
1802
|
+
exports.equal = equal;
|
|
1803
|
+
exports.escapeComponent = escapeComponent;
|
|
1804
|
+
exports.unescapeComponent = unescapeComponent;
|
|
1805
|
+
|
|
1806
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1807
|
+
|
|
1808
|
+
})));
|
|
1809
|
+
|
|
1810
|
+
} (uri_all, uri_all.exports));
|
|
1811
|
+
|
|
1812
|
+
const URI = uri_all.exports;
|
|
79
1813
|
|
|
80
|
-
}(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){
|
|
81
1814
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Returns a function that throws the passed exception, for use as argument for setTimeout
|
|
99
|
-
* @alias throwException
|
|
100
|
-
* @function
|
|
101
|
-
* @param { Object } ex An Error object
|
|
102
|
-
*/
|
|
103
|
-
function throwException( ex ){
|
|
104
|
-
return function reThrowException(){
|
|
105
|
-
throw ex;
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function callSubscriberWithDelayedExceptions( subscriber, message, data ){
|
|
110
|
-
try {
|
|
111
|
-
subscriber( message, data );
|
|
112
|
-
} catch( ex ){
|
|
113
|
-
setTimeout( throwException( ex ), 0);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function callSubscriberWithImmediateExceptions( subscriber, message, data ){
|
|
118
|
-
subscriber( message, data );
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function deliverMessage( originalMessage, matchedMessage, data, immediateExceptions ){
|
|
122
|
-
var subscribers = messages[matchedMessage],
|
|
123
|
-
callSubscriber = immediateExceptions ? callSubscriberWithImmediateExceptions : callSubscriberWithDelayedExceptions,
|
|
124
|
-
s;
|
|
125
|
-
|
|
126
|
-
if ( !Object.prototype.hasOwnProperty.call( messages, matchedMessage ) ) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
1815
|
+
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
1816
|
+
const isType = {
|
|
1817
|
+
null: (value) => value === null,
|
|
1818
|
+
boolean: (value) => typeof value === "boolean",
|
|
1819
|
+
object: isObject$1,
|
|
1820
|
+
array: (value) => Array.isArray(value),
|
|
1821
|
+
number: (value) => typeof value === "number",
|
|
1822
|
+
integer: (value) => Number.isInteger(value),
|
|
1823
|
+
string: (value) => typeof value === "string"
|
|
1824
|
+
};
|
|
1825
|
+
const jsonTypeOf$2 = (value, type) => isType[type](value);
|
|
129
1826
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1827
|
+
const resolveUrl$3 = (contextUrl, url) => {
|
|
1828
|
+
const resolvedUrl = URI.resolve(contextUrl, url, { iri: true });
|
|
1829
|
+
const contextId = URI.resolve(contextUrl, "", { iri: true });
|
|
1830
|
+
if (contextId && URI.parse(resolvedUrl).scheme === "file" && URI.parse(contextUrl).scheme !== "file") {
|
|
1831
|
+
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`);
|
|
1832
|
+
}
|
|
1833
|
+
return resolvedUrl;
|
|
1834
|
+
};
|
|
136
1835
|
|
|
137
|
-
|
|
138
|
-
return function deliverNamespaced(){
|
|
139
|
-
var topic = String( message ),
|
|
140
|
-
position = topic.lastIndexOf( '.' );
|
|
1836
|
+
const urlFragment$1 = (uri) => URI.unescapeComponent(URI.parse(uri).fragment) || "";
|
|
141
1837
|
|
|
142
|
-
|
|
143
|
-
deliverMessage(message, message, data, immediateExceptions);
|
|
1838
|
+
const CHAR_BACKWARD_SLASH = 47;
|
|
144
1839
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
deliverMessage( message, topic, data, immediateExceptions );
|
|
150
|
-
}
|
|
1840
|
+
const pathRelative$1 = (from, to) => {
|
|
1841
|
+
if (from === to) {
|
|
1842
|
+
return "";
|
|
1843
|
+
}
|
|
151
1844
|
|
|
152
|
-
|
|
153
|
-
|
|
1845
|
+
let toStart = 1;
|
|
1846
|
+
const fromLen = from.length - 1;
|
|
1847
|
+
const toLen = to.length - toStart;
|
|
1848
|
+
|
|
1849
|
+
// Compare paths to find the longest common path from root
|
|
1850
|
+
const length = fromLen < toLen ? fromLen : toLen;
|
|
1851
|
+
let lastCommonSep = -1;
|
|
1852
|
+
let i = 0;
|
|
1853
|
+
for (; i < length; i++) {
|
|
1854
|
+
const fromCode = from.charCodeAt(i + 1);
|
|
1855
|
+
if (fromCode !== to.charCodeAt(toStart + i)) {
|
|
1856
|
+
break;
|
|
1857
|
+
} else if (fromCode === CHAR_BACKWARD_SLASH) {
|
|
1858
|
+
lastCommonSep = i;
|
|
154
1859
|
}
|
|
1860
|
+
}
|
|
155
1861
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return found;
|
|
1862
|
+
if (toLen > length) {
|
|
1863
|
+
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
|
|
1864
|
+
return to.slice(toStart + i + 1);
|
|
161
1865
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
var topic = String( message ),
|
|
165
|
-
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
|
|
166
|
-
position = topic.lastIndexOf( '.' );
|
|
167
|
-
|
|
168
|
-
while ( !found && position !== -1 ){
|
|
169
|
-
topic = topic.substr( 0, position );
|
|
170
|
-
position = topic.lastIndexOf( '.' );
|
|
171
|
-
found = hasDirectSubscribersFor(topic);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return found;
|
|
1866
|
+
if (i === 0) {
|
|
1867
|
+
return to.slice(toStart + i);
|
|
175
1868
|
}
|
|
176
|
-
|
|
177
|
-
function publish( message, data, sync, immediateExceptions ){
|
|
178
|
-
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
179
|
-
|
|
180
|
-
var deliver = createDeliveryFunction( message, data, immediateExceptions ),
|
|
181
|
-
hasSubscribers = messageHasSubscribers( message );
|
|
182
|
-
|
|
183
|
-
if ( !hasSubscribers ){
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if ( sync === true ){
|
|
188
|
-
deliver();
|
|
189
|
-
} else {
|
|
190
|
-
setTimeout( deliver, 0 );
|
|
191
|
-
}
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Publishes the message, passing the data to it's subscribers
|
|
197
|
-
* @function
|
|
198
|
-
* @alias publish
|
|
199
|
-
* @param { String } message The message to publish
|
|
200
|
-
* @param {} data The data to pass to subscribers
|
|
201
|
-
* @return { Boolean }
|
|
202
|
-
*/
|
|
203
|
-
PubSub.publish = function( message, data ){
|
|
204
|
-
return publish( message, data, false, PubSub.immediateExceptions );
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Publishes the message synchronously, passing the data to it's subscribers
|
|
209
|
-
* @function
|
|
210
|
-
* @alias publishSync
|
|
211
|
-
* @param { String } message The message to publish
|
|
212
|
-
* @param {} data The data to pass to subscribers
|
|
213
|
-
* @return { Boolean }
|
|
214
|
-
*/
|
|
215
|
-
PubSub.publishSync = function( message, data ){
|
|
216
|
-
return publish( message, data, true, PubSub.immediateExceptions );
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Subscribes the passed function to the passed message. Every returned token is unique and should be stored if you need to unsubscribe
|
|
221
|
-
* @function
|
|
222
|
-
* @alias subscribe
|
|
223
|
-
* @param { String } message The message to subscribe to
|
|
224
|
-
* @param { Function } func The function to call when a new message is published
|
|
225
|
-
* @return { String }
|
|
226
|
-
*/
|
|
227
|
-
PubSub.subscribe = function( message, func ){
|
|
228
|
-
if ( typeof func !== 'function'){
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
233
|
-
|
|
234
|
-
// message is not registered yet
|
|
235
|
-
if ( !Object.prototype.hasOwnProperty.call( messages, message ) ){
|
|
236
|
-
messages[message] = {};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// forcing token as String, to allow for future expansions without breaking usage
|
|
240
|
-
// and allow for easy use as key names for the 'messages' object
|
|
241
|
-
var token = 'uid_' + String(++lastUid);
|
|
242
|
-
messages[message][token] = func;
|
|
243
|
-
|
|
244
|
-
// return token for unsubscribing
|
|
245
|
-
return token;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
PubSub.subscribeAll = function( func ){
|
|
249
|
-
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Subscribes the passed function to the passed message once
|
|
254
|
-
* @function
|
|
255
|
-
* @alias subscribeOnce
|
|
256
|
-
* @param { String } message The message to subscribe to
|
|
257
|
-
* @param { Function } func The function to call when a new message is published
|
|
258
|
-
* @return { PubSub }
|
|
259
|
-
*/
|
|
260
|
-
PubSub.subscribeOnce = function( message, func ){
|
|
261
|
-
var token = PubSub.subscribe( message, function(){
|
|
262
|
-
// before func apply, unsubscribe message
|
|
263
|
-
PubSub.unsubscribe( token );
|
|
264
|
-
func.apply( this, arguments );
|
|
265
|
-
});
|
|
266
|
-
return PubSub;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Clears all subscriptions
|
|
271
|
-
* @function
|
|
272
|
-
* @public
|
|
273
|
-
* @alias clearAllSubscriptions
|
|
274
|
-
*/
|
|
275
|
-
PubSub.clearAllSubscriptions = function clearAllSubscriptions(){
|
|
276
|
-
messages = {};
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Clear subscriptions by the topic
|
|
281
|
-
* @function
|
|
282
|
-
* @public
|
|
283
|
-
* @alias clearAllSubscriptions
|
|
284
|
-
* @return { int }
|
|
285
|
-
*/
|
|
286
|
-
PubSub.clearSubscriptions = function clearSubscriptions(topic){
|
|
287
|
-
var m;
|
|
288
|
-
for (m in messages){
|
|
289
|
-
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
290
|
-
delete messages[m];
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
Count subscriptions by the topic
|
|
297
|
-
* @function
|
|
298
|
-
* @public
|
|
299
|
-
* @alias countSubscriptions
|
|
300
|
-
* @return { Array }
|
|
301
|
-
*/
|
|
302
|
-
PubSub.countSubscriptions = function countSubscriptions(topic){
|
|
303
|
-
var m;
|
|
304
|
-
// eslint-disable-next-line no-unused-vars
|
|
305
|
-
var token;
|
|
306
|
-
var count = 0;
|
|
307
|
-
for (m in messages) {
|
|
308
|
-
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0) {
|
|
309
|
-
for (token in messages[m]) {
|
|
310
|
-
count++;
|
|
311
|
-
}
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return count;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
Gets subscriptions by the topic
|
|
321
|
-
* @function
|
|
322
|
-
* @public
|
|
323
|
-
* @alias getSubscriptions
|
|
324
|
-
*/
|
|
325
|
-
PubSub.getSubscriptions = function getSubscriptions(topic){
|
|
326
|
-
var m;
|
|
327
|
-
var list = [];
|
|
328
|
-
for (m in messages){
|
|
329
|
-
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
330
|
-
list.push(m);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return list;
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Removes subscriptions
|
|
338
|
-
*
|
|
339
|
-
* - When passed a token, removes a specific subscription.
|
|
340
|
-
*
|
|
341
|
-
* - When passed a function, removes all subscriptions for that function
|
|
342
|
-
*
|
|
343
|
-
* - When passed a topic, removes all subscriptions for that topic (hierarchy)
|
|
344
|
-
* @function
|
|
345
|
-
* @public
|
|
346
|
-
* @alias subscribeOnce
|
|
347
|
-
* @param { String | Function } value A token, function or topic to unsubscribe from
|
|
348
|
-
* @example // Unsubscribing with a token
|
|
349
|
-
* var token = PubSub.subscribe('mytopic', myFunc);
|
|
350
|
-
* PubSub.unsubscribe(token);
|
|
351
|
-
* @example // Unsubscribing with a function
|
|
352
|
-
* PubSub.unsubscribe(myFunc);
|
|
353
|
-
* @example // Unsubscribing from a topic
|
|
354
|
-
* PubSub.unsubscribe('mytopic');
|
|
355
|
-
*/
|
|
356
|
-
PubSub.unsubscribe = function(value){
|
|
357
|
-
var descendantTopicExists = function(topic) {
|
|
358
|
-
var m;
|
|
359
|
-
for ( m in messages ){
|
|
360
|
-
if ( Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0 ){
|
|
361
|
-
// a descendant of the topic exists:
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return false;
|
|
367
|
-
},
|
|
368
|
-
isTopic = typeof value === 'string' && ( Object.prototype.hasOwnProperty.call(messages, value) || descendantTopicExists(value) ),
|
|
369
|
-
isToken = !isTopic && typeof value === 'string',
|
|
370
|
-
isFunction = typeof value === 'function',
|
|
371
|
-
result = false,
|
|
372
|
-
m, message, t;
|
|
373
|
-
|
|
374
|
-
if (isTopic){
|
|
375
|
-
PubSub.clearSubscriptions(value);
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
for ( m in messages ){
|
|
380
|
-
if ( Object.prototype.hasOwnProperty.call( messages, m ) ){
|
|
381
|
-
message = messages[m];
|
|
382
|
-
|
|
383
|
-
if ( isToken && message[value] ){
|
|
384
|
-
delete message[value];
|
|
385
|
-
result = value;
|
|
386
|
-
// tokens are unique, so we can just stop here
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (isFunction) {
|
|
391
|
-
for ( t in message ){
|
|
392
|
-
if (Object.prototype.hasOwnProperty.call(message, t) && message[t] === value){
|
|
393
|
-
delete message[t];
|
|
394
|
-
result = true;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return result;
|
|
402
|
-
};
|
|
403
|
-
}));
|
|
404
|
-
});
|
|
405
|
-
pubsub.PubSub;
|
|
406
|
-
|
|
407
|
-
var urlResolveBrowser = urlResolve;
|
|
408
|
-
|
|
409
|
-
/*
|
|
410
|
-
The majority of the module is built by following RFC1808
|
|
411
|
-
url: https://tools.ietf.org/html/rfc1808
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
// adds a slash at end if not present
|
|
415
|
-
function _addSlash (url) {
|
|
416
|
-
return url + (url[url.length-1] === '/' ? '' : '/');
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// resolve the ..'s (directory up) and such
|
|
420
|
-
function _pathResolve (path) {
|
|
421
|
-
let pathSplit = path.split('/');
|
|
422
|
-
|
|
423
|
-
// happens when path starts with /
|
|
424
|
-
if (pathSplit[0] === '') {
|
|
425
|
-
pathSplit = pathSplit.slice(1);
|
|
426
1869
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (current !== '.') {
|
|
433
|
-
if (current === '..') {
|
|
434
|
-
resultArray.pop(); // remove previous
|
|
435
|
-
} else if (current !== '' || index === pathSplit.length - 1) {
|
|
436
|
-
resultArray.push(current);
|
|
437
|
-
}
|
|
1870
|
+
if (fromLen > length) {
|
|
1871
|
+
if (from.charCodeAt(i + 1) === CHAR_BACKWARD_SLASH) {
|
|
1872
|
+
lastCommonSep = i;
|
|
1873
|
+
} else if (length === 0) {
|
|
1874
|
+
lastCommonSep = 0;
|
|
438
1875
|
}
|
|
439
|
-
});
|
|
440
|
-
return '/' + resultArray.join('/');
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// parses a base url string into an object containing host, path and query
|
|
444
|
-
function _baseParse (base) {
|
|
445
|
-
const resultObject = {
|
|
446
|
-
host: '',
|
|
447
|
-
path: '',
|
|
448
|
-
query: '',
|
|
449
|
-
protocol: ''
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
let path = base;
|
|
453
|
-
let protocolEndIndex = base.indexOf('//');
|
|
454
|
-
|
|
455
|
-
resultObject.protocol = path.substring(0, protocolEndIndex);
|
|
456
|
-
|
|
457
|
-
protocolEndIndex += 2; // add two to pass double slash
|
|
458
|
-
|
|
459
|
-
const pathIndex = base.indexOf('/', protocolEndIndex);
|
|
460
|
-
const queryIndex = base.indexOf('?');
|
|
461
|
-
const hashIndex = base.indexOf('#');
|
|
462
|
-
|
|
463
|
-
if (hashIndex !== -1) {
|
|
464
|
-
path = path.substring(0, hashIndex); // remove hash, not needed for base
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
if (queryIndex !== -1) {
|
|
468
|
-
const query = path.substring(queryIndex); // remove query, save in return obj
|
|
469
|
-
resultObject.query = query;
|
|
470
|
-
path = path.substring(0, queryIndex);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (pathIndex !== -1) {
|
|
474
|
-
const host = path.substring(0, pathIndex); // separate host & path
|
|
475
|
-
resultObject.host = host;
|
|
476
|
-
path = path.substring(pathIndex);
|
|
477
|
-
resultObject.path = path;
|
|
478
|
-
} else {
|
|
479
|
-
resultObject.host = path; // there was no path, therefore path is host
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
return resultObject;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// https://tools.ietf.org/html/rfc3986#section-3.1
|
|
486
|
-
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )]
|
|
487
|
-
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i');
|
|
488
|
-
|
|
489
|
-
// parses a relative url string into an object containing the href,
|
|
490
|
-
// hash, query and whether it is a net path, absolute path or relative path
|
|
491
|
-
function _relativeParse (relative) {
|
|
492
|
-
const resultObject = {
|
|
493
|
-
href: relative, // href is always what was passed through
|
|
494
|
-
hash: '',
|
|
495
|
-
query: '',
|
|
496
|
-
netPath: false,
|
|
497
|
-
absolutePath: false,
|
|
498
|
-
relativePath: false
|
|
499
|
-
};
|
|
500
|
-
// check for protocol
|
|
501
|
-
// if protocol exists, is net path (absolute URL)
|
|
502
|
-
if (_isAbsolute.test(relative)) {
|
|
503
|
-
resultObject.netPath = true;
|
|
504
|
-
// return, in this case the relative is the resolved url, no need to parse.
|
|
505
|
-
return resultObject;
|
|
506
1876
|
}
|
|
507
1877
|
|
|
508
|
-
|
|
509
|
-
//
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
resultObject.relativePath = true;
|
|
1878
|
+
let out = "";
|
|
1879
|
+
// Generate the relative path based on the path difference between `to` and `from`
|
|
1880
|
+
for (i = lastCommonSep + 2; i <= from.length; ++i) {
|
|
1881
|
+
if (i === from.length || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
|
|
1882
|
+
out += out.length === 0 ? ".." : "/..";
|
|
1883
|
+
}
|
|
515
1884
|
}
|
|
516
1885
|
|
|
517
|
-
|
|
518
|
-
const queryIndex = relative.indexOf('?');
|
|
519
|
-
const hashIndex = relative.indexOf('#');
|
|
1886
|
+
toStart += lastCommonSep;
|
|
520
1887
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
1888
|
+
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
1889
|
+
// the common path parts
|
|
1890
|
+
if (out.length > 0) {
|
|
1891
|
+
return `${out}${to.slice(toStart, to.length)}`;
|
|
525
1892
|
}
|
|
526
1893
|
|
|
527
|
-
if (
|
|
528
|
-
|
|
529
|
-
resultObject.query = query;
|
|
530
|
-
path = path.substring(0, queryIndex);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
resultObject.path = path; // whatever is left is path
|
|
534
|
-
return resultObject;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
function _shouldAddSlash (url) {
|
|
538
|
-
const protocolIndex = url.indexOf('//') + 2;
|
|
539
|
-
const noPath = !(url.includes('/', protocolIndex));
|
|
540
|
-
const noQuery = !(url.includes('?', protocolIndex));
|
|
541
|
-
const noHash = !(url.includes('#', protocolIndex));
|
|
542
|
-
return (noPath && noQuery && noHash);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
function _shouldAddProtocol (url) {
|
|
546
|
-
return url.startsWith('//');
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/*
|
|
550
|
-
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/
|
|
551
|
-
* optional: path, query or hash
|
|
552
|
-
* returns the resolved url
|
|
553
|
-
*/
|
|
554
|
-
function urlResolve (base, relative) {
|
|
555
|
-
base = base.trim();
|
|
556
|
-
relative = relative.trim();
|
|
557
|
-
|
|
558
|
-
// about is always absolute
|
|
559
|
-
if (relative.startsWith('about:')) {
|
|
560
|
-
return relative;
|
|
1894
|
+
if (to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
|
|
1895
|
+
++toStart;
|
|
561
1896
|
}
|
|
562
1897
|
|
|
563
|
-
|
|
564
|
-
const relativeObj = _relativeParse(relative);
|
|
565
|
-
|
|
566
|
-
if (!baseObj.protocol && !relativeObj.netPath) {
|
|
567
|
-
throw new Error('Error, protocol is not specified');
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
if (relativeObj.netPath) { // relative is full qualified URL
|
|
571
|
-
if (_shouldAddProtocol(relativeObj.href)) {
|
|
572
|
-
relativeObj.href = baseObj.protocol + relativeObj.href;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (_shouldAddSlash(relativeObj.href)) {
|
|
576
|
-
return _addSlash(relativeObj.href);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
return relativeObj.href;
|
|
580
|
-
} else if (relativeObj.absolutePath) { // relative is an absolute path
|
|
581
|
-
const {path, query, hash} = relativeObj;
|
|
582
|
-
|
|
583
|
-
return baseObj.host + _pathResolve(path) + query + hash;
|
|
584
|
-
} else if (relativeObj.relativePath) { // relative is a relative path
|
|
585
|
-
const {path, query, hash} = relativeObj;
|
|
586
|
-
|
|
587
|
-
let basePath = baseObj.path;
|
|
588
|
-
let resultString = baseObj.host;
|
|
589
|
-
|
|
590
|
-
let resolvePath;
|
|
591
|
-
|
|
592
|
-
if (path.length === 0) {
|
|
593
|
-
resolvePath = basePath;
|
|
594
|
-
} else {
|
|
595
|
-
// remove last segment if no slash at end
|
|
596
|
-
basePath = basePath.substring(0, basePath.lastIndexOf('/'));
|
|
597
|
-
resolvePath = _pathResolve(basePath + '/' + path);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// if result is just the base host, add /
|
|
601
|
-
if ((resolvePath === '') && (!query) && (!hash)) {
|
|
602
|
-
resultString += '/';
|
|
603
|
-
} else {
|
|
604
|
-
resultString += resolvePath + query + hash;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
return resultString;
|
|
608
|
-
} else {
|
|
609
|
-
const {host, path, query} = baseObj;
|
|
610
|
-
// when path and query aren't supplied add slash
|
|
611
|
-
if ((!path) && (!query)) {
|
|
612
|
-
return _addSlash(host);
|
|
613
|
-
}
|
|
614
|
-
return host + path + query + relativeObj.hash;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
619
|
-
const isType = {
|
|
620
|
-
null: (value) => value === null,
|
|
621
|
-
boolean: (value) => typeof value === "boolean",
|
|
622
|
-
object: isObject$1,
|
|
623
|
-
array: (value) => Array.isArray(value),
|
|
624
|
-
number: (value) => typeof value === "number",
|
|
625
|
-
integer: (value) => Number.isInteger(value),
|
|
626
|
-
string: (value) => typeof value === "string"
|
|
1898
|
+
return to.slice(toStart, to.length);
|
|
627
1899
|
};
|
|
628
|
-
const jsonTypeOf$2 = (value, type) => isType[type](value);
|
|
629
1900
|
|
|
630
|
-
|
|
631
|
-
const indexOfHash = url.indexOf("#");
|
|
632
|
-
const ndx = indexOfHash === -1 ? url.length : indexOfHash;
|
|
633
|
-
const urlReference = url.slice(0, ndx);
|
|
634
|
-
const urlFragment = url.slice(ndx + 1);
|
|
1901
|
+
var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
|
|
635
1902
|
|
|
636
|
-
|
|
637
|
-
};
|
|
1903
|
+
const curry$9 = justCurryIt;
|
|
638
1904
|
|
|
639
|
-
const getScheme = (url) => {
|
|
640
|
-
const matches = RegExp(/^(.+):\/\//).exec(url);
|
|
641
|
-
return matches ? matches[1] : "";
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
const safeResolveUrl$1 = (contextUrl, url) => {
|
|
645
|
-
const resolvedUrl = urlResolveBrowser(contextUrl, url);
|
|
646
|
-
const contextId = splitUrl$4(contextUrl)[0];
|
|
647
|
-
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") {
|
|
648
|
-
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`);
|
|
649
|
-
}
|
|
650
|
-
return resolvedUrl;
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
var common$1 = { jsonTypeOf: jsonTypeOf$2, splitUrl: splitUrl$4, safeResolveUrl: safeResolveUrl$1 };
|
|
654
1905
|
|
|
655
1906
|
const nil$2 = "";
|
|
656
1907
|
|
|
@@ -674,7 +1925,7 @@ const get$1 = (pointer, value = undefined) => {
|
|
|
674
1925
|
|
|
675
1926
|
const set = (pointer, subject = undefined, value = undefined) => {
|
|
676
1927
|
const ptr = compile$P(pointer);
|
|
677
|
-
const fn =
|
|
1928
|
+
const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$2));
|
|
678
1929
|
return subject === undefined ? fn : fn(subject, value);
|
|
679
1930
|
};
|
|
680
1931
|
|
|
@@ -698,7 +1949,7 @@ const _set = (pointer, subject, value, cursor) => {
|
|
|
698
1949
|
|
|
699
1950
|
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
700
1951
|
const ptr = compile$P(pointer);
|
|
701
|
-
const fn =
|
|
1952
|
+
const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$2));
|
|
702
1953
|
return subject === undefined ? fn : fn(subject, value);
|
|
703
1954
|
};
|
|
704
1955
|
|
|
@@ -760,7 +2011,7 @@ const _remove = (pointer, subject, cursor) => {
|
|
|
760
2011
|
}
|
|
761
2012
|
};
|
|
762
2013
|
|
|
763
|
-
const append =
|
|
2014
|
+
const append = curry$9((segment, pointer) => pointer + "/" + escape(segment));
|
|
764
2015
|
|
|
765
2016
|
const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
766
2017
|
const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
@@ -782,13 +2033,6 @@ const applySegment = (value, segment, cursor = "") => {
|
|
|
782
2033
|
const isScalar = (value) => value === null || typeof value !== "object";
|
|
783
2034
|
|
|
784
2035
|
var lib$3 = { nil: nil$2, append, get: get$1, set, assign, unset, remove };
|
|
785
|
-
lib$3.nil;
|
|
786
|
-
lib$3.append;
|
|
787
|
-
lib$3.get;
|
|
788
|
-
lib$3.set;
|
|
789
|
-
lib$3.assign;
|
|
790
|
-
lib$3.unset;
|
|
791
|
-
lib$3.remove;
|
|
792
2036
|
|
|
793
2037
|
const $__value = Symbol("$__value");
|
|
794
2038
|
const $__href = Symbol("$__href");
|
|
@@ -803,67 +2047,52 @@ const href = (ref) => ref[$__href];
|
|
|
803
2047
|
const value$2 = (ref) => ref[$__value];
|
|
804
2048
|
|
|
805
2049
|
var reference = { cons: cons$1, isReference, href, value: value$2 };
|
|
806
|
-
reference.cons;
|
|
807
|
-
reference.isReference;
|
|
808
|
-
reference.href;
|
|
809
|
-
reference.value;
|
|
810
|
-
|
|
811
|
-
const { jsonTypeOf: jsonTypeOf$1 } = common$1;
|
|
812
2050
|
|
|
2051
|
+
const JsonPointer$1 = lib$3;
|
|
2052
|
+
const curry$8 = justCurryIt;
|
|
2053
|
+
const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
|
|
2054
|
+
const Reference$2 = reference;
|
|
813
2055
|
|
|
814
2056
|
|
|
815
2057
|
const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
|
|
816
|
-
const cons = (instance, id = "") => Object.freeze({ ...nil$1, id, instance, value: instance });
|
|
2058
|
+
const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
|
|
817
2059
|
const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
|
|
818
|
-
const value$1 = (doc) =>
|
|
2060
|
+
const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
|
|
819
2061
|
const has$1 = (key, doc) => key in value$1(doc);
|
|
820
|
-
const typeOf$1 =
|
|
2062
|
+
const typeOf$1 = curry$8((doc, type) => jsonTypeOf$1(value$1(doc), type));
|
|
821
2063
|
|
|
822
2064
|
const step$1 = (key, doc) => Object.freeze({
|
|
823
2065
|
...doc,
|
|
824
|
-
pointer:
|
|
2066
|
+
pointer: JsonPointer$1.append(key, doc.pointer),
|
|
825
2067
|
value: value$1(doc)[key]
|
|
826
2068
|
});
|
|
827
2069
|
|
|
828
|
-
const entries$
|
|
2070
|
+
const entries$3 = (doc) => Object.keys(value$1(doc))
|
|
829
2071
|
.map((key) => [key, step$1(key, doc)]);
|
|
830
2072
|
|
|
831
2073
|
const keys$1 = (doc) => Object.keys(value$1(doc));
|
|
832
2074
|
|
|
833
|
-
const map$
|
|
2075
|
+
const map$4 = curry$8((fn, doc) => value$1(doc)
|
|
834
2076
|
.map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
835
2077
|
|
|
836
|
-
const filter$1 =
|
|
2078
|
+
const filter$1 = curry$8((fn, doc) => value$1(doc)
|
|
837
2079
|
.map((item, ndx, array, thisArg) => step$1(ndx, doc))
|
|
838
2080
|
.filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
|
|
839
2081
|
|
|
840
|
-
const reduce$
|
|
2082
|
+
const reduce$3 = curry$8((fn, acc, doc) => value$1(doc)
|
|
841
2083
|
.reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
|
|
842
2084
|
|
|
843
|
-
const every$1 =
|
|
2085
|
+
const every$1 = curry$8((fn, doc) => value$1(doc)
|
|
844
2086
|
.every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
845
2087
|
|
|
846
|
-
const some$1 =
|
|
2088
|
+
const some$1 = curry$8((fn, doc) => value$1(doc)
|
|
847
2089
|
.some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
848
2090
|
|
|
849
2091
|
const length$1 = (doc) => value$1(doc).length;
|
|
850
2092
|
|
|
851
|
-
var instance = { nil: nil$1, cons, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, step: step$1, entries: entries$
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
instance.uri;
|
|
855
|
-
instance.value;
|
|
856
|
-
instance.has;
|
|
857
|
-
instance.typeOf;
|
|
858
|
-
instance.step;
|
|
859
|
-
instance.entries;
|
|
860
|
-
instance.keys;
|
|
861
|
-
instance.map;
|
|
862
|
-
instance.filter;
|
|
863
|
-
instance.reduce;
|
|
864
|
-
instance.every;
|
|
865
|
-
instance.some;
|
|
866
|
-
instance.length;
|
|
2093
|
+
var instance = { nil: nil$1, cons, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, step: step$1, entries: entries$3, keys: keys$1, map: map$4, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1, length: length$1 };
|
|
2094
|
+
|
|
2095
|
+
var contentType = {};
|
|
867
2096
|
|
|
868
2097
|
/*!
|
|
869
2098
|
* content-type
|
|
@@ -916,8 +2145,8 @@ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
|
916
2145
|
* @public
|
|
917
2146
|
*/
|
|
918
2147
|
|
|
919
|
-
|
|
920
|
-
|
|
2148
|
+
contentType.format = format$1;
|
|
2149
|
+
contentType.parse = parse;
|
|
921
2150
|
|
|
922
2151
|
/**
|
|
923
2152
|
* Format object to media type.
|
|
@@ -1086,43 +2315,64 @@ function ContentType (type) {
|
|
|
1086
2315
|
this.type = type;
|
|
1087
2316
|
}
|
|
1088
2317
|
|
|
1089
|
-
var
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
2318
|
+
var entries$2 = async (doc) => Object.entries(await doc);
|
|
2319
|
+
|
|
2320
|
+
const curry$7 = justCurryIt;
|
|
2321
|
+
|
|
1093
2322
|
|
|
1094
|
-
var
|
|
2323
|
+
var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
|
|
1095
2324
|
|
|
1096
|
-
|
|
2325
|
+
const curry$6 = justCurryIt;
|
|
1097
2326
|
|
|
1098
|
-
|
|
2327
|
+
|
|
2328
|
+
var reduce$2 = curry$6(async (fn, acc, doc) => {
|
|
1099
2329
|
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
1100
2330
|
});
|
|
1101
2331
|
|
|
1102
|
-
|
|
1103
|
-
|
|
2332
|
+
const curry$5 = justCurryIt;
|
|
2333
|
+
const reduce$1 = reduce$2;
|
|
2334
|
+
|
|
2335
|
+
|
|
2336
|
+
var filter = curry$5(async (fn, doc, options = {}) => {
|
|
2337
|
+
return reduce$1(async (acc, item) => {
|
|
1104
2338
|
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
1105
2339
|
}, [], doc, options);
|
|
1106
2340
|
});
|
|
1107
2341
|
|
|
1108
|
-
|
|
1109
|
-
|
|
2342
|
+
const curry$4 = justCurryIt;
|
|
2343
|
+
const map$2 = map$3;
|
|
2344
|
+
|
|
2345
|
+
|
|
2346
|
+
var some = curry$4(async (fn, doc) => {
|
|
2347
|
+
const results = await map$2(fn, doc);
|
|
1110
2348
|
return (await Promise.all(results))
|
|
1111
2349
|
.some((a) => a);
|
|
1112
2350
|
});
|
|
1113
2351
|
|
|
1114
|
-
|
|
2352
|
+
const curry$3 = justCurryIt;
|
|
2353
|
+
const map$1 = map$3;
|
|
2354
|
+
|
|
2355
|
+
|
|
2356
|
+
var every = curry$3(async (fn, doc) => {
|
|
1115
2357
|
const results = await map$1(fn, doc);
|
|
1116
2358
|
return (await Promise.all(results))
|
|
1117
2359
|
.every((a) => a);
|
|
1118
2360
|
});
|
|
1119
2361
|
|
|
1120
|
-
|
|
2362
|
+
const curry$2 = justCurryIt;
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
var pipeline$1 = curry$2((fns, doc) => {
|
|
1121
2366
|
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
1122
2367
|
});
|
|
1123
2368
|
|
|
1124
2369
|
var all = (doc) => Promise.all(doc);
|
|
1125
2370
|
|
|
2371
|
+
const pipeline = pipeline$1;
|
|
2372
|
+
const entries$1 = entries$2;
|
|
2373
|
+
const reduce = reduce$2;
|
|
2374
|
+
|
|
2375
|
+
|
|
1126
2376
|
var allValues = (doc) => {
|
|
1127
2377
|
return pipeline([
|
|
1128
2378
|
entries$1,
|
|
@@ -1134,48 +2384,43 @@ var allValues = (doc) => {
|
|
|
1134
2384
|
};
|
|
1135
2385
|
|
|
1136
2386
|
var lib$2 = {
|
|
1137
|
-
entries: entries$
|
|
1138
|
-
map: map$
|
|
2387
|
+
entries: entries$2,
|
|
2388
|
+
map: map$3,
|
|
1139
2389
|
filter: filter,
|
|
1140
|
-
reduce: reduce,
|
|
2390
|
+
reduce: reduce$2,
|
|
1141
2391
|
some: some,
|
|
1142
2392
|
every: every,
|
|
1143
|
-
pipeline: pipeline,
|
|
2393
|
+
pipeline: pipeline$1,
|
|
1144
2394
|
all: all,
|
|
1145
2395
|
allValues: allValues
|
|
1146
2396
|
};
|
|
1147
|
-
lib$2.entries;
|
|
1148
|
-
lib$2.map;
|
|
1149
|
-
lib$2.filter;
|
|
1150
|
-
lib$2.reduce;
|
|
1151
|
-
lib$2.some;
|
|
1152
|
-
lib$2.every;
|
|
1153
|
-
lib$2.pipeline;
|
|
1154
|
-
lib$2.all;
|
|
1155
|
-
lib$2.allValues;
|
|
1156
2397
|
|
|
1157
2398
|
var fetch_browser = fetch;
|
|
1158
2399
|
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
|
|
2400
|
+
const contentTypeParser = contentType;
|
|
2401
|
+
const curry$1 = justCurryIt;
|
|
2402
|
+
const Pact$a = lib$2;
|
|
2403
|
+
const JsonPointer = lib$3;
|
|
2404
|
+
const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
|
|
2405
|
+
const fetch$1 = fetch_browser;
|
|
2406
|
+
const Reference$1 = reference;
|
|
1162
2407
|
|
|
1163
2408
|
|
|
1164
2409
|
// Config
|
|
1165
2410
|
const config = {};
|
|
1166
|
-
const
|
|
2411
|
+
const dialectJsonSchemaVersion = {};
|
|
1167
2412
|
|
|
1168
|
-
const setConfig = (
|
|
1169
|
-
if (!config[
|
|
1170
|
-
config[
|
|
2413
|
+
const setConfig = (jsonSchemaVersion, key, value) => {
|
|
2414
|
+
if (!config[jsonSchemaVersion]) {
|
|
2415
|
+
config[jsonSchemaVersion] = {};
|
|
1171
2416
|
}
|
|
1172
|
-
config[
|
|
2417
|
+
config[jsonSchemaVersion][key] = value;
|
|
1173
2418
|
};
|
|
1174
2419
|
|
|
1175
|
-
const getConfig = (
|
|
1176
|
-
const
|
|
1177
|
-
if (
|
|
1178
|
-
return config[
|
|
2420
|
+
const getConfig = (dialectId, key) => {
|
|
2421
|
+
const jsonSchemaVersion = dialectJsonSchemaVersion[dialectId] || dialectId;
|
|
2422
|
+
if (jsonSchemaVersion in config) {
|
|
2423
|
+
return config[jsonSchemaVersion][key];
|
|
1179
2424
|
}
|
|
1180
2425
|
};
|
|
1181
2426
|
|
|
@@ -1186,22 +2431,32 @@ const schemaStoreAlias = {};
|
|
|
1186
2431
|
const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
1187
2432
|
schema = JSON.parse(JSON.stringify(schema));
|
|
1188
2433
|
|
|
1189
|
-
// Schema Version
|
|
1190
|
-
const
|
|
1191
|
-
if (!
|
|
1192
|
-
throw Error("Couldn't determine schema
|
|
2434
|
+
// Dialect / JSON Schema Version
|
|
2435
|
+
const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
|
|
2436
|
+
if (!dialectId) {
|
|
2437
|
+
throw Error("Couldn't determine schema dialect");
|
|
1193
2438
|
}
|
|
1194
2439
|
delete schema["$schema"];
|
|
1195
2440
|
|
|
2441
|
+
let jsonSchemaVersion;
|
|
2442
|
+
if (schema.$vocabulary?.["https://json-schema.org/draft/2019-09/vocab/core"] === true) {
|
|
2443
|
+
jsonSchemaVersion = "https://json-schema.org/draft/2019-09/vocab/core";
|
|
2444
|
+
} else if (schema.$vocabulary?.["https://json-schema.org/draft/2020-12/vocab/core"] === true) {
|
|
2445
|
+
jsonSchemaVersion = "https://json-schema.org/draft/2020-12/vocab/core";
|
|
2446
|
+
} else {
|
|
2447
|
+
jsonSchemaVersion = dialectJsonSchemaVersion[dialectId] || dialectId;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
1196
2450
|
// Identifier
|
|
1197
|
-
const baseToken = getConfig(
|
|
1198
|
-
const anchorToken = getConfig(
|
|
1199
|
-
const externalId =
|
|
1200
|
-
if (!externalId && !
|
|
2451
|
+
const baseToken = getConfig(jsonSchemaVersion, "baseToken");
|
|
2452
|
+
const anchorToken = getConfig(jsonSchemaVersion, "anchorToken");
|
|
2453
|
+
const externalId = resolveUrl$1(url, "");
|
|
2454
|
+
if (!externalId && !resolveUrl$1(schema[baseToken] || "", "")) {
|
|
1201
2455
|
throw Error("Couldn't determine an identifier for the schema");
|
|
1202
2456
|
}
|
|
1203
|
-
const internalUrl =
|
|
1204
|
-
const
|
|
2457
|
+
const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
|
|
2458
|
+
const id = resolveUrl$1(internalUrl, "");
|
|
2459
|
+
const fragment = urlFragment(internalUrl);
|
|
1205
2460
|
delete schema[baseToken];
|
|
1206
2461
|
if (fragment && baseToken === anchorToken) {
|
|
1207
2462
|
schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
|
|
@@ -1210,9 +2465,12 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
|
1210
2465
|
schemaStoreAlias[externalId] = id;
|
|
1211
2466
|
}
|
|
1212
2467
|
|
|
2468
|
+
// JSON Schema version
|
|
2469
|
+
dialectJsonSchemaVersion[id] = jsonSchemaVersion;
|
|
2470
|
+
|
|
1213
2471
|
// recursiveAnchor
|
|
1214
2472
|
const dynamicAnchors = {};
|
|
1215
|
-
const recursiveAnchorToken = getConfig(
|
|
2473
|
+
const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
|
|
1216
2474
|
if (schema[recursiveAnchorToken] === true) {
|
|
1217
2475
|
dynamicAnchors[""] = `${id}#`;
|
|
1218
2476
|
schema[anchorToken] = "";
|
|
@@ -1221,22 +2479,20 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
|
1221
2479
|
|
|
1222
2480
|
// Vocabulary
|
|
1223
2481
|
let vocabulary;
|
|
1224
|
-
const vocabularyToken = getConfig(
|
|
2482
|
+
const vocabularyToken = getConfig(dialectId, "vocabularyToken");
|
|
1225
2483
|
if (jsonTypeOf(schema[vocabularyToken], "object")) {
|
|
1226
|
-
configAlias[id] = schemaVersion;
|
|
1227
2484
|
vocabulary = schema[vocabularyToken];
|
|
1228
2485
|
delete schema[vocabularyToken];
|
|
1229
2486
|
} else {
|
|
1230
|
-
|
|
1231
|
-
vocabulary = { [schemaVersion]: true };
|
|
2487
|
+
vocabulary = { [dialectJsonSchemaVersion[dialectId]]: true };
|
|
1232
2488
|
}
|
|
1233
2489
|
|
|
1234
2490
|
// Store Schema
|
|
1235
2491
|
const anchors = { "": "" };
|
|
1236
2492
|
schemaStore[id] = {
|
|
1237
2493
|
id: id,
|
|
1238
|
-
|
|
1239
|
-
schema: processSchema(schema, id,
|
|
2494
|
+
dialectId: dialectId,
|
|
2495
|
+
schema: processSchema(schema, id, dialectId, JsonPointer.nil, anchors, dynamicAnchors),
|
|
1240
2496
|
anchors: anchors,
|
|
1241
2497
|
dynamicAnchors: dynamicAnchors,
|
|
1242
2498
|
vocabulary: vocabulary,
|
|
@@ -1246,45 +2502,46 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
|
1246
2502
|
return id;
|
|
1247
2503
|
};
|
|
1248
2504
|
|
|
1249
|
-
const processSchema = (subject, id,
|
|
2505
|
+
const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
|
|
1250
2506
|
if (jsonTypeOf(subject, "object")) {
|
|
1251
|
-
const
|
|
1252
|
-
const embeddedEmbeddedToken = getConfig(
|
|
1253
|
-
const embeddedAnchorToken = getConfig(
|
|
2507
|
+
const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
|
|
2508
|
+
const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
|
|
2509
|
+
const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
|
|
1254
2510
|
if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
|
|
1255
|
-
const ref =
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
2511
|
+
const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
|
|
2512
|
+
const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
|
|
2513
|
+
subject[embeddedBaseToken] = ref;
|
|
2514
|
+
add$1(subject, ref, dialectId);
|
|
2515
|
+
return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
|
|
1259
2516
|
}
|
|
1260
2517
|
|
|
1261
|
-
const anchorToken = getConfig(
|
|
1262
|
-
const dynamicAnchorToken = getConfig(
|
|
2518
|
+
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
2519
|
+
const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
|
|
1263
2520
|
if (typeof subject[dynamicAnchorToken] === "string") {
|
|
1264
2521
|
dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
|
|
1265
2522
|
anchors[subject[dynamicAnchorToken]] = pointer;
|
|
1266
2523
|
delete subject[dynamicAnchorToken];
|
|
1267
2524
|
}
|
|
1268
2525
|
|
|
1269
|
-
const embeddedToken = getConfig(
|
|
2526
|
+
const embeddedToken = getConfig(dialectId, "embeddedToken");
|
|
1270
2527
|
if (typeof subject[anchorToken] === "string") {
|
|
1271
2528
|
const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
|
|
1272
2529
|
anchors[anchor] = pointer;
|
|
1273
2530
|
delete subject[anchorToken];
|
|
1274
2531
|
}
|
|
1275
2532
|
|
|
1276
|
-
const jrefToken = getConfig(
|
|
2533
|
+
const jrefToken = getConfig(dialectId, "jrefToken");
|
|
1277
2534
|
if (typeof subject[jrefToken] === "string") {
|
|
1278
|
-
return
|
|
2535
|
+
return Reference$1.cons(subject[jrefToken], subject);
|
|
1279
2536
|
}
|
|
1280
2537
|
|
|
1281
2538
|
for (const key in subject) {
|
|
1282
|
-
subject[key] = processSchema(subject[key], id,
|
|
2539
|
+
subject[key] = processSchema(subject[key], id, dialectId, JsonPointer.append(key, pointer), anchors, dynamicAnchors);
|
|
1283
2540
|
}
|
|
1284
2541
|
|
|
1285
2542
|
return subject;
|
|
1286
2543
|
} else if (Array.isArray(subject)) {
|
|
1287
|
-
return subject.map((item, ndx) => processSchema(item, id,
|
|
2544
|
+
return subject.map((item, ndx) => processSchema(item, id, dialectId, JsonPointer.append(ndx, pointer), anchors, dynamicAnchors));
|
|
1288
2545
|
} else {
|
|
1289
2546
|
return subject;
|
|
1290
2547
|
}
|
|
@@ -1300,9 +2557,9 @@ const markValidated = (id) => {
|
|
|
1300
2557
|
// Schema Retrieval
|
|
1301
2558
|
const nil = Object.freeze({
|
|
1302
2559
|
id: "",
|
|
1303
|
-
|
|
2560
|
+
dialectId: undefined,
|
|
1304
2561
|
vocabulary: {},
|
|
1305
|
-
pointer:
|
|
2562
|
+
pointer: JsonPointer.nil,
|
|
1306
2563
|
schema: undefined,
|
|
1307
2564
|
value: undefined,
|
|
1308
2565
|
anchors: {},
|
|
@@ -1311,20 +2568,21 @@ const nil = Object.freeze({
|
|
|
1311
2568
|
});
|
|
1312
2569
|
|
|
1313
2570
|
const get = async (url, contextDoc = nil) => {
|
|
1314
|
-
const resolvedUrl =
|
|
1315
|
-
const
|
|
2571
|
+
const resolvedUrl = resolveUrl$1(uri(contextDoc), url);
|
|
2572
|
+
const id = resolveUrl$1(resolvedUrl, "");
|
|
2573
|
+
const fragment = urlFragment(resolvedUrl);
|
|
1316
2574
|
|
|
1317
2575
|
if (!hasStoredSchema(id)) {
|
|
1318
|
-
const response = await
|
|
2576
|
+
const response = await fetch$1(id, { headers: { Accept: "application/schema+json" } });
|
|
1319
2577
|
if (response.status >= 400) {
|
|
1320
2578
|
await response.text(); // Sometimes node hangs without this hack
|
|
1321
2579
|
throw Error(`Failed to retrieve schema with id: ${id}`);
|
|
1322
2580
|
}
|
|
1323
2581
|
|
|
1324
2582
|
if (response.headers.has("content-type")) {
|
|
1325
|
-
const contentType
|
|
1326
|
-
if (contentType
|
|
1327
|
-
throw Error(`${id} is not a schema. Found a document with media type: ${contentType
|
|
2583
|
+
const contentType = contentTypeParser.parse(response.headers.get("content-type")).type;
|
|
2584
|
+
if (contentType !== "application/schema+json") {
|
|
2585
|
+
throw Error(`${id} is not a schema. Found a document with media type: ${contentType}`);
|
|
1328
2586
|
}
|
|
1329
2587
|
}
|
|
1330
2588
|
|
|
@@ -1336,13 +2594,13 @@ const get = async (url, contextDoc = nil) => {
|
|
|
1336
2594
|
const doc = Object.freeze({
|
|
1337
2595
|
...storedSchema,
|
|
1338
2596
|
pointer: pointer,
|
|
1339
|
-
value:
|
|
2597
|
+
value: JsonPointer.get(pointer, storedSchema.schema)
|
|
1340
2598
|
});
|
|
1341
2599
|
|
|
1342
2600
|
return followReferences$1(doc);
|
|
1343
2601
|
};
|
|
1344
2602
|
|
|
1345
|
-
const followReferences$1 = (doc) =>
|
|
2603
|
+
const followReferences$1 = (doc) => Reference$1.isReference(doc.value) ? get(Reference$1.href(doc.value), doc) : doc;
|
|
1346
2604
|
|
|
1347
2605
|
const getAnchorPointer = (schema, fragment) => {
|
|
1348
2606
|
if (!(fragment in schema.anchors)) {
|
|
@@ -1354,7 +2612,7 @@ const getAnchorPointer = (schema, fragment) => {
|
|
|
1354
2612
|
|
|
1355
2613
|
// Utility Functions
|
|
1356
2614
|
const uri = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
|
|
1357
|
-
const value = (doc) =>
|
|
2615
|
+
const value = (doc) => Reference$1.isReference(doc.value) ? Reference$1.value(doc.value) : doc.value;
|
|
1358
2616
|
const has = (key, doc) => key in value(doc);
|
|
1359
2617
|
const typeOf = (doc, type) => jsonTypeOf(value(doc), type);
|
|
1360
2618
|
|
|
@@ -1362,7 +2620,7 @@ const step = (key, doc) => {
|
|
|
1362
2620
|
const storedSchema = getStoredSchema(doc.id);
|
|
1363
2621
|
const nextDoc = Object.freeze({
|
|
1364
2622
|
...doc,
|
|
1365
|
-
pointer:
|
|
2623
|
+
pointer: JsonPointer.append(key, doc.pointer),
|
|
1366
2624
|
value: value(doc)[key],
|
|
1367
2625
|
validated: storedSchema.validated
|
|
1368
2626
|
});
|
|
@@ -1371,43 +2629,91 @@ const step = (key, doc) => {
|
|
|
1371
2629
|
|
|
1372
2630
|
const keys = (doc) => Object.keys(value(doc));
|
|
1373
2631
|
|
|
1374
|
-
const entries = (doc) =>
|
|
2632
|
+
const entries = (doc) => Pact$a.pipeline([
|
|
1375
2633
|
value,
|
|
1376
2634
|
Object.keys,
|
|
1377
|
-
|
|
1378
|
-
|
|
2635
|
+
Pact$a.map(async (key) => [key, await step(key, doc)]),
|
|
2636
|
+
Pact$a.all
|
|
1379
2637
|
], doc);
|
|
1380
2638
|
|
|
1381
|
-
const map =
|
|
2639
|
+
const map = curry$1((fn, doc) => Pact$a.pipeline([
|
|
1382
2640
|
value,
|
|
1383
|
-
|
|
1384
|
-
|
|
2641
|
+
Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
|
|
2642
|
+
Pact$a.all
|
|
1385
2643
|
], doc));
|
|
1386
2644
|
|
|
1387
2645
|
const length = (doc) => value(doc).length;
|
|
1388
2646
|
|
|
2647
|
+
const toSchemaDefaultOptions = {
|
|
2648
|
+
parentId: "",
|
|
2649
|
+
parentDialect: "",
|
|
2650
|
+
includeEmbedded: true
|
|
2651
|
+
};
|
|
2652
|
+
const toSchema = (schemaDoc, options = {}) => {
|
|
2653
|
+
const fullOptions = { ...toSchemaDefaultOptions, ...options };
|
|
2654
|
+
|
|
2655
|
+
const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
|
|
2656
|
+
if (!Reference$1.isReference(value)) {
|
|
2657
|
+
return value;
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
const refValue = Reference$1.value(value);
|
|
2661
|
+
const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
|
|
2662
|
+
const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
|
|
2663
|
+
if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
|
|
2664
|
+
return;
|
|
2665
|
+
} else {
|
|
2666
|
+
return Reference$1.value(value);
|
|
2667
|
+
}
|
|
2668
|
+
}));
|
|
2669
|
+
|
|
2670
|
+
const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
|
|
2671
|
+
Object.entries(schemaDoc.dynamicAnchors)
|
|
2672
|
+
.forEach(([anchor, uri]) => {
|
|
2673
|
+
const pointer = urlFragment(uri);
|
|
2674
|
+
JsonPointer.assign(pointer, schema, {
|
|
2675
|
+
[dynamicAnchorToken]: anchor,
|
|
2676
|
+
...JsonPointer.get(pointer, schema)
|
|
2677
|
+
});
|
|
2678
|
+
});
|
|
2679
|
+
|
|
2680
|
+
const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
|
|
2681
|
+
Object.entries(schemaDoc.anchors)
|
|
2682
|
+
.filter(([anchor]) => anchor !== "")
|
|
2683
|
+
.forEach(([anchor, pointer]) => {
|
|
2684
|
+
JsonPointer.assign(pointer, schema, {
|
|
2685
|
+
[anchorToken]: anchor,
|
|
2686
|
+
...JsonPointer.get(pointer, schema)
|
|
2687
|
+
});
|
|
2688
|
+
});
|
|
2689
|
+
|
|
2690
|
+
const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
|
|
2691
|
+
const id = relativeUri(fullOptions.parentId, schemaDoc.id);
|
|
2692
|
+
const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
|
|
2693
|
+
return {
|
|
2694
|
+
...(id && { [baseToken]: id }),
|
|
2695
|
+
...(dialect && { $schema: dialect }),
|
|
2696
|
+
...schema
|
|
2697
|
+
};
|
|
2698
|
+
};
|
|
2699
|
+
|
|
2700
|
+
const relativeUri = (from, to) => {
|
|
2701
|
+
if (to.startsWith("file://")) {
|
|
2702
|
+
const pathToSchema = from.slice(7, from.lastIndexOf("/"));
|
|
2703
|
+
return from === "" ? "" : pathRelative(pathToSchema, to.slice(7));
|
|
2704
|
+
} else {
|
|
2705
|
+
return to;
|
|
2706
|
+
}
|
|
2707
|
+
};
|
|
2708
|
+
|
|
1389
2709
|
var schema$5 = {
|
|
1390
2710
|
setConfig, getConfig,
|
|
1391
2711
|
add: add$1, get, markValidated,
|
|
1392
|
-
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length
|
|
2712
|
+
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
|
|
2713
|
+
toSchema
|
|
1393
2714
|
};
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
schema$5.add;
|
|
1397
|
-
schema$5.get;
|
|
1398
|
-
schema$5.markValidated;
|
|
1399
|
-
schema$5.uri;
|
|
1400
|
-
schema$5.value;
|
|
1401
|
-
schema$5.getAnchorPointer;
|
|
1402
|
-
schema$5.typeOf;
|
|
1403
|
-
schema$5.has;
|
|
1404
|
-
schema$5.step;
|
|
1405
|
-
schema$5.keys;
|
|
1406
|
-
schema$5.entries;
|
|
1407
|
-
schema$5.map;
|
|
1408
|
-
schema$5.length;
|
|
1409
|
-
|
|
1410
|
-
class InvalidSchemaError$1 extends Error {
|
|
2715
|
+
|
|
2716
|
+
class InvalidSchemaError$3 extends Error {
|
|
1411
2717
|
constructor(output) {
|
|
1412
2718
|
super("Invalid Schema");
|
|
1413
2719
|
this.name = this.constructor.name;
|
|
@@ -1415,12 +2721,14 @@ class InvalidSchemaError$1 extends Error {
|
|
|
1415
2721
|
}
|
|
1416
2722
|
}
|
|
1417
2723
|
|
|
1418
|
-
var invalidSchemaError = InvalidSchemaError$
|
|
1419
|
-
|
|
1420
|
-
const { splitUrl: splitUrl$2 } = common$1;
|
|
1421
|
-
|
|
1422
|
-
|
|
2724
|
+
var invalidSchemaError = InvalidSchemaError$3;
|
|
1423
2725
|
|
|
2726
|
+
const curry = justCurryIt;
|
|
2727
|
+
const PubSub$1 = pubsub.exports;
|
|
2728
|
+
const { resolveUrl } = common$1;
|
|
2729
|
+
const Instance$E = instance;
|
|
2730
|
+
const Schema$R = schema$5;
|
|
2731
|
+
const InvalidSchemaError$2 = invalidSchemaError;
|
|
1424
2732
|
|
|
1425
2733
|
|
|
1426
2734
|
const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
|
|
@@ -1428,9 +2736,9 @@ const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE"
|
|
|
1428
2736
|
let metaOutputFormat = DETAILED;
|
|
1429
2737
|
let shouldMetaValidate = true;
|
|
1430
2738
|
|
|
1431
|
-
const validate$
|
|
2739
|
+
const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
|
|
1432
2740
|
const compiled = await compile$O(schema);
|
|
1433
|
-
const interpretAst = (value, outputFormat) => interpret$O(compiled,
|
|
2741
|
+
const interpretAst = (value, outputFormat) => interpret$O(compiled, Instance$E.cons(value), outputFormat);
|
|
1434
2742
|
|
|
1435
2743
|
return value === undefined ? interpretAst : interpretAst(value, outputFormat);
|
|
1436
2744
|
};
|
|
@@ -1441,15 +2749,15 @@ const compile$O = async (schema) => {
|
|
|
1441
2749
|
return { ast, schemaUri };
|
|
1442
2750
|
};
|
|
1443
2751
|
|
|
1444
|
-
const interpret$O =
|
|
2752
|
+
const interpret$O = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
1445
2753
|
if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
|
|
1446
2754
|
throw Error(`The '${outputFormat}' error format is not supported`);
|
|
1447
2755
|
}
|
|
1448
2756
|
|
|
1449
2757
|
const output = [];
|
|
1450
|
-
const subscriptionToken =
|
|
2758
|
+
const subscriptionToken = PubSub$1.subscribe("result", outputHandler(outputFormat, output));
|
|
1451
2759
|
interpretSchema(schemaUri, value, ast, {});
|
|
1452
|
-
|
|
2760
|
+
PubSub$1.unsubscribe(subscriptionToken);
|
|
1453
2761
|
|
|
1454
2762
|
return output[0];
|
|
1455
2763
|
});
|
|
@@ -1515,11 +2823,11 @@ const compileSchema = async (schema, ast) => {
|
|
|
1515
2823
|
schema = await followReferences(schema);
|
|
1516
2824
|
|
|
1517
2825
|
// Vocabularies
|
|
1518
|
-
if (!hasKeyword(`${schema.
|
|
1519
|
-
const metaSchema = await
|
|
2826
|
+
if (!hasKeyword(`${schema.dialectId}#validate`)) {
|
|
2827
|
+
const metaSchema = await Schema$R.get(schema.dialectId);
|
|
1520
2828
|
|
|
1521
2829
|
// Check for mandatory vocabularies
|
|
1522
|
-
const mandatoryVocabularies =
|
|
2830
|
+
const mandatoryVocabularies = Schema$R.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
|
|
1523
2831
|
mandatoryVocabularies.forEach((vocabularyId) => {
|
|
1524
2832
|
if (!metaSchema.vocabulary[vocabularyId]) {
|
|
1525
2833
|
throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
|
|
@@ -1542,20 +2850,20 @@ const compileSchema = async (schema, ast) => {
|
|
|
1542
2850
|
|
|
1543
2851
|
// Meta validation
|
|
1544
2852
|
if (shouldMetaValidate && !schema.validated) {
|
|
1545
|
-
|
|
2853
|
+
Schema$R.markValidated(schema.id);
|
|
1546
2854
|
|
|
1547
2855
|
// Compile
|
|
1548
|
-
if (!(schema.
|
|
1549
|
-
const metaSchema = await
|
|
2856
|
+
if (!(schema.dialectId in metaValidators)) {
|
|
2857
|
+
const metaSchema = await Schema$R.get(schema.dialectId);
|
|
1550
2858
|
const compiledSchema = await compile$O(metaSchema);
|
|
1551
2859
|
metaValidators[metaSchema.id] = interpret$O(compiledSchema);
|
|
1552
2860
|
}
|
|
1553
2861
|
|
|
1554
2862
|
// Interpret
|
|
1555
|
-
const schemaInstance =
|
|
1556
|
-
const metaResults = metaValidators[schema.
|
|
2863
|
+
const schemaInstance = Instance$E.cons(schema.schema, schema.id);
|
|
2864
|
+
const metaResults = metaValidators[schema.dialectId](schemaInstance, metaOutputFormat);
|
|
1557
2865
|
if (!metaResults.valid) {
|
|
1558
|
-
throw new
|
|
2866
|
+
throw new InvalidSchemaError$2(metaResults);
|
|
1559
2867
|
}
|
|
1560
2868
|
}
|
|
1561
2869
|
|
|
@@ -1567,16 +2875,16 @@ const compileSchema = async (schema, ast) => {
|
|
|
1567
2875
|
anchors: schema.anchors
|
|
1568
2876
|
};
|
|
1569
2877
|
}
|
|
1570
|
-
return getKeyword(`${schema.
|
|
2878
|
+
return getKeyword(`${schema.dialectId}#validate`).compile(schema, ast);
|
|
1571
2879
|
};
|
|
1572
2880
|
|
|
1573
2881
|
const followReferences = async (doc) => {
|
|
1574
|
-
return
|
|
2882
|
+
return Schema$R.typeOf(doc, "string") ? followReferences(await Schema$R.get(Schema$R.value(doc), doc)) : doc;
|
|
1575
2883
|
};
|
|
1576
2884
|
|
|
1577
2885
|
const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
|
|
1578
2886
|
const keywordId = getKeywordId(schemaUri, ast);
|
|
1579
|
-
const id =
|
|
2887
|
+
const id = resolveUrl(schemaUri, "");
|
|
1580
2888
|
return getKeyword(keywordId).interpret(schemaUri, instance, ast, { ...ast.metaData[id].dynamicAnchors, ...dynamicAnchors });
|
|
1581
2889
|
};
|
|
1582
2890
|
|
|
@@ -1599,63 +2907,54 @@ const getKeywordId = (schemaUri, ast) => {
|
|
|
1599
2907
|
};
|
|
1600
2908
|
|
|
1601
2909
|
const add = (schema, url = "", defaultSchemaVersion = "") => {
|
|
1602
|
-
const id =
|
|
2910
|
+
const id = Schema$R.add(schema, url, defaultSchemaVersion);
|
|
1603
2911
|
delete metaValidators[id];
|
|
1604
2912
|
};
|
|
1605
2913
|
|
|
1606
2914
|
var core$2 = {
|
|
1607
|
-
validate: validate$
|
|
2915
|
+
validate: validate$2, compile: compile$O, interpret: interpret$O,
|
|
1608
2916
|
setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
|
|
1609
2917
|
add, getKeyword, hasKeyword, defineVocabulary,
|
|
1610
2918
|
compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f
|
|
1611
2919
|
};
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
core$2.FLAG;
|
|
1618
|
-
core$2.BASIC;
|
|
1619
|
-
core$2.DETAILED;
|
|
1620
|
-
core$2.VERBOSE;
|
|
1621
|
-
core$2.add;
|
|
1622
|
-
core$2.getKeyword;
|
|
1623
|
-
core$2.hasKeyword;
|
|
1624
|
-
core$2.defineVocabulary;
|
|
1625
|
-
core$2.compileSchema;
|
|
1626
|
-
core$2.interpretSchema;
|
|
1627
|
-
core$2.collectEvaluatedProperties;
|
|
1628
|
-
core$2.collectEvaluatedItems;
|
|
1629
|
-
|
|
1630
|
-
const compile$N = (schema) => schema$5.value(schema);
|
|
2920
|
+
|
|
2921
|
+
const Schema$Q = schema$5;
|
|
2922
|
+
|
|
2923
|
+
|
|
2924
|
+
const compile$N = (schema) => Schema$Q.value(schema);
|
|
1631
2925
|
const interpret$N = () => true;
|
|
1632
2926
|
|
|
1633
|
-
var metaData$
|
|
1634
|
-
|
|
1635
|
-
|
|
2927
|
+
var metaData$3 = { compile: compile$N, interpret: interpret$N };
|
|
2928
|
+
|
|
2929
|
+
const Pact$9 = lib$2;
|
|
2930
|
+
const PubSub = pubsub.exports;
|
|
2931
|
+
const Core$x = core$2;
|
|
2932
|
+
const Instance$D = instance;
|
|
2933
|
+
const Schema$P = schema$5;
|
|
2934
|
+
|
|
1636
2935
|
|
|
1637
2936
|
const compile$M = async (schema, ast) => {
|
|
1638
|
-
const url =
|
|
2937
|
+
const url = Schema$P.uri(schema);
|
|
1639
2938
|
if (!(url in ast)) {
|
|
1640
2939
|
ast[url] = false; // Place dummy entry in ast to avoid recursive loops
|
|
1641
2940
|
|
|
1642
|
-
const schemaValue =
|
|
2941
|
+
const schemaValue = Schema$P.value(schema);
|
|
1643
2942
|
if (!["object", "boolean"].includes(typeof schemaValue)) {
|
|
1644
|
-
throw Error(`No schema found at '${
|
|
2943
|
+
throw Error(`No schema found at '${Schema$P.uri(schema)}'`);
|
|
1645
2944
|
}
|
|
1646
2945
|
|
|
1647
2946
|
ast[url] = [
|
|
1648
|
-
`${schema.
|
|
1649
|
-
|
|
1650
|
-
typeof schemaValue === "boolean" ? schemaValue : await
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
const keywordAst = await
|
|
1656
|
-
return [keywordId,
|
|
2947
|
+
`${schema.dialectId}#validate`,
|
|
2948
|
+
Schema$P.uri(schema),
|
|
2949
|
+
typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
|
|
2950
|
+
Schema$P.entries,
|
|
2951
|
+
Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
|
|
2952
|
+
Pact$9.filter(([keywordId]) => Core$x.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`),
|
|
2953
|
+
Pact$9.map(async ([keywordId, keywordSchema]) => {
|
|
2954
|
+
const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
|
|
2955
|
+
return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
|
|
1657
2956
|
}),
|
|
1658
|
-
|
|
2957
|
+
Pact$9.all
|
|
1659
2958
|
], schema)
|
|
1660
2959
|
];
|
|
1661
2960
|
}
|
|
@@ -1663,34 +2962,34 @@ const compile$M = async (schema, ast) => {
|
|
|
1663
2962
|
return url;
|
|
1664
2963
|
};
|
|
1665
2964
|
|
|
1666
|
-
const interpret$M = (uri, instance
|
|
2965
|
+
const interpret$M = (uri, instance, ast, dynamicAnchors) => {
|
|
1667
2966
|
const [keywordId, schemaUrl, nodes] = ast[uri];
|
|
1668
2967
|
|
|
1669
|
-
|
|
2968
|
+
PubSub.publishSync("result.start");
|
|
1670
2969
|
const isValid = typeof nodes === "boolean" ? nodes : nodes
|
|
1671
2970
|
.every(([keywordId, schemaUrl, keywordValue]) => {
|
|
1672
|
-
|
|
1673
|
-
const isValid =
|
|
2971
|
+
PubSub.publishSync("result.start");
|
|
2972
|
+
const isValid = Core$x.getKeyword(keywordId).interpret(keywordValue, instance, ast, dynamicAnchors);
|
|
1674
2973
|
|
|
1675
|
-
|
|
2974
|
+
PubSub.publishSync("result", {
|
|
1676
2975
|
keyword: keywordId,
|
|
1677
2976
|
absoluteKeywordLocation: schemaUrl,
|
|
1678
|
-
instanceLocation:
|
|
2977
|
+
instanceLocation: Instance$D.uri(instance),
|
|
1679
2978
|
valid: isValid,
|
|
1680
2979
|
ast: keywordValue
|
|
1681
2980
|
});
|
|
1682
|
-
|
|
2981
|
+
PubSub.publishSync("result.end");
|
|
1683
2982
|
return isValid;
|
|
1684
2983
|
});
|
|
1685
2984
|
|
|
1686
|
-
|
|
2985
|
+
PubSub.publishSync("result", {
|
|
1687
2986
|
keyword: keywordId,
|
|
1688
2987
|
absoluteKeywordLocation: schemaUrl,
|
|
1689
|
-
instanceLocation:
|
|
2988
|
+
instanceLocation: Instance$D.uri(instance),
|
|
1690
2989
|
valid: isValid,
|
|
1691
2990
|
ast: uri
|
|
1692
2991
|
});
|
|
1693
|
-
|
|
2992
|
+
PubSub.publishSync("result.end");
|
|
1694
2993
|
return isValid;
|
|
1695
2994
|
};
|
|
1696
2995
|
|
|
@@ -1704,7 +3003,7 @@ const collectEvaluatedProperties$d = (uri, instance, ast, dynamicAnchors, isTop
|
|
|
1704
3003
|
return nodes
|
|
1705
3004
|
.filter(([keywordId]) => !isTop || !keywordId.endsWith("#unevaluatedProperties"))
|
|
1706
3005
|
.reduce((acc, [keywordId, , keywordValue]) => {
|
|
1707
|
-
const propertyNames = acc &&
|
|
3006
|
+
const propertyNames = acc && Core$x.getKeyword(keywordId).collectEvaluatedProperties(keywordValue, instance, ast, dynamicAnchors);
|
|
1708
3007
|
return propertyNames !== false && [...acc, ...propertyNames];
|
|
1709
3008
|
}, []);
|
|
1710
3009
|
};
|
|
@@ -1719,22 +3018,28 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
|
|
|
1719
3018
|
return nodes
|
|
1720
3019
|
.filter(([keywordId]) => !isTop || !keywordId.endsWith("#unevaluatedItems"))
|
|
1721
3020
|
.reduce((acc, [keywordId, , keywordValue]) => {
|
|
1722
|
-
const itemIndexes = acc !== false &&
|
|
3021
|
+
const itemIndexes = acc !== false && Core$x.getKeyword(keywordId).collectEvaluatedItems(keywordValue, instance, ast, dynamicAnchors);
|
|
1723
3022
|
return itemIndexes !== false && new Set([...acc, ...itemIndexes]);
|
|
1724
3023
|
}, new Set());
|
|
1725
3024
|
};
|
|
1726
3025
|
|
|
1727
|
-
var validate = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
validate
|
|
1731
|
-
|
|
3026
|
+
var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
3027
|
+
|
|
3028
|
+
const metaData$2 = metaData$3;
|
|
3029
|
+
const validate = validate$1;
|
|
3030
|
+
|
|
3031
|
+
|
|
3032
|
+
var keywords$6 = { metaData: metaData$2, validate };
|
|
3033
|
+
|
|
3034
|
+
const Core$w = core$2;
|
|
3035
|
+
const Schema$O = schema$5;
|
|
3036
|
+
const Instance$C = instance;
|
|
3037
|
+
const Reference = reference;
|
|
3038
|
+
const Keywords$2 = keywords$6;
|
|
3039
|
+
const InvalidSchemaError$1 = invalidSchemaError;
|
|
1732
3040
|
|
|
1733
|
-
var keywords$1 = { metaData: metaData$2, validate };
|
|
1734
|
-
keywords$1.metaData;
|
|
1735
|
-
keywords$1.validate;
|
|
1736
3041
|
|
|
1737
|
-
var lib$1 = { Core:
|
|
3042
|
+
var lib$1 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
|
|
1738
3043
|
|
|
1739
3044
|
const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$1;
|
|
1740
3045
|
|
|
@@ -1763,8 +3068,6 @@ const interpret$L = ([numberOfItems, additionalItems], instance, ast, dynamicAnc
|
|
|
1763
3068
|
};
|
|
1764
3069
|
|
|
1765
3070
|
var additionalItems = { compile: compile$L, interpret: interpret$L };
|
|
1766
|
-
additionalItems.compile;
|
|
1767
|
-
additionalItems.interpret;
|
|
1768
3071
|
|
|
1769
3072
|
const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$1;
|
|
1770
3073
|
|
|
@@ -1789,9 +3092,6 @@ const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
1789
3092
|
};
|
|
1790
3093
|
|
|
1791
3094
|
var additionalItems6 = { compile: compile$K, interpret: interpret$K, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
1792
|
-
additionalItems6.compile;
|
|
1793
|
-
additionalItems6.interpret;
|
|
1794
|
-
additionalItems6.collectEvaluatedItems;
|
|
1795
3095
|
|
|
1796
3096
|
const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$1;
|
|
1797
3097
|
|
|
@@ -1826,8 +3126,6 @@ const interpret$J = ([propertyNames, propertyNamePatterns, additionalProperties]
|
|
|
1826
3126
|
};
|
|
1827
3127
|
|
|
1828
3128
|
var additionalProperties = { compile: compile$J, interpret: interpret$J };
|
|
1829
|
-
additionalProperties.compile;
|
|
1830
|
-
additionalProperties.interpret;
|
|
1831
3129
|
|
|
1832
3130
|
const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$1;
|
|
1833
3131
|
|
|
@@ -1857,17 +3155,14 @@ const collectEvaluatedProperties$c = (keywordValue, instance, ast, dynamicAnchor
|
|
|
1857
3155
|
};
|
|
1858
3156
|
|
|
1859
3157
|
var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
|
|
1860
|
-
additionalProperties6.compile;
|
|
1861
|
-
additionalProperties6.interpret;
|
|
1862
|
-
additionalProperties6.collectEvaluatedProperties;
|
|
1863
3158
|
|
|
1864
3159
|
const { Core: Core$r, Schema: Schema$J } = lib$1;
|
|
3160
|
+
const Pact$8 = lib$2;
|
|
1865
3161
|
|
|
1866
3162
|
|
|
1867
|
-
|
|
1868
|
-
const compile$H = (schema, ast) => lib$2.pipeline([
|
|
3163
|
+
const compile$H = (schema, ast) => Pact$8.pipeline([
|
|
1869
3164
|
Schema$J.map(async (itemSchema) => Core$r.compileSchema(await itemSchema, ast)),
|
|
1870
|
-
|
|
3165
|
+
Pact$8.all
|
|
1871
3166
|
], schema);
|
|
1872
3167
|
|
|
1873
3168
|
const interpret$H = (allOf, instance, ast, dynamicAnchors) => {
|
|
@@ -1889,18 +3184,14 @@ const collectEvaluatedItems$c = (allOf, instance, ast, dynamicAnchors) => {
|
|
|
1889
3184
|
};
|
|
1890
3185
|
|
|
1891
3186
|
var allOf = { compile: compile$H, interpret: interpret$H, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
|
|
1892
|
-
allOf.compile;
|
|
1893
|
-
allOf.interpret;
|
|
1894
|
-
allOf.collectEvaluatedProperties;
|
|
1895
|
-
allOf.collectEvaluatedItems;
|
|
1896
3187
|
|
|
1897
3188
|
const { Core: Core$q, Schema: Schema$I } = lib$1;
|
|
3189
|
+
const Pact$7 = lib$2;
|
|
1898
3190
|
|
|
1899
3191
|
|
|
1900
|
-
|
|
1901
|
-
const compile$G = (schema, ast) => lib$2.pipeline([
|
|
3192
|
+
const compile$G = (schema, ast) => Pact$7.pipeline([
|
|
1902
3193
|
Schema$I.map(async (itemSchema) => Core$q.compileSchema(await itemSchema, ast)),
|
|
1903
|
-
|
|
3194
|
+
Pact$7.all
|
|
1904
3195
|
], schema);
|
|
1905
3196
|
|
|
1906
3197
|
const interpret$G = (anyOf, instance, ast, dynamicAnchors) => {
|
|
@@ -1923,10 +3214,6 @@ const collectEvaluatedItems$b = (anyOf, instance, ast, dynamicAnchors) => {
|
|
|
1923
3214
|
};
|
|
1924
3215
|
|
|
1925
3216
|
var anyOf = { compile: compile$G, interpret: interpret$G, collectEvaluatedProperties: collectEvaluatedProperties$a, collectEvaluatedItems: collectEvaluatedItems$b };
|
|
1926
|
-
anyOf.compile;
|
|
1927
|
-
anyOf.interpret;
|
|
1928
|
-
anyOf.collectEvaluatedProperties;
|
|
1929
|
-
anyOf.collectEvaluatedItems;
|
|
1930
3217
|
|
|
1931
3218
|
var keyList = Object.keys;
|
|
1932
3219
|
var native_stringify = JSON.stringify;
|
|
@@ -1988,15 +3275,13 @@ function stringify(val, allowUndefined) {
|
|
|
1988
3275
|
var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
|
|
1989
3276
|
|
|
1990
3277
|
const { Schema: Schema$H, Instance: Instance$x } = lib$1;
|
|
3278
|
+
const jsonStringify$2 = fastestStableStringify;
|
|
1991
3279
|
|
|
1992
3280
|
|
|
1993
|
-
|
|
1994
|
-
const
|
|
1995
|
-
const interpret$F = (const_, instance) => fastestStableStringify(Instance$x.value(instance)) === const_;
|
|
3281
|
+
const compile$F = (schema) => jsonStringify$2(Schema$H.value(schema));
|
|
3282
|
+
const interpret$F = (const_, instance) => jsonStringify$2(Instance$x.value(instance)) === const_;
|
|
1996
3283
|
|
|
1997
3284
|
var _const = { compile: compile$F, interpret: interpret$F };
|
|
1998
|
-
_const.compile;
|
|
1999
|
-
_const.interpret;
|
|
2000
3285
|
|
|
2001
3286
|
const { Core: Core$p, Instance: Instance$w } = lib$1;
|
|
2002
3287
|
|
|
@@ -2008,8 +3293,6 @@ const interpret$E = (contains, instance, ast, dynamicAnchors) => {
|
|
|
2008
3293
|
};
|
|
2009
3294
|
|
|
2010
3295
|
var contains = { compile: compile$E, interpret: interpret$E };
|
|
2011
|
-
contains.compile;
|
|
2012
|
-
contains.interpret;
|
|
2013
3296
|
|
|
2014
3297
|
const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$1;
|
|
2015
3298
|
|
|
@@ -2044,38 +3327,33 @@ const collectEvaluatedItems$a = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
2044
3327
|
};
|
|
2045
3328
|
|
|
2046
3329
|
var containsMinContainsMaxContains = { compile: compile$D, interpret: interpret$D, collectEvaluatedItems: collectEvaluatedItems$a };
|
|
2047
|
-
containsMinContainsMaxContains.compile;
|
|
2048
|
-
containsMinContainsMaxContains.interpret;
|
|
2049
|
-
containsMinContainsMaxContains.collectEvaluatedItems;
|
|
2050
3330
|
|
|
2051
3331
|
const { Core: Core$n, Schema: Schema$F } = lib$1;
|
|
2052
|
-
|
|
3332
|
+
const Pact$6 = lib$2;
|
|
2053
3333
|
|
|
2054
3334
|
|
|
2055
3335
|
const compile$C = async (schema, ast) => {
|
|
2056
|
-
await
|
|
3336
|
+
await Pact$6.pipeline([
|
|
2057
3337
|
Schema$F.entries,
|
|
2058
|
-
|
|
2059
|
-
|
|
3338
|
+
Pact$6.map(([, definitionSchema]) => Core$n.compileSchema(definitionSchema, ast)),
|
|
3339
|
+
Pact$6.all
|
|
2060
3340
|
], schema);
|
|
2061
3341
|
};
|
|
2062
3342
|
|
|
2063
3343
|
const interpret$C = () => true;
|
|
2064
3344
|
|
|
2065
3345
|
var definitions = { compile: compile$C, interpret: interpret$C };
|
|
2066
|
-
definitions.compile;
|
|
2067
|
-
definitions.interpret;
|
|
2068
3346
|
|
|
2069
3347
|
const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$1;
|
|
3348
|
+
const Pact$5 = lib$2;
|
|
2070
3349
|
|
|
2071
3350
|
|
|
2072
|
-
|
|
2073
|
-
const compile$B = (schema, ast) => lib$2.pipeline([
|
|
3351
|
+
const compile$B = (schema, ast) => Pact$5.pipeline([
|
|
2074
3352
|
Schema$E.entries,
|
|
2075
|
-
|
|
3353
|
+
Pact$5.map(async ([key, dependency]) => {
|
|
2076
3354
|
return [key, Schema$E.typeOf(dependency, "array") ? Schema$E.value(dependency) : await Core$m.compileSchema(dependency, ast)];
|
|
2077
3355
|
}),
|
|
2078
|
-
|
|
3356
|
+
Pact$5.all
|
|
2079
3357
|
], schema);
|
|
2080
3358
|
|
|
2081
3359
|
const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
|
|
@@ -2095,17 +3373,15 @@ const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
|
|
|
2095
3373
|
};
|
|
2096
3374
|
|
|
2097
3375
|
var dependencies = { compile: compile$B, interpret: interpret$B };
|
|
2098
|
-
dependencies.compile;
|
|
2099
|
-
dependencies.interpret;
|
|
2100
3376
|
|
|
2101
3377
|
const { Schema: Schema$D, Instance: Instance$t } = lib$1;
|
|
3378
|
+
const Pact$4 = lib$2;
|
|
2102
3379
|
|
|
2103
3380
|
|
|
2104
|
-
|
|
2105
|
-
const compile$A = (schema) => lib$2.pipeline([
|
|
3381
|
+
const compile$A = (schema) => Pact$4.pipeline([
|
|
2106
3382
|
Schema$D.entries,
|
|
2107
|
-
|
|
2108
|
-
|
|
3383
|
+
Pact$4.map(([key, dependentRequired]) => [key, Schema$D.value(dependentRequired)]),
|
|
3384
|
+
Pact$4.all
|
|
2109
3385
|
], schema);
|
|
2110
3386
|
|
|
2111
3387
|
const interpret$A = (dependentRequired, instance) => {
|
|
@@ -2117,17 +3393,15 @@ const interpret$A = (dependentRequired, instance) => {
|
|
|
2117
3393
|
};
|
|
2118
3394
|
|
|
2119
3395
|
var dependentRequired = { compile: compile$A, interpret: interpret$A };
|
|
2120
|
-
dependentRequired.compile;
|
|
2121
|
-
dependentRequired.interpret;
|
|
2122
3396
|
|
|
2123
3397
|
const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$1;
|
|
3398
|
+
const Pact$3 = lib$2;
|
|
2124
3399
|
|
|
2125
3400
|
|
|
2126
|
-
|
|
2127
|
-
const compile$z = (schema, ast) => lib$2.pipeline([
|
|
3401
|
+
const compile$z = (schema, ast) => Pact$3.pipeline([
|
|
2128
3402
|
Schema$C.entries,
|
|
2129
|
-
|
|
2130
|
-
|
|
3403
|
+
Pact$3.map(async ([key, dependentSchema]) => [key, await Core$l.compileSchema(dependentSchema, ast)]),
|
|
3404
|
+
Pact$3.all
|
|
2131
3405
|
], schema);
|
|
2132
3406
|
|
|
2133
3407
|
const interpret$z = (dependentSchemas, instance, ast, dynamicAnchors) => {
|
|
@@ -2150,20 +3424,15 @@ const collectEvaluatedProperties$9 = (dependentSchemas, instance, ast, dynamicAn
|
|
|
2150
3424
|
};
|
|
2151
3425
|
|
|
2152
3426
|
var dependentSchemas = { compile: compile$z, interpret: interpret$z, collectEvaluatedProperties: collectEvaluatedProperties$9 };
|
|
2153
|
-
dependentSchemas.compile;
|
|
2154
|
-
dependentSchemas.interpret;
|
|
2155
|
-
dependentSchemas.collectEvaluatedProperties;
|
|
2156
3427
|
|
|
2157
3428
|
const { Schema: Schema$B, Instance: Instance$r } = lib$1;
|
|
3429
|
+
const jsonStringify$1 = fastestStableStringify;
|
|
2158
3430
|
|
|
2159
3431
|
|
|
2160
|
-
|
|
2161
|
-
const
|
|
2162
|
-
const interpret$y = (enum_, instance) => enum_.some((enumValue) => fastestStableStringify(Instance$r.value(instance)) === enumValue);
|
|
3432
|
+
const compile$y = (schema) => Schema$B.value(schema).map(jsonStringify$1);
|
|
3433
|
+
const interpret$y = (enum_, instance) => enum_.some((enumValue) => jsonStringify$1(Instance$r.value(instance)) === enumValue);
|
|
2163
3434
|
|
|
2164
3435
|
var _enum = { compile: compile$y, interpret: interpret$y };
|
|
2165
|
-
_enum.compile;
|
|
2166
|
-
_enum.interpret;
|
|
2167
3436
|
|
|
2168
3437
|
const { Schema: Schema$A, Instance: Instance$q } = lib$1;
|
|
2169
3438
|
|
|
@@ -2172,8 +3441,6 @@ const compile$x = async (schema) => Schema$A.value(schema);
|
|
|
2172
3441
|
const interpret$x = (exclusiveMaximum, instance) => !Instance$q.typeOf(instance, "number") || Instance$q.value(instance) < exclusiveMaximum;
|
|
2173
3442
|
|
|
2174
3443
|
var exclusiveMaximum = { compile: compile$x, interpret: interpret$x };
|
|
2175
|
-
exclusiveMaximum.compile;
|
|
2176
|
-
exclusiveMaximum.interpret;
|
|
2177
3444
|
|
|
2178
3445
|
const { Schema: Schema$z, Instance: Instance$p } = lib$1;
|
|
2179
3446
|
|
|
@@ -2182,8 +3449,6 @@ const compile$w = async (schema) => Schema$z.value(schema);
|
|
|
2182
3449
|
const interpret$w = (exclusiveMinimum, instance) => !Instance$p.typeOf(instance, "number") || Instance$p.value(instance) > exclusiveMinimum;
|
|
2183
3450
|
|
|
2184
3451
|
var exclusiveMinimum = { compile: compile$w, interpret: interpret$w };
|
|
2185
|
-
exclusiveMinimum.compile;
|
|
2186
|
-
exclusiveMinimum.interpret;
|
|
2187
3452
|
|
|
2188
3453
|
const { Core: Core$k } = lib$1;
|
|
2189
3454
|
|
|
@@ -2204,10 +3469,6 @@ const collectEvaluatedItems$9 = (ifSchema, instance, ast, dynamicAnchors) => {
|
|
|
2204
3469
|
};
|
|
2205
3470
|
|
|
2206
3471
|
var _if = { compile: compile$v, interpret: interpret$v, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
|
|
2207
|
-
_if.compile;
|
|
2208
|
-
_if.interpret;
|
|
2209
|
-
_if.collectEvaluatedProperties;
|
|
2210
|
-
_if.collectEvaluatedItems;
|
|
2211
3472
|
|
|
2212
3473
|
const { Core: Core$j, Schema: Schema$y } = lib$1;
|
|
2213
3474
|
|
|
@@ -2252,10 +3513,6 @@ const collectEvaluatedItems$8 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
2252
3513
|
};
|
|
2253
3514
|
|
|
2254
3515
|
var then = { compile: compile$u, interpret: interpret$u, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
|
|
2255
|
-
then.compile;
|
|
2256
|
-
then.interpret;
|
|
2257
|
-
then.collectEvaluatedProperties;
|
|
2258
|
-
then.collectEvaluatedItems;
|
|
2259
3516
|
|
|
2260
3517
|
const { Core: Core$i, Schema: Schema$x } = lib$1;
|
|
2261
3518
|
|
|
@@ -2300,10 +3557,6 @@ const collectEvaluatedItems$7 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
2300
3557
|
};
|
|
2301
3558
|
|
|
2302
3559
|
var _else = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
|
|
2303
|
-
_else.compile;
|
|
2304
|
-
_else.interpret;
|
|
2305
|
-
_else.collectEvaluatedProperties;
|
|
2306
|
-
_else.collectEvaluatedItems;
|
|
2307
3560
|
|
|
2308
3561
|
const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$1;
|
|
2309
3562
|
|
|
@@ -2336,9 +3589,6 @@ const collectEvaluatedItems$6 = (items, instance, ast, dynamicAnchors) => {
|
|
|
2336
3589
|
};
|
|
2337
3590
|
|
|
2338
3591
|
var items = { compile: compile$s, interpret: interpret$s, collectEvaluatedItems: collectEvaluatedItems$6 };
|
|
2339
|
-
items.compile;
|
|
2340
|
-
items.interpret;
|
|
2341
|
-
items.collectEvaluatedItems;
|
|
2342
3592
|
|
|
2343
3593
|
const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$1;
|
|
2344
3594
|
|
|
@@ -2363,9 +3613,6 @@ const collectEvaluatedItems$5 = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
2363
3613
|
};
|
|
2364
3614
|
|
|
2365
3615
|
var items202012 = { compile: compile$r, interpret: interpret$r, collectEvaluatedItems: collectEvaluatedItems$5 };
|
|
2366
|
-
items202012.compile;
|
|
2367
|
-
items202012.interpret;
|
|
2368
|
-
items202012.collectEvaluatedItems;
|
|
2369
3616
|
|
|
2370
3617
|
const { Schema: Schema$u, Instance: Instance$m } = lib$1;
|
|
2371
3618
|
|
|
@@ -2374,8 +3621,6 @@ const compile$q = (schema) => Schema$u.value(schema);
|
|
|
2374
3621
|
const interpret$q = (maxItems, instance) => !Instance$m.typeOf(instance, "array") || Instance$m.length(instance) <= maxItems;
|
|
2375
3622
|
|
|
2376
3623
|
var maxItems = { compile: compile$q, interpret: interpret$q };
|
|
2377
|
-
maxItems.compile;
|
|
2378
|
-
maxItems.interpret;
|
|
2379
3624
|
|
|
2380
3625
|
const { Schema: Schema$t, Instance: Instance$l } = lib$1;
|
|
2381
3626
|
|
|
@@ -2384,8 +3629,6 @@ const compile$p = (schema) => Schema$t.value(schema);
|
|
|
2384
3629
|
const interpret$p = (maxLength, instance) => !Instance$l.typeOf(instance, "string") || Instance$l.length(instance) <= maxLength;
|
|
2385
3630
|
|
|
2386
3631
|
var maxLength = { compile: compile$p, interpret: interpret$p };
|
|
2387
|
-
maxLength.compile;
|
|
2388
|
-
maxLength.interpret;
|
|
2389
3632
|
|
|
2390
3633
|
const { Schema: Schema$s, Instance: Instance$k } = lib$1;
|
|
2391
3634
|
|
|
@@ -2394,8 +3637,6 @@ const compile$o = (schema) => Schema$s.value(schema);
|
|
|
2394
3637
|
const interpret$o = (maxLength, instance) => !Instance$k.typeOf(instance, "string") || [...Instance$k.value(instance)].length <= maxLength;
|
|
2395
3638
|
|
|
2396
3639
|
var maxLength6 = { compile: compile$o, interpret: interpret$o };
|
|
2397
|
-
maxLength6.compile;
|
|
2398
|
-
maxLength6.interpret;
|
|
2399
3640
|
|
|
2400
3641
|
const { Schema: Schema$r, Instance: Instance$j } = lib$1;
|
|
2401
3642
|
|
|
@@ -2404,8 +3645,6 @@ const compile$n = (schema) => Schema$r.value(schema);
|
|
|
2404
3645
|
const interpret$n = (maxProperties, instance) => !Instance$j.typeOf(instance, "object") || Instance$j.keys(instance).length <= maxProperties;
|
|
2405
3646
|
|
|
2406
3647
|
var maxProperties = { compile: compile$n, interpret: interpret$n };
|
|
2407
|
-
maxProperties.compile;
|
|
2408
|
-
maxProperties.interpret;
|
|
2409
3648
|
|
|
2410
3649
|
const { Schema: Schema$q, Instance: Instance$i } = lib$1;
|
|
2411
3650
|
|
|
@@ -2427,8 +3666,6 @@ const interpret$m = ([maximum, isExclusive], instance) => {
|
|
|
2427
3666
|
};
|
|
2428
3667
|
|
|
2429
3668
|
var maximumExclusiveMaximum = { compile: compile$m, interpret: interpret$m };
|
|
2430
|
-
maximumExclusiveMaximum.compile;
|
|
2431
|
-
maximumExclusiveMaximum.interpret;
|
|
2432
3669
|
|
|
2433
3670
|
const { Schema: Schema$p, Instance: Instance$h } = lib$1;
|
|
2434
3671
|
|
|
@@ -2437,8 +3674,6 @@ const compile$l = async (schema) => Schema$p.value(schema);
|
|
|
2437
3674
|
const interpret$l = (maximum, instance) => !Instance$h.typeOf(instance, "number") || Instance$h.value(instance) <= maximum;
|
|
2438
3675
|
|
|
2439
3676
|
var maximum = { compile: compile$l, interpret: interpret$l };
|
|
2440
|
-
maximum.compile;
|
|
2441
|
-
maximum.interpret;
|
|
2442
3677
|
|
|
2443
3678
|
const { Schema: Schema$o, Instance: Instance$g } = lib$1;
|
|
2444
3679
|
|
|
@@ -2447,8 +3682,6 @@ const compile$k = (schema) => Schema$o.value(schema);
|
|
|
2447
3682
|
const interpret$k = (minItems, instance) => !Instance$g.typeOf(instance, "array") || Instance$g.length(instance) >= minItems;
|
|
2448
3683
|
|
|
2449
3684
|
var minItems = { compile: compile$k, interpret: interpret$k };
|
|
2450
|
-
minItems.compile;
|
|
2451
|
-
minItems.interpret;
|
|
2452
3685
|
|
|
2453
3686
|
const { Schema: Schema$n, Instance: Instance$f } = lib$1;
|
|
2454
3687
|
|
|
@@ -2457,8 +3690,6 @@ const compile$j = (schema) => Schema$n.value(schema);
|
|
|
2457
3690
|
const interpret$j = (minLength, instance) => !Instance$f.typeOf(instance, "string") || Instance$f.length(instance) >= minLength;
|
|
2458
3691
|
|
|
2459
3692
|
var minLength = { compile: compile$j, interpret: interpret$j };
|
|
2460
|
-
minLength.compile;
|
|
2461
|
-
minLength.interpret;
|
|
2462
3693
|
|
|
2463
3694
|
const { Schema: Schema$m, Instance: Instance$e } = lib$1;
|
|
2464
3695
|
|
|
@@ -2467,8 +3698,6 @@ const compile$i = (schema) => Schema$m.value(schema);
|
|
|
2467
3698
|
const interpret$i = (minLength, instance) => !Instance$e.typeOf(instance, "string") || [...Instance$e.value(instance)].length >= minLength;
|
|
2468
3699
|
|
|
2469
3700
|
var minLength6 = { compile: compile$i, interpret: interpret$i };
|
|
2470
|
-
minLength6.compile;
|
|
2471
|
-
minLength6.interpret;
|
|
2472
3701
|
|
|
2473
3702
|
const { Schema: Schema$l, Instance: Instance$d } = lib$1;
|
|
2474
3703
|
|
|
@@ -2477,8 +3706,6 @@ const compile$h = (schema) => Schema$l.value(schema);
|
|
|
2477
3706
|
const interpret$h = (minProperties, instance) => !Instance$d.typeOf(instance, "object") || Instance$d.keys(instance).length >= minProperties;
|
|
2478
3707
|
|
|
2479
3708
|
var minProperties = { compile: compile$h, interpret: interpret$h };
|
|
2480
|
-
minProperties.compile;
|
|
2481
|
-
minProperties.interpret;
|
|
2482
3709
|
|
|
2483
3710
|
const { Schema: Schema$k, Instance: Instance$c } = lib$1;
|
|
2484
3711
|
|
|
@@ -2500,8 +3727,6 @@ const interpret$g = ([minimum, isExclusive], instance) => {
|
|
|
2500
3727
|
};
|
|
2501
3728
|
|
|
2502
3729
|
var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
|
|
2503
|
-
minimumExclusiveMinimum.compile;
|
|
2504
|
-
minimumExclusiveMinimum.interpret;
|
|
2505
3730
|
|
|
2506
3731
|
const { Schema: Schema$j, Instance: Instance$b } = lib$1;
|
|
2507
3732
|
|
|
@@ -2510,8 +3735,6 @@ const compile$f = async (schema) => Schema$j.value(schema);
|
|
|
2510
3735
|
const interpret$f = (minimum, instance) => !Instance$b.typeOf(instance, "number") || Instance$b.value(instance) >= minimum;
|
|
2511
3736
|
|
|
2512
3737
|
var minimum = { compile: compile$f, interpret: interpret$f };
|
|
2513
|
-
minimum.compile;
|
|
2514
|
-
minimum.interpret;
|
|
2515
3738
|
|
|
2516
3739
|
const { Schema: Schema$i, Instance: Instance$a } = lib$1;
|
|
2517
3740
|
|
|
@@ -2530,8 +3753,6 @@ const interpret$e = (multipleOf, instance) => {
|
|
|
2530
3753
|
const numberEqual = (a, b) => Math.abs(a - b) < 1.19209290e-7;
|
|
2531
3754
|
|
|
2532
3755
|
var multipleOf = { compile: compile$e, interpret: interpret$e };
|
|
2533
|
-
multipleOf.compile;
|
|
2534
|
-
multipleOf.interpret;
|
|
2535
3756
|
|
|
2536
3757
|
const { Core: Core$f } = lib$1;
|
|
2537
3758
|
|
|
@@ -2540,8 +3761,6 @@ const compile$d = Core$f.compileSchema;
|
|
|
2540
3761
|
const interpret$d = (not, instance, ast, dynamicAnchors) => !Core$f.interpretSchema(not, instance, ast, dynamicAnchors);
|
|
2541
3762
|
|
|
2542
3763
|
var not = { compile: compile$d, interpret: interpret$d };
|
|
2543
|
-
not.compile;
|
|
2544
|
-
not.interpret;
|
|
2545
3764
|
|
|
2546
3765
|
const { Core: Core$e, Schema: Schema$h } = lib$1;
|
|
2547
3766
|
|
|
@@ -2591,10 +3810,6 @@ const collectEvaluatedItems$4 = (oneOf, instance, ast, dynamicAnchors) => {
|
|
|
2591
3810
|
};
|
|
2592
3811
|
|
|
2593
3812
|
var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
|
|
2594
|
-
oneOf.compile;
|
|
2595
|
-
oneOf.interpret;
|
|
2596
|
-
oneOf.collectEvaluatedProperties;
|
|
2597
|
-
oneOf.collectEvaluatedItems;
|
|
2598
3813
|
|
|
2599
3814
|
const { Schema: Schema$g, Instance: Instance$9 } = lib$1;
|
|
2600
3815
|
|
|
@@ -2603,17 +3818,15 @@ const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
|
|
|
2603
3818
|
const interpret$b = (pattern, instance) => !Instance$9.typeOf(instance, "string") || pattern.test(Instance$9.value(instance));
|
|
2604
3819
|
|
|
2605
3820
|
var pattern = { compile: compile$b, interpret: interpret$b };
|
|
2606
|
-
pattern.compile;
|
|
2607
|
-
pattern.interpret;
|
|
2608
3821
|
|
|
2609
3822
|
const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$1;
|
|
3823
|
+
const Pact$2 = lib$2;
|
|
2610
3824
|
|
|
2611
3825
|
|
|
2612
|
-
|
|
2613
|
-
const compile$a = (schema, ast) => lib$2.pipeline([
|
|
3826
|
+
const compile$a = (schema, ast) => Pact$2.pipeline([
|
|
2614
3827
|
Schema$f.entries,
|
|
2615
|
-
|
|
2616
|
-
|
|
3828
|
+
Pact$2.map(async ([pattern, propertySchema]) => [new RegExp(pattern, "u"), await Core$d.compileSchema(propertySchema, ast)]),
|
|
3829
|
+
Pact$2.all
|
|
2617
3830
|
], schema);
|
|
2618
3831
|
|
|
2619
3832
|
const interpret$a = (patternProperties, instance, ast, dynamicAnchors) => {
|
|
@@ -2629,9 +3842,6 @@ const collectEvaluatedProperties$4 = (patternProperties, instance, ast, dynamicA
|
|
|
2629
3842
|
};
|
|
2630
3843
|
|
|
2631
3844
|
var patternProperties = { compile: compile$a, interpret: interpret$a, collectEvaluatedProperties: collectEvaluatedProperties$4 };
|
|
2632
|
-
patternProperties.compile;
|
|
2633
|
-
patternProperties.interpret;
|
|
2634
|
-
patternProperties.collectEvaluatedProperties;
|
|
2635
3845
|
|
|
2636
3846
|
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
2637
3847
|
const escapeRegExp$1 = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -2648,13 +3858,13 @@ const splitUrl$1 = (url) => {
|
|
|
2648
3858
|
var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
|
|
2649
3859
|
|
|
2650
3860
|
const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$1;
|
|
2651
|
-
|
|
3861
|
+
const Pact$1 = lib$2;
|
|
2652
3862
|
const { escapeRegExp } = common;
|
|
2653
3863
|
|
|
2654
3864
|
|
|
2655
|
-
const compile$9 = (schema, ast) =>
|
|
3865
|
+
const compile$9 = (schema, ast) => Pact$1.pipeline([
|
|
2656
3866
|
Schema$e.entries,
|
|
2657
|
-
|
|
3867
|
+
Pact$1.reduce(async (acc, [propertyName, propertySchema]) => {
|
|
2658
3868
|
acc[propertyName] = await Core$c.compileSchema(propertySchema, ast);
|
|
2659
3869
|
return acc;
|
|
2660
3870
|
}, Object.create(null))
|
|
@@ -2672,9 +3882,6 @@ const collectEvaluatedProperties$3 = (properties, instance, ast, dynamicAnchors)
|
|
|
2672
3882
|
};
|
|
2673
3883
|
|
|
2674
3884
|
var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
|
|
2675
|
-
properties.compile;
|
|
2676
|
-
properties.interpret;
|
|
2677
|
-
properties.collectEvaluatedProperties;
|
|
2678
3885
|
|
|
2679
3886
|
const { Core: Core$b, Instance: Instance$6 } = lib$1;
|
|
2680
3887
|
|
|
@@ -2687,8 +3894,6 @@ const interpret$8 = (propertyNames, instance, ast, dynamicAnchors) => {
|
|
|
2687
3894
|
};
|
|
2688
3895
|
|
|
2689
3896
|
var propertyNames = { compile: compile$8, interpret: interpret$8 };
|
|
2690
|
-
propertyNames.compile;
|
|
2691
|
-
propertyNames.interpret;
|
|
2692
3897
|
|
|
2693
3898
|
const { Core: Core$a, Schema: Schema$d } = lib$1;
|
|
2694
3899
|
const { splitUrl } = common;
|
|
@@ -2714,10 +3919,6 @@ const collectEvaluatedProperties$2 = Core$a.collectEvaluatedProperties;
|
|
|
2714
3919
|
const collectEvaluatedItems$3 = Core$a.collectEvaluatedItems;
|
|
2715
3920
|
|
|
2716
3921
|
var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
|
|
2717
|
-
dynamicRef.compile;
|
|
2718
|
-
dynamicRef.interpret;
|
|
2719
|
-
dynamicRef.collectEvaluatedProperties;
|
|
2720
|
-
dynamicRef.collectEvaluatedItems;
|
|
2721
3922
|
|
|
2722
3923
|
const { Core: Core$9, Schema: Schema$c } = lib$1;
|
|
2723
3924
|
|
|
@@ -2732,10 +3933,6 @@ const collectEvaluatedProperties$1 = Core$9.collectEvaluatedProperties;
|
|
|
2732
3933
|
const collectEvaluatedItems$2 = Core$9.collectEvaluatedItems;
|
|
2733
3934
|
|
|
2734
3935
|
var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
|
|
2735
|
-
ref.compile;
|
|
2736
|
-
ref.interpret;
|
|
2737
|
-
ref.collectEvaluatedProperties;
|
|
2738
|
-
ref.collectEvaluatedItems;
|
|
2739
3936
|
|
|
2740
3937
|
const { Schema: Schema$b, Instance: Instance$5 } = lib$1;
|
|
2741
3938
|
|
|
@@ -2747,17 +3944,15 @@ const interpret$5 = (required, instance) => {
|
|
|
2747
3944
|
};
|
|
2748
3945
|
|
|
2749
3946
|
var required = { compile: compile$5, interpret: interpret$5 };
|
|
2750
|
-
required.compile;
|
|
2751
|
-
required.interpret;
|
|
2752
3947
|
|
|
2753
3948
|
const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$1;
|
|
2754
|
-
|
|
3949
|
+
const Pact = lib$2;
|
|
2755
3950
|
|
|
2756
3951
|
|
|
2757
3952
|
const compile$4 = (schema, ast) => {
|
|
2758
|
-
return
|
|
3953
|
+
return Pact.pipeline([
|
|
2759
3954
|
Schema$a.map((itemSchema) => Core$8.compileSchema(itemSchema, ast)),
|
|
2760
|
-
|
|
3955
|
+
Pact.all
|
|
2761
3956
|
], schema);
|
|
2762
3957
|
};
|
|
2763
3958
|
|
|
@@ -2774,9 +3969,6 @@ const collectEvaluatedItems$1 = (items, instance, ast, dynamicAnchors) => {
|
|
|
2774
3969
|
};
|
|
2775
3970
|
|
|
2776
3971
|
var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
|
|
2777
|
-
tupleItems.compile;
|
|
2778
|
-
tupleItems.interpret;
|
|
2779
|
-
tupleItems.collectEvaluatedItems;
|
|
2780
3972
|
|
|
2781
3973
|
const { Schema: Schema$9, Instance: Instance$3 } = lib$1;
|
|
2782
3974
|
|
|
@@ -2785,8 +3977,6 @@ const compile$3 = (schema) => Schema$9.value(schema);
|
|
|
2785
3977
|
const interpret$3 = (type, instance) => typeof type === "string" ? Instance$3.typeOf(instance, type) : type.some(Instance$3.typeOf(instance));
|
|
2786
3978
|
|
|
2787
3979
|
var type = { compile: compile$3, interpret: interpret$3 };
|
|
2788
|
-
type.compile;
|
|
2789
|
-
type.interpret;
|
|
2790
3980
|
|
|
2791
3981
|
const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$1;
|
|
2792
3982
|
|
|
@@ -2811,9 +4001,6 @@ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
|
2811
4001
|
};
|
|
2812
4002
|
|
|
2813
4003
|
var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
|
|
2814
|
-
unevaluatedItems.compile;
|
|
2815
|
-
unevaluatedItems.interpret;
|
|
2816
|
-
unevaluatedItems.collectEvaluatedItems;
|
|
2817
4004
|
|
|
2818
4005
|
const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$1;
|
|
2819
4006
|
|
|
@@ -2839,12 +4026,9 @@ const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors)
|
|
|
2839
4026
|
};
|
|
2840
4027
|
|
|
2841
4028
|
var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
|
|
2842
|
-
unevaluatedProperties.compile;
|
|
2843
|
-
unevaluatedProperties.interpret;
|
|
2844
|
-
unevaluatedProperties.collectEvaluatedProperties;
|
|
2845
4029
|
|
|
2846
4030
|
const { Schema: Schema$6, Instance } = lib$1;
|
|
2847
|
-
|
|
4031
|
+
const jsonStringify = fastestStableStringify;
|
|
2848
4032
|
|
|
2849
4033
|
|
|
2850
4034
|
const compile = (schema) => Schema$6.value(schema);
|
|
@@ -2854,18 +4038,16 @@ const interpret = (uniqueItems, instance) => {
|
|
|
2854
4038
|
return true;
|
|
2855
4039
|
}
|
|
2856
4040
|
|
|
2857
|
-
const normalizedItems = Instance.map((item) =>
|
|
4041
|
+
const normalizedItems = Instance.map((item) => jsonStringify(Instance.value(item)), instance);
|
|
2858
4042
|
return new Set(normalizedItems).size === normalizedItems.length;
|
|
2859
4043
|
};
|
|
2860
4044
|
|
|
2861
4045
|
var uniqueItems = { compile, interpret };
|
|
2862
|
-
uniqueItems.compile;
|
|
2863
|
-
uniqueItems.interpret;
|
|
2864
4046
|
|
|
2865
|
-
const { Keywords } = lib$1;
|
|
4047
|
+
const { Keywords: Keywords$1 } = lib$1;
|
|
2866
4048
|
|
|
2867
4049
|
|
|
2868
|
-
var keywords = {
|
|
4050
|
+
var keywords$5 = {
|
|
2869
4051
|
additionalItems: additionalItems,
|
|
2870
4052
|
additionalItems6: additionalItems6,
|
|
2871
4053
|
additionalProperties: additionalProperties,
|
|
@@ -2893,7 +4075,7 @@ var keywords = {
|
|
|
2893
4075
|
maxProperties: maxProperties,
|
|
2894
4076
|
maximumExclusiveMaximum: maximumExclusiveMaximum,
|
|
2895
4077
|
maximum: maximum,
|
|
2896
|
-
metaData: Keywords.metaData,
|
|
4078
|
+
metaData: Keywords$1.metaData,
|
|
2897
4079
|
minItems: minItems,
|
|
2898
4080
|
minLength: minLength,
|
|
2899
4081
|
minLength6: minLength6,
|
|
@@ -2915,54 +4097,8 @@ var keywords = {
|
|
|
2915
4097
|
unevaluatedItems: unevaluatedItems,
|
|
2916
4098
|
unevaluatedProperties: unevaluatedProperties,
|
|
2917
4099
|
uniqueItems: uniqueItems,
|
|
2918
|
-
validate: Keywords.validate
|
|
4100
|
+
validate: Keywords$1.validate
|
|
2919
4101
|
};
|
|
2920
|
-
keywords.additionalItems;
|
|
2921
|
-
keywords.additionalItems6;
|
|
2922
|
-
keywords.additionalProperties;
|
|
2923
|
-
keywords.additionalProperties6;
|
|
2924
|
-
keywords.allOf;
|
|
2925
|
-
keywords.anyOf;
|
|
2926
|
-
keywords.contains;
|
|
2927
|
-
keywords.containsMinContainsMaxContains;
|
|
2928
|
-
keywords.definitions;
|
|
2929
|
-
keywords.dependencies;
|
|
2930
|
-
keywords.dependentRequired;
|
|
2931
|
-
keywords.dependentSchemas;
|
|
2932
|
-
keywords.exclusiveMaximum;
|
|
2933
|
-
keywords.exclusiveMinimum;
|
|
2934
|
-
keywords.then;
|
|
2935
|
-
keywords.items;
|
|
2936
|
-
keywords.items202012;
|
|
2937
|
-
keywords.maxItems;
|
|
2938
|
-
keywords.maxLength;
|
|
2939
|
-
keywords.maxLength6;
|
|
2940
|
-
keywords.maxProperties;
|
|
2941
|
-
keywords.maximumExclusiveMaximum;
|
|
2942
|
-
keywords.maximum;
|
|
2943
|
-
keywords.metaData;
|
|
2944
|
-
keywords.minItems;
|
|
2945
|
-
keywords.minLength;
|
|
2946
|
-
keywords.minLength6;
|
|
2947
|
-
keywords.minProperties;
|
|
2948
|
-
keywords.minimumExclusiveMinimum;
|
|
2949
|
-
keywords.minimum;
|
|
2950
|
-
keywords.multipleOf;
|
|
2951
|
-
keywords.not;
|
|
2952
|
-
keywords.oneOf;
|
|
2953
|
-
keywords.pattern;
|
|
2954
|
-
keywords.patternProperties;
|
|
2955
|
-
keywords.properties;
|
|
2956
|
-
keywords.propertyNames;
|
|
2957
|
-
keywords.dynamicRef;
|
|
2958
|
-
keywords.ref;
|
|
2959
|
-
keywords.required;
|
|
2960
|
-
keywords.tupleItems;
|
|
2961
|
-
keywords.type;
|
|
2962
|
-
keywords.unevaluatedItems;
|
|
2963
|
-
keywords.unevaluatedProperties;
|
|
2964
|
-
keywords.uniqueItems;
|
|
2965
|
-
keywords.validate;
|
|
2966
4102
|
|
|
2967
4103
|
var schema$4 = `{
|
|
2968
4104
|
"id": "http://json-schema.org/draft-04/schema#",
|
|
@@ -3115,50 +4251,50 @@ var schema$4 = `{
|
|
|
3115
4251
|
}`;
|
|
3116
4252
|
|
|
3117
4253
|
const { Core: Core$5, Schema: Schema$5 } = lib$1;
|
|
3118
|
-
|
|
3119
|
-
|
|
4254
|
+
const keywords$4 = keywords$5;
|
|
4255
|
+
const metaSchema$4 = schema$4;
|
|
3120
4256
|
|
|
3121
4257
|
|
|
3122
4258
|
// JSON Schema Draft-04
|
|
3123
|
-
const
|
|
3124
|
-
|
|
3125
|
-
Schema$5.setConfig(
|
|
3126
|
-
Schema$5.setConfig(
|
|
3127
|
-
Schema$5.setConfig(
|
|
3128
|
-
Schema$5.setConfig(
|
|
3129
|
-
|
|
3130
|
-
Schema$5.add(JSON.parse(
|
|
3131
|
-
Core$5.defineVocabulary(
|
|
3132
|
-
"validate": keywords.validate,
|
|
3133
|
-
"additionalItems": keywords.additionalItems,
|
|
3134
|
-
"additionalProperties": keywords.additionalProperties,
|
|
3135
|
-
"allOf": keywords.allOf,
|
|
3136
|
-
"anyOf": keywords.anyOf,
|
|
3137
|
-
"default": keywords.metaData,
|
|
3138
|
-
"definitions": keywords.definitions,
|
|
3139
|
-
"dependencies": keywords.dependencies,
|
|
3140
|
-
"description": keywords.metaData,
|
|
3141
|
-
"enum": keywords.enum,
|
|
3142
|
-
"format": keywords.metaData,
|
|
3143
|
-
"items": keywords.items,
|
|
3144
|
-
"maxItems": keywords.maxItems,
|
|
3145
|
-
"maxLength": keywords.maxLength,
|
|
3146
|
-
"maxProperties": keywords.maxProperties,
|
|
3147
|
-
"maximum": keywords.maximumExclusiveMaximum,
|
|
3148
|
-
"minItems": keywords.minItems,
|
|
3149
|
-
"minLength": keywords.minLength,
|
|
3150
|
-
"minProperties": keywords.minProperties,
|
|
3151
|
-
"minimum": keywords.minimumExclusiveMinimum,
|
|
3152
|
-
"multipleOf": keywords.multipleOf,
|
|
3153
|
-
"not": keywords.not,
|
|
3154
|
-
"oneOf": keywords.oneOf,
|
|
3155
|
-
"pattern": keywords.pattern,
|
|
3156
|
-
"patternProperties": keywords.patternProperties,
|
|
3157
|
-
"properties": keywords.properties,
|
|
3158
|
-
"required": keywords.required,
|
|
3159
|
-
"title": keywords.metaData,
|
|
3160
|
-
"type": keywords.type,
|
|
3161
|
-
"uniqueItems": keywords.uniqueItems
|
|
4259
|
+
const jsonSchemaVersion$4 = "http://json-schema.org/draft-04/schema";
|
|
4260
|
+
|
|
4261
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "baseToken", "id");
|
|
4262
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "embeddedToken", "id");
|
|
4263
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "anchorToken", "id");
|
|
4264
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "jrefToken", "$ref");
|
|
4265
|
+
|
|
4266
|
+
Schema$5.add(JSON.parse(metaSchema$4));
|
|
4267
|
+
Core$5.defineVocabulary(jsonSchemaVersion$4, {
|
|
4268
|
+
"validate": keywords$4.validate,
|
|
4269
|
+
"additionalItems": keywords$4.additionalItems,
|
|
4270
|
+
"additionalProperties": keywords$4.additionalProperties,
|
|
4271
|
+
"allOf": keywords$4.allOf,
|
|
4272
|
+
"anyOf": keywords$4.anyOf,
|
|
4273
|
+
"default": keywords$4.metaData,
|
|
4274
|
+
"definitions": keywords$4.definitions,
|
|
4275
|
+
"dependencies": keywords$4.dependencies,
|
|
4276
|
+
"description": keywords$4.metaData,
|
|
4277
|
+
"enum": keywords$4.enum,
|
|
4278
|
+
"format": keywords$4.metaData,
|
|
4279
|
+
"items": keywords$4.items,
|
|
4280
|
+
"maxItems": keywords$4.maxItems,
|
|
4281
|
+
"maxLength": keywords$4.maxLength,
|
|
4282
|
+
"maxProperties": keywords$4.maxProperties,
|
|
4283
|
+
"maximum": keywords$4.maximumExclusiveMaximum,
|
|
4284
|
+
"minItems": keywords$4.minItems,
|
|
4285
|
+
"minLength": keywords$4.minLength,
|
|
4286
|
+
"minProperties": keywords$4.minProperties,
|
|
4287
|
+
"minimum": keywords$4.minimumExclusiveMinimum,
|
|
4288
|
+
"multipleOf": keywords$4.multipleOf,
|
|
4289
|
+
"not": keywords$4.not,
|
|
4290
|
+
"oneOf": keywords$4.oneOf,
|
|
4291
|
+
"pattern": keywords$4.pattern,
|
|
4292
|
+
"patternProperties": keywords$4.patternProperties,
|
|
4293
|
+
"properties": keywords$4.properties,
|
|
4294
|
+
"required": keywords$4.required,
|
|
4295
|
+
"title": keywords$4.metaData,
|
|
4296
|
+
"type": keywords$4.type,
|
|
4297
|
+
"uniqueItems": keywords$4.uniqueItems
|
|
3162
4298
|
});
|
|
3163
4299
|
|
|
3164
4300
|
var schema$3 = `{
|
|
@@ -3317,55 +4453,55 @@ var schema$3 = `{
|
|
|
3317
4453
|
}`;
|
|
3318
4454
|
|
|
3319
4455
|
const { Core: Core$4, Schema: Schema$4 } = lib$1;
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
const
|
|
3325
|
-
|
|
3326
|
-
Schema$4.setConfig(
|
|
3327
|
-
Schema$4.setConfig(
|
|
3328
|
-
Schema$4.setConfig(
|
|
3329
|
-
Schema$4.setConfig(
|
|
3330
|
-
|
|
3331
|
-
Schema$4.add(JSON.parse(
|
|
3332
|
-
Core$4.defineVocabulary(
|
|
3333
|
-
"validate": keywords.validate,
|
|
3334
|
-
"additionalItems": keywords.additionalItems6,
|
|
3335
|
-
"additionalProperties": keywords.additionalProperties6,
|
|
3336
|
-
"allOf": keywords.allOf,
|
|
3337
|
-
"anyOf": keywords.anyOf,
|
|
3338
|
-
"const": keywords.const,
|
|
3339
|
-
"contains": keywords.contains,
|
|
3340
|
-
"default": keywords.metaData,
|
|
3341
|
-
"definitions": keywords.definitions,
|
|
3342
|
-
"dependencies": keywords.dependencies,
|
|
3343
|
-
"description": keywords.metaData,
|
|
3344
|
-
"enum": keywords.enum,
|
|
3345
|
-
"examples": keywords.metaData,
|
|
3346
|
-
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
3347
|
-
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
3348
|
-
"format": keywords.metaData,
|
|
3349
|
-
"items": keywords.items,
|
|
3350
|
-
"maxItems": keywords.maxItems,
|
|
3351
|
-
"maxLength": keywords.maxLength6,
|
|
3352
|
-
"maxProperties": keywords.maxProperties,
|
|
3353
|
-
"maximum": keywords.maximum,
|
|
3354
|
-
"minItems": keywords.minItems,
|
|
3355
|
-
"minLength": keywords.minLength6,
|
|
3356
|
-
"minProperties": keywords.minProperties,
|
|
3357
|
-
"minimum": keywords.minimum,
|
|
3358
|
-
"multipleOf": keywords.multipleOf,
|
|
3359
|
-
"not": keywords.not,
|
|
3360
|
-
"oneOf": keywords.oneOf,
|
|
3361
|
-
"pattern": keywords.pattern,
|
|
3362
|
-
"patternProperties": keywords.patternProperties,
|
|
3363
|
-
"properties": keywords.properties,
|
|
3364
|
-
"propertyNames": keywords.propertyNames,
|
|
3365
|
-
"required": keywords.required,
|
|
3366
|
-
"title": keywords.metaData,
|
|
3367
|
-
"type": keywords.type,
|
|
3368
|
-
"uniqueItems": keywords.uniqueItems
|
|
4456
|
+
const keywords$3 = keywords$5;
|
|
4457
|
+
const metaSchema$3 = schema$3;
|
|
4458
|
+
|
|
4459
|
+
|
|
4460
|
+
const jsonSchemaVersion$3 = "http://json-schema.org/draft-06/schema";
|
|
4461
|
+
|
|
4462
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "baseToken", "$id");
|
|
4463
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "embeddedToken", "$id");
|
|
4464
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "anchorToken", "$id");
|
|
4465
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "jrefToken", "$ref");
|
|
4466
|
+
|
|
4467
|
+
Schema$4.add(JSON.parse(metaSchema$3));
|
|
4468
|
+
Core$4.defineVocabulary(jsonSchemaVersion$3, {
|
|
4469
|
+
"validate": keywords$3.validate,
|
|
4470
|
+
"additionalItems": keywords$3.additionalItems6,
|
|
4471
|
+
"additionalProperties": keywords$3.additionalProperties6,
|
|
4472
|
+
"allOf": keywords$3.allOf,
|
|
4473
|
+
"anyOf": keywords$3.anyOf,
|
|
4474
|
+
"const": keywords$3.const,
|
|
4475
|
+
"contains": keywords$3.contains,
|
|
4476
|
+
"default": keywords$3.metaData,
|
|
4477
|
+
"definitions": keywords$3.definitions,
|
|
4478
|
+
"dependencies": keywords$3.dependencies,
|
|
4479
|
+
"description": keywords$3.metaData,
|
|
4480
|
+
"enum": keywords$3.enum,
|
|
4481
|
+
"examples": keywords$3.metaData,
|
|
4482
|
+
"exclusiveMaximum": keywords$3.exclusiveMaximum,
|
|
4483
|
+
"exclusiveMinimum": keywords$3.exclusiveMinimum,
|
|
4484
|
+
"format": keywords$3.metaData,
|
|
4485
|
+
"items": keywords$3.items,
|
|
4486
|
+
"maxItems": keywords$3.maxItems,
|
|
4487
|
+
"maxLength": keywords$3.maxLength6,
|
|
4488
|
+
"maxProperties": keywords$3.maxProperties,
|
|
4489
|
+
"maximum": keywords$3.maximum,
|
|
4490
|
+
"minItems": keywords$3.minItems,
|
|
4491
|
+
"minLength": keywords$3.minLength6,
|
|
4492
|
+
"minProperties": keywords$3.minProperties,
|
|
4493
|
+
"minimum": keywords$3.minimum,
|
|
4494
|
+
"multipleOf": keywords$3.multipleOf,
|
|
4495
|
+
"not": keywords$3.not,
|
|
4496
|
+
"oneOf": keywords$3.oneOf,
|
|
4497
|
+
"pattern": keywords$3.pattern,
|
|
4498
|
+
"patternProperties": keywords$3.patternProperties,
|
|
4499
|
+
"properties": keywords$3.properties,
|
|
4500
|
+
"propertyNames": keywords$3.propertyNames,
|
|
4501
|
+
"required": keywords$3.required,
|
|
4502
|
+
"title": keywords$3.metaData,
|
|
4503
|
+
"type": keywords$3.type,
|
|
4504
|
+
"uniqueItems": keywords$3.uniqueItems
|
|
3369
4505
|
});
|
|
3370
4506
|
|
|
3371
4507
|
var schema$2 = `{
|
|
@@ -3542,59 +4678,59 @@ var schema$2 = `{
|
|
|
3542
4678
|
}`;
|
|
3543
4679
|
|
|
3544
4680
|
const { Core: Core$3, Schema: Schema$3 } = lib$1;
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
const
|
|
3550
|
-
|
|
3551
|
-
Schema$3.setConfig(
|
|
3552
|
-
Schema$3.setConfig(
|
|
3553
|
-
Schema$3.setConfig(
|
|
3554
|
-
Schema$3.setConfig(
|
|
3555
|
-
|
|
3556
|
-
Schema$3.add(JSON.parse(
|
|
3557
|
-
Core$3.defineVocabulary(
|
|
3558
|
-
"validate": keywords.validate,
|
|
3559
|
-
"additionalItems": keywords.additionalItems6,
|
|
3560
|
-
"additionalProperties": keywords.additionalProperties6,
|
|
3561
|
-
"allOf": keywords.allOf,
|
|
3562
|
-
"anyOf": keywords.anyOf,
|
|
3563
|
-
"const": keywords.const,
|
|
3564
|
-
"contains": keywords.contains,
|
|
3565
|
-
"default": keywords.metaData,
|
|
3566
|
-
"definitions": keywords.definitions,
|
|
3567
|
-
"dependencies": keywords.dependencies,
|
|
3568
|
-
"description": keywords.metaData,
|
|
3569
|
-
"enum": keywords.enum,
|
|
3570
|
-
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
3571
|
-
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
3572
|
-
"format": keywords.metaData,
|
|
3573
|
-
"if": keywords.if,
|
|
3574
|
-
"then": keywords.then,
|
|
3575
|
-
"else": keywords.else,
|
|
3576
|
-
"items": keywords.items,
|
|
3577
|
-
"maxItems": keywords.maxItems,
|
|
3578
|
-
"maxLength": keywords.maxLength6,
|
|
3579
|
-
"maxProperties": keywords.maxProperties,
|
|
3580
|
-
"maximum": keywords.maximum,
|
|
3581
|
-
"minItems": keywords.minItems,
|
|
3582
|
-
"minLength": keywords.minLength6,
|
|
3583
|
-
"minProperties": keywords.minProperties,
|
|
3584
|
-
"minimum": keywords.minimum,
|
|
3585
|
-
"multipleOf": keywords.multipleOf,
|
|
3586
|
-
"not": keywords.not,
|
|
3587
|
-
"oneOf": keywords.oneOf,
|
|
3588
|
-
"pattern": keywords.pattern,
|
|
3589
|
-
"patternProperties": keywords.patternProperties,
|
|
3590
|
-
"properties": keywords.properties,
|
|
3591
|
-
"propertyNames": keywords.propertyNames,
|
|
3592
|
-
"readOnly": keywords.metaData,
|
|
3593
|
-
"required": keywords.required,
|
|
3594
|
-
"title": keywords.metaData,
|
|
3595
|
-
"type": keywords.type,
|
|
3596
|
-
"uniqueItems": keywords.uniqueItems,
|
|
3597
|
-
"writeOnly": keywords.metaData
|
|
4681
|
+
const keywords$2 = keywords$5;
|
|
4682
|
+
const metaSchema$2 = schema$2;
|
|
4683
|
+
|
|
4684
|
+
|
|
4685
|
+
const jsonSchemaVersion$2 = "http://json-schema.org/draft-07/schema";
|
|
4686
|
+
|
|
4687
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "baseToken", "$id");
|
|
4688
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "embeddedToken", "$id");
|
|
4689
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "anchorToken", "$id");
|
|
4690
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "jrefToken", "$ref");
|
|
4691
|
+
|
|
4692
|
+
Schema$3.add(JSON.parse(metaSchema$2));
|
|
4693
|
+
Core$3.defineVocabulary(jsonSchemaVersion$2, {
|
|
4694
|
+
"validate": keywords$2.validate,
|
|
4695
|
+
"additionalItems": keywords$2.additionalItems6,
|
|
4696
|
+
"additionalProperties": keywords$2.additionalProperties6,
|
|
4697
|
+
"allOf": keywords$2.allOf,
|
|
4698
|
+
"anyOf": keywords$2.anyOf,
|
|
4699
|
+
"const": keywords$2.const,
|
|
4700
|
+
"contains": keywords$2.contains,
|
|
4701
|
+
"default": keywords$2.metaData,
|
|
4702
|
+
"definitions": keywords$2.definitions,
|
|
4703
|
+
"dependencies": keywords$2.dependencies,
|
|
4704
|
+
"description": keywords$2.metaData,
|
|
4705
|
+
"enum": keywords$2.enum,
|
|
4706
|
+
"exclusiveMaximum": keywords$2.exclusiveMaximum,
|
|
4707
|
+
"exclusiveMinimum": keywords$2.exclusiveMinimum,
|
|
4708
|
+
"format": keywords$2.metaData,
|
|
4709
|
+
"if": keywords$2.if,
|
|
4710
|
+
"then": keywords$2.then,
|
|
4711
|
+
"else": keywords$2.else,
|
|
4712
|
+
"items": keywords$2.items,
|
|
4713
|
+
"maxItems": keywords$2.maxItems,
|
|
4714
|
+
"maxLength": keywords$2.maxLength6,
|
|
4715
|
+
"maxProperties": keywords$2.maxProperties,
|
|
4716
|
+
"maximum": keywords$2.maximum,
|
|
4717
|
+
"minItems": keywords$2.minItems,
|
|
4718
|
+
"minLength": keywords$2.minLength6,
|
|
4719
|
+
"minProperties": keywords$2.minProperties,
|
|
4720
|
+
"minimum": keywords$2.minimum,
|
|
4721
|
+
"multipleOf": keywords$2.multipleOf,
|
|
4722
|
+
"not": keywords$2.not,
|
|
4723
|
+
"oneOf": keywords$2.oneOf,
|
|
4724
|
+
"pattern": keywords$2.pattern,
|
|
4725
|
+
"patternProperties": keywords$2.patternProperties,
|
|
4726
|
+
"properties": keywords$2.properties,
|
|
4727
|
+
"propertyNames": keywords$2.propertyNames,
|
|
4728
|
+
"readOnly": keywords$2.metaData,
|
|
4729
|
+
"required": keywords$2.required,
|
|
4730
|
+
"title": keywords$2.metaData,
|
|
4731
|
+
"type": keywords$2.type,
|
|
4732
|
+
"uniqueItems": keywords$2.uniqueItems,
|
|
4733
|
+
"writeOnly": keywords$2.metaData
|
|
3598
4734
|
});
|
|
3599
4735
|
|
|
3600
4736
|
var schema$1 = `{
|
|
@@ -3925,96 +5061,96 @@ var content$1 = `{
|
|
|
3925
5061
|
}`;
|
|
3926
5062
|
|
|
3927
5063
|
const { Core: Core$2, Schema: Schema$2 } = lib$1;
|
|
5064
|
+
const keywords$1 = keywords$5;
|
|
5065
|
+
const metaSchema$1 = schema$1;
|
|
5066
|
+
const coreMetaSchema$1 = core$1;
|
|
5067
|
+
const applicatorMetaSchema$1 = applicator$1;
|
|
5068
|
+
const validationMetaSchema$1 = validation$1;
|
|
5069
|
+
const metaDataMetaSchema$1 = metaData$1;
|
|
5070
|
+
const formatMetaSchema = format;
|
|
5071
|
+
const contentMetaSchema$1 = content$1;
|
|
3928
5072
|
|
|
3929
5073
|
|
|
5074
|
+
const jsonSchemaVersion$1 = "https://json-schema.org/draft/2019-09/vocab/core";
|
|
3930
5075
|
|
|
5076
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "baseToken", "$id");
|
|
5077
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "embeddedToken", "$id");
|
|
5078
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "anchorToken", "$anchor");
|
|
5079
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "recursiveAnchorToken", "$recursiveAnchor");
|
|
5080
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "vocabularyToken", "$vocabulary");
|
|
5081
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "mandatoryVocabularies", ["https://json-schema.org/draft/2019-09/vocab/core"]);
|
|
3931
5082
|
|
|
5083
|
+
Schema$2.add(JSON.parse(metaSchema$1));
|
|
3932
5084
|
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
const schemaVersion$1 = "https://json-schema.org/draft/2019-09/schema";
|
|
3939
|
-
|
|
3940
|
-
Schema$2.setConfig(schemaVersion$1, "baseToken", "$id");
|
|
3941
|
-
Schema$2.setConfig(schemaVersion$1, "embeddedToken", "$id");
|
|
3942
|
-
Schema$2.setConfig(schemaVersion$1, "anchorToken", "$anchor");
|
|
3943
|
-
Schema$2.setConfig(schemaVersion$1, "recursiveAnchorToken", "$recursiveAnchor");
|
|
3944
|
-
Schema$2.setConfig(schemaVersion$1, "vocabularyToken", "$vocabulary");
|
|
3945
|
-
Schema$2.setConfig(schemaVersion$1, "mandatoryVocabularies", ["https://json-schema.org/draft/2019-09/vocab/core"]);
|
|
3946
|
-
|
|
3947
|
-
Schema$2.add(JSON.parse(schema$1));
|
|
3948
|
-
|
|
3949
|
-
Schema$2.add(JSON.parse(core$1));
|
|
5085
|
+
Schema$2.add(JSON.parse(coreMetaSchema$1));
|
|
3950
5086
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/core", {
|
|
3951
|
-
"validate": keywords.validate,
|
|
3952
|
-
"$defs": keywords.definitions,
|
|
3953
|
-
"$recursiveRef": keywords.dynamicRef,
|
|
3954
|
-
"$ref": keywords.ref
|
|
5087
|
+
"validate": keywords$1.validate,
|
|
5088
|
+
"$defs": keywords$1.definitions,
|
|
5089
|
+
"$recursiveRef": keywords$1.dynamicRef,
|
|
5090
|
+
"$ref": keywords$1.ref
|
|
3955
5091
|
});
|
|
3956
5092
|
|
|
3957
|
-
Schema$2.add(JSON.parse(
|
|
5093
|
+
Schema$2.add(JSON.parse(applicatorMetaSchema$1));
|
|
3958
5094
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/applicator", {
|
|
3959
|
-
"additionalItems": keywords.additionalItems6,
|
|
3960
|
-
"additionalProperties": keywords.additionalProperties6,
|
|
3961
|
-
"allOf": keywords.allOf,
|
|
3962
|
-
"anyOf": keywords.anyOf,
|
|
3963
|
-
"contains": keywords.containsMinContainsMaxContains,
|
|
3964
|
-
"dependentSchemas": keywords.dependentSchemas,
|
|
3965
|
-
"if": keywords.if,
|
|
3966
|
-
"then": keywords.then,
|
|
3967
|
-
"else": keywords.else,
|
|
3968
|
-
"items": keywords.items,
|
|
3969
|
-
"not": keywords.not,
|
|
3970
|
-
"oneOf": keywords.oneOf,
|
|
3971
|
-
"patternProperties": keywords.patternProperties,
|
|
3972
|
-
"properties": keywords.properties,
|
|
3973
|
-
"propertyNames": keywords.propertyNames,
|
|
3974
|
-
"unevaluatedItems": keywords.unevaluatedItems,
|
|
3975
|
-
"unevaluatedProperties": keywords.unevaluatedProperties
|
|
5095
|
+
"additionalItems": keywords$1.additionalItems6,
|
|
5096
|
+
"additionalProperties": keywords$1.additionalProperties6,
|
|
5097
|
+
"allOf": keywords$1.allOf,
|
|
5098
|
+
"anyOf": keywords$1.anyOf,
|
|
5099
|
+
"contains": keywords$1.containsMinContainsMaxContains,
|
|
5100
|
+
"dependentSchemas": keywords$1.dependentSchemas,
|
|
5101
|
+
"if": keywords$1.if,
|
|
5102
|
+
"then": keywords$1.then,
|
|
5103
|
+
"else": keywords$1.else,
|
|
5104
|
+
"items": keywords$1.items,
|
|
5105
|
+
"not": keywords$1.not,
|
|
5106
|
+
"oneOf": keywords$1.oneOf,
|
|
5107
|
+
"patternProperties": keywords$1.patternProperties,
|
|
5108
|
+
"properties": keywords$1.properties,
|
|
5109
|
+
"propertyNames": keywords$1.propertyNames,
|
|
5110
|
+
"unevaluatedItems": keywords$1.unevaluatedItems,
|
|
5111
|
+
"unevaluatedProperties": keywords$1.unevaluatedProperties
|
|
3976
5112
|
});
|
|
3977
5113
|
|
|
3978
|
-
Schema$2.add(JSON.parse(
|
|
5114
|
+
Schema$2.add(JSON.parse(validationMetaSchema$1));
|
|
3979
5115
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/validation", {
|
|
3980
|
-
"const": keywords.const,
|
|
3981
|
-
"dependentRequired": keywords.dependentRequired,
|
|
3982
|
-
"enum": keywords.enum,
|
|
3983
|
-
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
3984
|
-
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
3985
|
-
"maxItems": keywords.maxItems,
|
|
3986
|
-
"maxLength": keywords.maxLength6,
|
|
3987
|
-
"maxProperties": keywords.maxProperties,
|
|
3988
|
-
"maximum": keywords.maximum,
|
|
3989
|
-
"minItems": keywords.minItems,
|
|
3990
|
-
"minLength": keywords.minLength6,
|
|
3991
|
-
"minProperties": keywords.minProperties,
|
|
3992
|
-
"minimum": keywords.minimum,
|
|
3993
|
-
"multipleOf": keywords.multipleOf,
|
|
3994
|
-
"pattern": keywords.pattern,
|
|
3995
|
-
"required": keywords.required,
|
|
3996
|
-
"type": keywords.type,
|
|
3997
|
-
"uniqueItems": keywords.uniqueItems
|
|
5116
|
+
"const": keywords$1.const,
|
|
5117
|
+
"dependentRequired": keywords$1.dependentRequired,
|
|
5118
|
+
"enum": keywords$1.enum,
|
|
5119
|
+
"exclusiveMaximum": keywords$1.exclusiveMaximum,
|
|
5120
|
+
"exclusiveMinimum": keywords$1.exclusiveMinimum,
|
|
5121
|
+
"maxItems": keywords$1.maxItems,
|
|
5122
|
+
"maxLength": keywords$1.maxLength6,
|
|
5123
|
+
"maxProperties": keywords$1.maxProperties,
|
|
5124
|
+
"maximum": keywords$1.maximum,
|
|
5125
|
+
"minItems": keywords$1.minItems,
|
|
5126
|
+
"minLength": keywords$1.minLength6,
|
|
5127
|
+
"minProperties": keywords$1.minProperties,
|
|
5128
|
+
"minimum": keywords$1.minimum,
|
|
5129
|
+
"multipleOf": keywords$1.multipleOf,
|
|
5130
|
+
"pattern": keywords$1.pattern,
|
|
5131
|
+
"required": keywords$1.required,
|
|
5132
|
+
"type": keywords$1.type,
|
|
5133
|
+
"uniqueItems": keywords$1.uniqueItems
|
|
3998
5134
|
});
|
|
3999
5135
|
|
|
4000
|
-
Schema$2.add(JSON.parse(
|
|
5136
|
+
Schema$2.add(JSON.parse(metaDataMetaSchema$1));
|
|
4001
5137
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/meta-data", {
|
|
4002
|
-
"default": keywords.metaData,
|
|
4003
|
-
"deprecated": keywords.metaData,
|
|
4004
|
-
"description": keywords.metaData,
|
|
4005
|
-
"examples": keywords.metaData,
|
|
4006
|
-
"readOnly": keywords.metaData,
|
|
4007
|
-
"title": keywords.metaData,
|
|
4008
|
-
"writeOnly": keywords.metaData
|
|
5138
|
+
"default": keywords$1.metaData,
|
|
5139
|
+
"deprecated": keywords$1.metaData,
|
|
5140
|
+
"description": keywords$1.metaData,
|
|
5141
|
+
"examples": keywords$1.metaData,
|
|
5142
|
+
"readOnly": keywords$1.metaData,
|
|
5143
|
+
"title": keywords$1.metaData,
|
|
5144
|
+
"writeOnly": keywords$1.metaData
|
|
4009
5145
|
});
|
|
4010
5146
|
|
|
4011
|
-
Schema$2.add(JSON.parse(
|
|
5147
|
+
Schema$2.add(JSON.parse(formatMetaSchema));
|
|
4012
5148
|
|
|
4013
|
-
Schema$2.add(JSON.parse(
|
|
5149
|
+
Schema$2.add(JSON.parse(contentMetaSchema$1));
|
|
4014
5150
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/content", {
|
|
4015
|
-
"contentEncoding": keywords.metaData,
|
|
4016
|
-
"contentMediaType": keywords.metaData,
|
|
4017
|
-
"contentSchema": keywords.metaData
|
|
5151
|
+
"contentEncoding": keywords$1.metaData,
|
|
5152
|
+
"contentMediaType": keywords$1.metaData,
|
|
5153
|
+
"contentSchema": keywords$1.metaData
|
|
4018
5154
|
});
|
|
4019
5155
|
|
|
4020
5156
|
var schema = `{
|
|
@@ -4372,30 +5508,30 @@ var unevaluated = `{
|
|
|
4372
5508
|
}`;
|
|
4373
5509
|
|
|
4374
5510
|
const { Core: Core$1, Schema: Schema$1 } = lib$1;
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
const
|
|
4388
|
-
|
|
4389
|
-
Schema$1.setConfig(
|
|
4390
|
-
Schema$1.setConfig(
|
|
4391
|
-
Schema$1.setConfig(
|
|
4392
|
-
Schema$1.setConfig(
|
|
4393
|
-
Schema$1.setConfig(
|
|
4394
|
-
Schema$1.setConfig(
|
|
4395
|
-
|
|
4396
|
-
Schema$1.add(JSON.parse(
|
|
4397
|
-
|
|
4398
|
-
Schema$1.add(JSON.parse(
|
|
5511
|
+
const keywords = keywords$5;
|
|
5512
|
+
const metaSchema = schema;
|
|
5513
|
+
const coreMetaSchema = core;
|
|
5514
|
+
const applicatorMetaSchema = applicator;
|
|
5515
|
+
const validationMetaSchema = validation;
|
|
5516
|
+
const metaDataMetaSchema = metaData;
|
|
5517
|
+
const formatAnnotationMetaSchema = formatAnnotation;
|
|
5518
|
+
const formatAssertionMetaSchema = formatAssertion;
|
|
5519
|
+
const contentMetaSchema = content;
|
|
5520
|
+
const unevaluatedMetaSchema = unevaluated;
|
|
5521
|
+
|
|
5522
|
+
|
|
5523
|
+
const jsonSchemaVersion = "https://json-schema.org/draft/2020-12/vocab/core";
|
|
5524
|
+
|
|
5525
|
+
Schema$1.setConfig(jsonSchemaVersion, "baseToken", "$id");
|
|
5526
|
+
Schema$1.setConfig(jsonSchemaVersion, "embeddedToken", "$id");
|
|
5527
|
+
Schema$1.setConfig(jsonSchemaVersion, "anchorToken", "$anchor");
|
|
5528
|
+
Schema$1.setConfig(jsonSchemaVersion, "dynamicAnchorToken", "$dynamicAnchor");
|
|
5529
|
+
Schema$1.setConfig(jsonSchemaVersion, "vocabularyToken", "$vocabulary");
|
|
5530
|
+
Schema$1.setConfig(jsonSchemaVersion, "mandatoryVocabularies", ["https://json-schema.org/draft/2020-12/vocab/core"]);
|
|
5531
|
+
|
|
5532
|
+
Schema$1.add(JSON.parse(metaSchema));
|
|
5533
|
+
|
|
5534
|
+
Schema$1.add(JSON.parse(coreMetaSchema));
|
|
4399
5535
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/core", {
|
|
4400
5536
|
"validate": keywords.validate,
|
|
4401
5537
|
"$defs": keywords.definitions,
|
|
@@ -4403,7 +5539,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/core", {
|
|
|
4403
5539
|
"$ref": keywords.ref
|
|
4404
5540
|
});
|
|
4405
5541
|
|
|
4406
|
-
Schema$1.add(JSON.parse(
|
|
5542
|
+
Schema$1.add(JSON.parse(applicatorMetaSchema));
|
|
4407
5543
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/applicator", {
|
|
4408
5544
|
"additionalProperties": keywords.additionalProperties6,
|
|
4409
5545
|
"allOf": keywords.allOf,
|
|
@@ -4422,7 +5558,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/applicator"
|
|
|
4422
5558
|
"propertyNames": keywords.propertyNames
|
|
4423
5559
|
});
|
|
4424
5560
|
|
|
4425
|
-
Schema$1.add(JSON.parse(
|
|
5561
|
+
Schema$1.add(JSON.parse(validationMetaSchema));
|
|
4426
5562
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/validation", {
|
|
4427
5563
|
"const": keywords.const,
|
|
4428
5564
|
"dependentRequired": keywords.dependentRequired,
|
|
@@ -4444,7 +5580,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/validation"
|
|
|
4444
5580
|
"uniqueItems": keywords.uniqueItems
|
|
4445
5581
|
});
|
|
4446
5582
|
|
|
4447
|
-
Schema$1.add(JSON.parse(
|
|
5583
|
+
Schema$1.add(JSON.parse(metaDataMetaSchema));
|
|
4448
5584
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/meta-data", {
|
|
4449
5585
|
"default": keywords.metaData,
|
|
4450
5586
|
"deprecated": keywords.metaData,
|
|
@@ -4455,28 +5591,28 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/meta-data",
|
|
|
4455
5591
|
"writeOnly": keywords.metaData
|
|
4456
5592
|
});
|
|
4457
5593
|
|
|
4458
|
-
Schema$1.add(JSON.parse(
|
|
5594
|
+
Schema$1.add(JSON.parse(formatAnnotationMetaSchema));
|
|
4459
5595
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/format-annotation", {
|
|
4460
5596
|
"format": keywords.metaData
|
|
4461
5597
|
});
|
|
4462
5598
|
|
|
4463
|
-
Schema$1.add(JSON.parse(
|
|
5599
|
+
Schema$1.add(JSON.parse(formatAssertionMetaSchema));
|
|
4464
5600
|
|
|
4465
|
-
Schema$1.add(JSON.parse(
|
|
5601
|
+
Schema$1.add(JSON.parse(contentMetaSchema));
|
|
4466
5602
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/content", {
|
|
4467
5603
|
"contentEncoding": keywords.metaData,
|
|
4468
5604
|
"contentMediaType": keywords.metaData,
|
|
4469
5605
|
"contentSchema": keywords.metaData
|
|
4470
5606
|
});
|
|
4471
5607
|
|
|
4472
|
-
Schema$1.add(JSON.parse(
|
|
5608
|
+
Schema$1.add(JSON.parse(unevaluatedMetaSchema));
|
|
4473
5609
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/unevaluated", {
|
|
4474
5610
|
"unevaluatedItems": keywords.unevaluatedItems,
|
|
4475
5611
|
"unevaluatedProperties": keywords.unevaluatedProperties
|
|
4476
5612
|
});
|
|
4477
5613
|
|
|
4478
5614
|
const { Core, Schema, InvalidSchemaError } = lib$1;
|
|
4479
|
-
|
|
5615
|
+
const Keywords = keywords$5;
|
|
4480
5616
|
|
|
4481
5617
|
|
|
4482
5618
|
|
|
@@ -4497,35 +5633,9 @@ var lib = {
|
|
|
4497
5633
|
BASIC: Core.BASIC,
|
|
4498
5634
|
DETAILED: Core.DETAILED,
|
|
4499
5635
|
VERBOSE: Core.VERBOSE,
|
|
4500
|
-
Keywords:
|
|
5636
|
+
Keywords: Keywords,
|
|
4501
5637
|
InvalidSchemaError: InvalidSchemaError
|
|
4502
5638
|
};
|
|
4503
|
-
|
|
4504
|
-
var lib_2 = lib.get;
|
|
4505
|
-
var lib_3 = lib.validate;
|
|
4506
|
-
var lib_4 = lib.compile;
|
|
4507
|
-
var lib_5 = lib.interpret;
|
|
4508
|
-
var lib_6 = lib.setMetaOutputFormat;
|
|
4509
|
-
var lib_7 = lib.setShouldMetaValidate;
|
|
4510
|
-
var lib_8 = lib.FLAG;
|
|
4511
|
-
var lib_9 = lib.BASIC;
|
|
4512
|
-
var lib_10 = lib.DETAILED;
|
|
4513
|
-
var lib_11 = lib.VERBOSE;
|
|
4514
|
-
var lib_12 = lib.Keywords;
|
|
4515
|
-
var lib_13 = lib.InvalidSchemaError;
|
|
4516
|
-
|
|
4517
|
-
exports.BASIC = lib_9;
|
|
4518
|
-
exports.DETAILED = lib_10;
|
|
4519
|
-
exports.FLAG = lib_8;
|
|
4520
|
-
exports.InvalidSchemaError = lib_13;
|
|
4521
|
-
exports.Keywords = lib_12;
|
|
4522
|
-
exports.VERBOSE = lib_11;
|
|
4523
|
-
exports.add = lib_1;
|
|
4524
|
-
exports.compile = lib_4;
|
|
5639
|
+
|
|
4525
5640
|
exports["default"] = lib;
|
|
4526
|
-
exports.get = lib_2;
|
|
4527
|
-
exports.interpret = lib_5;
|
|
4528
|
-
exports.setMetaOutputFormat = lib_6;
|
|
4529
|
-
exports.setShouldMetaValidate = lib_7;
|
|
4530
|
-
exports.validate = lib_3;
|
|
4531
5641
|
//# sourceMappingURL=json-schema-cjs.js.map
|