cdk-common 2.0.861 → 2.0.863

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.
Files changed (100) hide show
  1. package/.jsii +3 -3
  2. package/lib/main.js +1 -1
  3. package/node_modules/@types/node/README.md +1 -1
  4. package/node_modules/@types/node/buffer.d.ts +22 -22
  5. package/node_modules/@types/node/child_process.d.ts +3 -3
  6. package/node_modules/@types/node/crypto.d.ts +61 -61
  7. package/node_modules/@types/node/dgram.d.ts +1 -1
  8. package/node_modules/@types/node/fs.d.ts +2 -2
  9. package/node_modules/@types/node/http.d.ts +1 -1
  10. package/node_modules/@types/node/https.d.ts +2 -2
  11. package/node_modules/@types/node/net.d.ts +2 -2
  12. package/node_modules/@types/node/os.d.ts +1 -1
  13. package/node_modules/@types/node/package.json +2 -2
  14. package/node_modules/@types/node/perf_hooks.d.ts +1 -1
  15. package/node_modules/@types/node/process.d.ts +1 -1
  16. package/node_modules/@types/node/repl.d.ts +3 -3
  17. package/node_modules/@types/node/test.d.ts +31 -23
  18. package/node_modules/fast-uri/.gitattributes +2 -0
  19. package/node_modules/fast-uri/.github/.stale.yml +21 -0
  20. package/node_modules/fast-uri/.github/dependabot.yml +13 -0
  21. package/node_modules/fast-uri/.github/tests_checker.yml +8 -0
  22. package/node_modules/fast-uri/.github/workflows/ci.yml +22 -0
  23. package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +20 -0
  24. package/node_modules/fast-uri/LICENSE +30 -0
  25. package/node_modules/fast-uri/README.md +125 -0
  26. package/node_modules/fast-uri/benchmark.js +105 -0
  27. package/node_modules/fast-uri/index.js +305 -0
  28. package/node_modules/fast-uri/lib/schemes.js +188 -0
  29. package/node_modules/fast-uri/lib/scopedChars.js +30 -0
  30. package/node_modules/fast-uri/lib/utils.js +236 -0
  31. package/node_modules/fast-uri/package.json +41 -0
  32. package/node_modules/fast-uri/test/.gitkeep +0 -0
  33. package/node_modules/fast-uri/test/compatibility.test.js +129 -0
  34. package/node_modules/fast-uri/test/equal.test.js +104 -0
  35. package/node_modules/fast-uri/test/parse.test.js +310 -0
  36. package/node_modules/fast-uri/test/resolve.test.js +76 -0
  37. package/node_modules/fast-uri/test/serialize.test.js +144 -0
  38. package/node_modules/fast-uri/types/index.d.ts +53 -0
  39. package/node_modules/fast-uri/types/index.test-d.ts +17 -0
  40. package/node_modules/table/node_modules/ajv/dist/compile/resolve.d.ts +1 -1
  41. package/node_modules/table/node_modules/ajv/dist/runtime/uri.d.ts +1 -1
  42. package/node_modules/table/node_modules/ajv/dist/runtime/uri.js +1 -1
  43. package/node_modules/table/node_modules/ajv/dist/runtime/uri.js.map +1 -1
  44. package/node_modules/table/node_modules/ajv/dist/types/index.d.ts +1 -1
  45. package/node_modules/table/node_modules/ajv/lib/compile/index.ts +1 -1
  46. package/node_modules/table/node_modules/ajv/lib/compile/resolve.ts +1 -1
  47. package/node_modules/table/node_modules/ajv/lib/runtime/uri.ts +1 -1
  48. package/node_modules/table/node_modules/ajv/lib/types/index.ts +1 -1
  49. package/node_modules/table/node_modules/ajv/package.json +4 -4
  50. package/package.json +4 -4
  51. package/node_modules/punycode/LICENSE-MIT.txt +0 -20
  52. package/node_modules/punycode/README.md +0 -148
  53. package/node_modules/punycode/package.json +0 -58
  54. package/node_modules/punycode/punycode.es6.js +0 -444
  55. package/node_modules/punycode/punycode.js +0 -443
  56. package/node_modules/uri-js/LICENSE +0 -11
  57. package/node_modules/uri-js/README.md +0 -203
  58. package/node_modules/uri-js/dist/es5/uri.all.d.ts +0 -59
  59. package/node_modules/uri-js/dist/es5/uri.all.js +0 -1443
  60. package/node_modules/uri-js/dist/es5/uri.all.js.map +0 -1
  61. package/node_modules/uri-js/dist/es5/uri.all.min.d.ts +0 -59
  62. package/node_modules/uri-js/dist/es5/uri.all.min.js +0 -3
  63. package/node_modules/uri-js/dist/es5/uri.all.min.js.map +0 -1
  64. package/node_modules/uri-js/dist/esnext/index.d.ts +0 -1
  65. package/node_modules/uri-js/dist/esnext/index.js +0 -17
  66. package/node_modules/uri-js/dist/esnext/index.js.map +0 -1
  67. package/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +0 -3
  68. package/node_modules/uri-js/dist/esnext/regexps-iri.js +0 -3
  69. package/node_modules/uri-js/dist/esnext/regexps-iri.js.map +0 -1
  70. package/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +0 -4
  71. package/node_modules/uri-js/dist/esnext/regexps-uri.js +0 -42
  72. package/node_modules/uri-js/dist/esnext/regexps-uri.js.map +0 -1
  73. package/node_modules/uri-js/dist/esnext/schemes/http.d.ts +0 -3
  74. package/node_modules/uri-js/dist/esnext/schemes/http.js +0 -28
  75. package/node_modules/uri-js/dist/esnext/schemes/http.js.map +0 -1
  76. package/node_modules/uri-js/dist/esnext/schemes/https.d.ts +0 -3
  77. package/node_modules/uri-js/dist/esnext/schemes/https.js +0 -9
  78. package/node_modules/uri-js/dist/esnext/schemes/https.js.map +0 -1
  79. package/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +0 -12
  80. package/node_modules/uri-js/dist/esnext/schemes/mailto.js +0 -148
  81. package/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +0 -1
  82. package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +0 -7
  83. package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +0 -23
  84. package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +0 -1
  85. package/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +0 -10
  86. package/node_modules/uri-js/dist/esnext/schemes/urn.js +0 -49
  87. package/node_modules/uri-js/dist/esnext/schemes/urn.js.map +0 -1
  88. package/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +0 -7
  89. package/node_modules/uri-js/dist/esnext/schemes/ws.js +0 -41
  90. package/node_modules/uri-js/dist/esnext/schemes/ws.js.map +0 -1
  91. package/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +0 -3
  92. package/node_modules/uri-js/dist/esnext/schemes/wss.js +0 -9
  93. package/node_modules/uri-js/dist/esnext/schemes/wss.js.map +0 -1
  94. package/node_modules/uri-js/dist/esnext/uri.d.ts +0 -59
  95. package/node_modules/uri-js/dist/esnext/uri.js +0 -480
  96. package/node_modules/uri-js/dist/esnext/uri.js.map +0 -1
  97. package/node_modules/uri-js/dist/esnext/util.d.ts +0 -6
  98. package/node_modules/uri-js/dist/esnext/util.js +0 -36
  99. package/node_modules/uri-js/dist/esnext/util.js.map +0 -1
  100. package/node_modules/uri-js/package.json +0 -77
