@nocobase/plugin-mcp-server 2.1.0-alpha.10 → 2.1.0-alpha.9

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 (78) hide show
  1. package/build.config.ts +0 -1
  2. package/dist/client/index.js +1 -1
  3. package/dist/externalVersion.js +5 -6
  4. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/http-errors/HISTORY.md +186 -0
  5. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/http-errors/LICENSE +23 -0
  6. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/http-errors/README.md +169 -0
  7. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/http-errors/index.js +290 -0
  8. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/http-errors/package.json +54 -0
  9. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/LICENSE +21 -0
  10. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/README.md +138 -0
  11. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  12. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  13. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/index.js +23 -0
  14. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/internal.js +218 -0
  15. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  16. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  17. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-data.js +178 -0
  18. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  19. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  20. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  21. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  22. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  23. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  24. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  25. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  26. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf16.js +187 -0
  27. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf32.js +307 -0
  28. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf7.js +283 -0
  29. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  30. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  31. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/lib/index.d.ts +129 -0
  32. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/lib/index.js +182 -0
  33. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/lib/streams.js +105 -0
  34. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/package.json +70 -0
  35. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/types/encodings.d.ts +423 -0
  36. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/raw-body/LICENSE +22 -0
  37. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/raw-body/README.md +223 -0
  38. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/raw-body/index.d.ts +85 -0
  39. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/raw-body/index.js +336 -0
  40. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/raw-body/package.json +46 -0
  41. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/statuses/HISTORY.md +87 -0
  42. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/statuses/LICENSE +23 -0
  43. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/statuses/README.md +139 -0
  44. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/statuses/codes.json +65 -0
  45. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/statuses/index.js +146 -0
  46. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/statuses/package.json +49 -0
  47. package/dist/node_modules/light-my-request/package.json +1 -1
  48. package/dist/node_modules/openapi-types/package.json +1 -1
  49. package/dist/server/mcp-server.js +3 -4
  50. package/dist/server/mcp-tools.js +0 -56
  51. package/dist/server/plugin.d.ts +1 -10
  52. package/dist/server/plugin.js +4 -116
  53. package/package.json +2 -3
  54. package/dist/node_modules/fast-uri/.gitattributes +0 -2
  55. package/dist/node_modules/fast-uri/.github/.stale.yml +0 -21
  56. package/dist/node_modules/fast-uri/.github/dependabot.yml +0 -13
  57. package/dist/node_modules/fast-uri/.github/tests_checker.yml +0 -8
  58. package/dist/node_modules/fast-uri/.github/workflows/ci.yml +0 -23
  59. package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +0 -20
  60. package/dist/node_modules/fast-uri/LICENSE +0 -30
  61. package/dist/node_modules/fast-uri/README.md +0 -125
  62. package/dist/node_modules/fast-uri/benchmark.js +0 -105
  63. package/dist/node_modules/fast-uri/index.js +0 -303
  64. package/dist/node_modules/fast-uri/lib/schemes.js +0 -188
  65. package/dist/node_modules/fast-uri/lib/scopedChars.js +0 -30
  66. package/dist/node_modules/fast-uri/lib/utils.js +0 -242
  67. package/dist/node_modules/fast-uri/package.json +0 -39
  68. package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
  69. package/dist/node_modules/fast-uri/test/ajv.test.js +0 -39
  70. package/dist/node_modules/fast-uri/test/compatibility.test.js +0 -131
  71. package/dist/node_modules/fast-uri/test/equal.test.js +0 -103
  72. package/dist/node_modules/fast-uri/test/parse.test.js +0 -318
  73. package/dist/node_modules/fast-uri/test/resolve.test.js +0 -75
  74. package/dist/node_modules/fast-uri/test/serialize.test.js +0 -143
  75. package/dist/node_modules/fast-uri/test/uri-js.test.js +0 -912
  76. package/dist/node_modules/fast-uri/test/util.test.js +0 -23
  77. package/dist/node_modules/fast-uri/types/index.d.ts +0 -53
  78. package/dist/node_modules/fast-uri/types/index.test-d.ts +0 -17
