@cmflow/atlas 3.4.0-beta.3 → 3.4.0-beta.30
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 +283 -12
- package/dist/UserConfig-BlRknCRh.d.mts +142 -0
- package/dist/bin/atlas.d.mts +2 -0
- package/dist/bin/atlas.mjs +22572 -3184
- package/dist/bin/atlas.mjs.map +1 -0
- package/dist/defineExpressionRule-GhkeHHT8.mjs +10 -0
- package/dist/defineExpressionRule-GhkeHHT8.mjs.map +1 -0
- package/dist/dist-KClmoDrs.mjs +6950 -0
- package/dist/dist-KClmoDrs.mjs.map +1 -0
- package/dist/index.d.mts +38 -0
- package/dist/index.mjs +1318 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rolldown-runtime-CGR6nZuH.mjs +34 -0
- package/dist/routeBackendTopologyService-DMzDLqUR.mjs +8769 -0
- package/dist/routeBackendTopologyService-DMzDLqUR.mjs.map +1 -0
- package/dist/rules/lodashGetRule.d.mts +7 -0
- package/dist/rules/lodashGetRule.mjs +24 -0
- package/dist/rules/lodashGetRule.mjs.map +1 -0
- package/dist/rules/mappingUtilityRule.d.mts +7 -0
- package/dist/rules/mappingUtilityRule.mjs +38 -0
- package/dist/rules/mappingUtilityRule.mjs.map +1 -0
- package/dist/rules/memberGetFieldRule.d.mts +7 -0
- package/dist/rules/memberGetFieldRule.mjs +27 -0
- package/dist/rules/memberGetFieldRule.mjs.map +1 -0
- package/dist/taskProgressService-BTXcmKRN.mjs +1247 -0
- package/dist/taskProgressService-BTXcmKRN.mjs.map +1 -0
- package/dist/token-CiiblKFL.mjs +62 -0
- package/dist/token-CiiblKFL.mjs.map +1 -0
- package/dist/token-util-Br4-y5kE.mjs +7 -0
- package/dist/token-util-Dnzm6rU4.mjs +471 -0
- package/dist/token-util-Dnzm6rU4.mjs.map +1 -0
- package/dist/workers/routeBackendTopologyWorker.d.mts +2 -0
- package/dist/workers/routeBackendTopologyWorker.mjs +39 -0
- package/dist/workers/routeBackendTopologyWorker.mjs.map +1 -0
- package/knowledges/cms-and-directus-indirect-routes.md +5 -3
- package/package.json +24 -13
- package/dist/defineRule-Dfvzj6n2.mjs +0 -2
- package/dist/defineRule-Dfvzj6n2.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ atlas init
|
|
|
42
42
|
atlas --config /path/to/api/atlas.config.ts init
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
By default, Atlas loads `atlas.config.ts` from the directory where the command is launched. Use `--config` (or `-c`) to reference another configuration file. Use `--
|
|
45
|
+
By default, Atlas loads `atlas.config.ts` from the directory where the command is launched. Use `--config` (or `-c`) to reference another configuration file. Use `--analysis-dir` only to override the API source directory to analyze.
|
|
46
46
|
|
|
47
47
|
The configuration imports `defineConfig` from Atlas:
|
|
48
48
|
|
|
@@ -50,13 +50,275 @@ The configuration imports `defineConfig` from Atlas:
|
|
|
50
50
|
import { defineConfig } from "@cmflow/atlas";
|
|
51
51
|
|
|
52
52
|
export default defineConfig({
|
|
53
|
-
|
|
53
|
+
outputDir: "./tmp/atlas",
|
|
54
|
+
envs: {
|
|
55
|
+
XM_API_URL: "https://xm.example/openapi.json"
|
|
56
|
+
},
|
|
54
57
|
openapiUrl: "https://api.example.com/openapi.json",
|
|
55
58
|
openapiTimeoutMs: 60_000,
|
|
56
|
-
directusUrl: "https://cms.api.clubmed"
|
|
59
|
+
directusUrl: "https://cms.api.clubmed",
|
|
60
|
+
analysis: {
|
|
61
|
+
rootDir: "./app",
|
|
62
|
+
backends: ["ICC", "CMS", "CMS_B2C"]
|
|
63
|
+
}
|
|
57
64
|
});
|
|
58
65
|
```
|
|
59
66
|
|
|
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
|
+
```
|
|
80
|
+
|
|
81
|
+
## Backend sources
|
|
82
|
+
|
|
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.
|
|
86
|
+
|
|
87
|
+
A backend can be either a string or a `BackendSource` created with `defineBackendSource`:
|
|
88
|
+
|
|
89
|
+
- a string (for example `"ICC"`) has no field reference; Atlas keeps the current code-analysis and optional inference flow;
|
|
90
|
+
- a `BackendSource` provides a `resolve` function that returns the backend's known properties. Atlas assigns its `name` as `backend` on every resolved property.
|
|
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
|
+
|
|
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]`.
|
|
103
|
+
|
|
104
|
+
The resolver returns one of the following shapes. Document-oriented backends have no route; REST backends have no document.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
type BackendProperty =
|
|
108
|
+
| {
|
|
109
|
+
document: string;
|
|
110
|
+
field: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
}
|
|
113
|
+
| {
|
|
114
|
+
route: string;
|
|
115
|
+
method: string;
|
|
116
|
+
field: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
};
|
|
119
|
+
```
|
|
120
|
+
|
|
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`.
|
|
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
|
+
|
|
133
|
+
### Quable
|
|
134
|
+
|
|
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.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { defineBackendSource, httpClient } from "@cmflow/atlas";
|
|
139
|
+
import { quableI18nFieldRule } from "./atlas-rules";
|
|
140
|
+
|
|
141
|
+
export const quable = defineBackendSource({
|
|
142
|
+
name: "QUABLE",
|
|
143
|
+
rules: [quableI18nFieldRule],
|
|
144
|
+
resolve: async () => {
|
|
145
|
+
const documentTypes = await httpClient.get<QuableDocumentType[]>("https://quable.example/document-types");
|
|
146
|
+
|
|
147
|
+
return documentTypes.flatMap((document) =>
|
|
148
|
+
document.properties.map((property) => ({
|
|
149
|
+
document: document.code,
|
|
150
|
+
field: property.code,
|
|
151
|
+
description: "récupéré via le backend resolver"
|
|
152
|
+
}))
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
For example, the resolver above may return:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
{
|
|
162
|
+
backend: "QUABLE",
|
|
163
|
+
document: "products",
|
|
164
|
+
field: "product_geographical_area",
|
|
165
|
+
description: "récupéré via le backend resolver"
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### CMS Directus
|
|
170
|
+
|
|
171
|
+
CMS Directus follows the same document-oriented contract. Its `cmsI18nFieldRule` is owned by the CMS source rather than registered as a global expression rule.
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
import { defineBackendSource } from "@cmflow/atlas";
|
|
175
|
+
import { cmsI18nFieldRule } from "./atlas-rules";
|
|
176
|
+
|
|
177
|
+
export const cmsDirectus = defineBackendSource({
|
|
178
|
+
name: "CMS",
|
|
179
|
+
rules: [cmsI18nFieldRule],
|
|
180
|
+
resolve: async () => directusResolver.listProperties()
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
`directusResolver.listProperties()` returns items such as `{ document: "offers", field: "title", description: "…" }`.
|
|
185
|
+
|
|
186
|
+
### CMS Legacy
|
|
187
|
+
|
|
188
|
+
CMS Legacy is configured identically, with its own resolver and backend identifier. It may reuse `cmsI18nFieldRule` when the backend uses `CmsI18n` helpers.
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
import { defineBackendSource } from "@cmflow/atlas";
|
|
192
|
+
import { cmsI18nFieldRule } from "./atlas-rules";
|
|
193
|
+
|
|
194
|
+
export const cmsLegacy = defineBackendSource({
|
|
195
|
+
name: "CMS_LEGACY",
|
|
196
|
+
rules: [cmsI18nFieldRule],
|
|
197
|
+
resolve: async () => cmsLegacyResolver.listProperties()
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Custom REST backend with OpenAPI
|
|
202
|
+
|
|
203
|
+
`openapiSource` reuses Atlas's OpenAPI parsing utilities: downloading the document, resolving references, traversing operations, and extracting field descriptions. A project therefore only supplies the URL.
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { constant, defineBackendSource, openapiSource } from "@cmflow/atlas";
|
|
207
|
+
|
|
208
|
+
export const xm = defineBackendSource({
|
|
209
|
+
name: "XM",
|
|
210
|
+
cache: `${__dirname}/xm-openapi.yaml`,
|
|
211
|
+
resolve: () =>
|
|
212
|
+
openapiSource({
|
|
213
|
+
url: constant<string>("XM_API_URL", "https://xm.example/openapi.json")
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
`constant` resolves a value declared in `envs`, falling back to its second argument. No resolver context is required.
|
|
219
|
+
|
|
220
|
+
### Environment constants
|
|
221
|
+
|
|
222
|
+
Use `constant` when a backend source needs a configurable value such as a URL or an access token. Declare injected values at the root of `atlas.config.ts`; the value is resolved when the source runs:
|
|
223
|
+
|
|
224
|
+
1. Atlas uses `envs[name]` when it is set.
|
|
225
|
+
2. Otherwise, it returns the supplied default value.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
import { constant, defineBackendSource, openapiSource } from "@cmflow/atlas";
|
|
229
|
+
|
|
230
|
+
export const xmBackendSource = defineBackendSource({
|
|
231
|
+
name: "XM",
|
|
232
|
+
resolve: () =>
|
|
233
|
+
openapiSource({
|
|
234
|
+
url: constant<string>("XM_API_URL", "https://xm.example/openapi.json")
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
For example, configure the endpoint used by the source:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
export default defineConfig({
|
|
243
|
+
envs: {
|
|
244
|
+
XM_API_URL: "https://xm.internal/openapi.json"
|
|
245
|
+
}
|
|
246
|
+
// …other Atlas options
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
`envs` can itself be populated from `process.env` when appropriate for the project.
|
|
251
|
+
|
|
252
|
+
This returns entries such as:
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
{
|
|
256
|
+
backend: "XM",
|
|
257
|
+
route: "/path/to",
|
|
258
|
+
method: "GET",
|
|
259
|
+
field: "path.to.field",
|
|
260
|
+
description: "Description extraite du Swagger"
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Register strings and sources together:
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
import { defineConfig } from "@cmflow/atlas";
|
|
268
|
+
import { cmsDirectus, cmsLegacy, quable, xm } from "./backend-sources";
|
|
269
|
+
|
|
270
|
+
export default defineConfig({
|
|
271
|
+
// …other Atlas options
|
|
272
|
+
analysis: {
|
|
273
|
+
backends: ["ICC", quable, cmsDirectus, cmsLegacy, xm]
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Custom expression rules
|
|
279
|
+
|
|
280
|
+
Use `defineExpressionRule` when a project-specific helper hides a backend field or wraps an expression that Atlas should follow. Define those rules in the analyzed project, add a cross-backend rule to `analysis.rules` in `atlas.config.ts`, and attach backend-specific rules to `defineBackendSource({ rules: [...] })` instead.
|
|
281
|
+
|
|
282
|
+
`match` is a cheap predicate that selects the `ts-morph` expression. `parse` returns the information Atlas should use: a backend field, a transparent wrapper, or both.
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import { defineConfig, defineExpressionRule } from "@cmflow/atlas";
|
|
286
|
+
import { Node } from "ts-morph";
|
|
287
|
+
|
|
288
|
+
const localizedFieldRule = defineExpressionRule({
|
|
289
|
+
name: "localized-field",
|
|
290
|
+
match: (expression) => Node.isCallExpression(expression) && expression.getExpression().getText() === "localizedField",
|
|
291
|
+
parse: (expression) => {
|
|
292
|
+
if (!Node.isCallExpression(expression)) return undefined;
|
|
293
|
+
|
|
294
|
+
const [source, field] = expression.getArguments();
|
|
295
|
+
if (!source || !Node.isExpression(source) || !Node.isStringLiteral(field)) return undefined;
|
|
296
|
+
|
|
297
|
+
return { backendField: `${source.getText()}.${field.getLiteralValue()}` };
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
export default defineConfig({
|
|
302
|
+
// …other Atlas options
|
|
303
|
+
analysis: {
|
|
304
|
+
// …other analysis options
|
|
305
|
+
rules: [localizedFieldRule]
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
For a wrapper that does not change the field path, return `transparent: true`:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
const unwrapRule = defineExpressionRule({
|
|
314
|
+
name: "unwrap-api-value",
|
|
315
|
+
match: (expression) => Node.isCallExpression(expression) && expression.getExpression().getText() === "unwrap",
|
|
316
|
+
parse: () => ({ transparent: true })
|
|
317
|
+
});
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
`parse` may also set `mapperType` to annotate the generated mapping, or `apiMapping: true` when the helper maps an API value rather than a backend value.
|
|
321
|
+
|
|
60
322
|
Create a `.env.local` in the target API project when pushing to Directus:
|
|
61
323
|
|
|
62
324
|
```dotenv
|
|
@@ -69,23 +331,30 @@ DIRECTUS_TOKEN=replace-with-a-static-token
|
|
|
69
331
|
Generate the topology first, then the route catalogue:
|
|
70
332
|
|
|
71
333
|
```bash
|
|
72
|
-
atlas --
|
|
73
|
-
atlas --
|
|
334
|
+
atlas --analysis-dir /path/to/api generate:graph
|
|
335
|
+
atlas --analysis-dir /path/to/api generate:catalog --output .tmp/datasource-catalogue
|
|
74
336
|
```
|
|
75
337
|
|
|
76
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`.
|
|
77
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
|
+
|
|
78
347
|
Check configured coverage baselines:
|
|
79
348
|
|
|
80
349
|
```bash
|
|
81
|
-
atlas --
|
|
350
|
+
atlas --analysis-dir /path/to/api generate:test
|
|
82
351
|
```
|
|
83
352
|
|
|
84
353
|
Review unresolved mappings or run optional AI inference:
|
|
85
354
|
|
|
86
355
|
```bash
|
|
87
|
-
atlas --
|
|
88
|
-
atlas --
|
|
356
|
+
atlas --analysis-dir /path/to/api needs-review --sort percentage --limit 25
|
|
357
|
+
atlas --analysis-dir /path/to/api infer .tmp/datasource-catalogue
|
|
89
358
|
```
|
|
90
359
|
|
|
91
360
|
The inference pass only reads analysis files referenced by each route graph. Accepted suggestions remain marked `inferred`; suggestions below the configured confidence threshold are retained for manual review.
|
|
@@ -93,17 +362,19 @@ The inference pass only reads analysis files referenced by each route graph. Acc
|
|
|
93
362
|
Push route artifacts to Directus with an explicit write flag:
|
|
94
363
|
|
|
95
364
|
```bash
|
|
96
|
-
atlas --
|
|
365
|
+
atlas --analysis-dir /path/to/api push .tmp/datasource-catalogue --update
|
|
97
366
|
```
|
|
98
367
|
|
|
99
|
-
Without `--
|
|
368
|
+
Without `--update`, the command performs a dry run. Use `clean-orphans` to inspect Directus links that no longer reference an API or backend property.
|
|
100
369
|
|
|
101
370
|
## Command reference
|
|
102
371
|
|
|
103
372
|
```text
|
|
104
373
|
atlas init Create atlas.config.ts
|
|
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
|
|
105
376
|
atlas generate:graph Trace API routes to backends
|
|
106
|
-
atlas generate:
|
|
377
|
+
atlas generate:catalog [route] Generate route review documents
|
|
107
378
|
atlas generate:test Check configured coverage baselines
|
|
108
379
|
atlas needs-review Rank unresolved routes
|
|
109
380
|
atlas infer [route|directory] Optionally enrich unresolved mappings
|
|
@@ -114,7 +385,7 @@ atlas report:changed Report coverage for changed routes
|
|
|
114
385
|
|
|
115
386
|
## CI
|
|
116
387
|
|
|
117
|
-
The recommended static CI flow is `generate:graph`, `generate:
|
|
388
|
+
The recommended static CI flow is `generate:graph`, `generate:catalog`, then `push`. Do not run optional inference in CI. Supply `DIRECTUS_URL` and `DIRECTUS_TOKEN` through the CI secret context; skip the push if either value is absent.
|
|
118
389
|
|
|
119
390
|
## Development
|
|
120
391
|
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
|
|
2
|
+
import { Expression } from "ts-morph";
|
|
3
|
+
//#region src/fn/defineExpressionRule.d.ts
|
|
4
|
+
type FieldExtractionRuleResult = {
|
|
5
|
+
backendField?: string;
|
|
6
|
+
transparent?: boolean;
|
|
7
|
+
mapperType?: string;
|
|
8
|
+
apiMapping?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type FieldExtractionRule = {
|
|
11
|
+
name: string;
|
|
12
|
+
/** Higher-priority rules are evaluated first. Defaults to 0. */
|
|
13
|
+
priority?: number;
|
|
14
|
+
match: (expression: Expression, config: UserConfig) => boolean;
|
|
15
|
+
parse: (expression: Expression, config: UserConfig) => FieldExtractionRuleResult | undefined;
|
|
16
|
+
};
|
|
17
|
+
declare function defineExpressionRule(rule: FieldExtractionRule): FieldExtractionRule;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/interfaces/Direction.d.ts
|
|
20
|
+
type Direction = "input" | "output";
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/interfaces/PropertyLocation.d.ts
|
|
23
|
+
type PropertyLocation = "query" | "path" | "header" | "body";
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/interfaces/PropertyMetadata.d.ts
|
|
26
|
+
interface PropertyMetadata {
|
|
27
|
+
direction?: Direction;
|
|
28
|
+
location?: PropertyLocation;
|
|
29
|
+
type?: string;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/interfaces/BackendProperty.d.ts
|
|
33
|
+
type BackendProperty = PropertyMetadata & ({
|
|
34
|
+
document: string;
|
|
35
|
+
field: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
} | {
|
|
38
|
+
route: string;
|
|
39
|
+
method: string;
|
|
40
|
+
field: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/interfaces/BackendSource.d.ts
|
|
45
|
+
interface BackendSource {
|
|
46
|
+
name: string;
|
|
47
|
+
/** YAML file containing resolved properties. Existing caches are read before calling `resolve`. */
|
|
48
|
+
cache?: string;
|
|
49
|
+
resolve?: () => Promise<BackendProperty[]>;
|
|
50
|
+
rules?: FieldExtractionRule[];
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/config/interfaces/UserConfig.d.ts
|
|
54
|
+
interface NeutralExpressionMatcher {
|
|
55
|
+
prefix: string;
|
|
56
|
+
apiMapping?: boolean;
|
|
57
|
+
}
|
|
58
|
+
interface UserConfig {
|
|
59
|
+
/** Values injectable into backend source resolvers through `constant`. */
|
|
60
|
+
envs?: Record<string, unknown>;
|
|
61
|
+
/** Directory where Atlas writes generated graph and catalogue artifacts, resolved from `process.cwd()`. */
|
|
62
|
+
outputDir: string;
|
|
63
|
+
/**
|
|
64
|
+
* Default OpenAPI document URL used to extract the public contract exposed by the API.
|
|
65
|
+
* The CLI can still override this value with `--openapi-url`.
|
|
66
|
+
*/
|
|
67
|
+
openapiUrl: string;
|
|
68
|
+
/** Maximum duration allowed to connect to and download the OpenAPI document. */
|
|
69
|
+
openapiTimeoutMs: number;
|
|
70
|
+
/** Default Directus base URL used by `push` when no CLI option or environment variable overrides it. */
|
|
71
|
+
directusUrl: string;
|
|
72
|
+
/** Default Directus token used by `push` when no CLI option or environment variable overrides it. */
|
|
73
|
+
directusToken: string;
|
|
74
|
+
/**
|
|
75
|
+
* Module aliases resolved while traversing static-analysis dependencies.
|
|
76
|
+
* Defaults are read from `compilerOptions.paths` in the repository tsconfig.
|
|
77
|
+
*/
|
|
78
|
+
resolver?: {
|
|
79
|
+
/** Explicit aliases override aliases read from tsconfig. */
|
|
80
|
+
alias?: Record<string, string>;
|
|
81
|
+
};
|
|
82
|
+
/** Defaults used by the optional AI pass that reviews unresolved static mappings. */
|
|
83
|
+
inference: {
|
|
84
|
+
/** ai/sdk model used for structured mapping suggestions. */
|
|
85
|
+
model: string;
|
|
86
|
+
/** ai/sdk HTTP API base URL. */
|
|
87
|
+
baseUrl: string;
|
|
88
|
+
/** Minimum model confidence required to replace a `needs_review` mapping. */
|
|
89
|
+
minimumConfidence: number;
|
|
90
|
+
/** Maximum duration of one route-level AI request before aborting it. */
|
|
91
|
+
timeoutMs: number;
|
|
92
|
+
/** Maximum number of route-level AI requests run concurrently. */
|
|
93
|
+
workers: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Static analysis options used to keep generated artifacts focused on business-relevant files and fields.
|
|
97
|
+
*/
|
|
98
|
+
analysis: {
|
|
99
|
+
/** Directory containing the application source tree to analyze, resolved from `process.cwd()`. */
|
|
100
|
+
rootDir: string;
|
|
101
|
+
/** Backend identifiers used by the API project. */
|
|
102
|
+
backends: Array<string | BackendSource>;
|
|
103
|
+
/**
|
|
104
|
+
* Glob patterns, relative to the project working directory, excluded from `analysis_files`.
|
|
105
|
+
* Use this to hide technical plumbing files that add noise to route review documents.
|
|
106
|
+
*/
|
|
107
|
+
excluded: string[];
|
|
108
|
+
/**
|
|
109
|
+
* Input root fields considered transverse to the API, such as access headers or generic list filters.
|
|
110
|
+
* These fields are kept in the extracted contract but are not flagged as `needs_review`
|
|
111
|
+
* when they do not map to a backend property. A detected backend mapping always takes precedence.
|
|
112
|
+
*/
|
|
113
|
+
transversalInputs: string[];
|
|
114
|
+
/** Output field paths omitted from catalogues and coverage checks, including nested fields. */
|
|
115
|
+
ignoredOutputs: string[];
|
|
116
|
+
/** Technical property-access prefixes that must not be treated as backend fields. */
|
|
117
|
+
backendFieldAccess: {
|
|
118
|
+
excludedPrefixes: string[];
|
|
119
|
+
};
|
|
120
|
+
/** Mapper naming conventions used to infer mapping direction and domain roots. */
|
|
121
|
+
mapperNaming: {
|
|
122
|
+
inputPatterns: RegExp[];
|
|
123
|
+
outputPatterns: RegExp[];
|
|
124
|
+
domainToBackendPattern: RegExp;
|
|
125
|
+
domainNameFromToDomainPattern: RegExp;
|
|
126
|
+
constructedTypeToDomainPattern: (constructorName: string) => RegExp;
|
|
127
|
+
};
|
|
128
|
+
/** Expressions that are transparent while tracing a field through a mapping. */
|
|
129
|
+
neutralExpressionMatchers: NeutralExpressionMatcher[];
|
|
130
|
+
rules: FieldExtractionRule[];
|
|
131
|
+
};
|
|
132
|
+
/** Route-level minimum resolved-field coverage accepted by the static-analysis regression check. */
|
|
133
|
+
test: {
|
|
134
|
+
coverage: Array<{
|
|
135
|
+
route: string;
|
|
136
|
+
minimum_coverage: number | string;
|
|
137
|
+
}>;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { defineExpressionRule as a, FieldExtractionRule as i, BackendSource as n, BackendProperty as r, UserConfig as t };
|
|
142
|
+
//# sourceMappingURL=UserConfig-BlRknCRh.d.mts.map
|