@mindstone/mcp-server-runway 0.5.0 → 0.6.0
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/README.md +7 -3
- package/dist/auth.js +3 -0
- package/dist/bridge-reader.d.ts +85 -0
- package/dist/bridge-reader.js +125 -0
- package/dist/bridge.d.ts +11 -13
- package/dist/bridge.js +10 -39
- package/dist/client.d.ts +3 -0
- package/dist/client.js +44 -8
- package/dist/file-read-context.d.ts +4 -4
- package/dist/hardened-json-file.d.ts +15 -0
- package/dist/hardened-json-file.js +92 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -4
- package/dist/key-filter.d.ts +40 -0
- package/dist/key-filter.js +95 -0
- package/dist/server.js +12 -1
- package/dist/tools/audio.js +18 -10
- package/dist/tools/configure.d.ts +2 -0
- package/dist/tools/configure.js +34 -31
- package/dist/tools/image.js +31 -12
- package/dist/tools/resold-models.d.ts +65 -0
- package/dist/tools/resold-models.js +178 -0
- package/dist/tools/tasks.js +11 -5
- package/dist/tools/video.js +56 -12
- package/dist/tools/voices.js +3 -2
- package/dist/types.d.ts +18 -4
- package/dist/types.js +30 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +14 -5
- package/node_modules/@hono/node-server/README.md +118 -26
- package/node_modules/@hono/node-server/dist/conninfo.cjs +22 -0
- package/node_modules/@hono/node-server/dist/{conninfo.d.ts → conninfo.d.cts} +4 -3
- package/node_modules/@hono/node-server/dist/conninfo.d.mts +4 -3
- package/node_modules/@hono/node-server/dist/conninfo.mjs +19 -16
- package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +5 -0
- package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +11 -0
- package/node_modules/@hono/node-server/dist/early-hints.cjs +35 -0
- package/node_modules/@hono/node-server/dist/early-hints.d.cts +16 -0
- package/node_modules/@hono/node-server/dist/early-hints.d.mts +16 -0
- package/node_modules/@hono/node-server/dist/early-hints.mjs +33 -0
- package/node_modules/@hono/node-server/dist/index.cjs +1365 -0
- package/node_modules/@hono/node-server/dist/index.d.cts +101 -0
- package/node_modules/@hono/node-server/dist/index.d.mts +101 -8
- package/node_modules/@hono/node-server/dist/index.mjs +1336 -616
- package/node_modules/@hono/node-server/dist/serve-static.cjs +153 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.cts +19 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.mts +15 -13
- package/node_modules/@hono/node-server/dist/serve-static.mjs +145 -145
- package/node_modules/@hono/node-server/dist/utils/response.cjs +8 -0
- package/node_modules/@hono/node-server/dist/utils/response.d.cts +4 -0
- package/node_modules/@hono/node-server/dist/utils/response.d.mts +3 -2
- package/node_modules/@hono/node-server/dist/utils/response.mjs +6 -9
- package/node_modules/@hono/node-server/dist/utils/stream.cjs +65 -0
- package/node_modules/@hono/node-server/dist/utils/stream.d.cts +6 -0
- package/node_modules/@hono/node-server/dist/utils/stream.d.mts +6 -0
- package/node_modules/@hono/node-server/dist/utils/stream.mjs +64 -0
- package/node_modules/@hono/node-server/package.json +80 -55
- package/node_modules/@modelcontextprotocol/sdk/README.md +8 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts +43 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js +26 -5
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts +26 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js +127 -24
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js +1 -12
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js +17 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts +7 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js +9 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +28 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js +11 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js +63 -20
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js +71 -29
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js +45 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js +71 -31
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js +61 -18
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js +64 -17
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts +4 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts +17 -8
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js +31 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js +17 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js +6 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js +1 -12
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts +12 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js +56 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.d.ts +25 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.js +64 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js +17 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +31 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +252 -42
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +25 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts +3 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js +12 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts +32 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js +64 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js +39 -9
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js +10 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts +18 -8
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js +77 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts +43 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js +26 -5
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts +26 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +127 -24
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +2 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js +18 -5
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts +7 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js +9 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +29 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js +11 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js +63 -20
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js +71 -29
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js +45 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js +71 -31
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js +61 -18
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js +64 -17
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts +4 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts +17 -8
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js +31 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js +17 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js +6 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +2 -13
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts +12 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +56 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.d.ts +25 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js +58 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts +9 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +10 -4
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts +31 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +252 -42
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +25 -6
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts +3 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +12 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts +32 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +39 -9
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts +5 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +9 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts +18 -8
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js +72 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/package.json +4 -3
- package/node_modules/body-parser/README.md +33 -14
- package/node_modules/body-parser/index.js +4 -20
- package/node_modules/body-parser/lib/read.js +85 -68
- package/node_modules/body-parser/lib/types/json.js +67 -39
- package/node_modules/body-parser/lib/types/raw.js +3 -3
- package/node_modules/body-parser/lib/types/text.js +3 -3
- package/node_modules/body-parser/lib/types/urlencoded.js +21 -25
- package/node_modules/body-parser/lib/utils.js +14 -27
- package/node_modules/body-parser/node_modules/content-type/LICENSE +22 -0
- package/node_modules/body-parser/node_modules/content-type/README.md +71 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/body-parser/node_modules/content-type/package.json +52 -0
- package/node_modules/body-parser/package.json +24 -16
- package/node_modules/es-object-atoms/CHANGELOG.md +21 -14
- package/node_modules/es-object-atoms/isObject.d.ts +1 -1
- package/node_modules/es-object-atoms/package.json +6 -7
- package/node_modules/es-object-atoms/tsconfig.json +1 -0
- package/node_modules/express-rate-limit/dist/index.cjs +142 -23
- package/node_modules/express-rate-limit/dist/index.d.cts +58 -1
- package/node_modules/express-rate-limit/dist/index.d.mts +58 -1
- package/node_modules/express-rate-limit/dist/index.d.ts +58 -1
- package/node_modules/express-rate-limit/dist/index.mjs +128 -23
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +21 -17
- package/node_modules/express-rate-limit/readme.md +4 -0
- package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
- package/node_modules/fast-uri/README.md +8 -0
- package/node_modules/fast-uri/index.js +355 -50
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +448 -92
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
- package/node_modules/fast-uri/test/equal.test.js +31 -3
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
- package/node_modules/fast-uri/test/host-delimiter-security.test.js +94 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +7 -3
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/relative-normalization-security.test.js +156 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +137 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +163 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +139 -0
- package/node_modules/fast-uri/test/security.test.js +301 -3
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/hono/README.md +2 -3
- package/node_modules/hono/dist/_virtual/_rolldown/runtime.js +13 -0
- package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +42 -23
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +320 -351
- package/node_modules/hono/dist/adapter/aws-lambda/index.js +2 -8
- package/node_modules/hono/dist/adapter/aws-lambda/types.js +1 -0
- package/node_modules/hono/dist/adapter/bun/conninfo.js +20 -25
- package/node_modules/hono/dist/adapter/bun/index.js +3 -13
- package/node_modules/hono/dist/adapter/bun/serve-static.js +27 -27
- package/node_modules/hono/dist/adapter/bun/server.js +11 -5
- package/node_modules/hono/dist/adapter/bun/ssg.js +25 -15
- package/node_modules/hono/dist/adapter/bun/websocket.js +61 -66
- package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +24 -9
- package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +59 -62
- package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +2 -8
- package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +7 -9
- package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +3 -8
- package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +5 -6
- package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +26 -20
- package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +21 -34
- package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +31 -39
- package/node_modules/hono/dist/adapter/deno/conninfo.js +16 -13
- package/node_modules/hono/dist/adapter/deno/deno.d.js +1 -0
- package/node_modules/hono/dist/adapter/deno/index.js +3 -10
- package/node_modules/hono/dist/adapter/deno/serve-static.js +33 -38
- package/node_modules/hono/dist/adapter/deno/ssg.js +27 -16
- package/node_modules/hono/dist/adapter/deno/websocket.js +30 -26
- package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +7 -9
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +102 -71
- package/node_modules/hono/dist/adapter/lambda-edge/index.js +2 -6
- package/node_modules/hono/dist/adapter/netlify/conninfo.js +24 -9
- package/node_modules/hono/dist/adapter/netlify/handler.js +10 -8
- package/node_modules/hono/dist/adapter/netlify/index.js +3 -2
- package/node_modules/hono/dist/adapter/netlify/mod.js +2 -6
- package/node_modules/hono/dist/adapter/service-worker/handler.js +15 -19
- package/node_modules/hono/dist/adapter/service-worker/index.js +23 -7
- package/node_modules/hono/dist/adapter/service-worker/types.js +1 -0
- package/node_modules/hono/dist/adapter/vercel/conninfo.js +7 -10
- package/node_modules/hono/dist/adapter/vercel/handler.js +8 -6
- package/node_modules/hono/dist/adapter/vercel/index.js +2 -6
- package/node_modules/hono/dist/cjs/_virtual/_rolldown/runtime.js +33 -0
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +42 -44
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +328 -380
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +7 -34
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
- package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +21 -47
- package/node_modules/hono/dist/cjs/adapter/bun/index.js +14 -45
- package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +30 -51
- package/node_modules/hono/dist/cjs/adapter/bun/server.js +11 -26
- package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +24 -35
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +63 -89
- package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +25 -31
- package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +61 -85
- package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +7 -34
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +8 -31
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +7 -33
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +7 -29
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +28 -43
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +21 -55
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +33 -62
- package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +16 -34
- package/node_modules/hono/dist/cjs/adapter/deno/index.js +10 -38
- package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +34 -60
- package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
- package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -49
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +8 -31
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +105 -103
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +5 -30
- package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +25 -31
- package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +10 -29
- package/node_modules/hono/dist/cjs/adapter/netlify/index.js +5 -21
- package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +5 -30
- package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +16 -41
- package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +25 -30
- package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
- package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +8 -32
- package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +8 -27
- package/node_modules/hono/dist/cjs/adapter/vercel/index.js +5 -30
- package/node_modules/hono/dist/cjs/client/client.js +140 -190
- package/node_modules/hono/dist/cjs/client/fetch-result-please.js +62 -80
- package/node_modules/hono/dist/cjs/client/index.js +7 -32
- package/node_modules/hono/dist/cjs/client/types.js +0 -15
- package/node_modules/hono/dist/cjs/client/utils.js +54 -89
- package/node_modules/hono/dist/cjs/compose.js +49 -66
- package/node_modules/hono/dist/cjs/context.js +379 -431
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +50 -38
- package/node_modules/hono/dist/cjs/helper/accepts/index.js +3 -27
- package/node_modules/hono/dist/cjs/helper/adapter/index.js +33 -73
- package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
- package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
- package/node_modules/hono/dist/cjs/helper/cookie/index.js +75 -116
- package/node_modules/hono/dist/cjs/helper/css/common.js +167 -241
- package/node_modules/hono/dist/cjs/helper/css/index.js +136 -143
- package/node_modules/hono/dist/cjs/helper/dev/index.js +45 -71
- package/node_modules/hono/dist/cjs/helper/factory/index.js +30 -51
- package/node_modules/hono/dist/cjs/helper/html/index.js +32 -62
- package/node_modules/hono/dist/cjs/helper/proxy/index.js +113 -102
- package/node_modules/hono/dist/cjs/helper/route/index.js +125 -66
- package/node_modules/hono/dist/cjs/helper/ssg/index.js +19 -43
- package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +56 -64
- package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +55 -57
- package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +200 -298
- package/node_modules/hono/dist/cjs/helper/ssg/utils.js +53 -76
- package/node_modules/hono/dist/cjs/helper/streaming/index.js +8 -35
- package/node_modules/hono/dist/cjs/helper/streaming/sse.js +53 -84
- package/node_modules/hono/dist/cjs/helper/streaming/stream.js +23 -53
- package/node_modules/hono/dist/cjs/helper/streaming/text.js +10 -32
- package/node_modules/hono/dist/cjs/helper/streaming/utils.js +13 -32
- package/node_modules/hono/dist/cjs/helper/testing/index.js +16 -31
- package/node_modules/hono/dist/cjs/helper/websocket/index.js +51 -76
- package/node_modules/hono/dist/cjs/hono-base.js +346 -396
- package/node_modules/hono/dist/cjs/hono.js +27 -42
- package/node_modules/hono/dist/cjs/http-exception.js +55 -56
- package/node_modules/hono/dist/cjs/index.js +22 -27
- package/node_modules/hono/dist/cjs/jsx/base.js +264 -359
- package/node_modules/hono/dist/cjs/jsx/children.js +16 -41
- package/node_modules/hono/dist/cjs/jsx/components.js +120 -174
- package/node_modules/hono/dist/cjs/jsx/constants.js +17 -42
- package/node_modules/hono/dist/cjs/jsx/context.js +166 -58
- package/node_modules/hono/dist/cjs/jsx/dom/client.js +49 -69
- package/node_modules/hono/dist/cjs/jsx/dom/components.js +23 -52
- package/node_modules/hono/dist/cjs/jsx/dom/context.js +39 -67
- package/node_modules/hono/dist/cjs/jsx/dom/css.js +143 -158
- package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +55 -64
- package/node_modules/hono/dist/cjs/jsx/dom/index.js +114 -173
- package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +282 -375
- package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +14 -49
- package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +5 -32
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +471 -587
- package/node_modules/hono/dist/cjs/jsx/dom/server.js +37 -60
- package/node_modules/hono/dist/cjs/jsx/dom/utils.js +7 -30
- package/node_modules/hono/dist/cjs/jsx/hooks/index.js +227 -317
- package/node_modules/hono/dist/cjs/jsx/index.js +86 -135
- package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +20 -43
- package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +117 -168
- package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
- package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +14 -39
- package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +29 -67
- package/node_modules/hono/dist/cjs/jsx/streaming.js +123 -165
- package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
- package/node_modules/hono/dist/cjs/jsx/utils.js +91 -175
- package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +98 -86
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +100 -109
- package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +65 -72
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +168 -114
- package/node_modules/hono/dist/cjs/middleware/combine/index.js +135 -95
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +76 -59
- package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +49 -41
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +107 -107
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +103 -74
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +58 -51
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +73 -87
- package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +163 -141
- package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +99 -77
- package/node_modules/hono/dist/cjs/middleware/jwk/index.js +3 -27
- package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +118 -130
- package/node_modules/hono/dist/cjs/middleware/jwt/index.js +9 -38
- package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +120 -136
- package/node_modules/hono/dist/cjs/middleware/language/index.js +7 -35
- package/node_modules/hono/dist/cjs/middleware/language/language.js +184 -197
- package/node_modules/hono/dist/cjs/middleware/logger/index.js +41 -62
- package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +84 -0
- package/node_modules/hono/dist/cjs/middleware/method-override/index.js +101 -100
- package/node_modules/hono/dist/cjs/middleware/mount/index.js +72 -0
- package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +23 -30
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +40 -35
- package/node_modules/hono/dist/cjs/middleware/request-id/index.js +3 -27
- package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +34 -42
- package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +4 -29
- package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
- package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +143 -166
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +58 -93
- package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +15 -38
- package/node_modules/hono/dist/cjs/middleware/timeout/index.js +40 -45
- package/node_modules/hono/dist/cjs/middleware/timing/index.js +7 -35
- package/node_modules/hono/dist/cjs/middleware/timing/timing.js +178 -116
- package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +85 -58
- package/node_modules/hono/dist/cjs/preset/quick.js +18 -37
- package/node_modules/hono/dist/cjs/preset/tiny.js +15 -33
- package/node_modules/hono/dist/cjs/request/constants.js +5 -27
- package/node_modules/hono/dist/cjs/request.js +334 -321
- package/node_modules/hono/dist/cjs/router/linear-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +95 -138
- package/node_modules/hono/dist/cjs/router/pattern-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +41 -69
- package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +7 -34
- package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +18 -45
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +95 -131
- package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +92 -161
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +88 -206
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +83 -80
- package/node_modules/hono/dist/cjs/router/smart-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/smart-router/router.js +49 -79
- package/node_modules/hono/dist/cjs/router/trie-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +134 -200
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +15 -47
- package/node_modules/hono/dist/cjs/router/utils.js +5 -0
- package/node_modules/hono/dist/cjs/router.js +37 -37
- package/node_modules/hono/dist/cjs/types.js +5 -28
- package/node_modules/hono/dist/cjs/utils/accept.js +177 -228
- package/node_modules/hono/dist/cjs/utils/basic-auth.js +16 -40
- package/node_modules/hono/dist/cjs/utils/body.js +89 -89
- package/node_modules/hono/dist/cjs/utils/buffer.js +43 -90
- package/node_modules/hono/dist/cjs/utils/color.js +35 -44
- package/node_modules/hono/dist/cjs/utils/compress.js +12 -27
- package/node_modules/hono/dist/cjs/utils/concurrent.js +29 -59
- package/node_modules/hono/dist/cjs/utils/constants.js +7 -26
- package/node_modules/hono/dist/cjs/utils/cookie.js +108 -177
- package/node_modules/hono/dist/cjs/utils/crypto.js +30 -61
- package/node_modules/hono/dist/cjs/utils/encode.js +31 -48
- package/node_modules/hono/dist/cjs/utils/filepath.js +23 -54
- package/node_modules/hono/dist/cjs/utils/handler.js +11 -33
- package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
- package/node_modules/hono/dist/cjs/utils/html.js +96 -137
- package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +233 -121
- package/node_modules/hono/dist/cjs/utils/jwt/index.js +14 -27
- package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +25 -42
- package/node_modules/hono/dist/cjs/utils/jwt/jws.js +119 -199
- package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +123 -205
- package/node_modules/hono/dist/cjs/utils/jwt/types.js +122 -159
- package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +9 -28
- package/node_modules/hono/dist/cjs/utils/mime.js +75 -103
- package/node_modules/hono/dist/cjs/utils/mount.js +51 -0
- package/node_modules/hono/dist/cjs/utils/stream.js +88 -100
- package/node_modules/hono/dist/cjs/utils/types.js +0 -15
- package/node_modules/hono/dist/cjs/utils/url.js +199 -228
- package/node_modules/hono/dist/cjs/validator/index.js +3 -27
- package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
- package/node_modules/hono/dist/cjs/validator/validator.js +63 -106
- package/node_modules/hono/dist/client/client.js +139 -175
- package/node_modules/hono/dist/client/fetch-result-please.js +59 -56
- package/node_modules/hono/dist/client/index.js +3 -7
- package/node_modules/hono/dist/client/types.js +1 -0
- package/node_modules/hono/dist/client/utils.js +51 -65
- package/node_modules/hono/dist/compose.js +49 -45
- package/node_modules/hono/dist/context.js +376 -407
- package/node_modules/hono/dist/helper/accepts/accepts.js +49 -16
- package/node_modules/hono/dist/helper/accepts/index.js +1 -4
- package/node_modules/hono/dist/helper/adapter/index.js +33 -52
- package/node_modules/hono/dist/helper/conninfo/index.js +1 -0
- package/node_modules/hono/dist/helper/conninfo/types.js +1 -0
- package/node_modules/hono/dist/helper/cookie/index.js +74 -94
- package/node_modules/hono/dist/helper/css/common.js +169 -222
- package/node_modules/hono/dist/helper/css/index.js +132 -129
- package/node_modules/hono/dist/helper/dev/index.js +44 -49
- package/node_modules/hono/dist/helper/factory/index.js +27 -27
- package/node_modules/hono/dist/helper/html/index.js +30 -39
- package/node_modules/hono/dist/helper/proxy/index.js +116 -84
- package/node_modules/hono/dist/helper/route/index.js +123 -43
- package/node_modules/hono/dist/helper/ssg/index.js +3 -18
- package/node_modules/hono/dist/helper/ssg/middleware.js +53 -40
- package/node_modules/hono/dist/helper/ssg/plugins.js +55 -36
- package/node_modules/hono/dist/helper/ssg/ssg.js +200 -283
- package/node_modules/hono/dist/helper/ssg/utils.js +54 -56
- package/node_modules/hono/dist/helper/streaming/index.js +2 -8
- package/node_modules/hono/dist/helper/streaming/sse.js +50 -60
- package/node_modules/hono/dist/helper/streaming/stream.js +22 -31
- package/node_modules/hono/dist/helper/streaming/text.js +9 -10
- package/node_modules/hono/dist/helper/streaming/utils.js +9 -12
- package/node_modules/hono/dist/helper/testing/index.js +16 -10
- package/node_modules/hono/dist/helper/websocket/index.js +49 -53
- package/node_modules/hono/dist/hono-base.js +343 -372
- package/node_modules/hono/dist/hono.js +26 -20
- package/node_modules/hono/dist/http-exception.js +53 -33
- package/node_modules/hono/dist/index.js +19 -4
- package/node_modules/hono/dist/jsx/base.js +252 -326
- package/node_modules/hono/dist/jsx/children.js +16 -20
- package/node_modules/hono/dist/jsx/components.js +119 -152
- package/node_modules/hono/dist/jsx/constants.js +10 -15
- package/node_modules/hono/dist/jsx/context.js +162 -35
- package/node_modules/hono/dist/jsx/dom/client.js +45 -48
- package/node_modules/hono/dist/jsx/dom/components.js +21 -29
- package/node_modules/hono/dist/jsx/dom/context.js +37 -44
- package/node_modules/hono/dist/jsx/dom/css.js +142 -147
- package/node_modules/hono/dist/jsx/dom/hooks/index.js +52 -40
- package/node_modules/hono/dist/jsx/dom/index.js +71 -134
- package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +275 -359
- package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +14 -18
- package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +2 -8
- package/node_modules/hono/dist/jsx/dom/render.js +492 -593
- package/node_modules/hono/dist/jsx/dom/server.js +33 -29
- package/node_modules/hono/dist/jsx/dom/utils.js +6 -8
- package/node_modules/hono/dist/jsx/hooks/index.js +238 -307
- package/node_modules/hono/dist/jsx/index.js +45 -98
- package/node_modules/hono/dist/jsx/intrinsic-element/common.js +20 -22
- package/node_modules/hono/dist/jsx/intrinsic-element/components.js +113 -154
- package/node_modules/hono/dist/jsx/intrinsic-elements.js +1 -0
- package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +12 -16
- package/node_modules/hono/dist/jsx/jsx-runtime.js +25 -42
- package/node_modules/hono/dist/jsx/streaming.js +121 -142
- package/node_modules/hono/dist/jsx/types.js +1 -0
- package/node_modules/hono/dist/jsx/utils.js +105 -168
- package/node_modules/hono/dist/middleware/basic-auth/index.js +96 -63
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +101 -89
- package/node_modules/hono/dist/middleware/body-limit/index.js +65 -51
- package/node_modules/hono/dist/middleware/cache/index.js +169 -94
- package/node_modules/hono/dist/middleware/combine/index.js +134 -73
- package/node_modules/hono/dist/middleware/compress/index.js +76 -39
- package/node_modules/hono/dist/middleware/context-storage/index.js +49 -19
- package/node_modules/hono/dist/middleware/cors/index.js +107 -86
- package/node_modules/hono/dist/middleware/csrf/index.js +103 -53
- package/node_modules/hono/dist/middleware/etag/digest.js +59 -31
- package/node_modules/hono/dist/middleware/etag/index.js +73 -66
- package/node_modules/hono/dist/middleware/ip-restriction/index.js +163 -127
- package/node_modules/hono/dist/middleware/jsx-renderer/index.js +97 -54
- package/node_modules/hono/dist/middleware/jwk/index.js +1 -4
- package/node_modules/hono/dist/middleware/jwk/jwk.js +116 -107
- package/node_modules/hono/dist/middleware/jwt/index.js +2 -10
- package/node_modules/hono/dist/middleware/jwt/jwt.js +114 -109
- package/node_modules/hono/dist/middleware/language/index.js +2 -15
- package/node_modules/hono/dist/middleware/language/language.js +180 -172
- package/node_modules/hono/dist/middleware/logger/index.js +43 -37
- package/node_modules/hono/dist/middleware/method-not-allowed/index.js +83 -0
- package/node_modules/hono/dist/middleware/method-override/index.js +101 -79
- package/node_modules/hono/dist/middleware/mount/index.js +71 -0
- package/node_modules/hono/dist/middleware/powered-by/index.js +23 -9
- package/node_modules/hono/dist/middleware/pretty-json/index.js +40 -14
- package/node_modules/hono/dist/middleware/request-id/index.js +1 -4
- package/node_modules/hono/dist/middleware/request-id/request-id.js +33 -20
- package/node_modules/hono/dist/middleware/secure-headers/index.js +1 -5
- package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +1 -0
- package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +145 -147
- package/node_modules/hono/dist/middleware/serve-static/index.js +58 -72
- package/node_modules/hono/dist/middleware/serve-static/path.js +15 -17
- package/node_modules/hono/dist/middleware/timeout/index.js +40 -23
- package/node_modules/hono/dist/middleware/timing/index.js +2 -9
- package/node_modules/hono/dist/middleware/timing/timing.js +178 -95
- package/node_modules/hono/dist/middleware/trailing-slash/index.js +85 -37
- package/node_modules/hono/dist/preset/quick.js +17 -15
- package/node_modules/hono/dist/preset/tiny.js +14 -11
- package/node_modules/hono/dist/request/constants.js +4 -5
- package/node_modules/hono/dist/request.js +329 -295
- package/node_modules/hono/dist/router/linear-router/index.js +1 -4
- package/node_modules/hono/dist/router/linear-router/router.js +93 -115
- package/node_modules/hono/dist/router/pattern-router/index.js +1 -4
- package/node_modules/hono/dist/router/pattern-router/router.js +39 -46
- package/node_modules/hono/dist/router/reg-exp-router/index.js +1 -7
- package/node_modules/hono/dist/router/reg-exp-router/matcher.js +17 -23
- package/node_modules/hono/dist/router/reg-exp-router/node.js +90 -108
- package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +89 -137
- package/node_modules/hono/dist/router/reg-exp-router/router.js +82 -183
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +80 -56
- package/node_modules/hono/dist/router/smart-router/index.js +1 -4
- package/node_modules/hono/dist/router/smart-router/router.js +46 -55
- package/node_modules/hono/dist/router/trie-router/index.js +1 -4
- package/node_modules/hono/dist/router/trie-router/node.js +132 -177
- package/node_modules/hono/dist/router/trie-router/router.js +11 -22
- package/node_modules/hono/dist/router/utils.js +4 -0
- package/node_modules/hono/dist/router.js +35 -14
- package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +150 -104
- package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +4 -8
- package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +152 -113
- package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/bun/index.d.ts +6 -10
- package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +8 -3
- package/node_modules/hono/dist/types/adapter/bun/server.d.ts +4 -5
- package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +5 -1
- package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +31 -16
- package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +29 -17
- package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +3 -7
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +4 -7
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +5 -2
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +11 -6
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +10 -2
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/deno/deno.d.ts +1 -0
- package/node_modules/hono/dist/types/adapter/deno/index.d.ts +5 -8
- package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +8 -3
- package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +5 -1
- package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +84 -58
- package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +3 -7
- package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +3 -5
- package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +3 -2
- package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +9 -7
- package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +7 -9
- package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -7
- package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +3 -6
- package/node_modules/hono/dist/types/client/client.d.ts +5 -3
- package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +21 -19
- package/node_modules/hono/dist/types/client/index.d.ts +5 -7
- package/node_modules/hono/dist/types/client/types.d.ts +135 -160
- package/node_modules/hono/dist/types/client/utils.d.ts +6 -4
- package/node_modules/hono/dist/types/compose.d.ts +4 -2
- package/node_modules/hono/dist/types/context.d.ts +335 -331
- package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +11 -9
- package/node_modules/hono/dist/types/helper/accepts/index.d.ts +2 -5
- package/node_modules/hono/dist/types/helper/adapter/index.d.ts +4 -6
- package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +2 -5
- package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +25 -23
- package/node_modules/hono/dist/types/helper/cookie/index.d.ts +10 -12
- package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -9
- package/node_modules/hono/dist/types/helper/css/index.d.ts +26 -28
- package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -12
- package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -73
- package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
- package/node_modules/hono/dist/types/helper/proxy/index.d.ts +20 -22
- package/node_modules/hono/dist/types/helper/route/index.d.ts +6 -4
- package/node_modules/hono/dist/types/helper/ssg/index.d.ts +4 -7
- package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +8 -6
- package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +3 -1
- package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +44 -37
- package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +5 -3
- package/node_modules/hono/dist/types/helper/streaming/index.d.ts +4 -8
- package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +10 -8
- package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +4 -2
- package/node_modules/hono/dist/types/helper/streaming/text.d.ts +4 -2
- package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/helper/testing/index.d.ts +8 -9
- package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
- package/node_modules/hono/dist/types/hono-base.d.ts +225 -210
- package/node_modules/hono/dist/types/hono.d.ts +11 -10
- package/node_modules/hono/dist/types/http-exception.d.ts +20 -22
- package/node_modules/hono/dist/types/index.d.ts +6 -36
- package/node_modules/hono/dist/types/jsx/base.d.ts +45 -38
- package/node_modules/hono/dist/types/jsx/children.d.ts +8 -6
- package/node_modules/hono/dist/types/jsx/components.d.ts +8 -5
- package/node_modules/hono/dist/types/jsx/constants.d.ts +3 -0
- package/node_modules/hono/dist/types/jsx/context.d.ts +48 -6
- package/node_modules/hono/dist/types/jsx/dom/client.d.ts +9 -10
- package/node_modules/hono/dist/types/jsx/dom/components.d.ts +9 -6
- package/node_modules/hono/dist/types/jsx/dom/context.d.ts +3 -1
- package/node_modules/hono/dist/types/jsx/dom/css.d.ts +27 -30
- package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -12
- package/node_modules/hono/dist/types/jsx/dom/index.d.ts +79 -83
- package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +10 -6
- package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +4 -6
- package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +3 -7
- package/node_modules/hono/dist/types/jsx/dom/render.d.ts +32 -50
- package/node_modules/hono/dist/types/jsx/dom/server.d.ts +87 -85
- package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +22 -20
- package/node_modules/hono/dist/types/jsx/index.d.ts +71 -73
- package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +3 -1
- package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +7 -4
- package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +708 -708
- package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +4 -7
- package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +8 -10
- package/node_modules/hono/dist/types/jsx/streaming.d.ts +10 -10
- package/node_modules/hono/dist/types/jsx/types.d.ts +12 -13
- package/node_modules/hono/dist/types/jsx/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +17 -19
- package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +52 -52
- package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/cache/index.d.ts +18 -18
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +8 -8
- package/node_modules/hono/dist/types/middleware/compress/index.d.ts +17 -7
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/cors/index.d.ts +11 -13
- package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/etag/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -12
- package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +13 -13
- package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +2 -1
- package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +21 -22
- package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +7 -6
- package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +29 -29
- package/node_modules/hono/dist/types/middleware/language/index.d.ts +6 -5
- package/node_modules/hono/dist/types/middleware/language/language.d.ts +60 -44
- package/node_modules/hono/dist/types/middleware/logger/index.d.ts +3 -5
- package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +47 -0
- package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -16
- package/node_modules/hono/dist/types/middleware/mount/index.d.ts +48 -0
- package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -10
- package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -20
- package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +6 -5
- package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +9 -11
- package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +6 -6
- package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +5 -3
- package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -57
- package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +24 -24
- package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +5 -7
- package/node_modules/hono/dist/types/middleware/timing/index.d.ts +6 -5
- package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -20
- package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -37
- package/node_modules/hono/dist/types/preset/quick.d.ts +6 -9
- package/node_modules/hono/dist/types/preset/tiny.d.ts +6 -9
- package/node_modules/hono/dist/types/request/constants.d.ts +2 -0
- package/node_modules/hono/dist/types/request.d.ts +288 -273
- package/node_modules/hono/dist/types/router/linear-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/linear-router/router.d.ts +7 -5
- package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +7 -5
- package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +3 -6
- package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +3 -1
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +9 -4
- package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +11 -10
- package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +10 -9
- package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +7 -4
- package/node_modules/hono/dist/types/router/smart-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/smart-router/router.d.ts +11 -9
- package/node_modules/hono/dist/types/router/trie-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/trie-router/node.d.ts +6 -5
- package/node_modules/hono/dist/types/router/trie-router/router.d.ts +7 -6
- package/node_modules/hono/dist/types/router/utils.d.ts +3 -0
- package/node_modules/hono/dist/types/router.d.ts +24 -23
- package/node_modules/hono/dist/types/types.d.ts +146 -505
- package/node_modules/hono/dist/types/utils/accept.d.ts +5 -3
- package/node_modules/hono/dist/types/utils/basic-auth.d.ts +4 -2
- package/node_modules/hono/dist/types/utils/body.d.ts +46 -50
- package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -5
- package/node_modules/hono/dist/types/utils/color.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/compress.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/concurrent.d.ts +6 -4
- package/node_modules/hono/dist/types/utils/constants.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/cookie.d.ts +21 -19
- package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -7
- package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -3
- package/node_modules/hono/dist/types/utils/handler.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/headers.d.ts +4 -2
- package/node_modules/hono/dist/types/utils/html.d.ts +11 -9
- package/node_modules/hono/dist/types/utils/http-status.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/ipaddr.d.ts +7 -5
- package/node_modules/hono/dist/types/utils/jwt/index.d.ts +18 -12
- package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +15 -13
- package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +4 -7
- package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +26 -29
- package/node_modules/hono/dist/types/utils/jwt/types.d.ts +48 -45
- package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/mime.d.ts +60 -57
- package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
- package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
- package/node_modules/hono/dist/types/utils/types.d.ts +15 -27
- package/node_modules/hono/dist/types/utils/url.d.ts +7 -0
- package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
- package/node_modules/hono/dist/types/validator/utils.d.ts +6 -8
- package/node_modules/hono/dist/types/validator/validator.d.ts +11 -9
- package/node_modules/hono/dist/types.js +4 -6
- package/node_modules/hono/dist/utils/accept.js +185 -215
- package/node_modules/hono/dist/utils/basic-auth.js +18 -21
- package/node_modules/hono/dist/utils/body.js +88 -67
- package/node_modules/hono/dist/utils/buffer.js +44 -70
- package/node_modules/hono/dist/utils/color.js +33 -21
- package/node_modules/hono/dist/utils/compress.js +11 -5
- package/node_modules/hono/dist/utils/concurrent.js +29 -38
- package/node_modules/hono/dist/utils/constants.js +7 -5
- package/node_modules/hono/dist/utils/cookie.js +115 -163
- package/node_modules/hono/dist/utils/crypto.js +30 -40
- package/node_modules/hono/dist/utils/encode.js +30 -26
- package/node_modules/hono/dist/utils/filepath.js +23 -33
- package/node_modules/hono/dist/utils/handler.js +10 -11
- package/node_modules/hono/dist/utils/headers.js +1 -0
- package/node_modules/hono/dist/utils/html.js +97 -117
- package/node_modules/hono/dist/utils/http-status.js +1 -0
- package/node_modules/hono/dist/utils/ipaddr.js +231 -99
- package/node_modules/hono/dist/utils/jwt/index.js +12 -4
- package/node_modules/hono/dist/utils/jwt/jwa.js +24 -20
- package/node_modules/hono/dist/utils/jwt/jws.js +115 -174
- package/node_modules/hono/dist/utils/jwt/jwt.js +121 -197
- package/node_modules/hono/dist/utils/jwt/types.js +79 -95
- package/node_modules/hono/dist/utils/jwt/utf8.js +9 -7
- package/node_modules/hono/dist/utils/mime.js +74 -81
- package/node_modules/hono/dist/utils/mount.js +50 -0
- package/node_modules/hono/dist/utils/stream.js +86 -77
- package/node_modules/hono/dist/utils/types.js +1 -0
- package/node_modules/hono/dist/utils/url.js +199 -208
- package/node_modules/hono/dist/validator/index.js +1 -4
- package/node_modules/hono/dist/validator/utils.js +1 -0
- package/node_modules/hono/dist/validator/validator.js +61 -83
- package/node_modules/hono/package.json +69 -47
- package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/ip-address/README.md +173 -143
- package/node_modules/ip-address/dist/address-error.d.ts +11 -0
- package/node_modules/ip-address/dist/address-error.js.map +1 -1
- package/node_modules/ip-address/dist/common.d.ts +54 -0
- package/node_modules/ip-address/dist/common.js +93 -6
- package/node_modules/ip-address/dist/common.js.map +1 -1
- package/node_modules/ip-address/dist/ipv4.d.ts +88 -8
- package/node_modules/ip-address/dist/ipv4.js +146 -29
- package/node_modules/ip-address/dist/ipv4.js.map +1 -1
- package/node_modules/ip-address/dist/ipv6.d.ts +156 -11
- package/node_modules/ip-address/dist/ipv6.js +340 -96
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
- package/node_modules/ip-address/dist/v4/constants.js +45 -2
- package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
- package/node_modules/ip-address/dist/v6/constants.d.ts +17 -0
- package/node_modules/ip-address/dist/v6/constants.js +53 -3
- package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
- package/node_modules/ip-address/package.json +8 -5
- package/node_modules/proxy-addr/HISTORY.md +60 -54
- package/node_modules/proxy-addr/README.md +1 -1
- package/node_modules/proxy-addr/index.js +32 -0
- package/node_modules/proxy-addr/package.json +8 -4
- package/node_modules/qs/.editorconfig +1 -1
- package/node_modules/qs/.github/THREAT_MODEL.md +6 -4
- package/node_modules/qs/CHANGELOG.md +125 -0
- package/node_modules/qs/README.md +108 -9
- package/node_modules/qs/dist/qs.js +27 -27
- package/node_modules/qs/eslint.config.mjs +61 -49
- package/node_modules/qs/lib/formats.js +7 -2
- package/node_modules/qs/lib/parse.js +188 -39
- package/node_modules/qs/lib/stringify.js +42 -18
- package/node_modules/qs/lib/utils.js +213 -24
- package/node_modules/qs/package.json +11 -10
- package/node_modules/qs/test/parse.js +977 -2
- package/node_modules/qs/test/stringify.js +898 -0
- package/node_modules/qs/test/utils.js +450 -2
- package/node_modules/side-channel/CHANGELOG.md +10 -0
- package/node_modules/side-channel/README.md +1 -1
- package/node_modules/side-channel/index.js +5 -2
- package/node_modules/side-channel/package.json +10 -10
- package/node_modules/side-channel/test/index.js +16 -0
- package/node_modules/type-is/index.js +8 -18
- package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
- package/node_modules/type-is/node_modules/content-type/README.md +71 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +46 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/type-is/node_modules/content-type/package.json +52 -0
- package/node_modules/type-is/package.json +9 -5
- package/package.json +1 -1
- package/node_modules/@hono/node-server/dist/conninfo.js +0 -42
- package/node_modules/@hono/node-server/dist/globals.d.mts +0 -2
- package/node_modules/@hono/node-server/dist/globals.d.ts +0 -2
- package/node_modules/@hono/node-server/dist/globals.js +0 -29
- package/node_modules/@hono/node-server/dist/globals.mjs +0 -5
- package/node_modules/@hono/node-server/dist/index.d.ts +0 -8
- package/node_modules/@hono/node-server/dist/index.js +0 -680
- package/node_modules/@hono/node-server/dist/listener.d.mts +0 -13
- package/node_modules/@hono/node-server/dist/listener.d.ts +0 -13
- package/node_modules/@hono/node-server/dist/listener.js +0 -648
- package/node_modules/@hono/node-server/dist/listener.mjs +0 -613
- package/node_modules/@hono/node-server/dist/request.d.mts +0 -25
- package/node_modules/@hono/node-server/dist/request.d.ts +0 -25
- package/node_modules/@hono/node-server/dist/request.js +0 -227
- package/node_modules/@hono/node-server/dist/request.mjs +0 -195
- package/node_modules/@hono/node-server/dist/response.d.mts +0 -26
- package/node_modules/@hono/node-server/dist/response.d.ts +0 -26
- package/node_modules/@hono/node-server/dist/response.js +0 -101
- package/node_modules/@hono/node-server/dist/response.mjs +0 -74
- package/node_modules/@hono/node-server/dist/serve-static.d.ts +0 -17
- package/node_modules/@hono/node-server/dist/serve-static.js +0 -177
- package/node_modules/@hono/node-server/dist/server.d.mts +0 -10
- package/node_modules/@hono/node-server/dist/server.d.ts +0 -10
- package/node_modules/@hono/node-server/dist/server.js +0 -674
- package/node_modules/@hono/node-server/dist/server.mjs +0 -638
- package/node_modules/@hono/node-server/dist/types.d.mts +0 -44
- package/node_modules/@hono/node-server/dist/types.d.ts +0 -44
- package/node_modules/@hono/node-server/dist/types.js +0 -18
- package/node_modules/@hono/node-server/dist/types.mjs +0 -0
- package/node_modules/@hono/node-server/dist/utils/response/constants.d.mts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response/constants.d.ts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response/constants.js +0 -30
- package/node_modules/@hono/node-server/dist/utils/response/constants.mjs +0 -5
- package/node_modules/@hono/node-server/dist/utils/response.d.ts +0 -3
- package/node_modules/@hono/node-server/dist/utils/response.js +0 -37
- package/node_modules/@hono/node-server/dist/utils.d.mts +0 -9
- package/node_modules/@hono/node-server/dist/utils.d.ts +0 -9
- package/node_modules/@hono/node-server/dist/utils.js +0 -99
- package/node_modules/@hono/node-server/dist/utils.mjs +0 -71
- package/node_modules/@hono/node-server/dist/vercel.d.mts +0 -7
- package/node_modules/@hono/node-server/dist/vercel.d.ts +0 -7
- package/node_modules/@hono/node-server/dist/vercel.js +0 -655
- package/node_modules/@hono/node-server/dist/vercel.mjs +0 -618
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -5,6 +5,7 @@ var qs = require('../');
|
|
|
5
5
|
var utils = require('../lib/utils');
|
|
6
6
|
var iconv = require('iconv-lite');
|
|
7
7
|
var SaferBuffer = require('safer-buffer').Buffer;
|
|
8
|
+
var url = require('url');
|
|
8
9
|
var hasSymbols = require('has-symbols');
|
|
9
10
|
var mockProperty = require('mock-property');
|
|
10
11
|
var emptyTestCases = require('./empty-keys-cases').emptyTestCases;
|
|
@@ -24,6 +25,28 @@ test('stringify()', function (t) {
|
|
|
24
25
|
st.end();
|
|
25
26
|
});
|
|
26
27
|
|
|
28
|
+
t.test('stringifies lone surrogates as U+FFFD', function (st) {
|
|
29
|
+
st.equal(qs.stringify({ a: '\uD800x' }), 'a=%EF%BF%BDx', 'lone high surrogate does not swallow the next character');
|
|
30
|
+
st.equal(qs.stringify({ a: '\uDC00x' }), 'a=%EF%BF%BDx', 'lone low surrogate does not swallow the next character');
|
|
31
|
+
st.equal(qs.stringify({ '\uD800': 'b' }), '%EF%BF%BD=b', 'lone surrogate in a key');
|
|
32
|
+
st.deepEqual(qs.parse(qs.stringify({ a: 'x\uD800y' })), { a: 'x\uFFFDy' }, 'parses back with U+FFFD in place of the lone surrogate');
|
|
33
|
+
st.equal(qs.stringify({ '\uDC00': 'b' }), '%EF%BF%BD=b', 'lone low surrogate in a key');
|
|
34
|
+
st.equal(qs.stringify({ a: { 'b\uD800': 'c' } }), 'a%5Bb%EF%BF%BD%5D=c', 'lone surrogate in a nested key does not swallow the closing bracket');
|
|
35
|
+
st.equal(qs.stringify({ a: '\uD800 x' }, { format: 'RFC1738' }), 'a=%EF%BF%BD+x', 'lone surrogate does not swallow a space in RFC1738');
|
|
36
|
+
st.equal(
|
|
37
|
+
qs.stringify({ 'a\uD800': { b: 'c' } }, { allowDots: true, encodeDotInKeys: true }),
|
|
38
|
+
'a%EF%BF%BD.b=c',
|
|
39
|
+
'lone surrogate does not swallow a dot separator'
|
|
40
|
+
);
|
|
41
|
+
st.equal(qs.stringify({ a: ['x\uD800', 'y'] }, { arrayFormat: 'comma' }), 'a=x%EF%BF%BD%2Cy', 'lone surrogate does not swallow a comma');
|
|
42
|
+
st.equal(
|
|
43
|
+
qs.stringify({ a: ['x\uD800', 'y'] }, { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
44
|
+
'a=x%EF%BF%BD,y',
|
|
45
|
+
'lone surrogate at the end of a comma-joined element encodes as U+FFFD'
|
|
46
|
+
);
|
|
47
|
+
st.end();
|
|
48
|
+
});
|
|
49
|
+
|
|
27
50
|
t.test('stringifies falsy values', function (st) {
|
|
28
51
|
st.equal(qs.stringify(undefined), '');
|
|
29
52
|
st.equal(qs.stringify(null), '');
|
|
@@ -136,6 +159,175 @@ test('stringify()', function (t) {
|
|
|
136
159
|
st.end();
|
|
137
160
|
});
|
|
138
161
|
|
|
162
|
+
t.test('encodes dot in key of object with a primitive value when encodeDotInKeys and allowDots is provided', function (st) {
|
|
163
|
+
st.equal(
|
|
164
|
+
qs.stringify(
|
|
165
|
+
{ 'name.obj': 'John' },
|
|
166
|
+
{ allowDots: true, encodeDotInKeys: true }
|
|
167
|
+
),
|
|
168
|
+
'name%252Eobj=John',
|
|
169
|
+
'with allowDots true and encodeDotInKeys true'
|
|
170
|
+
);
|
|
171
|
+
st.equal(
|
|
172
|
+
qs.stringify(
|
|
173
|
+
{ 'name.obj': 'John' },
|
|
174
|
+
{ allowDots: false, encodeDotInKeys: true }
|
|
175
|
+
),
|
|
176
|
+
'name%252Eobj=John',
|
|
177
|
+
'with allowDots false and encodeDotInKeys true'
|
|
178
|
+
);
|
|
179
|
+
st.equal(
|
|
180
|
+
qs.stringify(
|
|
181
|
+
{ 'name.obj': 'John' },
|
|
182
|
+
{ encodeDotInKeys: true, allowDots: true, encodeValuesOnly: true }
|
|
183
|
+
),
|
|
184
|
+
'name%2Eobj=John',
|
|
185
|
+
'with encodeValuesOnly true'
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
// With `encodeValuesOnly` the key encoder is skipped, so the dot is encoded once
|
|
189
|
+
// (`%2E`) rather than twice. That single `%2E` decodes back to a structural dot, so
|
|
190
|
+
// unlike the default output below this does not round-trip to the original dotted key
|
|
191
|
+
// (a pre-existing `encodeValuesOnly` + `encodeDotInKeys` limitation, not new here).
|
|
192
|
+
st.deepEqual(
|
|
193
|
+
qs.parse(
|
|
194
|
+
qs.stringify(
|
|
195
|
+
{ 'name.obj': 'John' },
|
|
196
|
+
{ encodeDotInKeys: true, allowDots: true, encodeValuesOnly: true }
|
|
197
|
+
),
|
|
198
|
+
{ allowDots: true, decodeDotInKeys: true }
|
|
199
|
+
),
|
|
200
|
+
{ name: { obj: 'John' } },
|
|
201
|
+
'with encodeValuesOnly the single-encoded dot decodes structurally (does not round-trip)'
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
st.deepEqual(
|
|
205
|
+
qs.parse(
|
|
206
|
+
qs.stringify({ 'name.obj': 'John' }, { allowDots: true, encodeDotInKeys: true }),
|
|
207
|
+
{ allowDots: true, decodeDotInKeys: true }
|
|
208
|
+
),
|
|
209
|
+
{ 'name.obj': 'John' },
|
|
210
|
+
'round-trips a dotted key with a primitive value'
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
st.equal(
|
|
214
|
+
qs.stringify({ 'a.b': null }, { allowDots: true, encodeDotInKeys: true, strictNullHandling: true }),
|
|
215
|
+
'a%252Eb',
|
|
216
|
+
'encodes a dotted key with a null value'
|
|
217
|
+
);
|
|
218
|
+
st.equal(
|
|
219
|
+
qs.stringify({ 'a.b': '1', 'c.d': '2' }, { allowDots: true, encodeDotInKeys: true }),
|
|
220
|
+
'a%252Eb=1&c%252Ed=2',
|
|
221
|
+
'encodes dots in every top-level key, not just the first'
|
|
222
|
+
);
|
|
223
|
+
st.equal(
|
|
224
|
+
qs.stringify({ 'a.b.c': 'x' }, { allowDots: true, encodeDotInKeys: true }),
|
|
225
|
+
'a%252Eb%252Ec=x',
|
|
226
|
+
'encodes every dot in a key'
|
|
227
|
+
);
|
|
228
|
+
var primitiveKey = qs.stringify({ 'a.b': 'c' }, { allowDots: true, encodeDotInKeys: true }).split('=')[0];
|
|
229
|
+
st.equal(
|
|
230
|
+
qs.stringify({ 'a.b': { x: 'c' } }, { allowDots: true, encodeDotInKeys: true }).indexOf(primitiveKey + '.'),
|
|
231
|
+
0,
|
|
232
|
+
'a top-level dotted key encodes identically for primitive and object values'
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
st.end();
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
t.test('does not encode the structural separator dots between nested keys when encodeDotInKeys and allowDots are provided', function (st) {
|
|
239
|
+
st.equal(
|
|
240
|
+
qs.stringify(
|
|
241
|
+
{ a: { b: { c: 'd' } } },
|
|
242
|
+
{ allowDots: true, encodeDotInKeys: true }
|
|
243
|
+
),
|
|
244
|
+
'a.b.c=d',
|
|
245
|
+
'no key contains a literal dot, so encodeDotInKeys is a no-op on the separators'
|
|
246
|
+
);
|
|
247
|
+
st.equal(
|
|
248
|
+
qs.stringify(
|
|
249
|
+
{ a: { b: { c: { d: 'e' } } } },
|
|
250
|
+
{ allowDots: true, encodeDotInKeys: true }
|
|
251
|
+
),
|
|
252
|
+
'a.b.c.d=e',
|
|
253
|
+
'every nesting separator is preserved, not just the last one'
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
st.deepEqual(
|
|
257
|
+
qs.parse(
|
|
258
|
+
qs.stringify({ a: { b: { c: 'd' } } }, { allowDots: true, encodeDotInKeys: true }),
|
|
259
|
+
{ allowDots: true, decodeDotInKeys: true }
|
|
260
|
+
),
|
|
261
|
+
{ a: { b: { c: 'd' } } },
|
|
262
|
+
'stringify -> parse round-trips a deeply nested object'
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
st.end();
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
t.test('encodeDotInKeys encodes only literal dots inside nested keys, never the structural separators, at any depth', function (st) {
|
|
269
|
+
st.equal(
|
|
270
|
+
qs.stringify({ a: { 'b.c': { d: 'e' } } }, { allowDots: true, encodeDotInKeys: true }),
|
|
271
|
+
'a.b%252Ec.d=e',
|
|
272
|
+
'a nested key with a literal dot and an object value encodes only its own dot'
|
|
273
|
+
);
|
|
274
|
+
st.equal(
|
|
275
|
+
qs.stringify({ 'a.b': { c: { d: 'e' } } }, { allowDots: true, encodeDotInKeys: true }),
|
|
276
|
+
'a%252Eb.c.d=e',
|
|
277
|
+
'a top-level dotted key stays encoded while deeper separators stay literal'
|
|
278
|
+
);
|
|
279
|
+
st.equal(
|
|
280
|
+
qs.stringify({ a: { b: { 'c.d': { e: 'f' } } } }, { allowDots: true, encodeDotInKeys: true }),
|
|
281
|
+
'a.b.c%252Ed.e=f',
|
|
282
|
+
'a literal dot in a deeply nested key is encoded without touching the separators around it'
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
st.equal(
|
|
286
|
+
qs.stringify({ a: { b: [1, 2] } }, { allowDots: true, encodeDotInKeys: true }),
|
|
287
|
+
'a.b%5B0%5D=1&a.b%5B1%5D=2',
|
|
288
|
+
'separator dots are preserved for an array value nested under keys'
|
|
289
|
+
);
|
|
290
|
+
st.equal(
|
|
291
|
+
qs.stringify({ a: { 'b.c': [1, 2] } }, { allowDots: true, encodeDotInKeys: true }),
|
|
292
|
+
'a.b%252Ec%5B0%5D=1&a.b%252Ec%5B1%5D=2',
|
|
293
|
+
'a nested dotted key with an array value encodes only its own dot'
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
st.deepEqual(
|
|
297
|
+
qs.parse(
|
|
298
|
+
qs.stringify({ a: { 'b.c': { d: 'e' } } }, { allowDots: true, encodeDotInKeys: true }),
|
|
299
|
+
{ allowDots: true, decodeDotInKeys: true }
|
|
300
|
+
),
|
|
301
|
+
{ a: { 'b.c': { d: 'e' } } },
|
|
302
|
+
'stringify -> parse round-trips a nested dotted key with an object value'
|
|
303
|
+
);
|
|
304
|
+
st.deepEqual(
|
|
305
|
+
qs.parse(
|
|
306
|
+
qs.stringify({ 'a.b': { c: { d: 'e' } } }, { allowDots: true, encodeDotInKeys: true }),
|
|
307
|
+
{ allowDots: true, decodeDotInKeys: true }
|
|
308
|
+
),
|
|
309
|
+
{ 'a.b': { c: { d: 'e' } } },
|
|
310
|
+
'stringify -> parse round-trips a top-level dotted key with deep nesting'
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
st.end();
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
t.test('with allowDots false, encodeDotInKeys leaves nested-key dots literal, consistently for object and primitive values', function (st) {
|
|
317
|
+
st.equal(
|
|
318
|
+
qs.stringify({ a: { 'b.c': { d: 'e' } } }, { allowDots: false, encodeDotInKeys: true }),
|
|
319
|
+
'a%5Bb.c%5D%5Bd%5D=e',
|
|
320
|
+
'nested dotted key with an object value'
|
|
321
|
+
);
|
|
322
|
+
st.equal(
|
|
323
|
+
qs.stringify({ a: { 'b.c': 'e' } }, { allowDots: false, encodeDotInKeys: true }),
|
|
324
|
+
'a%5Bb.c%5D=e',
|
|
325
|
+
'nested dotted key with a primitive value matches the object-value case'
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
st.end();
|
|
329
|
+
});
|
|
330
|
+
|
|
139
331
|
t.test('should encode dot in key of object, and automatically set allowDots to `true` when encodeDotInKeys is true and allowDots in undefined', function (st) {
|
|
140
332
|
st.equal(
|
|
141
333
|
qs.stringify(
|
|
@@ -256,6 +448,41 @@ test('stringify()', function (t) {
|
|
|
256
448
|
st.end();
|
|
257
449
|
});
|
|
258
450
|
|
|
451
|
+
t.test('ignores inherited array format names', function (st) {
|
|
452
|
+
var array = { a: ['b', 'c'] };
|
|
453
|
+
var indices = 'a%5B0%5D=b&a%5B1%5D=c';
|
|
454
|
+
var repeat = 'a=b&a=c';
|
|
455
|
+
|
|
456
|
+
st.equal(qs.stringify(array, { arrayFormat: 'unsupported' }), indices, 'unknown format falls back to `indices`');
|
|
457
|
+
|
|
458
|
+
var names = [
|
|
459
|
+
'constructor',
|
|
460
|
+
'toString',
|
|
461
|
+
'__proto__',
|
|
462
|
+
'valueOf',
|
|
463
|
+
'hasOwnProperty',
|
|
464
|
+
'isPrototypeOf',
|
|
465
|
+
'propertyIsEnumerable',
|
|
466
|
+
'toLocaleString'
|
|
467
|
+
];
|
|
468
|
+
for (var i = 0; i < names.length; i++) {
|
|
469
|
+
var name = names[i];
|
|
470
|
+
st.equal(qs.stringify(array, { arrayFormat: name }), indices, '`' + name + '` falls back to `indices`');
|
|
471
|
+
st.equal(
|
|
472
|
+
qs.stringify(array, { arrayFormat: name, indices: true }),
|
|
473
|
+
indices,
|
|
474
|
+
'`' + name + '` with `indices: true` falls back to `indices`'
|
|
475
|
+
);
|
|
476
|
+
st.equal(
|
|
477
|
+
qs.stringify(array, { arrayFormat: name, indices: false }),
|
|
478
|
+
repeat,
|
|
479
|
+
'`' + name + '` with `indices: false` falls back to `repeat`'
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
st.end();
|
|
484
|
+
});
|
|
485
|
+
|
|
259
486
|
t.test('`skipNulls` option', function (st) {
|
|
260
487
|
st.equal(
|
|
261
488
|
qs.stringify({ a: 'b', c: null }, { skipNulls: true }),
|
|
@@ -316,6 +543,24 @@ test('stringify()', function (t) {
|
|
|
316
543
|
st.end();
|
|
317
544
|
});
|
|
318
545
|
|
|
546
|
+
t.test('allowEmptyArrays keys that need no encoding', function (st) {
|
|
547
|
+
st.equal(qs.stringify({ foo: [] }, { allowEmptyArrays: true, format: 'RFC1738' }), 'foo[]', 'a top-level key in RFC1738');
|
|
548
|
+
st.equal(
|
|
549
|
+
qs.stringify({ a: { b: [] }, c: 'd e' }, { allowEmptyArrays: true, encodeValuesOnly: true }),
|
|
550
|
+
'a[b][]&c=d%20e',
|
|
551
|
+
'a nested key with encodeValuesOnly'
|
|
552
|
+
);
|
|
553
|
+
st.equal(qs.stringify({ a: { b: [] } }, { allowEmptyArrays: true, encode: false }), 'a[b][]', 'a nested key with encode: false');
|
|
554
|
+
st.equal(qs.stringify({ a: { b: [] } }, { allowEmptyArrays: true, allowDots: true }), 'a.b[]', 'a nested key with allowDots');
|
|
555
|
+
st.equal(
|
|
556
|
+
qs.stringify({ a: { b: [] } }, { allowEmptyArrays: true, allowDots: true, format: 'RFC1738' }),
|
|
557
|
+
'a.b[]',
|
|
558
|
+
'a nested key with allowDots in RFC1738'
|
|
559
|
+
);
|
|
560
|
+
|
|
561
|
+
st.end();
|
|
562
|
+
});
|
|
563
|
+
|
|
319
564
|
t.test('allowEmptyArrays + strictNullHandling', function (st) {
|
|
320
565
|
st.equal(
|
|
321
566
|
qs.stringify(
|
|
@@ -328,6 +573,95 @@ test('stringify()', function (t) {
|
|
|
328
573
|
st.end();
|
|
329
574
|
});
|
|
330
575
|
|
|
576
|
+
t.test('allowEmptyArrays only short-circuits arrays with no own keys', function (st) {
|
|
577
|
+
st.equal(
|
|
578
|
+
qs.stringify({ a: [] }, { allowEmptyArrays: true }),
|
|
579
|
+
'a[]',
|
|
580
|
+
'a genuinely empty array is still emitted as `[]`'
|
|
581
|
+
);
|
|
582
|
+
|
|
583
|
+
var withKey = [];
|
|
584
|
+
withKey.extra = 'x';
|
|
585
|
+
st.equal(
|
|
586
|
+
qs.stringify({ a: withKey }, { allowEmptyArrays: true }),
|
|
587
|
+
'a%5Bextra%5D=x',
|
|
588
|
+
'an own key on an empty array is serialized rather than dropped'
|
|
589
|
+
);
|
|
590
|
+
st.equal(
|
|
591
|
+
qs.stringify({ a: withKey }, { allowEmptyArrays: true }),
|
|
592
|
+
qs.stringify({ a: withKey }),
|
|
593
|
+
'the allowEmptyArrays fast path matches the default path when the array has own keys'
|
|
594
|
+
);
|
|
595
|
+
|
|
596
|
+
var container = {};
|
|
597
|
+
var cyclic = [];
|
|
598
|
+
cyclic.back = container;
|
|
599
|
+
container.a = cyclic;
|
|
600
|
+
st['throws'](
|
|
601
|
+
function () { qs.stringify(container, { allowEmptyArrays: true }); },
|
|
602
|
+
RangeError,
|
|
603
|
+
'a cycle through an empty array with an own key is still detected'
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
st.end();
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
t.test('should encode the key of an empty array when allowEmptyArrays is set', function (st) {
|
|
610
|
+
st.equal(
|
|
611
|
+
qs.stringify({ 'a b': [] }, { allowEmptyArrays: true }),
|
|
612
|
+
'a%20b[]',
|
|
613
|
+
'default (RFC3986) percent-encodes the space in the key'
|
|
614
|
+
);
|
|
615
|
+
st.equal(
|
|
616
|
+
qs.stringify({ 'a b': [] }, { allowEmptyArrays: true, format: 'RFC1738' }),
|
|
617
|
+
'a+b[]',
|
|
618
|
+
'RFC1738 encodes the space in the key as a plus'
|
|
619
|
+
);
|
|
620
|
+
st.equal(
|
|
621
|
+
qs.stringify({ 'a b': [] }, { allowEmptyArrays: true, encodeValuesOnly: true }),
|
|
622
|
+
'a b[]',
|
|
623
|
+
'encodeValuesOnly leaves the key unencoded'
|
|
624
|
+
);
|
|
625
|
+
st.equal(
|
|
626
|
+
qs.stringify({ 'a b': [] }, { allowEmptyArrays: true, encode: false }),
|
|
627
|
+
'a b[]',
|
|
628
|
+
'encode: false leaves the key unencoded'
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
st.deepEqual(
|
|
632
|
+
qs.parse(qs.stringify({ 'a b': [], 'a&b=c': [] }, { allowEmptyArrays: true }), { allowEmptyArrays: true }),
|
|
633
|
+
{ 'a b': [], 'a&b=c': [] },
|
|
634
|
+
'the encoded keys round-trip back to the original, including `&` and `=`'
|
|
635
|
+
);
|
|
636
|
+
st.equal(
|
|
637
|
+
qs.stringify({ 'a b': ['x'] }, { allowEmptyArrays: true, arrayFormat: 'brackets' }),
|
|
638
|
+
'a%20b%5B%5D=x',
|
|
639
|
+
'the same key with a value encodes the key prefix identically'
|
|
640
|
+
);
|
|
641
|
+
st.equal(
|
|
642
|
+
qs.stringify({ a: { 'b c': [] } }, { allowEmptyArrays: true }),
|
|
643
|
+
'a%5Bb%20c%5D[]',
|
|
644
|
+
'a nested key prefix is encoded like the value path encodes it'
|
|
645
|
+
);
|
|
646
|
+
st.equal(
|
|
647
|
+
qs.stringify({ a: { b: [] } }, { allowEmptyArrays: true }),
|
|
648
|
+
'a%5Bb%5D[]',
|
|
649
|
+
'a nested key that needs no encoding still has its brackets encoded'
|
|
650
|
+
);
|
|
651
|
+
st.equal(
|
|
652
|
+
qs.stringify({ 'a.b': [] }, { allowEmptyArrays: true, allowDots: true, encodeDotInKeys: true }),
|
|
653
|
+
'a%252Eb[]',
|
|
654
|
+
'encodeDotInKeys double-encodes the dot, as on the value path'
|
|
655
|
+
);
|
|
656
|
+
st.deepEqual(
|
|
657
|
+
qs.parse('a%252Eb[]', { allowEmptyArrays: true, allowDots: true, decodeDotInKeys: true }),
|
|
658
|
+
{ 'a.b': [] },
|
|
659
|
+
'the encodeDotInKeys output round-trips'
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
st.end();
|
|
663
|
+
});
|
|
664
|
+
|
|
331
665
|
t.test('stringifies an array value with one item vs multiple items', function (st) {
|
|
332
666
|
st.test('non-array item', function (s2t) {
|
|
333
667
|
s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a=c');
|
|
@@ -398,6 +732,53 @@ test('stringify()', function (t) {
|
|
|
398
732
|
st.end();
|
|
399
733
|
});
|
|
400
734
|
|
|
735
|
+
t.test('encodes comma array values with the same encoder arguments as other values, with encodeValuesOnly', function (st) {
|
|
736
|
+
var commaValuesOnly = { arrayFormat: 'comma', encodeValuesOnly: true };
|
|
737
|
+
|
|
738
|
+
st.equal(
|
|
739
|
+
qs.stringify({ a: ['é', 'x'], b: 'é' }, utils.assign({ charset: 'iso-8859-1' }, commaValuesOnly)),
|
|
740
|
+
'a=%E9,x&b=%E9',
|
|
741
|
+
'respects charset iso-8859-1'
|
|
742
|
+
);
|
|
743
|
+
st.deepEqual(
|
|
744
|
+
qs.parse(qs.stringify({ a: ['é', 'x'] }, utils.assign({ charset: 'iso-8859-1' }, commaValuesOnly)), { charset: 'iso-8859-1', comma: true }),
|
|
745
|
+
{ a: ['é', 'x'] },
|
|
746
|
+
'round-trips in iso-8859-1'
|
|
747
|
+
);
|
|
748
|
+
st.equal(
|
|
749
|
+
qs.stringify({ a: ['☺'] }, utils.assign({ charset: 'iso-8859-1' }, commaValuesOnly)),
|
|
750
|
+
'a=%26%239786%3B',
|
|
751
|
+
'encodes unrepresentable chars as numeric entities in iso-8859-1'
|
|
752
|
+
);
|
|
753
|
+
st.equal(
|
|
754
|
+
qs.stringify({ a: ['(x)', 'y z'], b: '(x)' }, utils.assign({ format: qs.formats.RFC1738 }, commaValuesOnly)),
|
|
755
|
+
'a=(x),y+z&b=(x)',
|
|
756
|
+
'respects format RFC1738'
|
|
757
|
+
);
|
|
758
|
+
|
|
759
|
+
var calls = [];
|
|
760
|
+
st.equal(
|
|
761
|
+
qs.stringify({ a: ['b', 'c'] }, utils.assign({
|
|
762
|
+
encoder: function (str, defaultEncoder, charset, kind, format) {
|
|
763
|
+
calls[calls.length] = [str, typeof defaultEncoder, charset, kind, format];
|
|
764
|
+
return defaultEncoder(str, defaultEncoder, charset, kind, format).toUpperCase();
|
|
765
|
+
}
|
|
766
|
+
}, commaValuesOnly)),
|
|
767
|
+
'a=B,C',
|
|
768
|
+
'a custom encoder can call defaultEncoder'
|
|
769
|
+
);
|
|
770
|
+
st.deepEqual(
|
|
771
|
+
calls,
|
|
772
|
+
[
|
|
773
|
+
['b', 'function', 'utf-8', 'value', qs.formats.RFC3986],
|
|
774
|
+
['c', 'function', 'utf-8', 'value', qs.formats.RFC3986]
|
|
775
|
+
],
|
|
776
|
+
'a custom encoder receives defaultEncoder, charset, kind, and format'
|
|
777
|
+
);
|
|
778
|
+
|
|
779
|
+
st.end();
|
|
780
|
+
});
|
|
781
|
+
|
|
401
782
|
t.test('stringifies comma and empty non-array values', function (st) {
|
|
402
783
|
st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: false, arrayFormat: 'indices' }), 'a=,&b=&c=c,d%');
|
|
403
784
|
st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: false, arrayFormat: 'brackets' }), 'a=,&b=&c=c,d%');
|
|
@@ -651,6 +1032,155 @@ test('stringify()', function (t) {
|
|
|
651
1032
|
st.end();
|
|
652
1033
|
});
|
|
653
1034
|
|
|
1035
|
+
t.test('does not crash on null/undefined entries in arrayFormat=comma with encodeValuesOnly', function (st) {
|
|
1036
|
+
st.doesNotThrow(
|
|
1037
|
+
function () { qs.stringify({ a: [null, 'b'] }, { arrayFormat: 'comma', encodeValuesOnly: true }); },
|
|
1038
|
+
'does not pass a raw null array entry to the encoder'
|
|
1039
|
+
);
|
|
1040
|
+
st.doesNotThrow(
|
|
1041
|
+
function () { qs.stringify({ a: [undefined, 'b'] }, { arrayFormat: 'comma', encodeValuesOnly: true }); },
|
|
1042
|
+
'does not pass a raw undefined array entry to the encoder'
|
|
1043
|
+
);
|
|
1044
|
+
st.doesNotThrow(
|
|
1045
|
+
function () { qs.stringify({ a: [null] }, { arrayFormat: 'comma', encodeValuesOnly: true }); },
|
|
1046
|
+
'does not crash on a single-null array'
|
|
1047
|
+
);
|
|
1048
|
+
|
|
1049
|
+
st.equal(
|
|
1050
|
+
qs.stringify({ a: [null, 'b'] }, { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
1051
|
+
'a=,b',
|
|
1052
|
+
'null entry joins as empty, comma stays unencoded under encodeValuesOnly'
|
|
1053
|
+
);
|
|
1054
|
+
st.equal(
|
|
1055
|
+
qs.stringify({ a: [undefined, 'b'] }, { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
1056
|
+
'a=,b',
|
|
1057
|
+
'undefined entry joins as empty, comma stays unencoded under encodeValuesOnly'
|
|
1058
|
+
);
|
|
1059
|
+
st.equal(
|
|
1060
|
+
qs.stringify({ a: [null] }, { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
1061
|
+
'a=',
|
|
1062
|
+
'single-null array stringifies as empty value'
|
|
1063
|
+
);
|
|
1064
|
+
st.equal(
|
|
1065
|
+
qs.stringify({ a: [null] }, { arrayFormat: 'comma', encodeValuesOnly: true, strictNullHandling: true }),
|
|
1066
|
+
'a',
|
|
1067
|
+
'strictNullHandling drops the equals sign for a single-null array'
|
|
1068
|
+
);
|
|
1069
|
+
st.equal(
|
|
1070
|
+
qs.stringify({ a: [null] }, { arrayFormat: 'comma', encodeValuesOnly: true, skipNulls: true }),
|
|
1071
|
+
'',
|
|
1072
|
+
'skipNulls drops a single-null array entirely'
|
|
1073
|
+
);
|
|
1074
|
+
|
|
1075
|
+
st.end();
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1078
|
+
t.test('arrayFormat=comma: does not crash on entries with no callable `toString`', function (st) {
|
|
1079
|
+
var json = JSON.parse('{ "a": ["b", { "toString": "x" }, "c"] }');
|
|
1080
|
+
st.equal(qs.stringify(json, { arrayFormat: 'comma' }), 'a=b%2C%5Bobject%20Object%5D%2Cc', 'JSON own `toString`');
|
|
1081
|
+
st.equal(qs.stringify(json, { arrayFormat: 'comma', encode: false }), 'a=b,[object Object],c', 'with encode: false');
|
|
1082
|
+
st.equal(
|
|
1083
|
+
qs.stringify(json, { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
1084
|
+
'a=b,%5Bobject%20Object%5D,c',
|
|
1085
|
+
'with encodeValuesOnly'
|
|
1086
|
+
);
|
|
1087
|
+
st.equal(
|
|
1088
|
+
qs.stringify(JSON.parse('{ "a": [{ "toString": "x" }] }'), { arrayFormat: 'comma', commaRoundTrip: true }),
|
|
1089
|
+
'a%5B%5D=%5Bobject%20Object%5D',
|
|
1090
|
+
'with commaRoundTrip'
|
|
1091
|
+
);
|
|
1092
|
+
st.equal(
|
|
1093
|
+
qs.stringify(JSON.parse('{ "a": [{ "toString": "x" }] }'), { arrayFormat: 'comma' }),
|
|
1094
|
+
qs.stringify({ a: [{ b: 1 }] }, { arrayFormat: 'comma' }),
|
|
1095
|
+
'renders the same as a plain object entry'
|
|
1096
|
+
);
|
|
1097
|
+
|
|
1098
|
+
st.equal(
|
|
1099
|
+
qs.stringify(qs.parse('a[][b]=c', { plainObjects: true }), { arrayFormat: 'comma' }),
|
|
1100
|
+
'a=%5Bobject%20Object%5D',
|
|
1101
|
+
'null-prototype entry from `parse` with plainObjects'
|
|
1102
|
+
);
|
|
1103
|
+
st.equal(
|
|
1104
|
+
qs.stringify(qs.parse('a[][b]=c', { plainObjects: true }), { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
1105
|
+
'a=%5Bobject%20Object%5D',
|
|
1106
|
+
'null-prototype entry from `parse` with plainObjects, with encodeValuesOnly'
|
|
1107
|
+
);
|
|
1108
|
+
st.equal(
|
|
1109
|
+
qs.stringify(qs.parse('a[0][toString]=x', { allowPrototypes: true }), { arrayFormat: 'comma' }),
|
|
1110
|
+
'a=%5Bobject%20Object%5D',
|
|
1111
|
+
'own `toString` entry from `parse` with allowPrototypes'
|
|
1112
|
+
);
|
|
1113
|
+
|
|
1114
|
+
var nested = JSON.parse('{ "a": [[1, [{ "toString": "x" }]], "y"] }');
|
|
1115
|
+
st.equal(qs.stringify(nested, { arrayFormat: 'comma', encode: false }), 'a=1,[object Object],y', 'nested array');
|
|
1116
|
+
st.equal(
|
|
1117
|
+
qs.stringify(nested, { arrayFormat: 'comma', encodeValuesOnly: true }),
|
|
1118
|
+
'a=1%2C%5Bobject%20Object%5D,y',
|
|
1119
|
+
'nested array, with encodeValuesOnly'
|
|
1120
|
+
);
|
|
1121
|
+
st.equal(qs.stringify({ a: [[1, 2], 3] }, { arrayFormat: 'comma', encode: false }), 'a=1,2,3', 'nested array is still flattened');
|
|
1122
|
+
|
|
1123
|
+
var cyclic = [{ toString: 'x' }];
|
|
1124
|
+
cyclic[cyclic.length] = cyclic;
|
|
1125
|
+
st.equal(
|
|
1126
|
+
qs.stringify({ a: cyclic }, { arrayFormat: 'comma', encode: false }),
|
|
1127
|
+
'a=[object Object],[object Object],',
|
|
1128
|
+
'cyclic nested array joins its cycle as empty'
|
|
1129
|
+
);
|
|
1130
|
+
|
|
1131
|
+
var customJoin = [{ toString: 'x' }];
|
|
1132
|
+
customJoin.join = function () { return 'j'; };
|
|
1133
|
+
st.equal(qs.stringify({ a: [customJoin, 'y'] }, { arrayFormat: 'comma', encode: false }), 'a=j,y', 'own `join` is still used');
|
|
1134
|
+
|
|
1135
|
+
st.equal(
|
|
1136
|
+
qs.stringify({ a: [{ toString: 'x', valueOf: function () { return 7; } }] }, { arrayFormat: 'comma' }),
|
|
1137
|
+
'a=7',
|
|
1138
|
+
'primitive `valueOf` is still used'
|
|
1139
|
+
);
|
|
1140
|
+
st.equal(
|
|
1141
|
+
qs.stringify({ a: [{ toString: 'x', valueOf: function () { return null; } }] }, { arrayFormat: 'comma' }),
|
|
1142
|
+
'a=null',
|
|
1143
|
+
'null `valueOf` is still used'
|
|
1144
|
+
);
|
|
1145
|
+
st.equal(
|
|
1146
|
+
qs.stringify({ a: [{ toString: 'x', valueOf: function () { return {}; } }] }, { arrayFormat: 'comma' }),
|
|
1147
|
+
'a=%5Bobject%20Object%5D',
|
|
1148
|
+
'non-primitive `valueOf` falls back'
|
|
1149
|
+
);
|
|
1150
|
+
|
|
1151
|
+
st.equal(
|
|
1152
|
+
qs.stringify({ a: [{ toString: function () { return 't'; } }, new Date(0)] }, { arrayFormat: 'comma', encode: false }),
|
|
1153
|
+
'a=t,1970-01-01T00:00:00.000Z',
|
|
1154
|
+
'callable `toString` and dates are unaffected'
|
|
1155
|
+
);
|
|
1156
|
+
|
|
1157
|
+
st['throws'](
|
|
1158
|
+
function () {
|
|
1159
|
+
qs.stringify({ a: [{ toString: function () { throw new SyntaxError('mine'); } }] }, { arrayFormat: 'comma' });
|
|
1160
|
+
},
|
|
1161
|
+
SyntaxError,
|
|
1162
|
+
'a throwing `toString` still throws'
|
|
1163
|
+
);
|
|
1164
|
+
st['throws'](
|
|
1165
|
+
function () {
|
|
1166
|
+
qs.stringify({ a: [{ toString: 'x', valueOf: function () { throw new EvalError('mine'); } }] }, { arrayFormat: 'comma' });
|
|
1167
|
+
},
|
|
1168
|
+
EvalError,
|
|
1169
|
+
'a throwing `valueOf` still throws'
|
|
1170
|
+
);
|
|
1171
|
+
|
|
1172
|
+
st.end();
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
t.test('arrayFormat=comma: entries with `Symbol.toPrimitive` are unaffected', { skip: !hasSymbols() || typeof Symbol.toPrimitive !== 'symbol' }, function (st) {
|
|
1176
|
+
var entry = { toString: 'x' };
|
|
1177
|
+
entry[Symbol.toPrimitive] = function () { return 'p'; };
|
|
1178
|
+
st.equal(qs.stringify({ a: [entry] }, { arrayFormat: 'comma' }), 'a=p');
|
|
1179
|
+
st.equal(qs.stringify({ a: [entry] }, { arrayFormat: 'comma', encodeValuesOnly: true }), 'a=p');
|
|
1180
|
+
|
|
1181
|
+
st.end();
|
|
1182
|
+
});
|
|
1183
|
+
|
|
654
1184
|
t.test('stringifies a null object', { skip: !hasProto }, function (st) {
|
|
655
1185
|
st.equal(qs.stringify({ __proto__: null, a: 'b' }), 'a=b');
|
|
656
1186
|
st.end();
|
|
@@ -718,6 +1248,33 @@ test('stringify()', function (t) {
|
|
|
718
1248
|
st.end();
|
|
719
1249
|
});
|
|
720
1250
|
|
|
1251
|
+
t.test('does not throw on a non-callable `constructor.isBuffer` key', function (st) {
|
|
1252
|
+
var input = { a: { constructor: { isBuffer: 'x' } } };
|
|
1253
|
+
st.doesNotThrow(function () { qs.stringify(input); });
|
|
1254
|
+
st.equal(qs.stringify(input), 'a%5Bconstructor%5D%5BisBuffer%5D=x');
|
|
1255
|
+
st.equal(qs.stringify({ a: { constructor: { isBuffer: { b: 'c' } } } }), 'a%5Bconstructor%5D%5BisBuffer%5D%5Bb%5D=c');
|
|
1256
|
+
st.equal(qs.stringify({ a: { constructor: { isBuffer: ['b'] } } }), 'a%5Bconstructor%5D%5BisBuffer%5D%5B0%5D=b');
|
|
1257
|
+
st.equal(qs.stringify({ a: { constructor: { isBuffer: true } } }), 'a%5Bconstructor%5D%5BisBuffer%5D=true');
|
|
1258
|
+
st.end();
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1261
|
+
t.test('round-trips a parsed `constructor[isBuffer]` key', function (st) {
|
|
1262
|
+
var str = 'x%5Bconstructor%5D%5BisBuffer%5D=y';
|
|
1263
|
+
|
|
1264
|
+
var plain = qs.parse(str, { plainObjects: true });
|
|
1265
|
+
st.deepEqual(plain, { __proto__: null, x: { __proto__: null, constructor: { __proto__: null, isBuffer: 'y' } } }, 'plainObjects keeps the key');
|
|
1266
|
+
st.doesNotThrow(function () { qs.stringify(plain); });
|
|
1267
|
+
st.equal(qs.stringify(plain), str, 'plainObjects round-trips');
|
|
1268
|
+
|
|
1269
|
+
var proto = qs.parse(str, { allowPrototypes: true });
|
|
1270
|
+
st.deepEqual(proto, { x: { constructor: { isBuffer: 'y' } } }, 'allowPrototypes keeps the key');
|
|
1271
|
+
st.doesNotThrow(function () { qs.stringify(proto); });
|
|
1272
|
+
st.equal(qs.stringify(proto), str, 'allowPrototypes round-trips');
|
|
1273
|
+
|
|
1274
|
+
st.equal(qs.stringify(qs.parse(str)), '', 'default options drop the key');
|
|
1275
|
+
st.end();
|
|
1276
|
+
});
|
|
1277
|
+
|
|
721
1278
|
t.test('stringifies an object using an alternative delimiter', function (st) {
|
|
722
1279
|
st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d');
|
|
723
1280
|
st.end();
|
|
@@ -825,6 +1382,82 @@ test('stringify()', function (t) {
|
|
|
825
1382
|
st.end();
|
|
826
1383
|
});
|
|
827
1384
|
|
|
1385
|
+
t.test('skips null/undefined entries in filter=array', function (st) {
|
|
1386
|
+
st.doesNotThrow(
|
|
1387
|
+
function () { qs.stringify({ a: 'b', undefined: 'x' }, { filter: ['a', undefined] }); },
|
|
1388
|
+
'does not pass a raw undefined filter entry to the encoder'
|
|
1389
|
+
);
|
|
1390
|
+
st.doesNotThrow(
|
|
1391
|
+
function () { qs.stringify({ a: 'b', 'null': 'x' }, { filter: ['a', null] }); },
|
|
1392
|
+
'does not pass a raw null filter entry to the encoder'
|
|
1393
|
+
);
|
|
1394
|
+
|
|
1395
|
+
st.equal(
|
|
1396
|
+
qs.stringify({ a: 'b', undefined: 'x', c: 'd' }, { filter: ['a', undefined, 'c'] }),
|
|
1397
|
+
'a=b&c=d',
|
|
1398
|
+
'undefined filter entry is skipped, remaining keys are kept'
|
|
1399
|
+
);
|
|
1400
|
+
st.equal(
|
|
1401
|
+
qs.stringify({ a: 'b', 'null': 'x', c: 'd' }, { filter: ['a', null, 'c'] }),
|
|
1402
|
+
'a=b&c=d',
|
|
1403
|
+
'null filter entry is skipped, remaining keys are kept'
|
|
1404
|
+
);
|
|
1405
|
+
st.equal(
|
|
1406
|
+
qs.stringify({ a: 'b', 'null': 'x' }, { filter: [null] }),
|
|
1407
|
+
'',
|
|
1408
|
+
'filter array containing only null yields empty string'
|
|
1409
|
+
);
|
|
1410
|
+
|
|
1411
|
+
st.end();
|
|
1412
|
+
});
|
|
1413
|
+
|
|
1414
|
+
t.test('applies sort to nested keys selected by filter=array', function (st) {
|
|
1415
|
+
var asc = function (a, b) { return a.localeCompare(b); };
|
|
1416
|
+
var desc = function (a, b) { return b.localeCompare(a); };
|
|
1417
|
+
|
|
1418
|
+
st.equal(
|
|
1419
|
+
qs.stringify({ a: { c: 1, b: 2 }, z: 3 }, { filter: ['z', 'a', 'c', 'b'], sort: asc, encode: false }),
|
|
1420
|
+
'a[b]=2&a[c]=1&z=3',
|
|
1421
|
+
'nested keys are sorted, not left in filter order'
|
|
1422
|
+
);
|
|
1423
|
+
st.equal(
|
|
1424
|
+
qs.stringify({ a: { c: 1, b: 2 }, z: 3 }, { filter: ['z', 'b', 'a', 'c'], sort: desc, encode: false }),
|
|
1425
|
+
'z=3&a[c]=1&a[b]=2',
|
|
1426
|
+
'nested keys follow a descending sort'
|
|
1427
|
+
);
|
|
1428
|
+
st.equal(
|
|
1429
|
+
qs.stringify({ a: [{ y: 1, x: 2 }] }, { filter: ['a', '0', 'y', 'x'], sort: asc, encode: false }),
|
|
1430
|
+
'a[0][x]=2&a[0][y]=1',
|
|
1431
|
+
'keys of objects nested in arrays are sorted'
|
|
1432
|
+
);
|
|
1433
|
+
st.equal(
|
|
1434
|
+
qs.stringify({ a: { c: 1, b: 2 }, z: 3 }, { filter: ['z', 'a', 'c', 'b'], encode: false }),
|
|
1435
|
+
'z=3&a[c]=1&a[b]=2',
|
|
1436
|
+
'without sort, keys keep filter order at every level'
|
|
1437
|
+
);
|
|
1438
|
+
|
|
1439
|
+
st.end();
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
t.test('does not reorder the caller\'s filter array when sorting', function (st) {
|
|
1443
|
+
var filter = ['z', 'a', 'c', 'b'];
|
|
1444
|
+
var asc = function (a, b) { return a.localeCompare(b); };
|
|
1445
|
+
|
|
1446
|
+
st.equal(
|
|
1447
|
+
qs.stringify({ a: { c: 1, b: 2 }, z: 3 }, { filter: filter, sort: asc, encode: false }),
|
|
1448
|
+
'a[b]=2&a[c]=1&z=3',
|
|
1449
|
+
'keys are sorted at every level'
|
|
1450
|
+
);
|
|
1451
|
+
st.deepEqual(filter, ['z', 'a', 'c', 'b'], 'filter array is not mutated');
|
|
1452
|
+
st.equal(
|
|
1453
|
+
qs.stringify({ a: { c: 1, b: 2 }, z: 3 }, { filter: filter, encode: false }),
|
|
1454
|
+
'z=3&a[c]=1&a[b]=2',
|
|
1455
|
+
'reusing the filter without sort keeps its own order'
|
|
1456
|
+
);
|
|
1457
|
+
|
|
1458
|
+
st.end();
|
|
1459
|
+
});
|
|
1460
|
+
|
|
828
1461
|
t.test('supports custom representations when filter=function', function (st) {
|
|
829
1462
|
var calls = 0;
|
|
830
1463
|
var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } };
|
|
@@ -847,6 +1480,66 @@ test('stringify()', function (t) {
|
|
|
847
1480
|
st.end();
|
|
848
1481
|
});
|
|
849
1482
|
|
|
1483
|
+
t.test('serializes Date values unless filter transforms them', function (st) {
|
|
1484
|
+
var obj = {
|
|
1485
|
+
a: new Date(Date.UTC(2023, 2, 7, 9, 2, 41, 260)),
|
|
1486
|
+
b: [new Date(Date.UTC(2023, 2, 7, 9, 2, 41, 260))]
|
|
1487
|
+
};
|
|
1488
|
+
var iso = '2023-03-07T09%3A02%3A41.260Z';
|
|
1489
|
+
st.equal(
|
|
1490
|
+
qs.stringify(obj, { filter: function (prefix, value) { return value; } }),
|
|
1491
|
+
'a=' + iso + '&b%5B0%5D=' + iso,
|
|
1492
|
+
'Dates returned unchanged by a filter are serialized'
|
|
1493
|
+
);
|
|
1494
|
+
st.equal(
|
|
1495
|
+
qs.stringify({ a: new Date(0) }, { filter: function (prefix, value) { return value instanceof Date ? 'kept' : value; } }),
|
|
1496
|
+
'a=kept',
|
|
1497
|
+
'a filter that transforms a Date wins over default serialization'
|
|
1498
|
+
);
|
|
1499
|
+
st.end();
|
|
1500
|
+
});
|
|
1501
|
+
|
|
1502
|
+
t.test('applies default Date handling to whatever a filter function returns', function (st) {
|
|
1503
|
+
var date = new Date(Date.UTC(2023, 2, 7, 9, 2, 41, 260));
|
|
1504
|
+
var iso = '2023-03-07T09%3A02%3A41.260Z';
|
|
1505
|
+
var identity = function (prefix, value) { return value; };
|
|
1506
|
+
|
|
1507
|
+
st.equal(
|
|
1508
|
+
qs.stringify({ a: { b: date } }, { filter: identity }),
|
|
1509
|
+
'a%5Bb%5D=' + iso,
|
|
1510
|
+
'a nested Date is serialized through a filter'
|
|
1511
|
+
);
|
|
1512
|
+
st.equal(
|
|
1513
|
+
qs.stringify(
|
|
1514
|
+
{ a: date },
|
|
1515
|
+
{ filter: identity, serializeDate: function (d) { return String(d.getTime()); } }
|
|
1516
|
+
),
|
|
1517
|
+
'a=1678179761260',
|
|
1518
|
+
'`serializeDate` is honored after a filter'
|
|
1519
|
+
);
|
|
1520
|
+
st.equal(
|
|
1521
|
+
qs.stringify({ a: [date, 'x'] }, { filter: identity, arrayFormat: 'comma' }),
|
|
1522
|
+
'a=' + iso + '%2Cx',
|
|
1523
|
+
'Dates inside a comma array are serialized through a filter, not stringified as locale text'
|
|
1524
|
+
);
|
|
1525
|
+
st.equal(
|
|
1526
|
+
qs.stringify({ a: 'x' }, { filter: function (prefix, value) { return prefix === 'a' ? date : value; } }),
|
|
1527
|
+
'a=' + iso,
|
|
1528
|
+
'a Date produced by the filter is serialized'
|
|
1529
|
+
);
|
|
1530
|
+
st.equal(
|
|
1531
|
+
qs.stringify({ a: date, b: 1 }, { filter: ['a'] }),
|
|
1532
|
+
'a=' + iso,
|
|
1533
|
+
'an array filter still serializes Dates'
|
|
1534
|
+
);
|
|
1535
|
+
st['throws'](
|
|
1536
|
+
function () { qs.stringify({ a: new Date(NaN) }, { filter: identity }); },
|
|
1537
|
+
RangeError,
|
|
1538
|
+
'an invalid Date through a filter throws like the no-filter path'
|
|
1539
|
+
);
|
|
1540
|
+
st.end();
|
|
1541
|
+
});
|
|
1542
|
+
|
|
850
1543
|
t.test('can disable uri encoding', function (st) {
|
|
851
1544
|
st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b');
|
|
852
1545
|
st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c');
|
|
@@ -1015,6 +1708,7 @@ test('stringify()', function (t) {
|
|
|
1015
1708
|
st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.RFC1738 }), 'a+b=a+b');
|
|
1016
1709
|
|
|
1017
1710
|
st.equal(qs.stringify({ 'foo(ref)': 'bar' }, { format: qs.formats.RFC1738 }), 'foo(ref)=bar');
|
|
1711
|
+
st.equal(qs.stringify({ 'a~*': '~*()' }, { format: qs.formats.RFC1738 }), 'a~%2A=~%2A()', 'leaves `~` unencoded and encodes `*`');
|
|
1018
1712
|
|
|
1019
1713
|
st.end();
|
|
1020
1714
|
});
|
|
@@ -1023,6 +1717,83 @@ test('stringify()', function (t) {
|
|
|
1023
1717
|
st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC3986 }), 'a=b%20c');
|
|
1024
1718
|
st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC3986 }), 'a%20b=c%20d');
|
|
1025
1719
|
st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.RFC3986 }), 'a%20b=a%20b');
|
|
1720
|
+
st.equal(qs.stringify({ 'a~*': '~*()' }, { format: qs.formats.RFC3986 }), 'a~%2A=~%2A%28%29', 'leaves `~` unencoded, and encodes `*` and parens');
|
|
1721
|
+
|
|
1722
|
+
st.end();
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
t.test('WHATWG serialization', function (st) {
|
|
1726
|
+
st.equal(qs.formats.WHATWG, 'WHATWG', 'is exported');
|
|
1727
|
+
st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.WHATWG }), 'a=b+c');
|
|
1728
|
+
st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.WHATWG }), 'a+b=c+d');
|
|
1729
|
+
st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.WHATWG }), 'a+b=a+b');
|
|
1730
|
+
|
|
1731
|
+
st.equal(qs.stringify({ a: '~' }, { format: qs.formats.WHATWG }), 'a=%7E', 'encodes `~`');
|
|
1732
|
+
st.equal(qs.stringify({ a: '*' }, { format: qs.formats.WHATWG }), 'a=*', 'does not encode `*`');
|
|
1733
|
+
st.equal(qs.stringify({ 'foo(ref)': 'bar' }, { format: qs.formats.WHATWG }), 'foo%28ref%29=bar', 'encodes parentheses');
|
|
1734
|
+
st.equal(qs.stringify({ a: '-._' }, { format: qs.formats.WHATWG }), 'a=-._');
|
|
1735
|
+
st.equal(qs.stringify({ a: '+&=' }, { format: qs.formats.WHATWG }), 'a=%2B%26%3D');
|
|
1736
|
+
st.equal(qs.stringify({ a: { b: 'c d' } }, { format: qs.formats.WHATWG }), 'a%5Bb%5D=c+d');
|
|
1737
|
+
st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.WHATWG, encode: false }), 'a=b c', 'encode: false leaves the value alone');
|
|
1738
|
+
|
|
1739
|
+
st.equal(
|
|
1740
|
+
qs.stringify({ 'a~b*': { 'c d': '~* ' } }, { format: qs.formats.WHATWG, encodeValuesOnly: true }),
|
|
1741
|
+
'a~b*[c d]=%7E*+',
|
|
1742
|
+
'encodeValuesOnly: leaves keys alone'
|
|
1743
|
+
);
|
|
1744
|
+
st.equal(
|
|
1745
|
+
qs.stringify({ a: '~*\u00e9 ' }, { format: qs.formats.WHATWG, charset: 'iso-8859-1' }),
|
|
1746
|
+
'a=%7E*%E9+',
|
|
1747
|
+
'charset iso-8859-1'
|
|
1748
|
+
);
|
|
1749
|
+
st.equal(
|
|
1750
|
+
qs.stringify({ a: '~* ' }, {
|
|
1751
|
+
format: qs.formats.WHATWG,
|
|
1752
|
+
encoder: function (str, defaultEncoder, charset, type, format) {
|
|
1753
|
+
return defaultEncoder(str, defaultEncoder, charset, type, format);
|
|
1754
|
+
}
|
|
1755
|
+
}),
|
|
1756
|
+
'a=%7E*+',
|
|
1757
|
+
'an encoder wrapping the default encoder'
|
|
1758
|
+
);
|
|
1759
|
+
st.equal(
|
|
1760
|
+
qs.stringify({ a: ['~ x', '*'] }, { format: qs.formats.WHATWG, arrayFormat: 'comma' }),
|
|
1761
|
+
'a=%7E+x%2C*',
|
|
1762
|
+
'arrayFormat comma'
|
|
1763
|
+
);
|
|
1764
|
+
|
|
1765
|
+
st.end();
|
|
1766
|
+
});
|
|
1767
|
+
|
|
1768
|
+
var USP = typeof URLSearchParams === 'function' ? URLSearchParams : url.URLSearchParams;
|
|
1769
|
+
|
|
1770
|
+
t.test('WHATWG serialization matches URLSearchParams', { skip: typeof USP !== 'function' }, function (st) {
|
|
1771
|
+
var chars = [];
|
|
1772
|
+
for (var c = 0; c < 0x80; c++) {
|
|
1773
|
+
chars[chars.length] = String.fromCharCode(c);
|
|
1774
|
+
}
|
|
1775
|
+
chars.push('\u00e9', '\u20ac', '\uFFFF', '\uD83D\uDCA9', 'a b~c*d(e)f', '\uD800', '\uDC00', 'x\uDC00y');
|
|
1776
|
+
|
|
1777
|
+
for (var i = 0; i < chars.length; i++) {
|
|
1778
|
+
var key = {};
|
|
1779
|
+
key[chars[i]] = 'v';
|
|
1780
|
+
st.equal(
|
|
1781
|
+
qs.stringify({ k: chars[i] }, { format: qs.formats.WHATWG }),
|
|
1782
|
+
new USP([['k', chars[i]]]).toString(),
|
|
1783
|
+
'value ' + JSON.stringify(chars[i])
|
|
1784
|
+
);
|
|
1785
|
+
st.equal(
|
|
1786
|
+
qs.stringify(key, { format: qs.formats.WHATWG }),
|
|
1787
|
+
new USP([[chars[i], 'v']]).toString(),
|
|
1788
|
+
'key ' + JSON.stringify(chars[i])
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
st.equal(
|
|
1793
|
+
qs.stringify({ a: { 'b~': 'c d' } }, { format: qs.formats.WHATWG }),
|
|
1794
|
+
new USP([['a[b~]', 'c d']]).toString(),
|
|
1795
|
+
'nested key'
|
|
1796
|
+
);
|
|
1026
1797
|
|
|
1027
1798
|
st.end();
|
|
1028
1799
|
});
|
|
@@ -1111,6 +1882,28 @@ test('stringify()', function (t) {
|
|
|
1111
1882
|
st.end();
|
|
1112
1883
|
});
|
|
1113
1884
|
|
|
1885
|
+
t.test('strictNullHandling: applies the formatter to the encoded key (RFC1738)', function (st) {
|
|
1886
|
+
st.equal(
|
|
1887
|
+
qs.stringify(
|
|
1888
|
+
{ 'a b': null, 'c d': 'e f' },
|
|
1889
|
+
{ strictNullHandling: false, format: 'RFC1738' }
|
|
1890
|
+
),
|
|
1891
|
+
'a+b=&c+d=e+f',
|
|
1892
|
+
'without: as expected'
|
|
1893
|
+
);
|
|
1894
|
+
|
|
1895
|
+
st.equal(
|
|
1896
|
+
qs.stringify(
|
|
1897
|
+
{ 'a b': null, 'c d': 'e f' },
|
|
1898
|
+
{ strictNullHandling: true, format: 'RFC1738' }
|
|
1899
|
+
),
|
|
1900
|
+
'a+b&c+d=e+f',
|
|
1901
|
+
'with: as expected'
|
|
1902
|
+
);
|
|
1903
|
+
|
|
1904
|
+
st.end();
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1114
1907
|
t.test('throws if an invalid charset is specified', function (st) {
|
|
1115
1908
|
st['throws'](function () {
|
|
1116
1909
|
qs.stringify({ a: 'b' }, { charset: 'foobar' });
|
|
@@ -1128,6 +1921,17 @@ test('stringify()', function (t) {
|
|
|
1128
1921
|
st.end();
|
|
1129
1922
|
});
|
|
1130
1923
|
|
|
1924
|
+
t.test('encodes a literal `+` as `%2B` in iso-8859-1 mode so it round-trips', function (st) {
|
|
1925
|
+
st.equal(qs.stringify({ a: 'b+c' }, { charset: 'iso-8859-1' }), 'a=b%2Bc', 'a `+` in a value is percent-encoded');
|
|
1926
|
+
st.equal(qs.stringify({ 'a+b': 'c' }, { charset: 'iso-8859-1' }), 'a%2Bb=c', 'a `+` in a key is percent-encoded');
|
|
1927
|
+
st.deepEqual(
|
|
1928
|
+
qs.parse(qs.stringify({ a: 'b+c' }, { charset: 'iso-8859-1' }), { charset: 'iso-8859-1' }),
|
|
1929
|
+
{ a: 'b+c' },
|
|
1930
|
+
'the `+` survives a round-trip instead of decoding to a space'
|
|
1931
|
+
);
|
|
1932
|
+
st.end();
|
|
1933
|
+
});
|
|
1934
|
+
|
|
1131
1935
|
t.test('respects an explicit charset of utf-8 (the default)', function (st) {
|
|
1132
1936
|
st.equal(qs.stringify({ a: 'æ' }, { charset: 'utf-8' }), 'a=%C3%A6');
|
|
1133
1937
|
st.end();
|
|
@@ -1146,6 +1950,12 @@ test('stringify()', function (t) {
|
|
|
1146
1950
|
'adds the right sentinel when instructed to and the charset is iso-8859-1'
|
|
1147
1951
|
);
|
|
1148
1952
|
|
|
1953
|
+
st.equal(
|
|
1954
|
+
qs.stringify({ a: 1, b: 2 }, { charsetSentinel: true, delimiter: ';' }),
|
|
1955
|
+
'utf8=%E2%9C%93;a=1;b=2',
|
|
1956
|
+
'uses the configured delimiter after the sentinel'
|
|
1957
|
+
);
|
|
1958
|
+
|
|
1149
1959
|
st.end();
|
|
1150
1960
|
});
|
|
1151
1961
|
|
|
@@ -1316,4 +2126,92 @@ test('stringifies empty keys', function (t) {
|
|
|
1316
2126
|
|
|
1317
2127
|
st.end();
|
|
1318
2128
|
});
|
|
2129
|
+
|
|
2130
|
+
t.test('round-trips keys containing percent-encoded bracket text', function (st) {
|
|
2131
|
+
var cases = [
|
|
2132
|
+
{ 'a%5Bb': 'c' },
|
|
2133
|
+
{ 'a%5Db': 'c' },
|
|
2134
|
+
{ 'a%255Bb': 'c' },
|
|
2135
|
+
{ 'a%255Db': 'c' },
|
|
2136
|
+
{ a: { 'b%5Bc': 'd' } },
|
|
2137
|
+
{ a: { 'b%255Bc': 'd' } },
|
|
2138
|
+
{ 'a%5B%255Bb': 'c' }
|
|
2139
|
+
];
|
|
2140
|
+
for (var i = 0; i < cases.length; i++) {
|
|
2141
|
+
st.deepEqual(
|
|
2142
|
+
qs.parse(qs.stringify(cases[i])),
|
|
2143
|
+
cases[i],
|
|
2144
|
+
'round-trips ' + JSON.stringify(cases[i])
|
|
2145
|
+
);
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
st.end();
|
|
2149
|
+
});
|
|
2150
|
+
|
|
2151
|
+
t.test('parses input containing percent-encoded bracket text without mangling', function (st) {
|
|
2152
|
+
st.deepEqual(qs.parse('a%25255Bb=c'), { 'a%255Bb': 'c' }, 'a%25255Bb decodes to a%255Bb, not a%5Bb');
|
|
2153
|
+
st.deepEqual(qs.parse('a%25255Db=c'), { 'a%255Db': 'c' }, 'a%25255Db decodes to a%255Db, not a%5Db');
|
|
2154
|
+
st.deepEqual(qs.parse('a%5Bb%25255Bc%5D=d'), { a: { 'b%255Bc': 'd' } }, 'nested %25255B decodes to %255B inside segment, not %5B');
|
|
2155
|
+
|
|
2156
|
+
st.end();
|
|
2157
|
+
});
|
|
2158
|
+
|
|
2159
|
+
t.test('limits nesting depth with the `depth` option', function (st) {
|
|
2160
|
+
st.equal(
|
|
2161
|
+
qs.stringify({ a: { b: { c: 'd' } } }),
|
|
2162
|
+
'a%5Bb%5D%5Bc%5D=d',
|
|
2163
|
+
'the default depth is unlimited and does not alter output'
|
|
2164
|
+
);
|
|
2165
|
+
st.equal(
|
|
2166
|
+
qs.stringify({ a: { b: { c: 'd' } } }, { depth: 2 }),
|
|
2167
|
+
'a%5Bb%5D%5Bc%5D=d',
|
|
2168
|
+
'does not throw when nesting is within the depth limit'
|
|
2169
|
+
);
|
|
2170
|
+
st.equal(
|
|
2171
|
+
qs.stringify({ a: { b: 'c' } }, { depth: Infinity }),
|
|
2172
|
+
'a%5Bb%5D=c',
|
|
2173
|
+
'an explicit Infinity depth is unlimited'
|
|
2174
|
+
);
|
|
2175
|
+
st.equal(
|
|
2176
|
+
qs.stringify({ a: { b: { c: { d: 'e' } } } }, { depth: null }),
|
|
2177
|
+
qs.stringify({ a: { b: { c: { d: 'e' } } } }),
|
|
2178
|
+
'a non-number depth is ignored and treated as unlimited'
|
|
2179
|
+
);
|
|
2180
|
+
st.equal(
|
|
2181
|
+
qs.stringify({ a: 'b' }, { depth: 0 }),
|
|
2182
|
+
'a=b',
|
|
2183
|
+
'a flat object serializes with a depth of 0'
|
|
2184
|
+
);
|
|
2185
|
+
|
|
2186
|
+
var deep = {};
|
|
2187
|
+
var cursor = deep;
|
|
2188
|
+
for (var i = 0; i < 250; i++) {
|
|
2189
|
+
cursor.a = {};
|
|
2190
|
+
cursor = cursor.a;
|
|
2191
|
+
}
|
|
2192
|
+
cursor.b = 'c';
|
|
2193
|
+
st.equal(typeof qs.stringify(deep), 'string', 'the default depth serializes deeply nested objects without throwing');
|
|
2194
|
+
|
|
2195
|
+
st['throws'](
|
|
2196
|
+
function () { qs.stringify({ a: { b: { c: { d: 'e' } } } }, { depth: 2 }); },
|
|
2197
|
+
RangeError,
|
|
2198
|
+
'throws a RangeError when nesting exceeds the depth limit'
|
|
2199
|
+
);
|
|
2200
|
+
st['throws'](
|
|
2201
|
+
function () { qs.stringify({ a: { b: 'c' } }, { depth: 0 }); },
|
|
2202
|
+
RangeError,
|
|
2203
|
+
'a depth of 0 throws for any nested object'
|
|
2204
|
+
);
|
|
2205
|
+
|
|
2206
|
+
var caught;
|
|
2207
|
+
try {
|
|
2208
|
+
qs.stringify({ a: { b: { c: { d: 'e' } } } }, { depth: 2 });
|
|
2209
|
+
} catch (e) {
|
|
2210
|
+
caught = e;
|
|
2211
|
+
}
|
|
2212
|
+
st.ok(caught instanceof RangeError, 'the thrown value is a RangeError');
|
|
2213
|
+
st.equal(caught.message, 'Input depth exceeded depth option of 2', 'the RangeError names the exceeded depth');
|
|
2214
|
+
|
|
2215
|
+
st.end();
|
|
2216
|
+
});
|
|
1319
2217
|
});
|