@ttsc/graph 0.19.1 → 0.19.3

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.
Files changed (46) hide show
  1. package/lib/TtscGraphApplication.js +3 -1
  2. package/lib/TtscGraphApplication.js.map +1 -1
  3. package/lib/index.d.ts +1 -1
  4. package/lib/index.js +2 -1
  5. package/lib/index.js.map +1 -1
  6. package/lib/model/TtscGraphSession.js +509 -162
  7. package/lib/model/TtscGraphSession.js.map +1 -1
  8. package/lib/model/loadGraph.d.ts +14 -0
  9. package/lib/model/loadGraph.js +382 -101
  10. package/lib/model/loadGraph.js.map +1 -1
  11. package/lib/resolveGraphBinary.d.ts +9 -3
  12. package/lib/resolveGraphBinary.js +9 -3
  13. package/lib/resolveGraphBinary.js.map +1 -1
  14. package/lib/server/createServer.js +5 -5
  15. package/lib/server/resultAudit.d.ts +29 -8
  16. package/lib/server/resultAudit.js +47 -9
  17. package/lib/server/resultAudit.js.map +1 -1
  18. package/lib/server/runDetails.d.ts +7 -0
  19. package/lib/server/runDetails.js +87 -58
  20. package/lib/server/runDetails.js.map +1 -1
  21. package/lib/structures/ITtscGraphApplication.d.ts +8 -7
  22. package/lib/structures/ITtscGraphDetails.d.ts +18 -8
  23. package/lib/structures/ITtscGraphDump.d.ts +169 -6
  24. package/lib/structures/ITtscGraphNode.d.ts +37 -0
  25. package/lib/structures/ITtscGraphSnapshot.d.ts +55 -0
  26. package/lib/structures/ITtscGraphSnapshot.js +3 -0
  27. package/lib/structures/ITtscGraphSnapshot.js.map +1 -0
  28. package/lib/structures/ITtscGraphTour.d.ts +1 -1
  29. package/lib/structures/index.d.ts +1 -0
  30. package/lib/structures/index.js +1 -0
  31. package/lib/structures/index.js.map +1 -1
  32. package/package.json +5 -2
  33. package/src/TtscGraphApplication.ts +4 -1
  34. package/src/index.ts +1 -0
  35. package/src/model/TtscGraphSession.ts +89 -16
  36. package/src/model/loadGraph.ts +36 -0
  37. package/src/resolveGraphBinary.ts +9 -3
  38. package/src/server/resultAudit.ts +47 -8
  39. package/src/server/runDetails.ts +95 -70
  40. package/src/structures/ITtscGraphApplication.ts +8 -7
  41. package/src/structures/ITtscGraphDetails.ts +18 -8
  42. package/src/structures/ITtscGraphDump.ts +194 -6
  43. package/src/structures/ITtscGraphNode.ts +40 -0
  44. package/src/structures/ITtscGraphSnapshot.ts +69 -0
  45. package/src/structures/ITtscGraphTour.ts +1 -1
  46. package/src/structures/index.ts +1 -0
@@ -63,6 +63,32 @@ export interface ITtscGraphNode {
63
63
  /** Declaration modifiers, when the declaration pass recorded any. */
64
64
  modifiers?: TtscGraphNodeModifier[];
65
65
 
66
+ /**
67
+ * The complete value set of a type alias or enum whose declared type the
68
+ * checker resolved to literals, each in TypeScript source form (`"a"`, `1`,
69
+ * `true`, `null`).
70
+ *
71
+ * Present only when every constituent is enumerable, so the list is the whole
72
+ * type and never a sample of it: `type T = Kind | string` admits values no
73
+ * list can name and carries none. It is resolved from the type, not read off
74
+ * the declaration, so indirection (`type I = Kind | 'f'`) is followed and the
75
+ * answer does not depend on how the declaration is wrapped.
76
+ */
77
+ literals?: string[];
78
+
79
+ /**
80
+ * What an enum declares, in checker order: the name a caller writes and the
81
+ * value it carries. Absent on every other kind.
82
+ *
83
+ * `literals` says which values the enum admits, which is what a serializer
84
+ * asks. The code says `Colors.Red`, so the names are the other half, and
85
+ * without them a caller that had already named the enum still had to open the
86
+ * file to learn what to type. The members are not nodes — `Colors.Red` is a
87
+ * string a grep finds exactly — so this fills in the node the graph already
88
+ * holds instead of minting one per member.
89
+ */
90
+ enumMembers?: ITtscGraphNode.IEnumMember[];
91
+
66
92
  /**
67
93
  * Decorators written on this declaration, in source order: raw facts
68
94
  * (`@Controller`, `@Get`) a consumer interprets without re-parsing source.
@@ -78,3 +104,17 @@ export interface ITtscGraphNode {
78
104
  */
79
105
  implementation?: ITtscGraphEvidence;
80
106
  }