@@ -1,242 +0,0 @@
1
- 'use strict'
2
-
3
- const { HEX } = require('./scopedChars')
4
-
5
- function normalizeIPv4 (host) {
6
- if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
7
- const matches = host.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u) || []
8
- const [address] = matches
9
- if (address) {
10
- return { host: stripLeadingZeros(address, '.'), isIPV4: true }
11
- } else {
12
- return { host, isIPV4: false }
13
- }
14
- }
15
-
16
- /**
17
- * @param {string[]} input
18
- * @param {boolean} [keepZero=false]
19
- * @returns {string|undefined}
20
- */
21
- function stringArrayToHexStripped (input, keepZero = false) {
22
- let acc = ''
23
- let strip = true
24
- for (const c of input) {
25
- if (HEX[c] === undefined) return undefined
26
- if (c !== '0' && strip === true) strip = false
27
- if (!strip) acc += c
28
- }
29
- if (keepZero && acc.length === 0) acc = '0'
30
- return acc
31
- }
32
-
33
- function getIPV6 (input) {
34
- let tokenCount = 0
35
- const output = { error: false, address: '', zone: '' }
36
- const address = []
37
- const buffer = []
38
- let isZone = false
39
- let endipv6Encountered = false
40
- let endIpv6 = false
41
-
42
- function consume () {
43
- if (buffer.length) {
44
- if (isZone === false) {
45
- const hex = stringArrayToHexStripped(buffer)
46
- if (hex !== undefined) {
47
- address.push(hex)
48
- } else {
49
- output.error = true
50
- return false
51
- }
52
- }
53
- buffer.length = 0
54
- }
55
- return true
56
- }
57
-
58
- for (let i = 0; i < input.length; i++) {
59
- const cursor = input[i]
60
- if (cursor === '[' || cursor === ']') { continue }
61
- if (cursor === ':') {
62
- if (endipv6Encountered === true) {
63
- endIpv6 = true
64
- }
65
- if (!consume()) { break }
66
- tokenCount++
67
- address.push(':')
68
- if (tokenCount > 7) {
69
- // not valid
70
- output.error = true
71
- break
72
- }
73
- if (i - 1 >= 0 && input[i - 1] === ':') {
74
- endipv6Encountered = true
75
- }
76
- continue
77
- } else if (cursor === '%') {
78
- if (!consume()) { break }
79
- // switch to zone detection
80
- isZone = true
81
- } else {
82
- buffer.push(cursor)
83
- continue
84
- }
85
- }
86
- if (buffer.length) {
87
- if (isZone) {
88
- output.zone = buffer.join('')
89
- } else if (endIpv6) {
90
- address.push(buffer.join(''))
91
- } else {
92
- address.push(stringArrayToHexStripped(buffer))
93
- }
94
- }
95
- output.address = address.join('')
96
- return output
97
- }
98
-
99
- function normalizeIPv6 (host, opts = {}) {
100
- if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
101
- const ipv6 = getIPV6(host)
102
-
103
- if (!ipv6.error) {
104
- let newHost = ipv6.address
105
- let escapedHost = ipv6.address
106
- if (ipv6.zone) {
107
- newHost += '%' + ipv6.zone
108
- escapedHost += '%25' + ipv6.zone
109
- }
110
- return { host: newHost, escapedHost, isIPV6: true }
111
- } else {
112
- return { host, isIPV6: false }
113
- }
114
- }
115
-
116
- function stripLeadingZeros (str, token) {
117
- let out = ''
118
- let skip = true
119
- const l = str.length
120
- for (let i = 0; i < l; i++) {
121
- const c = str[i]
122
- if (c === '0' && skip) {
123
- if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
124
- out += c
125
- skip = false
126
- }
127
- } else {
128
- if (c === token) {
129
- skip = true
130
- } else {
131
- skip = false
132
- }
133
- out += c
134
- }
135
- }
136
- return out
137
- }
138
-
139
- function findToken (str, token) {
140
- let ind = 0
141
- for (let i = 0; i < str.length; i++) {
142
- if (str[i] === token) ind++
143
- }
144
- return ind
145
- }
146
-
147
- const RDS1 = /^\.\.?\//u
148
- const RDS2 = /^\/\.(?:\/|$)/u
149
- const RDS3 = /^\/\.\.(?:\/|$)/u
150
- const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u
151
-
152
- function removeDotSegments (input) {
153
- const output = []
154
-
155
- while (input.length) {
156
- if (input.match(RDS1)) {
157
- input = input.replace(RDS1, '')
158
- } else if (input.match(RDS2)) {
159
- input = input.replace(RDS2, '/')
160
- } else if (input.match(RDS3)) {
161
- input = input.replace(RDS3, '/')
162
- output.pop()
163
- } else if (input === '.' || input === '..') {
164
- input = ''
165
- } else {
166
- const im = input.match(RDS5)
167
- if (im) {
168
- const s = im[0]
169
- input = input.slice(s.length)
170
- output.push(s)
171
- } else {
172
- throw new Error('Unexpected dot segment condition')
173
- }
174
- }
175
- }
176
- return output.join('')
177
- }
178
-
179
- function normalizeComponentEncoding (components, esc) {
180
- const func = esc !== true ? escape : unescape
181
- if (components.scheme !== undefined) {
182
- components.scheme = func(components.scheme)
183
- }
184
- if (components.userinfo !== undefined) {
185
- components.userinfo = func(components.userinfo)
186
- }
187
- if (components.host !== undefined) {
188
- components.host = func(components.host)
189
- }
190
- if (components.path !== undefined) {
191
- components.path = func(components.path)
192
- }
193
- if (components.query !== undefined) {
194
- components.query = func(components.query)
195
- }
196
- if (components.fragment !== undefined) {
197
- components.fragment = func(components.fragment)
198
- }
199
- return components
200
- }
201
-
202
- function recomposeAuthority (components, options) {
203
- const uriTokens = []
204
-
205
- if (components.userinfo !== undefined) {
206
- uriTokens.push(components.userinfo)
207
- uriTokens.push('@')
208
- }
209
-
210
- if (components.host !== undefined) {
211
- let host = unescape(components.host)
212
- const ipV4res = normalizeIPv4(host)
213
-
214
- if (ipV4res.isIPV4) {
215
- host = ipV4res.host
216
- } else {
217
- const ipV6res = normalizeIPv6(ipV4res.host, { isIPV4: false })
218
- if (ipV6res.isIPV6 === true) {
219
- host = `[${ipV6res.escapedHost}]`
220
- } else {
221
- host = components.host
222
- }
223
- }
224
- uriTokens.push(host)
225
- }
226
-
227
- if (typeof components.port === 'number' || typeof components.port === 'string') {
228
- uriTokens.push(':')
229
- uriTokens.push(String(components.port))
230
- }
231
-
232
- return uriTokens.length ? uriTokens.join('') : undefined
233
- };
234
-
235
- module.exports = {
236
- recomposeAuthority,
237
- normalizeComponentEncoding,
238
- removeDotSegments,
239
- normalizeIPv4,
240
- normalizeIPv6,
241
- stringArrayToHexStripped
242
- }
@@ -1,39 +0,0 @@
1
- {
2
- "name": "fast-uri",
3
- "description": "Dependency free RFC 3986 URI toolbox",
4
- "version": "3.0.3",
5
- "main": "index.js",
6
- "type": "commonjs",
7
- "types": "types/index.d.ts",
8
- "license": "BSD-3-Clause",
9
- "author": "Vincent Le Goff <vince.legoff@gmail.com> (https://github.com/zekth)",
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/fastify/fast-uri.git"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/fastify/fast-uri/issues"
16
- },
17
- "homepage": "https://github.com/fastify/fast-uri",
18
- "scripts": {
19
- "bench": "node benchmark.js",
20
- "lint": "standard | snazzy",
21
- "lint:fix": "standard --fix",
22
- "test": "npm run lint && npm run test:unit && npm run test:typescript",
23
- "test:ci": "npm run lint && npm run test:unit -- --coverage-report=lcovonly && npm run test:typescript",
24
- "test:unit": "npx tape test/**/*.js",
25
- "test:unit:dev": "npm run test:unit -- --coverage-report=html",
26
- "test:typescript": "tsd"
27
- },
28
- "devDependencies": {
29
- "@fastify/pre-commit": "^2.1.0",
30
- "ajv": "^8.16.0",
31
- "benchmark": "^2.1.4",
32
- "coveralls": "^3.1.1",
33
- "snazzy": "^9.0.0",
34
- "standard": "^17.1.0",
35
- "tape": "^5.8.1",
36
- "tsd": "^0.31.0",
37
- "uri-js": "^4.4.1"
38
- }
39
- }
File without changes
@@ -1,39 +0,0 @@
1
- const AJV = require('ajv')
2
- const fastUri = require('../')
3
- const ajv = new AJV({
4
- uriResolver: fastUri // comment this line to see it works with uri-js
5
- })
6
- const test = require('tape')
7
-
8
- test('ajv', t => {
9
- t.plan(1)
10
- const schema = {
11
- $ref: '#/definitions/Record%3Cstring%2CPerson%3E',
12
- definitions: {
13
- Person: {
14
- type: 'object',
15
- properties: {
16
- firstName: {
17
- type: 'string'
18
- }
19
- }
20
- },
21
- 'Record<string,Person>': {
22
- type: 'object',
23
- additionalProperties: {
24
- $ref: '#/definitions/Person'
25
- }
26
- }
27
- }
28
- }
29
-
30
- const data = {
31
- joe: {
32
- firstName: 'Joe'
33
- }
34
-
35
- }
36
-
37
- const validate = ajv.compile(schema)
38
- t.ok(validate(data))
39
- })
@@ -1,131 +0,0 @@
1
- 'use strict'
2
-
3
- const test = require('tape')
4
- const fastifyURI = require('../')
5
- const urijs = require('uri-js')
6
-
7
- test('compatibility Parse', (t) => {
8
- const toParse = [
9
- '//www.g.com/error\n/bleh/bleh',
10
- 'https://fastify.org',
11
- '/definitions/Record%3Cstring%2CPerson%3E',
12
- '//10.10.10.10',
13
- // '//10.10.000.10', <-- not a valid URI per URI spec: https://datatracker.ietf.org/doc/html/rfc5954#section-4.1
14
- '//[2001:db8::7%en0]',
15
- '//[2001:dbZ::1]:80',
16
- '//[2001:db8::1]:80',
17
- '//[2001:db8::001]:80',
18
- 'uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body',
19
- 'http://user:pass@example.com:123/one/space in.url?q1=a1&q2=a2#body',
20
- 'http://User:Pass@example.com:123/one/space in.url?q1=a1&q2=a2#body',
21
- 'http://A%3AB@example.com:123/one/space',
22
- '//[::ffff:129.144.52.38]',
23
- 'uri://10.10.10.10.example.com/en/process',
24
- '//[2606:2800:220:1:248:1893:25c8:1946]/test',
25
- 'ws://example.com/chat',
26
- 'ws://example.com/foo?bar=baz',
27
- 'wss://example.com/?bar=baz',
28
- 'wss://example.com/chat',
29
- 'wss://example.com/foo?bar=baz',
30
- 'wss://example.com/?bar=baz',
31
- 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
32
- 'urn:uuid:notauuid-7dec-11d0-a765-00a0c91e6bf6',
33
- 'urn:example:%D0%B0123,z456',
34
- '//[2606:2800:220:1:248:1893:25c8:1946:43209]',
35
- 'http://foo.bar',
36
- 'http://',
37
- '#/$defs/stringMap',
38
- '#/$defs/string%20Map',
39
- '#/$defs/string Map',
40
- '//?json=%7B%22foo%22%3A%22bar%22%7D'
41
- // 'mailto:chris@example.com'-203845,
42
- // 'mailto:infobot@example.com?subject=current-issue',
43
- // 'mailto:infobot@example.com?body=send%20current-issue',
44
- // 'mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index',
45
- // 'mailto:list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E',
46
- // 'mailto:majordomo@example.com?body=subscribe%20bamboo-l',
47
- // 'mailto:joe@example.com?cc=bob@example.com&body=hello',
48
- // 'mailto:gorby%25kremvax@example.com',
49
- // 'mailto:unlikely%3Faddress@example.com?blat=foop',
50
- // 'mailto:Mike%26family@example.org',
51
- // 'mailto:%22not%40me%22@example.org',
52
- // 'mailto:%22oh%5C%5Cno%22@example.org',
53
- // 'mailto:%22%5C%5C%5C%22it\'s%5C%20ugly%5C%5C%5C%22%22@example.org',
54
- // 'mailto:user@example.org?subject=caf%C3%A9',
55
- // 'mailto:user@example.org?subject=%3D%3Futf-8%3FQ%3Fcaf%3DC3%3DA9%3F%3D',
56
- // 'mailto:user@example.org?subject=%3D%3Fiso-8859-1%3FQ%3Fcaf%3DE9%3F%3D',
57
- // 'mailto:user@example.org?subject=caf%C3%A9&body=caf%C3%A9',
58
- // 'mailto:user@%E7%B4%8D%E8%B1%86.example.org?subject=Test&body=NATTO'
59
- ]
60
- toParse.forEach((x) => {
61
- t.same(fastifyURI.parse(x), urijs.parse(x), 'Compatibility parse: ' + x)
62
- })
63
- t.end()
64
- })
65
-
66
- test('compatibility serialize', (t) => {
67
- const toSerialize = [
68
- { host: '10.10.10.10.example.com' },
69
- { host: '2001:db8::7' },
70
- { host: '::ffff:129.144.52.38' },
71
- { host: '2606:2800:220:1:248:1893:25c8:1946' },
72
- { host: '10.10.10.10.example.com' },
73
- { host: '10.10.10.10' },
74
- { path: '?query' },
75
- { path: 'foo:bar' },
76
- { path: '//path' },
77
- {
78
- scheme: 'uri',
79
- host: 'example.com',
80
- port: '9000'
81
- },
82
- {
83
- scheme: 'uri',
84
- userinfo: 'foo:bar',
85
- host: 'example.com',
86
- port: 1,
87
- path: 'path',
88
- query: 'query',
89
- fragment: 'fragment'
90
- },
91
- {
92
- scheme: '',
93
- userinfo: '',
94
- host: '',
95
- port: 0,
96
- path: '',
97
- query: '',
98
- fragment: ''
99
- },
100
- {
101
- scheme: undefined,
102
- userinfo: undefined,
103
- host: undefined,
104
- port: undefined,
105
- path: undefined,
106
- query: undefined,
107
- fragment: undefined
108
- },
109
- { host: 'fe80::a%en1' },
110
- { host: 'fe80::a%25en1' },
111
- {
112
- scheme: 'ws',
113
- host: 'example.com',
114
- resourceName: '/foo?bar',
115
- secure: true
116
- },
117
- {
118
- scheme: 'scheme',
119
- path: 'with:colon'
120
- }
121
- ]
122
- toSerialize.forEach((x) => {
123
- const r = JSON.stringify(x)
124
- t.same(
125
- fastifyURI.serialize(x),
126
- urijs.serialize(x),
127
- 'Compatibility serialize: ' + JSON.stringify(r)
128
- )
129
- })
130
- t.end()
131
- })
@@ -1,103 +0,0 @@
1
- 'use strict'
2
-
3
- const test = require('tape')
4
- const URI = require('../')
5
-
6
- const fn = URI.equal
7
- const runTest = (t, suite) => {
8
- suite.forEach(s => {
9
- const operator = s.result ? '==' : '!='
10
- t.equal(fn(s.pair[0], s.pair[1]), s.result, `${s.pair[0]} ${operator} ${s.pair[1]}`)
11
- t.equal(fn(s.pair[1], s.pair[0]), s.result, `${s.pair[1]} ${operator} ${s.pair[0]}`)
12
- })
13
- }
14
-
15
- test('URI Equals', (t) => {
16
- const suite = [
17
- { pair: ['example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'], result: true }, // test from RFC 3986
18
- { pair: ['http://example.org/~user', 'http://example.org/%7euser'], result: true } // test from RFC 3987
19
- ]
20
- runTest(t, suite)
21
- t.end()
22
- })
23
-
24
- // test('IRI Equals', (t) => {
25
- // // example from RFC 3987
26
- // t.equal(URI.equal('example://a/b/c/%7Bfoo%7D/ros\xE9', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d/ros%C3%A9', IRI_OPTION), true)
27
- // t.end()
28
- // })
29
-
30
- test('HTTP Equals', (t) => {
31
- const suite = [
32
- // test from RFC 2616
33
- { pair: ['http://abc.com:80/~smith/home.html', 'http://abc.com/~smith/home.html'], result: true },
34
- { pair: [{ scheme: 'http', host: 'abc.com', port: 80, path: '/~smith/home.html' }, 'http://abc.com/~smith/home.html'], result: true },
35
- { pair: ['http://ABC.com/%7Esmith/home.html', 'http://abc.com/~smith/home.html'], result: true },
36
- { pair: ['http://ABC.com:/%7esmith/home.html', 'http://abc.com/~smith/home.html'], result: true },
37
- { pair: ['HTTP://ABC.COM', 'http://abc.com/'], result: true },
38
- // test from RFC 3986
39
- { pair: ['http://example.com:/', 'http://example.com:80/'], result: true }
40
- ]
41
- runTest(t, suite)
42
- t.end()
43
- })
44
-
45
- test('HTTPS Equals', (t) => {
46
- const suite = [
47
- { pair: ['https://example.com', 'https://example.com:443/'], result: true },
48
- { pair: ['https://example.com:/', 'https://example.com:443/'], result: true }
49
- ]
50
- runTest(t, suite)
51
- t.end()
52
- })
53
-
54
- test('URN Equals', (t) => {
55
- const suite = [
56
- // test from RFC 2141
57
- { pair: ['urn:foo:a123,456', 'urn:foo:a123,456'], result: true },
58
- { pair: ['urn:foo:a123,456', 'URN:foo:a123,456'], result: true },
59
- { pair: ['urn:foo:a123,456', 'urn:FOO:a123,456'], result: true }
60
- ]
61
-
62
- // Disabling for now as the whole equal logic might need
63
- // to be refactored
64
- // t.equal(URI.equal('urn:foo:a123,456', 'urn:foo:A123,456'), false)
65
- // t.equal(URI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true)
66
-
67
- runTest(t, suite)
68
- t.end()
69
- })
70
-
71
- test('UUID Equals', (t) => {
72
- const suite = [
73
- { pair: ['URN:UUID:F81D4FAE-7DEC-11D0-A765-00A0C91E6BF6', 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'], result: true }
74
- ]
75
-
76
- runTest(t, suite)
77
- t.end()
78
- })
79
-
80
- // test('Mailto Equals', (t) => {
81
- // // tests from RFC 6068
82
- // t.equal(URI.equal('mailto:addr1@an.example,addr2@an.example', 'mailto:?to=addr1@an.example,addr2@an.example'), true)
83
- // t.equal(URI.equal('mailto:?to=addr1@an.example,addr2@an.example', 'mailto:addr1@an.example?to=addr2@an.example'), true)
84
- // t.end()
85
- // })
86
-
87
- test('WS Equal', (t) => {
88
- const suite = [
89
- { pair: ['WS://ABC.COM:80/chat#one', 'ws://abc.com/chat'], result: true }
90
- ]
91
-
92
- runTest(t, suite)
93
- t.end()
94
- })
95
-
96
- test('WSS Equal', (t) => {
97
- const suite = [
98
- { pair: ['WSS://ABC.COM:443/chat#one', 'wss://abc.com/chat'], result: true }
99
- ]
100
-
101
- runTest(t, suite)
102
- t.end()
103
- })