groove-dev 0.27.143 → 0.27.145
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/CLAUDE.md +0 -7
- package/node_modules/@groove-dev/cli/package.json +1 -1
- package/node_modules/@groove-dev/daemon/package.json +1 -1
- package/node_modules/@groove-dev/daemon/src/api.js +1086 -6532
- package/node_modules/@groove-dev/daemon/src/conversations.js +18 -48
- package/node_modules/@groove-dev/daemon/src/gateways/manager.js +35 -1
- package/node_modules/@groove-dev/daemon/src/index.js +3 -0
- package/node_modules/@groove-dev/daemon/src/journalist.js +23 -13
- package/node_modules/@groove-dev/daemon/src/mlx-server.js +365 -0
- package/node_modules/@groove-dev/daemon/src/model-lab.js +308 -12
- package/node_modules/@groove-dev/daemon/src/pm.js +1 -1
- package/node_modules/@groove-dev/daemon/src/process.js +2 -2
- package/node_modules/@groove-dev/daemon/src/providers/local.js +36 -8
- package/node_modules/@groove-dev/daemon/src/registry.js +21 -5
- package/node_modules/@groove-dev/daemon/src/routes/agents.js +812 -0
- package/node_modules/@groove-dev/daemon/src/routes/coordination.js +318 -0
- package/node_modules/@groove-dev/daemon/src/routes/files.js +751 -0
- package/node_modules/@groove-dev/daemon/src/routes/integrations.js +485 -0
- package/node_modules/@groove-dev/daemon/src/routes/network.js +1784 -0
- package/node_modules/@groove-dev/daemon/src/routes/providers.js +755 -0
- package/node_modules/@groove-dev/daemon/src/routes/schedules.js +110 -0
- package/node_modules/@groove-dev/daemon/src/routes/teams.js +650 -0
- package/node_modules/@groove-dev/daemon/src/scheduler.js +456 -24
- package/node_modules/@groove-dev/daemon/src/teams.js +1 -1
- package/node_modules/@groove-dev/daemon/src/validate.js +38 -1
- package/node_modules/@groove-dev/daemon/templates/mlx-setup.json +12 -0
- package/node_modules/@groove-dev/daemon/templates/tgi-setup.json +1 -1
- package/node_modules/@groove-dev/daemon/templates/vllm-setup.json +1 -1
- package/node_modules/@groove-dev/daemon/test/introducer.test.js +3 -3
- package/node_modules/@groove-dev/daemon/test/journalist.test.js +7 -10
- package/node_modules/@groove-dev/daemon/test/registry.test.js +38 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-Bxc0gU06.js +1006 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-C0pztKBn.css +1 -0
- package/node_modules/@groove-dev/gui/dist/index.html +2 -2
- package/node_modules/@groove-dev/gui/package.json +1 -1
- package/node_modules/@groove-dev/gui/src/{app.jsx → App.jsx} +0 -2
- package/node_modules/@groove-dev/gui/src/app.css +35 -0
- package/node_modules/@groove-dev/gui/src/components/agents/agent-config.jsx +1 -128
- package/node_modules/@groove-dev/gui/src/components/agents/agent-feed.jsx +210 -112
- package/node_modules/@groove-dev/gui/src/components/agents/agent-node.jsx +8 -13
- package/node_modules/@groove-dev/gui/src/components/agents/agent-panel.jsx +2 -70
- package/node_modules/@groove-dev/gui/src/components/agents/code-review.jsx +159 -122
- package/node_modules/@groove-dev/gui/src/components/agents/diff-viewer.jsx +23 -23
- package/node_modules/@groove-dev/gui/src/components/agents/journalist-panel.jsx +1 -1
- package/node_modules/@groove-dev/gui/src/components/agents/spawn-wizard.jsx +2 -135
- package/node_modules/@groove-dev/gui/src/components/automations/automation-card.jsx +274 -0
- package/node_modules/@groove-dev/gui/src/components/automations/automation-wizard.jsx +1136 -0
- package/node_modules/@groove-dev/gui/src/components/chat/chat-header.jsx +2 -0
- package/node_modules/@groove-dev/gui/src/components/chat/chat-input.jsx +68 -66
- package/node_modules/@groove-dev/gui/src/components/chat/chat-view.jsx +4 -8
- package/node_modules/@groove-dev/gui/src/components/dashboard/activity-feed.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/dashboard/cache-ring.jsx +5 -5
- package/node_modules/@groove-dev/gui/src/components/dashboard/context-gauges.jsx +6 -8
- package/node_modules/@groove-dev/gui/src/components/dashboard/fleet-panel.jsx +8 -14
- package/node_modules/@groove-dev/gui/src/components/dashboard/intel-panel.jsx +238 -656
- package/node_modules/@groove-dev/gui/src/components/dashboard/kpi-card.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/dashboard/routing-chart.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/dashboard/team-burn-panel.jsx +1 -1
- package/node_modules/@groove-dev/gui/src/components/dashboard/token-chart.jsx +4 -4
- package/node_modules/@groove-dev/gui/src/components/lab/chat-playground.jsx +39 -31
- package/node_modules/@groove-dev/gui/src/components/lab/lab-assistant.jsx +316 -82
- package/node_modules/@groove-dev/gui/src/components/lab/metrics-panel.jsx +187 -32
- package/node_modules/@groove-dev/gui/src/components/lab/parameter-panel.jsx +200 -18
- package/node_modules/@groove-dev/gui/src/components/lab/preset-manager.jsx +17 -14
- package/node_modules/@groove-dev/gui/src/components/lab/runtime-config.jsx +335 -152
- package/node_modules/@groove-dev/gui/src/components/lab/system-prompt-editor.jsx +10 -8
- package/node_modules/@groove-dev/gui/src/components/layout/activity-bar.jsx +2 -4
- package/node_modules/@groove-dev/gui/src/components/layout/terminal-panel.jsx +4 -2
- package/node_modules/@groove-dev/gui/src/components/layout/welcome-splash.jsx +137 -108
- package/node_modules/@groove-dev/gui/src/components/network/network-health.jsx +2 -2
- package/node_modules/@groove-dev/gui/src/components/network/performance-dashboard.jsx +4 -4
- package/node_modules/@groove-dev/gui/src/components/settings/ssh-wizard.jsx +81 -99
- package/node_modules/@groove-dev/gui/src/components/ui/sheet.jsx +5 -2
- package/node_modules/@groove-dev/gui/src/components/ui/slider.jsx +8 -8
- package/node_modules/@groove-dev/gui/src/lib/cron.js +64 -0
- package/node_modules/@groove-dev/gui/src/lib/status.js +25 -24
- package/node_modules/@groove-dev/gui/src/lib/theme-hex.js +1 -0
- package/node_modules/@groove-dev/gui/src/stores/groove.js +51 -3144
- package/node_modules/@groove-dev/gui/src/stores/helpers.js +10 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/agents-slice.js +459 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/automations-slice.js +96 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/chat-slice.js +226 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/editor-slice.js +285 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/marketplace-slice.js +461 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/network-slice.js +361 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/preview-slice.js +109 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/providers-slice.js +897 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/teams-slice.js +413 -0
- package/node_modules/@groove-dev/gui/src/stores/slices/ui-slice.js +98 -0
- package/node_modules/@groove-dev/gui/src/views/agents.jsx +5 -5
- package/node_modules/@groove-dev/gui/src/views/dashboard.jsx +12 -13
- package/node_modules/@groove-dev/gui/src/views/marketplace.jsx +191 -3
- package/node_modules/@groove-dev/gui/src/views/model-lab.jsx +54 -12
- package/node_modules/@groove-dev/gui/src/views/models.jsx +419 -496
- package/node_modules/@groove-dev/gui/src/views/network.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/views/settings.jsx +81 -94
- package/node_modules/@groove-dev/gui/src/views/teams.jsx +40 -483
- package/node_modules/axios/CHANGELOG.md +260 -0
- package/node_modules/axios/README.md +595 -223
- package/node_modules/axios/dist/axios.js +1460 -1090
- package/node_modules/axios/dist/axios.js.map +1 -1
- 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 +1560 -1132
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +1557 -1128
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- 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 +1594 -1057
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +40 -41
- package/node_modules/axios/index.d.ts +151 -227
- package/node_modules/axios/index.js +2 -0
- package/node_modules/axios/lib/adapters/adapters.js +4 -2
- package/node_modules/axios/lib/adapters/fetch.js +147 -16
- package/node_modules/axios/lib/adapters/http.js +306 -58
- package/node_modules/axios/lib/adapters/xhr.js +6 -2
- package/node_modules/axios/lib/core/Axios.js +7 -3
- package/node_modules/axios/lib/core/AxiosError.js +120 -34
- package/node_modules/axios/lib/core/AxiosHeaders.js +27 -25
- package/node_modules/axios/lib/core/buildFullPath.js +1 -1
- package/node_modules/axios/lib/core/dispatchRequest.js +19 -7
- package/node_modules/axios/lib/core/mergeConfig.js +21 -4
- package/node_modules/axios/lib/core/settle.js +7 -11
- package/node_modules/axios/lib/defaults/index.js +14 -9
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
- package/node_modules/axios/lib/helpers/buildURL.js +1 -1
- package/node_modules/axios/lib/helpers/cookies.js +14 -2
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +28 -1
- package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
- package/node_modules/axios/lib/helpers/formDataToStream.js +3 -2
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
- package/node_modules/axios/lib/helpers/resolveConfig.js +54 -18
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +74 -2
- package/node_modules/axios/lib/helpers/toFormData.js +10 -2
- package/node_modules/axios/lib/helpers/validator.js +3 -1
- package/node_modules/axios/lib/utils.js +33 -21
- package/node_modules/axios/package.json +17 -24
- package/node_modules/follow-redirects/README.md +7 -5
- package/node_modules/follow-redirects/index.js +24 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/daemon/package.json +1 -1
- package/packages/daemon/src/api.js +1086 -6532
- package/packages/daemon/src/conversations.js +18 -48
- package/packages/daemon/src/gateways/manager.js +35 -1
- package/packages/daemon/src/index.js +3 -0
- package/packages/daemon/src/journalist.js +23 -13
- package/packages/daemon/src/mlx-server.js +365 -0
- package/packages/daemon/src/model-lab.js +308 -12
- package/packages/daemon/src/pm.js +1 -1
- package/packages/daemon/src/process.js +2 -2
- package/packages/daemon/src/providers/local.js +36 -8
- package/packages/daemon/src/registry.js +21 -5
- package/packages/daemon/src/routes/agents.js +812 -0
- package/packages/daemon/src/routes/coordination.js +318 -0
- package/packages/daemon/src/routes/files.js +751 -0
- package/packages/daemon/src/routes/integrations.js +485 -0
- package/packages/daemon/src/routes/network.js +1784 -0
- package/packages/daemon/src/routes/providers.js +755 -0
- package/packages/daemon/src/routes/schedules.js +110 -0
- package/packages/daemon/src/routes/teams.js +650 -0
- package/packages/daemon/src/scheduler.js +456 -24
- package/packages/daemon/src/teams.js +1 -1
- package/packages/daemon/src/validate.js +38 -1
- package/packages/daemon/templates/mlx-setup.json +12 -0
- package/packages/daemon/templates/tgi-setup.json +1 -1
- package/packages/daemon/templates/vllm-setup.json +1 -1
- package/packages/gui/dist/assets/index-Bxc0gU06.js +1006 -0
- package/packages/gui/dist/assets/index-C0pztKBn.css +1 -0
- package/packages/gui/dist/index.html +2 -2
- package/packages/gui/package.json +1 -1
- package/packages/gui/src/{app.jsx → App.jsx} +0 -2
- package/packages/gui/src/app.css +35 -0
- package/packages/gui/src/components/agents/agent-config.jsx +1 -128
- package/packages/gui/src/components/agents/agent-feed.jsx +210 -112
- package/packages/gui/src/components/agents/agent-node.jsx +8 -13
- package/packages/gui/src/components/agents/agent-panel.jsx +2 -70
- package/packages/gui/src/components/agents/code-review.jsx +159 -122
- package/packages/gui/src/components/agents/diff-viewer.jsx +23 -23
- package/packages/gui/src/components/agents/journalist-panel.jsx +1 -1
- package/packages/gui/src/components/agents/spawn-wizard.jsx +2 -135
- package/packages/gui/src/components/automations/automation-card.jsx +274 -0
- package/packages/gui/src/components/automations/automation-wizard.jsx +1136 -0
- package/packages/gui/src/components/chat/chat-header.jsx +2 -0
- package/packages/gui/src/components/chat/chat-input.jsx +68 -66
- package/packages/gui/src/components/chat/chat-view.jsx +4 -8
- package/packages/gui/src/components/dashboard/activity-feed.jsx +3 -3
- package/packages/gui/src/components/dashboard/cache-ring.jsx +5 -5
- package/packages/gui/src/components/dashboard/context-gauges.jsx +6 -8
- package/packages/gui/src/components/dashboard/fleet-panel.jsx +8 -14
- package/packages/gui/src/components/dashboard/intel-panel.jsx +238 -656
- package/packages/gui/src/components/dashboard/kpi-card.jsx +3 -3
- package/packages/gui/src/components/dashboard/routing-chart.jsx +3 -3
- package/packages/gui/src/components/dashboard/team-burn-panel.jsx +1 -1
- package/packages/gui/src/components/dashboard/token-chart.jsx +4 -4
- package/packages/gui/src/components/lab/chat-playground.jsx +39 -31
- package/packages/gui/src/components/lab/lab-assistant.jsx +316 -82
- package/packages/gui/src/components/lab/metrics-panel.jsx +187 -32
- package/packages/gui/src/components/lab/parameter-panel.jsx +200 -18
- package/packages/gui/src/components/lab/preset-manager.jsx +17 -14
- package/packages/gui/src/components/lab/runtime-config.jsx +335 -152
- package/packages/gui/src/components/lab/system-prompt-editor.jsx +10 -8
- package/packages/gui/src/components/layout/activity-bar.jsx +2 -4
- package/packages/gui/src/components/layout/terminal-panel.jsx +4 -2
- package/packages/gui/src/components/layout/welcome-splash.jsx +137 -108
- package/packages/gui/src/components/network/network-health.jsx +2 -2
- package/packages/gui/src/components/network/performance-dashboard.jsx +4 -4
- package/packages/gui/src/components/settings/ssh-wizard.jsx +81 -99
- package/packages/gui/src/components/ui/sheet.jsx +5 -2
- package/packages/gui/src/components/ui/slider.jsx +8 -8
- package/packages/gui/src/lib/cron.js +64 -0
- package/packages/gui/src/lib/status.js +25 -24
- package/packages/gui/src/lib/theme-hex.js +1 -0
- package/packages/gui/src/stores/groove.js +51 -3144
- package/packages/gui/src/stores/helpers.js +10 -0
- package/packages/gui/src/stores/slices/agents-slice.js +459 -0
- package/packages/gui/src/stores/slices/automations-slice.js +96 -0
- package/packages/gui/src/stores/slices/chat-slice.js +226 -0
- package/packages/gui/src/stores/slices/editor-slice.js +285 -0
- package/packages/gui/src/stores/slices/marketplace-slice.js +461 -0
- package/packages/gui/src/stores/slices/network-slice.js +361 -0
- package/packages/gui/src/stores/slices/preview-slice.js +109 -0
- package/packages/gui/src/stores/slices/providers-slice.js +897 -0
- package/packages/gui/src/stores/slices/teams-slice.js +413 -0
- package/packages/gui/src/stores/slices/ui-slice.js +98 -0
- package/packages/gui/src/views/agents.jsx +5 -5
- package/packages/gui/src/views/dashboard.jsx +12 -13
- package/packages/gui/src/views/marketplace.jsx +191 -3
- package/packages/gui/src/views/model-lab.jsx +54 -12
- package/packages/gui/src/views/models.jsx +419 -496
- package/packages/gui/src/views/network.jsx +3 -3
- package/packages/gui/src/views/settings.jsx +81 -94
- package/packages/gui/src/views/teams.jsx +40 -483
- package/SECURITY_SWEEP.md +0 -228
- package/TRAINING_DATA_v4.md +0 -6
- package/node_modules/@groove-dev/gui/dist/assets/index-CCVvAoQn.css +0 -1
- package/node_modules/@groove-dev/gui/dist/assets/index-DGIv_TRm.js +0 -984
- package/node_modules/@groove-dev/gui/src/components/agents/agent-chat.jsx +0 -379
- package/node_modules/@groove-dev/gui/src/views/preview.jsx +0 -6
- package/node_modules/@groove-dev/gui/src/views/subscription-panel.jsx +0 -327
- package/packages/gui/dist/assets/index-CCVvAoQn.css +0 -1
- package/packages/gui/dist/assets/index-DGIv_TRm.js +0 -984
- package/packages/gui/src/components/agents/agent-chat.jsx +0 -379
- package/packages/gui/src/views/preview.jsx +0 -6
- package/packages/gui/src/views/subscription-panel.jsx +0 -327
- package/test.py +0 -571
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import utils from '../utils.js';
|
|
4
|
+
import AxiosHeaders from './AxiosHeaders.js';
|
|
5
|
+
|
|
6
|
+
const REDACTED = '[REDACTED ****]';
|
|
7
|
+
|
|
8
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
9
|
+
if (utils.hasOwnProp(source, 'toJSON')) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let prototype = Object.getPrototypeOf(source);
|
|
14
|
+
|
|
15
|
+
while (prototype && prototype !== Object.prototype) {
|
|
16
|
+
if (utils.hasOwnProp(prototype, 'toJSON')) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Build a plain-object snapshot of `config` and replace the value of any key
|
|
27
|
+
// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
|
|
28
|
+
// and AxiosHeaders, and short-circuits on circular references.
|
|
29
|
+
function redactConfig(config, redactKeys) {
|
|
30
|
+
const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
|
|
31
|
+
const seen = [];
|
|
32
|
+
|
|
33
|
+
const visit = (source) => {
|
|
34
|
+
if (source === null || typeof source !== 'object') return source;
|
|
35
|
+
if (utils.isBuffer(source)) return source;
|
|
36
|
+
if (seen.indexOf(source) !== -1) return undefined;
|
|
37
|
+
|
|
38
|
+
if (source instanceof AxiosHeaders) {
|
|
39
|
+
source = source.toJSON();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
seen.push(source);
|
|
43
|
+
|
|
44
|
+
let result;
|
|
45
|
+
if (utils.isArray(source)) {
|
|
46
|
+
result = [];
|
|
47
|
+
source.forEach((v, i) => {
|
|
48
|
+
const reducedValue = visit(v);
|
|
49
|
+
if (!utils.isUndefined(reducedValue)) {
|
|
50
|
+
result[i] = reducedValue;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
if (!utils.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
55
|
+
seen.pop();
|
|
56
|
+
return source;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
result = Object.create(null);
|
|
60
|
+
for (const [key, value] of Object.entries(source)) {
|
|
61
|
+
const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
|
|
62
|
+
if (!utils.isUndefined(reducedValue)) {
|
|
63
|
+
result[key] = reducedValue;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
seen.pop();
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return visit(config);
|
|
73
|
+
}
|
|
4
74
|
|
|
5
75
|
class AxiosError extends Error {
|
|
6
76
|
static from(error, code, config, request, response, customProps) {
|
|
@@ -17,42 +87,56 @@ class AxiosError extends Error {
|
|
|
17
87
|
return axiosError;
|
|
18
88
|
}
|
|
19
89
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} message The error message.
|
|
94
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
95
|
+
* @param {Object} [config] The config.
|
|
96
|
+
* @param {Object} [request] The request.
|
|
97
|
+
* @param {Object} [response] The response.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Error} The created error.
|
|
100
|
+
*/
|
|
101
|
+
constructor(message, code, config, request, response) {
|
|
102
|
+
super(message);
|
|
103
|
+
|
|
104
|
+
// Make message enumerable to maintain backward compatibility
|
|
105
|
+
// The native Error constructor sets message as non-enumerable,
|
|
106
|
+
// but axios < v1.13.3 had it as enumerable
|
|
107
|
+
Object.defineProperty(this, 'message', {
|
|
108
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
109
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
110
|
+
__proto__: null,
|
|
111
|
+
value: message,
|
|
112
|
+
enumerable: true,
|
|
113
|
+
writable: true,
|
|
114
|
+
configurable: true,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
this.name = 'AxiosError';
|
|
118
|
+
this.isAxiosError = true;
|
|
119
|
+
code && (this.code = code);
|
|
120
|
+
config && (this.config = config);
|
|
121
|
+
request && (this.request = request);
|
|
122
|
+
if (response) {
|
|
123
|
+
this.response = response;
|
|
124
|
+
this.status = response.status;
|
|
53
125
|
}
|
|
126
|
+
}
|
|
54
127
|
|
|
55
128
|
toJSON() {
|
|
129
|
+
// Opt-in redaction: when the request config carries a `redact` array, the
|
|
130
|
+
// value of any matching key (case-insensitive, at any depth) is replaced
|
|
131
|
+
// with REDACTED in the serialized snapshot. Undefined or empty leaves the
|
|
132
|
+
// existing serialization behavior unchanged.
|
|
133
|
+
const config = this.config;
|
|
134
|
+
const redactKeys = config && utils.hasOwnProp(config, 'redact') ? config.redact : undefined;
|
|
135
|
+
const serializedConfig =
|
|
136
|
+
utils.isArray(redactKeys) && redactKeys.length > 0
|
|
137
|
+
? redactConfig(config, redactKeys)
|
|
138
|
+
: utils.toJSONObject(config);
|
|
139
|
+
|
|
56
140
|
return {
|
|
57
141
|
// Standard
|
|
58
142
|
message: this.message,
|
|
@@ -66,7 +150,7 @@ class AxiosError extends Error {
|
|
|
66
150
|
columnNumber: this.columnNumber,
|
|
67
151
|
stack: this.stack,
|
|
68
152
|
// Axios
|
|
69
|
-
config:
|
|
153
|
+
config: serializedConfig,
|
|
70
154
|
code: this.code,
|
|
71
155
|
status: this.status,
|
|
72
156
|
};
|
|
@@ -78,6 +162,7 @@ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
|
78
162
|
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
79
163
|
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
80
164
|
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
165
|
+
AxiosError.ECONNREFUSED = 'ECONNREFUSED';
|
|
81
166
|
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
82
167
|
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
83
168
|
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
@@ -86,5 +171,6 @@ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
|
86
171
|
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
87
172
|
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
88
173
|
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
174
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
89
175
|
|
|
90
176
|
export default AxiosError;
|
|
@@ -5,41 +5,41 @@ import parseHeaders from '../helpers/parseHeaders.js';
|
|
|
5
5
|
|
|
6
6
|
const $internals = Symbol('internals');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
9
9
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (utils.isArray(value)) {
|
|
16
|
-
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
10
|
+
function trimSPorHTAB(str) {
|
|
11
|
+
let start = 0;
|
|
12
|
+
let end = str.length;
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}
|
|
14
|
+
while (start < end) {
|
|
15
|
+
const code = str.charCodeAt(start);
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
17
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
start += 1;
|
|
22
|
+
}
|
|
31
23
|
|
|
32
|
-
while (end >
|
|
33
|
-
const
|
|
24
|
+
while (end > start) {
|
|
25
|
+
const code = str.charCodeAt(end - 1);
|
|
34
26
|
|
|
35
|
-
if (
|
|
27
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
36
28
|
break;
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
end -= 1;
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
return end === str.length ? str : str.slice(
|
|
34
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function normalizeHeader(header) {
|
|
38
|
+
return header && String(header).trim().toLowerCase();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function sanitizeHeaderValue(str) {
|
|
42
|
+
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function normalizeValue(value) {
|
|
@@ -47,7 +47,7 @@ function normalizeValue(value) {
|
|
|
47
47
|
return value;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
return utils.isArray(value) ? value.map(normalizeValue) :
|
|
50
|
+
return utils.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function parseTokens(str) {
|
|
@@ -98,6 +98,9 @@ function buildAccessors(obj, header) {
|
|
|
98
98
|
|
|
99
99
|
['get', 'set', 'has'].forEach((methodName) => {
|
|
100
100
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
101
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
102
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
103
|
+
__proto__: null,
|
|
101
104
|
value: function (arg1, arg2, arg3) {
|
|
102
105
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
103
106
|
},
|
|
@@ -129,7 +132,6 @@ class AxiosHeaders {
|
|
|
129
132
|
_rewrite === true ||
|
|
130
133
|
(_rewrite === undefined && self[key] !== false)
|
|
131
134
|
) {
|
|
132
|
-
assertValidHeaderValue(_value, _header);
|
|
133
135
|
self[key || _header] = normalizeValue(_value);
|
|
134
136
|
}
|
|
135
137
|
}
|
|
@@ -15,7 +15,7 @@ import combineURLs from '../helpers/combineURLs.js';
|
|
|
15
15
|
*/
|
|
16
16
|
export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
17
17
|
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
18
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls
|
|
18
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
19
19
|
return combineURLs(baseURL, requestedURL);
|
|
20
20
|
}
|
|
21
21
|
return requestedURL;
|
|
@@ -49,8 +49,15 @@ export default function dispatchRequest(config) {
|
|
|
49
49
|
function onAdapterResolution(response) {
|
|
50
50
|
throwIfCancellationRequested(config);
|
|
51
51
|
|
|
52
|
-
//
|
|
53
|
-
|
|
52
|
+
// Expose the current response on config so that transformResponse can
|
|
53
|
+
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
54
|
+
// We clean it up afterwards to avoid polluting the config object.
|
|
55
|
+
config.response = response;
|
|
56
|
+
try {
|
|
57
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
58
|
+
} finally {
|
|
59
|
+
delete config.response;
|
|
60
|
+
}
|
|
54
61
|
|
|
55
62
|
response.headers = AxiosHeaders.from(response.headers);
|
|
56
63
|
|
|
@@ -62,11 +69,16 @@ export default function dispatchRequest(config) {
|
|
|
62
69
|
|
|
63
70
|
// Transform response data
|
|
64
71
|
if (reason && reason.response) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
config.response = reason.response;
|
|
73
|
+
try {
|
|
74
|
+
reason.response.data = transformData.call(
|
|
75
|
+
config,
|
|
76
|
+
config.transformResponse,
|
|
77
|
+
reason.response
|
|
78
|
+
);
|
|
79
|
+
} finally {
|
|
80
|
+
delete config.response;
|
|
81
|
+
}
|
|
70
82
|
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
71
83
|
}
|
|
72
84
|
}
|
|
@@ -17,7 +17,21 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing }
|
|
|
17
17
|
export default function mergeConfig(config1, config2) {
|
|
18
18
|
// eslint-disable-next-line no-param-reassign
|
|
19
19
|
config2 = config2 || {};
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
22
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
23
|
+
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
24
|
+
// ergonomics for user code that relies on it.
|
|
25
|
+
const config = Object.create(null);
|
|
26
|
+
Object.defineProperty(config, 'hasOwnProperty', {
|
|
27
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
28
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
29
|
+
__proto__: null,
|
|
30
|
+
value: Object.prototype.hasOwnProperty,
|
|
31
|
+
enumerable: false,
|
|
32
|
+
writable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
});
|
|
21
35
|
|
|
22
36
|
function getMergedValue(target, source, prop, caseless) {
|
|
23
37
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
@@ -56,9 +70,9 @@ export default function mergeConfig(config1, config2) {
|
|
|
56
70
|
|
|
57
71
|
// eslint-disable-next-line consistent-return
|
|
58
72
|
function mergeDirectKeys(a, b, prop) {
|
|
59
|
-
if (prop
|
|
73
|
+
if (utils.hasOwnProp(config2, prop)) {
|
|
60
74
|
return getMergedValue(a, b);
|
|
61
|
-
} else if (prop
|
|
75
|
+
} else if (utils.hasOwnProp(config1, prop)) {
|
|
62
76
|
return getMergedValue(undefined, a);
|
|
63
77
|
}
|
|
64
78
|
}
|
|
@@ -90,6 +104,7 @@ export default function mergeConfig(config1, config2) {
|
|
|
90
104
|
httpsAgent: defaultToConfig2,
|
|
91
105
|
cancelToken: defaultToConfig2,
|
|
92
106
|
socketPath: defaultToConfig2,
|
|
107
|
+
allowedSocketPaths: defaultToConfig2,
|
|
93
108
|
responseEncoding: defaultToConfig2,
|
|
94
109
|
validateStatus: mergeDirectKeys,
|
|
95
110
|
headers: (a, b, prop) =>
|
|
@@ -99,7 +114,9 @@ export default function mergeConfig(config1, config2) {
|
|
|
99
114
|
utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
100
115
|
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
101
116
|
const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
102
|
-
const
|
|
117
|
+
const a = utils.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
118
|
+
const b = utils.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
119
|
+
const configValue = merge(a, b, prop);
|
|
103
120
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
104
121
|
});
|
|
105
122
|
|
|
@@ -16,16 +16,12 @@ export default function settle(resolve, reject, response) {
|
|
|
16
16
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
17
17
|
resolve(response);
|
|
18
18
|
} else {
|
|
19
|
-
reject(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
response.request,
|
|
27
|
-
response
|
|
28
|
-
)
|
|
29
|
-
);
|
|
19
|
+
reject(new AxiosError(
|
|
20
|
+
'Request failed with status code ' + response.status,
|
|
21
|
+
response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
|
|
22
|
+
response.config,
|
|
23
|
+
response.request,
|
|
24
|
+
response
|
|
25
|
+
));
|
|
30
26
|
}
|
|
31
27
|
}
|
|
@@ -8,6 +8,8 @@ import toURLEncodedForm from '../helpers/toURLEncodedForm.js';
|
|
|
8
8
|
import platform from '../platform/index.js';
|
|
9
9
|
import formDataToJSON from '../helpers/formDataToJSON.js';
|
|
10
10
|
|
|
11
|
+
const own = (obj, key) => (obj != null && utils.hasOwnProp(obj, key) ? obj[key] : undefined);
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
13
15
|
* of the input
|
|
@@ -75,20 +77,22 @@ const defaults = {
|
|
|
75
77
|
let isFileList;
|
|
76
78
|
|
|
77
79
|
if (isObjectPayload) {
|
|
80
|
+
const formSerializer = own(this, 'formSerializer');
|
|
78
81
|
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
79
|
-
return toURLEncodedForm(data,
|
|
82
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
if (
|
|
83
86
|
(isFileList = utils.isFileList(data)) ||
|
|
84
87
|
contentType.indexOf('multipart/form-data') > -1
|
|
85
88
|
) {
|
|
86
|
-
const
|
|
89
|
+
const env = own(this, 'env');
|
|
90
|
+
const _FormData = env && env.FormData;
|
|
87
91
|
|
|
88
92
|
return toFormData(
|
|
89
93
|
isFileList ? { 'files[]': data } : data,
|
|
90
94
|
_FormData && new _FormData(),
|
|
91
|
-
|
|
95
|
+
formSerializer
|
|
92
96
|
);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
@@ -104,9 +108,10 @@ const defaults = {
|
|
|
104
108
|
|
|
105
109
|
transformResponse: [
|
|
106
110
|
function transformResponse(data) {
|
|
107
|
-
const transitional = this
|
|
111
|
+
const transitional = own(this, 'transitional') || defaults.transitional;
|
|
108
112
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
109
|
-
const
|
|
113
|
+
const responseType = own(this, 'responseType');
|
|
114
|
+
const JSONRequested = responseType === 'json';
|
|
110
115
|
|
|
111
116
|
if (utils.isResponse(data) || utils.isReadableStream(data)) {
|
|
112
117
|
return data;
|
|
@@ -115,17 +120,17 @@ const defaults = {
|
|
|
115
120
|
if (
|
|
116
121
|
data &&
|
|
117
122
|
utils.isString(data) &&
|
|
118
|
-
((forcedJSONParsing && !
|
|
123
|
+
((forcedJSONParsing && !responseType) || JSONRequested)
|
|
119
124
|
) {
|
|
120
125
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
121
126
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
122
127
|
|
|
123
128
|
try {
|
|
124
|
-
return JSON.parse(data, this
|
|
129
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
125
130
|
} catch (e) {
|
|
126
131
|
if (strictJSONParsing) {
|
|
127
132
|
if (e.name === 'SyntaxError') {
|
|
128
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this
|
|
133
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
129
134
|
}
|
|
130
135
|
throw e;
|
|
131
136
|
}
|
|
@@ -165,7 +170,7 @@ const defaults = {
|
|
|
165
170
|
},
|
|
166
171
|
};
|
|
167
172
|
|
|
168
|
-
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
173
|
+
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
|
|
169
174
|
defaults.headers[method] = {};
|
|
170
175
|
});
|
|
171
176
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.16.0";
|
|
@@ -18,9 +18,8 @@ function encode(str) {
|
|
|
18
18
|
')': '%29',
|
|
19
19
|
'~': '%7E',
|
|
20
20
|
'%20': '+',
|
|
21
|
-
'%00': '\x00',
|
|
22
21
|
};
|
|
23
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20
|
|
22
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
24
23
|
return charMap[match];
|
|
25
24
|
});
|
|
26
25
|
}
|
|
@@ -11,7 +11,7 @@ import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';
|
|
|
11
11
|
*
|
|
12
12
|
* @returns {string} The encoded value.
|
|
13
13
|
*/
|
|
14
|
-
function encode(val) {
|
|
14
|
+
export function encode(val) {
|
|
15
15
|
return encodeURIComponent(val)
|
|
16
16
|
.replace(/%3A/gi, ':')
|
|
17
17
|
.replace(/%24/g, '$')
|
|
@@ -30,8 +30,20 @@ export default platform.hasStandardBrowserEnv
|
|
|
30
30
|
|
|
31
31
|
read(name) {
|
|
32
32
|
if (typeof document === 'undefined') return null;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
34
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
35
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
36
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
37
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
38
|
+
const cookies = document.cookie.split(';');
|
|
39
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
40
|
+
const cookie = cookies[i].replace(/^\s+/, '');
|
|
41
|
+
const eq = cookie.indexOf('=');
|
|
42
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
43
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
35
47
|
},
|
|
36
48
|
|
|
37
49
|
remove(name) {
|
|
@@ -69,5 +69,32 @@ export default function estimateDataURLDecodedBytes(url) {
|
|
|
69
69
|
return bytes > 0 ? bytes : 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
73
|
+
return Buffer.byteLength(body, 'utf8');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
77
|
+
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
78
|
+
// Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
|
|
79
|
+
// but 3 UTF-8 bytes).
|
|
80
|
+
let bytes = 0;
|
|
81
|
+
for (let i = 0, len = body.length; i < len; i++) {
|
|
82
|
+
const c = body.charCodeAt(i);
|
|
83
|
+
if (c < 0x80) {
|
|
84
|
+
bytes += 1;
|
|
85
|
+
} else if (c < 0x800) {
|
|
86
|
+
bytes += 2;
|
|
87
|
+
} else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
|
|
88
|
+
const next = body.charCodeAt(i + 1);
|
|
89
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
90
|
+
bytes += 4;
|
|
91
|
+
i++;
|
|
92
|
+
} else {
|
|
93
|
+
bytes += 3;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
bytes += 3;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return bytes;
|
|
73
100
|
}
|
|
@@ -58,7 +58,9 @@ function formDataToJSON(formData) {
|
|
|
58
58
|
|
|
59
59
|
if (isLast) {
|
|
60
60
|
if (utils.hasOwnProp(target, name)) {
|
|
61
|
-
target[name] =
|
|
61
|
+
target[name] = utils.isArray(target[name])
|
|
62
|
+
? target[name].concat(value)
|
|
63
|
+
: [target[name], value];
|
|
62
64
|
} else {
|
|
63
65
|
target[name] = value;
|
|
64
66
|
}
|
|
@@ -24,7 +24,8 @@ class FormDataPart {
|
|
|
24
24
|
if (isStringValue) {
|
|
25
25
|
value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
|
|
26
26
|
} else {
|
|
27
|
-
|
|
27
|
+
const safeType = String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
|
|
28
|
+
headers += `Content-Type: ${safeType}${CRLF}`;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
this.headers = textEncoder.encode(headers + CRLF);
|
|
@@ -76,7 +77,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
if (boundary.length < 1 || boundary.length > 70) {
|
|
79
|
-
throw Error('boundary must be
|
|
80
|
+
throw Error('boundary must be 1-70 characters long');
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
@@ -7,13 +7,13 @@ export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
7
7
|
const _speedometer = speedometer(50, 250);
|
|
8
8
|
|
|
9
9
|
return throttle((e) => {
|
|
10
|
-
const
|
|
10
|
+
const rawLoaded = e.loaded;
|
|
11
11
|
const total = e.lengthComputable ? e.total : undefined;
|
|
12
|
-
const
|
|
12
|
+
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
13
|
+
const progressBytes = Math.max(0, loaded - bytesNotified);
|
|
13
14
|
const rate = _speedometer(progressBytes);
|
|
14
|
-
const inRange = loaded <= total;
|
|
15
15
|
|
|
16
|
-
bytesNotified = loaded;
|
|
16
|
+
bytesNotified = Math.max(bytesNotified, loaded);
|
|
17
17
|
|
|
18
18
|
const data = {
|
|
19
19
|
loaded,
|
|
@@ -21,7 +21,7 @@ export const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
21
21
|
progress: total ? loaded / total : undefined,
|
|
22
22
|
bytes: progressBytes,
|
|
23
23
|
rate: rate ? rate : undefined,
|
|
24
|
-
estimated: rate && total
|
|
24
|
+
estimated: rate && total ? (total - loaded) / rate : undefined,
|
|
25
25
|
event: e,
|
|
26
26
|
lengthComputable: total != null,
|
|
27
27
|
[isDownloadStream ? 'download' : 'upload']: true,
|