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,310 @@
1
+ 'use strict'
2
+
3
+ const tap = require('tap')
4
+ const test = tap.test
5
+ const URI = require('../')
6
+
7
+ test('URI parse', (t) => {
8
+ let components
9
+
10
+ // scheme
11
+ components = URI.parse('uri:')
12
+ t.equal(components.error, undefined, 'scheme errors')
13
+ t.equal(components.scheme, 'uri', 'scheme')
14
+ // t.equal(components.authority, undefined, "authority");
15
+ t.equal(components.userinfo, undefined, 'userinfo')
16
+ t.equal(components.host, undefined, 'host')
17
+ t.equal(components.port, undefined, 'port')
18
+ t.equal(components.path, '', 'path')
19
+ t.equal(components.query, undefined, 'query')
20
+ t.equal(components.fragment, undefined, 'fragment')
21
+
22
+ // userinfo
23
+ components = URI.parse('//@')
24
+ t.equal(components.error, undefined, 'userinfo errors')
25
+ t.equal(components.scheme, undefined, 'scheme')
26
+ // t.equal(components.authority, "@", "authority");
27
+ t.equal(components.userinfo, '', 'userinfo')
28
+ t.equal(components.host, '', 'host')
29
+ t.equal(components.port, undefined, 'port')
30
+ t.equal(components.path, '', 'path')
31
+ t.equal(components.query, undefined, 'query')
32
+ t.equal(components.fragment, undefined, 'fragment')
33
+
34
+ // host
35
+ components = URI.parse('//')
36
+ t.equal(components.error, undefined, 'host errors')
37
+ t.equal(components.scheme, undefined, 'scheme')
38
+ // t.equal(components.authority, "", "authority");
39
+ t.equal(components.userinfo, undefined, 'userinfo')
40
+ t.equal(components.host, '', 'host')
41
+ t.equal(components.port, undefined, 'port')
42
+ t.equal(components.path, '', 'path')
43
+ t.equal(components.query, undefined, 'query')
44
+ t.equal(components.fragment, undefined, 'fragment')
45
+
46
+ // port
47
+ components = URI.parse('//:')
48
+ t.equal(components.error, undefined, 'port errors')
49
+ t.equal(components.scheme, undefined, 'scheme')
50
+ // t.equal(components.authority, ":", "authority");
51
+ t.equal(components.userinfo, undefined, 'userinfo')
52
+ t.equal(components.host, '', 'host')
53
+ t.equal(components.port, '', 'port')
54
+ t.equal(components.path, '', 'path')
55
+ t.equal(components.query, undefined, 'query')
56
+ t.equal(components.fragment, undefined, 'fragment')
57
+
58
+ // path
59
+ components = URI.parse('')
60
+ t.equal(components.error, undefined, 'path errors')
61
+ t.equal(components.scheme, undefined, 'scheme')
62
+ // t.equal(components.authority, undefined, "authority");
63
+ t.equal(components.userinfo, undefined, 'userinfo')
64
+ t.equal(components.host, undefined, 'host')
65
+ t.equal(components.port, undefined, 'port')
66
+ t.equal(components.path, '', 'path')
67
+ t.equal(components.query, undefined, 'query')
68
+ t.equal(components.fragment, undefined, 'fragment')
69
+
70
+ // query
71
+ components = URI.parse('?')
72
+ t.equal(components.error, undefined, 'query errors')
73
+ t.equal(components.scheme, undefined, 'scheme')
74
+ // t.equal(components.authority, undefined, "authority");
75
+ t.equal(components.userinfo, undefined, 'userinfo')
76
+ t.equal(components.host, undefined, 'host')
77
+ t.equal(components.port, undefined, 'port')
78
+ t.equal(components.path, '', 'path')
79
+ t.equal(components.query, '', 'query')
80
+ t.equal(components.fragment, undefined, 'fragment')
81
+
82
+ // fragment
83
+ components = URI.parse('#')
84
+ t.equal(components.error, undefined, 'fragment errors')
85
+ t.equal(components.scheme, undefined, 'scheme')
86
+ // t.equal(components.authority, undefined, "authority");
87
+ t.equal(components.userinfo, undefined, 'userinfo')
88
+ t.equal(components.host, undefined, 'host')
89
+ t.equal(components.port, undefined, 'port')
90
+ t.equal(components.path, '', 'path')
91
+ t.equal(components.query, undefined, 'query')
92
+ t.equal(components.fragment, '', 'fragment')
93
+
94
+ // fragment with character tabulation
95
+ components = URI.parse('#\t')
96
+ t.equal(components.error, undefined, 'path errors')
97
+ t.equal(components.scheme, undefined, 'scheme')
98
+ // t.equal(components.authority, undefined, "authority");
99
+ t.equal(components.userinfo, undefined, 'userinfo')
100
+ t.equal(components.host, undefined, 'host')
101
+ t.equal(components.port, undefined, 'port')
102
+ t.equal(components.path, '', 'path')
103
+ t.equal(components.query, undefined, 'query')
104
+ t.equal(components.fragment, '%09', 'fragment')
105
+
106
+ // fragment with line feed
107
+ components = URI.parse('#\n')
108
+ t.equal(components.error, undefined, 'path errors')
109
+ t.equal(components.scheme, undefined, 'scheme')
110
+ // t.equal(components.authority, undefined, "authority");
111
+ t.equal(components.userinfo, undefined, 'userinfo')
112
+ t.equal(components.host, undefined, 'host')
113
+ t.equal(components.port, undefined, 'port')
114
+ t.equal(components.path, '', 'path')
115
+ t.equal(components.query, undefined, 'query')
116
+ t.equal(components.fragment, '%0A', 'fragment')
117
+
118
+ // fragment with line tabulation
119
+ components = URI.parse('#\v')
120
+ t.equal(components.error, undefined, 'path errors')
121
+ t.equal(components.scheme, undefined, 'scheme')
122
+ // t.equal(components.authority, undefined, "authority");
123
+ t.equal(components.userinfo, undefined, 'userinfo')
124
+ t.equal(components.host, undefined, 'host')
125
+ t.equal(components.port, undefined, 'port')
126
+ t.equal(components.path, '', 'path')
127
+ t.equal(components.query, undefined, 'query')
128
+ t.equal(components.fragment, '%0B', 'fragment')
129
+
130
+ // fragment with form feed
131
+ components = URI.parse('#\f')
132
+ t.equal(components.error, undefined, 'path errors')
133
+ t.equal(components.scheme, undefined, 'scheme')
134
+ // t.equal(components.authority, undefined, "authority");
135
+ t.equal(components.userinfo, undefined, 'userinfo')
136
+ t.equal(components.host, undefined, 'host')
137
+ t.equal(components.port, undefined, 'port')
138
+ t.equal(components.path, '', 'path')
139
+ t.equal(components.query, undefined, 'query')
140
+ t.equal(components.fragment, '%0C', 'fragment')
141
+
142
+ // fragment with carriage return
143
+ components = URI.parse('#\r')
144
+ t.equal(components.error, undefined, 'path errors')
145
+ t.equal(components.scheme, undefined, 'scheme')
146
+ // t.equal(components.authority, undefined, "authority");
147
+ t.equal(components.userinfo, undefined, 'userinfo')
148
+ t.equal(components.host, undefined, 'host')
149
+ t.equal(components.port, undefined, 'port')
150
+ t.equal(components.path, '', 'path')
151
+ t.equal(components.query, undefined, 'query')
152
+ t.equal(components.fragment, '%0D', 'fragment')
153
+
154
+ // all
155
+ components = URI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
156
+ t.equal(components.error, undefined, 'all errors')
157
+ t.equal(components.scheme, 'uri', 'scheme')
158
+ // t.equal(components.authority, "user:pass@example.com:123", "authority");
159
+ t.equal(components.userinfo, 'user:pass', 'userinfo')
160
+ t.equal(components.host, 'example.com', 'host')
161
+ t.equal(components.port, 123, 'port')
162
+ t.equal(components.path, '/one/two.three', 'path')
163
+ t.equal(components.query, 'q1=a1&q2=a2', 'query')
164
+ t.equal(components.fragment, 'body', 'fragment')
165
+
166
+ // IPv4address
167
+ components = URI.parse('//10.10.10.10')
168
+ t.equal(components.error, undefined, 'IPv4address errors')
169
+ t.equal(components.scheme, undefined, 'scheme')
170
+ t.equal(components.userinfo, undefined, 'userinfo')
171
+ t.equal(components.host, '10.10.10.10', 'host')
172
+ t.equal(components.port, undefined, 'port')
173
+ t.equal(components.path, '', 'path')
174
+ t.equal(components.query, undefined, 'query')
175
+ t.equal(components.fragment, undefined, 'fragment')
176
+
177
+ // IPv4address with unformated 0
178
+ components = URI.parse('//10.10.000.10')
179
+ t.equal(components.error, undefined, 'IPv4address errors')
180
+ t.equal(components.scheme, undefined, 'scheme')
181
+ t.equal(components.userinfo, undefined, 'userinfo')
182
+ t.equal(components.host, '10.10.0.10', 'host')
183
+ t.equal(components.port, undefined, 'port')
184
+ t.equal(components.path, '', 'path')
185
+ t.equal(components.query, undefined, 'query')
186
+ t.equal(components.fragment, undefined, 'fragment')
187
+
188
+ // IPv6address
189
+ components = URI.parse('//[2001:db8::7]')
190
+ t.equal(components.error, undefined, 'IPv4address errors')
191
+ t.equal(components.scheme, undefined, 'scheme')
192
+ t.equal(components.userinfo, undefined, 'userinfo')
193
+ t.equal(components.host, '2001:db8::7', 'host')
194
+ t.equal(components.port, undefined, 'port')
195
+ t.equal(components.path, '', 'path')
196
+ t.equal(components.query, undefined, 'query')
197
+ t.equal(components.fragment, undefined, 'fragment')
198
+
199
+ // invalid IPv6
200
+ components = URI.parse('//[2001:dbZ::7]')
201
+ t.equal(components.host, '[2001:dbz::7]')
202
+
203
+ // mixed IPv4address & IPv6address
204
+ components = URI.parse('//[::ffff:129.144.52.38]')
205
+ t.equal(components.error, undefined, 'IPv4address errors')
206
+ t.equal(components.scheme, undefined, 'scheme')
207
+ t.equal(components.userinfo, undefined, 'userinfo')
208
+ t.equal(components.host, '::ffff:129.144.52.38', 'host')
209
+ t.equal(components.port, undefined, 'port')
210
+ t.equal(components.path, '', 'path')
211
+ t.equal(components.query, undefined, 'query')
212
+ t.equal(components.fragment, undefined, 'fragment')
213
+
214
+ // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
215
+ components = URI.parse('uri://10.10.10.10.example.com/en/process')
216
+ t.equal(components.error, undefined, 'mixed errors')
217
+ t.equal(components.scheme, 'uri', 'scheme')
218
+ t.equal(components.userinfo, undefined, 'userinfo')
219
+ t.equal(components.host, '10.10.10.10.example.com', 'host')
220
+ t.equal(components.port, undefined, 'port')
221
+ t.equal(components.path, '/en/process', 'path')
222
+ t.equal(components.query, undefined, 'query')
223
+ t.equal(components.fragment, undefined, 'fragment')
224
+
225
+ // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16)
226
+ components = URI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test')
227
+ t.equal(components.error, undefined, 'IPv6address errors')
228
+ t.equal(components.scheme, undefined, 'scheme')
229
+ t.equal(components.userinfo, undefined, 'userinfo')
230
+ t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host')
231
+ t.equal(components.port, undefined, 'port')
232
+ t.equal(components.path, '/test', 'path')
233
+ t.equal(components.query, undefined, 'query')
234
+ t.equal(components.fragment, undefined, 'fragment')
235
+
236
+ // IPv6address, example from RFC 5952
237
+ components = URI.parse('//[2001:db8::1]:80')
238
+ t.equal(components.error, undefined, 'IPv6address errors')
239
+ t.equal(components.scheme, undefined, 'scheme')
240
+ t.equal(components.userinfo, undefined, 'userinfo')
241
+ t.equal(components.host, '2001:db8::1', 'host')
242
+ t.equal(components.port, 80, 'port')
243
+ t.equal(components.path, '', 'path')
244
+ t.equal(components.query, undefined, 'query')
245
+ t.equal(components.fragment, undefined, 'fragment')
246
+
247
+ // IPv6address with zone identifier, RFC 6874
248
+ components = URI.parse('//[fe80::a%25en1]')
249
+ t.equal(components.error, undefined, 'IPv4address errors')
250
+ t.equal(components.scheme, undefined, 'scheme')
251
+ t.equal(components.userinfo, undefined, 'userinfo')
252
+ t.equal(components.host, 'fe80::a%en1', 'host')
253
+ t.equal(components.port, undefined, 'port')
254
+ t.equal(components.path, '', 'path')
255
+ t.equal(components.query, undefined, 'query')
256
+ t.equal(components.fragment, undefined, 'fragment')
257
+
258
+ // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22)
259
+ components = URI.parse('//[2001:db8::7%en0]')
260
+ t.equal(components.error, undefined, 'IPv6address interface errors')
261
+ t.equal(components.scheme, undefined, 'scheme')
262
+ t.equal(components.userinfo, undefined, 'userinfo')
263
+ t.equal(components.host, '2001:db8::7%en0', 'host')
264
+ t.equal(components.port, undefined, 'port')
265
+ t.equal(components.path, '', 'path')
266
+ t.equal(components.query, undefined, 'query')
267
+ t.equal(components.fragment, undefined, 'fragment')
268
+
269
+ // UUID V1
270
+ components = URI.parse('urn:uuid:b571b0bc-4713-11ec-81d3-0242ac130003')
271
+ t.equal(components.error, undefined, 'errors')
272
+ t.equal(components.scheme, 'urn', 'scheme')
273
+ // t.equal(components.authority, undefined, "authority");
274
+ t.equal(components.userinfo, undefined, 'userinfo')
275
+ t.equal(components.host, undefined, 'host')
276
+ t.equal(components.port, undefined, 'port')
277
+ t.equal(components.path, undefined, 'path')
278
+ t.equal(components.query, undefined, 'query')
279
+ t.equal(components.fragment, undefined, 'fragment')
280
+ t.equal(components.nid, 'uuid', 'nid')
281
+ t.equal(components.nss, undefined, 'nss')
282
+ t.equal(components.uuid, 'b571b0bc-4713-11ec-81d3-0242ac130003', 'uuid')
283
+
284
+ // UUID v4
285
+ components = URI.parse('urn:uuid:97a32222-89b7-420e-8507-4360723e2c2a')
286
+ t.equal(components.uuid, '97a32222-89b7-420e-8507-4360723e2c2a', 'uuid')
287
+
288
+ components = URI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
289
+ t.notSame(components.error, undefined, 'errors')
290
+
291
+ components = URI.parse('urn:foo:a123,456')
292
+ t.equal(components.error, undefined, 'errors')
293
+ t.equal(components.scheme, 'urn', 'scheme')
294
+ // t.equal(components.authority, undefined, "authority");
295
+ t.equal(components.userinfo, undefined, 'userinfo')
296
+ t.equal(components.host, undefined, 'host')
297
+ t.equal(components.port, undefined, 'port')
298
+ t.equal(components.path, undefined, 'path')
299
+ t.equal(components.query, undefined, 'query')
300
+ t.equal(components.fragment, undefined, 'fragment')
301
+ t.equal(components.nid, 'foo', 'nid')
302
+ t.equal(components.nss, 'a123,456', 'nss')
303
+
304
+ components = URI.parse('//[2606:2800:220:1:248:1893:25c8:1946:43209]')
305
+ t.equal(components.host, '[2606:2800:220:1:248:1893:25c8:1946:43209]')
306
+
307
+ components = URI.parse('urn:foo:|\\24fpl')
308
+ t.equal(components.error, 'URN can not be parsed.')
309
+ t.end()
310
+ })
@@ -0,0 +1,76 @@
1
+ 'use strict'
2
+
3
+ const tap = require('tap')
4
+ const test = tap.test
5
+ const URI = require('../')
6
+
7
+ test('URI Resolving', (t) => {
8
+ // normal examples from RFC 3986
9
+ const base = 'uri://a/b/c/d;p?q'
10
+ t.equal(URI.resolve(base, 'g:h'), 'g:h', 'g:h')
11
+ t.equal(URI.resolve(base, 'g:h'), 'g:h', 'g:h')
12
+ t.equal(URI.resolve(base, 'g'), 'uri://a/b/c/g', 'g')
13
+ t.equal(URI.resolve(base, './g'), 'uri://a/b/c/g', './g')
14
+ t.equal(URI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/')
15
+ t.equal(URI.resolve(base, '/g'), 'uri://a/g', '/g')
16
+ t.equal(URI.resolve(base, '//g'), 'uri://g', '//g')
17
+ t.equal(URI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y')
18
+ t.equal(URI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y')
19
+ t.equal(URI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s')
20
+ t.equal(URI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s')
21
+ t.equal(URI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s')
22
+ t.equal(URI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x')
23
+ t.equal(URI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x')
24
+ t.equal(URI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s')
25
+ t.equal(URI.resolve(base, ''), 'uri://a/b/c/d;p?q', '')
26
+ t.equal(URI.resolve(base, '.'), 'uri://a/b/c/', '.')
27
+ t.equal(URI.resolve(base, './'), 'uri://a/b/c/', './')
28
+ t.equal(URI.resolve(base, '..'), 'uri://a/b/', '..')
29
+ t.equal(URI.resolve(base, '../'), 'uri://a/b/', '../')
30
+ t.equal(URI.resolve(base, '../g'), 'uri://a/b/g', '../g')
31
+ t.equal(URI.resolve(base, '../..'), 'uri://a/', '../..')
32
+ t.equal(URI.resolve(base, '../../'), 'uri://a/', '../../')
33
+ t.equal(URI.resolve(base, '../../g'), 'uri://a/g', '../../g')
34
+
35
+ // abnormal examples from RFC 3986
36
+ t.equal(URI.resolve(base, '../../../g'), 'uri://a/g', '../../../g')
37
+ t.equal(URI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g')
38
+
39
+ t.equal(URI.resolve(base, '/./g'), 'uri://a/g', '/./g')
40
+ t.equal(URI.resolve(base, '/../g'), 'uri://a/g', '/../g')
41
+ t.equal(URI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.')
42
+ t.equal(URI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g')
43
+ t.equal(URI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..')
44
+ t.equal(URI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g')
45
+
46
+ t.equal(URI.resolve(base, './../g'), 'uri://a/b/g', './../g')
47
+ t.equal(URI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.')
48
+ t.equal(URI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h')
49
+ t.equal(URI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h')
50
+ t.equal(URI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y')
51
+ t.equal(URI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y')
52
+
53
+ t.equal(URI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x')
54
+ t.equal(URI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x')
55
+ t.equal(URI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x')
56
+ t.equal(URI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x')
57
+
58
+ t.equal(URI.resolve(base, 'uri:g'), 'uri:g', 'uri:g')
59
+ t.equal(URI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g')
60
+
61
+ // examples by PAEz
62
+ // example was provided to avoid infinite loop within regex
63
+ // this is not the case anymore
64
+ // t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf')
65
+ // t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh')
66
+ t.end()
67
+ })
68
+
69
+ test('URN Resolving', (t) => {
70
+ // example from epoberezkin
71
+ t.equal(URI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
72
+ t.equal(URI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
73
+ t.equal(URI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
74
+ t.equal(URI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
75
+ t.end()
76
+ })
@@ -0,0 +1,144 @@
1
+ 'use strict'
2
+
3
+ const tap = require('tap')
4
+ const test = tap.test
5
+ const URI = require('../')
6
+
7
+ test('URI Serialize', (t) => {
8
+ let components = {
9
+ scheme: undefined,
10
+ userinfo: undefined,
11
+ host: undefined,
12
+ port: undefined,
13
+ path: undefined,
14
+ query: undefined,
15
+ fragment: undefined
16
+ }
17
+ t.equal(URI.serialize(components), '', 'Undefined Components')
18
+
19
+ components = {
20
+ scheme: '',
21
+ userinfo: '',
22
+ host: '',
23
+ port: 0,
24
+ path: '',
25
+ query: '',
26
+ fragment: ''
27
+ }
28
+ t.equal(URI.serialize(components), '//@:0?#', 'Empty Components')
29
+
30
+ components = {
31
+ scheme: 'uri',
32
+ userinfo: 'foo:bar',
33
+ host: 'example.com',
34
+ port: 1,
35
+ path: 'path',
36
+ query: 'query',
37
+ fragment: 'fragment'
38
+ }
39
+ t.equal(URI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components')
40
+
41
+ components = {
42
+ scheme: 'uri',
43
+ host: 'example.com',
44
+ port: '9000'
45
+ }
46
+ t.equal(URI.serialize(components), 'uri://example.com:9000', 'String port')
47
+
48
+ t.equal(URI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path')
49
+ t.equal(URI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path')
50
+ t.equal(URI.serialize({ path: '?query' }), '%3Fquery', 'Query path')
51
+
52
+ t.equal(URI.serialize({ host: '10.10.10.10' }), '//10.10.10.10', 'IPv4address')
53
+
54
+ // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
55
+ t.equal(URI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name')
56
+
57
+ // IPv6address
58
+ t.equal(URI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host')
59
+ t.equal(URI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host')
60
+ t.equal(URI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host')
61
+
62
+ // IPv6address with zone identifier, RFC 6874
63
+ t.equal(URI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host')
64
+ t.equal(URI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host')
65
+
66
+ t.end()
67
+ })
68
+
69
+ test('WS serialize', (t) => {
70
+ t.equal(URI.serialize({ scheme: 'ws' }), 'ws:')
71
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com')
72
+ t.equal(URI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:')
73
+ t.equal(URI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo')
74
+ t.equal(URI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar')
75
+ t.equal(URI.serialize({ scheme: 'ws', secure: false }), 'ws:')
76
+ t.equal(URI.serialize({ scheme: 'ws', secure: true }), 'wss:')
77
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo')
78
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar')
79
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com')
80
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com')
81
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
82
+ t.equal(URI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
83
+ t.end()
84
+ })
85
+
86
+ test('WSS serialize', (t) => {
87
+ t.equal(URI.serialize({ scheme: 'wss' }), 'wss:')
88
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com')
89
+ t.equal(URI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:')
90
+ t.equal(URI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo')
91
+ t.equal(URI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar')
92
+ t.equal(URI.serialize({ scheme: 'wss', secure: false }), 'ws:')
93
+ t.equal(URI.serialize({ scheme: 'wss', secure: true }), 'wss:')
94
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo')
95
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar')
96
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com')
97
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com')
98
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
99
+ t.equal(URI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
100
+
101
+ t.end()
102
+ })
103
+
104
+ test('URN serialize', (t) => {
105
+ // example from RFC 2141
106
+ const components = {
107
+ scheme: 'urn',
108
+ nid: 'foo',
109
+ nss: 'a123,456'
110
+ }
111
+ t.equal(URI.serialize(components), 'urn:foo:a123,456')
112
+ // example from RFC 4122
113
+ let uuidcomponents = {
114
+ scheme: 'urn',
115
+ nid: 'uuid',
116
+ uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
117
+ }
118
+ t.equal(URI.serialize(uuidcomponents), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
119
+
120
+ uuidcomponents = {
121
+ scheme: 'urn',
122
+ nid: 'uuid',
123
+ uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6'
124
+ }
125
+ t.equal(URI.serialize(uuidcomponents), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
126
+ t.end()
127
+ })
128
+ test('URN NID Override', (t) => {
129
+ let components = URI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' })
130
+ t.equal(components.error, undefined, 'errors')
131
+ t.equal(components.scheme, 'urn', 'scheme')
132
+ t.equal(components.path, undefined, 'path')
133
+ t.equal(components.nid, 'foo', 'nid')
134
+ t.equal(components.nss, undefined, 'nss')
135
+ t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid')
136
+
137
+ components = {
138
+ scheme: 'urn',
139
+ nid: 'foo',
140
+ uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
141
+ }
142
+ t.equal(URI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
143
+ t.end()
144
+ })
@@ -0,0 +1,53 @@
1
+ type FastUri = typeof fastUri
2
+
3
+ declare namespace fastUri {
4
+ export interface URIComponent {
5
+ scheme?: string;
6
+ userinfo?: string;
7
+ host?: string;
8
+ port?: number | string;
9
+ path?: string;
10
+ query?: string;
11
+ fragment?: string;
12
+ reference?: string;
13
+ error?: string;
14
+ }
15
+ export interface Options {
16
+ scheme?: string;
17
+ reference?: string;
18
+ unicodeSupport?: boolean;
19
+ domainHost?: boolean;
20
+ absolutePath?: boolean;
21
+ tolerant?: boolean;
22
+ }
23
+
24
+ /**
25
+ * @deprecated Use Options instead
26
+ */
27
+ export type options = Options
28
+ /**
29
+ * @deprecated Use URIComponent instead
30
+ */
31
+ export type URIComponents = URIComponent
32
+
33
+ export function normalize(uri: string, opts?: Options): string;
34
+ export function normalize(uri: URIComponent, opts?: Options): URIComponent;
35
+ export function normalize(uri: any, opts?: Options): any;
36
+
37
+ export function resolve(baseURI: string, relativeURI: string, options?: Options): string
38
+
39
+ export function resolveComponent(base: URIComponent, relative: URIComponent, options?: Options, skipNormalization?: boolean): URIComponent
40
+
41
+ export function parse(uri: string, opts?: Options): URIComponent;
42
+
43
+ export function serialize(component: URIComponent, opts?: Options): string;
44
+
45
+ export function equal(uriA: string, uriB: string): boolean;
46
+
47
+ export function resolve(base: string, path: string): string;
48
+
49
+ export const fastUri: FastUri
50
+ export { fastUri as default }
51
+ }
52
+
53
+ export = fastUri
@@ -0,0 +1,17 @@
1
+ import uri, { URIComponents, URIComponent, Options, options } from "..";
2
+ import { expectDeprecated, expectType } from "tsd";
3
+
4
+ const parsed = uri.parse("foo");
5
+ expectType<URIComponents>(parsed);
6
+ const parsed2 = uri.parse("foo", {
7
+ domainHost: true,
8
+ scheme: 'https',
9
+ unicodeSupport: false
10
+ })
11
+ expectType<URIComponents>(parsed2);
12
+
13
+ expectType<URIComponent>({} as URIComponents)
14
+ expectDeprecated({} as URIComponents)
15
+
16
+ expectType<Options>({} as options)
17
+ expectDeprecated({} as options)
@@ -1,6 +1,6 @@
1
1
  import type { AnySchema, AnySchemaObject, UriResolver } from "../types";
2
2
  import type Ajv from "../ajv";
3
- import type { URIComponents } from "uri-js";
3
+ import type { URIComponents } from "fast-uri";
4
4
  export type LocalRefs = {
5
5
  [Ref in string]?: AnySchemaObject;
6
6
  };
@@ -1,4 +1,4 @@
1
- import * as uri from "uri-js";
1
+ import * as uri from "fast-uri";
2
2
  type URI = typeof uri & {
3
3
  code: string;
4
4
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const uri = require("uri-js");
3
+ const uri = require("fast-uri");
4
4
  uri.code = 'require("ajv/dist/runtime/uri").default';
5
5
  exports.default = uri;
6
6
  //# sourceMappingURL=uri.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,8BAA6B;AAG3B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"}
1
+ {"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAG7B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as URI from "uri-js";
1
+ import * as URI from "fast-uri";
2
2
  import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from "../compile/codegen";
3
3
  import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from "../compile";
4
4
  import type { JSONType } from "../compile/rules";
@@ -14,7 +14,7 @@ import N from "./names"
14
14
  import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve"
15
15
  import {schemaHasRulesButRef, unescapeFragment} from "./util"
16
16
  import {validateFunctionCode} from "./validate"
17
- import * as URI from "uri-js"
17
+ import * as URI from "fast-uri"
18
18
  import {JSONType} from "./rules"
19
19
 
20
20
  export type SchemaRefs = {
@@ -1,6 +1,6 @@
1
1
  import type {AnySchema, AnySchemaObject, UriResolver} from "../types"
2
2
  import type Ajv from "../ajv"
3
- import type {URIComponents} from "uri-js"
3
+ import type {URIComponents} from "fast-uri"
4
4
  import {eachItem} from "./util"
5
5
  import * as equal from "fast-deep-equal"
6
6
  import * as traverse from "json-schema-traverse"