@distilled.cloud/core 1.0.0-rc.16 → 1.0.0-rc.18
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/aws.js +2 -0
- package/lib/_bundle/aws.js.map +1 -0
- package/lib/_bundle/base.js +5 -0
- package/lib/_bundle/base.js.map +1 -0
- package/lib/_bundle/graphql.js +3 -0
- package/lib/_bundle/graphql.js.map +1 -0
- package/lib/_bundle/rest.js +2 -0
- package/lib/_bundle/rest.js.map +1 -0
- package/lib/_bundle/xml.js +4 -0
- package/lib/_bundle/xml.js.map +1 -0
- package/lib/annotations.d.ts +15 -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 +15 -0
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -796
- package/lib/category.d.ts.map +1 -1
- package/lib/category.js +1 -278
- package/lib/chunks.js +1 -11
- package/lib/config.d.ts +54 -13
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -161
- package/lib/crypto.js +1 -130
- package/lib/debug.d.ts.map +1 -1
- package/lib/debug.js +1 -8
- package/lib/error-category.d.ts.map +1 -1
- package/lib/error-category.js +1 -47
- package/lib/errors.d.ts +2 -13
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -198
- package/lib/graphql.d.ts +14 -0
- package/lib/graphql.d.ts.map +1 -1
- package/lib/graphql.js +1 -1058
- package/lib/graphql.types.js +1 -6
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -15
- package/lib/pagination.d.ts +34 -2
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -271
- package/lib/plain-values.js +1 -39
- package/lib/plain-values.js.map +1 -1
- package/lib/protocol-http.d.ts +30 -6
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +1 -812
- package/lib/protocol-rest.d.ts +53 -39
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -375
- package/lib/query.js +1 -27
- package/lib/response-validation-strict.js +1 -284
- package/lib/response-validation.d.ts +4 -3
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/response-validation.js +1 -118
- package/lib/retry-after.js +1 -112
- package/lib/retry.js +1 -197
- package/lib/schema-lite-impl.js +1 -341
- package/lib/schema-lite-typed.js +1 -27
- package/lib/schema-lite.js +1 -31
- package/lib/schema.js +1 -220
- package/lib/telemetry-debug.d.ts +14 -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 +9 -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 +269 -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.js +1 -131
- package/lib/xml.js +1 -323
- package/package.json +1 -3
- package/src/annotations.ts +37 -0
- package/src/api.ts +130 -30
- package/src/category.ts +21 -22
- package/src/config.ts +58 -29
- package/src/debug.ts +9 -6
- package/src/error-category.ts +12 -14
- package/src/errors.ts +7 -7
- package/src/graphql.ts +123 -18
- package/src/index.ts +3 -2
- package/src/pagination.ts +119 -6
- package/src/protocol-http.ts +63 -43
- package/src/protocol-rest.ts +201 -140
- package/src/response-validation.ts +4 -3
- package/src/telemetry-debug.ts +135 -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 +91 -0
- package/src/telemetry-xray.ts +66 -0
- package/src/telemetry.ts +768 -0
- package/lib/api.js.map +0 -1
- package/lib/category.js.map +0 -1
- package/lib/chunks.js.map +0 -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/config.js.map +0 -1
- package/lib/crypto.js.map +0 -1
- package/lib/debug.js.map +0 -1
- package/lib/error-category.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/graphql.js.map +0 -1
- package/lib/graphql.types.js.map +0 -1
- package/lib/index.js.map +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 -227
- package/lib/json-patch.js.map +0 -1
- package/lib/pagination.js.map +0 -1
- package/lib/protocol-http.js.map +0 -1
- package/lib/protocol-rest.js.map +0 -1
- package/lib/query.js.map +0 -1
- package/lib/response-validation-strict.js.map +0 -1
- package/lib/response-validation.js.map +0 -1
- package/lib/retry-after.js.map +0 -1
- package/lib/retry.js.map +0 -1
- package/lib/schema-lite-impl.js.map +0 -1
- package/lib/schema-lite-typed.js.map +0 -1
- package/lib/schema-lite.js.map +0 -1
- package/lib/schema.js.map +0 -1
- package/lib/testing.d.ts +0 -40
- package/lib/testing.d.ts.map +0 -1
- package/lib/testing.js +0 -42
- package/lib/testing.js.map +0 -1
- package/lib/trait.js.map +0 -1
- package/lib/xml.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/json-patch.ts +0 -273
- package/src/testing.ts +0 -74
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import { spawn } from "node:child_process";
|
|
27
|
-
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, symlinkSync, writeFileSync, } from "node:fs";
|
|
28
|
-
import { availableParallelism, freemem } from "node:os";
|
|
29
|
-
import { basename, dirname, join, relative, sep } from "node:path";
|
|
30
|
-
import { diffModels } from "./model-diff.js";
|
|
31
|
-
import { isSmithyPatchPath, PATCH_AUDIT_ENV, PATCH_AUDIT_MARKER, RENAME_MAP_ENV, SKIP_PATCHES_ENV, } from "./patches.js";
|
|
32
|
-
export { diffModels };
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
// files
|
|
35
|
-
const walkJson = (dir) => {
|
|
36
|
-
if (!existsSync(dir))
|
|
37
|
-
return [];
|
|
38
|
-
const out = [];
|
|
39
|
-
for (const entry of readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
40
|
-
const p = join(dir, entry.name);
|
|
41
|
-
if (entry.isDirectory())
|
|
42
|
-
out.push(...walkJson(p));
|
|
43
|
-
else if (entry.name.endsWith(".json"))
|
|
44
|
-
out.push(p);
|
|
45
|
-
}
|
|
46
|
-
return out;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const listPatchFiles = (patchesDir) => {
|
|
50
|
-
const files = [];
|
|
51
|
-
const other = [];
|
|
52
|
-
for (const file of walkJson(patchesDir)) {
|
|
53
|
-
const key = relative(patchesDir, file).split(sep).join("/");
|
|
54
|
-
let parsed;
|
|
55
|
-
try {
|
|
56
|
-
parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
other.push(key);
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
const ops = parsed?.patches;
|
|
63
|
-
if (!Array.isArray(ops)) {
|
|
64
|
-
other.push(key);
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const smithyOnly = ops.every((op) => typeof op?.path === "string" && isSmithyPatchPath(op.path));
|
|
68
|
-
files.push({ key, ops: ops.length, smithyOnly });
|
|
69
|
-
}
|
|
70
|
-
return { files, other };
|
|
71
|
-
};
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
// scratch copies
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const scratchCopy = (pkgDir, index) => {
|
|
83
|
-
const dir = join(dirname(pkgDir), `.audit-${basename(pkgDir)}-${index}`);
|
|
84
|
-
rmSync(dir, { recursive: true, force: true });
|
|
85
|
-
mkdirSync(dir);
|
|
86
|
-
for (const entry of readdirSync(pkgDir, { withFileTypes: true })) {
|
|
87
|
-
const from = join(pkgDir, entry.name);
|
|
88
|
-
const to = join(dir, entry.name);
|
|
89
|
-
// Every convert output dir (`.generated-specs`, Railway's
|
|
90
|
-
// `.generated-graphql`) starts empty, so convert never writes through a
|
|
91
|
-
// symlink into the package.
|
|
92
|
-
if (entry.name.startsWith(".generated"))
|
|
93
|
-
mkdirSync(to);
|
|
94
|
-
else if (entry.name === "scripts" || entry.name === "package.json") {
|
|
95
|
-
cpSync(from, to, { recursive: true });
|
|
96
|
-
}
|
|
97
|
-
else
|
|
98
|
-
symlinkSync(from, to);
|
|
99
|
-
}
|
|
100
|
-
return dir;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const outputs = (copy) => {
|
|
104
|
-
const out = new Map();
|
|
105
|
-
for (const entry of readdirSync(copy, { withFileTypes: true })) {
|
|
106
|
-
if (!entry.isDirectory() || !entry.name.startsWith(".generated"))
|
|
107
|
-
continue;
|
|
108
|
-
const dir = join(copy, entry.name);
|
|
109
|
-
for (const f of walkJson(dir))
|
|
110
|
-
out.set(`${entry.name}/${relative(dir, f)}`, readFileSync(f, "utf8"));
|
|
111
|
-
}
|
|
112
|
-
return out;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const runConvert = (command, cwd, env, onVerdict = () => { }) => new Promise((resolve) => {
|
|
120
|
-
const child = spawn(command, { cwd, env, shell: true, stdio: ["ignore", "pipe", "pipe"] });
|
|
121
|
-
const reported = [];
|
|
122
|
-
const tail = [];
|
|
123
|
-
const keep = (line) => {
|
|
124
|
-
const l = line.trim();
|
|
125
|
-
if (l === "" || l.startsWith(`⚠ ${SKIP_PATCHES_ENV}`))
|
|
126
|
-
return;
|
|
127
|
-
if (l.startsWith("❌"))
|
|
128
|
-
reported.push(l);
|
|
129
|
-
tail.push(l);
|
|
130
|
-
if (tail.length > 20)
|
|
131
|
-
tail.shift();
|
|
132
|
-
};
|
|
133
|
-
const lines = (stream, onLine) => {
|
|
134
|
-
let buffer = "";
|
|
135
|
-
stream.setEncoding("utf8");
|
|
136
|
-
stream.on("data", (chunk) => {
|
|
137
|
-
buffer += chunk;
|
|
138
|
-
let nl;
|
|
139
|
-
while ((nl = buffer.indexOf("\n")) !== -1) {
|
|
140
|
-
onLine(buffer.slice(0, nl));
|
|
141
|
-
buffer = buffer.slice(nl + 1);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
stream.on("end", () => buffer && onLine(buffer));
|
|
145
|
-
};
|
|
146
|
-
lines(child.stdout, (line) => {
|
|
147
|
-
if (line.startsWith(PATCH_AUDIT_MARKER)) {
|
|
148
|
-
onVerdict(JSON.parse(line.slice(PATCH_AUDIT_MARKER.length)));
|
|
149
|
-
}
|
|
150
|
-
else
|
|
151
|
-
keep(line);
|
|
152
|
-
});
|
|
153
|
-
lines(child.stderr, keep);
|
|
154
|
-
child.on("error", (e) => keep(String(e)));
|
|
155
|
-
child.on("close", (code) => {
|
|
156
|
-
// convert reports each bad patch on its own `❌` line before throwing;
|
|
157
|
-
// those name the pointer, the stack trace below them does not.
|
|
158
|
-
const shown = reported.length > 0 ? reported : tail.slice(-2);
|
|
159
|
-
resolve({ ok: code === 0, error: shown.slice(0, 3).join("\n ") });
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
const defaultJobs = () => Math.max(1, Math.min(availableParallelism() - 1, Math.floor(freemem() / 1.5e9)));
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const shard = (keys, n, cost) => {
|
|
173
|
-
const groups = new Map();
|
|
174
|
-
for (const key of keys) {
|
|
175
|
-
const dir = key.includes("/") ? key.slice(0, key.lastIndexOf("/")) : "";
|
|
176
|
-
groups.set(dir, [...(groups.get(dir) ?? []), key]);
|
|
177
|
-
}
|
|
178
|
-
const weighted = [...groups].map(([dir, ks]) => ({ keys: ks, each: cost(dir) }));
|
|
179
|
-
const total = weighted.reduce((sum, g) => sum + g.keys.length * g.each, 0);
|
|
180
|
-
const share = total / n;
|
|
181
|
-
const pieces = [];
|
|
182
|
-
for (const g of weighted) {
|
|
183
|
-
const chunks = Math.min(g.keys.length, Math.max(1, Math.ceil((g.keys.length * g.each) / share)));
|
|
184
|
-
const size = Math.ceil(g.keys.length / chunks);
|
|
185
|
-
for (let i = 0; i < g.keys.length; i += size) {
|
|
186
|
-
const ks = g.keys.slice(i, i + size);
|
|
187
|
-
pieces.push({ keys: ks, cost: ks.length * g.each });
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
const shards = Array.from({ length: Math.min(n, pieces.length) }, () => ({
|
|
191
|
-
keys: [],
|
|
192
|
-
cost: 0,
|
|
193
|
-
}));
|
|
194
|
-
for (const piece of pieces.sort((a, b) => b.cost - a.cost)) {
|
|
195
|
-
const min = shards.reduce((a, b) => (b.cost < a.cost ? b : a));
|
|
196
|
-
min.keys.push(...piece.keys);
|
|
197
|
-
min.cost += piece.cost;
|
|
198
|
-
}
|
|
199
|
-
return shards.map((s) => s.keys).filter((ks) => ks.length > 0);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const mergeVerdicts = (vs) => {
|
|
203
|
-
const failed = vs.find((v) => v.verdict.kind === "depended" || v.verdict.kind === "baseline");
|
|
204
|
-
if (failed && "error" in failed.verdict) {
|
|
205
|
-
return { verdict: { kind: "depended", error: failed.verdict.error }, deadOps: [] };
|
|
206
|
-
}
|
|
207
|
-
const needed = vs.filter((v) => v.verdict.kind === "needed");
|
|
208
|
-
if (needed.length === 0)
|
|
209
|
-
return { verdict: { kind: "unused" }, deadOps: [] };
|
|
210
|
-
const diff = needed.flatMap((v) => v.verdict.kind === "needed"
|
|
211
|
-
? v.verdict.diff.map((line) => (needed.length > 1 ? `${v.model}: ${line}` : line))
|
|
212
|
-
: []);
|
|
213
|
-
// An op is dead only if it changes nothing in any of the models.
|
|
214
|
-
const deadOps = needed.map((v) => v.deadOps).reduce((a, b) => a.filter((i) => b.includes(i)));
|
|
215
|
-
return { verdict: { kind: "needed", diff }, deadOps };
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const withCopies = async (copies, tasks, run) => {
|
|
219
|
-
let next = 0;
|
|
220
|
-
await Promise.all(copies.map(async (copy) => {
|
|
221
|
-
while (next < tasks.length)
|
|
222
|
-
await run(tasks[next++], copy);
|
|
223
|
-
}));
|
|
224
|
-
};
|
|
225
|
-
const auditConvertStage = async (pkgDir, command, files, options, report) => {
|
|
226
|
-
const jobs = Math.max(1, options.jobs ?? defaultJobs());
|
|
227
|
-
const inMemoryKeys = options.inMemory === false ? [] : files.filter((f) => f.smithyOnly).map((f) => f.key);
|
|
228
|
-
// A dir's cost: the size of the committed model it patches (1 MB when
|
|
229
|
-
// there is none to go by, e.g. a root-level file patching every model).
|
|
230
|
-
const specsDir = join(pkgDir, ".generated-specs");
|
|
231
|
-
const cost = (dir) => {
|
|
232
|
-
const model = join(specsDir, `${dir}.json`);
|
|
233
|
-
return dir !== "" && existsSync(model) ? Math.max(1, statSync(model).size / 1e6) : 1;
|
|
234
|
-
};
|
|
235
|
-
const shards = shard(inMemoryKeys, jobs, cost);
|
|
236
|
-
// Even with nothing to judge in memory, one convert builds the baseline.
|
|
237
|
-
if (shards.length === 0)
|
|
238
|
-
shards.push([]);
|
|
239
|
-
const copies = Array.from({ length: Math.max(1, Math.min(jobs, files.length)) }, (_, i) => scratchCopy(pkgDir, i));
|
|
240
|
-
const cleanup = () => {
|
|
241
|
-
for (const c of copies)
|
|
242
|
-
rmSync(c, { recursive: true, force: true });
|
|
243
|
-
};
|
|
244
|
-
const onSignal = () => {
|
|
245
|
-
cleanup();
|
|
246
|
-
process.exit(130);
|
|
247
|
-
};
|
|
248
|
-
process.once("SIGINT", onSignal);
|
|
249
|
-
process.once("SIGTERM", onSignal);
|
|
250
|
-
const byKey = new Map(files.map((f) => [f.key, f]));
|
|
251
|
-
try {
|
|
252
|
-
// 1. In memory: one convert per shard, each on its own copy.
|
|
253
|
-
const verdicts = new Map();
|
|
254
|
-
let baselineError;
|
|
255
|
-
await withCopies(copies, shards, async (keys, copy) => {
|
|
256
|
-
const request = join(copy, ".audit-request.json");
|
|
257
|
-
writeFileSync(request, JSON.stringify({ keys, ops: options.ops === true }));
|
|
258
|
-
const result = await runConvert(command, copy, { ...process.env, [PATCH_AUDIT_ENV]: request, [SKIP_PATCHES_ENV]: "" }, (v) => {
|
|
259
|
-
verdicts.set(v.key, [...(verdicts.get(v.key) ?? []), v]);
|
|
260
|
-
options.onProgress?.();
|
|
261
|
-
});
|
|
262
|
-
if (!result.ok)
|
|
263
|
-
baselineError ??= result.error;
|
|
264
|
-
// A key is complete once its convert has exited: GCP judges one
|
|
265
|
-
// patch dir against both its stable and unstable model.
|
|
266
|
-
for (const key of keys) {
|
|
267
|
-
const vs = verdicts.get(key);
|
|
268
|
-
if (vs)
|
|
269
|
-
report({ file: byKey.get(key), ...mergeVerdicts(vs) });
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
if (baselineError !== undefined)
|
|
273
|
-
return { error: baselineError };
|
|
274
|
-
// 2. Everything else: one convert per file, diffed against the baseline
|
|
275
|
-
// a copy just wrote.
|
|
276
|
-
const perFile = files.filter((f) => !verdicts.has(f.key));
|
|
277
|
-
if (perFile.length > 0) {
|
|
278
|
-
const baseline = outputs(copies[0]);
|
|
279
|
-
const judge = async (skip, copy) => {
|
|
280
|
-
const result = await runConvert(command, copy, {
|
|
281
|
-
...process.env,
|
|
282
|
-
[SKIP_PATCHES_ENV]: skip,
|
|
283
|
-
});
|
|
284
|
-
if (!result.ok)
|
|
285
|
-
return { kind: "depended", error: result.error };
|
|
286
|
-
const diff = diffModels(baseline, outputs(copy));
|
|
287
|
-
return diff.length === 0 ? { kind: "unused" } : { kind: "needed", diff };
|
|
288
|
-
};
|
|
289
|
-
await withCopies(copies, perFile, async (file, copy) => {
|
|
290
|
-
const verdict = await judge(file.key, copy);
|
|
291
|
-
options.onProgress?.();
|
|
292
|
-
const deadOps = [];
|
|
293
|
-
if (options.ops && verdict.kind === "needed" && file.ops > 1) {
|
|
294
|
-
for (let index = 0; index < file.ops; index++) {
|
|
295
|
-
if ((await judge(`${file.key}:${index}`, copy)).kind === "unused")
|
|
296
|
-
deadOps.push(index);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
report({ file, verdict, deadOps });
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
return { inMemory: verdicts.size, perFile: perFile.length };
|
|
303
|
-
}
|
|
304
|
-
finally {
|
|
305
|
-
process.off("SIGINT", onSignal);
|
|
306
|
-
process.off("SIGTERM", onSignal);
|
|
307
|
-
cleanup();
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
export const auditPackage = async (pkgDir, options = {}) => {
|
|
312
|
-
const patchesDir = join(pkgDir, "patches");
|
|
313
|
-
if (!existsSync(patchesDir))
|
|
314
|
-
return { kind: "skipped", reason: "no patches/ directory" };
|
|
315
|
-
const listed = listPatchFiles(patchesDir);
|
|
316
|
-
const files = options.only === undefined
|
|
317
|
-
? listed.files
|
|
318
|
-
: listed.files.filter((f) => f.key.includes(options.only));
|
|
319
|
-
const order = new Map(files.map((f, i) => [f.key, i]));
|
|
320
|
-
const verdicts = [];
|
|
321
|
-
const report = (v) => {
|
|
322
|
-
verdicts.push(v);
|
|
323
|
-
options.onFile?.(v);
|
|
324
|
-
};
|
|
325
|
-
const done = (judged) => ({
|
|
326
|
-
kind: "audited",
|
|
327
|
-
files: verdicts.sort((a, b) => order.get(a.file.key) - order.get(b.file.key)),
|
|
328
|
-
notAudited: listed.other,
|
|
329
|
-
judged,
|
|
330
|
-
});
|
|
331
|
-
if (files.length === 0)
|
|
332
|
-
return done({ inMemory: 0, perFile: 0 });
|
|
333
|
-
const command = JSON.parse(readFileSync(join(pkgDir, "package.json"), "utf8")).scripts?.convert;
|
|
334
|
-
if (!command)
|
|
335
|
-
return { kind: "skipped", reason: "no `convert` script applies patches" };
|
|
336
|
-
const result = await auditConvertStage(pkgDir, command, files, options, report);
|
|
337
|
-
if ("error" in result)
|
|
338
|
-
return { kind: "skipped", reason: `baseline build fails: ${result.error}` };
|
|
339
|
-
return done(result);
|
|
340
|
-
};
|
|
341
|
-
// ---------------------------------------------------------------------------
|
|
342
|
-
// names
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
export const renameMaps = async (pkgDir) => {
|
|
349
|
-
const command = JSON.parse(readFileSync(join(pkgDir, "package.json"), "utf8")).scripts?.convert;
|
|
350
|
-
if (!command)
|
|
351
|
-
return { ok: false, error: "no `convert` script" };
|
|
352
|
-
const copy = scratchCopy(pkgDir, 0);
|
|
353
|
-
try {
|
|
354
|
-
const out = join(copy, ".rename-map.json");
|
|
355
|
-
const result = await runConvert(command, copy, { ...process.env, [RENAME_MAP_ENV]: out });
|
|
356
|
-
// The maps are recorded before the Smithy patches apply, so a convert
|
|
357
|
-
// that fails on a stale patch still names its shapes.
|
|
358
|
-
if (existsSync(out))
|
|
359
|
-
return { ok: true, maps: JSON.parse(readFileSync(out, "utf8")) };
|
|
360
|
-
return result.ok ? { ok: true, maps: {} } : { ok: false, error: result.error };
|
|
361
|
-
}
|
|
362
|
-
finally {
|
|
363
|
-
rmSync(copy, { recursive: true, force: true });
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
//#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AC;QAC1F,sEAAsE;QACtE,sDAAsD;QACtD,IAAI,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;QACtF,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACjF,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC"}
|
package/lib/codegen/patches.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { type JsonPatchOperation } from "../json-patch.ts";
|
|
2
|
-
export type OnStalePatch = "fail" | "warn";
|
|
3
|
-
export interface ApplyPatchesResult {
|
|
4
|
-
files: number;
|
|
5
|
-
applied: number;
|
|
6
|
-
stale: number;
|
|
7
|
-
errors: string[];
|
|
8
|
-
}
|
|
9
|
-
/** Smithy-model JSON pointers — OpenAPI has no `/shapes` tree. */
|
|
10
|
-
export declare const isSmithyPatchPath: (pointer: string) => boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Leave patches out of one convert run (dev-time only; the seam
|
|
13
|
-
* `scripts/patches.ts audit` uses to find patches the spec no longer
|
|
14
|
-
* needs). Comma-separated entries:
|
|
15
|
-
*
|
|
16
|
-
* all skip every patch file
|
|
17
|
-
* <file> skip a file — its basename, or a path suffix
|
|
18
|
-
* (`svc/a.json`) when basenames repeat
|
|
19
|
-
* <file>:<index> skip one op of a file, by its index in `patches`
|
|
20
|
-
*
|
|
21
|
-
* Like `DISTILLED_SPECS_LOCAL`, it lives in one command's environment: a
|
|
22
|
-
* model written under it is announced on stderr and must not be committed.
|
|
23
|
-
*/
|
|
24
|
-
export declare const SKIP_PATCHES_ENV = "DISTILLED_SKIP_PATCHES";
|
|
25
|
-
/**
|
|
26
|
-
* RFC-6902 files in `dir`: every `*.json`, `*.manual.json` last (those
|
|
27
|
-
* usually target post-rename shape names). Missing dir → `[]`. Files named
|
|
28
|
-
* by {@link SKIP_PATCHES_ENV} are left out.
|
|
29
|
-
*/
|
|
30
|
-
export declare const listRfc6902PatchFiles: (dir: string) => Promise<string[]>;
|
|
31
|
-
export declare const applyRfc6902Files: (target: unknown, files: readonly string[], opts?: {
|
|
32
|
-
readonly onStalePatch?: OnStalePatch;
|
|
33
|
-
readonly include?: (op: JsonPatchOperation) => boolean;
|
|
34
|
-
readonly label?: (file: string) => string;
|
|
35
|
-
}) => Promise<ApplyPatchesResult>;
|
|
36
|
-
/**
|
|
37
|
-
* An RFC-6902 `move` that renames an operation shape leaves the service's
|
|
38
|
-
* `operations` list pointing at the old id. Drop entries whose target no
|
|
39
|
-
* longer exists and append operation shapes the list is missing, keeping
|
|
40
|
-
* the existing order. Returns the number of services whose list changed.
|
|
41
|
-
*/
|
|
42
|
-
export declare const syncServiceOperations: (model: {
|
|
43
|
-
shapes?: Record<string, any>;
|
|
44
|
-
}) => number;
|
|
45
|
-
/**
|
|
46
|
-
* Every `target` in a Smithy model must resolve to a shape or a prelude
|
|
47
|
-
* (`smithy.api#…`) id. Returns the dangling ones as `"<owner> → <target>"`.
|
|
48
|
-
* A convert that produces any is broken — generate would emit references
|
|
49
|
-
* to types that do not exist.
|
|
50
|
-
*/
|
|
51
|
-
export declare const danglingTargets: (model: {
|
|
52
|
-
shapes?: Record<string, any>;
|
|
53
|
-
}) => string[];
|
|
54
|
-
export interface FinalizeOptions {
|
|
55
|
-
readonly root: string;
|
|
56
|
-
readonly outDir?: string;
|
|
57
|
-
readonly patchesDir?: string | false;
|
|
58
|
-
/**
|
|
59
|
-
* The directory holding a model's patches, relative to `patchesDir`.
|
|
60
|
-
* Default `<resource>`; `""` for a single-model package whose patches sit
|
|
61
|
-
* at the root of `patchesDir`; `undefined` for none.
|
|
62
|
-
*/
|
|
63
|
-
readonly patchesFor?: (resource: string) => string | undefined;
|
|
64
|
-
readonly exclude?: (file: string) => boolean;
|
|
65
|
-
readonly include?: (resource: string) => boolean;
|
|
66
|
-
readonly transform?: (model: any, resource: string) => string | void;
|
|
67
|
-
readonly operationNaming?: "as-is" | "verbNoun";
|
|
68
|
-
readonly onStalePatch?: OnStalePatch;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Last step of every convert: Smithy RFC-6902 patches, then verbNoun
|
|
72
|
-
* operation names, then an optional model transform, then a reference
|
|
73
|
-
* check. Writes models back so `.generated-specs` is what generate
|
|
74
|
-
* compiles. `outDir` may be nested (GCP `stable/` / `unstable/`).
|
|
75
|
-
*
|
|
76
|
-
* Input must be FRESHLY converted models. Smithy patches are `move`/`add`
|
|
77
|
-
* ops that are not idempotent, and a `transform` may not be either, so
|
|
78
|
-
* running this over a model that already went through it is an error —
|
|
79
|
-
* re-run the package's `convert` instead.
|
|
80
|
-
*
|
|
81
|
-
* Under {@link PATCH_AUDIT_ENV} it also judges the requested patch files
|
|
82
|
-
* in memory (see `./patch-audit.ts`).
|
|
83
|
-
*/
|
|
84
|
-
export declare const finalizeConvert: (o: FinalizeOptions) => Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Path of a JSON file finalizeConvert adds each model's deferred rename to
|
|
87
|
-
* (`{ <model>: { <upstream id>: <final id> } }`). Set by
|
|
88
|
-
* `pnpm patches:names`, which tells a patch author the upstream name of a
|
|
89
|
-
* shape they see in `.generated-specs`.
|
|
90
|
-
*/
|
|
91
|
-
export declare const RENAME_MAP_ENV = "DISTILLED_RENAME_MAP";
|
|
92
|
-
/**
|
|
93
|
-
* Path of a JSON request (`{ keys: string[], ops: boolean }`) asking
|
|
94
|
-
* finalizeConvert to judge those patch files in memory. Set only by
|
|
95
|
-
* `pnpm patches:audit` on a scratch copy of the package; the models it
|
|
96
|
-
* writes are the normal, fully patched ones.
|
|
97
|
-
*
|
|
98
|
-
* Each verdict is printed to stdout as one line, {@link PATCH_AUDIT_MARKER}
|
|
99
|
-
* followed by JSON. A requested key no finalizeConvert call owns (its ops
|
|
100
|
-
* are applied somewhere else, e.g. before conversion) gets no line, and the
|
|
101
|
-
* audit judges it by re-running convert.
|
|
102
|
-
*/
|
|
103
|
-
export declare const PATCH_AUDIT_ENV = "DISTILLED_PATCH_AUDIT";
|
|
104
|
-
export declare const PATCH_AUDIT_MARKER = "@@distilled-patch-audit ";
|
|
105
|
-
/** One finalizeConvert's answer for one patch file. */
|
|
106
|
-
export interface InMemoryVerdict {
|
|
107
|
-
readonly key: string;
|
|
108
|
-
/** Path of the model relative to the package's `.generated-specs`. */
|
|
109
|
-
readonly model: string;
|
|
110
|
-
readonly verdict: {
|
|
111
|
-
readonly kind: "unused";
|
|
112
|
-
} | {
|
|
113
|
-
readonly kind: "needed";
|
|
114
|
-
readonly diff: readonly string[];
|
|
115
|
-
} | {
|
|
116
|
-
readonly kind: "depended";
|
|
117
|
-
readonly error: string;
|
|
118
|
-
} | {
|
|
119
|
-
readonly kind: "baseline";
|
|
120
|
-
readonly error: string;
|
|
121
|
-
};
|
|
122
|
-
readonly deadOps: readonly number[];
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Metadata marker stamped by {@link finalizeConvert}. Guards against a
|
|
126
|
-
* second pass over the same file (see the note on finalizeConvert).
|
|
127
|
-
*/
|
|
128
|
-
export declare const FINALIZED_KEY = "distilled.finalized";
|
|
129
|
-
//# sourceMappingURL=patches.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patches.d.ts","sourceRoot":"","sources":["../../src/codegen/patches.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,kBAAkB,CAAC;AAQ1B,MAAM,MA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