107
+ export namespace ITtscGraphNode {
108
+ /** One member of an enum: the name a caller writes and the value it carries. */
109
+ export interface IEnumMember {
110
+ /** The member's own name, unqualified (`Red` on `Colors.Red`). */
111
+ name: string;
112
+
113
+ /**
114
+ * The value it carries, in TypeScript source form (`"red"`, `1`). Absent
115
+ * for a computed member the checker could not fold to a constant; the name
116
+ * still stands.
117
+ */
118
+ value?: string;
119
+ }
120
+ }
@@ -0,0 +1,69 @@
1
+ import { ITtscGraphDump } from "./ITtscGraphDump";
2
+
3
+ /**
4
+ * One response frame of the `ttscgraph serve` protocol.
5
+ *
6
+ * This is the envelope around a snapshot, mirrored by hand from `serveResponse`
7
+ * in `packages/ttsc/cmd/ttscgraph/serve.go`. There is no generator between the
8
+ * Go struct and this interface, so the two drift silently unless something
9
+ * checks them; `TtscGraphSession` validates every frame against this shape
10
+ * rather than casting it, so a drift surfaces as a precise error on the first
11
+ * frame instead of an `undefined` several layers downstream.
12
+ */
13
+ export interface ITtscGraphSnapshot {
14
+ /** Echoes the request's id, so a response finds its caller. */
15
+ id: number;
16
+
17
+ /**
18
+ * The protocol version the server speaks.
19
+ *
20
+ * It rides every frame rather than a handshake. The binary and this package
21
+ * version independently — the session runs whichever `ttscgraph` the target
22
+ * project installed, or whatever `TTSC_GRAPH_BINARY` points at — so a
23
+ * mismatched pair is reachable, and before this field nothing detected it:
24
+ * the first symptom was a misparsed dump or a silently absent value.
25
+ */
26
+ protocolVersion: number;
27
+
28
+ /**
29
+ * What the producer did to answer this request.
30
+ *
31
+ * Required, and never absent — including on the error path, where it is
32
+ * `"error"`. A consumer can report `rebuild` versus `incremental` honestly
33
+ * because the compiler said so; no generation counter can distinguish a reuse
34
+ * from a full rebuild after the fact.
35
+ */
36
+ mode: ITtscGraphSnapshot.Mode;
37
+
38
+ /** What this server can prove about the snapshots it publishes. */
39
+ capabilities: string[];
40
+
41
+ /** Whether the graph moved since the last snapshot. */
42
+ changed: boolean;
43
+
44
+ /** The snapshot, present exactly when `changed` is true. */
45
+ dump?: ITtscGraphDump;
46
+
47
+ /** Set when the request produced no snapshot; `mode` is then `"error"`. */
48
+ error?: string;
49
+ }
50
+
51
+ export namespace ITtscGraphSnapshot {
52
+ /**
53
+ * The computation modes the producer reports, plus the transport's `error`.
54
+ *
55
+ * - `initial`: the session's first snapshot.
56
+ * - `reload`: the build universe moved, so the program was reloaded whole.
57
+ * - `unchanged`: nothing moved; no dump rides it and the last one still holds.
58
+ * - `incremental`: edits applied onto the reused resident program.
59
+ * - `rebuild`: edits applied, but the program could not be reused.
60
+ * - `error`: no snapshot was produced.
61
+ */
62
+ export type Mode =
63
+ | "initial"
64
+ | "reload"
65
+ | "unchanged"
66
+ | "incremental"
67
+ | "rebuild"
68
+ | "error";
69
+ }
@@ -66,7 +66,7 @@ export namespace ITtscGraphTour {
66
66
  * Central entrypoints to seed the tour. Raise only when the question names
67
67
  * several public paths that must all appear in one answer.
68
68
  *
69
- * @default 4
69
+ * @default 5
70
70
  */
71
71
  limit?: number;
72
72
 
@@ -17,6 +17,7 @@ export * from "./ITtscGraphOverview";
17
17
  export * from "./ITtscGraphLookup";
18
18
  export * from "./ITtscGraphNext";
19
19
  export * from "./ITtscGraphTrace";
20
+ export * from "./ITtscGraphSnapshot";
20
21
  export * from "./ITtscGraphSpan";
21
22
  export * from "./ITtscGraphTour";
22
23
  export * from "./TtscGraphEdgeKind";