@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.
- package/CHANGELOG.md +5 -0
- package/dist/runtime/http.js +28 -338
- package/dist/runtime/proxy-retry-policy.d.ts +40 -0
- package/dist/runtime/proxy-retry-policy.js +326 -0
- package/dist/runtime/stealth.js +57 -203
- package/dist/server/serve.js +5 -2
- package/dist/server/types.d.ts +1 -0
- package/dist/server/types.js +1 -0
- package/package.json +1 -1
- package/src/runtime/http.ts +60 -547
- package/src/runtime/proxy-retry-policy.ts +469 -0
- package/src/runtime/stealth.ts +100 -361
- package/src/server/serve.ts +8 -2
- package/src/server/types.ts +1 -0
package/src/server/serve.ts
CHANGED
|
@@ -196,7 +196,7 @@ export function resolveProviderProxyAffinityKey(
|
|
|
196
196
|
operationId: string,
|
|
197
197
|
): string {
|
|
198
198
|
const connectionKey =
|
|
199
|
-
request
|
|
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
|
|
254
|
+
connectionId: resolveOperationConnectionId(request),
|
|
249
255
|
headers: request.headers ?? {},
|
|
250
256
|
};
|
|
251
257
|
const context = wrapWithInstrumentation({
|
package/src/server/types.ts
CHANGED
|
@@ -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(),
|