@antelopejs/dms-automation 0.11.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.
@@ -36,7 +36,7 @@ const emit = defineEmits<{
36
36
 
37
37
  <template>
38
38
  <div class="flex flex-col gap-2 empty:hidden" :class="loadError || saveBlocked || pausedBanner || overlayRun || testing || isCurrentGraphReadOnly ? 'border-b border-default p-2' : ''">
39
- <DmsBanner
39
+ <DmsNoticeBanner
40
40
  v-if="loadError"
41
41
  size="sm"
42
42
  tone="error"
@@ -47,8 +47,8 @@ const emit = defineEmits<{
47
47
  <template v-if="templateNotFound" #actions>
48
48
  <UButton size="xs" color="error" variant="soft" icon="i-ph-arrow-left" :to="libraryBackUrl">{{ $t('dms_automation.editor.backToTemplates') }}</UButton>
49
49
  </template>
50
- </DmsBanner>
51
- <DmsBanner
50
+ </DmsNoticeBanner>
51
+ <DmsNoticeBanner
52
52
  v-if="saveBlocked && blockingIssues.length"
53
53
  size="sm"
54
54
  tone="error"
@@ -60,15 +60,15 @@ const emit = defineEmits<{
60
60
  <UButton size="xs" color="error" variant="soft" @click="emit('go-to-first-problem')">{{ $t('dms_automation.editor.problems.first') }}</UButton>
61
61
  <UButton size="xs" color="neutral" variant="outline" :loading="saving" @click="emit('save-as-draft')">{{ $t('dms_automation.editor.problems.saveDraft') }}</UButton>
62
62
  </template>
63
- </DmsBanner>
64
- <DmsBanner v-if="pausedBanner && !saveBlocked" size="sm" tone="warning" icon="i-ph-pause-circle" :title="pausedBanner.title" :description="pausedBanner.description">
63
+ </DmsNoticeBanner>
64
+ <DmsNoticeBanner v-if="pausedBanner && !saveBlocked" size="sm" tone="warning" icon="i-ph-pause-circle" :title="pausedBanner.title" :description="pausedBanner.description">
65
65
  <template #actions>
66
66
  <UButton size="xs" color="warning" variant="soft" :loading="saving" :disabled="blockingIssues.length > 0" @click="emit('enable-now')">
67
67
  {{ $t('dms_automation.editor.paused.enable') }}
68
68
  </UButton>
69
69
  </template>
70
- </DmsBanner>
71
- <DmsBanner
70
+ </DmsNoticeBanner>
71
+ <DmsNoticeBanner
72
72
  v-if="testing"
73
73
  size="sm"
74
74
  tone="info"
@@ -76,7 +76,7 @@ const emit = defineEmits<{
76
76
  :title="$t('dms_automation.editor.debug.testing')"
77
77
  :description="$t('dms_automation.editor.debug.testingHint')"
78
78
  />
79
- <DmsBanner
79
+ <DmsNoticeBanner
80
80
  v-if="overlayRun && !testing"
81
81
  size="sm"
82
82
  :tone="overlayLook.tone"
@@ -101,8 +101,8 @@ const emit = defineEmits<{
101
101
  <UKbd value="Esc" size="sm" class="ml-1" />
102
102
  </UButton>
103
103
  </template>
104
- </DmsBanner>
105
- <DmsBanner
104
+ </DmsNoticeBanner>
105
+ <DmsNoticeBanner
106
106
  v-if="isCurrentGraphReadOnly"
107
107
  size="sm"
108
108
  tone="info"
@@ -115,6 +115,6 @@ const emit = defineEmits<{
115
115
  {{ $t('dms_automation.editor.forkToEdit') }}
116
116
  </UButton>
117
117
  </template>
118
- </DmsBanner>
118
+ </DmsNoticeBanner>
119
119
  </div>
120
120
  </template>
@@ -21,7 +21,7 @@ const open = defineModel<boolean>('open', { required: true })
21
21
  <p class="text-sm text-toned">
22
22
  {{ $t('dms_automation.editor.forkModal.body') }}
23
23
  </p>
24
- <DmsBanner
24
+ <DmsNoticeBanner
25
25
  v-if="error"
26
26
  size="sm"
27
27
  :tone="error.severity"
@@ -47,7 +47,7 @@ const icon = defineModel<string>('icon', { required: true })
47
47
  :label="$t('dms_automation.editor.saveTemplateModal.description')"
48
48
  label-for="save-template-description"
49
49
  >
50
- <DmsTextarea
50
+ <DmsInputTextarea
51
51
  id="save-template-description"
52
52
  v-model="description"
53
53
  :placeholder="$t('dms_automation.editor.saveTemplateModal.descriptionPlaceholder')"
@@ -74,7 +74,7 @@ const icon = defineModel<string>('icon', { required: true })
74
74
  </div>
75
75
  </div>
76
76
  </div>
77
- <DmsBanner
77
+ <DmsNoticeBanner
78
78
  v-if="error"
79
79
  size="sm"
80
80
  tone="error"
@@ -163,7 +163,7 @@ function dismiss(row: AttentionRow) {
163
163
  </script>
164
164
 
165
165
  <template>
166
- <DmsCard :title="$t('dms_automation.attention.title')" :count="total || undefined" :padded="false" class="h-full">
166
+ <DmsCardPanel :title="$t('dms_automation.attention.title')" :count="total || undefined" :padded="false" class="h-full">
167
167
  <template #actions>
168
168
  <UButton size="xs" variant="ghost" color="neutral" trailing-icon="i-ph-arrow-right" :to="proceduresUrl">
169
169
  {{ $t('dms_automation.attention.allProcedures') }}
@@ -281,5 +281,5 @@ function dismiss(row: AttentionRow) {
281
281
  </UButton>
282
282
  </div>
283
283
  </template>
284
- </DmsCard>
284
+ </DmsCardPanel>
285
285
  </template>
@@ -145,7 +145,7 @@ function runLine(run: DockRun): string {
145
145
  <div v-else-if="tab === 'payload'" class="flex h-full flex-col gap-2 p-3">
146
146
  <div v-if="(triggers?.length ?? 0) > 1" class="flex items-center gap-2 text-xs">
147
147
  <label for="dock-test-trigger" class="shrink-0 text-muted">{{ $t('dms_automation.editor.dock.fromTrigger') }}</label>
148
- <DmsSelect id="dock-test-trigger" v-model="trigger" :items="triggers" size="xs" class="min-w-48" />
148
+ <DmsInputSelect id="dock-test-trigger" v-model="trigger" :items="triggers" size="xs" class="min-w-48" />
149
149
  </div>
150
150
  <div class="flex items-center justify-between gap-2 text-xs">
151
151
  <span class="text-muted">
@@ -53,7 +53,7 @@ function onBlur() {
53
53
  </script>
54
54
 
55
55
  <template>
56
- <DmsTextarea
56
+ <DmsInputTextarea
57
57
  v-model="text"
58
58
  :rows="4"
59
59
  :placeholder="$t('dms_automation.editor.inspector.jsonPlaceholder')"
@@ -93,7 +93,7 @@ async function submit() {
93
93
  <DmsChoiceCards v-model="trigger" :items="starterItems" />
94
94
  </DmsFieldRow>
95
95
  <DmsFieldRow v-bind="ROW" :label="$t('dms_automation.newProcedure.description')" label-for="new-procedure-description">
96
- <DmsTextarea id="new-procedure-description" v-model="description" :rows="2" class="w-full" />
96
+ <DmsInputTextarea id="new-procedure-description" v-model="description" :rows="2" class="w-full" />
97
97
  </DmsFieldRow>
98
98
  <DmsFormRequiredLegend />
99
99
  </form>
@@ -472,7 +472,7 @@ function onUnwire(field: string) {
472
472
  :source-label="nodeName ? nodeName(findIncoming(f.name)!.from.node) : findIncoming(f.name)!.from.node"
473
473
  @unwire="onUnwire(f.name)"
474
474
  />
475
- <DmsSelect
475
+ <DmsInputSelect
476
476
  v-else-if="Array.isArray(f.prop.enum) && f.prop.enum.length > 0"
477
477
  :id="`inspector-${f.name}`"
478
478
  :items="(f.prop.enum as unknown[]).map((v) => String(v))"
@@ -494,12 +494,12 @@ function onUnwire(field: string) {
494
494
  class="w-full"
495
495
  @update:model-value="(v: number | null | undefined) => emitUpdated(f.name, asNumber(v))"
496
496
  />
497
- <DmsSwitch
497
+ <DmsInputSwitch
498
498
  v-else-if="isBoolish(f.prop)"
499
499
  :model-value="asBool(getValue(f.name) ?? f.prop.default)"
500
500
  @update:model-value="(v: boolean) => emitUpdated(f.name, v)"
501
501
  />
502
- <DmsTextarea
502
+ <DmsInputTextarea
503
503
  v-else-if="f.prop.type === 'array'"
504
504
  :id="`inspector-${f.name}`"
505
505
  :rows="3"
@@ -113,7 +113,7 @@ async function submit() {
113
113
  :label="$t('dms_automation.editor.runNow.trigger')"
114
114
  label-for="run-now-trigger"
115
115
  >
116
- <DmsSelect id="run-now-trigger" v-model="triggerNodeId" :items="triggerItems" class="w-full" />
116
+ <DmsInputSelect id="run-now-trigger" v-model="triggerNodeId" :items="triggerItems" class="w-full" />
117
117
  </DmsFieldRow>
118
118
  <DmsFieldRow
119
119
  v-bind="ROW"
@@ -134,14 +134,14 @@ async function submit() {
134
134
  <DmsFieldError :id="fieldErrors.errorId('payload')" :message="fieldErrors.errors.payload" />
135
135
  </div>
136
136
  </DmsFieldRow>
137
- <DmsBanner
137
+ <DmsNoticeBanner
138
138
  v-if="redactedHeaders.length"
139
139
  size="sm"
140
140
  tone="warning"
141
141
  icon="i-ph-key"
142
142
  :title="$t('dms_automation.editor.runNow.redactedHeaders', { headers: redactedHeaders.join(', ') })"
143
143
  />
144
- <DmsBanner size="sm" tone="warning" icon="i-ph-warning" :title="$t('dms_automation.editor.runNow.sideEffects')" />
144
+ <DmsNoticeBanner size="sm" tone="warning" icon="i-ph-warning" :title="$t('dms_automation.editor.runNow.sideEffects')" />
145
145
  </div>
146
146
  </template>
147
147
  <template #footer>
@@ -359,7 +359,7 @@ function open(use: TypeUsage) {
359
359
  >
360
360
  {{ $t('dms_automation.library.backToList') }}
361
361
  </UButton>
362
- <DmsCard>
362
+ <DmsCardPanel>
363
363
  <div class="flex flex-wrap items-start gap-4">
364
364
  <DmsIconWell :icon="selected.icon || 'i-ph-cube'" tone="primary" size="xl" />
365
365
  <div class="flex min-w-0 flex-1 flex-col gap-1">
@@ -386,9 +386,9 @@ function open(use: TypeUsage) {
386
386
  </div>
387
387
  </div>
388
388
  <p v-if="kind === 'flow'" class="mt-3 text-xs text-muted">{{ $t('dms_automation.library.flowAlwaysOn') }}</p>
389
- </DmsCard>
389
+ </DmsCardPanel>
390
390
 
391
- <DmsCard :title="$t('dms_automation.library.usedBy')" :count="procedureUses.length">
391
+ <DmsCardPanel :title="$t('dms_automation.library.usedBy')" :count="procedureUses.length">
392
392
  <p v-if="configurable && enabledUses > 0" class="mb-3 text-xs text-muted">
393
393
  {{ $t('dms_automation.library.disableImpact', { count: enabledUses }) }}
394
394
  </p>
@@ -431,22 +431,22 @@ function open(use: TypeUsage) {
431
431
  >
432
432
  {{ showAllUses ? $t('dms_automation.library.showLess') : $t('dms_automation.library.showAll', { count: procedureUses.length }) }}
433
433
  </UButton>
434
- </DmsCard>
434
+ </DmsCardPanel>
435
435
 
436
- <DmsCard v-if="settingsSchema" :title="kind === 'actions' ? $t('dms_automation.library.inputs') : $t('dms_automation.library.settings')">
436
+ <DmsCardPanel v-if="settingsSchema" :title="kind === 'actions' ? $t('dms_automation.library.inputs') : $t('dms_automation.library.settings')">
437
437
  <p class="mb-3 text-xs text-muted">{{ $t('dms_automation.library.settingsHint') }}</p>
438
438
  <DmsAutomationSchemaTable :schema="settingsSchema" />
439
- </DmsCard>
439
+ </DmsCardPanel>
440
440
 
441
- <DmsCard v-if="inputSchema" :title="$t('dms_automation.library.inputs')">
441
+ <DmsCardPanel v-if="inputSchema" :title="$t('dms_automation.library.inputs')">
442
442
  <DmsAutomationSchemaTable :schema="inputSchema" />
443
- </DmsCard>
443
+ </DmsCardPanel>
444
444
 
445
- <DmsCard :title="$t('dms_automation.library.outputs')">
445
+ <DmsCardPanel :title="$t('dms_automation.library.outputs')">
446
446
  <DmsAutomationSchemaTable :schema="selected.outputSchema" />
447
- </DmsCard>
447
+ </DmsCardPanel>
448
448
 
449
- <DmsBanner
449
+ <DmsNoticeBanner
450
450
  v-if="selected.cluster"
451
451
  size="sm"
452
452
  tone="info"
@@ -302,7 +302,7 @@ function ownersOf(found: TemplateUsages): string {
302
302
  <UButton class="self-start @5xl:hidden" size="sm" variant="ghost" color="neutral" icon="i-ph-arrow-up" @click="backToList">
303
303
  {{ $t('dms_automation.library.backToList') }}
304
304
  </UButton>
305
- <DmsCard>
305
+ <DmsCardPanel>
306
306
  <div class="flex flex-wrap items-start gap-4">
307
307
  <DmsIconWell :icon="formIcon || DEFAULT_ICON" tone="primary" size="xl" />
308
308
  <div class="flex min-w-0 flex-1 flex-col gap-1">
@@ -313,10 +313,10 @@ function ownersOf(found: TemplateUsages): string {
313
313
  {{ $t('dms_automation.templates.editGraph') }}
314
314
  </UButton>
315
315
  </div>
316
- </DmsCard>
316
+ </DmsCardPanel>
317
317
 
318
318
  <div ref="form">
319
- <DmsCard :title="$t('dms_automation.templates.details')">
319
+ <DmsCardPanel :title="$t('dms_automation.templates.details')">
320
320
  <div>
321
321
  <DmsFieldRow layout="form" :label="$t('dms_automation.templates.form.name')" :label-for="NAME_ID" required>
322
322
  <div class="grid gap-1.5">
@@ -325,7 +325,7 @@ function ownersOf(found: TemplateUsages): string {
325
325
  </div>
326
326
  </DmsFieldRow>
327
327
  <DmsFieldRow layout="form" :label="$t('dms_automation.templates.form.description')" label-for="template-description">
328
- <DmsTextarea id="template-description" v-model="formDescription" class="w-full" :rows="2" :maxlength="DESCRIPTION_MAX" />
328
+ <DmsInputTextarea id="template-description" v-model="formDescription" class="w-full" :rows="2" :maxlength="DESCRIPTION_MAX" />
329
329
  </DmsFieldRow>
330
330
  <DmsFieldRow layout="form" :label="$t('dms_automation.templates.form.icon')">
331
331
  <DmsAutomationIconPicker v-model="formIcon" />
@@ -339,10 +339,10 @@ function ownersOf(found: TemplateUsages): string {
339
339
  </UButton>
340
340
  </div>
341
341
  </template>
342
- </DmsCard>
342
+ </DmsCardPanel>
343
343
  </div>
344
344
 
345
- <DmsCard :title="$t('dms_automation.templates.ports.title')" :count="selected.ports?.length ?? 0">
345
+ <DmsCardPanel :title="$t('dms_automation.templates.ports.title')" :count="selected.ports?.length ?? 0">
346
346
  <p class="mb-3 text-xs text-muted">{{ $t('dms_automation.templates.ports.editHint') }}</p>
347
347
  <p v-if="(selected.ports ?? []).length === 0" class="text-xs text-dimmed">{{ $t('dms_automation.templates.ports.empty') }}</p>
348
348
  <div v-else class="overflow-hidden rounded-md border border-default">
@@ -369,9 +369,9 @@ function ownersOf(found: TemplateUsages): string {
369
369
  </tbody>
370
370
  </table>
371
371
  </div>
372
- </DmsCard>
372
+ </DmsCardPanel>
373
373
 
374
- <DmsCard :title="$t('dms_automation.templates.usedIn')" :count="usageRows.length">
374
+ <DmsCardPanel :title="$t('dms_automation.templates.usedIn')" :count="usageRows.length">
375
375
  <p v-if="usageRows.length" class="mb-3 text-xs text-muted">{{ $t('dms_automation.templates.usedInHint') }}</p>
376
376
  <div v-if="usagesLoading" class="flex flex-col gap-2">
377
377
  <USkeleton v-for="i in 2" :key="i" class="h-8 w-full" />
@@ -412,7 +412,7 @@ function ownersOf(found: TemplateUsages): string {
412
412
  </UButton>
413
413
  </li>
414
414
  </ul>
415
- </DmsCard>
415
+ </DmsCardPanel>
416
416
 
417
417
  <div class="flex flex-wrap items-center justify-between gap-3">
418
418
  <p class="text-xs text-muted">{{ $t('dms_automation.templates.deleteHint') }}</p>
@@ -52,7 +52,7 @@ function describeBytes(value: number): string {
52
52
  <template>
53
53
  <div class="flex flex-col gap-2">
54
54
  <template v-if="preview">
55
- <DmsBanner
55
+ <DmsNoticeBanner
56
56
  size="sm"
57
57
  tone="warning"
58
58
  icon="i-ph-warning"
@@ -255,7 +255,7 @@ const NAME_CLASS = 'break-words @xl:truncate'
255
255
 
256
256
  <template>
257
257
  <div class="@container flex flex-col">
258
- <DmsBanner
258
+ <DmsNoticeBanner
259
259
  v-if="truncated"
260
260
  size="sm"
261
261
  tone="warning"
@@ -83,11 +83,11 @@ function go(url: string) {
83
83
  <template v-if="section === 'summary'">
84
84
  <DmsAutomationRunFailure v-if="failed" :run="run" :trace-url="traceUrl" />
85
85
  <div class="flex flex-col gap-2">
86
- <DmsEyebrow as="h4" :label="$t('dms_automation.trace.pathTaken')" />
86
+ <DmsEyebrowLabel as="h4" :label="$t('dms_automation.trace.pathTaken')" />
87
87
  <DmsAutomationRunPathTaken :run="run" :builder-url="builderUrl" />
88
88
  </div>
89
89
  <div class="flex flex-col gap-2">
90
- <DmsEyebrow as="h4" :label="$t('dms_automation.trace.tabs.steps')" />
90
+ <DmsEyebrowLabel as="h4" :label="$t('dms_automation.trace.tabs.steps')" />
91
91
  <DmsAutomationRunWaterfall :steps="run.trace.steps" :skipped="[]" :total-ms="run.durationMs" :truncated="run.trace.truncated" path-only />
92
92
  </div>
93
93
  </template>
@@ -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>
@@ -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
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-automation",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Visual automation builder for the AntelopeJS DMS: procedures as node graphs started by schedules, webhooks, manual runs or DMS events, with a trace for every run.",
5
5
  "keywords": [
6
6
  "antelopejs",