@@ -0,0 +1,305 @@
1
+ 'use strict'
2
+
3
+ const URL = require('node:url')
4
+ const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require('./lib/utils')
5
+ const SCHEMES = require('./lib/schemes')
6
+
7
+ function normalize (uri, options) {
8
+ if (typeof uri === 'string') {
9
+ uri = serialize(parse(uri, options), options)
10
+ } else if (typeof uri === 'object') {
11
+ uri = parse(serialize(uri, options), options)
12
+ }
13
+ return uri
14
+ }
15
+
16
+ function resolve (baseURI, relativeURI, options) {
17
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options)
18
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true)
19
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
20
+ }
21
+
22
+ function resolveComponents (base, relative, options, skipNormalization) {
23
+ const target = {}
24
+ if (!skipNormalization) {
25
+ base = parse(serialize(base, options), options) // normalize base components
26
+ relative = parse(serialize(relative, options), options) // normalize relative components
27
+ }
28
+ options = options || {}
29
+
30
+ if (!options.tolerant && relative.scheme) {
31
+ target.scheme = relative.scheme
32
+ // target.authority = relative.authority;
33
+ target.userinfo = relative.userinfo
34
+ target.host = relative.host
35
+ target.port = relative.port
36
+ target.path = removeDotSegments(relative.path || '')
37
+ target.query = relative.query
38
+ } else {
39
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
40
+ // target.authority = relative.authority;
41
+ target.userinfo = relative.userinfo
42
+ target.host = relative.host
43
+ target.port = relative.port
44
+ target.path = removeDotSegments(relative.path || '')
45
+ target.query = relative.query
46
+ } else {
47
+ if (!relative.path) {
48
+ target.path = base.path
49
+ if (relative.query !== undefined) {
50
+ target.query = relative.query
51
+ } else {
52
+ target.query = base.query
53
+ }
54
+ } else {
55
+ if (relative.path.charAt(0) === '/') {
56
+ target.path = removeDotSegments(relative.path)
57
+ } else {
58
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
59
+ target.path = '/' + relative.path
60
+ } else if (!base.path) {
61
+ target.path = relative.path
62
+ } else {
63
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path
64
+ }
65
+ target.path = removeDotSegments(target.path)
66
+ }
67
+ target.query = relative.query
68
+ }
69
+ // target.authority = base.authority;
70
+ target.userinfo = base.userinfo
71
+ target.host = base.host
72
+ target.port = base.port
73
+ }
74
+ target.scheme = base.scheme
75
+ }
76
+
77
+ target.fragment = relative.fragment
78
+
79
+ return target
80
+ }
81
+
82
+ function equal (uriA, uriB, options) {
83
+ if (typeof uriA === 'string') {
84
+ uriA = unescape(uriA)
85
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true })
86
+ } else if (typeof uriA === 'object') {
87
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true })
88
+ }
89
+
90
+ if (typeof uriB === 'string') {
91
+ uriB = unescape(uriB)
92
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true })
93
+ } else if (typeof uriB === 'object') {
94
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true })
95
+ }
96
+
97
+ return uriA.toLowerCase() === uriB.toLowerCase()
98
+ }
99
+
100
+ function serialize (cmpts, opts) {
101
+ const components = {
102
+ host: cmpts.host,
103
+ scheme: cmpts.scheme,
104
+ userinfo: cmpts.userinfo,
105
+ port: cmpts.port,
106
+ path: cmpts.path,
107
+ query: cmpts.query,
108
+ nid: cmpts.nid,
109
+ nss: cmpts.nss,
110
+ uuid: cmpts.uuid,
111
+ fragment: cmpts.fragment,
112
+ reference: cmpts.reference,
113
+ resourceName: cmpts.resourceName,
114
+ secure: cmpts.secure,
115
+ error: ''
116
+ }
117
+ const options = Object.assign({}, opts)
118
+ const uriTokens = []
119
+
120
+ // find scheme handler
121
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()]
122
+
123
+ // perform scheme specific serialization
124
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options)
125
+
126
+ if (components.path !== undefined) {
127
+ if (!options.skipEscape) {
128
+ components.path = escape(components.path)
129
+
130
+ if (components.scheme !== undefined) {
131
+ components.path = components.path.split('%3A').join(':')
132
+ }
133
+ } else {
134
+ components.path = unescape(components.path)
135
+ }
136
+ }
137
+
138
+ if (options.reference !== 'suffix' && components.scheme) {
139
+ uriTokens.push(components.scheme)
140
+ uriTokens.push(':')
141
+ }
142
+
143
+ const authority = recomposeAuthority(components, options)
144
+ if (authority !== undefined) {
145
+ if (options.reference !== 'suffix') {
146
+ uriTokens.push('//')
147
+ }
148
+
149
+ uriTokens.push(authority)
150
+
151
+ if (components.path && components.path.charAt(0) !== '/') {
152
+ uriTokens.push('/')
153
+ }
154
+ }
155
+ if (components.path !== undefined) {
156
+ let s = components.path
157
+
158
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
159
+ s = removeDotSegments(s)
160
+ }
161
+
162
+ if (authority === undefined) {
163
+ s = s.replace(/^\/\//u, '/%2F') // don't allow the path to start with "//"
164
+ }
165
+
166
+ uriTokens.push(s)
167
+ }
168
+
169
+ if (components.query !== undefined) {
170
+ uriTokens.push('?')
171
+ uriTokens.push(components.query)
172
+ }
173
+
174
+ if (components.fragment !== undefined) {
175
+ uriTokens.push('#')
176
+ uriTokens.push(components.fragment)
177
+ }
178
+ return uriTokens.join('')
179
+ }
180
+
181
+ const hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)))
182
+
183
+ function nonSimpleDomain (value) {
184
+ let code = 0
185
+ for (let i = 0, len = value.length; i < len; ++i) {
186
+ code = value.charCodeAt(i)
187
+ if (code > 126 || hexLookUp[code]) {
188
+ return true
189
+ }
190
+ }
191
+ return false
192
+ }
193
+
194
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u
195
+
196
+ function parse (uri, opts) {
197
+ const options = Object.assign({}, opts)
198
+ const parsed = {
199
+ scheme: undefined,
200
+ userinfo: undefined,
201
+ host: '',
202
+ port: undefined,
203
+ path: '',
204
+ query: undefined,
205
+ fragment: undefined
206
+ }
207
+ const gotEncoding = uri.indexOf('%') !== -1
208
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri
209
+
210
+ const matches = uri.match(URI_PARSE)
211
+
212
+ if (matches) {
213
+ // store each component
214
+ parsed.scheme = matches[1]
215
+ parsed.userinfo = matches[3]
216
+ parsed.host = matches[4]
217
+ parsed.port = parseInt(matches[5], 10)
218
+ parsed.path = matches[6] || ''
219
+ parsed.query = matches[7]
220
+ parsed.fragment = matches[8]
221
+
222
+ // fix port number
223
+ if (isNaN(parsed.port)) {
224
+ parsed.port = matches[5]
225
+ }
226
+ if (parsed.host) {
227
+ const ipv4result = normalizeIPv4(parsed.host)
228
+ if (ipv4result.isIPV4 === false) {
229
+ parsed.host = normalizeIPv6(ipv4result.host, { isIPV4: false }).host.toLowerCase()
230
+ } else {
231
+ parsed.host = ipv4result.host
232
+ }
233
+ }
234
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && !parsed.path && parsed.query === undefined) {
235
+ parsed.reference = 'same-document'
236
+ } else if (parsed.scheme === undefined) {
237
+ parsed.reference = 'relative'
238
+ } else if (parsed.fragment === undefined) {
239
+ parsed.reference = 'absolute'
240
+ } else {
241
+ parsed.reference = 'uri'
242
+ }
243
+
244
+ // check for reference errors
245
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
246
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.'
247
+ }
248
+
249
+ // find scheme handler
250
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()]
251
+
252
+ // check if scheme can't handle IRIs
253
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
254
+ // if host component is a domain name
255
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && nonSimpleDomain(parsed.host)) {
256
+ // convert Unicode IDN -> ASCII IDN
257
+ try {
258
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase())
259
+ } catch (e) {
260
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
261
+ }
262
+ }
263
+ // convert IRI -> URI
264
+ }
265
+
266
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
267
+ if (gotEncoding && parsed.scheme !== undefined) {
268
+ parsed.scheme = unescape(parsed.scheme)
269
+ }
270
+ if (gotEncoding && parsed.userinfo !== undefined) {
271
+ parsed.userinfo = unescape(parsed.userinfo)
272
+ }
273
+ if (gotEncoding && parsed.host !== undefined) {
274
+ parsed.host = unescape(parsed.host)
275
+ }
276
+ if (parsed.path !== undefined && parsed.path.length) {
277
+ parsed.path = encodeURI(parsed.path)
278
+ }
279
+ if (parsed.fragment !== undefined && parsed.fragment.length) {
280
+ parsed.fragment = encodeURI(decodeURI(parsed.fragment))
281
+ }
282
+ }
283
+
284
+ // perform scheme specific parsing
285
+ if (schemeHandler && schemeHandler.parse) {
286
+ schemeHandler.parse(parsed, options)
287
+ }
288
+ } else {
289
+ parsed.error = parsed.error || 'URI can not be parsed.'
290
+ }
291
+ return parsed
292
+ }
293
+
294
+ const fastUri = {
295
+ normalize,
296
+ resolve,
297
+ resolveComponents,
298
+ equal,
299
+ serialize,
300
+ parse
301
+ }
302
+
303
+ module.exports = fastUri
304
+ module.exports.default = fastUri
305
+ module.exports.fastUri = fastUri
@@ -0,0 +1,188 @@
1
+ 'use strict'
2
+
3
+ const UUID_REG = /^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu
4
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu
5
+
6
+ function isSecure (wsComponents) {
7
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
8
+ }
9
+
10
+ function httpParse (components) {
11
+ if (!components.host) {
12
+ components.error = components.error || 'HTTP URIs must have a host.'
13
+ }
14
+
15
+ return components
16
+ }
17
+
18
+ function httpSerialize (components) {
19
+ const secure = String(components.scheme).toLowerCase() === 'https'
20
+
21
+ // normalize the default port
22
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
23
+ components.port = undefined
24
+ }
25
+
26
+ // normalize the empty path
27
+ if (!components.path) {
28
+ components.path = '/'
29
+ }
30
+
31
+ // NOTE: We do not parse query strings for HTTP URIs
32
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
33
+ // and not the HTTP spec.
34
+
35
+ return components
36
+ }
37
+
38
+ function wsParse (wsComponents) {
39
+ // indicate if the secure flag is set
40
+ wsComponents.secure = isSecure(wsComponents)
41
+
42
+ // construct resouce name
43
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '')
44
+ wsComponents.path = undefined
45
+ wsComponents.query = undefined
46
+
47
+ return wsComponents
48
+ }
49
+
50
+ function wsSerialize (wsComponents) {
51
+ // normalize the default port
52
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
53
+ wsComponents.port = undefined
54
+ }
55
+
56
+ // ensure scheme matches secure flag
57
+ if (typeof wsComponents.secure === 'boolean') {
58
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws')
59
+ wsComponents.secure = undefined
60
+ }
61
+
62
+ // reconstruct path from resource name
63
+ if (wsComponents.resourceName) {
64
+ const [path, query] = wsComponents.resourceName.split('?')
65
+ wsComponents.path = (path && path !== '/' ? path : undefined)
66
+ wsComponents.query = query
67
+ wsComponents.resourceName = undefined
68
+ }
69
+
70
+ // forbid fragment component
71
+ wsComponents.fragment = undefined
72
+
73
+ return wsComponents
74
+ }
75
+
76
+ function urnParse (urnComponents, options) {
77
+ if (!urnComponents.path) {
78
+ urnComponents.error = 'URN can not be parsed'
79
+ return urnComponents
80
+ }
81
+ const matches = urnComponents.path.match(URN_REG)
82
+ if (matches) {
83
+ const scheme = options.scheme || urnComponents.scheme || 'urn'
84
+ urnComponents.nid = matches[1].toLowerCase()
85
+ urnComponents.nss = matches[2]
86
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`
87
+ const schemeHandler = SCHEMES[urnScheme]
88
+ urnComponents.path = undefined
89
+
90
+ if (schemeHandler) {
91
+ urnComponents = schemeHandler.parse(urnComponents, options)
92
+ }
93
+ } else {
94
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.'
95
+ }
96
+
97
+ return urnComponents
98
+ }
99
+
100
+ function urnSerialize (urnComponents, options) {
101
+ const scheme = options.scheme || urnComponents.scheme || 'urn'
102
+ const nid = urnComponents.nid.toLowerCase()
103
+ const urnScheme = `${scheme}:${options.nid || nid}`
104
+ const schemeHandler = SCHEMES[urnScheme]
105
+
106
+ if (schemeHandler) {
107
+ urnComponents = schemeHandler.serialize(urnComponents, options)
108
+ }
109
+
110
+ const uriComponents = urnComponents
111
+ const nss = urnComponents.nss
112
+ uriComponents.path = `${nid || options.nid}:${nss}`
113
+
114
+ options.skipEscape = true
115
+ return uriComponents
116
+ }
117
+
118
+ function urnuuidParse (urnComponents, options) {
119
+ const uuidComponents = urnComponents
120
+ uuidComponents.uuid = uuidComponents.nss
121
+ uuidComponents.nss = undefined
122
+
123
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
124
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.'
125
+ }
126
+
127
+ return uuidComponents
128
+ }
129
+
130
+ function urnuuidSerialize (uuidComponents) {
131
+ const urnComponents = uuidComponents
132
+ // normalize UUID
133
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase()
134
+ return urnComponents
135
+ }
136
+
137
+ const http = {
138
+ scheme: 'http',
139
+ domainHost: true,
140
+ parse: httpParse,
141
+ serialize: httpSerialize
142
+ }
143
+
144
+ const https = {
145
+ scheme: 'https',
146
+ domainHost: http.domainHost,
147
+ parse: httpParse,
148
+ serialize: httpSerialize
149
+ }
150
+
151
+ const ws = {
152
+ scheme: 'ws',
153
+ domainHost: true,
154
+ parse: wsParse,
155
+ serialize: wsSerialize
156
+ }
157
+
158
+ const wss = {
159
+ scheme: 'wss',
160
+ domainHost: ws.domainHost,
161
+ parse: ws.parse,
162
+ serialize: ws.serialize
163
+ }
164
+
165
+ const urn = {
166
+ scheme: 'urn',
167
+ parse: urnParse,
168
+ serialize: urnSerialize,
169
+ skipNormalize: true
170
+ }
171
+
172
+ const urnuuid = {
173
+ scheme: 'urn:uuid',
174
+ parse: urnuuidParse,
175
+ serialize: urnuuidSerialize,
176
+ skipNormalize: true
177
+ }
178
+
179
+ const SCHEMES = {
180
+ http,
181
+ https,
182
+ ws,
183
+ wss,
184
+ urn,
185
+ 'urn:uuid': urnuuid
186
+ }
187
+
188
+ module.exports = SCHEMES
@@ -0,0 +1,30 @@
1
+ 'use strict'
2
+
3
+ const HEX = {
4
+ 0: 0,
5
+ 1: 1,
6
+ 2: 2,
7
+ 3: 3,
8
+ 4: 4,
9
+ 5: 5,
10
+ 6: 6,
11
+ 7: 7,
12
+ 8: 8,
13
+ 9: 9,
14
+ a: 10,
15
+ A: 10,
16
+ b: 11,
17
+ B: 11,
18
+ c: 12,
19
+ C: 12,
20
+ d: 13,
21
+ D: 13,
22
+ e: 14,
23
+ E: 14,
24
+ f: 15,
25
+ F: 15
26
+ }
27
+
28
+ module.exports = {
29
+ HEX
30
+ }