@cmflow/atlas 3.4.0-beta.24 → 3.4.0-beta.26
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/README.md +46 -3
- package/dist/{UserConfig-aqAuodcW.d.mts → UserConfig-BlRknCRh.d.mts} +3 -1
- package/dist/bin/atlas.mjs +20 -6744
- package/dist/bin/atlas.mjs.map +1 -1
- package/dist/dist-uTuN89Bv.mjs +6950 -0
- package/dist/dist-uTuN89Bv.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +23 -2
- package/dist/index.mjs.map +1 -1
- package/dist/rules/lodashGetRule.d.mts +1 -1
- package/dist/rules/mappingUtilityRule.d.mts +1 -1
- package/dist/rules/memberGetFieldRule.d.mts +1 -1
- package/package.json +1 -1
- package/dist/propertyExtractionService-CTQFyLdy.mjs +0 -213
- package/dist/propertyExtractionService-CTQFyLdy.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -64,17 +64,41 @@ export default defineConfig({
|
|
|
64
64
|
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
`process.cwd()` is always the project root: `outputDir`, `tsconfig.json`, Git paths and serialized source paths are resolved from it. `analysis.rootDir` only defines the source tree to analyze and may therefore point to a subdirectory such as `./app`. Atlas reads `compilerOptions.paths` from the root `tsconfig.json` and uses them as module aliases. Add `resolver.alias` only to override or complement those aliases.
|
|
68
|
+
|
|
69
|
+
`outputDir` is resolved from the project root, not from `analysis.rootDir`. With the configuration above, artifacts are written to `<project-root>/tmp/atlas`, never to `<project-root>/app/tmp/atlas`.
|
|
70
|
+
|
|
71
|
+
Use `analysis.excluded` for project-root-relative technical files that must not enter dependency traversal or `analysis_files`:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
analysis: {
|
|
75
|
+
rootDir: "./app",
|
|
76
|
+
excluded: ["tools/build/*-reference.json"],
|
|
77
|
+
backends: [/* ... */]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
68
80
|
|
|
69
81
|
## Backend sources
|
|
70
82
|
|
|
71
|
-
Atlas
|
|
83
|
+
Atlas starts from accesses actually detected in code on a backend reached by the route graph. It then consolidates those code candidates against the canonical properties returned by the matching `BackendSource`. Atlas never creates a confirmed mapping from API field-name similarity alone.
|
|
84
|
+
|
|
85
|
+
For a backend with no configured source, Atlas preserves code candidates for optional AI inference. A configured source is authoritative: only its resolved properties can validate the code access.
|
|
72
86
|
|
|
73
87
|
A backend can be either a string or a `BackendSource` created with `defineBackendSource`:
|
|
74
88
|
|
|
75
89
|
- a string (for example `"ICC"`) has no field reference; Atlas keeps the current code-analysis and optional inference flow;
|
|
76
90
|
- a `BackendSource` provides a `resolve` function that returns the backend's known properties. Atlas assigns its `name` as `backend` on every resolved property.
|
|
77
91
|
|
|
92
|
+
Any backend source can persist its resolved properties in a YAML cache. When the cache exists, Atlas uses it and does not call the remote source. Refresh it explicitly with `atlas backend-source --refresh` (or the compatible `atlas backend-sources --refresh`). Use `atlas backend-sources --refresh --all` to refresh every configured source without an interactive prompt.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
export const xm = defineBackendSource({
|
|
96
|
+
name: "XM",
|
|
97
|
+
cache: `${__dirname}/cache.yaml`,
|
|
98
|
+
resolve: () => openapiSource({ url: "https://xm.example/openapi.json" })
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
78
102
|
When a string and a source share the same name, the last declaration wins. This lets a source enrich a list of backend names, for example `[..., Object.values(BackendTypes), quableBackendSource]`.
|
|
79
103
|
|
|
80
104
|
The resolver returns one of the following shapes. Document-oriented backends have no route; REST backends have no document.
|
|
@@ -96,6 +120,16 @@ type BackendProperty =
|
|
|
96
120
|
|
|
97
121
|
The generated mapping preserves this shape. In particular, `document` is a separate property: Atlas does not turn a Quable field into an artificial path such as `products.product_geographical_area`.
|
|
98
122
|
|
|
123
|
+
## Resolved backend metadata artifacts
|
|
124
|
+
|
|
125
|
+
At the start of `generate:graph` and `generate:catalog`, Atlas resolves every configured backend source and writes its metadata for inspection:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
<outputDir>/backends/<backend>.yaml
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For example, `<outputDir>/backends/quable_rest.yaml` contains the source name, generation date and canonical properties returned by Quable. Backends declared as strings still receive an artifact with `resolved: false`; this makes missing metadata sources visible during analysis.
|
|
132
|
+
|
|
99
133
|
### Quable
|
|
100
134
|
|
|
101
135
|
Attach rules that are specific to Quable directly to its source. They inherit the source backend automatically and their candidates are validated by the Quable property list.
|
|
@@ -173,6 +207,7 @@ import { constant, defineBackendSource, openapiSource } from "@cmflow/atlas";
|
|
|
173
207
|
|
|
174
208
|
export const xm = defineBackendSource({
|
|
175
209
|
name: "XM",
|
|
210
|
+
cache: `${__dirname}/xm-openapi.yaml`,
|
|
176
211
|
resolve: () =>
|
|
177
212
|
openapiSource({
|
|
178
213
|
url: constant<string>("XM_API_URL", "https://xm.example/openapi.json")
|
|
@@ -302,6 +337,13 @@ atlas --analysis-dir /path/to/api generate:catalog --output .tmp/datasource-cata
|
|
|
302
337
|
|
|
303
338
|
Each route produces a YAML document and a `.graph.yaml` topology artifact. The catalogue requires a valid graph and leaves ambiguous fields marked `needs_review`.
|
|
304
339
|
|
|
340
|
+
When changing `analysis.rootDir`, backend sources or exclusions, regenerate the graph before the catalogue so the route graph and metadata artifacts use the same configuration:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
atlas generate:graph "GET /v2/products"
|
|
344
|
+
atlas generate:catalog "GET /v2/products"
|
|
345
|
+
```
|
|
346
|
+
|
|
305
347
|
Check configured coverage baselines:
|
|
306
348
|
|
|
307
349
|
```bash
|
|
@@ -329,7 +371,8 @@ Without `--write`, the command performs a dry run. Use `clean-orphans` to inspec
|
|
|
329
371
|
|
|
330
372
|
```text
|
|
331
373
|
atlas init Create atlas.config.ts
|
|
332
|
-
atlas backend-
|
|
374
|
+
atlas backend-source [--refresh] Display backend metadata; refresh configured source caches when requested
|
|
375
|
+
atlas backend-sources [--refresh] [--all] Compatible plural alias; --all skips the source picker
|
|
333
376
|
atlas generate:graph Trace API routes to backends
|
|
334
377
|
atlas generate:catalog [route] Generate route review documents
|
|
335
378
|
atlas generate:test Check configured coverage baselines
|
|
@@ -44,6 +44,8 @@ type BackendProperty = PropertyMetadata & ({
|
|
|
44
44
|
//#region src/interfaces/BackendSource.d.ts
|
|
45
45
|
interface BackendSource {
|
|
46
46
|
name: string;
|
|
47
|
+
/** YAML file containing resolved properties. Existing caches are read before calling `resolve`. */
|
|
48
|
+
cache?: string;
|
|
47
49
|
resolve?: () => Promise<BackendProperty[]>;
|
|
48
50
|
rules?: FieldExtractionRule[];
|
|
49
51
|
}
|
|
@@ -137,4 +139,4 @@ interface UserConfig {
|
|
|
137
139
|
}
|
|
138
140
|
//#endregion
|
|
139
141
|
export { defineExpressionRule as a, FieldExtractionRule as i, BackendSource as n, BackendProperty as r, UserConfig as t };
|
|
140
|
-
//# sourceMappingURL=UserConfig-
|
|
142
|
+
//# sourceMappingURL=UserConfig-BlRknCRh.d.mts.map
|