agent-relay 4.0.32 → 4.0.34

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 (226) hide show
  1. package/bin/agent-relay-broker-darwin-arm64 +0 -0
  2. package/bin/agent-relay-broker-darwin-x64 +0 -0
  3. package/bin/agent-relay-broker-linux-arm64 +0 -0
  4. package/bin/agent-relay-broker-linux-x64 +0 -0
  5. package/dist/index.cjs +1 -3
  6. package/dist/src/cli/commands/on/start.d.ts.map +1 -1
  7. package/dist/src/cli/commands/on/start.js +149 -111
  8. package/dist/src/cli/commands/on/start.js.map +1 -1
  9. package/dist/src/cli/commands/setup.js +2 -2
  10. package/dist/src/cli/commands/setup.js.map +1 -1
  11. package/node_modules/@agent-relay/cloud/package.json +2 -2
  12. package/node_modules/@agent-relay/config/package.json +1 -1
  13. package/node_modules/@agent-relay/hooks/package.json +4 -4
  14. package/node_modules/@agent-relay/sdk/dist/workflows/runner.d.ts.map +1 -1
  15. package/node_modules/@agent-relay/sdk/dist/workflows/runner.js +7 -5
  16. package/node_modules/@agent-relay/sdk/dist/workflows/runner.js.map +1 -1
  17. package/node_modules/@agent-relay/sdk/package.json +2 -2
  18. package/node_modules/@agent-relay/telemetry/dist/config.d.ts +1 -1
  19. package/node_modules/@agent-relay/telemetry/dist/config.d.ts.map +1 -1
  20. package/node_modules/@agent-relay/telemetry/dist/config.js +6 -3
  21. package/node_modules/@agent-relay/telemetry/dist/config.js.map +1 -1
  22. package/node_modules/@agent-relay/telemetry/package.json +1 -1
  23. package/node_modules/@agent-relay/trajectory/package.json +2 -2
  24. package/node_modules/@agent-relay/user-directory/package.json +2 -2
  25. package/node_modules/@agent-relay/utils/package.json +2 -2
  26. package/node_modules/@aws-sdk/core/dist-cjs/index.js +18 -10
  27. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +18 -10
  28. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +6 -4
  29. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +6 -3
  30. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +2 -1
  31. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +2 -1
  32. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -2
  33. package/node_modules/@aws-sdk/core/package.json +1 -1
  34. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  35. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  36. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  37. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  38. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  39. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  40. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  41. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  42. package/node_modules/@aws-sdk/middleware-flexible-checksums/package.json +2 -2
  43. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +2 -2
  44. package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
  45. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/endpoint/bdd.js +100 -0
  46. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/endpoint/endpointResolver.js +2 -2
  47. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/bdd.js +90 -0
  48. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/endpointResolver.js +2 -2
  49. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/bdd.js +80 -0
  50. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/endpointResolver.js +2 -2
  51. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/bdd.js +80 -0
  52. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/endpointResolver.js +2 -2
  53. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/STSClient.js +1 -0
  54. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/auth/httpAuthSchemeProvider.js +87 -5
  55. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/bdd.js +150 -0
  56. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/endpointResolver.js +2 -2
  57. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.js +6 -0
  58. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.shared.js +7 -0
  59. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/bdd.js +97 -0
  60. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/endpointResolver.js +3 -3
  61. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +87 -0
  62. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +3 -3
  63. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/bdd.js +77 -0
  64. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/endpointResolver.js +3 -3
  65. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/bdd.js +77 -0
  66. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/endpointResolver.js +3 -3
  67. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/STSClient.js +1 -0
  68. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/auth/httpAuthSchemeProvider.js +88 -4
  69. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/bdd.js +147 -0
  70. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/endpointResolver.js +3 -3
  71. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +7 -1
  72. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.shared.js +8 -1
  73. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/endpoint/bdd.d.ts +2 -0
  74. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/bdd.d.ts +2 -0
  75. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/endpoint/bdd.d.ts +2 -0
  76. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/endpoint/bdd.d.ts +2 -0
  77. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/auth/httpAuthSchemeProvider.d.ts +15 -7
  78. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/endpoint/bdd.d.ts +2 -0
  79. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.browser.d.ts +3 -2
  80. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +10 -4
  81. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.native.d.ts +3 -2
  82. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.shared.d.ts +3 -1
  83. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/endpoint/bdd.d.ts +2 -0
  84. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/bdd.d.ts +2 -0
  85. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/endpoint/bdd.d.ts +2 -0
  86. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/endpoint/bdd.d.ts +2 -0
  87. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/auth/httpAuthSchemeProvider.d.ts +20 -9
  88. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/endpoint/bdd.d.ts +2 -0
  89. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.browser.d.ts +11 -5
  90. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +35 -16
  91. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.native.d.ts +11 -5
  92. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.shared.d.ts +8 -1
  93. package/node_modules/@aws-sdk/nested-clients/package.json +5 -4
  94. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  95. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  96. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  97. package/node_modules/@relayfile/local-mount/README.md +215 -0
  98. package/node_modules/@relayfile/local-mount/dist/auto-sync.d.ts +31 -0
  99. package/node_modules/@relayfile/local-mount/dist/auto-sync.js +466 -0
  100. package/node_modules/@relayfile/local-mount/dist/dotfiles.d.ts +18 -0
  101. package/node_modules/@relayfile/local-mount/dist/dotfiles.js +43 -0
  102. package/node_modules/@relayfile/local-mount/dist/index.d.ts +4 -0
  103. package/node_modules/@relayfile/local-mount/dist/index.js +3 -0
  104. package/node_modules/@relayfile/local-mount/dist/launch.d.ts +50 -0
  105. package/node_modules/@relayfile/local-mount/dist/launch.js +129 -0
  106. package/node_modules/@relayfile/local-mount/dist/symlink-mount.d.ts +23 -0
  107. package/{dist/src/cli/commands/on → node_modules/@relayfile/local-mount/dist}/symlink-mount.js +88 -20
  108. package/node_modules/@relayfile/local-mount/node_modules/chokidar/LICENSE +21 -0
  109. package/node_modules/@relayfile/local-mount/node_modules/chokidar/README.md +305 -0
  110. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/handler.d.ts +90 -0
  111. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/handler.js +629 -0
  112. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/index.d.ts +215 -0
  113. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/index.js +798 -0
  114. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/package.json +1 -0
  115. package/node_modules/@relayfile/local-mount/node_modules/chokidar/handler.d.ts +90 -0
  116. package/node_modules/@relayfile/local-mount/node_modules/chokidar/handler.js +635 -0
  117. package/node_modules/@relayfile/local-mount/node_modules/chokidar/index.d.ts +215 -0
  118. package/node_modules/@relayfile/local-mount/node_modules/chokidar/index.js +804 -0
  119. package/node_modules/@relayfile/local-mount/node_modules/chokidar/package.json +69 -0
  120. package/node_modules/@relayfile/local-mount/node_modules/readdirp/LICENSE +21 -0
  121. package/node_modules/@relayfile/local-mount/node_modules/readdirp/README.md +120 -0
  122. package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/index.d.ts +108 -0
  123. package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/index.js +257 -0
  124. package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/package.json +1 -0
  125. package/node_modules/@relayfile/local-mount/node_modules/readdirp/index.d.ts +108 -0
  126. package/node_modules/@relayfile/local-mount/node_modules/readdirp/index.js +263 -0
  127. package/node_modules/@relayfile/local-mount/node_modules/readdirp/package.json +70 -0
  128. package/node_modules/@relayfile/local-mount/package.json +47 -0
  129. package/node_modules/@smithy/config-resolver/package.json +2 -2
  130. package/node_modules/@smithy/core/dist-cjs/index.js +2 -1
  131. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +32 -14
  132. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +2 -2
  133. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +16 -8
  134. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +17 -10
  135. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +6 -1
  136. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +6 -3
  137. package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
  138. package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +23 -11
  139. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +9 -3
  140. package/node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js +2 -2
  141. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +16 -8
  142. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +9 -4
  143. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +8 -6
  144. package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +6 -1
  145. package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +6 -3
  146. package/node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
  147. package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
  148. package/node_modules/@smithy/core/package.json +2 -2
  149. package/node_modules/@smithy/middleware-endpoint/package.json +3 -3
  150. package/node_modules/@smithy/middleware-retry/package.json +5 -5
  151. package/node_modules/@smithy/middleware-serde/package.json +2 -2
  152. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +188 -93
  153. package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +45 -0
  154. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +71 -35
  155. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -18
  156. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +41 -40
  157. package/node_modules/@smithy/node-http-handler/dist-types/http2/ClientHttp2SessionRef.d.ts +42 -0
  158. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +34 -14
  159. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +32 -8
  160. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -5
  161. package/node_modules/@smithy/node-http-handler/package.json +1 -1
  162. package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +5 -0
  163. package/node_modules/@smithy/service-error-classification/dist-es/index.js +4 -0
  164. package/node_modules/@smithy/service-error-classification/dist-types/index.d.ts +6 -0
  165. package/node_modules/@smithy/service-error-classification/package.json +1 -1
  166. package/node_modules/@smithy/smithy-client/package.json +4 -4
  167. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  168. package/node_modules/@smithy/util-defaults-mode-node/package.json +3 -3
  169. package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +65 -53
  170. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js +9 -7
  171. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js +12 -8
  172. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js +14 -13
  173. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js +7 -4
  174. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js +10 -8
  175. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js +4 -4
  176. package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js +5 -5
  177. package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js +4 -4
  178. package/node_modules/@smithy/util-endpoints/dist-types/types/shared.d.ts +3 -3
  179. package/node_modules/@smithy/util-endpoints/dist-types/utils/endpointFunctions.d.ts +2 -15
  180. package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateCondition.d.ts +6 -3
  181. package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateConditions.d.ts +3 -3
  182. package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointHeaders.d.ts +1 -1
  183. package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointProperties.d.ts +2 -2
  184. package/node_modules/@smithy/util-endpoints/dist-types/utils/getReferenceValue.d.ts +2 -2
  185. package/node_modules/@smithy/util-endpoints/package.json +1 -1
  186. package/node_modules/@smithy/util-retry/package.json +2 -2
  187. package/node_modules/@smithy/util-stream/package.json +2 -2
  188. package/package.json +25 -11
  189. package/packages/cloud/package.json +2 -2
  190. package/packages/config/package.json +1 -1
  191. package/packages/hooks/package.json +4 -4
  192. package/packages/sdk/dist/workflows/runner.d.ts.map +1 -1
  193. package/packages/sdk/dist/workflows/runner.js +7 -5
  194. package/packages/sdk/dist/workflows/runner.js.map +1 -1
  195. package/packages/sdk/package.json +2 -2
  196. package/packages/telemetry/dist/config.d.ts +1 -1
  197. package/packages/telemetry/dist/config.d.ts.map +1 -1
  198. package/packages/telemetry/dist/config.js +6 -3
  199. package/packages/telemetry/dist/config.js.map +1 -1
  200. package/packages/telemetry/package.json +1 -1
  201. package/packages/trajectory/package.json +2 -2
  202. package/packages/user-directory/package.json +2 -2
  203. package/packages/utils/package.json +2 -2
  204. package/dist/src/cli/commands/on/symlink-mount.d.ts +0 -12
  205. package/dist/src/cli/commands/on/symlink-mount.d.ts.map +0 -1
  206. package/dist/src/cli/commands/on/symlink-mount.js.map +0 -1
  207. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/endpoint/ruleset.js +0 -146
  208. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/ruleset.js +0 -133
  209. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/ruleset.js +0 -106
  210. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/ruleset.js +0 -106
  211. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/ruleset.js +0 -145
  212. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/ruleset.js +0 -143
  213. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/ruleset.js +0 -130
  214. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/ruleset.js +0 -103
  215. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/ruleset.js +0 -103
  216. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/ruleset.js +0 -142
  217. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/endpoint/ruleset.d.ts +0 -2
  218. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/ruleset.d.ts +0 -2
  219. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/endpoint/ruleset.d.ts +0 -2
  220. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/endpoint/ruleset.d.ts +0 -2
  221. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/endpoint/ruleset.d.ts +0 -2
  222. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/endpoint/ruleset.d.ts +0 -2
  223. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/ruleset.d.ts +0 -2
  224. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/endpoint/ruleset.d.ts +0 -2
  225. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/endpoint/ruleset.d.ts +0 -2
  226. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/endpoint/ruleset.d.ts +0 -2
