@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PLAN_KEY_MAX = 64;
|
|
3
|
+
export declare const PLAN_NAME_MAX = 200;
|
|
4
|
+
export declare const PLAN_DESCRIPTION_MAX = 2000;
|
|
5
|
+
/** $1 floor (Stripe's charge minimum with margin) and a $10,000 sanity cap. */
|
|
6
|
+
export declare const PLAN_MIN_PRICE_CENTS = 100;
|
|
7
|
+
export declare const PLAN_MAX_PRICE_CENTS = 1000000;
|
|
8
|
+
export declare const PLAN_SHAPE_VALUES: readonly ["free", "one_time", "monthly", "yearly"];
|
|
9
|
+
export type PlanShapeValue = (typeof PLAN_SHAPE_VALUES)[number];
|
|
10
|
+
/**
|
|
11
|
+
* A plan key: 1 to 64 characters, lowercase ASCII letters, digits and single
|
|
12
|
+
* hyphens, starting with a letter and ending with a letter or digit. A linear
|
|
13
|
+
* scan with the length checked first, never a regex (untrusted text).
|
|
14
|
+
*/
|
|
15
|
+
export declare function isPlanKey(value: string): boolean;
|
|
16
|
+
/** S315 section 3a: a free plan costs 0, every other shape whole cents from $1 to $10,000. */
|
|
17
|
+
export declare function planPriceAgrees(shape: string, priceCents: number): boolean;
|
|
18
|
+
export declare const PlanKeySchema: z.ZodString;
|
|
19
|
+
export declare const PlanNameSchema: z.ZodString;
|
|
20
|
+
export declare const PlanDescriptionSchema: z.ZodString;
|
|
21
|
+
export declare const PlanShapeSchema: z.ZodEnum<{
|
|
22
|
+
free: "free";
|
|
23
|
+
one_time: "one_time";
|
|
24
|
+
monthly: "monthly";
|
|
25
|
+
yearly: "yearly";
|
|
26
|
+
}>;
|
|
27
|
+
export declare const PlanAddInputSchema: z.ZodObject<{
|
|
28
|
+
listingId: z.ZodString;
|
|
29
|
+
key: z.ZodString;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
description: z.ZodString;
|
|
32
|
+
shape: z.ZodEnum<{
|
|
33
|
+
free: "free";
|
|
34
|
+
one_time: "one_time";
|
|
35
|
+
monthly: "monthly";
|
|
36
|
+
yearly: "yearly";
|
|
37
|
+
}>;
|
|
38
|
+
priceCents: z.ZodNumber;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export type PlanAddInput = z.infer<typeof PlanAddInputSchema>;
|
|
41
|
+
/** Name and description always; key, shape and price only while the plan was never held (D4, S315 D8). */
|
|
42
|
+
export declare const PlanEditInputSchema: z.ZodObject<{
|
|
43
|
+
planId: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
description: z.ZodString;
|
|
46
|
+
key: z.ZodOptional<z.ZodString>;
|
|
47
|
+
shape: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
free: "free";
|
|
49
|
+
one_time: "one_time";
|
|
50
|
+
monthly: "monthly";
|
|
51
|
+
yearly: "yearly";
|
|
52
|
+
}>>;
|
|
53
|
+
priceCents: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export type PlanEditInput = z.infer<typeof PlanEditInputSchema>;
|
|
56
|
+
export declare const PlanRefInputSchema: z.ZodObject<{
|
|
57
|
+
planId: z.ZodString;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
export type PlanRefInput = z.infer<typeof PlanRefInputSchema>;
|
|
60
|
+
export declare const PlanMoveInputSchema: z.ZodObject<{
|
|
61
|
+
planId: z.ZodString;
|
|
62
|
+
direction: z.ZodEnum<{
|
|
63
|
+
up: "up";
|
|
64
|
+
down: "down";
|
|
65
|
+
}>;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
export type PlanMoveInput = z.infer<typeof PlanMoveInputSchema>;
|
|
68
|
+
export declare const PlanPriceInputSchema: z.ZodObject<{
|
|
69
|
+
planId: z.ZodString;
|
|
70
|
+
priceCents: z.ZodNumber;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export type PlanPriceInput = z.infer<typeof PlanPriceInputSchema>;
|
|
73
|
+
/** S321c (spec 3c): a price change's background notices as the plans page
|
|
74
|
+
* reads them. While the sweep runs, `waiting` counts the subscribers not
|
|
75
|
+
* reached yet and those whose email has not gone out; after the walk, only
|
|
76
|
+
* the latter. `walking` while the walk has subscribers left to reach (the
|
|
77
|
+
* page reads its progress again only then); `finished` once every subscriber
|
|
78
|
+
* was told. */
|
|
79
|
+
export declare const PriceSweepProgressSchema: z.ZodObject<{
|
|
80
|
+
total: z.ZodNumber;
|
|
81
|
+
told: z.ZodNumber;
|
|
82
|
+
waiting: z.ZodNumber;
|
|
83
|
+
walking: z.ZodBoolean;
|
|
84
|
+
finished: z.ZodBoolean;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
export type PriceSweepProgress = z.infer<typeof PriceSweepProgressSchema>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// S321 (spec 3b, D4; S315 section 3a): what the author's plans editor sends.
|
|
3
|
+
// The plan key is what a plugin reads as planId (S317) and what the vendor
|
|
4
|
+
// token carries (S320), so its caps live here and vendor-service.schema.ts
|
|
5
|
+
// reads them: a longer key or name could never be signed.
|
|
6
|
+
export const PLAN_KEY_MAX = 64;
|
|
7
|
+
export const PLAN_NAME_MAX = 200;
|
|
8
|
+
export const PLAN_DESCRIPTION_MAX = 2000;
|
|
9
|
+
/** $1 floor (Stripe's charge minimum with margin) and a $10,000 sanity cap. */
|
|
10
|
+
export const PLAN_MIN_PRICE_CENTS = 100;
|
|
11
|
+
export const PLAN_MAX_PRICE_CENTS = 1_000_000;
|
|
12
|
+
export const PLAN_SHAPE_VALUES = ["free", "one_time", "monthly", "yearly"];
|
|
13
|
+
/**
|
|
14
|
+
* A plan key: 1 to 64 characters, lowercase ASCII letters, digits and single
|
|
15
|
+
* hyphens, starting with a letter and ending with a letter or digit. A linear
|
|
16
|
+
* scan with the length checked first, never a regex (untrusted text).
|
|
17
|
+
*/
|
|
18
|
+
export function isPlanKey(value) {
|
|
19
|
+
if (value.length < 1 || value.length > PLAN_KEY_MAX)
|
|
20
|
+
return false;
|
|
21
|
+
for (let i = 0; i < value.length; i++) {
|
|
22
|
+
const c = value.charCodeAt(i);
|
|
23
|
+
const lower = c >= 97 && c <= 122;
|
|
24
|
+
const digit = c >= 48 && c <= 57;
|
|
25
|
+
const hyphen = c === 45;
|
|
26
|
+
if (i === 0 && !lower)
|
|
27
|
+
return false;
|
|
28
|
+
if (!lower && !digit && !hyphen)
|
|
29
|
+
return false;
|
|
30
|
+
if (hyphen && (i === value.length - 1 || value.charCodeAt(i + 1) === 45))
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
/** S315 section 3a: a free plan costs 0, every other shape whole cents from $1 to $10,000. */
|
|
36
|
+
export function planPriceAgrees(shape, priceCents) {
|
|
37
|
+
if (!Number.isInteger(priceCents))
|
|
38
|
+
return false;
|
|
39
|
+
if (shape === "free")
|
|
40
|
+
return priceCents === 0;
|
|
41
|
+
return priceCents >= PLAN_MIN_PRICE_CENTS && priceCents <= PLAN_MAX_PRICE_CENTS;
|
|
42
|
+
}
|
|
43
|
+
const PRICE_SHAPE_MESSAGE = "A free plan costs 0; any other plan costs from $1.00 to $10,000.00";
|
|
44
|
+
// A listing or plan id is never validated beyond its length: a wrong one
|
|
45
|
+
// reads as "not found" from the owner-scoped query, like someone else's.
|
|
46
|
+
const RowIdSchema = z.string().min(1).max(64);
|
|
47
|
+
export const PlanKeySchema = z
|
|
48
|
+
.string()
|
|
49
|
+
.max(PLAN_KEY_MAX, `A plan key is at most ${PLAN_KEY_MAX} characters`)
|
|
50
|
+
.refine(isPlanKey, "A plan key uses lowercase letters, digits and single hyphens, starts with a letter and ends with a letter or digit");
|
|
51
|
+
export const PlanNameSchema = z.string().trim().min(1, "Give the plan a name").max(PLAN_NAME_MAX, `A plan name is at most ${PLAN_NAME_MAX} characters`);
|
|
52
|
+
export const PlanDescriptionSchema = z.string().trim().max(PLAN_DESCRIPTION_MAX, `A plan description is at most ${PLAN_DESCRIPTION_MAX} characters`);
|
|
53
|
+
export const PlanShapeSchema = z.enum(PLAN_SHAPE_VALUES, "Choose free, one-time, monthly or yearly");
|
|
54
|
+
const PlanCentsSchema = z.number().int().min(0).max(PLAN_MAX_PRICE_CENTS, "Maximum price is $10,000.00");
|
|
55
|
+
export const PlanAddInputSchema = z
|
|
56
|
+
.object({ listingId: RowIdSchema, key: PlanKeySchema, name: PlanNameSchema, description: PlanDescriptionSchema, shape: PlanShapeSchema, priceCents: PlanCentsSchema })
|
|
57
|
+
.strict()
|
|
58
|
+
.refine((input) => planPriceAgrees(input.shape, input.priceCents), { message: PRICE_SHAPE_MESSAGE, path: ["priceCents"] });
|
|
59
|
+
/** Name and description always; key, shape and price only while the plan was never held (D4, S315 D8). */
|
|
60
|
+
export const PlanEditInputSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
planId: RowIdSchema,
|
|
63
|
+
name: PlanNameSchema,
|
|
64
|
+
description: PlanDescriptionSchema,
|
|
65
|
+
key: PlanKeySchema.optional(),
|
|
66
|
+
shape: PlanShapeSchema.optional(),
|
|
67
|
+
priceCents: PlanCentsSchema.optional(),
|
|
68
|
+
})
|
|
69
|
+
.strict();
|
|
70
|
+
export const PlanRefInputSchema = z.object({ planId: RowIdSchema }).strict();
|
|
71
|
+
export const PlanMoveInputSchema = z.object({ planId: RowIdSchema, direction: z.enum(["up", "down"]) }).strict();
|
|
72
|
+
export const PlanPriceInputSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
planId: RowIdSchema,
|
|
75
|
+
priceCents: z.number().int().min(PLAN_MIN_PRICE_CENTS, "A paid plan costs at least $1.00").max(PLAN_MAX_PRICE_CENTS, "Maximum price is $10,000.00"),
|
|
76
|
+
})
|
|
77
|
+
.strict();
|
|
78
|
+
/** S321c (spec 3c): a price change's background notices as the plans page
|
|
79
|
+
* reads them. While the sweep runs, `waiting` counts the subscribers not
|
|
80
|
+
* reached yet and those whose email has not gone out; after the walk, only
|
|
81
|
+
* the latter. `walking` while the walk has subscribers left to reach (the
|
|
82
|
+
* page reads its progress again only then); `finished` once every subscriber
|
|
83
|
+
* was told. */
|
|
84
|
+
export const PriceSweepProgressSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
total: z.number().int().nonnegative(),
|
|
87
|
+
told: z.number().int().nonnegative(),
|
|
88
|
+
waiting: z.number().int().nonnegative(),
|
|
89
|
+
walking: z.boolean(),
|
|
90
|
+
finished: z.boolean(),
|
|
91
|
+
})
|
|
92
|
+
.strict();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const PluginActionDeclarationSchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodString;
|
|
4
|
-
label: z.ZodString
|
|
4
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
5
|
+
en: z.ZodString;
|
|
6
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
5
7
|
}, z.core.$strip>;
|
|
6
8
|
export type PluginActionDeclaration = z.infer<typeof PluginActionDeclarationSchema>;
|
|
7
9
|
/** A role a plugin offers. Never applied unasked: the operator accepts it
|
|
@@ -9,7 +11,9 @@ export type PluginActionDeclaration = z.infer<typeof PluginActionDeclarationSche
|
|
|
9
11
|
* result is an ordinary editable role. */
|
|
10
12
|
export declare const PluginRoleOfferSchema: z.ZodObject<{
|
|
11
13
|
id: z.ZodString;
|
|
12
|
-
label: z.ZodString
|
|
14
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodPreprocess<z.ZodObject<{
|
|
15
|
+
en: z.ZodString;
|
|
16
|
+
}, z.core.$catchall<z.ZodString>>, unknown>]>;
|
|
13
17
|
actions: z.ZodArray<z.ZodString>;
|
|
14
18
|
}, z.core.$strip>;
|
|
15
19
|
export type PluginRoleOffer = z.infer<typeof PluginRoleOfferSchema>;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ActionStringSchema } from "./action.schema.js";
|
|
3
|
+
import { PluginLabelSchema } from "./plugin-labels.js";
|
|
3
4
|
import { RoleIdSchema } from "./role.schema.js";
|
|
4
5
|
// S273: what a plugin declares about permissions. These two shapes are the
|
|
5
6
|
// one definition the SDK manifest schema, the marketplace listing and the
|
|
6
7
|
// installed-plugin list all reuse, so a label an author wrote reaches the
|
|
7
8
|
// install screen and the Roles screen unchanged.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
// A label is what the role editor and the install screen show; nothing ever
|
|
10
|
+
// shows an operator a raw action string. Since S311 it may be a language map
|
|
11
|
+
// (PluginLabelSchema, the shape a section's label has) or a plain string; the
|
|
12
|
+
// server stores one string per action and per role, the map resolved to the
|
|
13
|
+
// site's default language when the plugin is installed.
|
|
12
14
|
export const PluginActionDeclarationSchema = z.object({
|
|
13
15
|
id: ActionStringSchema,
|
|
14
|
-
label:
|
|
16
|
+
label: PluginLabelSchema,
|
|
15
17
|
});
|
|
16
18
|
/** A role a plugin offers. Never applied unasked: the operator accepts it
|
|
17
19
|
* on the install screen or later from the installed-plugins view, and the
|
|
18
20
|
* result is an ordinary editable role. */
|
|
19
21
|
export const PluginRoleOfferSchema = z.object({
|
|
20
22
|
id: RoleIdSchema,
|
|
21
|
-
label:
|
|
23
|
+
label: PluginLabelSchema,
|
|
22
24
|
actions: z.array(ActionStringSchema).min(1),
|
|
23
25
|
});
|
|
24
26
|
export const OfferedRoleParamsSchema = z.object({
|
|
@@ -63,6 +63,11 @@ export declare const PluginDocsPluginParamsSchema: z.ZodObject<{
|
|
|
63
63
|
pluginId: z.ZodString;
|
|
64
64
|
}, z.core.$strip>;
|
|
65
65
|
export type PluginDocsPluginParams = z.infer<typeof PluginDocsPluginParamsSchema>;
|
|
66
|
+
export declare const PluginDocsImageParamsSchema: z.ZodObject<{
|
|
67
|
+
pluginId: z.ZodString;
|
|
68
|
+
"*": z.ZodString;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type PluginDocsImageParams = z.infer<typeof PluginDocsImageParamsSchema>;
|
|
66
71
|
export declare const PluginDocsPageResponseSchema: z.ZodObject<{
|
|
67
72
|
pluginId: z.ZodString;
|
|
68
73
|
version: z.ZodString;
|
|
@@ -80,8 +85,8 @@ export declare const PluginDocsPageResponseSchema: z.ZodObject<{
|
|
|
80
85
|
}, z.core.$strip>;
|
|
81
86
|
export type PluginDocsPageResponse = z.infer<typeof PluginDocsPageResponseSchema>;
|
|
82
87
|
export declare const PluginReferenceSourceSchema: z.ZodEnum<{
|
|
83
|
-
package: "package";
|
|
84
88
|
live: "live";
|
|
89
|
+
package: "package";
|
|
85
90
|
}>;
|
|
86
91
|
export type PluginReferenceSource = z.infer<typeof PluginReferenceSourceSchema>;
|
|
87
92
|
/** S289: "live" is built from the manifest the server has attached; "package"
|
|
@@ -90,8 +95,8 @@ export declare const PluginDocsReferenceResponseSchema: z.ZodObject<{
|
|
|
90
95
|
pluginId: z.ZodString;
|
|
91
96
|
version: z.ZodString;
|
|
92
97
|
source: z.ZodEnum<{
|
|
93
|
-
package: "package";
|
|
94
98
|
live: "live";
|
|
99
|
+
package: "package";
|
|
95
100
|
}>;
|
|
96
101
|
reference: z.ZodObject<{
|
|
97
102
|
actions: z.ZodArray<z.ZodObject<{
|
|
@@ -100,8 +105,8 @@ export declare const PluginDocsReferenceResponseSchema: z.ZodObject<{
|
|
|
100
105
|
}, z.core.$strip>>;
|
|
101
106
|
roles: z.ZodArray<z.ZodObject<{
|
|
102
107
|
id: z.ZodString;
|
|
103
|
-
label: z.ZodString;
|
|
104
108
|
actions: z.ZodArray<z.ZodString>;
|
|
109
|
+
label: z.ZodString;
|
|
105
110
|
}, z.core.$strip>>;
|
|
106
111
|
apiRoutes: z.ZodArray<z.ZodObject<{
|
|
107
112
|
method: z.ZodString;
|
|
@@ -135,11 +140,6 @@ export declare const PluginDocsReferenceResponseSchema: z.ZodObject<{
|
|
|
135
140
|
kind: z.ZodString;
|
|
136
141
|
documentType: z.ZodOptional<z.ZodString>;
|
|
137
142
|
}, z.core.$strict>>;
|
|
138
|
-
settingsPages: z.ZodArray<z.ZodObject<{
|
|
139
|
-
id: z.ZodString;
|
|
140
|
-
name: z.ZodString;
|
|
141
|
-
action: z.ZodString;
|
|
142
|
-
}, z.core.$strict>>;
|
|
143
143
|
adminSections: z.ZodArray<z.ZodObject<{
|
|
144
144
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
145
145
|
rail: z.ZodArray<z.ZodObject<{
|
|
@@ -161,16 +161,6 @@ export declare const PluginDocsReferenceResponseSchema: z.ZodObject<{
|
|
|
161
161
|
id: z.ZodString;
|
|
162
162
|
action: z.ZodString;
|
|
163
163
|
}, z.core.$strict>>;
|
|
164
|
-
editorToolbar: z.ZodArray<z.ZodObject<{
|
|
165
|
-
label: z.ZodString;
|
|
166
|
-
id: z.ZodString;
|
|
167
|
-
action: z.ZodString;
|
|
168
|
-
}, z.core.$strict>>;
|
|
169
|
-
contentTreeActions: z.ZodArray<z.ZodObject<{
|
|
170
|
-
label: z.ZodString;
|
|
171
|
-
id: z.ZodString;
|
|
172
|
-
action: z.ZodString;
|
|
173
|
-
}, z.core.$strict>>;
|
|
174
164
|
hooks: z.ZodArray<z.ZodString>;
|
|
175
165
|
scheduledTasks: z.ZodArray<z.ZodObject<{
|
|
176
166
|
id: z.ZodString;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { PLUGIN_DOC_ROLES, PluginReferenceSchema } from "./plugin-docs.js";
|
|
3
|
+
import { MAX_DOCS_TARGET_LENGTH } from "./plugin-docs-text.js";
|
|
3
4
|
// S287. The shapes of the four JSON routes the server serves to the admin:
|
|
4
5
|
// the docs index, one page, the reference tables and the search index.
|
|
5
6
|
export const PluginDocsPageRefSchema = z.object({
|
|
@@ -26,6 +27,12 @@ export const PluginDocsPageParamsSchema = z.object({
|
|
|
26
27
|
export const PluginDocsPluginParamsSchema = z.object({
|
|
27
28
|
pluginId: z.string().min(1),
|
|
28
29
|
});
|
|
30
|
+
// S314c3 (D2): GET /plugin-docs/:pluginId/images/*, an image of the stored package by its package
|
|
31
|
+
// path (the `*` param, as Fastify names a wildcard).
|
|
32
|
+
export const PluginDocsImageParamsSchema = z.object({
|
|
33
|
+
pluginId: z.string().min(1),
|
|
34
|
+
"*": z.string().min(1).max(MAX_DOCS_TARGET_LENGTH),
|
|
35
|
+
});
|
|
29
36
|
export const PluginDocsPageResponseSchema = z.object({
|
|
30
37
|
pluginId: z.string(),
|
|
31
38
|
version: z.string(),
|
|
@@ -32,9 +32,8 @@ export interface DocsFacts {
|
|
|
32
32
|
hasDependencies: boolean;
|
|
33
33
|
hasPrice: boolean;
|
|
34
34
|
hasDocumentTypes: boolean;
|
|
35
|
-
hasSettingsPages: boolean;
|
|
36
35
|
}
|
|
37
|
-
/** Reads the
|
|
36
|
+
/** Reads the four facts from a live manifest or from manifest.json. The
|
|
38
37
|
* summary keeps each contribution list as a list of redacted entries,
|
|
39
38
|
* reduces migrations to their ids, and says `paid: true` where the live
|
|
40
39
|
* manifest has a price above 0: the amount itself never reaches
|
|
@@ -57,8 +56,8 @@ export declare const PluginReferenceSchema: z.ZodObject<{
|
|
|
57
56
|
}, z.core.$strip>>;
|
|
58
57
|
roles: z.ZodArray<z.ZodObject<{
|
|
59
58
|
id: z.ZodString;
|
|
60
|
-
label: z.ZodString;
|
|
61
59
|
actions: z.ZodArray<z.ZodString>;
|
|
60
|
+
label: z.ZodString;
|
|
62
61
|
}, z.core.$strip>>;
|
|
63
62
|
apiRoutes: z.ZodArray<z.ZodObject<{
|
|
64
63
|
method: z.ZodString;
|
|
@@ -92,11 +91,6 @@ export declare const PluginReferenceSchema: z.ZodObject<{
|
|
|
92
91
|
kind: z.ZodString;
|
|
93
92
|
documentType: z.ZodOptional<z.ZodString>;
|
|
94
93
|
}, z.core.$strict>>;
|
|
95
|
-
settingsPages: z.ZodArray<z.ZodObject<{
|
|
96
|
-
id: z.ZodString;
|
|
97
|
-
name: z.ZodString;
|
|
98
|
-
action: z.ZodString;
|
|
99
|
-
}, z.core.$strict>>;
|
|
100
94
|
adminSections: z.ZodArray<z.ZodObject<{
|
|
101
95
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
102
96
|
rail: z.ZodArray<z.ZodObject<{
|
|
@@ -118,16 +112,6 @@ export declare const PluginReferenceSchema: z.ZodObject<{
|
|
|
118
112
|
id: z.ZodString;
|
|
119
113
|
action: z.ZodString;
|
|
120
114
|
}, z.core.$strict>>;
|
|
121
|
-
editorToolbar: z.ZodArray<z.ZodObject<{
|
|
122
|
-
label: z.ZodString;
|
|
123
|
-
id: z.ZodString;
|
|
124
|
-
action: z.ZodString;
|
|
125
|
-
}, z.core.$strict>>;
|
|
126
|
-
contentTreeActions: z.ZodArray<z.ZodObject<{
|
|
127
|
-
label: z.ZodString;
|
|
128
|
-
id: z.ZodString;
|
|
129
|
-
action: z.ZodString;
|
|
130
|
-
}, z.core.$strict>>;
|
|
131
115
|
hooks: z.ZodArray<z.ZodString>;
|
|
132
116
|
scheduledTasks: z.ZodArray<z.ZodObject<{
|
|
133
117
|
id: z.ZodString;
|
|
@@ -157,7 +141,7 @@ export declare const PluginReferenceSchema: z.ZodObject<{
|
|
|
157
141
|
}, z.core.$strict>;
|
|
158
142
|
export type PluginReference = z.infer<typeof PluginReferenceSchema>;
|
|
159
143
|
export declare function emptyPluginReference(): PluginReference;
|
|
160
|
-
export declare const REFERENCE_PAGE_SLUGS: readonly ["permissions", "api-routes", "capabilities", "content", "
|
|
144
|
+
export declare const REFERENCE_PAGE_SLUGS: readonly ["permissions", "api-routes", "capabilities", "content", "admin-surfaces", "lifecycle"];
|
|
161
145
|
export type ReferencePageSlug = (typeof REFERENCE_PAGE_SLUGS)[number];
|
|
162
146
|
/** Which lists each page's tables are drawn from. Every list belongs to
|
|
163
147
|
* exactly one page (pinned by plugin-docs.test.ts), so a list added to the
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { PluginActionDeclarationSchema, PluginRoleOfferSchema } from "./plugin-actions.schema.js";
|
|
3
3
|
import { HOSTILE_CHARS_MESSAGE, hasHostileChars } from "./plugin-docs-text.js";
|
|
4
|
+
import { PluginLabelStringSchema } from "./plugin-labels.js";
|
|
4
5
|
// S286, the docs contract (2026-10-04-s285-the-docs-contract-design.md).
|
|
5
6
|
// The contract's pure parts live here so the SDK's manifest schema, the
|
|
6
7
|
// CLI and the package door run the same definitions.
|
|
@@ -69,7 +70,7 @@ function present(value) {
|
|
|
69
70
|
return value.length > 0;
|
|
70
71
|
return value === true;
|
|
71
72
|
}
|
|
72
|
-
/** Reads the
|
|
73
|
+
/** Reads the four facts from a live manifest or from manifest.json. The
|
|
73
74
|
* summary keeps each contribution list as a list of redacted entries,
|
|
74
75
|
* reduces migrations to their ids, and says `paid: true` where the live
|
|
75
76
|
* manifest has a price above 0: the amount itself never reaches
|
|
@@ -83,7 +84,6 @@ export function docsFactsFrom(manifest) {
|
|
|
83
84
|
hasDependencies: present(source.pluginDependencies),
|
|
84
85
|
hasPrice: (typeof source.price === "number" && source.price > 0) || source.paid === true,
|
|
85
86
|
hasDocumentTypes: present(contributions.documentTypes),
|
|
86
|
-
hasSettingsPages: present(contributions.settingsPages),
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
/** Which roles the door requires, each with the declaration that requires
|
|
@@ -98,12 +98,10 @@ export function requiredDocRoles(facts) {
|
|
|
98
98
|
].filter((reason) => reason !== null);
|
|
99
99
|
if (setup.length > 0)
|
|
100
100
|
required.push({ role: "setup", because: setup.join(", ") });
|
|
101
|
-
if (facts.hasSettingsPages)
|
|
102
|
-
required.push({ role: "configuration", because: "settingsPages" });
|
|
103
101
|
return required;
|
|
104
102
|
}
|
|
105
103
|
// reference.json: the serialisable facts the generated Reference pages are
|
|
106
|
-
// rendered from (S285 section 7, widened to seven pages by S289). Written by
|
|
104
|
+
// rendered from (S285 section 7, widened to seven pages by S289, six since S313b). Written by
|
|
107
105
|
// `kardalum plugin build` through buildReference in
|
|
108
106
|
// @kardalum/plugin-package/reference; built live from the attached manifest
|
|
109
107
|
// by the server for an installed plugin. JSON schemas and field definitions
|
|
@@ -115,6 +113,11 @@ export const ReferenceLabelMapSchema = z
|
|
|
115
113
|
.record(z.string(), z.string())
|
|
116
114
|
.refine((label) => typeof label.en === "string" && label.en.trim().length > 0, 'a label carries its English text under "en"');
|
|
117
115
|
const gated = { id: z.string(), action: z.string() };
|
|
116
|
+
// S311 (D3): a manifest may write an action's or a role's label as a language
|
|
117
|
+
// map; the builder writes its English text, so the reference carries one string
|
|
118
|
+
// per label, as the generated pages print it.
|
|
119
|
+
const ReferenceActionSchema = PluginActionDeclarationSchema.extend({ label: PluginLabelStringSchema });
|
|
120
|
+
const ReferenceRoleSchema = PluginRoleOfferSchema.extend({ label: PluginLabelStringSchema });
|
|
118
121
|
// S292: one row per option a manifest's `install` declares, carrying its
|
|
119
122
|
// step's label, for the lifecycle page's "Install asks" table. `required` is
|
|
120
123
|
// installOptionNeedsAnswer's answer, which buildReference writes inline (it
|
|
@@ -133,8 +136,8 @@ const ReferenceInstallOptionSchema = z
|
|
|
133
136
|
.strict();
|
|
134
137
|
export const PluginReferenceSchema = z
|
|
135
138
|
.object({
|
|
136
|
-
actions: z.array(
|
|
137
|
-
roles: z.array(
|
|
139
|
+
actions: z.array(ReferenceActionSchema),
|
|
140
|
+
roles: z.array(ReferenceRoleSchema),
|
|
138
141
|
apiRoutes: z.array(z.object({ method: z.string(), path: z.string(), access: z.string(), action: z.string().optional() }).strict()),
|
|
139
142
|
capabilities: z.array(z
|
|
140
143
|
.object({
|
|
@@ -146,12 +149,9 @@ export const PluginReferenceSchema = z
|
|
|
146
149
|
documentTypes: z.array(z.object({ name: z.string(), kind: z.string(), fields: z.array(z.unknown()) }).passthrough()),
|
|
147
150
|
dataTypes: z.array(z.object({ id: z.string(), name: z.string() }).passthrough()),
|
|
148
151
|
templates: z.array(z.object({ name: z.string(), alias: z.string(), kind: z.string(), documentType: z.string().optional() }).strict()),
|
|
149
|
-
settingsPages: z.array(z.object({ id: z.string(), name: z.string(), action: z.string() }).strict()),
|
|
150
152
|
adminSections: z.array(z.object({ ...gated, label: ReferenceLabelMapSchema, rail: z.array(z.object({ ...gated, label: ReferenceLabelMapSchema }).strict()) }).strict()),
|
|
151
153
|
railEntries: z.array(z.object({ ...gated, label: ReferenceLabelMapSchema, section: z.string() }).strict()),
|
|
152
154
|
dashboardWidgets: z.array(z.object({ ...gated, name: z.string() }).strict()),
|
|
153
|
-
editorToolbar: z.array(z.object({ ...gated, label: z.string() }).strict()),
|
|
154
|
-
contentTreeActions: z.array(z.object({ ...gated, label: z.string() }).strict()),
|
|
155
155
|
hooks: z.array(z.string()),
|
|
156
156
|
scheduledTasks: z.array(z.object({ id: z.string(), name: z.string(), cron: z.string() }).strict()),
|
|
157
157
|
migrations: z.array(z.object({ id: z.string(), name: z.string() }).strict()),
|
|
@@ -162,11 +162,10 @@ export const PluginReferenceSchema = z
|
|
|
162
162
|
export function emptyPluginReference() {
|
|
163
163
|
return {
|
|
164
164
|
actions: [], roles: [], apiRoutes: [], capabilities: [], documentTypes: [], dataTypes: [], templates: [],
|
|
165
|
-
|
|
166
|
-
contentTreeActions: [], hooks: [], scheduledTasks: [], migrations: [], assertions: [], installOptions: [],
|
|
165
|
+
adminSections: [], railEntries: [], dashboardWidgets: [], hooks: [], scheduledTasks: [], migrations: [], assertions: [], installOptions: [],
|
|
167
166
|
};
|
|
168
167
|
}
|
|
169
|
-
export const REFERENCE_PAGE_SLUGS = ["permissions", "api-routes", "capabilities", "content", "
|
|
168
|
+
export const REFERENCE_PAGE_SLUGS = ["permissions", "api-routes", "capabilities", "content", "admin-surfaces", "lifecycle"];
|
|
170
169
|
/** Which lists each page's tables are drawn from. Every list belongs to
|
|
171
170
|
* exactly one page (pinned by plugin-docs.test.ts), so a list added to the
|
|
172
171
|
* schema without a page is a red test, not a fact nobody sees. */
|
|
@@ -175,8 +174,7 @@ export const REFERENCE_PAGE_TABLES = {
|
|
|
175
174
|
"api-routes": ["apiRoutes"],
|
|
176
175
|
capabilities: ["capabilities"],
|
|
177
176
|
content: ["documentTypes", "dataTypes", "templates"],
|
|
178
|
-
|
|
179
|
-
"admin-surfaces": ["adminSections", "railEntries", "dashboardWidgets", "editorToolbar", "contentTreeActions"],
|
|
177
|
+
"admin-surfaces": ["adminSections", "railEntries", "dashboardWidgets"],
|
|
180
178
|
lifecycle: ["installOptions", "hooks", "scheduledTasks", "migrations", "assertions"],
|
|
181
179
|
};
|
|
182
180
|
export function isReferencePageSlug(slug) {
|
|
@@ -12,13 +12,23 @@ export declare const PLUGIN_ID_REGEX: RegExp;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const MANIFEST_ID_SEGMENT_MAX: number;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* (
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* The longest a plugin manifest's own id may be. The id names the plugin's
|
|
16
|
+
* folder at every install and is part of every file name a version is (see
|
|
17
|
+
* PLUGIN_VERSION_MAX), so the cap is checked before the pattern ever reads it
|
|
18
|
+
* (S311 fix wave). A reverse-domain id of at most MANIFEST_ID_SEGMENT_MAX (4)
|
|
19
|
+
* segments never comes near it in practice: "com.vendor.plugin-name" is 22
|
|
20
|
+
* characters. 128 (S311 third code fix, from npm's 214) leaves the version
|
|
21
|
+
* room beside it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PLUGIN_ID_MAX = 128;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `id` is an id a plugin manifest may have: at most PLUGIN_ID_MAX
|
|
26
|
+
* characters, PLUGIN_ID_REGEX and at most MANIFEST_ID_SEGMENT_MAX segments,
|
|
27
|
+
* exactly what the SDK's manifest validator applies. Every door that turns a
|
|
28
|
+
* plugin id into a directory name (an install, an upload, a marketplace
|
|
29
|
+
* submission) runs this first, so an id the validator would refuse never
|
|
30
|
+
* reaches the filesystem: a lookalike such as "COM.KARDALUM.SEO" names another
|
|
31
|
+
* plugin's folder on a case-insensitive filesystem (S283).
|
|
22
32
|
*/
|
|
23
33
|
export declare function isPluginManifestId(id: string): boolean;
|
|
24
34
|
/**
|
|
@@ -17,16 +17,26 @@ export const PLUGIN_ID_REGEX = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/;
|
|
|
17
17
|
*/
|
|
18
18
|
export const MANIFEST_ID_SEGMENT_MAX = ACTION_SEGMENT_MAX - 2;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
20
|
+
* The longest a plugin manifest's own id may be. The id names the plugin's
|
|
21
|
+
* folder at every install and is part of every file name a version is (see
|
|
22
|
+
* PLUGIN_VERSION_MAX), so the cap is checked before the pattern ever reads it
|
|
23
|
+
* (S311 fix wave). A reverse-domain id of at most MANIFEST_ID_SEGMENT_MAX (4)
|
|
24
|
+
* segments never comes near it in practice: "com.vendor.plugin-name" is 22
|
|
25
|
+
* characters. 128 (S311 third code fix, from npm's 214) leaves the version
|
|
26
|
+
* room beside it.
|
|
27
|
+
*/
|
|
28
|
+
export const PLUGIN_ID_MAX = 128;
|
|
29
|
+
/**
|
|
30
|
+
* Whether `id` is an id a plugin manifest may have: at most PLUGIN_ID_MAX
|
|
31
|
+
* characters, PLUGIN_ID_REGEX and at most MANIFEST_ID_SEGMENT_MAX segments,
|
|
32
|
+
* exactly what the SDK's manifest validator applies. Every door that turns a
|
|
33
|
+
* plugin id into a directory name (an install, an upload, a marketplace
|
|
34
|
+
* submission) runs this first, so an id the validator would refuse never
|
|
35
|
+
* reaches the filesystem: a lookalike such as "COM.KARDALUM.SEO" names another
|
|
36
|
+
* plugin's folder on a case-insensitive filesystem (S283).
|
|
27
37
|
*/
|
|
28
38
|
export function isPluginManifestId(id) {
|
|
29
|
-
return PLUGIN_ID_REGEX.test(id) && id.split(".").length <= MANIFEST_ID_SEGMENT_MAX;
|
|
39
|
+
return id.length <= PLUGIN_ID_MAX && PLUGIN_ID_REGEX.test(id) && id.split(".").length <= MANIFEST_ID_SEGMENT_MAX;
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
42
|
* A slot's id (S280): a segment of its screen's URL, so lowercase letters,
|
|
@@ -28,9 +28,9 @@ export declare const INSTALL_ROLE_OUTCOMES: readonly ["created", "already-exists
|
|
|
28
28
|
export declare const InstallRoleOutcomeSchema: z.ZodObject<{
|
|
29
29
|
id: z.ZodString;
|
|
30
30
|
outcome: z.ZodEnum<{
|
|
31
|
+
failed: "failed";
|
|
31
32
|
created: "created";
|
|
32
33
|
"already-exists": "already-exists";
|
|
33
|
-
failed: "failed";
|
|
34
34
|
}>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export type InstallRoleOutcome = z.infer<typeof InstallRoleOutcomeSchema>;
|