@distilled.cloud/core 1.0.0-rc.17 → 1.0.0-rc.19
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/lib/_bundle/base.js +2 -2
- package/lib/_bundle/base.js.map +1 -1
- package/lib/_bundle/graphql.js +2 -2
- package/lib/_bundle/graphql.js.map +1 -1
- package/lib/_bundle/grpc.js +2 -0
- package/lib/_bundle/grpc.js.map +1 -0
- package/lib/_bundle/rest.js +1 -1
- package/lib/_bundle/rest.js.map +1 -1
- package/lib/_bundle/xml.js +1 -1
- package/lib/_bundle/xml.js.map +1 -1
- package/lib/annotations.d.ts +17 -0
- package/lib/annotations.d.ts.map +1 -0
- package/lib/annotations.js +2 -0
- package/lib/annotations.js.map +1 -0
- package/lib/api.d.ts +52 -1
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -1
- package/lib/category.d.ts.map +1 -1
- package/lib/config.d.ts +54 -13
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -1
- package/lib/error-category.d.ts.map +1 -1
- package/lib/errors.d.ts +3 -13
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/graphql.d.ts +26 -5
- package/lib/graphql.d.ts.map +1 -1
- package/lib/graphql.types.d.ts.map +1 -1
- package/lib/grpc-transport-cloudflare-http2.d.ts +7 -0
- package/lib/grpc-transport-cloudflare-http2.d.ts.map +1 -0
- package/lib/grpc-transport-cloudflare-http2.js +6 -0
- package/lib/grpc-transport-cloudflare-http2.js.map +1 -0
- package/lib/grpc-transport-cloudflare-sockets.d.ts +7 -0
- package/lib/grpc-transport-cloudflare-sockets.d.ts.map +1 -0
- package/lib/grpc-transport-cloudflare-sockets.js +5 -0
- package/lib/grpc-transport-cloudflare-sockets.js.map +1 -0
- package/lib/grpc-transport-node-http2.d.ts +19 -0
- package/lib/grpc-transport-node-http2.d.ts.map +1 -0
- package/lib/grpc-transport-node-http2.js +2 -0
- package/lib/grpc-transport-node-http2.js.map +1 -0
- package/lib/grpc-transport.d.ts +76 -0
- package/lib/grpc-transport.d.ts.map +1 -0
- package/lib/grpc-transport.js +1 -0
- package/lib/hpack.d.ts +34 -0
- package/lib/hpack.d.ts.map +1 -0
- package/lib/hpack.js +2 -0
- package/lib/hpack.js.map +1 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/pagination.d.ts +55 -3
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -1
- package/lib/protobuf.d.ts +92 -0
- package/lib/protobuf.d.ts.map +1 -0
- package/lib/protobuf.js +1 -0
- package/lib/protocol-grpc.d.ts +86 -0
- package/lib/protocol-grpc.d.ts.map +1 -0
- package/lib/protocol-grpc.js +1 -0
- package/lib/protocol-http.d.ts +38 -9
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +1 -1
- package/lib/protocol-rest.d.ts +60 -42
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -1
- package/lib/response-validation.d.ts +5 -4
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/schema-lite-typed.js +1 -2
- package/lib/sdk-error.d.ts +27 -0
- package/lib/sdk-error.d.ts.map +1 -0
- package/lib/sdk-error.js +1 -0
- package/lib/sensitive.d.ts +28 -0
- package/lib/sensitive.d.ts.map +1 -0
- package/lib/sensitive.js +2 -0
- package/lib/sensitive.js.map +1 -0
- package/lib/telemetry-debug.d.ts +6 -0
- package/lib/telemetry-debug.d.ts.map +1 -0
- package/lib/telemetry-debug.js +2 -0
- package/lib/telemetry-debug.js.map +1 -0
- package/lib/telemetry-hooks.d.ts +32 -0
- package/lib/telemetry-hooks.d.ts.map +1 -0
- package/lib/telemetry-hooks.js +2 -0
- package/lib/telemetry-hooks.js.map +1 -0
- package/lib/telemetry-host-rules.d.ts +23 -0
- package/lib/telemetry-host-rules.d.ts.map +1 -0
- package/lib/telemetry-host-rules.js +2 -0
- package/lib/telemetry-host-rules.js.map +1 -0
- package/lib/telemetry-lambda-context.d.ts +17 -0
- package/lib/telemetry-lambda-context.d.ts.map +1 -0
- package/lib/telemetry-lambda-context.js +2 -0
- package/lib/telemetry-lambda-context.js.map +1 -0
- package/lib/telemetry-message-context.d.ts +52 -0
- package/lib/telemetry-message-context.d.ts.map +1 -0
- package/lib/telemetry-message-context.js +2 -0
- package/lib/telemetry-message-context.js.map +1 -0
- package/lib/telemetry-metrics.d.ts +6 -0
- package/lib/telemetry-metrics.d.ts.map +1 -0
- package/lib/telemetry-metrics.js +2 -0
- package/lib/telemetry-metrics.js.map +1 -0
- package/lib/telemetry-name-template.d.ts +13 -0
- package/lib/telemetry-name-template.d.ts.map +1 -0
- package/lib/telemetry-name-template.js +2 -0
- package/lib/telemetry-name-template.js.map +1 -0
- package/lib/telemetry-stream.d.ts +11 -0
- package/lib/telemetry-stream.d.ts.map +1 -0
- package/lib/telemetry-stream.js +2 -0
- package/lib/telemetry-stream.js.map +1 -0
- package/lib/telemetry-xray.d.ts +28 -0
- package/lib/telemetry-xray.d.ts.map +1 -0
- package/lib/telemetry-xray.js +2 -0
- package/lib/telemetry-xray.js.map +1 -0
- package/lib/telemetry.d.ts +288 -0
- package/lib/telemetry.d.ts.map +1 -0
- package/lib/telemetry.js +3 -0
- package/lib/telemetry.js.map +1 -0
- package/lib/trait.d.ts +7 -0
- package/lib/trait.d.ts.map +1 -1
- package/lib/trait.js +1 -1
- package/lib/xml.d.ts.map +1 -1
- package/package.json +3 -5
- package/src/annotations.ts +53 -0
- package/src/api.ts +316 -43
- package/src/category.ts +21 -22
- package/src/config.ts +58 -29
- package/src/error-category.ts +12 -14
- package/src/errors.ts +11 -7
- package/src/graphql.ts +191 -63
- package/src/graphql.types.ts +5 -1
- package/src/grpc-transport-cloudflare-http2.ts +494 -0
- package/src/grpc-transport-cloudflare-sockets.ts +299 -0
- package/src/grpc-transport-node-http2.ts +234 -0
- package/src/grpc-transport.ts +118 -0
- package/src/hpack.ts +331 -0
- package/src/index.ts +6 -2
- package/src/pagination.ts +193 -8
- package/src/protobuf.ts +1332 -0
- package/src/protocol-grpc.ts +641 -0
- package/src/protocol-http.ts +87 -67
- package/src/protocol-rest.ts +183 -191
- package/src/response-validation.ts +8 -5
- package/src/sdk-error.ts +33 -0
- package/src/sensitive.ts +154 -0
- package/src/telemetry-debug.ts +179 -0
- package/src/telemetry-hooks.ts +33 -0
- package/src/telemetry-host-rules.ts +39 -0
- package/src/telemetry-lambda-context.ts +46 -0
- package/src/telemetry-message-context.ts +170 -0
- package/src/telemetry-metrics.ts +69 -0
- package/src/telemetry-name-template.ts +26 -0
- package/src/telemetry-stream.ts +100 -0
- package/src/telemetry-xray.ts +66 -0
- package/src/telemetry.ts +832 -0
- package/src/trait.ts +10 -0
- package/src/xml.ts +10 -1
- package/lib/codegen/boolean-string-enums.d.ts +0 -36
- package/lib/codegen/boolean-string-enums.d.ts.map +0 -1
- package/lib/codegen/boolean-string-enums.js +0 -147
- package/lib/codegen/boolean-string-enums.js.map +0 -1
- package/lib/codegen/chunk.d.ts +0 -7
- package/lib/codegen/chunk.d.ts.map +0 -1
- package/lib/codegen/chunk.js +0 -139
- package/lib/codegen/chunk.js.map +0 -1
- package/lib/codegen/cli.d.ts +0 -80
- package/lib/codegen/cli.d.ts.map +0 -1
- package/lib/codegen/cli.js +0 -166
- package/lib/codegen/cli.js.map +0 -1
- package/lib/codegen/datafy.d.ts +0 -14
- package/lib/codegen/datafy.d.ts.map +0 -1
- package/lib/codegen/datafy.js +0 -853
- package/lib/codegen/datafy.js.map +0 -1
- package/lib/codegen/dedupe.d.ts +0 -5
- package/lib/codegen/dedupe.d.ts.map +0 -1
- package/lib/codegen/dedupe.js +0 -153
- package/lib/codegen/dedupe.js.map +0 -1
- package/lib/codegen/emit.d.ts +0 -125
- package/lib/codegen/emit.d.ts.map +0 -1
- package/lib/codegen/emit.js +0 -99
- package/lib/codegen/emit.js.map +0 -1
- package/lib/codegen/format.d.ts +0 -11
- package/lib/codegen/format.d.ts.map +0 -1
- package/lib/codegen/format.js +0 -32
- package/lib/codegen/format.js.map +0 -1
- package/lib/codegen/generated-at.d.ts +0 -29
- package/lib/codegen/generated-at.d.ts.map +0 -1
- package/lib/codegen/generated-at.js +0 -78
- package/lib/codegen/generated-at.js.map +0 -1
- package/lib/codegen/generator.d.ts +0 -353
- package/lib/codegen/generator.d.ts.map +0 -1
- package/lib/codegen/generator.js +0 -810
- package/lib/codegen/generator.js.map +0 -1
- package/lib/codegen/graph.d.ts +0 -36
- package/lib/codegen/graph.d.ts.map +0 -1
- package/lib/codegen/graph.js +0 -136
- package/lib/codegen/graph.js.map +0 -1
- package/lib/codegen/graphql-client.d.ts +0 -70
- package/lib/codegen/graphql-client.d.ts.map +0 -1
- package/lib/codegen/graphql-client.js +0 -439
- package/lib/codegen/graphql-client.js.map +0 -1
- package/lib/codegen/graphql.d.ts +0 -207
- package/lib/codegen/graphql.d.ts.map +0 -1
- package/lib/codegen/graphql.js +0 -786
- package/lib/codegen/graphql.js.map +0 -1
- package/lib/codegen/latin1.d.ts +0 -3
- package/lib/codegen/latin1.d.ts.map +0 -1
- package/lib/codegen/latin1.js +0 -126
- package/lib/codegen/latin1.js.map +0 -1
- package/lib/codegen/members.d.ts +0 -32
- package/lib/codegen/members.d.ts.map +0 -1
- package/lib/codegen/members.js +0 -62
- package/lib/codegen/members.js.map +0 -1
- package/lib/codegen/model-diff.d.ts +0 -10
- package/lib/codegen/model-diff.d.ts.map +0 -1
- package/lib/codegen/model-diff.js +0 -67
- package/lib/codegen/model-diff.js.map +0 -1
- package/lib/codegen/naming.d.ts +0 -29
- package/lib/codegen/naming.d.ts.map +0 -1
- package/lib/codegen/naming.js +0 -74
- package/lib/codegen/naming.js.map +0 -1
- package/lib/codegen/openapi-cli.d.ts +0 -52
- package/lib/codegen/openapi-cli.d.ts.map +0 -1
- package/lib/codegen/openapi-cli.js +0 -84
- package/lib/codegen/openapi-cli.js.map +0 -1
- package/lib/codegen/openapi.d.ts +0 -209
- package/lib/codegen/openapi.d.ts.map +0 -1
- package/lib/codegen/openapi.js +0 -1548
- package/lib/codegen/openapi.js.map +0 -1
- package/lib/codegen/operations.d.ts +0 -24
- package/lib/codegen/operations.d.ts.map +0 -1
- package/lib/codegen/operations.js +0 -56
- package/lib/codegen/operations.js.map +0 -1
- package/lib/codegen/pagination.d.ts +0 -39
- package/lib/codegen/pagination.d.ts.map +0 -1
- package/lib/codegen/pagination.js +0 -31
- package/lib/codegen/pagination.js.map +0 -1
- package/lib/codegen/patch-audit.d.ts +0 -84
- package/lib/codegen/patch-audit.d.ts.map +0 -1
- package/lib/codegen/patch-audit.js +0 -366
- package/lib/codegen/patch-audit.js.map +0 -1
- package/lib/codegen/patches.d.ts +0 -129
- package/lib/codegen/patches.d.ts.map +0 -1
- package/lib/codegen/patches.js +0 -472
- package/lib/codegen/patches.js.map +0 -1
- package/lib/codegen/prelude.d.ts +0 -15
- package/lib/codegen/prelude.d.ts.map +0 -1
- package/lib/codegen/prelude.js +0 -60
- package/lib/codegen/prelude.js.map +0 -1
- package/lib/codegen/privatize.d.ts +0 -21
- package/lib/codegen/privatize.d.ts.map +0 -1
- package/lib/codegen/privatize.js +0 -176
- package/lib/codegen/privatize.js.map +0 -1
- package/lib/codegen/proto.d.ts +0 -121
- package/lib/codegen/proto.d.ts.map +0 -1
- package/lib/codegen/proto.js +0 -960
- package/lib/codegen/proto.js.map +0 -1
- package/lib/codegen/pure.d.ts +0 -6
- package/lib/codegen/pure.d.ts.map +0 -1
- package/lib/codegen/pure.js +0 -91
- package/lib/codegen/pure.js.map +0 -1
- package/lib/codegen/rewrite-operation-ids.d.ts +0 -154
- package/lib/codegen/rewrite-operation-ids.d.ts.map +0 -1
- package/lib/codegen/rewrite-operation-ids.js +0 -1117
- package/lib/codegen/rewrite-operation-ids.js.map +0 -1
- package/lib/codegen/spec-path.d.ts +0 -16
- package/lib/codegen/spec-path.d.ts.map +0 -1
- package/lib/codegen/spec-path.js +0 -101
- package/lib/codegen/spec-path.js.map +0 -1
- package/lib/codegen/table.d.ts +0 -5
- package/lib/codegen/table.d.ts.map +0 -1
- package/lib/codegen/table.js +0 -249
- package/lib/codegen/table.js.map +0 -1
- package/lib/debug.d.ts +0 -2
- package/lib/debug.d.ts.map +0 -1
- package/lib/debug.js +0 -1
- package/lib/json-patch.d.ts +0 -58
- package/lib/json-patch.d.ts.map +0 -1
- package/lib/json-patch.js +0 -2
- package/lib/json-patch.js.map +0 -1
- package/lib/schema-lite-typed.js.map +0 -1
- package/lib/testing.d.ts +0 -40
- package/lib/testing.d.ts.map +0 -1
- package/lib/testing.js +0 -2
- package/lib/testing.js.map +0 -1
- package/src/codegen/boolean-string-enums.ts +0 -155
- package/src/codegen/chunk.ts +0 -147
- package/src/codegen/cli.ts +0 -293
- package/src/codegen/datafy.ts +0 -874
- package/src/codegen/dedupe.ts +0 -173
- package/src/codegen/emit.ts +0 -200
- package/src/codegen/format.ts +0 -49
- package/src/codegen/generated-at.ts +0 -88
- package/src/codegen/generator.ts +0 -1229
- package/src/codegen/graph.ts +0 -151
- package/src/codegen/graphql-client.ts +0 -545
- package/src/codegen/graphql.ts +0 -1145
- package/src/codegen/latin1.ts +0 -131
- package/src/codegen/members.ts +0 -79
- package/src/codegen/model-diff.ts +0 -67
- package/src/codegen/naming.ts +0 -85
- package/src/codegen/openapi-cli.ts +0 -141
- package/src/codegen/openapi.ts +0 -1845
- package/src/codegen/operations.ts +0 -73
- package/src/codegen/pagination.ts +0 -64
- package/src/codegen/patch-audit.ts +0 -480
- package/src/codegen/patches.ts +0 -581
- package/src/codegen/prelude.ts +0 -70
- package/src/codegen/privatize.ts +0 -200
- package/src/codegen/proto.ts +0 -1092
- package/src/codegen/pure.ts +0 -94
- package/src/codegen/rewrite-operation-ids.ts +0 -1219
- package/src/codegen/spec-path.ts +0 -112
- package/src/codegen/table.ts +0 -254
- package/src/debug.ts +0 -8
- package/src/json-patch.ts +0 -273
- package/src/testing.ts +0 -74
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import * as fs from "node:fs/promises";
|
|
16
|
-
import * as path from "node:path";
|
|
17
|
-
import { convertOpenApiToSmithy } from "./openapi.js";
|
|
18
|
-
import { finalizeConvert } from "./patches.js";
|
|
19
|
-
import { resolveSpecPath } from "./spec-path.js";
|
|
20
|
-
const exists = async (p) => {
|
|
21
|
-
try {
|
|
22
|
-
await fs.access(p);
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const runOpenApiConvert = async (o) => {
|
|
31
|
-
const outDir = path.resolve(o.root, o.outDir ?? ".generated-specs");
|
|
32
|
-
const patchRoot = o.patchesDir === false ? undefined : path.resolve(o.root, o.patchesDir ?? "patches");
|
|
33
|
-
const parse = o.parse ?? ((text) => JSON.parse(text));
|
|
34
|
-
const onStalePatch = o.onStalePatch ?? "fail";
|
|
35
|
-
await fs.mkdir(outDir, { recursive: true });
|
|
36
|
-
console.log("🛠️ openapi → smithy");
|
|
37
|
-
console.log(` Output: ${outDir}`);
|
|
38
|
-
// Each spec's patch dir, relative to the patch root: `<name>/` when it
|
|
39
|
-
// exists, else the root itself for a single-spec provider.
|
|
40
|
-
const patchDirs = new Map();
|
|
41
|
-
if (patchRoot && (await exists(patchRoot))) {
|
|
42
|
-
for (const entry of o.specs) {
|
|
43
|
-
if (await exists(path.join(patchRoot, entry.name)))
|
|
44
|
-
patchDirs.set(entry.name, entry.name);
|
|
45
|
-
else if (o.specs.length === 1)
|
|
46
|
-
patchDirs.set(entry.name, "");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
for (const entry of o.specs) {
|
|
50
|
-
// Production path by default; `specs/.local` under DISTILLED_SPECS_LOCAL.
|
|
51
|
-
const specPath = resolveSpecPath(o.root, entry.specPath);
|
|
52
|
-
let spec = parse(await fs.readFile(specPath, "utf8"), specPath);
|
|
53
|
-
// ---- Preprocess hook ----
|
|
54
|
-
if (entry.preprocess) {
|
|
55
|
-
const replaced = await entry.preprocess(spec);
|
|
56
|
-
if (replaced !== undefined)
|
|
57
|
-
spec = replaced;
|
|
58
|
-
}
|
|
59
|
-
// ---- Convert, write ----
|
|
60
|
-
const model = convertOpenApiToSmithy(spec, {
|
|
61
|
-
deferNaming: true,
|
|
62
|
-
...o.options,
|
|
63
|
-
...entry.options,
|
|
64
|
-
});
|
|
65
|
-
const opCount = Object.values(model.shapes).filter((s) => s.type === "operation").length;
|
|
66
|
-
const outPath = path.join(outDir, `${entry.name}.json`);
|
|
67
|
-
await fs.writeFile(outPath, JSON.stringify(model, null, 2) + "\n");
|
|
68
|
-
console.log(` ✅ ${entry.name}: ${opCount} operations, ${Object.keys(model.shapes).length} shapes`);
|
|
69
|
-
}
|
|
70
|
-
if (o.finalize !== false) {
|
|
71
|
-
const written = new Set(o.specs.map((s) => s.name));
|
|
72
|
-
await finalizeConvert({
|
|
73
|
-
root: o.root,
|
|
74
|
-
outDir,
|
|
75
|
-
patchesDir: patchRoot ?? false,
|
|
76
|
-
patchesFor: (resource) => patchDirs.get(resource),
|
|
77
|
-
onStalePatch,
|
|
78
|
-
// The converter computed the names; finalize only applies them.
|
|
79
|
-
operationNaming: "as-is",
|
|
80
|
-
include: (resource) => written.has(resource),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=openapi-cli.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-cli.js","sourceRoot":"","sources":["../../src/codegen/openapi-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,MAAM,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 2.0 JSON converter (dev-time only, provider-agnostic).
|
|
3
|
-
*
|
|
4
|
-
* Turns a Swagger 2.0 / OAS 3.0 / OAS 3.1 document into the same Smithy JSON
|
|
5
|
-
* model shape the other spec converters produce (`{ smithy: "2.0", metadata,
|
|
6
|
-
* shapes }`), so every OpenAPI-sourced provider flows through the one shared
|
|
7
|
-
* `generateService` compiler. Conversion fidelity follows distilled v0's
|
|
8
|
-
* `generate-openapi.ts` feature matrix:
|
|
9
|
-
*
|
|
10
|
-
* • one operation per (path × get/post/put/patch/delete — plus head/options
|
|
11
|
-
* when a provider opts in via `extraHttpMethods`), deprecated skipped by
|
|
12
|
-
* default; op shape name = PascalCase(operationId), or verbNoun
|
|
13
|
-
* (`Apps_list` → `ListApps`) when {@link OpenApiConvertOptions.operationNaming}
|
|
14
|
-
* is `"verbNoun"`
|
|
15
|
-
* • input `<Op>Request`: path params → `smithy.api#httpLabel` (+required),
|
|
16
|
-
* query params → `smithy.api#httpQuery`, header params →
|
|
17
|
-
* `smithy.api#httpHeader` when `headerParams` is on (dropped otherwise,
|
|
18
|
-
* as cookie params always are),
|
|
19
|
-
* body properties flattened alongside
|
|
20
|
-
* (labels win, then query, then headers, then body);
|
|
21
|
-
* non-object bodies become a sole `body` member with `smithy.api#httpPayload`
|
|
22
|
-
* • `$ref`s become NAMED shapes (`components/schemas/X` → `<ns>#X`), reused
|
|
23
|
-
* across operations; anonymous nested objects synthesize names from the
|
|
24
|
-
* parent + member path
|
|
25
|
-
* • responses: 200 → 201 → 204 precedence (`successStatuses` overrides),
|
|
26
|
-
* JSON or opt-in binary `application/octet-stream`; object
|
|
27
|
-
* results become `<Op>Response` structures (a sole `$ref` reuses the named
|
|
28
|
-
* shape); bare array/scalar results wrap in a structure whose single
|
|
29
|
-
* member carries `com.distilled.openapi#rawResponse` (the SdkSpec maps it
|
|
30
|
-
* to a root pipe); no schema → `smithy.api#Unit`; `head` is always
|
|
31
|
-
* `smithy.api#Unit`, whatever content the spec declares
|
|
32
|
-
* • nullability (3.0 `nullable`, 3.1 `type: [..., "null"]`, 2.0
|
|
33
|
-
* `x-nullable`, `oneOf`/`anyOf` null branches) → member-level
|
|
34
|
-
* `com.distilled.openapi#nullable` trait
|
|
35
|
-
* • sensitive string members (x-sensitive or name-pattern match) →
|
|
36
|
-
* `smithy.api#sensitive` on the member (direction-agnostic; the SdkSpec
|
|
37
|
-
* decides the input/output treatment)
|
|
38
|
-
* • per-op non-2xx statuses (outside `defaultErrorStatuses`) → typed error
|
|
39
|
-
* shapes with `smithy.api#error`/`smithy.api#httpError` and
|
|
40
|
-
* `com.distilled.openapi#errorMatchers` status matchers
|
|
41
|
-
* • v0 pagination detection (`pagination.cursor` / `.next` / `.next_page`,
|
|
42
|
-
* `next_token`/`NextToken`/`nextToken`, `next_page` + input alias lists +
|
|
43
|
-
* first top-level array property) → `smithy.api#paginated` on the op
|
|
44
|
-
* (with the non-standard `mode` member the core runtime dispatches on)
|
|
45
|
-
*/
|
|
46
|
-
import { RENAME_METADATA_KEY, type OperationIdRewrite } from "./rewrite-operation-ids.ts";
|
|
47
|
-
/** Member-level nullability (`S.NullOr` + `| null` via `SdkSpec.nullableTrait`). */
|
|
48
|
-
export declare const NULLABLE_TRAIT = "com.distilled.openapi#nullable";
|
|
49
|
-
/**
|
|
50
|
-
* Marks the sole member of a synthesized response wrapper for bare
|
|
51
|
-
* array/scalar response bodies. SdkSpecs bind it with a `rootPipe`
|
|
52
|
-
* (`T.RawResponseRoot()` from `core/protocol-rest`), so the emitted response
|
|
53
|
-
* type IS the payload type.
|
|
54
|
-
*/
|
|
55
|
-
export declare const RAW_RESPONSE_TRAIT = "com.distilled.openapi#rawResponse";
|
|
56
|
-
/**
|
|
57
|
-
* Wire-matching rules for a generated error class (see
|
|
58
|
-
* `SdkSpec.errorMatchersTrait` + `applyErrorMatchers`). The converter stamps
|
|
59
|
-
* `[{ status }]` from the response status the class was mapped from.
|
|
60
|
-
*/
|
|
61
|
-
export declare const ERROR_MATCHERS_TRAIT = "com.distilled.openapi#errorMatchers";
|
|
62
|
-
/**
|
|
63
|
-
* Non-JSON request body encoding chosen by the v0 content-type precedence
|
|
64
|
-
* (json > form-urlencoded > multipart). Value: `"form-urlencoded"` |
|
|
65
|
-
* `"multipart"`. `"multipart"` is also merged into the `smithy.api#http`
|
|
66
|
-
* trait's `contentType` (which core's `buildRequest` understands);
|
|
67
|
-
* form-urlencoded is left to provider SdkSpecs/protocols.
|
|
68
|
-
*/
|
|
69
|
-
export declare const CONTENT_TYPE_TRAIT = "com.distilled.openapi#contentType";
|
|
70
|
-
/**
|
|
71
|
-
* The `apiVersion` recorded on every operation when
|
|
72
|
-
* {@link OpenApiConvertOptions.apiVersion} is set (Azure ARM style). The
|
|
73
|
-
* matching `api-version` query parameter is dropped from inputs; the
|
|
74
|
-
* provider's protocol injects it at request time.
|
|
75
|
-
*/
|
|
76
|
-
export declare const API_VERSION_TRAIT = "com.distilled.openapi#apiVersion";
|
|
77
|
-
export declare const SENSITIVE_FIELD_PATTERNS: readonly RegExp[];
|
|
78
|
-
export interface OpenApiConvertOptions {
|
|
79
|
-
/** Shape namespace, e.g. `"com.neon.api"`. */
|
|
80
|
-
readonly namespace: string;
|
|
81
|
-
/** Service shape name (PascalCased), e.g. `"Neon"`. */
|
|
82
|
-
readonly serviceName: string;
|
|
83
|
-
/** Service shape `version`. Default: the spec's `info.version`, else "1.0". */
|
|
84
|
-
readonly serviceVersion?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Non-2xx response status → error class name. Statuses in
|
|
87
|
-
* {@link defaultErrorStatuses} never produce per-op errors. Default:
|
|
88
|
-
* `{400: BadRequest, 403: Forbidden, 404: NotFound, 409: Conflict,
|
|
89
|
-
* 422: UnprocessableEntity}` (the v0 default).
|
|
90
|
-
*/
|
|
91
|
-
readonly statusToErrorClass?: Readonly<Record<string, string>>;
|
|
92
|
-
/**
|
|
93
|
-
* Statuses covered by the SDK's common errors, excluded from per-op error
|
|
94
|
-
* lists. Default: `{"401","429","500","503"}` (the v0 default).
|
|
95
|
-
*/
|
|
96
|
-
readonly defaultErrorStatuses?: Iterable<string>;
|
|
97
|
-
/** Skip operations marked `deprecated: true`. Default true. */
|
|
98
|
-
readonly skipDeprecated?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* HTTP methods to convert IN ADDITION to get/post/put/patch/delete —
|
|
101
|
-
* currently `"head"` and `"options"`. Opt-in, so a provider that models
|
|
102
|
-
* them (Vercel probes cache artifacts and sandbox files with HEAD) gets
|
|
103
|
-
* them without every other provider silently gaining operations.
|
|
104
|
-
*
|
|
105
|
-
* `head` operations always output `smithy.api#Unit` — see the output-shape
|
|
106
|
-
* comment in {@link convertOpenApiToSmithy} for why a declared response
|
|
107
|
-
* body on a HEAD can never arrive.
|
|
108
|
-
*/
|
|
109
|
-
readonly extraHttpMethods?: readonly ("head" | "options")[];
|
|
110
|
-
/**
|
|
111
|
-
* Emit `in: header` parameters as `smithy.api#httpHeader` members instead
|
|
112
|
-
* of dropping them. Opt-in for the same reason as
|
|
113
|
-
* {@link extraHttpMethods}: turning it on adds input members to every
|
|
114
|
-
* operation whose spec declares a header parameter, and most providers
|
|
115
|
-
* declare ones the protocol already sends itself (Accept, Authorization,
|
|
116
|
-
* an API-version pin). Providers whose headers are real per-call inputs
|
|
117
|
-
* — Vercel's `x-Artifact-*` remote-cache metadata, `x-Vercel-Digest` —
|
|
118
|
-
* ask for them.
|
|
119
|
-
*/
|
|
120
|
-
readonly headerParams?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Convert `format: binary` strings to blobs and include binary
|
|
123
|
-
* `application/octet-stream` responses. Opt in only when the provider's
|
|
124
|
-
* generator and protocol support binary inputs and outputs. Default false.
|
|
125
|
-
*/
|
|
126
|
-
readonly binaryTypes?: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Response statuses to read the operation's output shape from, most
|
|
129
|
-
* preferred first. Default `["200", "201", "204"]`. Extend it for an API
|
|
130
|
-
* that answers asynchronous work with a body under another status — Vercel
|
|
131
|
-
* returns `202 Accepted` with a payload from nine endpoints (artifact
|
|
132
|
-
* upload, account deletion, VCR blob/manifest writes), which would
|
|
133
|
-
* otherwise generate as a `void` output.
|
|
134
|
-
*/
|
|
135
|
-
readonly successStatuses?: readonly string[];
|
|
136
|
-
/**
|
|
137
|
-
* Response headers (matched case-insensitively) to add to an operation's
|
|
138
|
-
* output as optional `smithy.api#httpHeader` members wherever one of its
|
|
139
|
-
* 2xx responses declares them -- bodiless ones such as `202 Accepted`
|
|
140
|
-
* included. An allowlist for the same reason as {@link headerParams}:
|
|
141
|
-
* specs declare noise headers (request ids, ETags) on most responses.
|
|
142
|
-
* Azure lists its long-running-operation status monitor
|
|
143
|
-
* (`Azure-AsyncOperation`, `Location`, `Retry-After`), which callers need
|
|
144
|
-
* to follow the operation themselves.
|
|
145
|
-
*
|
|
146
|
-
* An operation whose output reuses a named component gets its own output
|
|
147
|
-
* structure (the component's members plus the headers), so the headers
|
|
148
|
-
* never leak into other operations sharing that component. A header whose
|
|
149
|
-
* member name a body member already uses is suffixed `Header`
|
|
150
|
-
* (`Location` → `locationHeader` next to ARM's `location` region).
|
|
151
|
-
*/
|
|
152
|
-
readonly responseHeaders?: readonly string[];
|
|
153
|
-
/**
|
|
154
|
-
* Azure-style fixed `api-version`: drops `api-version` query params and
|
|
155
|
-
* stamps {@link API_VERSION_TRAIT} on every operation.
|
|
156
|
-
*/
|
|
157
|
-
readonly apiVersion?: string;
|
|
158
|
-
/**
|
|
159
|
-
* Name patterns marking string members sensitive. Default
|
|
160
|
-
* {@link SENSITIVE_FIELD_PATTERNS}. Pass `[]` to disable name-based
|
|
161
|
-
* detection (explicit `x-sensitive: true` still applies).
|
|
162
|
-
*/
|
|
163
|
-
readonly sensitivePatterns?: readonly RegExp[];
|
|
164
|
-
/**
|
|
165
|
-
* Optional full shape-definition overrides for emitted error classes
|
|
166
|
-
* (keyed by class name) — e.g. custom members. The converter's default is
|
|
167
|
-
* an empty structure with `smithy.api#error` + `smithy.api#httpError` +
|
|
168
|
-
* {@link ERROR_MATCHERS_TRAIT} traits; overrides are merged over it.
|
|
169
|
-
*/
|
|
170
|
-
readonly errorShapes?: Readonly<Record<string, any>>;
|
|
171
|
-
/**
|
|
172
|
-
* How to turn an OpenAPI `operationId` into the Smithy/SDK operation name.
|
|
173
|
-
* This is a convert policy, not a spec patch — the OpenAPI document is
|
|
174
|
-
* left alone.
|
|
175
|
-
*
|
|
176
|
-
* - `"verbNoun"` (default): `Apps_list` / `ConfigsList` / `showContact` →
|
|
177
|
-
* `listApps` / `listConfigs` / `getApp`. Already verb-first ids stay.
|
|
178
|
-
* An operation with no `operationId`, or a mechanical one that only
|
|
179
|
-
* restates the method and path (`get-api-card`, `post_v1_users`), is
|
|
180
|
-
* named from the route instead: `GET /users` → `listUsers`,
|
|
181
|
-
* `GET /users/{id}` → `getUser`, `POST /users/{id}/reset` →
|
|
182
|
-
* `resetUser`.
|
|
183
|
-
* - `"as-is"`: `PascalCase(operationId)` (`Apps_list` → `AppsList`).
|
|
184
|
-
*
|
|
185
|
-
* {@link operationNames} overrides win (lookup by `"METHOD path"`, then
|
|
186
|
-
* operationId).
|
|
187
|
-
*/
|
|
188
|
-
readonly operationNaming?: "as-is" | "verbNoun";
|
|
189
|
-
/**
|
|
190
|
-
* Per-operation name overrides for {@link operationNaming}. Use
|
|
191
|
-
* `"METHOD path"` keys when two methods share an `operationId`.
|
|
192
|
-
*/
|
|
193
|
-
readonly operationNames?: OperationIdRewrite;
|
|
194
|
-
/**
|
|
195
|
-
* Name shapes from the spec (`PascalCase(operationId)`, no overrides) and
|
|
196
|
-
* record the {@link operationNaming} names in
|
|
197
|
-
* `metadata[RENAME_METADATA_KEY]`; `finalizeConvert` renames after the
|
|
198
|
-
* Smithy patches, so patches target upstream names.
|
|
199
|
-
*/
|
|
200
|
-
readonly deferNaming?: boolean;
|
|
201
|
-
}
|
|
202
|
-
export interface SmithyModel {
|
|
203
|
-
smithy: "2.0";
|
|
204
|
-
metadata: any;
|
|
205
|
-
shapes: Record<string, any>;
|
|
206
|
-
}
|
|
207
|
-
export { RENAME_METADATA_KEY };
|
|
208
|
-
export declare const convertOpenApiToSmithy: (spec: unknown, options: OpenApiConvertOptions) => SmithyModel;
|
|
209
|
-
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/codegen/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,EAIL,mBAAmB,EAInB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAMpC,oFAAoF;AACpF,eAAO,MAAM,cAAc,mCAAmC,CAAC;AAC/D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AACtE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAC1E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AACtE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AAMpE,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAoBrD,CAAC;AAMF,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjD,+DAA+D;IAC/D,QAAQ,CAAC,cAAc,CAAC,E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