@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.
Files changed (245) hide show
  1. package/README.md +12 -6
  2. package/dist/pages/actions.d.ts +7 -0
  3. package/dist/pages/actions.js +15 -0
  4. package/dist/pages/actions.js.map +1 -0
  5. package/dist/pages/component-action.d.ts +2 -0
  6. package/dist/pages/component-action.js +10 -0
  7. package/dist/pages/component-action.js.map +1 -0
  8. package/dist/pages/header-actions.d.ts +9 -0
  9. package/dist/pages/header-actions.js +146 -0
  10. package/dist/pages/header-actions.js.map +1 -0
  11. package/dist/pages/index.d.ts +6 -0
  12. package/dist/pages/index.js +6 -0
  13. package/dist/pages/index.js.map +1 -1
  14. package/dist/pages/language.d.ts +10 -0
  15. package/dist/pages/language.js +89 -0
  16. package/dist/pages/language.js.map +1 -0
  17. package/dist/pages/languages-table.d.ts +2 -0
  18. package/dist/pages/languages-table.js +120 -0
  19. package/dist/pages/languages-table.js.map +1 -0
  20. package/dist/pages/module.d.ts +7 -1
  21. package/dist/pages/module.js +28 -2
  22. package/dist/pages/module.js.map +1 -1
  23. package/dist/pages/overview.d.ts +2 -1
  24. package/dist/pages/overview.js +83 -8
  25. package/dist/pages/overview.js.map +1 -1
  26. package/dist/pages/page-actions.d.ts +6 -0
  27. package/dist/pages/page-actions.js +10 -0
  28. package/dist/pages/page-actions.js.map +1 -0
  29. package/dist/pages/quick-actions.d.ts +1 -0
  30. package/dist/pages/quick-actions.js +56 -0
  31. package/dist/pages/quick-actions.js.map +1 -0
  32. package/dist/pages/translations.d.ts +7 -1
  33. package/dist/pages/translations.js +47 -10
  34. package/dist/pages/translations.js.map +1 -1
  35. package/dist/pages/workspace-guard.d.ts +1 -0
  36. package/dist/pages/workspace-guard.js +35 -0
  37. package/dist/pages/workspace-guard.js.map +1 -0
  38. package/dist/pages/workspace.d.ts +18 -0
  39. package/dist/pages/workspace.js +162 -0
  40. package/dist/pages/workspace.js.map +1 -0
  41. package/dist/pages/workspaces.d.ts +14 -0
  42. package/dist/pages/workspaces.js +88 -0
  43. package/dist/pages/workspaces.js.map +1 -0
  44. package/dist/routes/publicLocales.d.ts +3 -2
  45. package/dist/routes/publicLocales.js +39 -18
  46. package/dist/routes/publicLocales.js.map +1 -1
  47. package/dist/routes/translations.d.ts +59 -63
  48. package/dist/routes/translations.js +400 -119
  49. package/dist/routes/translations.js.map +1 -1
  50. package/dist/utils/announce.d.ts +9 -0
  51. package/dist/utils/announce.js +29 -0
  52. package/dist/utils/announce.js.map +1 -0
  53. package/dist/utils/blocks.d.ts +8 -0
  54. package/dist/utils/blocks.js +213 -0
  55. package/dist/utils/blocks.js.map +1 -0
  56. package/dist/utils/body.d.ts +1 -0
  57. package/dist/utils/body.js +21 -0
  58. package/dist/utils/body.js.map +1 -0
  59. package/dist/utils/cache.d.ts +3 -0
  60. package/dist/utils/cache.js +32 -0
  61. package/dist/utils/cache.js.map +1 -0
  62. package/dist/utils/catalog.d.ts +7 -0
  63. package/dist/utils/catalog.js +62 -0
  64. package/dist/utils/catalog.js.map +1 -0
  65. package/dist/utils/constants.d.ts +6 -0
  66. package/dist/utils/constants.js +10 -0
  67. package/dist/utils/constants.js.map +1 -0
  68. package/dist/utils/coverage.d.ts +2 -0
  69. package/dist/utils/coverage.js +11 -0
  70. package/dist/utils/coverage.js.map +1 -0
  71. package/dist/utils/dialogs.d.ts +7 -0
  72. package/dist/utils/dialogs.js +103 -0
  73. package/dist/utils/dialogs.js.map +1 -0
  74. package/dist/utils/errors.d.ts +40 -0
  75. package/dist/utils/errors.js +60 -0
  76. package/dist/utils/errors.js.map +1 -0
  77. package/dist/utils/export.d.ts +17 -0
  78. package/dist/utils/export.js +129 -0
  79. package/dist/utils/export.js.map +1 -0
  80. package/dist/utils/json.d.ts +10 -1
  81. package/dist/utils/json.js +127 -19
  82. package/dist/utils/json.js.map +1 -1
  83. package/dist/utils/key-stores.d.ts +3 -0
  84. package/dist/utils/key-stores.js +24 -0
  85. package/dist/utils/key-stores.js.map +1 -0
  86. package/dist/utils/keys.d.ts +23 -0
  87. package/dist/utils/keys.js +252 -0
  88. package/dist/utils/keys.js.map +1 -0
  89. package/dist/utils/languages.d.ts +27 -0
  90. package/dist/utils/languages.js +121 -0
  91. package/dist/utils/languages.js.map +1 -0
  92. package/dist/utils/locale-codes.d.ts +5 -0
  93. package/dist/utils/locale-codes.js +56 -0
  94. package/dist/utils/locale-codes.js.map +1 -0
  95. package/dist/utils/locale-discovery.d.ts +1 -0
  96. package/dist/utils/locale-discovery.js +19 -1
  97. package/dist/utils/locale-discovery.js.map +1 -1
  98. package/dist/utils/message-check.d.ts +1 -0
  99. package/dist/utils/message-check.js +93 -0
  100. package/dist/utils/message-check.js.map +1 -0
  101. package/dist/utils/message-syntax.d.ts +6 -0
  102. package/dist/utils/message-syntax.js +38 -0
  103. package/dist/utils/message-syntax.js.map +1 -0
  104. package/dist/utils/namespaces.d.ts +12 -0
  105. package/dist/utils/namespaces.js +52 -0
  106. package/dist/utils/namespaces.js.map +1 -0
  107. package/dist/utils/notices.d.ts +4 -0
  108. package/dist/utils/notices.js +60 -0
  109. package/dist/utils/notices.js.map +1 -0
  110. package/dist/utils/own.d.ts +2 -3
  111. package/dist/utils/own.js +17 -57
  112. package/dist/utils/own.js.map +1 -1
  113. package/dist/utils/public-url.d.ts +8 -0
  114. package/dist/utils/public-url.js +87 -0
  115. package/dist/utils/public-url.js.map +1 -0
  116. package/dist/utils/registry.d.ts +3 -1
  117. package/dist/utils/registry.js +26 -10
  118. package/dist/utils/registry.js.map +1 -1
  119. package/dist/utils/resolve.d.ts +18 -15
  120. package/dist/utils/resolve.js +98 -151
  121. package/dist/utils/resolve.js.map +1 -1
  122. package/dist/utils/review.d.ts +5 -0
  123. package/dist/utils/review.js +64 -0
  124. package/dist/utils/review.js.map +1 -0
  125. package/dist/utils/snippets.d.ts +7 -0
  126. package/dist/utils/snippets.js +129 -0
  127. package/dist/utils/snippets.js.map +1 -0
  128. package/dist/utils/summary.d.ts +23 -0
  129. package/dist/utils/summary.js +65 -0
  130. package/dist/utils/summary.js.map +1 -0
  131. package/dist/utils/tree.d.ts +2 -17
  132. package/dist/utils/tree.js +21 -126
  133. package/dist/utils/tree.js.map +1 -1
  134. package/dist/utils/workspaces.d.ts +45 -15
  135. package/dist/utils/workspaces.js +256 -164
  136. package/dist/utils/workspaces.js.map +1 -1
  137. package/dist/validation/key.schema.d.ts +71 -0
  138. package/dist/validation/key.schema.js +67 -0
  139. package/dist/validation/key.schema.js.map +1 -0
  140. package/dist/validation/query.schema.d.ts +17 -0
  141. package/dist/validation/query.schema.js +44 -0
  142. package/dist/validation/query.schema.js.map +1 -0
  143. package/dist/validation/validate.d.ts +2 -0
  144. package/dist/validation/validate.js +24 -0
  145. package/dist/validation/validate.js.map +1 -0
  146. package/dist/validation/workspace.schema.d.ts +145 -0
  147. package/dist/validation/workspace.schema.js +83 -0
  148. package/dist/validation/workspace.schema.js.map +1 -0
  149. package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
  150. package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
  151. package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
  152. package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
  153. package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
  154. package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
  155. package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
  156. package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
  157. package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
  158. package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
  159. package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
  160. package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
  161. package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
  162. package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
  163. package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
  164. package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
  165. package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
  166. package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
  167. package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
  168. package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
  169. package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
  170. package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
  171. package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
  172. package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
  173. package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
  174. package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
  175. package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
  176. package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
  177. package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
  178. package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
  179. package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
  180. package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
  181. package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
  182. package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
  183. package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
  184. package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
  185. package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
  186. package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
  187. package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
  188. package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
  189. package/frontend-vue/app/components/TranslationQueue.vue +212 -0
  190. package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
  191. package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
  192. package/frontend-vue/app/components/WorkspaceList.vue +454 -0
  193. package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
  194. package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
  195. package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
  196. package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
  197. package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
  198. package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
  199. package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
  200. package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
  201. package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
  202. package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
  203. package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
  204. package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
  205. package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
  206. package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
  207. package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
  208. package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
  209. package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
  210. package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
  211. package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
  212. package/frontend-vue/app/types/lang.ts +130 -0
  213. package/frontend-vue/app/utils/boundedCache.ts +22 -0
  214. package/frontend-vue/app/utils/download.ts +16 -0
  215. package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
  216. package/frontend-vue/app/utils/keySaves.ts +108 -0
  217. package/frontend-vue/app/utils/languages.ts +272 -0
  218. package/frontend-vue/app/utils/matrixExport.ts +47 -0
  219. package/frontend-vue/app/utils/queueDrafts.ts +115 -0
  220. package/frontend-vue/app/utils/queuePass.ts +145 -0
  221. package/frontend-vue/app/utils/queueView.ts +22 -0
  222. package/frontend-vue/app/utils/shortcuts.ts +75 -0
  223. package/frontend-vue/app/utils/translations.ts +756 -0
  224. package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
  225. package/frontend-vue/app/utils/workspaces.ts +45 -0
  226. package/frontend-vue/dms.frontend.build.ts +5 -0
  227. package/frontend-vue/dms.frontend.ts +9 -20
  228. package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
  229. package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
  230. package/frontend-vue/package.json +10 -5
  231. package/package.json +10 -8
  232. package/dist/utils/mutations.d.ts +0 -3
  233. package/dist/utils/mutations.js +0 -35
  234. package/dist/utils/mutations.js.map +0 -1
  235. package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
  236. package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
  237. package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
  238. package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
  239. package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
  240. package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
  241. package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
  242. package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
  243. package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
  244. package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
  245. package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.keySchema = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const errors_1 = require("../utils/errors");
