@antelopejs/dms 0.25.7-next.1111.gaba637e → 0.25.7

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 (385) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +2 -2
  3. package/data/mockup-spec.schema.json +303 -223
  4. package/dist/implementations/dms-auth/account-emails.js +2 -2
  5. package/dist/implementations/dms-auth/account-emails.js.map +1 -1
  6. package/dist/implementations/dms-auth/index.js +1 -2
  7. package/dist/implementations/dms-auth/index.js.map +1 -1
  8. package/dist/implementations/dms-base/group-order.d.ts +18 -0
  9. package/dist/implementations/dms-base/group-order.js +66 -0
  10. package/dist/implementations/dms-base/group-order.js.map +1 -0
  11. package/dist/implementations/dms-base/search-route.js +8 -5
  12. package/dist/implementations/dms-base/search-route.js.map +1 -1
  13. package/dist/implementations/dms-builder/engine/cell-displays.js +4 -1
  14. package/dist/implementations/dms-builder/engine/cell-displays.js.map +1 -1
  15. package/dist/implementations/dms-builder/engine/mapped-displays.js +5 -1
  16. package/dist/implementations/dms-builder/engine/mapped-displays.js.map +1 -1
  17. package/dist/implementations/dms-builder/engine/resource-emit.js +4 -0
  18. package/dist/implementations/dms-builder/engine/resource-emit.js.map +1 -1
  19. package/dist/implementations/dms-builder/engine/theme-assets.js +5 -17
  20. package/dist/implementations/dms-builder/engine/theme-assets.js.map +1 -1
  21. package/dist/index.js +0 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/mcp/index.d.ts +0 -1
  24. package/dist/mcp/index.js +0 -5
  25. package/dist/mcp/index.js.map +1 -1
  26. package/dist/mcp/page-verify/index.d.ts +0 -14
  27. package/dist/mcp/page-verify/index.js +5 -9
  28. package/dist/mcp/page-verify/index.js.map +1 -1
  29. package/dist/mcp/page-verify/mockup.d.ts +1 -2
  30. package/dist/mcp/page-verify/mockup.js +0 -1
  31. package/dist/mcp/page-verify/mockup.js.map +1 -1
  32. package/dist/mcp/page-verify/playwright.d.ts +4 -22
  33. package/dist/mcp/page-verify/playwright.js.map +1 -1
  34. package/dist/mcp/tools/mockup-apply-to-page.js +1 -1
  35. package/dist/mcp/tools/mockup-apply-to-page.js.map +1 -1
  36. package/dist/mcp/tools/mockup-patch-spec.js +1 -1
  37. package/dist/mcp/tools/mockup-patch-spec.js.map +1 -1
  38. package/dist/mcp/tools/mockup-read-spec.js +3 -10
  39. package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
  40. package/dist/mcp/tools/mockup-write-spec.js +1 -1
  41. package/dist/mcp/tools/mockup-write-spec.js.map +1 -1
  42. package/dist/mcp/tools/mockup.js +0 -2
  43. package/dist/mcp/tools/mockup.js.map +1 -1
  44. package/dist/mcp/tools/page-verify.d.ts +0 -1
  45. package/dist/mcp/tools/page-verify.js +1 -5
  46. package/dist/mcp/tools/page-verify.js.map +1 -1
  47. package/dist/mockup/apply-notes.d.ts +1 -1
  48. package/dist/mockup/apply-notes.js +2 -1
  49. package/dist/mockup/apply-notes.js.map +1 -1
  50. package/dist/mockup/apply-plan.js +3 -0
  51. package/dist/mockup/apply-plan.js.map +1 -1
  52. package/dist/mockup/{fixture-routes.d.ts → capture-routes.d.ts} +6 -11
  53. package/dist/mockup/capture-routes.js +101 -0
  54. package/dist/mockup/capture-routes.js.map +1 -0
  55. package/dist/mockup/capture.d.ts +10 -0
  56. package/dist/mockup/capture.js +64 -0
  57. package/dist/mockup/capture.js.map +1 -0
  58. package/dist/mockup/compile.d.ts +1 -6
  59. package/dist/mockup/compile.js +25 -29
  60. package/dist/mockup/compile.js.map +1 -1
  61. package/dist/mockup/controller-blocks.js +62 -10
  62. package/dist/mockup/controller-blocks.js.map +1 -1
  63. package/dist/mockup/display-values.js +1 -1
  64. package/dist/mockup/display-values.js.map +1 -1
  65. package/dist/mockup/files.d.ts +2 -2
  66. package/dist/mockup/files.js +2 -2
  67. package/dist/mockup/files.js.map +1 -1
  68. package/dist/mockup/fixture-answers.d.ts +0 -1
  69. package/dist/mockup/fixture-answers.js +1 -1
  70. package/dist/mockup/fixture-answers.js.map +1 -1
  71. package/dist/mockup/fixtures.d.ts +3 -1
  72. package/dist/mockup/fixtures.js +25 -2
  73. package/dist/mockup/fixtures.js.map +1 -1
  74. package/dist/mockup/form-fields.js +10 -1
  75. package/dist/mockup/form-fields.js.map +1 -1
  76. package/dist/mockup/generate.js +1 -4
  77. package/dist/mockup/generate.js.map +1 -1
  78. package/dist/mockup/header-action.d.ts +47 -0
  79. package/dist/mockup/header-action.js +46 -0
  80. package/dist/mockup/header-action.js.map +1 -0
  81. package/dist/mockup/history-routes.js +17 -2
  82. package/dist/mockup/history-routes.js.map +1 -1
  83. package/dist/mockup/index.d.ts +0 -3
  84. package/dist/mockup/index.js +0 -3
  85. package/dist/mockup/index.js.map +1 -1
  86. package/dist/mockup/json-schema-header.d.ts +2 -0
  87. package/dist/mockup/json-schema-header.js +69 -0
  88. package/dist/mockup/json-schema-header.js.map +1 -0
  89. package/dist/mockup/json-schema-layout.d.ts +2 -0
  90. package/dist/mockup/json-schema-layout.js +61 -0
  91. package/dist/mockup/json-schema-layout.js.map +1 -0
  92. package/dist/mockup/json-schema.js +24 -23
  93. package/dist/mockup/json-schema.js.map +1 -1
  94. package/dist/mockup/manage.js +1 -1
  95. package/dist/mockup/manage.js.map +1 -1
  96. package/dist/mockup/model.d.ts +255 -106
  97. package/dist/mockup/model.js +82 -86
  98. package/dist/mockup/model.js.map +1 -1
  99. package/dist/mockup/modules.d.ts +9 -20
  100. package/dist/mockup/modules.js +22 -146
  101. package/dist/mockup/modules.js.map +1 -1
  102. package/dist/mockup/page-links.d.ts +2 -1
  103. package/dist/mockup/page-links.js +14 -3
  104. package/dist/mockup/page-links.js.map +1 -1
  105. package/dist/mockup/refusals.d.ts +1 -4
  106. package/dist/mockup/refusals.js +1 -15
  107. package/dist/mockup/refusals.js.map +1 -1
  108. package/dist/mockup/routes.d.ts +5 -1
  109. package/dist/mockup/routes.js +171 -9
  110. package/dist/mockup/routes.js.map +1 -1
  111. package/dist/mockup/sample-rows.js +4 -0
  112. package/dist/mockup/sample-rows.js.map +1 -1
  113. package/dist/mockup/store.d.ts +2 -1
  114. package/dist/mockup/store.js +22 -16
  115. package/dist/mockup/store.js.map +1 -1
  116. package/dist/mockup/{store-summary.js → summary-fields.js} +1 -1
  117. package/dist/mockup/summary-fields.js.map +1 -0
  118. package/dist/mockup/table-columns.js +9 -3
  119. package/dist/mockup/table-columns.js.map +1 -1
  120. package/dist/mockup/table-options.d.ts +4 -1
  121. package/dist/mockup/table-options.js +40 -2
  122. package/dist/mockup/table-options.js.map +1 -1
  123. package/dist/mockup/table-param-filters.d.ts +52 -0
  124. package/dist/mockup/table-param-filters.js +83 -0
  125. package/dist/mockup/table-param-filters.js.map +1 -0
  126. package/dist/mockup/table-row-actions.d.ts +2 -0
  127. package/dist/mockup/table-row-actions.js +85 -0
  128. package/dist/mockup/table-row-actions.js.map +1 -0
  129. package/dist/mockup/unknown-keys.d.ts +3 -0
  130. package/dist/mockup/unknown-keys.js +45 -0
  131. package/dist/mockup/unknown-keys.js.map +1 -0
  132. package/dist/mockup/validate.d.ts +7 -1
  133. package/dist/mockup/validate.js +76 -3
  134. package/dist/mockup/validate.js.map +1 -1
  135. package/dist/pages/account.d.ts +1 -0
  136. package/dist/pages/account.js +1 -0
  137. package/dist/pages/account.js.map +1 -1
  138. package/dist/pages/settings/overview/account-summary.d.ts +2 -0
  139. package/dist/pages/settings/overview/account-summary.js +17 -8
  140. package/dist/pages/settings/overview/account-summary.js.map +1 -1
  141. package/dist/pages/settings/settings-index.js +2 -1
  142. package/dist/pages/settings/settings-index.js.map +1 -1
  143. package/dist/realtime/sse.js +2 -4
  144. package/dist/realtime/sse.js.map +1 -1
  145. package/dist/store/internal/frontend/dev-reload.js +7 -1
  146. package/dist/store/internal/frontend/dev-reload.js.map +1 -1
  147. package/dist/utils/account-notifications.js +1 -0
  148. package/dist/utils/account-notifications.js.map +1 -1
  149. package/dist/utils/email-change-mail.js +2 -2
  150. package/dist/utils/email-change-mail.js.map +1 -1
  151. package/dist/utils/email-plain-text.d.ts +1 -0
  152. package/dist/utils/email-plain-text.js +95 -0
  153. package/dist/utils/email-plain-text.js.map +1 -0
  154. package/dist/utils/export-jobs.js +2 -2
  155. package/dist/utils/export-jobs.js.map +1 -1
  156. package/dist/utils/html-email.d.ts +8 -0
  157. package/dist/utils/html-email.js +9 -0
  158. package/dist/utils/html-email.js.map +1 -0
  159. package/dist/utils/image-signatures.d.ts +3 -0
  160. package/dist/utils/image-signatures.js +22 -0
  161. package/dist/utils/image-signatures.js.map +1 -0
  162. package/dist/utils/index.d.ts +2 -0
  163. package/dist/utils/index.js +2 -0
  164. package/dist/utils/index.js.map +1 -1
  165. package/dist/utils/sse-keepalive/index.d.ts +3 -0
  166. package/dist/utils/sse-keepalive/index.js +8 -0
  167. package/dist/utils/sse-keepalive/index.js.map +1 -0
  168. package/dist/validation/allowed-keys.d.ts +2 -0
  169. package/dist/validation/allowed-keys.js +16 -0
  170. package/dist/validation/allowed-keys.js.map +1 -0
  171. package/dist/validation/index.d.ts +1 -0
  172. package/dist/validation/index.js +1 -0
  173. package/dist/validation/index.js.map +1 -1
  174. package/frontend-vue/eslint-globals.generated.mjs +2 -2
  175. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/2fa.vue +3 -0
  176. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/backup.vue +3 -0
  177. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot-validation.vue +3 -0
  178. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/forgot.vue +3 -0
  179. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +4 -1
  180. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/recover.vue +3 -0
  181. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/signup.vue +17 -1
  182. package/frontend-vue/layers/dms-auth/app/custom-pages/auth/validate.vue +3 -0
  183. package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +10 -10
  184. package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +8 -0
  185. package/frontend-vue/layers/dms-core/app/build/composables/field-errors.ts +485 -0
  186. package/frontend-vue/layers/dms-core/app/build/composables/useHydrated.ts +27 -0
  187. package/frontend-vue/layers/dms-core/app/composables/data-types/useDataType.ts +3 -2
  188. package/frontend-vue/layers/dms-core/app/composables/translation/useUniqueLocales.ts +23 -5
  189. package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +1 -0
  190. package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +12 -443
  191. package/frontend-vue/layers/dms-core/app/entries/composables/useHydrated.ts +1 -0
  192. package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +8 -0
  193. package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +8 -0
  194. package/frontend-vue/layers/dms-core/shared/types/app-config.ts +2 -0
  195. package/frontend-vue/layers/dms-layout/app/app.config.ts +1 -0
  196. package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardHeader.vue +7 -4
  197. package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +14 -29
  198. package/frontend-vue/layers/dms-layout/app/build/components/layout/EmptyLayoutBrand.vue +49 -0
  199. package/frontend-vue/layers/dms-layout/app/build/components/layout/LayoutFooter.vue +2 -0
  200. package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +6 -21
  201. package/frontend-vue/layers/dms-layout/app/build/components/layout/PreviewPageHeader.vue +19 -3
  202. package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +9 -110
  203. package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +8 -2
  204. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationInboxItem.vue +6 -9
  205. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixCategory.vue +6 -2
  206. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixSubject.vue +27 -22
  207. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationPreferencesForm.vue +8 -10
  208. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/notificationDisplay.ts +39 -3
  209. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +38 -5
  210. package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useProfilePreferences.ts +1 -3
  211. package/frontend-vue/layers/dms-layout/app/build/utils/dev-reload-stream.ts +23 -4
  212. package/frontend-vue/layers/dms-layout/app/custom-layouts/EmptyLayout.vue +39 -31
  213. package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +60 -9
  214. package/frontend-vue/layers/dms-layout/app/entries/components/pages/settings/shell/SettingsShell.ts +2 -0
  215. package/frontend-vue/layers/dms-layout/app/error.vue +1 -1
  216. package/frontend-vue/layers/dms-layout/app/middleware/module-routing.global.ts +7 -1
  217. package/frontend-vue/layers/dms-layout/app/plugins/dms-menu-sync.client.ts +14 -1
  218. package/frontend-vue/layers/dms-layout/app/utils/breadcrumb.ts +13 -0
  219. package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +1 -1
  220. package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +5 -5
  221. package/frontend-vue/layers/dms-onboarding/app/build/components/onboarding/steps/StepPlatform.vue +3 -0
  222. package/frontend-vue/layers/dms-onboarding/app/components/onboarding/steps/StepRegister.vue +3 -1
  223. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +1 -1
  224. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupHeaderActions.vue +1 -4
  225. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupInspector.vue +2 -1
  226. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupIssues.vue +22 -1
  227. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +6 -11
  228. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +125 -182
  229. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewArrows.vue +110 -0
  230. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewFrameImage.vue +75 -0
  231. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +114 -12
  232. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewZoom.vue +67 -0
  233. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +10 -4
  234. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +8 -76
  235. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +9 -65
  236. package/frontend-vue/layers/dms-ui/app/build/components/table-view/ExpandedRowDetail.vue +26 -6
  237. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +247 -0
  238. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCaptureAssets.ts +181 -0
  239. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +8 -8
  240. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewRaster.ts +45 -0
  241. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +46 -6
  242. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +109 -35
  243. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +5 -18
  244. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +4 -1
  245. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +3 -1
  246. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +0 -6
  247. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +137 -0
  248. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +68 -13
  249. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewLinks.ts +17 -7
  250. package/frontend-vue/layers/dms-ui/app/build/composables/confirm/fetchedConfirmDialog.ts +6 -0
  251. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultDisplayComponents.ts +4 -0
  252. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +38 -0
  253. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/registerFieldTypes.ts +69 -3
  254. package/frontend-vue/layers/dms-ui/app/build/composables/data-types/useColumnValueRenderer.ts +20 -7
  255. package/frontend-vue/layers/dms-ui/app/build/composables/form/keyValueRows.ts +36 -0
  256. package/frontend-vue/layers/dms-ui/app/build/composables/form/useInstantForm.ts +4 -0
  257. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +1 -0
  258. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewListing.ts +21 -5
  259. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewSorting.ts +8 -0
  260. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useGroupedRows.ts +32 -4
  261. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableFooter.ts +1 -1
  262. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRows.ts +1 -1
  263. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/displayOptions.ts +16 -2
  264. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/groupedRows.ts +67 -5
  265. package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/tableQuery.ts +5 -0
  266. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCard.vue +73 -48
  267. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +18 -11
  268. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupThumbnail.vue +35 -124
  269. package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +7 -3
  270. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewCapture.ts +96 -0
  271. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +10 -0
  272. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +84 -149
  273. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +61 -0
  274. package/frontend-vue/layers/dms-ui/app/build/utils/dotGrid.ts +37 -0
  275. package/frontend-vue/layers/dms-ui/app/build/utils/legalIdentifier.ts +279 -0
  276. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +43 -72
  277. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +130 -0
  278. package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +8 -92
  279. package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +35 -1
  280. package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +44 -17
  281. package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +3 -14
  282. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +26 -14
  283. package/frontend-vue/layers/dms-ui/app/build/utils/previewHeader.ts +154 -0
  284. package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +149 -0
  285. package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +42 -0
  286. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +56 -6
  287. package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +0 -3
  288. package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +7 -7
  289. package/frontend-vue/layers/dms-ui/app/components/flow-canvas/FlowCanvas.vue +4 -7
  290. package/frontend-vue/layers/dms-ui/app/components/form/components/InputIdentifier.vue +90 -0
  291. package/frontend-vue/layers/dms-ui/app/components/form/components/InputPhone.vue +5 -0
  292. package/frontend-vue/layers/dms-ui/app/components/form/components/KeyValue.vue +2 -20
  293. package/frontend-vue/layers/dms-ui/app/components/key-value-list/KeyValueList.vue +51 -15
  294. package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +3 -8
  295. package/frontend-vue/layers/dms-ui/app/composables/table-view/types/config.ts +10 -0
  296. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/previewCapture.ts +1 -0
  297. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/previewCaptureAssets.ts +1 -0
  298. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePreviewFrame.ts +1 -0
  299. package/frontend-vue/layers/dms-ui/app/entries/composables/table-view/utils/displayOptions.ts +1 -0
  300. package/frontend-vue/layers/dms-ui/app/entries/mockups/manage.ts +1 -0
  301. package/frontend-vue/layers/dms-ui/app/entries/utils/blockPreview.ts +3 -0
  302. package/frontend-vue/layers/dms-ui/app/entries/utils/legalIdentifier.ts +1 -0
  303. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupCaptures.ts +1 -0
  304. package/frontend-vue/layers/dms-ui/app/types/table/query.ts +5 -0
  305. package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +2 -28
  306. package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +12 -38
  307. package/frontend-vue/package.json +3 -3
  308. package/frontend-vue/scripts/check-invariants.mjs +101 -0
  309. package/package.json +9 -8
  310. package/skills/dms/SKILL.md +4 -2
  311. package/skills/dms-module/SKILL.md +3 -0
  312. package/dist/mcp/mockup-export/capture.d.ts +0 -15
  313. package/dist/mcp/mockup-export/capture.js +0 -97
  314. package/dist/mcp/mockup-export/capture.js.map +0 -1
  315. package/dist/mcp/mockup-export/document.d.ts +0 -4
  316. package/dist/mcp/mockup-export/document.js +0 -199
  317. package/dist/mcp/mockup-export/document.js.map +0 -1
  318. package/dist/mcp/mockup-export/index.d.ts +0 -23
  319. package/dist/mcp/mockup-export/index.js +0 -90
  320. package/dist/mcp/mockup-export/index.js.map +0 -1
  321. package/dist/mcp/mockup-export/plan.d.ts +0 -78
  322. package/dist/mcp/mockup-export/plan.js +0 -257
  323. package/dist/mcp/mockup-export/plan.js.map +0 -1
  324. package/dist/mcp/mockup-export/route.d.ts +0 -13
  325. package/dist/mcp/mockup-export/route.js +0 -66
  326. package/dist/mcp/mockup-export/route.js.map +0 -1
  327. package/dist/mcp/tools/mockup-export-pdf.d.ts +0 -1
  328. package/dist/mcp/tools/mockup-export-pdf.js +0 -71
  329. package/dist/mcp/tools/mockup-export-pdf.js.map +0 -1
  330. package/dist/mockup/database-manifest.d.ts +0 -2
  331. package/dist/mockup/database-manifest.js +0 -75
  332. package/dist/mockup/database-manifest.js.map +0 -1
  333. package/dist/mockup/entities.d.ts +0 -20
  334. package/dist/mockup/entities.js +0 -213
  335. package/dist/mockup/entities.js.map +0 -1
  336. package/dist/mockup/fixture-routes.js +0 -155
  337. package/dist/mockup/fixture-routes.js.map +0 -1
  338. package/dist/mockup/json-schema-entities.d.ts +0 -5
  339. package/dist/mockup/json-schema-entities.js +0 -141
  340. package/dist/mockup/json-schema-entities.js.map +0 -1
  341. package/dist/mockup/json.d.ts +0 -8
  342. package/dist/mockup/json.js +0 -20
  343. package/dist/mockup/json.js.map +0 -1
  344. package/dist/mockup/manifest-blocks.d.ts +0 -19
  345. package/dist/mockup/manifest-blocks.js +0 -65
  346. package/dist/mockup/manifest-blocks.js.map +0 -1
  347. package/dist/mockup/module-manifests.d.ts +0 -22
  348. package/dist/mockup/module-manifests.js +0 -28
  349. package/dist/mockup/module-manifests.js.map +0 -1
  350. package/dist/mockup/modules-schema.d.ts +0 -2
  351. package/dist/mockup/modules-schema.js +0 -42
  352. package/dist/mockup/modules-schema.js.map +0 -1
  353. package/dist/mockup/saas-manifest.d.ts +0 -2
  354. package/dist/mockup/saas-manifest.js +0 -496
  355. package/dist/mockup/saas-manifest.js.map +0 -1
  356. package/dist/mockup/state.d.ts +0 -76
  357. package/dist/mockup/state.js +0 -22
  358. package/dist/mockup/state.js.map +0 -1
  359. package/dist/mockup/store-summary.js.map +0 -1
  360. package/dist/mockup/tenancy.d.ts +0 -19
  361. package/dist/mockup/tenancy.js +0 -73
  362. package/dist/mockup/tenancy.js.map +0 -1
  363. package/dist/mockup/tenant-rows.d.ts +0 -4
  364. package/dist/mockup/tenant-rows.js +0 -19
  365. package/dist/mockup/tenant-rows.js.map +0 -1
  366. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +0 -165
  367. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +0 -48
  368. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +0 -142
  369. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +0 -175
  370. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +0 -76
  371. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +0 -63
  372. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +0 -119
  373. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +0 -80
  374. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +0 -177
  375. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +0 -151
  376. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +0 -23
  377. package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +0 -15
  378. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +0 -2
  379. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +0 -2
  380. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +0 -1
  381. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +0 -1
  382. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +0 -1
  383. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +0 -1
  384. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +0 -1
  385. /package/dist/mockup/{store-summary.d.ts → summary-fields.d.ts} +0 -0
