@zuplo/cli 6.71.27 → 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.
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/dependabot.yml +42 -2
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/README.md +5 -5
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/index.js +4 -7
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/package.json +3 -3
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/additionalProperties.test.js +47 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/const.test.js +20 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/patternProperties.test.js +24 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.gitattributes +2 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/dependabot.yml +53 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/workflows/ci.yml +154 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/LICENSE +30 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/README.md +152 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/encoder.mjs +54 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/package.json +17 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/eslint.config.js +6 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/index.js +405 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/lib/schemes.js +267 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/lib/utils.js +585 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/package.json +68 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/ajv.test.js +43 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/equal.test.js +168 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/parse.test.js +325 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/resolve.test.js +87 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/scheme-normalization.test.js +16 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security-normalization.test.js +39 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security-utf8-encoding.test.js +0 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security.test.js +161 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/serialize.test.js +151 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/uri-js.test.js +912 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/util.test.js +47 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/tsconfig.json +10 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/types/index.d.ts +51 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/types/index.tst.ts +15 -0
- package/node_modules/@posthog/core/dist/index.d.ts +3 -0
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +133 -93
- package/node_modules/@posthog/core/dist/index.mjs +2 -1
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +61 -0
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/metrics/index.js +326 -0
- package/node_modules/@posthog/core/dist/metrics/index.mjs +283 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts +41 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.js +117 -0
- package/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs +68 -0
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +69 -0
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/metrics/types.js +18 -0
- package/node_modules/@posthog/core/dist/metrics/types.mjs +0 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +2 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +16 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +16 -1
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/index.ts +20 -0
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +459 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +414 -0
- package/node_modules/@posthog/core/src/metrics/metrics-utils.ts +100 -0
- package/node_modules/@posthog/core/src/metrics/types.ts +89 -0
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +26 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts +122 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -0
- package/node_modules/@posthog/types/dist/capture-metric.js +36 -0
- package/node_modules/@posthog/types/dist/capture-metric.mjs +2 -0
- package/node_modules/@posthog/types/dist/index.d.ts +3 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/index.js +19 -1
- package/node_modules/@posthog/types/dist/index.mjs +2 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +60 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture-metric.ts +133 -0
- package/node_modules/@posthog/types/src/index.ts +17 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +62 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/fs/promises.d.ts +16 -6
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-D3O7C43P.js → chunk-IC7XGD5C.js} +93 -93
- package/node_modules/@zuplo/runtime/out/esm/chunk-IC7XGD5C.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +9 -9
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +830 -6
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +30 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.js +11 -4
- package/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js +1 -1
- package/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/browser/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/index.min.js.map +3 -3
- package/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.js +11 -4
- package/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
- package/node_modules/lru-cache/dist/esm/node/index.min.js.map +3 -3
- package/node_modules/lru-cache/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-D3O7C43P.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-D3O7C43P.js.LEGAL.txt → chunk-IC7XGD5C.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('scheme is normalized to lowercase (RFC 3986 §6.2.2.1)', (t) => {
|
|
7
|
+
// parse lowercases the scheme, consistent with how it already lowercases the host
|
|
8
|
+
t.equal(fastURI.parse('HTTP://EXAMPLE.com/Path').scheme, 'http', 'parse lowercases an uppercase scheme')
|
|
9
|
+
t.equal(fastURI.parse('HtTpS://example.com').scheme, 'https', 'parse lowercases a mixed-case scheme')
|
|
10
|
+
|
|
11
|
+
// normalize emits a lowercase scheme (matches the already-lowercased host)
|
|
12
|
+
t.equal(fastURI.normalize('HTTP://EXAMPLE.com/p'), 'http://example.com/p', 'normalize lowercases the scheme')
|
|
13
|
+
t.equal(fastURI.normalize('HtTp://Example.COM/'), 'http://example.com/', 'normalize lowercases a mixed-case scheme')
|
|
14
|
+
|
|
15
|
+
t.end()
|
|
16
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('parse preserves reserved path escapes as data', (t) => {
|
|
7
|
+
const components = fastURI.parse('http://example.com/a%2Fb/public/%2e%2e/admin')
|
|
8
|
+
|
|
9
|
+
t.equal(components.path, '/a%2Fb/public/%2E%2E/admin')
|
|
10
|
+
t.end()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('normalize preserves percent-encoded path separators and dot segments', (t) => {
|
|
14
|
+
t.equal(
|
|
15
|
+
fastURI.normalize('http://example.com/public/%2e%2e/admin'),
|
|
16
|
+
'http://example.com/public/%2E%2E/admin'
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
t.equal(
|
|
20
|
+
fastURI.normalize('http://example.com/a%2Fb'),
|
|
21
|
+
'http://example.com/a%2Fb'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
t.end()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('equal does not treat reserved path escapes as live path syntax', (t) => {
|
|
28
|
+
t.equal(
|
|
29
|
+
fastURI.equal('http://example.com/public/%2e%2e/admin', 'http://example.com/admin', {}),
|
|
30
|
+
false
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
t.equal(
|
|
34
|
+
fastURI.equal('http://example.com/a%2Fb', 'http://example.com/a/b', {}),
|
|
35
|
+
false
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
t.end()
|
|
39
|
+
})
|
|
Binary file
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('parse marks malformed authority and port inputs as errors', (t) => {
|
|
7
|
+
const malformedCases = [
|
|
8
|
+
{
|
|
9
|
+
input: 'http://[::1]foo',
|
|
10
|
+
expectedError: 'URI path must start with "/" when authority is present.'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
input: 'http://[::1]:80abc/path',
|
|
14
|
+
expectedError: 'URI path must start with "/" when authority is present.'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
input: 'http://example.com:80abc/path',
|
|
18
|
+
expectedError: 'URI path must start with "/" when authority is present.'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
input: 'http://[::1]:65536',
|
|
22
|
+
expectedError: 'URI port is malformed.'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
t.plan(malformedCases.length)
|
|
27
|
+
|
|
28
|
+
malformedCases.forEach(({ input, expectedError }) => {
|
|
29
|
+
t.equal(fastURI.parse(input).error, expectedError, input)
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('normalize does not canonicalize malformed URLs into different valid URLs', (t) => {
|
|
34
|
+
const malformedCases = [
|
|
35
|
+
'http://[::1]foo',
|
|
36
|
+
'http://[::1]:80abc/path',
|
|
37
|
+
'http://example.com:80abc/path',
|
|
38
|
+
'http://[::1]:65536'
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
t.plan(malformedCases.length)
|
|
42
|
+
|
|
43
|
+
malformedCases.forEach((input) => {
|
|
44
|
+
t.equal(fastURI.normalize(input), input, input)
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('equal returns false when either side is malformed', (t) => {
|
|
49
|
+
const malformedPairs = [
|
|
50
|
+
['http://[::1]foo', 'http://[::1]/foo'],
|
|
51
|
+
['http://[::1]:80abc/path', 'http://[::1]/abc/path'],
|
|
52
|
+
['http://example.com:80abc/path', 'http://example.com/abc/path'],
|
|
53
|
+
['http://[::1]:65536', 'http://[::1]:65536/']
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
t.plan(malformedPairs.length)
|
|
57
|
+
|
|
58
|
+
malformedPairs.forEach(([left, right]) => {
|
|
59
|
+
t.equal(fastURI.equal(left, right), false, `${left} != ${right}`)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('normalize preserves encoded authority delimiters in host', (t) => {
|
|
64
|
+
const cases = [
|
|
65
|
+
['http://trusted.com%40evil.com/', 'http://trusted.com%40evil.com/'],
|
|
66
|
+
['http://example.com%3A8080/', 'http://example.com%3A8080/'],
|
|
67
|
+
['http://example.com%2Fevil.com/path', 'http://example.com%2Fevil.com/path'],
|
|
68
|
+
['http://example.com%23fragment/path', 'http://example.com%23fragment/path'],
|
|
69
|
+
['http://example.com%3Fq=evil/path', 'http://example.com%3Fq=evil/path'],
|
|
70
|
+
['http://user%3Apass%40evil.com/', 'http://user%3Apass%40evil.com/'],
|
|
71
|
+
['http://user@trusted.com%40evil.com/', 'http://user@trusted.com%40evil.com/'],
|
|
72
|
+
['https://trusted.com%40evil.com/', 'https://trusted.com%40evil.com/'],
|
|
73
|
+
['ws://trusted.com%40evil.com/chat', 'ws://trusted.com%40evil.com/chat'],
|
|
74
|
+
['wss://trusted.com%40evil.com/chat', 'wss://trusted.com%40evil.com/chat']
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
t.plan(cases.length)
|
|
78
|
+
|
|
79
|
+
cases.forEach(([input, expected]) => {
|
|
80
|
+
t.equal(fastURI.normalize(input), expected, input)
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('parse preserves encoded authority delimiters in host', (t) => {
|
|
85
|
+
const cases = [
|
|
86
|
+
['http://trusted.com%40evil.com/', 'trusted.com%40evil.com'],
|
|
87
|
+
['http://example.com%3A8080/', 'example.com%3A8080'],
|
|
88
|
+
['http://user%3Apass%40evil.com/', 'user%3Apass%40evil.com']
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
t.plan(cases.length)
|
|
92
|
+
|
|
93
|
+
cases.forEach(([input, expectedHost]) => {
|
|
94
|
+
t.equal(fastURI.parse(input).host, expectedHost, input)
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
test('equal returns false when encoded delimiters differ from live delimiters', (t) => {
|
|
99
|
+
const pairs = [
|
|
100
|
+
['http://trusted.com%40evil.com/', 'http://trusted.com@evil.com/'],
|
|
101
|
+
['http://example.com%3A8080/', 'http://example.com:8080/']
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
t.plan(pairs.length)
|
|
105
|
+
|
|
106
|
+
pairs.forEach(([left, right]) => {
|
|
107
|
+
t.equal(fastURI.equal(left, right, {}), false, `${left} != ${right}`)
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('resolve preserves encoded authority delimiters', (t) => {
|
|
112
|
+
const result = fastURI.resolve('http://base.com/', '//trusted.com%40evil.com/path')
|
|
113
|
+
const parsed = fastURI.parse(result)
|
|
114
|
+
|
|
115
|
+
t.plan(1)
|
|
116
|
+
t.notEqual(parsed.host, 'evil.com', '//trusted.com%40evil.com/path')
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
test('serialize escapes authority delimiters in host field', (t) => {
|
|
120
|
+
const result = fastURI.serialize({ scheme: 'http', host: 'trusted.com@evil.com', path: '/' })
|
|
121
|
+
const parsed = fastURI.parse(result)
|
|
122
|
+
|
|
123
|
+
t.plan(1)
|
|
124
|
+
t.notEqual(parsed.host, 'evil.com', 'host: trusted.com@evil.com')
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test('normalize does not double-decode %2540 into a live @', (t) => {
|
|
128
|
+
const result = fastURI.normalize('http://trusted.com%2540evil.com/')
|
|
129
|
+
const parsed = fastURI.parse(result)
|
|
130
|
+
|
|
131
|
+
t.plan(1)
|
|
132
|
+
t.notEqual(parsed.host, 'trusted.com@evil.com', 'http://trusted.com%2540evil.com/')
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
test('parse canonicalises IDN / Unicode hosts to their ASCII form', (t) => {
|
|
136
|
+
const cases = [
|
|
137
|
+
{
|
|
138
|
+
input: 'http://127。0。0。1/',
|
|
139
|
+
expectedHost: '127.0.0.1',
|
|
140
|
+
description: 'full-width ideographic stops as octet separators'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
input: 'http://example.com/',
|
|
144
|
+
expectedHost: 'example.com',
|
|
145
|
+
description: 'fullwidth e as first letter'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
input: 'http://納豆.example.org/',
|
|
149
|
+
expectedHost: 'xn--99zt52a.example.org',
|
|
150
|
+
description: 'CJK label requiring punycode'
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
t.plan(cases.length * 2)
|
|
155
|
+
|
|
156
|
+
cases.forEach(({ input, expectedHost, description }) => {
|
|
157
|
+
const parsed = fastURI.parse(input)
|
|
158
|
+
t.notOk(parsed.error, `parse should not set error: ${description}`)
|
|
159
|
+
t.equal(parsed.host, expectedHost, `host canonicalised to ASCII: ${description}`)
|
|
160
|
+
})
|
|
161
|
+
})
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
6
|
+
test('URI Serialize', (t) => {
|
|
7
|
+
let components = {
|
|
8
|
+
scheme: undefined,
|
|
9
|
+
userinfo: undefined,
|
|
10
|
+
host: undefined,
|
|
11
|
+
port: undefined,
|
|
12
|
+
path: undefined,
|
|
13
|
+
query: undefined,
|
|
14
|
+
fragment: undefined
|
|
15
|
+
}
|
|
16
|
+
t.equal(fastURI.serialize(components), '', 'Undefined Components')
|
|
17
|
+
|
|
18
|
+
components = {
|
|
19
|
+
scheme: '',
|
|
20
|
+
userinfo: '',
|
|
21
|
+
host: '',
|
|
22
|
+
port: 0,
|
|
23
|
+
path: '',
|
|
24
|
+
query: '',
|
|
25
|
+
fragment: ''
|
|
26
|
+
}
|
|
27
|
+
t.equal(fastURI.serialize(components), '//@:0?#', 'Empty Components')
|
|
28
|
+
|
|
29
|
+
components = {
|
|
30
|
+
scheme: 'uri',
|
|
31
|
+
userinfo: 'foo:bar',
|
|
32
|
+
host: 'example.com',
|
|
33
|
+
port: 1,
|
|
34
|
+
path: 'path',
|
|
35
|
+
query: 'query',
|
|
36
|
+
fragment: 'fragment'
|
|
37
|
+
}
|
|
38
|
+
t.equal(fastURI.serialize(components), 'uri://foo:bar@example.com:1/path?query#fragment', 'All Components')
|
|
39
|
+
|
|
40
|
+
components = {
|
|
41
|
+
scheme: 'uri',
|
|
42
|
+
host: 'example.com',
|
|
43
|
+
port: '9000'
|
|
44
|
+
}
|
|
45
|
+
t.equal(fastURI.serialize(components), 'uri://example.com:9000', 'String port')
|
|
46
|
+
|
|
47
|
+
t.equal(fastURI.serialize({ path: '//path' }), '/%2Fpath', 'Double slash path')
|
|
48
|
+
t.equal(fastURI.serialize({ path: 'foo:bar' }), 'foo%3Abar', 'Colon path')
|
|
49
|
+
t.equal(fastURI.serialize({ path: '?query' }), '%3Fquery', 'Query path')
|
|
50
|
+
|
|
51
|
+
t.equal(fastURI.serialize({ host: '10.10.10.10' }), '//10.10.10.10', 'IPv4address')
|
|
52
|
+
|
|
53
|
+
// mixed IPv4address & reg-name, example from terion-name (https://github.com/garycourt/uri-js/issues/4)
|
|
54
|
+
t.equal(fastURI.serialize({ host: '10.10.10.10.example.com' }), '//10.10.10.10.example.com', 'Mixed IPv4address & reg-name')
|
|
55
|
+
|
|
56
|
+
// IPv6address
|
|
57
|
+
t.equal(fastURI.serialize({ host: '2001:db8::7' }), '//[2001:db8::7]', 'IPv6 Host')
|
|
58
|
+
t.equal(fastURI.serialize({ host: '::ffff:129.144.52.38' }), '//[::ffff:129.144.52.38]', 'IPv6 Mixed Host')
|
|
59
|
+
t.equal(fastURI.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' }), '//[2606:2800:220:1:248:1893:25c8:1946]', 'IPv6 Full Host')
|
|
60
|
+
|
|
61
|
+
// IPv6address with zone identifier, RFC 6874
|
|
62
|
+
t.equal(fastURI.serialize({ host: 'fe80::a%en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Unescaped Host')
|
|
63
|
+
t.equal(fastURI.serialize({ host: 'fe80::a%25en1' }), '//[fe80::a%25en1]', 'IPv6 Zone Escaped Host')
|
|
64
|
+
|
|
65
|
+
t.end()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('WS serialize', (t) => {
|
|
69
|
+
t.equal(fastURI.serialize({ scheme: 'ws' }), 'ws:')
|
|
70
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com' }), 'ws://example.com')
|
|
71
|
+
t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/' }), 'ws:')
|
|
72
|
+
t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo' }), 'ws:/foo')
|
|
73
|
+
t.equal(fastURI.serialize({ scheme: 'ws', resourceName: '/foo?bar' }), 'ws:/foo?bar')
|
|
74
|
+
t.equal(fastURI.serialize({ scheme: 'ws', secure: false }), 'ws:')
|
|
75
|
+
t.equal(fastURI.serialize({ scheme: 'ws', secure: true }), 'wss:')
|
|
76
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo' }), 'ws://example.com/foo')
|
|
77
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar' }), 'ws://example.com/foo?bar')
|
|
78
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: false }), 'ws://example.com')
|
|
79
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', secure: true }), 'wss://example.com')
|
|
80
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
|
|
81
|
+
t.equal(fastURI.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
|
|
82
|
+
t.end()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('WSS serialize', (t) => {
|
|
86
|
+
t.equal(fastURI.serialize({ scheme: 'wss' }), 'wss:')
|
|
87
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com' }), 'wss://example.com')
|
|
88
|
+
t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/' }), 'wss:')
|
|
89
|
+
t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo' }), 'wss:/foo')
|
|
90
|
+
t.equal(fastURI.serialize({ scheme: 'wss', resourceName: '/foo?bar' }), 'wss:/foo?bar')
|
|
91
|
+
t.equal(fastURI.serialize({ scheme: 'wss', secure: false }), 'ws:')
|
|
92
|
+
t.equal(fastURI.serialize({ scheme: 'wss', secure: true }), 'wss:')
|
|
93
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo' }), 'wss://example.com/foo')
|
|
94
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar' }), 'wss://example.com/foo?bar')
|
|
95
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: false }), 'ws://example.com')
|
|
96
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', secure: true }), 'wss://example.com')
|
|
97
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: false }), 'ws://example.com/foo?bar')
|
|
98
|
+
t.equal(fastURI.serialize({ scheme: 'wss', host: 'example.com', resourceName: '/foo?bar', secure: true }), 'wss://example.com/foo?bar')
|
|
99
|
+
|
|
100
|
+
t.end()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('URN serialize', (t) => {
|
|
104
|
+
// example from RFC 2141
|
|
105
|
+
const components = {
|
|
106
|
+
scheme: 'urn',
|
|
107
|
+
nid: 'foo',
|
|
108
|
+
nss: 'a123,456'
|
|
109
|
+
}
|
|
110
|
+
t.equal(fastURI.serialize(components), 'urn:foo:a123,456')
|
|
111
|
+
// example from RFC 4122
|
|
112
|
+
let uuidcomponents = {
|
|
113
|
+
scheme: 'urn',
|
|
114
|
+
nid: 'uuid',
|
|
115
|
+
uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
|
|
116
|
+
}
|
|
117
|
+
t.equal(fastURI.serialize(uuidcomponents), 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
|
|
118
|
+
|
|
119
|
+
uuidcomponents = {
|
|
120
|
+
scheme: 'urn',
|
|
121
|
+
nid: 'uuid',
|
|
122
|
+
uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6'
|
|
123
|
+
}
|
|
124
|
+
t.equal(fastURI.serialize(uuidcomponents), 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6')
|
|
125
|
+
|
|
126
|
+
uuidcomponents = {
|
|
127
|
+
scheme: 'urn',
|
|
128
|
+
nid: undefined,
|
|
129
|
+
uuid: 'notauuid-7dec-11d0-a765-00a0c91e6bf6'
|
|
130
|
+
}
|
|
131
|
+
t.throws(() => { fastURI.serialize(uuidcomponents) }, 'URN without nid cannot be serialized')
|
|
132
|
+
|
|
133
|
+
t.end()
|
|
134
|
+
})
|
|
135
|
+
test('URN NID Override', (t) => {
|
|
136
|
+
let components = fastURI.parse('urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', { nid: 'uuid' })
|
|
137
|
+
t.equal(components.error, undefined, 'errors')
|
|
138
|
+
t.equal(components.scheme, 'urn', 'scheme')
|
|
139
|
+
t.equal(components.path, undefined, 'path')
|
|
140
|
+
t.equal(components.nid, 'foo', 'nid')
|
|
141
|
+
t.equal(components.nss, undefined, 'nss')
|
|
142
|
+
t.equal(components.uuid, 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6', 'uuid')
|
|
143
|
+
|
|
144
|
+
components = {
|
|
145
|
+
scheme: 'urn',
|
|
146
|
+
nid: 'foo',
|
|
147
|
+
uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
|
|
148
|
+
}
|
|
149
|
+
t.equal(fastURI.serialize(components, { nid: 'uuid' }), 'urn:foo:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
|
|
150
|
+
t.end()
|
|
151
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('../')
|
|
5
|
+
|
|
6
|
+
const uriJsParseFixtures = require('./fixtures/uri-js-parse.json')
|
|
7
|
+
const uriJsSerializeFixtures = require('./fixtures/uri-js-serialize.json')
|
|
8
|
+
|
|
9
|
+
test('uri-js compatibility Parse', (t) => {
|
|
10
|
+
uriJsParseFixtures.forEach((
|
|
11
|
+
[value, expected]
|
|
12
|
+
) => {
|
|
13
|
+
if (value === '//10.10.000.10') {
|
|
14
|
+
return t.skip('Skipping //10.10.000.10 as it is not a valid URI per URI spec: https://datatracker.ietf.org/doc/html/rfc5954#section-4.1')
|
|
15
|
+
}
|
|
16
|
+
if (value.slice(0, 6) === 'mailto') {
|
|
17
|
+
return t.skip('Skipping mailto schema test as it is not supported by fastifyURI')
|
|
18
|
+
}
|
|
19
|
+
t.same(JSON.parse(JSON.stringify(fastURI.parse(value))), expected, 'Compatibility parse: ' + value)
|
|
20
|
+
})
|
|
21
|
+
t.end()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('uri-js compatibility serialize', (t) => {
|
|
25
|
+
uriJsSerializeFixtures.forEach(([value, expected]) => {
|
|
26
|
+
t.same(
|
|
27
|
+
fastURI.serialize(value),
|
|
28
|
+
expected,
|
|
29
|
+
'Compatibility serialize: ' + JSON.stringify(value)
|
|
30
|
+
)
|
|
31
|
+
})
|
|
32
|
+
t.end()
|
|
33
|
+
})
|