autotel-eventcatalog 18.0.0 → 20.0.0

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 20.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d303348]
8
+ - autotel-subscribers@50.0.0
9
+
10
+ ## 19.0.0
11
+
12
+ ### Patch Changes
13
+
14
+ - autotel-subscribers@49.0.0
15
+
3
16
  ## 18.0.0
4
17
 
5
18
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- const require_generate = require('./generate-CHjGIFJe.cjs');
2
+ const require_generate = require('./generate-C1vYn-_M.cjs');
3
3
  let node_fs_promises = require("node:fs/promises");
4
4
  let node_path = require("node:path");
5
5
  let node_url = require("node:url");
@@ -34,7 +34,7 @@ async function loadRendererModule(modulePath) {
34
34
  try {
35
35
  mod = await import((0, node_url.pathToFileURL)(resolved).href);
36
36
  } catch (error) {
37
- process.stderr.write(`Failed to load renderer module ${modulePath}: ${error.message}\n`);
37
+ process.stderr.write(`Failed to load renderer module ${modulePath}: ${error instanceof Error ? error.message : String(error)}\n`);
38
38
  process.exit(2);
39
39
  }
40
40
  const candidate = mod.default ?? mod.renderer;
@@ -45,7 +45,7 @@ async function loadRendererModule(modulePath) {
45
45
  try {
46
46
  require_generate.registerRenderer(candidate);
47
47
  } catch (error) {
48
- process.stderr.write(`${error.message}\n`);
48
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
49
49
  process.exit(2);
50
50
  }
51
51
  }
@@ -429,7 +429,7 @@ async function main() {
429
429
  await runDrift(args);
430
430
  }
431
431
  main().catch((error) => {
432
- process.stderr.write(`autotel-eventcatalog: ${error.message}\n`);
432
+ process.stderr.write(`autotel-eventcatalog: ${error instanceof Error ? error.message : String(error)}\n`);
433
433
  process.exit(1);
434
434
  });
435
435
 
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as countDriftEntries, F as readCatalogState, I as loadSnapshot, M as diffCatalogAgainstSnapshot, O as compareDriftReports, d as evaluatePolicy, g as registerRenderer, h as listRendererNames, j as countDriftReport, l as buildStampSummary, m as getRenderer, n as buildGenerateSummary, r as generateCatalogFromSnapshot, u as stampCatalog } from "./generate-r5KccyNS.js";
2
+ import { A as countDriftEntries, F as readCatalogState, I as loadSnapshot, M as diffCatalogAgainstSnapshot, O as compareDriftReports, d as evaluatePolicy, g as registerRenderer, h as listRendererNames, j as countDriftReport, l as buildStampSummary, m as getRenderer, n as buildGenerateSummary, r as generateCatalogFromSnapshot, u as stampCatalog } from "./generate-w_py2l3I.js";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { dirname, resolve } from "node:path";
5
5
  import { pathToFileURL } from "node:url";
@@ -34,7 +34,7 @@ async function loadRendererModule(modulePath) {
34
34
  try {
35
35
  mod = await import(pathToFileURL(resolved).href);
36
36
  } catch (error) {
37
- process.stderr.write(`Failed to load renderer module ${modulePath}: ${error.message}\n`);
37
+ process.stderr.write(`Failed to load renderer module ${modulePath}: ${error instanceof Error ? error.message : String(error)}\n`);
38
38
  process.exit(2);
39
39
  }
40
40
  const candidate = mod.default ?? mod.renderer;
@@ -45,7 +45,7 @@ async function loadRendererModule(modulePath) {
45
45
  try {
46
46
  registerRenderer(candidate);
47
47
  } catch (error) {
48
- process.stderr.write(`${error.message}\n`);
48
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
49
49
  process.exit(2);
50
50
  }
51
51
  }
@@ -429,7 +429,7 @@ async function main() {
429
429
  await runDrift(args);
430
430
  }
431
431
  main().catch((error) => {
432
- process.stderr.write(`autotel-eventcatalog: ${error.message}\n`);
432
+ process.stderr.write(`autotel-eventcatalog: ${error instanceof Error ? error.message : String(error)}\n`);
433
433
  process.exit(1);
434
434
  });
435
435
 
@@ -46,14 +46,14 @@ async function loadSnapshot(path) {
46
46
  } catch (err) {
47
47
  if (isNodeFsError(err) && err.code === "ENOENT") throw new Error(`Snapshot not found: ${path}`);
48
48
  if (isNodeFsError(err) && err.code === "EISDIR") throw new Error(`Snapshot path is a directory, not a file: ${path}`);
49
- throw new Error(`Could not read snapshot at ${path}: ${err.message}`);
49
+ throw new Error(`Could not read snapshot at ${path}: ${err instanceof Error ? err.message : String(err)}`);
50
50
  }
51
51
  if (raw.trim().length === 0) throw new Error(`Snapshot is empty: ${path}`);
52
52
  let parsed;
53
53
  try {
54
54
  parsed = JSON.parse(raw);
55
55
  } catch (err) {
56
- throw new Error(`Snapshot is not valid JSON: ${path} (${err.message})`);
56
+ throw new Error(`Snapshot is not valid JSON: ${path} (${err instanceof Error ? err.message : String(err)})`);
57
57
  }
58
58
  return validateSnapshot(parsed, path);
59
59
  }
