@songtonyli/dsh-cli 0.1.98 → 0.1.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +12 -0
  4. package/node_modules/@aws-sdk/core/dist-es/submodules/client/getDefaultSocketTimeout.js +10 -0
  5. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.browser.js +1 -0
  6. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +1 -0
  7. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.native.js +1 -0
  8. package/node_modules/@aws-sdk/core/package.json +1 -1
  9. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  10. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  12. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  13. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  14. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  15. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  16. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  17. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -2
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +3 -2
  20. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -2
  21. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -2
  22. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +3 -2
  23. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +2 -1
  24. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +2 -1
  25. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +2 -1
  26. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +2 -1
  27. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +2 -1
  28. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  29. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  30. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/boot.js +1 -1
  31. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/file.js +1 -1
  32. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/index.js +3 -0
  33. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/from-binary.js +3 -1
  34. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/index.js +7 -2
  35. package/node_modules/@bufbuild/protobuf/dist/cjs/package.json +1 -0
  36. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect.js +0 -1
  37. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/registry.js +79 -10
  38. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/to-json.js +1 -1
  39. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/to-text.js +4 -9
  40. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/binary-encoding.js +9 -5
  41. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/text-encoding.js +7 -3
  42. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +2 -2
  43. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +2 -2
  44. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +1 -0
  45. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +3 -1
  46. package/node_modules/@bufbuild/protobuf/dist/esm/index.js +1 -1
  47. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +0 -1
  48. package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +77 -10
  49. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +1 -1
  50. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +4 -9
  51. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +9 -5
  52. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +7 -3
  53. package/node_modules/@bufbuild/protobuf/package.json +70 -267
  54. package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
  55. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  56. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +8 -8
  57. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +4 -4
  58. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +4 -4
  59. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +507 -127
  60. package/node_modules/@eslint-community/regexpp/index.js +3 -3
  61. package/node_modules/@eslint-community/regexpp/index.mjs +3 -3
  62. package/node_modules/@eslint-community/regexpp/package.json +1 -1
  63. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +1461 -176
  64. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +1363 -171
  65. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +1 -1
  66. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +1 -1
  67. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +382 -95
  68. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +358 -94
  69. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +132 -8
  70. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +5 -5
  71. package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +8 -0
  72. package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +3 -3
  73. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +104 -13
  74. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +99 -14
  75. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +16 -0
  76. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +15 -1
  77. package/node_modules/@opentelemetry/semantic-conventions/package.json +2 -2
  78. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +1 -0
  79. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +33 -5
  80. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +33 -5
  81. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +1 -0
  82. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +11 -5
  83. package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/race.js +22 -0
  84. package/node_modules/@smithy/core/package.json +2 -2
  85. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +10 -4
  86. package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +6 -2
  87. package/node_modules/@smithy/fetch-http-handler/dist-es/request-timeout.js +4 -2
  88. package/node_modules/@smithy/fetch-http-handler/package.json +3 -3
  89. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +31 -31
  90. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +2 -4
  91. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +29 -27
  92. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  93. package/node_modules/@smithy/types/package.json +1 -1
  94. package/node_modules/commander/Readme.md +6 -32
  95. package/node_modules/commander/index.js +1 -1
  96. package/node_modules/commander/lib/command.js +22 -9
  97. package/node_modules/commander/lib/help.js +6 -2
  98. package/node_modules/commander/lib/option.js +1 -1
  99. package/node_modules/commander/package.json +2 -1
  100. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +3 -2
  101. package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  102. package/node_modules/jose/dist/webapi/jws/general/verify.js +2 -8
  103. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +11 -8
  104. package/node_modules/jose/dist/webapi/lib/key_management.js +0 -1
  105. package/node_modules/jose/package.json +1 -1
  106. package/node_modules/vfile-message/lib/index.js +44 -14
  107. package/node_modules/vfile-message/package.json +6 -13
  108. package/node_modules/vfile-message/readme.md +9 -14
  109. package/package.json +23 -23
  110. package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +0 -4
  111. package/node_modules/@bufbuild/protobuf/dist/esm/package.json +0 -4
  112. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/clone.js +0 -0
  113. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/boot.js +0 -0
  114. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/enum.js +0 -0
  115. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/extension.js +0 -0
  116. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/file.js +0 -0
  117. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/index.js +0 -0
  118. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/message.js +0 -0
  119. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/service.js +0 -0
  120. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/symbols.js +0 -0
  121. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/types.js +0 -0
  122. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/embed.js +0 -0
  123. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/enum.js +0 -0
  124. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/extension.js +0 -0
  125. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/message.js +0 -0
  126. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/restore-json-names.js +0 -0
  127. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/scalar.js +0 -0
  128. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/service.js +0 -0
  129. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/symbols.js +0 -0
  130. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/types.js +0 -0
  131. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/create.js +0 -0
  132. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/descriptors.js +0 -0
  133. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/equals.js +0 -0
  134. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/extensions.js +0 -0
  135. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/fields.js +0 -0
  136. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/from-json.js +0 -0
  137. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/is-message.js +0 -0
  138. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/json-value.js +0 -0
  139. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/merge.js +0 -0
  140. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/proto-int64.js +0 -0
  141. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/error.js +0 -0
  142. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/guard.js +0 -0
  143. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/index.js +0 -0
  144. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/message.js +0 -0
  145. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/names.js +0 -0
  146. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/nested-types.js +0 -0
  147. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/path.js +0 -0
  148. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect-check.js +0 -0
  149. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect-types.js +0 -0
  150. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/scalar.js +0 -0
  151. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/unsafe.js +0 -0
  152. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/to-binary.js +0 -0
  153. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/from-text.js +0 -0
  154. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/index.js +0 -0
  155. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/is-group-like.js +0 -0
  156. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/reader.js +0 -0
  157. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/writer.js +0 -0
  158. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/types.js +0 -0
  159. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/unknown-enum.js +0 -0
  160. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/base64-encoding.js +0 -0
  161. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/index.js +0 -0
  162. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/size-delimited.js +0 -0
  163. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/text-format.js +0 -0
  164. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/varint.js +0 -0
  165. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/any.js +0 -0
  166. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/duration.js +0 -0
  167. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/any_pb.js +0 -0
  168. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/api_pb.js +0 -0
  169. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/c_sharp_features_pb.js +0 -0
  170. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/compiler/plugin_pb.js +0 -0
  171. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_features_pb.js +0 -0
  172. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_file_options_pb.js +0 -0
  173. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_options_pb.js +0 -0
  174. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/descriptor_pb.js +0 -0
  175. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/duration_pb.js +0 -0
  176. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/empty_pb.js +0 -0
  177. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/field_mask_pb.js +0 -0
  178. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/go_features_pb.js +0 -0
  179. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/java_features_pb.js +0 -0
  180. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/json_enumvalue_options_pb.js +0 -0
  181. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/json_options_pb.js +0 -0
  182. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/source_context_pb.js +0 -0
  183. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/struct_pb.js +0 -0
  184. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/timestamp_pb.js +0 -0
  185. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/type_pb.js +0 -0
  186. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/wrappers_pb.js +0 -0
  187. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/index.js +0 -0
  188. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/json.js +0 -0
  189. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/timestamp.js +0 -0
  190. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/wrappers.js +0 -0
