@apifuse/provider-sdk 2.2.0-beta.26 → 2.2.0-beta.27
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 +4 -0
- package/dist/contract-serialization.d.ts +1 -20
- package/dist/contract-serialization.js +8 -587
- package/dist/contract.d.ts +0 -2
- package/dist/contract.js +5 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/provider.d.ts +1 -1
- package/dist/provider.js +1 -1
- package/dist/schema.d.ts +0 -63
- package/dist/schema.js +8 -808
- package/package.json +1 -1
- package/src/contract-serialization.ts +8 -859
- package/src/contract.ts +5 -16
- package/src/index.ts +0 -11
- package/src/provider.ts +0 -10
- package/src/schema.ts +9 -1060
package/src/contract.ts
CHANGED
|
@@ -7,11 +7,7 @@ import {
|
|
|
7
7
|
type JsonValue,
|
|
8
8
|
toJsonValue,
|
|
9
9
|
} from "./contract-json.js";
|
|
10
|
-
import {
|
|
11
|
-
describeSchema,
|
|
12
|
-
OutputTextTrustProjectionError,
|
|
13
|
-
serializeSmsMatcher,
|
|
14
|
-
} from "./contract-serialization.js";
|
|
10
|
+
import { describeSchema, serializeSmsMatcher } from "./contract-serialization.js";
|
|
15
11
|
import {
|
|
16
12
|
PROVIDER_CONTRACT_SCHEMA_VERSION,
|
|
17
13
|
type ProviderContractOperation,
|
|
@@ -34,7 +30,6 @@ export {
|
|
|
34
30
|
type ProviderContractOperation,
|
|
35
31
|
type ProviderContractSnapshot,
|
|
36
32
|
};
|
|
37
|
-
export { OutputTextTrustProjectionError };
|
|
38
33
|
|
|
39
34
|
export function extractProviderContract(provider: ProviderDefinition): ProviderContractSnapshot {
|
|
40
35
|
const auth = extractAuth(provider.auth);
|
|
@@ -99,7 +94,7 @@ function extractOperation(
|
|
|
99
94
|
const relatedOperations = toJsonValue(operation.relatedOperations);
|
|
100
95
|
const toolRouter = toJsonValue(operation.toolRouter);
|
|
101
96
|
const observability = toJsonValue(operation.observability);
|
|
102
|
-
const transport = extractTransport(operation.transport
|
|
97
|
+
const transport = extractTransport(operation.transport);
|
|
103
98
|
const fixtures = toJsonValue(operation.fixtures);
|
|
104
99
|
const upstream = toJsonValue(operation.upstream);
|
|
105
100
|
const hints = toJsonValue(operation.hints);
|
|
@@ -109,7 +104,7 @@ function extractOperation(
|
|
|
109
104
|
return {
|
|
110
105
|
id: operationId,
|
|
111
106
|
inputSchema: describeSchema(operation.input),
|
|
112
|
-
outputSchema: describeSchema(operation.output
|
|
107
|
+
outputSchema: describeSchema(operation.output),
|
|
113
108
|
...(descriptionKey === undefined ? {} : { descriptionKey }),
|
|
114
109
|
...(docs === undefined ? {} : { docs }),
|
|
115
110
|
...(whenToUseKeys === undefined ? {} : { whenToUseKeys }),
|
|
@@ -146,10 +141,7 @@ function extractAuth(value: ProviderDefinition["auth"]): JsonValue | undefined {
|
|
|
146
141
|
});
|
|
147
142
|
}
|
|
148
143
|
|
|
149
|
-
function extractTransport(
|
|
150
|
-
value: OperationTransport | undefined,
|
|
151
|
-
operationId: string,
|
|
152
|
-
): JsonValue | undefined {
|
|
144
|
+
function extractTransport(value: OperationTransport | undefined): JsonValue | undefined {
|
|
153
145
|
if (!value) return undefined;
|
|
154
146
|
if (value.kind !== "sse") return toJsonValue(value);
|
|
155
147
|
return compactObject({
|
|
@@ -157,10 +149,7 @@ function extractTransport(
|
|
|
157
149
|
events: Object.fromEntries(
|
|
158
150
|
Object.entries(value.events)
|
|
159
151
|
.sort(([leftId], [rightId]) => leftId.localeCompare(rightId))
|
|
160
|
-
.map(([eventName, schema]) => [
|
|
161
|
-
eventName,
|
|
162
|
-
describeSchema(schema, { eventName, operationId, outputTextTrust: true }),
|
|
163
|
-
]),
|
|
152
|
+
.map(([eventName, schema]) => [eventName, describeSchema(schema)]),
|
|
164
153
|
),
|
|
165
154
|
});
|
|
166
155
|
}
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,6 @@ export {
|
|
|
20
20
|
extractProviderContract,
|
|
21
21
|
type JsonPrimitive,
|
|
22
22
|
type JsonValue,
|
|
23
|
-
OutputTextTrustProjectionError,
|
|
24
23
|
PROVIDER_CONTRACT_SCHEMA_VERSION,
|
|
25
24
|
type ProviderContractOperation,
|
|
26
25
|
type ProviderContractSnapshot,
|
|
@@ -157,30 +156,20 @@ export {
|
|
|
157
156
|
type TraceContext,
|
|
158
157
|
} from "./runtime/trace.js";
|
|
159
158
|
export {
|
|
160
|
-
APIFUSE_TEXT_TRUST_META_KEY,
|
|
161
159
|
APIFUSE_DESCRIPTION_KEY_META_KEY,
|
|
162
160
|
APIFUSE_REDACTION_MARKER,
|
|
163
161
|
APIFUSE_SENSITIVE_KIND_META_KEY,
|
|
164
162
|
APIFUSE_SENSITIVE_META_KEY,
|
|
165
|
-
AUTO_TRUSTED_ZOD_STRING_FORMATS,
|
|
166
|
-
collectOutputTextTrust,
|
|
167
163
|
collectSensitivePaths,
|
|
168
164
|
describeKey,
|
|
169
165
|
field,
|
|
170
166
|
fields,
|
|
171
|
-
findUnclassifiedOutputTextPaths,
|
|
172
167
|
isSensitiveSchema,
|
|
173
|
-
OutputTextTrustCollectionError,
|
|
174
|
-
OutputTextTrustSchemaError,
|
|
175
168
|
redactPayload,
|
|
176
|
-
type OutputTextTrustMap,
|
|
177
169
|
type SensitiveFieldKind,
|
|
178
170
|
type SensitiveFieldOptions,
|
|
179
171
|
type SensitivePath,
|
|
180
172
|
sensitive,
|
|
181
|
-
textTrust,
|
|
182
|
-
type TextTrust,
|
|
183
|
-
type TextTrustMetadata,
|
|
184
173
|
z,
|
|
185
174
|
} from "./schema.js";
|
|
186
175
|
export {
|
package/src/provider.ts
CHANGED
|
@@ -58,30 +58,20 @@ export {
|
|
|
58
58
|
PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV,
|
|
59
59
|
} from "./runtime/choice.js";
|
|
60
60
|
export {
|
|
61
|
-
APIFUSE_TEXT_TRUST_META_KEY,
|
|
62
61
|
APIFUSE_DESCRIPTION_KEY_META_KEY,
|
|
63
62
|
APIFUSE_REDACTION_MARKER,
|
|
64
63
|
APIFUSE_SENSITIVE_KIND_META_KEY,
|
|
65
64
|
APIFUSE_SENSITIVE_META_KEY,
|
|
66
|
-
AUTO_TRUSTED_ZOD_STRING_FORMATS,
|
|
67
|
-
collectOutputTextTrust,
|
|
68
65
|
collectSensitivePaths,
|
|
69
66
|
describeKey,
|
|
70
67
|
field,
|
|
71
68
|
fields,
|
|
72
|
-
findUnclassifiedOutputTextPaths,
|
|
73
69
|
isSensitiveSchema,
|
|
74
|
-
OutputTextTrustCollectionError,
|
|
75
|
-
OutputTextTrustSchemaError,
|
|
76
70
|
redactPayload,
|
|
77
|
-
type OutputTextTrustMap,
|
|
78
71
|
type SensitiveFieldKind,
|
|
79
72
|
type SensitiveFieldOptions,
|
|
80
73
|
type SensitivePath,
|
|
81
74
|
sensitive,
|
|
82
|
-
textTrust,
|
|
83
|
-
type TextTrust,
|
|
84
|
-
type TextTrustMetadata,
|
|
85
75
|
z,
|
|
86
76
|
} from "./schema.js";
|
|
87
77
|
export type {
|