@kardalum/plugin-sdk 0.16.0 → 0.18.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/CHANGELOG.md +105 -0
- package/README.md +4 -3
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- package/dist/assets/asset-picker.d.ts +11 -0
- package/dist/assets/asset-picker.js +109 -0
- package/dist/assets/asset-tree.d.ts +30 -0
- package/dist/assets/asset-tree.js +150 -0
- package/dist/built-in-editor-ids.d.ts +1 -0
- package/dist/built-in-editor-ids.js +20 -0
- package/dist/built-in-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +27 -0
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +10 -1
- package/dist/capabilities.js +5 -3
- package/dist/datatype-validation.js +18 -4
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- package/dist/entitlement-entry.d.ts +3 -2
- package/dist/entitlement-entry.js +13 -1
- package/dist/entitlement-gate.d.ts +18 -0
- package/dist/entitlement-gate.js +95 -21
- package/dist/entitlement-plan.d.ts +21 -0
- package/dist/entitlement-plan.js +26 -0
- package/dist/entitlement-types.d.ts +21 -4
- package/dist/entitlement.d.ts +29 -1
- package/dist/entitlement.js +39 -0
- package/dist/grid-arrow-step.d.ts +7 -0
- package/dist/grid-arrow-step.js +20 -0
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +13 -18
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +4 -7
- package/dist/manifest-entry.d.ts +6 -2
- package/dist/manifest-entry.js +5 -1
- package/dist/manifest-schema.d.ts +56 -63
- package/dist/manifest-schema.js +103 -249
- package/dist/manifest.d.ts +61 -73
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +32 -32
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/plugin-screen-context.d.ts +11 -1
- package/dist/richtext/block-panel.js +19 -20
- package/dist/richtext/extensions.js +10 -1
- package/dist/richtext/insert-menu.js +1 -1
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +4 -4
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/structured-storage-types.d.ts +11 -0
- package/dist/tailwind.js +10 -3
- package/dist/tokens/tailwind-theme.css +176 -0
- package/dist/tokens/tokens.css +2 -0
- package/dist/tokens/tokens.json +4 -2
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- package/dist/vendor-check.d.ts +39 -0
- package/dist/vendor-check.js +79 -0
- package/dist/vendor-entry.d.ts +3 -0
- package/dist/vendor-entry.js +9 -0
- package/dist/vendor-service.d.ts +20 -0
- package/dist/vendor-service.js +20 -0
- package/dist/views/asset-view.d.ts +6 -0
- package/dist/views/asset-view.js +55 -0
- package/dist/views/content-list-settings-view.js +1 -1
- package/dist/views/content-list-view.js +1 -1
- package/dist/views/html-code-editor.js +0 -1
- package/dist/views/html-view.js +1 -1
- package/dist/views/image-view.js +1 -1
- package/dist/views/rich-text-view.js +30 -30
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +43 -10
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +60 -18
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +22 -6
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +52 -10
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +33 -14
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +25 -5
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +42 -2
- package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +73 -31
- package/node_modules/@kardalum/api-schemas/dist/index.js +47 -17
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +216 -63
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +117 -5
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +8 -18
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +9 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +240 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +164 -32
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +152 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +35 -23
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +6 -6
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +58 -25
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +194 -48
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +18 -6
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +115 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +65 -10
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +37 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +34 -8
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- package/node_modules/@kardalum/design-tokens/README.md +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +4 -2
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -0
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +5 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +59 -16
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +77 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +137 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +215 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -4
- package/node_modules/@kardalum/plugin-package/dist/index.js +10 -3
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -2
- package/node_modules/@kardalum/ui/README.md +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
- package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
- package/node_modules/@kardalum/ui/dist/index.js +1 -0
- package/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +19 -6
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { CultureSchema } from "./content-api.schema.js";
|
|
3
2
|
import { PluginRoleOfferSchema } from "./plugin-actions.schema.js";
|
|
4
|
-
import { HOSTILE_CHARS_MESSAGE, hasHostileChars } from "./plugin-docs-text.js";
|
|
5
3
|
import { SLOT_ID_MAX, SLOT_ID_REGEX } from "./plugin-id-rules.js";
|
|
6
|
-
import {
|
|
4
|
+
import { LABEL_KEY_MAX_LENGTH, LABEL_MAX_LANGUAGES, PluginLabelSchema, labelMapSchema, labelTextSchema, pluginLabelMapSchema } from "./plugin-labels.js";
|
|
7
5
|
import { RoleIdSchema } from "./role.schema.js";
|
|
8
6
|
// S292 (2026-10-13-s292-what-the-wizard-may-ask-design.md): what a plugin's
|
|
9
7
|
// install asks, declared as plain data in the manifest's `install`, so the
|
|
@@ -28,11 +26,12 @@ export const INSTALL_MAX_CHOICES_PER_OPTION = 64;
|
|
|
28
26
|
export const INSTALL_LABEL_MAX_LENGTH = 120;
|
|
29
27
|
/** The longest a description's text may be, per language. */
|
|
30
28
|
export const INSTALL_DESCRIPTION_MAX_LENGTH = 500;
|
|
31
|
-
/** The most languages one label or description may carry
|
|
32
|
-
|
|
29
|
+
/** The most languages one label or description may carry: every label map's
|
|
30
|
+
* bound (plugin-labels.ts). */
|
|
31
|
+
export const INSTALL_LABEL_MAX_LANGUAGES = LABEL_MAX_LANGUAGES;
|
|
33
32
|
/** The longest language code a label's key may be: DocsLanguageSchema's
|
|
34
33
|
* bound, checked before the culture pattern ever sees the key. */
|
|
35
|
-
export const INSTALL_LABEL_KEY_MAX_LENGTH =
|
|
34
|
+
export const INSTALL_LABEL_KEY_MAX_LENGTH = LABEL_KEY_MAX_LENGTH;
|
|
36
35
|
/** The most option answers one answers object may carry: every option of a full declaration. */
|
|
37
36
|
export const INSTALL_MAX_OPTION_ANSWERS = INSTALL_MAX_STEPS * INSTALL_MAX_OPTIONS_PER_STEP;
|
|
38
37
|
/** The most offered roles one answers object may name. */
|
|
@@ -45,58 +44,13 @@ export const INSTALL_OPTION_KINDS = ["boolean", "select", "multiSelect"];
|
|
|
45
44
|
* and the answers schema as keys, and no answers object can reach a
|
|
46
45
|
* prototype. */
|
|
47
46
|
const RESERVED_ANSWER_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
48
|
-
// One text of a label map
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.refine((text) => text.trim() !== "", { message: "must not be empty" })
|
|
56
|
-
.refine((text) => !hasHostileChars(text), { message: HOSTILE_CHARS_MESSAGE });
|
|
57
|
-
}
|
|
58
|
-
/** A label map's keys, bounded before the map is read: at most
|
|
59
|
-
* INSTALL_LABEL_MAX_LANGUAGES of them, each at most
|
|
60
|
-
* INSTALL_LABEL_KEY_MAX_LENGTH characters. An issue raised here ends the
|
|
61
|
-
* preprocess's pipe, so the map is not read at all: a map of thousands of
|
|
62
|
-
* keys costs one count, and a key too long to be a language code is never
|
|
63
|
-
* echoed, neither in a message nor in a path (where reading the map would
|
|
64
|
-
* put it, under a text the map refuses). */
|
|
65
|
-
function boundLabelKeys(value, ctx) {
|
|
66
|
-
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
67
|
-
return value;
|
|
68
|
-
const keys = Object.keys(value);
|
|
69
|
-
if (keys.length > INSTALL_LABEL_MAX_LANGUAGES) {
|
|
70
|
-
ctx.addIssue({ code: "custom", message: `a label holds at most ${INSTALL_LABEL_MAX_LANGUAGES} languages` });
|
|
71
|
-
}
|
|
72
|
-
if (keys.some((key) => key.length > INSTALL_LABEL_KEY_MAX_LENGTH)) {
|
|
73
|
-
ctx.addIssue({ code: "custom", message: `label keys are language codes of at most ${INSTALL_LABEL_KEY_MAX_LENGTH} characters` });
|
|
74
|
-
}
|
|
75
|
-
return value;
|
|
76
|
-
}
|
|
77
|
-
// A label map: a language code to the text shown in that language, `en`
|
|
78
|
-
// required because every other language falls back to it. Its keys are
|
|
79
|
-
// bounded first (boundLabelKeys), then follow a slot label's rule
|
|
80
|
-
// (CultureSchema), with the same message.
|
|
81
|
-
function installLabelMap(max) {
|
|
82
|
-
const text = installText(max);
|
|
83
|
-
return z.preprocess(boundLabelKeys, z
|
|
84
|
-
.object({ en: text })
|
|
85
|
-
.catchall(text)
|
|
86
|
-
.superRefine((label, ctx) => {
|
|
87
|
-
for (const key of Object.keys(label)) {
|
|
88
|
-
if (!CultureSchema.safeParse(key).success) {
|
|
89
|
-
ctx.addIssue({
|
|
90
|
-
code: "custom",
|
|
91
|
-
message: `label keys are language codes such as "en", "de" or "pt-BR", not ${JSON.stringify(key)}`,
|
|
92
|
-
path: [key],
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
export const InstallLabelSchema = installLabelMap(INSTALL_LABEL_MAX_LENGTH);
|
|
99
|
-
export const InstallDescriptionSchema = installLabelMap(INSTALL_DESCRIPTION_MAX_LENGTH);
|
|
47
|
+
// One text of a label map, and a label map itself: the one bounded rule every
|
|
48
|
+
// label of the manifest follows (plugin-labels.ts), with the install's own text
|
|
49
|
+
// lengths. A blank question on a screen, a key too long to be a language code
|
|
50
|
+
// and a Trojan-Source character are refused here as everywhere else.
|
|
51
|
+
const installText = (max) => labelTextSchema({ max });
|
|
52
|
+
export const InstallLabelSchema = labelMapSchema({ max: INSTALL_LABEL_MAX_LENGTH });
|
|
53
|
+
export const InstallDescriptionSchema = labelMapSchema({ max: INSTALL_DESCRIPTION_MAX_LENGTH });
|
|
100
54
|
/** A step's, an option's or a choice's id: the slot id rule, so an id needs
|
|
101
55
|
* no encoding anywhere it travels and can never be "." or "..". */
|
|
102
56
|
export const InstallIdSchema = z
|
|
@@ -453,13 +407,19 @@ export const INSTALL_CONSENT_IDS = ["migrations", "documentTypes", "actions", "t
|
|
|
453
407
|
* parts of a manifest no install schema bounds (the door's mirror leaves
|
|
454
408
|
* `contributions` unvalidated) and shown as text, so it is held to a
|
|
455
409
|
* label's text rule: at most 120 characters, never only whitespace, no
|
|
456
|
-
* control or direction-override character.
|
|
457
|
-
|
|
410
|
+
* control or direction-override character. An action's label may be a
|
|
411
|
+
* language map (S311), carried as declared under the map rule the action's
|
|
412
|
+
* own declaration follows (PluginLabelMapSchema), so a label the manifest
|
|
413
|
+
* accepts is always a name the screen can show in its own language. */
|
|
414
|
+
const InstallConsentTextSchema = installText(INSTALL_LABEL_MAX_LENGTH);
|
|
415
|
+
const InstallConsentLabelMapSchema = pluginLabelMapSchema();
|
|
416
|
+
const InstallConsentDetailSchema = z.union([InstallConsentTextSchema, InstallConsentLabelMapSchema]);
|
|
458
417
|
// The interface's parts, once: InstallInterfaceSchema holds them closed, and
|
|
459
|
-
// InstallInterfaceWireSchema below drops a key it does not know instead.
|
|
418
|
+
// InstallInterfaceWireSchema below drops a key it does not know instead. A
|
|
419
|
+
// role's label is the offer's, a string or a language map (S311).
|
|
460
420
|
const consentItemShape = { id: z.string(), details: z.array(InstallConsentDetailSchema) };
|
|
461
421
|
const sampleContentShape = { default: z.literal(true), description: InstallDescriptionSchema.optional() };
|
|
462
|
-
const roleOfferShape = { id: z.string(), label:
|
|
422
|
+
const roleOfferShape = { id: z.string(), label: PluginLabelSchema, actions: z.array(z.string()), default: z.literal(false) };
|
|
463
423
|
/** The install interface: what a screen shows and a script answers, before
|
|
464
424
|
* anything is installed. The marketplace stores it per version and its
|
|
465
425
|
* listing API carries it to the admin. A consent id is an open string on
|
|
@@ -495,18 +455,25 @@ function asRecord(value) {
|
|
|
495
455
|
}
|
|
496
456
|
/** A consent entry's readable name: the entry itself when it is a string
|
|
497
457
|
* (manifest.json's migration ids, an asset path), else its `field`, kept
|
|
498
|
-
* only when it passes
|
|
499
|
-
|
|
458
|
+
* only when it passes the detail's text rule. With `map`, the field may be a
|
|
459
|
+
* language map instead (an action's label, S311), kept when it passes
|
|
460
|
+
* PluginLabelMapSchema; every other name is an identifier and stays a string. */
|
|
461
|
+
function readableName(entry, field, map = false) {
|
|
500
462
|
const value = typeof entry === "string" ? entry : asRecord(entry)?.[field];
|
|
501
|
-
|
|
463
|
+
if (typeof value === "string")
|
|
464
|
+
return InstallConsentTextSchema.safeParse(value).success ? value : null;
|
|
465
|
+
if (!map)
|
|
466
|
+
return null;
|
|
467
|
+
const parsed = InstallConsentLabelMapSchema.safeParse(value);
|
|
468
|
+
return parsed.success ? parsed.data : null;
|
|
502
469
|
}
|
|
503
470
|
/** One consent item when the manifest declares any of it. A detail the text
|
|
504
471
|
* rule refuses is left out of the list, and the item stays: what it names
|
|
505
472
|
* is installed whether or not its name can be shown. */
|
|
506
|
-
function consentItem(id, declared, field) {
|
|
473
|
+
function consentItem(id, declared, field, map = false) {
|
|
507
474
|
if (!Array.isArray(declared) || declared.length === 0)
|
|
508
475
|
return null;
|
|
509
|
-
return { id, details: declared.map((entry) => readableName(entry, field)).filter((name) => name !== null) };
|
|
476
|
+
return { id, details: declared.map((entry) => readableName(entry, field, map)).filter((name) => name !== null) };
|
|
510
477
|
}
|
|
511
478
|
/** The interface a package's install asks, in the order a screen asks it:
|
|
512
479
|
* the consent list, the sample content when it ships, one unticked question
|
|
@@ -517,7 +484,7 @@ export function installInterfaceFor(manifest, shipped) {
|
|
|
517
484
|
const consent = [
|
|
518
485
|
consentItem("migrations", manifest.migrations, "id"),
|
|
519
486
|
consentItem("documentTypes", contributions.documentTypes, "name"),
|
|
520
|
-
consentItem("actions", manifest.actions, "label"),
|
|
487
|
+
consentItem("actions", manifest.actions, "label", true),
|
|
521
488
|
consentItem("templates", contributions.templates, "name"),
|
|
522
489
|
consentItem("assets", contributions.assets, "path"),
|
|
523
490
|
].filter((item) => item !== null);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export type SlotLabelMap = {
|
|
3
|
+
en: string;
|
|
4
|
+
[language: string]: string;
|
|
5
|
+
};
|
|
6
|
+
export type PluginLabel = string | SlotLabelMap;
|
|
7
|
+
/** The most languages one label map may carry. */
|
|
8
|
+
export declare const LABEL_MAX_LANGUAGES = 32;
|
|
9
|
+
/** The longest language code a label map's key may be: the longest a locale
|
|
10
|
+
* file's name can carry (DocsLanguageSchema's bound), checked before the
|
|
11
|
+
* culture pattern ever sees the key. */
|
|
12
|
+
export declare const LABEL_KEY_MAX_LENGTH = 35;
|
|
13
|
+
export interface LabelTextRule {
|
|
14
|
+
/** The longest the text may be, after trimming when `trim` is set. */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** Trim the text first, as a plain-string label is. */
|
|
17
|
+
trim?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** One text of a label: never empty or only whitespace (a blank tab or
|
|
20
|
+
* question, and a blank English label is one the generated reference
|
|
21
|
+
* refuses), no control or direction-override character, and at most `max`
|
|
22
|
+
* characters when given. Shown as text, never as markup. */
|
|
23
|
+
export declare function labelTextSchema({ max, trim }?: LabelTextRule): z.ZodString;
|
|
24
|
+
/** A label map: a language code to the text shown in that language, `en`
|
|
25
|
+
* required because every other language falls back to it. Its keys are
|
|
26
|
+
* bounded first (boundLabelKeys), then each is a language code under the
|
|
27
|
+
* same rule as the site's cultures setting (CultureSchema), so "" or
|
|
28
|
+
* "anything" is refused rather than carried as a language no locale can ever
|
|
29
|
+
* pick; every text follows labelTextSchema with `rule`. */
|
|
30
|
+
export declare function labelMapSchema(rule?: LabelTextRule): z.ZodPreprocess<z.ZodObject<{
|
|
31
|
+
en: z.ZodString;
|
|
32
|
+
}, z.core.$catchall<z.ZodString>>, unknown>;
|
|
33
|
+
/** A section's or a rail entry's label (S280): the map rule, at any length. */
|
|
34
|
+
export declare const SlotLabelSchema: z.ZodPreprocess<z.ZodObject<{
|
|
35
|
+
en: z.ZodString;
|
|
36
|
+
}, z.core.$catchall<z.ZodString>>, unknown>;
|
|
37
|
+
/** What the server stores for an action or an offered role is one string of at
|
|
38
|
+
* most 191 characters (MySQL's VARCHAR); 120 leaves room, and holds for every
|
|
39
|
+
* language of a map, since any of them may be the one stored. */
|
|
40
|
+
export declare const PLUGIN_LABEL_MAX = 120;
|
|
41
|
+
/** A label written as one string, trimmed, 1 to 120 characters. The generated
|
|
42
|
+
* reference carries this form, the English text of whatever was declared. */
|
|
43
|
+
export declare const PluginLabelStringSchema: z.ZodString;
|
|
44
|
+
/** A label written as a map, its texts trimmed as a string is: a fresh
|
|
45
|
+
* instance of the rule each call. The install screen's consent list holds an
|
|
46
|
+
* action's label map to exactly this rule through its own instance, because
|
|
47
|
+
* the OpenAPI conversion drops a schema instance that a new union reuses. */
|
|
48
|
+
export declare function pluginLabelMapSchema(): z.ZodPreprocess<z.ZodObject<{
|
|
49
|
+
en: z.ZodString;
|
|
50
|
+
}, z.core.$catchall<z.ZodString>>, unknown>;
|
|
51
|
+
export declare const PluginLabelMapSchema: z.ZodPreprocess<z.ZodObject<{
|
|
52
|
+
en: z.ZodString;
|
|
53
|
+
}, z.core.$catchall<z.ZodString>>, unknown>;
|
|
54
|
+
export declare const PluginLabelSchema: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
55
|
+
en: z.ZodString;
|
|
56
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
57
|
+
/** The text of a label for a language: the language as given, else its primary
|
|
58
|
+
* subtag (`de-AT` reads `de`), else `en`, which every map carries. Codes
|
|
59
|
+
* compare case-insensitively (BCP 47 tags do). A plain string is its own text. */
|
|
60
|
+
export declare function resolveLabel(label: PluginLabel, language: string): string;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CultureSchema } from "./content-api.schema.js";
|
|
3
|
+
import { HOSTILE_CHARS_MESSAGE, hasHostileChars } from "./plugin-docs-text.js";
|
|
4
|
+
import { DOCS_LANGUAGE_MAX_LENGTH } from "./plugin-locales.js";
|
|
5
|
+
/** The most languages one label map may carry. */
|
|
6
|
+
export const LABEL_MAX_LANGUAGES = 32;
|
|
7
|
+
/** The longest language code a label map's key may be: the longest a locale
|
|
8
|
+
* file's name can carry (DocsLanguageSchema's bound), checked before the
|
|
9
|
+
* culture pattern ever sees the key. */
|
|
10
|
+
export const LABEL_KEY_MAX_LENGTH = DOCS_LANGUAGE_MAX_LENGTH;
|
|
11
|
+
/** A label map's keys, bounded before the map is read: at most
|
|
12
|
+
* LABEL_MAX_LANGUAGES of them, each at most LABEL_KEY_MAX_LENGTH characters.
|
|
13
|
+
* An issue raised here ends the preprocess's pipe, so the map is not read at
|
|
14
|
+
* all: a map of thousands of keys costs one count, and a key too long to be a
|
|
15
|
+
* language code is never echoed, neither in a message nor in a path (where
|
|
16
|
+
* reading the map would put it, under a text the map refuses). */
|
|
17
|
+
function boundLabelKeys(value, ctx) {
|
|
18
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
19
|
+
return value;
|
|
20
|
+
const keys = Object.keys(value);
|
|
21
|
+
if (keys.length > LABEL_MAX_LANGUAGES) {
|
|
22
|
+
ctx.addIssue({ code: "custom", message: `a label holds at most ${LABEL_MAX_LANGUAGES} languages` });
|
|
23
|
+
}
|
|
24
|
+
if (keys.some((key) => key.length > LABEL_KEY_MAX_LENGTH)) {
|
|
25
|
+
ctx.addIssue({ code: "custom", message: `label keys are language codes of at most ${LABEL_KEY_MAX_LENGTH} characters` });
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
/** One text of a label: never empty or only whitespace (a blank tab or
|
|
30
|
+
* question, and a blank English label is one the generated reference
|
|
31
|
+
* refuses), no control or direction-override character, and at most `max`
|
|
32
|
+
* characters when given. Shown as text, never as markup. */
|
|
33
|
+
export function labelTextSchema({ max, trim = false } = {}) {
|
|
34
|
+
let text = z.string({ error: "must be text" });
|
|
35
|
+
if (trim)
|
|
36
|
+
text = text.trim();
|
|
37
|
+
if (max !== undefined)
|
|
38
|
+
text = text.max(max, { message: `is at most ${max} characters` });
|
|
39
|
+
return text
|
|
40
|
+
.refine((value) => value.trim() !== "", { message: "must not be empty" })
|
|
41
|
+
.refine((value) => !hasHostileChars(value), { message: HOSTILE_CHARS_MESSAGE });
|
|
42
|
+
}
|
|
43
|
+
/** A label map: a language code to the text shown in that language, `en`
|
|
44
|
+
* required because every other language falls back to it. Its keys are
|
|
45
|
+
* bounded first (boundLabelKeys), then each is a language code under the
|
|
46
|
+
* same rule as the site's cultures setting (CultureSchema), so "" or
|
|
47
|
+
* "anything" is refused rather than carried as a language no locale can ever
|
|
48
|
+
* pick; every text follows labelTextSchema with `rule`. */
|
|
49
|
+
export function labelMapSchema(rule = {}) {
|
|
50
|
+
const text = labelTextSchema(rule);
|
|
51
|
+
return z.preprocess(boundLabelKeys, z
|
|
52
|
+
.object({ en: text })
|
|
53
|
+
.catchall(text)
|
|
54
|
+
.superRefine((label, ctx) => {
|
|
55
|
+
for (const key of Object.keys(label)) {
|
|
56
|
+
if (!CultureSchema.safeParse(key).success) {
|
|
57
|
+
ctx.addIssue({
|
|
58
|
+
code: "custom",
|
|
59
|
+
message: `label keys are language codes such as "en", "de" or "pt-BR", not ${JSON.stringify(key)}`,
|
|
60
|
+
path: [key],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
/** A section's or a rail entry's label (S280): the map rule, at any length. */
|
|
67
|
+
export const SlotLabelSchema = labelMapSchema();
|
|
68
|
+
/** What the server stores for an action or an offered role is one string of at
|
|
69
|
+
* most 191 characters (MySQL's VARCHAR); 120 leaves room, and holds for every
|
|
70
|
+
* language of a map, since any of them may be the one stored. */
|
|
71
|
+
export const PLUGIN_LABEL_MAX = 120;
|
|
72
|
+
/** A label written as one string, trimmed, 1 to 120 characters. The generated
|
|
73
|
+
* reference carries this form, the English text of whatever was declared. */
|
|
74
|
+
export const PluginLabelStringSchema = labelTextSchema({ max: PLUGIN_LABEL_MAX, trim: true });
|
|
75
|
+
/** A label written as a map, its texts trimmed as a string is: a fresh
|
|
76
|
+
* instance of the rule each call. The install screen's consent list holds an
|
|
77
|
+
* action's label map to exactly this rule through its own instance, because
|
|
78
|
+
* the OpenAPI conversion drops a schema instance that a new union reuses. */
|
|
79
|
+
export function pluginLabelMapSchema() {
|
|
80
|
+
return labelMapSchema({ max: PLUGIN_LABEL_MAX, trim: true });
|
|
81
|
+
}
|
|
82
|
+
export const PluginLabelMapSchema = pluginLabelMapSchema();
|
|
83
|
+
const LABEL_HINT = "a string, or a map with en required";
|
|
84
|
+
/** A label neither branch accepts is explained once: a map that carries its
|
|
85
|
+
* English text by the map's own first problem (too many languages, a key that
|
|
86
|
+
* is not a language code, a text that is not one), anything else by what a
|
|
87
|
+
* label is. */
|
|
88
|
+
function labelUnionError(issue) {
|
|
89
|
+
if (issue.code !== "invalid_union")
|
|
90
|
+
return undefined;
|
|
91
|
+
const value = issue.input;
|
|
92
|
+
const first = issue.errors?.[1]?.[0];
|
|
93
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.en === "string" && first) {
|
|
94
|
+
return first.path.length > 0 ? `${first.path.map(String).join(".")}: ${first.message}` : first.message;
|
|
95
|
+
}
|
|
96
|
+
return LABEL_HINT;
|
|
97
|
+
}
|
|
98
|
+
export const PluginLabelSchema = z.union([PluginLabelStringSchema, PluginLabelMapSchema], { error: labelUnionError });
|
|
99
|
+
/** The text of a label for a language: the language as given, else its primary
|
|
100
|
+
* subtag (`de-AT` reads `de`), else `en`, which every map carries. Codes
|
|
101
|
+
* compare case-insensitively (BCP 47 tags do). A plain string is its own text. */
|
|
102
|
+
export function resolveLabel(label, language) {
|
|
103
|
+
if (typeof label === "string")
|
|
104
|
+
return label;
|
|
105
|
+
const wanted = language.toLowerCase();
|
|
106
|
+
const primary = wanted.split("-")[0] ?? "";
|
|
107
|
+
let primaryText;
|
|
108
|
+
for (const [code, text] of Object.entries(label)) {
|
|
109
|
+
const lower = code.toLowerCase();
|
|
110
|
+
if (lower === wanted)
|
|
111
|
+
return text;
|
|
112
|
+
if (primaryText === undefined && primary !== "" && lower === primary)
|
|
113
|
+
primaryText = text;
|
|
114
|
+
}
|
|
115
|
+
return primaryText ?? label.en;
|
|
116
|
+
}
|
|
@@ -71,5 +71,12 @@ export type PluginLanguages = z.infer<typeof PluginLanguagesSchema>;
|
|
|
71
71
|
* (extra keys and placeholder drift are author errors `validate` fails,
|
|
72
72
|
* not missing words). With no readable en.json there is nothing to compare,
|
|
73
73
|
* so no other language is complete. `docs` is a language code the caller
|
|
74
|
-
* has already checked.
|
|
75
|
-
|
|
74
|
+
* has already checked.
|
|
75
|
+
*
|
|
76
|
+
* S311: `labelLanguages` are the language codes the manifest's label maps
|
|
77
|
+
* use. A language only labels use is listed too, and is never complete: its
|
|
78
|
+
* screens' words show English. A code is taken under DocsLanguageSchema's
|
|
79
|
+
* rule (a language code of at most 35 characters, the longest a locale
|
|
80
|
+
* file's name can carry), and one a file already lists, in any case, is not
|
|
81
|
+
* listed twice. */
|
|
82
|
+
export declare function summarizePluginLanguages(bundles: ReadonlyMap<string, PluginLocaleFile>, docs: string, labelLanguages?: ReadonlyArray<string>): PluginLanguages;
|
|
@@ -196,17 +196,32 @@ export const PluginLanguagesSchema = z
|
|
|
196
196
|
* (extra keys and placeholder drift are author errors `validate` fails,
|
|
197
197
|
* not missing words). With no readable en.json there is nothing to compare,
|
|
198
198
|
* so no other language is complete. `docs` is a language code the caller
|
|
199
|
-
* has already checked.
|
|
200
|
-
|
|
199
|
+
* has already checked.
|
|
200
|
+
*
|
|
201
|
+
* S311: `labelLanguages` are the language codes the manifest's label maps
|
|
202
|
+
* use. A language only labels use is listed too, and is never complete: its
|
|
203
|
+
* screens' words show English. A code is taken under DocsLanguageSchema's
|
|
204
|
+
* rule (a language code of at most 35 characters, the longest a locale
|
|
205
|
+
* file's name can carry), and one a file already lists, in any case, is not
|
|
206
|
+
* listed twice. */
|
|
207
|
+
export function summarizePluginLanguages(bundles, docs, labelLanguages = []) {
|
|
201
208
|
const en = bundles.get("en");
|
|
202
|
-
const
|
|
209
|
+
const codes = new Set(bundles.keys());
|
|
210
|
+
const listed = new Set([...codes].map((code) => code.toLowerCase()));
|
|
211
|
+
for (const code of labelLanguages) {
|
|
212
|
+
if (listed.has(code.toLowerCase()) || !DocsLanguageSchema.safeParse(code).success)
|
|
213
|
+
continue;
|
|
214
|
+
codes.add(code);
|
|
215
|
+
listed.add(code.toLowerCase());
|
|
216
|
+
}
|
|
217
|
+
const others = [...codes].filter((code) => code !== "en").sort();
|
|
203
218
|
return {
|
|
204
219
|
ui: [
|
|
205
220
|
{ code: "en", complete: true },
|
|
206
|
-
...others.map((code) =>
|
|
207
|
-
code
|
|
208
|
-
complete: en !== undefined && compareLocaleFiles(en,
|
|
209
|
-
})
|
|
221
|
+
...others.map((code) => {
|
|
222
|
+
const bundle = bundles.get(code);
|
|
223
|
+
return { code, complete: en !== undefined && bundle !== undefined && compareLocaleFiles(en, bundle).missing.length === 0 };
|
|
224
|
+
}),
|
|
210
225
|
],
|
|
211
226
|
docs,
|
|
212
227
|
};
|