@apifuse/provider-sdk 2.2.0-beta.1 → 2.2.0-beta.2

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.
@@ -196,7 +196,7 @@ export function resolveProviderProxyAffinityKey(
196
196
  operationId: string,
197
197
  ): string {
198
198
  const connectionKey =
199
- request.connection?.id ?? request.connection?.externalRef;
199
+ resolveOperationConnectionId(request) ?? request.connection?.externalRef;
200
200
  const affinity =
201
201
  typeof provider.proxy === "object"
202
202
  ? provider.proxy.session?.affinity
@@ -207,6 +207,12 @@ export function resolveProviderProxyAffinityKey(
207
207
  return connectionKey ?? provider.id;
208
208
  }
209
209
 
210
+ function resolveOperationConnectionId(
211
+ request: OperationRequest,
212
+ ): string | undefined {
213
+ return request.connection?.id ?? request.connectionId;
214
+ }
215
+
210
216
  function createProviderContext(
211
217
  provider: ProviderDefinition,
212
218
  request: OperationRequest,
@@ -245,7 +251,7 @@ function createProviderContext(
245
251
  values: request.connection?.secrets,
246
252
  });
247
253
  const requestContext = {
248
- connectionId: request.connection?.id,
254
+ connectionId: resolveOperationConnectionId(request),
249
255
  headers: request.headers ?? {},
250
256
  };
251
257
  const context = wrapWithInstrumentation({
@@ -21,6 +21,7 @@ export const OperationConnectionSchema = z.object({
21
21
  export const OperationRequestSchema = z.object({
22
22
  requestId: z.string(),
23
23
  input: z.record(z.string(), z.unknown()),
24
+ connectionId: z.string().optional(),
24
25
  connection: OperationConnectionSchema.optional(),
25
26
  headers: z.record(z.string(), z.string()).optional(),
26
27
  trace: z.record(z.string(), z.string()).optional(),