@zuplo/cli 6.72.0 → 6.72.1

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 (99) hide show
  1. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/dependabot.yml +42 -2
  2. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/README.md +5 -5
  3. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/index.js +4 -7
  4. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/package.json +3 -3
  5. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/additionalProperties.test.js +47 -0
  6. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/const.test.js +20 -0
  7. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/patternProperties.test.js +24 -0
  8. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.gitattributes +2 -0
  9. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/dependabot.yml +53 -0
  10. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/workflows/ci.yml +154 -0
  11. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
  12. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/LICENSE +30 -0
  13. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/README.md +152 -0
  14. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
  15. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/encoder.mjs +54 -0
  16. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/equal.mjs +51 -0
  17. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
  18. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/package.json +17 -0
  19. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
  20. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
  21. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/eslint.config.js +6 -0
  22. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/index.js +405 -0
  23. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/lib/schemes.js +267 -0
  24. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/lib/utils.js +585 -0
  25. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/package.json +68 -0
  26. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/ajv.test.js +43 -0
  27. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/equal.test.js +168 -0
  28. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
  29. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
  30. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/parse.test.js +325 -0
  31. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
  32. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/resolve.test.js +87 -0
  33. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
  34. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/scheme-normalization.test.js +16 -0
  35. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security-normalization.test.js +39 -0
  36. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security-utf8-encoding.test.js +0 -0
  37. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security.test.js +161 -0
  38. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/serialize.test.js +151 -0
  39. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
  40. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/uri-js.test.js +912 -0
  41. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/util.test.js +47 -0
  42. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/tsconfig.json +10 -0
  43. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/types/index.d.ts +51 -0
  44. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/types/index.tst.ts +15 -0
  45. package/node_modules/@posthog/core/dist/index.d.ts +3 -0
  46. package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
  47. package/node_modules/@posthog/core/dist/index.js +133 -93
  48. package/node_modules/@posthog/core/dist/index.mjs +2 -1
  49. package/node_modules/@posthog/core/dist/metrics/index.d.ts +61 -0
  50. package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -0
  51. package/node_modules/@posthog/core/dist/metrics/index.js +326 -0
  52. package/node_modules/@posthog/core/dist/metrics/index.mjs +283 -0
  53. package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts +41 -0
  54. package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts.map +1 -0
  55. package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +117 -0
  56. package/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs +68 -0
  57. package/node_modules/@posthog/core/dist/metrics/types.d.ts +69 -0
  58. package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -0
  59. package/node_modules/@posthog/core/dist/metrics/types.js +18 -0
  60. package/node_modules/@posthog/core/dist/metrics/types.mjs +0 -0
  61. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +2 -0
  62. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
  63. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +16 -1
  64. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +16 -1
  65. package/node_modules/@posthog/core/package.json +2 -2
  66. package/node_modules/@posthog/core/src/index.ts +20 -0
  67. package/node_modules/@posthog/core/src/metrics/index.spec.ts +459 -0
  68. package/node_modules/@posthog/core/src/metrics/index.ts +414 -0
  69. package/node_modules/@posthog/core/src/metrics/metrics-utils.ts +100 -0
  70. package/node_modules/@posthog/core/src/metrics/types.ts +89 -0
  71. package/node_modules/@posthog/core/src/posthog-core-stateless.ts +26 -0
  72. package/node_modules/@posthog/types/dist/capture-metric.d.ts +122 -0
  73. package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -0
  74. package/node_modules/@posthog/types/dist/capture-metric.js +36 -0
  75. package/node_modules/@posthog/types/dist/capture-metric.mjs +2 -0
  76. package/node_modules/@posthog/types/dist/index.d.ts +3 -1
  77. package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
  78. package/node_modules/@posthog/types/dist/index.js +19 -1
  79. package/node_modules/@posthog/types/dist/index.mjs +2 -0
  80. package/node_modules/@posthog/types/dist/posthog-config.d.ts +60 -0
  81. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  82. package/node_modules/@posthog/types/package.json +1 -1
  83. package/node_modules/@posthog/types/src/capture-metric.ts +133 -0
  84. package/node_modules/@posthog/types/src/index.ts +17 -0
  85. package/node_modules/@posthog/types/src/posthog-config.ts +62 -0
  86. package/node_modules/@zuplo/core/package.json +1 -1
  87. package/node_modules/@zuplo/graphql/package.json +1 -1
  88. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  89. package/node_modules/@zuplo/otel/package.json +1 -1
  90. package/node_modules/@zuplo/runtime/out/esm/{chunk-FAOWNDMK.js → chunk-IC7XGD5C.js} +93 -93
  91. package/node_modules/@zuplo/runtime/out/esm/chunk-IC7XGD5C.js.map +1 -0
  92. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  93. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  94. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  95. package/node_modules/@zuplo/runtime/out/types/index.d.ts +830 -6
  96. package/node_modules/@zuplo/runtime/package.json +1 -1
  97. package/package.json +6 -6
  98. package/node_modules/@zuplo/runtime/out/esm/chunk-FAOWNDMK.js.map +0 -1
  99. /package/node_modules/@zuplo/runtime/out/esm/{chunk-FAOWNDMK.js.LEGAL.txt → chunk-IC7XGD5C.js.LEGAL.txt} +0 -0
