@quantiya/codevibe-claude-plugin 1.0.37 → 1.0.39
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-plugin/plugin.json +1 -1
- package/bin/codevibe-claude +17 -3
- package/dist/server.js +8 -7
- package/hooks/stop.sh +30 -10
- package/node_modules/@quantiya/codevibe-core/dist/appsync/appsync-client.d.ts +1 -139
- package/node_modules/@quantiya/codevibe-core/dist/appsync/queries.d.ts +0 -5
- package/node_modules/@quantiya/codevibe-core/dist/auth/auth-telemetry.d.ts +64 -29
- package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +0 -4
- package/node_modules/@quantiya/codevibe-core/dist/index.js +33 -194
- package/node_modules/@quantiya/codevibe-core/dist/keychain/keychain-manager.d.ts +16 -2
- package/node_modules/@quantiya/codevibe-core/dist/session/session-rekey.d.ts +40 -0
- package/node_modules/@quantiya/codevibe-core/dist/session/session-resume.d.ts +1 -0
- package/node_modules/@quantiya/codevibe-core/dist/types/index.d.ts +0 -2
- package/node_modules/@quantiya/codevibe-core/dist/types/session.d.ts +0 -16
- package/node_modules/@quantiya/codevibe-core/package.json +1 -1
- package/node_modules/body-parser/README.md +18 -18
- package/node_modules/body-parser/index.js +6 -15
- package/node_modules/body-parser/lib/read.js +17 -20
- package/node_modules/body-parser/lib/types/json.js +8 -16
- package/node_modules/body-parser/lib/types/raw.js +3 -4
- package/node_modules/body-parser/lib/types/text.js +3 -4
- package/node_modules/body-parser/lib/types/urlencoded.js +8 -8
- package/node_modules/body-parser/lib/utils.js +11 -9
- package/node_modules/body-parser/package.json +2 -2
- package/node_modules/content-disposition/README.md +7 -8
- package/node_modules/content-disposition/index.js +118 -40
- package/node_modules/content-disposition/package.json +8 -11
- package/node_modules/express/Readme.md +39 -29
- package/node_modules/express/lib/application.js +1 -1
- package/node_modules/express/lib/request.js +5 -6
- package/node_modules/express/lib/response.js +14 -0
- package/node_modules/express/lib/utils.js +3 -1
- package/node_modules/express/package.json +6 -5
- package/node_modules/finalhandler/HISTORY.md +6 -0
- package/node_modules/finalhandler/README.md +26 -23
- package/node_modules/finalhandler/package.json +13 -9
- package/node_modules/graphql/execution/execute.d.ts +14 -1
- package/node_modules/graphql/execution/execute.js +63 -13
- package/node_modules/graphql/execution/execute.mjs +63 -13
- package/node_modules/graphql/execution/subscribe.js +1 -0
- package/node_modules/graphql/execution/subscribe.mjs +2 -0
- package/node_modules/graphql/execution/values.js +4 -4
- package/node_modules/graphql/execution/values.mjs +4 -4
- package/node_modules/graphql/index.d.ts +1 -0
- package/node_modules/graphql/language/ast.d.ts +10 -1
- package/node_modules/graphql/language/ast.js +8 -1
- package/node_modules/graphql/language/ast.mjs +8 -1
- package/node_modules/graphql/language/directiveLocation.d.ts +1 -0
- package/node_modules/graphql/language/directiveLocation.js +1 -0
- package/node_modules/graphql/language/directiveLocation.mjs +1 -0
- package/node_modules/graphql/language/index.d.ts +1 -0
- package/node_modules/graphql/language/kinds.d.ts +1 -0
- package/node_modules/graphql/language/kinds.js +1 -0
- package/node_modules/graphql/language/kinds.mjs +1 -0
- package/node_modules/graphql/language/parser.d.ts +14 -0
- package/node_modules/graphql/language/parser.js +33 -0
- package/node_modules/graphql/language/parser.mjs +33 -0
- package/node_modules/graphql/language/predicates.js +3 -1
- package/node_modules/graphql/language/predicates.mjs +5 -1
- package/node_modules/graphql/language/printer.js +13 -1
- package/node_modules/graphql/language/printer.mjs +13 -1
- package/node_modules/graphql/package.json +1 -1
- package/node_modules/graphql/type/directives.d.ts +9 -1
- package/node_modules/graphql/type/directives.js +10 -1
- package/node_modules/graphql/type/directives.mjs +10 -1
- package/node_modules/graphql/type/introspection.js +24 -1
- package/node_modules/graphql/type/introspection.mjs +24 -1
- package/node_modules/graphql/utilities/buildASTSchema.js +4 -0
- package/node_modules/graphql/utilities/buildASTSchema.mjs +4 -0
- package/node_modules/graphql/utilities/buildClientSchema.js +1 -0
- package/node_modules/graphql/utilities/buildClientSchema.mjs +1 -0
- package/node_modules/graphql/utilities/coerceInputValue.js +2 -2
- package/node_modules/graphql/utilities/coerceInputValue.mjs +2 -2
- package/node_modules/graphql/utilities/extendSchema.js +58 -3
- package/node_modules/graphql/utilities/extendSchema.mjs +58 -3
- package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +16 -0
- package/node_modules/graphql/utilities/getIntrospectionQuery.js +31 -38
- package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +31 -38
- package/node_modules/graphql/utilities/introspectionFromSchema.js +1 -0
- package/node_modules/graphql/utilities/introspectionFromSchema.mjs +1 -0
- package/node_modules/graphql/utilities/printSchema.js +1 -0
- package/node_modules/graphql/utilities/printSchema.mjs +1 -0
- package/node_modules/graphql/utilities/valueFromAST.js +12 -2
- package/node_modules/graphql/utilities/valueFromAST.mjs +12 -2
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +4 -0
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +4 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +12 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +12 -0
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +5 -11
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -11
- package/node_modules/graphql/validation/validate.js +12 -0
- package/node_modules/graphql/validation/validate.mjs +13 -2
- package/node_modules/graphql/version.js +2 -2
- package/node_modules/graphql/version.mjs +2 -2
- package/node_modules/hasown/CHANGELOG.md +11 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +1 -0
- package/node_modules/hasown/package.json +14 -14
- package/node_modules/iconv-lite/lib/index.d.ts +114 -26
- package/node_modules/iconv-lite/lib/index.js +39 -40
- package/node_modules/iconv-lite/package.json +13 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +423 -0
- package/node_modules/node-abi/abi_registry.json +10 -3
- package/node_modules/{semver → node-abi/node_modules/semver}/README.md +19 -4
- package/node_modules/{semver → node-abi/node_modules/semver}/bin/semver.js +14 -10
- package/node_modules/node-abi/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/index.js +2 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/internal/re.js +1 -1
- package/node_modules/{semver → node-abi/node_modules/semver}/package.json +3 -3
- package/node_modules/{semver → node-abi/node_modules/semver}/range.bnf +5 -4
- package/node_modules/node-abi/package.json +1 -1
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.d.ts +3 -0
- package/node_modules/path-to-regexp/dist/index.js +215 -193
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/.editorconfig +1 -1
- package/node_modules/qs/.github/SECURITY.md +11 -0
- package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/node_modules/qs/CHANGELOG.md +190 -0
- package/node_modules/qs/README.md +29 -4
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +56 -0
- package/node_modules/qs/lib/parse.js +94 -49
- package/node_modules/qs/lib/utils.js +85 -11
- package/node_modules/qs/package.json +10 -9
- package/node_modules/qs/test/parse.js +391 -13
- package/node_modules/qs/test/stringify.js +16 -3
- package/node_modules/qs/test/utils.js +173 -3
- package/node_modules/send/package.json +11 -8
- package/node_modules/serve-static/README.md +23 -23
- package/node_modules/serve-static/package.json +6 -3
- 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/uuid/dist/v35.js +3 -0
- package/node_modules/uuid/dist/v6.js +3 -0
- package/node_modules/uuid/dist-node/v35.js +3 -0
- package/node_modules/uuid/dist-node/v6.js +3 -0
- package/node_modules/uuid/package.json +1 -1
- package/node_modules/ws/index.js +15 -6
- package/node_modules/ws/lib/constants.js +1 -0
- package/node_modules/ws/lib/permessage-deflate.js +6 -6
- package/node_modules/ws/lib/websocket-server.js +10 -6
- package/node_modules/ws/lib/websocket.js +19 -14
- package/node_modules/ws/package.json +4 -3
- package/node_modules/ws/wrapper.mjs +14 -1
- package/package.json +2 -2
- package/node_modules/@quantiya/codevibe-core/dist/appsync/__tests__/appsync-client.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/audit-keys/__tests__/audit-keys-parity.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/audit-keys/index.d.ts +0 -41
- package/node_modules/@quantiya/codevibe-core/dist/auth/__tests__/auth-telemetry.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-bootstrap.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-failure-recourse.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-save.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-seat-picker.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-telemetry.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-test-agents.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-types.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-wizard.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/v1-options.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/detect-agents.d.ts +0 -56
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/index.d.ts +0 -3
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/orchestration-cli.d.ts +0 -12
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-bootstrap.d.ts +0 -146
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-failure-recourse.d.ts +0 -23
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-save.d.ts +0 -47
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-seat-picker.d.ts +0 -72
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-telemetry.d.ts +0 -54
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-test-agents.d.ts +0 -108
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-types.d.ts +0 -140
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-wizard.d.ts +0 -57
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/v1-options.d.ts +0 -108
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/integration.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/mocks.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/output-parser.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/registry.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/subprocess.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/index.d.ts +0 -15
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/mocks.d.ts +0 -80
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/output-parser.d.ts +0 -95
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/provider.d.ts +0 -153
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/claude-live-smoke.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/claude.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/codex-live-smoke.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/codex.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/gemini-live-smoke.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/gemini.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/claude.d.ts +0 -59
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/codex.d.ts +0 -67
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/common.d.ts +0 -25
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/gemini.d.ts +0 -108
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/registry.d.ts +0 -87
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/subprocess.d.ts +0 -117
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/types.d.ts +0 -101
- package/node_modules/@quantiya/codevibe-core/dist/types/orchestration.d.ts +0 -57
- package/node_modules/@quantiya/codevibe-core/dist/types/reviewer.d.ts +0 -67
- package/node_modules/content-disposition/HISTORY.md +0 -72
- package/node_modules/express/History.md +0 -3858
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/iconv-lite/Changelog.md +0 -236
- package/node_modules/qs/.eslintrc +0 -39
- package/node_modules/send/HISTORY.md +0 -580
- package/node_modules/serve-static/HISTORY.md +0 -516
- /package/node_modules/{semver → node-abi/node_modules/semver}/LICENSE +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/comparator.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/index.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/range.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/semver.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/clean.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/cmp.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/coerce.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-build.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-loose.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/diff.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/eq.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gt.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gte.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/inc.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lt.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lte.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/major.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/minor.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/neq.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/parse.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/patch.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/prerelease.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rcompare.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rsort.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/satisfies.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/sort.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/valid.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/constants.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/debug.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/identifiers.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/lrucache.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/parse-options.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/preload.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/gtr.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/intersects.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/ltr.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/max-satisfying.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-satisfying.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-version.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/outside.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/simplify.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/subset.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/to-comparators.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/valid.js +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/index.js +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/license +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/package.json +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/readme.md +0 -0
|
@@ -91,14 +91,28 @@ export declare class KeychainManager {
|
|
|
91
91
|
*/
|
|
92
92
|
getSessionKey(sessionId: string, encryptedKeys?: EncryptedSessionKey[]): Promise<string | null>;
|
|
93
93
|
/**
|
|
94
|
-
* Generate and encrypt a new session key for all devices
|
|
94
|
+
* Generate and encrypt a new session key for all devices.
|
|
95
|
+
*
|
|
96
|
+
* Per-device try/catch (task #331 Bug B): one bad publicKey (corrupted
|
|
97
|
+
* base64, wrong curve, ECDH derive failure) does NOT abort the whole
|
|
98
|
+
* call — that device is skipped and reported in `skippedDeviceIds`. The
|
|
99
|
+
* caller decides what to do (telemetry, partial-success UX). Throw only
|
|
100
|
+
* if NO device succeeded, preserving the existing "no encryption"
|
|
101
|
+
* fallback at `prepareSessionEncryption`.
|
|
102
|
+
*
|
|
103
|
+
* Optional `onDeviceSkipped` callback fires per-skip for telemetry —
|
|
104
|
+
* intentionally a callback rather than a direct beacon import so this
|
|
105
|
+
* module stays free of analytics dependencies.
|
|
95
106
|
*/
|
|
96
107
|
createSessionKey(devicePublicKeys: Array<{
|
|
97
108
|
deviceId: string;
|
|
98
109
|
publicKey: string;
|
|
99
|
-
}
|
|
110
|
+
}>, options?: {
|
|
111
|
+
onDeviceSkipped?: (totalSkippedSoFar: number) => void;
|
|
112
|
+
}): {
|
|
100
113
|
sessionKey: string;
|
|
101
114
|
encryptedKeys: EncryptedSessionKey[];
|
|
115
|
+
skippedDeviceIds: string[];
|
|
102
116
|
};
|
|
103
117
|
/**
|
|
104
118
|
* Cache a session key
|
|
@@ -36,3 +36,43 @@ export interface RekeyOptions {
|
|
|
36
36
|
* @returns The number of new grants that succeeded.
|
|
37
37
|
*/
|
|
38
38
|
export declare function rekeySessionForNewDevices(sessionId: string, sessionKey: string, appSyncClient: AppSyncClient, options?: RekeyOptions): Promise<number>;
|
|
39
|
+
/**
|
|
40
|
+
* Options for {@link awaitOwnSessionKeyGrant}.
|
|
41
|
+
*/
|
|
42
|
+
export interface AwaitOwnGrantOptions {
|
|
43
|
+
/** Poll interval in ms. Default 5000. */
|
|
44
|
+
pollIntervalMs?: number;
|
|
45
|
+
/** Max poll attempts. Default 6 (30s total at 5s intervals). */
|
|
46
|
+
maxAttempts?: number;
|
|
47
|
+
/** Authenticated AppSyncClient. */
|
|
48
|
+
appSyncClient: AppSyncClient;
|
|
49
|
+
/** Fired on successful decrypt. Telemetry-only — never thrown. */
|
|
50
|
+
onSuccess?: (attemptCount: number) => void;
|
|
51
|
+
/** Fired after maxAttempts exhausted. Telemetry-only — never thrown. */
|
|
52
|
+
onTimeout?: (attemptCount: number) => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Wait for this device's deviceId to appear in `session.encryptedKeys`.
|
|
56
|
+
*
|
|
57
|
+
* Triggered when {@link keychainManager.getSessionKey} returned null on
|
|
58
|
+
* resume AND at least one other device IS in encryptedKeys (so some other
|
|
59
|
+
* device can mint a grant for us via grantSessionKey). Caller must have
|
|
60
|
+
* already invoked {@link registerDeviceEncryptionKey} BEFORE this helper —
|
|
61
|
+
* that's what causes mobile's DeviceKeyWatcher subscription to fire and
|
|
62
|
+
* grant the session key to our (possibly rotated) pubKey.
|
|
63
|
+
*
|
|
64
|
+
* This helper deliberately bypasses {@link keychainManager.getSessionKey}
|
|
65
|
+
* (which has a cache short-circuit) and instead:
|
|
66
|
+
* 1. Calls {@link AppSyncClient.getSession} each poll for fresh
|
|
67
|
+
* `encryptedKeys`.
|
|
68
|
+
* 2. Looks for our `deviceId` in the fresh list.
|
|
69
|
+
* 3. If found, calls {@link cryptoService.decryptSessionKey} directly.
|
|
70
|
+
* 4. On success, populates the keychain cache (so subsequent
|
|
71
|
+
* `getSessionKey` calls hit the cache). The cache is NEVER populated
|
|
72
|
+
* on failure — there's no null sentinel.
|
|
73
|
+
*
|
|
74
|
+
* Returns the decrypted session key on success, or `null` after timeout.
|
|
75
|
+
* Errors are swallowed inside the loop (best-effort polling); telemetry
|
|
76
|
+
* surfaces success vs timeout via the optional callbacks.
|
|
77
|
+
*/
|
|
78
|
+
export declare function awaitOwnSessionKeyGrant(sessionId: string, options: AwaitOwnGrantOptions): Promise<string | null>;
|
|
@@ -36,6 +36,7 @@ export interface ResumeOrCreateSessionResult {
|
|
|
36
36
|
export declare function prepareSessionEncryption(sessionId: string, appSyncClient: AppSyncClient, logger: Logger): Promise<{
|
|
37
37
|
sessionKey: string;
|
|
38
38
|
encryptedKeys: EncryptedSessionKey[];
|
|
39
|
+
skippedDeviceIds: string[];
|
|
39
40
|
} | null>;
|
|
40
41
|
/**
|
|
41
42
|
* Resume an existing session or create a new one.
|
|
@@ -32,12 +32,6 @@ export interface Session {
|
|
|
32
32
|
creatorDeviceId?: string;
|
|
33
33
|
encryptionVersion?: number;
|
|
34
34
|
lastHeartbeatAt?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Quorum 2.0 opt-in flag (2f.0.a.3). True routes the session to the
|
|
37
|
-
* 2.0 orchestration flow once 2f.3 Lambda is live; null/false keeps
|
|
38
|
-
* the 1.0 companion flow.
|
|
39
|
-
*/
|
|
40
|
-
orchestrationEnabled?: boolean | null;
|
|
41
35
|
}
|
|
42
36
|
/**
|
|
43
37
|
* GraphQL input for creating sessions
|
|
@@ -53,11 +47,6 @@ export interface CreateSessionInput {
|
|
|
53
47
|
creatorDeviceId?: string;
|
|
54
48
|
isEncrypted?: boolean;
|
|
55
49
|
encryptionVersion?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Quorum 2.0 (2f.0.a.3). Null/absent = server reads
|
|
58
|
-
* User.orchestrationEnabledDefault (option 6a auto-populate).
|
|
59
|
-
*/
|
|
60
|
-
orchestrationEnabled?: boolean;
|
|
61
50
|
}
|
|
62
51
|
/**
|
|
63
52
|
* GraphQL input for updating sessions
|
|
@@ -67,9 +56,4 @@ export interface UpdateSessionInput {
|
|
|
67
56
|
status?: SessionStatus;
|
|
68
57
|
metadata?: Record<string, any>;
|
|
69
58
|
lastHeartbeatAt?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Quorum 2.0 (2f.0.a.3). Per-session override for the orchestration
|
|
72
|
-
* opt-in. Plugin CLI --orchestration/--no-orchestration sets this.
|
|
73
|
-
*/
|
|
74
|
-
orchestrationEnabled?: boolean;
|
|
75
59
|
}
|
|
@@ -17,18 +17,18 @@ before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
|
|
17
17
|
ways, for example the `foo` property may not be there or may not be a string,
|
|
18
18
|
and `toString` may not be a function and instead a string or other user input.
|
|
19
19
|
|
|
20
|
-
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/
|
|
20
|
+
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/learn/http/anatomy-of-an-http-transaction).
|
|
21
21
|
|
|
22
22
|
_This does not handle multipart bodies_, due to their complex and typically
|
|
23
23
|
large nature. For multipart bodies, you may be interested in the following
|
|
24
24
|
modules:
|
|
25
25
|
|
|
26
|
-
* [busboy](https://www.npmjs.
|
|
27
|
-
[connect-busboy](https://www.npmjs.
|
|
28
|
-
* [multiparty](https://www.npmjs.
|
|
29
|
-
[connect-multiparty](https://www.npmjs.
|
|
30
|
-
* [formidable](https://www.npmjs.
|
|
31
|
-
* [multer](https://www.npmjs.
|
|
26
|
+
* [busboy](https://www.npmjs.com/package/busboy#readme) and
|
|
27
|
+
[connect-busboy](https://www.npmjs.com/package/connect-busboy#readme)
|
|
28
|
+
* [multiparty](https://www.npmjs.com/package/multiparty#readme) and
|
|
29
|
+
[connect-multiparty](https://www.npmjs.com/package/connect-multiparty#readme)
|
|
30
|
+
* [formidable](https://www.npmjs.com/package/formidable#readme)
|
|
31
|
+
* [multer](https://www.npmjs.com/package/multer#readme)
|
|
32
32
|
|
|
33
33
|
This module provides the following parsers:
|
|
34
34
|
|
|
@@ -39,8 +39,8 @@ This module provides the following parsers:
|
|
|
39
39
|
|
|
40
40
|
Other body parsers you might be interested in:
|
|
41
41
|
|
|
42
|
-
- [body](https://www.npmjs.
|
|
43
|
-
- [co-body](https://www.npmjs.
|
|
42
|
+
- [body](https://www.npmjs.com/package/body#readme)
|
|
43
|
+
- [co-body](https://www.npmjs.com/package/co-body#readme)
|
|
44
44
|
|
|
45
45
|
## Installation
|
|
46
46
|
|
|
@@ -109,7 +109,7 @@ accept anything `JSON.parse` accepts. Defaults to `true`.
|
|
|
109
109
|
The `type` option is used to determine what media type the middleware will
|
|
110
110
|
parse. This option can be a string, array of strings, or a function. If not a
|
|
111
111
|
function, `type` option is passed directly to the
|
|
112
|
-
[type-is](https://www.npmjs.
|
|
112
|
+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
|
|
113
113
|
be an extension name (like `json`), a mime type (like `application/json`), or
|
|
114
114
|
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
|
115
115
|
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
|
@@ -154,7 +154,7 @@ to `'100kb'`.
|
|
|
154
154
|
The `type` option is used to determine what media type the middleware will
|
|
155
155
|
parse. This option can be a string, array of strings, or a function.
|
|
156
156
|
If not a function, `type` option is passed directly to the
|
|
157
|
-
[type-is](https://www.npmjs.
|
|
157
|
+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this
|
|
158
158
|
can be an extension name (like `bin`), a mime type (like
|
|
159
159
|
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
|
160
160
|
`application/*`). If a function, the `type` option is called as `fn(req)`
|
|
@@ -205,7 +205,7 @@ to `'100kb'`.
|
|
|
205
205
|
The `type` option is used to determine what media type the middleware will
|
|
206
206
|
parse. This option can be a string, array of strings, or a function. If not
|
|
207
207
|
a function, `type` option is passed directly to the
|
|
208
|
-
[type-is](https://www.npmjs.
|
|
208
|
+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
|
|
209
209
|
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
|
210
210
|
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
|
211
211
|
option is called as `fn(req)` and the request is parsed if it returns a
|
|
@@ -221,8 +221,8 @@ encoding of the request. The parsing can be aborted by throwing an error.
|
|
|
221
221
|
|
|
222
222
|
Returns middleware that only parses `urlencoded` bodies and only looks at
|
|
223
223
|
requests where the `Content-Type` header matches the `type` option. This
|
|
224
|
-
parser accepts only UTF-8
|
|
225
|
-
inflation of `gzip`, `br` (brotli) and `deflate` encodings.
|
|
224
|
+
parser accepts only UTF-8 and ISO-8859-1 encodings of the body and supports
|
|
225
|
+
automatic inflation of `gzip`, `br` (brotli) and `deflate` encodings.
|
|
226
226
|
|
|
227
227
|
A new `body` object containing the parsed data is populated on the `request`
|
|
228
228
|
object after the middleware (i.e. `req.body`). This object will contain
|
|
@@ -239,7 +239,7 @@ any of the following keys:
|
|
|
239
239
|
The "extended" syntax allows for rich objects and arrays to be encoded into the
|
|
240
240
|
URL-encoded format, allowing for a JSON-like experience with URL-encoded. For
|
|
241
241
|
more information, please [see the qs
|
|
242
|
-
library](https://www.npmjs.
|
|
242
|
+
library](https://www.npmjs.com/package/qs#readme).
|
|
243
243
|
|
|
244
244
|
Defaults to `false`.
|
|
245
245
|
|
|
@@ -266,7 +266,7 @@ than this value, a 413 will be returned to the client. Defaults to `1000`.
|
|
|
266
266
|
The `type` option is used to determine what media type the middleware will
|
|
267
267
|
parse. This option can be a string, array of strings, or a function. If not
|
|
268
268
|
a function, `type` option is passed directly to the
|
|
269
|
-
[type-is](https://www.npmjs.
|
|
269
|
+
[type-is](https://www.npmjs.com/package/type-is#readme) library and this can
|
|
270
270
|
be an extension name (like `urlencoded`), a mime type (like
|
|
271
271
|
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
|
272
272
|
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
|
@@ -488,7 +488,7 @@ app.use(bodyParser.text({ type: 'text/html' }))
|
|
|
488
488
|
[coveralls-image]: https://img.shields.io/coverallsCoverage/github/expressjs/body-parser?branch=master
|
|
489
489
|
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
|
490
490
|
[npm-downloads-image]: https://img.shields.io/npm/dm/body-parser
|
|
491
|
-
[npm-url]: https://npmjs.
|
|
491
|
+
[npm-url]: https://npmjs.com/package/body-parser
|
|
492
492
|
[npm-version-image]: https://img.shields.io/npm/v/body-parser
|
|
493
493
|
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
|
|
494
|
-
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|
|
494
|
+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|
|
@@ -7,26 +7,23 @@
|
|
|
7
7
|
'use strict'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @typedef Parsers
|
|
11
|
-
* @
|
|
12
|
-
* @property {
|
|
13
|
-
* @property {
|
|
14
|
-
* @property {
|
|
15
|
-
* @property {function} urlencoded
|
|
10
|
+
* @typedef {Object} Parsers
|
|
11
|
+
* @property {Function} json JSON parser
|
|
12
|
+
* @property {Function} raw Raw parser
|
|
13
|
+
* @property {Function} text Text parser
|
|
14
|
+
* @property {Function} urlencoded URL-encoded parser
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Module exports.
|
|
20
|
-
* @type {Parsers}
|
|
19
|
+
* @type {Function & Parsers}
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
21
|
exports = module.exports = bodyParser
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* JSON parser.
|
|
27
25
|
* @public
|
|
28
26
|
*/
|
|
29
|
-
|
|
30
27
|
Object.defineProperty(exports, 'json', {
|
|
31
28
|
configurable: true,
|
|
32
29
|
enumerable: true,
|
|
@@ -37,7 +34,6 @@ Object.defineProperty(exports, 'json', {
|
|
|
37
34
|
* Raw parser.
|
|
38
35
|
* @public
|
|
39
36
|
*/
|
|
40
|
-
|
|
41
37
|
Object.defineProperty(exports, 'raw', {
|
|
42
38
|
configurable: true,
|
|
43
39
|
enumerable: true,
|
|
@@ -48,7 +44,6 @@ Object.defineProperty(exports, 'raw', {
|
|
|
48
44
|
* Text parser.
|
|
49
45
|
* @public
|
|
50
46
|
*/
|
|
51
|
-
|
|
52
47
|
Object.defineProperty(exports, 'text', {
|
|
53
48
|
configurable: true,
|
|
54
49
|
enumerable: true,
|
|
@@ -59,7 +54,6 @@ Object.defineProperty(exports, 'text', {
|
|
|
59
54
|
* URL-encoded parser.
|
|
60
55
|
* @public
|
|
61
56
|
*/
|
|
62
|
-
|
|
63
57
|
Object.defineProperty(exports, 'urlencoded', {
|
|
64
58
|
configurable: true,
|
|
65
59
|
enumerable: true,
|
|
@@ -69,12 +63,9 @@ Object.defineProperty(exports, 'urlencoded', {
|
|
|
69
63
|
/**
|
|
70
64
|
* Create a middleware to parse json and urlencoded bodies.
|
|
71
65
|
*
|
|
72
|
-
* @param {object} [options]
|
|
73
|
-
* @return {function}
|
|
74
66
|
* @deprecated
|
|
75
67
|
* @public
|
|
76
68
|
*/
|
|
77
|
-
|
|
78
69
|
function bodyParser () {
|
|
79
70
|
throw new Error('The bodyParser() generic has been split into individual middleware to use instead.')
|
|
80
71
|
}
|
|
@@ -28,15 +28,14 @@ module.exports = read
|
|
|
28
28
|
/**
|
|
29
29
|
* Read a request into a buffer and parse.
|
|
30
30
|
*
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
35
|
-
* @param {
|
|
36
|
-
* @param {
|
|
31
|
+
* @param {Object} req
|
|
32
|
+
* @param {Object} res
|
|
33
|
+
* @param {Function} next
|
|
34
|
+
* @param {Function} parse
|
|
35
|
+
* @param {Function} debug
|
|
36
|
+
* @param {Object} options
|
|
37
37
|
* @private
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
39
|
function read (req, res, next, parse, debug, options) {
|
|
41
40
|
if (onFinished.isFinished(req)) {
|
|
42
41
|
debug('body already parsed')
|
|
@@ -176,13 +175,12 @@ function read (req, res, next, parse, debug, options) {
|
|
|
176
175
|
/**
|
|
177
176
|
* Get the content stream of the request.
|
|
178
177
|
*
|
|
179
|
-
* @param {
|
|
180
|
-
* @param {
|
|
181
|
-
* @param {boolean}
|
|
182
|
-
* @
|
|
183
|
-
* @
|
|
178
|
+
* @param {Object} req
|
|
179
|
+
* @param {Function} debug
|
|
180
|
+
* @param {boolean} inflate
|
|
181
|
+
* @returns {Object}
|
|
182
|
+
* @private
|
|
184
183
|
*/
|
|
185
|
-
|
|
186
184
|
function contentstream (req, debug, inflate) {
|
|
187
185
|
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
|
188
186
|
var length = req.headers['content-length']
|
|
@@ -209,9 +207,9 @@ function contentstream (req, debug, inflate) {
|
|
|
209
207
|
/**
|
|
210
208
|
* Create a decompression stream for the given encoding.
|
|
211
209
|
* @param {string} encoding
|
|
212
|
-
* @param {
|
|
213
|
-
* @
|
|
214
|
-
* @
|
|
210
|
+
* @param {Function} debug
|
|
211
|
+
* @returns {Object}
|
|
212
|
+
* @private
|
|
215
213
|
*/
|
|
216
214
|
function createDecompressionStream (encoding, debug) {
|
|
217
215
|
switch (encoding) {
|
|
@@ -235,11 +233,10 @@ function createDecompressionStream (encoding, debug) {
|
|
|
235
233
|
/**
|
|
236
234
|
* Dump the contents of a request.
|
|
237
235
|
*
|
|
238
|
-
* @param {
|
|
239
|
-
* @param {
|
|
240
|
-
* @
|
|
236
|
+
* @param {Object} req
|
|
237
|
+
* @param {Function} callback
|
|
238
|
+
* @private
|
|
241
239
|
*/
|
|
242
|
-
|
|
243
240
|
function dump (req, callback) {
|
|
244
241
|
if (onFinished.isFinished(req)) {
|
|
245
242
|
callback(null)
|
|
@@ -33,7 +33,6 @@ module.exports = json
|
|
|
33
33
|
* %x0A / ; Line feed or New line
|
|
34
34
|
* %x0D ) ; Carriage return
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
36
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
|
|
38
37
|
|
|
39
38
|
var JSON_SYNTAX_CHAR = '#'
|
|
@@ -42,11 +41,10 @@ var JSON_SYNTAX_REGEXP = /#+/g
|
|
|
42
41
|
/**
|
|
43
42
|
* Create a middleware to parse JSON bodies.
|
|
44
43
|
*
|
|
45
|
-
* @param {
|
|
46
|
-
* @
|
|
44
|
+
* @param {Object} [options]
|
|
45
|
+
* @returns {Function}
|
|
47
46
|
* @public
|
|
48
47
|
*/
|
|
49
|
-
|
|
50
48
|
function json (options) {
|
|
51
49
|
const normalizedOptions = normalizeOptions(options, 'application/json')
|
|
52
50
|
|
|
@@ -96,20 +94,15 @@ function json (options) {
|
|
|
96
94
|
*
|
|
97
95
|
* @param {string} str
|
|
98
96
|
* @param {string} char
|
|
99
|
-
* @
|
|
97
|
+
* @returns {Error}
|
|
100
98
|
* @private
|
|
101
99
|
*/
|
|
102
|
-
|
|
103
100
|
function createStrictSyntaxError (str, char) {
|
|
104
101
|
var index = str.indexOf(char)
|
|
105
102
|
var partial = ''
|
|
106
103
|
|
|
107
104
|
if (index !== -1) {
|
|
108
|
-
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
|
|
109
|
-
|
|
110
|
-
for (var i = index + 1; i < str.length; i++) {
|
|
111
|
-
partial += JSON_SYNTAX_CHAR
|
|
112
|
-
}
|
|
105
|
+
partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index)
|
|
113
106
|
}
|
|
114
107
|
|
|
115
108
|
try {
|
|
@@ -128,10 +121,9 @@ function createStrictSyntaxError (str, char) {
|
|
|
128
121
|
* Get the first non-whitespace character in a string.
|
|
129
122
|
*
|
|
130
123
|
* @param {string} str
|
|
131
|
-
* @
|
|
124
|
+
* @returns {string|undefined}
|
|
132
125
|
* @private
|
|
133
126
|
*/
|
|
134
|
-
|
|
135
127
|
function firstchar (str) {
|
|
136
128
|
var match = FIRST_CHAR_REGEXP.exec(str)
|
|
137
129
|
|
|
@@ -144,10 +136,10 @@ function firstchar (str) {
|
|
|
144
136
|
* Normalize a SyntaxError for JSON.parse.
|
|
145
137
|
*
|
|
146
138
|
* @param {SyntaxError} error
|
|
147
|
-
* @param {
|
|
148
|
-
* @
|
|
139
|
+
* @param {Object} obj
|
|
140
|
+
* @returns {SyntaxError}
|
|
141
|
+
* @private
|
|
149
142
|
*/
|
|
150
|
-
|
|
151
143
|
function normalizeJsonSyntaxError (error, obj) {
|
|
152
144
|
var keys = Object.getOwnPropertyNames(error)
|
|
153
145
|
|
|
@@ -23,11 +23,10 @@ module.exports = raw
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a middleware to parse raw bodies.
|
|
25
25
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
26
|
+
* @param {Object} [options]
|
|
27
|
+
* @returns {Function}
|
|
28
|
+
* @public
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
function raw (options) {
|
|
32
31
|
const normalizedOptions = normalizeOptions(options, 'application/octet-stream')
|
|
33
32
|
|
|
@@ -23,11 +23,10 @@ module.exports = text
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a middleware to parse text bodies.
|
|
25
25
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
26
|
+
* @param {Object} [options]
|
|
27
|
+
* @returns {Function}
|
|
28
|
+
* @public
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
function text (options) {
|
|
32
31
|
const normalizedOptions = normalizeOptions(options, 'text/plain')
|
|
33
32
|
|
|
@@ -27,11 +27,10 @@ module.exports = urlencoded
|
|
|
27
27
|
/**
|
|
28
28
|
* Create a middleware to parse urlencoded bodies.
|
|
29
29
|
*
|
|
30
|
-
* @param {
|
|
31
|
-
* @
|
|
30
|
+
* @param {Object} [options]
|
|
31
|
+
* @returns {Function}
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
|
|
35
34
|
function urlencoded (options) {
|
|
36
35
|
const normalizedOptions = normalizeOptions(options, 'application/x-www-form-urlencoded')
|
|
37
36
|
|
|
@@ -62,9 +61,10 @@ function urlencoded (options) {
|
|
|
62
61
|
/**
|
|
63
62
|
* Get the extended query parser.
|
|
64
63
|
*
|
|
65
|
-
* @param {
|
|
64
|
+
* @param {Object} options
|
|
65
|
+
* @returns {Function}
|
|
66
|
+
* @private
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
68
|
function createQueryParser (options) {
|
|
69
69
|
var extended = Boolean(options?.extended)
|
|
70
70
|
var parameterLimit = options?.parameterLimit !== undefined
|
|
@@ -96,7 +96,7 @@ function createQueryParser (options) {
|
|
|
96
96
|
})
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
var arrayLimit = extended ? Math.max(100, paramCount) :
|
|
99
|
+
var arrayLimit = extended ? Math.max(100, paramCount) : paramCount
|
|
100
100
|
|
|
101
101
|
debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')
|
|
102
102
|
try {
|
|
@@ -127,8 +127,8 @@ function createQueryParser (options) {
|
|
|
127
127
|
*
|
|
128
128
|
* @param {string} body
|
|
129
129
|
* @param {number} limit
|
|
130
|
-
* @
|
|
131
|
-
* @
|
|
130
|
+
* @returns {number|undefined} Returns undefined if limit exceeded
|
|
131
|
+
* @private
|
|
132
132
|
*/
|
|
133
133
|
function parameterCount (body, limit) {
|
|
134
134
|
let count = 0
|
|
@@ -20,10 +20,10 @@ module.exports = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Get the charset of a request.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
24
|
-
* @
|
|
23
|
+
* @param {Object} req
|
|
24
|
+
* @returns {string | undefined}
|
|
25
|
+
* @private
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
27
|
function getCharset (req) {
|
|
28
28
|
try {
|
|
29
29
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
|
@@ -36,9 +36,9 @@ function getCharset (req) {
|
|
|
36
36
|
* Get the simple type checker.
|
|
37
37
|
*
|
|
38
38
|
* @param {string | string[]} type
|
|
39
|
-
* @
|
|
39
|
+
* @returns {Function}
|
|
40
|
+
* @private
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
42
|
function typeChecker (type) {
|
|
43
43
|
return function checkType (req) {
|
|
44
44
|
return Boolean(typeis(req, type))
|
|
@@ -48,9 +48,10 @@ function typeChecker (type) {
|
|
|
48
48
|
/**
|
|
49
49
|
* Normalizes the common options for all parsers.
|
|
50
50
|
*
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {string | string[] |
|
|
53
|
-
* @returns {
|
|
51
|
+
* @param {Object} options options to normalize
|
|
52
|
+
* @param {string | string[] | Function} defaultType default content type(s) or a function to determine it
|
|
53
|
+
* @returns {Object}
|
|
54
|
+
* @private
|
|
54
55
|
*/
|
|
55
56
|
function normalizeOptions (options, defaultType) {
|
|
56
57
|
if (!defaultType) {
|
|
@@ -89,7 +90,8 @@ function normalizeOptions (options, defaultType) {
|
|
|
89
90
|
* Used by parsers that don't need to transform the data.
|
|
90
91
|
*
|
|
91
92
|
* @param {*} value
|
|
92
|
-
* @
|
|
93
|
+
* @returns {*}
|
|
94
|
+
* @private
|
|
93
95
|
*/
|
|
94
96
|
function passthrough (value) {
|
|
95
97
|
return value
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "body-parser",
|
|
3
3
|
"description": "Node.js body parsing middleware",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
7
7
|
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"http-errors": "^2.0.0",
|
|
20
20
|
"iconv-lite": "^0.7.0",
|
|
21
21
|
"on-finished": "^2.4.1",
|
|
22
|
-
"qs": "^6.14.
|
|
22
|
+
"qs": "^6.14.1",
|
|
23
23
|
"raw-body": "^3.0.1",
|
|
24
24
|
"type-is": "^2.0.1"
|
|
25
25
|
},
|
|
@@ -87,7 +87,6 @@ are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-
|
|
|
87
87
|
|
|
88
88
|
```js
|
|
89
89
|
const contentDisposition = require('content-disposition')
|
|
90
|
-
const destroy = require('destroy')
|
|
91
90
|
const fs = require('fs')
|
|
92
91
|
const http = require('http')
|
|
93
92
|
const onFinished = require('on-finished')
|
|
@@ -103,7 +102,7 @@ http.createServer(function onRequest (req, res) {
|
|
|
103
102
|
const stream = fs.createReadStream(filePath)
|
|
104
103
|
stream.pipe(res)
|
|
105
104
|
onFinished(res, function () {
|
|
106
|
-
destroy(
|
|
105
|
+
stream.destroy()
|
|
107
106
|
})
|
|
108
107
|
})
|
|
109
108
|
```
|
|
@@ -121,9 +120,9 @@ $ npm test
|
|
|
121
120
|
- [RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)][rfc-6266]
|
|
122
121
|
- [Test Cases for HTTP Content-Disposition header field (RFC 6266) and the Encodings defined in RFCs 2047, 2231 and 5987][tc-2231]
|
|
123
122
|
|
|
124
|
-
[rfc-2616]: https://
|
|
125
|
-
[rfc-5987]: https://
|
|
126
|
-
[rfc-6266]: https://
|
|
123
|
+
[rfc-2616]: https://datatracker.ietf.org/doc/html/rfc2616
|
|
124
|
+
[rfc-5987]: https://datatracker.ietf.org/doc/html/rfc5987
|
|
125
|
+
[rfc-6266]: https://datatracker.ietf.org/doc/html/rfc6266
|
|
127
126
|
[tc-2231]: http://greenbytes.de/tech/tc2231/
|
|
128
127
|
|
|
129
128
|
## License
|
|
@@ -131,12 +130,12 @@ $ npm test
|
|
|
131
130
|
[MIT](LICENSE)
|
|
132
131
|
|
|
133
132
|
[npm-image]: https://img.shields.io/npm/v/content-disposition
|
|
134
|
-
[npm-url]: https://npmjs.
|
|
133
|
+
[npm-url]: https://www.npmjs.com/package/content-disposition
|
|
135
134
|
[node-version-image]: https://img.shields.io/node/v/content-disposition
|
|
136
135
|
[node-version-url]: https://nodejs.org/en/download
|
|
137
136
|
[coveralls-image]: https://img.shields.io/coverallsCoverage/github/jshttp/content-disposition
|
|
138
|
-
[coveralls-url]: https://coveralls.io/
|
|
137
|
+
[coveralls-url]: https://coveralls.io/github/jshttp/content-disposition?branch=master
|
|
139
138
|
[downloads-image]: https://img.shields.io/npm/dm/content-disposition
|
|
140
|
-
[downloads-url]: https://npmjs.
|
|
139
|
+
[downloads-url]: https://www.npmjs.com/package/content-disposition
|
|
141
140
|
[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-disposition/ci.yml
|
|
142
141
|
[github-actions-ci-url]: https://github.com/jshttp/content-disposition/actions/workflows/ci.yml
|