@antelopejs/dms-automation 0.10.0 → 0.11.1

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 (51) hide show
  1. package/README.md +11 -11
  2. package/dist/data/procedures-table.d.ts +1 -1
  3. package/dist/data/runs-table.d.ts +14 -1
  4. package/dist/data/runs-table.js +18 -8
  5. package/dist/data/runs-table.js.map +1 -1
  6. package/dist/db/models/automation_template.model.d.ts +3 -3
  7. package/dist/db/models/procedure.model.d.ts +4 -5
  8. package/dist/db/models/procedure.model.js +2 -15
  9. package/dist/db/models/procedure.model.js.map +1 -1
  10. package/dist/db/models/procedure_run.model.d.ts +3 -3
  11. package/dist/db/models/type_switch.model.d.ts +3 -3
  12. package/dist/routes/procedures.d.ts +4 -3
  13. package/dist/routes/procedures.js +13 -6
  14. package/dist/routes/procedures.js.map +1 -1
  15. package/dist/routes/requests.d.ts +2 -2
  16. package/dist/routes/requests.js +2 -2
  17. package/dist/routes/requests.js.map +1 -1
  18. package/dist/routes/stats.d.ts +2 -2
  19. package/dist/routes/stats.js +9 -12
  20. package/dist/routes/stats.js.map +1 -1
  21. package/dist/routes/templates.d.ts +3 -2
  22. package/dist/routes/templates.js +2 -2
  23. package/dist/routes/templates.js.map +1 -1
  24. package/dist/runtime/builtins/data/json.js +1 -1
  25. package/dist/runtime/builtins/data/json.js.map +1 -1
  26. package/dist/runtime/builtins/data/string.js +12 -11
  27. package/dist/runtime/builtins/data/string.js.map +1 -1
  28. package/dist/types/dataValue.d.ts +1 -0
  29. package/dist/types/dataValue.js +5 -0
  30. package/dist/types/dataValue.js.map +1 -1
  31. package/frontend-vue/app/build/components/editor/EditorBanners.vue +11 -11
  32. package/frontend-vue/app/build/components/editor/EditorForkModal.vue +1 -1
  33. package/frontend-vue/app/build/components/editor/EditorSaveTemplateModal.vue +2 -2
  34. package/frontend-vue/app/components/AttentionList.vue +2 -2
  35. package/frontend-vue/app/components/Editor/BottomDock.vue +1 -1
  36. package/frontend-vue/app/components/Editor/JsonField.vue +1 -1
  37. package/frontend-vue/app/components/Editor/NewProcedureDialog.vue +1 -1
  38. package/frontend-vue/app/components/Editor/NodeInspector.vue +3 -3
  39. package/frontend-vue/app/components/Editor/RunNowDialog.vue +3 -3
  40. package/frontend-vue/app/components/LibraryCatalog.vue +11 -11
  41. package/frontend-vue/app/components/LibraryTemplates.vue +9 -9
  42. package/frontend-vue/app/components/Run/RunPayload.vue +1 -1
  43. package/frontend-vue/app/components/Run/RunWaterfall.vue +1 -1
  44. package/frontend-vue/app/components/RunPeek.vue +2 -2
  45. package/frontend-vue/app/components/RunTrace.vue +12 -12
  46. package/frontend-vue/build/backend-boundary.ts +7 -2
  47. package/frontend-vue/eslint-rules/index.mjs +97 -0
  48. package/frontend-vue/eslint.config.mjs +4 -1
  49. package/frontend-vue/package.json +4 -4
  50. package/frontend-vue/pnpm-lock.yaml +633 -224
  51. package/package.json +15 -15
