@vcp-dev/contracts 0.4.8 → 0.4.9

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.
@@ -77,6 +77,7 @@ export declare const InputSourceSchema: z.ZodObject<{
77
77
  original_ref: z.ZodString;
78
78
  source_metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
79
79
  error_code: z.ZodOptional<z.ZodString>;
80
+ submitted: z.ZodOptional<z.ZodBoolean>;
80
81
  }, z.core.$strip>;
81
82
  export type InputSource = z.infer<typeof InputSourceSchema>;
82
83
  export declare const InputConflictSchema: z.ZodObject<{
@@ -211,6 +212,7 @@ export declare const InputContextBundleSchema: z.ZodObject<{
211
212
  original_ref: z.ZodString;
212
213
  source_metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
213
214
  error_code: z.ZodOptional<z.ZodString>;
215
+ submitted: z.ZodOptional<z.ZodBoolean>;
214
216
  }, z.core.$strip>>;
215
217
  facts: z.ZodArray<z.ZodObject<{
216
218
  fact: z.ZodString;
@@ -18,12 +18,21 @@
18
18
  * silently skipped. Routing both ends through this one function removes the
19
19
  * divergence at the root.
20
20
  *
21
- * Both functions are pure & total: any input (including non-string) yields a
22
- * canonical result and never throws. Path traversal is neutralized (the `..`
23
- * segment collapses to empty and is dropped) rather than rejected, so a
24
- * misbehaving slug degrades to a safe route instead of failing finalization
25
- * and blocking the user journey.
21
+ * Model-output repair is intentionally kept out of this module. These helpers
22
+ * define the fail-closed route identity consumed after Sitemap hydration: an
23
+ * unsafe/non-ASCII value has no canonical route and must be rejected instead
24
+ * of silently materializing a second public path.
26
25
  */
26
+ export declare const PAGE_SLUG_SEGMENT_PATTERN_SOURCE = "[a-z0-9]+(?:-[a-z0-9]+)*";
27
+ export declare const PAGE_SLUG_PATTERN: RegExp;
28
+ export declare function isCanonicalPageSlug(value: unknown): value is string;
29
+ /**
30
+ * Best-effort canonicalization for ASCII-only semantic input. Returns `null`
31
+ * when accepting the value would require transliteration, traversal cleanup,
32
+ * or non-string coercion. Page-index/id fallbacks belong to Sitemap hydration,
33
+ * where uniqueness and home-page position are available.
34
+ */
35
+ export declare function tryCanonicalizeAsciiPageSlug(value: unknown): string | null;
27
36
  /**
28
37
  * Canonicalize a sitemap page slug into the form
29
38
  * `deriveSitemapRouteIdentity` emits in its `slug` field once the route file
@@ -31,13 +40,13 @@
31
40
  * stay consistent.
32
41
  *
33
42
  * Examples:
34
- * - `/` / `""` / non-string → `/`
43
+ * - `/` / `""` → `/`
35
44
  * - `Products` → `/products`
36
45
  * - `index` / `home` → `/` (top-level only; `blog/index` → `/blog/index`)
37
46
  * - `about_us` → `/about-us`
38
47
  * - `Our Services` → `/our-services`
39
- * - `产品` `/产品`
40
- * - `/../admin` `/admin`
48
+ * Unsafe, non-ASCII, traversal, and runtime non-string inputs throw. Model-facing
49
+ * repair must run before this authority is called.
41
50
  */
42
51
  export declare function canonicalizePageSlug(slug: string): string;
43
52
  /**
@@ -49,6 +58,6 @@ export declare function canonicalizePageSlug(slug: string): string;
49
58
  * - `/` / `index` / `home` → `app/page.tsx`
50
59
  * - `Products` → `app/products/page.tsx`
51
60
  * - `services/Repair` → `app/services/repair/page.tsx`
52
- * - `产品` `app/产品/page.tsx`
61
+ * Unsafe/non-ASCII input throws before a snapshot path is constructed.
53
62
  */
54
63
  export declare function pageSlugToRouteFilePath(slug: string): string;
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ export declare const PublishPlanFeatureSnapshotSchema: z.ZodObject<{
3
+ maxSites: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
4
+ maxStorageMb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
5
+ customDomains: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
6
+ }, z.core.$loose>;
7
+ export type PublishPlanFeatureSnapshot = z.infer<typeof PublishPlanFeatureSnapshotSchema>;
8
+ export declare const PublishPlanSchema: z.ZodObject<{
9
+ subscriptionId: z.ZodString;
10
+ planId: z.ZodString;
11
+ locale: z.ZodUnion<[z.ZodEnum<{
12
+ en: "en";
13
+ zh_CN: "zh_CN";
14
+ }>, z.ZodString]>;
15
+ currentPeriodEnd: z.ZodNullable<z.ZodString>;
16
+ servicePeriodEnd: z.ZodNullable<z.ZodString>;
17
+ featureSnapshot: z.ZodNullable<z.ZodObject<{
18
+ maxSites: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
19
+ maxStorageMb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
20
+ customDomains: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
21
+ }, z.core.$loose>>;
22
+ code: z.ZodNullable<z.ZodString>;
23
+ level: z.ZodNullable<z.ZodNumber>;
24
+ name: z.ZodNullable<z.ZodString>;
25
+ }, z.core.$strict>;
26
+ export type PublishPlan = z.infer<typeof PublishPlanSchema>;
27
+ export declare const PublishEntitlementSchema: z.ZodObject<{
28
+ hasActiveSubscription: z.ZodBoolean;
29
+ }, z.core.$strict>;
30
+ export type PublishEntitlement = z.infer<typeof PublishEntitlementSchema>;
31
+ export declare const GetSitePlanDataSchema: z.ZodObject<{
32
+ plan: z.ZodNullable<z.ZodObject<{
33
+ subscriptionId: z.ZodString;
34
+ planId: z.ZodString;
35
+ locale: z.ZodUnion<[z.ZodEnum<{
36
+ en: "en";
37
+ zh_CN: "zh_CN";
38
+ }>, z.ZodString]>;
39
+ currentPeriodEnd: z.ZodNullable<z.ZodString>;
40
+ servicePeriodEnd: z.ZodNullable<z.ZodString>;
41
+ featureSnapshot: z.ZodNullable<z.ZodObject<{
42
+ maxSites: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
43
+ maxStorageMb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
44
+ customDomains: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
45
+ }, z.core.$loose>>;
46
+ code: z.ZodNullable<z.ZodString>;
47
+ level: z.ZodNullable<z.ZodNumber>;
48
+ name: z.ZodNullable<z.ZodString>;
49
+ }, z.core.$strict>>;
50
+ entitlement: z.ZodObject<{
51
+ hasActiveSubscription: z.ZodBoolean;
52
+ }, z.core.$strict>;
53
+ }, z.core.$strict>;
54
+ export type GetSitePlanData = z.infer<typeof GetSitePlanDataSchema>;
@@ -130,8 +130,8 @@ export declare const SiteEditStylePropertySchema: z.ZodEnum<{
130
130
  }>;
131
131
  export type SiteEditStyleProperty = z.infer<typeof SiteEditStylePropertySchema>;
132
132
  export declare const SiteEditStyleStateModeSchema: z.ZodEnum<{
133
- hover: "hover";
134
133
  active: "active";
134
+ hover: "hover";
135
135
  focus: "focus";
136
136
  disabled: "disabled";
137
137
  }>;
@@ -363,8 +363,8 @@ export declare const SiteEditStyleModelSchema: z.ZodUnion<readonly [z.ZodRecord<
363
363
  "2xl": "2xl";
364
364
  }>>;
365
365
  state: z.ZodOptional<z.ZodEnum<{
366
- hover: "hover";
367
366
  active: "active";
367
+ hover: "hover";
368
368
  focus: "focus";
369
369
  disabled: "disabled";
370
370
  }>>;
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * 由 release-edit-engine-packages.ts 在 bump 版本时自动更新。
7
7
  */
8
- export declare const CURRENT_EDIT_ENGINE_VERSION = "0.4.8";
8
+ export declare const CURRENT_EDIT_ENGINE_VERSION = "0.4.9";
9
9
  export declare const EDIT_ENGINE_VERSION_HEADER = "x-vcp-edit-engine-version";
10
10
  export declare const EDIT_ENGINE_VERSION_SOURCE_HEADER = "x-vcp-edit-engine-version-source";
11
11
  export type EditEngineVersionSource = "explicit" | "fallback_current" | "system_current";
@@ -1,14 +1,84 @@
1
1
  import { z } from "zod";
2
- export { DEFAULT_SITE_LOCALE, ISO_639_3_TO_SITE_LOCALE, SITE_LOCALE_CODES, SUPPORTED_SITE_LOCALES, resolveSiteLocaleFromIso6393, type SiteLocale, type SiteLocaleOption, } from "@vcp-dev/i18n/site-locale";
2
+ /**
3
+ * Site output locale constants. These describe generated-site visitor language,
4
+ * not the platform console UI language.
5
+ */
6
+ export declare const SELECTABLE_SITE_LOCALE_CODES: readonly ["zh-CN", "zh-HK", "zh-TW", "en-US", "en-GB", "ja-JP", "ko-KR", "es-ES", "fr-FR", "de-DE", "pt-PT", "ru-RU", "ar-SA", "id-ID", "vi-VN", "th-TH", "it-IT", "nl-NL", "tr-TR", "pl-PL", "uk-UA", "cs-CZ", "sk-SK", "hu-HU", "ro-RO", "el-GR", "sv-SE", "da-DK", "fi-FI", "hr-HR", "lt-LT", "lv-LV", "et-EE", "ga-IE", "mt-MT", "ka-GE", "fa-IR", "bn-BD", "ta-IN", "si-LK", "ms-MY", "fil-PH", "my-MM", "km-KH", "lo-LA", "mn-MN", "kk-KZ"];
7
+ export type SelectableSiteLocale = (typeof SELECTABLE_SITE_LOCALE_CODES)[number];
8
+ /**
9
+ * 已持久化站点仍可能携带这些旧短码。它们继续通过运行时合同,但不会出现在
10
+ * 澄清页的新建/切换目录中;本次 UI 调整不做数据迁移。
11
+ */
12
+ export declare const LEGACY_SITE_LOCALE_CODES: readonly ["en", "ja", "es", "fr", "de", "ko", "pt", "pt-BR", "it", "ru", "ar", "hi", "id", "vi", "th", "tr", "nl", "pl", "uk", "sv", "da", "fi", "no", "cs", "el", "hu", "ro", "he", "ms", "fil", "bn", "ta", "ca", "sk", "hr", "bg", "lt", "lv", "et", "fa", "sw", "sr", "is"];
13
+ export declare const SITE_LOCALE_CODES: readonly ["zh-CN", "zh-HK", "zh-TW", "en-US", "en-GB", "ja-JP", "ko-KR", "es-ES", "fr-FR", "de-DE", "pt-PT", "ru-RU", "ar-SA", "id-ID", "vi-VN", "th-TH", "it-IT", "nl-NL", "tr-TR", "pl-PL", "uk-UA", "cs-CZ", "sk-SK", "hu-HU", "ro-RO", "el-GR", "sv-SE", "da-DK", "fi-FI", "hr-HR", "lt-LT", "lv-LV", "et-EE", "ga-IE", "mt-MT", "ka-GE", "fa-IR", "bn-BD", "ta-IN", "si-LK", "ms-MY", "fil-PH", "my-MM", "km-KH", "lo-LA", "mn-MN", "kk-KZ", "en", "ja", "es", "fr", "de", "ko", "pt", "pt-BR", "it", "ru", "ar", "hi", "id", "vi", "th", "tr", "nl", "pl", "uk", "sv", "da", "fi", "no", "cs", "el", "hu", "ro", "he", "ms", "fil", "bn", "ta", "ca", "sk", "hr", "bg", "lt", "lv", "et", "fa", "sw", "sr", "is"];
14
+ export type SiteLocale = (typeof SITE_LOCALE_CODES)[number];
15
+ export type SiteTextDirection = "ltr" | "rtl";
16
+ export interface SiteLocaleOption {
17
+ code: SelectableSiteLocale;
18
+ label: string;
19
+ englishName: string;
20
+ common?: boolean;
21
+ }
22
+ export declare const SUPPORTED_SITE_LOCALES: readonly SiteLocaleOption[];
23
+ export declare function resolveSelectableSiteLocale(locale: SiteLocale): SelectableSiteLocale | undefined;
24
+ export declare const DEFAULT_SITE_LOCALE: SiteLocale;
25
+ export declare function resolveSiteTextDirection(locale: SiteLocale): SiteTextDirection;
26
+ export declare const ISO_639_3_TO_SITE_LOCALE: Readonly<Record<string, SiteLocale>>;
27
+ export declare function resolveSiteLocaleFromIso6393(iso6393: string): SiteLocale;
3
28
  export declare const SiteLocaleSchema: z.ZodEnum<{
4
29
  id: "id";
5
30
  "zh-CN": "zh-CN";
31
+ "zh-HK": "zh-HK";
32
+ "zh-TW": "zh-TW";
33
+ "en-US": "en-US";
34
+ "en-GB": "en-GB";
35
+ "ja-JP": "ja-JP";
36
+ "ko-KR": "ko-KR";
37
+ "es-ES": "es-ES";
38
+ "fr-FR": "fr-FR";
39
+ "de-DE": "de-DE";
40
+ "pt-PT": "pt-PT";
41
+ "ru-RU": "ru-RU";
42
+ "ar-SA": "ar-SA";
43
+ "id-ID": "id-ID";
44
+ "vi-VN": "vi-VN";
45
+ "th-TH": "th-TH";
46
+ "it-IT": "it-IT";
47
+ "nl-NL": "nl-NL";
48
+ "tr-TR": "tr-TR";
49
+ "pl-PL": "pl-PL";
50
+ "uk-UA": "uk-UA";
51
+ "cs-CZ": "cs-CZ";
52
+ "sk-SK": "sk-SK";
53
+ "hu-HU": "hu-HU";
54
+ "ro-RO": "ro-RO";
55
+ "el-GR": "el-GR";
56
+ "sv-SE": "sv-SE";
57
+ "da-DK": "da-DK";
58
+ "fi-FI": "fi-FI";
59
+ "hr-HR": "hr-HR";
60
+ "lt-LT": "lt-LT";
61
+ "lv-LV": "lv-LV";
62
+ "et-EE": "et-EE";
63
+ "ga-IE": "ga-IE";
64
+ "mt-MT": "mt-MT";
65
+ "ka-GE": "ka-GE";
66
+ "fa-IR": "fa-IR";
67
+ "bn-BD": "bn-BD";
68
+ "ta-IN": "ta-IN";
69
+ "si-LK": "si-LK";
70
+ "ms-MY": "ms-MY";
71
+ "fil-PH": "fil-PH";
72
+ "my-MM": "my-MM";
73
+ "km-KH": "km-KH";
74
+ "lo-LA": "lo-LA";
75
+ "mn-MN": "mn-MN";
76
+ "kk-KZ": "kk-KZ";
6
77
  en: "en";
7
78
  ja: "ja";
8
79
  es: "es";
9
80
  fr: "fr";
10
81
  de: "de";
11
- "zh-TW": "zh-TW";
12
82
  ko: "ko";
13
83
  pt: "pt";
14
84
  "pt-BR": "pt-BR";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcp-dev/contracts",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -51,7 +51,6 @@
51
51
  "typecheck": "tsc -p tsconfig.json --noEmit"
52
52
  },
53
53
  "dependencies": {
54
- "@vcp-dev/i18n": "0.4.8",
55
54
  "culori": "^4.0.2",
56
55
  "zod": "^4.0.0"
57
56
  },