@antelopejs/dms-lang 0.0.6 → 0.1.0
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/README.md +12 -6
- package/dist/pages/actions.d.ts +7 -0
- package/dist/pages/actions.js +15 -0
- package/dist/pages/actions.js.map +1 -0
- package/dist/pages/component-action.d.ts +2 -0
- package/dist/pages/component-action.js +10 -0
- package/dist/pages/component-action.js.map +1 -0
- package/dist/pages/header-actions.d.ts +9 -0
- package/dist/pages/header-actions.js +146 -0
- package/dist/pages/header-actions.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +6 -0
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/language.d.ts +10 -0
- package/dist/pages/language.js +89 -0
- package/dist/pages/language.js.map +1 -0
- package/dist/pages/languages-table.d.ts +2 -0
- package/dist/pages/languages-table.js +120 -0
- package/dist/pages/languages-table.js.map +1 -0
- package/dist/pages/module.d.ts +7 -1
- package/dist/pages/module.js +28 -2
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/overview.d.ts +2 -1
- package/dist/pages/overview.js +83 -8
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/page-actions.d.ts +6 -0
- package/dist/pages/page-actions.js +10 -0
- package/dist/pages/page-actions.js.map +1 -0
- package/dist/pages/quick-actions.d.ts +1 -0
- package/dist/pages/quick-actions.js +56 -0
- package/dist/pages/quick-actions.js.map +1 -0
- package/dist/pages/translations.d.ts +7 -1
- package/dist/pages/translations.js +47 -10
- package/dist/pages/translations.js.map +1 -1
- package/dist/pages/workspace-guard.d.ts +1 -0
- package/dist/pages/workspace-guard.js +35 -0
- package/dist/pages/workspace-guard.js.map +1 -0
- package/dist/pages/workspace.d.ts +18 -0
- package/dist/pages/workspace.js +162 -0
- package/dist/pages/workspace.js.map +1 -0
- package/dist/pages/workspaces.d.ts +14 -0
- package/dist/pages/workspaces.js +88 -0
- package/dist/pages/workspaces.js.map +1 -0
- package/dist/routes/publicLocales.d.ts +3 -2
- package/dist/routes/publicLocales.js +39 -18
- package/dist/routes/publicLocales.js.map +1 -1
- package/dist/routes/translations.d.ts +59 -63
- package/dist/routes/translations.js +400 -119
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/announce.d.ts +9 -0
- package/dist/utils/announce.js +29 -0
- package/dist/utils/announce.js.map +1 -0
- package/dist/utils/blocks.d.ts +8 -0
- package/dist/utils/blocks.js +213 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/body.d.ts +1 -0
- package/dist/utils/body.js +21 -0
- package/dist/utils/body.js.map +1 -0
- package/dist/utils/cache.d.ts +3 -0
- package/dist/utils/cache.js +32 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/catalog.d.ts +7 -0
- package/dist/utils/catalog.js +62 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +10 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/coverage.d.ts +2 -0
- package/dist/utils/coverage.js +11 -0
- package/dist/utils/coverage.js.map +1 -0
- package/dist/utils/dialogs.d.ts +7 -0
- package/dist/utils/dialogs.js +103 -0
- package/dist/utils/dialogs.js.map +1 -0
- package/dist/utils/errors.d.ts +40 -0
- package/dist/utils/errors.js +60 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/export.d.ts +17 -0
- package/dist/utils/export.js +129 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/json.d.ts +10 -1
- package/dist/utils/json.js +127 -19
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/key-stores.d.ts +3 -0
- package/dist/utils/key-stores.js +24 -0
- package/dist/utils/key-stores.js.map +1 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +252 -0
- package/dist/utils/keys.js.map +1 -0
- package/dist/utils/languages.d.ts +27 -0
- package/dist/utils/languages.js +121 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/locale-codes.d.ts +5 -0
- package/dist/utils/locale-codes.js +56 -0
- package/dist/utils/locale-codes.js.map +1 -0
- package/dist/utils/locale-discovery.d.ts +1 -0
- package/dist/utils/locale-discovery.js +19 -1
- package/dist/utils/locale-discovery.js.map +1 -1
- package/dist/utils/message-check.d.ts +1 -0
- package/dist/utils/message-check.js +93 -0
- package/dist/utils/message-check.js.map +1 -0
- package/dist/utils/message-syntax.d.ts +6 -0
- package/dist/utils/message-syntax.js +38 -0
- package/dist/utils/message-syntax.js.map +1 -0
- package/dist/utils/namespaces.d.ts +12 -0
- package/dist/utils/namespaces.js +52 -0
- package/dist/utils/namespaces.js.map +1 -0
- package/dist/utils/notices.d.ts +4 -0
- package/dist/utils/notices.js +60 -0
- package/dist/utils/notices.js.map +1 -0
- package/dist/utils/own.d.ts +2 -3
- package/dist/utils/own.js +17 -57
- package/dist/utils/own.js.map +1 -1
- package/dist/utils/public-url.d.ts +8 -0
- package/dist/utils/public-url.js +87 -0
- package/dist/utils/public-url.js.map +1 -0
- package/dist/utils/registry.d.ts +3 -1
- package/dist/utils/registry.js +26 -10
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/resolve.d.ts +18 -15
- package/dist/utils/resolve.js +98 -151
- package/dist/utils/resolve.js.map +1 -1
- package/dist/utils/review.d.ts +5 -0
- package/dist/utils/review.js +64 -0
- package/dist/utils/review.js.map +1 -0
- package/dist/utils/snippets.d.ts +7 -0
- package/dist/utils/snippets.js +129 -0
- package/dist/utils/snippets.js.map +1 -0
- package/dist/utils/summary.d.ts +23 -0
- package/dist/utils/summary.js +65 -0
- package/dist/utils/summary.js.map +1 -0
- package/dist/utils/tree.d.ts +2 -17
- package/dist/utils/tree.js +21 -126
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/workspaces.d.ts +45 -15
- package/dist/utils/workspaces.js +256 -164
- package/dist/utils/workspaces.js.map +1 -1
- package/dist/validation/key.schema.d.ts +71 -0
- package/dist/validation/key.schema.js +67 -0
- package/dist/validation/key.schema.js.map +1 -0
- package/dist/validation/query.schema.d.ts +17 -0
- package/dist/validation/query.schema.js +44 -0
- package/dist/validation/query.schema.js.map +1 -0
- package/dist/validation/validate.d.ts +2 -0
- package/dist/validation/validate.js +24 -0
- package/dist/validation/validate.js.map +1 -0
- package/dist/validation/workspace.schema.d.ts +145 -0
- package/dist/validation/workspace.schema.js +83 -0
- package/dist/validation/workspace.schema.js.map +1 -0
- package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
- package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
- package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
- package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
- package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
- package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
- package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
- package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
- package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
- package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
- package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
- package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
- package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
- package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
- package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
- package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
- package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
- package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
- package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
- package/frontend-vue/app/components/TranslationQueue.vue +212 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
- package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
- package/frontend-vue/app/components/WorkspaceList.vue +454 -0
- package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
- package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
- package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
- package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
- package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
- package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
- package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
- package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
- package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
- package/frontend-vue/app/types/lang.ts +130 -0
- package/frontend-vue/app/utils/boundedCache.ts +22 -0
- package/frontend-vue/app/utils/download.ts +16 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
- package/frontend-vue/app/utils/keySaves.ts +108 -0
- package/frontend-vue/app/utils/languages.ts +272 -0
- package/frontend-vue/app/utils/matrixExport.ts +47 -0
- package/frontend-vue/app/utils/queueDrafts.ts +115 -0
- package/frontend-vue/app/utils/queuePass.ts +145 -0
- package/frontend-vue/app/utils/queueView.ts +22 -0
- package/frontend-vue/app/utils/shortcuts.ts +75 -0
- package/frontend-vue/app/utils/translations.ts +756 -0
- package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
- package/frontend-vue/app/utils/workspaces.ts +45 -0
- package/frontend-vue/dms.frontend.build.ts +5 -0
- package/frontend-vue/dms.frontend.ts +9 -20
- package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
- package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
- package/frontend-vue/package.json +10 -5
- package/package.json +10 -8
- package/dist/utils/mutations.d.ts +0 -3
- package/dist/utils/mutations.js +0 -35
- package/dist/utils/mutations.js.map +0 -1
- package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
- package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
- package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
- package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
- package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
- package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
- package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
- package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
- package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
- package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
- package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
export interface WorkspaceChange {
|
|
3
|
+
workspace: string;
|
|
4
|
+
actor: User;
|
|
5
|
+
session?: string;
|
|
6
|
+
keys?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const RealtimeSession: () => import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator;
|
|
9
|
+
export declare function announce(change: WorkspaceChange): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RealtimeSession = void 0;
|
|
4
|
+
exports.announce = announce;
|
|
5
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
6
|
+
const realtime_1 = require("@antelopejs/interface-dms/realtime");
|
|
7
|
+
const decorators_1 = require("@antelopejs/interface-core/decorators");
|
|
8
|
+
const module_1 = require("../pages/module");
|
|
9
|
+
const SESSION_HEADER = "x-realtime-session";
|
|
10
|
+
const REALTIME_CHANGE = "changed";
|
|
11
|
+
function sessionOf(context) {
|
|
12
|
+
const value = context.rawRequest.headers[SESSION_HEADER];
|
|
13
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
14
|
+
}
|
|
15
|
+
exports.RealtimeSession = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, index) => {
|
|
16
|
+
(0, interface_api_1.SetParameterProvider)(target, key, index, sessionOf);
|
|
17
|
+
});
|
|
18
|
+
function announce(change) {
|
|
19
|
+
const payload = { workspace: change.workspace };
|
|
20
|
+
if (change.session)
|
|
21
|
+
payload.session = change.session;
|
|
22
|
+
if (change.keys)
|
|
23
|
+
payload.keys = change.keys;
|
|
24
|
+
(0, realtime_1.PublishMessage)(module_1.LANG_REALTIME_TOPIC, REALTIME_CHANGE, {
|
|
25
|
+
actorId: change.actor._id,
|
|
26
|
+
payload,
|
|
27
|
+
}).catch(() => undefined);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=announce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announce.js","sourceRoot":"","sources":["../../src/utils/announce.ts"],"names":[],"mappings":";;;AA+CA,4BAQC;AAvDD,6DAGmC;AAEnC,iEAAoE;AACpE,sEAA0F;AAC1F,4CAAsD;AAGtD,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAC5C,MAAM,eAAe,GAAG,SAAS,CAAC;AAoBlC,SAAS,SAAS,CAAC,OAAuB;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACzD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC;AAGY,QAAA,eAAe,GAAG,IAAA,8CAAiC,EAC9D,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IACrB,IAAA,oCAAoB,EAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CACF,CAAC;AAMF,SAAgB,QAAQ,CAAC,MAAuB;IAC9C,MAAM,OAAO,GAA2B,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;IACxE,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IACrD,IAAI,MAAM,CAAC,IAAI;QAAE,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC5C,IAAA,yBAAc,EAAC,4BAAmB,EAAE,eAAe,EAAE;QACnD,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG;QACzB,OAAO;KACR,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { KeyValueListItem } from "@antelopejs/interface-dms/base/key-value-list";
|
|
2
|
+
import type { StatGroupItem } from "@antelopejs/interface-dms/base/stat-group";
|
|
3
|
+
export interface BlockItems<T> {
|
|
4
|
+
items: T[];
|
|
5
|
+
}
|
|
6
|
+
export declare function workspaceKpis(workspace: string): BlockItems<StatGroupItem>;
|
|
7
|
+
export declare function workspaceAbout(workspace: string): BlockItems<KeyValueListItem>;
|
|
8
|
+
export declare function localeStats(workspace: string, requested: string): BlockItems<StatGroupItem>;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workspaceKpis = workspaceKpis;
|
|
4
|
+
exports.workspaceAbout = workspaceAbout;
|
|
5
|
+
exports.localeStats = localeStats;
|
|
6
|
+
const catalog_1 = require("./catalog");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const coverage_1 = require("./coverage");
|
|
9
|
+
const languages_1 = require("./languages");
|
|
10
|
+
const locale_codes_1 = require("./locale-codes");
|
|
11
|
+
const resolve_1 = require("./resolve");
|
|
12
|
+
const summary_1 = require("./summary");
|
|
13
|
+
const NAMESPACE_SEPARATOR = ".";
|
|
14
|
+
const WORKSPACES_FOLDER = "i18n-workspaces";
|
|
15
|
+
const HIGH_COVERAGE = 90;
|
|
16
|
+
const MID_COVERAGE = 60;
|
|
17
|
+
const NO_VALUE = "—";
|
|
18
|
+
function counted(key, value) {
|
|
19
|
+
return {
|
|
20
|
+
key: `${constants_1.LANG_TEXTS}.${key}`,
|
|
21
|
+
params: { n: { type: "count", value } },
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function percent(value) {
|
|
25
|
+
return {
|
|
26
|
+
key: `${constants_1.LANG_TEXTS}.common.value`,
|
|
27
|
+
params: { value: (0, languages_1.percentParam)(value) },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function amount(value) {
|
|
31
|
+
return {
|
|
32
|
+
key: `${constants_1.LANG_TEXTS}.common.value`,
|
|
33
|
+
params: { value: { type: "number", value } },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function namespaceCount(flat) {
|
|
37
|
+
return new Set(flat.rows.map((row) => row.key.split(NAMESPACE_SEPARATOR)[0]))
|
|
38
|
+
.size;
|
|
39
|
+
}
|
|
40
|
+
function missingTone(missing, hasWork) {
|
|
41
|
+
if (!hasWork)
|
|
42
|
+
return "neutral";
|
|
43
|
+
return missing > 0 ? "warning" : "success";
|
|
44
|
+
}
|
|
45
|
+
function keysDetail(flat) {
|
|
46
|
+
const namespaces = counted("kpis.keys_detail", namespaceCount(flat));
|
|
47
|
+
if (!flat.baseMissing)
|
|
48
|
+
return { detail: namespaces };
|
|
49
|
+
return {
|
|
50
|
+
detail: {
|
|
51
|
+
key: `${constants_1.LANG_TEXTS}.kpis.keys_detail_base_missing`,
|
|
52
|
+
params: {
|
|
53
|
+
namespaces,
|
|
54
|
+
missing: counted("kpis.keys_base_missing", flat.baseMissing),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
detailTone: "warning",
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function kpiItems(flat) {
|
|
61
|
+
const targets = (0, summary_1.targetLocales)(flat).length;
|
|
62
|
+
const missing = (0, summary_1.sumMissing)(flat);
|
|
63
|
+
const coverage = (0, summary_1.targetCoverage)(flat);
|
|
64
|
+
return [
|
|
65
|
+
{
|
|
66
|
+
id: "languages",
|
|
67
|
+
icon: "i-ph-globe",
|
|
68
|
+
tone: "primary",
|
|
69
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.kpis.languages`,
|
|
70
|
+
value: flat.locales.length,
|
|
71
|
+
detail: counted("kpis.languages_detail", targets),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "keys",
|
|
75
|
+
icon: "i-ph-key",
|
|
76
|
+
tone: "neutral",
|
|
77
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.kpis.keys`,
|
|
78
|
+
value: flat.totalKeys,
|
|
79
|
+
...keysDetail(flat),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "missing",
|
|
83
|
+
icon: "i-ph-warning",
|
|
84
|
+
tone: missingTone(missing, coverage !== undefined),
|
|
85
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.kpis.missing`,
|
|
86
|
+
value: missing,
|
|
87
|
+
detail: counted("kpis.missing_detail", targets),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "coverage",
|
|
91
|
+
icon: "i-ph-chart-bar",
|
|
92
|
+
tone: "primary",
|
|
93
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.kpis.coverage`,
|
|
94
|
+
value: coverage === undefined ? NO_VALUE : percent(coverage),
|
|
95
|
+
detail: `$${constants_1.LANG_TEXTS}.kpis.coverage_detail`,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
function workspaceKpis(workspace) {
|
|
100
|
+
return { items: kpiItems((0, resolve_1.resolveFlat)(workspace)) };
|
|
101
|
+
}
|
|
102
|
+
function folderOf(summary) {
|
|
103
|
+
return summary.kind === "added"
|
|
104
|
+
? `${WORKSPACES_FOLDER}/${summary.id}`
|
|
105
|
+
: { key: `${constants_1.LANG_TEXTS}.workspace_kinds.${summary.kind}.folder` };
|
|
106
|
+
}
|
|
107
|
+
function detailItems(summary) {
|
|
108
|
+
const items = [];
|
|
109
|
+
if (summary.description) {
|
|
110
|
+
items.push({
|
|
111
|
+
id: "description",
|
|
112
|
+
label: `$${constants_1.LANG_TEXTS}.workspace_details.description_label`,
|
|
113
|
+
value: summary.description,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (summary.type) {
|
|
117
|
+
items.push({
|
|
118
|
+
id: "type",
|
|
119
|
+
label: `$${constants_1.LANG_TEXTS}.workspace_details.type_label`,
|
|
120
|
+
value: `$${constants_1.LANG_TEXTS}.workspace_types.${summary.type}`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return items;
|
|
124
|
+
}
|
|
125
|
+
function workspaceAbout(workspace) {
|
|
126
|
+
const summary = (0, catalog_1.findWorkspace)(workspace);
|
|
127
|
+
const flat = (0, resolve_1.resolveFlat)(summary.id);
|
|
128
|
+
return {
|
|
129
|
+
items: [
|
|
130
|
+
...detailItems(summary),
|
|
131
|
+
{
|
|
132
|
+
id: "kind",
|
|
133
|
+
label: `$${constants_1.LANG_TEXTS}.about.kind`,
|
|
134
|
+
value: `$${constants_1.LANG_TEXTS}.workspace_kinds.${summary.kind}.kind`,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "editable",
|
|
138
|
+
label: `$${constants_1.LANG_TEXTS}.about.editable`,
|
|
139
|
+
value: `$${constants_1.LANG_TEXTS}.about.${summary.editable ? "yes" : "no"}`,
|
|
140
|
+
tone: summary.editable ? "success" : "warning",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "keys",
|
|
144
|
+
label: `$${constants_1.LANG_TEXTS}.about.keys`,
|
|
145
|
+
value: amount(flat.totalKeys),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "strings",
|
|
149
|
+
label: `$${constants_1.LANG_TEXTS}.about.strings`,
|
|
150
|
+
value: amount((0, summary_1.countTranslated)(flat)),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "folder",
|
|
154
|
+
label: `$${constants_1.LANG_TEXTS}.about.folder`,
|
|
155
|
+
value: folderOf(summary),
|
|
156
|
+
type: "mono",
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function coverageTone(coverage) {
|
|
162
|
+
if (coverage >= HIGH_COVERAGE)
|
|
163
|
+
return "success";
|
|
164
|
+
if (coverage >= MID_COVERAGE)
|
|
165
|
+
return "warning";
|
|
166
|
+
return "error";
|
|
167
|
+
}
|
|
168
|
+
function countIssues(flat, locale) {
|
|
169
|
+
return flat.rows.filter((row) => (0, resolve_1.needsReview)(row, locale)).length;
|
|
170
|
+
}
|
|
171
|
+
function localeStatItems(flat, locale) {
|
|
172
|
+
const missing = flat.localeMissing[locale] ?? 0;
|
|
173
|
+
const translated = flat.rows.length - missing;
|
|
174
|
+
const coverage = (0, coverage_1.coveragePercent)(translated, flat.rows.length);
|
|
175
|
+
const issues = countIssues(flat, locale);
|
|
176
|
+
return [
|
|
177
|
+
{
|
|
178
|
+
id: "coverage",
|
|
179
|
+
icon: "i-ph-chart-donut",
|
|
180
|
+
tone: coverageTone(coverage),
|
|
181
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.progress.coverage`,
|
|
182
|
+
value: percent(coverage),
|
|
183
|
+
detail: counted("progress.coverage_detail", flat.rows.length),
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "translated",
|
|
187
|
+
icon: "i-ph-check-circle",
|
|
188
|
+
tone: "success",
|
|
189
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.progress.translated`,
|
|
190
|
+
value: translated,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: "missing",
|
|
194
|
+
icon: "i-ph-warning",
|
|
195
|
+
tone: missingTone(missing, flat.rows.length > 0),
|
|
196
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.progress.missing`,
|
|
197
|
+
value: missing,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "issues",
|
|
201
|
+
icon: "i-ph-brackets-curly",
|
|
202
|
+
tone: issues ? "error" : "success",
|
|
203
|
+
eyebrow: `$${constants_1.LANG_TEXTS}.progress.issues`,
|
|
204
|
+
value: issues,
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
function localeStats(workspace, requested) {
|
|
209
|
+
const flat = (0, resolve_1.resolveFlat)(workspace);
|
|
210
|
+
const locale = (0, locale_codes_1.findLocale)(flat.locales, requested);
|
|
211
|
+
return { items: locale === undefined ? [] : localeStatItems(flat, locale) };
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/utils/blocks.ts"],"names":[],"mappings":";;AA2HA,sCAEC;AA4BD,wCAqCC;AAwDD,kCAOC;AAtPD,uCAA0C;AAC1C,2CAAyC;AACzC,yCAA6C;AAC7C,2CAA2C;AAC3C,iDAA4C;AAC5C,uCAAsE;AACtE,uCAKmB;AAGnB,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,QAAQ,GAAG,GAAG,CAAC;AAMrB,SAAS,OAAO,CAAC,GAAW,EAAE,KAAa;IACzC,OAAO;QACL,GAAG,EAAE,GAAG,sBAAU,IAAI,GAAG,EAAE;QAC3B,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;KACxC,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO;QACL,GAAG,EAAE,GAAG,sBAAU,eAAe;QACjC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAA,wBAAY,EAAC,KAAK,CAAC,EAAE;KACvC,CAAC;AACJ,CAAC;AAGD,SAAS,MAAM,CAAC,KAAa;IA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0 +1 @@
|
|
|
1
|
+
export declare const JsonBody: () => import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonBody = void 0;
|
|
4
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
5
|
+
const decorators_1 = require("@antelopejs/interface-core/decorators");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
function parseJson(raw) {
|
|
8
|
+
const text = raw.toString().trim();
|
|
9
|
+
if (text === "")
|
|
10
|
+
return {};
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(text);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return (0, errors_1.fail)("invalid_body", {}, "invalid_json");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.JsonBody = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, index) => {
|
|
19
|
+
(0, interface_api_1.SetParameterProvider)(target, key, index, (context) => (0, interface_api_1.ReadBody)(context).then(parseJson));
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../src/utils/body.ts"],"names":[],"mappings":";;;AAAA,6DAImC;AACnC,sEAA0F;AAC1F,qCAAgC;AAEhC,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAA,aAAI,EAAC,cAAc,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAMY,QAAA,QAAQ,GAAG,IAAA,8CAAiC,EACvD,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IACrB,IAAA,oCAAoB,EAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,OAAuB,EAAE,EAAE,CACnE,IAAA,wBAAQ,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAClC,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markWritten = markWritten;
|
|
4
|
+
exports.filesStamp = filesStamp;
|
|
5
|
+
exports.memoize = memoize;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const MISSING_FILE = "-";
|
|
8
|
+
const STAMP_SEPARATOR = "|";
|
|
9
|
+
const entries = new Map();
|
|
10
|
+
const writes = new Map();
|
|
11
|
+
function markWritten(path) {
|
|
12
|
+
writes.set(path, (writes.get(path) ?? 0) + 1);
|
|
13
|
+
}
|
|
14
|
+
function fileStamp(path) {
|
|
15
|
+
const written = writes.get(path) ?? 0;
|
|
16
|
+
const stats = (0, node_fs_1.statSync)(path, { throwIfNoEntry: false, bigint: true });
|
|
17
|
+
if (!stats)
|
|
18
|
+
return `${path}:${MISSING_FILE}:${written}`;
|
|
19
|
+
return `${path}:${stats.mtimeNs}:${stats.size}:${written}`;
|
|
20
|
+
}
|
|
21
|
+
function filesStamp(paths) {
|
|
22
|
+
return paths.map(fileStamp).join(STAMP_SEPARATOR);
|
|
23
|
+
}
|
|
24
|
+
function memoize(key, stamp, compute) {
|
|
25
|
+
const entry = entries.get(key);
|
|
26
|
+
if (entry?.stamp === stamp)
|
|
27
|
+
return entry.value;
|
|
28
|
+
const value = compute();
|
|
29
|
+
entries.set(key, { stamp, value });
|
|
30
|
+
return value;
|
|
31
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KAAK,EAAE,KAAK,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC,KAAU,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type WorkspaceSummary } from "./workspaces";
|
|
2
|
+
export declare const FALLBACK_LOCALE = "en";
|
|
3
|
+
export declare function projectBaseLocale(): string;
|
|
4
|
+
export declare function modulesBaseLocale(): string;
|
|
5
|
+
export declare function listAllWorkspaces(): WorkspaceSummary[];
|
|
6
|
+
export declare function resolveWorkspaceId(workspace?: string): string;
|
|
7
|
+
export declare function findWorkspace(workspace?: string): WorkspaceSummary;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FALLBACK_LOCALE = void 0;
|
|
4
|
+
exports.projectBaseLocale = projectBaseLocale;
|
|
5
|
+
exports.modulesBaseLocale = modulesBaseLocale;
|
|
6
|
+
exports.listAllWorkspaces = listAllWorkspaces;
|
|
7
|
+
exports.resolveWorkspaceId = resolveWorkspaceId;
|
|
8
|
+
exports.findWorkspace = findWorkspace;
|
|
9
|
+
const config_1 = require("./config");
|
|
10
|
+
const errors_1 = require("./errors");
|
|
11
|
+
const registry_1 = require("./registry");
|
|
12
|
+
const workspaces_1 = require("./workspaces");
|
|
13
|
+
exports.FALLBACK_LOCALE = "en";
|
|
14
|
+
function localeEntries(codes) {
|
|
15
|
+
return codes.map((code) => ({ code }));
|
|
16
|
+
}
|
|
17
|
+
function baseLocaleOf(origin) {
|
|
18
|
+
const codes = (0, registry_1.getLocaleCodes)(origin);
|
|
19
|
+
return codes.includes(exports.FALLBACK_LOCALE)
|
|
20
|
+
? exports.FALLBACK_LOCALE
|
|
21
|
+
: (codes[0] ?? exports.FALLBACK_LOCALE);
|
|
22
|
+
}
|
|
23
|
+
function projectBaseLocale() {
|
|
24
|
+
return baseLocaleOf("own");
|
|
25
|
+
}
|
|
26
|
+
function modulesBaseLocale() {
|
|
27
|
+
return baseLocaleOf("external");
|
|
28
|
+
}
|
|
29
|
+
function listAllWorkspaces() {
|
|
30
|
+
const { editable } = (0, config_1.getTranslationConfig)();
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
id: workspaces_1.DEFAULT_WORKSPACE,
|
|
34
|
+
kind: "default",
|
|
35
|
+
editable,
|
|
36
|
+
defaultLocale: projectBaseLocale(),
|
|
37
|
+
locales: localeEntries((0, registry_1.getLocaleCodes)("own")),
|
|
38
|
+
},
|
|
39
|
+
...(0, workspaces_1.listWorkspaces)(),
|
|
40
|
+
{
|
|
41
|
+
id: workspaces_1.MODULES_WORKSPACE,
|
|
42
|
+
kind: "modules",
|
|
43
|
+
editable: false,
|
|
44
|
+
defaultLocale: modulesBaseLocale(),
|
|
45
|
+
locales: localeEntries((0, registry_1.getLocaleCodes)("external")),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
function resolveWorkspaceId(workspace) {
|
|
50
|
+
const id = (0, workspaces_1.normalizeWorkspaceId)(workspace) || workspaces_1.DEFAULT_WORKSPACE;
|
|
51
|
+
if (id === workspaces_1.DEFAULT_WORKSPACE || id === workspaces_1.MODULES_WORKSPACE || (0, workspaces_1.hasWorkspace)(id))
|
|
52
|
+
return id;
|
|
53
|
+
return (0, errors_1.fail)("unknown_workspace", { id: workspace });
|
|
54
|
+
}
|
|
55
|
+
function findWorkspace(workspace) {
|
|
56
|
+
const id = resolveWorkspaceId(workspace);
|
|
57
|
+
const summary = listAllWorkspaces().find((entry) => entry.id === id);
|
|
58
|
+
if (summary === undefined)
|
|
59
|
+
(0, errors_1.fail)("unknown_workspace", { id: workspace });
|
|
60
|
+
return summary;
|
|
61
|
+
}
|
|
62
|
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;YACf,aAAa,EAAE,iBAAiB,EAAE;YAClC,OAAO,EAAE,aAAa,CAAC,IAAA,yBAAc,EAAC,UAAU,CAAC,CAAC;SACnD;KACF,CAAC;AACJ,CAAC;AAMD,SAAgB,kBAAkB,CAAC,SAAkB;IACnD,MAAM,EAAE,GAAG,IAAA,iCAAoB,EAAC,SAAS,CAAC,IAAI,8BAAiB,CAAC;IAChE,IAAI,EAAE,KAAK,8BAAiB,IAAI,EAAE,KAAK,8BAAiB,IAAI,IAAA,yBAAY,EAAC,EAAE,CAAC;QAC1E,OAAO,EAAE,CAAC;IACZ,OAAO,IAAA,aAAI,EAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACtD,CAAC;AAGD,SAAgB,aAAa,CAAC,SAAkB;IAC9C,MAAM,EAAE,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrE,IAAI,OAAO,KAAK,SAAS;QAAE,IAAA,aAAI,EAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACxE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const LANG_TEXTS = "dms_lang";
|
|
2
|
+
export declare const PERMISSION_TEXTS = "$dms_lang.permissions";
|
|
3
|
+
export declare const LANG_API = "/api/lang/translations";
|
|
4
|
+
export declare const PUBLIC_PATH = "/i18n";
|
|
5
|
+
export declare const PAGES_URL = "/modules/lang";
|
|
6
|
+
export declare const PROJECT_FILES = "frontend-vue/i18n/locales/app-*.json";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROJECT_FILES = exports.PAGES_URL = exports.PUBLIC_PATH = exports.LANG_API = exports.PERMISSION_TEXTS = exports.LANG_TEXTS = void 0;
|
|
4
|
+
exports.LANG_TEXTS = "dms_lang";
|
|
5
|
+
exports.PERMISSION_TEXTS = `$${exports.LANG_TEXTS}.permissions`;
|
|
6
|
+
exports.LANG_API = "/api/lang/translations";
|
|
7
|
+
exports.PUBLIC_PATH = "/i18n";
|
|
8
|
+
exports.PAGES_URL = "/modules/lang";
|
|
9
|
+
exports.PROJECT_FILES = "frontend-vue/i18n/locales/app-*.json";
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AACa,QAAA,UAAU,GAAG,UAAU,CAAC;AAGxB,QAAA,gBAAgB,GAAG,IAAI,kBAAU,cAAc,CAAC;AAGhD,QAAA,QAAQ,GAAG,wBAAwB,CAAC;AAGpC,QAAA,WAAW,GAAG,OAAO,CAAC;AAGtB,QAAA,SAAS,GAAG,eAAe,CAAC;AAG5B,QAAA,aAAa,GAAG,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FULL_COVERAGE = void 0;
|
|
4
|
+
exports.coveragePercent = coveragePercent;
|
|
5
|
+
exports.FULL_COVERAGE = 100;
|
|
6
|
+
function coveragePercent(translated, total) {
|
|
7
|
+
if (total <= 0)
|
|
8
|
+
return exports.FULL_COVERAGE;
|
|
9
|
+
return Math.floor((translated * exports.FULL_COVERAGE) / total);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../src/utils/coverage.ts"],"names":[],"mappings":";;;AASA,0CAGC;AAXY,QAAA,aAAa,GAAG,GAAG,CAAC;AAQjC,SAAgB,eAAe,CAAC,UAAkB,EAAE,KAAa;IAC/D,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,qBAAa,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,qBAAa,CAAC,GAAG,KAAK,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConfirmDialogSerialized } from "@antelopejs/interface-dms/base/types";
|
|
2
|
+
export interface BaseConfirm extends ConfirmDialogSerialized {
|
|
3
|
+
missing: number;
|
|
4
|
+
keys: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function removalConfirm(workspace: string, requested: string, origin: string): ConfirmDialogSerialized;
|
|
7
|
+
export declare function baseConfirm(workspace: string, requested: string): BaseConfirm;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removalConfirm = removalConfirm;
|
|
4
|
+
exports.baseConfirm = baseConfirm;
|
|
5
|
+
const confirm_dialog_1 = require("@antelopejs/interface-dms/base/confirm-dialog");
|
|
6
|
+
const catalog_1 = require("./catalog");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const errors_1 = require("./errors");
|
|
9
|
+
const languages_1 = require("./languages");
|
|
10
|
+
const locale_codes_1 = require("./locale-codes");
|
|
11
|
+
const public_url_1 = require("./public-url");
|
|
12
|
+
const resolve_1 = require("./resolve");
|
|
13
|
+
const LISTED_KEYS = 20;
|
|
14
|
+
const SHOWN_KEYS = 5;
|
|
15
|
+
const LANGUAGE_FILE = "{code}.json";
|
|
16
|
+
const DOWNLOAD_LANGUAGE = {
|
|
17
|
+
label: `$${constants_1.LANG_TEXTS}.language_remove.download`,
|
|
18
|
+
icon: "i-ph-download-simple",
|
|
19
|
+
target: {
|
|
20
|
+
type: "download",
|
|
21
|
+
url: `${constants_1.PUBLIC_PATH}/{workspace}/${LANGUAGE_FILE}`,
|
|
22
|
+
filename: LANGUAGE_FILE,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
function knownLocale(flat, code) {
|
|
26
|
+
const found = (0, locale_codes_1.findLocale)(flat.locales, code);
|
|
27
|
+
if (found === undefined)
|
|
28
|
+
(0, errors_1.fail)("unknown_locale", { locale: code });
|
|
29
|
+
return found;
|
|
30
|
+
}
|
|
31
|
+
function countStrings(flat, code) {
|
|
32
|
+
return flat.totalKeys - (flat.localeMissing[code] ?? 0);
|
|
33
|
+
}
|
|
34
|
+
function removalConfirm(workspace, requested, origin) {
|
|
35
|
+
const summary = (0, catalog_1.findWorkspace)(workspace);
|
|
36
|
+
const flat = (0, resolve_1.resolveFlat)(summary.id);
|
|
37
|
+
const code = knownLocale(flat, requested);
|
|
38
|
+
const strings = countStrings(flat, code);
|
|
39
|
+
const impact = [
|
|
40
|
+
{ icon: "i-ph-file", label: `$${constants_1.LANG_TEXTS}.language_remove.file` },
|
|
41
|
+
];
|
|
42
|
+
const dialog = {
|
|
43
|
+
title: `$${constants_1.LANG_TEXTS}.language_remove.title`,
|
|
44
|
+
description: `$${constants_1.LANG_TEXTS}.language_remove.description`,
|
|
45
|
+
params: {
|
|
46
|
+
name: (0, languages_1.nativeName)(code, flat.locales),
|
|
47
|
+
workspace: summary.id,
|
|
48
|
+
code,
|
|
49
|
+
url: (0, public_url_1.publicLocaleUrl)(origin, summary, code) ?? "",
|
|
50
|
+
file: `${code}.json`,
|
|
51
|
+
},
|
|
52
|
+
color: "error",
|
|
53
|
+
confirmLabel: `$${constants_1.LANG_TEXTS}.language_remove.submit`,
|
|
54
|
+
impact,
|
|
55
|
+
};
|
|
56
|
+
if (!strings)
|
|
57
|
+
return (0, confirm_dialog_1.serializeConfirmDialog)(dialog);
|
|
58
|
+
dialog.description = `$${constants_1.LANG_TEXTS}.language_remove.description_backup`;
|
|
59
|
+
dialog.confirmText = code;
|
|
60
|
+
dialog.secondaryAction = DOWNLOAD_LANGUAGE;
|
|
61
|
+
impact.push({
|
|
62
|
+
icon: "i-ph-text-aa",
|
|
63
|
+
label: `$${constants_1.LANG_TEXTS}.language_remove.strings`,
|
|
64
|
+
count: strings,
|
|
65
|
+
});
|
|
66
|
+
return (0, confirm_dialog_1.serializeConfirmDialog)(dialog);
|
|
67
|
+
}
|
|
68
|
+
function keyImpact(keys, missing) {
|
|
69
|
+
const shown = keys
|
|
70
|
+
.slice(0, SHOWN_KEYS)
|
|
71
|
+
.map((key) => ({ icon: "i-ph-key", label: key }));
|
|
72
|
+
const rest = missing - shown.length;
|
|
73
|
+
return rest > 0
|
|
74
|
+
? [
|
|
75
|
+
...shown,
|
|
76
|
+
{
|
|
77
|
+
icon: "i-ph-dots-three",
|
|
78
|
+
label: `$${constants_1.LANG_TEXTS}.language_base.more_keys`,
|
|
79
|
+
count: rest,
|
|
80
|
+
},
|
|
81
|
+
]
|
|
82
|
+
: shown;
|
|
83
|
+
}
|
|
84
|
+
function baseConfirm(workspace, requested) {
|
|
85
|
+
const flat = (0, resolve_1.resolveFlat)((0, catalog_1.findWorkspace)(workspace).id);
|
|
86
|
+
const code = knownLocale(flat, requested);
|
|
87
|
+
const missingRows = flat.rows.filter((row) => (0, resolve_1.isRowMissing)(row, code));
|
|
88
|
+
const keys = missingRows.slice(0, LISTED_KEYS).map((row) => row.key);
|
|
89
|
+
const missing = missingRows.length;
|
|
90
|
+
const dialog = (0, confirm_dialog_1.serializeConfirmDialog)({
|
|
91
|
+
title: `$${constants_1.LANG_TEXTS}.language_base.confirm_title`,
|
|
92
|
+
description: missing
|
|
93
|
+
? `$${constants_1.LANG_TEXTS}.language_base.confirm_missing`
|
|
94
|
+
: `$${constants_1.LANG_TEXTS}.language_base.confirm_complete`,
|
|
95
|
+
params: { name: (0, languages_1.nativeName)(code, flat.locales), count: missing },
|
|
96
|
+
icon: "i-ph-star",
|
|
97
|
+
color: "primary",
|
|
98
|
+
confirmLabel: `$${constants_1.LANG_TEXTS}.language_base.confirm_submit`,
|
|
99
|
+
impact: keyImpact(keys, missing),
|
|
100
|
+
});
|
|
101
|
+
return { ...dialog, missing, keys };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=dialogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogs.js","sourceRoot":"","sources":["../../src/utils/dialogs.ts"],"names":[],"mappings":";;AAoDA,wCAoCC;AAwBD,kCAkBC;AAlID,kFAAuF;AAOvF,uCAA0C;AAC1C,2CAAsD;AACtD,qCAAgC;AAChC,2CAAyC;AACzC,iDAA4C;AAC5C,6CAA+C;AAC/C,uCAAuE;AAEvE,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,aAAa,GAAG,aAAa,CAAC;AAGpC,MAAM,iBAAiB,GAAiC;IACtD,KAAK,EAAE,IAAI,sBAAU,2BAA2B;IAChD,IAAI,EAAE,sBAAsB;IAC5B,MAAM,EAAE;QACN,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,GAAG,uBAAW,gBAAgB,aAAa,EAAE;QAClD,QAAQ,EAAE,aAAa;KACxB;CACF,CAAC;AASF,SAAS,WAAW,CAAC,IAAgB,EAAE,IAAY;IACjD,MAAM,KAAK,GAAG,IAAA,yBAAU,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C,IAAI,KAAK,KAAK,SAAS;QAAE,IAAA,aAAI,EAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,IAAgB,EAAE,IAAY;IAClD,OAAO,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC;AAOD,SAAgB,cAAc,CAC5B,SAAiB,EACjB,SAAiB,EACjB,MAAc;IAEd,MAAM,OAAO,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,CAAC,IAAI,sBAAU,iCAAiC;QACnD,MAAM,EAAE,EAAE,IAAI,EAAE,IAAA,sBAAU,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE;QAChE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,SAAS;QAChB,YAAY,EAAE,IAAI,sBAAU,+BAA+B;QAC3D,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC;KACjC,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { HTTPResult } from "@antelopejs/interface-api";
|
|
2
|
+
declare const ERROR_STATUS: {
|
|
3
|
+
readonly invalid_body: 400;
|
|
4
|
+
readonly invalid_key_path: 400;
|
|
5
|
+
readonly invalid_value: 400;
|
|
6
|
+
readonly invalid_message: 400;
|
|
7
|
+
readonly invalid_locale: 400;
|
|
8
|
+
readonly undeclared_locale: 400;
|
|
9
|
+
readonly invalid_workspace_id: 400;
|
|
10
|
+
readonly reserved_workspace: 400;
|
|
11
|
+
readonly not_a_key: 400;
|
|
12
|
+
readonly read_only: 403;
|
|
13
|
+
readonly unknown_workspace: 404;
|
|
14
|
+
readonly unknown_locale: 404;
|
|
15
|
+
readonly key_not_found: 404;
|
|
16
|
+
readonly not_an_override: 404;
|
|
17
|
+
readonly conflict: 409;
|
|
18
|
+
readonly key_exists: 409;
|
|
19
|
+
readonly key_conflict: 409;
|
|
20
|
+
readonly module_key: 409;
|
|
21
|
+
readonly last_value: 409;
|
|
22
|
+
readonly workspace_exists: 409;
|
|
23
|
+
readonly locale_exists: 409;
|
|
24
|
+
readonly base_locale: 409;
|
|
25
|
+
readonly server_error: 500;
|
|
26
|
+
};
|
|
27
|
+
export type ErrorCode = keyof typeof ERROR_STATUS;
|
|
28
|
+
export type ErrorReason = ErrorCode | "invalid_json" | "invalid_new_key_path" | "same_key_path" | "invalid_before" | "empty_key" | "module_key_locked" | "modules_read_only" | "review_added_only" | "no_project_file" | "duplicate_locale" | "unknown_base_locale" | "no_locale" | "corrupt_file" | "corrupt_manifest" | "invalid_backup" | "newer_backup" | "not_configured";
|
|
29
|
+
export type ErrorDetails = Record<string, unknown>;
|
|
30
|
+
export interface ErrorBody extends ErrorDetails {
|
|
31
|
+
message: string;
|
|
32
|
+
code: ErrorCode;
|
|
33
|
+
}
|
|
34
|
+
export declare function errorMessage(reason: ErrorReason): string;
|
|
35
|
+
export declare function errorStatus(code: ErrorCode): number;
|
|
36
|
+
export declare function errorBody(code: ErrorCode, details?: ErrorDetails, reason?: ErrorReason): ErrorBody;
|
|
37
|
+
export declare function errorResult(code: ErrorCode, details?: ErrorDetails, reason?: ErrorReason): HTTPResult;
|
|
38
|
+
export declare function fail(code: ErrorCode, details?: ErrorDetails, reason?: ErrorReason): never;
|
|
39
|
+
export declare function check(condition: unknown, code: ErrorCode, details?: ErrorDetails, reason?: ErrorReason): asserts condition;
|
|
40
|
+
export {};
|