@@ -36,12 +36,14 @@ export class NodeHttp2Handler {
36
36
  async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
37
37
  if (!this.config) {
38
38
  this.config = await this.configProvider;
39
- this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams ?? false);
40
- if (this.config.maxConcurrentStreams) {
41
- this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams);
39
+ const { disableConcurrentStreams, maxConcurrentStreams } = this.config;
40
+ this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
41
+ if (maxConcurrentStreams) {
42
+ this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
42
43
  }
43
44
  }
44
45
  const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
46
+ const useIsolatedSession = disableConcurrentStreams || isEventStream;
45
47
  const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
46
48
  return new Promise((_resolve, _reject) => {
47
49
  let fulfilled = false;
@@ -69,13 +71,17 @@ export class NodeHttp2Handler {
69
71
  }
70
72
  const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
71
73
  const requestContext = { destination: new URL(authority) };
72
- const session = this.connectionManager.lease(requestContext, {
74
+ const connectConfig = {
73
75
  requestTimeout: this.config?.sessionTimeout,
74
76
  isEventStream,
75
- });
77
+ };
78
+ const ref = useIsolatedSession
79
+ ? this.connectionManager.createIsolatedSession(requestContext, connectConfig)
80
+ : this.connectionManager.lease(requestContext, connectConfig);
81
+ const session = ref.deref();
76
82
  const rejectWithDestroy = (err) => {
77
- if (disableConcurrentStreams) {
78
- this.destroySession(session);
83
+ if (useIsolatedSession) {
84
+ ref.destroy();
79
85
  }
80
86
  fulfilled = true;
81
87
  reject(err);
@@ -88,28 +94,14 @@ export class NodeHttp2Handler {
88
94
  if (request.fragment) {
89
95
  path += `#${request.fragment}`;
90
96
  }
91
- const req = session.request({
97
+ const clientHttp2Stream = session.request({
92
98
  ...request.headers,
93
99
  [constants.HTTP2_HEADER_PATH]: path,
94
100
  [constants.HTTP2_HEADER_METHOD]: method,
95
101
  });
96
- session.ref();
97
- req.on("response", (headers) => {
98
- const httpResponse = new HttpResponse({
99
- statusCode: headers[":status"] ?? -1,
100
- headers: getTransformedHeaders(headers),
101
- body: req,
102
- });
103
- fulfilled = true;
104
- resolve({ response: httpResponse });
105
- if (disableConcurrentStreams) {
106
- session.close();
107
- this.connectionManager.deleteSession(authority, session);
108
- }
109
- });
110
102
  if (effectiveRequestTimeout) {
111
- req.setTimeout(effectiveRequestTimeout, () => {
112
- req.close();
103
+ clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
104
+ clientHttp2Stream.close();
113
105
  const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
114
106
  timeoutError.name = "TimeoutError";
115
107
  rejectWithDestroy(timeoutError);
@@ -117,36 +109,50 @@ export class NodeHttp2Handler {
117
109
  }
118
110
  if (abortSignal) {
119
111
  const onAbort = () => {
120
- req.close();
112
+ clientHttp2Stream.close();
121
113
  const abortError = buildAbortError(abortSignal);
122
114
  rejectWithDestroy(abortError);
123
115
  };
124
116
  if (typeof abortSignal.addEventListener === "function") {
125
117
  const signal = abortSignal;
126
118
  signal.addEventListener("abort", onAbort, { once: true });
127
- req.once("close", () => signal.removeEventListener("abort", onAbort));
119
+ clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
128
120
  }
129
121
  else {
130
122
  abortSignal.onabort = onAbort;
131
123
  }
132
124
  }
133
- req.on("frameError", (type, code, id) => {
125
+ clientHttp2Stream.on("frameError", (type, code, id) => {
134
126
  rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
135
127
  });
136
- req.on("error", rejectWithDestroy);
137
- req.on("aborted", () => {
138
- rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`));
128
+ clientHttp2Stream.on("error", rejectWithDestroy);
129
+ clientHttp2Stream.on("aborted", () => {
130
+ rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
131
+ });
132
+ clientHttp2Stream.on("response", (headers) => {
133
+ const httpResponse = new HttpResponse({
134
+ statusCode: headers[":status"] ?? -1,
135
+ headers: getTransformedHeaders(headers),
136
+ body: clientHttp2Stream,
137
+ });
138
+ fulfilled = true;
139
+ resolve({ response: httpResponse });
140
+ if (useIsolatedSession) {
141
+ session.close();
142
+ }
139
143
  });
140
- req.on("close", () => {
141
- session.unref();
142
- if (disableConcurrentStreams) {
143
- session.destroy();
144
+ clientHttp2Stream.on("close", () => {
145
+ if (useIsolatedSession) {
146
+ ref.destroy();
147
+ }
148
+ else {
149
+ this.connectionManager.release(requestContext, ref);
144
150
  }
145
151
  if (!fulfilled) {
146
152
  rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"));
147
153
  }
148
154
  });
149
- writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout);
155
+ writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
150
156
  });
151
157
  }
152
158
  updateHttpClientConfig(key, value) {
@@ -161,9 +167,4 @@ export class NodeHttp2Handler {
161
167
  httpHandlerConfigs() {
162
168
  return this.config ?? {};
163
169
  }
164
- destroySession(session) {
165
- if (!session.destroyed) {
166
- session.destroy();
167
- }
168
- }
169
170
  }
@@ -0,0 +1,42 @@
1
+ import type { ClientHttp2Session } from "node:http2";
2
+ /**
3
+ * Shared access ref counter for ClientHttp2Session, where owners are
4
+ * in-flight requests.
5
+ *
6
+ * @internal
7
+ * @since 4.6.0
8
+ */
9
+ export declare class ClientHttp2SessionRef {
10
+ readonly id: number;
11
+ /**
12
+ * Total calls to retain for this session.
13
+ */
14
+ total: number;
15
+ /**
16
+ * Max ref count observed.
17
+ */
18
+ max: number;
19
+ private readonly session;
20
+ private refs;
21
+ constructor(session: ClientHttp2Session);
22
+ /**
23
+ * Signal that the session is entering a request span and has an additional owning request.
24
+ * This must be called when beginning a request using the session.
25
+ */
26
+ retain(): void;
27
+ /**
28
+ * Release reference to session, to be called when it exits request span, indicating one fewer owning request.
29
+ * When reaching zero, the session is unref'd.
30
+ * This must be called when concluding a request using the session.
31
+ */
32
+ free(): void;
33
+ /**
34
+ * Access the session (don't call ref/unref on it).
35
+ */
36
+ deref(): ClientHttp2Session;
37
+ destroy(): void;
38
+ /**
39
+ * @returns the current number of active references (in-flight requests).
40
+ */
41
+ useCount(): number;
42
+ }
@@ -1,24 +1,44 @@
1
- import type { RequestContext } from "@smithy/types";
2
- import type { ConnectConfiguration } from "@smithy/types";
3
- import type { ConnectionManager, ConnectionManagerConfiguration } from "@smithy/types";
4
- import type { ClientHttp2Session } from "node:http2";
1
+ import type { ConnectConfiguration, ConnectionManager, ConnectionManagerConfiguration, RequestContext } from "@smithy/types";
2
+ import { ClientHttp2SessionRef } from "./http2/ClientHttp2SessionRef";
5
3
  /**
6
- * @public
4
+ * This class previously implemented the ConnectionManager<ClientHttp2Session> interface,
5
+ * but this class isn't exported from this package, except as a private property of NodeHttp2Handler.
6
+ *
7
+ * @since 4.6.0
8
+ * @internal
7
9
  */
8
- export declare class NodeHttp2ConnectionManager implements ConnectionManager<ClientHttp2Session> {
9
- constructor(config: ConnectionManagerConfiguration);
10
+ export declare class NodeHttp2ConnectionManager implements ConnectionManager<ClientHttp2SessionRef> {
10
11
  private config;
11
- private readonly sessionCache;
12
- lease(requestContext: RequestContext, connectionConfiguration: ConnectConfiguration): ClientHttp2Session;
12
+ private readonly connectionPools;
13
+ constructor(config: ConnectionManagerConfiguration);
14
+ /**
15
+ * Acquire a session for making a request.
16
+ */
17
+ lease(requestContext: RequestContext, connectionConfiguration: ConnectConfiguration): ClientHttp2SessionRef;
18
+ /**
19
+ * Signal that a request using this session has completed.
20
+ *
21
+ * The session remains in its pool for reuse.
22
+ * This method is not called for isolated sessions.
23
+ */
24
+ release(_requestContext: RequestContext, ref: ClientHttp2SessionRef): void;
13
25
  /**
14
- * Delete a session from the connection pool.
15
- * @param authority The authority of the session to delete.
16
- * @param session The session to delete.
26
+ * Create an isolated session that isn't part of the connection pools.
27
+ * For use in event-streams or when concurrency is turned off.
17
28
  */
18
- deleteSession(authority: string, session: ClientHttp2Session): void;
19
- release(requestContext: RequestContext, session: ClientHttp2Session): void;
29
+ createIsolatedSession(requestContext: RequestContext, connectionConfiguration: ConnectConfiguration): ClientHttp2SessionRef;
20
30
  destroy(): void;
21
31
  setMaxConcurrentStreams(maxConcurrentStreams: number): void;
22
32
  setDisableConcurrentStreams(disableConcurrentStreams: boolean): void;
33
+ /**
34
+ * @internal
35
+ * @returns a snapshot of the state of all connection pools and their sessions.
36
+ */
37
+ debug(): Record<string, any>;
38
+ /**
39
+ * Remove a session from the pools. Does not destroy it.
40
+ */
41
+ private removeFromPool;
42
+ private getPool;
23
43
  private getUrlString;
24
44
  }
@@ -1,12 +1,36 @@
1
1
  import type { ConnectionPool } from "@smithy/types";
2
2
  import type { ClientHttp2Session } from "node:http2";
3
- export declare class NodeHttp2ConnectionPool implements ConnectionPool<ClientHttp2Session> {
4
- private sessions;
3
+ import { ClientHttp2SessionRef } from "./http2/ClientHttp2SessionRef";
4
+ /**
5
+ * These are keyed by URL, therefore all sessions within this class' state
6
+ * are for the same URL.
7
+ *
8
+ * Sessions remain in the pool for their entire lifetime (until destroyed or
9
+ * removed). The pool tracks capacity via each session's ref count.
10
+ *
11
+ * Interface implementation changed from ConnectionPool<ClientHttp2Session>.
12
+ * @since 4.6.0
13
+ * @internal
14
+ */
15
+ export declare class NodeHttp2ConnectionPool implements ConnectionPool<ClientHttp2SessionRef> {
16
+ private readonly sessions;
17
+ private maxConcurrency;
5
18
  constructor(sessions?: ClientHttp2Session[]);
6
- poll(): ClientHttp2Session | void;
7
- offerLast(session: ClientHttp2Session): void;
8
- contains(session: ClientHttp2Session): boolean;
9
- remove(session: ClientHttp2Session): void;
10
- [Symbol.iterator](): ArrayIterator<ClientHttp2Session>;
11
- destroy(connection: ClientHttp2Session): void;
19
+ /**
20
+ * Find a session with available capacity (refs < maxConcurrency).
21
+ * Returns undefined if all sessions are at capacity or the pool is empty.
22
+ */
23
+ poll(): ClientHttp2SessionRef | undefined;
24
+ /**
25
+ * Add a session to the pool.
26
+ */
27
+ offerLast(ref: ClientHttp2SessionRef): void;
28
+ remove(ref: ClientHttp2SessionRef): void;
29
+ [Symbol.iterator](): ArrayIterator<ClientHttp2SessionRef>;
30
+ setMaxConcurrency(maxConcurrency: number): void;
31
+ /**
32
+ * This is unused, but part of the interface.
33
+ * @deprecated
34
+ */
35
+ destroy(ref: ClientHttp2SessionRef): void;
12
36
  }
@@ -67,10 +67,5 @@ export declare class NodeHttp2Handler implements HttpHandler<NodeHttp2HandlerOpt
67
67
  }>;
68
68
  updateHttpClientConfig(key: keyof NodeHttp2HandlerOptions, value: NodeHttp2HandlerOptions[typeof key]): void;
69
69
  httpHandlerConfigs(): NodeHttp2HandlerOptions;
70
- /**
71
- * Destroys a session.
72
- * @param session - the session to destroy.
73
- */
74
- private destroySession;
75
70
  }
76
71
  export {};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/node-http-handler",
3
- "version": "4.5.3",
3
+ "version": "4.6.0",
4
4
  "description": "Provides a way to make requests",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
@@ -56,6 +56,7 @@ const isTransientError = (error, depth = 0) => isRetryableByTrait(error) ||
56
56
  NODEJS_NETWORK_ERROR_CODES.includes(error?.code || "") ||
57
57
  TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) ||
58
58
  isBrowserNetworkError(error) ||
59
+ isNodeJsHttp2TransientError(error) ||
59
60
  (error.cause !== undefined && depth <= 10 && isTransientError(error.cause, depth + 1));
60
61
  const isServerError = (error) => {
61
62
  if (error.$metadata?.httpStatusCode !== undefined) {
@@ -67,10 +68,14 @@ const isServerError = (error) => {
67
68
  }
68
69
  return false;
69
70
  };
71
+ function isNodeJsHttp2TransientError(error) {
72
+ return error.code === "ERR_HTTP2_STREAM_ERROR" && error.message.includes("NGHTTP2_REFUSED_STREAM");
73
+ }
70
74
 
71
75
  exports.isBrowserNetworkError = isBrowserNetworkError;
72
76
  exports.isClockSkewCorrectedError = isClockSkewCorrectedError;
73
77
  exports.isClockSkewError = isClockSkewError;
78
+ exports.isNodeJsHttp2TransientError = isNodeJsHttp2TransientError;
74
79
  exports.isRetryableByTrait = isRetryableByTrait;
75
80
  exports.isServerError = isServerError;
76
81
  exports.isThrottlingError = isThrottlingError;
@@ -26,6 +26,7 @@ export const isTransientError = (error, depth = 0) => isRetryableByTrait(error)
26
26
  NODEJS_NETWORK_ERROR_CODES.includes(error?.code || "") ||
27
27
  TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) ||
28
28
  isBrowserNetworkError(error) ||
29
+ isNodeJsHttp2TransientError(error) ||
29
30
  (error.cause !== undefined && depth <= 10 && isTransientError(error.cause, depth + 1));
30
31
  export const isServerError = (error) => {
31
32
  if (error.$metadata?.httpStatusCode !== undefined) {
@@ -37,3 +38,6 @@ export const isServerError = (error) => {
37
38
  }
38
39
  return false;
39
40
  };
41
+ export function isNodeJsHttp2TransientError(error) {
42
+ return error.code === "ERR_HTTP2_STREAM_ERROR" && error.message.includes("NGHTTP2_REFUSED_STREAM");
43
+ }
@@ -22,3 +22,9 @@ export declare const isThrottlingError: (error: SdkError) => boolean;
22
22
  */
23
23
  export declare const isTransientError: (error: SdkError, depth?: number) => boolean;
24
24
  export declare const isServerError: (error: SdkError) => boolean;
25
+ /**
26
+ * @internal
27
+ */
28
+ export declare function isNodeJsHttp2TransientError(error: Error & {
29
+ code?: string;
30
+ }): boolean;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/service-error-classification",
3
- "version": "4.2.14",
3
+ "version": "4.3.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
6
  "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline service-error-classification",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/smithy-client",
3
- "version": "4.12.11",
3
+ "version": "4.12.12",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
6
  "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline smithy-client",
@@ -26,12 +26,12 @@
26
26
  "license": "Apache-2.0",
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@smithy/core": "^3.23.15",
30
- "@smithy/middleware-endpoint": "^4.4.30",
29
+ "@smithy/core": "^3.23.16",
30
+ "@smithy/middleware-endpoint": "^4.4.31",
31
31
  "@smithy/middleware-stack": "^4.2.14",
32
32
  "@smithy/protocol-http": "^5.3.14",
33
33
  "@smithy/types": "^4.14.1",
34
- "@smithy/util-stream": "^4.5.23",
34
+ "@smithy/util-stream": "^4.5.24",
35
35
  "tslib": "^2.6.2"
36
36
  },
37
37
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-defaults-mode-browser",
3
- "version": "4.3.47",
3
+ "version": "4.3.48",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
6
  "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline util-defaults-mode-browser",
@@ -24,7 +24,7 @@
24
24
  "sideEffects": false,
25
25
  "dependencies": {
26
26
  "@smithy/property-provider": "^4.2.14",
27
- "@smithy/smithy-client": "^4.12.11",
27
+ "@smithy/smithy-client": "^4.12.12",
28
28
  "@smithy/types": "^4.14.1",
29
29
  "tslib": "^2.6.2"
30
30
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-defaults-mode-node",
3
- "version": "4.2.52",
3
+ "version": "4.2.53",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
6
6
  "build:es:cjs": "yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline util-defaults-mode-node",
@@ -23,11 +23,11 @@
23
23
  "license": "Apache-2.0",
24
24
  "sideEffects": false,
25
25
  "dependencies": {
26
- "@smithy/config-resolver": "^4.4.16",
26
+ "@smithy/config-resolver": "^4.4.17",
27
27
  "@smithy/credential-provider-imds": "^4.2.14",
28
28
  "@smithy/node-config-provider": "^4.3.14",
29
29
  "@smithy/property-provider": "^4.2.14",
30
- "@smithy/smithy-client": "^4.12.11",
30
+ "@smithy/smithy-client": "^4.12.12",
31
31
  "@smithy/types": "^4.14.1",
32
32
  "tslib": "^2.6.2"
33
33
  },
@@ -318,50 +318,54 @@ const callFunction = ({ fn, argv }, options) => {
318
318
  evaluatedArgs[i] = group$2.evaluateExpression(arg, "arg", options);
319
319
  }
320
320
  }
321
- if (fn.includes(".")) {
322
- const fnSegments = fn.split(".");
323
- if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) {
324
- return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
321
+ const namespaceSeparatorIndex = fn.indexOf(".");
322
+ if (namespaceSeparatorIndex !== -1) {
323
+ const namespaceFunctions = customEndpointFunctions[fn.slice(0, namespaceSeparatorIndex)];
324
+ const customFunction = namespaceFunctions?.[fn.slice(namespaceSeparatorIndex + 1)];
325
+ if (typeof customFunction === "function") {
326
+ return customFunction(...evaluatedArgs);
325
327
  }
326
328
  }
327
- if (typeof endpointFunctions[fn] !== "function") {
328
- throw new Error(`function ${fn} not loaded in endpointFunctions.`);
329
- }
330
329
  const callable = endpointFunctions[fn];
331
- return callable(...evaluatedArgs);
330
+ if (typeof callable === "function") {
331
+ return callable(...evaluatedArgs);
332
+ }
333
+ throw new Error(`function ${fn} not loaded in endpointFunctions.`);
332
334
  };
333
335
  const group$2 = {
334
336
  evaluateExpression,
335
337
  callFunction,
336
338
  };
337
339
 
338
- const evaluateCondition = ({ assign, ...fnArgs }, options) => {
340
+ const evaluateCondition = (condition, options) => {
341
+ const { assign } = condition;
339
342
  if (assign && assign in options.referenceRecord) {
340
343
  throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
341
344
  }
342
- const value = callFunction(fnArgs, options);
343
- options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`);
344
- return {
345
- result: value === "" ? true : !!value,
346
- ...(assign != null && { toAssign: { name: assign, value } }),
347
- };
345
+ const value = callFunction(condition, options);
346
+ options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(condition)} = ${toDebugString(value)}`);
347
+ const result = value === "" ? true : !!value;
348
+ if (assign != null) {
349
+ return { result, toAssign: { name: assign, value } };
350
+ }
351
+ return { result };
348
352
  };
349
353
 
350
- const getEndpointHeaders = (headers, options) => Object.entries(headers ?? {}).reduce((acc, [headerKey, headerVal]) => ({
351
- ...acc,
352
- [headerKey]: headerVal.map((headerValEntry) => {
354
+ const getEndpointHeaders = (headers, options) => Object.entries(headers ?? {}).reduce((acc, [headerKey, headerVal]) => {
355
+ acc[headerKey] = headerVal.map((headerValEntry) => {
353
356
  const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options);
354
357
  if (typeof processedExpr !== "string") {
355
358
  throw new EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
356
359
  }
357
360
  return processedExpr;
358
- }),
359
- }), {});
361
+ });
362
+ return acc;
363
+ }, {});
360
364
 
361
- const getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
362
- ...acc,
363
- [propertyKey]: group$1.getEndpointProperty(propertyVal, options),
364
- }), {});
365
+ const getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => {
366
+ acc[propertyKey] = group$1.getEndpointProperty(propertyVal, options);
367
+ return acc;
368
+ }, {});
365
369
  const getEndpointProperty = (property, options) => {
366
370
  if (Array.isArray(property)) {
367
371
  return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
@@ -438,23 +442,27 @@ const decideEndpoint = (bdd, options) => {
438
442
 
439
443
  const evaluateConditions = (conditions = [], options) => {
440
444
  const conditionsReferenceRecord = {};
445
+ const conditionOptions = {
446
+ ...options,
447
+ referenceRecord: { ...options.referenceRecord },
448
+ };
449
+ let didAssign = false;
441
450
  for (const condition of conditions) {
442
- const { result, toAssign } = evaluateCondition(condition, {
443
- ...options,
444
- referenceRecord: {
445
- ...options.referenceRecord,
446
- ...conditionsReferenceRecord,
447
- },
448
- });
451
+ const { result, toAssign } = evaluateCondition(condition, conditionOptions);
449
452
  if (!result) {
450
453
  return { result };
451
454
  }
452
455
  if (toAssign) {
456
+ didAssign = true;
453
457
  conditionsReferenceRecord[toAssign.name] = toAssign.value;
458
+ conditionOptions.referenceRecord[toAssign.name] = toAssign.value;
454
459
  options.logger?.debug?.(`${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`);
455
460
  }
456
461
  }
457
- return { result: true, referenceRecord: conditionsReferenceRecord };
462
+ if (didAssign) {
463
+ return { result: true, referenceRecord: conditionsReferenceRecord };
464
+ }
465
+ return { result: true };
458
466
  };
459
467
 
460
468
  const evaluateEndpointRule = (endpointRule, options) => {
@@ -463,21 +471,22 @@ const evaluateEndpointRule = (endpointRule, options) => {
463
471
  if (!result) {
464
472
  return;
465
473
  }
466
- const endpointRuleOptions = {
467
- ...options,
468
- referenceRecord: { ...options.referenceRecord, ...referenceRecord },
469
- };
474
+ const endpointRuleOptions = referenceRecord
475
+ ? {
476
+ ...options,
477
+ referenceRecord: { ...options.referenceRecord, ...referenceRecord },
478
+ }
479
+ : options;
470
480
  const { url, properties, headers } = endpoint;
471
481
  options.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`);
472
- return {
473
- ...(headers != undefined && {
474
- headers: getEndpointHeaders(headers, endpointRuleOptions),
475
- }),
476
- ...(properties != undefined && {
477
- properties: getEndpointProperties(properties, endpointRuleOptions),
478
- }),
479
- url: getEndpointUrl(url, endpointRuleOptions),
480
- };
482
+ const endpointToReturn = { url: getEndpointUrl(url, endpointRuleOptions) };
483
+ if (headers != null) {
484
+ endpointToReturn.headers = getEndpointHeaders(headers, endpointRuleOptions);
485
+ }
486
+ if (properties != null) {
487
+ endpointToReturn.properties = getEndpointProperties(properties, endpointRuleOptions);
488
+ }
489
+ return endpointToReturn;
481
490
  };
482
491
 
483
492
  const evaluateErrorRule = (errorRule, options) => {
@@ -486,10 +495,13 @@ const evaluateErrorRule = (errorRule, options) => {
486
495
  if (!result) {
487
496
  return;
488
497
  }
489
- throw new EndpointError(evaluateExpression(error, "Error", {
490
- ...options,
491
- referenceRecord: { ...options.referenceRecord, ...referenceRecord },
492
- }));
498
+ const errorRuleOptions = referenceRecord
499
+ ? {
500
+ ...options,
501
+ referenceRecord: { ...options.referenceRecord, ...referenceRecord },
502
+ }
503
+ : options;
504
+ throw new EndpointError(evaluateExpression(error, "Error", errorRuleOptions));
493
505
  };
494
506
 
495
507
  const evaluateRules = (rules, options) => {
@@ -521,10 +533,10 @@ const evaluateTreeRule = (treeRule, options) => {
521
533
  if (!result) {
522
534
  return;
523
535
  }
524
- return group.evaluateRules(rules, {
525
- ...options,
526
- referenceRecord: { ...options.referenceRecord, ...referenceRecord },
527
- });
536
+ const treeRuleOptions = referenceRecord
537
+ ? { ...options, referenceRecord: { ...options.referenceRecord, ...referenceRecord } }
538
+ : options;
539
+ return group.evaluateRules(rules, treeRuleOptions);
528
540
  };
529
541
  const group = {
530
542
  evaluateRules,
@@ -1,14 +1,16 @@
1
1
  import { debugId, toDebugString } from "../debug";
2
2
  import { EndpointError } from "../types";
3
3
  import { callFunction } from "./callFunction";
4
- export const evaluateCondition = ({ assign, ...fnArgs }, options) => {
4
+ export const evaluateCondition = (condition, options) => {
5
+ const { assign } = condition;
5
6
  if (assign && assign in options.referenceRecord) {
6
7
  throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
7
8
  }
8
- const value = callFunction(fnArgs, options);
9
- options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`);
10
- return {
11
- result: value === "" ? true : !!value,
12
- ...(assign != null && { toAssign: { name: assign, value } }),
13
- };
9
+ const value = callFunction(condition, options);
10
+ options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(condition)} = ${toDebugString(value)}`);
11
+ const result = value === "" ? true : !!value;
12
+ if (assign != null) {
13
+ return { result, toAssign: { name: assign, value } };
14
+ }
15
+ return { result };
14
16
  };