@mindstone/mcp-server-xero 0.1.3 → 0.1.4
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/dist/auth/token-grant.js +10 -8
- package/dist/bridge-reader.js +35 -78
- package/dist/clients/sdk-axios.js +30 -0
- package/dist/clients/xero-client.js +14 -8
- package/dist/handlers/create-xero-bank-transaction.handler.js +2 -1
- package/dist/handlers/create-xero-contact.handler.js +2 -1
- package/dist/handlers/create-xero-credit-note.handler.js +2 -1
- package/dist/handlers/create-xero-invoice.handler.js +2 -1
- package/dist/handlers/create-xero-manual-journal.handler.js +2 -1
- package/dist/handlers/create-xero-payment.handler.js +2 -1
- package/dist/handlers/create-xero-purchase-order.handler.js +2 -1
- package/dist/handlers/create-xero-quote.handler.js +2 -1
- package/dist/handlers/create-xero-tracking-category.handler.js +2 -1
- package/dist/handlers/history-handler-factory.js +2 -1
- package/dist/handlers/list-xero-organisation-details.handler.js +2 -1
- package/dist/handlers/list-xero-payroll-employee-leave-balances.handler.js +2 -1
- package/dist/handlers/list-xero-payroll-employee-leave-types.handler.js +2 -1
- package/dist/handlers/list-xero-payroll-employee-leave.handler.js +2 -1
- package/dist/handlers/list-xero-payroll-leave-periods.handler.js +2 -1
- package/dist/handlers/list-xero-profit-and-loss.handler.js +1 -1
- package/dist/handlers/update-xero-bank-transaction.handler.js +3 -2
- package/dist/handlers/update-xero-contact.handler.js +2 -1
- package/dist/handlers/update-xero-credit-note.handler.js +2 -1
- package/dist/handlers/update-xero-invoice.handler.js +2 -1
- package/dist/handlers/update-xero-manual-journal.handler.js +2 -1
- package/dist/handlers/update-xero-quote.handler.js +2 -1
- package/dist/handlers/update-xero-tracking-category.handler.js +3 -2
- package/dist/handlers/update-xero-tracking-options.handler.js +3 -2
- package/dist/hardened-json-file.js +91 -0
- package/dist/helpers/connector-error.js +11 -0
- package/dist/helpers/format-error.js +41 -14
- package/dist/helpers/format-token-error.js +4 -0
- package/dist/helpers/xero-currencies.js +2 -1
- package/dist/tools/sign-in.tool.js +1 -1
- 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 +1335 -637
- 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/axios/CHANGELOG.md +214 -1
- package/node_modules/axios/README.md +471 -82
- package/node_modules/axios/dist/axios.js +2009 -516
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +2174 -487
- package/node_modules/axios/dist/esm/axios.js +2174 -487
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +2410 -515
- package/node_modules/axios/index.d.cts +150 -75
- package/node_modules/axios/index.d.ts +144 -69
- package/node_modules/axios/lib/adapters/adapters.js +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +272 -75
- package/node_modules/axios/lib/adapters/http.js +475 -122
- package/node_modules/axios/lib/adapters/xhr.js +173 -16
- package/node_modules/axios/lib/core/Axios.js +114 -35
- package/node_modules/axios/lib/core/AxiosError.js +105 -3
- package/node_modules/axios/lib/core/AxiosHeaders.js +151 -12
- package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/buildFullPath.js +55 -1
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +45 -2
- package/node_modules/axios/lib/core/mergeConfig.js +203 -90
- package/node_modules/axios/lib/core/methodList.js +17 -0
- package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
- package/node_modules/axios/lib/defaults/index.js +2 -1
- package/node_modules/axios/lib/defaults/transitional.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
- package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +12 -1
- package/node_modules/axios/lib/helpers/buildURL.js +6 -3
- package/node_modules/axios/lib/helpers/combineURLs.js +11 -3
- package/node_modules/axios/lib/helpers/composeSignals.js +18 -4
- package/node_modules/axios/lib/helpers/cookies.js +30 -2
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +156 -63
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +60 -8
- package/node_modules/axios/lib/helpers/fromDataURI.js +12 -3
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +7 -4
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/progressEventReducer.js +4 -4
- package/node_modules/axios/lib/helpers/resolveConfig.js +33 -25
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +345 -3
- package/node_modules/axios/lib/helpers/throttle.js +3 -2
- package/node_modules/axios/lib/helpers/toFormData.js +60 -30
- package/node_modules/axios/lib/helpers/validator.js +1 -1
- package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
- package/node_modules/axios/lib/utils.js +271 -23
- package/node_modules/axios/package.json +31 -30
- 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 +90 -12
- package/node_modules/express-rate-limit/dist/index.d.cts +27 -0
- package/node_modules/express-rate-limit/dist/index.d.mts +27 -0
- package/node_modules/express-rate-limit/dist/index.d.ts +27 -0
- package/node_modules/express-rate-limit/dist/index.mjs +76 -12
- package/node_modules/express-rate-limit/{license.md → license} +7 -6
- package/node_modules/express-rate-limit/package.json +19 -16
- package/node_modules/express-rate-limit/readme.md +1 -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/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +12 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/form-data/CHANGELOG.md +29 -2
- package/node_modules/form-data/README.md +4 -4
- package/node_modules/form-data/lib/form_data.js +14 -2
- package/node_modules/form-data/package.json +7 -7
- package/node_modules/hasown/CHANGELOG.md +18 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/package.json +13 -14
- 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 -30
- 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 +29 -50
- 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 +27 -42
- 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 +33 -59
- package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
- package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -53
- 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 -401
- 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 -30
- 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 +166 -117
- package/node_modules/hono/dist/cjs/middleware/combine/index.js +135 -95
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +74 -83
- 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 +161 -169
- 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 -336
- 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 +11 -26
- 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 +213 -279
- 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 -101
- package/node_modules/hono/dist/cjs/utils/mount.js +51 -0
- package/node_modules/hono/dist/cjs/utils/stream.js +88 -102
- 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 -377
- 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 -6
- 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 -99
- package/node_modules/hono/dist/middleware/combine/index.js +134 -73
- package/node_modules/hono/dist/middleware/compress/index.js +75 -63
- 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 -158
- 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 -310
- 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 +7 -2
- 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 +10 -5
- 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 +7 -2
- 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 -37
- package/node_modules/hono/dist/types/jsx/base.d.ts +43 -36
- 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 +48 -49
- 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 +17 -17
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +8 -8
- package/node_modules/hono/dist/types/middleware/compress/index.d.ts +9 -10
- 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 -286
- 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 +4 -6
- 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 +227 -272
- 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 -79
- package/node_modules/hono/dist/utils/mount.js +50 -0
- package/node_modules/hono/dist/utils/stream.js +86 -79
- 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 +116 -1
- package/node_modules/qs/README.md +107 -8
- package/node_modules/qs/dist/qs.js +28 -28
- package/node_modules/qs/eslint.config.mjs +61 -50
- package/node_modules/qs/lib/formats.js +7 -2
- package/node_modules/qs/lib/parse.js +137 -18
- package/node_modules/qs/lib/stringify.js +32 -15
- package/node_modules/qs/lib/utils.js +213 -24
- package/node_modules/qs/package.json +11 -10
- package/node_modules/qs/test/parse.js +928 -2
- package/node_modules/qs/test/stringify.js +769 -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/side-channel-list/CHANGELOG.md +25 -4
- package/node_modules/side-channel-list/index.js +1 -3
- package/node_modules/side-channel-list/package.json +8 -8
- package/node_modules/side-channel-list/test/index.js +50 -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 -702
- 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 -670
- package/node_modules/@hono/node-server/dist/listener.mjs +0 -635
- 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 -238
- package/node_modules/@hono/node-server/dist/request.mjs +0 -206
- 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 -112
- package/node_modules/@hono/node-server/dist/response.mjs +0 -85
- 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 -696
- package/node_modules/@hono/node-server/dist/server.mjs +0 -660
- 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 -677
- package/node_modules/@hono/node-server/dist/vercel.mjs +0 -640
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.21.1 Copyright (c) 2026 Matt Zabriskie and contributors */
|
|
2
2
|
/**
|
|
3
3
|
* Create a bound version of a function with a specified `this` context
|
|
4
4
|
*
|
|
@@ -18,6 +18,179 @@ const { toString } = Object.prototype;
|
|
|
18
18
|
const { getPrototypeOf } = Object;
|
|
19
19
|
const { iterator, toStringTag } = Symbol;
|
|
20
20
|
|
|
21
|
+
/* Creating a function that will check if an object has a property. */
|
|
22
|
+
const hasOwnProperty = (
|
|
23
|
+
({ hasOwnProperty }) =>
|
|
24
|
+
(obj, prop) =>
|
|
25
|
+
hasOwnProperty.call(obj, prop)
|
|
26
|
+
)(Object.prototype);
|
|
27
|
+
|
|
28
|
+
const isUnsafeObjectKey = (prop) =>
|
|
29
|
+
typeof prop === 'string' &&
|
|
30
|
+
(prop === '__proto__' || prop === 'constructor' || prop === 'prototype');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Determine whether an inherited object must be treated as a shared-prototype
|
|
34
|
+
* boundary. Cross-realm Object.prototype objects cannot be distinguished
|
|
35
|
+
* reliably from application-created null-prototype objects because their
|
|
36
|
+
* properties are mutable, so all inherited terminal prototypes are excluded
|
|
37
|
+
* as a fail-closed boundary. A null-prototype source still keeps its own
|
|
38
|
+
* properties, as produced by mergeConfig and other safe materialization paths.
|
|
39
|
+
*
|
|
40
|
+
* @param {*} obj The object to inspect
|
|
41
|
+
* @param {*} prototype The object's prototype
|
|
42
|
+
* @param {boolean} source Whether obj is the original traversal source
|
|
43
|
+
*
|
|
44
|
+
* @returns {boolean} True when obj is a safe prototype traversal boundary
|
|
45
|
+
*/
|
|
46
|
+
const isPrototypeBoundary = (obj, prototype, source) =>
|
|
47
|
+
obj === Object.prototype || (!source && prototype === null);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Determine whether an object can retain its identity through code paths that
|
|
51
|
+
* add, replace, and remove config properties without bypassing unsafe-key
|
|
52
|
+
* filtering. Immutable objects, unsafe-key-bearing objects, and objects with
|
|
53
|
+
* accessor or restricted data properties must be materialized instead.
|
|
54
|
+
*
|
|
55
|
+
* @param {*} obj The object to inspect
|
|
56
|
+
*
|
|
57
|
+
* @returns {boolean} True when every own property is safe and fully mutable
|
|
58
|
+
*/
|
|
59
|
+
const isSafeAndFullyMutable = (obj) => {
|
|
60
|
+
if (!Object.isExtensible(obj)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const props = Object.getOwnPropertyNames(obj);
|
|
65
|
+
|
|
66
|
+
if (Object.getOwnPropertySymbols) {
|
|
67
|
+
props.push(...Object.getOwnPropertySymbols(obj));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return props.every((prop) => {
|
|
71
|
+
if (isUnsafeObjectKey(prop)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
76
|
+
|
|
77
|
+
return !!descriptor && descriptor.configurable && descriptor.writable === true;
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Walk the prototype chain (excluding the source realm's Object.prototype)
|
|
83
|
+
* looking for an own `prop`. This distinguishes genuine own/inherited members
|
|
84
|
+
* — including class accessors and template prototypes — from members injected
|
|
85
|
+
* via Object.prototype pollution (e.g. `Object.prototype.username = '...'`),
|
|
86
|
+
* which live on Object.prototype itself and are therefore never matched.
|
|
87
|
+
*
|
|
88
|
+
* @param {*} thing The value whose chain to inspect
|
|
89
|
+
* @param {string|symbol} prop The property key to look for
|
|
90
|
+
*
|
|
91
|
+
* @returns {boolean} True when `prop` is owned below Object.prototype
|
|
92
|
+
*/
|
|
93
|
+
const hasOwnInPrototypeChain = (thing, prop) => {
|
|
94
|
+
let obj = thing;
|
|
95
|
+
const seen = [];
|
|
96
|
+
|
|
97
|
+
while (obj != null) {
|
|
98
|
+
if (seen.indexOf(obj) !== -1) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
seen.push(obj);
|
|
102
|
+
|
|
103
|
+
const prototype = getPrototypeOf(obj);
|
|
104
|
+
|
|
105
|
+
if (isPrototypeBoundary(obj, prototype, obj === thing)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (hasOwnProperty(obj, prop)) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
obj = prototype;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
|
|
119
|
+
* properties and members inherited from a non-Object.prototype source (a class
|
|
120
|
+
* instance or template object) are honored; a value reachable only through a
|
|
121
|
+
* polluted Object.prototype is ignored and `undefined` is returned.
|
|
122
|
+
*
|
|
123
|
+
* @param {*} obj The source object
|
|
124
|
+
* @param {string|symbol} prop The property key to read
|
|
125
|
+
*
|
|
126
|
+
* @returns {*} The resolved value, or undefined when unsafe/absent
|
|
127
|
+
*/
|
|
128
|
+
const getSafeProp = (obj, prop) =>
|
|
129
|
+
obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Flatten an object and its application-defined prototype chain into a
|
|
133
|
+
* null-prototype object. Members inherited only from the source realm's
|
|
134
|
+
* Object.prototype are deliberately excluded, while class/template members
|
|
135
|
+
* below that boundary are preserved.
|
|
136
|
+
*
|
|
137
|
+
* @param {*} thing The value to flatten
|
|
138
|
+
*
|
|
139
|
+
* @returns {*} A null-prototype copy, or the original value when it is already
|
|
140
|
+
* structurally safe or is not an object
|
|
141
|
+
*/
|
|
142
|
+
const toSafeFlatObject = (thing) => {
|
|
143
|
+
if (thing == null || (typeof thing !== 'object' && typeof thing !== 'function')) {
|
|
144
|
+
return thing;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const sourcePrototype = getPrototypeOf(thing);
|
|
148
|
+
|
|
149
|
+
if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
|
|
150
|
+
return thing;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const result = Object.create(null);
|
|
154
|
+
const merged = Object.create(null);
|
|
155
|
+
const seen = [];
|
|
156
|
+
let current = thing;
|
|
157
|
+
|
|
158
|
+
while (current != null) {
|
|
159
|
+
if (seen.indexOf(current) !== -1) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
seen.push(current);
|
|
164
|
+
|
|
165
|
+
const prototype = current === thing ? sourcePrototype : getPrototypeOf(current);
|
|
166
|
+
|
|
167
|
+
if (isPrototypeBoundary(current, prototype, current === thing)) {
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const props = Object.getOwnPropertyNames(current);
|
|
172
|
+
|
|
173
|
+
if (Object.getOwnPropertySymbols) {
|
|
174
|
+
props.push(...Object.getOwnPropertySymbols(current));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
for (const prop of props) {
|
|
178
|
+
if (isUnsafeObjectKey(prop)) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (!hasOwnProperty(merged, prop)) {
|
|
183
|
+
result[prop] = thing[prop];
|
|
184
|
+
merged[prop] = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
current = prototype;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return result;
|
|
192
|
+
};
|
|
193
|
+
|
|
21
194
|
const kindOf = ((cache) => (thing) => {
|
|
22
195
|
const str = toString.call(thing);
|
|
23
196
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
@@ -143,17 +316,24 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
143
316
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
144
317
|
*/
|
|
145
318
|
const isPlainObject = (val) => {
|
|
146
|
-
if (
|
|
319
|
+
if (!isObject(val)) {
|
|
147
320
|
return false;
|
|
148
321
|
}
|
|
149
322
|
|
|
150
323
|
const prototype = getPrototypeOf(val);
|
|
151
324
|
return (
|
|
152
|
-
(prototype === null ||
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
325
|
+
(prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
|
|
326
|
+
// Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
|
|
327
|
+
// value is tagged/iterable, ignoring members reachable only through shared
|
|
328
|
+
// or terminal prototype boundaries. This is exactly what
|
|
329
|
+
// hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
|
|
330
|
+
// above (null, Object.prototype, or a terminal null-prototype template) is
|
|
331
|
+
// a boundary, so the walk never inspects anything but `val`'s own members,
|
|
332
|
+
// and stops before even those when `val` is itself the boundary
|
|
333
|
+
// Object.prototype. Checking that inline avoids allocating the walker's
|
|
334
|
+
// `seen` list twice per call on the mergeConfig / merge hot path.
|
|
335
|
+
(isPrototypeBoundary(val, prototype, true) ||
|
|
336
|
+
(!hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator)))
|
|
157
337
|
);
|
|
158
338
|
};
|
|
159
339
|
|
|
@@ -238,6 +418,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
238
418
|
* @returns {boolean} True if value is a FileList, otherwise false
|
|
239
419
|
*/
|
|
240
420
|
const isFileList = kindOfTest('FileList');
|
|
421
|
+
const isSet = kindOfTest('Set');
|
|
241
422
|
|
|
242
423
|
/**
|
|
243
424
|
* Determine if a value is a Stream
|
|
@@ -416,15 +597,30 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
416
597
|
function merge(...objs) {
|
|
417
598
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
418
599
|
const result = {};
|
|
600
|
+
// Caseless lookup only applies to string keys — symbol keys are
|
|
601
|
+
// identity-matched. Every string key that reaches `result` passes through
|
|
602
|
+
// this index first, so it can never hold two case variants of one key and a
|
|
603
|
+
// lowercase -> key map is exactly what findKey(result, key) would rescan
|
|
604
|
+
// Object.keys(result) for on each assignment.
|
|
605
|
+
const lowerCaseKeys = caseless ? Object.create(null) : null;
|
|
419
606
|
const assignValue = (val, key) => {
|
|
420
607
|
// Skip dangerous property names to prevent prototype pollution
|
|
421
608
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
422
609
|
return;
|
|
423
610
|
}
|
|
424
611
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
612
|
+
let targetKey = key;
|
|
613
|
+
if (lowerCaseKeys && typeof key === 'string') {
|
|
614
|
+
const lowerKey = key.toLowerCase();
|
|
615
|
+
const knownKey = lowerCaseKeys[lowerKey];
|
|
616
|
+
// A key recorded but absent from `result` was skipped by skipUndefined;
|
|
617
|
+
// the later spelling wins then, as it does for findKey.
|
|
618
|
+
if (knownKey !== undefined && hasOwnProperty(result, knownKey)) {
|
|
619
|
+
targetKey = knownKey;
|
|
620
|
+
} else {
|
|
621
|
+
lowerCaseKeys[lowerKey] = key;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
428
624
|
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
429
625
|
// chain, so a polluted Object.prototype value could surface here and get
|
|
430
626
|
// copied into the merged result.
|
|
@@ -448,7 +644,7 @@ function merge(...objs) {
|
|
|
448
644
|
|
|
449
645
|
forEach(source, assignValue);
|
|
450
646
|
|
|
451
|
-
if (typeof source !== 'object' || isArray(source)) {
|
|
647
|
+
if (typeof source !== 'object' || isArray(source) || !Object.getOwnPropertySymbols) {
|
|
452
648
|
continue;
|
|
453
649
|
}
|
|
454
650
|
|
|
@@ -607,7 +803,37 @@ const toArray = (thing) => {
|
|
|
607
803
|
if (!thing) return null;
|
|
608
804
|
if (isArray(thing)) return thing;
|
|
609
805
|
let i = thing.length;
|
|
610
|
-
if (!
|
|
806
|
+
if (!Number.isSafeInteger(i) || i < 0 || i > 0xffffffff) return null;
|
|
807
|
+
|
|
808
|
+
// Bound the copy by actual indexed properties, including hidden and inherited
|
|
809
|
+
// members of array-like collections, rather than by the declared length alone.
|
|
810
|
+
const indexes = new Set();
|
|
811
|
+
const seen = new Set();
|
|
812
|
+
let source = thing;
|
|
813
|
+
|
|
814
|
+
while (source != null && indexes.size < i) {
|
|
815
|
+
if (seen.has(source)) return null;
|
|
816
|
+
seen.add(source);
|
|
817
|
+
|
|
818
|
+
const prototype = getPrototypeOf(source);
|
|
819
|
+
if (isPrototypeBoundary(source, prototype, source === thing)) break;
|
|
820
|
+
|
|
821
|
+
Object.getOwnPropertyNames(source).forEach((key) => {
|
|
822
|
+
const index = +key;
|
|
823
|
+
if (
|
|
824
|
+
Number.isInteger(index) &&
|
|
825
|
+
index >= 0 &&
|
|
826
|
+
index < i &&
|
|
827
|
+
String(index) === key &&
|
|
828
|
+
hasOwnProperty(source, key)
|
|
829
|
+
) {
|
|
830
|
+
indexes.add(index);
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
source = prototype;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (indexes.size !== i) return null;
|
|
611
837
|
const arr = new Array(i);
|
|
612
838
|
while (i-- > 0) {
|
|
613
839
|
arr[i] = thing[i];
|
|
@@ -680,13 +906,6 @@ const toCamelCase = (str) => {
|
|
|
680
906
|
});
|
|
681
907
|
};
|
|
682
908
|
|
|
683
|
-
/* Creating a function that will check if an object has a property. */
|
|
684
|
-
const hasOwnProperty = (
|
|
685
|
-
({ hasOwnProperty }) =>
|
|
686
|
-
(obj, prop) =>
|
|
687
|
-
hasOwnProperty.call(obj, prop)
|
|
688
|
-
)(Object.prototype);
|
|
689
|
-
|
|
690
909
|
const { propertyIsEnumerable } = Object.prototype;
|
|
691
910
|
|
|
692
911
|
/**
|
|
@@ -810,12 +1029,23 @@ const toJSONObject = (obj) => {
|
|
|
810
1029
|
if (!('toJSON' in source)) {
|
|
811
1030
|
// add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
|
|
812
1031
|
visited.add(source);
|
|
813
|
-
const target = isArray(source) ? [] : {};
|
|
814
1032
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
1033
|
+
let target;
|
|
1034
|
+
|
|
1035
|
+
if (isSet(source)) {
|
|
1036
|
+
target = [];
|
|
1037
|
+
for (const value of source) {
|
|
1038
|
+
const reducedValue = visit(value);
|
|
1039
|
+
!isUndefined(reducedValue) && target.push(reducedValue);
|
|
1040
|
+
}
|
|
1041
|
+
} else {
|
|
1042
|
+
target = isArray(source) ? [] : {};
|
|
1043
|
+
|
|
1044
|
+
forEach(source, (value, key) => {
|
|
1045
|
+
const reducedValue = visit(value);
|
|
1046
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
819
1049
|
|
|
820
1050
|
visited.delete(source);
|
|
821
1051
|
|
|
@@ -900,6 +1130,20 @@ const asap =
|
|
|
900
1130
|
|
|
901
1131
|
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
902
1132
|
|
|
1133
|
+
/**
|
|
1134
|
+
* Determine if a value is iterable via an iterator that is NOT sourced solely
|
|
1135
|
+
* from a polluted Object.prototype. Use this instead of `isIterable` whenever
|
|
1136
|
+
* the iterable comes from untrusted input (e.g. user-supplied header sources),
|
|
1137
|
+
* so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
|
|
1138
|
+
* into an attacker-controlled entries iterator.
|
|
1139
|
+
*
|
|
1140
|
+
* @param {*} thing The value to test
|
|
1141
|
+
*
|
|
1142
|
+
* @returns {boolean} True if value has a non-polluted iterator
|
|
1143
|
+
*/
|
|
1144
|
+
const isSafeIterable = (thing) =>
|
|
1145
|
+
thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
|
|
1146
|
+
|
|
903
1147
|
var utils$1 = {
|
|
904
1148
|
isArray,
|
|
905
1149
|
isArrayBuffer,
|
|
@@ -944,6 +1188,9 @@ var utils$1 = {
|
|
|
944
1188
|
isHTMLForm,
|
|
945
1189
|
hasOwnProperty,
|
|
946
1190
|
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
|
1191
|
+
hasOwnInPrototypeChain,
|
|
1192
|
+
getSafeProp,
|
|
1193
|
+
toSafeFlatObject,
|
|
947
1194
|
reduceDescriptors,
|
|
948
1195
|
freezeMethods,
|
|
949
1196
|
toObjectSet,
|
|
@@ -960,6 +1207,7 @@ var utils$1 = {
|
|
|
960
1207
|
setImmediate: _setImmediate,
|
|
961
1208
|
asap,
|
|
962
1209
|
isIterable,
|
|
1210
|
+
isSafeIterable,
|
|
963
1211
|
};
|
|
964
1212
|
|
|
965
1213
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
@@ -999,7 +1247,8 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
999
1247
|
* @returns {Object} Headers parsed into an object
|
|
1000
1248
|
*/
|
|
1001
1249
|
var parseHeaders = (rawHeaders) => {
|
|
1002
|
-
|
|
1250
|
+
// Header names are data, including __proto__; avoid inherited setters.
|
|
1251
|
+
const parsed = Object.create(null);
|
|
1003
1252
|
let key;
|
|
1004
1253
|
let val;
|
|
1005
1254
|
let i;
|
|
@@ -1010,18 +1259,20 @@ var parseHeaders = (rawHeaders) => {
|
|
|
1010
1259
|
key = line.substring(0, i).trim().toLowerCase();
|
|
1011
1260
|
val = line.substring(i + 1).trim();
|
|
1012
1261
|
|
|
1013
|
-
|
|
1262
|
+
const hasKey = utils$1.hasOwnProp(parsed, key);
|
|
1263
|
+
|
|
1264
|
+
if (!key || (hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key))) {
|
|
1014
1265
|
return;
|
|
1015
1266
|
}
|
|
1016
1267
|
|
|
1017
1268
|
if (key === 'set-cookie') {
|
|
1018
|
-
if (
|
|
1269
|
+
if (hasKey) {
|
|
1019
1270
|
parsed[key].push(val);
|
|
1020
1271
|
} else {
|
|
1021
1272
|
parsed[key] = [val];
|
|
1022
1273
|
}
|
|
1023
1274
|
} else {
|
|
1024
|
-
parsed[key] =
|
|
1275
|
+
parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
|
|
1025
1276
|
}
|
|
1026
1277
|
});
|
|
1027
1278
|
|
|
@@ -1085,7 +1336,7 @@ function toByteStringHeaderObject(headers) {
|
|
|
1085
1336
|
return byteStringHeaders;
|
|
1086
1337
|
}
|
|
1087
1338
|
|
|
1088
|
-
const $internals = Symbol('internals');
|
|
1339
|
+
const $internals$1 = Symbol('internals');
|
|
1089
1340
|
|
|
1090
1341
|
function normalizeHeader(header) {
|
|
1091
1342
|
return header && String(header).trim().toLowerCase();
|
|
@@ -1111,11 +1362,142 @@ function parseTokens(str) {
|
|
|
1111
1362
|
return tokens;
|
|
1112
1363
|
}
|
|
1113
1364
|
|
|
1365
|
+
const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
1366
|
+
|
|
1367
|
+
function trimOWS(value) {
|
|
1368
|
+
let start = 0;
|
|
1369
|
+
let end = value.length;
|
|
1370
|
+
|
|
1371
|
+
while (start < end) {
|
|
1372
|
+
const code = value.charCodeAt(start);
|
|
1373
|
+
|
|
1374
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1375
|
+
break;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
start += 1;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
while (end > start) {
|
|
1382
|
+
const code = value.charCodeAt(end - 1);
|
|
1383
|
+
|
|
1384
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
end -= 1;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
function decodeQuotedString(value) {
|
|
1395
|
+
const last = value.length - 1;
|
|
1396
|
+
|
|
1397
|
+
if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
|
|
1398
|
+
return value;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
let decoded = '';
|
|
1402
|
+
|
|
1403
|
+
for (let i = 1; i < last; i++) {
|
|
1404
|
+
const code = value.charCodeAt(i);
|
|
1405
|
+
|
|
1406
|
+
if (code === 0x22) {
|
|
1407
|
+
return value;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
if (code === 0x5c) {
|
|
1411
|
+
i += 1;
|
|
1412
|
+
|
|
1413
|
+
if (i >= last) {
|
|
1414
|
+
return value;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
decoded += value[i];
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
return decoded;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
function parseParameters(value) {
|
|
1425
|
+
const parameters = Object.create(null);
|
|
1426
|
+
const str = String(value);
|
|
1427
|
+
let start = 0;
|
|
1428
|
+
let quoted = false;
|
|
1429
|
+
let escaped = false;
|
|
1430
|
+
|
|
1431
|
+
function parseParameter(end) {
|
|
1432
|
+
const part = trimOWS(str.slice(start, end));
|
|
1433
|
+
const equals = part.indexOf('=');
|
|
1434
|
+
|
|
1435
|
+
if (equals < 1) {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
const name = trimOWS(part.slice(0, equals));
|
|
1440
|
+
|
|
1441
|
+
if (!parameterNameRE.test(name)) {
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
const normalizedName = name.toLowerCase();
|
|
1446
|
+
|
|
1447
|
+
if (
|
|
1448
|
+
normalizedName === '__proto__' ||
|
|
1449
|
+
normalizedName === 'constructor' ||
|
|
1450
|
+
normalizedName === 'prototype'
|
|
1451
|
+
) {
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
const parameterValue = trimOWS(part.slice(equals + 1));
|
|
1456
|
+
parameters[normalizedName] = decodeQuotedString(parameterValue);
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
for (let i = 0; i < str.length; i++) {
|
|
1460
|
+
const code = str.charCodeAt(i);
|
|
1461
|
+
|
|
1462
|
+
if (quoted) {
|
|
1463
|
+
if (escaped) {
|
|
1464
|
+
escaped = false;
|
|
1465
|
+
} else if (code === 0x5c) {
|
|
1466
|
+
escaped = true;
|
|
1467
|
+
} else if (code === 0x22) {
|
|
1468
|
+
quoted = false;
|
|
1469
|
+
}
|
|
1470
|
+
} else if (code === 0x22) {
|
|
1471
|
+
quoted = true;
|
|
1472
|
+
} else if (code === 0x2c || code === 0x3b) {
|
|
1473
|
+
parseParameter(i);
|
|
1474
|
+
start = i + 1;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
parseParameter(str.length);
|
|
1479
|
+
|
|
1480
|
+
return parameters;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1114
1483
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1115
1484
|
|
|
1485
|
+
// `__proto__` is a valid field name, and the one name the uppercase mapping at
|
|
1486
|
+
// the bottom of this file cannot reach: it is inherited from Object.prototype
|
|
1487
|
+
// instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
|
|
1488
|
+
// runs the inherited setter. That silently discards the header, and an array
|
|
1489
|
+
// value replaces the instance prototype, taking every method with it.
|
|
1490
|
+
// Store it under the same kind of case variant that mapping uses for `set` and
|
|
1491
|
+
// `constructor`. Header lookup is caseless, so it reads back under either
|
|
1492
|
+
// spelling, and no own `__proto__` slot is ever created for a later
|
|
1493
|
+
// `Object.assign` to copy onto a plain object through the same setter.
|
|
1494
|
+
const PROTO_HEADER_SLOT = '__Proto__';
|
|
1495
|
+
|
|
1496
|
+
const headerSlot = (name) => (name === '__proto__' ? PROTO_HEADER_SLOT : name);
|
|
1497
|
+
|
|
1116
1498
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1117
1499
|
if (utils$1.isFunction(filter)) {
|
|
1118
|
-
return filter.call(
|
|
1500
|
+
return filter.call(context, value, header);
|
|
1119
1501
|
}
|
|
1120
1502
|
|
|
1121
1503
|
if (isHeaderNameFilter) {
|
|
@@ -1181,7 +1563,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1181
1563
|
_rewrite === true ||
|
|
1182
1564
|
(_rewrite === undefined && self[key] !== false)
|
|
1183
1565
|
) {
|
|
1184
|
-
self[key || _header] = normalizeValue(_value);
|
|
1566
|
+
self[headerSlot(key || _header)] = normalizeValue(_value);
|
|
1185
1567
|
}
|
|
1186
1568
|
}
|
|
1187
1569
|
|
|
@@ -1192,8 +1574,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1192
1574
|
setHeaders(header, valueOrRewrite);
|
|
1193
1575
|
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1194
1576
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1195
|
-
} else if (utils$1.isObject(header) && utils$1.
|
|
1196
|
-
let obj =
|
|
1577
|
+
} else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
|
|
1578
|
+
let obj = Object.create(null),
|
|
1197
1579
|
dest,
|
|
1198
1580
|
key;
|
|
1199
1581
|
for (const entry of header) {
|
|
@@ -1201,11 +1583,14 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1201
1583
|
throw new TypeError('Object iterator must return a key-value pair');
|
|
1202
1584
|
}
|
|
1203
1585
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
: entry[1];
|
|
1586
|
+
key = entry[0];
|
|
1587
|
+
|
|
1588
|
+
if (utils$1.hasOwnProp(obj, key)) {
|
|
1589
|
+
dest = obj[key];
|
|
1590
|
+
obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
|
|
1591
|
+
} else {
|
|
1592
|
+
obj[key] = entry[1];
|
|
1593
|
+
}
|
|
1209
1594
|
}
|
|
1210
1595
|
|
|
1211
1596
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -1307,7 +1692,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1307
1692
|
|
|
1308
1693
|
normalize(format) {
|
|
1309
1694
|
const self = this;
|
|
1310
|
-
const headers =
|
|
1695
|
+
const headers = Object.create(null);
|
|
1311
1696
|
|
|
1312
1697
|
utils$1.forEach(this, (value, header) => {
|
|
1313
1698
|
const key = utils$1.findKey(headers, header);
|
|
@@ -1318,7 +1703,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1318
1703
|
return;
|
|
1319
1704
|
}
|
|
1320
1705
|
|
|
1321
|
-
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
1706
|
+
const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
|
|
1322
1707
|
|
|
1323
1708
|
if (normalized !== header) {
|
|
1324
1709
|
delete self[header];
|
|
@@ -1359,7 +1744,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1359
1744
|
}
|
|
1360
1745
|
|
|
1361
1746
|
getSetCookie() {
|
|
1362
|
-
|
|
1747
|
+
const value = this.get('set-cookie');
|
|
1748
|
+
return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
|
|
1363
1749
|
}
|
|
1364
1750
|
|
|
1365
1751
|
get [Symbol.toStringTag]() {
|
|
@@ -1370,6 +1756,10 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1370
1756
|
return thing instanceof this ? thing : new this(thing);
|
|
1371
1757
|
}
|
|
1372
1758
|
|
|
1759
|
+
static parseParameters(value) {
|
|
1760
|
+
return parseParameters(value);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1373
1763
|
static concat(first, ...targets) {
|
|
1374
1764
|
const computed = new this(first);
|
|
1375
1765
|
|
|
@@ -1380,8 +1770,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
1380
1770
|
|
|
1381
1771
|
static accessor(header) {
|
|
1382
1772
|
const internals =
|
|
1383
|
-
(this[$internals] =
|
|
1384
|
-
this[$internals] =
|
|
1773
|
+
(this[$internals$1] =
|
|
1774
|
+
this[$internals$1] =
|
|
1385
1775
|
{
|
|
1386
1776
|
accessors: {},
|
|
1387
1777
|
});
|
|
@@ -1495,12 +1885,114 @@ function redactConfig(config, redactKeys) {
|
|
|
1495
1885
|
return visit(config);
|
|
1496
1886
|
}
|
|
1497
1887
|
|
|
1888
|
+
function stringifySafely$1(value) {
|
|
1889
|
+
try {
|
|
1890
|
+
return String(value);
|
|
1891
|
+
} catch (err) {
|
|
1892
|
+
return '';
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
function aggregateErrorMessage(error) {
|
|
1897
|
+
const message = error.errors
|
|
1898
|
+
.map((entry) => {
|
|
1899
|
+
try {
|
|
1900
|
+
return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
|
|
1901
|
+
} catch (err) {
|
|
1902
|
+
return '';
|
|
1903
|
+
}
|
|
1904
|
+
})
|
|
1905
|
+
.filter(Boolean)
|
|
1906
|
+
.join('; ');
|
|
1907
|
+
|
|
1908
|
+
return message || error.name || 'AggregateError';
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// Shared with `Axios.prototype.request`, which splices the reconstructed
|
|
1912
|
+
// caller frames in ahead of this marker.
|
|
1913
|
+
const CAUSED_BY_SEPARATOR = '\nCaused by: ';
|
|
1914
|
+
const $causeStack = Symbol('causeStack');
|
|
1915
|
+
|
|
1916
|
+
// Match the section we appended, not marker-like text in an error message or
|
|
1917
|
+
// a replacement stack supplied by the caller. Do not re-read the cause's stack.
|
|
1918
|
+
function getCauseStackIndex(error, stack) {
|
|
1919
|
+
const causeStack = utils$1.hasOwnProp(error, $causeStack) && error[$causeStack];
|
|
1920
|
+
|
|
1921
|
+
return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Append the stack of a wrapped error to `target.stack`.
|
|
1926
|
+
*
|
|
1927
|
+
* `cause` already exposes the original error for tooling that walks the standard
|
|
1928
|
+
* cause chain, but many error reporters read `stack` and nothing else. Inlining
|
|
1929
|
+
* the wrapped stack there means those reporters surface the underlying failure
|
|
1930
|
+
* instead of the axios frames that normalized it (see #6670).
|
|
1931
|
+
*
|
|
1932
|
+
* Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
|
|
1933
|
+
* without stack support, or a replaced `stack` property can leave the value
|
|
1934
|
+
* missing, non-string, or read-only, and normalizing an error must not throw
|
|
1935
|
+
* because of that.
|
|
1936
|
+
*
|
|
1937
|
+
* @param {Error} target The AxiosError being built.
|
|
1938
|
+
* @param {Error} source The error being wrapped.
|
|
1939
|
+
*
|
|
1940
|
+
* @returns {void}
|
|
1941
|
+
*/
|
|
1942
|
+
function appendCauseStack(target, source) {
|
|
1943
|
+
try {
|
|
1944
|
+
const sourceStack = source && source.stack;
|
|
1945
|
+
|
|
1946
|
+
if (typeof sourceStack !== 'string' || !sourceStack) {
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
const targetStack = target.stack;
|
|
1951
|
+
|
|
1952
|
+
if (typeof targetStack !== 'string' || !targetStack) {
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
// Each call to `from()` creates a fresh target. Re-wrapping includes the
|
|
1957
|
+
// previous stack verbatim, adding one cause section per wrap.
|
|
1958
|
+
const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
|
|
1959
|
+
target.stack = targetStack + causeStack;
|
|
1960
|
+
Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
|
|
1961
|
+
} catch (e) {
|
|
1962
|
+
// Ignore failures from custom stack hooks or un-writable stack properties.
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1498
1966
|
let AxiosError$1 = class AxiosError extends Error {
|
|
1499
1967
|
static from(error, code, config, request, response, customProps) {
|
|
1500
|
-
|
|
1501
|
-
|
|
1968
|
+
// `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
|
|
1969
|
+
// failures) has an empty `message`; its detail lives in `errors[]`. Without
|
|
1970
|
+
// this, the wrapped error surfaces with a blank message (see #6721).
|
|
1971
|
+
let message = error.message;
|
|
1972
|
+
if (!message && utils$1.isArray(error.errors) && error.errors.length) {
|
|
1973
|
+
message = aggregateErrorMessage(error);
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
const axiosError = new AxiosError(message, code || error.code, config, request, response);
|
|
1977
|
+
// Match native `Error` `cause` semantics: non-enumerable. The wrapped
|
|
1978
|
+
// error often carries circular internals (sockets, requests, agents), so
|
|
1979
|
+
// an enumerable `cause` makes structured loggers (pino/winston) and any
|
|
1980
|
+
// own-property walk throw "Converting circular structure to JSON".
|
|
1981
|
+
// Regression from #6982; see #7205. `__proto__: null` mirrors the
|
|
1982
|
+
// `message` descriptor below (prototype-pollution-safe descriptor).
|
|
1983
|
+
Object.defineProperty(axiosError, 'cause', {
|
|
1984
|
+
__proto__: null,
|
|
1985
|
+
value: error,
|
|
1986
|
+
writable: true,
|
|
1987
|
+
enumerable: false,
|
|
1988
|
+
configurable: true,
|
|
1989
|
+
});
|
|
1502
1990
|
axiosError.name = error.name;
|
|
1503
1991
|
|
|
1992
|
+
// Inline the wrapped stack for reporters that read only `stack`; the `cause`
|
|
1993
|
+
// property above already covers cause-aware tooling.
|
|
1994
|
+
appendCauseStack(axiosError, error);
|
|
1995
|
+
|
|
1504
1996
|
// Preserve status from the original error if not already set from response
|
|
1505
1997
|
if (error.status != null && axiosError.status == null) {
|
|
1506
1998
|
axiosError.status = error.status;
|
|
@@ -1599,6 +2091,10 @@ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
|
1599
2091
|
// eslint-disable-next-line strict
|
|
1600
2092
|
var httpAdapter = null;
|
|
1601
2093
|
|
|
2094
|
+
// Default nesting limit shared with the inverse transform (formDataToJSON) so
|
|
2095
|
+
// the FormData <-> JSON round-trip stays symmetric.
|
|
2096
|
+
const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
|
|
2097
|
+
|
|
1602
2098
|
/**
|
|
1603
2099
|
* Determines if the given thing is a array or js object.
|
|
1604
2100
|
*
|
|
@@ -1688,29 +2184,20 @@ function toFormData$1(obj, formData, options) {
|
|
|
1688
2184
|
// eslint-disable-next-line no-param-reassign
|
|
1689
2185
|
formData = formData || new (FormData)();
|
|
1690
2186
|
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
metaTokens: true,
|
|
1696
|
-
dots: false,
|
|
1697
|
-
indexes: false,
|
|
1698
|
-
},
|
|
1699
|
-
false,
|
|
1700
|
-
function defined(option, source) {
|
|
1701
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1702
|
-
return !utils$1.isUndefined(source[option]);
|
|
1703
|
-
}
|
|
1704
|
-
);
|
|
2187
|
+
const option = (name, fallback) => {
|
|
2188
|
+
const value = utils$1.getSafeProp(options, name);
|
|
2189
|
+
return utils$1.isUndefined(value) ? fallback : value;
|
|
2190
|
+
};
|
|
1705
2191
|
|
|
1706
|
-
const metaTokens =
|
|
2192
|
+
const metaTokens = option('metaTokens', true);
|
|
1707
2193
|
// eslint-disable-next-line no-use-before-define
|
|
1708
|
-
const visitor =
|
|
1709
|
-
const dots =
|
|
1710
|
-
const indexes =
|
|
1711
|
-
const _Blob =
|
|
1712
|
-
const maxDepth =
|
|
2194
|
+
const visitor = option('visitor') || defaultVisitor;
|
|
2195
|
+
const dots = option('dots', false);
|
|
2196
|
+
const indexes = option('indexes', false);
|
|
2197
|
+
const _Blob = option('Blob') || (typeof Blob !== 'undefined' && Blob);
|
|
2198
|
+
const maxDepth = option('maxDepth', DEFAULT_FORM_DATA_MAX_DEPTH);
|
|
1713
2199
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
2200
|
+
const stack = [];
|
|
1714
2201
|
|
|
1715
2202
|
if (!utils$1.isFunction(visitor)) {
|
|
1716
2203
|
throw new TypeError('visitor must be a function');
|
|
@@ -1732,24 +2219,62 @@ function toFormData$1(obj, formData, options) {
|
|
|
1732
2219
|
}
|
|
1733
2220
|
|
|
1734
2221
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
1735
|
-
|
|
2222
|
+
if (useBlob && typeof _Blob === 'function') {
|
|
2223
|
+
return new _Blob([value]);
|
|
2224
|
+
}
|
|
2225
|
+
throw new AxiosError$1(
|
|
2226
|
+
'Blob is not supported. Use a Buffer instead.',
|
|
2227
|
+
AxiosError$1.ERR_NOT_SUPPORT
|
|
2228
|
+
);
|
|
1736
2229
|
}
|
|
1737
2230
|
|
|
1738
2231
|
return value;
|
|
1739
2232
|
}
|
|
1740
2233
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
2234
|
+
function throwIfMaxDepthExceeded(depth) {
|
|
2235
|
+
if (depth > maxDepth) {
|
|
2236
|
+
throw new AxiosError$1(
|
|
2237
|
+
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
2238
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
2239
|
+
);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
function stringifyWithDepthLimit(value, depth) {
|
|
2244
|
+
if (maxDepth === Infinity) {
|
|
2245
|
+
return JSON.stringify(value);
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
const ancestors = [];
|
|
2249
|
+
|
|
2250
|
+
return JSON.stringify(value, function limitDepth(_key, currentValue) {
|
|
2251
|
+
if (!utils$1.isObject(currentValue)) {
|
|
2252
|
+
return currentValue;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
|
|
2256
|
+
ancestors.pop();
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
ancestors.push(currentValue);
|
|
2260
|
+
throwIfMaxDepthExceeded(depth + ancestors.length - 1);
|
|
2261
|
+
|
|
2262
|
+
return currentValue;
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* Default visitor.
|
|
2268
|
+
*
|
|
2269
|
+
* @param {*} value
|
|
2270
|
+
* @param {String|Number} key
|
|
2271
|
+
* @param {Array<String|Number>} path
|
|
2272
|
+
* @this {FormData}
|
|
2273
|
+
*
|
|
2274
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
2275
|
+
*/
|
|
2276
|
+
function defaultVisitor(value, key, path) {
|
|
2277
|
+
let arr = value;
|
|
1753
2278
|
|
|
1754
2279
|
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1755
2280
|
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
@@ -1761,7 +2286,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
1761
2286
|
// eslint-disable-next-line no-param-reassign
|
|
1762
2287
|
key = metaTokens ? key : key.slice(0, -2);
|
|
1763
2288
|
// eslint-disable-next-line no-param-reassign
|
|
1764
|
-
value =
|
|
2289
|
+
value = stringifyWithDepthLimit(value, 1);
|
|
1765
2290
|
} else if (
|
|
1766
2291
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1767
2292
|
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
@@ -1794,8 +2319,6 @@ function toFormData$1(obj, formData, options) {
|
|
|
1794
2319
|
return false;
|
|
1795
2320
|
}
|
|
1796
2321
|
|
|
1797
|
-
const stack = [];
|
|
1798
|
-
|
|
1799
2322
|
const exposedHelpers = Object.assign(predicates, {
|
|
1800
2323
|
defaultVisitor,
|
|
1801
2324
|
convertValue,
|
|
@@ -1805,12 +2328,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
1805
2328
|
function build(value, path, depth = 0) {
|
|
1806
2329
|
if (utils$1.isUndefined(value)) return;
|
|
1807
2330
|
|
|
1808
|
-
|
|
1809
|
-
throw new AxiosError$1(
|
|
1810
|
-
'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
|
|
1811
|
-
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
1812
|
-
);
|
|
1813
|
-
}
|
|
2331
|
+
throwIfMaxDepthExceeded(depth);
|
|
1814
2332
|
|
|
1815
2333
|
if (stack.indexOf(value) !== -1) {
|
|
1816
2334
|
throw new Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -1884,9 +2402,7 @@ prototype.append = function append(name, value) {
|
|
|
1884
2402
|
|
|
1885
2403
|
prototype.toString = function toString(encoder) {
|
|
1886
2404
|
const _encode = encoder
|
|
1887
|
-
?
|
|
1888
|
-
return encoder.call(this, value, encode$1);
|
|
1889
|
-
}
|
|
2405
|
+
? (value) => encoder.call(this, value, encode$1)
|
|
1890
2406
|
: encode$1;
|
|
1891
2407
|
|
|
1892
2408
|
return this._pairs
|
|
@@ -1925,8 +2441,7 @@ function buildURL(url, params, options) {
|
|
|
1925
2441
|
if (!params) {
|
|
1926
2442
|
return url;
|
|
1927
2443
|
}
|
|
1928
|
-
|
|
1929
|
-
const _encode = (options && options.encode) || encode;
|
|
2444
|
+
url = url || '';
|
|
1930
2445
|
|
|
1931
2446
|
const _options = utils$1.isFunction(options)
|
|
1932
2447
|
? {
|
|
@@ -1934,7 +2449,11 @@ function buildURL(url, params, options) {
|
|
|
1934
2449
|
}
|
|
1935
2450
|
: options;
|
|
1936
2451
|
|
|
1937
|
-
|
|
2452
|
+
// Read serializer options pollution-safely: own properties and methods on a
|
|
2453
|
+
// class/template prototype are honored, but values injected onto a polluted
|
|
2454
|
+
// Object.prototype are ignored.
|
|
2455
|
+
const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
|
|
2456
|
+
const serializeFn = utils$1.getSafeProp(_options, 'serialize');
|
|
1938
2457
|
|
|
1939
2458
|
let serializedParams;
|
|
1940
2459
|
|
|
@@ -1958,9 +2477,67 @@ function buildURL(url, params, options) {
|
|
|
1958
2477
|
return url;
|
|
1959
2478
|
}
|
|
1960
2479
|
|
|
2480
|
+
const $internals = Symbol('internals');
|
|
2481
|
+
|
|
2482
|
+
// `handlers` is public and may be replaced with a nullish value by user code;
|
|
2483
|
+
// `clear()` has always tolerated that. Treat it as an empty stack rather than
|
|
2484
|
+
// dereferencing it.
|
|
2485
|
+
function countHandlers(handlers) {
|
|
2486
|
+
return handlers ? handlers.length : 0;
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
function trimHandlers(handlers) {
|
|
2490
|
+
if (!handlers) {
|
|
2491
|
+
return;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
while (handlers.length && handlers[handlers.length - 1] === null) {
|
|
2495
|
+
handlers.pop();
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
// Preserve the array-key coercion used before IDs were stored in a Map, without
|
|
2500
|
+
// treating null, empty strings, or noncanonical numeric strings as ID zero.
|
|
2501
|
+
function normalizeHandlerId(id) {
|
|
2502
|
+
if (typeof id === 'string' && id !== '' && String(Number(id)) === id) {
|
|
2503
|
+
return Number(id);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
return id;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
function syncHandlerEntries(manager, internals) {
|
|
2510
|
+
const handlers = manager.handlers;
|
|
2511
|
+
const length = countHandlers(handlers);
|
|
2512
|
+
|
|
2513
|
+
if (handlers !== internals.handlersRef) {
|
|
2514
|
+
internals.handlersRef = handlers;
|
|
2515
|
+
internals.handlerEntries.clear();
|
|
2516
|
+
} else if (length !== internals.handlersLength) {
|
|
2517
|
+
if (!length) {
|
|
2518
|
+
internals.handlerEntries.clear();
|
|
2519
|
+
} else {
|
|
2520
|
+
internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
|
|
2521
|
+
if (handlers[entry.index] !== entry.handler) {
|
|
2522
|
+
internals.handlerEntries.delete(id);
|
|
2523
|
+
}
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
internals.handlersLength = length;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
1961
2531
|
class InterceptorManager {
|
|
1962
2532
|
constructor() {
|
|
1963
2533
|
this.handlers = [];
|
|
2534
|
+
this[$internals] = {
|
|
2535
|
+
handlersRef: this.handlers,
|
|
2536
|
+
handlersLength: this.handlers.length,
|
|
2537
|
+
handlerEntries: new Map(),
|
|
2538
|
+
iterationDepth: 0,
|
|
2539
|
+
nextId: 0,
|
|
2540
|
+
};
|
|
1964
2541
|
}
|
|
1965
2542
|
|
|
1966
2543
|
/**
|
|
@@ -1973,13 +2550,30 @@ class InterceptorManager {
|
|
|
1973
2550
|
* @return {Number} An ID used to remove interceptor later
|
|
1974
2551
|
*/
|
|
1975
2552
|
use(fulfilled, rejected, options) {
|
|
1976
|
-
|
|
2553
|
+
const handler = {
|
|
1977
2554
|
fulfilled,
|
|
1978
2555
|
rejected,
|
|
1979
2556
|
synchronous: options ? options.synchronous : false,
|
|
1980
2557
|
runWhen: options ? options.runWhen : null,
|
|
2558
|
+
};
|
|
2559
|
+
const internals = this[$internals];
|
|
2560
|
+
|
|
2561
|
+
if (this.handlers == null) {
|
|
2562
|
+
this.handlers = [];
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
syncHandlerEntries(this, internals);
|
|
2566
|
+
|
|
2567
|
+
const id = internals.nextId++;
|
|
2568
|
+
|
|
2569
|
+
this.handlers.push(handler);
|
|
2570
|
+
internals.handlerEntries.set(id, {
|
|
2571
|
+
handler,
|
|
2572
|
+
index: this.handlers.length - 1,
|
|
1981
2573
|
});
|
|
1982
|
-
|
|
2574
|
+
internals.handlersLength = this.handlers.length;
|
|
2575
|
+
|
|
2576
|
+
return id;
|
|
1983
2577
|
}
|
|
1984
2578
|
|
|
1985
2579
|
/**
|
|
@@ -1990,8 +2584,28 @@ class InterceptorManager {
|
|
|
1990
2584
|
* @returns {void}
|
|
1991
2585
|
*/
|
|
1992
2586
|
eject(id) {
|
|
1993
|
-
|
|
1994
|
-
|
|
2587
|
+
const internals = this[$internals];
|
|
2588
|
+
|
|
2589
|
+
syncHandlerEntries(this, internals);
|
|
2590
|
+
|
|
2591
|
+
const handlerId = normalizeHandlerId(id);
|
|
2592
|
+
const entry = internals.handlerEntries.get(handlerId);
|
|
2593
|
+
|
|
2594
|
+
if (entry) {
|
|
2595
|
+
internals.handlerEntries.delete(handlerId);
|
|
2596
|
+
|
|
2597
|
+
// Ignore IDs invalidated by clear or direct replacement of handlers.
|
|
2598
|
+
if (this.handlers[entry.index] !== entry.handler) {
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
this.handlers[entry.index] = null;
|
|
2603
|
+
|
|
2604
|
+
// Do not reuse an index while forEach is walking its length snapshot.
|
|
2605
|
+
if (!internals.iterationDepth) {
|
|
2606
|
+
trimHandlers(this.handlers);
|
|
2607
|
+
internals.handlersLength = this.handlers.length;
|
|
2608
|
+
}
|
|
1995
2609
|
}
|
|
1996
2610
|
}
|
|
1997
2611
|
|
|
@@ -2003,6 +2617,7 @@ class InterceptorManager {
|
|
|
2003
2617
|
clear() {
|
|
2004
2618
|
if (this.handlers) {
|
|
2005
2619
|
this.handlers = [];
|
|
2620
|
+
syncHandlerEntries(this, this[$internals]);
|
|
2006
2621
|
}
|
|
2007
2622
|
}
|
|
2008
2623
|
|
|
@@ -2017,11 +2632,25 @@ class InterceptorManager {
|
|
|
2017
2632
|
* @returns {void}
|
|
2018
2633
|
*/
|
|
2019
2634
|
forEach(fn) {
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2635
|
+
const internals = this[$internals];
|
|
2636
|
+
|
|
2637
|
+
syncHandlerEntries(this, internals);
|
|
2638
|
+
|
|
2639
|
+
internals.iterationDepth++;
|
|
2640
|
+
|
|
2641
|
+
try {
|
|
2642
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
2643
|
+
if (h !== null) {
|
|
2644
|
+
fn(h);
|
|
2645
|
+
}
|
|
2646
|
+
});
|
|
2647
|
+
} finally {
|
|
2648
|
+
if (!--internals.iterationDepth) {
|
|
2649
|
+
syncHandlerEntries(this, internals);
|
|
2650
|
+
trimHandlers(this.handlers);
|
|
2651
|
+
internals.handlersLength = countHandlers(this.handlers);
|
|
2023
2652
|
}
|
|
2024
|
-
}
|
|
2653
|
+
}
|
|
2025
2654
|
}
|
|
2026
2655
|
}
|
|
2027
2656
|
|
|
@@ -2031,6 +2660,8 @@ var transitionalDefaults = {
|
|
|
2031
2660
|
clarifyTimeoutError: false,
|
|
2032
2661
|
legacyInterceptorReqResOrdering: true,
|
|
2033
2662
|
advertiseZstdAcceptEncoding: false,
|
|
2663
|
+
validateStatusUndefinedResolves: true,
|
|
2664
|
+
encodeBasicAuthUsername: false,
|
|
2034
2665
|
};
|
|
2035
2666
|
|
|
2036
2667
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -2122,6 +2753,17 @@ function toURLEncodedForm(data, options) {
|
|
|
2122
2753
|
});
|
|
2123
2754
|
}
|
|
2124
2755
|
|
|
2756
|
+
const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
|
|
2757
|
+
|
|
2758
|
+
function throwIfDepthExceeded(index) {
|
|
2759
|
+
if (index > MAX_DEPTH) {
|
|
2760
|
+
throw new AxiosError$1(
|
|
2761
|
+
'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
|
|
2762
|
+
AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
|
|
2763
|
+
);
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2125
2767
|
/**
|
|
2126
2768
|
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
2127
2769
|
*
|
|
@@ -2130,13 +2772,26 @@ function toURLEncodedForm(data, options) {
|
|
|
2130
2772
|
* @returns An array of strings.
|
|
2131
2773
|
*/
|
|
2132
2774
|
function parsePropPath(name) {
|
|
2133
|
-
// foo[x][y][z]
|
|
2134
|
-
// foo.x.y.z
|
|
2135
|
-
//
|
|
2136
|
-
//
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2775
|
+
// foo[x][y][z] -> ['foo', 'x', 'y', 'z']
|
|
2776
|
+
// foo.x.y.z -> ['foo', 'x', 'y', 'z']
|
|
2777
|
+
// A path is split on `.` and on `[...]` groups. A segment — whether written
|
|
2778
|
+
// in dot notation or captured inside brackets — may contain any character
|
|
2779
|
+
// except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
|
|
2780
|
+
// literal instead of being split (#5402). `.`, `[` and `]` keep their existing
|
|
2781
|
+
// meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
|
|
2782
|
+
// Excluding `[` from the bracket group also makes the match fail fast at the
|
|
2783
|
+
// next `[`, so a malformed name cannot rescan to the end of the string from
|
|
2784
|
+
// every unmatched `[` — parsing stays linear in the length of the name.
|
|
2785
|
+
const path = [];
|
|
2786
|
+
const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
|
|
2787
|
+
let match;
|
|
2788
|
+
|
|
2789
|
+
while ((match = pattern.exec(name)) !== null) {
|
|
2790
|
+
throwIfDepthExceeded(path.length);
|
|
2791
|
+
path.push(match[0] === '[]' ? '' : match[1] || match[0]);
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
return path;
|
|
2140
2795
|
}
|
|
2141
2796
|
|
|
2142
2797
|
/**
|
|
@@ -2159,6 +2814,29 @@ function arrayToObject(arr) {
|
|
|
2159
2814
|
return obj;
|
|
2160
2815
|
}
|
|
2161
2816
|
|
|
2817
|
+
function normalizeArray(value) {
|
|
2818
|
+
if (!utils$1.isArray(value)) return value;
|
|
2819
|
+
|
|
2820
|
+
const keys = Object.keys(value);
|
|
2821
|
+
return keys.length !== value.length || keys.some((key, index) => key !== String(index))
|
|
2822
|
+
? arrayToObject(value)
|
|
2823
|
+
: value;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
function normalizeArrays(obj) {
|
|
2827
|
+
const pending = [obj];
|
|
2828
|
+
while (pending.length) {
|
|
2829
|
+
const target = pending.pop();
|
|
2830
|
+
Object.keys(target).forEach((key) => {
|
|
2831
|
+
const value = (target[key] = normalizeArray(target[key]));
|
|
2832
|
+
if (utils$1.isArray(value) || utils$1.isPlainObject(value)) {
|
|
2833
|
+
pending.push(value);
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
return obj;
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2162
2840
|
/**
|
|
2163
2841
|
* It takes a FormData object and returns a JavaScript object
|
|
2164
2842
|
*
|
|
@@ -2168,6 +2846,8 @@ function arrayToObject(arr) {
|
|
|
2168
2846
|
*/
|
|
2169
2847
|
function formDataToJSON(formData) {
|
|
2170
2848
|
function buildPath(path, value, target, index) {
|
|
2849
|
+
throwIfDepthExceeded(index);
|
|
2850
|
+
|
|
2171
2851
|
let name = path[index++];
|
|
2172
2852
|
|
|
2173
2853
|
if (name === '__proto__') return true;
|
|
@@ -2178,6 +2858,7 @@ function formDataToJSON(formData) {
|
|
|
2178
2858
|
|
|
2179
2859
|
if (isLast) {
|
|
2180
2860
|
if (utils$1.hasOwnProp(target, name)) {
|
|
2861
|
+
target[name] = normalizeArray(target[name]);
|
|
2181
2862
|
target[name] = utils$1.isArray(target[name])
|
|
2182
2863
|
? target[name].concat(value)
|
|
2183
2864
|
: [target[name], value];
|
|
@@ -2208,12 +2889,26 @@ function formDataToJSON(formData) {
|
|
|
2208
2889
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
2209
2890
|
});
|
|
2210
2891
|
|
|
2211
|
-
return obj;
|
|
2892
|
+
return normalizeArrays(obj);
|
|
2212
2893
|
}
|
|
2213
2894
|
|
|
2214
2895
|
return null;
|
|
2215
2896
|
}
|
|
2216
2897
|
|
|
2898
|
+
const methodList = Object.freeze([
|
|
2899
|
+
'get',
|
|
2900
|
+
'delete',
|
|
2901
|
+
'head',
|
|
2902
|
+
'options',
|
|
2903
|
+
'post',
|
|
2904
|
+
'put',
|
|
2905
|
+
'patch',
|
|
2906
|
+
'purge',
|
|
2907
|
+
'link',
|
|
2908
|
+
'unlink',
|
|
2909
|
+
'query',
|
|
2910
|
+
]);
|
|
2911
|
+
|
|
2217
2912
|
const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
2218
2913
|
|
|
2219
2914
|
/**
|
|
@@ -2376,7 +3071,7 @@ const defaults = {
|
|
|
2376
3071
|
},
|
|
2377
3072
|
};
|
|
2378
3073
|
|
|
2379
|
-
utils$1.forEach(
|
|
3074
|
+
utils$1.forEach(methodList, (method) => {
|
|
2380
3075
|
defaults.headers[method] = {};
|
|
2381
3076
|
});
|
|
2382
3077
|
|
|
@@ -2448,11 +3143,120 @@ function settle(resolve, reject, response) {
|
|
|
2448
3143
|
}
|
|
2449
3144
|
}
|
|
2450
3145
|
|
|
3146
|
+
const urlParserControlCharacters = /[\t\n\r]/g;
|
|
3147
|
+
|
|
3148
|
+
/**
|
|
3149
|
+
* Match WHATWG URL preprocessing before checking a URL's protocol.
|
|
3150
|
+
*
|
|
3151
|
+
* @param {string} url
|
|
3152
|
+
*
|
|
3153
|
+
* @returns {string}
|
|
3154
|
+
*/
|
|
3155
|
+
function normalizeURLForProtocolCheck(url) {
|
|
3156
|
+
if (typeof url !== 'string') {
|
|
3157
|
+
return url;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
let start = 0;
|
|
3161
|
+
|
|
3162
|
+
while (start < url.length && url.charCodeAt(start) <= 0x20) {
|
|
3163
|
+
start++;
|
|
3164
|
+
}
|
|
3165
|
+
|
|
3166
|
+
return url.slice(start).replace(urlParserControlCharacters, '');
|
|
3167
|
+
}
|
|
3168
|
+
|
|
2451
3169
|
function parseProtocol(url) {
|
|
2452
3170
|
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
2453
|
-
return (match && match[1]) || '';
|
|
3171
|
+
return (match && match[1].toLowerCase()) || '';
|
|
2454
3172
|
}
|
|
2455
3173
|
|
|
3174
|
+
const decodeCookieValue = (value) => {
|
|
3175
|
+
try {
|
|
3176
|
+
return decodeURIComponent(value);
|
|
3177
|
+
} catch (e) {
|
|
3178
|
+
return value;
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
|
|
3182
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
3183
|
+
? // Standard browser envs support document.cookie
|
|
3184
|
+
{
|
|
3185
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
3186
|
+
if (typeof document === 'undefined') return;
|
|
3187
|
+
|
|
3188
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
3189
|
+
|
|
3190
|
+
if (utils$1.isNumber(expires)) {
|
|
3191
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
3192
|
+
}
|
|
3193
|
+
if (utils$1.isString(path)) {
|
|
3194
|
+
cookie.push(`path=${path}`);
|
|
3195
|
+
}
|
|
3196
|
+
if (utils$1.isString(domain)) {
|
|
3197
|
+
cookie.push(`domain=${domain}`);
|
|
3198
|
+
}
|
|
3199
|
+
if (secure === true) {
|
|
3200
|
+
cookie.push('secure');
|
|
3201
|
+
}
|
|
3202
|
+
if (utils$1.isString(sameSite)) {
|
|
3203
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3206
|
+
document.cookie = cookie.join('; ');
|
|
3207
|
+
},
|
|
3208
|
+
|
|
3209
|
+
read(name) {
|
|
3210
|
+
if (typeof document === 'undefined') return null;
|
|
3211
|
+
const cookieString = document.cookie;
|
|
3212
|
+
if (!cookieString) return null;
|
|
3213
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
3214
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
3215
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
3216
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
3217
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
3218
|
+
const cookies = cookieString.split(';');
|
|
3219
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
3220
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
3221
|
+
const eq = cookie.indexOf('=');
|
|
3222
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
3223
|
+
return decodeCookieValue(cookie.slice(eq + 1));
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
return null;
|
|
3227
|
+
},
|
|
3228
|
+
|
|
3229
|
+
async readAsync(name) {
|
|
3230
|
+
try {
|
|
3231
|
+
const store = typeof window !== 'undefined' && window.cookieStore;
|
|
3232
|
+
if (store && utils$1.isFunction(store.get)) {
|
|
3233
|
+
const cookie = await store.get(name);
|
|
3234
|
+
// Both APIs expose stored bytes; preserve Axios's existing URI decoding.
|
|
3235
|
+
return cookie ? decodeCookieValue(cookie.value) : null;
|
|
3236
|
+
}
|
|
3237
|
+
} catch (e) {
|
|
3238
|
+
// Restricted or unavailable storage retains the synchronous fallback.
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
return this.read(name);
|
|
3242
|
+
},
|
|
3243
|
+
|
|
3244
|
+
remove(name) {
|
|
3245
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
3246
|
+
},
|
|
3247
|
+
}
|
|
3248
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
3249
|
+
{
|
|
3250
|
+
write() {},
|
|
3251
|
+
read() {
|
|
3252
|
+
return null;
|
|
3253
|
+
},
|
|
3254
|
+
async readAsync() {
|
|
3255
|
+
return null;
|
|
3256
|
+
},
|
|
3257
|
+
remove() {},
|
|
3258
|
+
};
|
|
3259
|
+
|
|
2456
3260
|
/**
|
|
2457
3261
|
* Calculate data maxRate
|
|
2458
3262
|
* @param {Number} [samplesCount= 10]
|
|
@@ -2509,7 +3313,7 @@ function speedometer(samplesCount, min) {
|
|
|
2509
3313
|
* Throttle decorator
|
|
2510
3314
|
* @param {Function} fn
|
|
2511
3315
|
* @param {Number} freq
|
|
2512
|
-
* @return {Function}
|
|
3316
|
+
* @return {Array<Function>}
|
|
2513
3317
|
*/
|
|
2514
3318
|
function throttle(fn, freq) {
|
|
2515
3319
|
let timestamp = 0;
|
|
@@ -2544,8 +3348,9 @@ function throttle(fn, freq) {
|
|
|
2544
3348
|
};
|
|
2545
3349
|
|
|
2546
3350
|
const flush = () => lastArgs && invoke(lastArgs);
|
|
3351
|
+
const flushWith = (...args) => invoke(args);
|
|
2547
3352
|
|
|
2548
|
-
return [throttled, flush];
|
|
3353
|
+
return [throttled, flush, flushWith];
|
|
2549
3354
|
}
|
|
2550
3355
|
|
|
2551
3356
|
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
@@ -2553,12 +3358,12 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2553
3358
|
const _speedometer = speedometer(50, 250);
|
|
2554
3359
|
|
|
2555
3360
|
return throttle((e) => {
|
|
2556
|
-
if (!e ||
|
|
3361
|
+
if (!e || !utils$1.isNumber(e.loaded)) {
|
|
2557
3362
|
return;
|
|
2558
3363
|
}
|
|
2559
3364
|
const rawLoaded = e.loaded;
|
|
2560
3365
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2561
|
-
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
3366
|
+
const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
|
|
2562
3367
|
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2563
3368
|
const rate = _speedometer(progressBytes);
|
|
2564
3369
|
|
|
@@ -2595,83 +3400,20 @@ const progressEventDecorator = (total, throttled) => {
|
|
|
2595
3400
|
};
|
|
2596
3401
|
|
|
2597
3402
|
const asyncDecorator =
|
|
2598
|
-
(fn) =>
|
|
3403
|
+
(fn, scheduler = utils$1.asap) =>
|
|
2599
3404
|
(...args) =>
|
|
2600
|
-
|
|
3405
|
+
scheduler(() => fn(...args));
|
|
2601
3406
|
|
|
2602
3407
|
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
2603
|
-
? ((origin
|
|
2604
|
-
url = new URL(url, platform.origin);
|
|
3408
|
+
? ((origin) => (url) => {
|
|
3409
|
+
url = new URL(url, document.baseURI || platform.origin);
|
|
2605
3410
|
|
|
2606
3411
|
return (
|
|
2607
|
-
origin.protocol === url.protocol &&
|
|
2608
|
-
origin.host === url.host &&
|
|
2609
|
-
(isMSIE || origin.port === url.port)
|
|
3412
|
+
origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port
|
|
2610
3413
|
);
|
|
2611
|
-
})(
|
|
2612
|
-
new URL(platform.origin),
|
|
2613
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2614
|
-
)
|
|
3414
|
+
})(new URL(platform.origin))
|
|
2615
3415
|
: () => true;
|
|
2616
3416
|
|
|
2617
|
-
var cookies = platform.hasStandardBrowserEnv
|
|
2618
|
-
? // Standard browser envs support document.cookie
|
|
2619
|
-
{
|
|
2620
|
-
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2621
|
-
if (typeof document === 'undefined') return;
|
|
2622
|
-
|
|
2623
|
-
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2624
|
-
|
|
2625
|
-
if (utils$1.isNumber(expires)) {
|
|
2626
|
-
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2627
|
-
}
|
|
2628
|
-
if (utils$1.isString(path)) {
|
|
2629
|
-
cookie.push(`path=${path}`);
|
|
2630
|
-
}
|
|
2631
|
-
if (utils$1.isString(domain)) {
|
|
2632
|
-
cookie.push(`domain=${domain}`);
|
|
2633
|
-
}
|
|
2634
|
-
if (secure === true) {
|
|
2635
|
-
cookie.push('secure');
|
|
2636
|
-
}
|
|
2637
|
-
if (utils$1.isString(sameSite)) {
|
|
2638
|
-
cookie.push(`SameSite=${sameSite}`);
|
|
2639
|
-
}
|
|
2640
|
-
|
|
2641
|
-
document.cookie = cookie.join('; ');
|
|
2642
|
-
},
|
|
2643
|
-
|
|
2644
|
-
read(name) {
|
|
2645
|
-
if (typeof document === 'undefined') return null;
|
|
2646
|
-
// Match name=value by splitting on the semicolon separator instead of building a
|
|
2647
|
-
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
2648
|
-
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
2649
|
-
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
2650
|
-
// "; ", so ignore optional whitespace before each cookie name.
|
|
2651
|
-
const cookies = document.cookie.split(';');
|
|
2652
|
-
for (let i = 0; i < cookies.length; i++) {
|
|
2653
|
-
const cookie = cookies[i].replace(/^\s+/, '');
|
|
2654
|
-
const eq = cookie.indexOf('=');
|
|
2655
|
-
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
2656
|
-
return decodeURIComponent(cookie.slice(eq + 1));
|
|
2657
|
-
}
|
|
2658
|
-
}
|
|
2659
|
-
return null;
|
|
2660
|
-
},
|
|
2661
|
-
|
|
2662
|
-
remove(name) {
|
|
2663
|
-
this.write(name, '', Date.now() - 86400000, '/');
|
|
2664
|
-
},
|
|
2665
|
-
}
|
|
2666
|
-
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
2667
|
-
{
|
|
2668
|
-
write() {},
|
|
2669
|
-
read() {
|
|
2670
|
-
return null;
|
|
2671
|
-
},
|
|
2672
|
-
remove() {},
|
|
2673
|
-
};
|
|
2674
|
-
|
|
2675
3417
|
/**
|
|
2676
3418
|
* Determines whether the specified URL is absolute
|
|
2677
3419
|
*
|
|
@@ -2699,9 +3441,67 @@ function isAbsoluteURL(url) {
|
|
|
2699
3441
|
* @returns {string} The combined URL
|
|
2700
3442
|
*/
|
|
2701
3443
|
function combineURLs(baseURL, relativeURL) {
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
3444
|
+
if (!relativeURL) {
|
|
3445
|
+
return baseURL;
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
let end = baseURL.length;
|
|
3449
|
+
|
|
3450
|
+
while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
|
|
3451
|
+
end--;
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
const malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
3458
|
+
|
|
3459
|
+
// Redact the parts of a URL that can carry secrets before it is embedded in an
|
|
3460
|
+
// error message. AxiosError.toJSON() serializes `message` verbatim and errors
|
|
3461
|
+
// are commonly logged, while the opt-in `config.redact` model only cleans
|
|
3462
|
+
// config keys — it cannot reach the message. Redact only the genuinely
|
|
3463
|
+
// sensitive substrings — userinfo (credentials), query parameter values and
|
|
3464
|
+
// fragment contents — with the same REDACTED marker the config redaction uses,
|
|
3465
|
+
// while keeping the scheme, host, path and parameter names so the offending
|
|
3466
|
+
// request stays accurately identifiable.
|
|
3467
|
+
function redactFragment(fragment) {
|
|
3468
|
+
if (!fragment) {
|
|
3469
|
+
return fragment;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
|
|
3473
|
+
return `${separator}${parameterName}${REDACTED}`;
|
|
3474
|
+
});
|
|
3475
|
+
}
|
|
3476
|
+
|
|
3477
|
+
function redactSensitiveURLParts(url) {
|
|
3478
|
+
const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
|
|
3479
|
+
const fragmentIndex = redactedURL.indexOf('#');
|
|
3480
|
+
const urlWithoutFragment =
|
|
3481
|
+
fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
|
|
3482
|
+
const redactedURLWithoutFragment = urlWithoutFragment.replace(
|
|
3483
|
+
/([?&][^=&#]*=)[^&#]*/g,
|
|
3484
|
+
`$1${REDACTED}`
|
|
3485
|
+
);
|
|
3486
|
+
|
|
3487
|
+
if (fragmentIndex === -1) {
|
|
3488
|
+
return redactedURLWithoutFragment;
|
|
3489
|
+
}
|
|
3490
|
+
|
|
3491
|
+
return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
function assertValidHttpProtocolURL(url, config) {
|
|
3495
|
+
if (typeof url === 'string') {
|
|
3496
|
+
const normalizedURL = normalizeURLForProtocolCheck(url);
|
|
3497
|
+
if (malformedHttpProtocol.test(normalizedURL)) {
|
|
3498
|
+
throw new AxiosError$1(
|
|
3499
|
+
`Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
|
|
3500
|
+
AxiosError$1.ERR_INVALID_URL,
|
|
3501
|
+
config
|
|
3502
|
+
);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
2705
3505
|
}
|
|
2706
3506
|
|
|
2707
3507
|
/**
|
|
@@ -2714,16 +3514,244 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
2714
3514
|
*
|
|
2715
3515
|
* @returns {string} The combined full path
|
|
2716
3516
|
*/
|
|
2717
|
-
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
3517
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
|
|
3518
|
+
assertValidHttpProtocolURL(requestedURL, config);
|
|
2718
3519
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2719
3520
|
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
3521
|
+
assertValidHttpProtocolURL(baseURL, config);
|
|
2720
3522
|
return combineURLs(baseURL, requestedURL);
|
|
2721
3523
|
}
|
|
2722
3524
|
return requestedURL;
|
|
2723
3525
|
}
|
|
2724
3526
|
|
|
3527
|
+
function assertParamsAcyclic(params) {
|
|
3528
|
+
const pending = [{ value: params }];
|
|
3529
|
+
const active = new WeakSet();
|
|
3530
|
+
const visited = new WeakSet();
|
|
3531
|
+
|
|
3532
|
+
while (pending.length) {
|
|
3533
|
+
const { value, done } = pending.pop();
|
|
3534
|
+
if (!utils$1.isPlainObject(value) && !utils$1.isArray(value)) continue;
|
|
3535
|
+
if (done) {
|
|
3536
|
+
active.delete(value);
|
|
3537
|
+
continue;
|
|
3538
|
+
}
|
|
3539
|
+
if (active.has(value)) {
|
|
3540
|
+
throw new AxiosError$1(
|
|
3541
|
+
'Circular reference detected in params',
|
|
3542
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
3543
|
+
);
|
|
3544
|
+
}
|
|
3545
|
+
if (visited.has(value)) continue;
|
|
3546
|
+
visited.add(value);
|
|
3547
|
+
active.add(value);
|
|
3548
|
+
pending.push({ value, done: true });
|
|
3549
|
+
|
|
3550
|
+
const keys = Object.keys(value);
|
|
3551
|
+
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
3552
|
+
Object.getOwnPropertySymbols(value).forEach((key) => {
|
|
3553
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
3554
|
+
if (descriptor && descriptor.enumerable) keys.push(key);
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
// Shallow array elements retain fields filtered during plain-object merges.
|
|
3558
|
+
// Inspect reserved data properties without evaluating their accessors.
|
|
3559
|
+
keys.forEach((key) => {
|
|
3560
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
3561
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
3562
|
+
if (descriptor && utils$1.hasOwnProp(descriptor, 'value')) {
|
|
3563
|
+
pending.push({ value: descriptor.value });
|
|
3564
|
+
}
|
|
3565
|
+
} else {
|
|
3566
|
+
pending.push({ value: value[key] });
|
|
3567
|
+
}
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
|
|
2725
3572
|
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
2726
3573
|
|
|
3574
|
+
const ownEnumerableKeys = (thing) => {
|
|
3575
|
+
if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
|
|
3576
|
+
return Object.keys(thing).concat(
|
|
3577
|
+
Object.getOwnPropertySymbols(thing).filter((symbol) => {
|
|
3578
|
+
const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
|
|
3579
|
+
return descriptor && descriptor.enumerable;
|
|
3580
|
+
})
|
|
3581
|
+
);
|
|
3582
|
+
}
|
|
3583
|
+
return Object.keys(thing);
|
|
3584
|
+
};
|
|
3585
|
+
|
|
3586
|
+
// Copy params without recursive merges so the serializer remains responsible
|
|
3587
|
+
// for its depth policy. Only visit defaults that contribute to the result.
|
|
3588
|
+
function mergeParams(a, b) {
|
|
3589
|
+
const pending = [];
|
|
3590
|
+
const copies = new WeakMap();
|
|
3591
|
+
const empty = {};
|
|
3592
|
+
|
|
3593
|
+
function copy(target, source) {
|
|
3594
|
+
if (!utils$1.isPlainObject(source)) {
|
|
3595
|
+
return utils$1.isArray(source) ? source.slice() : source;
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
const base = utils$1.isPlainObject(target) ? target : empty;
|
|
3599
|
+
let bases = copies.get(source);
|
|
3600
|
+
if (!bases) {
|
|
3601
|
+
bases = new WeakMap();
|
|
3602
|
+
copies.set(source, bases);
|
|
3603
|
+
}
|
|
3604
|
+
if (bases.has(base)) return bases.get(base);
|
|
3605
|
+
|
|
3606
|
+
const result = {};
|
|
3607
|
+
bases.set(base, result);
|
|
3608
|
+
pending.push({ base, source, result });
|
|
3609
|
+
return result;
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3612
|
+
const result = utils$1.isUndefined(b) ? copy(undefined, a) : copy(a, b);
|
|
3613
|
+
while (pending.length) {
|
|
3614
|
+
const { base, source, result: target } = pending.pop();
|
|
3615
|
+
const baseKeys = new Set(ownEnumerableKeys(base));
|
|
3616
|
+
const sourceKeys = new Set(ownEnumerableKeys(source));
|
|
3617
|
+
const keys = new Set([...baseKeys, ...sourceKeys]);
|
|
3618
|
+
|
|
3619
|
+
keys.forEach((key) => {
|
|
3620
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;
|
|
3621
|
+
const hasSource = sourceKeys.has(key);
|
|
3622
|
+
const value = hasSource ? source[key] : undefined;
|
|
3623
|
+
const previous =
|
|
3624
|
+
(!hasSource || utils$1.isPlainObject(value)) && baseKeys.has(key) ? base[key] : undefined;
|
|
3625
|
+
target[key] = hasSource ? copy(previous, value) : copy(undefined, previous);
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
assertParamsAcyclic(result);
|
|
3630
|
+
return result;
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
3634
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
3635
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
3636
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
3637
|
+
return utils$1.merge({}, source);
|
|
3638
|
+
} else if (utils$1.isArray(source)) {
|
|
3639
|
+
return source.slice();
|
|
3640
|
+
}
|
|
3641
|
+
return source;
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
3645
|
+
if (!utils$1.isUndefined(b)) {
|
|
3646
|
+
return getMergedValue(a, b, prop, caseless);
|
|
3647
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
3648
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
// eslint-disable-next-line consistent-return
|
|
3653
|
+
function valueFromConfig2(a, b) {
|
|
3654
|
+
if (!utils$1.isUndefined(b)) {
|
|
3655
|
+
return getMergedValue(undefined, b);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
// eslint-disable-next-line consistent-return
|
|
3660
|
+
function defaultToConfig2(a, b) {
|
|
3661
|
+
if (!utils$1.isUndefined(b)) {
|
|
3662
|
+
return getMergedValue(undefined, b);
|
|
3663
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
3664
|
+
return getMergedValue(undefined, a);
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
function getMergedTransitionalOption(config1, config2, prop) {
|
|
3669
|
+
const transitional2 = utils$1.hasOwnProp(config2, 'transitional')
|
|
3670
|
+
? config2.transitional
|
|
3671
|
+
: undefined;
|
|
3672
|
+
|
|
3673
|
+
if (!utils$1.isUndefined(transitional2)) {
|
|
3674
|
+
if (utils$1.isPlainObject(transitional2)) {
|
|
3675
|
+
if (utils$1.hasOwnProp(transitional2, prop)) {
|
|
3676
|
+
return transitional2[prop];
|
|
3677
|
+
}
|
|
3678
|
+
} else {
|
|
3679
|
+
return undefined;
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
const transitional1 = utils$1.hasOwnProp(config1, 'transitional')
|
|
3684
|
+
? config1.transitional
|
|
3685
|
+
: undefined;
|
|
3686
|
+
|
|
3687
|
+
if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
|
|
3688
|
+
return transitional1[prop];
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
return undefined;
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
// eslint-disable-next-line consistent-return
|
|
3695
|
+
function mergeDirectKeys(a, b, prop, config1, config2) {
|
|
3696
|
+
if (utils$1.hasOwnProp(config2, prop)) {
|
|
3697
|
+
return getMergedValue(a, b);
|
|
3698
|
+
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
3699
|
+
return getMergedValue(undefined, a);
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
function mergeHeaders(a, b, prop) {
|
|
3704
|
+
return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
// Null-proto, frozen descriptor so a polluted Object.prototype.get cannot turn
|
|
3708
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
3709
|
+
// defineProperty only reads it, so one shared instance serves every call.
|
|
3710
|
+
const hasOwnPropertyDescriptor = Object.freeze({
|
|
3711
|
+
__proto__: null,
|
|
3712
|
+
value: Object.prototype.hasOwnProperty,
|
|
3713
|
+
enumerable: false,
|
|
3714
|
+
writable: true,
|
|
3715
|
+
configurable: true,
|
|
3716
|
+
});
|
|
3717
|
+
|
|
3718
|
+
// The strategy table and the strategies above are stateless, so they are
|
|
3719
|
+
// built once at module load instead of on every call: mergeConfig runs at
|
|
3720
|
+
// most twice per request (once from a method alias, once from `_request`).
|
|
3721
|
+
const mergeMap = {
|
|
3722
|
+
url: valueFromConfig2,
|
|
3723
|
+
method: valueFromConfig2,
|
|
3724
|
+
data: valueFromConfig2,
|
|
3725
|
+
baseURL: defaultToConfig2,
|
|
3726
|
+
transformRequest: defaultToConfig2,
|
|
3727
|
+
transformResponse: defaultToConfig2,
|
|
3728
|
+
params: mergeParams,
|
|
3729
|
+
paramsSerializer: defaultToConfig2,
|
|
3730
|
+
timeout: defaultToConfig2,
|
|
3731
|
+
timeoutErrorMessage: defaultToConfig2,
|
|
3732
|
+
withCredentials: defaultToConfig2,
|
|
3733
|
+
withXSRFToken: defaultToConfig2,
|
|
3734
|
+
adapter: defaultToConfig2,
|
|
3735
|
+
responseType: defaultToConfig2,
|
|
3736
|
+
xsrfCookieName: defaultToConfig2,
|
|
3737
|
+
xsrfHeaderName: defaultToConfig2,
|
|
3738
|
+
onUploadProgress: defaultToConfig2,
|
|
3739
|
+
onDownloadProgress: defaultToConfig2,
|
|
3740
|
+
decompress: defaultToConfig2,
|
|
3741
|
+
maxContentLength: defaultToConfig2,
|
|
3742
|
+
maxBodyLength: defaultToConfig2,
|
|
3743
|
+
beforeRedirect: defaultToConfig2,
|
|
3744
|
+
transport: defaultToConfig2,
|
|
3745
|
+
httpAgent: defaultToConfig2,
|
|
3746
|
+
httpsAgent: defaultToConfig2,
|
|
3747
|
+
cancelToken: defaultToConfig2,
|
|
3748
|
+
socketPath: defaultToConfig2,
|
|
3749
|
+
allowedSocketPaths: defaultToConfig2,
|
|
3750
|
+
responseEncoding: defaultToConfig2,
|
|
3751
|
+
validateStatus: mergeDirectKeys,
|
|
3752
|
+
headers: mergeHeaders,
|
|
3753
|
+
};
|
|
3754
|
+
|
|
2727
3755
|
/**
|
|
2728
3756
|
* Config-specific merge-function which creates a new config-object
|
|
2729
3757
|
* by merging two configuration objects together.
|
|
@@ -2735,6 +3763,7 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing
|
|
|
2735
3763
|
*/
|
|
2736
3764
|
function mergeConfig$1(config1, config2) {
|
|
2737
3765
|
// eslint-disable-next-line no-param-reassign
|
|
3766
|
+
config1 = config1 || {};
|
|
2738
3767
|
config2 = config2 || {};
|
|
2739
3768
|
|
|
2740
3769
|
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
@@ -2742,115 +3771,56 @@ function mergeConfig$1(config1, config2) {
|
|
|
2742
3771
|
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
2743
3772
|
// ergonomics for user code that relies on it.
|
|
2744
3773
|
const config = Object.create(null);
|
|
2745
|
-
Object.defineProperty(config, 'hasOwnProperty',
|
|
2746
|
-
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
2747
|
-
// this data descriptor into an accessor descriptor on the way in.
|
|
2748
|
-
__proto__: null,
|
|
2749
|
-
value: Object.prototype.hasOwnProperty,
|
|
2750
|
-
enumerable: false,
|
|
2751
|
-
writable: true,
|
|
2752
|
-
configurable: true,
|
|
2753
|
-
});
|
|
2754
|
-
|
|
2755
|
-
function getMergedValue(target, source, prop, caseless) {
|
|
2756
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2757
|
-
return utils$1.merge.call({ caseless }, target, source);
|
|
2758
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
2759
|
-
return utils$1.merge({}, source);
|
|
2760
|
-
} else if (utils$1.isArray(source)) {
|
|
2761
|
-
return source.slice();
|
|
2762
|
-
}
|
|
2763
|
-
return source;
|
|
2764
|
-
}
|
|
3774
|
+
Object.defineProperty(config, 'hasOwnProperty', hasOwnPropertyDescriptor);
|
|
2765
3775
|
|
|
2766
|
-
|
|
2767
|
-
if (!utils$1.isUndefined(b)) {
|
|
2768
|
-
return getMergedValue(a, b, prop, caseless);
|
|
2769
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2770
|
-
return getMergedValue(undefined, a, prop, caseless);
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2774
|
-
// eslint-disable-next-line consistent-return
|
|
2775
|
-
function valueFromConfig2(a, b) {
|
|
2776
|
-
if (!utils$1.isUndefined(b)) {
|
|
2777
|
-
return getMergedValue(undefined, b);
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2780
|
-
|
|
2781
|
-
// eslint-disable-next-line consistent-return
|
|
2782
|
-
function defaultToConfig2(a, b) {
|
|
2783
|
-
if (!utils$1.isUndefined(b)) {
|
|
2784
|
-
return getMergedValue(undefined, b);
|
|
2785
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2786
|
-
return getMergedValue(undefined, a);
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
// eslint-disable-next-line consistent-return
|
|
2791
|
-
function mergeDirectKeys(a, b, prop) {
|
|
2792
|
-
if (utils$1.hasOwnProp(config2, prop)) {
|
|
2793
|
-
return getMergedValue(a, b);
|
|
2794
|
-
} else if (utils$1.hasOwnProp(config1, prop)) {
|
|
2795
|
-
return getMergedValue(undefined, a);
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
|
|
2799
|
-
const mergeMap = {
|
|
2800
|
-
url: valueFromConfig2,
|
|
2801
|
-
method: valueFromConfig2,
|
|
2802
|
-
data: valueFromConfig2,
|
|
2803
|
-
baseURL: defaultToConfig2,
|
|
2804
|
-
transformRequest: defaultToConfig2,
|
|
2805
|
-
transformResponse: defaultToConfig2,
|
|
2806
|
-
paramsSerializer: defaultToConfig2,
|
|
2807
|
-
timeout: defaultToConfig2,
|
|
2808
|
-
timeoutMessage: defaultToConfig2,
|
|
2809
|
-
withCredentials: defaultToConfig2,
|
|
2810
|
-
withXSRFToken: defaultToConfig2,
|
|
2811
|
-
adapter: defaultToConfig2,
|
|
2812
|
-
responseType: defaultToConfig2,
|
|
2813
|
-
xsrfCookieName: defaultToConfig2,
|
|
2814
|
-
xsrfHeaderName: defaultToConfig2,
|
|
2815
|
-
onUploadProgress: defaultToConfig2,
|
|
2816
|
-
onDownloadProgress: defaultToConfig2,
|
|
2817
|
-
decompress: defaultToConfig2,
|
|
2818
|
-
maxContentLength: defaultToConfig2,
|
|
2819
|
-
maxBodyLength: defaultToConfig2,
|
|
2820
|
-
beforeRedirect: defaultToConfig2,
|
|
2821
|
-
transport: defaultToConfig2,
|
|
2822
|
-
httpAgent: defaultToConfig2,
|
|
2823
|
-
httpsAgent: defaultToConfig2,
|
|
2824
|
-
cancelToken: defaultToConfig2,
|
|
2825
|
-
socketPath: defaultToConfig2,
|
|
2826
|
-
allowedSocketPaths: defaultToConfig2,
|
|
2827
|
-
responseEncoding: defaultToConfig2,
|
|
2828
|
-
validateStatus: mergeDirectKeys,
|
|
2829
|
-
headers: (a, b, prop) =>
|
|
2830
|
-
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2831
|
-
};
|
|
3776
|
+
const keys = ownEnumerableKeys({ ...config1, ...config2 });
|
|
2832
3777
|
|
|
2833
|
-
|
|
2834
|
-
|
|
3778
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
3779
|
+
const prop = keys[i];
|
|
3780
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') continue;
|
|
2835
3781
|
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2836
3782
|
const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
2837
3783
|
const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
2838
|
-
const configValue =
|
|
3784
|
+
const configValue =
|
|
3785
|
+
merge === mergeDirectKeys ? merge(a, b, prop, config1, config2) : merge(a, b, prop);
|
|
2839
3786
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2840
|
-
}
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
if (
|
|
3790
|
+
utils$1.hasOwnProp(config2, 'validateStatus') &&
|
|
3791
|
+
utils$1.isUndefined(config2.validateStatus) &&
|
|
3792
|
+
getMergedTransitionalOption(config1, config2, 'validateStatusUndefinedResolves') === false
|
|
3793
|
+
) {
|
|
3794
|
+
if (utils$1.hasOwnProp(config1, 'validateStatus')) {
|
|
3795
|
+
config.validateStatus = getMergedValue(undefined, config1.validateStatus);
|
|
3796
|
+
} else {
|
|
3797
|
+
delete config.validateStatus;
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
2841
3800
|
|
|
2842
3801
|
return config;
|
|
2843
3802
|
}
|
|
2844
3803
|
|
|
2845
3804
|
const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
2846
3805
|
|
|
3806
|
+
/**
|
|
3807
|
+
* Apply the headers generated by a FormData implementation to the request headers,
|
|
3808
|
+
* honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
|
|
3809
|
+
* content-* headers; otherwise merge all of them.
|
|
3810
|
+
*
|
|
3811
|
+
* @param {AxiosHeaders} headers - the request headers to mutate
|
|
3812
|
+
* @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
|
|
3813
|
+
* @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
|
|
3814
|
+
*
|
|
3815
|
+
* @returns {void}
|
|
3816
|
+
*/
|
|
2847
3817
|
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
2848
3818
|
if (policy !== 'content-only') {
|
|
2849
3819
|
headers.set(formHeaders);
|
|
2850
3820
|
return;
|
|
2851
3821
|
}
|
|
2852
3822
|
|
|
2853
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
3823
|
+
Object.entries(formHeaders || {}).forEach(([key, val]) => {
|
|
2854
3824
|
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
2855
3825
|
headers.set(key, val);
|
|
2856
3826
|
}
|
|
@@ -2870,7 +3840,9 @@ const encodeUTF8$1 = (str) =>
|
|
|
2870
3840
|
String.fromCharCode(parseInt(hex, 16))
|
|
2871
3841
|
);
|
|
2872
3842
|
|
|
2873
|
-
|
|
3843
|
+
const readCookie = (name) => cookies.read(name);
|
|
3844
|
+
|
|
3845
|
+
function resolveConfig(config, readXsrfCookie = readCookie) {
|
|
2874
3846
|
const newConfig = mergeConfig$1({}, config);
|
|
2875
3847
|
|
|
2876
3848
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -2890,30 +3862,49 @@ function resolveConfig(config) {
|
|
|
2890
3862
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2891
3863
|
|
|
2892
3864
|
newConfig.url = buildURL(
|
|
2893
|
-
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
3865
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
|
|
2894
3866
|
own('params'),
|
|
2895
3867
|
own('paramsSerializer')
|
|
2896
3868
|
);
|
|
2897
3869
|
|
|
2898
3870
|
// HTTP basic authentication
|
|
2899
3871
|
if (auth) {
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3872
|
+
const username = utils$1.getSafeProp(auth, 'username') || '';
|
|
3873
|
+
const password = utils$1.getSafeProp(auth, 'password') || '';
|
|
3874
|
+
const transitional = own('transitional');
|
|
3875
|
+
const encodeUsername =
|
|
3876
|
+
transitional &&
|
|
3877
|
+
utils$1.hasOwnProp(transitional, 'encodeBasicAuthUsername') &&
|
|
3878
|
+
transitional.encodeBasicAuthUsername === true;
|
|
3879
|
+
|
|
3880
|
+
try {
|
|
3881
|
+
headers.set(
|
|
3882
|
+
'Authorization',
|
|
3883
|
+
// Preserve legacy username bytes unless the caller opts in to UTF-8.
|
|
3884
|
+
'Basic ' +
|
|
3885
|
+
btoa(
|
|
3886
|
+
(encodeUsername ? encodeUTF8$1(username) : username) +
|
|
3887
|
+
':' +
|
|
3888
|
+
(password ? encodeUTF8$1(password) : '')
|
|
3889
|
+
)
|
|
3890
|
+
);
|
|
3891
|
+
} catch (e) {
|
|
3892
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
|
|
3893
|
+
}
|
|
2905
3894
|
}
|
|
2906
3895
|
|
|
2907
3896
|
if (utils$1.isFormData(data)) {
|
|
3897
|
+
const getHeaders = utils$1.getSafeProp(data, 'getHeaders');
|
|
3898
|
+
|
|
2908
3899
|
if (
|
|
2909
3900
|
platform.hasStandardBrowserEnv ||
|
|
2910
3901
|
platform.hasStandardBrowserWebWorkerEnv ||
|
|
2911
3902
|
utils$1.isReactNative(data)
|
|
2912
3903
|
) {
|
|
2913
3904
|
headers.setContentType(undefined); // browser/web worker/RN handles it
|
|
2914
|
-
} else if (utils$1.isFunction(
|
|
3905
|
+
} else if (utils$1.isFunction(getHeaders)) {
|
|
2915
3906
|
// Node.js FormData (like form-data package)
|
|
2916
|
-
setFormDataHeaders(headers,
|
|
3907
|
+
setFormDataHeaders(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
|
|
2917
3908
|
}
|
|
2918
3909
|
}
|
|
2919
3910
|
|
|
@@ -2933,7 +3924,7 @@ function resolveConfig(config) {
|
|
|
2933
3924
|
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
2934
3925
|
|
|
2935
3926
|
if (shouldSendXSRF) {
|
|
2936
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName &&
|
|
3927
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
|
|
2937
3928
|
|
|
2938
3929
|
if (xsrfValue) {
|
|
2939
3930
|
headers.set(xsrfHeaderName, xsrfValue);
|
|
@@ -2949,17 +3940,60 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
|
2949
3940
|
var xhrAdapter = isXHRAdapterSupported &&
|
|
2950
3941
|
function (config) {
|
|
2951
3942
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2952
|
-
|
|
3943
|
+
let useAsyncXsrf;
|
|
3944
|
+
try {
|
|
3945
|
+
const store =
|
|
3946
|
+
platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
|
|
3947
|
+
useAsyncXsrf = store && utils$1.isFunction(store.get);
|
|
3948
|
+
} catch (e) {
|
|
3949
|
+
// A restricted Cookie Store getter must retain the synchronous fallback.
|
|
3950
|
+
}
|
|
3951
|
+
let xsrfCookieName;
|
|
3952
|
+
const _config = resolveConfig(
|
|
3953
|
+
config,
|
|
3954
|
+
useAsyncXsrf
|
|
3955
|
+
? (name) => {
|
|
3956
|
+
xsrfCookieName = name;
|
|
3957
|
+
return null;
|
|
3958
|
+
}
|
|
3959
|
+
: undefined
|
|
3960
|
+
);
|
|
2953
3961
|
let requestData = _config.data;
|
|
2954
3962
|
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
2955
3963
|
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
2956
3964
|
let onCanceled;
|
|
3965
|
+
let timeoutId;
|
|
2957
3966
|
let uploadThrottled, downloadThrottled;
|
|
2958
|
-
let flushUpload, flushDownload;
|
|
3967
|
+
let flushUpload, flushDownload, flushDownloadWithEvent;
|
|
2959
3968
|
|
|
2960
3969
|
function done() {
|
|
2961
|
-
|
|
2962
|
-
|
|
3970
|
+
clearTimeout(timeoutId);
|
|
3971
|
+
// A final progress callback must not prevent the remaining cleanup.
|
|
3972
|
+
// Report errors asynchronously, as onloadend and the throttle timer do.
|
|
3973
|
+
try {
|
|
3974
|
+
flushUpload && flushUpload(); // flush events
|
|
3975
|
+
} catch (err) {
|
|
3976
|
+
setTimeout(() => {
|
|
3977
|
+
throw err;
|
|
3978
|
+
});
|
|
3979
|
+
}
|
|
3980
|
+
try {
|
|
3981
|
+
flushDownload && flushDownload(); // flush events
|
|
3982
|
+
} catch (err) {
|
|
3983
|
+
setTimeout(() => {
|
|
3984
|
+
throw err;
|
|
3985
|
+
});
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
// A flush can synchronously cancel the request and reenter done().
|
|
3989
|
+
// In that case the inner call has already detached these listeners.
|
|
3990
|
+
if (request) {
|
|
3991
|
+
downloadThrottled && request.removeEventListener('progress', downloadThrottled);
|
|
3992
|
+
if (request.upload) {
|
|
3993
|
+
uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
|
|
3994
|
+
flushUpload && request.upload.removeEventListener('loadend', flushUpload);
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
2963
3997
|
|
|
2964
3998
|
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2965
3999
|
|
|
@@ -2973,10 +4007,55 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
2973
4007
|
// Set the request timeout in MS
|
|
2974
4008
|
request.timeout = _config.timeout;
|
|
2975
4009
|
|
|
2976
|
-
function onloadend() {
|
|
4010
|
+
function onloadend(event) {
|
|
4011
|
+
if (!request) {
|
|
4012
|
+
return;
|
|
4013
|
+
}
|
|
4014
|
+
|
|
4015
|
+
// Status 0 means no response was received, which onerror and onabort normally
|
|
4016
|
+
// reject before this runs. Firefox 152 fires only readystatechange and loadend for
|
|
4017
|
+
// navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
|
|
4018
|
+
// leaving settle() to resolve them as an empty success. ECONNABORTED is the error
|
|
4019
|
+
// onabort raised on Firefox 151. Reads over file:, which some environments report as
|
|
4020
|
+
// status 0 on success, are excluded by the request URL's scheme after browser-style
|
|
4021
|
+
// preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
|
|
4022
|
+
// by responseURL where implemented.
|
|
4023
|
+
if (
|
|
4024
|
+
request.status === 0 &&
|
|
4025
|
+
(parseProtocol(normalizeURLForProtocolCheck(_config.url)) ||
|
|
4026
|
+
parseProtocol(platform.origin)) !== 'file' &&
|
|
4027
|
+
!(request.responseURL && request.responseURL.startsWith('file:'))
|
|
4028
|
+
) {
|
|
4029
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
4030
|
+
done();
|
|
4031
|
+
|
|
4032
|
+
// Clean up request
|
|
4033
|
+
request = null;
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
// When loadend is still dispatching, flushing with it gives progress
|
|
4038
|
+
// listeners a final delivery whose event has a live target. The legacy
|
|
4039
|
+
// ready-state fallback has no event, so replay its pending progress.
|
|
4040
|
+
// A throwing listener must not block settlement; rethrow asynchronously,
|
|
4041
|
+
// matching how listener errors surface on the throttle timer path.
|
|
4042
|
+
try {
|
|
4043
|
+
if (event) {
|
|
4044
|
+
flushDownloadWithEvent && flushDownloadWithEvent(event);
|
|
4045
|
+
} else {
|
|
4046
|
+
flushDownload && flushDownload();
|
|
4047
|
+
}
|
|
4048
|
+
} catch (err) {
|
|
4049
|
+
setTimeout(() => {
|
|
4050
|
+
throw err;
|
|
4051
|
+
});
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
// A final progress callback can cancel the request synchronously.
|
|
2977
4055
|
if (!request) {
|
|
2978
4056
|
return;
|
|
2979
4057
|
}
|
|
4058
|
+
|
|
2980
4059
|
// Prepare the response
|
|
2981
4060
|
const responseHeaders = AxiosHeaders$1.from(
|
|
2982
4061
|
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
@@ -3065,6 +4144,7 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3065
4144
|
|
|
3066
4145
|
// Handle timeout
|
|
3067
4146
|
request.ontimeout = function handleTimeout() {
|
|
4147
|
+
if (!request) return;
|
|
3068
4148
|
let timeoutErrorMessage = _config.timeout
|
|
3069
4149
|
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
3070
4150
|
: 'timeout exceeded';
|
|
@@ -3089,13 +4169,6 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3089
4169
|
// Remove Content-Type if data is undefined
|
|
3090
4170
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
3091
4171
|
|
|
3092
|
-
// Add headers to the request
|
|
3093
|
-
if ('setRequestHeader' in request) {
|
|
3094
|
-
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
3095
|
-
request.setRequestHeader(key, val);
|
|
3096
|
-
});
|
|
3097
|
-
}
|
|
3098
|
-
|
|
3099
4172
|
// Add withCredentials to request if needed
|
|
3100
4173
|
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3101
4174
|
request.withCredentials = !!_config.withCredentials;
|
|
@@ -3108,7 +4181,10 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3108
4181
|
|
|
3109
4182
|
// Handle progress if needed
|
|
3110
4183
|
if (onDownloadProgress) {
|
|
3111
|
-
[downloadThrottled, flushDownload] = progressEventReducer(
|
|
4184
|
+
[downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
|
|
4185
|
+
onDownloadProgress,
|
|
4186
|
+
true
|
|
4187
|
+
);
|
|
3112
4188
|
request.addEventListener('progress', downloadThrottled);
|
|
3113
4189
|
}
|
|
3114
4190
|
|
|
@@ -3129,12 +4205,14 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3129
4205
|
return;
|
|
3130
4206
|
}
|
|
3131
4207
|
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3132
|
-
request
|
|
4208
|
+
const xhr = request;
|
|
3133
4209
|
done();
|
|
3134
4210
|
request = null;
|
|
4211
|
+
xhr.abort();
|
|
3135
4212
|
};
|
|
3136
4213
|
|
|
3137
4214
|
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
4215
|
+
if (!request) return;
|
|
3138
4216
|
if (_config.signal) {
|
|
3139
4217
|
_config.signal.aborted
|
|
3140
4218
|
? onCanceled()
|
|
@@ -3142,6 +4220,8 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3142
4220
|
}
|
|
3143
4221
|
}
|
|
3144
4222
|
|
|
4223
|
+
if (!request) return;
|
|
4224
|
+
|
|
3145
4225
|
const protocol = parseProtocol(_config.url);
|
|
3146
4226
|
|
|
3147
4227
|
if (protocol && !platform.protocols.includes(protocol)) {
|
|
@@ -3152,11 +4232,77 @@ var xhrAdapter = isXHRAdapterSupported &&
|
|
|
3152
4232
|
config
|
|
3153
4233
|
)
|
|
3154
4234
|
);
|
|
4235
|
+
done();
|
|
3155
4236
|
return;
|
|
3156
4237
|
}
|
|
3157
4238
|
|
|
3158
|
-
|
|
3159
|
-
|
|
4239
|
+
const sendRequest = () => {
|
|
4240
|
+
if (!request) return;
|
|
4241
|
+
// Apply headers after an asynchronous XSRF read so existing headers are
|
|
4242
|
+
// replaced through AxiosHeaders rather than appended by the native XHR.
|
|
4243
|
+
if ('setRequestHeader' in request) {
|
|
4244
|
+
utils$1.forEach(
|
|
4245
|
+
toByteStringHeaderObject(requestHeaders),
|
|
4246
|
+
function setRequestHeader(val, key) {
|
|
4247
|
+
request.setRequestHeader(key, val);
|
|
4248
|
+
}
|
|
4249
|
+
);
|
|
4250
|
+
}
|
|
4251
|
+
request.send(requestData || null);
|
|
4252
|
+
};
|
|
4253
|
+
|
|
4254
|
+
if (xsrfCookieName) {
|
|
4255
|
+
// Native XHR timeout starts at send(). Cover cookie preparation and the
|
|
4256
|
+
// subsequent request with the same budget and existing timeout handler.
|
|
4257
|
+
const now =
|
|
4258
|
+
typeof performance !== 'undefined' && utils$1.isFunction(performance.now)
|
|
4259
|
+
? () => performance.now()
|
|
4260
|
+
: Date.now;
|
|
4261
|
+
const deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
|
|
4262
|
+
const abortOnTimeout = () => {
|
|
4263
|
+
if (!request) return;
|
|
4264
|
+
const xhr = request;
|
|
4265
|
+
xhr.ontimeout();
|
|
4266
|
+
xhr.abort();
|
|
4267
|
+
};
|
|
4268
|
+
if (deadline !== undefined) {
|
|
4269
|
+
const scheduleTimeout = () => {
|
|
4270
|
+
const remaining = deadline - now();
|
|
4271
|
+
if (remaining > 0) {
|
|
4272
|
+
// Browser timers overflow above the signed 32-bit delay limit.
|
|
4273
|
+
timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 0x7fffffff));
|
|
4274
|
+
} else {
|
|
4275
|
+
abortOnTimeout();
|
|
4276
|
+
}
|
|
4277
|
+
};
|
|
4278
|
+
scheduleTimeout();
|
|
4279
|
+
}
|
|
4280
|
+
|
|
4281
|
+
cookies
|
|
4282
|
+
.readAsync(xsrfCookieName)
|
|
4283
|
+
.then((value) => {
|
|
4284
|
+
if (!request) return;
|
|
4285
|
+
// Promise callbacks may run before an overdue timer after a busy task.
|
|
4286
|
+
if (deadline !== undefined && now() >= deadline) {
|
|
4287
|
+
abortOnTimeout();
|
|
4288
|
+
return;
|
|
4289
|
+
}
|
|
4290
|
+
if (value) {
|
|
4291
|
+
const headerName =
|
|
4292
|
+
utils$1.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
|
|
4293
|
+
requestHeaders.set(headerName, value);
|
|
4294
|
+
}
|
|
4295
|
+
sendRequest();
|
|
4296
|
+
})
|
|
4297
|
+
.catch((error) => {
|
|
4298
|
+
if (!request) return;
|
|
4299
|
+
reject(AxiosError$1.from(error, null, config, request));
|
|
4300
|
+
done();
|
|
4301
|
+
request = null;
|
|
4302
|
+
});
|
|
4303
|
+
} else {
|
|
4304
|
+
sendRequest();
|
|
4305
|
+
}
|
|
3160
4306
|
});
|
|
3161
4307
|
};
|
|
3162
4308
|
|
|
@@ -3192,18 +4338,32 @@ const composeSignals = (signals, timeout) => {
|
|
|
3192
4338
|
}, timeout);
|
|
3193
4339
|
|
|
3194
4340
|
const unsubscribe = () => {
|
|
3195
|
-
if (!signals) {
|
|
4341
|
+
if (!signals) {
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
3196
4344
|
timer && clearTimeout(timer);
|
|
3197
4345
|
timer = null;
|
|
3198
4346
|
signals.forEach((signal) => {
|
|
3199
|
-
signal
|
|
3200
|
-
|
|
4347
|
+
const unsubscribeSignal = utils$1.getSafeProp(signal, 'unsubscribe');
|
|
4348
|
+
utils$1.isFunction(unsubscribeSignal)
|
|
4349
|
+
? unsubscribeSignal.call(signal, onabort)
|
|
3201
4350
|
: signal.removeEventListener('abort', onabort);
|
|
3202
4351
|
});
|
|
3203
4352
|
signals = null;
|
|
3204
4353
|
};
|
|
3205
4354
|
|
|
3206
|
-
signals.forEach((signal) =>
|
|
4355
|
+
signals.forEach((signal) => {
|
|
4356
|
+
if (aborted) {
|
|
4357
|
+
return;
|
|
4358
|
+
}
|
|
4359
|
+
|
|
4360
|
+
if (signal.aborted) {
|
|
4361
|
+
onabort.call(signal);
|
|
4362
|
+
return;
|
|
4363
|
+
}
|
|
4364
|
+
|
|
4365
|
+
signal.addEventListener('abort', onabort, { once: true });
|
|
4366
|
+
});
|
|
3207
4367
|
|
|
3208
4368
|
const { signal } = controller;
|
|
3209
4369
|
|
|
@@ -3302,89 +4462,274 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
3302
4462
|
);
|
|
3303
4463
|
};
|
|
3304
4464
|
|
|
4465
|
+
const CRLF = '\r\n';
|
|
4466
|
+
const normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF);
|
|
4467
|
+
const escapeName = (value) =>
|
|
4468
|
+
String(value).replace(/[\r\n"]/g, (char) =>
|
|
4469
|
+
char === '\r' ? '%0D' : char === '\n' ? '%0A' : '%22'
|
|
4470
|
+
);
|
|
4471
|
+
|
|
4472
|
+
// Count UTF-8 bytes without allocating an encoded copy of a field. FormData
|
|
4473
|
+
// string values normalize line endings; Blob/File contents remain unchanged.
|
|
4474
|
+
const stringBytes = (value, normalize) => {
|
|
4475
|
+
let length = 0;
|
|
4476
|
+
for (let i = 0; i < value.length; i++) {
|
|
4477
|
+
const code = value.charCodeAt(i);
|
|
4478
|
+
if (normalize && (code === 13 || code === 10)) {
|
|
4479
|
+
if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
|
|
4480
|
+
length += 2;
|
|
4481
|
+
} else if (code < 0x80) {
|
|
4482
|
+
length++;
|
|
4483
|
+
} else if (code < 0x800) {
|
|
4484
|
+
length += 2;
|
|
4485
|
+
} else if (
|
|
4486
|
+
code >= 0xd800 &&
|
|
4487
|
+
code <= 0xdbff &&
|
|
4488
|
+
value.charCodeAt(i + 1) >= 0xdc00 &&
|
|
4489
|
+
value.charCodeAt(i + 1) <= 0xdfff
|
|
4490
|
+
) {
|
|
4491
|
+
length += 4;
|
|
4492
|
+
i++;
|
|
4493
|
+
} else {
|
|
4494
|
+
length += 3;
|
|
4495
|
+
}
|
|
4496
|
+
}
|
|
4497
|
+
return length;
|
|
4498
|
+
};
|
|
4499
|
+
|
|
4500
|
+
// Describe serialization failures independently of any request library.
|
|
4501
|
+
class FormDataError extends TypeError {
|
|
4502
|
+
constructor(message, reason) {
|
|
4503
|
+
super(message);
|
|
4504
|
+
this.name = 'FormDataError';
|
|
4505
|
+
this.reason = reason;
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
|
|
4509
|
+
// The caller supplies the boundary, Blob implementation, and limit error.
|
|
4510
|
+
function formDataToBlob(form, Blob, limit, limitError, boundary) {
|
|
4511
|
+
if (!utils$1.isFunction(Blob)) {
|
|
4512
|
+
throw new FormDataError('Blob is not supported', 'blob');
|
|
4513
|
+
}
|
|
4514
|
+
|
|
4515
|
+
if (
|
|
4516
|
+
!utils$1.isString(boundary) ||
|
|
4517
|
+
!/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) ||
|
|
4518
|
+
/ $/.test(boundary)
|
|
4519
|
+
) {
|
|
4520
|
+
throw new FormDataError('Invalid multipart boundary', 'boundary');
|
|
4521
|
+
}
|
|
4522
|
+
const footer = '--' + boundary + '--' + CRLF;
|
|
4523
|
+
let length = footer.length;
|
|
4524
|
+
const parts = [];
|
|
4525
|
+
const checkLength = (extra) => {
|
|
4526
|
+
if (length + extra > limit) throw limitError();
|
|
4527
|
+
};
|
|
4528
|
+
checkLength(0);
|
|
4529
|
+
|
|
4530
|
+
for (const [name, value] of form) {
|
|
4531
|
+
const isString = utils$1.isString(value);
|
|
4532
|
+
const valueLength = isString ? stringBytes(value, true) : value.size;
|
|
4533
|
+
if (!Number.isFinite(valueLength) || valueLength < 0) {
|
|
4534
|
+
throw new FormDataError('Unsupported FormData part size', 'part');
|
|
4535
|
+
}
|
|
4536
|
+
// Reject large values and names before building normalized header strings.
|
|
4537
|
+
checkLength(
|
|
4538
|
+
valueLength +
|
|
4539
|
+
stringBytes(name, true) +
|
|
4540
|
+
(!isString && value.name ? stringBytes(value.name, false) : 0) +
|
|
4541
|
+
(!isString && value.type ? stringBytes(value.type, false) : 0)
|
|
4542
|
+
);
|
|
4543
|
+
|
|
4544
|
+
let header =
|
|
4545
|
+
'--' +
|
|
4546
|
+
boundary +
|
|
4547
|
+
CRLF +
|
|
4548
|
+
'Content-Disposition: form-data; name="' +
|
|
4549
|
+
escapeName(normalizeLines(name)) +
|
|
4550
|
+
'"';
|
|
4551
|
+
if (!isString) {
|
|
4552
|
+
header +=
|
|
4553
|
+
'; filename="' +
|
|
4554
|
+
escapeName(utils$1.isString(value.name) ? value.name : 'blob') +
|
|
4555
|
+
'"' +
|
|
4556
|
+
CRLF +
|
|
4557
|
+
'Content-Type: ' +
|
|
4558
|
+
String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
|
|
4559
|
+
}
|
|
4560
|
+
header += CRLF + CRLF;
|
|
4561
|
+
const partLength = stringBytes(header, false) + valueLength + CRLF.length;
|
|
4562
|
+
checkLength(partLength);
|
|
4563
|
+
length += partLength;
|
|
4564
|
+
parts.push({ header, value, isString });
|
|
4565
|
+
}
|
|
4566
|
+
|
|
4567
|
+
// Native Blob composition retains existing Blob/File data. No file is read
|
|
4568
|
+
// and no complete multipart ArrayBuffer is created to determine its length.
|
|
4569
|
+
const blobParts = [];
|
|
4570
|
+
for (const part of parts) {
|
|
4571
|
+
blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
|
|
4572
|
+
}
|
|
4573
|
+
blobParts.push(footer);
|
|
4574
|
+
return new Blob(blobParts, { type: 'multipart/form-data; boundary=' + boundary });
|
|
4575
|
+
}
|
|
4576
|
+
|
|
4577
|
+
function createMultipartBody(form, Blob, limit, limitError, boundary) {
|
|
4578
|
+
// Report missing Blob support before trying to select a random source.
|
|
4579
|
+
if (!utils$1.isFunction(Blob)) {
|
|
4580
|
+
throw new AxiosError$1('Blob is not supported', AxiosError$1.ERR_NOT_SUPPORT);
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
if (boundary === undefined) {
|
|
4584
|
+
if (utils$1.isFunction(platform.generateString)) {
|
|
4585
|
+
boundary = 'axios-' + platform.generateString(36, '0123456789abcdef');
|
|
4586
|
+
} else {
|
|
4587
|
+
const crypto = utils$1.global.crypto;
|
|
4588
|
+
if (!crypto || !utils$1.isFunction(crypto.getRandomValues)) {
|
|
4589
|
+
throw new AxiosError$1('Random byte generation is not supported', AxiosError$1.ERR_NOT_SUPPORT);
|
|
4590
|
+
}
|
|
4591
|
+
const random = new Uint8Array(18);
|
|
4592
|
+
crypto.getRandomValues(random);
|
|
4593
|
+
boundary =
|
|
4594
|
+
'axios-' + Array.from(random, (value) => ('0' + value.toString(16)).slice(-2)).join('');
|
|
4595
|
+
}
|
|
4596
|
+
}
|
|
4597
|
+
|
|
4598
|
+
try {
|
|
4599
|
+
return formDataToBlob(form, Blob, limit, limitError, boundary);
|
|
4600
|
+
} catch (error) {
|
|
4601
|
+
if (error instanceof FormDataError) {
|
|
4602
|
+
const code =
|
|
4603
|
+
error.reason === 'boundary' ? AxiosError$1.ERR_BAD_OPTION_VALUE : AxiosError$1.ERR_BAD_REQUEST;
|
|
4604
|
+
throw new AxiosError$1(error.message, code);
|
|
4605
|
+
}
|
|
4606
|
+
throw error;
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
|
|
3305
4610
|
/**
|
|
3306
|
-
* Estimate
|
|
3307
|
-
* -
|
|
3308
|
-
*
|
|
3309
|
-
*
|
|
3310
|
-
*
|
|
3311
|
-
* @param {string} url
|
|
3312
|
-
* @returns {number}
|
|
4611
|
+
* Estimate data: URL byte lengths *without* allocating large buffers.
|
|
4612
|
+
* - Fetch percent-decodes a base64 body before decoding it.
|
|
4613
|
+
* - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
|
|
4614
|
+
* percent-decoded body, including ignored characters and content after padding.
|
|
4615
|
+
* - Non-base64 data is percent-decoded and then encoded as UTF-8.
|
|
3313
4616
|
*/
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
4617
|
+
const isHexDigit = (charCode) =>
|
|
4618
|
+
(charCode >= 48 && charCode <= 57) ||
|
|
4619
|
+
(charCode >= 65 && charCode <= 70) ||
|
|
4620
|
+
(charCode >= 97 && charCode <= 102);
|
|
4621
|
+
|
|
4622
|
+
const isPercentEncodedByte = (str, i, len) =>
|
|
4623
|
+
i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
|
|
4624
|
+
|
|
4625
|
+
const hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);
|
|
4626
|
+
|
|
4627
|
+
const isBase64Char = (charCode) =>
|
|
4628
|
+
(charCode >= 65 && charCode <= 90) || // A-Z
|
|
4629
|
+
(charCode >= 97 && charCode <= 122) || // a-z
|
|
4630
|
+
(charCode >= 48 && charCode <= 57) || // 0-9
|
|
4631
|
+
charCode === 43 || // +
|
|
4632
|
+
charCode === 47 || // /
|
|
4633
|
+
charCode === 45 || // - (base64url)
|
|
4634
|
+
charCode === 95; // _ (base64url)
|
|
4635
|
+
|
|
4636
|
+
const isBase64Whitespace = (charCode) =>
|
|
4637
|
+
charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
|
|
4638
|
+
|
|
4639
|
+
const base64Bytes = (significant) => {
|
|
4640
|
+
const groups = Math.floor(significant / 4);
|
|
4641
|
+
const remainder = significant % 4;
|
|
4642
|
+
return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
|
|
4643
|
+
};
|
|
3317
4644
|
|
|
3318
|
-
|
|
3319
|
-
|
|
4645
|
+
// Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
|
|
4646
|
+
// upper bound even when Buffer.from later ignores characters or stops at '='.
|
|
4647
|
+
const estimateBase64BufferAllocation = (body) => {
|
|
4648
|
+
const len = body.length;
|
|
4649
|
+
let padding = 0;
|
|
3320
4650
|
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
const isBase64 = /;base64/i.test(meta);
|
|
4651
|
+
if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
|
|
4652
|
+
padding++;
|
|
3324
4653
|
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
const len = body.length; // cache length
|
|
3328
|
-
|
|
3329
|
-
for (let i = 0; i < len; i++) {
|
|
3330
|
-
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
3331
|
-
const a = body.charCodeAt(i + 1);
|
|
3332
|
-
const b = body.charCodeAt(i + 2);
|
|
3333
|
-
const isHex =
|
|
3334
|
-
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
3335
|
-
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
3336
|
-
|
|
3337
|
-
if (isHex) {
|
|
3338
|
-
effectiveLen -= 2;
|
|
3339
|
-
i += 2;
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
4654
|
+
if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
|
|
4655
|
+
padding++;
|
|
3342
4656
|
}
|
|
4657
|
+
}
|
|
3343
4658
|
|
|
3344
|
-
|
|
3345
|
-
|
|
4659
|
+
return Math.floor(((len - padding) * 3) / 4);
|
|
4660
|
+
};
|
|
3346
4661
|
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
4662
|
+
const estimatePercentDecodedBase64Bytes = (body) => {
|
|
4663
|
+
const len = body.length;
|
|
4664
|
+
let significant = 0;
|
|
4665
|
+
let padding = 0;
|
|
4666
|
+
let invalid = false;
|
|
3352
4667
|
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
idx -= 3;
|
|
3360
|
-
}
|
|
4668
|
+
for (let i = 0; i < len; i++) {
|
|
4669
|
+
let code = body.charCodeAt(i);
|
|
4670
|
+
|
|
4671
|
+
if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
4672
|
+
code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
|
|
4673
|
+
i += 2;
|
|
3361
4674
|
}
|
|
3362
4675
|
|
|
3363
|
-
if (
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
4676
|
+
if (isBase64Whitespace(code)) {
|
|
4677
|
+
continue;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
if (code === 61 /* '=' */) {
|
|
4681
|
+
padding++;
|
|
4682
|
+
continue;
|
|
3369
4683
|
}
|
|
3370
4684
|
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
4685
|
+
if (!isBase64Char(code) || padding > 0) {
|
|
4686
|
+
invalid = true;
|
|
4687
|
+
continue;
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4690
|
+
significant++;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
// Fetch rejects malformed forgiving-base64 input. Returning the raw-size
|
|
4694
|
+
// allocation bound keeps that invalid input from becoming a pre-check bypass.
|
|
4695
|
+
if (
|
|
4696
|
+
invalid ||
|
|
4697
|
+
padding > 2 ||
|
|
4698
|
+
(padding > 0 && (significant + padding) % 4 !== 0) ||
|
|
4699
|
+
significant % 4 === 1
|
|
4700
|
+
) {
|
|
4701
|
+
return estimateBase64BufferAllocation(body);
|
|
3374
4702
|
}
|
|
3375
4703
|
|
|
3376
|
-
|
|
3377
|
-
|
|
4704
|
+
return base64Bytes(significant);
|
|
4705
|
+
};
|
|
4706
|
+
|
|
4707
|
+
const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
|
|
4708
|
+
if (!url || typeof url !== 'string') return 0;
|
|
4709
|
+
if (!/^data:/i.test(url)) return 0;
|
|
4710
|
+
|
|
4711
|
+
const comma = url.indexOf(',');
|
|
4712
|
+
if (comma < 0) return 0;
|
|
4713
|
+
|
|
4714
|
+
const meta = url.slice(5, comma);
|
|
4715
|
+
const body = url.slice(comma + 1);
|
|
4716
|
+
const isBase64 = base64Pattern.test(meta);
|
|
4717
|
+
|
|
4718
|
+
if (isBase64) {
|
|
4719
|
+
return estimateBase64(body);
|
|
3378
4720
|
}
|
|
3379
4721
|
|
|
3380
4722
|
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
3381
4723
|
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
3382
|
-
//
|
|
3383
|
-
//
|
|
4724
|
+
// Valid %XX triplets count as one decoded byte; this matches the bytes that
|
|
4725
|
+
// decodeURIComponent(body) would produce before Buffer re-encodes the string.
|
|
3384
4726
|
let bytes = 0;
|
|
3385
4727
|
for (let i = 0, len = body.length; i < len; i++) {
|
|
3386
4728
|
const c = body.charCodeAt(i);
|
|
3387
|
-
if (c
|
|
4729
|
+
if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
|
|
4730
|
+
bytes += 1;
|
|
4731
|
+
i += 2;
|
|
4732
|
+
} else if (c < 0x80) {
|
|
3388
4733
|
bytes += 1;
|
|
3389
4734
|
} else if (c < 0x800) {
|
|
3390
4735
|
bytes += 2;
|
|
@@ -3401,12 +4746,41 @@ function estimateDataURLDecodedBytes(url) {
|
|
|
3401
4746
|
}
|
|
3402
4747
|
}
|
|
3403
4748
|
return bytes;
|
|
4749
|
+
};
|
|
4750
|
+
|
|
4751
|
+
/**
|
|
4752
|
+
* Estimate the percent-decoded payload size used by Fetch data: URLs.
|
|
4753
|
+
*
|
|
4754
|
+
* @param {string} url
|
|
4755
|
+
* @returns {number}
|
|
4756
|
+
*/
|
|
4757
|
+
function estimateDataURLDecodedBytes(url) {
|
|
4758
|
+
// Fetch removes URL fragments before processing a data: URL.
|
|
4759
|
+
const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
|
|
4760
|
+
|
|
4761
|
+
return estimateDataURLBytes(
|
|
4762
|
+
fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
|
|
4763
|
+
estimatePercentDecodedBase64Bytes,
|
|
4764
|
+
/; *base64[\t\n\f\r ]*$/i
|
|
4765
|
+
);
|
|
3404
4766
|
}
|
|
3405
4767
|
|
|
3406
|
-
const VERSION$1 = "1.
|
|
4768
|
+
const VERSION$1 = "1.21.1";
|
|
3407
4769
|
|
|
3408
4770
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3409
4771
|
|
|
4772
|
+
const DEFAULT_REQUEST_OPTIONS = {
|
|
4773
|
+
cache: 'default',
|
|
4774
|
+
redirect: 'follow',
|
|
4775
|
+
referrer: 'about:client',
|
|
4776
|
+
referrerPolicy: '',
|
|
4777
|
+
mode: 'cors',
|
|
4778
|
+
integrity: '',
|
|
4779
|
+
keepalive: false,
|
|
4780
|
+
priority: 'auto',
|
|
4781
|
+
window: null,
|
|
4782
|
+
};
|
|
4783
|
+
|
|
3410
4784
|
const { isFunction } = utils$1;
|
|
3411
4785
|
|
|
3412
4786
|
/**
|
|
@@ -3457,9 +4831,7 @@ const maybeWithAuthCredentials = (url) => {
|
|
|
3457
4831
|
|
|
3458
4832
|
const factory = (env) => {
|
|
3459
4833
|
const globalObject =
|
|
3460
|
-
utils$1.global !== undefined && utils$1.global !== null
|
|
3461
|
-
? utils$1.global
|
|
3462
|
-
: globalThis;
|
|
4834
|
+
utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
|
|
3463
4835
|
const { ReadableStream, TextEncoder } = globalObject;
|
|
3464
4836
|
|
|
3465
4837
|
env = utils$1.merge.call(
|
|
@@ -3469,11 +4841,13 @@ const factory = (env) => {
|
|
|
3469
4841
|
{
|
|
3470
4842
|
Request: globalObject.Request,
|
|
3471
4843
|
Response: globalObject.Response,
|
|
4844
|
+
Blob: globalObject.Blob,
|
|
3472
4845
|
},
|
|
3473
4846
|
env
|
|
3474
4847
|
);
|
|
3475
4848
|
|
|
3476
|
-
const
|
|
4849
|
+
const envFetch = utils$1.hasOwnProp(env, 'fetch') ? env.fetch : undefined;
|
|
4850
|
+
const { Request, Response, Blob } = env;
|
|
3477
4851
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
3478
4852
|
const isRequestSupported = isFunction(Request);
|
|
3479
4853
|
const isResponseSupported = isFunction(Response);
|
|
@@ -3522,6 +4896,20 @@ const factory = (env) => {
|
|
|
3522
4896
|
isReadableStreamSupported &&
|
|
3523
4897
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
3524
4898
|
|
|
4899
|
+
// Some runtimes reject every explicit cache mode. Use own defaults for both
|
|
4900
|
+
// probes so unrelated polluted options cannot affect cache-mode detection.
|
|
4901
|
+
const requestDefaults = Object.assign(Object.create(null), DEFAULT_REQUEST_OPTIONS);
|
|
4902
|
+
|
|
4903
|
+
if (isRequestSupported && !test(() => new Request(platform.origin, requestDefaults))) {
|
|
4904
|
+
delete requestDefaults.cache;
|
|
4905
|
+
|
|
4906
|
+
// Only omit cache when that makes Request construction succeed. Otherwise
|
|
4907
|
+
// retain the explicit default that protects supporting runtimes from pollution.
|
|
4908
|
+
if (!test(() => new Request(platform.origin, requestDefaults))) {
|
|
4909
|
+
requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
|
|
4910
|
+
}
|
|
4911
|
+
}
|
|
4912
|
+
|
|
3525
4913
|
const resolvers = {
|
|
3526
4914
|
stream: supportsResponseStream && ((res) => res.body),
|
|
3527
4915
|
};
|
|
@@ -3555,14 +4943,6 @@ const factory = (env) => {
|
|
|
3555
4943
|
return body.size;
|
|
3556
4944
|
}
|
|
3557
4945
|
|
|
3558
|
-
if (utils$1.isSpecCompliantForm(body)) {
|
|
3559
|
-
const _request = new Request(platform.origin, {
|
|
3560
|
-
method: 'POST',
|
|
3561
|
-
body,
|
|
3562
|
-
});
|
|
3563
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
3564
|
-
}
|
|
3565
|
-
|
|
3566
4946
|
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
3567
4947
|
return body.byteLength;
|
|
3568
4948
|
}
|
|
@@ -3598,6 +4978,7 @@ const factory = (env) => {
|
|
|
3598
4978
|
fetchOptions,
|
|
3599
4979
|
maxContentLength,
|
|
3600
4980
|
maxBodyLength,
|
|
4981
|
+
maxRedirects,
|
|
3601
4982
|
} = resolveConfig(config);
|
|
3602
4983
|
|
|
3603
4984
|
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
@@ -3624,29 +5005,45 @@ const factory = (env) => {
|
|
|
3624
5005
|
|
|
3625
5006
|
let requestContentLength;
|
|
3626
5007
|
|
|
5008
|
+
// AxiosErrors we raise while request or response bodies are being streamed. Captured
|
|
5009
|
+
// by identity so the catch block can surface it directly, regardless of
|
|
5010
|
+
// how the runtime wraps the resulting fetch rejection (undici exposes it
|
|
5011
|
+
// as `err.cause`; some browsers drop the original error entirely).
|
|
5012
|
+
let pendingBodyError = null;
|
|
5013
|
+
let pendingResponseError = null;
|
|
5014
|
+
|
|
5015
|
+
const maxBodyLengthError = () =>
|
|
5016
|
+
new AxiosError$1(
|
|
5017
|
+
'Request body larger than maxBodyLength limit',
|
|
5018
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
5019
|
+
config,
|
|
5020
|
+
request
|
|
5021
|
+
);
|
|
5022
|
+
|
|
3627
5023
|
try {
|
|
3628
5024
|
// HTTP basic authentication
|
|
3629
5025
|
let auth = undefined;
|
|
3630
5026
|
const configAuth = own('auth');
|
|
3631
5027
|
|
|
3632
5028
|
if (configAuth) {
|
|
3633
|
-
const username = configAuth
|
|
3634
|
-
const password = configAuth
|
|
5029
|
+
const username = utils$1.getSafeProp(configAuth, 'username') || '';
|
|
5030
|
+
const password = utils$1.getSafeProp(configAuth, 'password') || '';
|
|
3635
5031
|
auth = {
|
|
3636
5032
|
username,
|
|
3637
|
-
password
|
|
5033
|
+
password,
|
|
3638
5034
|
};
|
|
3639
5035
|
}
|
|
3640
5036
|
|
|
5037
|
+
let parsedURL;
|
|
3641
5038
|
if (maybeWithAuthCredentials(url)) {
|
|
3642
|
-
|
|
5039
|
+
parsedURL = new URL(url, platform.origin);
|
|
3643
5040
|
|
|
3644
5041
|
if (!auth && (parsedURL.username || parsedURL.password)) {
|
|
3645
5042
|
const urlUsername = decodeURIComponentSafe(parsedURL.username);
|
|
3646
5043
|
const urlPassword = decodeURIComponentSafe(parsedURL.password);
|
|
3647
5044
|
auth = {
|
|
3648
5045
|
username: urlUsername,
|
|
3649
|
-
password: urlPassword
|
|
5046
|
+
password: urlPassword,
|
|
3650
5047
|
};
|
|
3651
5048
|
}
|
|
3652
5049
|
|
|
@@ -3668,8 +5065,8 @@ const factory = (env) => {
|
|
|
3668
5065
|
// Enforce maxContentLength for data: URLs up-front so we never materialize
|
|
3669
5066
|
// an oversized payload. The HTTP adapter applies the same check (see http.js
|
|
3670
5067
|
// "if (protocol === 'data:')" branch).
|
|
3671
|
-
if (hasMaxContentLength &&
|
|
3672
|
-
const estimated = estimateDataURLDecodedBytes(
|
|
5068
|
+
if (hasMaxContentLength && parsedURL && parsedURL.protocol === 'data:') {
|
|
5069
|
+
const estimated = estimateDataURLDecodedBytes(parsedURL.href);
|
|
3673
5070
|
if (estimated > maxContentLength) {
|
|
3674
5071
|
throw new AxiosError$1(
|
|
3675
5072
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
@@ -3680,53 +5077,133 @@ const factory = (env) => {
|
|
|
3680
5077
|
}
|
|
3681
5078
|
}
|
|
3682
5079
|
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
5080
|
+
const formContentType =
|
|
5081
|
+
utils$1.isSpecCompliantForm(data) && AxiosHeaders$1.from(own('headers')).getContentType();
|
|
5082
|
+
let formBoundary;
|
|
5083
|
+
if (
|
|
5084
|
+
utils$1.isString(formContentType) &&
|
|
5085
|
+
/^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())
|
|
5086
|
+
) {
|
|
5087
|
+
const parameters = AxiosHeaders$1.parseParameters(formContentType);
|
|
5088
|
+
if (utils$1.hasOwnProp(parameters, 'boundary')) formBoundary = parameters.boundary;
|
|
5089
|
+
}
|
|
5090
|
+
|
|
5091
|
+
if (
|
|
5092
|
+
utils$1.isSpecCompliantForm(data) &&
|
|
5093
|
+
method !== 'get' &&
|
|
5094
|
+
method !== 'head' &&
|
|
5095
|
+
(hasMaxBodyLength ||
|
|
5096
|
+
(onUploadProgress && supportsRequestStream) ||
|
|
5097
|
+
formBoundary !== undefined)
|
|
5098
|
+
) {
|
|
5099
|
+
data = createMultipartBody(
|
|
5100
|
+
data,
|
|
5101
|
+
Blob,
|
|
5102
|
+
hasMaxBodyLength ? maxBodyLength : Infinity,
|
|
5103
|
+
maxBodyLengthError,
|
|
5104
|
+
formBoundary
|
|
5105
|
+
);
|
|
5106
|
+
// Blob.type lowercases its value, including a case-sensitive boundary.
|
|
5107
|
+
// Retain the caller's header when an explicit boundary was serialized.
|
|
5108
|
+
headers.setContentType(formBoundary === undefined ? data.type : formContentType);
|
|
5109
|
+
requestContentLength = data.size;
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
// Enforce maxBodyLength against known-size bodies before dispatch using
|
|
5113
|
+
// the body's *actual* size — never a caller-declared Content-Length,
|
|
5114
|
+
// which could under-report to slip an oversized body past the check.
|
|
5115
|
+
// Unknown-size streams return undefined here and are counted per-chunk
|
|
5116
|
+
// below as fetch consumes them.
|
|
3687
5117
|
if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
|
|
3688
|
-
const outboundLength = await
|
|
3689
|
-
if (
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
throw new AxiosError$1(
|
|
3695
|
-
'Request body larger than maxBodyLength limit',
|
|
3696
|
-
AxiosError$1.ERR_BAD_REQUEST,
|
|
3697
|
-
config,
|
|
3698
|
-
request
|
|
3699
|
-
);
|
|
5118
|
+
const outboundLength = await getBodyLength(data);
|
|
5119
|
+
if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
|
|
5120
|
+
requestContentLength = outboundLength;
|
|
5121
|
+
if (outboundLength > maxBodyLength) {
|
|
5122
|
+
throw maxBodyLengthError();
|
|
5123
|
+
}
|
|
3700
5124
|
}
|
|
3701
5125
|
}
|
|
3702
5126
|
|
|
5127
|
+
// A streamed body under maxBodyLength must be counted as fetch consumes
|
|
5128
|
+
// it; its size is never trusted from a caller-declared Content-Length.
|
|
5129
|
+
const mustEnforceStreamBody =
|
|
5130
|
+
hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
|
|
5131
|
+
|
|
5132
|
+
const trackRequestStream = (stream, onProgress, flush) =>
|
|
5133
|
+
trackStream(
|
|
5134
|
+
stream,
|
|
5135
|
+
DEFAULT_CHUNK_SIZE,
|
|
5136
|
+
(loadedBytes) => {
|
|
5137
|
+
if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
|
|
5138
|
+
throw (pendingBodyError = maxBodyLengthError());
|
|
5139
|
+
}
|
|
5140
|
+
onProgress && onProgress(loadedBytes);
|
|
5141
|
+
},
|
|
5142
|
+
flush
|
|
5143
|
+
);
|
|
5144
|
+
|
|
3703
5145
|
if (
|
|
3704
|
-
onUploadProgress &&
|
|
3705
5146
|
supportsRequestStream &&
|
|
3706
5147
|
method !== 'get' &&
|
|
3707
5148
|
method !== 'head' &&
|
|
3708
|
-
(
|
|
5149
|
+
(onUploadProgress || mustEnforceStreamBody)
|
|
3709
5150
|
) {
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
5151
|
+
requestContentLength =
|
|
5152
|
+
requestContentLength == null
|
|
5153
|
+
? await resolveBodyLength(headers, data)
|
|
5154
|
+
: requestContentLength;
|
|
5155
|
+
|
|
5156
|
+
// A declared length of 0 is only trusted to skip the wrap when we are
|
|
5157
|
+
// not enforcing a stream limit (which must not rely on that header).
|
|
5158
|
+
if (requestContentLength !== 0 || mustEnforceStreamBody) {
|
|
5159
|
+
let _request = new Request(url, {
|
|
5160
|
+
method: 'POST',
|
|
5161
|
+
body: data,
|
|
5162
|
+
duplex: 'half',
|
|
5163
|
+
});
|
|
3715
5164
|
|
|
3716
|
-
|
|
5165
|
+
let contentTypeHeader;
|
|
3717
5166
|
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
5167
|
+
if (
|
|
5168
|
+
utils$1.isFormData(data) &&
|
|
5169
|
+
(contentTypeHeader = _request.headers.get('content-type'))
|
|
5170
|
+
) {
|
|
5171
|
+
headers.setContentType(contentTypeHeader);
|
|
5172
|
+
}
|
|
3721
5173
|
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
5174
|
+
if (_request.body) {
|
|
5175
|
+
const [onProgress, flush] =
|
|
5176
|
+
(onUploadProgress &&
|
|
5177
|
+
progressEventDecorator(
|
|
5178
|
+
requestContentLength,
|
|
5179
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
5180
|
+
)) ||
|
|
5181
|
+
[];
|
|
3727
5182
|
|
|
3728
|
-
|
|
5183
|
+
data = trackRequestStream(_request.body, onProgress, flush);
|
|
5184
|
+
}
|
|
3729
5185
|
}
|
|
5186
|
+
} else if (
|
|
5187
|
+
mustEnforceStreamBody &&
|
|
5188
|
+
!isRequestSupported &&
|
|
5189
|
+
isReadableStreamSupported &&
|
|
5190
|
+
method !== 'get' &&
|
|
5191
|
+
method !== 'head'
|
|
5192
|
+
) {
|
|
5193
|
+
data = trackRequestStream(data);
|
|
5194
|
+
} else if (
|
|
5195
|
+
mustEnforceStreamBody &&
|
|
5196
|
+
isRequestSupported &&
|
|
5197
|
+
!supportsRequestStream &&
|
|
5198
|
+
method !== 'get' &&
|
|
5199
|
+
method !== 'head'
|
|
5200
|
+
) {
|
|
5201
|
+
throw new AxiosError$1(
|
|
5202
|
+
'Stream request bodies are not supported by the current fetch implementation',
|
|
5203
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
5204
|
+
config,
|
|
5205
|
+
request
|
|
5206
|
+
);
|
|
3730
5207
|
}
|
|
3731
5208
|
|
|
3732
5209
|
if (!utils$1.isString(withCredentials)) {
|
|
@@ -3753,26 +5230,65 @@ const factory = (env) => {
|
|
|
3753
5230
|
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
3754
5231
|
headers.set('User-Agent', 'axios/' + VERSION$1, false);
|
|
3755
5232
|
|
|
3756
|
-
const
|
|
3757
|
-
|
|
5233
|
+
const safeFetchOptions =
|
|
5234
|
+
fetchOptions == null ? fetchOptions : Object.assign(Object.create(null), fetchOptions);
|
|
5235
|
+
|
|
5236
|
+
if (safeFetchOptions) {
|
|
5237
|
+
// These options are owned by Axios and are already reflected in the
|
|
5238
|
+
// resolved Request passed to fetch.
|
|
5239
|
+
delete safeFetchOptions.body;
|
|
5240
|
+
delete safeFetchOptions.headers;
|
|
5241
|
+
delete safeFetchOptions.method;
|
|
5242
|
+
delete safeFetchOptions.signal;
|
|
5243
|
+
delete safeFetchOptions.duplex;
|
|
5244
|
+
delete safeFetchOptions.credentials;
|
|
5245
|
+
}
|
|
5246
|
+
|
|
5247
|
+
const resolvedOptions = Object.assign(Object.create(null), safeFetchOptions, {
|
|
3758
5248
|
signal: composedSignal,
|
|
3759
5249
|
method: method.toUpperCase(),
|
|
3760
5250
|
headers: toByteStringHeaderObject(headers.normalize()),
|
|
3761
5251
|
body: data,
|
|
3762
5252
|
duplex: 'half',
|
|
3763
5253
|
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3764
|
-
};
|
|
5254
|
+
});
|
|
5255
|
+
|
|
5256
|
+
if (isRequestSupported) {
|
|
5257
|
+
utils$1.forEach(requestDefaults, (value, key) => {
|
|
5258
|
+
if (resolvedOptions[key] === undefined) {
|
|
5259
|
+
resolvedOptions[key] = value;
|
|
5260
|
+
}
|
|
5261
|
+
});
|
|
5262
|
+
|
|
5263
|
+
if (resolvedOptions.signal === undefined) {
|
|
5264
|
+
resolvedOptions.signal = null;
|
|
5265
|
+
}
|
|
5266
|
+
|
|
5267
|
+
if (resolvedOptions.body === undefined) {
|
|
5268
|
+
resolvedOptions.body = null;
|
|
5269
|
+
}
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5272
|
+
if (maxRedirects === 0) {
|
|
5273
|
+
resolvedOptions.redirect = 'manual';
|
|
5274
|
+
|
|
5275
|
+
if (safeFetchOptions) {
|
|
5276
|
+
safeFetchOptions.redirect = 'manual';
|
|
5277
|
+
}
|
|
5278
|
+
}
|
|
3765
5279
|
|
|
3766
5280
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3767
5281
|
|
|
3768
5282
|
let response = await (isRequestSupported
|
|
3769
|
-
? _fetch(request,
|
|
5283
|
+
? _fetch(request, safeFetchOptions)
|
|
3770
5284
|
: _fetch(url, resolvedOptions));
|
|
3771
5285
|
|
|
5286
|
+
const responseHeaders = AxiosHeaders$1.from(response.headers);
|
|
5287
|
+
|
|
3772
5288
|
// Cheap pre-check: if the server honestly declares a content-length that
|
|
3773
5289
|
// already exceeds the cap, reject before we start streaming.
|
|
3774
5290
|
if (hasMaxContentLength) {
|
|
3775
|
-
const declaredLength = utils$1.toFiniteNumber(
|
|
5291
|
+
const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
3776
5292
|
if (declaredLength != null && declaredLength > maxContentLength) {
|
|
3777
5293
|
throw new AxiosError$1(
|
|
3778
5294
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
@@ -3797,7 +5313,7 @@ const factory = (env) => {
|
|
|
3797
5313
|
options[prop] = response[prop];
|
|
3798
5314
|
});
|
|
3799
5315
|
|
|
3800
|
-
const responseContentLength = utils$1.toFiniteNumber(
|
|
5316
|
+
const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
3801
5317
|
|
|
3802
5318
|
const [onProgress, flush] =
|
|
3803
5319
|
(onDownloadProgress &&
|
|
@@ -3812,12 +5328,12 @@ const factory = (env) => {
|
|
|
3812
5328
|
if (hasMaxContentLength) {
|
|
3813
5329
|
bytesRead = loadedBytes;
|
|
3814
5330
|
if (bytesRead > maxContentLength) {
|
|
3815
|
-
throw new AxiosError$1(
|
|
5331
|
+
throw (pendingResponseError = new AxiosError$1(
|
|
3816
5332
|
'maxContentLength size of ' + maxContentLength + ' exceeded',
|
|
3817
5333
|
AxiosError$1.ERR_BAD_RESPONSE,
|
|
3818
5334
|
config,
|
|
3819
5335
|
request
|
|
3820
|
-
);
|
|
5336
|
+
));
|
|
3821
5337
|
}
|
|
3822
5338
|
}
|
|
3823
5339
|
onProgress && onProgress(loadedBytes);
|
|
@@ -3888,23 +5404,59 @@ const factory = (env) => {
|
|
|
3888
5404
|
const canceledError = composedSignal.reason;
|
|
3889
5405
|
canceledError.config = config;
|
|
3890
5406
|
request && (canceledError.request = request);
|
|
3891
|
-
err !== canceledError
|
|
5407
|
+
if (err !== canceledError) {
|
|
5408
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
5409
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
5410
|
+
Object.defineProperty(canceledError, 'cause', {
|
|
5411
|
+
__proto__: null,
|
|
5412
|
+
value: err,
|
|
5413
|
+
writable: true,
|
|
5414
|
+
enumerable: false,
|
|
5415
|
+
configurable: true,
|
|
5416
|
+
});
|
|
5417
|
+
}
|
|
3892
5418
|
throw canceledError;
|
|
3893
5419
|
}
|
|
3894
5420
|
|
|
5421
|
+
// Surface a maxBodyLength violation we raised while the request body was
|
|
5422
|
+
// being streamed. Keeping the original error (rather than reading
|
|
5423
|
+
// `err.cause.isAxiosError`) keeps the error deterministic across runtimes
|
|
5424
|
+
// and avoids both prototype-pollution reads and mis-attributing a foreign
|
|
5425
|
+
// AxiosError that merely happened to land in `err.cause`.
|
|
5426
|
+
if (pendingBodyError) {
|
|
5427
|
+
request && !pendingBodyError.request && (pendingBodyError.request = request);
|
|
5428
|
+
throw pendingBodyError;
|
|
5429
|
+
}
|
|
5430
|
+
|
|
5431
|
+
if (pendingResponseError) {
|
|
5432
|
+
throw pendingResponseError;
|
|
5433
|
+
}
|
|
5434
|
+
|
|
5435
|
+
// Re-throw AxiosErrors we raised synchronously (data: URL / content-length
|
|
5436
|
+
// pre-checks, response size enforcement) without re-wrapping them.
|
|
5437
|
+
if (err instanceof AxiosError$1) {
|
|
5438
|
+
request && !err.request && (err.request = request);
|
|
5439
|
+
throw err;
|
|
5440
|
+
}
|
|
5441
|
+
|
|
3895
5442
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
err && err.response
|
|
3903
|
-
),
|
|
3904
|
-
{
|
|
3905
|
-
cause: err.cause || err,
|
|
3906
|
-
}
|
|
5443
|
+
const networkError = new AxiosError$1(
|
|
5444
|
+
'Network Error',
|
|
5445
|
+
AxiosError$1.ERR_NETWORK,
|
|
5446
|
+
config,
|
|
5447
|
+
request,
|
|
5448
|
+
err && err.response
|
|
3907
5449
|
);
|
|
5450
|
+
// Non-enumerable to match native Error `cause` semantics so loggers
|
|
5451
|
+
// don't recurse into circular fetch internals (see #7205).
|
|
5452
|
+
Object.defineProperty(networkError, 'cause', {
|
|
5453
|
+
__proto__: null,
|
|
5454
|
+
value: err.cause || err,
|
|
5455
|
+
writable: true,
|
|
5456
|
+
enumerable: false,
|
|
5457
|
+
configurable: true,
|
|
5458
|
+
});
|
|
5459
|
+
throw networkError;
|
|
3908
5460
|
}
|
|
3909
5461
|
|
|
3910
5462
|
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
@@ -3915,9 +5467,15 @@ const factory = (env) => {
|
|
|
3915
5467
|
const seedCache = new Map();
|
|
3916
5468
|
|
|
3917
5469
|
const getFetch = (config) => {
|
|
3918
|
-
|
|
3919
|
-
const
|
|
3920
|
-
|
|
5470
|
+
const env = Object.create(null);
|
|
5471
|
+
const configuredEnv = config && utils$1.hasOwnProp(config, 'env') && config.env;
|
|
5472
|
+
['fetch', 'Request', 'Response', 'Blob'].forEach((key) => {
|
|
5473
|
+
if (configuredEnv && utils$1.hasOwnProp(configuredEnv, key)) {
|
|
5474
|
+
env[key] = configuredEnv[key];
|
|
5475
|
+
}
|
|
5476
|
+
});
|
|
5477
|
+
const { fetch, Request, Response, Blob } = env;
|
|
5478
|
+
const seeds = [Request, Response, fetch, Blob];
|
|
3921
5479
|
|
|
3922
5480
|
let len = seeds.length,
|
|
3923
5481
|
i = len,
|
|
@@ -4042,7 +5600,7 @@ function getAdapter$1(adapters, config) {
|
|
|
4042
5600
|
|
|
4043
5601
|
throw new AxiosError$1(
|
|
4044
5602
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
4045
|
-
|
|
5603
|
+
AxiosError$1.ERR_NOT_SUPPORT
|
|
4046
5604
|
);
|
|
4047
5605
|
}
|
|
4048
5606
|
|
|
@@ -4083,6 +5641,37 @@ function throwIfCancellationRequested(config) {
|
|
|
4083
5641
|
}
|
|
4084
5642
|
}
|
|
4085
5643
|
|
|
5644
|
+
/**
|
|
5645
|
+
* Resolve the clock used to time adapter execution.
|
|
5646
|
+
*
|
|
5647
|
+
* Prefers the monotonic `performance.now()` so wall-clock adjustments do not
|
|
5648
|
+
* skew the measurement, and so frameworks that forbid reading the current
|
|
5649
|
+
* time during prerendering (e.g. Next.js Cache Components) accept it. Falls
|
|
5650
|
+
* back to `Date.now()` in runtimes without the High Resolution Time API.
|
|
5651
|
+
*
|
|
5652
|
+
* @returns {() => number} Millisecond clock
|
|
5653
|
+
*/
|
|
5654
|
+
function resolveClock() {
|
|
5655
|
+
return typeof performance !== 'undefined' && utils$1.isFunction(performance.now)
|
|
5656
|
+
? () => performance.now()
|
|
5657
|
+
: Date.now;
|
|
5658
|
+
}
|
|
5659
|
+
|
|
5660
|
+
/**
|
|
5661
|
+
* Whole milliseconds elapsed since `start`, floored at zero.
|
|
5662
|
+
*
|
|
5663
|
+
* Rounded so the value stays an integer as with `Date.now()`. The fallback
|
|
5664
|
+
* wall clock can move backwards mid-request, so the result is clamped.
|
|
5665
|
+
*
|
|
5666
|
+
* @param {() => number} now Clock returned by `resolveClock()`
|
|
5667
|
+
* @param {number} start Timestamp read from `now`
|
|
5668
|
+
*
|
|
5669
|
+
* @returns {number} Non-negative elapsed milliseconds
|
|
5670
|
+
*/
|
|
5671
|
+
function elapsedSince(now, start) {
|
|
5672
|
+
return Math.max(0, Math.round(now() - start));
|
|
5673
|
+
}
|
|
5674
|
+
|
|
4086
5675
|
/**
|
|
4087
5676
|
* Dispatch a request to the server using the configured adapter.
|
|
4088
5677
|
*
|
|
@@ -4090,10 +5679,15 @@ function throwIfCancellationRequested(config) {
|
|
|
4090
5679
|
*
|
|
4091
5680
|
* @returns {Promise} The Promise to be fulfilled
|
|
4092
5681
|
*/
|
|
4093
|
-
function dispatchRequest(
|
|
5682
|
+
function dispatchRequest(_config) {
|
|
5683
|
+
// Interceptors may replace the merged config with an ordinary object. Flatten
|
|
5684
|
+
// it at the dispatch boundary so shared prototype members cannot become
|
|
5685
|
+
// request behavior, while preserving intentional template/class members.
|
|
5686
|
+
const config = utils$1.toSafeFlatObject(_config);
|
|
5687
|
+
|
|
4094
5688
|
throwIfCancellationRequested(config);
|
|
4095
5689
|
|
|
4096
|
-
config.headers = AxiosHeaders$1.from(config
|
|
5690
|
+
config.headers = AxiosHeaders$1.from(utils$1.getSafeProp(config, 'headers'));
|
|
4097
5691
|
|
|
4098
5692
|
// Transform request data
|
|
4099
5693
|
config.data = transformData.call(config, config.transformRequest);
|
|
@@ -4104,10 +5698,15 @@ function dispatchRequest(config) {
|
|
|
4104
5698
|
|
|
4105
5699
|
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
4106
5700
|
|
|
5701
|
+
const now = resolveClock();
|
|
5702
|
+
const start = now();
|
|
5703
|
+
|
|
4107
5704
|
return adapter(config).then(
|
|
4108
5705
|
function onAdapterResolution(response) {
|
|
4109
5706
|
throwIfCancellationRequested(config);
|
|
4110
5707
|
|
|
5708
|
+
response.duration = elapsedSince(now, start);
|
|
5709
|
+
|
|
4111
5710
|
// Expose the current response on config so that transformResponse can
|
|
4112
5711
|
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
4113
5712
|
// We clean it up afterwards to avoid polluting the config object.
|
|
@@ -4128,6 +5727,7 @@ function dispatchRequest(config) {
|
|
|
4128
5727
|
|
|
4129
5728
|
// Transform response data
|
|
4130
5729
|
if (reason && reason.response) {
|
|
5730
|
+
reason.response.duration = elapsedSince(now, start);
|
|
4131
5731
|
config.response = reason.response;
|
|
4132
5732
|
try {
|
|
4133
5733
|
reason.response.data = transformData.call(
|
|
@@ -4223,7 +5823,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
4223
5823
|
*/
|
|
4224
5824
|
|
|
4225
5825
|
function assertOptions(options, schema, allowUnknown) {
|
|
4226
|
-
if (typeof options !== 'object') {
|
|
5826
|
+
if (typeof options !== 'object' || options === null) {
|
|
4227
5827
|
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
4228
5828
|
}
|
|
4229
5829
|
const keys = Object.keys(options);
|
|
@@ -4257,6 +5857,37 @@ var validator = {
|
|
|
4257
5857
|
|
|
4258
5858
|
const validators = validator.validators;
|
|
4259
5859
|
|
|
5860
|
+
// Recognize header maps without consuming objects intended as literal values.
|
|
5861
|
+
// AxiosHeaders from other builds share a brand and header-container interface,
|
|
5862
|
+
// but not constructor identity. A tag and toJSON alone can describe a literal.
|
|
5863
|
+
const isHeadersBucket = (value) => {
|
|
5864
|
+
if (value == null || utils$1.isPlainObject(value) || value instanceof AxiosHeaders$1) {
|
|
5865
|
+
return true;
|
|
5866
|
+
}
|
|
5867
|
+
|
|
5868
|
+
try {
|
|
5869
|
+
return (
|
|
5870
|
+
utils$1.isObject(value) &&
|
|
5871
|
+
utils$1.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' &&
|
|
5872
|
+
[
|
|
5873
|
+
'toJSON',
|
|
5874
|
+
'set',
|
|
5875
|
+
'get',
|
|
5876
|
+
'has',
|
|
5877
|
+
'delete',
|
|
5878
|
+
'clear',
|
|
5879
|
+
'normalize',
|
|
5880
|
+
'concat',
|
|
5881
|
+
'toString',
|
|
5882
|
+
Symbol.iterator,
|
|
5883
|
+
].every((method) => utils$1.isFunction(utils$1.getSafeProp(value, method)))
|
|
5884
|
+
);
|
|
5885
|
+
} catch (e) {
|
|
5886
|
+
// A failed optional brand probe must not prevent literal header serialization.
|
|
5887
|
+
return false;
|
|
5888
|
+
}
|
|
5889
|
+
};
|
|
5890
|
+
|
|
4260
5891
|
/**
|
|
4261
5892
|
* Create a new instance of Axios
|
|
4262
5893
|
*
|
|
@@ -4286,37 +5917,47 @@ let Axios$1 = class Axios {
|
|
|
4286
5917
|
return await this._request(configOrUrl, config);
|
|
4287
5918
|
} catch (err) {
|
|
4288
5919
|
if (err instanceof Error) {
|
|
4289
|
-
|
|
5920
|
+
try {
|
|
5921
|
+
let dummy = {};
|
|
4290
5922
|
|
|
4291
|
-
|
|
5923
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
4292
5924
|
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
if (!dummy.stack) {
|
|
4296
|
-
return '';
|
|
4297
|
-
}
|
|
5925
|
+
const dummyStack = dummy.stack;
|
|
5926
|
+
let stack = '';
|
|
4298
5927
|
|
|
4299
|
-
|
|
5928
|
+
// slice off the Error: ... line
|
|
5929
|
+
if (typeof dummyStack === 'string') {
|
|
5930
|
+
const firstNewlineIndex = dummyStack.indexOf('\n');
|
|
5931
|
+
|
|
5932
|
+
stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
|
|
5933
|
+
}
|
|
4300
5934
|
|
|
4301
|
-
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
4302
|
-
})();
|
|
4303
|
-
try {
|
|
4304
5935
|
if (!err.stack) {
|
|
4305
5936
|
err.stack = stack;
|
|
4306
|
-
// match without the 2 top stack lines
|
|
4307
5937
|
} else if (stack) {
|
|
5938
|
+
// Match a common suffix after the 2 top frames when available,
|
|
5939
|
+
// otherwise compare the full reconstructed stack.
|
|
4308
5940
|
const firstNewlineIndex = stack.indexOf('\n');
|
|
4309
5941
|
const secondNewlineIndex =
|
|
4310
5942
|
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
4311
|
-
const
|
|
4312
|
-
secondNewlineIndex === -1 ?
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
5943
|
+
const duplicateCheckSuffix =
|
|
5944
|
+
secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
|
|
5945
|
+
|
|
5946
|
+
// `AxiosError.from()` may have already inlined the wrapped error's
|
|
5947
|
+
// stack under a `Caused by:` marker. Keep the reconstructed caller
|
|
5948
|
+
// frames ahead of that marker so stack-only reporters do not read
|
|
5949
|
+
// them as part of the low-level cause.
|
|
5950
|
+
const currentStack = String(err.stack);
|
|
5951
|
+
const causeIndex = getCauseStackIndex(err, currentStack);
|
|
5952
|
+
const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
|
|
5953
|
+
const causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
|
|
5954
|
+
|
|
5955
|
+
if (!stackHead.endsWith(duplicateCheckSuffix)) {
|
|
5956
|
+
err.stack = stackHead + '\n' + stack + causeSection;
|
|
4316
5957
|
}
|
|
4317
5958
|
}
|
|
4318
5959
|
} catch (e) {
|
|
4319
|
-
//
|
|
5960
|
+
// Ignore failures from custom stack hooks or un-writable stack properties.
|
|
4320
5961
|
}
|
|
4321
5962
|
}
|
|
4322
5963
|
|
|
@@ -4347,6 +5988,8 @@ let Axios$1 = class Axios {
|
|
|
4347
5988
|
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
4348
5989
|
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
4349
5990
|
advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
|
|
5991
|
+
validateStatusUndefinedResolves: validators.transitional(validators.boolean),
|
|
5992
|
+
encodeBasicAuthUsername: validators.transitional(validators.boolean),
|
|
4350
5993
|
},
|
|
4351
5994
|
false
|
|
4352
5995
|
);
|
|
@@ -4370,7 +6013,10 @@ let Axios$1 = class Axios {
|
|
|
4370
6013
|
}
|
|
4371
6014
|
|
|
4372
6015
|
// Set config.allowAbsoluteUrls
|
|
4373
|
-
if (config.allowAbsoluteUrls !== undefined) ; else if (
|
|
6016
|
+
if (config.allowAbsoluteUrls !== undefined) ; else if (
|
|
6017
|
+
utils$1.hasOwnProp(this.defaults, 'allowAbsoluteUrls') &&
|
|
6018
|
+
this.defaults.allowAbsoluteUrls !== undefined
|
|
6019
|
+
) {
|
|
4374
6020
|
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
4375
6021
|
} else {
|
|
4376
6022
|
config.allowAbsoluteUrls = true;
|
|
@@ -4386,14 +6032,27 @@ let Axios$1 = class Axios {
|
|
|
4386
6032
|
);
|
|
4387
6033
|
|
|
4388
6034
|
// Set config.method
|
|
4389
|
-
config.method = (
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
6035
|
+
config.method = (
|
|
6036
|
+
utils$1.getSafeProp(config, 'method') ||
|
|
6037
|
+
utils$1.getSafeProp(this.defaults, 'method') ||
|
|
6038
|
+
'get'
|
|
6039
|
+
).toLowerCase();
|
|
6040
|
+
|
|
6041
|
+
// Flatten header defaults without consuming literal method-named headers.
|
|
6042
|
+
const commonHeaders = utils$1.getSafeProp(headers, 'common');
|
|
6043
|
+
const methodHeaders = utils$1.getSafeProp(headers, config.method);
|
|
6044
|
+
const contextHeaders =
|
|
6045
|
+
headers &&
|
|
6046
|
+
utils$1.merge(
|
|
6047
|
+
isHeadersBucket(commonHeaders) ? commonHeaders : undefined,
|
|
6048
|
+
isHeadersBucket(methodHeaders) ? methodHeaders : undefined
|
|
6049
|
+
);
|
|
4393
6050
|
|
|
4394
6051
|
headers &&
|
|
4395
|
-
utils$1.forEach(
|
|
4396
|
-
|
|
6052
|
+
utils$1.forEach(methodList.concat('common'), (method) => {
|
|
6053
|
+
if (isHeadersBucket(utils$1.getSafeProp(headers, method))) {
|
|
6054
|
+
delete headers[method];
|
|
6055
|
+
}
|
|
4397
6056
|
});
|
|
4398
6057
|
|
|
4399
6058
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
@@ -4451,17 +6110,35 @@ let Axios$1 = class Axios {
|
|
|
4451
6110
|
const onFulfilled = requestInterceptorChain[i++];
|
|
4452
6111
|
const onRejected = requestInterceptorChain[i++];
|
|
4453
6112
|
try {
|
|
4454
|
-
newConfig = onFulfilled(newConfig);
|
|
6113
|
+
newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
|
|
4455
6114
|
} catch (error) {
|
|
4456
|
-
onRejected
|
|
6115
|
+
if (!onRejected) {
|
|
6116
|
+
promise = Promise.reject(error);
|
|
6117
|
+
break;
|
|
6118
|
+
}
|
|
6119
|
+
|
|
6120
|
+
try {
|
|
6121
|
+
const rejectedResult = onRejected.call(this, error);
|
|
6122
|
+
|
|
6123
|
+
if (utils$1.isThenable(rejectedResult)) {
|
|
6124
|
+
promise = Promise.resolve(rejectedResult).then(() =>
|
|
6125
|
+
dispatchRequest.call(this, newConfig)
|
|
6126
|
+
);
|
|
6127
|
+
}
|
|
6128
|
+
} catch (rejectedError) {
|
|
6129
|
+
promise = Promise.reject(rejectedError);
|
|
6130
|
+
}
|
|
6131
|
+
|
|
4457
6132
|
break;
|
|
4458
6133
|
}
|
|
4459
6134
|
}
|
|
4460
6135
|
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
6136
|
+
if (!promise) {
|
|
6137
|
+
try {
|
|
6138
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
6139
|
+
} catch (error) {
|
|
6140
|
+
promise = Promise.reject(error);
|
|
6141
|
+
}
|
|
4465
6142
|
}
|
|
4466
6143
|
|
|
4467
6144
|
i = 0;
|
|
@@ -4476,7 +6153,7 @@ let Axios$1 = class Axios {
|
|
|
4476
6153
|
|
|
4477
6154
|
getUri(config) {
|
|
4478
6155
|
config = mergeConfig$1(this.defaults, config);
|
|
4479
|
-
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
6156
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
|
|
4480
6157
|
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
4481
6158
|
}
|
|
4482
6159
|
};
|
|
@@ -4484,12 +6161,12 @@ let Axios$1 = class Axios {
|
|
|
4484
6161
|
// Provide aliases for supported request methods
|
|
4485
6162
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
4486
6163
|
/*eslint func-names:0*/
|
|
4487
|
-
Axios$1.prototype[method] = function (url, config) {
|
|
6164
|
+
Axios$1.prototype[method] = async function (url, config) {
|
|
4488
6165
|
return this.request(
|
|
4489
6166
|
mergeConfig$1(config || {}, {
|
|
4490
6167
|
method,
|
|
4491
6168
|
url,
|
|
4492
|
-
data: (config
|
|
6169
|
+
data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
|
|
4493
6170
|
})
|
|
4494
6171
|
);
|
|
4495
6172
|
};
|
|
@@ -4497,7 +6174,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
4497
6174
|
|
|
4498
6175
|
utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
4499
6176
|
function generateHTTPMethod(isForm) {
|
|
4500
|
-
return function httpMethod(url, data, config) {
|
|
6177
|
+
return async function httpMethod(url, data, config) {
|
|
4501
6178
|
return this.request(
|
|
4502
6179
|
mergeConfig$1(config || {}, {
|
|
4503
6180
|
method,
|
|
@@ -4727,14 +6404,22 @@ const HttpStatusCode$1 = {
|
|
|
4727
6404
|
Gone: 410,
|
|
4728
6405
|
LengthRequired: 411,
|
|
4729
6406
|
PreconditionFailed: 412,
|
|
6407
|
+
/**
|
|
6408
|
+
* @deprecated Use `ContentTooLarge` instead.
|
|
6409
|
+
*/
|
|
4730
6410
|
PayloadTooLarge: 413,
|
|
6411
|
+
ContentTooLarge: 413,
|
|
4731
6412
|
UriTooLong: 414,
|
|
4732
6413
|
UnsupportedMediaType: 415,
|
|
4733
6414
|
RangeNotSatisfiable: 416,
|
|
4734
6415
|
ExpectationFailed: 417,
|
|
4735
6416
|
ImATeapot: 418,
|
|
4736
6417
|
MisdirectedRequest: 421,
|
|
6418
|
+
/**
|
|
6419
|
+
* @deprecated Use `UnprocessableContent` instead.
|
|
6420
|
+
*/
|
|
4737
6421
|
UnprocessableEntity: 422,
|
|
6422
|
+
UnprocessableContent: 422,
|
|
4738
6423
|
Locked: 423,
|
|
4739
6424
|
FailedDependency: 424,
|
|
4740
6425
|
TooEarly: 425,
|
|
@@ -4754,6 +6439,7 @@ const HttpStatusCode$1 = {
|
|
|
4754
6439
|
LoopDetected: 508,
|
|
4755
6440
|
NotExtended: 510,
|
|
4756
6441
|
NetworkAuthenticationRequired: 511,
|
|
6442
|
+
WebServerReturnsAnUnknownError: 520,
|
|
4757
6443
|
WebServerIsDown: 521,
|
|
4758
6444
|
ConnectionTimedOut: 522,
|
|
4759
6445
|
OriginIsUnreachable: 523,
|
|
@@ -4763,7 +6449,9 @@ const HttpStatusCode$1 = {
|
|
|
4763
6449
|
};
|
|
4764
6450
|
|
|
4765
6451
|
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
4766
|
-
HttpStatusCode$1[value]
|
|
6452
|
+
if (HttpStatusCode$1[value] === undefined) {
|
|
6453
|
+
HttpStatusCode$1[value] = key;
|
|
6454
|
+
}
|
|
4767
6455
|
});
|
|
4768
6456
|
|
|
4769
6457
|
/**
|
|
@@ -4857,4 +6545,3 @@ const {
|
|
|
4857
6545
|
} = axios;
|
|
4858
6546
|
|
|
4859
6547
|
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, create, axios as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
|
|
4860
|
-
//# sourceMappingURL=axios.js.map
|