@@ -1,76 +0,0 @@
1
- import { ref, type Ref } from "vue";
2
- import { mockupEndpoint } from "../../utils/mockup";
3
- import { type MockupTenancy, tenantOf } from "../../utils/mockupTenancy";
4
-
5
- /** What `POST /api/mockup/:name/export.pdf` answers: the PDF. */
6
- interface PdfResponse {
7
- _data?: Blob;
8
- }
9
-
10
- /** Posts the export's options with the user's session (`$authFetch.raw`). */
11
- export type PdfFetch = (
12
- url: string,
13
- options: {
14
- method: "POST";
15
- body: MockupPdfOptions;
16
- responseType: "blob";
17
- },
18
- ) => Promise<PdfResponse>;
19
-
20
- /** The options the viewer exports with: every page, its open annotations, the data model, and the tenant on screen in SaaS mode. */
21
- export interface MockupPdfOptions {
22
- annotations: true;
23
- includeSchema: true;
24
- saasTenant?: string;
25
- }
26
-
27
- interface PdfExportOptions {
28
- name: string;
29
- tenancy: Readonly<Ref<MockupTenancy>>;
30
- fetchRaw: PdfFetch;
31
- /** Saves the file at `url` under `filename`, as the browser downloads it. */
32
- save: (url: string, filename: string) => void;
33
- /** Called when the export fails: the backend refused it, or the browser could not reach it. */
34
- onFailure: (error: Error) => void;
35
- }
36
-
37
- /**
38
- * The viewer's Export PDF button: asks the backend to print the mockup, as
39
- * `mockup_export_pdf` does, and saves the PDF it answers. One export runs at
40
- * a time.
41
- */
42
- export function useMockupPdfExport(options: PdfExportOptions) {
43
- const isExporting = ref(false);
44
-
45
- async function run(): Promise<void> {
46
- if (isExporting.value) return;
47
- isExporting.value = true;
48
- const url = mockupEndpoint(options.name, "/export.pdf");
49
- const tenant = tenantOf(options.tenancy.value);
50
- try {
51
- const response = await options.fetchRaw(url, {
52
- method: "POST",
53
- body: {
54
- annotations: true,
55
- includeSchema: true,
56
- ...(tenant !== undefined && { saasTenant: tenant }),
57
- },
58
- responseType: "blob",
59
- });
60
- const objectUrl = URL.createObjectURL(response._data ?? new Blob([]));
61
- try {
62
- options.save(objectUrl, `${options.name}.pdf`);
63
- } finally {
64
- URL.revokeObjectURL(objectUrl);
65
- }
66
- } catch (error) {
67
- options.onFailure(
68
- error instanceof Error ? error : new Error(String(error)),
69
- );
70
- } finally {
71
- isExporting.value = false;
72
- }
73
- }
74
-
75
- return { isExporting, run };
76
- }
@@ -1,63 +0,0 @@
1
- import { computed, ref, type Ref, watch } from "vue";
2
- import type { MockupModule } from "../../utils/mockup";
3
- import {
4
- activeTenantId,
5
- type MockupTenancy,
6
- SAAS_MODULE_ID,
7
- SINGLE_TENANCY,
8
- } from "../../utils/mockupTenancy";
9
- import type { MockupTenant } from "../../utils/mockupTenants";
10
-
11
- /** What the viewer opens in: SaaS mode, and the tenant it starts on. */
12
- export interface InitialTenancy {
13
- saas?: boolean;
14
- tenant?: string;
15
- }
16
-
17
- /**
18
- * How the viewer shows the mockup: as written, or in SaaS mode, as one
19
- * workspace of the app sees it. SaaS mode is there while the spec lists the
20
- * `saas` module, and the tenant is the one picked, the first of the spec's
21
- * tenants until another is, and the first again once the one picked leaves
22
- * them. The choice is kept in memory, as the Real data one is; the page's
23
- * query gives what it starts as.
24
- */
25
- export function useMockupTenancy(
26
- modules: Readonly<Ref<readonly MockupModule[]>>,
27
- tenants: Readonly<Ref<readonly MockupTenant[] | undefined>>,
28
- initial: InitialTenancy = {},
29
- ) {
30
- const isSaasChosen = ref(initial.saas === true);
31
- const picked = ref(initial.tenant);
32
- const hasSaas = computed(() =>
33
- modules.value.some((module) => module.id === SAAS_MODULE_ID),
34
- );
35
- const active = computed(() =>
36
- activeTenantId(tenants.value ?? [], picked.value),
37
- );
38
- watch(active, (id) => {
39
- picked.value = id;
40
- });
41
- const tenancy = computed<MockupTenancy>(() =>
42
- hasSaas.value && isSaasChosen.value
43
- ? {
44
- mode: "saas",
45
- ...(active.value !== undefined && { tenant: active.value }),
46
- }
47
- : SINGLE_TENANCY,
48
- );
49
- const isSaas = computed({
50
- get: () => tenancy.value.mode === "saas",
51
- set: (isOn: boolean) => {
52
- isSaasChosen.value = isOn;
53
- },
54
- });
55
- return {
56
- hasSaas,
57
- isSaas,
58
- tenancy,
59
- pickTenant: (id: string) => {
60
- picked.value = id;
61
- },
62
- };
63
- }
@@ -1,119 +0,0 @@
1
- import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
2
- import { isMockupTenants, type MockupTenant } from "./mockupTenants";
3
- import { isOptionalString, isRecord } from "./recordGuards";
4
-
5
- /** One entry of the sidebar the preview draws around the blocks. */
6
- export interface PreviewNavigationItem {
7
- id: string;
8
- label: string;
9
- icon?: string;
10
- }
11
-
12
- /** A category of the sidebar: the header its entries are listed under. */
13
- export interface PreviewNavigationCategory {
14
- id: string;
15
- title: string;
16
- icon?: string;
17
- }
18
-
19
- /** A section of the sidebar: a category and its entries, or the default section's entries. */
20
- export interface PreviewNavigationSection {
21
- /** None for the default section, which holds the pages without a category. */
22
- category?: PreviewNavigationCategory;
23
- items: PreviewNavigationItem[];
24
- }
25
-
26
- /**
27
- * A module of the app, a menu root under the app's own menu: its icon and
28
- * title, then its root pages as a section with no category and each of its
29
- * categories with their pages.
30
- */
31
- export interface PreviewNavigationModule {
32
- id: string;
33
- title: string;
34
- icon: string;
35
- sections: PreviewNavigationSection[];
36
- }
37
-
38
- /** How many rows of a tenant-scoped entity the active tenant sees, out of all of them. */
39
- export interface PreviewHiddenRows {
40
- entity: string;
41
- shown: number;
42
- total: number;
43
- }
44
-
45
- /**
46
- * SaaS mode as the sidebar and the banner draw it: the workspaces the
47
- * switcher lists, the id of the active one, and the rows its page hides.
48
- */
49
- export interface PreviewWorkspace {
50
- tenants: MockupTenant[];
51
- active: string;
52
- hidden: PreviewHiddenRows[];
53
- }
54
-
55
- function isHiddenRows(value: unknown): value is PreviewHiddenRows {
56
- return (
57
- isRecord(value) &&
58
- isString(value.entity) &&
59
- isNumber(value.shown) &&
60
- Number.isFinite(value.shown) &&
61
- isNumber(value.total) &&
62
- Number.isFinite(value.total)
63
- );
64
- }
65
-
66
- /** Whether `value` is a workspace a sidebar may carry: its tenants and the rows it hides, each read. */
67
- export function isPreviewWorkspace(value: unknown): value is PreviewWorkspace {
68
- return (
69
- isRecord(value) &&
70
- isMockupTenants(value.tenants) &&
71
- isString(value.active) &&
72
- Array.isArray(value.hidden) &&
73
- value.hidden.every(isHiddenRows)
74
- );
75
- }
76
-
77
- function isNavigationItem(value: unknown): value is PreviewNavigationItem {
78
- return (
79
- isRecord(value) &&
80
- isString(value.id) &&
81
- isString(value.label) &&
82
- isOptionalString(value.icon)
83
- );
84
- }
85
-
86
- function isNavigationCategory(
87
- value: unknown,
88
- ): value is PreviewNavigationCategory {
89
- return (
90
- isRecord(value) &&
91
- isString(value.id) &&
92
- isString(value.title) &&
93
- isOptionalString(value.icon)
94
- );
95
- }
96
-
97
- export function isNavigationSection(
98
- value: unknown,
99
- ): value is PreviewNavigationSection {
100
- return (
101
- isRecord(value) &&
102
- (value.category === undefined || isNavigationCategory(value.category)) &&
103
- Array.isArray(value.items) &&
104
- value.items.every(isNavigationItem)
105
- );
106
- }
107
-
108
- export function isNavigationModule(
109
- value: unknown,
110
- ): value is PreviewNavigationModule {
111
- return (
112
- isRecord(value) &&
113
- isString(value.id) &&
114
- isString(value.title) &&
115
- isString(value.icon) &&
116
- Array.isArray(value.sections) &&
117
- value.sections.every(isNavigationSection)
118
- );
119
- }
@@ -1,80 +0,0 @@
1
- import { isString } from "../../../../dms-core/app/utils/type-check";
2
- import { isJsonObject, type JsonObject } from "./json";
3
- import { isRecord } from "./recordGuards";
4
-
5
- /** The types a field of a spec entity takes. */
6
- export const MOCKUP_FIELD_TYPES = [
7
- "string",
8
- "number",
9
- "price",
10
- "boolean",
11
- "date",
12
- "email",
13
- "url",
14
- "enum",
15
- "ref",
16
- ] as const;
17
-
18
- /** A field type of an entity. */
19
- export type MockupFieldType = (typeof MOCKUP_FIELD_TYPES)[number];
20
-
21
- export interface MockupEntityField {
22
- name: string;
23
- type: MockupFieldType;
24
- /** The entity a `ref` points to; set on a `ref` alone. */
25
- to?: string;
26
- /** The values an `enum` takes, at least one; set on an `enum` alone. */
27
- values?: string[];
28
- }
29
-
30
- /** An entity of the spec's data model: a table of the mockup's database. */
31
- export interface MockupEntityState {
32
- name: string;
33
- tenantScoped?: true;
34
- /** `id` first (declared, else implied `{ name: "id", type: "string" }`), then the declared fields in spec order. */
35
- fields: MockupEntityField[];
36
- /** The rows of every fixture pointing to it, pages in spec order then fixture keys in order; a row whose `id` an earlier row has is dropped. */
37
- rows: JsonObject[];
38
- /** The ids of the pages holding a fixture that points to it, in spec order, each once. */
39
- pages: string[];
40
- }
41
-
42
- function isFieldType(value: unknown): value is MockupFieldType {
43
- const types: readonly unknown[] = MOCKUP_FIELD_TYPES;
44
- return types.includes(value);
45
- }
46
-
47
- function isEnumValues(value: Parameters<typeof isString>[0]): boolean {
48
- return Array.isArray(value) && value.length > 0 && value.every(isString);
49
- }
50
-
51
- /** Whether `value` is a field: a `ref` names its target and an `enum` its values, and no other type carries either. */
52
- function isEntityField(value: unknown): value is MockupEntityField {
53
- if (!isRecord(value) || !isString(value.name) || !isFieldType(value.type)) {
54
- return false;
55
- }
56
- const { type, to, values } = value;
57
- return (
58
- (type === "ref" ? isString(to) : to === undefined) &&
59
- (type === "enum" ? isEnumValues(values) : values === undefined)
60
- );
61
- }
62
-
63
- function isEntity(value: unknown): value is MockupEntityState {
64
- return (
65
- isRecord(value) &&
66
- isString(value.name) &&
67
- (value.tenantScoped === undefined || value.tenantScoped === true) &&
68
- Array.isArray(value.fields) &&
69
- value.fields.every(isEntityField) &&
70
- Array.isArray(value.rows) &&
71
- value.rows.every(isJsonObject) &&
72
- Array.isArray(value.pages) &&
73
- value.pages.every(isString)
74
- );
75
- }
76
-
77
- /** Whether `value` is a list of entities, each field, row and page id of them read. */
78
- export function isMockupEntities(value: unknown): value is MockupEntityState[] {
79
- return Array.isArray(value) && value.every(isEntity);
80
- }
@@ -1,177 +0,0 @@
1
- import type { JsonObject, JsonWritableObject } from "./json";
2
- import type {
3
- MockupEntityField,
4
- MockupEntityState,
5
- MockupFieldType,
6
- } from "./mockupEntities";
7
-
8
- /** The name `@antelopejs/dms-database` registers its schema explorer under. */
9
- export const SCHEMA_EXPLORER_COMPONENT = "DmsDatabaseSchemaExplorer";
10
-
11
- /** The package that registers {@link SCHEMA_EXPLORER_COMPONENT}. */
12
- export const SCHEMA_EXPLORER_PACKAGE = "@antelopejs/dms-database";
13
-
14
- /** The id of the one schema the spec's entities make up. */
15
- export const MOCKUP_SCHEMA_ID = "mockup";
16
-
17
- /** The badge the diagram draws in the header of a tenant-scoped entity's table. */
18
- export const TENANT_SCOPED_BADGE = "Tenant-scoped";
19
-
20
- /** What the explorer needs of the schema's field descriptors, as `@antelopejs/dms-database` declares them. */
21
- export type FieldDescriptor =
22
- | { kind: "string" }
23
- | { kind: "number" }
24
- | { kind: "boolean" }
25
- | { kind: "date" }
26
- | { kind: "literal"; value: string | number | boolean }
27
- | { kind: "union"; members: FieldDescriptor[] }
28
- | { kind: "refinement"; base: FieldDescriptor; name: string };
29
-
30
- export interface RelationDeclaration {
31
- fromField: string;
32
- toSchema: string;
33
- toTable: string;
34
- toField: string;
35
- many: boolean;
36
- }
37
-
38
- export interface TableSummary {
39
- name: string;
40
- fields: Record<string, FieldDescriptor>;
41
- indexes: Record<string, { fields?: string[]; multi?: boolean }>;
42
- relations: RelationDeclaration[];
43
- modifiers?: Record<string, string[]>;
44
- /** Labels the diagram draws in the table's header. */
45
- badges?: string[];
46
- }
47
-
48
- export interface SchemaSummary {
49
- id: string;
50
- options: Record<string, never>;
51
- tables: TableSummary[];
52
- label?: { text: string; color?: string };
53
- stats: { tableCount: number; elementCount: number; instanceCount: number };
54
- instances: string[];
55
- }
56
-
57
- /** Where the explorer reads its schema: the one it is given, with its rows, or the connection it introspects. */
58
- export type SchemaExplorerSource =
59
- | {
60
- kind: "static";
61
- schema: SchemaSummary;
62
- rows: Record<string, JsonObject[]>;
63
- }
64
- | { kind: "connection"; connection: string };
65
-
66
- /** The views of the explorer. */
67
- export type SchemaExplorerView = "diagram" | "data";
68
-
69
- const STRING: FieldDescriptor = { kind: "string" };
70
- const NUMBER: FieldDescriptor = { kind: "number" };
71
-
72
- function refined(base: FieldDescriptor, name: string): FieldDescriptor {
73
- return { kind: "refinement", base, name };
74
- }
75
-
76
- /** The descriptor each field type draws as: an `email`, a `url` and a `price` are refinements of their base, an `enum` is the union of its values, a `ref` the string key it holds. */
77
- const DESCRIBE: Record<
78
- MockupFieldType,
79
- (field: MockupEntityField) => FieldDescriptor
80
- > = {
81
- string: () => STRING,
82
- number: () => NUMBER,
83
- price: () => refined(NUMBER, "price"),
84
- boolean: () => ({ kind: "boolean" }),
85
- date: () => ({ kind: "date" }),
86
- email: () => refined(STRING, "email"),
87
- url: () => refined(STRING, "url"),
88
- enum: (field) => ({
89
- kind: "union",
90
- members: (field.values ?? []).map((value) => ({ kind: "literal", value })),
91
- }),
92
- ref: () => STRING,
93
- };
94
-
95
- function relationOf(
96
- field: MockupEntityField,
97
- known: ReadonlySet<string>,
98
- ): RelationDeclaration[] {
99
- if (field.to === undefined || !known.has(field.to)) return [];
100
- return [
101
- {
102
- fromField: field.name,
103
- toSchema: MOCKUP_SCHEMA_ID,
104
- toTable: field.to,
105
- toField: "id",
106
- many: false,
107
- },
108
- ];
109
- }
110
-
111
- function tableOf(
112
- entity: MockupEntityState,
113
- known: ReadonlySet<string>,
114
- ): TableSummary {
115
- return {
116
- name: entity.name,
117
- fields: Object.fromEntries(
118
- entity.fields.map((field) => [field.name, DESCRIBE[field.type](field)]),
119
- ),
120
- indexes: { id: { fields: ["id"] } },
121
- relations: entity.fields.flatMap((field) => relationOf(field, known)),
122
- ...(entity.tenantScoped && {
123
- badges: [TENANT_SCOPED_BADGE],
124
- }),
125
- };
126
- }
127
-
128
- /**
129
- * The explorer's source for the spec's entities: one table per entity with
130
- * `id` indexed, a relation for each `ref` whose target is an entity, and the
131
- * rows the entities hold, keyed by entity name.
132
- */
133
- export function entitiesSource(
134
- entities: readonly MockupEntityState[],
135
- ): Extract<SchemaExplorerSource, { kind: "static" }> {
136
- const known = new Set(entities.map((entity) => entity.name));
137
- return {
138
- kind: "static",
139
- schema: {
140
- id: MOCKUP_SCHEMA_ID,
141
- options: {},
142
- tables: entities.map((entity) => tableOf(entity, known)),
143
- stats: {
144
- tableCount: entities.length,
145
- elementCount: entities.reduce(
146
- (count, entity) => count + entity.rows.length,
147
- 0,
148
- ),
149
- instanceCount: 0,
150
- },
151
- instances: [],
152
- },
153
- rows: Object.fromEntries(
154
- entities.map((entity) => [entity.name, entity.rows]),
155
- ),
156
- };
157
- }
158
-
159
- /** The entities as `spec.json` writes them once serialized: keyed by name, each field keyed by its name, with `tenantScoped`, `to` and `values` only where they are set. */
160
- export function entitiesSpec(
161
- entities: readonly MockupEntityState[],
162
- ): JsonWritableObject {
163
- return Object.fromEntries(
164
- entities.map((entity) => [
165
- entity.name,
166
- {
167
- tenantScoped: entity.tenantScoped,
168
- fields: Object.fromEntries(
169
- entity.fields.map((field) => [
170
- field.name,
171
- { type: field.type, to: field.to, values: field.values },
172
- ]),
173
- ),
174
- },
175
- ]),
176
- );
177
- }
@@ -1,151 +0,0 @@
1
- import type { PreviewNode } from "./blockPreview";
2
- import type {
3
- PreviewHiddenRows,
4
- PreviewWorkspace,
5
- } from "./blockPreviewNavigation";
6
- import {
7
- isWritableObject,
8
- type JsonWritable,
9
- type JsonWritableObject,
10
- } from "./json";
11
- import { isString } from "../../../../dms-core/app/utils/type-check";
12
- import { mockupEndpoint } from "./mockup";
13
- import type { MockupEntityState } from "./mockupEntities";
14
- import type { MockupTenant } from "./mockupTenants";
15
-
16
- /**
17
- * How the viewer shows the mockup: as written, or as one workspace of a SaaS
18
- * app sees it. `tenant` is the id of that workspace, and is absent when the
19
- * spec lists no tenant.
20
- */
21
- export type MockupTenancy =
22
- { mode: "single" } | { mode: "saas"; tenant?: string };
23
-
24
- /** The id of the module whose presence in a spec turns SaaS mode on. */
25
- export const SAAS_MODULE_ID = "saas";
26
-
27
- export const SINGLE_TENANCY: MockupTenancy = { mode: "single" };
28
-
29
- /** The tenant `tenancy` shows: none in single-tenant mode, and in SaaS mode for a spec that lists no tenant. */
30
- export function tenantOf(tenancy: MockupTenancy): string | undefined {
31
- return tenancy.mode === "saas" ? tenancy.tenant : undefined;
32
- }
33
-
34
- /**
35
- * The tenant SaaS mode shows: `preferred` while the spec still lists it, else
36
- * the first one; undefined when the spec lists none.
37
- */
38
- export function activeTenantId(
39
- tenants: readonly MockupTenant[],
40
- preferred: string | undefined,
41
- ): string | undefined {
42
- return tenants.some((tenant) => tenant.id === preferred)
43
- ? preferred
44
- : tenants[0]?.id;
45
- }
46
-
47
- function scopedFields(
48
- fields: JsonWritableObject,
49
- from: string,
50
- to: string,
51
- ): JsonWritableObject {
52
- return Object.fromEntries(
53
- Object.entries(fields).map(([key, field]) => [
54
- key,
55
- field === undefined ? undefined : scopedJson(field, from, to),
56
- ]),
57
- );
58
- }
59
-
60
- function scopedJson(
61
- value: JsonWritable,
62
- from: string,
63
- to: string,
64
- ): JsonWritable {
65
- if (isString(value)) {
66
- return value.startsWith(from) ? `${to}${value.slice(from.length)}` : value;
67
- }
68
- if (Array.isArray(value)) {
69
- return value.map((item) => scopedJson(item, from, to));
70
- }
71
- return isWritableObject(value) ? scopedFields(value, from, to) : value;
72
- }
73
-
74
- function scopedNode(node: PreviewNode, from: string, to: string): PreviewNode {
75
- return {
76
- ...node,
77
- ...(node.options && { options: scopedFields(node.options, from, to) }),
78
- ...(node.children && {
79
- children: node.children.map((child) => scopedNode(child, from, to)),
80
- }),
81
- };
82
- }
83
-
84
- /**
85
- * `tree` with every string that starts at the mockup's fixture routes,
86
- * `/api/mockup/<name>/pages/`, moved under the tenant's,
87
- * `/api/mockup/<name>/tenants/<tenant>/pages/`, at any depth. What follows
88
- * the prefix, a suffix or a query, stays as it is; any other string stays too.
89
- */
90
- export function withTenantFixtures(
91
- tree: readonly PreviewNode[],
92
- name: string,
93
- tenant: string,
94
- ): PreviewNode[] {
95
- const from = mockupEndpoint(name, "/pages/");
96
- const to = mockupEndpoint(
97
- name,
98
- `/tenants/${encodeURIComponent(tenant)}/pages/`,
99
- );
100
- return tree.map((node) => scopedNode(node, from, to));
101
- }
102
-
103
- /**
104
- * Each tenant-scoped entity the page `page` holds, with the rows of the
105
- * tenant `tenant` it shows out of all its rows; empty for a page that holds
106
- * none.
107
- */
108
- export function hiddenRows(
109
- entities: readonly MockupEntityState[] | undefined,
110
- page: string | undefined,
111
- tenant: string,
112
- ): PreviewHiddenRows[] {
113
- return (entities ?? []).flatMap((entity) =>
114
- entity.tenantScoped === true &&
115
- page !== undefined &&
116
- entity.pages.includes(page)
117
- ? [
118
- {
119
- entity: entity.name,
120
- shown: entity.rows.filter((row) => row.tenantId === tenant).length,
121
- total: entity.rows.length,
122
- },
123
- ]
124
- : [],
125
- );
126
- }
127
-
128
- /**
129
- * What the preview's sidebar and banner draw of SaaS mode: the tenants, the
130
- * active one and the rows hidden on `page`. Undefined in single-tenant mode
131
- * and for a spec that lists no tenant.
132
- */
133
- export function mockupWorkspace(
134
- tenants: readonly MockupTenant[] | undefined,
135
- tenancy: MockupTenancy,
136
- entities: readonly MockupEntityState[] | undefined,
137
- page: string | undefined,
138
- ): PreviewWorkspace | undefined {
139
- if (
140
- tenancy.mode !== "saas" ||
141
- tenancy.tenant === undefined ||
142
- !tenants?.length
143
- ) {
144
- return undefined;
145
- }
146
- return {
147
- tenants: [...tenants],
148
- active: tenancy.tenant,
149
- hidden: hiddenRows(entities, page, tenancy.tenant),
150
- };
151
- }
@@ -1,23 +0,0 @@
1
- import { isString } from "../../../../dms-core/app/utils/type-check";
2
- import { isOptionalString, isRecord } from "./recordGuards";
3
-
4
- /** A workspace of the mockup's SaaS mode: one of `fixtures.tenants` of the spec. */
5
- export interface MockupTenant {
6
- id: string;
7
- name: string;
8
- plan?: string;
9
- }
10
-
11
- function isTenant(value: unknown): value is MockupTenant {
12
- return (
13
- isRecord(value) &&
14
- isString(value.id) &&
15
- isString(value.name) &&
16
- isOptionalString(value.plan)
17
- );
18
- }
19
-
20
- /** Whether `value` is a list of tenants, each read. */
21
- export function isMockupTenants(value: unknown): value is MockupTenant[] {
22
- return Array.isArray(value) && value.every(isTenant);
23
- }