@antelopejs/dms 0.20.3 → 0.20.4
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/CHANGELOG.md +21 -0
- package/dist/implementations/dms-builder/engine/compose-page.js +3 -2
- package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
- package/dist/mcp/page-verify/index.d.ts +1 -0
- package/dist/mcp/page-verify/index.js +1 -0
- package/dist/mcp/page-verify/index.js.map +1 -1
- package/dist/mcp/page-verify/redact-report.d.ts +2 -0
- package/dist/mcp/page-verify/redact-report.js +120 -0
- package/dist/mcp/page-verify/redact-report.js.map +1 -0
- package/dist/mcp/page-verify/render.js +4 -1
- package/dist/mcp/page-verify/render.js.map +1 -1
- package/dist/mcp/redact.d.ts +87 -0
- package/dist/mcp/redact.js +139 -0
- package/dist/mcp/redact.js.map +1 -0
- package/dist/mcp/tools/builder-compose.js +11 -2
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-project.js +56 -23
- package/dist/mcp/tools/builder-project.js.map +1 -1
- package/dist/mcp/tools/builder-queries.js +41 -4
- package/dist/mcp/tools/builder-queries.js.map +1 -1
- package/dist/mcp/tools/builder-shared.d.ts +3 -1
- package/dist/mcp/tools/builder-shared.js +5 -0
- package/dist/mcp/tools/builder-shared.js.map +1 -1
- package/dist/mcp/tools/database.js +3 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/page-verify.js +3 -2
- package/dist/mcp/tools/page-verify.js.map +1 -1
- package/frontend-vue/eslint-globals.generated.mjs +259 -942
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +46 -23
- package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +34 -23
- package/frontend-vue/layers/dms-core/app/build/composables/user/preferencesCookie.ts +8 -2
- package/frontend-vue/layers/dms-core/app/build/composables/user/tablePreferences.ts +11 -5
- package/frontend-vue/layers/dms-core/app/build/utils/crossTab.ts +4 -2
- package/frontend-vue/layers/dms-core/app/build/utils/json.ts +31 -0
- package/frontend-vue/layers/dms-core/app/build/utils/permission-preview.ts +6 -11
- package/frontend-vue/layers/dms-core/app/build/utils/record.ts +4 -0
- package/frontend-vue/layers/dms-core/app/build/utils/sharedRealtimeConnection.ts +56 -36
- package/frontend-vue/layers/dms-core/app/composables/auth/useApiData.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +6 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useCurrentUser.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useLogout.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/auth/useMultiAccount.ts +15 -14
- package/frontend-vue/layers/dms-core/app/composables/auth/useSessionRecovery.ts +21 -8
- package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -3
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +11 -9
- package/frontend-vue/layers/dms-core/app/composables/period/periodLink.ts +3 -2
- package/frontend-vue/layers/dms-core/app/composables/period/usePeriod.ts +2 -2
- package/frontend-vue/layers/dms-core/app/composables/realtime/usePageRealtime.ts +10 -3
- package/frontend-vue/layers/dms-core/app/composables/realtime/useSseStream.ts +22 -16
- package/frontend-vue/layers/dms-core/app/composables/realtime/useUserRealtime.ts +68 -46
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +22 -11
- package/frontend-vue/layers/dms-core/app/composables/useEventedAction.ts +4 -1
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -6
- package/frontend-vue/layers/dms-core/app/composables/user/usePreferences.ts +8 -3
- package/frontend-vue/layers/dms-core/app/composables/watch/useWatch.ts +17 -8
- package/frontend-vue/layers/dms-core/app/types/module-store.ts +3 -1
- package/frontend-vue/layers/dms-core/app/types/page.ts +3 -1
- package/frontend-vue/layers/dms-core/app/utils/dedupedRefresh.ts +2 -2
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +5 -5
- package/frontend-vue/layers/dms-core/app/utils/menu.ts +12 -4
- package/frontend-vue/layers/dms-core/app/utils/pageQuery.ts +7 -4
- package/frontend-vue/layers/dms-core/app/utils/row-action-rule-evaluator.ts +7 -3
- package/frontend-vue/layers/dms-core/app/utils/stringTypeParser.ts +8 -10
- package/frontend-vue/layers/dms-core/app/utils/type-check.ts +25 -12
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEditOverlay.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIndex.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspectorField.vue +5 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/containers/modal/DynamicModal.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/build/components/containers/row/RowHeader.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +10 -7
- package/frontend-vue/layers/dms-ui/app/build/components/sortable/SortableList.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/build/components/table/FiltersRow.vue +20 -18
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuColumns.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuDensity.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuFilter.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuImport.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuPage.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuRoot.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuSort.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/MenuViewMode.vue +21 -19
- package/frontend-vue/layers/dms-ui/app/build/components/table/RowSelection.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/Table.types.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableMenu.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableRoot.vue +3 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableTabs.vue +2 -5
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableViews.vue +3 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentFilters.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentPreferences.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentRows.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/components/table/tableComponentTheme.ts +11 -0
- package/frontend-vue/layers/dms-ui/app/build/components/table-view/CardsDisplay.vue +35 -9
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +1 -1
- package/frontend-vue/layers/dms-ui/app/build/mockups/resync.ts +9 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +34 -25
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +52 -26
- package/frontend-vue/layers/dms-ui/app/build/utils/calendarDay.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/characterCount.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/dispatchQuickActionTarget.ts +16 -11
- package/frontend-vue/layers/dms-ui/app/build/utils/fieldOptionsI18n.ts +23 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/json.ts +74 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +59 -50
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupDrop.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupEdit.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +34 -28
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStamp.ts +11 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/streamHighlight.ts +8 -6
- package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/components/RecursiveComponent.vue +3 -6
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +5 -4
- package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +1 -2
- package/frontend-vue/layers/dms-ui/app/components/card/NavCard.vue +4 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +62 -13
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartBlock.vue +18 -6
- package/frontend-vue/layers/dms-ui/app/components/code-snippet/CodeSnippet.vue +9 -4
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +9 -6
- package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +16 -18
- package/frontend-vue/layers/dms-ui/app/components/form/FormBlock.vue +4 -9
- package/frontend-vue/layers/dms-ui/app/components/form/LocalizedField.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputImage.vue +5 -8
- package/frontend-vue/layers/dms-ui/app/components/form/components/RichText.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/master-detail/MasterDetail.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/components/period/usePeriodSelectorInteraction.ts +9 -7
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +11 -6
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanDisplay.vue +40 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts +9 -5
- package/frontend-vue/layers/dms-ui/app/composables/chart/events.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/composables/chart/heatmapColors.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/chart/localizeSeries.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +27 -4
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.types.ts +3 -2
- package/frontend-vue/layers/dms-ui/app/composables/chart/useChartFetch.ts +3 -4
- package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/openDynamicContainer.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/composables/containers/types.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/containers/useDrawer.ts +8 -5
- package/frontend-vue/layers/dms-ui/app/composables/containers/useModal.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/form/types/props.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +80 -39
- package/frontend-vue/layers/dms-ui/app/composables/live/usePageLiveRefresh.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/resolveDmsComponent.ts +9 -2
- package/frontend-vue/layers/dms-ui/app/composables/tab/useTab.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/shortcuts/tableViewShiftA.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/action-target.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/column.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/composables/table-view/types/display.ts +6 -2
- package/frontend-vue/layers/dms-ui/app/composables/table-view/useTableViewExport.ts +6 -5
- package/frontend-vue/layers/dms-ui/app/composables/unsaved-changes/useUnsavedChanges.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +21 -9
- package/frontend-vue/layers/dms-ui/app/utils/blockRefresh.ts +8 -2
- package/frontend-vue/layers/dms-ui/app/utils/cascader.ts +18 -8
- package/frontend-vue/layers/dms-ui/app/utils/metadataRetry.ts +1 -1
- package/frontend-vue/package.json +2 -1
- package/frontend-vue/scripts/check-api-error-presentation.mjs +257 -117
- package/frontend-vue/scripts/check-autoimport-boundaries.mjs +143 -27
- package/frontend-vue/scripts/check-disable-blocks.mjs +26 -4
- package/frontend-vue/scripts/check-dms-components.mjs +152 -246
- package/frontend-vue/scripts/check-invariants.mjs +100 -42
- package/frontend-vue/scripts/check-page-invariants.mjs +103 -40
- package/frontend-vue/scripts/dms-components-dependencies.mjs +106 -13
- package/frontend-vue/scripts/dms-components-script.mjs +375 -0
- package/frontend-vue/scripts/eslint-test-quality.mjs +126 -0
- package/frontend-vue/scripts/jsconfig.json +10 -0
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +4 -2
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +217 -47
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +159 -8
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +89 -10
- package/frontend-vue/scripts/prove-comment-emit.mjs +33 -4
- package/frontend-vue/scripts/prove-component-registration.mjs +110 -24
- package/frontend-vue/scripts/test-autoimport-boundaries.mjs +37 -6
- package/frontend-vue/scripts/test-dms-components.mjs +51 -2
- package/package.json +1 -1
- package/frontend-vue/eslint-test-quality.mjs +0 -62
|
@@ -8,6 +8,7 @@ import { z } from "zod";
|
|
|
8
8
|
|
|
9
9
|
const frontend = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
10
10
|
const root = resolve(frontend, "../../..");
|
|
11
|
+
/** @type {(id: string) => typeof import("vite")} */
|
|
11
12
|
const require = createRequire(import.meta.url);
|
|
12
13
|
const { createServer } = require("vite");
|
|
13
14
|
const baseRef = process.argv[2] ?? "HEAD^";
|
|
@@ -98,32 +99,115 @@ const server = await createServer({
|
|
|
98
99
|
},
|
|
99
100
|
],
|
|
100
101
|
});
|
|
102
|
+
/**
|
|
103
|
+
* A module as the observer plugin loads it: the layer's registration function and the maps it fills.
|
|
104
|
+
*
|
|
105
|
+
* @typedef {object} RegistryModule
|
|
106
|
+
* @property {{ setup: (sdk: object) => unknown }} default
|
|
107
|
+
* @property {Record<string, Record<string, () => unknown>>} registryMaps
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {unknown} value
|
|
112
|
+
* @returns {value is Record<string, unknown>}
|
|
113
|
+
*/
|
|
114
|
+
function isRecord(value) {
|
|
115
|
+
return typeof value === "object" && value !== null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param {unknown} value
|
|
120
|
+
* @returns {value is () => unknown}
|
|
121
|
+
*/
|
|
122
|
+
function isLoader(value) {
|
|
123
|
+
return typeof value === "function";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @param {unknown} value
|
|
128
|
+
* @returns {value is Record<string, () => unknown>}
|
|
129
|
+
*/
|
|
130
|
+
function isLoaderMap(value) {
|
|
131
|
+
return isRecord(value) && Object.values(value).every(isLoader);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @param {unknown} value
|
|
136
|
+
* @returns {value is RegistryModule}
|
|
137
|
+
*/
|
|
138
|
+
function isRegistryModule(value) {
|
|
139
|
+
return (
|
|
140
|
+
isRecord(value) &&
|
|
141
|
+
isRecord(value.default) &&
|
|
142
|
+
typeof value.default.setup === "function" &&
|
|
143
|
+
isRecord(value.registryMaps) &&
|
|
144
|
+
Object.values(value.registryMaps).every(isLoaderMap)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @param {unknown} value
|
|
150
|
+
* @returns {value is { default: { target: unknown } }}
|
|
151
|
+
*/
|
|
152
|
+
function hasTarget(value) {
|
|
153
|
+
return (
|
|
154
|
+
isRecord(value) &&
|
|
155
|
+
isRecord(value.default) &&
|
|
156
|
+
Object.hasOwn(value.default, "target")
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @param {unknown} value
|
|
162
|
+
* @returns {value is ((...args: never[]) => unknown) & { registryId?: unknown }}
|
|
163
|
+
*/
|
|
164
|
+
function isFunction(value) {
|
|
165
|
+
return z.function().safeParse(value).success;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @param {string} id
|
|
170
|
+
* @returns {Promise<RegistryModule>}
|
|
171
|
+
*/
|
|
172
|
+
async function loadRegistry(id) {
|
|
173
|
+
/** @type {unknown} */
|
|
174
|
+
const module = await server.ssrLoadModule(id);
|
|
175
|
+
if (!isRegistryModule(module))
|
|
176
|
+
throw new Error(`${id} exports no registration setup and registry maps`);
|
|
177
|
+
return module;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @param {RegistryModule} module
|
|
182
|
+
* @returns {Promise<{ events: unknown[][], maps: Record<string, [string, unknown][]> }>}
|
|
183
|
+
*/
|
|
101
184
|
async function registration(module) {
|
|
185
|
+
/** @type {unknown[][]} */
|
|
102
186
|
const events = [];
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
187
|
+
/** @type {Record<string | symbol, unknown>} */
|
|
188
|
+
const target = { options: { public: {} } };
|
|
189
|
+
const sdk = new Proxy(target, {
|
|
190
|
+
get(target, name) {
|
|
191
|
+
if (name in target) return target[name];
|
|
192
|
+
return (/** @type {unknown[]} */ ...args) =>
|
|
193
|
+
events.push([
|
|
194
|
+
name,
|
|
195
|
+
...args.map((value) => {
|
|
196
|
+
if (isFunction(value))
|
|
197
|
+
return {
|
|
198
|
+
function: value.name,
|
|
199
|
+
arity: value.length,
|
|
200
|
+
importedModule: value.registryId,
|
|
201
|
+
};
|
|
202
|
+
return isRecord(value) && value.__asyncLoader
|
|
203
|
+
? { kind: "async-component" }
|
|
204
|
+
: value;
|
|
205
|
+
}),
|
|
206
|
+
]);
|
|
124
207
|
},
|
|
125
|
-
);
|
|
208
|
+
});
|
|
126
209
|
module.default.setup(sdk);
|
|
210
|
+
/** @type {Record<string, [string, unknown][]>} */
|
|
127
211
|
const maps = {};
|
|
128
212
|
for (const [name, entries] of Object.entries(module.registryMaps)) {
|
|
129
213
|
maps[name] = [];
|
|
@@ -131,14 +215,16 @@ async function registration(module) {
|
|
|
131
215
|
a.localeCompare(b),
|
|
132
216
|
)) {
|
|
133
217
|
const loaded = await load();
|
|
218
|
+
if (!hasTarget(loaded))
|
|
219
|
+
throw new Error(`${key} loads no default export with a target`);
|
|
134
220
|
maps[name].push([key, loaded.default.target]);
|
|
135
221
|
}
|
|
136
222
|
}
|
|
137
223
|
return { events, maps };
|
|
138
224
|
}
|
|
139
225
|
try {
|
|
140
|
-
const before = await registration(await
|
|
141
|
-
const after = await registration(await
|
|
226
|
+
const before = await registration(await loadRegistry(baseId));
|
|
227
|
+
const after = await registration(await loadRegistry(currentId));
|
|
142
228
|
assert.deepEqual(
|
|
143
229
|
after.maps,
|
|
144
230
|
before.maps,
|
|
@@ -18,13 +18,30 @@ const root = resolve(frontend, "../../..");
|
|
|
18
18
|
const scratch = mkdtempSync(join(tmpdir(), "frontend-autoimport-tests-"));
|
|
19
19
|
const pkg = join(scratch, "packages/dms/frontend-vue");
|
|
20
20
|
const app = "layers/dms-core/app";
|
|
21
|
-
const require = createRequire(import.meta.url);
|
|
22
|
-
const { createServer } = require("vite");
|
|
23
|
-
const vue = require("@vitejs/plugin-vue").default;
|
|
24
|
-
const { createSSRApp } = require("vue");
|
|
25
|
-
const { renderToString } = require("vue/server-renderer");
|
|
26
|
-
const autoImport = require("unplugin-auto-import/vite");
|
|
27
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {{
|
|
24
|
+
* (id: "vite"): typeof import("vite");
|
|
25
|
+
* (id: "@vitejs/plugin-vue"): typeof import("@vitejs/plugin-vue");
|
|
26
|
+
* (id: "vue"): typeof import("vue");
|
|
27
|
+
* (id: "vue/server-renderer"): typeof import("vue/server-renderer");
|
|
28
|
+
* (id: "unplugin-auto-import/vite"): typeof import("unplugin-auto-import/vite").default;
|
|
29
|
+
* }} TestDependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** @type {(from: string) => TestDependencies} */
|
|
33
|
+
const requireFrom = createRequire;
|
|
34
|
+
const load = requireFrom(import.meta.url);
|
|
35
|
+
const { createServer } = load("vite");
|
|
36
|
+
const vue = load("@vitejs/plugin-vue").default;
|
|
37
|
+
const { createSSRApp } = load("vue");
|
|
38
|
+
const { renderToString } = load("vue/server-renderer");
|
|
39
|
+
const autoImport = load("unplugin-auto-import/vite");
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} file
|
|
43
|
+
* @param {string} text
|
|
44
|
+
*/
|
|
28
45
|
function write(file, text) {
|
|
29
46
|
const target = join(pkg, file);
|
|
30
47
|
mkdirSync(dirname(target), { recursive: true });
|
|
@@ -40,6 +57,19 @@ function run() {
|
|
|
40
57
|
);
|
|
41
58
|
}
|
|
42
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @param {unknown} value
|
|
62
|
+
* @returns {value is import("vue").Component}
|
|
63
|
+
*/
|
|
64
|
+
function isComponent(value) {
|
|
65
|
+
return value instanceof Object;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} file
|
|
70
|
+
* @param {(loaded: Record<string, unknown>) => unknown} verify
|
|
71
|
+
* @param {import("vite").PluginOption[]} plugins
|
|
72
|
+
*/
|
|
43
73
|
async function viteControl(file, verify, plugins) {
|
|
44
74
|
const server = await createServer({
|
|
45
75
|
root: pkg,
|
|
@@ -97,6 +127,7 @@ try {
|
|
|
97
127
|
await viteControl(
|
|
98
128
|
"layers/dms-ui/app/components/Entry.vue",
|
|
99
129
|
async (actual) => {
|
|
130
|
+
assert.ok(isComponent(actual.default), "entry default is a component");
|
|
100
131
|
const app = createSSRApp(actual.default);
|
|
101
132
|
app.component("DashboardHeader", {
|
|
102
133
|
template: "<header>CONTROL_OK</header>",
|
|
@@ -45,6 +45,48 @@ const FIXTURE_FILES = {
|
|
|
45
45
|
"frontend-vue/app/custom-layouts/Board.vue": "<template><div /></template>",
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {object} DiagnoseOptions
|
|
50
|
+
* @property {string} [screen]
|
|
51
|
+
* @property {string} [script]
|
|
52
|
+
* @property {string} [backend]
|
|
53
|
+
* @property {boolean} [renderer]
|
|
54
|
+
* @property {boolean} [asserted]
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {unknown} error
|
|
59
|
+
* @returns {string}
|
|
60
|
+
*/
|
|
61
|
+
function messageOf(error) {
|
|
62
|
+
if (!(error instanceof Error)) throw error;
|
|
63
|
+
return error.message;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {unknown} value
|
|
68
|
+
* @returns {value is Record<string, unknown>}
|
|
69
|
+
*/
|
|
70
|
+
function isRecord(value) {
|
|
71
|
+
return typeof value === "object" && value !== null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {unknown} value
|
|
76
|
+
* @returns {value is { checkDmsComponents: typeof checkDmsComponents }}
|
|
77
|
+
*/
|
|
78
|
+
function isChecker(value) {
|
|
79
|
+
return (
|
|
80
|
+
isRecord(value) &&
|
|
81
|
+
Object.hasOwn(value, "checkDmsComponents") &&
|
|
82
|
+
typeof value.checkDmsComponents === "function"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param {DiagnoseOptions} options
|
|
88
|
+
* @returns {Promise<string[]>}
|
|
89
|
+
*/
|
|
48
90
|
async function diagnose({
|
|
49
91
|
screen = "<div />",
|
|
50
92
|
script = "",
|
|
@@ -81,7 +123,8 @@ async function diagnose({
|
|
|
81
123
|
if (asserted)
|
|
82
124
|
return await assertDmsComponents(options).then(
|
|
83
125
|
() => [],
|
|
84
|
-
|
|
126
|
+
/** @param {unknown} error */
|
|
127
|
+
(error) => messageOf(error).replaceAll(layer, "<layer>").split("\n"),
|
|
85
128
|
);
|
|
86
129
|
const diagnostics = await checkDmsComponents(options);
|
|
87
130
|
return diagnostics.map((line) =>
|
|
@@ -228,6 +271,7 @@ const BROKEN_PARSERS = {
|
|
|
228
271
|
},
|
|
229
272
|
};
|
|
230
273
|
|
|
274
|
+
/** @returns {Promise<string>} */
|
|
231
275
|
async function checkWithoutParsers() {
|
|
232
276
|
const root = mkdtempSync(join(tmpdir(), "dms-components-parsers-"));
|
|
233
277
|
try {
|
|
@@ -240,6 +284,7 @@ async function checkWithoutParsers() {
|
|
|
240
284
|
for (const file of [
|
|
241
285
|
"scripts/check-dms-components.mjs",
|
|
242
286
|
"scripts/dms-components-dependencies.mjs",
|
|
287
|
+
"scripts/dms-components-script.mjs",
|
|
243
288
|
"package.json",
|
|
244
289
|
])
|
|
245
290
|
copyFileSync(
|
|
@@ -253,12 +298,16 @@ async function checkWithoutParsers() {
|
|
|
253
298
|
const layer = join(root, "layer");
|
|
254
299
|
mkdirSync(layer);
|
|
255
300
|
writeFileSync(join(layer, "package.json"), "{}");
|
|
301
|
+
/** @type {unknown} */
|
|
256
302
|
const copy = await import(
|
|
257
303
|
pathToFileURL(join(frontend, "scripts", "check-dms-components.mjs")).href
|
|
258
304
|
);
|
|
305
|
+
if (!isChecker(copy))
|
|
306
|
+
throw new Error("The copy of the check exports no checkDmsComponents");
|
|
259
307
|
return await copy.checkDmsComponents({ layer }).then(
|
|
260
308
|
() => "",
|
|
261
|
-
|
|
309
|
+
/** @param {unknown} error */
|
|
310
|
+
(error) => messageOf(error).replaceAll(layer, "<layer>"),
|
|
262
311
|
);
|
|
263
312
|
} finally {
|
|
264
313
|
rmSync(root, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.4",
|
|
4
4
|
"description": "AntelopeJS DMS. Plug in your PostgreSQL, MySQL, MariaDB, MongoDB or RethinkDB database and your coding agent builds a back office and analytics dashboard as typed TypeScript. Real-time updates on the data the DMS manages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import antiSlop from "@antelopejs/tooling-configs/oxc/anti-slop";
|
|
2
|
-
import guardrails from "@antelopejs/tooling-configs/oxc/guardrails";
|
|
3
|
-
|
|
4
|
-
const rules = {
|
|
5
|
-
"no-fs-read-in-tests": guardrails.rules["no-fs-read-in-tests"],
|
|
6
|
-
"require-assertion": guardrails.rules["require-assertion"],
|
|
7
|
-
"no-constant-value-assertion":
|
|
8
|
-
guardrails.rules["no-constant-value-assertion"],
|
|
9
|
-
"no-typeof-function-only-test":
|
|
10
|
-
guardrails.rules["no-typeof-function-only-test"],
|
|
11
|
-
"no-module-mocking": antiSlop.rules["no-module-mocking"],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
rules: Object.fromEntries(
|
|
16
|
-
Object.entries(rules).map(([name, rule]) => [
|
|
17
|
-
name,
|
|
18
|
-
{
|
|
19
|
-
meta: rule.meta,
|
|
20
|
-
create(context) {
|
|
21
|
-
const sourceCode = context.sourceCode;
|
|
22
|
-
const compatibleSourceCode = Object.create(sourceCode, {
|
|
23
|
-
isGlobalReference: {
|
|
24
|
-
value(node) {
|
|
25
|
-
let scope = sourceCode.getScope(node);
|
|
26
|
-
while (scope !== null) {
|
|
27
|
-
const variable = scope.set.get(node.name);
|
|
28
|
-
if (variable !== undefined) return variable.defs.length === 0;
|
|
29
|
-
scope = scope.upper;
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const visitors = rule.createOnce(
|
|
36
|
-
Object.create(context, {
|
|
37
|
-
sourceCode: { value: compatibleSourceCode },
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
return {
|
|
41
|
-
...visitors,
|
|
42
|
-
Program(node) {
|
|
43
|
-
const pending = [node];
|
|
44
|
-
while (pending.length > 0) {
|
|
45
|
-
const current = pending.pop();
|
|
46
|
-
if (current.start !== undefined) continue;
|
|
47
|
-
[current.start, current.end] = current.range;
|
|
48
|
-
for (const key of sourceCode.visitorKeys[current.type] ?? []) {
|
|
49
|
-
const children = current[key];
|
|
50
|
-
if (Array.isArray(children))
|
|
51
|
-
pending.push(...children.filter(Boolean));
|
|
52
|
-
else if (children) pending.push(children);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
visitors.Program?.(node);
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]),
|
|
61
|
-
),
|
|
62
|
-
};
|