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