@@ -78,6 +78,7 @@ export class FetchHttpHandler {
78
78
  Object.assign(requestOptions, this.config.requestInit(request));
79
79
  }
80
80
  let removeSignalEventListener = () => { };
81
+ const timeout = requestTimeoutFn(requestTimeoutInMs);
81
82
  const fetchRequest = createRequest(url, requestOptions);
82
83
  const raceOfPromises = [
83
84
  fetchFn(fetchRequest).then((response) => {
@@ -106,7 +107,7 @@ export class FetchHttpHandler {
106
107
  }),
107
108
  };
108
109
  }),
109
- requestTimeoutFn(requestTimeoutInMs),
110
+ timeout.promise,
110
111
  ];
111
112
  if (abortSignal) {
112
113
  raceOfPromises.push(new Promise((resolve, reject) => {
@@ -124,7 +125,10 @@ export class FetchHttpHandler {
124
125
  }
125
126
  }));
126
127
  }
127
- return Promise.race(raceOfPromises).finally(removeSignalEventListener);
128
+ return Promise.race(raceOfPromises).finally(() => {
129
+ timeout.cancel();
130
+ removeSignalEventListener();
131
+ });
128
132
  }
129
133
  updateHttpClientConfig(key, value) {
130
134
  this.config = undefined;
@@ -1,11 +1,13 @@
1
1
  export function requestTimeout(timeoutInMs = 0) {
2
- return new Promise((resolve, reject) => {
2
+ let timeoutId;
3
+ const promise = new Promise((resolve, reject) => {
3
4
  if (timeoutInMs) {
4
- setTimeout(() => {
5
+ timeoutId = setTimeout(() => {
5
6
  const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
6
7
  timeoutError.name = "TimeoutError";
7
8
  reject(timeoutError);
8
9
  }, timeoutInMs);
9
10
  }
10
11
  });
12
+ return { promise, cancel: () => clearTimeout(timeoutId) };
11
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/fetch-http-handler",
3
- "version": "5.8.0",
3
+ "version": "5.8.1",
4
4
  "description": "Provides a way to make requests",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/fetch-http-handler",
6
6
  "license": "Apache-2.0",
@@ -28,8 +28,8 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@smithy/core": "^3.33.3",
32
- "@smithy/types": "^4.18.0",
31
+ "@smithy/core": "^3.39.0",
32
+ "@smithy/types": "^4.20.0",
33
33
  "tslib": "^2.6.2"
34
34
  },
35
35
  "devDependencies": {
@@ -130,39 +130,41 @@ const resolveDefaultSocketTimeout = (config) => {
130
130
  };
131
131
 
132
132
  const DEFER_EVENT_LISTENER_TIME = 3000;
133
- const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
134
- let response;
135
- if (destroyResponseBodyOnTimeout) {
136
- request.once("response", (res) => (response = res));
133
+ const setSocketTimeout = (request, reject, timeoutInMs = 0, isServiceDefault = false) => {
134
+ if (!Number.isFinite(timeoutInMs) || timeoutInMs <= 0) {
135
+ return;
137
136
  }
138
- const registerTimeout = (offset) => {
139
- const timeout = timeoutInMs - offset;
140
- const onTimeout = () => {
141
- const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
142
- if (destroyResponseBodyOnTimeout) {
143
- response?.destroy(error);
144
- }
145
- request.destroy();
146
- reject(error);
147
- };
148
- if (request.socket) {
149
- request.socket.setTimeout(timeout, onTimeout);
150
- request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
137
+ let response;
138
+ request.once("response", (res) => (response = res));
139
+ const onTimeout = () => {
140
+ if (response?.complete) {
141
+ request.socket?.destroy();
142
+ return;
143
+ }
144
+ const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${isServiceDefault ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
145
+ response?.destroy(error);
146
+ request.destroy();
147
+ reject(error);
148
+ };
149
+ const registerTimeout = () => {
150
+ const { socket } = request;
151
+ if (!socket) {
152
+ request.once("socket", registerTimeout);
153
+ }
154
+ else if (socket.connecting) {
155
+ socket.once("connect", registerTimeout);
151
156
  }
152
157
  else {
153
- request.setTimeout(timeout, onTimeout);
158
+ socket.setTimeout(timeoutInMs, onTimeout);
159
+ request.on("close", () => socket.removeListener("timeout", onTimeout));
154
160
  }
155
161
  };
156
- if (0 < timeoutInMs && timeoutInMs < 6000) {
157
- registerTimeout(0);
158
- return 0;
159
- }
160
- const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
161
- if (destroyResponseBodyOnTimeout) {
162
- request.once("close", () => timing.clearTimeout(deferralId));
163
- return 0;
162
+ if (timeoutInMs < 6000) {
163
+ registerTimeout();
164
+ return;
164
165
  }
165
- return deferralId;
166
+ const deferralId = timing.setTimeout(registerTimeout, DEFER_EVENT_LISTENER_TIME);
167
+ request.once("close", () => timing.clearTimeout(deferralId));
166
168
  };
167
169
 
168
170
  const MIN_WAIT_TIME = 6_000;
@@ -301,13 +303,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
301
303
  let socketWarningTimeoutId = -1;
302
304
  let connectionTimeoutId = -1;
303
305
  let requestTimeoutId = -1;
304
- let socketTimeoutId = -1;
305
306
  let keepAliveTimeoutId = -1;
306
307
  const clearTimeouts = () => {
307
308
  timing.clearTimeout(socketWarningTimeoutId);
308
309
  timing.clearTimeout(connectionTimeoutId);
309
310
  timing.clearTimeout(requestTimeoutId);
310
- timing.clearTimeout(socketTimeoutId);
311
311
  timing.clearTimeout(keepAliveTimeoutId);
312
312
  };
313
313
  const resolve = async (arg) => {
@@ -405,10 +405,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
405
405
  requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
406
406
  const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
407
407
  if (defaultSocketTimeout) {
408
- socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
408
+ setSocketTimeout(req, reject, defaultSocketTimeout, true);
409
409
  }
410
410
  else {
411
- socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
411
+ setSocketTimeout(req, reject, config.socketTimeout);
412
412
  }
413
413
  const httpAgent = nodeHttpsOptions.agent;
414
414
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
@@ -85,13 +85,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
85
85
  let socketWarningTimeoutId = -1;
86
86
  let connectionTimeoutId = -1;
87
87
  let requestTimeoutId = -1;
88
- let socketTimeoutId = -1;
89
88
  let keepAliveTimeoutId = -1;
90
89
  const clearTimeouts = () => {
91
90
  timing.clearTimeout(socketWarningTimeoutId);
92
91
  timing.clearTimeout(connectionTimeoutId);
93
92
  timing.clearTimeout(requestTimeoutId);
94
- timing.clearTimeout(socketTimeoutId);
95
93
  timing.clearTimeout(keepAliveTimeoutId);
96
94
  };
97
95
  const resolve = async (arg) => {
@@ -189,10 +187,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
189
187
  requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
190
188
  const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
191
189
  if (defaultSocketTimeout) {
192
- socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
190
+ setSocketTimeout(req, reject, defaultSocketTimeout, true);
193
191
  }
194
192
  else {
195
- socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
193
+ setSocketTimeout(req, reject, config.socketTimeout);
196
194
  }
197
195
  const httpAgent = nodeHttpsOptions.agent;
198
196
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
@@ -1,36 +1,38 @@
1
1
  import { timing } from "./timing";
2
2
  const DEFER_EVENT_LISTENER_TIME = 3000;
3
- export const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
4
- let response;
5
- if (destroyResponseBodyOnTimeout) {
6
- request.once("response", (res) => (response = res));
3
+ export const setSocketTimeout = (request, reject, timeoutInMs = 0, isServiceDefault = false) => {
4
+ if (!Number.isFinite(timeoutInMs) || timeoutInMs <= 0) {
5
+ return;
7
6
  }
8
- const registerTimeout = (offset) => {
9
- const timeout = timeoutInMs - offset;
10
- const onTimeout = () => {
11
- const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
12
- if (destroyResponseBodyOnTimeout) {
13
- response?.destroy(error);
14
- }
15
- request.destroy();
16
- reject(error);
17
- };
18
- if (request.socket) {
19
- request.socket.setTimeout(timeout, onTimeout);
20
- request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
7
+ let response;
8
+ request.once("response", (res) => (response = res));
9
+ const onTimeout = () => {
10
+ if (response?.complete) {
11
+ request.socket?.destroy();
12
+ return;
13
+ }
14
+ const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${isServiceDefault ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
15
+ response?.destroy(error);
16
+ request.destroy();
17
+ reject(error);
18
+ };
19
+ const registerTimeout = () => {
20
+ const { socket } = request;
21
+ if (!socket) {
22
+ request.once("socket", registerTimeout);
23
+ }
24
+ else if (socket.connecting) {
25
+ socket.once("connect", registerTimeout);
21
26
  }
22
27
  else {
23
- request.setTimeout(timeout, onTimeout);
28
+ socket.setTimeout(timeoutInMs, onTimeout);
29
+ request.on("close", () => socket.removeListener("timeout", onTimeout));
24
30
  }
25
31
  };
26
- if (0 < timeoutInMs && timeoutInMs < 6000) {
27
- registerTimeout(0);
28
- return 0;
29
- }
30
- const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
31
- if (destroyResponseBodyOnTimeout) {
32
- request.once("close", () => timing.clearTimeout(deferralId));
33
- return 0;
32
+ if (timeoutInMs < 6000) {
33
+ registerTimeout();
34
+ return;
34
35
  }
35
- return deferralId;
36
+ const deferralId = timing.setTimeout(registerTimeout, DEFER_EVENT_LISTENER_TIME);
37
+ request.once("close", () => timing.clearTimeout(deferralId));
36
38
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/node-http-handler",
3
- "version": "4.14.1",
3
+ "version": "4.14.2",
4
4
  "description": "Provides a way to make requests",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/node-http-handler",
6
6
  "license": "Apache-2.0",
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@smithy/core": "^3.38.1",
33
- "@smithy/types": "^4.19.0",
32
+ "@smithy/core": "^3.39.0",
33
+ "@smithy/types": "^4.20.0",
34
34
  "tslib": "^2.6.2"
35
35
  },
36
36
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/types",
3
- "version": "4.19.0",
3
+ "version": "4.20.0",
4
4
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/types",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -44,7 +44,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
44
44
  - [Bits and pieces](#bits-and-pieces)
45
45
  - [.parse() and .parseAsync()](#parse-and-parseasync)
46
46
  - [Parsing Configuration](#parsing-configuration)
47
- - [Legacy options as properties](#legacy-options-as-properties)
48
47
  - [TypeScript](#typescript)
49
48
  - [createCommand()](#createcommand)
50
49
  - [Node options such as `--harmony`](#node-options-such-as---harmony)
@@ -54,7 +53,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
54
53
  - [Override exit and output handling](#override-exit-and-output-handling)
55
54
  - [Additional documentation](#additional-documentation)
56
55
  - [Support](#support)
57
- - [Commander for enterprise](#commander-for-enterprise)
58
56
 
59
57
  For information about terms used in this document see: [terminology](./docs/terminology.md)
60
58
 
@@ -367,7 +365,8 @@ Example file: [options-variadic.js](./examples/options-variadic.js)
367
365
  ```js
368
366
  program
369
367
  .option('-n, --number <numbers...>', 'specify numbers')
370
- .option('-l, --letter [letters...]', 'specify letters');
368
+ .option('-l, --letter [letters...]', 'specify letters')
369
+ .argument('[operand]');
371
370
 
372
371
  program.parse();
373
372
 
@@ -380,10 +379,10 @@ $ collect -n 1 2 3 --letter a b c
380
379
  Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
381
380
  Remaining arguments: []
382
381
  $ collect --letter=A -n80 operand
383
- Options: { number: [ '80' ], letter: [ 'A' ] }
382
+ Options: { letter: [ 'A' ], number: [ '80' ] }
384
383
  Remaining arguments: [ 'operand' ]
385
384
  $ collect --letter -n 1 -n 2 3 -- operand
386
- Options: { number: [ '1', '2', '3' ], letter: true }
385
+ Options: { letter: true, number: [ '1', '2', '3' ] }
387
386
  Remaining arguments: [ 'operand' ]
388
387
  ```
389
388
 
@@ -670,7 +669,7 @@ Example file: [action-this.js](./examples/action-this.js)
670
669
  program
671
670
  .command('serve')
672
671
  .argument('<script>')
673
- .option('-p, --port <number>', 'port number', 80)
672
+ .option('-p, --port <number>', 'port number', '80')
674
673
  .action(function() {
675
674
  console.error('Run script %s on port %s', this.args[0], this.opts().port);
676
675
  });
@@ -1016,25 +1015,6 @@ By default, the option processing shows an error for an unknown option. To have
1016
1015
  By default, the argument processing displays an error for more command-arguments than expected.
1017
1016
  To suppress the error for excess arguments, use `.allowExcessArguments()`.
1018
1017
 
1019
- ### Legacy options as properties
1020
-
1021
- Before Commander 7, the option values were stored as properties on the command.
1022
- This was convenient to code, but the downside was possible clashes with
1023
- existing properties of `Command`.
1024
-
1025
- You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.
1026
-
1027
- ```js
1028
- program
1029
- .storeOptionsAsProperties()
1030
- .option('-d, --debug')
1031
- .action((commandAndOptions) => {
1032
- if (commandAndOptions.debug) {
1033
- console.error(`Called ${commandAndOptions.name()}`);
1034
- }
1035
- });
1036
- ```
1037
-
1038
1018
  ### TypeScript
1039
1019
 
1040
1020
  **extra-typings:** There is an optional project to infer extra type information from the option and argument definitions.
@@ -1075,7 +1055,7 @@ You can enable `--harmony` option in two ways:
1075
1055
 
1076
1056
  An executable subcommand is launched as a separate child process.
1077
1057
 
1078
- If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al.,
1058
+ If you are using the node inspector for [debugging](https://nodejs.org/en/learn/getting-started/debugging) executable subcommands using `node --inspect` et al.,
1079
1059
  the inspector port is incremented by 1 for the spawned subcommand.
1080
1060
 
1081
1061
  If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your `launch.json` configuration.
@@ -1164,9 +1144,3 @@ The current version of Commander is fully supported on Long Term Support version
1164
1144
  Older major versions of Commander receive security updates for 12 months. For more see: [Release Policy](./docs/release-policy.md).
1165
1145
 
1166
1146
  The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
1167
-
1168
- ### Commander for enterprise
1169
-
1170
- Available as part of the Tidelift Subscription
1171
-
1172
- The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
@@ -18,4 +18,4 @@ export const createArgument = (name, description) =>
18
18
 
19
19
  export { Command, Option, Argument, Help };
20
20
  export { CommanderError, InvalidArgumentError };
21
- export { InvalidArgumentError as InvalidOptionArgumentError }; // Deprecated
21
+ export { InvalidArgumentError as InvalidOptionArgumentError };
@@ -975,7 +975,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
975
975
  // global overwrites local, like optsWithGlobals
976
976
  let source;
977
977
  this._getCommandAndAncestors().forEach((cmd) => {
978
- if (cmd.getOptionValueSource(key) !== undefined) {
978
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
979
979
  source = cmd.getOptionValueSource(key);
980
980
  }
981
981
  });
@@ -1768,7 +1768,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1768
1768
 
1769
1769
  const negativeNumberArg = (arg) => {
1770
1770
  // return false if not a negative number
1771
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
1771
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
1772
1772
  // negative number is ok unless digit used as an option in command hierarchy
1773
1773
  return !this._getCommandAndAncestors().some((cmd) =>
1774
1774
  cmd.options
@@ -2366,7 +2366,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2366
2366
  * (This does not override a group set directly on the subcommand using .helpGroup().)
2367
2367
  *
2368
2368
  * @example
2369
- * program.commandsGroup('Development Commands:);
2369
+ * program.commandsGroup('Development Commands:');
2370
2370
  * program.command('watch')...
2371
2371
  * program.command('lint')...
2372
2372
  * ...
@@ -2562,7 +2562,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2562
2562
  * Pass in false to disable the built-in help option.
2563
2563
  *
2564
2564
  * @example
2565
- * program.helpOption('-?, --help' 'show help'); // customise
2565
+ * program.helpOption('-?, --help', 'show help'); // customise
2566
2566
  * program.helpOption(false); // disable
2567
2567
  *
2568
2568
  * @param {(string | boolean)} flags
@@ -2720,7 +2720,12 @@ function incrementNodeInspectorPort(args) {
2720
2720
  // Testing for these options:
2721
2721
  // --inspect[=[host:]port]
2722
2722
  // --inspect-brk[=[host:]port]
2723
+ // --inspect-wait[=[host:]port]
2723
2724
  // --inspect-port=[host:]port
2725
+ //
2726
+ // Host can be an IP literal encapsulated within square brackets (e.g. [::1]),
2727
+ // an IPv4 address in dotted-decimal form (e.g. 192.168.0.1), or a registered name.
2728
+ // https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
2724
2729
  return args.map((arg) => {
2725
2730
  if (!arg.startsWith('--inspect')) {
2726
2731
  return arg;
@@ -2729,24 +2734,32 @@ function incrementNodeInspectorPort(args) {
2729
2734
  let debugHost = '127.0.0.1';
2730
2735
  let debugPort = '9229';
2731
2736
  let match;
2732
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
2737
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
2733
2738
  // e.g. --inspect
2734
2739
  debugOption = match[1];
2735
2740
  } else if (
2736
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null
2741
+ (match = arg.match(
2742
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/,
2743
+ )) !== null
2737
2744
  ) {
2745
+ // Matches a host or a port, but not both. No colon to separate them.
2738
2746
  debugOption = match[1];
2739
2747
  if (/^\d+$/.test(match[3])) {
2748
+ // Plain digits so a port number.
2740
2749
  // e.g. --inspect=1234
2741
2750
  debugPort = match[3];
2742
2751
  } else {
2743
- // e.g. --inspect=localhost
2752
+ // Assume a host.
2753
+ // e.g. --inspect=localhost, --inspect=[::1], --inspect=192.168.0.1
2744
2754
  debugHost = match[3];
2745
2755
  }
2746
2756
  } else if (
2747
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null
2757
+ (match = arg.match(
2758
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/,
2759
+ )) !== null
2748
2760
  ) {
2749
- // e.g. --inspect=localhost:1234
2761
+ // Matched host:port pattern.
2762
+ // e.g. --inspect=localhost:1234, --inspect=[::1]:1234, --inspect=192.168.0.1:1234
2750
2763
  debugOption = match[1];
2751
2764
  debugHost = match[3];
2752
2765
  debugPort = match[4];
@@ -89,11 +89,15 @@ export class Help {
89
89
  visibleOptions.push(helpOption); // no changes needed
90
90
  } else if (helpOption.long && !removeLong) {
91
91
  visibleOptions.push(
92
- cmd.createOption(helpOption.long, helpOption.description),
92
+ cmd
93
+ .createOption(helpOption.long, helpOption.description)
94
+ .helpGroup(helpOption.helpGroupHeading),
93
95
  );
94
96
  } else if (helpOption.short && !removeShort) {
95
97
  visibleOptions.push(
96
- cmd.createOption(helpOption.short, helpOption.description),
98
+ cmd
99
+ .createOption(helpOption.short, helpOption.description)
100
+ .helpGroup(helpOption.helpGroupHeading),
97
101
  );
98
102
  }
99
103
  }
@@ -15,7 +15,7 @@ export class Option {
15
15
  this.required = flags.includes('<'); // A value must be supplied when the option is specified.
16
16
  this.optional = flags.includes('['); // A value is optional when the option is specified.
17
17
  // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument
18
- this.variadic = /\w\.\.\.[>\]]$/.test(flags); // The option can take multiple values.
18
+ this.variadic = /\p{ID_Continue}\.\.\.[>\]]$/u.test(flags); // The option can take multiple values.
19
19
  this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.
20
20
  const optionFlags = splitOptionFlags(flags);
21
21
  this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander",
3
- "version": "15.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "the complete solution for node.js command-line programs",
5
5
  "keywords": [
6
6
  "commander",
@@ -37,6 +37,7 @@
37
37
  "@types/node": "^22.7.4",
38
38
  "eslint": "^10.0.2",
39
39
  "eslint-config-prettier": "^10.0.1",
40
+ "eslint-node-test": "^1.0.0",
40
41
  "globals": "^17.3.0",
41
42
  "prettier": "^3.2.5",
42
43
  "tsd": "^0.33.0",
@@ -13,9 +13,10 @@ async function generalDecrypt(jwe, key, options) {
13
13
  throw new JWEInvalid("JWE Recipients missing or incorrect type");
14
14
  if (!recipients.length)
15
15
  throw new JWEInvalid("JWE Recipients has no members");
16
- let shared, sharedJwe, token;
16
+ const shared = prepareDecrypt(options);
17
+ let sharedJwe, token;
17
18
  try {
18
- shared = prepareDecrypt(options), sharedJwe = snapshotSharedJWE(jwe), token = shareJWE(sharedJwe);
19
+ sharedJwe = snapshotSharedJWE(jwe), token = shareJWE(sharedJwe);
19
20
  } catch {
20
21
  throw new JWEDecryptionFailed();
21
22
  }
@@ -5,7 +5,7 @@ function isCloudflareWorkers() {
5
5
  return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
6
6
  }
7
7
  let USER_AGENT;
8
- (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.15");
8
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.16");
9
9
  const customFetch = /* @__PURE__ */ Symbol();
10
10
  async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
11
11
  const response = await fetchImpl(url, {
@@ -22,15 +22,9 @@ async function generalVerify(jws, key, options) {
22
22
  const signatureEntries = Array.from(signatures);
23
23
  if (!signatureEntries.every(isObject))
24
24
  throw new JWSInvalid("JWS Signatures missing or incorrect type");
25
- let shared;
26
- try {
27
- if (inputPayload === void 0)
28
- throw new Error();
29
- shared = prepareVerify(options);
30
- } catch {
25
+ if (inputPayload === void 0)
31
26
  throw new JWSSignatureVerificationFailed();
32
- }
33
- const payload = inputPayload instanceof Uint8Array ? new Uint8Array(inputPayload) : inputPayload, candidates = signatureEntries.map((signature) => snapshotSignature(signature, payload)).filter((candidate) => candidate !== void 0);
27
+ const shared = prepareVerify(options), payload = inputPayload instanceof Uint8Array ? new Uint8Array(inputPayload) : inputPayload, candidates = signatureEntries.map((signature) => snapshotSignature(signature, payload)).filter((candidate) => candidate !== void 0);
34
28
  let payloadEncodings = 0;
35
29
  for (const [, , payloadEncoding] of candidates)
36
30
  if (payloadEncodings |= payloadEncoding, payloadEncodings === 3)
@@ -1,7 +1,7 @@
1
1
  import { decrypt, generateCek } from "./content_encryption.js";
2
2
  import { decodeBase64url, encodeAsciiMember, parseJoseHeader, isDisjoint, isObject, validateCrit, validateAlgorithms, JWE_RECOGNIZED } from "./validate.js";
3
3
  import { JOSEAlgNotAllowed, JOSENotSupported, JWEInvalid } from "../util/errors.js";
4
- import { decryptKeyManagement } from "./key_management.js";
4
+ import { decryptKeyManagement, validateMaxPBES2Count } from "./key_management.js";
5
5
  import { decoder } from "./buffer_utils.js";
6
6
  import { prepareKey } from "./key.js";
7
7
  import { JWE, isJWECEKTransport, jweAlgorithm, jweEncryption } from "./jwe_algorithms.js";
@@ -69,12 +69,17 @@ function shareJWE(jwe) {
69
69
  ];
70
70
  }
71
71
  function prepareDecrypt(options) {
72
+ const keyManagementAlgorithms = options && validateAlgorithms("keyManagementAlgorithms", options.keyManagementAlgorithms), contentEncryptionAlgorithms = options && validateAlgorithms("contentEncryptionAlgorithms", options.contentEncryptionAlgorithms), { crit, maxPBES2Count, maxDecompressedLength } = options ?? {};
73
+ validateMaxPBES2Count(maxPBES2Count);
74
+ const decompressionLimit = maxDecompressedLength ?? 25e4;
75
+ if (decompressionLimit !== 0 && decompressionLimit !== 1 / 0 && (!Number.isSafeInteger(decompressionLimit) || decompressionLimit < 1))
76
+ throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");
72
77
  return [
73
- options && validateAlgorithms("keyManagementAlgorithms", options.keyManagementAlgorithms),
74
- options && validateAlgorithms("contentEncryptionAlgorithms", options.contentEncryptionAlgorithms),
75
- options?.crit,
76
- options?.maxPBES2Count,
77
- options?.maxDecompressedLength
78
+ keyManagementAlgorithms,
79
+ contentEncryptionAlgorithms,
80
+ crit,
81
+ maxPBES2Count,
82
+ maxDecompressedLength
78
83
  ];
79
84
  }
80
85
  async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
@@ -145,8 +150,6 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
145
150
  const decompressionLimit = maxDecompressedLength ?? 25e4;
146
151
  if (decompressionLimit === 0)
147
152
  throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
148
- if (decompressionLimit !== 1 / 0 && (!Number.isSafeInteger(decompressionLimit) || decompressionLimit < 1))
149
- throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");
150
153
  plaintext = await decompress(plaintext, decompressionLimit).catch((cause) => {
151
154
  throw cause instanceof JWEInvalid ? cause : new JWEInvalid("Failed to decompress plaintext", { cause });
152
155
  });
@@ -111,7 +111,6 @@ async function decryptKeyManagement(entry, enc, key, encryptedKey, joseHeader, m
111
111
  case "PBKDF2": {
112
112
  if (typeof joseHeader.p2c != "number")
113
113
  throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');
114
- validateMaxPBES2Count(maxPBES2Count);
115
114
  const p2cLimit = maxPBES2Count ?? 1e4;
116
115
  if (joseHeader.p2c > p2cLimit)
117
116
  throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.15",
3
+ "version": "6.2.16",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",