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