@intentic/graph 1.310.0 → 1.311.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.
Files changed (2) hide show
  1. package/README.md +23 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,29 +1,31 @@
1
- # @intentic/graph
1
+ # graph
2
2
 
3
- The product-agnostic **desired-state IR** and its compiler: the data structure every other package is built around. A node's `type` is an opaque string here; the closed vocabulary lives in [`@intentic/resources`](../resources). This is the base of the dependency graph (depended on by every other package, depends on nothing internal).
3
+ The desired-state representation the deploy tool passes between stages: refs, secrets and readiness checks compiled into one serializable, dependency-ordered graph.
4
4
 
5
- ## Responsibilities
5
+ ```mermaid
6
+ flowchart LR
7
+ config["deploy.config.ts<br/>env('KEY')"] --> resolver["state-resolver<br/>RawNode[]"]
8
+ resolver -- "compile" --> dsg(["graph<br/>DesiredStateGraph"])
9
+ dsg -- "desired-state.json" --> engine["engine<br/>linearize · hashInputs"]
10
+ dsg -- "collectSecretUsage" --> cli["cli<br/>deploy secrets"]
11
+ ```
6
12
 
7
- - Define the serializable graph types: `DesiredStateGraph`, `RawNode`/`ResourceNode`, `Ref`, `SecretRef`, `Readiness`.
8
- - Compile a map of `RawNode`s into a validated, dependency-ordered `DesiredStateGraph` (`compile`).
9
- - Provide the primitives others compose with: typed refs between nodes, env-sourced secrets, HTTP readiness gates, and ownership stamps.
10
- - It does **not** know which resource kinds exist, how to reconcile them, or how to talk to infra: those belong to `resources`/`engine`/`providers`.
13
+ - A resource node is `{ id, type, inputs, dependsOn, readyWhen }`. Inside inputs, a dependency's output is `{ $ref: "id.output" }` and a secret is `{ $secret: { source, key } }`, so the artifact is plain JSON with no values filled in.
14
+ - `compile` derives `dependsOn` from every ref a node carries and throws on a ref to an unknown id. `linearize` orders nodes topologically with declaration order as the tiebreak, so apply order is deterministic.
15
+ - Secrets come from `env("KEY")`, which the user supplies, or `generated("KEY")`, which intentic creates and stores. Configs import `env` from this package directly.
16
+ - `stamp.ts` is the ownership contract: providers label live resources with `intentic.id` and a hash of their inputs, which lets the engine find and diff them without a state file.
17
+ - A node's `type` is an opaque string here; [resources](../resources) owns the list of kinds.
11
18
 
12
19
  ## Key files
13
20
 
14
- - [src/types.ts](src/types.ts): the IR types (`DesiredStateGraph`, `RawNode`, `Ref`, `SecretRef`, `Readiness`).
15
- - [src/compile.ts](src/compile.ts), `compile`: RawNode map → graph (validates refs, fills order).
16
- - [src/topo.ts](src/topo.ts): `toNodeMap`, `linearize` (topological dependency order).
17
- - [src/ref.ts](src/ref.ts): `makeRef`/`refKey`/`isRef`, `env` (env-sourced secret), `httpOk` (readiness gate).
18
- - [src/stamp.ts](src/stamp.ts): `formatStamp`/`parseStamp` (resource ownership stamps).
19
- - [src/serialize.ts](src/serialize.ts): stable serialization of the graph.
21
+ - [src/types.ts](src/types.ts) — `Ref`, `SecretRef`, `RawNode`, `ResourceNode`, `DesiredStateGraph`, `Move`.
22
+ - [src/compile.ts](src/compile.ts) — raw nodes to the serialized graph with derived dependencies.
23
+ - [src/index.ts](src/index.ts) — `env`, `generated`, `httpOk`, `linearize`, `subgraph`.
24
+ - [src/stamp.ts](src/stamp.ts) — the `intentic.id` and `intentic.hash` stamp format.
25
+ - [src/secrets.ts](src/secrets.ts) — every secret the graph requires and which nodes need it.
20
26
 
21
- ## How it fits
27
+ ## Commands
22
28
 
23
- Foundational layer. `resources` constrains node `type`s on top of it; `need-resolver`, `state-resolver`, `engine`, and `sdk` all consume its types; authors import `env` from here (its true source) when writing a `deploy.config.ts`.
24
-
25
- ## Conventions & gotchas
26
-
27
- - Refs are typed pointers to another node's outputs: never inline a downstream value; emit a `Ref` so ordering and resolution stay correct.
28
- - Secrets are `SecretRef`s with a `source` (`env` or `generated`); keep them as refs, never bake plaintext into a node.
29
- - Co-located tests in [src/index.test.ts](src/index.test.ts). See [ARCHITECTURE.md](../../ARCHITECTURE.md) for the full pipeline.
29
+ ```sh
30
+ pnpm --filter @intentic/graph test
31
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/graph",
3
- "version": "1.310.0",
3
+ "version": "1.311.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",