@@ -0,0 +1,120 @@
1
+ [
2
+ [
3
+ {
4
+ "host": "10.10.10.10.example.com"
5
+ },
6
+ "//10.10.10.10.example.com"
7
+ ],
8
+ [
9
+ {
10
+ "host": "2001:db8::7"
11
+ },
12
+ "//[2001:db8::7]"
13
+ ],
14
+ [
15
+ {
16
+ "host": "::ffff:129.144.52.38"
17
+ },
18
+ "//[::ffff:129.144.52.38]"
19
+ ],
20
+ [
21
+ {
22
+ "host": "2606:2800:220:1:248:1893:25c8:1946"
23
+ },
24
+ "//[2606:2800:220:1:248:1893:25c8:1946]"
25
+ ],
26
+ [
27
+ {
28
+ "host": "10.10.10.10.example.com"
29
+ },
30
+ "//10.10.10.10.example.com"
31
+ ],
32
+ [
33
+ {
34
+ "host": "10.10.10.10"
35
+ },
36
+ "//10.10.10.10"
37
+ ],
38
+ [
39
+ {
40
+ "path": "?query"
41
+ },
42
+ "%3Fquery"
43
+ ],
44
+ [
45
+ {
46
+ "path": "foo:bar"
47
+ },
48
+ "foo%3Abar"
49
+ ],
50
+ [
51
+ {
52
+ "path": "//path"
53
+ },
54
+ "/%2Fpath"
55
+ ],
56
+ [
57
+ {
58
+ "scheme": "uri",
59
+ "host": "example.com",
60
+ "port": "9000"
61
+ },
62
+ "uri://example.com:9000"
63
+ ],
64
+ [
65
+ {
66
+ "scheme": "uri",
67
+ "userinfo": "foo:bar",
68
+ "host": "example.com",
69
+ "port": 1,
70
+ "path": "path",
71
+ "query": "query",
72
+ "fragment": "fragment"
73
+ },
74
+ "uri://foo:bar@example.com:1/path?query#fragment"
75
+ ],
76
+ [
77
+ {
78
+ "scheme": "",
79
+ "userinfo": "",
80
+ "host": "",
81
+ "port": 0,
82
+ "path": "",
83
+ "query": "",
84
+ "fragment": ""
85
+ },
86
+ "//@:0?#"
87
+ ],
88
+ [
89
+ {},
90
+ ""
91
+ ],
92
+ [
93
+ {
94
+ "host": "fe80::a%en1"
95
+ },
96
+ "//[fe80::a%25en1]"
97
+ ],
98
+ [
99
+ {
100
+ "host": "fe80::a%25en1"
101
+ },
102
+ "//[fe80::a%25en1]"
103
+ ],
104
+ [
105
+ {
106
+ "scheme": "wss",
107
+ "host": "example.com",
108
+ "path": "/foo",
109
+ "query": "bar"
110
+ },
111
+ "wss://example.com/foo?bar"
112
+ ],
113
+ [
114
+ {
115
+ "scheme": "scheme",
116
+ "path": "with:colon"
117
+ },
118
+ "scheme:with:colon"
119
+ ]
120
+ ]
@@ -0,0 +1,325 @@
1
+ 'use strict'
2
+
3
+ const test = require('tape')
4
+ const fastURI = require('..')
5
+
6
+ test('URI parse', (t) => {
7
+ let components
8
+
9
+ // scheme
10
+ components = fastURI.parse('uri:')
11
+ t.equal(components.error, undefined, 'scheme errors')
12
+ t.equal(components.scheme, 'uri', 'scheme')
13
+ // t.equal(components.authority, undefined, "authority");
14
+ t.equal(components.userinfo, undefined, 'userinfo')
15
+ t.equal(components.host, undefined, 'host')
16
+ t.equal(components.port, undefined, 'port')
17
+ t.equal(components.path, '', 'path')
18
+ t.equal(components.query, undefined, 'query')
19
+ t.equal(components.fragment, undefined, 'fragment')
20
+
21
+ // userinfo
22
+ components = fastURI.parse('//@')
23
+ t.equal(components.error, undefined, 'userinfo errors')
24
+ t.equal(components.scheme, undefined, 'scheme')
25
+ // t.equal(components.authority, "@", "authority");
26
+ t.equal(components.userinfo, '', 'userinfo')
27
+ t.equal(components.host, '', 'host')
28
+ t.equal(components.port, undefined, 'port')
29
+ t.equal(components.path, '', 'path')
30
+ t.equal(components.query, undefined, 'query')
31
+ t.equal(components.fragment, undefined, 'fragment')
32
+
33
+ // host
34
+ components = fastURI.parse('//')
35
+ t.equal(components.error, undefined, 'host errors')
36
+ t.equal(components.scheme, undefined, 'scheme')
37
+ // t.equal(components.authority, "", "authority");
38
+ t.equal(components.userinfo, undefined, 'userinfo')
39
+ t.equal(components.host, '', 'host')
40
+ t.equal(components.port, undefined, 'port')
41
+ t.equal(components.path, '', 'path')
42
+ t.equal(components.query, undefined, 'query')
43
+ t.equal(components.fragment, undefined, 'fragment')
44
+
45
+ // port
46
+ components = fastURI.parse('//:')
47
+ t.equal(components.error, undefined, 'port errors')
48
+ t.equal(components.scheme, undefined, 'scheme')
49
+ // t.equal(components.authority, ":", "authority");
50
+ t.equal(components.userinfo, undefined, 'userinfo')
51
+ t.equal(components.host, '', 'host')
52
+ t.equal(components.port, '', 'port')
53
+ t.equal(components.path, '', 'path')
54
+ t.equal(components.query, undefined, 'query')
55
+ t.equal(components.fragment, undefined, 'fragment')
56
+
57
+ // path
58
+ components = fastURI.parse('')
59
+ t.equal(components.error, undefined, 'path errors')
60
+ t.equal(components.scheme, undefined, 'scheme')
61
+ // t.equal(components.authority, undefined, "authority");
62
+ t.equal(components.userinfo, undefined, 'userinfo')
63
+ t.equal(components.host, undefined, 'host')
64
+ t.equal(components.port, undefined, 'port')
65
+ t.equal(components.path, '', 'path')
66
+ t.equal(components.query, undefined, 'query')
67
+ t.equal(components.fragment, undefined, 'fragment')
68
+
69
+ // query
70
+ components = fastURI.parse('?')
71
+ t.equal(components.error, undefined, 'query errors')
72
+ t.equal(components.scheme, undefined, 'scheme')
73
+ // t.equal(components.authority, undefined, "authority");
74
+ t.equal(components.userinfo, undefined, 'userinfo')
75
+ t.equal(components.host, undefined, 'host')
76
+ t.equal(components.port, undefined, 'port')
77
+ t.equal(components.path, '', 'path')
78
+ t.equal(components.query, '', 'query')
79
+ t.equal(components.fragment, undefined, 'fragment')
80
+
81
+ // fragment
82
+ components = fastURI.parse('#')
83
+ t.equal(components.error, undefined, 'fragment errors')
84
+ t.equal(components.scheme, undefined, 'scheme')
85
+ // t.equal(components.authority, undefined, "authority");
86
+ t.equal(components.userinfo, undefined, 'userinfo')
87
+ t.equal(components.host, undefined, 'host')
88
+ t.equal(components.port, undefined, 'port')
89
+ t.equal(components.path, '', 'path')
90
+ t.equal(components.query, undefined, 'query')
91
+ t.equal(components.fragment, '', 'fragment')
92
+
93
+ // fragment with character tabulation
94
+ components = fastURI.parse('#\t')
95
+ t.equal(components.error, undefined, 'path errors')
96
+ t.equal(components.scheme, undefined, 'scheme')
97
+ // t.equal(components.authority, undefined, "authority");
98
+ t.equal(components.userinfo, undefined, 'userinfo')
99
+ t.equal(components.host, undefined, 'host')
100
+ t.equal(components.port, undefined, 'port')
101
+ t.equal(components.path, '', 'path')
102
+ t.equal(components.query, undefined, 'query')
103
+ t.equal(components.fragment, '%09', 'fragment')
104
+
105
+ // fragment with line feed
106
+ components = fastURI.parse('#\n')
107
+ t.equal(components.error, undefined, 'path errors')
108
+ t.equal(components.scheme, undefined, 'scheme')
109
+ // t.equal(components.authority, undefined, "authority");
110
+ t.equal(components.userinfo, undefined, 'userinfo')
111
+ t.equal(components.host, undefined, 'host')
112
+ t.equal(components.port, undefined, 'port')
113
+ t.equal(components.path, '', 'path')
114
+ t.equal(components.query, undefined, 'query')
115
+ t.equal(components.fragment, '%0A', 'fragment')
116
+
117
+ // fragment with line tabulation
118
+ components = fastURI.parse('#\v')
119
+ t.equal(components.error, undefined, 'path errors')
120
+ t.equal(components.scheme, undefined, 'scheme')
121
+ // t.equal(components.authority, undefined, "authority");
122
+ t.equal(components.userinfo, undefined, 'userinfo')
123
+ t.equal(components.host, undefined, 'host')
124
+ t.equal(components.port, undefined, 'port')
125
+ t.equal(components.path, '', 'path')
126
+ t.equal(components.query, undefined, 'query')
127
+ t.equal(components.fragment, '%0B', 'fragment')
128
+
129
+ // fragment with form feed
130
+ components = fastURI.parse('#\f')
131
+ t.equal(components.error, undefined, 'path errors')
132
+ t.equal(components.scheme, undefined, 'scheme')
133
+ // t.equal(components.authority, undefined, "authority");
134
+ t.equal(components.userinfo, undefined, 'userinfo')
135
+ t.equal(components.host, undefined, 'host')
136
+ t.equal(components.port, undefined, 'port')
137
+ t.equal(components.path, '', 'path')
138
+ t.equal(components.query, undefined, 'query')
139
+ t.equal(components.fragment, '%0C', 'fragment')
140
+
141
+ // fragment with carriage return
142
+ components = fastURI.parse('#\r')
143
+ t.equal(components.error, undefined, 'path errors')
144
+ t.equal(components.scheme, undefined, 'scheme')
145
+ // t.equal(components.authority, undefined, "authority");
146
+ t.equal(components.userinfo, undefined, 'userinfo')
147
+ t.equal(components.host, undefined, 'host')
148
+ t.equal(components.port, undefined, 'port')
149
+ t.equal(components.path, '', 'path')
150
+ t.equal(components.query, undefined, 'query')
151
+ t.equal(components.fragment, '%0D', 'fragment')
152
+
153
+ // a fragment whose decoded bytes are not valid UTF-8 is still valid
154
+ // percent-encoding (RFC 3986 §2.1 is byte-level), so it is preserved as-is
155
+ // rather than being flagged as malformed
156
+ components = fastURI.parse('http://example.com/#%E0%A4A')
157
+ t.equal(components.error, undefined, 'valid percent-encoding is not flagged as malformed')
158
+ t.equal(components.fragment, '%E0%A4A', 'fragment is preserved')
159
+
160
+ // all
161
+ components = fastURI.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
162
+ t.equal(components.error, undefined, 'all errors')
163
+ t.equal(components.scheme, 'uri', 'scheme')
164
+ // t.equal(components.authority, "user:pass@example.com:123", "authority");
165
+ t.equal(components.userinfo, 'user:pass', 'userinfo')
166
+ t.equal(components.host, 'example.com', 'host')
167
+ t.equal(components.port, 123, 'port')
168
+ t.equal(components.path, '/one/two.three', 'path')
169
+ t.equal(components.query, 'q1=a1&q2=a2', 'query')
170
+ t.equal(components.fragment, 'body', 'fragment')
171
+
172
+ // IPv4address
173
+ components = fastURI.parse('//10.10.10.10')
174
+ t.equal(components.error, undefined, 'IPv4address errors')
175
+ t.equal(components.scheme, undefined, 'scheme')
176
+ t.equal(components.userinfo, undefined, 'userinfo')
177
+ t.equal(components.host, '10.10.10.10', 'host')
178
+ t.equal(components.port, undefined, 'port')
179
+ t.equal(components.path, '', 'path')
180
+ t.equal(components.query, undefined, 'query')
181
+ t.equal(components.fragment, undefined, 'fragment')
182
+
183
+ // IPv4address with unformated 0 stay as-is
184
+ components = fastURI.parse('//10.10.000.10') // not valid as per https://datatracker.ietf.org/doc/html/rfc5954#section-4.1
185
+ t.equal(components.error, undefined, 'IPv4address errors')
186
+ t.equal(components.scheme, undefined, 'scheme')
187
+ t.equal(components.userinfo, undefined, 'userinfo')
188
+ t.equal(components.host, '10.10.000.10', 'host')
189
+ t.equal(components.port, undefined, 'port')
190
+ t.equal(components.path, '', 'path')
191
+ t.equal(components.query, undefined, 'query')
192
+ t.equal(components.fragment, undefined, 'fragment')
193
+ components = fastURI.parse('//01.01.01.01') // not valid in URIs: https://datatracker.ietf.org/doc/html/rfc3986#section-7.4
194
+ t.equal(components.error, undefined, 'IPv4address errors')
195
+ t.equal(components.scheme, undefined, 'scheme')
196
+ t.equal(components.userinfo, undefined, 'userinfo')
197
+ t.equal(components.host, '01.01.01.01', 'host')
198
+ t.equal(components.port, undefined, 'port')
199
+ t.equal(components.path, '', 'path')
200
+ t.equal(components.query, undefined, 'query')
201
+ t.equal(components.fragment, undefined, 'fragment')
202
+
203
+ // IPv6address
204
+ components = fastURI.parse('//[2001:db8::7]')
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, '2001:db8::7', '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
+ // invalid IPv6
215
+ components = fastURI.parse('//[2001:dbZ::7]')
216
+ t.equal(components.host, '[2001:dbz::7]')
217
+
218
+ // mixed IPv4address & IPv6address
219
+ components = fastURI.parse('//[::ffff:129.144.52.38]')
220
+ t.equal(components.error, undefined, 'IPv4address errors')
221
+ t.equal(components.scheme, undefined, 'scheme')
222
+ t.equal(components.userinfo, undefined, 'userinfo')
223
+ t.equal(components.host, '::ffff:129.144.52.38', 'host')
224
+ t.equal(components.port, undefined, 'port')
225
+ t.equal(components.path, '', 'path')
226
+ t.equal(components.query, undefined, 'query')
227
+ t.equal(components.fragment, undefined, 'fragment')
228
+
229
+ // mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
230
+ components = fastURI.parse('uri://10.10.10.10.example.com/en/process')
231
+ t.equal(components.error, undefined, 'mixed errors')
232
+ t.equal(components.scheme, 'uri', 'scheme')
233
+ t.equal(components.userinfo, undefined, 'userinfo')
234
+ t.equal(components.host, '10.10.10.10.example.com', 'host')
235
+ t.equal(components.port, undefined, 'port')
236
+ t.equal(components.path, '/en/process', 'path')
237
+ t.equal(components.query, undefined, 'query')
238
+ t.equal(components.fragment, undefined, 'fragment')
239
+
240
+ // IPv6address, example from bkw (https://github.com/garycourt/uri-js/pull/16)
241
+ components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946]/test')
242
+ t.equal(components.error, undefined, 'IPv6address errors')
243
+ t.equal(components.scheme, undefined, 'scheme')
244
+ t.equal(components.userinfo, undefined, 'userinfo')
245
+ t.equal(components.host, '2606:2800:220:1:248:1893:25c8:1946', 'host')
246
+ t.equal(components.port, undefined, 'port')
247
+ t.equal(components.path, '/test', 'path')
248
+ t.equal(components.query, undefined, 'query')
249
+ t.equal(components.fragment, undefined, 'fragment')
250
+
251
+ // IPv6address, example from RFC 5952
252
+ components = fastURI.parse('//[2001:db8::1]:80')
253
+ t.equal(components.error, undefined, 'IPv6address errors')
254
+ t.equal(components.scheme, undefined, 'scheme')
255
+ t.equal(components.userinfo, undefined, 'userinfo')
256
+ t.equal(components.host, '2001:db8::1', 'host')
257
+ t.equal(components.port, 80, 'port')
258
+ t.equal(components.path, '', 'path')
259
+ t.equal(components.query, undefined, 'query')
260
+ t.equal(components.fragment, undefined, 'fragment')
261
+
262
+ // IPv6address with zone identifier, RFC 6874
263
+ components = fastURI.parse('//[fe80::a%25en1]')
264
+ t.equal(components.error, undefined, 'IPv4address errors')
265
+ t.equal(components.scheme, undefined, 'scheme')
266
+ t.equal(components.userinfo, undefined, 'userinfo')
267
+ t.equal(components.host, 'fe80::a%en1', 'host')
268
+ t.equal(components.port, undefined, 'port')
269
+ t.equal(components.path, '', 'path')
270
+ t.equal(components.query, undefined, 'query')
271
+ t.equal(components.fragment, undefined, 'fragment')
272
+
273
+ // IPv6address with an unescaped interface specifier, example from pekkanikander (https://github.com/garycourt/uri-js/pull/22)
274
+ components = fastURI.parse('//[2001:db8::7%en0]')
275
+ t.equal(components.error, undefined, 'IPv6address interface errors')
276
+ t.equal(components.scheme, undefined, 'scheme')
277
+ t.equal(components.userinfo, undefined, 'userinfo')
278
+ t.equal(components.host, '2001:db8::7%en0', 'host')
279
+ t.equal(components.port, undefined, 'port')
280
+ t.equal(components.path, '', 'path')
281
+ t.equal(components.query, undefined, 'query')
282
+ t.equal(components.fragment, undefined, 'fragment')
283
+
284
+ // UUID V1
285
+ components = fastURI.parse('urn:uuid:b571b0bc-4713-11ec-81d3-0242ac130003')
286
+ t.equal(components.error, undefined, 'errors')
287
+ t.equal(components.scheme, 'urn', 'scheme')
288
+ // t.equal(components.authority, undefined, "authority");
289
+ t.equal(components.userinfo, undefined, 'userinfo')
290
+ t.equal(components.host, undefined, 'host')
291
+ t.equal(components.port, undefined, 'port')
292
+ t.equal(components.path, undefined, 'path')
293
+ t.equal(components.query, undefined, 'query')
294
+ t.equal(components.fragment, undefined, 'fragment')
295
+ t.equal(components.nid, 'uuid', 'nid')
296
+ t.equal(components.nss, undefined, 'nss')
297
+ t.equal(components.uuid, 'b571b0bc-4713-11ec-81d3-0242ac130003', 'uuid')
298
+
299
+ // UUID v4
300
+ components = fastURI.parse('urn:uuid:97a32222-89b7-420e-8507-4360723e2c2a')
301
+ t.equal(components.uuid, '97a32222-89b7-420e-8507-4360723e2c2a', 'uuid')
302
+
303
+ components = fastURI.parse('urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
304
+ t.notSame(components.error, undefined, 'errors')
305
+
306
+ components = fastURI.parse('urn:foo:a123,456')
307
+ t.equal(components.error, undefined, 'errors')
308
+ t.equal(components.scheme, 'urn', 'scheme')
309
+ // t.equal(components.authority, undefined, "authority");
310
+ t.equal(components.userinfo, undefined, 'userinfo')
311
+ t.equal(components.host, undefined, 'host')
312
+ t.equal(components.port, undefined, 'port')
313
+ t.equal(components.path, undefined, 'path')
314
+ t.equal(components.query, undefined, 'query')
315
+ t.equal(components.fragment, undefined, 'fragment')
316
+ t.equal(components.nid, 'foo', 'nid')
317
+ t.equal(components.nss, 'a123,456', 'nss')
318
+
319
+ components = fastURI.parse('//[2606:2800:220:1:248:1893:25c8:1946:43209]')
320
+ t.equal(components.host, '[2606:2800:220:1:248:1893:25c8:1946:43209]')
321
+
322
+ components = fastURI.parse('urn:foo:|\\24fpl')
323
+ t.equal(components.error, 'URN can not be parsed.')
324
+ t.end()
325
+ })
@@ -0,0 +1,33 @@
1
+ 'use strict'
2
+
3
+ const test = require('tape')
4
+ const fastURI = require('..')
5
+
6
+ test('query percent-encoding is normalized (RFC 3986 §6.2.2)', (t) => {
7
+ // hex digits are uppercased, like the path component already does
8
+ t.equal(fastURI.normalize('x://h/p?a=%2a'), 'x://h/p?a=%2A', 'uppercases hex in query')
9
+ // unreserved characters are decoded
10
+ t.equal(fastURI.normalize('x://h/p?a=%7e%2e'), 'x://h/p?a=~.', 'decodes unreserved in query')
11
+ // reserved characters stay percent-encoded
12
+ t.equal(fastURI.normalize('x://h/p?a=%2F'), 'x://h/p?a=%2F', 'keeps reserved encoded in query')
13
+ // raw characters that are not allowed are percent-encoded
14
+ t.equal(fastURI.normalize('x://h/p?a b'), 'x://h/p?a%20b', 'encodes a raw space in query')
15
+ t.equal(fastURI.normalize('x://h/p?café'), 'x://h/p?caf%C3%A9', 'encodes raw non-ASCII in query')
16
+ // `?` is allowed unencoded in a query
17
+ t.equal(fastURI.normalize('x://h/p?a?b'), 'x://h/p?a?b', 'keeps `?` raw in query')
18
+
19
+ t.end()
20
+ })
21
+
22
+ test('fragment percent-encoding is normalized without decoding reserved characters', (t) => {
23
+ // reserved characters must NOT be decoded — `%2F` is not `/`
24
+ t.equal(fastURI.normalize('x://h/p#a%2Fb%2A'), 'x://h/p#a%2Fb%2A', 'keeps reserved encoded in fragment')
25
+ // hex is uppercased and unreserved is decoded
26
+ t.equal(fastURI.normalize('x://h/p#a%2a%7e'), 'x://h/p#a%2A~', 'uppercases hex and decodes unreserved in fragment')
27
+ // raw characters are still encoded
28
+ t.equal(fastURI.normalize('x://h/p#a b'), 'x://h/p#a%20b', 'encodes a raw space in fragment')
29
+ // `?` and `/` are allowed unencoded in a fragment
30
+ t.equal(fastURI.normalize('x://h/p#f?x/y'), 'x://h/p#f?x/y', 'keeps `?` and `/` raw in fragment')
31
+
32
+ t.end()
33
+ })
@@ -0,0 +1,87 @@
1
+ 'use strict'
2
+
3
+ const test = require('tape')
4
+ const fastURI = require('..')
5
+
6
+ test('URI Resolving', (t) => {
7
+ // normal examples from RFC 3986
8
+ const base = 'uri://a/b/c/d;p?q'
9
+ t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h')
10
+ t.equal(fastURI.resolve(base, 'g:h'), 'g:h', 'g:h')
11
+ t.equal(fastURI.resolve(base, 'g'), 'uri://a/b/c/g', 'g')
12
+ t.equal(fastURI.resolve(base, './g'), 'uri://a/b/c/g', './g')
13
+ t.equal(fastURI.resolve(base, 'g/'), 'uri://a/b/c/g/', 'g/')
14
+ t.equal(fastURI.resolve(base, '/g'), 'uri://a/g', '/g')
15
+ t.equal(fastURI.resolve(base, '//g'), 'uri://g', '//g')
16
+ t.equal(fastURI.resolve(base, '?y'), 'uri://a/b/c/d;p?y', '?y')
17
+ t.equal(fastURI.resolve(base, 'g?y'), 'uri://a/b/c/g?y', 'g?y')
18
+ t.equal(fastURI.resolve(base, '#s'), 'uri://a/b/c/d;p?q#s', '#s')
19
+ t.equal(fastURI.resolve(base, 'g#s'), 'uri://a/b/c/g#s', 'g#s')
20
+ t.equal(fastURI.resolve(base, 'g?y#s'), 'uri://a/b/c/g?y#s', 'g?y#s')
21
+ t.equal(fastURI.resolve(base, ';x'), 'uri://a/b/c/;x', ';x')
22
+ t.equal(fastURI.resolve(base, 'g;x'), 'uri://a/b/c/g;x', 'g;x')
23
+ t.equal(fastURI.resolve(base, 'g;x?y#s'), 'uri://a/b/c/g;x?y#s', 'g;x?y#s')
24
+ t.equal(fastURI.resolve(base, ''), 'uri://a/b/c/d;p?q', '')
25
+ t.equal(fastURI.resolve(base, '.'), 'uri://a/b/c/', '.')
26
+ t.equal(fastURI.resolve(base, './'), 'uri://a/b/c/', './')
27
+ t.equal(fastURI.resolve(base, '..'), 'uri://a/b/', '..')
28
+ t.equal(fastURI.resolve(base, '../'), 'uri://a/b/', '../')
29
+ t.equal(fastURI.resolve(base, '../g'), 'uri://a/b/g', '../g')
30
+ t.equal(fastURI.resolve(base, '../..'), 'uri://a/', '../..')
31
+ t.equal(fastURI.resolve(base, '../../'), 'uri://a/', '../../')
32
+ t.equal(fastURI.resolve(base, '../../g'), 'uri://a/g', '../../g')
33
+
34
+ // abnormal examples from RFC 3986
35
+ t.equal(fastURI.resolve(base, '../../../g'), 'uri://a/g', '../../../g')
36
+ t.equal(fastURI.resolve(base, '../../../../g'), 'uri://a/g', '../../../../g')
37
+
38
+ t.equal(fastURI.resolve(base, '/./g'), 'uri://a/g', '/./g')
39
+ t.equal(fastURI.resolve(base, '/../g'), 'uri://a/g', '/../g')
40
+ t.equal(fastURI.resolve(base, 'g.'), 'uri://a/b/c/g.', 'g.')
41
+ t.equal(fastURI.resolve(base, '.g'), 'uri://a/b/c/.g', '.g')
42
+ t.equal(fastURI.resolve(base, 'g..'), 'uri://a/b/c/g..', 'g..')
43
+ t.equal(fastURI.resolve(base, '..g'), 'uri://a/b/c/..g', '..g')
44
+
45
+ t.equal(fastURI.resolve(base, './../g'), 'uri://a/b/g', './../g')
46
+ t.equal(fastURI.resolve(base, './g/.'), 'uri://a/b/c/g/', './g/.')
47
+ t.equal(fastURI.resolve(base, 'g/./h'), 'uri://a/b/c/g/h', 'g/./h')
48
+ t.equal(fastURI.resolve(base, 'g/../h'), 'uri://a/b/c/h', 'g/../h')
49
+ t.equal(fastURI.resolve(base, 'g;x=1/./y'), 'uri://a/b/c/g;x=1/y', 'g;x=1/./y')
50
+ t.equal(fastURI.resolve(base, 'g;x=1/../y'), 'uri://a/b/c/y', 'g;x=1/../y')
51
+
52
+ t.equal(fastURI.resolve(base, 'g?y/./x'), 'uri://a/b/c/g?y/./x', 'g?y/./x')
53
+ t.equal(fastURI.resolve(base, 'g?y/../x'), 'uri://a/b/c/g?y/../x', 'g?y/../x')
54
+ t.equal(fastURI.resolve(base, 'g#s/./x'), 'uri://a/b/c/g#s/./x', 'g#s/./x')
55
+ t.equal(fastURI.resolve(base, 'g#s/../x'), 'uri://a/b/c/g#s/../x', 'g#s/../x')
56
+
57
+ t.equal(fastURI.resolve(base, 'uri:g'), 'uri:g', 'uri:g')
58
+ t.equal(fastURI.resolve(base, 'uri:g', {}), 'uri:g', 'uri:g')
59
+ t.equal(fastURI.resolve(base, 'uri:g', { tolerant: undefined }), 'uri:g', 'uri:g')
60
+ t.equal(fastURI.resolve(base, 'uri:g', { tolerant: false }), 'uri:g', 'uri:g')
61
+ t.equal(fastURI.resolve(base, 'uri:g', { tolerant: true }), 'uri://a/b/c/g', 'uri:g')
62
+
63
+ // examples by PAEz
64
+ // example was provided to avoid infinite loop within regex
65
+ // this is not the case anymore
66
+ // t.equal(URI.resolve('//www.g.com/', '/adf\ngf'), '//www.g.com/adf%0Agf', '/adf\\ngf')
67
+ // t.equal(URI.resolve('//www.g.com/error\n/bleh/bleh', '..'), '//www.g.com/error%0A/', '//www.g.com/error\\n/bleh/bleh')
68
+ t.end()
69
+ })
70
+
71
+ test('URN Resolving', (t) => {
72
+ // example from epoberezkin
73
+ t.equal(fastURI.resolve('', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
74
+ t.equal(fastURI.resolve('#', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
75
+ t.equal(fastURI.resolve('urn:some:ip:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
76
+ t.equal(fastURI.resolve('urn:some:other:prop', 'urn:some:ip:prop'), 'urn:some:ip:prop', 'urn:some:ip:prop')
77
+ t.end()
78
+ })
79
+
80
+ test('URI Resolving tolerates malformed fragments', (t) => {
81
+ t.equal(
82
+ fastURI.resolve('http://base.com/', 'http://example.com/#%E0%A4A'),
83
+ 'http://example.com/#%E0%A4A',
84
+ 'malformed fragment does not throw during resolve'
85
+ )
86
+ t.end()
87
+ })
@@ -0,0 +1,90 @@
1
+ 'use strict'
2
+
3
+ const test = require('tape')
4
+ const fastURI = require('..')
5
+
6
+ test('RFC 3986', (t) => {
7
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/', secure: true }),
8
+ 'http://example.com/', 'http://example.com/')
9
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo', secure: true }),
10
+ 'http://example.com/foo', 'http://example.com/foo')
11
+
12
+ // A. If the input buffer begins with a prefix of "../" or "./",
13
+ // then remove that prefix from the input buffer; otherwise,
14
+
15
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../', secure: true }),
16
+ 'http://example.com/', 'http://example.com/')
17
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './', secure: true }),
18
+ 'http://example.com/', 'http://example.com/')
19
+
20
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../', secure: true }),
21
+ 'http://example.com/', 'http://example.com/')
22
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././', secure: true }),
23
+ 'http://example.com/', 'http://example.com/')
24
+
25
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../', secure: true }),
26
+ 'http://example.com/', 'http://example.com/')
27
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././', secure: true }),
28
+ 'http://example.com/', 'http://example.com/')
29
+
30
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../foo', secure: true }),
31
+ 'http://example.com/foo', 'http://example.com/foo')
32
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './foo', secure: true }),
33
+ 'http://example.com/foo', 'http://example.com/foo')
34
+
35
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '../../foo', secure: true }),
36
+ 'http://example.com/foo', 'http://example.com/foo')
37
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '././foo', secure: true }),
38
+ 'http://example.com/foo', 'http://example.com/foo')
39
+
40
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: './../foo', secure: true }),
41
+ 'http://example.com/foo', 'http://example.com/foo')
42
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.././foo', secure: true }),
43
+ 'http://example.com/foo', 'http://example.com/foo')
44
+
45
+ // B. if the input buffer begins with a prefix of "/./" or "/.",
46
+ // where "." is a complete path segment, then replace that
47
+ // prefix with "/" in the input buffer; otherwise,
48
+
49
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./', secure: true }),
50
+ 'http://example.com/', 'http://example.com/')
51
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }),
52
+ 'http://example.com/', 'http://example.com/')
53
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/./foo', secure: true }),
54
+ 'http://example.com/foo', 'http://example.com/foo')
55
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.././foo', secure: true }),
56
+ 'http://example.com/foo', 'http://example.com/foo')
57
+
58
+ // C. if the input buffer begins with a prefix of "/../" or "/..",
59
+ // where ".." is a complete path segment, then replace that
60
+ // prefix with "/" in the input buffer and remove the last
61
+ // segment and its preceding "/" (if any) from the output
62
+ // buffer; otherwise,
63
+
64
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../', secure: true }),
65
+ 'http://example.com/', 'http://example.com/')
66
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }),
67
+ 'http://example.com/', 'http://example.com/')
68
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/../foo', secure: true }),
69
+ 'http://example.com/foo', 'http://example.com/foo')
70
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/..', secure: true }),
71
+ 'http://example.com/', 'http://example.com/')
72
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/bar/..', secure: true }),
73
+ 'http://example.com/foo/', 'http://example.com/foo/')
74
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/foo/../bar/..', secure: true }),
75
+ 'http://example.com/', 'http://example.com/')
76
+
77
+ // D. if the input buffer consists only of "." or "..", then remove
78
+ // that from the input buffer; otherwise,
79
+
80
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/.', secure: true }),
81
+ 'http://example.com/', 'http://example.com/')
82
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '/..', secure: true }),
83
+ 'http://example.com/', 'http://example.com/')
84
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '.', secure: true }),
85
+ 'http://example.com/', 'http://example.com/')
86
+ t.strictEqual(fastURI.serialize({ scheme: 'http', host: 'example.com', path: '..', secure: true }),
87
+ 'http://example.com/', 'http://example.com/')
88
+
89
+ t.end()
90
+ })