@cmflow/atlas 3.4.0-beta.27 → 3.4.0-beta.29

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 CHANGED
@@ -242,7 +242,7 @@ For example, configure the endpoint used by the source:
242
242
  export default defineConfig({
243
243
  envs: {
244
244
  XM_API_URL: "https://xm.internal/openapi.json"
245
- },
245
+ }
246
246
  // …other Atlas options
247
247
  });
248
248
  ```
@@ -362,10 +362,10 @@ The inference pass only reads analysis files referenced by each route graph. Acc
362
362
  Push route artifacts to Directus with an explicit write flag:
363
363
 
364
364
  ```bash
365
- atlas --analysis-dir /path/to/api push .tmp/datasource-catalogue --write
365
+ atlas --analysis-dir /path/to/api push .tmp/datasource-catalogue --update
366
366
  ```
367
367
 
368
- Without `--write`, the command performs a dry run. Use `clean-orphans` to inspect Directus links that no longer reference an API or backend property.
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.
369
369
 
370
370
  ## Command reference
371
371
 
@@ -5402,7 +5402,12 @@ async function readCatalogueFromDirectory(inputDir) {
5402
5402
  const files = await globby("**/*.@(yaml|yml)", {
5403
5403
  cwd: inputDir,
5404
5404
  absolute: true,
5405
- ignore: ["**/*.graph.yaml", "**/*.graph.yml"]
5405
+ ignore: [
5406
+ "backends/**/*.yaml",
5407
+ "backends/**/*.yml",
5408
+ "**/*.graph.yaml",
5409
+ "**/*.graph.yml"
5410
+ ]
5406
5411
  });
5407
5412
  if (!files.length) throw new Error(`No route YAML documents found in ${inputDir}`);
5408
5413
  return {
@@ -5519,10 +5524,11 @@ function createPushStepClassifier() {
5519
5524
  };
5520
5525
  };
5521
5526
  }
5522
- var push_default = (program) => void program.command("push").argument("[catalogue-directory-or-route]", "Directory or route such as \"GET /v1/offers\"").option("--route <route>", "Push one route only, for example \"POST /v0/accommodations_arrangement/check\"").option("--write", "Persist changes to Directus", false).description("Push generated per-route YAML documents to Directus").action(async (catalogueDirectoryOrRoute, options) => {
5527
+ var push_default = (program) => void program.command("push").argument("[catalogue-directory-or-route]", "Directory or route such as \"GET /v1/offers\"").option("--route <route>", "Push one route only, for example \"POST /v0/accommodations_arrangement/check\"").option("--update", "Persist changes to Directus", false).description("Push generated per-route YAML documents to Directus").action(async (catalogueDirectoryOrRoute, options) => {
5523
5528
  intro("Datasource catalogue push");
5524
5529
  const { cwd } = getUserConfig();
5525
5530
  const progress = taskProgressService.createStepProgress(createPushStepClassifier());
5531
+ const update = options.update;
5526
5532
  try {
5527
5533
  const positionalRouteSelector = catalogueDirectoryOrRoute && isRouteSelector(catalogueDirectoryOrRoute) ? parseRouteSelector(catalogueDirectoryOrRoute) : void 0;
5528
5534
  if (options.route && positionalRouteSelector) throw new Error("Specify the route either as the positional argument or with --route, not both");
@@ -5532,9 +5538,9 @@ var push_default = (program) => void program.command("push").argument("[catalogu
5532
5538
  cwd,
5533
5539
  catalogueDirectory,
5534
5540
  routeSelector,
5535
- write: options.write
5541
+ write: update
5536
5542
  }));
5537
- progress.finish(options.write ? "Directus synchronization completed" : "Directus dry-run completed");
5543
+ progress.finish(update ? "Directus synchronization completed" : "Directus dry-run completed");
5538
5544
  note([
5539
5545
  `Input directory: ${pushResult.inputPath}`,
5540
5546
  `Route documents: ${pushResult.files.length}`,
@@ -5583,10 +5589,10 @@ var cleanOrphans_default = (program) => void program.command("clean-orphans").op
5583
5589
  //#endregion
5584
5590
  //#region src/commands/backendSources.ts
5585
5591
  async function listBackendSourceMetadata(sources, backend, refresh = false) {
5586
- const resolvableSources = sources.filter((source) => Boolean(source.resolve));
5592
+ const resolvableSources = sources.filter((source) => Boolean(source.resolve) && (!refresh || Boolean(source.cache)));
5587
5593
  const selectedSources = backend ? resolvableSources.filter((source) => source.name === backend) : resolvableSources;
5588
- if (backend && !selectedSources.length) throw new Error(`Unknown backend source with a resolver: ${backend}`);
5589
- if (!backend && !selectedSources.length) throw new Error("No backend source with a resolver is configured");
5594
+ if (backend && !selectedSources.length) throw new Error(`Unknown backend source with a resolver${refresh ? " and cache" : ""}: ${backend}`);
5595
+ if (!backend && !selectedSources.length) throw new Error(`No backend source with a resolver${refresh ? " and cache" : ""} is configured`);
5590
5596
  const previousRefresh = process.env.ATLAS_BACKEND_SOURCE_REFRESH;
5591
5597
  if (refresh) process.env.ATLAS_BACKEND_SOURCE_REFRESH = "true";
5592
5598
  let propertiesByBackend;
@@ -5607,13 +5613,13 @@ var backendSources_default = (program) => void program.command("backend-sources"
5607
5613
  intro("Atlas backend source metadata");
5608
5614
  try {
5609
5615
  if (options.backend && options.all) throw new Error("Specify either --backend or --all, not both");
5610
- const sources = getUserConfig().analysis.backends.filter((source) => Boolean(source.resolve));
5616
+ const sources = getUserConfig().analysis.backends.filter((source) => Boolean(source.resolve) && (!options.refresh || Boolean(source.cache)));
5611
5617
  const selectedBackend = options.all ? void 0 : options.backend || await select({
5612
5618
  message: "Which backend source do you want to execute?",
5613
5619
  options: sources.map((source) => ({
5614
5620
  value: source.name,
5615
5621
  label: source.name,
5616
- hint: "resolver configured"
5622
+ hint: options.refresh ? "resolver and cache configured" : "resolver configured"
5617
5623
  }))
5618
5624
  });
5619
5625
  if (isCancel(selectedBackend)) {