@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
|
@@ -7,6 +7,27 @@ const { createRequire } = require("node:module");
|
|
|
7
7
|
|
|
8
8
|
const root = path.resolve(process.argv[2]);
|
|
9
9
|
const frontend = path.join(root, "packages/dms/frontend-vue");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Omit<typeof import("@vue/compiler-sfc"), "registerTS"> & {
|
|
13
|
+
* registerTS: (load: () => typeof import("typescript")) => void;
|
|
14
|
+
* }} CompilerSfc
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {{
|
|
19
|
+
* (id: "typescript"): typeof import("typescript");
|
|
20
|
+
* (id: "@vue/compiler-sfc"): CompilerSfc;
|
|
21
|
+
* (id: "vue"): {
|
|
22
|
+
* mergeDefaults: (raw: unknown, defaults: unknown) => unknown;
|
|
23
|
+
* mergeModels: (first: unknown, second: unknown) => unknown;
|
|
24
|
+
* };
|
|
25
|
+
* (id: "vite"): typeof import("vite");
|
|
26
|
+
* (id: "node:path"): typeof import("node:path");
|
|
27
|
+
* }} FrontendRequire
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** @type {FrontendRequire} */
|
|
10
31
|
const req = createRequire(path.join(frontend, "package.json"));
|
|
11
32
|
const ts = {
|
|
12
33
|
...req("typescript"),
|
|
@@ -137,13 +158,31 @@ const compilerOptions = {
|
|
|
137
158
|
module: ts.ModuleKind.CommonJS,
|
|
138
159
|
target: ts.ScriptTarget.ES2022,
|
|
139
160
|
};
|
|
161
|
+
|
|
162
|
+
/** @type {Record<string, () => unknown>} */
|
|
140
163
|
const dependencyLoaders = {
|
|
141
164
|
"node:path": () => req("node:path"),
|
|
142
165
|
vite: () => req("vite"),
|
|
143
166
|
};
|
|
144
167
|
|
|
168
|
+
/** @typedef {Record<string, unknown>} ProbeBindings */
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Runs one transpiled source in a fresh context and returns its exports. The
|
|
172
|
+
* exports follow the file, so each caller binds the type of the file it loads.
|
|
173
|
+
* @param {string} source
|
|
174
|
+
* @param {string} filename
|
|
175
|
+
* @param {ProbeBindings} [globals]
|
|
176
|
+
* @param {ProbeBindings} [imports]
|
|
177
|
+
* @param {import("typescript").CustomTransformers} [transformers]
|
|
178
|
+
* @returns {any}
|
|
179
|
+
*/
|
|
145
180
|
function evaluate(source, filename, globals = {}, imports = {}, transformers) {
|
|
146
181
|
const module = { exports: {} };
|
|
182
|
+
/**
|
|
183
|
+
* @param {string} specifier
|
|
184
|
+
* @returns {unknown}
|
|
185
|
+
*/
|
|
147
186
|
const localRequire = (specifier) => {
|
|
148
187
|
if (specifier in imports) return imports[specifier];
|
|
149
188
|
if (specifier.startsWith(".")) {
|
|
@@ -177,14 +216,36 @@ function evaluate(source, filename, globals = {}, imports = {}, transformers) {
|
|
|
177
216
|
return module.exports;
|
|
178
217
|
}
|
|
179
218
|
|
|
219
|
+
/**
|
|
220
|
+
* @param {string} filename
|
|
221
|
+
* @param {ProbeBindings} [globals]
|
|
222
|
+
* @returns {any}
|
|
223
|
+
*/
|
|
180
224
|
function load(filename, globals) {
|
|
181
225
|
return evaluate(fs.readFileSync(filename, "utf8"), filename, globals);
|
|
182
226
|
}
|
|
183
227
|
|
|
228
|
+
/**
|
|
229
|
+
* @typedef {{
|
|
230
|
+
* (url: string, options: object): Promise<unknown>;
|
|
231
|
+
* raw: (url: string, options: object) => Promise<unknown>;
|
|
232
|
+
* }} AuthFetch
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
/** @type {(filename: string, globals: ProbeBindings) => { useAuthFetch: () => { $authFetch: AuthFetch } }} */
|
|
236
|
+
const loadAuthFetch = load;
|
|
237
|
+
|
|
238
|
+
/** @param {boolean} raw */
|
|
184
239
|
async function authRetry(raw) {
|
|
240
|
+
/** @type {number[]} */
|
|
185
241
|
const reads = [];
|
|
242
|
+
/** @type {Array<{ unauthorized: true } | { token: string | null; retry: string | null }>} */
|
|
186
243
|
const calls = [];
|
|
187
244
|
let refreshes = 0;
|
|
245
|
+
/**
|
|
246
|
+
* @param {unknown} _request
|
|
247
|
+
* @param {{ headers: Headers }} options
|
|
248
|
+
*/
|
|
188
249
|
const baseFetch = async (_request, options) => {
|
|
189
250
|
calls.push(
|
|
190
251
|
calls.length
|
|
@@ -202,7 +263,7 @@ async function authRetry(raw) {
|
|
|
202
263
|
layers,
|
|
203
264
|
"dms-core/app/composables/auth/useAuthFetch.ts",
|
|
204
265
|
);
|
|
205
|
-
const { useAuthFetch } =
|
|
266
|
+
const { useAuthFetch } = loadAuthFetch(filename, {
|
|
206
267
|
HTTP_UNAUTHORIZED: 401,
|
|
207
268
|
useDmsUserSession: () => ({ loggedIn: { value: true } }),
|
|
208
269
|
useSessionRecovery: () => ({
|
|
@@ -215,6 +276,10 @@ async function authRetry(raw) {
|
|
|
215
276
|
}),
|
|
216
277
|
useDmsRuntimeConfig: () => ({ public: { dms: { baseURL: "/api" } } }),
|
|
217
278
|
useDmsApp: () => ({ $i18n: { locale: { value: "en" } } }),
|
|
279
|
+
/**
|
|
280
|
+
* @param {unknown} _key
|
|
281
|
+
* @param {() => unknown} initial
|
|
282
|
+
*/
|
|
218
283
|
useDmsState: (_key, initial) => ({ value: initial() }),
|
|
219
284
|
$fetch: { create: () => baseFetch },
|
|
220
285
|
});
|
|
@@ -233,14 +298,20 @@ async function authRetry(raw) {
|
|
|
233
298
|
return { result, reads, refreshes, calls };
|
|
234
299
|
}
|
|
235
300
|
|
|
301
|
+
/** @type {(filename: string) => { writeAt: (tree: object, path: string[], value: unknown) => void; readAt: (tree: object, path: string[]) => unknown }} */
|
|
302
|
+
const loadPreferences = load;
|
|
303
|
+
|
|
236
304
|
function preferences() {
|
|
237
305
|
const filename = path.join(
|
|
238
306
|
layers,
|
|
239
307
|
"dms-core/app/build/composables/user/preferencesCookie.ts",
|
|
240
308
|
);
|
|
241
|
-
const { writeAt, readAt } =
|
|
309
|
+
const { writeAt, readAt } = loadPreferences(filename);
|
|
310
|
+
/** @type {string[]} */
|
|
242
311
|
const events = [];
|
|
312
|
+
/** @type {{ leaf?: string }} */
|
|
243
313
|
const first = {};
|
|
314
|
+
/** @type {{ leaf?: string }} */
|
|
244
315
|
const second = {};
|
|
245
316
|
let reads = 0;
|
|
246
317
|
const tree = Object.defineProperty({}, "branch", {
|
|
@@ -253,8 +324,11 @@ function preferences() {
|
|
|
253
324
|
writeAt(tree, ["branch", "leaf"], "written");
|
|
254
325
|
const plain = {};
|
|
255
326
|
writeAt(plain, ["a", "b"], 7);
|
|
327
|
+
/** @type {string[]} */
|
|
256
328
|
const creationEvents = [];
|
|
329
|
+
/** @type {{ leaf?: string }} */
|
|
257
330
|
const afterAssignment = {};
|
|
331
|
+
/** @type {{ leaf?: string }} */
|
|
258
332
|
let assigned;
|
|
259
333
|
let creationReads = 0;
|
|
260
334
|
const creatingTree = Object.defineProperty({}, "branch", {
|
|
@@ -262,6 +336,7 @@ function preferences() {
|
|
|
262
336
|
creationEvents.push(`get:${++creationReads}`);
|
|
263
337
|
return creationReads === 1 ? undefined : afterAssignment;
|
|
264
338
|
},
|
|
339
|
+
/** @param {{ leaf?: string }} value */
|
|
265
340
|
set(value) {
|
|
266
341
|
creationEvents.push("set");
|
|
267
342
|
assigned = value;
|
|
@@ -281,6 +356,21 @@ function preferences() {
|
|
|
281
356
|
};
|
|
282
357
|
}
|
|
283
358
|
|
|
359
|
+
/**
|
|
360
|
+
* @typedef {{
|
|
361
|
+
* setup: (
|
|
362
|
+
* props: object,
|
|
363
|
+
* context: { expose: () => void },
|
|
364
|
+
* ) => {
|
|
365
|
+
* HANDOFF_ACTIONS: object;
|
|
366
|
+
* runHandoffAction: (handoff: object) => unknown;
|
|
367
|
+
* };
|
|
368
|
+
* }} OauthComponent
|
|
369
|
+
*/
|
|
370
|
+
|
|
371
|
+
/** @type {(source: string, filename: string, globals: ProbeBindings, imports: ProbeBindings) => { default: OauthComponent }} */
|
|
372
|
+
const evaluateOauth = evaluate;
|
|
373
|
+
|
|
284
374
|
function oauth() {
|
|
285
375
|
const filename = path.join(
|
|
286
376
|
layers,
|
|
@@ -290,13 +380,14 @@ function oauth() {
|
|
|
290
380
|
filename,
|
|
291
381
|
});
|
|
292
382
|
const compiled = sfc.compileScript(descriptor, { id: "oauth-probe" });
|
|
293
|
-
const { default: component } =
|
|
383
|
+
const { default: component } = evaluateOauth(
|
|
294
384
|
compiled.content,
|
|
295
385
|
filename,
|
|
296
386
|
{
|
|
297
387
|
useDmsRoute: () => ({ query: {} }),
|
|
298
388
|
useHomepage: () => "/home",
|
|
299
389
|
useDmsApp: () => ({}),
|
|
390
|
+
/** @param {() => unknown} get */
|
|
300
391
|
computed: (get) => ({
|
|
301
392
|
get value() {
|
|
302
393
|
return get();
|
|
@@ -304,14 +395,24 @@ function oauth() {
|
|
|
304
395
|
}),
|
|
305
396
|
onMounted: () => {},
|
|
306
397
|
},
|
|
307
|
-
{
|
|
398
|
+
{
|
|
399
|
+
vue: {
|
|
400
|
+
/** @param {object} options */
|
|
401
|
+
defineComponent: (options) => options,
|
|
402
|
+
},
|
|
403
|
+
},
|
|
308
404
|
);
|
|
309
405
|
const exposed = component.setup({}, { expose() {} });
|
|
406
|
+
/** @type {string[]} */
|
|
310
407
|
const events = [];
|
|
311
408
|
const actions = exposed.HANDOFF_ACTIONS;
|
|
312
409
|
Object.defineProperty(actions, "none", {
|
|
313
410
|
get() {
|
|
314
411
|
events.push("action:get");
|
|
412
|
+
/**
|
|
413
|
+
* @this {unknown}
|
|
414
|
+
* @param {{ token: string }} handoff
|
|
415
|
+
*/
|
|
315
416
|
return function (handoff) {
|
|
316
417
|
events.push(
|
|
317
418
|
this === actions ? "receiver:actions" : "receiver:undefined",
|
|
@@ -331,6 +432,43 @@ function oauth() {
|
|
|
331
432
|
return { result, events };
|
|
332
433
|
}
|
|
333
434
|
|
|
435
|
+
/**
|
|
436
|
+
* @param {unknown} value
|
|
437
|
+
* @returns {value is (...args: never[]) => unknown}
|
|
438
|
+
*/
|
|
439
|
+
function isCallable(value) {
|
|
440
|
+
return typeof value === "function";
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @param {unknown} value
|
|
445
|
+
* @returns {value is Record<string, unknown>}
|
|
446
|
+
*/
|
|
447
|
+
function isObjectLike(value) {
|
|
448
|
+
return typeof value === "object" && value !== null;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @param {unknown} value
|
|
453
|
+
* @returns {value is unknown[]}
|
|
454
|
+
*/
|
|
455
|
+
function isList(value) {
|
|
456
|
+
return Array.isArray(value);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* @param {unknown} error
|
|
461
|
+
* @returns {error is { message: string }}
|
|
462
|
+
*/
|
|
463
|
+
function hasMessage(error) {
|
|
464
|
+
return (
|
|
465
|
+
isObjectLike(error) &&
|
|
466
|
+
"message" in error &&
|
|
467
|
+
typeof error.message === "string"
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/** @param {string} expression */
|
|
334
472
|
function runtimeDeclaration(expression) {
|
|
335
473
|
try {
|
|
336
474
|
const javascript = ts.transpileModule(`module.exports = (${expression});`, {
|
|
@@ -343,15 +481,19 @@ function runtimeDeclaration(expression) {
|
|
|
343
481
|
_mergeDefaults: vue.mergeDefaults,
|
|
344
482
|
_mergeModels: vue.mergeModels,
|
|
345
483
|
});
|
|
484
|
+
/**
|
|
485
|
+
* @param {unknown} value
|
|
486
|
+
* @returns {unknown}
|
|
487
|
+
*/
|
|
346
488
|
const serialize = (value) => {
|
|
347
489
|
if (value === undefined) return { undefined: true };
|
|
348
|
-
if (
|
|
490
|
+
if (isCallable(value))
|
|
349
491
|
return {
|
|
350
492
|
function: value.name || null,
|
|
351
493
|
code: value.toString().replace(/\s+/g, " "),
|
|
352
494
|
};
|
|
353
|
-
if (
|
|
354
|
-
if (value
|
|
495
|
+
if (isList(value)) return Array.from(value, serialize);
|
|
496
|
+
if (isObjectLike(value))
|
|
355
497
|
return Object.fromEntries(
|
|
356
498
|
Object.entries(value).map(([key, entry]) => [key, serialize(entry)]),
|
|
357
499
|
);
|
|
@@ -359,15 +501,19 @@ function runtimeDeclaration(expression) {
|
|
|
359
501
|
};
|
|
360
502
|
return { status: "evaluated", value: serialize(module.exports) };
|
|
361
503
|
} catch (error) {
|
|
362
|
-
|
|
504
|
+
const reason = hasMessage(error) ? error.message : undefined;
|
|
505
|
+
return { status: "runtime-unresolved", reason };
|
|
363
506
|
}
|
|
364
507
|
}
|
|
365
508
|
|
|
509
|
+
/** @typedef {{ compiled: string; runtime: ReturnType<typeof runtimeDeclaration> }} DeclarationContract */
|
|
510
|
+
|
|
366
511
|
function contracts() {
|
|
367
512
|
const manifest = Object.entries(componentManifest).flatMap(
|
|
368
513
|
([prefix, files]) => files.map((file) => `${prefix}${file}`),
|
|
369
514
|
);
|
|
370
515
|
const printer = ts.createPrinter({ removeComments: true });
|
|
516
|
+
/** @param {string} source */
|
|
371
517
|
const normalize = (source) =>
|
|
372
518
|
printer
|
|
373
519
|
.printFile(
|
|
@@ -399,6 +545,7 @@ function contracts() {
|
|
|
399
545
|
ts.ScriptTarget.Latest,
|
|
400
546
|
true,
|
|
401
547
|
);
|
|
548
|
+
/** @type {{ path: string; status: string; props: DeclarationContract | null; emits: DeclarationContract | null; macros: string[]; [key: string]: unknown }} */
|
|
402
549
|
const result = {
|
|
403
550
|
path: relative,
|
|
404
551
|
status: "compiled",
|
|
@@ -406,6 +553,7 @@ function contracts() {
|
|
|
406
553
|
emits: null,
|
|
407
554
|
macros: [],
|
|
408
555
|
};
|
|
556
|
+
/** @param {import("typescript").Node} node */
|
|
409
557
|
const inspect = (node) => {
|
|
410
558
|
if (
|
|
411
559
|
ts.isPropertyAssignment(node) &&
|
|
@@ -426,6 +574,7 @@ function contracts() {
|
|
|
426
574
|
ts.ScriptTarget.Latest,
|
|
427
575
|
true,
|
|
428
576
|
);
|
|
577
|
+
/** @param {import("typescript").Node} node */
|
|
429
578
|
const macro = (node) => {
|
|
430
579
|
if (
|
|
431
580
|
ts.isCallExpression(node) &&
|
|
@@ -440,6 +589,7 @@ function contracts() {
|
|
|
440
589
|
macro(raw);
|
|
441
590
|
return result;
|
|
442
591
|
} catch (error) {
|
|
592
|
+
if (!hasMessage(error)) throw error;
|
|
443
593
|
return {
|
|
444
594
|
path: relative,
|
|
445
595
|
status: "compiler-unresolved",
|
|
@@ -459,6 +609,7 @@ module.exports = {
|
|
|
459
609
|
ts,
|
|
460
610
|
evaluate,
|
|
461
611
|
load,
|
|
612
|
+
isObjectLike,
|
|
462
613
|
observe: async () => ({
|
|
463
614
|
authRetry: await authRetry(false),
|
|
464
615
|
authRawRetry: await authRetry(true),
|
|
@@ -8,13 +8,75 @@ const { execFileSync } = require("node:child_process");
|
|
|
8
8
|
const { createRequire } = require("node:module");
|
|
9
9
|
const { captureProbe } = require("./capture-frontend-probe.cjs");
|
|
10
10
|
|
|
11
|
+
/** @typedef {{ name: string; signature: string; injected: boolean }} AutoImport */
|
|
12
|
+
|
|
13
|
+
/** @typedef {{ autoImports: AutoImport[]; registrations: unknown[] }} ProbeResult */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {unknown} value
|
|
17
|
+
* @returns {value is Record<string, unknown>}
|
|
18
|
+
*/
|
|
19
|
+
function isObjectLike(value) {
|
|
20
|
+
return typeof value === "object" && value !== null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {unknown} value
|
|
25
|
+
* @returns {value is AutoImport}
|
|
26
|
+
*/
|
|
27
|
+
function isAutoImport(value) {
|
|
28
|
+
return (
|
|
29
|
+
isObjectLike(value) &&
|
|
30
|
+
Object.hasOwn(value, "name") &&
|
|
31
|
+
typeof value.name === "string" &&
|
|
32
|
+
Object.hasOwn(value, "signature") &&
|
|
33
|
+
typeof value.signature === "string" &&
|
|
34
|
+
Object.hasOwn(value, "injected") &&
|
|
35
|
+
typeof value.injected === "boolean"
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {unknown} value
|
|
41
|
+
* @returns {value is ProbeResult}
|
|
42
|
+
*/
|
|
43
|
+
function isProbeResult(value) {
|
|
44
|
+
return (
|
|
45
|
+
isObjectLike(value) &&
|
|
46
|
+
Object.hasOwn(value, "autoImports") &&
|
|
47
|
+
Array.isArray(value.autoImports) &&
|
|
48
|
+
value.autoImports.every(isAutoImport) &&
|
|
49
|
+
Object.hasOwn(value, "registrations") &&
|
|
50
|
+
Array.isArray(value.registrations)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {unknown} value
|
|
56
|
+
* @returns {value is import("typescript").Node & { name: { text: string } }}
|
|
57
|
+
*/
|
|
58
|
+
function hasTextName(value) {
|
|
59
|
+
return (
|
|
60
|
+
isObjectLike(value) &&
|
|
61
|
+
Object.hasOwn(value, "name") &&
|
|
62
|
+
isObjectLike(value.name) &&
|
|
63
|
+
typeof value.name.text === "string"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @type {(from: string) => (id: string) => typeof import("typescript")}
|
|
69
|
+
*/
|
|
70
|
+
const createTypeScriptRequire = createRequire;
|
|
71
|
+
|
|
11
72
|
const root = path.resolve(process.argv[2]);
|
|
12
73
|
const frontend = path.join(root, "packages/dms/frontend-vue");
|
|
13
74
|
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "frontend-controls-"));
|
|
14
75
|
const copy = path.join(temporary, "packages/dms/frontend-vue");
|
|
15
76
|
const probe = path.join(temporary, "captured-probe.cjs");
|
|
16
|
-
const run = () =>
|
|
17
|
-
|
|
77
|
+
const run = () => {
|
|
78
|
+
/** @type {unknown} */
|
|
79
|
+
const result = JSON.parse(
|
|
18
80
|
execFileSync(
|
|
19
81
|
process.execPath,
|
|
20
82
|
["--max-old-space-size=650", probe, temporary],
|
|
@@ -25,6 +87,14 @@ const run = () =>
|
|
|
25
87
|
},
|
|
26
88
|
),
|
|
27
89
|
);
|
|
90
|
+
if (!isProbeResult(result))
|
|
91
|
+
throw new TypeError("The captured probe printed an unexpected result");
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @param {ProbeResult} result
|
|
96
|
+
* @param {string} name
|
|
97
|
+
*/
|
|
28
98
|
const entry = (result, name) =>
|
|
29
99
|
result.autoImports.find((item) => item.name === name);
|
|
30
100
|
|
|
@@ -58,21 +128,25 @@ try {
|
|
|
58
128
|
"layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts",
|
|
59
129
|
);
|
|
60
130
|
const originalBucket = fs.readFileSync(bucket, "utf8");
|
|
61
|
-
const ts =
|
|
131
|
+
const ts = createTypeScriptRequire(path.join(frontend, "package.json"))(
|
|
132
|
+
"typescript",
|
|
133
|
+
);
|
|
62
134
|
const ast = ts.createSourceFile(
|
|
63
135
|
bucket,
|
|
64
136
|
originalBucket,
|
|
65
137
|
ts.ScriptTarget.Latest,
|
|
66
138
|
true,
|
|
67
139
|
);
|
|
140
|
+
/** @type {import("typescript").TypeNode | undefined} */
|
|
68
141
|
let timestamp;
|
|
142
|
+
/** @param {import("typescript").Node} node */
|
|
69
143
|
const visit = (node) => {
|
|
70
144
|
if (ts.isParameter(node) && node.name.getText(ast) === "timestamp")
|
|
71
145
|
timestamp = node.type;
|
|
72
146
|
ts.forEachChild(node, visit);
|
|
73
147
|
};
|
|
74
148
|
const formatter = ast.statements.find(
|
|
75
|
-
(node) => node.name
|
|
149
|
+
(node) => hasTextName(node) && node.name.text === "bucketAxisFormatter",
|
|
76
150
|
);
|
|
77
151
|
visit(formatter);
|
|
78
152
|
assert.ok(timestamp);
|
|
@@ -181,12 +255,15 @@ try {
|
|
|
181
255
|
ts.ScriptTarget.Latest,
|
|
182
256
|
true,
|
|
183
257
|
);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
258
|
+
/**
|
|
259
|
+
* @param {import("typescript").Node} node
|
|
260
|
+
* @returns {node is import("typescript").VariableStatement}
|
|
261
|
+
*/
|
|
262
|
+
const isComponentsDeclaration = (node) =>
|
|
263
|
+
ts.isVariableStatement(node) &&
|
|
264
|
+
node.declarationList.declarations[0].name.getText(runtimeAst) ===
|
|
265
|
+
"components";
|
|
266
|
+
const components = runtimeAst.statements.find(isComponentsDeclaration);
|
|
190
267
|
const initializer = components?.declarationList.declarations[0].initializer;
|
|
191
268
|
if (initializer?.getText(runtimeAst).includes("import.meta.glob")) {
|
|
192
269
|
const entryFile = path.join(
|
|
@@ -197,7 +274,9 @@ try {
|
|
|
197
274
|
const expression = initializer
|
|
198
275
|
.getText(runtimeAst)
|
|
199
276
|
.replaceAll("./layers/", `${prefix}layers/`);
|
|
277
|
+
/** @type {Set<string>} */
|
|
200
278
|
const references = new Set();
|
|
279
|
+
/** @param {import("typescript").Node} node */
|
|
201
280
|
const collectReferences = (node) => {
|
|
202
281
|
if (ts.isIdentifier(node)) references.add(node.text);
|
|
203
282
|
ts.forEachChild(node, collectReferences);
|
|
@@ -4,14 +4,24 @@ import { readFileSync } from "node:fs";
|
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @param {string[]} args
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
7
11
|
const git = (...args) =>
|
|
8
12
|
execFileSync("git", args, { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
|
|
9
13
|
const root = git("rev-parse", "--show-toplevel").trim();
|
|
10
14
|
const area = "packages/dms/frontend-vue";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
+
const requireFrom = join(root, area, "package.json");
|
|
16
|
+
/** @type {(id: string) => typeof import("typescript")} */
|
|
17
|
+
const loadTypeScript = createRequire(requireFrom);
|
|
18
|
+
/** @type {(id: string) => typeof import("prettier")} */
|
|
19
|
+
const loadPrettier = createRequire(requireFrom);
|
|
20
|
+
/** @type {(id: string) => typeof import("vue/compiler-sfc")} */
|
|
21
|
+
const loadCompilerSfc = createRequire(requireFrom);
|
|
22
|
+
const ts = loadTypeScript("typescript");
|
|
23
|
+
const prettier = loadPrettier("prettier");
|
|
24
|
+
const { parse, compileTemplate } = loadCompilerSfc("vue/compiler-sfc");
|
|
15
25
|
const base = process.argv[2];
|
|
16
26
|
assert.ok(base, "Usage: node frontend-comment-emit.mjs <base-ref>");
|
|
17
27
|
const head = process.argv.includes("--working")
|
|
@@ -19,6 +29,11 @@ const head = process.argv.includes("--working")
|
|
|
19
29
|
: git("rev-parse", "HEAD").trim();
|
|
20
30
|
const printer = ts.createPrinter({ removeComments: true });
|
|
21
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} source
|
|
34
|
+
* @param {string} file
|
|
35
|
+
* @returns {Promise<string>}
|
|
36
|
+
*/
|
|
22
37
|
async function scriptSyntax(source, file) {
|
|
23
38
|
const parsed = ts.createSourceFile(
|
|
24
39
|
file,
|
|
@@ -29,6 +44,10 @@ async function scriptSyntax(source, file) {
|
|
|
29
44
|
return prettier.format(printer.printFile(parsed), { parser: "typescript" });
|
|
30
45
|
}
|
|
31
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} source
|
|
49
|
+
* @param {string} file
|
|
50
|
+
*/
|
|
32
51
|
async function sourceEmit(source, file) {
|
|
33
52
|
const tree = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true);
|
|
34
53
|
assert.deepEqual(tree.parseDiagnostics, [], `${file}: syntax diagnostics`);
|
|
@@ -53,6 +72,10 @@ async function sourceEmit(source, file) {
|
|
|
53
72
|
};
|
|
54
73
|
}
|
|
55
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @param {string} source
|
|
77
|
+
* @param {string} file
|
|
78
|
+
*/
|
|
56
79
|
async function vueOutput(source, file) {
|
|
57
80
|
const { descriptor, errors } = parse(source, { filename: file });
|
|
58
81
|
assert.deepEqual(errors, [], `${file}: SFC parse errors`);
|
|
@@ -67,6 +90,7 @@ async function vueOutput(source, file) {
|
|
|
67
90
|
),
|
|
68
91
|
);
|
|
69
92
|
const template = descriptor.template;
|
|
93
|
+
/** @param {boolean} ssr */
|
|
70
94
|
function render(ssr) {
|
|
71
95
|
if (!template) return null;
|
|
72
96
|
const result = compileTemplate({
|
|
@@ -98,6 +122,10 @@ async function vueOutput(source, file) {
|
|
|
98
122
|
};
|
|
99
123
|
}
|
|
100
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @param {string} ref
|
|
127
|
+
* @returns {string[]}
|
|
128
|
+
*/
|
|
101
129
|
function files(ref) {
|
|
102
130
|
const paths =
|
|
103
131
|
ref === "WORKTREE"
|
|
@@ -122,6 +150,7 @@ const before = files(base);
|
|
|
122
150
|
const after = files(head);
|
|
123
151
|
assert.deepEqual(after, before, "Product source file set changed");
|
|
124
152
|
for (const file of before) {
|
|
153
|
+
/** @param {string} ref */
|
|
125
154
|
const compileProduct = (ref) => {
|
|
126
155
|
const source =
|
|
127
156
|
ref === "WORKTREE"
|