@antelopejs/dms 0.12.1 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/data/dbip-country-lite.mmdb +0 -0
- package/data/module-store/catalog.json +0 -6
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/ensure-default-tenant.js +7 -2
- package/dist/utils/ensure-default-tenant.js.map +1 -1
- package/frontend-vue/dms.frontend.ts +2 -0
- package/frontend-vue/layers/dms-auth/app/build/components/AuthFormAlert.vue +1 -1
- package/frontend-vue/layers/dms-auth/app/build/composables/useAuthFormError.ts +11 -14
- package/frontend-vue/layers/dms-auth/app/composables/useOAuthErrorToast.ts +3 -8
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/accounts.vue +3 -2
- package/frontend-vue/layers/dms-core/app/build/composables/api-error.ts +145 -0
- package/frontend-vue/layers/dms-core/app/build/composables/auth/usePermissionPreview.ts +5 -1
- package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +0 -2
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +6 -5
- package/frontend-vue/layers/dms-core/app/composables/useApiError.ts +3 -11
- package/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter.ts +159 -0
- package/frontend-vue/layers/dms-core/app/composables/useFieldErrors.ts +14 -29
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +3 -1
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationInboxDisplay.vue +3 -3
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/profile/ProfilePersonalInfo.vue +4 -4
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecurityEmail.vue +7 -9
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecurityPassword.vue +4 -4
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecuritySessions.vue +6 -7
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/security/SecurityTwoFactor.vue +2 -1
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/profile/useAccountData.ts +14 -34
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +3 -11
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStore.ts +9 -0
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleStoreActions.ts +13 -28
- package/frontend-vue/layers/dms-layout/app/custom-pages/modules-store.vue +2 -2
- package/frontend-vue/layers/dms-layout/app/custom-pages/settings/roles.vue +5 -2
- package/frontend-vue/layers/dms-layout/app/plugins/command-palette-session.client.ts +4 -4
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +0 -4
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +0 -4
- package/frontend-vue/layers/dms-ui/app/build/components/blocks/BlockStatus.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRequests.ts +6 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/chart/groupPoints.ts +13 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/actionError.ts +10 -139
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/useActionConfirm.ts +2 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/form/formState.ts +2 -12
- package/frontend-vue/layers/dms-ui/app/build/composables/table/useTableConfigClipboard.ts +7 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionBulkRequests.ts +11 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +1 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewGrouping.ts +7 -10
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useExpandedRowDetails.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableRecordLink.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableViewRowActions.ts +7 -18
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/recordLink.ts +3 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/writeError.ts +9 -5
- package/frontend-vue/layers/dms-ui/app/build/utils/fetchNotFound.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +6 -1
- package/frontend-vue/layers/dms-ui/app/components/blocks/BannerBlock.vue +3 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ChartCard.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/confirm/ConfirmModal.vue +24 -19
- package/frontend-vue/layers/dms-ui/app/components/form/components/Cascader.vue +2 -6
- package/frontend-vue/layers/dms-ui/app/components/form/components/File.vue +6 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/Image.vue +5 -1
- package/frontend-vue/layers/dms-ui/app/components/form/components/ImagePresentation.vue +2 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputAddress.vue +2 -6
- package/frontend-vue/layers/dms-ui/app/components/form/components/Relation.vue +2 -6
- package/frontend-vue/layers/dms-ui/app/components/form/components/imageItems.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/components/guard/Guard.vue +2 -1
- package/frontend-vue/layers/dms-ui/app/components/table-view/KanbanBoard.vue +13 -11
- package/frontend-vue/layers/dms-ui/app/composables/confirm/types.ts +6 -6
- package/frontend-vue/layers/dms-ui/app/composables/form/useForm.ts +14 -25
- package/frontend-vue/layers/dms-ui/app/composables/global/keyboardPlatform.ts +36 -9
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +13 -59
- package/frontend-vue/layers/dms-ui/app/plugins/kbd-platform.ts +13 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +1 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +1 -0
- package/frontend-vue/package.json +1 -3
- package/frontend-vue/scripts/check-api-error-presentation.mjs +248 -0
- package/frontend-vue/scripts/check-invariants.mjs +23 -0
- package/frontend-vue/scripts/codemods/api-error-presenter.mjs +196 -0
- package/frontend-vue/scripts/test-api-error-presentation.mjs +134 -0
- package/package.json +10 -4
- package/skills/dms-module/REFERENCE.md +3 -1
- package/skills/dms-module/SKILL.md +7 -2
- package/skills/dms-project/SKILL.md +9 -3
- package/frontend-vue/layers/dms-core/app/composables/useReadOnlyRefusal.ts +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.13.1
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.13.0...v0.13.1)
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **frontend:** Run the API error CLIs when pnpm links the package ([#634](https://github.com/AntelopeJS/dms/pull/634))
|
|
10
|
+
|
|
11
|
+
### ❤️ Contributors
|
|
12
|
+
|
|
13
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
14
|
+
|
|
15
|
+
## v0.13.0
|
|
16
|
+
|
|
17
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.12.1...v0.13.0)
|
|
18
|
+
|
|
19
|
+
### 🩹 Fixes
|
|
20
|
+
|
|
21
|
+
- **chart:** Draw only the fetched series that carry their points ([#587](https://github.com/AntelopeJS/dms/pull/587))
|
|
22
|
+
- **store:** Remove the archived CI/CD module from the catalog ([#609](https://github.com/AntelopeJS/dms/pull/609))
|
|
23
|
+
- **tenants:** Resume the default tenant's provisioning after start ([#613](https://github.com/AntelopeJS/dms/pull/613))
|
|
24
|
+
- **dms-ui:** Hydrate keyboard hints with the platform the server rendered ([#442](https://github.com/AntelopeJS/dms/pull/442))
|
|
25
|
+
- **dms-ui:** Print Nuxt UI key hints for the dashboard's keyboard platform ([#541](https://github.com/AntelopeJS/dms/pull/541))
|
|
26
|
+
- **playground:** Declare the playground's frontend, so dev and production include it ([#441](https://github.com/AntelopeJS/dms/pull/441))
|
|
27
|
+
- **frontend:** Unify API error presentation ([#614](https://github.com/AntelopeJS/dms/pull/614))
|
|
28
|
+
|
|
29
|
+
### 📖 Documentation
|
|
30
|
+
|
|
31
|
+
- **readme:** Restore the realtime updates line and the live preview wording ([#589](https://github.com/AntelopeJS/dms/pull/589))
|
|
32
|
+
- **readme:** Remove the How AntelopeJS makes money section ([#592](https://github.com/AntelopeJS/dms/pull/592))
|
|
33
|
+
|
|
34
|
+
### 🏡 Chore
|
|
35
|
+
|
|
36
|
+
- **release:** @antelopejs/interface-dms v0.10.2 ([7b173edb](https://github.com/AntelopeJS/dms/commit/7b173edb))
|
|
37
|
+
|
|
38
|
+
### ❤️ Contributors
|
|
39
|
+
|
|
40
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
41
|
+
- Alessandro Aloisio ([@alessaloisio](http://github.com/alessaloisio))
|
|
42
|
+
|
|
3
43
|
## v0.12.1
|
|
4
44
|
|
|
5
45
|
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.12.0...v0.12.1)
|
|
Binary file
|
|
@@ -25,12 +25,6 @@
|
|
|
25
25
|
"icon": "i-ph-hammer",
|
|
26
26
|
"category": "developer"
|
|
27
27
|
},
|
|
28
|
-
{
|
|
29
|
-
"id": "cicd",
|
|
30
|
-
"package": "@antelopejs-private/dms-cicd",
|
|
31
|
-
"icon": "i-ph-rocket-launch",
|
|
32
|
-
"category": "operations"
|
|
33
|
-
},
|
|
34
28
|
{
|
|
35
29
|
"id": "database",
|
|
36
30
|
"package": "@antelopejs/dms-database",
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ exports.start = start;
|
|
|
42
42
|
exports.stop = stop;
|
|
43
43
|
const interface_core_1 = require("@antelopejs/interface-core");
|
|
44
44
|
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
45
|
+
const modules_1 = require("@antelopejs/interface-core/modules");
|
|
45
46
|
const runtime_1 = require("@antelopejs/interface-core/runtime");
|
|
46
47
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
47
48
|
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
@@ -71,6 +72,7 @@ const utils_1 = require("./utils");
|
|
|
71
72
|
__exportStar(require("./config"), exports);
|
|
72
73
|
let cronTasks = [];
|
|
73
74
|
let staleExportsSweep = Promise.resolve();
|
|
75
|
+
let defaultTenantProvisioning;
|
|
74
76
|
let globalRealtimeConfig;
|
|
75
77
|
async function construct(config) {
|
|
76
78
|
const { dev } = await (0, runtime_1.GetRuntimeInfo)();
|
|
@@ -152,16 +154,21 @@ function destroy() {
|
|
|
152
154
|
cancelDeferredNotifications();
|
|
153
155
|
(0, frontend_1.closeDevReloadStreams)();
|
|
154
156
|
}
|
|
157
|
+
function onModulesStarted() {
|
|
158
|
+
if (defaultTenantProvisioning)
|
|
159
|
+
return;
|
|
160
|
+
defaultTenantProvisioning = (0, utils_1.provisionDefaultTenant)().finally(() => {
|
|
161
|
+
defaultTenantProvisioning = undefined;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
155
164
|
async function start() {
|
|
156
165
|
await (0, client_origin_cors_1.allowClientOrigin)();
|
|
157
166
|
await (0, realtime_1.configureRealtime)(globalRealtimeConfig);
|
|
158
167
|
await (0, interface_database_decorators_1.RegisterSchema)(constants_1.CORE_SCHEMA_NAME);
|
|
159
168
|
await (0, interface_database_decorators_1.RegisterSchema)(constants_1.TENANT_SCHEMA_NAME);
|
|
160
|
-
|
|
169
|
+
await (0, utils_1.ensureDefaultTenantExists)();
|
|
161
170
|
await (0, utils_1.registerExistingTenantInstances)();
|
|
162
171
|
await (0, hooks_1.SettleHook)(hooks_1.Hook.DATABASE_INITIALIZED);
|
|
163
|
-
if (defaultTenantCreated)
|
|
164
|
-
await (0, utils_1.provisionDefaultTenant)();
|
|
165
172
|
staleExportsSweep = (0, crons_1.runSweepStaleExports)().catch((error) => {
|
|
166
173
|
logging_1.Logging.Error(`Cron '${crons_1.SWEEP_STALE_EXPORTS_CRON_NAME}' failed:`, error);
|
|
167
174
|
});
|
|
@@ -172,8 +179,11 @@ async function start() {
|
|
|
172
179
|
await (0, automation_1.registerAutomationNodes)();
|
|
173
180
|
await (0, dev_1.startModuleUpdateWatcher)();
|
|
174
181
|
(0, page_extensions_1.startPendingExtensionReport)();
|
|
182
|
+
modules_1.Events.ModulesStarted.register(onModulesStarted);
|
|
175
183
|
}
|
|
176
184
|
async function stop() {
|
|
185
|
+
modules_1.Events.ModulesStarted.unregister(onModulesStarted);
|
|
186
|
+
await defaultTenantProvisioning;
|
|
177
187
|
await staleExportsSweep;
|
|
178
188
|
(0, hooks_1.UnsettleHook)(hooks_1.Hook.DATABASE_INITIALIZED);
|
|
179
189
|
(0, page_extensions_1.stopPendingExtensionReport)();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,8BAsBC;AA6ID,0BAGC;AASD,sBAqBC;AAED,oBAuBC;AAvTD,+DAAgE;AAChE,gEAA6D;AAC7D,gEAA4D;AAC5D,gEAAoE;AACpE,6FAA2E;AAC3E,mEAG6C;AAC7C,gBAAc;AAGd,sBAAoB;AACpB,sDAAoD;AACpD,mBAAiB;AACjB,oBAAkB;AAClB,2DAIyC;AACzC,yDAAmE;AAEnE,6CAGsB;AACtB,qCAOkB;AAClB,mCAMiB;AACjB,+BAA0E;AAC1E,mCAIiB;AACjB,+CAI0B;AAC1B,6DAA+E;AAC/E,qDAGoC;AACpC,yCAIoB;AACpB,uDAI2B;AAC3B,oDAAiE;AACjE,0CAAwD;AACxD,uDAAmD;AACnD,4DAGiC;AACjC,oEAAgE;AAChE,mCA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ACjC,IAAA,6CAA2B,GAAE,CAAC;IAC9B,gBAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACnD,CAAC;AAEM,KAAK,UAAU,IAAI;IACxB,gBAAM,CAAC,cAAc,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,yBAAyB,CAAC;IAChC,MAAM,iBAAiB,CAAC;IACxB,IAAA,oBAAY,EAAC,YAAI,CAAC,oBAAoB,CAAC,CAAC;IACxC,IAAA,4CAA0B,GAAE,CAAC;IAC7B,MAAM,IAAA,6BAAuB,GAAE,CAAC;IAChC,MAAM,IAAA,sCAAyB,GAAE,CAAC;IAClC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,UAAU,CACxC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAC9C,CAAC;QACF,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,IAAI,QAAQ,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACnC,iBAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,SAAS,GAAG,EAAE,CAAC;QACf,MAAM,IAAA,uBAAY,GAAE,CAAC;QACrB,2BAA2B,EAAE,CAAC;QAC9B,IAAA,gCAAqB,GAAE,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -12,6 +12,7 @@ function buildDefaultTenant() {
|
|
|
12
12
|
return {
|
|
13
13
|
_id: constants_1.DEFAULT_TENANT_ID,
|
|
14
14
|
name: constants_1.DEFAULT_TENANT_NAME,
|
|
15
|
+
provisioningPending: true,
|
|
15
16
|
createdAt: now,
|
|
16
17
|
updatedAt: now,
|
|
17
18
|
};
|
|
@@ -29,11 +30,15 @@ async function ensureDefaultTenantExists() {
|
|
|
29
30
|
}
|
|
30
31
|
async function provisionDefaultTenant() {
|
|
31
32
|
try {
|
|
33
|
+
const tenants = (0, interface_database_decorators_1.GetModel)(db_1.TenantModel);
|
|
34
|
+
const tenant = await tenants.get(constants_1.DEFAULT_TENANT_ID);
|
|
35
|
+
if (!tenant?.provisioningPending)
|
|
36
|
+
return;
|
|
32
37
|
await (0, tenant_provisioning_1.ProvisionTenant)({ tenantId: constants_1.DEFAULT_TENANT_ID, extras: {} });
|
|
38
|
+
await tenants.update(constants_1.DEFAULT_TENANT_ID, { provisioningPending: false });
|
|
33
39
|
}
|
|
34
40
|
catch (error) {
|
|
35
|
-
|
|
36
|
-
throw error;
|
|
41
|
+
logging_1.Logging.Error(`Default tenant '${constants_1.DEFAULT_TENANT_ID}' provisioning failed:`, error);
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
//# sourceMappingURL=ensure-default-tenant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-default-tenant.js","sourceRoot":"","sources":["../../src/utils/ensure-default-tenant.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ensure-default-tenant.js","sourceRoot":"","sources":["../../src/utils/ensure-default-tenant.ts"],"names":[],"mappings":";;AA0BA,8DAWC;AAUD,wDAcC;AA7DD,gEAA6D;AAC7D,6FAAqE;AACrE,mEAG6C;AAC7C,qDAAwE;AACxE,uFAAgF;AAEhF,SAAS,kBAAkB;IACzB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,OAAO;QACL,GAAG,EAAE,6BAAiB;QACtB,IAAI,EAAE,+BAAmB;QACzB,mBAAmB,EAAE,IAAI;QACzB,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,GAAG;KACf,CAAC;AACJ,CAAC;AAQM,KAAK,UAAU,yBAAyB;IAC7C,MAAM,OAAO,GAAG,IAAA,wCAAQ,EAAC,gBAAW,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,6BAAiB,CAAC,CAAC;IACtD,IAAI,QAAQ,EAAE,CAAC;QACb,iBAAO,CAAC,IAAI,CAAC,mBAAmB,6BAAiB,mBAAmB,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC3C,iBAAO,CAAC,IAAI,CAAC,mBAAmB,6BAAiB,YAAY,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC;AACd,CAAC;AAUM,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,wCAAQ,EAAC,gBAAW,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,6BAAiB,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,EAAE,mBAAmB;YAAE,OAAO;QAEzC,MAAM,IAAA,qCAAe,EAAC,EAAE,QAAQ,EAAE,6BAAiB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACnE,MAAM,OAAO,CAAC,MAAM,CAAC,6BAAiB,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAO,CAAC,KAAK,CACX,mBAAmB,6BAAiB,wBAAwB,EAC5D,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -27,6 +27,7 @@ import livePauseSourcePlugin from "./layers/dms-ui/app/plugins/live-pause-source
|
|
|
27
27
|
import onboardingMiddleware from "./layers/dms-onboarding/app/middleware/onboarding.global";
|
|
28
28
|
import onboardingPreloadPlugin from "./layers/dms-onboarding/app/plugins/onboarding-preload";
|
|
29
29
|
import closingLayersPlugin from "./layers/dms-ui/app/plugins/closing-layers.client";
|
|
30
|
+
import kbdPlatformPlugin from "./layers/dms-ui/app/plugins/kbd-platform";
|
|
30
31
|
import registerPlugin from "./layers/dms-ui/app/plugins/register";
|
|
31
32
|
import shortcutsPlugin from "./layers/dms-ui/app/plugins/shortcuts";
|
|
32
33
|
import tableViewDisplaysPlugin from "./layers/dms-ui/app/plugins/table-view-displays";
|
|
@@ -200,6 +201,7 @@ function registerPlugins(sdk: Parameters<DmsFrontendModule["setup"]>[0]): void {
|
|
|
200
201
|
sdk.registerPlugin(closingLayersPlugin, clientOnly);
|
|
201
202
|
sdk.registerPlugin(registerPlugin);
|
|
202
203
|
sdk.registerPlugin(shortcutsPlugin);
|
|
204
|
+
sdk.registerPlugin(kbdPlatformPlugin);
|
|
203
205
|
sdk.registerPlugin(tableViewDisplaysPlugin);
|
|
204
206
|
registerDeferredPlugins(sdk);
|
|
205
207
|
}
|
|
@@ -5,14 +5,11 @@ import {
|
|
|
5
5
|
resolveFieldErrors,
|
|
6
6
|
} from "#dms-core/app/composables/useFieldErrors";
|
|
7
7
|
import { resolveApiErrorMessage } from "#dms-core/app/composables/useApiError";
|
|
8
|
-
import {
|
|
9
|
-
type I18nTranslate,
|
|
10
|
-
resolveApiMessage,
|
|
11
|
-
} from "#dms-core/app/composables/translation/useTranslation";
|
|
12
8
|
|
|
13
9
|
export interface AuthFormError {
|
|
14
10
|
title: string;
|
|
15
11
|
description: string;
|
|
12
|
+
severity: ApiErrorSeverity;
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
/** What an auth page's `UForm` exposes that a field error needs. */
|
|
@@ -42,20 +39,17 @@ export interface AuthFieldErrorTarget {
|
|
|
42
39
|
* after an `await` without the i18n context.
|
|
43
40
|
*/
|
|
44
41
|
export function useAuthFormError() {
|
|
45
|
-
const
|
|
46
|
-
const { t } = useI18n();
|
|
47
|
-
const translate: I18nTranslate = (key, params = {}) => t(key, params);
|
|
42
|
+
const { resolveError } = useApiErrorPresenter();
|
|
48
43
|
const formError = ref<AuthFormError | null>(null);
|
|
49
44
|
|
|
50
45
|
function showFormError(
|
|
51
46
|
error: Parameters<typeof resolveApiErrorMessage>[0],
|
|
52
47
|
titleKey: string,
|
|
53
48
|
): void {
|
|
54
|
-
|
|
55
|
-
formError.value =
|
|
56
|
-
title:
|
|
57
|
-
|
|
58
|
-
};
|
|
49
|
+
const notice = resolveError(error, { fallbackKey: titleKey });
|
|
50
|
+
formError.value = notice
|
|
51
|
+
? { title: notice.message, description: "", severity: notice.severity }
|
|
52
|
+
: null;
|
|
59
53
|
}
|
|
60
54
|
|
|
61
55
|
function clearFormError(): void {
|
|
@@ -83,7 +77,6 @@ export function useAuthFormError() {
|
|
|
83
77
|
titleKey: string,
|
|
84
78
|
target: AuthFieldErrorTarget,
|
|
85
79
|
): Promise<boolean> {
|
|
86
|
-
if (consumeReadOnlyRefusal(error)) return false;
|
|
87
80
|
const { fields } = resolveFieldErrors(error, {
|
|
88
81
|
fields: target.fields,
|
|
89
82
|
codes: target.codes,
|
|
@@ -96,7 +89,11 @@ export function useAuthFormError() {
|
|
|
96
89
|
clearFormError();
|
|
97
90
|
const messages = fields.map((entry) => ({
|
|
98
91
|
name: entry.field,
|
|
99
|
-
message:
|
|
92
|
+
message:
|
|
93
|
+
resolveError(entry.message, {
|
|
94
|
+
fallbackKey: entry.fallbackKey ?? "dms.field_errors.invalid",
|
|
95
|
+
params: entry.params,
|
|
96
|
+
})?.message ?? "",
|
|
100
97
|
}));
|
|
101
98
|
if (target.show) {
|
|
102
99
|
for (const { name, message } of messages) target.show(name, message);
|
|
@@ -16,14 +16,13 @@ const FALLBACK_ERROR_KEY = "error.oauth.failed";
|
|
|
16
16
|
export function useOAuthErrorToast(): void {
|
|
17
17
|
const route = useDmsRoute();
|
|
18
18
|
const router = useDmsRouter();
|
|
19
|
-
const
|
|
20
|
-
const { t, te } = useI18n();
|
|
19
|
+
const { presentError } = useApiErrorPresenter();
|
|
21
20
|
|
|
22
21
|
function toErrorMessageKey(
|
|
23
22
|
value: ReturnType<typeof useDmsRoute>["query"][string],
|
|
24
23
|
): string | undefined {
|
|
25
24
|
if (!isString(value) || !value) return undefined;
|
|
26
|
-
if (value.startsWith(ERROR_KEY_PREFIX)
|
|
25
|
+
if (value.startsWith(ERROR_KEY_PREFIX)) return value;
|
|
27
26
|
return FALLBACK_ERROR_KEY;
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -31,11 +30,7 @@ export function useOAuthErrorToast(): void {
|
|
|
31
30
|
const messageKey = toErrorMessageKey(route.query[OAUTH_ERROR_QUERY]);
|
|
32
31
|
if (!messageKey) return;
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
title: t("page.auth.error_title"),
|
|
36
|
-
description: t(messageKey),
|
|
37
|
-
color: "error",
|
|
38
|
-
});
|
|
33
|
+
presentError(messageKey, { fallbackKey: FALLBACK_ERROR_KEY });
|
|
39
34
|
|
|
40
35
|
const { [OAUTH_ERROR_QUERY]: _consumed, ...query } = route.query;
|
|
41
36
|
void router.replace({ query });
|
|
@@ -9,6 +9,7 @@ const ACCOUNT_SKELETON_ROWS = 2;
|
|
|
9
9
|
|
|
10
10
|
const { t } = useI18n();
|
|
11
11
|
const toast = useToast();
|
|
12
|
+
const { presentError } = useApiErrorPresenter();
|
|
12
13
|
const homepage = useHomepage();
|
|
13
14
|
const {
|
|
14
15
|
accounts,
|
|
@@ -49,8 +50,8 @@ async function handleSwitchAccount(userId: string) {
|
|
|
49
50
|
|
|
50
51
|
await navigateDms(homepage);
|
|
51
52
|
} catch (error: unknown) {
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
presentError(error, {
|
|
54
|
+
fallbackKey: "error.switch_account_failed",
|
|
54
55
|
});
|
|
55
56
|
} finally {
|
|
56
57
|
loading.value = null;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { toRaw } from "vue";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type {
|
|
4
|
+
ApiErrorParams,
|
|
5
|
+
ApiErrorSeverity,
|
|
6
|
+
} from "../../composables/useApiErrorPresenter";
|
|
7
|
+
|
|
8
|
+
const MAX_DEPTH = 8;
|
|
9
|
+
const HTTP_FAILURE_MIN = 400;
|
|
10
|
+
const HTTP_CLIENT_MAX = 499;
|
|
11
|
+
const HTTP_STATUS_MAX = 599;
|
|
12
|
+
const statusSchema = z
|
|
13
|
+
.number()
|
|
14
|
+
.int()
|
|
15
|
+
.min(HTTP_FAILURE_MIN)
|
|
16
|
+
.max(HTTP_STATUS_MAX);
|
|
17
|
+
const severitySchema = z.enum(["info", "warning", "error"]);
|
|
18
|
+
const paramsSchema = z.record(z.union([z.string(), z.number(), z.boolean()]));
|
|
19
|
+
const recordSchema = z.object({
|
|
20
|
+
cause: z.unknown().optional(),
|
|
21
|
+
response: z.unknown().optional(),
|
|
22
|
+
data: z.unknown().optional(),
|
|
23
|
+
_data: z.unknown().optional(),
|
|
24
|
+
message: z.unknown().optional(),
|
|
25
|
+
name: z.unknown().optional(),
|
|
26
|
+
severity: z.unknown().optional(),
|
|
27
|
+
params: z.unknown().optional(),
|
|
28
|
+
status: z.unknown().optional(),
|
|
29
|
+
statusCode: z.unknown().optional(),
|
|
30
|
+
body: z.unknown().optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
interface DecodedBody {
|
|
34
|
+
key?: string;
|
|
35
|
+
params?: ApiErrorParams;
|
|
36
|
+
severity?: ApiErrorSeverity;
|
|
37
|
+
status?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export interface DecodedApiFailure {
|
|
42
|
+
cancelled: boolean;
|
|
43
|
+
identity: object | null;
|
|
44
|
+
key?: string;
|
|
45
|
+
params?: ApiErrorParams;
|
|
46
|
+
severity: ApiErrorSeverity;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function record(value: unknown) {
|
|
50
|
+
return recordSchema.safeParse(value).data;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function decodeBody(input: unknown): DecodedBody {
|
|
54
|
+
let value = input;
|
|
55
|
+
let status: number | undefined;
|
|
56
|
+
const seen = new Set<unknown>();
|
|
57
|
+
for (let depth = 0; depth < MAX_DEPTH; depth++) {
|
|
58
|
+
if (seen.has(value)) return { status };
|
|
59
|
+
seen.add(value);
|
|
60
|
+
if (typeof value === "string") {
|
|
61
|
+
const text = value;
|
|
62
|
+
try {
|
|
63
|
+
const parsed: unknown = JSON.parse(text);
|
|
64
|
+
value = parsed;
|
|
65
|
+
continue;
|
|
66
|
+
} catch {
|
|
67
|
+
return { key: text, status };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const body = record(value);
|
|
71
|
+
if (!body) return { status };
|
|
72
|
+
const envelopeStatus = statusSchema.safeParse(body.status).data;
|
|
73
|
+
if (envelopeStatus !== undefined && body.body !== undefined) {
|
|
74
|
+
status ??= envelopeStatus;
|
|
75
|
+
value = body.body;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
key: z.string().safeParse(body.message).data,
|
|
80
|
+
severity: severitySchema.safeParse(body.severity).data,
|
|
81
|
+
params: paramsSchema.safeParse(body.params).data,
|
|
82
|
+
status,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return { status };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** @internal */
|
|
89
|
+
export function decodeApiFailure(error: unknown): DecodedApiFailure {
|
|
90
|
+
let current = error;
|
|
91
|
+
let identity: object | null = null;
|
|
92
|
+
let request: DecodedBody | undefined;
|
|
93
|
+
let local: unknown = error;
|
|
94
|
+
let status: number | undefined;
|
|
95
|
+
let cancelled = false;
|
|
96
|
+
let hasFailedResponse = false;
|
|
97
|
+
let params: ApiErrorParams | undefined;
|
|
98
|
+
const seen = new Set<unknown>();
|
|
99
|
+
for (let depth = 0; depth < MAX_DEPTH && !seen.has(current); depth++) {
|
|
100
|
+
seen.add(current);
|
|
101
|
+
const entry = record(current);
|
|
102
|
+
if (!entry) {
|
|
103
|
+
local = current;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
if (current !== null && typeof current === "object")
|
|
107
|
+
identity = toRaw(current);
|
|
108
|
+
local = entry.message;
|
|
109
|
+
params ??= paramsSchema.safeParse(entry.params).data;
|
|
110
|
+
cancelled ||= entry.name === "AbortError";
|
|
111
|
+
const response = record(entry.response);
|
|
112
|
+
const responseStatus = statusSchema.safeParse(response?.status).data;
|
|
113
|
+
const entryStatus =
|
|
114
|
+
responseStatus ??
|
|
115
|
+
statusSchema.safeParse(entry.statusCode ?? entry.status).data;
|
|
116
|
+
if (
|
|
117
|
+
entry.response &&
|
|
118
|
+
responseStatus !== undefined &&
|
|
119
|
+
typeof entry.response === "object"
|
|
120
|
+
) {
|
|
121
|
+
identity = toRaw(entry.response);
|
|
122
|
+
request = decodeBody(entry.data ?? response?._data);
|
|
123
|
+
status = responseStatus;
|
|
124
|
+
hasFailedResponse = true;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (entry.data !== undefined || entryStatus !== undefined) {
|
|
128
|
+
request = decodeBody(entry.data);
|
|
129
|
+
status = entryStatus;
|
|
130
|
+
}
|
|
131
|
+
if (entry.cause === undefined) break;
|
|
132
|
+
current = entry.cause;
|
|
133
|
+
}
|
|
134
|
+
const body = request ?? decodeBody(local);
|
|
135
|
+
status ??= body.status;
|
|
136
|
+
return {
|
|
137
|
+
cancelled: cancelled && !hasFailedResponse,
|
|
138
|
+
identity,
|
|
139
|
+
key: body.key,
|
|
140
|
+
params: { ...params, ...body.params },
|
|
141
|
+
severity:
|
|
142
|
+
body.severity ??
|
|
143
|
+
(status !== undefined && status <= HTTP_CLIENT_MAX ? "warning" : "error"),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
@@ -155,6 +155,7 @@ function createPreviewSharing() {
|
|
|
155
155
|
*/
|
|
156
156
|
export function usePermissionPreview() {
|
|
157
157
|
const state = usePreviewState();
|
|
158
|
+
const { presentError } = useApiErrorPresenter();
|
|
158
159
|
const isActive = computed(() => state.session.value !== null);
|
|
159
160
|
const hiddenEntries = computed(
|
|
160
161
|
() => new Set(state.result.value?.hiddenEntries ?? []),
|
|
@@ -249,9 +250,12 @@ export function usePermissionPreview() {
|
|
|
249
250
|
if (current !== refreshGeneration) return;
|
|
250
251
|
state.result.value = result;
|
|
251
252
|
state.failed.value = false;
|
|
252
|
-
} catch {
|
|
253
|
+
} catch (error) {
|
|
253
254
|
if (current !== refreshGeneration) return;
|
|
254
255
|
state.failed.value = true;
|
|
256
|
+
presentError(error, {
|
|
257
|
+
fallbackKey: "page.settings.roles.preview.failed",
|
|
258
|
+
});
|
|
255
259
|
} finally {
|
|
256
260
|
if (current === refreshGeneration) state.loading.value = false;
|
|
257
261
|
}
|
|
@@ -42,7 +42,6 @@ export const useAuthFetch = () => {
|
|
|
42
42
|
useSessionRecovery();
|
|
43
43
|
const config = useDmsRuntimeConfig();
|
|
44
44
|
const dmsApp = useDmsApp();
|
|
45
|
-
const consumeReadOnlyRefusal = useReadOnlyRefusal();
|
|
46
45
|
|
|
47
46
|
const realtimeSessionId = useDmsState<string | undefined>(
|
|
48
47
|
REALTIME_SESSION_STATE_KEY,
|
|
@@ -60,7 +59,6 @@ export const useAuthFetch = () => {
|
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
61
|
async onResponseError({ response, options }) {
|
|
63
|
-
if (consumeReadOnlyRefusal({ response })) return;
|
|
64
62
|
if (response.status !== HTTP_UNAUTHORIZED) {
|
|
65
63
|
return;
|
|
66
64
|
}
|
|
@@ -209,18 +209,19 @@ const useSiteLayoutRequests = () => {
|
|
|
209
209
|
const { pageLayoutPromises, loadingPromise } =
|
|
210
210
|
useSiteLayoutRequestsInFlight();
|
|
211
211
|
|
|
212
|
-
const
|
|
213
|
-
const UNKNOWN_SITE_LAYOUT_ERROR = "Unknown error loading siteLayout";
|
|
212
|
+
const { resolveError } = useApiErrorPresenter();
|
|
214
213
|
const HTTP_INTERNAL_ERROR = 500;
|
|
215
214
|
|
|
216
215
|
// oxlint-disable-next-line anti-slop/no-unknown-parameters -- Fetch rejection values have no shared owner schema; an Error-only input would exclude malformed thrown values that intentionally use the fallback message.
|
|
217
216
|
const handleSiteLayoutError = (error: unknown) => {
|
|
218
|
-
const errorMessage =
|
|
219
|
-
|
|
217
|
+
const errorMessage = resolveError(error, {
|
|
218
|
+
fallbackKey: "error.500.description",
|
|
219
|
+
})?.message;
|
|
220
|
+
if (!errorMessage) return;
|
|
220
221
|
loadingError.value = errorMessage;
|
|
221
222
|
showDmsError({
|
|
222
223
|
statusCode: HTTP_INTERNAL_ERROR,
|
|
223
|
-
statusMessage:
|
|
224
|
+
statusMessage: errorMessage,
|
|
224
225
|
message: errorMessage,
|
|
225
226
|
});
|
|
226
227
|
};
|
|
@@ -69,20 +69,12 @@ export function resolveApiErrorMessage(
|
|
|
69
69
|
return isApiError(error) ? resolveDescription(error) : FALLBACK_ERROR_KEY;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/** @deprecated Capture useApiErrorPresenter during setup instead. */
|
|
72
73
|
export function useApiError(
|
|
73
74
|
error: Parameters<typeof resolveApiErrorTitle>[0],
|
|
74
75
|
options?: Options,
|
|
75
76
|
) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const { processApiMessage } = getAppTranslation();
|
|
79
|
-
|
|
80
|
-
const title = options?.title || resolveApiErrorTitle(error);
|
|
81
|
-
const description = options?.description || resolveApiErrorMessage(error);
|
|
82
|
-
|
|
83
|
-
toast.add({
|
|
84
|
-
title: processApiMessage(title),
|
|
85
|
-
description: processApiMessage(description),
|
|
86
|
-
color: "error",
|
|
77
|
+
useApiErrorPresenter().presentError(error, {
|
|
78
|
+
fallbackKey: options?.description || options?.title || FALLBACK_ERROR_KEY,
|
|
87
79
|
});
|
|
88
80
|
}
|