39
+ const INVALID_VALUE = (0, errors_1.errorMessage)("invalid_value");
40
+ const workspace = z.string().trim().min(1);
41
+ const keyPath = z.string().min(1);
42
+ const localeTexts = z.record(z.string({ message: INVALID_VALUE }).nullable(), {
43
+ message: INVALID_VALUE,
44
+ });
45
+ const localeCodes = z.array(z.string());
46
+ exports.keySchema = {
47
+ create: z.object({
48
+ workspace,
49
+ path: keyPath,
50
+ values: localeTexts,
51
+ before: z.string().nullish(),
52
+ }),
53
+ update: z.object({
54
+ workspace,
55
+ path: keyPath,
56
+ values: localeTexts.default({}),
57
+ expected: localeTexts.optional(),
58
+ }),
59
+ rename: z.object({ workspace, path: keyPath, newPath: keyPath }),
60
+ remove: z.object({ workspace, path: keyPath }),
61
+ locales: z.object({
62
+ workspace,
63
+ path: keyPath,
64
+ locales: localeCodes.optional(),
65
+ }),
66
+ };
67
+ //# sourceMappingURL=key.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.schema.js","sourceRoot":"","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,CAAC,MAAM,CAAC;QAChB,SAAS;QACT,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE;KAChC,CAAC;CACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import * as z from "zod";
2
+ export declare const querySchema: {
3
+ snippet: z.ZodObject<{
4
+ kind: z.ZodDefault<z.ZodEnum<["vue", "i18next", "fetch", "curl"]>>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ kind: "vue" | "i18next" | "fetch" | "curl";
7
+ }, {
8
+ kind?: "vue" | "i18next" | "fetch" | "curl" | undefined;
9
+ }>;
10
+ notice: z.ZodObject<{
11
+ page: z.ZodDefault<z.ZodEnum<["overview", "workspace"]>>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ page: "overview" | "workspace";
14
+ }, {
15
+ page?: "overview" | "workspace" | undefined;
16
+ }>;
17
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.querySchema = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const notices_1 = require("../utils/notices");
39
+ const snippets_1 = require("../utils/snippets");
40
+ exports.querySchema = {
41
+ snippet: z.object({ kind: z.enum(snippets_1.SNIPPET_KINDS).default(snippets_1.SNIPPET_KINDS[0]) }),
42
+ notice: z.object({ page: z.enum(notices_1.NOTICE_PAGES).default(notices_1.NOTICE_PAGES[0]) }),
43
+ };
44
+ //# sourceMappingURL=query.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.schema.js","sourceRoot":"","sources":["../../src/validation/query.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,8CAAgD;AAChD,gDAAkD;AAGrC,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,wBAAa,CAAC,CAAC,OAAO,CAAC,wBAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAY,CAAC,CAAC,OAAO,CAAC,sBAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;CAC1E,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type ZodType, type ZodTypeDef } from "zod";
2
+ export declare function validate<Output, Input>(schema: ZodType<Output, ZodTypeDef, Input>, input: unknown): Output;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validate = validate;
4
+ const interface_api_util_1 = require("@antelopejs/interface-api-util");
5
+ const zod_1 = require("zod");
6
+ const errors_1 = require("../utils/errors");
7
+ const KEY_PREFIX = "$";
8
+ const INVALID_BODY = "invalid_body";
9
+ function firstMessage(error) {
10
+ const message = error.issues[0]?.message;
11
+ return message?.startsWith(KEY_PREFIX) ? message : (0, errors_1.errorMessage)(INVALID_BODY);
12
+ }
13
+ function refusal(error) {
14
+ if (!(error instanceof zod_1.ZodError))
15
+ return (0, errors_1.errorBody)(INVALID_BODY);
16
+ return {
17
+ ...(0, errors_1.errorBody)(INVALID_BODY, { issues: error.issues }),
18
+ message: firstMessage(error),
19
+ };
20
+ }
21
+ function validate(schema, input) {
22
+ return (0, interface_api_util_1.assertValidation)(input, (value) => schema.parse(value), refusal, (0, errors_1.errorStatus)(INVALID_BODY));
23
+ }
24
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validation/validate.ts"],"names":[],"mappings":";;AA0BA,4BAUC;AApCD,uEAAkE;AAClE,6BAA8D;AAC9D,4CAAuE;AAEvE,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,SAAS,YAAY,CAAC,KAAe;IACnC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IACzC,OAAO,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,qBAAY,EAAC,YAAY,CAAC,CAAC;AAChF,CAAC;AAOD,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,CAAC,CAAC,KAAK,YAAY,cAAQ,CAAC;QAAE,OAAO,IAAA,kBAAS,EAAC,YAAY,CAAC,CAAC;IACjE,OAAO;QACL,GAAG,IAAA,kBAAS,EAAC,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;KAC7B,CAAC;AACJ,CAAC;AAGD,SAAgB,QAAQ,CACtB,MAA0C,EAC1C,KAAc;IAEd,OAAO,IAAA,qCAAgB,EACrB,KAAK,EACL,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAC9B,OAAO,EACP,IAAA,oBAAW,EAAC,YAAY,CAAC,CAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,145 @@
1
+ import * as z from "zod";
2
+ export declare const workspaceSchema: {
3
+ create: z.ZodObject<{
4
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["dms", "website", "mobile", "other"]>, z.ZodLiteral<"">]>>>;
6
+ id: z.ZodString;
7
+ locale: z.ZodObject<{
8
+ code: z.ZodString;
9
+ name: z.ZodOptional<z.ZodString>;
10
+ flag: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ code: string;
13
+ name?: string | undefined;
14
+ flag?: string | undefined;
15
+ }, {
16
+ code: string;
17
+ name?: string | undefined;
18
+ flag?: string | undefined;
19
+ }>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ id: string;
22
+ locale: {
23
+ code: string;
24
+ name?: string | undefined;
25
+ flag?: string | undefined;
26
+ };
27
+ type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
28
+ description?: string | null | undefined;
29
+ }, {
30
+ id: string;
31
+ locale: {
32
+ code: string;
33
+ name?: string | undefined;
34
+ flag?: string | undefined;
35
+ };
36
+ type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
37
+ description?: string | null | undefined;
38
+ }>;
39
+ update: z.ZodObject<{
40
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["dms", "website", "mobile", "other"]>, z.ZodLiteral<"">]>>>;
42
+ id: z.ZodString;
43
+ }, "strip", z.ZodTypeAny, {
44
+ id: string;
45
+ type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
46
+ description?: string | null | undefined;
47
+ }, {
48
+ id: string;
49
+ type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
50
+ description?: string | null | undefined;
51
+ }>;
52
+ rename: z.ZodObject<{
53
+ id: z.ZodString;
54
+ newId: z.ZodString;
55
+ }, "strip", z.ZodTypeAny, {
56
+ id: string;
57
+ newId: string;
58
+ }, {
59
+ id: string;
60
+ newId: string;
61
+ }>;
62
+ remove: z.ZodObject<{
63
+ id: z.ZodString;
64
+ }, "strip", z.ZodTypeAny, {
65
+ id: string;
66
+ }, {
67
+ id: string;
68
+ }>;
69
+ import: z.ZodObject<{
70
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["dms", "website", "mobile", "other"]>, z.ZodLiteral<"">]>>>;
72
+ format: z.ZodOptional<z.ZodEnum<["dms-lang.workspace"]>>;
73
+ version: z.ZodOptional<z.ZodNumber>;
74
+ id: z.ZodString;
75
+ messages: z.ZodRecord<z.ZodString, z.ZodUnknown>;
76
+ locales: z.ZodOptional<z.ZodArray<z.ZodObject<{
77
+ code: z.ZodString;
78
+ name: z.ZodOptional<z.ZodString>;
79
+ flag: z.ZodOptional<z.ZodString>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ code: string;
82
+ name?: string | undefined;
83
+ flag?: string | undefined;
84
+ }, {
85
+ code: string;
86
+ name?: string | undefined;
87
+ flag?: string | undefined;
88
+ }>, "many">>;
89
+ defaultLocale: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ id: string;
92
+ messages: Record<string, unknown>;
93
+ type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
94
+ description?: string | null | undefined;
95
+ version?: number | undefined;
96
+ format?: "dms-lang.workspace" | undefined;
97
+ defaultLocale?: string | undefined;
98
+ locales?: {
99
+ code: string;
100
+ name?: string | undefined;
101
+ flag?: string | undefined;
102
+ }[] | undefined;
103
+ }, {
104
+ id: string;
105
+ messages: Record<string, unknown>;
106
+ type?: "" | "mobile" | "dms" | "website" | "other" | null | undefined;
107
+ description?: string | null | undefined;
108
+ version?: number | undefined;
109
+ format?: "dms-lang.workspace" | undefined;
110
+ defaultLocale?: string | undefined;
111
+ locales?: {
112
+ code: string;
113
+ name?: string | undefined;
114
+ flag?: string | undefined;
115
+ }[] | undefined;
116
+ }>;
117
+ addLocale: z.ZodObject<{
118
+ code: z.ZodString;
119
+ name: z.ZodOptional<z.ZodString>;
120
+ flag: z.ZodOptional<z.ZodString>;
121
+ } & {
122
+ workspace: z.ZodString;
123
+ }, "strip", z.ZodTypeAny, {
124
+ code: string;
125
+ workspace: string;
126
+ name?: string | undefined;
127
+ flag?: string | undefined;
128
+ }, {
129
+ code: string;
130
+ workspace: string;
131
+ name?: string | undefined;
132
+ flag?: string | undefined;
133
+ }>;
134
+ language: z.ZodObject<{
135
+ workspace: z.ZodString;
136
+ code: z.ZodString;
137
+ }, "strip", z.ZodTypeAny, {
138
+ code: string;
139
+ workspace: string;
140
+ }, {
141
+ code: string;
142
+ workspace: string;
143
+ }>;
144
+ };
145
+ export type ImportInput = z.infer<typeof workspaceSchema.import>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.workspaceSchema = void 0;
37
+ const z = __importStar(require("zod"));
38
+ const errors_1 = require("../utils/errors");
39
+ const export_1 = require("../utils/export");
40
+ const workspaces_1 = require("../utils/workspaces");
41
+ const DESCRIPTION_MAX_LENGTH = 500;
42
+ const NO_TYPE = "";
43
+ const id = z.string().trim().min(1);
44
+ const code = z.string({ message: (0, errors_1.errorMessage)("invalid_locale") }).min(1);
45
+ const localeEntry = z.object({
46
+ code,
47
+ name: z.string().optional(),
48
+ flag: z.string().optional(),
49
+ });
50
+ const backupStamp = {
51
+ format: z
52
+ .enum([export_1.BACKUP_FORMAT], { message: (0, errors_1.errorMessage)("invalid_backup") })
53
+ .optional(),
54
+ version: z
55
+ .number({ message: (0, errors_1.errorMessage)("invalid_backup") })
56
+ .int({ message: (0, errors_1.errorMessage)("invalid_backup") })
57
+ .positive({ message: (0, errors_1.errorMessage)("invalid_backup") })
58
+ .max(export_1.BACKUP_VERSION, { message: (0, errors_1.errorMessage)("newer_backup") })
59
+ .optional(),
60
+ };
61
+ const details = {
62
+ description: z.string().max(DESCRIPTION_MAX_LENGTH).nullish(),
63
+ type: z.enum(workspaces_1.WORKSPACE_TYPES).or(z.literal(NO_TYPE)).nullish(),
64
+ };
65
+ exports.workspaceSchema = {
66
+ create: z.object({ id, locale: localeEntry, ...details }),
67
+ update: z.object({ id, ...details }),
68
+ rename: z.object({ id, newId: id }),
69
+ remove: z.object({ id }),
70
+ import: z.object({
71
+ id,
72
+ messages: z.record(z.unknown(), {
73
+ message: (0, errors_1.errorMessage)("invalid_value"),
74
+ }),
75
+ locales: z.array(localeEntry).optional(),
76
+ defaultLocale: z.string().optional(),
77
+ ...backupStamp,
78
+ ...details,
79
+ }),
80
+ addLocale: localeEntry.extend({ workspace: id }),
81
+ language: z.object({ workspace: id, code }),
82
+ };
83
+ //# sourceMappingURL=workspace.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.schema.js","sourceRoot":"","sources":["../../src/validation/workspace.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,4CAA+C;AAC/C,4CAAgE;AAChE,oDAAsD;AAGtD,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACpC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAA,qBAAY,EAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE1E,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI;IACJ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAGH,MAAM,WAAW,GAAG;IAClB,MAAM,EAAE,CAAC;SACN,IAAI,CAA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