@coldtea/pr-lens-schema 0.1.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/LICENSE +21 -0
- package/README.md +150 -0
- package/dist/apply.d.ts +42 -0
- package/dist/apply.d.ts.map +1 -0
- package/dist/apply.js +315 -0
- package/dist/apply.js.map +1 -0
- package/dist/config.d.ts +58 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +61 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +12 -0
- package/dist/errors.js.map +1 -0
- package/dist/examples/baseline.d.ts +18 -0
- package/dist/examples/baseline.d.ts.map +1 -0
- package/dist/examples/baseline.js +433 -0
- package/dist/examples/baseline.js.map +1 -0
- package/dist/examples/index.d.ts +1194 -0
- package/dist/examples/index.d.ts.map +1 -0
- package/dist/examples/index.js +20 -0
- package/dist/examples/index.js.map +1 -0
- package/dist/examples/minimal.d.ts +4 -0
- package/dist/examples/minimal.d.ts.map +1 -0
- package/dist/examples/minimal.js +25 -0
- package/dist/examples/minimal.js.map +1 -0
- package/dist/examples/postmark-refactor.d.ts +16 -0
- package/dist/examples/postmark-refactor.d.ts.map +1 -0
- package/dist/examples/postmark-refactor.js +468 -0
- package/dist/examples/postmark-refactor.js.map +1 -0
- package/dist/graph.d.ts +568 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +266 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/integrity.d.ts +20 -0
- package/dist/integrity.d.ts.map +1 -0
- package/dist/integrity.js +167 -0
- package/dist/integrity.js.map +1 -0
- package/dist/manifest.d.ts +65 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +60 -0
- package/dist/manifest.js.map +1 -0
- package/dist/patch.d.ts +824 -0
- package/dist/patch.d.ts.map +1 -0
- package/dist/patch.js +84 -0
- package/dist/patch.js.map +1 -0
- package/dist/primitives.d.ts +92 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +120 -0
- package/dist/primitives.js.map +1 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +8 -0
- package/dist/utils.js.map +1 -0
- package/dist/validate.d.ts +18 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +95 -0
- package/dist/validate.js.map +1 -0
- package/dist/version.d.ts +21 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +24 -0
- package/dist/version.js.map +1 -0
- package/examples/broadcast-baseline.graph.json +289 -0
- package/examples/broadcast-baseline.patch.json +321 -0
- package/examples/minimal.graph.json +45 -0
- package/examples/postmark-refactor.graph.json +580 -0
- package/examples/postmark-refactor.render-manifest.json +67 -0
- package/examples/pr-lens.config.json +32 -0
- package/json-schema/config.schema.json +153 -0
- package/json-schema/graph-doc.schema.json +1032 -0
- package/json-schema/patch-doc.schema.json +1383 -0
- package/json-schema/render-manifest.schema.json +183 -0
- package/package.json +66 -0
- package/src/apply.ts +399 -0
- package/src/config.ts +69 -0
- package/src/errors.ts +34 -0
- package/src/examples/baseline.ts +437 -0
- package/src/examples/index.ts +25 -0
- package/src/examples/minimal.ts +26 -0
- package/src/examples/postmark-refactor.ts +480 -0
- package/src/graph.ts +331 -0
- package/src/index.ts +82 -0
- package/src/integrity.ts +216 -0
- package/src/manifest.ts +64 -0
- package/src/patch.ts +100 -0
- package/src/primitives.ts +146 -0
- package/src/utils.ts +7 -0
- package/src/validate.ts +132 -0
- package/src/version.ts +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ohans Emmanuel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @coldtea/pr-lens-schema
|
|
2
|
+
|
|
3
|
+
The PR Lens contract. Extraction produces these documents, the renderer consumes them, and every other surface — CLI, GitHub Action, agent skill, hosted app — passes them around. If a document validates here, it is safe to render.
|
|
4
|
+
|
|
5
|
+
MIT © Ohans Emmanuel.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @coldtea/pr-lens-schema
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { parseGraphDoc, safeParseGraphDoc } from "@coldtea/pr-lens-schema";
|
|
13
|
+
|
|
14
|
+
const graph = parseGraphDoc(json); // throws PrLensSchemaError
|
|
15
|
+
const result = safeParseGraphDoc(json); // { ok: true, value } | { ok: false, error }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## The four documents
|
|
19
|
+
|
|
20
|
+
| Document | Purpose | Parser |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| `GraphDoc` | Lanes, nodes, edges, flows, stats and the drill-down tree for one pull request — or for a stored baseline map | `parseGraphDoc` |
|
|
23
|
+
| `PatchDoc` | Ordered operations that move a stored graph forward as pull requests merge | `parsePatchDoc` |
|
|
24
|
+
| `Config` | What a repository commits as `.github/pr-lens.yml` | `parseConfig` |
|
|
25
|
+
| `RenderManifest` | The SVGs a render produced, and where they live | `parseRenderManifest` |
|
|
26
|
+
|
|
27
|
+
Every document carries a `schemaVersion`, config included: a repository's corrections have to keep their meaning as the contract moves.
|
|
28
|
+
|
|
29
|
+
## Views and the render they imply
|
|
30
|
+
|
|
31
|
+
A render is one asset per view per theme, so the size of a drill-down tree and the size of a render manifest are one rule, not two numbers:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
MAX_VIEWS * THEMES.length === MAX_RENDER_ASSETS; // 128 * 2 === 256
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Each array in the view tree is capped, but its depth is not, so the total is bounded by `graphIntegrityIssues`: a document carrying more views than a manifest could describe is rejected here rather than at the renderer, which would otherwise be left holding a document it was told was fine. Import `MAX_VIEWS`, `MAX_RENDER_ASSETS` and `THEMES` rather than restating any of them — raise the budget or add a theme and the other end moves with it.
|
|
38
|
+
|
|
39
|
+
The cap is the worst case, every theme rendered, not what a particular render would emit. A single-theme render could describe twice as many views, but then whether a document is renderable would depend on how it was asked to be rendered — and **if it parses, it renders** is the promise this package exists to make.
|
|
40
|
+
|
|
41
|
+
## Two lenses
|
|
42
|
+
|
|
43
|
+
`architecture` shows blast radius against the existing system. `data-flow` animates an ordered pipeline. There is deliberately no security lens and no findings field: PR Lens is the comprehension layer, and a document that carries findings is rejected rather than quietly stripped. The `Lens` enum is additive — a future contract version may add lenses, so treat one you do not recognise as a view to skip, not as a failure.
|
|
44
|
+
|
|
45
|
+
## Deltas
|
|
46
|
+
|
|
47
|
+
Every node, edge and flow step declares how it relates to the base commit: `added`, `modified`, `removed` or `unchanged`. `unchanged` elements are the context a reviewer needs to judge blast radius, so they belong in the document rather than being filtered out.
|
|
48
|
+
|
|
49
|
+
## What validation covers
|
|
50
|
+
|
|
51
|
+
Parsing runs three things in one pass, and reports every problem it finds rather than only the first:
|
|
52
|
+
|
|
53
|
+
1. **Structure** — types, lengths, enums, no unknown keys, and file paths that can actually become a diff permalink (repository-relative, POSIX, no `..` segment).
|
|
54
|
+
2. **Contract version** — below `1.0.0` an exact `major.minor` match; from `1.0.0` on, the same major and a minor no newer than this package's.
|
|
55
|
+
3. **Referential integrity** — every node sits in a declared lane, every edge joins declared nodes, every flow step runs between declared participants, every drill-down view and layout hint names elements that exist, and a document carrying flows declares the `data-flow` lens.
|
|
56
|
+
4. **That a render could describe the document** — see below.
|
|
57
|
+
|
|
58
|
+
A document nested deeper than the stack can walk is reported as a document too deep to read, not thrown: `safeParse*` returns a result whatever it is handed.
|
|
59
|
+
|
|
60
|
+
Failures arrive as a `PrLensSchemaError` with a machine-readable `code` (`INVALID_DOCUMENT`, `BROKEN_REFERENCE`, `DUPLICATE_ID`, `UNSUPPORTED_SCHEMA_VERSION`, `PATCH_CONFLICT`, `NOT_A_SNAPSHOT`) and an `issues` array carrying a path and message each.
|
|
61
|
+
|
|
62
|
+
## Evolving a stored graph
|
|
63
|
+
|
|
64
|
+
`applyPatchDoc(graph, patch)` is the executable definition of the patch operations:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { applyPatchDoc, parseGraphDoc, parsePatchDoc } from "@coldtea/pr-lens-schema";
|
|
68
|
+
|
|
69
|
+
const result = applyPatchDoc(parseGraphDoc(baseline), parsePatchDoc(patch));
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- A patch names the map it targets and the commits it carries it between — `graphId`, `fromSha` and `toSha` are all required, they are full 40-character commit names, and they must differ. Abbreviations are fine for something a human reads but not for deciding whether two records mean the same commit, and a patch that does not move the map is a patch that can be replayed.
|
|
73
|
+
- The target is checked before anything is applied: a patch aimed at another map, or written against a commit the map has already moved past, is a `PATCH_CONFLICT` rather than a merge.
|
|
74
|
+
- A stored map is a snapshot rather than a diff: it has an id, it records the single commit it reflects in full on both `base` and `head`, and nothing in it is annotated as a change. `graphSnapshotIssues` is that rule, exported for anything that stores a map, and `applyPatchDoc` runs it on the way in and on the way out — so a patch can neither leave an annotation behind nor launder a map that already carries one. Failures are `NOT_A_SNAPSHOT` and name the offender, down to the step of a flow.
|
|
75
|
+
- The target rules are re-checked inside `applyPatchDoc` rather than trusted from parsing, because a zod refinement does not survive into the inferred type: a `PatchDoc` a caller assembled itself is held to the same rules as one that came from `parsePatchDoc`.
|
|
76
|
+
- Operations apply in array order, and the first conflict stops the batch — a later operation was written against the state an earlier one was supposed to produce.
|
|
77
|
+
- `add_*` refuses an id that is taken; `update_*` and `remove_*` refuse an id that is absent; `update_*` writes only the fields it names.
|
|
78
|
+
- Removing a node takes its edges and flow steps with it, and drops a flow left with fewer than two participants or no steps. Removed ids are pruned out of the drill-down tree and the layout hints, and a view whose selection loses its last element is dropped rather than widened.
|
|
79
|
+
- Removing a lane that still holds nodes is a conflict, not a cascade: move its nodes first.
|
|
80
|
+
- `remove_*` deletes an element from the stored graph. That is a different statement from `delta: "removed"`, which says an element still exists but is being deleted by the change under review.
|
|
81
|
+
- A successful result is always a document that would pass `parseGraphDoc`: the candidate is validated as a whole before it is returned.
|
|
82
|
+
|
|
83
|
+
The input document is never mutated. `applyPatch(graph, ops)` is the same thing without the target check, for callers that already know which document they hold.
|
|
84
|
+
|
|
85
|
+
A stored map describes a system rather than a change, so everything in it is `unchanged` and its `base` equals its `head`; the deltas belong to pull-request documents.
|
|
86
|
+
|
|
87
|
+
## Repository config
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
# .github/pr-lens.yml
|
|
91
|
+
schemaVersion: 0.1.0
|
|
92
|
+
lenses: [architecture, data-flow]
|
|
93
|
+
branding: true
|
|
94
|
+
map:
|
|
95
|
+
rename:
|
|
96
|
+
- match: functions/src/broadcast/sendBroadcastBulk.ts
|
|
97
|
+
to: Broadcast sender
|
|
98
|
+
exclude:
|
|
99
|
+
- "**/*.test.ts"
|
|
100
|
+
lane:
|
|
101
|
+
- match: packages/broadcast-lib/**
|
|
102
|
+
lane: functions
|
|
103
|
+
group:
|
|
104
|
+
- match: id:build-bulk-payload
|
|
105
|
+
group: broadcast-lib
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A `match` beginning with `id:` addresses one node exactly; anything else is a path glob matched against a node's file paths, so a correction survives the model renaming the node between runs. Corrections are an overlay applied over fresh inference on every run — inference never writes back into this file.
|
|
109
|
+
|
|
110
|
+
## JSON Schema
|
|
111
|
+
|
|
112
|
+
`json-schema/*.json` (draft 2020-12) is generated from the zod schemas and published with the package, for producers that do not run TypeScript and for editors validating `.github/pr-lens.yml`:
|
|
113
|
+
|
|
114
|
+
```jsonc
|
|
115
|
+
{ "$ref": "node_modules/@coldtea/pr-lens-schema/json-schema/graph-doc.schema.json" }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
They describe **what an author may write**: a field with a default is one you may leave out. Rules are carried across wherever JSON Schema can state them — the supported contract versions, the repository-relative path rule, `endLine` requiring `startLine`, an asset needing a `url` or a `path`, a `selection` view having to select something.
|
|
119
|
+
|
|
120
|
+
Exactly five rules cannot be stated in JSON Schema and stay the parser's job, each of them a comparison the shape alone cannot make:
|
|
121
|
+
|
|
122
|
+
1. referential integrity between elements,
|
|
123
|
+
2. a line range that ends before it starts,
|
|
124
|
+
3. the agreement between a self message's endpoints,
|
|
125
|
+
4. a patch whose two commits are the same,
|
|
126
|
+
5. more views than a render manifest could describe.
|
|
127
|
+
|
|
128
|
+
The tests run a table of documents through both representations and assert the same verdict, accept and reject alike — including a case per divergence above, so they stay deliberate and cannot quietly grow a fifth.
|
|
129
|
+
|
|
130
|
+
## Goldens
|
|
131
|
+
|
|
132
|
+
`examples/` holds the reference documents, also importable pre-parsed:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { postmarkRefactorGraph } from "@coldtea/pr-lens-schema/examples";
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
They tell one story — a real refactor that moved broadcast sending from one Postmark request per recipient to batches of 500:
|
|
139
|
+
|
|
140
|
+
- **`postmark-refactor.graph.json`** is the canonical document: the pull request itself, across three lanes, exercising all four delta states, a hero edge, a seven-step data flow with returns and a repeated batch step, and a nested drill-down tree. Downstream renderer goldens are measured against it.
|
|
141
|
+
- **`broadcast-baseline.graph.json`** is the stored map of that subsystem as `main` stood before the change, and **`broadcast-baseline.patch.json`** carries it to the merged state — the transition `applyPatchDoc` performs.
|
|
142
|
+
- **`postmark-refactor.render-manifest.json`** is what rendering the pull-request document produces, **`pr-lens.config.json`** a repository's corrections, and **`minimal.graph.json`** the smallest document that validates.
|
|
143
|
+
|
|
144
|
+
## Versioning
|
|
145
|
+
|
|
146
|
+
`SCHEMA_VERSION` is the contract version, and it is not the package version's twin by accident — they move together. While the contract is below `1.0.0`, a minor bump may break: parsers accept only their exact `major.minor`. From `1.0.0` on, minor releases only add optional fields or widen an enum, and a parser accepts any minor at or below its own.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
Part of [PR Lens](https://prlens.dev) — review what actually matters.
|
package/dist/apply.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Parsed } from "./errors.js";
|
|
2
|
+
import type { GraphDoc } from "./graph.js";
|
|
3
|
+
import { type PatchDoc, type PatchOp } from "./patch.js";
|
|
4
|
+
/**
|
|
5
|
+
* Applies patch operations to a stored graph — the way a baseline map moves
|
|
6
|
+
* forward as pull requests merge, instead of being re-extracted wholesale.
|
|
7
|
+
*
|
|
8
|
+
* Operations apply in order and the first conflict stops the batch: a later
|
|
9
|
+
* operation in the same patch was written against the state the earlier one
|
|
10
|
+
* was supposed to produce.
|
|
11
|
+
*
|
|
12
|
+
* A successful result is a fully valid graph document: per-operation checks
|
|
13
|
+
* catch the common mistakes with a message naming the operation, and the
|
|
14
|
+
* candidate is validated as a whole before it is handed back, so no patch can
|
|
15
|
+
* quietly leave a document the renderer would choke on.
|
|
16
|
+
*/
|
|
17
|
+
export declare const applyPatch: (graph: GraphDoc, ops: readonly PatchOp[]) => Parsed<GraphDoc>;
|
|
18
|
+
/**
|
|
19
|
+
* Applies a patch document, honouring the target it declares.
|
|
20
|
+
*
|
|
21
|
+
* `applyPatch` takes bare operations and trusts the caller to have picked the
|
|
22
|
+
* right document; this checks first. A baseline map is long-lived and patched
|
|
23
|
+
* repeatedly, so applying a patch to the wrong map, or to one that has moved
|
|
24
|
+
* on since the patch was written, has to fail loudly rather than merge.
|
|
25
|
+
*
|
|
26
|
+
* A stored map is a snapshot, not a diff: everything in it is `unchanged`,
|
|
27
|
+
* and `base` and `head` both name the single commit it reflects. So both
|
|
28
|
+
* advance to the patch's `toSha` — leaving `base` behind would claim the
|
|
29
|
+
* elements this patch just added had been there, unchanged, all along. The
|
|
30
|
+
* commit the map came from stays recorded on the patch itself.
|
|
31
|
+
*
|
|
32
|
+
* That snapshot rule is checked rather than assumed, on the way in as well as
|
|
33
|
+
* on the way out: a patch is free to carry `added` or `modified` elements, and
|
|
34
|
+
* neither a patch that leaves them in the map nor one that quietly launders a
|
|
35
|
+
* map that already carries them is allowed through.
|
|
36
|
+
*
|
|
37
|
+
* The target rules are re-checked here rather than trusted from parsing. A
|
|
38
|
+
* zod refinement does not survive into the inferred type, so a caller holding
|
|
39
|
+
* a `PatchDoc` it assembled itself would otherwise skip them.
|
|
40
|
+
*/
|
|
41
|
+
export declare const applyPatchDoc: (graph: GraphDoc, patch: PatchDoc) => Parsed<GraphDoc>;
|
|
42
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,MAAM,EAAoB,MAAM,aAAa,CAAC;AAE7F,OAAO,KAAK,EAAQ,QAAQ,EAAyB,MAAM,YAAY,CAAC;AAExE,OAAO,EAA8B,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAuHrF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,UAAW,QAAQ,OAAO,SAAS,OAAO,EAAE,KAAG,MAAM,CAAC,QAAQ,CA8KpF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa,UAAW,QAAQ,SAAS,QAAQ,KAAG,MAAM,CAAC,QAAQ,CA+D/E,CAAC"}
|
package/dist/apply.js
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { formatIssues, PrLensSchemaError } from "./errors.js";
|
|
2
|
+
import { safeParseGraphDoc } from "./validate.js";
|
|
3
|
+
import { graphSnapshotIssues } from "./integrity.js";
|
|
4
|
+
import { targetDescribesATransition } from "./patch.js";
|
|
5
|
+
import { assertNever } from "./utils.js";
|
|
6
|
+
const conflict = (path, message) => ({
|
|
7
|
+
code: "PATCH_CONFLICT",
|
|
8
|
+
path,
|
|
9
|
+
message,
|
|
10
|
+
});
|
|
11
|
+
const brokenReference = (path, message) => ({
|
|
12
|
+
code: "BROKEN_REFERENCE",
|
|
13
|
+
path,
|
|
14
|
+
message,
|
|
15
|
+
});
|
|
16
|
+
const indexOfId = (items, id) => items.findIndex((item) => item.id === id);
|
|
17
|
+
const nothingRemoved = {
|
|
18
|
+
lanes: new Set(),
|
|
19
|
+
nodes: new Set(),
|
|
20
|
+
edges: new Set(),
|
|
21
|
+
flows: new Set(),
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A view whose selection loses its last element no longer has a subject, so
|
|
25
|
+
* it goes rather than being left to render as an empty section.
|
|
26
|
+
*/
|
|
27
|
+
const pruneViews = (views, removed) => views.flatMap((view) => {
|
|
28
|
+
const children = pruneViews(view.children, removed);
|
|
29
|
+
switch (view.scope.kind) {
|
|
30
|
+
case "all":
|
|
31
|
+
return [{ ...view, children }];
|
|
32
|
+
case "selection": {
|
|
33
|
+
const scope = {
|
|
34
|
+
kind: "selection",
|
|
35
|
+
lanes: view.scope.lanes.filter((id) => !removed.lanes.has(id)),
|
|
36
|
+
nodes: view.scope.nodes.filter((id) => !removed.nodes.has(id)),
|
|
37
|
+
edges: view.scope.edges.filter((id) => !removed.edges.has(id)),
|
|
38
|
+
flows: view.scope.flows.filter((id) => !removed.flows.has(id)),
|
|
39
|
+
};
|
|
40
|
+
const selected = scope.lanes.length + scope.nodes.length + scope.edges.length + scope.flows.length;
|
|
41
|
+
return selected === 0 ? [] : [{ ...view, scope, children }];
|
|
42
|
+
}
|
|
43
|
+
default:
|
|
44
|
+
return assertNever(view.scope, "Unhandled view scope");
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
/** Layout hints name elements, so they strand the same way view scopes do. */
|
|
48
|
+
const pruneLayout = (layout, removed) => {
|
|
49
|
+
if (layout === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
const rank = layout.rank
|
|
52
|
+
? Object.fromEntries(Object.entries(layout.rank).filter(([nodeId]) => !removed.nodes.has(nodeId)))
|
|
53
|
+
: undefined;
|
|
54
|
+
return {
|
|
55
|
+
...layout,
|
|
56
|
+
laneOrder: layout.laneOrder.filter((id) => !removed.lanes.has(id)),
|
|
57
|
+
...(rank ? { rank } : {}),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Deleting a node would strand every edge and flow step that touched it, so
|
|
62
|
+
* those go with it. A flow left with fewer than two participants, or with no
|
|
63
|
+
* steps, no longer describes a pipeline and is dropped whole.
|
|
64
|
+
*/
|
|
65
|
+
const cascadeNodeRemoval = (working, nodeId) => {
|
|
66
|
+
const strandedEdges = working.edges.filter((edge) => edge.from === nodeId || edge.to === nodeId);
|
|
67
|
+
working.edges = working.edges.filter((edge) => edge.from !== nodeId && edge.to !== nodeId);
|
|
68
|
+
const droppedFlows = [];
|
|
69
|
+
working.flows = working.flows.flatMap((flow) => {
|
|
70
|
+
const participants = flow.participants.filter((participant) => participant.node !== nodeId);
|
|
71
|
+
if (participants.length === flow.participants.length)
|
|
72
|
+
return [flow];
|
|
73
|
+
const messages = flow.messages.filter((message) => message.from !== nodeId && message.to !== nodeId);
|
|
74
|
+
if (participants.length < 2 || messages.length === 0) {
|
|
75
|
+
droppedFlows.push(flow.id);
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
return [{ ...flow, participants, messages }];
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
...nothingRemoved,
|
|
82
|
+
nodes: new Set([nodeId]),
|
|
83
|
+
edges: new Set(strandedEdges.map((edge) => edge.id)),
|
|
84
|
+
flows: new Set(droppedFlows),
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Applies patch operations to a stored graph — the way a baseline map moves
|
|
89
|
+
* forward as pull requests merge, instead of being re-extracted wholesale.
|
|
90
|
+
*
|
|
91
|
+
* Operations apply in order and the first conflict stops the batch: a later
|
|
92
|
+
* operation in the same patch was written against the state the earlier one
|
|
93
|
+
* was supposed to produce.
|
|
94
|
+
*
|
|
95
|
+
* A successful result is a fully valid graph document: per-operation checks
|
|
96
|
+
* catch the common mistakes with a message naming the operation, and the
|
|
97
|
+
* candidate is validated as a whole before it is handed back, so no patch can
|
|
98
|
+
* quietly leave a document the renderer would choke on.
|
|
99
|
+
*/
|
|
100
|
+
export const applyPatch = (graph, ops) => {
|
|
101
|
+
const working = {
|
|
102
|
+
lanes: [...graph.lanes],
|
|
103
|
+
nodes: [...graph.nodes],
|
|
104
|
+
edges: [...graph.edges],
|
|
105
|
+
flows: [...graph.flows],
|
|
106
|
+
stats: graph.stats,
|
|
107
|
+
};
|
|
108
|
+
let views = graph.views;
|
|
109
|
+
let layout = graph.layout;
|
|
110
|
+
const prune = (removed) => {
|
|
111
|
+
views = pruneViews(views, removed);
|
|
112
|
+
layout = pruneLayout(layout, removed);
|
|
113
|
+
};
|
|
114
|
+
for (const [index, op] of ops.entries()) {
|
|
115
|
+
const at = `ops[${index}]`;
|
|
116
|
+
const reject = (issue) => ({
|
|
117
|
+
ok: false,
|
|
118
|
+
error: new PrLensSchemaError(issue.code, `${at}: ${issue.message}`, [issue]),
|
|
119
|
+
});
|
|
120
|
+
switch (op.op) {
|
|
121
|
+
case "add_lane": {
|
|
122
|
+
if (indexOfId(working.lanes, op.lane.id) !== -1)
|
|
123
|
+
return reject(conflict(`${at}.lane.id`, `lane '${op.lane.id}' already exists`));
|
|
124
|
+
working.lanes.push(op.lane);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case "update_lane": {
|
|
128
|
+
const position = indexOfId(working.lanes, op.id);
|
|
129
|
+
const lane = working.lanes[position];
|
|
130
|
+
if (lane === undefined)
|
|
131
|
+
return reject(conflict(`${at}.id`, `unknown lane '${op.id}'`));
|
|
132
|
+
working.lanes[position] = { ...lane, ...op.patch };
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "remove_lane": {
|
|
136
|
+
const position = indexOfId(working.lanes, op.id);
|
|
137
|
+
if (position === -1)
|
|
138
|
+
return reject(conflict(`${at}.id`, `unknown lane '${op.id}'`));
|
|
139
|
+
const occupant = working.nodes.find((node) => node.lane === op.id);
|
|
140
|
+
if (occupant !== undefined)
|
|
141
|
+
return reject(conflict(`${at}.id`, `lane '${op.id}' still holds node '${occupant.id}'; move or remove its nodes first`));
|
|
142
|
+
working.lanes.splice(position, 1);
|
|
143
|
+
prune({ ...nothingRemoved, lanes: new Set([op.id]) });
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "add_node": {
|
|
147
|
+
if (indexOfId(working.nodes, op.node.id) !== -1)
|
|
148
|
+
return reject(conflict(`${at}.node.id`, `node '${op.node.id}' already exists`));
|
|
149
|
+
if (indexOfId(working.lanes, op.node.lane) === -1)
|
|
150
|
+
return reject(brokenReference(`${at}.node.lane`, `unknown lane '${op.node.lane}'`));
|
|
151
|
+
working.nodes.push(op.node);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case "update_node": {
|
|
155
|
+
const position = indexOfId(working.nodes, op.id);
|
|
156
|
+
const node = working.nodes[position];
|
|
157
|
+
if (node === undefined)
|
|
158
|
+
return reject(conflict(`${at}.id`, `unknown node '${op.id}'`));
|
|
159
|
+
if (op.patch.lane !== undefined && indexOfId(working.lanes, op.patch.lane) === -1)
|
|
160
|
+
return reject(brokenReference(`${at}.patch.lane`, `unknown lane '${op.patch.lane}'`));
|
|
161
|
+
working.nodes[position] = { ...node, ...op.patch };
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
case "remove_node": {
|
|
165
|
+
const position = indexOfId(working.nodes, op.id);
|
|
166
|
+
if (position === -1)
|
|
167
|
+
return reject(conflict(`${at}.id`, `unknown node '${op.id}'`));
|
|
168
|
+
working.nodes.splice(position, 1);
|
|
169
|
+
prune(cascadeNodeRemoval(working, op.id));
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
case "add_edge": {
|
|
173
|
+
if (indexOfId(working.edges, op.edge.id) !== -1)
|
|
174
|
+
return reject(conflict(`${at}.edge.id`, `edge '${op.edge.id}' already exists`));
|
|
175
|
+
for (const [field, id] of [
|
|
176
|
+
["from", op.edge.from],
|
|
177
|
+
["to", op.edge.to],
|
|
178
|
+
]) {
|
|
179
|
+
if (indexOfId(working.nodes, id) === -1)
|
|
180
|
+
return reject(brokenReference(`${at}.edge.${field}`, `unknown node '${id}'`));
|
|
181
|
+
}
|
|
182
|
+
working.edges.push(op.edge);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case "update_edge": {
|
|
186
|
+
const position = indexOfId(working.edges, op.id);
|
|
187
|
+
const edge = working.edges[position];
|
|
188
|
+
if (edge === undefined)
|
|
189
|
+
return reject(conflict(`${at}.id`, `unknown edge '${op.id}'`));
|
|
190
|
+
for (const [field, id] of [
|
|
191
|
+
["from", op.patch.from],
|
|
192
|
+
["to", op.patch.to],
|
|
193
|
+
]) {
|
|
194
|
+
if (id !== undefined && indexOfId(working.nodes, id) === -1)
|
|
195
|
+
return reject(brokenReference(`${at}.patch.${field}`, `unknown node '${id}'`));
|
|
196
|
+
}
|
|
197
|
+
working.edges[position] = { ...edge, ...op.patch };
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
case "remove_edge": {
|
|
201
|
+
const position = indexOfId(working.edges, op.id);
|
|
202
|
+
if (position === -1)
|
|
203
|
+
return reject(conflict(`${at}.id`, `unknown edge '${op.id}'`));
|
|
204
|
+
working.edges.splice(position, 1);
|
|
205
|
+
prune({ ...nothingRemoved, edges: new Set([op.id]) });
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
case "add_flow": {
|
|
209
|
+
if (indexOfId(working.flows, op.flow.id) !== -1)
|
|
210
|
+
return reject(conflict(`${at}.flow.id`, `flow '${op.flow.id}' already exists`));
|
|
211
|
+
for (const [participantIndex, participant] of op.flow.participants.entries()) {
|
|
212
|
+
if (indexOfId(working.nodes, participant.node) === -1)
|
|
213
|
+
return reject(brokenReference(`${at}.flow.participants[${participantIndex}].node`, `unknown node '${participant.node}'`));
|
|
214
|
+
}
|
|
215
|
+
working.flows.push(op.flow);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case "update_flow": {
|
|
219
|
+
const position = indexOfId(working.flows, op.id);
|
|
220
|
+
const flow = working.flows[position];
|
|
221
|
+
if (flow === undefined)
|
|
222
|
+
return reject(conflict(`${at}.id`, `unknown flow '${op.id}'`));
|
|
223
|
+
for (const [participantIndex, participant] of (op.patch.participants ?? []).entries()) {
|
|
224
|
+
if (indexOfId(working.nodes, participant.node) === -1)
|
|
225
|
+
return reject(brokenReference(`${at}.patch.participants[${participantIndex}].node`, `unknown node '${participant.node}'`));
|
|
226
|
+
}
|
|
227
|
+
working.flows[position] = { ...flow, ...op.patch };
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case "remove_flow": {
|
|
231
|
+
const position = indexOfId(working.flows, op.id);
|
|
232
|
+
if (position === -1)
|
|
233
|
+
return reject(conflict(`${at}.id`, `unknown flow '${op.id}'`));
|
|
234
|
+
working.flows.splice(position, 1);
|
|
235
|
+
prune({ ...nothingRemoved, flows: new Set([op.id]) });
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case "set_stats": {
|
|
239
|
+
working.stats = op.stats;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
default:
|
|
243
|
+
return assertNever(op, "Unhandled patch operation");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return safeParseGraphDoc({
|
|
247
|
+
...graph,
|
|
248
|
+
lanes: working.lanes,
|
|
249
|
+
nodes: working.nodes,
|
|
250
|
+
edges: working.edges,
|
|
251
|
+
flows: working.flows,
|
|
252
|
+
stats: working.stats,
|
|
253
|
+
views,
|
|
254
|
+
layout,
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Applies a patch document, honouring the target it declares.
|
|
259
|
+
*
|
|
260
|
+
* `applyPatch` takes bare operations and trusts the caller to have picked the
|
|
261
|
+
* right document; this checks first. A baseline map is long-lived and patched
|
|
262
|
+
* repeatedly, so applying a patch to the wrong map, or to one that has moved
|
|
263
|
+
* on since the patch was written, has to fail loudly rather than merge.
|
|
264
|
+
*
|
|
265
|
+
* A stored map is a snapshot, not a diff: everything in it is `unchanged`,
|
|
266
|
+
* and `base` and `head` both name the single commit it reflects. So both
|
|
267
|
+
* advance to the patch's `toSha` — leaving `base` behind would claim the
|
|
268
|
+
* elements this patch just added had been there, unchanged, all along. The
|
|
269
|
+
* commit the map came from stays recorded on the patch itself.
|
|
270
|
+
*
|
|
271
|
+
* That snapshot rule is checked rather than assumed, on the way in as well as
|
|
272
|
+
* on the way out: a patch is free to carry `added` or `modified` elements, and
|
|
273
|
+
* neither a patch that leaves them in the map nor one that quietly launders a
|
|
274
|
+
* map that already carries them is allowed through.
|
|
275
|
+
*
|
|
276
|
+
* The target rules are re-checked here rather than trusted from parsing. A
|
|
277
|
+
* zod refinement does not survive into the inferred type, so a caller holding
|
|
278
|
+
* a `PatchDoc` it assembled itself would otherwise skip them.
|
|
279
|
+
*/
|
|
280
|
+
export const applyPatchDoc = (graph, patch) => {
|
|
281
|
+
const { graphId, fromSha, toSha } = patch.target;
|
|
282
|
+
const reject = (code, message, issue) => ({
|
|
283
|
+
ok: false,
|
|
284
|
+
error: new PrLensSchemaError(code, message, [issue]),
|
|
285
|
+
});
|
|
286
|
+
const rejectIssues = (code, message, issues) => ({
|
|
287
|
+
ok: false,
|
|
288
|
+
error: new PrLensSchemaError(code, `${message}:\n${formatIssues(issues)}`, issues),
|
|
289
|
+
});
|
|
290
|
+
if (!targetDescribesATransition(patch.target))
|
|
291
|
+
return reject("PATCH_CONFLICT", `patch moves the map from ${fromSha} to the same commit, so it describes no transition`, { code: "PATCH_CONFLICT", path: "target.toSha", message: "no transition" });
|
|
292
|
+
const contamination = graphSnapshotIssues(graph);
|
|
293
|
+
if (contamination.length > 0)
|
|
294
|
+
return rejectIssues("NOT_A_SNAPSHOT", "the graph being patched is not a stored map", contamination);
|
|
295
|
+
if (graph.id !== graphId)
|
|
296
|
+
return reject("PATCH_CONFLICT", `patch targets graph '${graphId}' but was applied to '${graph.id ?? "an unidentified graph"}'`, { code: "PATCH_CONFLICT", path: "target.graphId", message: "wrong graph" });
|
|
297
|
+
if (graph.provenance.head.sha !== fromSha)
|
|
298
|
+
return reject("PATCH_CONFLICT", `patch expects the graph at ${fromSha} but it reflects ${graph.provenance.head.sha}`, { code: "PATCH_CONFLICT", path: "target.fromSha", message: "stale baseline" });
|
|
299
|
+
const applied = applyPatch(graph, patch.ops);
|
|
300
|
+
if (!applied.ok)
|
|
301
|
+
return applied;
|
|
302
|
+
const snapshot = {
|
|
303
|
+
...applied.value,
|
|
304
|
+
provenance: {
|
|
305
|
+
...applied.value.provenance,
|
|
306
|
+
base: { ...applied.value.provenance.base, sha: toSha },
|
|
307
|
+
head: { ...applied.value.provenance.head, sha: toSha },
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
const issues = graphSnapshotIssues(snapshot);
|
|
311
|
+
if (issues.length > 0)
|
|
312
|
+
return rejectIssues("NOT_A_SNAPSHOT", "patch leaves a map that is not a stored map", issues);
|
|
313
|
+
return { ok: true, value: snapshot };
|
|
314
|
+
};
|
|
315
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAiC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAA+B,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUzC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,OAAe,EAAe,EAAE,CAAC,CAAC;IAChE,IAAI,EAAE,gBAAgB;IACtB,IAAI;IACJ,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,OAAe,EAAe,EAAE,CAAC,CAAC;IACvE,IAAI,EAAE,kBAAkB;IACxB,IAAI;IACJ,OAAO;CACR,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,CAAC,KAAgC,EAAE,EAAU,EAAU,EAAE,CACzE,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAS5C,MAAM,cAAc,GAAe;IACj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,EAAE;QAAE,OAAO,OAAO,CAAC;IAEhC,MAAM,QAAQ,GAAa;QACzB,GAAG,OAAO,CAAC,KAAK;QAChB,UAAU,EAAE;YACV,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU;YAC3B,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;YACtD,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;SACvD;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QACnB,OAAO,YAAY,CAAC,gBAAgB,EAAE,6CAA6C,EAAE,MAAM,CAAC,CAAC;IAE/F,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACvC,CAAC,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Which inferred elements a correction applies to.
|
|
4
|
+
*
|
|
5
|
+
* `id:<node-id>` addresses one node exactly. Anything else is a path glob
|
|
6
|
+
* matched against the node's file paths, so a correction survives the model
|
|
7
|
+
* renaming the node between runs.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Selector: z.ZodString;
|
|
10
|
+
export type Selector = z.infer<typeof Selector>;
|
|
11
|
+
/**
|
|
12
|
+
* Human corrections to the inferred map. They are an overlay: inference never
|
|
13
|
+
* writes back here, and every run re-applies the overlay on top of fresh
|
|
14
|
+
* inference, so a correction keeps holding as the code moves.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MapCorrections: z.ZodObject<{
|
|
17
|
+
rename: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
18
|
+
match: z.ZodString;
|
|
19
|
+
to: z.ZodString;
|
|
20
|
+
}, z.core.$strict>>>;
|
|
21
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
22
|
+
lane: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
23
|
+
match: z.ZodString;
|
|
24
|
+
lane: z.ZodString;
|
|
25
|
+
}, z.core.$strict>>>;
|
|
26
|
+
group: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
27
|
+
match: z.ZodString;
|
|
28
|
+
group: z.ZodString;
|
|
29
|
+
}, z.core.$strict>>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type MapCorrections = z.infer<typeof MapCorrections>;
|
|
32
|
+
/** The `.github/pr-lens.yml` a repository may commit. Every field is optional. */
|
|
33
|
+
export declare const Config: z.ZodObject<{
|
|
34
|
+
schemaVersion: z.ZodString;
|
|
35
|
+
lenses: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
36
|
+
architecture: "architecture";
|
|
37
|
+
"data-flow": "data-flow";
|
|
38
|
+
}>>>;
|
|
39
|
+
map: z.ZodDefault<z.ZodObject<{
|
|
40
|
+
rename: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
41
|
+
match: z.ZodString;
|
|
42
|
+
to: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>>;
|
|
44
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
45
|
+
lane: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
46
|
+
match: z.ZodString;
|
|
47
|
+
lane: z.ZodString;
|
|
48
|
+
}, z.core.$strict>>>;
|
|
49
|
+
group: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
50
|
+
match: z.ZodString;
|
|
51
|
+
group: z.ZodString;
|
|
52
|
+
}, z.core.$strict>>>;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
branding: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
export type Config = z.infer<typeof Config>;
|
|
57
|
+
export type ConfigInput = z.input<typeof Config>;
|
|
58
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,aAIsE,CAAC;AAC5F,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;kBAuBwC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;kBAiBiC,CAAC;AACrD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
|