@@ -82,8 +82,8 @@ function validateSnapshot(parsed, path) {
82
82
  function isJsonObject(value) {
83
83
  return typeof value === "object" && value !== null && !Array.isArray(value);
84
84
  }
85
- function isNodeFsError(err) {
86
- return err instanceof Error && typeof err.code === "string";
85
+ function isNodeFsError(cause) {
86
+ return cause instanceof Error && typeof cause.code === "string";
87
87
  }
88
88
  function describe(value) {
89
89
  if (value === null) return "null";
@@ -150,42 +150,35 @@ function extractDeclaredFieldPaths(schema, prefix = "") {
150
150
  return [...out].toSorted();
151
151
  }
152
152
  function walkSchema(schema, prefix, out) {
153
- if (!schema || typeof schema !== "object") return;
154
- const s = schema;
155
- if (s.properties && typeof s.properties === "object") for (const [key, sub] of Object.entries(s.properties)) {
153
+ if (!schema) return;
154
+ for (const [key, sub] of Object.entries(schema.properties ?? {})) {
156
155
  const path = prefix === "" ? key : `${prefix}.${key}`;
157
156
  out.add(path);
158
157
  walkSchema(sub, path, out);
159
158
  }
160
- if (s.items) {
161
- const arrayPrefix = prefix + "[]";
162
- walkSchema(s.items, arrayPrefix, out);
163
- }
159
+ if (schema.items) walkSchema(schema.items, prefix + "[]", out);
164
160
  }
165
161
  function extractDeclaredSchemaConstraints(schema, prefix = "") {
166
162
  const out = /* @__PURE__ */ new Map();
167
163
  walkSchemaConstraints(schema, prefix, out);
168
- const obj = {};
169
- for (const [path, c] of out) obj[path] = c;
170
- return obj;
164
+ return Object.fromEntries(out);
171
165
  }
172
166
  function walkSchemaConstraints(schema, prefix, out) {
173
- if (!schema || typeof schema !== "object") return;
174
- const s = schema;
175
- const typeVal = s.type;
176
- const enumVal = s.enum;
167
+ if (!schema) return;
168
+ const typeVal = schema.type;
169
+ const enumVal = schema.enum;
177
170
  if (prefix !== "" && (typeVal !== void 0 || enumVal !== void 0)) {
178
171
  const types = toTypeArray(typeVal);
179
172
  const enumValues = Array.isArray(enumVal) ? [...enumVal] : void 0;
180
- out.set(prefix, {
181
- ...types.length > 0 ? { types } : {},
182
- ...enumValues ? { enumValues } : {}
183
- });
173
+ const field = {};
174
+ if (types.length > 0) field.types = types;
175
+ if (enumValues) field.enumValues = enumValues;
176
+ out.set(prefix, field);
184
177
  }
185
- if (s.properties && typeof s.properties === "object") for (const [key, sub] of Object.entries(s.properties)) walkSchemaConstraints(sub, prefix === "" ? key : `${prefix}.${key}`, out);
186
- if (s.items) {
178
+ for (const [key, sub] of Object.entries(schema.properties ?? {})) walkSchemaConstraints(sub, prefix === "" ? key : `${prefix}.${key}`, out);
179
+ if (schema.items) {
187
180
  const arrayPrefix = prefix + "[]";
188
- walkSchemaConstraints(s.items, arrayPrefix, out);
181
+ walkSchemaConstraints(schema.items, arrayPrefix, out);
189
182
  }
190
183
  }
191
184
  function toTypeArray(typeVal) {
@@ -1021,10 +1014,10 @@ async function generateCatalogFromSnapshot(opts) {
1021
1014
  summary: `Generated from autotel snapshot event "${snapshotName}"`,
1022
1015
  schemaPath: "schema.json",
1023
1016
  markdown: buildEventMarkdown(snapshotName, obs, schemaSource),
1024
- ...obs.channel ? { channels: [{
1017
+ channels: obs.channel ? [{
1025
1018
  id: obs.channel,
1026
1019
  version: DEFAULT_VERSION
1027
- }] } : {}
1020
+ }] : void 0
1028
1021
  });
1029
1022
  await sdk.addSchemaToEvent(eventId, {
1030
1023
  schema: JSON.stringify(schema, null, 2),
@@ -1157,7 +1150,7 @@ function insertSchemaPath(root, path, observedTypes) {
1157
1150
  for (let i = 0; i < steps.length; i++) {
1158
1151
  const step = steps[i];
1159
1152
  const last = i === steps.length - 1;
1160
- if (!current.properties || typeof current.properties !== "object") current.properties = {};
1153
+ current.properties ??= {};
1161
1154
  const properties = current.properties;
1162
1155
  const next = properties[step.key] ?? {};
1163
1156
  properties[step.key] = next;
@@ -18,14 +18,14 @@ async function loadSnapshot(path) {
18
18
  } catch (err) {
19
19
  if (isNodeFsError(err) && err.code === "ENOENT") throw new Error(`Snapshot not found: ${path}`);
20
20
  if (isNodeFsError(err) && err.code === "EISDIR") throw new Error(`Snapshot path is a directory, not a file: ${path}`);
21
- throw new Error(`Could not read snapshot at ${path}: ${err.message}`);
21
+ throw new Error(`Could not read snapshot at ${path}: ${err instanceof Error ? err.message : String(err)}`);
22
22
  }
23
23
  if (raw.trim().length === 0) throw new Error(`Snapshot is empty: ${path}`);
24
24
  let parsed;
25
25
  try {
26
26
  parsed = JSON.parse(raw);
27
27
  } catch (err) {
28
- throw new Error(`Snapshot is not valid JSON: ${path} (${err.message})`);
28
+ throw new Error(`Snapshot is not valid JSON: ${path} (${err instanceof Error ? err.message : String(err)})`);
29
29
  }
30
30
  return validateSnapshot(parsed, path);
31
31
  }
@@ -54,8 +54,8 @@ function validateSnapshot(parsed, path) {
54
54
  function isJsonObject(value) {
55
55
  return typeof value === "object" && value !== null && !Array.isArray(value);
56
56
  }
57
- function isNodeFsError(err) {
58
- return err instanceof Error && typeof err.code === "string";
57
+ function isNodeFsError(cause) {
58
+ return cause instanceof Error && typeof cause.code === "string";
59
59
  }
60
60
  function describe(value) {
61
61
  if (value === null) return "null";
@@ -122,42 +122,35 @@ function extractDeclaredFieldPaths(schema, prefix = "") {
122
122
  return [...out].toSorted();
123
123
  }
124
124
  function walkSchema(schema, prefix, out) {
125
- if (!schema || typeof schema !== "object") return;
126
- const s = schema;
127
- if (s.properties && typeof s.properties === "object") for (const [key, sub] of Object.entries(s.properties)) {
125
+ if (!schema) return;
126
+ for (const [key, sub] of Object.entries(schema.properties ?? {})) {
128
127
  const path = prefix === "" ? key : `${prefix}.${key}`;
129
128
  out.add(path);
130
129
  walkSchema(sub, path, out);
131
130
  }
132
- if (s.items) {
133
- const arrayPrefix = prefix + "[]";
134
- walkSchema(s.items, arrayPrefix, out);
135
- }
131
+ if (schema.items) walkSchema(schema.items, prefix + "[]", out);
136
132
  }
137
133
  function extractDeclaredSchemaConstraints(schema, prefix = "") {
138
134
  const out = /* @__PURE__ */ new Map();
139
135
  walkSchemaConstraints(schema, prefix, out);
140
- const obj = {};
141
- for (const [path, c] of out) obj[path] = c;
142
- return obj;
136
+ return Object.fromEntries(out);
143
137
  }
144
138
  function walkSchemaConstraints(schema, prefix, out) {
145
- if (!schema || typeof schema !== "object") return;
146
- const s = schema;
147
- const typeVal = s.type;
148
- const enumVal = s.enum;
139
+ if (!schema) return;
140
+ const typeVal = schema.type;
141
+ const enumVal = schema.enum;
149
142
  if (prefix !== "" && (typeVal !== void 0 || enumVal !== void 0)) {
150
143
  const types = toTypeArray(typeVal);
151
144
  const enumValues = Array.isArray(enumVal) ? [...enumVal] : void 0;
152
- out.set(prefix, {
153
- ...types.length > 0 ? { types } : {},
154
- ...enumValues ? { enumValues } : {}
155
- });
145
+ const field = {};
146
+ if (types.length > 0) field.types = types;
147
+ if (enumValues) field.enumValues = enumValues;
148
+ out.set(prefix, field);
156
149
  }
157
- if (s.properties && typeof s.properties === "object") for (const [key, sub] of Object.entries(s.properties)) walkSchemaConstraints(sub, prefix === "" ? key : `${prefix}.${key}`, out);
158
- if (s.items) {
150
+ for (const [key, sub] of Object.entries(schema.properties ?? {})) walkSchemaConstraints(sub, prefix === "" ? key : `${prefix}.${key}`, out);
151
+ if (schema.items) {
159
152
  const arrayPrefix = prefix + "[]";
160
- walkSchemaConstraints(s.items, arrayPrefix, out);
153
+ walkSchemaConstraints(schema.items, arrayPrefix, out);
161
154
  }
162
155
  }
163
156
  function toTypeArray(typeVal) {
@@ -993,10 +986,10 @@ async function generateCatalogFromSnapshot(opts) {
993
986
  summary: `Generated from autotel snapshot event "${snapshotName}"`,
994
987
  schemaPath: "schema.json",
995
988
  markdown: buildEventMarkdown(snapshotName, obs, schemaSource),
996
- ...obs.channel ? { channels: [{
989
+ channels: obs.channel ? [{
997
990
  id: obs.channel,
998
991
  version: DEFAULT_VERSION
999
- }] } : {}
992
+ }] : void 0
1000
993
  });
1001
994
  await sdk.addSchemaToEvent(eventId, {
1002
995
  schema: JSON.stringify(schema, null, 2),
@@ -1129,7 +1122,7 @@ function insertSchemaPath(root, path, observedTypes) {
1129
1122
  for (let i = 0; i < steps.length; i++) {
1130
1123
  const step = steps[i];
1131
1124
  const last = i === steps.length - 1;
1132
- if (!current.properties || typeof current.properties !== "object") current.properties = {};
1125
+ current.properties ??= {};
1133
1126
  const properties = current.properties;
1134
1127
  const next = properties[step.key] ?? {};
1135
1128
  properties[step.key] = next;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const require_generate = require('./generate-CHjGIFJe.cjs');
3
+ const require_generate = require('./generate-C1vYn-_M.cjs');
4
4
 
5
5
  exports.EVENTCATALOG_SNAPSHOT_DIFF_SPEC = require_generate.EVENTCATALOG_SNAPSHOT_DIFF_SPEC;
6
6
  exports.GENERATE_SUMMARY_SPEC = require_generate.GENERATE_SUMMARY_SPEC;
package/dist/index.d.cts CHANGED
@@ -11,6 +11,86 @@ import { Channel, Event, Service } from "@eventcatalog/sdk";
11
11
  */
12
12
  declare function loadSnapshot(path: string): Promise<ArchitectureSnapshot$1>;
13
13
  //#endregion
14
+ //#region src/generate.d.ts
15
+ interface GenerateOptions {
16
+ snapshot: ArchitectureSnapshot;
17
+ catalogPath: string;
18
+ dryRun?: boolean;
19
+ edgesOnly?: boolean;
20
+ /** Version to assign to newly created resources. Defaults to '1.0.0'. */
21
+ version?: string;
22
+ }
23
+ type GenerateSummaryItem = {
24
+ kind: 'service' | 'event' | 'channel' | 'service-edge' | 'channel-edge';
25
+ id: string;
26
+ action: 'create' | 'exists' | 'link' | 'would-create' | 'would-link';
27
+ detail?: string;
28
+ /** For event items: where the JSON Schema came from. */
29
+ schemaSource?: 'declared' | 'inferred';
30
+ };
31
+ interface GenerateResult {
32
+ operations: GenerateSummaryItem[];
33
+ }
34
+ declare const GENERATE_SUMMARY_SPEC: "autotel-eventcatalog-generate-summary/v0.1.0";
35
+ type GenerateSummary = {
36
+ spec: typeof GENERATE_SUMMARY_SPEC;
37
+ dryRun: boolean;
38
+ edgesOnly: boolean;
39
+ attempted: number;
40
+ /** Top-level totals for dashboards / status checks. */
41
+ totals: {
42
+ created: number;
43
+ linked: number;
44
+ skipped: number;
45
+ };
46
+ /** Per-kind counts so consumers can render detail without re-deriving from `operations`. */
47
+ created: {
48
+ services: string[];
49
+ events: string[];
50
+ channels: string[];
51
+ };
52
+ edges: {
53
+ sends: {
54
+ service: string;
55
+ event: string;
56
+ }[];
57
+ receives: {
58
+ service: string;
59
+ event: string;
60
+ }[];
61
+ messages: {
62
+ channel: string;
63
+ event: string;
64
+ }[];
65
+ };
66
+ /** Counts of declared- vs inferred-schema events created. Reveals adoption of `defineEvent`. */
67
+ schemaSources: {
68
+ declared: number;
69
+ inferred: number;
70
+ };
71
+ skipped: {
72
+ services: string[];
73
+ events: string[];
74
+ channels: string[];
75
+ };
76
+ };
77
+ /** A JSON Schema node, as this generator builds one. */
78
+ interface JsonSchemaNode {
79
+ $schema?: string;
80
+ type?: string | string[];
81
+ enum?: Array<string | number | boolean | null>;
82
+ properties?: Record<string, JsonSchemaNode>;
83
+ items?: JsonSchemaNode;
84
+ format?: string;
85
+ description?: string;
86
+ }
87
+ declare function generateCatalogFromSnapshot(opts: GenerateOptions): Promise<GenerateResult>;
88
+ declare function buildGenerateSummary(result: GenerateResult, options: {
89
+ dryRun: boolean;
90
+ edgesOnly: boolean;
91
+ }): GenerateSummary;
92
+ declare function inferJsonSchemaFromObservation(observation: EventObservation): JsonSchemaNode;
93
+ //#endregion
14
94
  //#region src/catalog.d.ts
15
95
  type SchemaConstraint = {
16
96
  types?: string[];
@@ -40,7 +120,7 @@ declare function readCatalogState(catalogPath: string): Promise<CatalogState>;
40
120
  * used by the snapshot subscriber: arrays collapse to `[]`, nested objects
41
121
  * use `.`. We walk `properties` (objects) and `items` (arrays).
42
122
  */
43
- declare function extractDeclaredFieldPaths(schema: unknown, prefix?: string): string[];
123
+ declare function extractDeclaredFieldPaths(schema: JsonSchemaNode | undefined, prefix?: string): string[];
44
124
  //#endregion
45
125
  //#region src/diff.d.ts
46
126
  type EventDrift = {
@@ -345,74 +425,4 @@ type StampSummary = {
345
425
  };
346
426
  declare function buildStampSummary(result: StampResult, dryRun: boolean): StampSummary;
347
427
  //#endregion
348
- //#region src/generate.d.ts
349
- interface GenerateOptions {
350
- snapshot: ArchitectureSnapshot;
351
- catalogPath: string;
352
- dryRun?: boolean;
353
- edgesOnly?: boolean;
354
- /** Version to assign to newly created resources. Defaults to '1.0.0'. */
355
- version?: string;
356
- }
357
- type GenerateSummaryItem = {
358
- kind: 'service' | 'event' | 'channel' | 'service-edge' | 'channel-edge';
359
- id: string;
360
- action: 'create' | 'exists' | 'link' | 'would-create' | 'would-link';
361
- detail?: string;
362
- /** For event items: where the JSON Schema came from. */
363
- schemaSource?: 'declared' | 'inferred';
364
- };
365
- interface GenerateResult {
366
- operations: GenerateSummaryItem[];
367
- }
368
- declare const GENERATE_SUMMARY_SPEC: "autotel-eventcatalog-generate-summary/v0.1.0";
369
- type GenerateSummary = {
370
- spec: typeof GENERATE_SUMMARY_SPEC;
371
- dryRun: boolean;
372
- edgesOnly: boolean;
373
- attempted: number;
374
- /** Top-level totals for dashboards / status checks. */
375
- totals: {
376
- created: number;
377
- linked: number;
378
- skipped: number;
379
- };
380
- /** Per-kind counts so consumers can render detail without re-deriving from `operations`. */
381
- created: {
382
- services: string[];
383
- events: string[];
384
- channels: string[];
385
- };
386
- edges: {
387
- sends: {
388
- service: string;
389
- event: string;
390
- }[];
391
- receives: {
392
- service: string;
393
- event: string;
394
- }[];
395
- messages: {
396
- channel: string;
397
- event: string;
398
- }[];
399
- };
400
- /** Counts of declared- vs inferred-schema events created. Reveals adoption of `defineEvent`. */
401
- schemaSources: {
402
- declared: number;
403
- inferred: number;
404
- };
405
- skipped: {
406
- services: string[];
407
- events: string[];
408
- channels: string[];
409
- };
410
- };
411
- declare function generateCatalogFromSnapshot(opts: GenerateOptions): Promise<GenerateResult>;
412
- declare function buildGenerateSummary(result: GenerateResult, options: {
413
- dryRun: boolean;
414
- edgesOnly: boolean;
415
- }): GenerateSummary;
416
- declare function inferJsonSchemaFromObservation(observation: EventObservation): Record<string, unknown>;
417
- //#endregion
418
428
  export { type ArchitectureSnapshot, type CatalogChannel, type CatalogEvent, type CatalogService, type CatalogState, type ChannelDrift, type DriftCounts, type DriftDelta, type DriftEntries, type DriftPolicyMode, type DriftReport, EVENTCATALOG_SNAPSHOT_DIFF_SPEC, type EventCatalogSnapshotDiff, type EventCatalogSnapshotDiffEnvelope, type EventDrift, type EventObservation, type FieldDrift, GENERATE_SUMMARY_SPEC, type GenerateOptions, type GenerateResult, type GenerateSummary, type GenerateSummaryItem, type JsonReport, type JsonReportEnvelope, type PolicyEvaluationInput, type PolicyEvaluationResult, RENDERERS, RENDERER_NAMES, REPORT_SPEC, type RelationshipChange, type Renderer, type RendererName, type ResourceChange, STAMP_END, STAMP_START, STAMP_SUMMARY_SPEC, type ServiceDrift, type StampOptions, type StampResult, type StampSkip, type StampSummary, type StampUpdate, buildGenerateSummary, buildStampBlock, buildStampSummary, compareDriftReports, countDriftDelta, countDriftEntries, countDriftReport, diffCatalogAgainstSnapshot, evaluatePolicy, extractDeclaredFieldPaths, generateCatalogFromSnapshot, getRenderer, hasDrift, inferJsonSchemaFromObservation, loadSnapshot, readCatalogState, renderDeltaMarkdown, renderDeltaTerminal, renderEventCatalogSnapshotDiffFromDelta, renderEventCatalogSnapshotDiffFromReport, renderJson, renderMarkdown, renderTerminal, stampCatalog, toSnapshotDiffFromDelta, toSnapshotDiffFromReport };
package/dist/index.d.ts CHANGED
@@ -11,6 +11,86 @@ import { ArchitectureSnapshot, ArchitectureSnapshot as ArchitectureSnapshot$1, E
11
11
  */
12
12
  declare function loadSnapshot(path: string): Promise<ArchitectureSnapshot$1>;
13
13
  //#endregion
14
+ //#region src/generate.d.ts
15
+ interface GenerateOptions {
16
+ snapshot: ArchitectureSnapshot;
17
+ catalogPath: string;
18
+ dryRun?: boolean;
19
+ edgesOnly?: boolean;
20
+ /** Version to assign to newly created resources. Defaults to '1.0.0'. */
21
+ version?: string;
22
+ }
23
+ type GenerateSummaryItem = {
24
+ kind: 'service' | 'event' | 'channel' | 'service-edge' | 'channel-edge';
25
+ id: string;
26
+ action: 'create' | 'exists' | 'link' | 'would-create' | 'would-link';
27
+ detail?: string;
28
+ /** For event items: where the JSON Schema came from. */
29
+ schemaSource?: 'declared' | 'inferred';
30
+ };
31
+ interface GenerateResult {
32
+ operations: GenerateSummaryItem[];
33
+ }
34
+ declare const GENERATE_SUMMARY_SPEC: "autotel-eventcatalog-generate-summary/v0.1.0";
35
+ type GenerateSummary = {
36
+ spec: typeof GENERATE_SUMMARY_SPEC;
37
+ dryRun: boolean;
38
+ edgesOnly: boolean;
39
+ attempted: number;
40
+ /** Top-level totals for dashboards / status checks. */
41
+ totals: {
42
+ created: number;
43
+ linked: number;
44
+ skipped: number;
45
+ };
46
+ /** Per-kind counts so consumers can render detail without re-deriving from `operations`. */
47
+ created: {
48
+ services: string[];
49
+ events: string[];
50
+ channels: string[];
51
+ };
52
+ edges: {
53
+ sends: {
54
+ service: string;
55
+ event: string;
56
+ }[];
57
+ receives: {
58
+ service: string;
59
+ event: string;
60
+ }[];
61
+ messages: {
62
+ channel: string;
63
+ event: string;
64
+ }[];
65
+ };
66
+ /** Counts of declared- vs inferred-schema events created. Reveals adoption of `defineEvent`. */
67
+ schemaSources: {
68
+ declared: number;
69
+ inferred: number;
70
+ };
71
+ skipped: {
72
+ services: string[];
73
+ events: string[];
74
+ channels: string[];
75
+ };
76
+ };
77
+ /** A JSON Schema node, as this generator builds one. */
78
+ interface JsonSchemaNode {
79
+ $schema?: string;
80
+ type?: string | string[];
81
+ enum?: Array<string | number | boolean | null>;
82
+ properties?: Record<string, JsonSchemaNode>;
83
+ items?: JsonSchemaNode;
84
+ format?: string;
85
+ description?: string;
86
+ }
87
+ declare function generateCatalogFromSnapshot(opts: GenerateOptions): Promise<GenerateResult>;
88
+ declare function buildGenerateSummary(result: GenerateResult, options: {
89
+ dryRun: boolean;
90
+ edgesOnly: boolean;
91
+ }): GenerateSummary;
92
+ declare function inferJsonSchemaFromObservation(observation: EventObservation): JsonSchemaNode;
93
+ //#endregion
14
94
  //#region src/catalog.d.ts
15
95
  type SchemaConstraint = {
16
96
  types?: string[];
@@ -40,7 +120,7 @@ declare function readCatalogState(catalogPath: string): Promise<CatalogState>;
40
120
  * used by the snapshot subscriber: arrays collapse to `[]`, nested objects
41
121
  * use `.`. We walk `properties` (objects) and `items` (arrays).
42
122
  */
43
- declare function extractDeclaredFieldPaths(schema: unknown, prefix?: string): string[];
123
+ declare function extractDeclaredFieldPaths(schema: JsonSchemaNode | undefined, prefix?: string): string[];
44
124
  //#endregion
45
125
  //#region src/diff.d.ts
46
126
  type EventDrift = {
@@ -345,74 +425,4 @@ type StampSummary = {
345
425
  };
346
426
  declare function buildStampSummary(result: StampResult, dryRun: boolean): StampSummary;
347
427
  //#endregion
348
- //#region src/generate.d.ts
349
- interface GenerateOptions {
350
- snapshot: ArchitectureSnapshot;
351
- catalogPath: string;
352
- dryRun?: boolean;
353
- edgesOnly?: boolean;
354
- /** Version to assign to newly created resources. Defaults to '1.0.0'. */
355
- version?: string;
356
- }
357
- type GenerateSummaryItem = {
358
- kind: 'service' | 'event' | 'channel' | 'service-edge' | 'channel-edge';
359
- id: string;
360
- action: 'create' | 'exists' | 'link' | 'would-create' | 'would-link';
361
- detail?: string;
362
- /** For event items: where the JSON Schema came from. */
363
- schemaSource?: 'declared' | 'inferred';
364
- };
365
- interface GenerateResult {
366
- operations: GenerateSummaryItem[];
367
- }
368
- declare const GENERATE_SUMMARY_SPEC: "autotel-eventcatalog-generate-summary/v0.1.0";
369
- type GenerateSummary = {
370
- spec: typeof GENERATE_SUMMARY_SPEC;
371
- dryRun: boolean;
372
- edgesOnly: boolean;
373
- attempted: number;
374
- /** Top-level totals for dashboards / status checks. */
375
- totals: {
376
- created: number;
377
- linked: number;
378
- skipped: number;
379
- };
380
- /** Per-kind counts so consumers can render detail without re-deriving from `operations`. */
381
- created: {
382
- services: string[];
383
- events: string[];
384
- channels: string[];
385
- };
386
- edges: {
387
- sends: {
388
- service: string;
389
- event: string;
390
- }[];
391
- receives: {
392
- service: string;
393
- event: string;
394
- }[];
395
- messages: {
396
- channel: string;
397
- event: string;
398
- }[];
399
- };
400
- /** Counts of declared- vs inferred-schema events created. Reveals adoption of `defineEvent`. */
401
- schemaSources: {
402
- declared: number;
403
- inferred: number;
404
- };
405
- skipped: {
406
- services: string[];
407
- events: string[];
408
- channels: string[];
409
- };
410
- };
411
- declare function generateCatalogFromSnapshot(opts: GenerateOptions): Promise<GenerateResult>;
412
- declare function buildGenerateSummary(result: GenerateResult, options: {
413
- dryRun: boolean;
414
- edgesOnly: boolean;
415
- }): GenerateSummary;
416
- declare function inferJsonSchemaFromObservation(observation: EventObservation): Record<string, unknown>;
417
- //#endregion
418
428
  export { type ArchitectureSnapshot, type CatalogChannel, type CatalogEvent, type CatalogService, type CatalogState, type ChannelDrift, type DriftCounts, type DriftDelta, type DriftEntries, type DriftPolicyMode, type DriftReport, EVENTCATALOG_SNAPSHOT_DIFF_SPEC, type EventCatalogSnapshotDiff, type EventCatalogSnapshotDiffEnvelope, type EventDrift, type EventObservation, type FieldDrift, GENERATE_SUMMARY_SPEC, type GenerateOptions, type GenerateResult, type GenerateSummary, type GenerateSummaryItem, type JsonReport, type JsonReportEnvelope, type PolicyEvaluationInput, type PolicyEvaluationResult, RENDERERS, RENDERER_NAMES, REPORT_SPEC, type RelationshipChange, type Renderer, type RendererName, type ResourceChange, STAMP_END, STAMP_START, STAMP_SUMMARY_SPEC, type ServiceDrift, type StampOptions, type StampResult, type StampSkip, type StampSummary, type StampUpdate, buildGenerateSummary, buildStampBlock, buildStampSummary, compareDriftReports, countDriftDelta, countDriftEntries, countDriftReport, diffCatalogAgainstSnapshot, evaluatePolicy, extractDeclaredFieldPaths, generateCatalogFromSnapshot, getRenderer, hasDrift, inferJsonSchemaFromObservation, loadSnapshot, readCatalogState, renderDeltaMarkdown, renderDeltaTerminal, renderEventCatalogSnapshotDiffFromDelta, renderEventCatalogSnapshotDiffFromReport, renderJson, renderMarkdown, renderTerminal, stampCatalog, toSnapshotDiffFromDelta, toSnapshotDiffFromReport };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- import { A as countDriftEntries, C as renderJson, D as renderMarkdown, E as renderDeltaMarkdown, F as readCatalogState, I as loadSnapshot, M as diffCatalogAgainstSnapshot, N as hasDrift, O as compareDriftReports, P as extractDeclaredFieldPaths, S as REPORT_SPEC, T as renderTerminal, _ as EVENTCATALOG_SNAPSHOT_DIFF_SPEC, a as STAMP_END, b as toSnapshotDiffFromDelta, c as buildStampBlock, d as evaluatePolicy, f as RENDERERS, i as inferJsonSchemaFromObservation, j as countDriftReport, k as countDriftDelta, l as buildStampSummary, m as getRenderer, n as buildGenerateSummary, o as STAMP_START, p as RENDERER_NAMES, r as generateCatalogFromSnapshot, s as STAMP_SUMMARY_SPEC, t as GENERATE_SUMMARY_SPEC, u as stampCatalog, v as renderEventCatalogSnapshotDiffFromDelta, w as renderDeltaTerminal, x as toSnapshotDiffFromReport, y as renderEventCatalogSnapshotDiffFromReport } from "./generate-r5KccyNS.js";
2
+ import { A as countDriftEntries, C as renderJson, D as renderMarkdown, E as renderDeltaMarkdown, F as readCatalogState, I as loadSnapshot, M as diffCatalogAgainstSnapshot, N as hasDrift, O as compareDriftReports, P as extractDeclaredFieldPaths, S as REPORT_SPEC, T as renderTerminal, _ as EVENTCATALOG_SNAPSHOT_DIFF_SPEC, a as STAMP_END, b as toSnapshotDiffFromDelta, c as buildStampBlock, d as evaluatePolicy, f as RENDERERS, i as inferJsonSchemaFromObservation, j as countDriftReport, k as countDriftDelta, l as buildStampSummary, m as getRenderer, n as buildGenerateSummary, o as STAMP_START, p as RENDERER_NAMES, r as generateCatalogFromSnapshot, s as STAMP_SUMMARY_SPEC, t as GENERATE_SUMMARY_SPEC, u as stampCatalog, v as renderEventCatalogSnapshotDiffFromDelta, w as renderDeltaTerminal, x as toSnapshotDiffFromReport, y as renderEventCatalogSnapshotDiffFromReport } from "./generate-w_py2l3I.js";
3
3
 
4
4
  export { EVENTCATALOG_SNAPSHOT_DIFF_SPEC, GENERATE_SUMMARY_SPEC, RENDERERS, RENDERER_NAMES, REPORT_SPEC, STAMP_END, STAMP_START, STAMP_SUMMARY_SPEC, buildGenerateSummary, buildStampBlock, buildStampSummary, compareDriftReports, countDriftDelta, countDriftEntries, countDriftReport, diffCatalogAgainstSnapshot, evaluatePolicy, extractDeclaredFieldPaths, generateCatalogFromSnapshot, getRenderer, hasDrift, inferJsonSchemaFromObservation, loadSnapshot, readCatalogState, renderDeltaMarkdown, renderDeltaTerminal, renderEventCatalogSnapshotDiffFromDelta, renderEventCatalogSnapshotDiffFromReport, renderJson, renderMarkdown, renderTerminal, stampCatalog, toSnapshotDiffFromDelta, toSnapshotDiffFromReport };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-eventcatalog",
3
- "version": "18.0.0",
3
+ "version": "20.0.0",
4
4
  "description": "Diff your autotel architecture snapshot against an EventCatalog and report drift. Same model as Pact, for event architectures.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "tsdown": "^0.22.14",
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^4.1.10",
58
- "autotel-subscribers": "48.0.0"
58
+ "autotel-subscribers": "50.0.0"
59
59
  },
60
60
  "dependencies": {
61
61
  "@eventcatalog/sdk": "^2.26.3"