@@ -368,7 +368,7 @@ function openRun(id: string) {
368
368
  <p v-if="builderHint" class="basis-full text-xs text-muted">{{ builderHint }}</p>
369
369
  </DmsAutomationRunFailure>
370
370
 
371
- <DmsBanner
371
+ <DmsNoticeBanner
372
372
  v-if="run.graphOutdated"
373
373
  size="sm"
374
374
  tone="warning"
@@ -376,7 +376,7 @@ function openRun(id: string) {
376
376
  :title="outdatedTitle"
377
377
  :description="$t('dms_automation.trace.graphNotKeptHint', { current: run.procedure?.version })"
378
378
  />
379
- <DmsBanner
379
+ <DmsNoticeBanner
380
380
  v-else-if="olderVersion"
381
381
  size="sm"
382
382
  tone="info"
@@ -384,7 +384,7 @@ function openRun(id: string) {
384
384
  :title="$t('dms_automation.trace.olderVersion', { version: run.procedureVersion })"
385
385
  :description="$t('dms_automation.trace.olderVersionHint', { current: run.procedure?.version })"
386
386
  />
387
- <DmsBanner
387
+ <DmsNoticeBanner
388
388
  v-if="run.rerunOf"
389
389
  size="sm"
390
390
  tone="info"
@@ -396,12 +396,12 @@ function openRun(id: string) {
396
396
  {{ $t('dms_automation.trace.openOriginal') }}
397
397
  </UButton>
398
398
  </template>
399
- </DmsBanner>
399
+ </DmsNoticeBanner>
400
400
 
401
401
  <DmsStatGroup :items="stats" layout="joined" :columns="4" />
402
402
 
403
403
  <div class="grid items-start gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]">
404
- <DmsCard :padded="false">
404
+ <DmsCardPanel :padded="false">
405
405
  <div class="flex flex-wrap items-center justify-between gap-2 border-b border-default px-3 pt-2">
406
406
  <UTabs v-model="tab" :items="tabs" variant="link" :content="false" size="sm" />
407
407
  <USwitch
@@ -424,12 +424,12 @@ function openRun(id: string) {
424
424
  <DmsAutomationRunPayload :raw="run.triggerPayload" :kept="run.payloadKept" />
425
425
  </div>
426
426
  <DmsAutomationRunLogList v-else :api-url="apiUrl" :run-id="run._id" :log="run.logs" :names="names" />
427
- </DmsCard>
427
+ </DmsCardPanel>
428
428
 
429
429
  <div class="flex flex-col gap-4">
430
- <DmsCard>
430
+ <DmsCardPanel>
431
431
  <template #header>
432
- <DmsEyebrow as="h2" tone="muted" truncate :label="$t('dms_automation.trace.pathTaken')" />
432
+ <DmsEyebrowLabel as="h2" tone="muted" truncate :label="$t('dms_automation.trace.pathTaken')" />
433
433
  </template>
434
434
  <template v-if="opensInBuilder(run) && !run.graphOutdated" #actions>
435
435
  <UButton size="xs" variant="ghost" color="neutral" trailing-icon="i-ph-arrow-up-right" @click="debugInBuilder()">
@@ -437,13 +437,13 @@ function openRun(id: string) {
437
437
  </UButton>
438
438
  </template>
439
439
  <DmsAutomationRunPathTaken :run="run" :builder-url="builderUrl" />
440
- </DmsCard>
441
- <DmsCard>
440
+ </DmsCardPanel>
441
+ <DmsCardPanel>
442
442
  <template #header>
443
- <DmsEyebrow as="h2" tone="muted" truncate :label="$t('dms_automation.trace.compared')" />
443
+ <DmsEyebrowLabel as="h2" tone="muted" truncate :label="$t('dms_automation.trace.compared')" />
444
444
  </template>
445
445
  <DmsAutomationRunCompare :run="run" :trace-url="traceUrl" />
446
- </DmsCard>
446
+ </DmsCardPanel>
447
447
  </div>
448
448
  </div>
449
449
  </template>
@@ -74,6 +74,11 @@ function backendSourceFile(id: string): string | undefined {
74
74
  : undefined;
75
75
  }
76
76
 
77
+ /** `path` with `/` separators, the form Vite gives an importer, so a boundary error names both paths alike on every OS. */
78
+ function forwardSlashes(path: string): string {
79
+ return path.split(sep).join("/");
80
+ }
81
+
77
82
  /**
78
83
  * Fails the build and the dev server when a module of the frontend resolves to
79
84
  * a file under the `src` of the backend package: the browser reaches the
@@ -113,9 +118,9 @@ function boundaryCheck(): VitePlugin {
113
118
  const from =
114
119
  importer === undefined
115
120
  ? "an entry point"
116
- : importer.replace(QUERY_OR_HASH, "");
121
+ : forwardSlashes(importer.replace(QUERY_OR_HASH, ""));
117
122
  return this.error(
118
- `Backend boundary: ${from} imports ${file}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
123
+ `Backend boundary: ${from} imports ${forwardSlashes(file)}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
119
124
  );
120
125
  },
121
126
  };
@@ -1,4 +1,100 @@
1
+ import { readdirSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { basename, dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import dmsFrontendGlobals from "@antelopejs/dms-frontend/eslint-globals";
6
+
1
7
  const BLANK = /^\s*$/;
8
+ const DMS_TAG = /^(?:Dms[A-Z]|dms-[a-z])/;
9
+ const COMPONENT_DIR = /(?:^|\/)(?:build\/)?components\//;
10
+ const DMS_ALIASES = ["ActivityFeedBlock", "SectionBlock", "FieldRowBlock"];
11
+
12
+ /** `notice-banner` or `NoticeBanner.vue` as the name Vue resolves: `NoticeBanner`. */
13
+ function pascalCase(name) {
14
+ return name
15
+ .replace(/\.vue$/, "")
16
+ .split(/[./_-]+/)
17
+ .filter(Boolean)
18
+ .map((part) => `${part[0].toUpperCase()}${part.slice(1)}`)
19
+ .join("");
20
+ }
21
+
22
+ /** The names of the `.vue` files under `root` whose path `keep` accepts. */
23
+ function componentFiles(root, keep = () => true) {
24
+ return readdirSync(root, { recursive: true })
25
+ .map((path) => String(path).replaceAll("\\", "/"))
26
+ .filter((path) => path.endsWith(".vue") && keep(path))
27
+ .map((path) => basename(path));
28
+ }
29
+
30
+ /**
31
+ * Every `Dms*` name a template can resolve: the components the installed
32
+ * `@antelopejs/dms` registers under its `Dms` prefix (named as its
33
+ * `dms.frontend.ts` names them), the ones the `@antelopejs/dms-frontend`
34
+ * renderer registers itself, and this module's own, registered under
35
+ * `DmsAutomation`.
36
+ */
37
+ function registeredDmsComponents() {
38
+ const here = dirname(fileURLToPath(import.meta.url));
39
+ const dmsRoot = dirname(
40
+ createRequire(import.meta.url).resolve("@antelopejs/dms/package.json"),
41
+ );
42
+ return new Set([
43
+ ...componentFiles(join(dmsRoot, "frontend-vue", "layers"), (path) =>
44
+ COMPONENT_DIR.test(path),
45
+ ).map((file) => `Dms${pascalCase(file)}`),
46
+ ...DMS_ALIASES.map((alias) => `Dms${alias}`),
47
+ ...Object.keys(dmsFrontendGlobals).filter((name) => DMS_TAG.test(name)),
48
+ ...componentFiles(join(here, "..", "app", "components")).map(
49
+ (file) => `DmsAutomation${pascalCase(file)}`,
50
+ ),
51
+ ]);
52
+ }
53
+
54
+ let registered;
55
+
56
+ /** The names a file imports, which its template may use as tags. */
57
+ function importedNames(program) {
58
+ return new Set(
59
+ program.body
60
+ .filter((node) => node.type === "ImportDeclaration")
61
+ .flatMap((node) => node.specifiers.map((spec) => spec.local.name)),
62
+ );
63
+ }
64
+
65
+ /**
66
+ * Vue renders a tag it cannot resolve as an unknown element, with no error:
67
+ * a component the DMS renamed or removed leaves its place empty on screen.
68
+ */
69
+ const knownDmsComponents = {
70
+ meta: {
71
+ type: "problem",
72
+ schema: [],
73
+ messages: {
74
+ unknown:
75
+ "`{{name}}` is no component the installed @antelopejs/dms, @antelopejs/dms-frontend or this module registers, and this file does not import it.",
76
+ },
77
+ },
78
+ create(context) {
79
+ const { defineTemplateBodyVisitor } = context.sourceCode.parserServices;
80
+ if (!defineTemplateBodyVisitor) return {};
81
+ registered ??= registeredDmsComponents();
82
+ const imported = importedNames(context.sourceCode.ast);
83
+ return defineTemplateBodyVisitor({
84
+ VElement(element) {
85
+ const name = element.rawName;
86
+ if (!DMS_TAG.test(name)) return;
87
+ const pascal = pascalCase(name);
88
+ if (registered.has(pascal) || imported.has(name)) return;
89
+ context.report({
90
+ loc: element.startTag.loc,
91
+ messageId: "unknown",
92
+ data: { name },
93
+ });
94
+ },
95
+ });
96
+ },
97
+ };
2
98
  const ROW_TOKEN = /\{\{[^}]*\}\}/g;
3
99
  const BARE_BRACES = /\{[^}]*\}/;
4
100
 
@@ -99,5 +195,6 @@ export default {
99
195
  rules: {
100
196
  "no-comment-before-else": noCommentBeforeElse,
101
197
  "confirm-from-row-tokens": confirmFromRowTokens,
198
+ "known-dms-components": knownDmsComponents,
102
199
  },
103
200
  };
@@ -38,6 +38,9 @@ export default ts.config(
38
38
  {
39
39
  files: ["app/**/*.vue"],
40
40
  plugins: { automation },
41
- rules: { "automation/no-comment-before-else": "error" },
41
+ rules: {
42
+ "automation/no-comment-before-else": "error",
43
+ "automation/known-dms-components": "error",
44
+ },
42
45
  },
43
46
  );
@@ -17,9 +17,9 @@
17
17
  "vue": "^3.5.18"
18
18
  },
19
19
  "devDependencies": {
20
- "@antelopejs/dms": ">=0.19.5 <1.0.0",
21
- "@antelopejs/dms-frontend": ">=0.10.4 <0.11.0",
22
- "@antelopejs/tooling-configs": ">=0.3.3 <1.0.0",
20
+ "@antelopejs/dms": ">=0.20.0 <0.21.0",
21
+ "@antelopejs/dms-frontend": ">=0.11.0 <0.12.0",
22
+ "@antelopejs/tooling-configs": ">=0.7.0 <0.8.0",
23
23
  "@eslint/js": "^9.0.0",
24
24
  "@nuxt/ui": "4.10.0",
25
25
  "eslint": "^9.0.0",
@@ -34,7 +34,7 @@
34
34
  "vue-tsc": "^3.1.1"
35
35
  },
36
36
  "engines": {
37
- "@antelopejs/dms-frontend": ">=0.10.0 <0.11.0"
37
+ "@antelopejs/dms-frontend": ">=0.11.0 <0.12.0"
38
38
  },
39
39
  "packageManager": "pnpm@10.33.0"
40
40
  }