@hyperjump/json-schema 0.18.5 → 0.21.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 +38 -1
- package/dist/json-schema-amd.js +4217 -3188
- 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 +2388 -1359
- 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 +2389 -1347
- 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 +4221 -3192
- 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 +4220 -3178
- 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 +4220 -3191
- 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/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.mjs +1 -0
- package/package.json +19 -19
package/dist/json-schema-cjs.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
|
+
|
|
7
|
+
var justCurryIt = curry$a;
|
|
6
8
|
|
|
7
9
|
/*
|
|
8
10
|
function add(a, b, c) {
|
|
@@ -27,7 +29,7 @@ var justCurryIt = curry;
|
|
|
27
29
|
milesToKm(10); // 16.2
|
|
28
30
|
*/
|
|
29
31
|
|
|
30
|
-
function curry(fn, arity) {
|
|
32
|
+
function curry$a(fn, arity) {
|
|
31
33
|
return function curried() {
|
|
32
34
|
if (arity == null) {
|
|
33
35
|
arity = fn.length;
|
|
@@ -43,13 +45,8 @@ function curry(fn, arity) {
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
function createCommonjsModule(fn, module) {
|
|
49
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
50
|
-
}
|
|
48
|
+
var pubsub = {exports: {}};
|
|
51
49
|
|
|
52
|
-
var pubsub = createCommonjsModule(function (module, exports) {
|
|
53
50
|
/**
|
|
54
51
|
* Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk
|
|
55
52
|
* License: MIT - http://mrgnrdrck.mit-license.org
|
|
@@ -57,563 +54,1763 @@ var pubsub = createCommonjsModule(function (module, exports) {
|
|
|
57
54
|
* https://github.com/mroderick/PubSubJS
|
|
58
55
|
*/
|
|
59
56
|
|
|
60
|
-
(function (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
57
|
+
(function (module, exports) {
|
|
58
|
+
(function (root, factory){
|
|
59
|
+
|
|
60
|
+
var PubSub = {};
|
|
61
|
+
|
|
62
|
+
if (root.PubSub) {
|
|
63
|
+
PubSub = root.PubSub;
|
|
64
|
+
console.warn("PubSub already loaded, using existing version");
|
|
65
|
+
} else {
|
|
66
|
+
root.PubSub = PubSub;
|
|
67
|
+
factory(PubSub);
|
|
68
|
+
}
|
|
69
|
+
// CommonJS and Node.js module support
|
|
70
|
+
{
|
|
71
|
+
if (module !== undefined && module.exports) {
|
|
72
|
+
exports = module.exports = PubSub; // Node.js specific `module.exports`
|
|
73
|
+
}
|
|
74
|
+
exports.PubSub = PubSub; // CommonJS module 1.1.1 spec
|
|
75
|
+
module.exports = exports = PubSub; // CommonJS
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){
|
|
79
|
+
|
|
80
|
+
var messages = {},
|
|
81
|
+
lastUid = -1,
|
|
82
|
+
ALL_SUBSCRIBING_MSG = '*';
|
|
83
|
+
|
|
84
|
+
function hasKeys(obj){
|
|
85
|
+
var key;
|
|
86
|
+
|
|
87
|
+
for (key in obj){
|
|
88
|
+
if ( Object.prototype.hasOwnProperty.call(obj, key) ){
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns a function that throws the passed exception, for use as argument for setTimeout
|
|
97
|
+
* @alias throwException
|
|
98
|
+
* @function
|
|
99
|
+
* @param { Object } ex An Error object
|
|
100
|
+
*/
|
|
101
|
+
function throwException( ex ){
|
|
102
|
+
return function reThrowException(){
|
|
103
|
+
throw ex;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function callSubscriberWithDelayedExceptions( subscriber, message, data ){
|
|
108
|
+
try {
|
|
109
|
+
subscriber( message, data );
|
|
110
|
+
} catch( ex ){
|
|
111
|
+
setTimeout( throwException( ex ), 0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function callSubscriberWithImmediateExceptions( subscriber, message, data ){
|
|
116
|
+
subscriber( message, data );
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function deliverMessage( originalMessage, matchedMessage, data, immediateExceptions ){
|
|
120
|
+
var subscribers = messages[matchedMessage],
|
|
121
|
+
callSubscriber = immediateExceptions ? callSubscriberWithImmediateExceptions : callSubscriberWithDelayedExceptions,
|
|
122
|
+
s;
|
|
123
|
+
|
|
124
|
+
if ( !Object.prototype.hasOwnProperty.call( messages, matchedMessage ) ) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
for (s in subscribers){
|
|
129
|
+
if ( Object.prototype.hasOwnProperty.call(subscribers, s)){
|
|
130
|
+
callSubscriber( subscribers[s], originalMessage, data );
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function createDeliveryFunction( message, data, immediateExceptions ){
|
|
136
|
+
return function deliverNamespaced(){
|
|
137
|
+
var topic = String( message ),
|
|
138
|
+
position = topic.lastIndexOf( '.' );
|
|
139
|
+
|
|
140
|
+
// deliver the message as it is now
|
|
141
|
+
deliverMessage(message, message, data, immediateExceptions);
|
|
142
|
+
|
|
143
|
+
// trim the hierarchy and deliver message to each level
|
|
144
|
+
while( position !== -1 ){
|
|
145
|
+
topic = topic.substr( 0, position );
|
|
146
|
+
position = topic.lastIndexOf('.');
|
|
147
|
+
deliverMessage( message, topic, data, immediateExceptions );
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function hasDirectSubscribersFor( message ) {
|
|
155
|
+
var topic = String( message ),
|
|
156
|
+
found = Boolean(Object.prototype.hasOwnProperty.call( messages, topic ) && hasKeys(messages[topic]));
|
|
157
|
+
|
|
158
|
+
return found;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function messageHasSubscribers( message ){
|
|
162
|
+
var topic = String( message ),
|
|
163
|
+
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
|
|
164
|
+
position = topic.lastIndexOf( '.' );
|
|
165
|
+
|
|
166
|
+
while ( !found && position !== -1 ){
|
|
167
|
+
topic = topic.substr( 0, position );
|
|
168
|
+
position = topic.lastIndexOf( '.' );
|
|
169
|
+
found = hasDirectSubscribersFor(topic);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return found;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function publish( message, data, sync, immediateExceptions ){
|
|
176
|
+
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
177
|
+
|
|
178
|
+
var deliver = createDeliveryFunction( message, data, immediateExceptions ),
|
|
179
|
+
hasSubscribers = messageHasSubscribers( message );
|
|
180
|
+
|
|
181
|
+
if ( !hasSubscribers ){
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if ( sync === true ){
|
|
186
|
+
deliver();
|
|
187
|
+
} else {
|
|
188
|
+
setTimeout( deliver, 0 );
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Publishes the message, passing the data to it's subscribers
|
|
195
|
+
* @function
|
|
196
|
+
* @alias publish
|
|
197
|
+
* @param { String } message The message to publish
|
|
198
|
+
* @param {} data The data to pass to subscribers
|
|
199
|
+
* @return { Boolean }
|
|
200
|
+
*/
|
|
201
|
+
PubSub.publish = function( message, data ){
|
|
202
|
+
return publish( message, data, false, PubSub.immediateExceptions );
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Publishes the message synchronously, passing the data to it's subscribers
|
|
207
|
+
* @function
|
|
208
|
+
* @alias publishSync
|
|
209
|
+
* @param { String } message The message to publish
|
|
210
|
+
* @param {} data The data to pass to subscribers
|
|
211
|
+
* @return { Boolean }
|
|
212
|
+
*/
|
|
213
|
+
PubSub.publishSync = function( message, data ){
|
|
214
|
+
return publish( message, data, true, PubSub.immediateExceptions );
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Subscribes the passed function to the passed message. Every returned token is unique and should be stored if you need to unsubscribe
|
|
219
|
+
* @function
|
|
220
|
+
* @alias subscribe
|
|
221
|
+
* @param { String } message The message to subscribe to
|
|
222
|
+
* @param { Function } func The function to call when a new message is published
|
|
223
|
+
* @return { String }
|
|
224
|
+
*/
|
|
225
|
+
PubSub.subscribe = function( message, func ){
|
|
226
|
+
if ( typeof func !== 'function'){
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
231
|
+
|
|
232
|
+
// message is not registered yet
|
|
233
|
+
if ( !Object.prototype.hasOwnProperty.call( messages, message ) ){
|
|
234
|
+
messages[message] = {};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// forcing token as String, to allow for future expansions without breaking usage
|
|
238
|
+
// and allow for easy use as key names for the 'messages' object
|
|
239
|
+
var token = 'uid_' + String(++lastUid);
|
|
240
|
+
messages[message][token] = func;
|
|
241
|
+
|
|
242
|
+
// return token for unsubscribing
|
|
243
|
+
return token;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
PubSub.subscribeAll = function( func ){
|
|
247
|
+
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Subscribes the passed function to the passed message once
|
|
252
|
+
* @function
|
|
253
|
+
* @alias subscribeOnce
|
|
254
|
+
* @param { String } message The message to subscribe to
|
|
255
|
+
* @param { Function } func The function to call when a new message is published
|
|
256
|
+
* @return { PubSub }
|
|
257
|
+
*/
|
|
258
|
+
PubSub.subscribeOnce = function( message, func ){
|
|
259
|
+
var token = PubSub.subscribe( message, function(){
|
|
260
|
+
// before func apply, unsubscribe message
|
|
261
|
+
PubSub.unsubscribe( token );
|
|
262
|
+
func.apply( this, arguments );
|
|
263
|
+
});
|
|
264
|
+
return PubSub;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Clears all subscriptions
|
|
269
|
+
* @function
|
|
270
|
+
* @public
|
|
271
|
+
* @alias clearAllSubscriptions
|
|
272
|
+
*/
|
|
273
|
+
PubSub.clearAllSubscriptions = function clearAllSubscriptions(){
|
|
274
|
+
messages = {};
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Clear subscriptions by the topic
|
|
279
|
+
* @function
|
|
280
|
+
* @public
|
|
281
|
+
* @alias clearAllSubscriptions
|
|
282
|
+
* @return { int }
|
|
283
|
+
*/
|
|
284
|
+
PubSub.clearSubscriptions = function clearSubscriptions(topic){
|
|
285
|
+
var m;
|
|
286
|
+
for (m in messages){
|
|
287
|
+
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
288
|
+
delete messages[m];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
Count subscriptions by the topic
|
|
295
|
+
* @function
|
|
296
|
+
* @public
|
|
297
|
+
* @alias countSubscriptions
|
|
298
|
+
* @return { Array }
|
|
299
|
+
*/
|
|
300
|
+
PubSub.countSubscriptions = function countSubscriptions(topic){
|
|
301
|
+
var m;
|
|
302
|
+
// eslint-disable-next-line no-unused-vars
|
|
303
|
+
var token;
|
|
304
|
+
var count = 0;
|
|
305
|
+
for (m in messages) {
|
|
306
|
+
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0) {
|
|
307
|
+
for (token in messages[m]) {
|
|
308
|
+
count++;
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return count;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
Gets subscriptions by the topic
|
|
319
|
+
* @function
|
|
320
|
+
* @public
|
|
321
|
+
* @alias getSubscriptions
|
|
322
|
+
*/
|
|
323
|
+
PubSub.getSubscriptions = function getSubscriptions(topic){
|
|
324
|
+
var m;
|
|
325
|
+
var list = [];
|
|
326
|
+
for (m in messages){
|
|
327
|
+
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
328
|
+
list.push(m);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return list;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Removes subscriptions
|
|
336
|
+
*
|
|
337
|
+
* - When passed a token, removes a specific subscription.
|
|
338
|
+
*
|
|
339
|
+
* - When passed a function, removes all subscriptions for that function
|
|
340
|
+
*
|
|
341
|
+
* - When passed a topic, removes all subscriptions for that topic (hierarchy)
|
|
342
|
+
* @function
|
|
343
|
+
* @public
|
|
344
|
+
* @alias subscribeOnce
|
|
345
|
+
* @param { String | Function } value A token, function or topic to unsubscribe from
|
|
346
|
+
* @example // Unsubscribing with a token
|
|
347
|
+
* var token = PubSub.subscribe('mytopic', myFunc);
|
|
348
|
+
* PubSub.unsubscribe(token);
|
|
349
|
+
* @example // Unsubscribing with a function
|
|
350
|
+
* PubSub.unsubscribe(myFunc);
|
|
351
|
+
* @example // Unsubscribing from a topic
|
|
352
|
+
* PubSub.unsubscribe('mytopic');
|
|
353
|
+
*/
|
|
354
|
+
PubSub.unsubscribe = function(value){
|
|
355
|
+
var descendantTopicExists = function(topic) {
|
|
356
|
+
var m;
|
|
357
|
+
for ( m in messages ){
|
|
358
|
+
if ( Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0 ){
|
|
359
|
+
// a descendant of the topic exists:
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return false;
|
|
365
|
+
},
|
|
366
|
+
isTopic = typeof value === 'string' && ( Object.prototype.hasOwnProperty.call(messages, value) || descendantTopicExists(value) ),
|
|
367
|
+
isToken = !isTopic && typeof value === 'string',
|
|
368
|
+
isFunction = typeof value === 'function',
|
|
369
|
+
result = false,
|
|
370
|
+
m, message, t;
|
|
371
|
+
|
|
372
|
+
if (isTopic){
|
|
373
|
+
PubSub.clearSubscriptions(value);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
for ( m in messages ){
|
|
378
|
+
if ( Object.prototype.hasOwnProperty.call( messages, m ) ){
|
|
379
|
+
message = messages[m];
|
|
380
|
+
|
|
381
|
+
if ( isToken && message[value] ){
|
|
382
|
+
delete message[value];
|
|
383
|
+
result = value;
|
|
384
|
+
// tokens are unique, so we can just stop here
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (isFunction) {
|
|
389
|
+
for ( t in message ){
|
|
390
|
+
if (Object.prototype.hasOwnProperty.call(message, t) && message[t] === value){
|
|
391
|
+
delete message[t];
|
|
392
|
+
result = true;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return result;
|
|
400
|
+
};
|
|
401
|
+
}));
|
|
402
|
+
} (pubsub, pubsub.exports));
|
|
403
|
+
|
|
404
|
+
var uri_all = {exports: {}};
|
|
405
|
+
|
|
406
|
+
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
407
|
+
|
|
408
|
+
(function (module, exports) {
|
|
409
|
+
(function (global, factory) {
|
|
410
|
+
factory(exports) ;
|
|
411
|
+
}(commonjsGlobal, (function (exports) {
|
|
412
|
+
function merge() {
|
|
413
|
+
for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
|
|
414
|
+
sets[_key] = arguments[_key];
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (sets.length > 1) {
|
|
418
|
+
sets[0] = sets[0].slice(0, -1);
|
|
419
|
+
var xl = sets.length - 1;
|
|
420
|
+
for (var x = 1; x < xl; ++x) {
|
|
421
|
+
sets[x] = sets[x].slice(1, -1);
|
|
422
|
+
}
|
|
423
|
+
sets[xl] = sets[xl].slice(1);
|
|
424
|
+
return sets.join('');
|
|
425
|
+
} else {
|
|
426
|
+
return sets[0];
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function subexp(str) {
|
|
430
|
+
return "(?:" + str + ")";
|
|
431
|
+
}
|
|
432
|
+
function typeOf(o) {
|
|
433
|
+
return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
|
|
434
|
+
}
|
|
435
|
+
function toUpperCase(str) {
|
|
436
|
+
return str.toUpperCase();
|
|
437
|
+
}
|
|
438
|
+
function toArray(obj) {
|
|
439
|
+
return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
|
|
440
|
+
}
|
|
441
|
+
function assign(target, source) {
|
|
442
|
+
var obj = target;
|
|
443
|
+
if (source) {
|
|
444
|
+
for (var key in source) {
|
|
445
|
+
obj[key] = source[key];
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return obj;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function buildExps(isIRI) {
|
|
452
|
+
var ALPHA$$ = "[A-Za-z]",
|
|
453
|
+
DIGIT$$ = "[0-9]",
|
|
454
|
+
HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
|
|
455
|
+
PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
|
|
456
|
+
//expanded
|
|
457
|
+
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
|
|
458
|
+
SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
|
|
459
|
+
RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
|
|
460
|
+
UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
|
|
461
|
+
//subset, excludes bidi control characters
|
|
462
|
+
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
|
|
463
|
+
//subset
|
|
464
|
+
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
|
|
465
|
+
subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
|
|
466
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
|
|
467
|
+
var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
|
|
468
|
+
//relaxed parsing rules
|
|
469
|
+
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
|
470
|
+
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
|
471
|
+
LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
|
|
472
|
+
IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
|
|
473
|
+
// 6( h16 ":" ) ls32
|
|
474
|
+
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
|
|
475
|
+
// "::" 5( h16 ":" ) ls32
|
|
476
|
+
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
|
|
477
|
+
//[ h16 ] "::" 4( h16 ":" ) ls32
|
|
478
|
+
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
|
|
479
|
+
//[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
|
480
|
+
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
|
|
481
|
+
//[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
|
482
|
+
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
|
|
483
|
+
//[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
|
484
|
+
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
|
|
485
|
+
//[ *4( h16 ":" ) h16 ] "::" ls32
|
|
486
|
+
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
|
|
487
|
+
//[ *5( h16 ":" ) h16 ] "::" h16
|
|
488
|
+
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
|
|
489
|
+
//[ *6( h16 ":" ) h16 ] "::"
|
|
490
|
+
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
|
491
|
+
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
|
|
492
|
+
//RFC 6874, with relaxed parsing rules
|
|
493
|
+
subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
|
|
494
|
+
//RFC 6874
|
|
495
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
|
|
496
|
+
var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
|
|
497
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
|
|
498
|
+
subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
|
|
499
|
+
return {
|
|
500
|
+
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
|
501
|
+
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
502
|
+
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
503
|
+
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
504
|
+
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
505
|
+
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
|
506
|
+
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
|
507
|
+
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
508
|
+
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
|
|
509
|
+
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
|
510
|
+
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
|
|
511
|
+
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
|
512
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
var URI_PROTOCOL = buildExps(false);
|
|
516
|
+
|
|
517
|
+
var IRI_PROTOCOL = buildExps(true);
|
|
518
|
+
|
|
519
|
+
var slicedToArray = function () {
|
|
520
|
+
function sliceIterator(arr, i) {
|
|
521
|
+
var _arr = [];
|
|
522
|
+
var _n = true;
|
|
523
|
+
var _d = false;
|
|
524
|
+
var _e = undefined;
|
|
525
|
+
|
|
526
|
+
try {
|
|
527
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
528
|
+
_arr.push(_s.value);
|
|
529
|
+
|
|
530
|
+
if (i && _arr.length === i) break;
|
|
531
|
+
}
|
|
532
|
+
} catch (err) {
|
|
533
|
+
_d = true;
|
|
534
|
+
_e = err;
|
|
535
|
+
} finally {
|
|
536
|
+
try {
|
|
537
|
+
if (!_n && _i["return"]) _i["return"]();
|
|
538
|
+
} finally {
|
|
539
|
+
if (_d) throw _e;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return _arr;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return function (arr, i) {
|
|
547
|
+
if (Array.isArray(arr)) {
|
|
548
|
+
return arr;
|
|
549
|
+
} else if (Symbol.iterator in Object(arr)) {
|
|
550
|
+
return sliceIterator(arr, i);
|
|
551
|
+
} else {
|
|
552
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
}();
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
var toConsumableArray = function (arr) {
|
|
570
|
+
if (Array.isArray(arr)) {
|
|
571
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
572
|
+
|
|
573
|
+
return arr2;
|
|
574
|
+
} else {
|
|
575
|
+
return Array.from(arr);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/** Highest positive signed 32-bit float value */
|
|
580
|
+
|
|
581
|
+
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
|
582
|
+
|
|
583
|
+
/** Bootstring parameters */
|
|
584
|
+
var base = 36;
|
|
585
|
+
var tMin = 1;
|
|
586
|
+
var tMax = 26;
|
|
587
|
+
var skew = 38;
|
|
588
|
+
var damp = 700;
|
|
589
|
+
var initialBias = 72;
|
|
590
|
+
var initialN = 128; // 0x80
|
|
591
|
+
var delimiter = '-'; // '\x2D'
|
|
592
|
+
|
|
593
|
+
/** Regular expressions */
|
|
594
|
+
var regexPunycode = /^xn--/;
|
|
595
|
+
var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
|
|
596
|
+
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
597
|
+
|
|
598
|
+
/** Error messages */
|
|
599
|
+
var errors = {
|
|
600
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
601
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
602
|
+
'invalid-input': 'Invalid input'
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
/** Convenience shortcuts */
|
|
606
|
+
var baseMinusTMin = base - tMin;
|
|
607
|
+
var floor = Math.floor;
|
|
608
|
+
var stringFromCharCode = String.fromCharCode;
|
|
609
|
+
|
|
610
|
+
/*--------------------------------------------------------------------------*/
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* A generic error utility function.
|
|
614
|
+
* @private
|
|
615
|
+
* @param {String} type The error type.
|
|
616
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
617
|
+
*/
|
|
618
|
+
function error$1(type) {
|
|
619
|
+
throw new RangeError(errors[type]);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* A generic `Array#map` utility function.
|
|
624
|
+
* @private
|
|
625
|
+
* @param {Array} array The array to iterate over.
|
|
626
|
+
* @param {Function} callback The function that gets called for every array
|
|
627
|
+
* item.
|
|
628
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
629
|
+
*/
|
|
630
|
+
function map(array, fn) {
|
|
631
|
+
var result = [];
|
|
632
|
+
var length = array.length;
|
|
633
|
+
while (length--) {
|
|
634
|
+
result[length] = fn(array[length]);
|
|
635
|
+
}
|
|
636
|
+
return result;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
641
|
+
* addresses.
|
|
642
|
+
* @private
|
|
643
|
+
* @param {String} domain The domain name or email address.
|
|
644
|
+
* @param {Function} callback The function that gets called for every
|
|
645
|
+
* character.
|
|
646
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
647
|
+
* function.
|
|
648
|
+
*/
|
|
649
|
+
function mapDomain(string, fn) {
|
|
650
|
+
var parts = string.split('@');
|
|
651
|
+
var result = '';
|
|
652
|
+
if (parts.length > 1) {
|
|
653
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
654
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
655
|
+
result = parts[0] + '@';
|
|
656
|
+
string = parts[1];
|
|
657
|
+
}
|
|
658
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
659
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
660
|
+
var labels = string.split('.');
|
|
661
|
+
var encoded = map(labels, fn).join('.');
|
|
662
|
+
return result + encoded;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
667
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
668
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
669
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
670
|
+
* matching UTF-16.
|
|
671
|
+
* @see `punycode.ucs2.encode`
|
|
672
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
673
|
+
* @memberOf punycode.ucs2
|
|
674
|
+
* @name decode
|
|
675
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
676
|
+
* @returns {Array} The new array of code points.
|
|
677
|
+
*/
|
|
678
|
+
function ucs2decode(string) {
|
|
679
|
+
var output = [];
|
|
680
|
+
var counter = 0;
|
|
681
|
+
var length = string.length;
|
|
682
|
+
while (counter < length) {
|
|
683
|
+
var value = string.charCodeAt(counter++);
|
|
684
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
685
|
+
// It's a high surrogate, and there is a next character.
|
|
686
|
+
var extra = string.charCodeAt(counter++);
|
|
687
|
+
if ((extra & 0xFC00) == 0xDC00) {
|
|
688
|
+
// Low surrogate.
|
|
689
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
690
|
+
} else {
|
|
691
|
+
// It's an unmatched surrogate; only append this code unit, in case the
|
|
692
|
+
// next code unit is the high surrogate of a surrogate pair.
|
|
693
|
+
output.push(value);
|
|
694
|
+
counter--;
|
|
695
|
+
}
|
|
696
|
+
} else {
|
|
697
|
+
output.push(value);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return output;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Creates a string based on an array of numeric code points.
|
|
705
|
+
* @see `punycode.ucs2.decode`
|
|
706
|
+
* @memberOf punycode.ucs2
|
|
707
|
+
* @name encode
|
|
708
|
+
* @param {Array} codePoints The array of numeric code points.
|
|
709
|
+
* @returns {String} The new Unicode string (UCS-2).
|
|
710
|
+
*/
|
|
711
|
+
var ucs2encode = function ucs2encode(array) {
|
|
712
|
+
return String.fromCodePoint.apply(String, toConsumableArray(array));
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Converts a basic code point into a digit/integer.
|
|
717
|
+
* @see `digitToBasic()`
|
|
718
|
+
* @private
|
|
719
|
+
* @param {Number} codePoint The basic numeric code point value.
|
|
720
|
+
* @returns {Number} The numeric value of a basic code point (for use in
|
|
721
|
+
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
722
|
+
* the code point does not represent a value.
|
|
723
|
+
*/
|
|
724
|
+
var basicToDigit = function basicToDigit(codePoint) {
|
|
725
|
+
if (codePoint - 0x30 < 0x0A) {
|
|
726
|
+
return codePoint - 0x16;
|
|
727
|
+
}
|
|
728
|
+
if (codePoint - 0x41 < 0x1A) {
|
|
729
|
+
return codePoint - 0x41;
|
|
730
|
+
}
|
|
731
|
+
if (codePoint - 0x61 < 0x1A) {
|
|
732
|
+
return codePoint - 0x61;
|
|
733
|
+
}
|
|
734
|
+
return base;
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Converts a digit/integer into a basic code point.
|
|
739
|
+
* @see `basicToDigit()`
|
|
740
|
+
* @private
|
|
741
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
742
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
743
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
744
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
745
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
746
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
747
|
+
*/
|
|
748
|
+
var digitToBasic = function digitToBasic(digit, flag) {
|
|
749
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
750
|
+
// 26..35 map to ASCII 0..9
|
|
751
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
756
|
+
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
757
|
+
* @private
|
|
758
|
+
*/
|
|
759
|
+
var adapt = function adapt(delta, numPoints, firstTime) {
|
|
760
|
+
var k = 0;
|
|
761
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
762
|
+
delta += floor(delta / numPoints);
|
|
763
|
+
for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
764
|
+
delta = floor(delta / baseMinusTMin);
|
|
765
|
+
}
|
|
766
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
771
|
+
* symbols.
|
|
772
|
+
* @memberOf punycode
|
|
773
|
+
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
774
|
+
* @returns {String} The resulting string of Unicode symbols.
|
|
775
|
+
*/
|
|
776
|
+
var decode = function decode(input) {
|
|
777
|
+
// Don't use UCS-2.
|
|
778
|
+
var output = [];
|
|
779
|
+
var inputLength = input.length;
|
|
780
|
+
var i = 0;
|
|
781
|
+
var n = initialN;
|
|
782
|
+
var bias = initialBias;
|
|
783
|
+
|
|
784
|
+
// Handle the basic code points: let `basic` be the number of input code
|
|
785
|
+
// points before the last delimiter, or `0` if there is none, then copy
|
|
786
|
+
// the first basic code points to the output.
|
|
787
|
+
|
|
788
|
+
var basic = input.lastIndexOf(delimiter);
|
|
789
|
+
if (basic < 0) {
|
|
790
|
+
basic = 0;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
for (var j = 0; j < basic; ++j) {
|
|
794
|
+
// if it's not a basic code point
|
|
795
|
+
if (input.charCodeAt(j) >= 0x80) {
|
|
796
|
+
error$1('not-basic');
|
|
797
|
+
}
|
|
798
|
+
output.push(input.charCodeAt(j));
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
802
|
+
// points were copied; start at the beginning otherwise.
|
|
803
|
+
|
|
804
|
+
for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
|
|
805
|
+
|
|
806
|
+
// `index` is the index of the next character to be consumed.
|
|
807
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
808
|
+
// which gets added to `i`. The overflow checking is easier
|
|
809
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
810
|
+
// value at the end to obtain `delta`.
|
|
811
|
+
var oldi = i;
|
|
812
|
+
for (var w = 1, k = base;; /* no condition */k += base) {
|
|
813
|
+
|
|
814
|
+
if (index >= inputLength) {
|
|
815
|
+
error$1('invalid-input');
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
var digit = basicToDigit(input.charCodeAt(index++));
|
|
819
|
+
|
|
820
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
821
|
+
error$1('overflow');
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
i += digit * w;
|
|
825
|
+
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
826
|
+
|
|
827
|
+
if (digit < t) {
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
var baseMinusT = base - t;
|
|
832
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
833
|
+
error$1('overflow');
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
w *= baseMinusT;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var out = output.length + 1;
|
|
840
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
841
|
+
|
|
842
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
843
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
844
|
+
if (floor(i / out) > maxInt - n) {
|
|
845
|
+
error$1('overflow');
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
n += floor(i / out);
|
|
849
|
+
i %= out;
|
|
850
|
+
|
|
851
|
+
// Insert `n` at position `i` of the output.
|
|
852
|
+
output.splice(i++, 0, n);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
return String.fromCodePoint.apply(String, output);
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
860
|
+
* Punycode string of ASCII-only symbols.
|
|
861
|
+
* @memberOf punycode
|
|
862
|
+
* @param {String} input The string of Unicode symbols.
|
|
863
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
864
|
+
*/
|
|
865
|
+
var encode = function encode(input) {
|
|
866
|
+
var output = [];
|
|
867
|
+
|
|
868
|
+
// Convert the input in UCS-2 to an array of Unicode code points.
|
|
869
|
+
input = ucs2decode(input);
|
|
870
|
+
|
|
871
|
+
// Cache the length.
|
|
872
|
+
var inputLength = input.length;
|
|
873
|
+
|
|
874
|
+
// Initialize the state.
|
|
875
|
+
var n = initialN;
|
|
876
|
+
var delta = 0;
|
|
877
|
+
var bias = initialBias;
|
|
878
|
+
|
|
879
|
+
// Handle the basic code points.
|
|
880
|
+
var _iteratorNormalCompletion = true;
|
|
881
|
+
var _didIteratorError = false;
|
|
882
|
+
var _iteratorError = undefined;
|
|
883
|
+
|
|
884
|
+
try {
|
|
885
|
+
for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
886
|
+
var _currentValue2 = _step.value;
|
|
887
|
+
|
|
888
|
+
if (_currentValue2 < 0x80) {
|
|
889
|
+
output.push(stringFromCharCode(_currentValue2));
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
} catch (err) {
|
|
893
|
+
_didIteratorError = true;
|
|
894
|
+
_iteratorError = err;
|
|
895
|
+
} finally {
|
|
896
|
+
try {
|
|
897
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
898
|
+
_iterator.return();
|
|
899
|
+
}
|
|
900
|
+
} finally {
|
|
901
|
+
if (_didIteratorError) {
|
|
902
|
+
throw _iteratorError;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
var basicLength = output.length;
|
|
908
|
+
var handledCPCount = basicLength;
|
|
909
|
+
|
|
910
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
911
|
+
// `basicLength` is the number of basic code points.
|
|
912
|
+
|
|
913
|
+
// Finish the basic string with a delimiter unless it's empty.
|
|
914
|
+
if (basicLength) {
|
|
915
|
+
output.push(delimiter);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// Main encoding loop:
|
|
919
|
+
while (handledCPCount < inputLength) {
|
|
920
|
+
|
|
921
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
922
|
+
// larger one:
|
|
923
|
+
var m = maxInt;
|
|
924
|
+
var _iteratorNormalCompletion2 = true;
|
|
925
|
+
var _didIteratorError2 = false;
|
|
926
|
+
var _iteratorError2 = undefined;
|
|
927
|
+
|
|
928
|
+
try {
|
|
929
|
+
for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
930
|
+
var currentValue = _step2.value;
|
|
931
|
+
|
|
932
|
+
if (currentValue >= n && currentValue < m) {
|
|
933
|
+
m = currentValue;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
938
|
+
// but guard against overflow.
|
|
939
|
+
} catch (err) {
|
|
940
|
+
_didIteratorError2 = true;
|
|
941
|
+
_iteratorError2 = err;
|
|
942
|
+
} finally {
|
|
943
|
+
try {
|
|
944
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
945
|
+
_iterator2.return();
|
|
946
|
+
}
|
|
947
|
+
} finally {
|
|
948
|
+
if (_didIteratorError2) {
|
|
949
|
+
throw _iteratorError2;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
var handledCPCountPlusOne = handledCPCount + 1;
|
|
955
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
956
|
+
error$1('overflow');
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
960
|
+
n = m;
|
|
961
|
+
|
|
962
|
+
var _iteratorNormalCompletion3 = true;
|
|
963
|
+
var _didIteratorError3 = false;
|
|
964
|
+
var _iteratorError3 = undefined;
|
|
965
|
+
|
|
966
|
+
try {
|
|
967
|
+
for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
968
|
+
var _currentValue = _step3.value;
|
|
969
|
+
|
|
970
|
+
if (_currentValue < n && ++delta > maxInt) {
|
|
971
|
+
error$1('overflow');
|
|
972
|
+
}
|
|
973
|
+
if (_currentValue == n) {
|
|
974
|
+
// Represent delta as a generalized variable-length integer.
|
|
975
|
+
var q = delta;
|
|
976
|
+
for (var k = base;; /* no condition */k += base) {
|
|
977
|
+
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
978
|
+
if (q < t) {
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
var qMinusT = q - t;
|
|
982
|
+
var baseMinusT = base - t;
|
|
983
|
+
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
|
|
984
|
+
q = floor(qMinusT / baseMinusT);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
988
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
989
|
+
delta = 0;
|
|
990
|
+
++handledCPCount;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
} catch (err) {
|
|
994
|
+
_didIteratorError3 = true;
|
|
995
|
+
_iteratorError3 = err;
|
|
996
|
+
} finally {
|
|
997
|
+
try {
|
|
998
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
999
|
+
_iterator3.return();
|
|
1000
|
+
}
|
|
1001
|
+
} finally {
|
|
1002
|
+
if (_didIteratorError3) {
|
|
1003
|
+
throw _iteratorError3;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
++delta;
|
|
1009
|
+
++n;
|
|
1010
|
+
}
|
|
1011
|
+
return output.join('');
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
1016
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
1017
|
+
* it doesn't matter if you call it on a string that has already been
|
|
1018
|
+
* converted to Unicode.
|
|
1019
|
+
* @memberOf punycode
|
|
1020
|
+
* @param {String} input The Punycoded domain name or email address to
|
|
1021
|
+
* convert to Unicode.
|
|
1022
|
+
* @returns {String} The Unicode representation of the given Punycode
|
|
1023
|
+
* string.
|
|
1024
|
+
*/
|
|
1025
|
+
var toUnicode = function toUnicode(input) {
|
|
1026
|
+
return mapDomain(input, function (string) {
|
|
1027
|
+
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
1028
|
+
});
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
1033
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
1034
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
1035
|
+
* ASCII.
|
|
1036
|
+
* @memberOf punycode
|
|
1037
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
1038
|
+
* Unicode string.
|
|
1039
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
1040
|
+
* email address.
|
|
1041
|
+
*/
|
|
1042
|
+
var toASCII = function toASCII(input) {
|
|
1043
|
+
return mapDomain(input, function (string) {
|
|
1044
|
+
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
|
|
1045
|
+
});
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
/*--------------------------------------------------------------------------*/
|
|
1049
|
+
|
|
1050
|
+
/** Define the public API */
|
|
1051
|
+
var punycode = {
|
|
1052
|
+
/**
|
|
1053
|
+
* A string representing the current Punycode.js version number.
|
|
1054
|
+
* @memberOf punycode
|
|
1055
|
+
* @type String
|
|
1056
|
+
*/
|
|
1057
|
+
'version': '2.1.0',
|
|
1058
|
+
/**
|
|
1059
|
+
* An object of methods to convert from JavaScript's internal character
|
|
1060
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
1061
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
1062
|
+
* @memberOf punycode
|
|
1063
|
+
* @type Object
|
|
1064
|
+
*/
|
|
1065
|
+
'ucs2': {
|
|
1066
|
+
'decode': ucs2decode,
|
|
1067
|
+
'encode': ucs2encode
|
|
1068
|
+
},
|
|
1069
|
+
'decode': decode,
|
|
1070
|
+
'encode': encode,
|
|
1071
|
+
'toASCII': toASCII,
|
|
1072
|
+
'toUnicode': toUnicode
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* URI.js
|
|
1077
|
+
*
|
|
1078
|
+
* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
|
|
1079
|
+
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
1080
|
+
* @see http://github.com/garycourt/uri-js
|
|
1081
|
+
*/
|
|
1082
|
+
/**
|
|
1083
|
+
* Copyright 2011 Gary Court. All rights reserved.
|
|
1084
|
+
*
|
|
1085
|
+
* Redistribution and use in source and binary forms, with or without modification, are
|
|
1086
|
+
* permitted provided that the following conditions are met:
|
|
1087
|
+
*
|
|
1088
|
+
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
1089
|
+
* conditions and the following disclaimer.
|
|
1090
|
+
*
|
|
1091
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
1092
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
1093
|
+
* provided with the distribution.
|
|
1094
|
+
*
|
|
1095
|
+
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
1096
|
+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
1097
|
+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
|
|
1098
|
+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
1099
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1100
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
1101
|
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
1102
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
1103
|
+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1104
|
+
*
|
|
1105
|
+
* The views and conclusions contained in the software and documentation are those of the
|
|
1106
|
+
* authors and should not be interpreted as representing official policies, either expressed
|
|
1107
|
+
* or implied, of Gary Court.
|
|
1108
|
+
*/
|
|
1109
|
+
var SCHEMES = {};
|
|
1110
|
+
function pctEncChar(chr) {
|
|
1111
|
+
var c = chr.charCodeAt(0);
|
|
1112
|
+
var e = void 0;
|
|
1113
|
+
if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
|
|
1114
|
+
return e;
|
|
1115
|
+
}
|
|
1116
|
+
function pctDecChars(str) {
|
|
1117
|
+
var newStr = "";
|
|
1118
|
+
var i = 0;
|
|
1119
|
+
var il = str.length;
|
|
1120
|
+
while (i < il) {
|
|
1121
|
+
var c = parseInt(str.substr(i + 1, 2), 16);
|
|
1122
|
+
if (c < 128) {
|
|
1123
|
+
newStr += String.fromCharCode(c);
|
|
1124
|
+
i += 3;
|
|
1125
|
+
} else if (c >= 194 && c < 224) {
|
|
1126
|
+
if (il - i >= 6) {
|
|
1127
|
+
var c2 = parseInt(str.substr(i + 4, 2), 16);
|
|
1128
|
+
newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
|
|
1129
|
+
} else {
|
|
1130
|
+
newStr += str.substr(i, 6);
|
|
1131
|
+
}
|
|
1132
|
+
i += 6;
|
|
1133
|
+
} else if (c >= 224) {
|
|
1134
|
+
if (il - i >= 9) {
|
|
1135
|
+
var _c = parseInt(str.substr(i + 4, 2), 16);
|
|
1136
|
+
var c3 = parseInt(str.substr(i + 7, 2), 16);
|
|
1137
|
+
newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
|
|
1138
|
+
} else {
|
|
1139
|
+
newStr += str.substr(i, 9);
|
|
1140
|
+
}
|
|
1141
|
+
i += 9;
|
|
1142
|
+
} else {
|
|
1143
|
+
newStr += str.substr(i, 3);
|
|
1144
|
+
i += 3;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
return newStr;
|
|
1148
|
+
}
|
|
1149
|
+
function _normalizeComponentEncoding(components, protocol) {
|
|
1150
|
+
function decodeUnreserved(str) {
|
|
1151
|
+
var decStr = pctDecChars(str);
|
|
1152
|
+
return !decStr.match(protocol.UNRESERVED) ? str : decStr;
|
|
1153
|
+
}
|
|
1154
|
+
if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
|
|
1155
|
+
if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1156
|
+
if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1157
|
+
if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1158
|
+
if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1159
|
+
if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
1160
|
+
return components;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
function _stripLeadingZeros(str) {
|
|
1164
|
+
return str.replace(/^0*(.*)/, "$1") || "0";
|
|
1165
|
+
}
|
|
1166
|
+
function _normalizeIPv4(host, protocol) {
|
|
1167
|
+
var matches = host.match(protocol.IPV4ADDRESS) || [];
|
|
1168
|
+
|
|
1169
|
+
var _matches = slicedToArray(matches, 2),
|
|
1170
|
+
address = _matches[1];
|
|
1171
|
+
|
|
1172
|
+
if (address) {
|
|
1173
|
+
return address.split(".").map(_stripLeadingZeros).join(".");
|
|
1174
|
+
} else {
|
|
1175
|
+
return host;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function _normalizeIPv6(host, protocol) {
|
|
1179
|
+
var matches = host.match(protocol.IPV6ADDRESS) || [];
|
|
1180
|
+
|
|
1181
|
+
var _matches2 = slicedToArray(matches, 3),
|
|
1182
|
+
address = _matches2[1],
|
|
1183
|
+
zone = _matches2[2];
|
|
1184
|
+
|
|
1185
|
+
if (address) {
|
|
1186
|
+
var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
|
|
1187
|
+
_address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
|
|
1188
|
+
last = _address$toLowerCase$2[0],
|
|
1189
|
+
first = _address$toLowerCase$2[1];
|
|
1190
|
+
|
|
1191
|
+
var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
|
|
1192
|
+
var lastFields = last.split(":").map(_stripLeadingZeros);
|
|
1193
|
+
var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
|
|
1194
|
+
var fieldCount = isLastFieldIPv4Address ? 7 : 8;
|
|
1195
|
+
var lastFieldsStart = lastFields.length - fieldCount;
|
|
1196
|
+
var fields = Array(fieldCount);
|
|
1197
|
+
for (var x = 0; x < fieldCount; ++x) {
|
|
1198
|
+
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
|
|
1199
|
+
}
|
|
1200
|
+
if (isLastFieldIPv4Address) {
|
|
1201
|
+
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
|
|
1202
|
+
}
|
|
1203
|
+
var allZeroFields = fields.reduce(function (acc, field, index) {
|
|
1204
|
+
if (!field || field === "0") {
|
|
1205
|
+
var lastLongest = acc[acc.length - 1];
|
|
1206
|
+
if (lastLongest && lastLongest.index + lastLongest.length === index) {
|
|
1207
|
+
lastLongest.length++;
|
|
1208
|
+
} else {
|
|
1209
|
+
acc.push({ index: index, length: 1 });
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return acc;
|
|
1213
|
+
}, []);
|
|
1214
|
+
var longestZeroFields = allZeroFields.sort(function (a, b) {
|
|
1215
|
+
return b.length - a.length;
|
|
1216
|
+
})[0];
|
|
1217
|
+
var newHost = void 0;
|
|
1218
|
+
if (longestZeroFields && longestZeroFields.length > 1) {
|
|
1219
|
+
var newFirst = fields.slice(0, longestZeroFields.index);
|
|
1220
|
+
var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
|
|
1221
|
+
newHost = newFirst.join(":") + "::" + newLast.join(":");
|
|
1222
|
+
} else {
|
|
1223
|
+
newHost = fields.join(":");
|
|
1224
|
+
}
|
|
1225
|
+
if (zone) {
|
|
1226
|
+
newHost += "%" + zone;
|
|
1227
|
+
}
|
|
1228
|
+
return newHost;
|
|
1229
|
+
} else {
|
|
1230
|
+
return host;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
|
|
1234
|
+
var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
|
|
1235
|
+
function parse(uriString) {
|
|
1236
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1237
|
+
|
|
1238
|
+
var components = {};
|
|
1239
|
+
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
1240
|
+
if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
|
|
1241
|
+
var matches = uriString.match(URI_PARSE);
|
|
1242
|
+
if (matches) {
|
|
1243
|
+
if (NO_MATCH_IS_UNDEFINED) {
|
|
1244
|
+
//store each component
|
|
1245
|
+
components.scheme = matches[1];
|
|
1246
|
+
components.userinfo = matches[3];
|
|
1247
|
+
components.host = matches[4];
|
|
1248
|
+
components.port = parseInt(matches[5], 10);
|
|
1249
|
+
components.path = matches[6] || "";
|
|
1250
|
+
components.query = matches[7];
|
|
1251
|
+
components.fragment = matches[8];
|
|
1252
|
+
//fix port number
|
|
1253
|
+
if (isNaN(components.port)) {
|
|
1254
|
+
components.port = matches[5];
|
|
1255
|
+
}
|
|
1256
|
+
} else {
|
|
1257
|
+
//IE FIX for improper RegExp matching
|
|
1258
|
+
//store each component
|
|
1259
|
+
components.scheme = matches[1] || undefined;
|
|
1260
|
+
components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
|
|
1261
|
+
components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
|
|
1262
|
+
components.port = parseInt(matches[5], 10);
|
|
1263
|
+
components.path = matches[6] || "";
|
|
1264
|
+
components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
|
|
1265
|
+
components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
|
|
1266
|
+
//fix port number
|
|
1267
|
+
if (isNaN(components.port)) {
|
|
1268
|
+
components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
if (components.host) {
|
|
1272
|
+
//normalize IP hosts
|
|
1273
|
+
components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
|
|
1274
|
+
}
|
|
1275
|
+
//determine reference type
|
|
1276
|
+
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
|
|
1277
|
+
components.reference = "same-document";
|
|
1278
|
+
} else if (components.scheme === undefined) {
|
|
1279
|
+
components.reference = "relative";
|
|
1280
|
+
} else if (components.fragment === undefined) {
|
|
1281
|
+
components.reference = "absolute";
|
|
1282
|
+
} else {
|
|
1283
|
+
components.reference = "uri";
|
|
1284
|
+
}
|
|
1285
|
+
//check for reference errors
|
|
1286
|
+
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
|
|
1287
|
+
components.error = components.error || "URI is not a " + options.reference + " reference.";
|
|
1288
|
+
}
|
|
1289
|
+
//find scheme handler
|
|
1290
|
+
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
1291
|
+
//check if scheme can't handle IRIs
|
|
1292
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
1293
|
+
//if host component is a domain name
|
|
1294
|
+
if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
|
|
1295
|
+
//convert Unicode IDN -> ASCII IDN
|
|
1296
|
+
try {
|
|
1297
|
+
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
|
|
1298
|
+
} catch (e) {
|
|
1299
|
+
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
//convert IRI -> URI
|
|
1303
|
+
_normalizeComponentEncoding(components, URI_PROTOCOL);
|
|
1304
|
+
} else {
|
|
1305
|
+
//normalize encodings
|
|
1306
|
+
_normalizeComponentEncoding(components, protocol);
|
|
1307
|
+
}
|
|
1308
|
+
//perform scheme specific parsing
|
|
1309
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
1310
|
+
schemeHandler.parse(components, options);
|
|
1311
|
+
}
|
|
1312
|
+
} else {
|
|
1313
|
+
components.error = components.error || "URI can not be parsed.";
|
|
1314
|
+
}
|
|
1315
|
+
return components;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
function _recomposeAuthority(components, options) {
|
|
1319
|
+
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
1320
|
+
var uriTokens = [];
|
|
1321
|
+
if (components.userinfo !== undefined) {
|
|
1322
|
+
uriTokens.push(components.userinfo);
|
|
1323
|
+
uriTokens.push("@");
|
|
1324
|
+
}
|
|
1325
|
+
if (components.host !== undefined) {
|
|
1326
|
+
//normalize IP hosts, add brackets and escape zone separator for IPv6
|
|
1327
|
+
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
|
|
1328
|
+
return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
|
|
1329
|
+
}));
|
|
1330
|
+
}
|
|
1331
|
+
if (typeof components.port === "number" || typeof components.port === "string") {
|
|
1332
|
+
uriTokens.push(":");
|
|
1333
|
+
uriTokens.push(String(components.port));
|
|
1334
|
+
}
|
|
1335
|
+
return uriTokens.length ? uriTokens.join("") : undefined;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
var RDS1 = /^\.\.?\//;
|
|
1339
|
+
var RDS2 = /^\/\.(\/|$)/;
|
|
1340
|
+
var RDS3 = /^\/\.\.(\/|$)/;
|
|
1341
|
+
var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
1342
|
+
function removeDotSegments(input) {
|
|
1343
|
+
var output = [];
|
|
1344
|
+
while (input.length) {
|
|
1345
|
+
if (input.match(RDS1)) {
|
|
1346
|
+
input = input.replace(RDS1, "");
|
|
1347
|
+
} else if (input.match(RDS2)) {
|
|
1348
|
+
input = input.replace(RDS2, "/");
|
|
1349
|
+
} else if (input.match(RDS3)) {
|
|
1350
|
+
input = input.replace(RDS3, "/");
|
|
1351
|
+
output.pop();
|
|
1352
|
+
} else if (input === "." || input === "..") {
|
|
1353
|
+
input = "";
|
|
1354
|
+
} else {
|
|
1355
|
+
var im = input.match(RDS5);
|
|
1356
|
+
if (im) {
|
|
1357
|
+
var s = im[0];
|
|
1358
|
+
input = input.slice(s.length);
|
|
1359
|
+
output.push(s);
|
|
1360
|
+
} else {
|
|
1361
|
+
throw new Error("Unexpected dot segment condition");
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
return output.join("");
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
function serialize(components) {
|
|
1369
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1370
|
+
|
|
1371
|
+
var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
1372
|
+
var uriTokens = [];
|
|
1373
|
+
//find scheme handler
|
|
1374
|
+
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
1375
|
+
//perform scheme specific serialization
|
|
1376
|
+
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
|
|
1377
|
+
if (components.host) {
|
|
1378
|
+
//if host component is an IPv6 address
|
|
1379
|
+
if (protocol.IPV6ADDRESS.test(components.host)) ;
|
|
1380
|
+
//TODO: normalize IPv6 address as per RFC 5952
|
|
1381
|
+
|
|
1382
|
+
//if host component is a domain name
|
|
1383
|
+
else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
|
|
1384
|
+
//convert IDN via punycode
|
|
1385
|
+
try {
|
|
1386
|
+
components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
|
|
1387
|
+
} catch (e) {
|
|
1388
|
+
components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
//normalize encoding
|
|
1393
|
+
_normalizeComponentEncoding(components, protocol);
|
|
1394
|
+
if (options.reference !== "suffix" && components.scheme) {
|
|
1395
|
+
uriTokens.push(components.scheme);
|
|
1396
|
+
uriTokens.push(":");
|
|
1397
|
+
}
|
|
1398
|
+
var authority = _recomposeAuthority(components, options);
|
|
1399
|
+
if (authority !== undefined) {
|
|
1400
|
+
if (options.reference !== "suffix") {
|
|
1401
|
+
uriTokens.push("//");
|
|
1402
|
+
}
|
|
1403
|
+
uriTokens.push(authority);
|
|
1404
|
+
if (components.path && components.path.charAt(0) !== "/") {
|
|
1405
|
+
uriTokens.push("/");
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
if (components.path !== undefined) {
|
|
1409
|
+
var s = components.path;
|
|
1410
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
1411
|
+
s = removeDotSegments(s);
|
|
1412
|
+
}
|
|
1413
|
+
if (authority === undefined) {
|
|
1414
|
+
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
|
|
1415
|
+
}
|
|
1416
|
+
uriTokens.push(s);
|
|
1417
|
+
}
|
|
1418
|
+
if (components.query !== undefined) {
|
|
1419
|
+
uriTokens.push("?");
|
|
1420
|
+
uriTokens.push(components.query);
|
|
1421
|
+
}
|
|
1422
|
+
if (components.fragment !== undefined) {
|
|
1423
|
+
uriTokens.push("#");
|
|
1424
|
+
uriTokens.push(components.fragment);
|
|
1425
|
+
}
|
|
1426
|
+
return uriTokens.join(""); //merge tokens into a string
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
function resolveComponents(base, relative) {
|
|
1430
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1431
|
+
var skipNormalization = arguments[3];
|
|
1432
|
+
|
|
1433
|
+
var target = {};
|
|
1434
|
+
if (!skipNormalization) {
|
|
1435
|
+
base = parse(serialize(base, options), options); //normalize base components
|
|
1436
|
+
relative = parse(serialize(relative, options), options); //normalize relative components
|
|
1437
|
+
}
|
|
1438
|
+
options = options || {};
|
|
1439
|
+
if (!options.tolerant && relative.scheme) {
|
|
1440
|
+
target.scheme = relative.scheme;
|
|
1441
|
+
//target.authority = relative.authority;
|
|
1442
|
+
target.userinfo = relative.userinfo;
|
|
1443
|
+
target.host = relative.host;
|
|
1444
|
+
target.port = relative.port;
|
|
1445
|
+
target.path = removeDotSegments(relative.path || "");
|
|
1446
|
+
target.query = relative.query;
|
|
1447
|
+
} else {
|
|
1448
|
+
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
1449
|
+
//target.authority = relative.authority;
|
|
1450
|
+
target.userinfo = relative.userinfo;
|
|
1451
|
+
target.host = relative.host;
|
|
1452
|
+
target.port = relative.port;
|
|
1453
|
+
target.path = removeDotSegments(relative.path || "");
|
|
1454
|
+
target.query = relative.query;
|
|
1455
|
+
} else {
|
|
1456
|
+
if (!relative.path) {
|
|
1457
|
+
target.path = base.path;
|
|
1458
|
+
if (relative.query !== undefined) {
|
|
1459
|
+
target.query = relative.query;
|
|
1460
|
+
} else {
|
|
1461
|
+
target.query = base.query;
|
|
1462
|
+
}
|
|
1463
|
+
} else {
|
|
1464
|
+
if (relative.path.charAt(0) === "/") {
|
|
1465
|
+
target.path = removeDotSegments(relative.path);
|
|
1466
|
+
} else {
|
|
1467
|
+
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
1468
|
+
target.path = "/" + relative.path;
|
|
1469
|
+
} else if (!base.path) {
|
|
1470
|
+
target.path = relative.path;
|
|
1471
|
+
} else {
|
|
1472
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
1473
|
+
}
|
|
1474
|
+
target.path = removeDotSegments(target.path);
|
|
1475
|
+
}
|
|
1476
|
+
target.query = relative.query;
|
|
1477
|
+
}
|
|
1478
|
+
//target.authority = base.authority;
|
|
1479
|
+
target.userinfo = base.userinfo;
|
|
1480
|
+
target.host = base.host;
|
|
1481
|
+
target.port = base.port;
|
|
1482
|
+
}
|
|
1483
|
+
target.scheme = base.scheme;
|
|
1484
|
+
}
|
|
1485
|
+
target.fragment = relative.fragment;
|
|
1486
|
+
return target;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
function resolve(baseURI, relativeURI, options) {
|
|
1490
|
+
var schemelessOptions = assign({ scheme: 'null' }, options);
|
|
1491
|
+
return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
function normalize(uri, options) {
|
|
1495
|
+
if (typeof uri === "string") {
|
|
1496
|
+
uri = serialize(parse(uri, options), options);
|
|
1497
|
+
} else if (typeOf(uri) === "object") {
|
|
1498
|
+
uri = parse(serialize(uri, options), options);
|
|
1499
|
+
}
|
|
1500
|
+
return uri;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
function equal(uriA, uriB, options) {
|
|
1504
|
+
if (typeof uriA === "string") {
|
|
1505
|
+
uriA = serialize(parse(uriA, options), options);
|
|
1506
|
+
} else if (typeOf(uriA) === "object") {
|
|
1507
|
+
uriA = serialize(uriA, options);
|
|
1508
|
+
}
|
|
1509
|
+
if (typeof uriB === "string") {
|
|
1510
|
+
uriB = serialize(parse(uriB, options), options);
|
|
1511
|
+
} else if (typeOf(uriB) === "object") {
|
|
1512
|
+
uriB = serialize(uriB, options);
|
|
1513
|
+
}
|
|
1514
|
+
return uriA === uriB;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
function escapeComponent(str, options) {
|
|
1518
|
+
return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
function unescapeComponent(str, options) {
|
|
1522
|
+
return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
var handler = {
|
|
1526
|
+
scheme: "http",
|
|
1527
|
+
domainHost: true,
|
|
1528
|
+
parse: function parse(components, options) {
|
|
1529
|
+
//report missing host
|
|
1530
|
+
if (!components.host) {
|
|
1531
|
+
components.error = components.error || "HTTP URIs must have a host.";
|
|
1532
|
+
}
|
|
1533
|
+
return components;
|
|
1534
|
+
},
|
|
1535
|
+
serialize: function serialize(components, options) {
|
|
1536
|
+
var secure = String(components.scheme).toLowerCase() === "https";
|
|
1537
|
+
//normalize the default port
|
|
1538
|
+
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
|
1539
|
+
components.port = undefined;
|
|
1540
|
+
}
|
|
1541
|
+
//normalize the empty path
|
|
1542
|
+
if (!components.path) {
|
|
1543
|
+
components.path = "/";
|
|
1544
|
+
}
|
|
1545
|
+
//NOTE: We do not parse query strings for HTTP URIs
|
|
1546
|
+
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
1547
|
+
//and not the HTTP spec.
|
|
1548
|
+
return components;
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
var handler$1 = {
|
|
1553
|
+
scheme: "https",
|
|
1554
|
+
domainHost: handler.domainHost,
|
|
1555
|
+
parse: handler.parse,
|
|
1556
|
+
serialize: handler.serialize
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
function isSecure(wsComponents) {
|
|
1560
|
+
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
|
1561
|
+
}
|
|
1562
|
+
//RFC 6455
|
|
1563
|
+
var handler$2 = {
|
|
1564
|
+
scheme: "ws",
|
|
1565
|
+
domainHost: true,
|
|
1566
|
+
parse: function parse(components, options) {
|
|
1567
|
+
var wsComponents = components;
|
|
1568
|
+
//indicate if the secure flag is set
|
|
1569
|
+
wsComponents.secure = isSecure(wsComponents);
|
|
1570
|
+
//construct resouce name
|
|
1571
|
+
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
|
1572
|
+
wsComponents.path = undefined;
|
|
1573
|
+
wsComponents.query = undefined;
|
|
1574
|
+
return wsComponents;
|
|
1575
|
+
},
|
|
1576
|
+
serialize: function serialize(wsComponents, options) {
|
|
1577
|
+
//normalize the default port
|
|
1578
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
1579
|
+
wsComponents.port = undefined;
|
|
1580
|
+
}
|
|
1581
|
+
//ensure scheme matches secure flag
|
|
1582
|
+
if (typeof wsComponents.secure === 'boolean') {
|
|
1583
|
+
wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
|
|
1584
|
+
wsComponents.secure = undefined;
|
|
1585
|
+
}
|
|
1586
|
+
//reconstruct path from resource name
|
|
1587
|
+
if (wsComponents.resourceName) {
|
|
1588
|
+
var _wsComponents$resourc = wsComponents.resourceName.split('?'),
|
|
1589
|
+
_wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
|
|
1590
|
+
path = _wsComponents$resourc2[0],
|
|
1591
|
+
query = _wsComponents$resourc2[1];
|
|
1592
|
+
|
|
1593
|
+
wsComponents.path = path && path !== '/' ? path : undefined;
|
|
1594
|
+
wsComponents.query = query;
|
|
1595
|
+
wsComponents.resourceName = undefined;
|
|
1596
|
+
}
|
|
1597
|
+
//forbid fragment component
|
|
1598
|
+
wsComponents.fragment = undefined;
|
|
1599
|
+
return wsComponents;
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
var handler$3 = {
|
|
1604
|
+
scheme: "wss",
|
|
1605
|
+
domainHost: handler$2.domainHost,
|
|
1606
|
+
parse: handler$2.parse,
|
|
1607
|
+
serialize: handler$2.serialize
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
var O = {};
|
|
1611
|
+
//RFC 3986
|
|
1612
|
+
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
|
|
1613
|
+
var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
|
|
1614
|
+
var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
|
|
1615
|
+
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
|
|
1616
|
+
//const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
|
|
1617
|
+
//const WSP$$ = "[\\x20\\x09]";
|
|
1618
|
+
//const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
|
|
1619
|
+
//const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
|
|
1620
|
+
//const VCHAR$$ = "[\\x21-\\x7E]";
|
|
1621
|
+
//const WSP$$ = "[\\x20\\x09]";
|
|
1622
|
+
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
|
|
1623
|
+
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
|
|
1624
|
+
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
|
|
1625
|
+
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
|
|
1626
|
+
var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
|
|
1627
|
+
var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
|
|
1628
|
+
var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
|
|
1629
|
+
var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
|
|
1630
|
+
var UNRESERVED = new RegExp(UNRESERVED$$, "g");
|
|
1631
|
+
var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
|
|
1632
|
+
var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
|
|
1633
|
+
var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
|
|
1634
|
+
var NOT_HFVALUE = NOT_HFNAME;
|
|
1635
|
+
function decodeUnreserved(str) {
|
|
1636
|
+
var decStr = pctDecChars(str);
|
|
1637
|
+
return !decStr.match(UNRESERVED) ? str : decStr;
|
|
1638
|
+
}
|
|
1639
|
+
var handler$4 = {
|
|
1640
|
+
scheme: "mailto",
|
|
1641
|
+
parse: function parse$$1(components, options) {
|
|
1642
|
+
var mailtoComponents = components;
|
|
1643
|
+
var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
|
|
1644
|
+
mailtoComponents.path = undefined;
|
|
1645
|
+
if (mailtoComponents.query) {
|
|
1646
|
+
var unknownHeaders = false;
|
|
1647
|
+
var headers = {};
|
|
1648
|
+
var hfields = mailtoComponents.query.split("&");
|
|
1649
|
+
for (var x = 0, xl = hfields.length; x < xl; ++x) {
|
|
1650
|
+
var hfield = hfields[x].split("=");
|
|
1651
|
+
switch (hfield[0]) {
|
|
1652
|
+
case "to":
|
|
1653
|
+
var toAddrs = hfield[1].split(",");
|
|
1654
|
+
for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
|
|
1655
|
+
to.push(toAddrs[_x]);
|
|
1656
|
+
}
|
|
1657
|
+
break;
|
|
1658
|
+
case "subject":
|
|
1659
|
+
mailtoComponents.subject = unescapeComponent(hfield[1], options);
|
|
1660
|
+
break;
|
|
1661
|
+
case "body":
|
|
1662
|
+
mailtoComponents.body = unescapeComponent(hfield[1], options);
|
|
1663
|
+
break;
|
|
1664
|
+
default:
|
|
1665
|
+
unknownHeaders = true;
|
|
1666
|
+
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
if (unknownHeaders) mailtoComponents.headers = headers;
|
|
1671
|
+
}
|
|
1672
|
+
mailtoComponents.query = undefined;
|
|
1673
|
+
for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
|
|
1674
|
+
var addr = to[_x2].split("@");
|
|
1675
|
+
addr[0] = unescapeComponent(addr[0]);
|
|
1676
|
+
if (!options.unicodeSupport) {
|
|
1677
|
+
//convert Unicode IDN -> ASCII IDN
|
|
1678
|
+
try {
|
|
1679
|
+
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
|
|
1680
|
+
} catch (e) {
|
|
1681
|
+
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
|
|
1682
|
+
}
|
|
1683
|
+
} else {
|
|
1684
|
+
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
|
|
1685
|
+
}
|
|
1686
|
+
to[_x2] = addr.join("@");
|
|
1687
|
+
}
|
|
1688
|
+
return mailtoComponents;
|
|
1689
|
+
},
|
|
1690
|
+
serialize: function serialize$$1(mailtoComponents, options) {
|
|
1691
|
+
var components = mailtoComponents;
|
|
1692
|
+
var to = toArray(mailtoComponents.to);
|
|
1693
|
+
if (to) {
|
|
1694
|
+
for (var x = 0, xl = to.length; x < xl; ++x) {
|
|
1695
|
+
var toAddr = String(to[x]);
|
|
1696
|
+
var atIdx = toAddr.lastIndexOf("@");
|
|
1697
|
+
var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
|
|
1698
|
+
var domain = toAddr.slice(atIdx + 1);
|
|
1699
|
+
//convert IDN via punycode
|
|
1700
|
+
try {
|
|
1701
|
+
domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
|
|
1702
|
+
} catch (e) {
|
|
1703
|
+
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
1704
|
+
}
|
|
1705
|
+
to[x] = localPart + "@" + domain;
|
|
1706
|
+
}
|
|
1707
|
+
components.path = to.join(",");
|
|
1708
|
+
}
|
|
1709
|
+
var headers = mailtoComponents.headers = mailtoComponents.headers || {};
|
|
1710
|
+
if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
|
|
1711
|
+
if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
|
|
1712
|
+
var fields = [];
|
|
1713
|
+
for (var name in headers) {
|
|
1714
|
+
if (headers[name] !== O[name]) {
|
|
1715
|
+
fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
if (fields.length) {
|
|
1719
|
+
components.query = fields.join("&");
|
|
1720
|
+
}
|
|
1721
|
+
return components;
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1725
|
+
var URN_PARSE = /^([^\:]+)\:(.*)/;
|
|
1726
|
+
//RFC 2141
|
|
1727
|
+
var handler$5 = {
|
|
1728
|
+
scheme: "urn",
|
|
1729
|
+
parse: function parse$$1(components, options) {
|
|
1730
|
+
var matches = components.path && components.path.match(URN_PARSE);
|
|
1731
|
+
var urnComponents = components;
|
|
1732
|
+
if (matches) {
|
|
1733
|
+
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
1734
|
+
var nid = matches[1].toLowerCase();
|
|
1735
|
+
var nss = matches[2];
|
|
1736
|
+
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
1737
|
+
var schemeHandler = SCHEMES[urnScheme];
|
|
1738
|
+
urnComponents.nid = nid;
|
|
1739
|
+
urnComponents.nss = nss;
|
|
1740
|
+
urnComponents.path = undefined;
|
|
1741
|
+
if (schemeHandler) {
|
|
1742
|
+
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
1743
|
+
}
|
|
1744
|
+
} else {
|
|
1745
|
+
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
|
1746
|
+
}
|
|
1747
|
+
return urnComponents;
|
|
1748
|
+
},
|
|
1749
|
+
serialize: function serialize$$1(urnComponents, options) {
|
|
1750
|
+
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
1751
|
+
var nid = urnComponents.nid;
|
|
1752
|
+
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
1753
|
+
var schemeHandler = SCHEMES[urnScheme];
|
|
1754
|
+
if (schemeHandler) {
|
|
1755
|
+
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
1756
|
+
}
|
|
1757
|
+
var uriComponents = urnComponents;
|
|
1758
|
+
var nss = urnComponents.nss;
|
|
1759
|
+
uriComponents.path = (nid || options.nid) + ":" + nss;
|
|
1760
|
+
return uriComponents;
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
|
1765
|
+
//RFC 4122
|
|
1766
|
+
var handler$6 = {
|
|
1767
|
+
scheme: "urn:uuid",
|
|
1768
|
+
parse: function parse(urnComponents, options) {
|
|
1769
|
+
var uuidComponents = urnComponents;
|
|
1770
|
+
uuidComponents.uuid = uuidComponents.nss;
|
|
1771
|
+
uuidComponents.nss = undefined;
|
|
1772
|
+
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
|
1773
|
+
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
|
1774
|
+
}
|
|
1775
|
+
return uuidComponents;
|
|
1776
|
+
},
|
|
1777
|
+
serialize: function serialize(uuidComponents, options) {
|
|
1778
|
+
var urnComponents = uuidComponents;
|
|
1779
|
+
//normalize UUID
|
|
1780
|
+
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
1781
|
+
return urnComponents;
|
|
1782
|
+
}
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1785
|
+
SCHEMES[handler.scheme] = handler;
|
|
1786
|
+
SCHEMES[handler$1.scheme] = handler$1;
|
|
1787
|
+
SCHEMES[handler$2.scheme] = handler$2;
|
|
1788
|
+
SCHEMES[handler$3.scheme] = handler$3;
|
|
1789
|
+
SCHEMES[handler$4.scheme] = handler$4;
|
|
1790
|
+
SCHEMES[handler$5.scheme] = handler$5;
|
|
1791
|
+
SCHEMES[handler$6.scheme] = handler$6;
|
|
1792
|
+
|
|
1793
|
+
exports.SCHEMES = SCHEMES;
|
|
1794
|
+
exports.pctEncChar = pctEncChar;
|
|
1795
|
+
exports.pctDecChars = pctDecChars;
|
|
1796
|
+
exports.parse = parse;
|
|
1797
|
+
exports.removeDotSegments = removeDotSegments;
|
|
1798
|
+
exports.serialize = serialize;
|
|
1799
|
+
exports.resolveComponents = resolveComponents;
|
|
1800
|
+
exports.resolve = resolve;
|
|
1801
|
+
exports.normalize = normalize;
|
|
1802
|
+
exports.equal = equal;
|
|
1803
|
+
exports.escapeComponent = escapeComponent;
|
|
1804
|
+
exports.unescapeComponent = unescapeComponent;
|
|
1805
|
+
|
|
1806
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1807
|
+
|
|
1808
|
+
})));
|
|
1809
|
+
|
|
1810
|
+
} (uri_all, uri_all.exports));
|
|
1811
|
+
|
|
1812
|
+
const URI = uri_all.exports;
|
|
136
1813
|
|
|
137
|
-
function createDeliveryFunction( message, data, immediateExceptions ){
|
|
138
|
-
return function deliverNamespaced(){
|
|
139
|
-
var topic = String( message ),
|
|
140
|
-
position = topic.lastIndexOf( '.' );
|
|
141
|
-
|
|
142
|
-
// deliver the message as it is now
|
|
143
|
-
deliverMessage(message, message, data, immediateExceptions);
|
|
144
|
-
|
|
145
|
-
// trim the hierarchy and deliver message to each level
|
|
146
|
-
while( position !== -1 ){
|
|
147
|
-
topic = topic.substr( 0, position );
|
|
148
|
-
position = topic.lastIndexOf('.');
|
|
149
|
-
deliverMessage( message, topic, data, immediateExceptions );
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function hasDirectSubscribersFor( message ) {
|
|
157
|
-
var topic = String( message ),
|
|
158
|
-
found = Boolean(Object.prototype.hasOwnProperty.call( messages, topic ) && hasKeys(messages[topic]));
|
|
159
|
-
|
|
160
|
-
return found;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function messageHasSubscribers( message ){
|
|
164
|
-
var topic = String( message ),
|
|
165
|
-
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
|
|
166
|
-
position = topic.lastIndexOf( '.' );
|
|
167
|
-
|
|
168
|
-
while ( !found && position !== -1 ){
|
|
169
|
-
topic = topic.substr( 0, position );
|
|
170
|
-
position = topic.lastIndexOf( '.' );
|
|
171
|
-
found = hasDirectSubscribersFor(topic);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return found;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function publish( message, data, sync, immediateExceptions ){
|
|
178
|
-
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
179
|
-
|
|
180
|
-
var deliver = createDeliveryFunction( message, data, immediateExceptions ),
|
|
181
|
-
hasSubscribers = messageHasSubscribers( message );
|
|
182
|
-
|
|
183
|
-
if ( !hasSubscribers ){
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if ( sync === true ){
|
|
188
|
-
deliver();
|
|
189
|
-
} else {
|
|
190
|
-
setTimeout( deliver, 0 );
|
|
191
|
-
}
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Publishes the message, passing the data to it's subscribers
|
|
197
|
-
* @function
|
|
198
|
-
* @alias publish
|
|
199
|
-
* @param { String } message The message to publish
|
|
200
|
-
* @param {} data The data to pass to subscribers
|
|
201
|
-
* @return { Boolean }
|
|
202
|
-
*/
|
|
203
|
-
PubSub.publish = function( message, data ){
|
|
204
|
-
return publish( message, data, false, PubSub.immediateExceptions );
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Publishes the message synchronously, passing the data to it's subscribers
|
|
209
|
-
* @function
|
|
210
|
-
* @alias publishSync
|
|
211
|
-
* @param { String } message The message to publish
|
|
212
|
-
* @param {} data The data to pass to subscribers
|
|
213
|
-
* @return { Boolean }
|
|
214
|
-
*/
|
|
215
|
-
PubSub.publishSync = function( message, data ){
|
|
216
|
-
return publish( message, data, true, PubSub.immediateExceptions );
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Subscribes the passed function to the passed message. Every returned token is unique and should be stored if you need to unsubscribe
|
|
221
|
-
* @function
|
|
222
|
-
* @alias subscribe
|
|
223
|
-
* @param { String } message The message to subscribe to
|
|
224
|
-
* @param { Function } func The function to call when a new message is published
|
|
225
|
-
* @return { String }
|
|
226
|
-
*/
|
|
227
|
-
PubSub.subscribe = function( message, func ){
|
|
228
|
-
if ( typeof func !== 'function'){
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
message = (typeof message === 'symbol') ? message.toString() : message;
|
|
233
|
-
|
|
234
|
-
// message is not registered yet
|
|
235
|
-
if ( !Object.prototype.hasOwnProperty.call( messages, message ) ){
|
|
236
|
-
messages[message] = {};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// forcing token as String, to allow for future expansions without breaking usage
|
|
240
|
-
// and allow for easy use as key names for the 'messages' object
|
|
241
|
-
var token = 'uid_' + String(++lastUid);
|
|
242
|
-
messages[message][token] = func;
|
|
243
|
-
|
|
244
|
-
// return token for unsubscribing
|
|
245
|
-
return token;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
PubSub.subscribeAll = function( func ){
|
|
249
|
-
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Subscribes the passed function to the passed message once
|
|
254
|
-
* @function
|
|
255
|
-
* @alias subscribeOnce
|
|
256
|
-
* @param { String } message The message to subscribe to
|
|
257
|
-
* @param { Function } func The function to call when a new message is published
|
|
258
|
-
* @return { PubSub }
|
|
259
|
-
*/
|
|
260
|
-
PubSub.subscribeOnce = function( message, func ){
|
|
261
|
-
var token = PubSub.subscribe( message, function(){
|
|
262
|
-
// before func apply, unsubscribe message
|
|
263
|
-
PubSub.unsubscribe( token );
|
|
264
|
-
func.apply( this, arguments );
|
|
265
|
-
});
|
|
266
|
-
return PubSub;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Clears all subscriptions
|
|
271
|
-
* @function
|
|
272
|
-
* @public
|
|
273
|
-
* @alias clearAllSubscriptions
|
|
274
|
-
*/
|
|
275
|
-
PubSub.clearAllSubscriptions = function clearAllSubscriptions(){
|
|
276
|
-
messages = {};
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Clear subscriptions by the topic
|
|
281
|
-
* @function
|
|
282
|
-
* @public
|
|
283
|
-
* @alias clearAllSubscriptions
|
|
284
|
-
* @return { int }
|
|
285
|
-
*/
|
|
286
|
-
PubSub.clearSubscriptions = function clearSubscriptions(topic){
|
|
287
|
-
var m;
|
|
288
|
-
for (m in messages){
|
|
289
|
-
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
290
|
-
delete messages[m];
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
Count subscriptions by the topic
|
|
297
|
-
* @function
|
|
298
|
-
* @public
|
|
299
|
-
* @alias countSubscriptions
|
|
300
|
-
* @return { Array }
|
|
301
|
-
*/
|
|
302
|
-
PubSub.countSubscriptions = function countSubscriptions(topic){
|
|
303
|
-
var m;
|
|
304
|
-
// eslint-disable-next-line no-unused-vars
|
|
305
|
-
var token;
|
|
306
|
-
var count = 0;
|
|
307
|
-
for (m in messages) {
|
|
308
|
-
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0) {
|
|
309
|
-
for (token in messages[m]) {
|
|
310
|
-
count++;
|
|
311
|
-
}
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return count;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
Gets subscriptions by the topic
|
|
321
|
-
* @function
|
|
322
|
-
* @public
|
|
323
|
-
* @alias getSubscriptions
|
|
324
|
-
*/
|
|
325
|
-
PubSub.getSubscriptions = function getSubscriptions(topic){
|
|
326
|
-
var m;
|
|
327
|
-
var list = [];
|
|
328
|
-
for (m in messages){
|
|
329
|
-
if (Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0){
|
|
330
|
-
list.push(m);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return list;
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Removes subscriptions
|
|
338
|
-
*
|
|
339
|
-
* - When passed a token, removes a specific subscription.
|
|
340
|
-
*
|
|
341
|
-
* - When passed a function, removes all subscriptions for that function
|
|
342
|
-
*
|
|
343
|
-
* - When passed a topic, removes all subscriptions for that topic (hierarchy)
|
|
344
|
-
* @function
|
|
345
|
-
* @public
|
|
346
|
-
* @alias subscribeOnce
|
|
347
|
-
* @param { String | Function } value A token, function or topic to unsubscribe from
|
|
348
|
-
* @example // Unsubscribing with a token
|
|
349
|
-
* var token = PubSub.subscribe('mytopic', myFunc);
|
|
350
|
-
* PubSub.unsubscribe(token);
|
|
351
|
-
* @example // Unsubscribing with a function
|
|
352
|
-
* PubSub.unsubscribe(myFunc);
|
|
353
|
-
* @example // Unsubscribing from a topic
|
|
354
|
-
* PubSub.unsubscribe('mytopic');
|
|
355
|
-
*/
|
|
356
|
-
PubSub.unsubscribe = function(value){
|
|
357
|
-
var descendantTopicExists = function(topic) {
|
|
358
|
-
var m;
|
|
359
|
-
for ( m in messages ){
|
|
360
|
-
if ( Object.prototype.hasOwnProperty.call(messages, m) && m.indexOf(topic) === 0 ){
|
|
361
|
-
// a descendant of the topic exists:
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return false;
|
|
367
|
-
},
|
|
368
|
-
isTopic = typeof value === 'string' && ( Object.prototype.hasOwnProperty.call(messages, value) || descendantTopicExists(value) ),
|
|
369
|
-
isToken = !isTopic && typeof value === 'string',
|
|
370
|
-
isFunction = typeof value === 'function',
|
|
371
|
-
result = false,
|
|
372
|
-
m, message, t;
|
|
373
|
-
|
|
374
|
-
if (isTopic){
|
|
375
|
-
PubSub.clearSubscriptions(value);
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
for ( m in messages ){
|
|
380
|
-
if ( Object.prototype.hasOwnProperty.call( messages, m ) ){
|
|
381
|
-
message = messages[m];
|
|
382
|
-
|
|
383
|
-
if ( isToken && message[value] ){
|
|
384
|
-
delete message[value];
|
|
385
|
-
result = value;
|
|
386
|
-
// tokens are unique, so we can just stop here
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (isFunction) {
|
|
391
|
-
for ( t in message ){
|
|
392
|
-
if (Object.prototype.hasOwnProperty.call(message, t) && message[t] === value){
|
|
393
|
-
delete message[t];
|
|
394
|
-
result = true;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return result;
|
|
402
|
-
};
|
|
403
|
-
}));
|
|
404
|
-
});
|
|
405
|
-
pubsub.PubSub;
|
|
406
|
-
|
|
407
|
-
var urlResolveBrowser = urlResolve;
|
|
408
|
-
|
|
409
|
-
/*
|
|
410
|
-
The majority of the module is built by following RFC1808
|
|
411
|
-
url: https://tools.ietf.org/html/rfc1808
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
// adds a slash at end if not present
|
|
415
|
-
function _addSlash (url) {
|
|
416
|
-
return url + (url[url.length-1] === '/' ? '' : '/');
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// resolve the ..'s (directory up) and such
|
|
420
|
-
function _pathResolve (path) {
|
|
421
|
-
let pathSplit = path.split('/');
|
|
422
|
-
|
|
423
|
-
// happens when path starts with /
|
|
424
|
-
if (pathSplit[0] === '') {
|
|
425
|
-
pathSplit = pathSplit.slice(1);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// let segmentCount = 0; // number of segments that have been passed
|
|
429
|
-
let resultArray = [];
|
|
430
|
-
pathSplit.forEach((current, index) => {
|
|
431
|
-
// skip occurances of '.'
|
|
432
|
-
if (current !== '.') {
|
|
433
|
-
if (current === '..') {
|
|
434
|
-
resultArray.pop(); // remove previous
|
|
435
|
-
} else if (current !== '' || index === pathSplit.length - 1) {
|
|
436
|
-
resultArray.push(current);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
return '/' + resultArray.join('/');
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// parses a base url string into an object containing host, path and query
|
|
444
|
-
function _baseParse (base) {
|
|
445
|
-
const resultObject = {
|
|
446
|
-
host: '',
|
|
447
|
-
path: '',
|
|
448
|
-
query: '',
|
|
449
|
-
protocol: ''
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
let path = base;
|
|
453
|
-
let protocolEndIndex = base.indexOf('//');
|
|
454
|
-
|
|
455
|
-
resultObject.protocol = path.substring(0, protocolEndIndex);
|
|
456
|
-
|
|
457
|
-
protocolEndIndex += 2; // add two to pass double slash
|
|
458
|
-
|
|
459
|
-
const pathIndex = base.indexOf('/', protocolEndIndex);
|
|
460
|
-
const queryIndex = base.indexOf('?');
|
|
461
|
-
const hashIndex = base.indexOf('#');
|
|
462
|
-
|
|
463
|
-
if (hashIndex !== -1) {
|
|
464
|
-
path = path.substring(0, hashIndex); // remove hash, not needed for base
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
if (queryIndex !== -1) {
|
|
468
|
-
const query = path.substring(queryIndex); // remove query, save in return obj
|
|
469
|
-
resultObject.query = query;
|
|
470
|
-
path = path.substring(0, queryIndex);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (pathIndex !== -1) {
|
|
474
|
-
const host = path.substring(0, pathIndex); // separate host & path
|
|
475
|
-
resultObject.host = host;
|
|
476
|
-
path = path.substring(pathIndex);
|
|
477
|
-
resultObject.path = path;
|
|
478
|
-
} else {
|
|
479
|
-
resultObject.host = path; // there was no path, therefore path is host
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
return resultObject;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// https://tools.ietf.org/html/rfc3986#section-3.1
|
|
486
|
-
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )]
|
|
487
|
-
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i');
|
|
488
|
-
|
|
489
|
-
// parses a relative url string into an object containing the href,
|
|
490
|
-
// hash, query and whether it is a net path, absolute path or relative path
|
|
491
|
-
function _relativeParse (relative) {
|
|
492
|
-
const resultObject = {
|
|
493
|
-
href: relative, // href is always what was passed through
|
|
494
|
-
hash: '',
|
|
495
|
-
query: '',
|
|
496
|
-
netPath: false,
|
|
497
|
-
absolutePath: false,
|
|
498
|
-
relativePath: false
|
|
499
|
-
};
|
|
500
|
-
// check for protocol
|
|
501
|
-
// if protocol exists, is net path (absolute URL)
|
|
502
|
-
if (_isAbsolute.test(relative)) {
|
|
503
|
-
resultObject.netPath = true;
|
|
504
|
-
// return, in this case the relative is the resolved url, no need to parse.
|
|
505
|
-
return resultObject;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// if / is first, this is an absolute path,
|
|
509
|
-
// I.E. it overwrites the base URL's path
|
|
510
|
-
if (relative[0] === '/') {
|
|
511
|
-
resultObject.absolutePath = true;
|
|
512
|
-
// return resultObject
|
|
513
|
-
} else if (relative !== '') {
|
|
514
|
-
resultObject.relativePath = true;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
let path = relative;
|
|
518
|
-
const queryIndex = relative.indexOf('?');
|
|
519
|
-
const hashIndex = relative.indexOf('#');
|
|
520
|
-
|
|
521
|
-
if (hashIndex !== -1) {
|
|
522
|
-
const hash = path.substring(hashIndex);
|
|
523
|
-
resultObject.hash = hash;
|
|
524
|
-
path = path.substring(0, hashIndex);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
if (queryIndex !== -1) {
|
|
528
|
-
const query = path.substring(queryIndex);
|
|
529
|
-
resultObject.query = query;
|
|
530
|
-
path = path.substring(0, queryIndex);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
resultObject.path = path; // whatever is left is path
|
|
534
|
-
return resultObject;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
function _shouldAddSlash (url) {
|
|
538
|
-
const protocolIndex = url.indexOf('//') + 2;
|
|
539
|
-
const noPath = !(url.includes('/', protocolIndex));
|
|
540
|
-
const noQuery = !(url.includes('?', protocolIndex));
|
|
541
|
-
const noHash = !(url.includes('#', protocolIndex));
|
|
542
|
-
return (noPath && noQuery && noHash);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
function _shouldAddProtocol (url) {
|
|
546
|
-
return url.startsWith('//');
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/*
|
|
550
|
-
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/
|
|
551
|
-
* optional: path, query or hash
|
|
552
|
-
* returns the resolved url
|
|
553
|
-
*/
|
|
554
|
-
function urlResolve (base, relative) {
|
|
555
|
-
base = base.trim();
|
|
556
|
-
relative = relative.trim();
|
|
557
|
-
|
|
558
|
-
// about is always absolute
|
|
559
|
-
if (relative.startsWith('about:')) {
|
|
560
|
-
return relative;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
const baseObj = _baseParse(base);
|
|
564
|
-
const relativeObj = _relativeParse(relative);
|
|
565
|
-
|
|
566
|
-
if (!baseObj.protocol && !relativeObj.netPath) {
|
|
567
|
-
throw new Error('Error, protocol is not specified');
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
if (relativeObj.netPath) { // relative is full qualified URL
|
|
571
|
-
if (_shouldAddProtocol(relativeObj.href)) {
|
|
572
|
-
relativeObj.href = baseObj.protocol + relativeObj.href;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (_shouldAddSlash(relativeObj.href)) {
|
|
576
|
-
return _addSlash(relativeObj.href);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
return relativeObj.href;
|
|
580
|
-
} else if (relativeObj.absolutePath) { // relative is an absolute path
|
|
581
|
-
const {path, query, hash} = relativeObj;
|
|
582
|
-
|
|
583
|
-
return baseObj.host + _pathResolve(path) + query + hash;
|
|
584
|
-
} else if (relativeObj.relativePath) { // relative is a relative path
|
|
585
|
-
const {path, query, hash} = relativeObj;
|
|
586
|
-
|
|
587
|
-
let basePath = baseObj.path;
|
|
588
|
-
let resultString = baseObj.host;
|
|
589
|
-
|
|
590
|
-
let resolvePath;
|
|
591
|
-
|
|
592
|
-
if (path.length === 0) {
|
|
593
|
-
resolvePath = basePath;
|
|
594
|
-
} else {
|
|
595
|
-
// remove last segment if no slash at end
|
|
596
|
-
basePath = basePath.substring(0, basePath.lastIndexOf('/'));
|
|
597
|
-
resolvePath = _pathResolve(basePath + '/' + path);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// if result is just the base host, add /
|
|
601
|
-
if ((resolvePath === '') && (!query) && (!hash)) {
|
|
602
|
-
resultString += '/';
|
|
603
|
-
} else {
|
|
604
|
-
resultString += resolvePath + query + hash;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
return resultString;
|
|
608
|
-
} else {
|
|
609
|
-
const {host, path, query} = baseObj;
|
|
610
|
-
// when path and query aren't supplied add slash
|
|
611
|
-
if ((!path) && (!query)) {
|
|
612
|
-
return _addSlash(host);
|
|
613
|
-
}
|
|
614
|
-
return host + path + query + relativeObj.hash;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
1814
|
|
|
618
1815
|
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
619
1816
|
const isType = {
|
|
@@ -627,29 +1824,17 @@ const isType = {
|
|
|
627
1824
|
};
|
|
628
1825
|
const jsonTypeOf$2 = (value, type) => isType[type](value);
|
|
629
1826
|
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
const urlFragment = url.slice(ndx + 1);
|
|
635
|
-
|
|
636
|
-
return [decodeURI(urlReference), decodeURI(urlFragment)];
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
const getScheme = (url) => {
|
|
640
|
-
const matches = RegExp(/^(.+):\/\//).exec(url);
|
|
641
|
-
return matches ? matches[1] : "";
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
const safeResolveUrl$1 = (contextUrl, url) => {
|
|
645
|
-
const resolvedUrl = urlResolveBrowser(contextUrl, url);
|
|
646
|
-
const contextId = splitUrl$4(contextUrl)[0];
|
|
647
|
-
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") {
|
|
1827
|
+
const resolveUrl$3 = (contextUrl, url) => {
|
|
1828
|
+
const resolvedUrl = URI.resolve(contextUrl, url, { iri: true });
|
|
1829
|
+
const contextId = URI.resolve(contextUrl, "", { iri: true });
|
|
1830
|
+
if (contextId && URI.parse(resolvedUrl).scheme === "file" && URI.parse(contextUrl).scheme !== "file") {
|
|
648
1831
|
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`);
|
|
649
1832
|
}
|
|
650
1833
|
return resolvedUrl;
|
|
651
1834
|
};
|
|
652
1835
|
|
|
1836
|
+
const urlFragment$1 = (uri) => URI.unescapeComponent(URI.parse(uri).fragment) || "";
|
|
1837
|
+
|
|
653
1838
|
const CHAR_BACKWARD_SLASH = 47;
|
|
654
1839
|
|
|
655
1840
|
const pathRelative$1 = (from, to) => {
|
|
@@ -713,7 +1898,10 @@ const pathRelative$1 = (from, to) => {
|
|
|
713
1898
|
return to.slice(toStart, to.length);
|
|
714
1899
|
};
|
|
715
1900
|
|
|
716
|
-
var common$1 = { jsonTypeOf: jsonTypeOf$2,
|
|
1901
|
+
var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
|
|
1902
|
+
|
|
1903
|
+
const curry$9 = justCurryIt;
|
|
1904
|
+
|
|
717
1905
|
|
|
718
1906
|
const nil$2 = "";
|
|
719
1907
|
|
|
@@ -737,7 +1925,7 @@ const get$1 = (pointer, value = undefined) => {
|
|
|
737
1925
|
|
|
738
1926
|
const set = (pointer, subject = undefined, value = undefined) => {
|
|
739
1927
|
const ptr = compile$P(pointer);
|
|
740
|
-
const fn =
|
|
1928
|
+
const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$2));
|
|
741
1929
|
return subject === undefined ? fn : fn(subject, value);
|
|
742
1930
|
};
|
|
743
1931
|
|
|
@@ -761,7 +1949,7 @@ const _set = (pointer, subject, value, cursor) => {
|
|
|
761
1949
|
|
|
762
1950
|
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
763
1951
|
const ptr = compile$P(pointer);
|
|
764
|
-
const fn =
|
|
1952
|
+
const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$2));
|
|
765
1953
|
return subject === undefined ? fn : fn(subject, value);
|
|
766
1954
|
};
|
|
767
1955
|
|
|
@@ -823,7 +2011,7 @@ const _remove = (pointer, subject, cursor) => {
|
|
|
823
2011
|
}
|
|
824
2012
|
};
|
|
825
2013
|
|
|
826
|
-
const append =
|
|
2014
|
+
const append = curry$9((segment, pointer) => pointer + "/" + escape(segment));
|
|
827
2015
|
|
|
828
2016
|
const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
829
2017
|
const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
@@ -845,13 +2033,6 @@ const applySegment = (value, segment, cursor = "") => {
|
|
|
845
2033
|
const isScalar = (value) => value === null || typeof value !== "object";
|
|
846
2034
|
|
|
847
2035
|
var lib$3 = { nil: nil$2, append, get: get$1, set, assign, unset, remove };
|
|
848
|
-
lib$3.nil;
|
|
849
|
-
lib$3.append;
|
|
850
|
-
lib$3.get;
|
|
851
|
-
lib$3.set;
|
|
852
|
-
lib$3.assign;
|
|
853
|
-
lib$3.unset;
|
|
854
|
-
lib$3.remove;
|
|
855
2036
|
|
|
856
2037
|
const $__value = Symbol("$__value");
|
|
857
2038
|
const $__href = Symbol("$__href");
|
|
@@ -866,67 +2047,134 @@ const href = (ref) => ref[$__href];
|
|
|
866
2047
|
const value$2 = (ref) => ref[$__value];
|
|
867
2048
|
|
|
868
2049
|
var reference = { cons: cons$1, isReference, href, value: value$2 };
|
|
869
|
-
reference.cons;
|
|
870
|
-
reference.isReference;
|
|
871
|
-
reference.href;
|
|
872
|
-
reference.value;
|
|
873
|
-
|
|
874
|
-
const { jsonTypeOf: jsonTypeOf$1 } = common$1;
|
|
875
2050
|
|
|
2051
|
+
const JsonPointer$1 = lib$3;
|
|
2052
|
+
const curry$8 = justCurryIt;
|
|
2053
|
+
const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
|
|
2054
|
+
const Reference$2 = reference;
|
|
876
2055
|
|
|
877
2056
|
|
|
878
2057
|
const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
|
|
879
|
-
const cons = (instance, id = "") => Object.freeze({ ...nil$1, id, instance, value: instance });
|
|
2058
|
+
const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
|
|
880
2059
|
const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
|
|
881
|
-
const value$1 = (doc) =>
|
|
2060
|
+
const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
|
|
882
2061
|
const has$1 = (key, doc) => key in value$1(doc);
|
|
883
|
-
const typeOf$1 =
|
|
2062
|
+
const typeOf$1 = curry$8((doc, type) => jsonTypeOf$1(value$1(doc), type));
|
|
884
2063
|
|
|
885
2064
|
const step$1 = (key, doc) => Object.freeze({
|
|
886
2065
|
...doc,
|
|
887
|
-
pointer:
|
|
2066
|
+
pointer: JsonPointer$1.append(key, doc.pointer),
|
|
888
2067
|
value: value$1(doc)[key]
|
|
889
2068
|
});
|
|
890
2069
|
|
|
891
|
-
const entries$
|
|
2070
|
+
const entries$3 = (doc) => Object.keys(value$1(doc))
|
|
892
2071
|
.map((key) => [key, step$1(key, doc)]);
|
|
893
2072
|
|
|
894
2073
|
const keys$1 = (doc) => Object.keys(value$1(doc));
|
|
895
2074
|
|
|
896
|
-
const map$
|
|
2075
|
+
const map$4 = curry$8((fn, doc) => value$1(doc)
|
|
897
2076
|
.map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
898
2077
|
|
|
899
|
-
const filter$1 =
|
|
2078
|
+
const filter$1 = curry$8((fn, doc) => value$1(doc)
|
|
900
2079
|
.map((item, ndx, array, thisArg) => step$1(ndx, doc))
|
|
901
2080
|
.filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
|
|
902
2081
|
|
|
903
|
-
const reduce$
|
|
2082
|
+
const reduce$3 = curry$8((fn, acc, doc) => value$1(doc)
|
|
904
2083
|
.reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
|
|
905
2084
|
|
|
906
|
-
const every$1 =
|
|
2085
|
+
const every$1 = curry$8((fn, doc) => value$1(doc)
|
|
907
2086
|
.every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
908
2087
|
|
|
909
|
-
const some$1 =
|
|
2088
|
+
const some$1 = curry$8((fn, doc) => value$1(doc)
|
|
910
2089
|
.some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
911
2090
|
|
|
912
2091
|
const length$1 = (doc) => value$1(doc).length;
|
|
913
2092
|
|
|
914
|
-
var instance = { nil: nil$1, cons, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, step: step$1, entries: entries$
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
2093
|
+
var instance = { nil: nil$1, cons, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, step: step$1, entries: entries$3, keys: keys$1, map: map$4, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1, length: length$1 };
|
|
2094
|
+
|
|
2095
|
+
var entries$2 = async (doc) => Object.entries(await doc);
|
|
2096
|
+
|
|
2097
|
+
const curry$7 = justCurryIt;
|
|
2098
|
+
|
|
2099
|
+
|
|
2100
|
+
var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
|
|
2101
|
+
|
|
2102
|
+
const curry$6 = justCurryIt;
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
var reduce$2 = curry$6(async (fn, acc, doc) => {
|
|
2106
|
+
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
2107
|
+
});
|
|
2108
|
+
|
|
2109
|
+
const curry$5 = justCurryIt;
|
|
2110
|
+
const reduce$1 = reduce$2;
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
var filter = curry$5(async (fn, doc, options = {}) => {
|
|
2114
|
+
return reduce$1(async (acc, item) => {
|
|
2115
|
+
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
2116
|
+
}, [], doc, options);
|
|
2117
|
+
});
|
|
2118
|
+
|
|
2119
|
+
const curry$4 = justCurryIt;
|
|
2120
|
+
const map$2 = map$3;
|
|
2121
|
+
|
|
2122
|
+
|
|
2123
|
+
var some = curry$4(async (fn, doc) => {
|
|
2124
|
+
const results = await map$2(fn, doc);
|
|
2125
|
+
return (await Promise.all(results))
|
|
2126
|
+
.some((a) => a);
|
|
2127
|
+
});
|
|
2128
|
+
|
|
2129
|
+
const curry$3 = justCurryIt;
|
|
2130
|
+
const map$1 = map$3;
|
|
2131
|
+
|
|
2132
|
+
|
|
2133
|
+
var every = curry$3(async (fn, doc) => {
|
|
2134
|
+
const results = await map$1(fn, doc);
|
|
2135
|
+
return (await Promise.all(results))
|
|
2136
|
+
.every((a) => a);
|
|
2137
|
+
});
|
|
2138
|
+
|
|
2139
|
+
const curry$2 = justCurryIt;
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
var pipeline$1 = curry$2((fns, doc) => {
|
|
2143
|
+
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
2144
|
+
});
|
|
2145
|
+
|
|
2146
|
+
var all = (doc) => Promise.all(doc);
|
|
2147
|
+
|
|
2148
|
+
const pipeline = pipeline$1;
|
|
2149
|
+
const entries$1 = entries$2;
|
|
2150
|
+
const reduce = reduce$2;
|
|
2151
|
+
|
|
2152
|
+
|
|
2153
|
+
var allValues = (doc) => {
|
|
2154
|
+
return pipeline([
|
|
2155
|
+
entries$1,
|
|
2156
|
+
reduce(async (acc, [propertyName, propertyValue]) => {
|
|
2157
|
+
acc[propertyName] = await propertyValue;
|
|
2158
|
+
return acc;
|
|
2159
|
+
}, {})
|
|
2160
|
+
], doc);
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
var lib$2 = {
|
|
2164
|
+
entries: entries$2,
|
|
2165
|
+
map: map$3,
|
|
2166
|
+
filter: filter,
|
|
2167
|
+
reduce: reduce$2,
|
|
2168
|
+
some: some,
|
|
2169
|
+
every: every,
|
|
2170
|
+
pipeline: pipeline$1,
|
|
2171
|
+
all: all,
|
|
2172
|
+
allValues: allValues
|
|
2173
|
+
};
|
|
2174
|
+
|
|
2175
|
+
var fetch_browser = fetch;
|
|
2176
|
+
|
|
2177
|
+
var contentType = {};
|
|
930
2178
|
|
|
931
2179
|
/*!
|
|
932
2180
|
* content-type
|
|
@@ -979,8 +2227,8 @@ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
|
979
2227
|
* @public
|
|
980
2228
|
*/
|
|
981
2229
|
|
|
982
|
-
|
|
983
|
-
|
|
2230
|
+
contentType.format = format$1;
|
|
2231
|
+
contentType.parse = parse$1;
|
|
984
2232
|
|
|
985
2233
|
/**
|
|
986
2234
|
* Format object to media type.
|
|
@@ -1031,7 +2279,7 @@ function format$1 (obj) {
|
|
|
1031
2279
|
* @public
|
|
1032
2280
|
*/
|
|
1033
2281
|
|
|
1034
|
-
function parse (string) {
|
|
2282
|
+
function parse$1 (string) {
|
|
1035
2283
|
if (!string) {
|
|
1036
2284
|
throw new TypeError('argument string is required')
|
|
1037
2285
|
}
|
|
@@ -1149,97 +2397,61 @@ function ContentType (type) {
|
|
|
1149
2397
|
this.type = type;
|
|
1150
2398
|
}
|
|
1151
2399
|
|
|
1152
|
-
|
|
1153
|
-
format: format_1,
|
|
1154
|
-
parse: parse_1
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
var entries$1 = async (doc) => Object.entries(await doc);
|
|
1158
|
-
|
|
1159
|
-
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn));
|
|
1160
|
-
|
|
1161
|
-
var reduce = justCurryIt(async (fn, acc, doc) => {
|
|
1162
|
-
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
1163
|
-
});
|
|
1164
|
-
|
|
1165
|
-
var filter = justCurryIt(async (fn, doc, options = {}) => {
|
|
1166
|
-
return reduce(async (acc, item) => {
|
|
1167
|
-
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
1168
|
-
}, [], doc, options);
|
|
1169
|
-
});
|
|
1170
|
-
|
|
1171
|
-
var some = justCurryIt(async (fn, doc) => {
|
|
1172
|
-
const results = await map$1(fn, doc);
|
|
1173
|
-
return (await Promise.all(results))
|
|
1174
|
-
.some((a) => a);
|
|
1175
|
-
});
|
|
1176
|
-
|
|
1177
|
-
var every = justCurryIt(async (fn, doc) => {
|
|
1178
|
-
const results = await map$1(fn, doc);
|
|
1179
|
-
return (await Promise.all(results))
|
|
1180
|
-
.every((a) => a);
|
|
1181
|
-
});
|
|
2400
|
+
const contentTypeParser = contentType;
|
|
1182
2401
|
|
|
1183
|
-
var pipeline = justCurryIt((fns, doc) => {
|
|
1184
|
-
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
1185
|
-
});
|
|
1186
2402
|
|
|
1187
|
-
|
|
2403
|
+
const mediaTypePlugins = {};
|
|
1188
2404
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
entries$1,
|
|
1192
|
-
reduce(async (acc, [propertyName, propertyValue]) => {
|
|
1193
|
-
acc[propertyName] = await propertyValue;
|
|
1194
|
-
return acc;
|
|
1195
|
-
}, {})
|
|
1196
|
-
], doc);
|
|
2405
|
+
const addPlugin = (contentType, plugin) => {
|
|
2406
|
+
mediaTypePlugins[contentType] = plugin;
|
|
1197
2407
|
};
|
|
1198
2408
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
every: every,
|
|
1206
|
-
pipeline: pipeline,
|
|
1207
|
-
all: all,
|
|
1208
|
-
allValues: allValues
|
|
2409
|
+
const parse = (response) => {
|
|
2410
|
+
const contentType = contentTypeParser.parse(response.headers.get("content-type")).type;
|
|
2411
|
+
if (!(contentType in mediaTypePlugins)) {
|
|
2412
|
+
throw Error(`${response.url} is not a schema. Found a document with media type: ${contentType}`);
|
|
2413
|
+
}
|
|
2414
|
+
return mediaTypePlugins[contentType].parse(response);
|
|
1209
2415
|
};
|
|
1210
|
-
lib$2.entries;
|
|
1211
|
-
lib$2.map;
|
|
1212
|
-
lib$2.filter;
|
|
1213
|
-
lib$2.reduce;
|
|
1214
|
-
lib$2.some;
|
|
1215
|
-
lib$2.every;
|
|
1216
|
-
lib$2.pipeline;
|
|
1217
|
-
lib$2.all;
|
|
1218
|
-
lib$2.allValues;
|
|
1219
2416
|
|
|
1220
|
-
|
|
2417
|
+
const getContentType = (path) => {
|
|
2418
|
+
for (const contentType in mediaTypePlugins) {
|
|
2419
|
+
if (mediaTypePlugins[contentType].matcher(path)) {
|
|
2420
|
+
return contentType;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
return "application/octet-stream";
|
|
2425
|
+
};
|
|
1221
2426
|
|
|
1222
|
-
|
|
2427
|
+
var mediaTypes = { addPlugin, parse, getContentType };
|
|
1223
2428
|
|
|
2429
|
+
const curry$1 = justCurryIt;
|
|
2430
|
+
const Pact$a = lib$2;
|
|
2431
|
+
const JsonPointer = lib$3;
|
|
2432
|
+
const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
|
|
2433
|
+
const fetch$1 = fetch_browser;
|
|
2434
|
+
const Reference$1 = reference;
|
|
2435
|
+
const MediaTypes$1 = mediaTypes;
|
|
1224
2436
|
|
|
1225
2437
|
|
|
2438
|
+
const core201909Id = "https://json-schema.org/draft/2019-09/vocab/core";
|
|
2439
|
+
const core202012Id = "https://json-schema.org/draft/2020-12/vocab/core";
|
|
1226
2440
|
|
|
1227
2441
|
// Config
|
|
1228
2442
|
const config = {};
|
|
1229
|
-
const
|
|
2443
|
+
const dialectJsonSchemaVersion = {};
|
|
1230
2444
|
|
|
1231
|
-
const setConfig = (
|
|
1232
|
-
if (!config[
|
|
1233
|
-
config[
|
|
2445
|
+
const setConfig = (jsonSchemaVersion, key, value) => {
|
|
2446
|
+
if (!config[jsonSchemaVersion]) {
|
|
2447
|
+
config[jsonSchemaVersion] = {};
|
|
1234
2448
|
}
|
|
1235
|
-
config[
|
|
2449
|
+
config[jsonSchemaVersion][key] = value;
|
|
1236
2450
|
};
|
|
1237
2451
|
|
|
1238
|
-
const getConfig = (
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
return config[configVersion][key];
|
|
1242
|
-
}
|
|
2452
|
+
const getConfig = (dialectId, key) => {
|
|
2453
|
+
const jsonSchemaVersion = dialectJsonSchemaVersion[dialectId];
|
|
2454
|
+
return config[jsonSchemaVersion]?.[key];
|
|
1243
2455
|
};
|
|
1244
2456
|
|
|
1245
2457
|
// Schema Management
|
|
@@ -1248,34 +2460,56 @@ const schemaStoreAlias = {};
|
|
|
1248
2460
|
|
|
1249
2461
|
const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
1250
2462
|
schema = JSON.parse(JSON.stringify(schema));
|
|
2463
|
+
const externalId = resolveUrl$1(url, "");
|
|
1251
2464
|
|
|
1252
|
-
// Schema Version
|
|
1253
|
-
const
|
|
1254
|
-
if (!
|
|
1255
|
-
throw Error("Couldn't determine schema
|
|
2465
|
+
// Dialect / JSON Schema Version
|
|
2466
|
+
const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
|
|
2467
|
+
if (!dialectId) {
|
|
2468
|
+
throw Error("Couldn't determine schema dialect");
|
|
1256
2469
|
}
|
|
1257
2470
|
delete schema["$schema"];
|
|
1258
2471
|
|
|
1259
|
-
//
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
2472
|
+
// JSON Schema version
|
|
2473
|
+
if (!(dialectId in dialectJsonSchemaVersion)) {
|
|
2474
|
+
if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core201909Id)[0]) {
|
|
2475
|
+
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
2476
|
+
} else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core202012Id)[0]) {
|
|
2477
|
+
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
2478
|
+
} else if (dialectId === getSchemaIdentifier(schema, externalId, dialectId)[0]) {
|
|
2479
|
+
dialectJsonSchemaVersion[dialectId] = dialectId;
|
|
2480
|
+
} else if (!(dialectId in schemaStore)) {
|
|
2481
|
+
throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
|
|
2482
|
+
} else {
|
|
2483
|
+
const metaSchema = schemaStore[dialectId];
|
|
2484
|
+
if (metaSchema.vocabulary[core201909Id] === true) {
|
|
2485
|
+
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
2486
|
+
} else if (metaSchema.vocabulary[core202012Id] === true) {
|
|
2487
|
+
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
2488
|
+
} else {
|
|
2489
|
+
dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
// Internal Identifier
|
|
2495
|
+
const [id, fragment] = getSchemaIdentifier(schema, externalId, dialectJsonSchemaVersion[dialectId]);
|
|
2496
|
+
if (!id) {
|
|
1264
2497
|
throw Error("Couldn't determine an identifier for the schema");
|
|
1265
2498
|
}
|
|
1266
|
-
const
|
|
1267
|
-
const [id, fragment] = splitUrl$3(internalUrl);
|
|
2499
|
+
const baseToken = getConfig(dialectId, "baseToken");
|
|
1268
2500
|
delete schema[baseToken];
|
|
1269
|
-
if (fragment && baseToken === anchorToken) {
|
|
1270
|
-
schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
|
|
1271
|
-
}
|
|
1272
2501
|
if (externalId) {
|
|
1273
2502
|
schemaStoreAlias[externalId] = id;
|
|
1274
2503
|
}
|
|
1275
2504
|
|
|
2505
|
+
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
2506
|
+
if (fragment && baseToken === anchorToken) {
|
|
2507
|
+
schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
|
|
2508
|
+
}
|
|
2509
|
+
|
|
1276
2510
|
// recursiveAnchor
|
|
1277
2511
|
const dynamicAnchors = {};
|
|
1278
|
-
const recursiveAnchorToken = getConfig(
|
|
2512
|
+
const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
|
|
1279
2513
|
if (schema[recursiveAnchorToken] === true) {
|
|
1280
2514
|
dynamicAnchors[""] = `${id}#`;
|
|
1281
2515
|
schema[anchorToken] = "";
|
|
@@ -1284,22 +2518,20 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
|
1284
2518
|
|
|
1285
2519
|
// Vocabulary
|
|
1286
2520
|
let vocabulary;
|
|
1287
|
-
const vocabularyToken = getConfig(
|
|
2521
|
+
const vocabularyToken = getConfig(dialectId, "vocabularyToken");
|
|
1288
2522
|
if (jsonTypeOf(schema[vocabularyToken], "object")) {
|
|
1289
|
-
configAlias[id] = schemaVersion;
|
|
1290
2523
|
vocabulary = schema[vocabularyToken];
|
|
1291
2524
|
delete schema[vocabularyToken];
|
|
1292
2525
|
} else {
|
|
1293
|
-
|
|
1294
|
-
vocabulary = { [schemaVersion]: true };
|
|
2526
|
+
vocabulary = { [dialectJsonSchemaVersion[dialectId]]: true };
|
|
1295
2527
|
}
|
|
1296
2528
|
|
|
1297
2529
|
// Store Schema
|
|
1298
2530
|
const anchors = { "": "" };
|
|
1299
2531
|
schemaStore[id] = {
|
|
1300
2532
|
id: id,
|
|
1301
|
-
|
|
1302
|
-
schema: processSchema(schema, id,
|
|
2533
|
+
dialectId: dialectId,
|
|
2534
|
+
schema: processSchema(schema, id, dialectId, JsonPointer.nil, anchors, dynamicAnchors),
|
|
1303
2535
|
anchors: anchors,
|
|
1304
2536
|
dynamicAnchors: dynamicAnchors,
|
|
1305
2537
|
vocabulary: vocabulary,
|
|
@@ -1309,45 +2541,52 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
|
1309
2541
|
return id;
|
|
1310
2542
|
};
|
|
1311
2543
|
|
|
1312
|
-
const
|
|
2544
|
+
const getSchemaIdentifier = (schema, externalId, jsonSchemaVersion) => {
|
|
2545
|
+
const baseToken = config[jsonSchemaVersion]?.["baseToken"];
|
|
2546
|
+
const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
|
|
2547
|
+
return [resolveUrl$1(internalUrl, ""), urlFragment(internalUrl)];
|
|
2548
|
+
};
|
|
2549
|
+
|
|
2550
|
+
const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
|
|
1313
2551
|
if (jsonTypeOf(subject, "object")) {
|
|
1314
|
-
const
|
|
1315
|
-
const embeddedEmbeddedToken = getConfig(
|
|
1316
|
-
const embeddedAnchorToken = getConfig(
|
|
2552
|
+
const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
|
|
2553
|
+
const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
|
|
2554
|
+
const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
|
|
1317
2555
|
if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
|
|
1318
|
-
const ref =
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
2556
|
+
const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
|
|
2557
|
+
const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
|
|
2558
|
+
subject[embeddedBaseToken] = ref;
|
|
2559
|
+
add$1(subject, ref, dialectId);
|
|
2560
|
+
return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
|
|
1322
2561
|
}
|
|
1323
2562
|
|
|
1324
|
-
const anchorToken = getConfig(
|
|
1325
|
-
const dynamicAnchorToken = getConfig(
|
|
2563
|
+
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
2564
|
+
const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
|
|
1326
2565
|
if (typeof subject[dynamicAnchorToken] === "string") {
|
|
1327
2566
|
dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
|
|
1328
2567
|
anchors[subject[dynamicAnchorToken]] = pointer;
|
|
1329
2568
|
delete subject[dynamicAnchorToken];
|
|
1330
2569
|
}
|
|
1331
2570
|
|
|
1332
|
-
const embeddedToken = getConfig(
|
|
2571
|
+
const embeddedToken = getConfig(dialectId, "embeddedToken");
|
|
1333
2572
|
if (typeof subject[anchorToken] === "string") {
|
|
1334
2573
|
const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
|
|
1335
2574
|
anchors[anchor] = pointer;
|
|
1336
2575
|
delete subject[anchorToken];
|
|
1337
2576
|
}
|
|
1338
2577
|
|
|
1339
|
-
const jrefToken = getConfig(
|
|
2578
|
+
const jrefToken = getConfig(dialectId, "jrefToken");
|
|
1340
2579
|
if (typeof subject[jrefToken] === "string") {
|
|
1341
|
-
return
|
|
2580
|
+
return Reference$1.cons(subject[jrefToken], subject);
|
|
1342
2581
|
}
|
|
1343
2582
|
|
|
1344
2583
|
for (const key in subject) {
|
|
1345
|
-
subject[key] = processSchema(subject[key], id,
|
|
2584
|
+
subject[key] = processSchema(subject[key], id, dialectId, JsonPointer.append(key, pointer), anchors, dynamicAnchors);
|
|
1346
2585
|
}
|
|
1347
2586
|
|
|
1348
2587
|
return subject;
|
|
1349
2588
|
} else if (Array.isArray(subject)) {
|
|
1350
|
-
return subject.map((item, ndx) => processSchema(item, id,
|
|
2589
|
+
return subject.map((item, ndx) => processSchema(item, id, dialectId, JsonPointer.append(ndx, pointer), anchors, dynamicAnchors));
|
|
1351
2590
|
} else {
|
|
1352
2591
|
return subject;
|
|
1353
2592
|
}
|
|
@@ -1363,9 +2602,9 @@ const markValidated = (id) => {
|
|
|
1363
2602
|
// Schema Retrieval
|
|
1364
2603
|
const nil = Object.freeze({
|
|
1365
2604
|
id: "",
|
|
1366
|
-
|
|
2605
|
+
dialectId: undefined,
|
|
1367
2606
|
vocabulary: {},
|
|
1368
|
-
pointer:
|
|
2607
|
+
pointer: JsonPointer.nil,
|
|
1369
2608
|
schema: undefined,
|
|
1370
2609
|
value: undefined,
|
|
1371
2610
|
anchors: {},
|
|
@@ -1374,24 +2613,18 @@ const nil = Object.freeze({
|
|
|
1374
2613
|
});
|
|
1375
2614
|
|
|
1376
2615
|
const get = async (url, contextDoc = nil) => {
|
|
1377
|
-
const resolvedUrl =
|
|
1378
|
-
const
|
|
2616
|
+
const resolvedUrl = resolveUrl$1(uri(contextDoc), url);
|
|
2617
|
+
const id = resolveUrl$1(resolvedUrl, "");
|
|
2618
|
+
const fragment = urlFragment(resolvedUrl);
|
|
1379
2619
|
|
|
1380
2620
|
if (!hasStoredSchema(id)) {
|
|
1381
|
-
const response = await
|
|
2621
|
+
const response = await fetch$1(id, { headers: { Accept: "application/schema+json" } });
|
|
1382
2622
|
if (response.status >= 400) {
|
|
1383
2623
|
await response.text(); // Sometimes node hangs without this hack
|
|
1384
2624
|
throw Error(`Failed to retrieve schema with id: ${id}`);
|
|
1385
2625
|
}
|
|
1386
2626
|
|
|
1387
|
-
|
|
1388
|
-
const contentType$1 = contentType.parse(response.headers.get("content-type")).type;
|
|
1389
|
-
if (contentType$1 !== "application/schema+json") {
|
|
1390
|
-
throw Error(`${id} is not a schema. Found a document with media type: ${contentType$1}`);
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
add$1(await response.json(), id);
|
|
2627
|
+
add$1(await MediaTypes$1.parse(response), id);
|
|
1395
2628
|
}
|
|
1396
2629
|
|
|
1397
2630
|
const storedSchema = getStoredSchema(id);
|
|
@@ -1399,13 +2632,13 @@ const get = async (url, contextDoc = nil) => {
|
|
|
1399
2632
|
const doc = Object.freeze({
|
|
1400
2633
|
...storedSchema,
|
|
1401
2634
|
pointer: pointer,
|
|
1402
|
-
value:
|
|
2635
|
+
value: JsonPointer.get(pointer, storedSchema.schema)
|
|
1403
2636
|
});
|
|
1404
2637
|
|
|
1405
2638
|
return followReferences$1(doc);
|
|
1406
2639
|
};
|
|
1407
2640
|
|
|
1408
|
-
const followReferences$1 = (doc) =>
|
|
2641
|
+
const followReferences$1 = (doc) => Reference$1.isReference(doc.value) ? get(Reference$1.href(doc.value), doc) : doc;
|
|
1409
2642
|
|
|
1410
2643
|
const getAnchorPointer = (schema, fragment) => {
|
|
1411
2644
|
if (!(fragment in schema.anchors)) {
|
|
@@ -1417,7 +2650,7 @@ const getAnchorPointer = (schema, fragment) => {
|
|
|
1417
2650
|
|
|
1418
2651
|
// Utility Functions
|
|
1419
2652
|
const uri = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
|
|
1420
|
-
const value = (doc) =>
|
|
2653
|
+
const value = (doc) => Reference$1.isReference(doc.value) ? Reference$1.value(doc.value) : doc.value;
|
|
1421
2654
|
const has = (key, doc) => key in value(doc);
|
|
1422
2655
|
const typeOf = (doc, type) => jsonTypeOf(value(doc), type);
|
|
1423
2656
|
|
|
@@ -1425,7 +2658,7 @@ const step = (key, doc) => {
|
|
|
1425
2658
|
const storedSchema = getStoredSchema(doc.id);
|
|
1426
2659
|
const nextDoc = Object.freeze({
|
|
1427
2660
|
...doc,
|
|
1428
|
-
pointer:
|
|
2661
|
+
pointer: JsonPointer.append(key, doc.pointer),
|
|
1429
2662
|
value: value(doc)[key],
|
|
1430
2663
|
validated: storedSchema.validated
|
|
1431
2664
|
});
|
|
@@ -1434,17 +2667,17 @@ const step = (key, doc) => {
|
|
|
1434
2667
|
|
|
1435
2668
|
const keys = (doc) => Object.keys(value(doc));
|
|
1436
2669
|
|
|
1437
|
-
const entries = (doc) =>
|
|
2670
|
+
const entries = (doc) => Pact$a.pipeline([
|
|
1438
2671
|
value,
|
|
1439
2672
|
Object.keys,
|
|
1440
|
-
|
|
1441
|
-
|
|
2673
|
+
Pact$a.map(async (key) => [key, await step(key, doc)]),
|
|
2674
|
+
Pact$a.all
|
|
1442
2675
|
], doc);
|
|
1443
2676
|
|
|
1444
|
-
const map =
|
|
2677
|
+
const map = curry$1((fn, doc) => Pact$a.pipeline([
|
|
1445
2678
|
value,
|
|
1446
|
-
|
|
1447
|
-
|
|
2679
|
+
Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
|
|
2680
|
+
Pact$a.all
|
|
1448
2681
|
], doc));
|
|
1449
2682
|
|
|
1450
2683
|
const length = (doc) => value(doc).length;
|
|
@@ -1458,43 +2691,43 @@ const toSchema = (schemaDoc, options = {}) => {
|
|
|
1458
2691
|
const fullOptions = { ...toSchemaDefaultOptions, ...options };
|
|
1459
2692
|
|
|
1460
2693
|
const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
|
|
1461
|
-
if (!
|
|
2694
|
+
if (!Reference$1.isReference(value)) {
|
|
1462
2695
|
return value;
|
|
1463
2696
|
}
|
|
1464
2697
|
|
|
1465
|
-
const refValue =
|
|
1466
|
-
const embeddedDialect = refValue.$schema
|
|
2698
|
+
const refValue = Reference$1.value(value);
|
|
2699
|
+
const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
|
|
1467
2700
|
const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
|
|
1468
2701
|
if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
|
|
1469
2702
|
return;
|
|
1470
2703
|
} else {
|
|
1471
|
-
return
|
|
2704
|
+
return Reference$1.value(value);
|
|
1472
2705
|
}
|
|
1473
2706
|
}));
|
|
1474
2707
|
|
|
1475
|
-
const dynamicAnchorToken = getConfig(schemaDoc.
|
|
2708
|
+
const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
|
|
1476
2709
|
Object.entries(schemaDoc.dynamicAnchors)
|
|
1477
2710
|
.forEach(([anchor, uri]) => {
|
|
1478
|
-
const pointer =
|
|
1479
|
-
|
|
2711
|
+
const pointer = urlFragment(uri);
|
|
2712
|
+
JsonPointer.assign(pointer, schema, {
|
|
1480
2713
|
[dynamicAnchorToken]: anchor,
|
|
1481
|
-
...
|
|
2714
|
+
...JsonPointer.get(pointer, schema)
|
|
1482
2715
|
});
|
|
1483
2716
|
});
|
|
1484
2717
|
|
|
1485
|
-
const anchorToken = getConfig(schemaDoc.
|
|
2718
|
+
const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
|
|
1486
2719
|
Object.entries(schemaDoc.anchors)
|
|
1487
2720
|
.filter(([anchor]) => anchor !== "")
|
|
1488
2721
|
.forEach(([anchor, pointer]) => {
|
|
1489
|
-
|
|
2722
|
+
JsonPointer.assign(pointer, schema, {
|
|
1490
2723
|
[anchorToken]: anchor,
|
|
1491
|
-
...
|
|
2724
|
+
...JsonPointer.get(pointer, schema)
|
|
1492
2725
|
});
|
|
1493
2726
|
});
|
|
1494
2727
|
|
|
1495
|
-
const baseToken = getConfig(schemaDoc.
|
|
2728
|
+
const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
|
|
1496
2729
|
const id = relativeUri(fullOptions.parentId, schemaDoc.id);
|
|
1497
|
-
const dialect = fullOptions.parentDialect === schemaDoc.
|
|
2730
|
+
const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
|
|
1498
2731
|
return {
|
|
1499
2732
|
...(id && { [baseToken]: id }),
|
|
1500
2733
|
...(dialect && { $schema: dialect }),
|
|
@@ -1517,24 +2750,8 @@ var schema$5 = {
|
|
|
1517
2750
|
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
|
|
1518
2751
|
toSchema
|
|
1519
2752
|
};
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
schema$5.add;
|
|
1523
|
-
schema$5.get;
|
|
1524
|
-
schema$5.markValidated;
|
|
1525
|
-
schema$5.uri;
|
|
1526
|
-
schema$5.value;
|
|
1527
|
-
schema$5.getAnchorPointer;
|
|
1528
|
-
schema$5.typeOf;
|
|
1529
|
-
schema$5.has;
|
|
1530
|
-
schema$5.step;
|
|
1531
|
-
schema$5.keys;
|
|
1532
|
-
schema$5.entries;
|
|
1533
|
-
schema$5.map;
|
|
1534
|
-
schema$5.length;
|
|
1535
|
-
schema$5.toSchema;
|
|
1536
|
-
|
|
1537
|
-
class InvalidSchemaError$1 extends Error {
|
|
2753
|
+
|
|
2754
|
+
class InvalidSchemaError$3 extends Error {
|
|
1538
2755
|
constructor(output) {
|
|
1539
2756
|
super("Invalid Schema");
|
|
1540
2757
|
this.name = this.constructor.name;
|
|
@@ -1542,12 +2759,15 @@ class InvalidSchemaError$1 extends Error {
|
|
|
1542
2759
|
}
|
|
1543
2760
|
}
|
|
1544
2761
|
|
|
1545
|
-
var invalidSchemaError = InvalidSchemaError$
|
|
1546
|
-
|
|
1547
|
-
const { splitUrl: splitUrl$2 } = common$1;
|
|
1548
|
-
|
|
1549
|
-
|
|
2762
|
+
var invalidSchemaError = InvalidSchemaError$3;
|
|
1550
2763
|
|
|
2764
|
+
const curry = justCurryIt;
|
|
2765
|
+
const PubSub$1 = pubsub.exports;
|
|
2766
|
+
const { resolveUrl } = common$1;
|
|
2767
|
+
const Instance$E = instance;
|
|
2768
|
+
const Schema$R = schema$5;
|
|
2769
|
+
const InvalidSchemaError$2 = invalidSchemaError;
|
|
2770
|
+
const MediaTypes = mediaTypes;
|
|
1551
2771
|
|
|
1552
2772
|
|
|
1553
2773
|
const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
|
|
@@ -1555,9 +2775,14 @@ const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE"
|
|
|
1555
2775
|
let metaOutputFormat = DETAILED;
|
|
1556
2776
|
let shouldMetaValidate = true;
|
|
1557
2777
|
|
|
1558
|
-
|
|
2778
|
+
MediaTypes.addPlugin("application/schema+json", {
|
|
2779
|
+
parse: async (response) => await response.json(),
|
|
2780
|
+
matcher: (path) => path.endsWith(".schema.json")
|
|
2781
|
+
});
|
|
2782
|
+
|
|
2783
|
+
const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
|
|
1559
2784
|
const compiled = await compile$O(schema);
|
|
1560
|
-
const interpretAst = (value, outputFormat) => interpret$O(compiled,
|
|
2785
|
+
const interpretAst = (value, outputFormat) => interpret$O(compiled, Instance$E.cons(value), outputFormat);
|
|
1561
2786
|
|
|
1562
2787
|
return value === undefined ? interpretAst : interpretAst(value, outputFormat);
|
|
1563
2788
|
};
|
|
@@ -1568,15 +2793,15 @@ const compile$O = async (schema) => {
|
|
|
1568
2793
|
return { ast, schemaUri };
|
|
1569
2794
|
};
|
|
1570
2795
|
|
|
1571
|
-
const interpret$O =
|
|
2796
|
+
const interpret$O = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
1572
2797
|
if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
|
|
1573
2798
|
throw Error(`The '${outputFormat}' error format is not supported`);
|
|
1574
2799
|
}
|
|
1575
2800
|
|
|
1576
2801
|
const output = [];
|
|
1577
|
-
const subscriptionToken =
|
|
2802
|
+
const subscriptionToken = PubSub$1.subscribe("result", outputHandler(outputFormat, output));
|
|
1578
2803
|
interpretSchema(schemaUri, value, ast, {});
|
|
1579
|
-
|
|
2804
|
+
PubSub$1.unsubscribe(subscriptionToken);
|
|
1580
2805
|
|
|
1581
2806
|
return output[0];
|
|
1582
2807
|
});
|
|
@@ -1642,11 +2867,11 @@ const compileSchema = async (schema, ast) => {
|
|
|
1642
2867
|
schema = await followReferences(schema);
|
|
1643
2868
|
|
|
1644
2869
|
// Vocabularies
|
|
1645
|
-
if (!hasKeyword(`${schema.
|
|
1646
|
-
const metaSchema = await
|
|
2870
|
+
if (!hasKeyword(`${schema.dialectId}#validate`)) {
|
|
2871
|
+
const metaSchema = await Schema$R.get(schema.dialectId);
|
|
1647
2872
|
|
|
1648
2873
|
// Check for mandatory vocabularies
|
|
1649
|
-
const mandatoryVocabularies =
|
|
2874
|
+
const mandatoryVocabularies = Schema$R.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
|
|
1650
2875
|
mandatoryVocabularies.forEach((vocabularyId) => {
|
|
1651
2876
|
if (!metaSchema.vocabulary[vocabularyId]) {
|
|
1652
2877
|
throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
|
|
@@ -1669,20 +2894,20 @@ const compileSchema = async (schema, ast) => {
|
|
|
1669
2894
|
|
|
1670
2895
|
// Meta validation
|
|
1671
2896
|
if (shouldMetaValidate && !schema.validated) {
|
|
1672
|
-
|
|
2897
|
+
Schema$R.markValidated(schema.id);
|
|
1673
2898
|
|
|
1674
2899
|
// Compile
|
|
1675
|
-
if (!(schema.
|
|
1676
|
-
const metaSchema = await
|
|
2900
|
+
if (!(schema.dialectId in metaValidators)) {
|
|
2901
|
+
const metaSchema = await Schema$R.get(schema.dialectId);
|
|
1677
2902
|
const compiledSchema = await compile$O(metaSchema);
|
|
1678
2903
|
metaValidators[metaSchema.id] = interpret$O(compiledSchema);
|
|
1679
2904
|
}
|
|
1680
2905
|
|
|
1681
2906
|
// Interpret
|
|
1682
|
-
const schemaInstance =
|
|
1683
|
-
const metaResults = metaValidators[schema.
|
|
2907
|
+
const schemaInstance = Instance$E.cons(schema.schema, schema.id);
|
|
2908
|
+
const metaResults = metaValidators[schema.dialectId](schemaInstance, metaOutputFormat);
|
|
1684
2909
|
if (!metaResults.valid) {
|
|
1685
|
-
throw new
|
|
2910
|
+
throw new InvalidSchemaError$2(metaResults);
|
|
1686
2911
|
}
|
|
1687
2912
|
}
|
|
1688
2913
|
|
|
@@ -1694,16 +2919,16 @@ const compileSchema = async (schema, ast) => {
|
|
|
1694
2919
|
anchors: schema.anchors
|
|
1695
2920
|
};
|
|
1696
2921
|
}
|
|
1697
|
-
return getKeyword(`${schema.
|
|
2922
|
+
return getKeyword(`${schema.dialectId}#validate`).compile(schema, ast);
|
|
1698
2923
|
};
|
|
1699
2924
|
|
|
1700
2925
|
const followReferences = async (doc) => {
|
|
1701
|
-
return
|
|
2926
|
+
return Schema$R.typeOf(doc, "string") ? followReferences(await Schema$R.get(Schema$R.value(doc), doc)) : doc;
|
|
1702
2927
|
};
|
|
1703
2928
|
|
|
1704
2929
|
const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
|
|
1705
2930
|
const keywordId = getKeywordId(schemaUri, ast);
|
|
1706
|
-
const id =
|
|
2931
|
+
const id = resolveUrl(schemaUri, "");
|
|
1707
2932
|
return getKeyword(keywordId).interpret(schemaUri, instance, ast, { ...ast.metaData[id].dynamicAnchors, ...dynamicAnchors });
|
|
1708
2933
|
};
|
|
1709
2934
|
|
|
@@ -1726,63 +2951,55 @@ const getKeywordId = (schemaUri, ast) => {
|
|
|
1726
2951
|
};
|
|
1727
2952
|
|
|
1728
2953
|
const add = (schema, url = "", defaultSchemaVersion = "") => {
|
|
1729
|
-
const id =
|
|
2954
|
+
const id = Schema$R.add(schema, url, defaultSchemaVersion);
|
|
1730
2955
|
delete metaValidators[id];
|
|
1731
2956
|
};
|
|
1732
2957
|
|
|
1733
2958
|
var core$2 = {
|
|
1734
|
-
validate: validate$
|
|
2959
|
+
validate: validate$2, compile: compile$O, interpret: interpret$O,
|
|
1735
2960
|
setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
|
|
1736
2961
|
add, getKeyword, hasKeyword, defineVocabulary,
|
|
1737
|
-
compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f
|
|
2962
|
+
compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
|
|
2963
|
+
addMediaTypePlugin: MediaTypes.addPlugin
|
|
1738
2964
|
};
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
core$2.FLAG;
|
|
1745
|
-
core$2.BASIC;
|
|
1746
|
-
core$2.DETAILED;
|
|
1747
|
-
core$2.VERBOSE;
|
|
1748
|
-
core$2.add;
|
|
1749
|
-
core$2.getKeyword;
|
|
1750
|
-
core$2.hasKeyword;
|
|
1751
|
-
core$2.defineVocabulary;
|
|
1752
|
-
core$2.compileSchema;
|
|
1753
|
-
core$2.interpretSchema;
|
|
1754
|
-
core$2.collectEvaluatedProperties;
|
|
1755
|
-
core$2.collectEvaluatedItems;
|
|
1756
|
-
|
|
1757
|
-
const compile$N = (schema) => schema$5.value(schema);
|
|
2965
|
+
|
|
2966
|
+
const Schema$Q = schema$5;
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
const compile$N = (schema) => Schema$Q.value(schema);
|
|
1758
2970
|
const interpret$N = () => true;
|
|
1759
2971
|
|
|
1760
|
-
var metaData$
|
|
1761
|
-
|
|
1762
|
-
|
|
2972
|
+
var metaData$3 = { compile: compile$N, interpret: interpret$N };
|
|
2973
|
+
|
|
2974
|
+
const Pact$9 = lib$2;
|
|
2975
|
+
const PubSub = pubsub.exports;
|
|
2976
|
+
const Core$x = core$2;
|
|
2977
|
+
const Instance$D = instance;
|
|
2978
|
+
const Schema$P = schema$5;
|
|
2979
|
+
|
|
1763
2980
|
|
|
1764
2981
|
const compile$M = async (schema, ast) => {
|
|
1765
|
-
const url =
|
|
2982
|
+
const url = Schema$P.uri(schema);
|
|
1766
2983
|
if (!(url in ast)) {
|
|
1767
2984
|
ast[url] = false; // Place dummy entry in ast to avoid recursive loops
|
|
1768
2985
|
|
|
1769
|
-
const schemaValue =
|
|
2986
|
+
const schemaValue = Schema$P.value(schema);
|
|
1770
2987
|
if (!["object", "boolean"].includes(typeof schemaValue)) {
|
|
1771
|
-
throw Error(`No schema found at '${
|
|
2988
|
+
throw Error(`No schema found at '${Schema$P.uri(schema)}'`);
|
|
1772
2989
|
}
|
|
1773
2990
|
|
|
1774
2991
|
ast[url] = [
|
|
1775
|
-
`${schema.
|
|
1776
|
-
|
|
1777
|
-
typeof schemaValue === "boolean" ? schemaValue : await
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
const keywordAst = await
|
|
1783
|
-
return [keywordId,
|
|
2992
|
+
`${schema.dialectId}#validate`,
|
|
2993
|
+
Schema$P.uri(schema),
|
|
2994
|
+
typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
|
|
2995
|
+
Schema$P.entries,
|
|
2996
|
+
Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
|
|
2997
|
+
Pact$9.filter(([keywordId]) => Core$x.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`),
|
|
2998
|
+
Pact$9.map(async ([keywordId, keywordSchema]) => {
|
|
2999
|
+
const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
|
|
3000
|
+
return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
|
|
1784
3001
|
}),
|
|
1785
|
-
|
|
3002
|
+
Pact$9.all
|
|
1786
3003
|
], schema)
|
|
1787
3004
|
];
|
|
1788
3005
|
}
|
|
@@ -1790,34 +3007,34 @@ const compile$M = async (schema, ast) => {
|
|
|
1790
3007
|
return url;
|
|
1791
3008
|
};
|
|
1792
3009
|
|
|
1793
|
-
const interpret$M = (uri, instance
|
|
3010
|
+
const interpret$M = (uri, instance, ast, dynamicAnchors) => {
|
|
1794
3011
|
const [keywordId, schemaUrl, nodes] = ast[uri];
|
|
1795
3012
|
|
|
1796
|
-
|
|
3013
|
+
PubSub.publishSync("result.start");
|
|
1797
3014
|
const isValid = typeof nodes === "boolean" ? nodes : nodes
|
|
1798
3015
|
.every(([keywordId, schemaUrl, keywordValue]) => {
|
|
1799
|
-
|
|
1800
|
-
const isValid =
|
|
3016
|
+
PubSub.publishSync("result.start");
|
|
3017
|
+
const isValid = Core$x.getKeyword(keywordId).interpret(keywordValue, instance, ast, dynamicAnchors);
|
|
1801
3018
|
|
|
1802
|
-
|
|
3019
|
+
PubSub.publishSync("result", {
|
|
1803
3020
|
keyword: keywordId,
|
|
1804
3021
|
absoluteKeywordLocation: schemaUrl,
|
|
1805
|
-
instanceLocation:
|
|
3022
|
+
instanceLocation: Instance$D.uri(instance),
|
|
1806
3023
|
valid: isValid,
|
|
1807
3024
|
ast: keywordValue
|
|
1808
3025
|
});
|
|
1809
|
-
|
|
3026
|
+
PubSub.publishSync("result.end");
|
|
1810
3027
|
return isValid;
|
|
1811
3028
|
});
|
|
1812
3029
|
|
|
1813
|
-
|
|
3030
|
+
PubSub.publishSync("result", {
|
|
1814
3031
|
keyword: keywordId,
|
|
1815
3032
|
absoluteKeywordLocation: schemaUrl,
|
|
1816
|
-
instanceLocation:
|
|
3033
|
+
instanceLocation: Instance$D.uri(instance),
|
|
1817
3034
|
valid: isValid,
|
|
1818
3035
|
ast: uri
|
|
1819
3036
|
});
|
|
1820
|
-
|
|
3037
|
+
PubSub.publishSync("result.end");
|
|
1821
3038
|
return isValid;
|
|
1822
3039
|
};
|
|
1823
3040
|
|
|
@@ -1831,7 +3048,7 @@ const collectEvaluatedProperties$d = (uri, instance, ast, dynamicAnchors, isTop
|
|
|
1831
3048
|
return nodes
|
|
1832
3049
|
.filter(([keywordId]) => !isTop || !keywordId.endsWith("#unevaluatedProperties"))
|
|
1833
3050
|
.reduce((acc, [keywordId, , keywordValue]) => {
|
|
1834
|
-
const propertyNames = acc &&
|
|
3051
|
+
const propertyNames = acc && Core$x.getKeyword(keywordId).collectEvaluatedProperties(keywordValue, instance, ast, dynamicAnchors);
|
|
1835
3052
|
return propertyNames !== false && [...acc, ...propertyNames];
|
|
1836
3053
|
}, []);
|
|
1837
3054
|
};
|
|
@@ -1846,22 +3063,28 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
|
|
|
1846
3063
|
return nodes
|
|
1847
3064
|
.filter(([keywordId]) => !isTop || !keywordId.endsWith("#unevaluatedItems"))
|
|
1848
3065
|
.reduce((acc, [keywordId, , keywordValue]) => {
|
|
1849
|
-
const itemIndexes = acc !== false &&
|
|
3066
|
+
const itemIndexes = acc !== false && Core$x.getKeyword(keywordId).collectEvaluatedItems(keywordValue, instance, ast, dynamicAnchors);
|
|
1850
3067
|
return itemIndexes !== false && new Set([...acc, ...itemIndexes]);
|
|
1851
3068
|
}, new Set());
|
|
1852
3069
|
};
|
|
1853
3070
|
|
|
1854
|
-
var validate = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
validate
|
|
1858
|
-
validate.collectEvaluatedItems;
|
|
3071
|
+
var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
3072
|
+
|
|
3073
|
+
const metaData$2 = metaData$3;
|
|
3074
|
+
const validate = validate$1;
|
|
1859
3075
|
|
|
1860
|
-
var keywords$1 = { metaData: metaData$2, validate };
|
|
1861
|
-
keywords$1.metaData;
|
|
1862
|
-
keywords$1.validate;
|
|
1863
3076
|
|
|
1864
|
-
var
|
|
3077
|
+
var keywords$6 = { metaData: metaData$2, validate };
|
|
3078
|
+
|
|
3079
|
+
const Core$w = core$2;
|
|
3080
|
+
const Schema$O = schema$5;
|
|
3081
|
+
const Instance$C = instance;
|
|
3082
|
+
const Reference = reference;
|
|
3083
|
+
const Keywords$2 = keywords$6;
|
|
3084
|
+
const InvalidSchemaError$1 = invalidSchemaError;
|
|
3085
|
+
|
|
3086
|
+
|
|
3087
|
+
var lib$1 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
|
|
1865
3088
|
|
|
1866
3089
|
const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$1;
|
|
1867
3090
|
|
|
@@ -1890,8 +3113,6 @@ const interpret$L = ([numberOfItems, additionalItems], instance, ast, dynamicAnc
|
|
|
1890
3113
|
};
|
|
1891
3114
|
|
|
1892
3115
|
var additionalItems = { compile: compile$L, interpret: interpret$L };
|
|
1893
|
-
additionalItems.compile;
|
|
1894
|
-
additionalItems.interpret;
|
|
1895
3116
|
|
|
1896
3117
|
const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$1;
|
|
1897
3118
|
|
|
@@ -1916,9 +3137,6 @@ const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
1916
3137
|
};
|
|
1917
3138
|
|
|
1918
3139
|
var additionalItems6 = { compile: compile$K, interpret: interpret$K, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
1919
|
-
additionalItems6.compile;
|
|
1920
|
-
additionalItems6.interpret;
|
|
1921
|
-
additionalItems6.collectEvaluatedItems;
|
|
1922
3140
|
|
|
1923
3141
|
const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$1;
|
|
1924
3142
|
|
|
@@ -1953,8 +3171,6 @@ const interpret$J = ([propertyNames, propertyNamePatterns, additionalProperties]
|
|
|
1953
3171
|
};
|
|
1954
3172
|
|
|
1955
3173
|
var additionalProperties = { compile: compile$J, interpret: interpret$J };
|
|
1956
|
-
additionalProperties.compile;
|
|
1957
|
-
additionalProperties.interpret;
|
|
1958
3174
|
|
|
1959
3175
|
const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$1;
|
|
1960
3176
|
|
|
@@ -1984,17 +3200,14 @@ const collectEvaluatedProperties$c = (keywordValue, instance, ast, dynamicAnchor
|
|
|
1984
3200
|
};
|
|
1985
3201
|
|
|
1986
3202
|
var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
|
|
1987
|
-
additionalProperties6.compile;
|
|
1988
|
-
additionalProperties6.interpret;
|
|
1989
|
-
additionalProperties6.collectEvaluatedProperties;
|
|
1990
3203
|
|
|
1991
3204
|
const { Core: Core$r, Schema: Schema$J } = lib$1;
|
|
3205
|
+
const Pact$8 = lib$2;
|
|
1992
3206
|
|
|
1993
3207
|
|
|
1994
|
-
|
|
1995
|
-
const compile$H = (schema, ast) => lib$2.pipeline([
|
|
3208
|
+
const compile$H = (schema, ast) => Pact$8.pipeline([
|
|
1996
3209
|
Schema$J.map(async (itemSchema) => Core$r.compileSchema(await itemSchema, ast)),
|
|
1997
|
-
|
|
3210
|
+
Pact$8.all
|
|
1998
3211
|
], schema);
|
|
1999
3212
|
|
|
2000
3213
|
const interpret$H = (allOf, instance, ast, dynamicAnchors) => {
|
|
@@ -2016,18 +3229,14 @@ const collectEvaluatedItems$c = (allOf, instance, ast, dynamicAnchors) => {
|
|
|
2016
3229
|
};
|
|
2017
3230
|
|
|
2018
3231
|
var allOf = { compile: compile$H, interpret: interpret$H, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
|
|
2019
|
-
allOf.compile;
|
|
2020
|
-
allOf.interpret;
|
|
2021
|
-
allOf.collectEvaluatedProperties;
|
|
2022
|
-
allOf.collectEvaluatedItems;
|
|
2023
3232
|
|
|
2024
3233
|
const { Core: Core$q, Schema: Schema$I } = lib$1;
|
|
3234
|
+
const Pact$7 = lib$2;
|
|
2025
3235
|
|
|
2026
3236
|
|
|
2027
|
-
|
|
2028
|
-
const compile$G = (schema, ast) => lib$2.pipeline([
|
|
3237
|
+
const compile$G = (schema, ast) => Pact$7.pipeline([
|
|
2029
3238
|
Schema$I.map(async (itemSchema) => Core$q.compileSchema(await itemSchema, ast)),
|
|
2030
|
-
|
|
3239
|
+
Pact$7.all
|
|
2031
3240
|
], schema);
|
|
2032
3241
|
|
|
2033
3242
|
const interpret$G = (anyOf, instance, ast, dynamicAnchors) => {
|
|
@@ -2050,10 +3259,6 @@ const collectEvaluatedItems$b = (anyOf, instance, ast, dynamicAnchors) => {
|
|
|
2050
3259
|
};
|
|
2051
3260
|
|
|
2052
3261
|
var anyOf = { compile: compile$G, interpret: interpret$G, collectEvaluatedProperties: collectEvaluatedProperties$a, collectEvaluatedItems: collectEvaluatedItems$b };
|
|
2053
|
-
anyOf.compile;
|
|
2054
|
-
anyOf.interpret;
|
|
2055
|
-
anyOf.collectEvaluatedProperties;
|
|
2056
|
-
anyOf.collectEvaluatedItems;
|
|
2057
3262
|
|
|
2058
3263
|
var keyList = Object.keys;
|
|
2059
3264
|
var native_stringify = JSON.stringify;
|
|
@@ -2115,15 +3320,13 @@ function stringify(val, allowUndefined) {
|
|
|
2115
3320
|
var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
|
|
2116
3321
|
|
|
2117
3322
|
const { Schema: Schema$H, Instance: Instance$x } = lib$1;
|
|
3323
|
+
const jsonStringify$2 = fastestStableStringify;
|
|
2118
3324
|
|
|
2119
3325
|
|
|
2120
|
-
|
|
2121
|
-
const
|
|
2122
|
-
const interpret$F = (const_, instance) => fastestStableStringify(Instance$x.value(instance)) === const_;
|
|
3326
|
+
const compile$F = (schema) => jsonStringify$2(Schema$H.value(schema));
|
|
3327
|
+
const interpret$F = (const_, instance) => jsonStringify$2(Instance$x.value(instance)) === const_;
|
|
2123
3328
|
|
|
2124
3329
|
var _const = { compile: compile$F, interpret: interpret$F };
|
|
2125
|
-
_const.compile;
|
|
2126
|
-
_const.interpret;
|
|
2127
3330
|
|
|
2128
3331
|
const { Core: Core$p, Instance: Instance$w } = lib$1;
|
|
2129
3332
|
|
|
@@ -2135,8 +3338,6 @@ const interpret$E = (contains, instance, ast, dynamicAnchors) => {
|
|
|
2135
3338
|
};
|
|
2136
3339
|
|
|
2137
3340
|
var contains = { compile: compile$E, interpret: interpret$E };
|
|
2138
|
-
contains.compile;
|
|
2139
|
-
contains.interpret;
|
|
2140
3341
|
|
|
2141
3342
|
const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$1;
|
|
2142
3343
|
|
|
@@ -2171,38 +3372,33 @@ const collectEvaluatedItems$a = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
2171
3372
|
};
|
|
2172
3373
|
|
|
2173
3374
|
var containsMinContainsMaxContains = { compile: compile$D, interpret: interpret$D, collectEvaluatedItems: collectEvaluatedItems$a };
|
|
2174
|
-
containsMinContainsMaxContains.compile;
|
|
2175
|
-
containsMinContainsMaxContains.interpret;
|
|
2176
|
-
containsMinContainsMaxContains.collectEvaluatedItems;
|
|
2177
3375
|
|
|
2178
3376
|
const { Core: Core$n, Schema: Schema$F } = lib$1;
|
|
2179
|
-
|
|
3377
|
+
const Pact$6 = lib$2;
|
|
2180
3378
|
|
|
2181
3379
|
|
|
2182
3380
|
const compile$C = async (schema, ast) => {
|
|
2183
|
-
await
|
|
3381
|
+
await Pact$6.pipeline([
|
|
2184
3382
|
Schema$F.entries,
|
|
2185
|
-
|
|
2186
|
-
|
|
3383
|
+
Pact$6.map(([, definitionSchema]) => Core$n.compileSchema(definitionSchema, ast)),
|
|
3384
|
+
Pact$6.all
|
|
2187
3385
|
], schema);
|
|
2188
3386
|
};
|
|
2189
3387
|
|
|
2190
3388
|
const interpret$C = () => true;
|
|
2191
3389
|
|
|
2192
3390
|
var definitions = { compile: compile$C, interpret: interpret$C };
|
|
2193
|
-
definitions.compile;
|
|
2194
|
-
definitions.interpret;
|
|
2195
3391
|
|
|
2196
3392
|
const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$1;
|
|
3393
|
+
const Pact$5 = lib$2;
|
|
2197
3394
|
|
|
2198
3395
|
|
|
2199
|
-
|
|
2200
|
-
const compile$B = (schema, ast) => lib$2.pipeline([
|
|
3396
|
+
const compile$B = (schema, ast) => Pact$5.pipeline([
|
|
2201
3397
|
Schema$E.entries,
|
|
2202
|
-
|
|
3398
|
+
Pact$5.map(async ([key, dependency]) => {
|
|
2203
3399
|
return [key, Schema$E.typeOf(dependency, "array") ? Schema$E.value(dependency) : await Core$m.compileSchema(dependency, ast)];
|
|
2204
3400
|
}),
|
|
2205
|
-
|
|
3401
|
+
Pact$5.all
|
|
2206
3402
|
], schema);
|
|
2207
3403
|
|
|
2208
3404
|
const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
|
|
@@ -2222,17 +3418,15 @@ const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
|
|
|
2222
3418
|
};
|
|
2223
3419
|
|
|
2224
3420
|
var dependencies = { compile: compile$B, interpret: interpret$B };
|
|
2225
|
-
dependencies.compile;
|
|
2226
|
-
dependencies.interpret;
|
|
2227
3421
|
|
|
2228
3422
|
const { Schema: Schema$D, Instance: Instance$t } = lib$1;
|
|
3423
|
+
const Pact$4 = lib$2;
|
|
2229
3424
|
|
|
2230
3425
|
|
|
2231
|
-
|
|
2232
|
-
const compile$A = (schema) => lib$2.pipeline([
|
|
3426
|
+
const compile$A = (schema) => Pact$4.pipeline([
|
|
2233
3427
|
Schema$D.entries,
|
|
2234
|
-
|
|
2235
|
-
|
|
3428
|
+
Pact$4.map(([key, dependentRequired]) => [key, Schema$D.value(dependentRequired)]),
|
|
3429
|
+
Pact$4.all
|
|
2236
3430
|
], schema);
|
|
2237
3431
|
|
|
2238
3432
|
const interpret$A = (dependentRequired, instance) => {
|
|
@@ -2244,17 +3438,15 @@ const interpret$A = (dependentRequired, instance) => {
|
|
|
2244
3438
|
};
|
|
2245
3439
|
|
|
2246
3440
|
var dependentRequired = { compile: compile$A, interpret: interpret$A };
|
|
2247
|
-
dependentRequired.compile;
|
|
2248
|
-
dependentRequired.interpret;
|
|
2249
3441
|
|
|
2250
3442
|
const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$1;
|
|
3443
|
+
const Pact$3 = lib$2;
|
|
2251
3444
|
|
|
2252
3445
|
|
|
2253
|
-
|
|
2254
|
-
const compile$z = (schema, ast) => lib$2.pipeline([
|
|
3446
|
+
const compile$z = (schema, ast) => Pact$3.pipeline([
|
|
2255
3447
|
Schema$C.entries,
|
|
2256
|
-
|
|
2257
|
-
|
|
3448
|
+
Pact$3.map(async ([key, dependentSchema]) => [key, await Core$l.compileSchema(dependentSchema, ast)]),
|
|
3449
|
+
Pact$3.all
|
|
2258
3450
|
], schema);
|
|
2259
3451
|
|
|
2260
3452
|
const interpret$z = (dependentSchemas, instance, ast, dynamicAnchors) => {
|
|
@@ -2277,20 +3469,15 @@ const collectEvaluatedProperties$9 = (dependentSchemas, instance, ast, dynamicAn
|
|
|
2277
3469
|
};
|
|
2278
3470
|
|
|
2279
3471
|
var dependentSchemas = { compile: compile$z, interpret: interpret$z, collectEvaluatedProperties: collectEvaluatedProperties$9 };
|
|
2280
|
-
dependentSchemas.compile;
|
|
2281
|
-
dependentSchemas.interpret;
|
|
2282
|
-
dependentSchemas.collectEvaluatedProperties;
|
|
2283
3472
|
|
|
2284
3473
|
const { Schema: Schema$B, Instance: Instance$r } = lib$1;
|
|
3474
|
+
const jsonStringify$1 = fastestStableStringify;
|
|
2285
3475
|
|
|
2286
3476
|
|
|
2287
|
-
|
|
2288
|
-
const
|
|
2289
|
-
const interpret$y = (enum_, instance) => enum_.some((enumValue) => fastestStableStringify(Instance$r.value(instance)) === enumValue);
|
|
3477
|
+
const compile$y = (schema) => Schema$B.value(schema).map(jsonStringify$1);
|
|
3478
|
+
const interpret$y = (enum_, instance) => enum_.some((enumValue) => jsonStringify$1(Instance$r.value(instance)) === enumValue);
|
|
2290
3479
|
|
|
2291
3480
|
var _enum = { compile: compile$y, interpret: interpret$y };
|
|
2292
|
-
_enum.compile;
|
|
2293
|
-
_enum.interpret;
|
|
2294
3481
|
|
|
2295
3482
|
const { Schema: Schema$A, Instance: Instance$q } = lib$1;
|
|
2296
3483
|
|
|
@@ -2299,8 +3486,6 @@ const compile$x = async (schema) => Schema$A.value(schema);
|
|
|
2299
3486
|
const interpret$x = (exclusiveMaximum, instance) => !Instance$q.typeOf(instance, "number") || Instance$q.value(instance) < exclusiveMaximum;
|
|
2300
3487
|
|
|
2301
3488
|
var exclusiveMaximum = { compile: compile$x, interpret: interpret$x };
|
|
2302
|
-
exclusiveMaximum.compile;
|
|
2303
|
-
exclusiveMaximum.interpret;
|
|
2304
3489
|
|
|
2305
3490
|
const { Schema: Schema$z, Instance: Instance$p } = lib$1;
|
|
2306
3491
|
|
|
@@ -2309,8 +3494,6 @@ const compile$w = async (schema) => Schema$z.value(schema);
|
|
|
2309
3494
|
const interpret$w = (exclusiveMinimum, instance) => !Instance$p.typeOf(instance, "number") || Instance$p.value(instance) > exclusiveMinimum;
|
|
2310
3495
|
|
|
2311
3496
|
var exclusiveMinimum = { compile: compile$w, interpret: interpret$w };
|
|
2312
|
-
exclusiveMinimum.compile;
|
|
2313
|
-
exclusiveMinimum.interpret;
|
|
2314
3497
|
|
|
2315
3498
|
const { Core: Core$k } = lib$1;
|
|
2316
3499
|
|
|
@@ -2331,10 +3514,6 @@ const collectEvaluatedItems$9 = (ifSchema, instance, ast, dynamicAnchors) => {
|
|
|
2331
3514
|
};
|
|
2332
3515
|
|
|
2333
3516
|
var _if = { compile: compile$v, interpret: interpret$v, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
|
|
2334
|
-
_if.compile;
|
|
2335
|
-
_if.interpret;
|
|
2336
|
-
_if.collectEvaluatedProperties;
|
|
2337
|
-
_if.collectEvaluatedItems;
|
|
2338
3517
|
|
|
2339
3518
|
const { Core: Core$j, Schema: Schema$y } = lib$1;
|
|
2340
3519
|
|
|
@@ -2379,10 +3558,6 @@ const collectEvaluatedItems$8 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
2379
3558
|
};
|
|
2380
3559
|
|
|
2381
3560
|
var then = { compile: compile$u, interpret: interpret$u, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
|
|
2382
|
-
then.compile;
|
|
2383
|
-
then.interpret;
|
|
2384
|
-
then.collectEvaluatedProperties;
|
|
2385
|
-
then.collectEvaluatedItems;
|
|
2386
3561
|
|
|
2387
3562
|
const { Core: Core$i, Schema: Schema$x } = lib$1;
|
|
2388
3563
|
|
|
@@ -2427,10 +3602,6 @@ const collectEvaluatedItems$7 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
2427
3602
|
};
|
|
2428
3603
|
|
|
2429
3604
|
var _else = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
|
|
2430
|
-
_else.compile;
|
|
2431
|
-
_else.interpret;
|
|
2432
|
-
_else.collectEvaluatedProperties;
|
|
2433
|
-
_else.collectEvaluatedItems;
|
|
2434
3605
|
|
|
2435
3606
|
const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$1;
|
|
2436
3607
|
|
|
@@ -2463,9 +3634,6 @@ const collectEvaluatedItems$6 = (items, instance, ast, dynamicAnchors) => {
|
|
|
2463
3634
|
};
|
|
2464
3635
|
|
|
2465
3636
|
var items = { compile: compile$s, interpret: interpret$s, collectEvaluatedItems: collectEvaluatedItems$6 };
|
|
2466
|
-
items.compile;
|
|
2467
|
-
items.interpret;
|
|
2468
|
-
items.collectEvaluatedItems;
|
|
2469
3637
|
|
|
2470
3638
|
const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$1;
|
|
2471
3639
|
|
|
@@ -2490,9 +3658,6 @@ const collectEvaluatedItems$5 = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
2490
3658
|
};
|
|
2491
3659
|
|
|
2492
3660
|
var items202012 = { compile: compile$r, interpret: interpret$r, collectEvaluatedItems: collectEvaluatedItems$5 };
|
|
2493
|
-
items202012.compile;
|
|
2494
|
-
items202012.interpret;
|
|
2495
|
-
items202012.collectEvaluatedItems;
|
|
2496
3661
|
|
|
2497
3662
|
const { Schema: Schema$u, Instance: Instance$m } = lib$1;
|
|
2498
3663
|
|
|
@@ -2501,8 +3666,6 @@ const compile$q = (schema) => Schema$u.value(schema);
|
|
|
2501
3666
|
const interpret$q = (maxItems, instance) => !Instance$m.typeOf(instance, "array") || Instance$m.length(instance) <= maxItems;
|
|
2502
3667
|
|
|
2503
3668
|
var maxItems = { compile: compile$q, interpret: interpret$q };
|
|
2504
|
-
maxItems.compile;
|
|
2505
|
-
maxItems.interpret;
|
|
2506
3669
|
|
|
2507
3670
|
const { Schema: Schema$t, Instance: Instance$l } = lib$1;
|
|
2508
3671
|
|
|
@@ -2511,8 +3674,6 @@ const compile$p = (schema) => Schema$t.value(schema);
|
|
|
2511
3674
|
const interpret$p = (maxLength, instance) => !Instance$l.typeOf(instance, "string") || Instance$l.length(instance) <= maxLength;
|
|
2512
3675
|
|
|
2513
3676
|
var maxLength = { compile: compile$p, interpret: interpret$p };
|
|
2514
|
-
maxLength.compile;
|
|
2515
|
-
maxLength.interpret;
|
|
2516
3677
|
|
|
2517
3678
|
const { Schema: Schema$s, Instance: Instance$k } = lib$1;
|
|
2518
3679
|
|
|
@@ -2521,8 +3682,6 @@ const compile$o = (schema) => Schema$s.value(schema);
|
|
|
2521
3682
|
const interpret$o = (maxLength, instance) => !Instance$k.typeOf(instance, "string") || [...Instance$k.value(instance)].length <= maxLength;
|
|
2522
3683
|
|
|
2523
3684
|
var maxLength6 = { compile: compile$o, interpret: interpret$o };
|
|
2524
|
-
maxLength6.compile;
|
|
2525
|
-
maxLength6.interpret;
|
|
2526
3685
|
|
|
2527
3686
|
const { Schema: Schema$r, Instance: Instance$j } = lib$1;
|
|
2528
3687
|
|
|
@@ -2531,8 +3690,6 @@ const compile$n = (schema) => Schema$r.value(schema);
|
|
|
2531
3690
|
const interpret$n = (maxProperties, instance) => !Instance$j.typeOf(instance, "object") || Instance$j.keys(instance).length <= maxProperties;
|
|
2532
3691
|
|
|
2533
3692
|
var maxProperties = { compile: compile$n, interpret: interpret$n };
|
|
2534
|
-
maxProperties.compile;
|
|
2535
|
-
maxProperties.interpret;
|
|
2536
3693
|
|
|
2537
3694
|
const { Schema: Schema$q, Instance: Instance$i } = lib$1;
|
|
2538
3695
|
|
|
@@ -2554,8 +3711,6 @@ const interpret$m = ([maximum, isExclusive], instance) => {
|
|
|
2554
3711
|
};
|
|
2555
3712
|
|
|
2556
3713
|
var maximumExclusiveMaximum = { compile: compile$m, interpret: interpret$m };
|
|
2557
|
-
maximumExclusiveMaximum.compile;
|
|
2558
|
-
maximumExclusiveMaximum.interpret;
|
|
2559
3714
|
|
|
2560
3715
|
const { Schema: Schema$p, Instance: Instance$h } = lib$1;
|
|
2561
3716
|
|
|
@@ -2564,8 +3719,6 @@ const compile$l = async (schema) => Schema$p.value(schema);
|
|
|
2564
3719
|
const interpret$l = (maximum, instance) => !Instance$h.typeOf(instance, "number") || Instance$h.value(instance) <= maximum;
|
|
2565
3720
|
|
|
2566
3721
|
var maximum = { compile: compile$l, interpret: interpret$l };
|
|
2567
|
-
maximum.compile;
|
|
2568
|
-
maximum.interpret;
|
|
2569
3722
|
|
|
2570
3723
|
const { Schema: Schema$o, Instance: Instance$g } = lib$1;
|
|
2571
3724
|
|
|
@@ -2574,8 +3727,6 @@ const compile$k = (schema) => Schema$o.value(schema);
|
|
|
2574
3727
|
const interpret$k = (minItems, instance) => !Instance$g.typeOf(instance, "array") || Instance$g.length(instance) >= minItems;
|
|
2575
3728
|
|
|
2576
3729
|
var minItems = { compile: compile$k, interpret: interpret$k };
|
|
2577
|
-
minItems.compile;
|
|
2578
|
-
minItems.interpret;
|
|
2579
3730
|
|
|
2580
3731
|
const { Schema: Schema$n, Instance: Instance$f } = lib$1;
|
|
2581
3732
|
|
|
@@ -2584,8 +3735,6 @@ const compile$j = (schema) => Schema$n.value(schema);
|
|
|
2584
3735
|
const interpret$j = (minLength, instance) => !Instance$f.typeOf(instance, "string") || Instance$f.length(instance) >= minLength;
|
|
2585
3736
|
|
|
2586
3737
|
var minLength = { compile: compile$j, interpret: interpret$j };
|
|
2587
|
-
minLength.compile;
|
|
2588
|
-
minLength.interpret;
|
|
2589
3738
|
|
|
2590
3739
|
const { Schema: Schema$m, Instance: Instance$e } = lib$1;
|
|
2591
3740
|
|
|
@@ -2594,8 +3743,6 @@ const compile$i = (schema) => Schema$m.value(schema);
|
|
|
2594
3743
|
const interpret$i = (minLength, instance) => !Instance$e.typeOf(instance, "string") || [...Instance$e.value(instance)].length >= minLength;
|
|
2595
3744
|
|
|
2596
3745
|
var minLength6 = { compile: compile$i, interpret: interpret$i };
|
|
2597
|
-
minLength6.compile;
|
|
2598
|
-
minLength6.interpret;
|
|
2599
3746
|
|
|
2600
3747
|
const { Schema: Schema$l, Instance: Instance$d } = lib$1;
|
|
2601
3748
|
|
|
@@ -2604,8 +3751,6 @@ const compile$h = (schema) => Schema$l.value(schema);
|
|
|
2604
3751
|
const interpret$h = (minProperties, instance) => !Instance$d.typeOf(instance, "object") || Instance$d.keys(instance).length >= minProperties;
|
|
2605
3752
|
|
|
2606
3753
|
var minProperties = { compile: compile$h, interpret: interpret$h };
|
|
2607
|
-
minProperties.compile;
|
|
2608
|
-
minProperties.interpret;
|
|
2609
3754
|
|
|
2610
3755
|
const { Schema: Schema$k, Instance: Instance$c } = lib$1;
|
|
2611
3756
|
|
|
@@ -2627,8 +3772,6 @@ const interpret$g = ([minimum, isExclusive], instance) => {
|
|
|
2627
3772
|
};
|
|
2628
3773
|
|
|
2629
3774
|
var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
|
|
2630
|
-
minimumExclusiveMinimum.compile;
|
|
2631
|
-
minimumExclusiveMinimum.interpret;
|
|
2632
3775
|
|
|
2633
3776
|
const { Schema: Schema$j, Instance: Instance$b } = lib$1;
|
|
2634
3777
|
|
|
@@ -2637,8 +3780,6 @@ const compile$f = async (schema) => Schema$j.value(schema);
|
|
|
2637
3780
|
const interpret$f = (minimum, instance) => !Instance$b.typeOf(instance, "number") || Instance$b.value(instance) >= minimum;
|
|
2638
3781
|
|
|
2639
3782
|
var minimum = { compile: compile$f, interpret: interpret$f };
|
|
2640
|
-
minimum.compile;
|
|
2641
|
-
minimum.interpret;
|
|
2642
3783
|
|
|
2643
3784
|
const { Schema: Schema$i, Instance: Instance$a } = lib$1;
|
|
2644
3785
|
|
|
@@ -2657,8 +3798,6 @@ const interpret$e = (multipleOf, instance) => {
|
|
|
2657
3798
|
const numberEqual = (a, b) => Math.abs(a - b) < 1.19209290e-7;
|
|
2658
3799
|
|
|
2659
3800
|
var multipleOf = { compile: compile$e, interpret: interpret$e };
|
|
2660
|
-
multipleOf.compile;
|
|
2661
|
-
multipleOf.interpret;
|
|
2662
3801
|
|
|
2663
3802
|
const { Core: Core$f } = lib$1;
|
|
2664
3803
|
|
|
@@ -2667,8 +3806,6 @@ const compile$d = Core$f.compileSchema;
|
|
|
2667
3806
|
const interpret$d = (not, instance, ast, dynamicAnchors) => !Core$f.interpretSchema(not, instance, ast, dynamicAnchors);
|
|
2668
3807
|
|
|
2669
3808
|
var not = { compile: compile$d, interpret: interpret$d };
|
|
2670
|
-
not.compile;
|
|
2671
|
-
not.interpret;
|
|
2672
3809
|
|
|
2673
3810
|
const { Core: Core$e, Schema: Schema$h } = lib$1;
|
|
2674
3811
|
|
|
@@ -2718,10 +3855,6 @@ const collectEvaluatedItems$4 = (oneOf, instance, ast, dynamicAnchors) => {
|
|
|
2718
3855
|
};
|
|
2719
3856
|
|
|
2720
3857
|
var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
|
|
2721
|
-
oneOf.compile;
|
|
2722
|
-
oneOf.interpret;
|
|
2723
|
-
oneOf.collectEvaluatedProperties;
|
|
2724
|
-
oneOf.collectEvaluatedItems;
|
|
2725
3858
|
|
|
2726
3859
|
const { Schema: Schema$g, Instance: Instance$9 } = lib$1;
|
|
2727
3860
|
|
|
@@ -2730,17 +3863,15 @@ const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
|
|
|
2730
3863
|
const interpret$b = (pattern, instance) => !Instance$9.typeOf(instance, "string") || pattern.test(Instance$9.value(instance));
|
|
2731
3864
|
|
|
2732
3865
|
var pattern = { compile: compile$b, interpret: interpret$b };
|
|
2733
|
-
pattern.compile;
|
|
2734
|
-
pattern.interpret;
|
|
2735
3866
|
|
|
2736
3867
|
const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$1;
|
|
3868
|
+
const Pact$2 = lib$2;
|
|
2737
3869
|
|
|
2738
3870
|
|
|
2739
|
-
|
|
2740
|
-
const compile$a = (schema, ast) => lib$2.pipeline([
|
|
3871
|
+
const compile$a = (schema, ast) => Pact$2.pipeline([
|
|
2741
3872
|
Schema$f.entries,
|
|
2742
|
-
|
|
2743
|
-
|
|
3873
|
+
Pact$2.map(async ([pattern, propertySchema]) => [new RegExp(pattern, "u"), await Core$d.compileSchema(propertySchema, ast)]),
|
|
3874
|
+
Pact$2.all
|
|
2744
3875
|
], schema);
|
|
2745
3876
|
|
|
2746
3877
|
const interpret$a = (patternProperties, instance, ast, dynamicAnchors) => {
|
|
@@ -2756,9 +3887,6 @@ const collectEvaluatedProperties$4 = (patternProperties, instance, ast, dynamicA
|
|
|
2756
3887
|
};
|
|
2757
3888
|
|
|
2758
3889
|
var patternProperties = { compile: compile$a, interpret: interpret$a, collectEvaluatedProperties: collectEvaluatedProperties$4 };
|
|
2759
|
-
patternProperties.compile;
|
|
2760
|
-
patternProperties.interpret;
|
|
2761
|
-
patternProperties.collectEvaluatedProperties;
|
|
2762
3890
|
|
|
2763
3891
|
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
2764
3892
|
const escapeRegExp$1 = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -2775,13 +3903,13 @@ const splitUrl$1 = (url) => {
|
|
|
2775
3903
|
var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
|
|
2776
3904
|
|
|
2777
3905
|
const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$1;
|
|
2778
|
-
|
|
3906
|
+
const Pact$1 = lib$2;
|
|
2779
3907
|
const { escapeRegExp } = common;
|
|
2780
3908
|
|
|
2781
3909
|
|
|
2782
|
-
const compile$9 = (schema, ast) =>
|
|
3910
|
+
const compile$9 = (schema, ast) => Pact$1.pipeline([
|
|
2783
3911
|
Schema$e.entries,
|
|
2784
|
-
|
|
3912
|
+
Pact$1.reduce(async (acc, [propertyName, propertySchema]) => {
|
|
2785
3913
|
acc[propertyName] = await Core$c.compileSchema(propertySchema, ast);
|
|
2786
3914
|
return acc;
|
|
2787
3915
|
}, Object.create(null))
|
|
@@ -2799,9 +3927,6 @@ const collectEvaluatedProperties$3 = (properties, instance, ast, dynamicAnchors)
|
|
|
2799
3927
|
};
|
|
2800
3928
|
|
|
2801
3929
|
var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
|
|
2802
|
-
properties.compile;
|
|
2803
|
-
properties.interpret;
|
|
2804
|
-
properties.collectEvaluatedProperties;
|
|
2805
3930
|
|
|
2806
3931
|
const { Core: Core$b, Instance: Instance$6 } = lib$1;
|
|
2807
3932
|
|
|
@@ -2814,8 +3939,6 @@ const interpret$8 = (propertyNames, instance, ast, dynamicAnchors) => {
|
|
|
2814
3939
|
};
|
|
2815
3940
|
|
|
2816
3941
|
var propertyNames = { compile: compile$8, interpret: interpret$8 };
|
|
2817
|
-
propertyNames.compile;
|
|
2818
|
-
propertyNames.interpret;
|
|
2819
3942
|
|
|
2820
3943
|
const { Core: Core$a, Schema: Schema$d } = lib$1;
|
|
2821
3944
|
const { splitUrl } = common;
|
|
@@ -2841,10 +3964,6 @@ const collectEvaluatedProperties$2 = Core$a.collectEvaluatedProperties;
|
|
|
2841
3964
|
const collectEvaluatedItems$3 = Core$a.collectEvaluatedItems;
|
|
2842
3965
|
|
|
2843
3966
|
var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
|
|
2844
|
-
dynamicRef.compile;
|
|
2845
|
-
dynamicRef.interpret;
|
|
2846
|
-
dynamicRef.collectEvaluatedProperties;
|
|
2847
|
-
dynamicRef.collectEvaluatedItems;
|
|
2848
3967
|
|
|
2849
3968
|
const { Core: Core$9, Schema: Schema$c } = lib$1;
|
|
2850
3969
|
|
|
@@ -2859,10 +3978,6 @@ const collectEvaluatedProperties$1 = Core$9.collectEvaluatedProperties;
|
|
|
2859
3978
|
const collectEvaluatedItems$2 = Core$9.collectEvaluatedItems;
|
|
2860
3979
|
|
|
2861
3980
|
var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
|
|
2862
|
-
ref.compile;
|
|
2863
|
-
ref.interpret;
|
|
2864
|
-
ref.collectEvaluatedProperties;
|
|
2865
|
-
ref.collectEvaluatedItems;
|
|
2866
3981
|
|
|
2867
3982
|
const { Schema: Schema$b, Instance: Instance$5 } = lib$1;
|
|
2868
3983
|
|
|
@@ -2874,17 +3989,15 @@ const interpret$5 = (required, instance) => {
|
|
|
2874
3989
|
};
|
|
2875
3990
|
|
|
2876
3991
|
var required = { compile: compile$5, interpret: interpret$5 };
|
|
2877
|
-
required.compile;
|
|
2878
|
-
required.interpret;
|
|
2879
3992
|
|
|
2880
3993
|
const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$1;
|
|
2881
|
-
|
|
3994
|
+
const Pact = lib$2;
|
|
2882
3995
|
|
|
2883
3996
|
|
|
2884
3997
|
const compile$4 = (schema, ast) => {
|
|
2885
|
-
return
|
|
3998
|
+
return Pact.pipeline([
|
|
2886
3999
|
Schema$a.map((itemSchema) => Core$8.compileSchema(itemSchema, ast)),
|
|
2887
|
-
|
|
4000
|
+
Pact.all
|
|
2888
4001
|
], schema);
|
|
2889
4002
|
};
|
|
2890
4003
|
|
|
@@ -2901,9 +4014,6 @@ const collectEvaluatedItems$1 = (items, instance, ast, dynamicAnchors) => {
|
|
|
2901
4014
|
};
|
|
2902
4015
|
|
|
2903
4016
|
var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
|
|
2904
|
-
tupleItems.compile;
|
|
2905
|
-
tupleItems.interpret;
|
|
2906
|
-
tupleItems.collectEvaluatedItems;
|
|
2907
4017
|
|
|
2908
4018
|
const { Schema: Schema$9, Instance: Instance$3 } = lib$1;
|
|
2909
4019
|
|
|
@@ -2912,8 +4022,6 @@ const compile$3 = (schema) => Schema$9.value(schema);
|
|
|
2912
4022
|
const interpret$3 = (type, instance) => typeof type === "string" ? Instance$3.typeOf(instance, type) : type.some(Instance$3.typeOf(instance));
|
|
2913
4023
|
|
|
2914
4024
|
var type = { compile: compile$3, interpret: interpret$3 };
|
|
2915
|
-
type.compile;
|
|
2916
|
-
type.interpret;
|
|
2917
4025
|
|
|
2918
4026
|
const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$1;
|
|
2919
4027
|
|
|
@@ -2938,9 +4046,6 @@ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
|
2938
4046
|
};
|
|
2939
4047
|
|
|
2940
4048
|
var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
|
|
2941
|
-
unevaluatedItems.compile;
|
|
2942
|
-
unevaluatedItems.interpret;
|
|
2943
|
-
unevaluatedItems.collectEvaluatedItems;
|
|
2944
4049
|
|
|
2945
4050
|
const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$1;
|
|
2946
4051
|
|
|
@@ -2966,12 +4071,9 @@ const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors)
|
|
|
2966
4071
|
};
|
|
2967
4072
|
|
|
2968
4073
|
var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
|
|
2969
|
-
unevaluatedProperties.compile;
|
|
2970
|
-
unevaluatedProperties.interpret;
|
|
2971
|
-
unevaluatedProperties.collectEvaluatedProperties;
|
|
2972
4074
|
|
|
2973
4075
|
const { Schema: Schema$6, Instance } = lib$1;
|
|
2974
|
-
|
|
4076
|
+
const jsonStringify = fastestStableStringify;
|
|
2975
4077
|
|
|
2976
4078
|
|
|
2977
4079
|
const compile = (schema) => Schema$6.value(schema);
|
|
@@ -2981,18 +4083,16 @@ const interpret = (uniqueItems, instance) => {
|
|
|
2981
4083
|
return true;
|
|
2982
4084
|
}
|
|
2983
4085
|
|
|
2984
|
-
const normalizedItems = Instance.map((item) =>
|
|
4086
|
+
const normalizedItems = Instance.map((item) => jsonStringify(Instance.value(item)), instance);
|
|
2985
4087
|
return new Set(normalizedItems).size === normalizedItems.length;
|
|
2986
4088
|
};
|
|
2987
4089
|
|
|
2988
4090
|
var uniqueItems = { compile, interpret };
|
|
2989
|
-
uniqueItems.compile;
|
|
2990
|
-
uniqueItems.interpret;
|
|
2991
4091
|
|
|
2992
|
-
const { Keywords } = lib$1;
|
|
4092
|
+
const { Keywords: Keywords$1 } = lib$1;
|
|
2993
4093
|
|
|
2994
4094
|
|
|
2995
|
-
var keywords = {
|
|
4095
|
+
var keywords$5 = {
|
|
2996
4096
|
additionalItems: additionalItems,
|
|
2997
4097
|
additionalItems6: additionalItems6,
|
|
2998
4098
|
additionalProperties: additionalProperties,
|
|
@@ -3020,7 +4120,7 @@ var keywords = {
|
|
|
3020
4120
|
maxProperties: maxProperties,
|
|
3021
4121
|
maximumExclusiveMaximum: maximumExclusiveMaximum,
|
|
3022
4122
|
maximum: maximum,
|
|
3023
|
-
metaData: Keywords.metaData,
|
|
4123
|
+
metaData: Keywords$1.metaData,
|
|
3024
4124
|
minItems: minItems,
|
|
3025
4125
|
minLength: minLength,
|
|
3026
4126
|
minLength6: minLength6,
|
|
@@ -3042,54 +4142,8 @@ var keywords = {
|
|
|
3042
4142
|
unevaluatedItems: unevaluatedItems,
|
|
3043
4143
|
unevaluatedProperties: unevaluatedProperties,
|
|
3044
4144
|
uniqueItems: uniqueItems,
|
|
3045
|
-
validate: Keywords.validate
|
|
4145
|
+
validate: Keywords$1.validate
|
|
3046
4146
|
};
|
|
3047
|
-
keywords.additionalItems;
|
|
3048
|
-
keywords.additionalItems6;
|
|
3049
|
-
keywords.additionalProperties;
|
|
3050
|
-
keywords.additionalProperties6;
|
|
3051
|
-
keywords.allOf;
|
|
3052
|
-
keywords.anyOf;
|
|
3053
|
-
keywords.contains;
|
|
3054
|
-
keywords.containsMinContainsMaxContains;
|
|
3055
|
-
keywords.definitions;
|
|
3056
|
-
keywords.dependencies;
|
|
3057
|
-
keywords.dependentRequired;
|
|
3058
|
-
keywords.dependentSchemas;
|
|
3059
|
-
keywords.exclusiveMaximum;
|
|
3060
|
-
keywords.exclusiveMinimum;
|
|
3061
|
-
keywords.then;
|
|
3062
|
-
keywords.items;
|
|
3063
|
-
keywords.items202012;
|
|
3064
|
-
keywords.maxItems;
|
|
3065
|
-
keywords.maxLength;
|
|
3066
|
-
keywords.maxLength6;
|
|
3067
|
-
keywords.maxProperties;
|
|
3068
|
-
keywords.maximumExclusiveMaximum;
|
|
3069
|
-
keywords.maximum;
|
|
3070
|
-
keywords.metaData;
|
|
3071
|
-
keywords.minItems;
|
|
3072
|
-
keywords.minLength;
|
|
3073
|
-
keywords.minLength6;
|
|
3074
|
-
keywords.minProperties;
|
|
3075
|
-
keywords.minimumExclusiveMinimum;
|
|
3076
|
-
keywords.minimum;
|
|
3077
|
-
keywords.multipleOf;
|
|
3078
|
-
keywords.not;
|
|
3079
|
-
keywords.oneOf;
|
|
3080
|
-
keywords.pattern;
|
|
3081
|
-
keywords.patternProperties;
|
|
3082
|
-
keywords.properties;
|
|
3083
|
-
keywords.propertyNames;
|
|
3084
|
-
keywords.dynamicRef;
|
|
3085
|
-
keywords.ref;
|
|
3086
|
-
keywords.required;
|
|
3087
|
-
keywords.tupleItems;
|
|
3088
|
-
keywords.type;
|
|
3089
|
-
keywords.unevaluatedItems;
|
|
3090
|
-
keywords.unevaluatedProperties;
|
|
3091
|
-
keywords.uniqueItems;
|
|
3092
|
-
keywords.validate;
|
|
3093
4147
|
|
|
3094
4148
|
var schema$4 = `{
|
|
3095
4149
|
"id": "http://json-schema.org/draft-04/schema#",
|
|
@@ -3242,50 +4296,50 @@ var schema$4 = `{
|
|
|
3242
4296
|
}`;
|
|
3243
4297
|
|
|
3244
4298
|
const { Core: Core$5, Schema: Schema$5 } = lib$1;
|
|
3245
|
-
|
|
3246
|
-
|
|
4299
|
+
const keywords$4 = keywords$5;
|
|
4300
|
+
const metaSchema$4 = schema$4;
|
|
3247
4301
|
|
|
3248
4302
|
|
|
3249
4303
|
// JSON Schema Draft-04
|
|
3250
|
-
const
|
|
3251
|
-
|
|
3252
|
-
Schema$5.setConfig(
|
|
3253
|
-
Schema$5.setConfig(
|
|
3254
|
-
Schema$5.setConfig(
|
|
3255
|
-
Schema$5.setConfig(
|
|
3256
|
-
|
|
3257
|
-
Schema$5.add(JSON.parse(
|
|
3258
|
-
Core$5.defineVocabulary(
|
|
3259
|
-
"validate": keywords.validate,
|
|
3260
|
-
"additionalItems": keywords.additionalItems,
|
|
3261
|
-
"additionalProperties": keywords.additionalProperties,
|
|
3262
|
-
"allOf": keywords.allOf,
|
|
3263
|
-
"anyOf": keywords.anyOf,
|
|
3264
|
-
"default": keywords.metaData,
|
|
3265
|
-
"definitions": keywords.definitions,
|
|
3266
|
-
"dependencies": keywords.dependencies,
|
|
3267
|
-
"description": keywords.metaData,
|
|
3268
|
-
"enum": keywords.enum,
|
|
3269
|
-
"format": keywords.metaData,
|
|
3270
|
-
"items": keywords.items,
|
|
3271
|
-
"maxItems": keywords.maxItems,
|
|
3272
|
-
"maxLength": keywords.maxLength,
|
|
3273
|
-
"maxProperties": keywords.maxProperties,
|
|
3274
|
-
"maximum": keywords.maximumExclusiveMaximum,
|
|
3275
|
-
"minItems": keywords.minItems,
|
|
3276
|
-
"minLength": keywords.minLength,
|
|
3277
|
-
"minProperties": keywords.minProperties,
|
|
3278
|
-
"minimum": keywords.minimumExclusiveMinimum,
|
|
3279
|
-
"multipleOf": keywords.multipleOf,
|
|
3280
|
-
"not": keywords.not,
|
|
3281
|
-
"oneOf": keywords.oneOf,
|
|
3282
|
-
"pattern": keywords.pattern,
|
|
3283
|
-
"patternProperties": keywords.patternProperties,
|
|
3284
|
-
"properties": keywords.properties,
|
|
3285
|
-
"required": keywords.required,
|
|
3286
|
-
"title": keywords.metaData,
|
|
3287
|
-
"type": keywords.type,
|
|
3288
|
-
"uniqueItems": keywords.uniqueItems
|
|
4304
|
+
const jsonSchemaVersion$4 = "http://json-schema.org/draft-04/schema";
|
|
4305
|
+
|
|
4306
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "baseToken", "id");
|
|
4307
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "embeddedToken", "id");
|
|
4308
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "anchorToken", "id");
|
|
4309
|
+
Schema$5.setConfig(jsonSchemaVersion$4, "jrefToken", "$ref");
|
|
4310
|
+
|
|
4311
|
+
Schema$5.add(JSON.parse(metaSchema$4));
|
|
4312
|
+
Core$5.defineVocabulary(jsonSchemaVersion$4, {
|
|
4313
|
+
"validate": keywords$4.validate,
|
|
4314
|
+
"additionalItems": keywords$4.additionalItems,
|
|
4315
|
+
"additionalProperties": keywords$4.additionalProperties,
|
|
4316
|
+
"allOf": keywords$4.allOf,
|
|
4317
|
+
"anyOf": keywords$4.anyOf,
|
|
4318
|
+
"default": keywords$4.metaData,
|
|
4319
|
+
"definitions": keywords$4.definitions,
|
|
4320
|
+
"dependencies": keywords$4.dependencies,
|
|
4321
|
+
"description": keywords$4.metaData,
|
|
4322
|
+
"enum": keywords$4.enum,
|
|
4323
|
+
"format": keywords$4.metaData,
|
|
4324
|
+
"items": keywords$4.items,
|
|
4325
|
+
"maxItems": keywords$4.maxItems,
|
|
4326
|
+
"maxLength": keywords$4.maxLength,
|
|
4327
|
+
"maxProperties": keywords$4.maxProperties,
|
|
4328
|
+
"maximum": keywords$4.maximumExclusiveMaximum,
|
|
4329
|
+
"minItems": keywords$4.minItems,
|
|
4330
|
+
"minLength": keywords$4.minLength,
|
|
4331
|
+
"minProperties": keywords$4.minProperties,
|
|
4332
|
+
"minimum": keywords$4.minimumExclusiveMinimum,
|
|
4333
|
+
"multipleOf": keywords$4.multipleOf,
|
|
4334
|
+
"not": keywords$4.not,
|
|
4335
|
+
"oneOf": keywords$4.oneOf,
|
|
4336
|
+
"pattern": keywords$4.pattern,
|
|
4337
|
+
"patternProperties": keywords$4.patternProperties,
|
|
4338
|
+
"properties": keywords$4.properties,
|
|
4339
|
+
"required": keywords$4.required,
|
|
4340
|
+
"title": keywords$4.metaData,
|
|
4341
|
+
"type": keywords$4.type,
|
|
4342
|
+
"uniqueItems": keywords$4.uniqueItems
|
|
3289
4343
|
});
|
|
3290
4344
|
|
|
3291
4345
|
var schema$3 = `{
|
|
@@ -3444,55 +4498,55 @@ var schema$3 = `{
|
|
|
3444
4498
|
}`;
|
|
3445
4499
|
|
|
3446
4500
|
const { Core: Core$4, Schema: Schema$4 } = lib$1;
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
const
|
|
3452
|
-
|
|
3453
|
-
Schema$4.setConfig(
|
|
3454
|
-
Schema$4.setConfig(
|
|
3455
|
-
Schema$4.setConfig(
|
|
3456
|
-
Schema$4.setConfig(
|
|
3457
|
-
|
|
3458
|
-
Schema$4.add(JSON.parse(
|
|
3459
|
-
Core$4.defineVocabulary(
|
|
3460
|
-
"validate": keywords.validate,
|
|
3461
|
-
"additionalItems": keywords.additionalItems6,
|
|
3462
|
-
"additionalProperties": keywords.additionalProperties6,
|
|
3463
|
-
"allOf": keywords.allOf,
|
|
3464
|
-
"anyOf": keywords.anyOf,
|
|
3465
|
-
"const": keywords.const,
|
|
3466
|
-
"contains": keywords.contains,
|
|
3467
|
-
"default": keywords.metaData,
|
|
3468
|
-
"definitions": keywords.definitions,
|
|
3469
|
-
"dependencies": keywords.dependencies,
|
|
3470
|
-
"description": keywords.metaData,
|
|
3471
|
-
"enum": keywords.enum,
|
|
3472
|
-
"examples": keywords.metaData,
|
|
3473
|
-
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
3474
|
-
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
3475
|
-
"format": keywords.metaData,
|
|
3476
|
-
"items": keywords.items,
|
|
3477
|
-
"maxItems": keywords.maxItems,
|
|
3478
|
-
"maxLength": keywords.maxLength6,
|
|
3479
|
-
"maxProperties": keywords.maxProperties,
|
|
3480
|
-
"maximum": keywords.maximum,
|
|
3481
|
-
"minItems": keywords.minItems,
|
|
3482
|
-
"minLength": keywords.minLength6,
|
|
3483
|
-
"minProperties": keywords.minProperties,
|
|
3484
|
-
"minimum": keywords.minimum,
|
|
3485
|
-
"multipleOf": keywords.multipleOf,
|
|
3486
|
-
"not": keywords.not,
|
|
3487
|
-
"oneOf": keywords.oneOf,
|
|
3488
|
-
"pattern": keywords.pattern,
|
|
3489
|
-
"patternProperties": keywords.patternProperties,
|
|
3490
|
-
"properties": keywords.properties,
|
|
3491
|
-
"propertyNames": keywords.propertyNames,
|
|
3492
|
-
"required": keywords.required,
|
|
3493
|
-
"title": keywords.metaData,
|
|
3494
|
-
"type": keywords.type,
|
|
3495
|
-
"uniqueItems": keywords.uniqueItems
|
|
4501
|
+
const keywords$3 = keywords$5;
|
|
4502
|
+
const metaSchema$3 = schema$3;
|
|
4503
|
+
|
|
4504
|
+
|
|
4505
|
+
const jsonSchemaVersion$3 = "http://json-schema.org/draft-06/schema";
|
|
4506
|
+
|
|
4507
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "baseToken", "$id");
|
|
4508
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "embeddedToken", "$id");
|
|
4509
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "anchorToken", "$id");
|
|
4510
|
+
Schema$4.setConfig(jsonSchemaVersion$3, "jrefToken", "$ref");
|
|
4511
|
+
|
|
4512
|
+
Schema$4.add(JSON.parse(metaSchema$3));
|
|
4513
|
+
Core$4.defineVocabulary(jsonSchemaVersion$3, {
|
|
4514
|
+
"validate": keywords$3.validate,
|
|
4515
|
+
"additionalItems": keywords$3.additionalItems6,
|
|
4516
|
+
"additionalProperties": keywords$3.additionalProperties6,
|
|
4517
|
+
"allOf": keywords$3.allOf,
|
|
4518
|
+
"anyOf": keywords$3.anyOf,
|
|
4519
|
+
"const": keywords$3.const,
|
|
4520
|
+
"contains": keywords$3.contains,
|
|
4521
|
+
"default": keywords$3.metaData,
|
|
4522
|
+
"definitions": keywords$3.definitions,
|
|
4523
|
+
"dependencies": keywords$3.dependencies,
|
|
4524
|
+
"description": keywords$3.metaData,
|
|
4525
|
+
"enum": keywords$3.enum,
|
|
4526
|
+
"examples": keywords$3.metaData,
|
|
4527
|
+
"exclusiveMaximum": keywords$3.exclusiveMaximum,
|
|
4528
|
+
"exclusiveMinimum": keywords$3.exclusiveMinimum,
|
|
4529
|
+
"format": keywords$3.metaData,
|
|
4530
|
+
"items": keywords$3.items,
|
|
4531
|
+
"maxItems": keywords$3.maxItems,
|
|
4532
|
+
"maxLength": keywords$3.maxLength6,
|
|
4533
|
+
"maxProperties": keywords$3.maxProperties,
|
|
4534
|
+
"maximum": keywords$3.maximum,
|
|
4535
|
+
"minItems": keywords$3.minItems,
|
|
4536
|
+
"minLength": keywords$3.minLength6,
|
|
4537
|
+
"minProperties": keywords$3.minProperties,
|
|
4538
|
+
"minimum": keywords$3.minimum,
|
|
4539
|
+
"multipleOf": keywords$3.multipleOf,
|
|
4540
|
+
"not": keywords$3.not,
|
|
4541
|
+
"oneOf": keywords$3.oneOf,
|
|
4542
|
+
"pattern": keywords$3.pattern,
|
|
4543
|
+
"patternProperties": keywords$3.patternProperties,
|
|
4544
|
+
"properties": keywords$3.properties,
|
|
4545
|
+
"propertyNames": keywords$3.propertyNames,
|
|
4546
|
+
"required": keywords$3.required,
|
|
4547
|
+
"title": keywords$3.metaData,
|
|
4548
|
+
"type": keywords$3.type,
|
|
4549
|
+
"uniqueItems": keywords$3.uniqueItems
|
|
3496
4550
|
});
|
|
3497
4551
|
|
|
3498
4552
|
var schema$2 = `{
|
|
@@ -3669,59 +4723,59 @@ var schema$2 = `{
|
|
|
3669
4723
|
}`;
|
|
3670
4724
|
|
|
3671
4725
|
const { Core: Core$3, Schema: Schema$3 } = lib$1;
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
const
|
|
3677
|
-
|
|
3678
|
-
Schema$3.setConfig(
|
|
3679
|
-
Schema$3.setConfig(
|
|
3680
|
-
Schema$3.setConfig(
|
|
3681
|
-
Schema$3.setConfig(
|
|
3682
|
-
|
|
3683
|
-
Schema$3.add(JSON.parse(
|
|
3684
|
-
Core$3.defineVocabulary(
|
|
3685
|
-
"validate": keywords.validate,
|
|
3686
|
-
"additionalItems": keywords.additionalItems6,
|
|
3687
|
-
"additionalProperties": keywords.additionalProperties6,
|
|
3688
|
-
"allOf": keywords.allOf,
|
|
3689
|
-
"anyOf": keywords.anyOf,
|
|
3690
|
-
"const": keywords.const,
|
|
3691
|
-
"contains": keywords.contains,
|
|
3692
|
-
"default": keywords.metaData,
|
|
3693
|
-
"definitions": keywords.definitions,
|
|
3694
|
-
"dependencies": keywords.dependencies,
|
|
3695
|
-
"description": keywords.metaData,
|
|
3696
|
-
"enum": keywords.enum,
|
|
3697
|
-
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
3698
|
-
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
3699
|
-
"format": keywords.metaData,
|
|
3700
|
-
"if": keywords.if,
|
|
3701
|
-
"then": keywords.then,
|
|
3702
|
-
"else": keywords.else,
|
|
3703
|
-
"items": keywords.items,
|
|
3704
|
-
"maxItems": keywords.maxItems,
|
|
3705
|
-
"maxLength": keywords.maxLength6,
|
|
3706
|
-
"maxProperties": keywords.maxProperties,
|
|
3707
|
-
"maximum": keywords.maximum,
|
|
3708
|
-
"minItems": keywords.minItems,
|
|
3709
|
-
"minLength": keywords.minLength6,
|
|
3710
|
-
"minProperties": keywords.minProperties,
|
|
3711
|
-
"minimum": keywords.minimum,
|
|
3712
|
-
"multipleOf": keywords.multipleOf,
|
|
3713
|
-
"not": keywords.not,
|
|
3714
|
-
"oneOf": keywords.oneOf,
|
|
3715
|
-
"pattern": keywords.pattern,
|
|
3716
|
-
"patternProperties": keywords.patternProperties,
|
|
3717
|
-
"properties": keywords.properties,
|
|
3718
|
-
"propertyNames": keywords.propertyNames,
|
|
3719
|
-
"readOnly": keywords.metaData,
|
|
3720
|
-
"required": keywords.required,
|
|
3721
|
-
"title": keywords.metaData,
|
|
3722
|
-
"type": keywords.type,
|
|
3723
|
-
"uniqueItems": keywords.uniqueItems,
|
|
3724
|
-
"writeOnly": keywords.metaData
|
|
4726
|
+
const keywords$2 = keywords$5;
|
|
4727
|
+
const metaSchema$2 = schema$2;
|
|
4728
|
+
|
|
4729
|
+
|
|
4730
|
+
const jsonSchemaVersion$2 = "http://json-schema.org/draft-07/schema";
|
|
4731
|
+
|
|
4732
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "baseToken", "$id");
|
|
4733
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "embeddedToken", "$id");
|
|
4734
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "anchorToken", "$id");
|
|
4735
|
+
Schema$3.setConfig(jsonSchemaVersion$2, "jrefToken", "$ref");
|
|
4736
|
+
|
|
4737
|
+
Schema$3.add(JSON.parse(metaSchema$2));
|
|
4738
|
+
Core$3.defineVocabulary(jsonSchemaVersion$2, {
|
|
4739
|
+
"validate": keywords$2.validate,
|
|
4740
|
+
"additionalItems": keywords$2.additionalItems6,
|
|
4741
|
+
"additionalProperties": keywords$2.additionalProperties6,
|
|
4742
|
+
"allOf": keywords$2.allOf,
|
|
4743
|
+
"anyOf": keywords$2.anyOf,
|
|
4744
|
+
"const": keywords$2.const,
|
|
4745
|
+
"contains": keywords$2.contains,
|
|
4746
|
+
"default": keywords$2.metaData,
|
|
4747
|
+
"definitions": keywords$2.definitions,
|
|
4748
|
+
"dependencies": keywords$2.dependencies,
|
|
4749
|
+
"description": keywords$2.metaData,
|
|
4750
|
+
"enum": keywords$2.enum,
|
|
4751
|
+
"exclusiveMaximum": keywords$2.exclusiveMaximum,
|
|
4752
|
+
"exclusiveMinimum": keywords$2.exclusiveMinimum,
|
|
4753
|
+
"format": keywords$2.metaData,
|
|
4754
|
+
"if": keywords$2.if,
|
|
4755
|
+
"then": keywords$2.then,
|
|
4756
|
+
"else": keywords$2.else,
|
|
4757
|
+
"items": keywords$2.items,
|
|
4758
|
+
"maxItems": keywords$2.maxItems,
|
|
4759
|
+
"maxLength": keywords$2.maxLength6,
|
|
4760
|
+
"maxProperties": keywords$2.maxProperties,
|
|
4761
|
+
"maximum": keywords$2.maximum,
|
|
4762
|
+
"minItems": keywords$2.minItems,
|
|
4763
|
+
"minLength": keywords$2.minLength6,
|
|
4764
|
+
"minProperties": keywords$2.minProperties,
|
|
4765
|
+
"minimum": keywords$2.minimum,
|
|
4766
|
+
"multipleOf": keywords$2.multipleOf,
|
|
4767
|
+
"not": keywords$2.not,
|
|
4768
|
+
"oneOf": keywords$2.oneOf,
|
|
4769
|
+
"pattern": keywords$2.pattern,
|
|
4770
|
+
"patternProperties": keywords$2.patternProperties,
|
|
4771
|
+
"properties": keywords$2.properties,
|
|
4772
|
+
"propertyNames": keywords$2.propertyNames,
|
|
4773
|
+
"readOnly": keywords$2.metaData,
|
|
4774
|
+
"required": keywords$2.required,
|
|
4775
|
+
"title": keywords$2.metaData,
|
|
4776
|
+
"type": keywords$2.type,
|
|
4777
|
+
"uniqueItems": keywords$2.uniqueItems,
|
|
4778
|
+
"writeOnly": keywords$2.metaData
|
|
3725
4779
|
});
|
|
3726
4780
|
|
|
3727
4781
|
var schema$1 = `{
|
|
@@ -4052,96 +5106,96 @@ var content$1 = `{
|
|
|
4052
5106
|
}`;
|
|
4053
5107
|
|
|
4054
5108
|
const { Core: Core$2, Schema: Schema$2 } = lib$1;
|
|
5109
|
+
const keywords$1 = keywords$5;
|
|
5110
|
+
const metaSchema$1 = schema$1;
|
|
5111
|
+
const coreMetaSchema$1 = core$1;
|
|
5112
|
+
const applicatorMetaSchema$1 = applicator$1;
|
|
5113
|
+
const validationMetaSchema$1 = validation$1;
|
|
5114
|
+
const metaDataMetaSchema$1 = metaData$1;
|
|
5115
|
+
const formatMetaSchema = format;
|
|
5116
|
+
const contentMetaSchema$1 = content$1;
|
|
4055
5117
|
|
|
4056
5118
|
|
|
5119
|
+
const jsonSchemaVersion$1 = "https://json-schema.org/draft/2019-09/vocab/core";
|
|
4057
5120
|
|
|
5121
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "baseToken", "$id");
|
|
5122
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "embeddedToken", "$id");
|
|
5123
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "anchorToken", "$anchor");
|
|
5124
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "recursiveAnchorToken", "$recursiveAnchor");
|
|
5125
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "vocabularyToken", "$vocabulary");
|
|
5126
|
+
Schema$2.setConfig(jsonSchemaVersion$1, "mandatoryVocabularies", ["https://json-schema.org/draft/2019-09/vocab/core"]);
|
|
4058
5127
|
|
|
5128
|
+
Schema$2.add(JSON.parse(metaSchema$1));
|
|
4059
5129
|
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
const schemaVersion$1 = "https://json-schema.org/draft/2019-09/schema";
|
|
4066
|
-
|
|
4067
|
-
Schema$2.setConfig(schemaVersion$1, "baseToken", "$id");
|
|
4068
|
-
Schema$2.setConfig(schemaVersion$1, "embeddedToken", "$id");
|
|
4069
|
-
Schema$2.setConfig(schemaVersion$1, "anchorToken", "$anchor");
|
|
4070
|
-
Schema$2.setConfig(schemaVersion$1, "recursiveAnchorToken", "$recursiveAnchor");
|
|
4071
|
-
Schema$2.setConfig(schemaVersion$1, "vocabularyToken", "$vocabulary");
|
|
4072
|
-
Schema$2.setConfig(schemaVersion$1, "mandatoryVocabularies", ["https://json-schema.org/draft/2019-09/vocab/core"]);
|
|
4073
|
-
|
|
4074
|
-
Schema$2.add(JSON.parse(schema$1));
|
|
4075
|
-
|
|
4076
|
-
Schema$2.add(JSON.parse(core$1));
|
|
5130
|
+
Schema$2.add(JSON.parse(coreMetaSchema$1));
|
|
4077
5131
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/core", {
|
|
4078
|
-
"validate": keywords.validate,
|
|
4079
|
-
"$defs": keywords.definitions,
|
|
4080
|
-
"$recursiveRef": keywords.dynamicRef,
|
|
4081
|
-
"$ref": keywords.ref
|
|
5132
|
+
"validate": keywords$1.validate,
|
|
5133
|
+
"$defs": keywords$1.definitions,
|
|
5134
|
+
"$recursiveRef": keywords$1.dynamicRef,
|
|
5135
|
+
"$ref": keywords$1.ref
|
|
4082
5136
|
});
|
|
4083
5137
|
|
|
4084
|
-
Schema$2.add(JSON.parse(
|
|
5138
|
+
Schema$2.add(JSON.parse(applicatorMetaSchema$1));
|
|
4085
5139
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/applicator", {
|
|
4086
|
-
"additionalItems": keywords.additionalItems6,
|
|
4087
|
-
"additionalProperties": keywords.additionalProperties6,
|
|
4088
|
-
"allOf": keywords.allOf,
|
|
4089
|
-
"anyOf": keywords.anyOf,
|
|
4090
|
-
"contains": keywords.containsMinContainsMaxContains,
|
|
4091
|
-
"dependentSchemas": keywords.dependentSchemas,
|
|
4092
|
-
"if": keywords.if,
|
|
4093
|
-
"then": keywords.then,
|
|
4094
|
-
"else": keywords.else,
|
|
4095
|
-
"items": keywords.items,
|
|
4096
|
-
"not": keywords.not,
|
|
4097
|
-
"oneOf": keywords.oneOf,
|
|
4098
|
-
"patternProperties": keywords.patternProperties,
|
|
4099
|
-
"properties": keywords.properties,
|
|
4100
|
-
"propertyNames": keywords.propertyNames,
|
|
4101
|
-
"unevaluatedItems": keywords.unevaluatedItems,
|
|
4102
|
-
"unevaluatedProperties": keywords.unevaluatedProperties
|
|
5140
|
+
"additionalItems": keywords$1.additionalItems6,
|
|
5141
|
+
"additionalProperties": keywords$1.additionalProperties6,
|
|
5142
|
+
"allOf": keywords$1.allOf,
|
|
5143
|
+
"anyOf": keywords$1.anyOf,
|
|
5144
|
+
"contains": keywords$1.containsMinContainsMaxContains,
|
|
5145
|
+
"dependentSchemas": keywords$1.dependentSchemas,
|
|
5146
|
+
"if": keywords$1.if,
|
|
5147
|
+
"then": keywords$1.then,
|
|
5148
|
+
"else": keywords$1.else,
|
|
5149
|
+
"items": keywords$1.items,
|
|
5150
|
+
"not": keywords$1.not,
|
|
5151
|
+
"oneOf": keywords$1.oneOf,
|
|
5152
|
+
"patternProperties": keywords$1.patternProperties,
|
|
5153
|
+
"properties": keywords$1.properties,
|
|
5154
|
+
"propertyNames": keywords$1.propertyNames,
|
|
5155
|
+
"unevaluatedItems": keywords$1.unevaluatedItems,
|
|
5156
|
+
"unevaluatedProperties": keywords$1.unevaluatedProperties
|
|
4103
5157
|
});
|
|
4104
5158
|
|
|
4105
|
-
Schema$2.add(JSON.parse(
|
|
5159
|
+
Schema$2.add(JSON.parse(validationMetaSchema$1));
|
|
4106
5160
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/validation", {
|
|
4107
|
-
"const": keywords.const,
|
|
4108
|
-
"dependentRequired": keywords.dependentRequired,
|
|
4109
|
-
"enum": keywords.enum,
|
|
4110
|
-
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
4111
|
-
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
4112
|
-
"maxItems": keywords.maxItems,
|
|
4113
|
-
"maxLength": keywords.maxLength6,
|
|
4114
|
-
"maxProperties": keywords.maxProperties,
|
|
4115
|
-
"maximum": keywords.maximum,
|
|
4116
|
-
"minItems": keywords.minItems,
|
|
4117
|
-
"minLength": keywords.minLength6,
|
|
4118
|
-
"minProperties": keywords.minProperties,
|
|
4119
|
-
"minimum": keywords.minimum,
|
|
4120
|
-
"multipleOf": keywords.multipleOf,
|
|
4121
|
-
"pattern": keywords.pattern,
|
|
4122
|
-
"required": keywords.required,
|
|
4123
|
-
"type": keywords.type,
|
|
4124
|
-
"uniqueItems": keywords.uniqueItems
|
|
5161
|
+
"const": keywords$1.const,
|
|
5162
|
+
"dependentRequired": keywords$1.dependentRequired,
|
|
5163
|
+
"enum": keywords$1.enum,
|
|
5164
|
+
"exclusiveMaximum": keywords$1.exclusiveMaximum,
|
|
5165
|
+
"exclusiveMinimum": keywords$1.exclusiveMinimum,
|
|
5166
|
+
"maxItems": keywords$1.maxItems,
|
|
5167
|
+
"maxLength": keywords$1.maxLength6,
|
|
5168
|
+
"maxProperties": keywords$1.maxProperties,
|
|
5169
|
+
"maximum": keywords$1.maximum,
|
|
5170
|
+
"minItems": keywords$1.minItems,
|
|
5171
|
+
"minLength": keywords$1.minLength6,
|
|
5172
|
+
"minProperties": keywords$1.minProperties,
|
|
5173
|
+
"minimum": keywords$1.minimum,
|
|
5174
|
+
"multipleOf": keywords$1.multipleOf,
|
|
5175
|
+
"pattern": keywords$1.pattern,
|
|
5176
|
+
"required": keywords$1.required,
|
|
5177
|
+
"type": keywords$1.type,
|
|
5178
|
+
"uniqueItems": keywords$1.uniqueItems
|
|
4125
5179
|
});
|
|
4126
5180
|
|
|
4127
|
-
Schema$2.add(JSON.parse(
|
|
5181
|
+
Schema$2.add(JSON.parse(metaDataMetaSchema$1));
|
|
4128
5182
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/meta-data", {
|
|
4129
|
-
"default": keywords.metaData,
|
|
4130
|
-
"deprecated": keywords.metaData,
|
|
4131
|
-
"description": keywords.metaData,
|
|
4132
|
-
"examples": keywords.metaData,
|
|
4133
|
-
"readOnly": keywords.metaData,
|
|
4134
|
-
"title": keywords.metaData,
|
|
4135
|
-
"writeOnly": keywords.metaData
|
|
5183
|
+
"default": keywords$1.metaData,
|
|
5184
|
+
"deprecated": keywords$1.metaData,
|
|
5185
|
+
"description": keywords$1.metaData,
|
|
5186
|
+
"examples": keywords$1.metaData,
|
|
5187
|
+
"readOnly": keywords$1.metaData,
|
|
5188
|
+
"title": keywords$1.metaData,
|
|
5189
|
+
"writeOnly": keywords$1.metaData
|
|
4136
5190
|
});
|
|
4137
5191
|
|
|
4138
|
-
Schema$2.add(JSON.parse(
|
|
5192
|
+
Schema$2.add(JSON.parse(formatMetaSchema));
|
|
4139
5193
|
|
|
4140
|
-
Schema$2.add(JSON.parse(
|
|
5194
|
+
Schema$2.add(JSON.parse(contentMetaSchema$1));
|
|
4141
5195
|
Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/content", {
|
|
4142
|
-
"contentEncoding": keywords.metaData,
|
|
4143
|
-
"contentMediaType": keywords.metaData,
|
|
4144
|
-
"contentSchema": keywords.metaData
|
|
5196
|
+
"contentEncoding": keywords$1.metaData,
|
|
5197
|
+
"contentMediaType": keywords$1.metaData,
|
|
5198
|
+
"contentSchema": keywords$1.metaData
|
|
4145
5199
|
});
|
|
4146
5200
|
|
|
4147
5201
|
var schema = `{
|
|
@@ -4499,30 +5553,30 @@ var unevaluated = `{
|
|
|
4499
5553
|
}`;
|
|
4500
5554
|
|
|
4501
5555
|
const { Core: Core$1, Schema: Schema$1 } = lib$1;
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
const
|
|
4515
|
-
|
|
4516
|
-
Schema$1.setConfig(
|
|
4517
|
-
Schema$1.setConfig(
|
|
4518
|
-
Schema$1.setConfig(
|
|
4519
|
-
Schema$1.setConfig(
|
|
4520
|
-
Schema$1.setConfig(
|
|
4521
|
-
Schema$1.setConfig(
|
|
4522
|
-
|
|
4523
|
-
Schema$1.add(JSON.parse(
|
|
4524
|
-
|
|
4525
|
-
Schema$1.add(JSON.parse(
|
|
5556
|
+
const keywords = keywords$5;
|
|
5557
|
+
const metaSchema = schema;
|
|
5558
|
+
const coreMetaSchema = core;
|
|
5559
|
+
const applicatorMetaSchema = applicator;
|
|
5560
|
+
const validationMetaSchema = validation;
|
|
5561
|
+
const metaDataMetaSchema = metaData;
|
|
5562
|
+
const formatAnnotationMetaSchema = formatAnnotation;
|
|
5563
|
+
const formatAssertionMetaSchema = formatAssertion;
|
|
5564
|
+
const contentMetaSchema = content;
|
|
5565
|
+
const unevaluatedMetaSchema = unevaluated;
|
|
5566
|
+
|
|
5567
|
+
|
|
5568
|
+
const jsonSchemaVersion = "https://json-schema.org/draft/2020-12/vocab/core";
|
|
5569
|
+
|
|
5570
|
+
Schema$1.setConfig(jsonSchemaVersion, "baseToken", "$id");
|
|
5571
|
+
Schema$1.setConfig(jsonSchemaVersion, "embeddedToken", "$id");
|
|
5572
|
+
Schema$1.setConfig(jsonSchemaVersion, "anchorToken", "$anchor");
|
|
5573
|
+
Schema$1.setConfig(jsonSchemaVersion, "dynamicAnchorToken", "$dynamicAnchor");
|
|
5574
|
+
Schema$1.setConfig(jsonSchemaVersion, "vocabularyToken", "$vocabulary");
|
|
5575
|
+
Schema$1.setConfig(jsonSchemaVersion, "mandatoryVocabularies", ["https://json-schema.org/draft/2020-12/vocab/core"]);
|
|
5576
|
+
|
|
5577
|
+
Schema$1.add(JSON.parse(metaSchema));
|
|
5578
|
+
|
|
5579
|
+
Schema$1.add(JSON.parse(coreMetaSchema));
|
|
4526
5580
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/core", {
|
|
4527
5581
|
"validate": keywords.validate,
|
|
4528
5582
|
"$defs": keywords.definitions,
|
|
@@ -4530,7 +5584,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/core", {
|
|
|
4530
5584
|
"$ref": keywords.ref
|
|
4531
5585
|
});
|
|
4532
5586
|
|
|
4533
|
-
Schema$1.add(JSON.parse(
|
|
5587
|
+
Schema$1.add(JSON.parse(applicatorMetaSchema));
|
|
4534
5588
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/applicator", {
|
|
4535
5589
|
"additionalProperties": keywords.additionalProperties6,
|
|
4536
5590
|
"allOf": keywords.allOf,
|
|
@@ -4549,7 +5603,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/applicator"
|
|
|
4549
5603
|
"propertyNames": keywords.propertyNames
|
|
4550
5604
|
});
|
|
4551
5605
|
|
|
4552
|
-
Schema$1.add(JSON.parse(
|
|
5606
|
+
Schema$1.add(JSON.parse(validationMetaSchema));
|
|
4553
5607
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/validation", {
|
|
4554
5608
|
"const": keywords.const,
|
|
4555
5609
|
"dependentRequired": keywords.dependentRequired,
|
|
@@ -4571,7 +5625,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/validation"
|
|
|
4571
5625
|
"uniqueItems": keywords.uniqueItems
|
|
4572
5626
|
});
|
|
4573
5627
|
|
|
4574
|
-
Schema$1.add(JSON.parse(
|
|
5628
|
+
Schema$1.add(JSON.parse(metaDataMetaSchema));
|
|
4575
5629
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/meta-data", {
|
|
4576
5630
|
"default": keywords.metaData,
|
|
4577
5631
|
"deprecated": keywords.metaData,
|
|
@@ -4582,28 +5636,28 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/meta-data",
|
|
|
4582
5636
|
"writeOnly": keywords.metaData
|
|
4583
5637
|
});
|
|
4584
5638
|
|
|
4585
|
-
Schema$1.add(JSON.parse(
|
|
5639
|
+
Schema$1.add(JSON.parse(formatAnnotationMetaSchema));
|
|
4586
5640
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/format-annotation", {
|
|
4587
5641
|
"format": keywords.metaData
|
|
4588
5642
|
});
|
|
4589
5643
|
|
|
4590
|
-
Schema$1.add(JSON.parse(
|
|
5644
|
+
Schema$1.add(JSON.parse(formatAssertionMetaSchema));
|
|
4591
5645
|
|
|
4592
|
-
Schema$1.add(JSON.parse(
|
|
5646
|
+
Schema$1.add(JSON.parse(contentMetaSchema));
|
|
4593
5647
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/content", {
|
|
4594
5648
|
"contentEncoding": keywords.metaData,
|
|
4595
5649
|
"contentMediaType": keywords.metaData,
|
|
4596
5650
|
"contentSchema": keywords.metaData
|
|
4597
5651
|
});
|
|
4598
5652
|
|
|
4599
|
-
Schema$1.add(JSON.parse(
|
|
5653
|
+
Schema$1.add(JSON.parse(unevaluatedMetaSchema));
|
|
4600
5654
|
Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/unevaluated", {
|
|
4601
5655
|
"unevaluatedItems": keywords.unevaluatedItems,
|
|
4602
5656
|
"unevaluatedProperties": keywords.unevaluatedProperties
|
|
4603
5657
|
});
|
|
4604
5658
|
|
|
4605
5659
|
const { Core, Schema, InvalidSchemaError } = lib$1;
|
|
4606
|
-
|
|
5660
|
+
const Keywords = keywords$5;
|
|
4607
5661
|
|
|
4608
5662
|
|
|
4609
5663
|
|
|
@@ -4620,39 +5674,14 @@ var lib = {
|
|
|
4620
5674
|
interpret: Core.interpret,
|
|
4621
5675
|
setMetaOutputFormat: Core.setMetaOutputFormat,
|
|
4622
5676
|
setShouldMetaValidate: Core.setShouldMetaValidate,
|
|
5677
|
+
addMediaTypePlugin: Core.addMediaTypePlugin,
|
|
4623
5678
|
FLAG: Core.FLAG,
|
|
4624
5679
|
BASIC: Core.BASIC,
|
|
4625
5680
|
DETAILED: Core.DETAILED,
|
|
4626
5681
|
VERBOSE: Core.VERBOSE,
|
|
4627
|
-
Keywords:
|
|
5682
|
+
Keywords: Keywords,
|
|
4628
5683
|
InvalidSchemaError: InvalidSchemaError
|
|
4629
5684
|
};
|
|
4630
|
-
|
|
4631
|
-
var lib_2 = lib.get;
|
|
4632
|
-
var lib_3 = lib.validate;
|
|
4633
|
-
var lib_4 = lib.compile;
|
|
4634
|
-
var lib_5 = lib.interpret;
|
|
4635
|
-
var lib_6 = lib.setMetaOutputFormat;
|
|
4636
|
-
var lib_7 = lib.setShouldMetaValidate;
|
|
4637
|
-
var lib_8 = lib.FLAG;
|
|
4638
|
-
var lib_9 = lib.BASIC;
|
|
4639
|
-
var lib_10 = lib.DETAILED;
|
|
4640
|
-
var lib_11 = lib.VERBOSE;
|
|
4641
|
-
var lib_12 = lib.Keywords;
|
|
4642
|
-
var lib_13 = lib.InvalidSchemaError;
|
|
4643
|
-
|
|
4644
|
-
exports.BASIC = lib_9;
|
|
4645
|
-
exports.DETAILED = lib_10;
|
|
4646
|
-
exports.FLAG = lib_8;
|
|
4647
|
-
exports.InvalidSchemaError = lib_13;
|
|
4648
|
-
exports.Keywords = lib_12;
|
|
4649
|
-
exports.VERBOSE = lib_11;
|
|
4650
|
-
exports.add = lib_1;
|
|
4651
|
-
exports.compile = lib_4;
|
|
5685
|
+
|
|
4652
5686
|
exports["default"] = lib;
|
|
4653
|
-
exports.get = lib_2;
|
|
4654
|
-
exports.interpret = lib_5;
|
|
4655
|
-
exports.setMetaOutputFormat = lib_6;
|
|
4656
|
-
exports.setShouldMetaValidate = lib_7;
|
|
4657
|
-
exports.validate = lib_3;
|
|
4658
5687
|
//# sourceMappingURL=json-schema-cjs.js.map
|