@ontrails/library 0.2.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 ADDED
@@ -0,0 +1,195 @@
1
+ # @ontrails/library
2
+
3
+ ## 0.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`79d12ca`](https://github.com/outfitter-dev/trails/commit/79d12cae392436e21a1125f3517e08a6b38d12d0): Support the approved initial release on `latest` at `0.2.0`: recognize the unpublished `1.0.0` source reset and the old beta tag predecessor, while retaining downgrade guards for every other transition and requiring manual publication.
8
+
9
+ Recognize the approved manual version PR in publication discovery with exact repository, branch, version, and label checks; preserve the normal bot-generated release path.
10
+
11
+ Keep the generated Homebrew formula on version scheme 1 so ordinary upgrades move from the beta line to 0.2.0 and continue through subsequent releases.
12
+
13
+ Derive generated library runtime ranges from the installed compiler package version so emitted libraries follow the 0.2.x release line and future version changes.
14
+ - [`b3ddf91`](https://github.com/outfitter-dev/trails/commit/b3ddf918ada8211f44983512e2bbdfbc5b66d722): Prepare the first normal Trails release at `0.2.0` on `latest`, replacing the unpublished 1.0.0 source release. The target advances the original `0.1.0` source minor, which was never published under the current package names. Public packages remain in lockstep. Update consumer installation guidance and provide a temporary manifest bridge for old 1.0 beta sources. Published beta versions remain unchanged; minor 0.x releases may carry documented breaking changes.
15
+
16
+ The `1.0.0` section retained below records an unpublished preparation, not an npm release. Its accumulated changes are included in `0.2.0`; the section remains as source history alongside the published beta entries.
17
+
18
+ ## 1.0.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [`5adb995`](https://github.com/outfitter-dev/trails/commit/5adb99551c2dda6190d46cce7f60bb08d63c99aa): Complete the v1 hard cutover from the authored `blaze` field to
23
+ `implementation` across trail contracts, surface projections, tests, examples,
24
+ and public source-analysis helpers. Existing applications must rename authored
25
+ trail behavior fields and direct trail-object access before upgrading.
26
+ - [`88a6a62`](https://github.com/outfitter-dev/trails/commit/88a6a62a9e9e230ca6d368fa78dc3ece6c816204): Complete the v1 classification-first cutover from projection/project vocabulary
27
+ to derive/derived for contract-owned fact production and render/rendered for
28
+ surface presentation. Public type, helper, rule, relation, and report names move
29
+ without compatibility aliases; ordinary repository/project nouns remain
30
+ explicit preserves or structured review inventory.
31
+
32
+ ### Patch Changes
33
+
34
+ - [`8097663`](https://github.com/outfitter-dev/trails/commit/80976636d0c40edb92ff458053818050043e7c9e): Project typed layer inputs through the library surface and generated packages. The runtime now validates the combined public input, routes layer-owned fields into per-layer input slots, and generated packages share one held client across root and result subpaths while avoiding Bun-only ambient type assumptions in their emitted tsconfig.
35
+ - [`b1fbe57`](https://github.com/outfitter-dev/trails/commit/b1fbe574e6f44d1fecb5e3a000270955c0a77b7b): Publish Bun-validated package tarballs through an npm trusted-publishing adapter
36
+ binding, add exact repository metadata for each public workspace package, and
37
+ correct the native Bun release descriptor to its pack-only runtime boundary.
38
+ - [`3a65ae3`](https://github.com/outfitter-dev/trails/commit/3a65ae363e05b7589f4a9876da4346886353b48c): Rename the durable graph substrate package from `@ontrails/topographer` to
39
+ `@ontrails/topography` after folding Wayfind graph queries into that owner.
40
+
41
+ Update imports to `@ontrails/topography` or
42
+ `@ontrails/topography/backend-support`. The pre-1.0 cutover does not ship a
43
+ compatibility package. TopoGraph, lock, topo-store, semantic diff, and Wayfind
44
+ APIs keep their existing contracts, and the `trails wayfind` CLI and MCP names
45
+ remain unchanged.
46
+
47
+ The governed package-route transition moves legacy `@ontrails/wayfinder`
48
+ imports directly to `@ontrails/topography`; it does not emit the retired
49
+ intermediate `@ontrails/topographer` route.
50
+
51
+ - [`f9533a4`](https://github.com/outfitter-dev/trails/commit/f9533a4ef7392201c71d7f751361b4f7177eeacb): Keep public error projection shared and redacted while using transport-neutral CLI vocabulary and preserving safe topo diagnostics in structured output.
52
+ - [`d4c8600`](https://github.com/outfitter-dev/trails/commit/d4c86009af44348d16bb78cae72054487baf0538): Make the library surface package publishable so generated Trails libraries can depend on the shared runtime-backed surface outside the monorepo.
53
+
54
+ ## 1.0.0-beta.50
55
+
56
+ ## 1.0.0-beta.49
57
+
58
+ ## 1.0.0-beta.48
59
+
60
+ ## 1.0.0-beta.47
61
+
62
+ ## 1.0.0-beta.46
63
+
64
+ ## 1.0.0-beta.45
65
+
66
+ ### Patch Changes
67
+
68
+ - [`f9533a4`](https://github.com/outfitter-dev/trails/commit/f9533a4ef7392201c71d7f751361b4f7177eeacb): Keep public error projection shared and redacted while using transport-neutral CLI vocabulary and preserving safe topo diagnostics in structured output.
69
+
70
+ ## 1.0.0-beta.44
71
+
72
+ ### Patch Changes
73
+
74
+ - [`b1fbe57`](https://github.com/outfitter-dev/trails/commit/b1fbe574e6f44d1fecb5e3a000270955c0a77b7b): Publish Bun-validated package tarballs through an npm trusted-publishing adapter
75
+ binding, add exact repository metadata for each public workspace package, and
76
+ correct the native Bun release descriptor to its pack-only runtime boundary.
77
+
78
+ ## 1.0.0-beta.43
79
+
80
+ ### Minor Changes
81
+
82
+ - [`88a6a62`](https://github.com/outfitter-dev/trails/commit/88a6a62a9e9e230ca6d368fa78dc3ece6c816204): Complete the v1 classification-first cutover from projection/project vocabulary
83
+ to derive/derived for contract-owned fact production and render/rendered for
84
+ surface presentation. Public type, helper, rule, relation, and report names move
85
+ without compatibility aliases; ordinary repository/project nouns remain
86
+ explicit preserves or structured review inventory.
87
+
88
+ ## 1.0.0-beta.42
89
+
90
+ ## 1.0.0-beta.41
91
+
92
+ ## 1.0.0-beta.40
93
+
94
+ ### Minor Changes
95
+
96
+ - [`5adb995`](https://github.com/outfitter-dev/trails/commit/5adb99551c2dda6190d46cce7f60bb08d63c99aa): Complete the v1 hard cutover from the authored `blaze` field to
97
+ `implementation` across trail contracts, surface projections, tests, examples,
98
+ and public source-analysis helpers. Existing applications must rename authored
99
+ trail behavior fields and direct trail-object access before upgrading.
100
+
101
+ ### Patch Changes
102
+
103
+ - [`3a65ae3`](https://github.com/outfitter-dev/trails/commit/3a65ae363e05b7589f4a9876da4346886353b48c): Rename the durable graph substrate package from `@ontrails/topographer` to
104
+ `@ontrails/topography` after folding Wayfind graph queries into that owner.
105
+
106
+ Update imports to `@ontrails/topography` or
107
+ `@ontrails/topography/backend-support`. The pre-1.0 cutover does not ship a
108
+ compatibility package. TopoGraph, lock, topo-store, semantic diff, and Wayfind
109
+ APIs keep their existing contracts, and the `trails wayfind` CLI and MCP names
110
+ remain unchanged.
111
+
112
+ The governed package-route transition moves legacy `@ontrails/wayfinder`
113
+ imports directly to `@ontrails/topography`; it does not emit the retired
114
+ intermediate `@ontrails/topographer` route.
115
+
116
+ ## 1.0.0-beta.39
117
+
118
+ ## 1.0.0-beta.38
119
+
120
+ ## 1.0.0-beta.37
121
+
122
+ ## 1.0.0-beta.36
123
+
124
+ ## 1.0.0-beta.35
125
+
126
+ ## 1.0.0-beta.34
127
+
128
+ ## 1.0.0-beta.33
129
+
130
+ ## 1.0.0-beta.32
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies [3e5c0fc]
135
+ - Updated dependencies [f3c4fef]
136
+ - Updated dependencies [cb0a9d8]
137
+ - Updated dependencies [21c6dda]
138
+ - Updated dependencies [fe72b84]
139
+ - @ontrails/core@1.0.0-beta.32
140
+
141
+ ## 1.0.0-beta.31
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [4cd5d4e]
146
+ - Updated dependencies [38907cc]
147
+ - @ontrails/core@1.0.0-beta.31
148
+
149
+ ## 1.0.0-beta.30
150
+
151
+ ### Patch Changes
152
+
153
+ - @ontrails/core@1.0.0-beta.30
154
+
155
+ ## 1.0.0-beta.29
156
+
157
+ ### Patch Changes
158
+
159
+ - @ontrails/core@1.0.0-beta.29
160
+
161
+ ## 1.0.0-beta.28
162
+
163
+ ### Patch Changes
164
+
165
+ - @ontrails/core@1.0.0-beta.28
166
+
167
+ ## 1.0.0-beta.27
168
+
169
+ ### Patch Changes
170
+
171
+ - @ontrails/core@1.0.0-beta.27
172
+
173
+ ## 1.0.0-beta.26
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [1307568]
178
+ - Updated dependencies [371d19e]
179
+ - @ontrails/core@1.0.0-beta.26
180
+
181
+ ## 1.0.0-beta.25
182
+
183
+ ### Patch Changes
184
+
185
+ - 8097663: Project typed layer inputs through the library surface and generated packages. The runtime now validates the combined public input, routes layer-owned fields into per-layer input slots, and generated packages share one held client across root and result subpaths while avoiding Bun-only ambient type assumptions in their emitted tsconfig.
186
+ - d4c8600: Make the library surface package publishable so generated Trails libraries can depend on the shared runtime-backed surface outside the monorepo.
187
+ - Updated dependencies [c36aca9]
188
+ - Updated dependencies [3befcf1]
189
+ - Updated dependencies [a4f9cf6]
190
+ - Updated dependencies [9bcf34e]
191
+ - @ontrails/core@1.0.0-beta.25
192
+
193
+ ## 1.0.0-beta.24
194
+
195
+ Initial prerelease changelog for the library surface package.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @ontrails/library
2
+
3
+ Render a Trails topo as an idiomatic TypeScript library.
4
+
5
+ `@ontrails/library` is a peer surface for plain TypeScript consumers. It reads the same contract that CLI, MCP, and HTTP read, then renders that graph into function calls, package-facing errors, schema exports, and generated package files.
6
+
7
+ The package is publishable as the runtime dependency for generated Trails libraries. Generated packages can depend on it while keeping their consumer-facing API idiomatic and package-local.
8
+
9
+ Generated runtime dependencies default to a caret range of the installed compiler's package version, such as `^0.2.0` for a `0.2.0` compiler. Set `libraryDependency` when generating into an owned workspace or choosing a different runtime range.
10
+
11
+ ## API
12
+
13
+ ```ts
14
+ import { compile, deriveLibraryApi, surface } from '@ontrails/library';
15
+
16
+ const renderingPlan = deriveLibraryApi(app);
17
+ const client = await surface(app);
18
+ const files = compile(app, {
19
+ appExportName: 'app',
20
+ appImportPath: '@acme/app',
21
+ packageName: '@acme/generated',
22
+ });
23
+ ```
24
+
25
+ - `deriveLibraryApi(graph, options)` is the pure derivation. It returns the rendering plan that decides which public trails become library exports, how export names are derived, which trails are excluded, and where export-name collisions exist.
26
+ - `surface(graph, options)` returns an in-memory callable client. The root call lane unwraps `Result.ok` into a return value and maps `Result.err` into typed `LibraryError` subclasses.
27
+ - `compile(graph, options)` returns a stable file plan for a generated package. Writing those files is intentionally a thin apply step outside the compiler.
28
+
29
+ ## Generated package shape
30
+
31
+ Generated packages use one package with subpath exports:
32
+
33
+ ```text
34
+ . consumer-fluent root functions and createX factories
35
+ ./result no-throw Result-returning functions
36
+ ./schemas authored Zod schemas and optional schema-owned type aliases
37
+ ./trails the Trails-native topo entrypoint
38
+ ```
39
+
40
+ Stateless trails render to root named exports. Resource-bearing trails render behind a generated `createX(options)` factory so callers can provide resource configuration once and call several related methods from the same client.
41
+
42
+ Generated root and `/result` subpaths share one internal client module, so importing both subpaths does not open separate root library surfaces.
43
+
44
+ ## Typed signatures
45
+
46
+ Topo artifacts carry durable contract facts, but they do not preserve erased source-level TypeScript generics. Generated packages therefore stay honest by defaulting method signatures to `unknown` unless the caller binds a rendered trail id to the source trail export that owns its schema types:
47
+
48
+ ```ts
49
+ const files = compile(app, {
50
+ appExportName: 'app',
51
+ appImportPath: '../fixture-app',
52
+ packageName: '@acme/generated',
53
+ trailTypeExports: {
54
+ 'widget.ping': 'pingTrail',
55
+ },
56
+ typeImportPath: '../fixture-trails',
57
+ });
58
+ ```
59
+
60
+ With that binding, `/schemas` emits aliases such as `WidgetPingInput = TrailInput<typeof pingTrail>` and the root and `/result` subpaths use those aliases in their public signatures.
61
+
62
+ Typed layer inputs are rendered into the same public method input object as trail fields. When a layer field collides with a trail field or reserved surface name, the generated library input uses the same deterministic `<layerName><Field>` rename rule as other object-shaped surfaces. Runtime calls validate the rendered input, strip layer-owned fields before trail validation, and route them to the layer's own input slot. When a source trail type binding is provided, generated signatures widen layer-rendered inputs with `Record<string, unknown>` until layer input type exports have a source-level owner.
63
+
64
+ ## Errors
65
+
66
+ The root API throws package-facing `LibraryError` subclasses. This is a surface mapping, not an implementation behavior change: implementations still return `Result`.
67
+
68
+ The `/result` subpath preserves the no-throw envelope:
69
+
70
+ ```ts
71
+ import { widgetPing } from '@acme/generated/result';
72
+
73
+ const result = await widgetPing(input);
74
+ ```
75
+
76
+ The mapper is built with the shared Trails error taxonomy, so new categories must be covered before the package can typecheck.
77
+
78
+ ## Governance and dogfood
79
+
80
+ Library-derived facts are embedded in `TopoGraph.library` by Topography. Warden's `library-render-coherence` rule checks that serialized rendering facts do not drift from the graph, including missing target trails and export name collisions.
81
+
82
+ Run the focused package checks while changing the surface:
83
+
84
+ ```bash
85
+ bun run library:smoke
86
+ bun run library:dogfood:warden
87
+ ```
88
+
89
+ `library:dogfood:warden` compiles the Warden topo into a generated package, typechecks that generated package, runs a generated consumer test through root, `/result`, `/schemas`, and `/trails`, then dry-run packs it.
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@ontrails/library",
3
+ "version": "0.2.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/outfitter-dev/trails.git",
7
+ "directory": "packages/library"
8
+ },
9
+ "files": [
10
+ "src/**/*.ts",
11
+ "!src/**/__tests__/**",
12
+ "!src/**/*.test.ts",
13
+ "!src/**/*.test-d.ts",
14
+ "README.md",
15
+ "CHANGELOG.md"
16
+ ],
17
+ "type": "module",
18
+ "exports": {
19
+ ".": "./src/index.ts",
20
+ "./package.json": "./package.json"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -b",
24
+ "test": "bun test --timeout 30000",
25
+ "typecheck": "tsc --noEmit",
26
+ "lint": "oxlint ./src",
27
+ "clean": "rm -rf dist *.tsbuildinfo"
28
+ },
29
+ "dependencies": {
30
+ "@ontrails/core": "^0.2.0"
31
+ },
32
+ "devDependencies": {
33
+ "@ontrails/testing": "^0.2.0"
34
+ },
35
+ "peerDependencies": {
36
+ "zod": "^4.3.5"
37
+ }
38
+ }