@stonecrop/schema 0.39.0 → 0.41.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/dist/cli.js +1 -1
- package/dist/{converter-2mU9FiFz.js → converter-DU9gIlb8.js} +60 -100
- package/dist/converter-DU9gIlb8.js.map +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/naming.js +99 -0
- package/dist/naming.js.map +1 -0
- package/dist/{record-BMHP2AMK.js → record-ChZNL_Hb.js} +3 -2
- package/dist/record-ChZNL_Hb.js.map +1 -0
- package/dist/record.js +1 -1
- package/dist/schema.d.ts +3 -4
- package/package.json +1 -1
- package/dist/converter-2mU9FiFz.js.map +0 -1
- package/dist/record-BMHP2AMK.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/badge.ts"],"sourcesContent":["import type { FieldOptions } from './field'\n\n/**\n * Semantic badge variant. Maps to theme tokens `--sc-badge-{variant}-*`.\n * @public\n */\nexport type BadgeVariant = 'neutral' | 'success' | 'warning' | 'danger' | 'brand'\n\n/**\n * Where ABadge paints the same descriptor.\n * @public\n */\nexport type BadgePresentation = 'cell-fill' | 'input-accent'\n\n/**\n * Per-choice badge configuration in a Select options map.\n * @public\n */\nexport interface BadgeSpecObject {\n\tvariant?: BadgeVariant\n\tcolor?: string\n\tlabel?: string\n}\n\n/**\n * Value in a choice→badge map: shorthand variant or object form.\n * @public\n */\nexport type BadgeSpec = BadgeVariant | BadgeSpecObject\n\n/**\n * Select field options when choices carry badge colors.\n * @public\n */\nexport interface SelectOptions extends Record<string, unknown> {\n\tchoices: string[]\n\tbadges?: Record<string, BadgeSpec>\n}\n\n/**\n * Resolved badge for rendering. Returned by `format` or built from an options map.\n * @public\n */\nexport interface BadgeDescriptor {\n\tlabel: string\n\tvariant?: BadgeVariant\n\tcolor?: string\n}\n\nconst BADGE_VARIANTS = new Set<string>(['neutral', 'success', 'warning', 'danger', 'brand'])\n\nconst BADGE_SPEC_OBJECT_KEYS = new Set(['variant', 'color', 'label'])\n\nfunction isOptionsRecord(options: FieldOptions): options is Record<string, unknown> {\n\treturn !Array.isArray(options)\n}\n\nfunction isBadgeVariant(value: unknown): value is BadgeVariant {\n\treturn typeof value === 'string' && BADGE_VARIANTS.has(value)\n}\n\nfunction isBadgeSpecObject(value: unknown): value is BadgeSpecObject {\n\tif (value === null || typeof value !== 'object' || Array.isArray(value)) return false\n\tfor (const key of Object.keys(value)) {\n\t\tif (!BADGE_SPEC_OBJECT_KEYS.has(key)) return false\n\t}\n\tconst obj = value as BadgeSpecObject\n\tif (obj.variant !== undefined && !isBadgeVariant(obj.variant)) return false\n\tif (obj.color !== undefined && typeof obj.color !== 'string') return false\n\tif (obj.label !== undefined && typeof obj.label !== 'string') return false\n\treturn true\n}\n\nfunction isBadgeSpec(value: unknown): value is BadgeSpec {\n\treturn isBadgeVariant(value) || isBadgeSpecObject(value)\n}\n\n/**\n * Narrows an options record to the structured `{ choices, badges }` form. A type predicate rather\n * than a cast: `SelectOptions` requires `choices`, so asserting into it trips `no-unsafe-type-assertion`.\n */\nfunction isStructuredSelectOptions(options: Record<string, unknown>): options is SelectOptions {\n\treturn Array.isArray(options.choices)\n}\n\n/**\n * True when `value` is a resolved badge descriptor for ACell / ADropdown.\n * @public\n */\nexport function isBadgeDescriptor(value: unknown): value is BadgeDescriptor {\n\tif (value === null || typeof value !== 'object' || Array.isArray(value)) return false\n\t// Partial<> keeps this a widening assertion; asserting into BadgeDescriptor itself (required\n\t// `label`) narrows, which `no-unsafe-type-assertion` rejects.\n\tconst obj = value as Partial<BadgeDescriptor>\n\tif (typeof obj.label !== 'string') return false\n\tif (obj.variant !== undefined && !isBadgeVariant(obj.variant)) return false\n\tif (obj.color !== undefined && typeof obj.color !== 'string') return false\n\treturn true\n}\n\n/**\n * True when `options` is a Select choice map (`{ Open: \"warning\", ... }` or\n * `{ choices: [...], badges: {...} }`), not a quantity/currency/code config bag.\n * @public\n */\nexport function isSelectChoiceMap(options: FieldOptions | undefined): options is Record<string, BadgeSpec> {\n\tif (options === undefined || Array.isArray(options) || !isOptionsRecord(options)) return false\n\tif (isStructuredSelectOptions(options)) {\n\t\tconst badges = options.badges\n\t\tif (badges === undefined) return false\n\t\treturn Object.values(badges).every(isBadgeSpec)\n\t}\n\tconst entries = Object.entries(options)\n\tif (entries.length === 0) return false\n\treturn entries.every(([, value]) => isBadgeSpec(value))\n}\n\n/**\n * True when `options` uses the structured SelectOptions shape.\n * @public\n */\nexport function isSelectOptions(options: FieldOptions | undefined): options is SelectOptions {\n\tif (options === undefined || Array.isArray(options) || !isOptionsRecord(options)) return false\n\treturn isStructuredSelectOptions(options)\n}\n\n/**\n * Dropdown / filter choice strings.\n * @public\n */\nexport function selectChoices(options: FieldOptions | undefined): string[] {\n\tif (options === undefined) return []\n\tif (Array.isArray(options)) return options\n\tif (!isOptionsRecord(options)) return []\n\tif (isStructuredSelectOptions(options)) return options.choices\n\tif (isSelectChoiceMap(options)) return Object.keys(options)\n\treturn []\n}\n\nfunction normalizeBadgeSpec(spec: unknown, key: string): BadgeDescriptor {\n\tif (isBadgeVariant(spec)) {\n\t\treturn { label: key, variant: spec }\n\t}\n\t// A malformed spec still names a real choice, so keep the label and drop only the styling.\n\t// Reading `.variant`/`.color` off an unvalidated value is what let a misspelt variant reach the\n\t// DOM as an unmatched class, and threw outright on null.\n\tif (!isBadgeSpecObject(spec)) {\n\t\treturn { label: key }\n\t}\n\treturn {\n\t\tlabel: spec.label ?? key,\n\t\tvariant: spec.variant,\n\t\tcolor: spec.color,\n\t}\n}\n\nfunction lookupFromBareMap(map: Record<string, BadgeSpec>, key: string | undefined): BadgeDescriptor | undefined {\n\tif (key === undefined || key === '') return undefined\n\tif (!(key in map)) return undefined\n\treturn normalizeBadgeSpec(map[key], key)\n}\n\nfunction lookupFromStructured(options: SelectOptions, key: string | undefined): BadgeDescriptor | undefined {\n\tif (key === undefined || key === '') return undefined\n\tconst badges = options.badges\n\tif (!badges || !(key in badges)) return undefined\n\treturn normalizeBadgeSpec(badges[key], key)\n}\n\n/**\n * Resolve a stored choice value to a badge descriptor using field options.\n * @public\n */\nexport function lookupBadge(options: FieldOptions | undefined, key: string | undefined): BadgeDescriptor | undefined {\n\tif (options === undefined || key === undefined || key === '') return undefined\n\tif (Array.isArray(options)) return undefined\n\tif (!isOptionsRecord(options)) return undefined\n\tif (isStructuredSelectOptions(options)) return lookupFromStructured(options, key)\n\tif (isSelectChoiceMap(options)) return lookupFromBareMap(options, key)\n\treturn undefined\n}\n\n/**\n * Whether field options carry any badge mapping.\n * @public\n */\nexport function hasBadgeOptions(options: FieldOptions | undefined): boolean {\n\tif (options === undefined || Array.isArray(options)) return false\n\tif (!isOptionsRecord(options)) return false\n\tif (isStructuredSelectOptions(options)) return options.badges !== undefined && Object.keys(options.badges).length > 0\n\treturn isSelectChoiceMap(options)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/badge.ts"],"sourcesContent":["import type { FieldOptions } from './field'\n\n/**\n * Semantic badge variant. Maps to theme tokens `--sc-badge-{variant}-*`.\n * @public\n */\nexport type BadgeVariant = 'neutral' | 'success' | 'warning' | 'danger' | 'brand'\n\n/**\n * Where ABadge paints the same descriptor.\n * @public\n */\nexport type BadgePresentation = 'cell-fill' | 'input-accent'\n\n/**\n * Per-choice badge configuration in a Select options map.\n * @public\n */\nexport interface BadgeSpecObject {\n\tvariant?: BadgeVariant\n\tcolor?: string\n\tlabel?: string\n}\n\n/**\n * Value in a choice→badge map: shorthand variant or object form.\n * @public\n */\nexport type BadgeSpec = BadgeVariant | BadgeSpecObject\n\n/**\n * Select field options when choices carry badge colors.\n * @public\n */\nexport interface SelectOptions extends Record<string, unknown> {\n\tchoices: string[]\n\tbadges?: Record<string, BadgeSpec>\n}\n\n/**\n * Resolved badge for rendering. Returned by `format` or built from an options map.\n * @public\n */\nexport interface BadgeDescriptor {\n\tlabel: string\n\tvariant?: BadgeVariant\n\tcolor?: string\n}\n\nconst BADGE_VARIANTS = new Set<string>(['neutral', 'success', 'warning', 'danger', 'brand'])\n\nconst BADGE_SPEC_OBJECT_KEYS = new Set(['variant', 'color', 'label'])\n\nfunction isOptionsRecord(options: FieldOptions): options is Record<string, unknown> {\n\treturn !Array.isArray(options)\n}\n\nfunction isBadgeVariant(value: unknown): value is BadgeVariant {\n\treturn typeof value === 'string' && BADGE_VARIANTS.has(value)\n}\n\nfunction isBadgeSpecObject(value: unknown): value is BadgeSpecObject {\n\tif (value === null || typeof value !== 'object' || Array.isArray(value)) return false\n\tfor (const key of Object.keys(value)) {\n\t\tif (!BADGE_SPEC_OBJECT_KEYS.has(key)) return false\n\t}\n\tconst obj = value as BadgeSpecObject\n\tif (obj.variant !== undefined && !isBadgeVariant(obj.variant)) return false\n\tif (obj.color !== undefined && typeof obj.color !== 'string') return false\n\tif (obj.label !== undefined && typeof obj.label !== 'string') return false\n\treturn true\n}\n\nfunction isBadgeSpec(value: unknown): value is BadgeSpec {\n\treturn isBadgeVariant(value) || isBadgeSpecObject(value)\n}\n\n/**\n * Narrows an options record to the structured `{ choices, badges }` form. A type predicate rather\n * than a cast: `SelectOptions` requires `choices`, so asserting into it trips `no-unsafe-type-assertion`.\n */\nfunction isStructuredSelectOptions(options: Record<string, unknown>): options is SelectOptions {\n\treturn Array.isArray(options.choices)\n}\n\n/**\n * True when `value` is a resolved badge descriptor for ACell / ADropdown.\n * @public\n */\nexport function isBadgeDescriptor(value: unknown): value is BadgeDescriptor {\n\tif (value === null || typeof value !== 'object' || Array.isArray(value)) return false\n\t// Partial<> keeps this a widening assertion; asserting into BadgeDescriptor itself (required\n\t// `label`) narrows, which `no-unsafe-type-assertion` rejects.\n\tconst obj = value as Partial<BadgeDescriptor>\n\tif (typeof obj.label !== 'string') return false\n\tif (obj.variant !== undefined && !isBadgeVariant(obj.variant)) return false\n\tif (obj.color !== undefined && typeof obj.color !== 'string') return false\n\treturn true\n}\n\n/**\n * True when `options` is a Select choice map (`{ Open: \"warning\", ... }` or\n * `{ choices: [...], badges: {...} }`), not a quantity/currency/code config bag.\n * @public\n */\nexport function isSelectChoiceMap(options: FieldOptions | undefined): options is Record<string, BadgeSpec> {\n\tif (options === undefined || Array.isArray(options) || !isOptionsRecord(options)) return false\n\tif (isStructuredSelectOptions(options)) {\n\t\tconst badges = options.badges\n\t\tif (badges === undefined) return false\n\t\treturn Object.values(badges).every(isBadgeSpec)\n\t}\n\tconst entries = Object.entries(options)\n\tif (entries.length === 0) return false\n\treturn entries.every(([, value]) => isBadgeSpec(value))\n}\n\n/**\n * True when `options` uses the structured SelectOptions shape.\n * @public\n */\nexport function isSelectOptions(options: FieldOptions | undefined): options is SelectOptions {\n\tif (options === undefined || Array.isArray(options) || !isOptionsRecord(options)) return false\n\treturn isStructuredSelectOptions(options)\n}\n\n/**\n * Dropdown / filter choice strings.\n * @public\n */\nexport function selectChoices(options: FieldOptions | undefined): string[] {\n\tif (options === undefined) return []\n\tif (Array.isArray(options)) return options\n\tif (!isOptionsRecord(options)) return []\n\tif (isStructuredSelectOptions(options)) return options.choices\n\tif (isSelectChoiceMap(options)) return Object.keys(options)\n\treturn []\n}\n\nfunction normalizeBadgeSpec(spec: unknown, key: string): BadgeDescriptor {\n\tif (isBadgeVariant(spec)) {\n\t\treturn { label: key, variant: spec }\n\t}\n\t// A malformed spec still names a real choice, so keep the label and drop only the styling.\n\t// Reading `.variant`/`.color` off an unvalidated value is what let a misspelt variant reach the\n\t// DOM as an unmatched class, and threw outright on null.\n\tif (!isBadgeSpecObject(spec)) {\n\t\treturn { label: key }\n\t}\n\treturn {\n\t\tlabel: spec.label ?? key,\n\t\tvariant: spec.variant,\n\t\tcolor: spec.color,\n\t}\n}\n\nfunction lookupFromBareMap(map: Record<string, BadgeSpec>, key: string | undefined): BadgeDescriptor | undefined {\n\tif (key === undefined || key === '') return undefined\n\tif (!(key in map)) return undefined\n\treturn normalizeBadgeSpec(map[key], key)\n}\n\nfunction lookupFromStructured(options: SelectOptions, key: string | undefined): BadgeDescriptor | undefined {\n\tif (key === undefined || key === '') return undefined\n\tconst badges = options.badges\n\tif (!badges || !(key in badges)) return undefined\n\treturn normalizeBadgeSpec(badges[key], key)\n}\n\n/**\n * Resolve a stored choice value to a badge descriptor using field options.\n * @public\n */\nexport function lookupBadge(options: FieldOptions | undefined, key: string | undefined): BadgeDescriptor | undefined {\n\tif (options === undefined || key === undefined || key === '') return undefined\n\tif (Array.isArray(options)) return undefined\n\tif (!isOptionsRecord(options)) return undefined\n\tif (isStructuredSelectOptions(options)) return lookupFromStructured(options, key)\n\tif (isSelectChoiceMap(options)) return lookupFromBareMap(options, key)\n\treturn undefined\n}\n\n/**\n * Whether field options carry any badge mapping.\n * @public\n */\nexport function hasBadgeOptions(options: FieldOptions | undefined): boolean {\n\tif (options === undefined || Array.isArray(options)) return false\n\tif (!isOptionsRecord(options)) return false\n\tif (isStructuredSelectOptions(options)) return options.badges !== undefined && Object.keys(options.badges).length > 0\n\treturn isSelectChoiceMap(options)\n}\n"],"mappings":";;;;;AAiDA,IAAM,iCAAiB,IAAI,IAAY;CAAC;CAAW;CAAW;CAAW;CAAU;AAAO,CAAC;AAE3F,IAAM,yCAAyB,IAAI,IAAI;CAAC;CAAW;CAAS;AAAO,CAAC;AAEpE,SAAS,gBAAgB,SAA2D;CACnF,OAAO,CAAC,MAAM,QAAQ,OAAO;AAC9B;AAEA,SAAS,eAAe,OAAuC;CAC9D,OAAO,OAAO,UAAU,YAAY,eAAe,IAAI,KAAK;AAC7D;AAEA,SAAS,kBAAkB,OAA0C;CACpE,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO;CAChF,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAClC,IAAI,CAAC,uBAAuB,IAAI,GAAG,GAAG,OAAO;CAE9C,MAAM,MAAM;CACZ,IAAI,IAAI,YAAY,KAAA,KAA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AkB,OAAO,GAAG,OAAO,kBAAkB,SAAS,GAAG;AAEtE;;;;;AAMA,SAAgB,gBAAgB,SAA4C;CAC3E,IAAI,YAAY,KAAA,KAAa,MAAM,QAAQ,OAAO,GAAG,OAAO;CAC5D,IAAI,CAAC,gBAAgB,OAAO,GAAG,OAAO;CACtC,IAAI,0BAA0B,OAAO,GAAG,OAAO,QAAQ,WAAW,KAAA,KAAa,OAAO,KAAK,QAAQ,MAAM,CAAC,CAAC,SAAS;CACpH,OAAO,kBAAkB,OAAO;AACjC"}
|
package/dist/naming.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region src/naming.ts
|
|
2
|
+
/**
|
|
3
|
+
* Naming Convention Utilities
|
|
4
|
+
* Converts between various naming conventions (snake_case, camelCase, PascalCase, kebab-case)
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Converts snake_case to camelCase
|
|
9
|
+
* @param snakeCase - Snake case string
|
|
10
|
+
* @returns Camel case string
|
|
11
|
+
* @public
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* snakeToCamel('user_email') // 'userEmail'
|
|
15
|
+
* snakeToCamel('created_at') // 'createdAt'
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function snakeToCamel(snakeCase) {
|
|
19
|
+
return snakeCase.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Converts camelCase to snake_case
|
|
23
|
+
* @param camelCase - Camel case string
|
|
24
|
+
* @returns Snake case string
|
|
25
|
+
* @public
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* camelToSnake('userEmail') // 'user_email'
|
|
29
|
+
* camelToSnake('createdAt') // 'created_at'
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function camelToSnake(camelCase) {
|
|
33
|
+
return camelCase.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Converts snake_case to Title Case label
|
|
37
|
+
* @param snakeCase - Snake case string
|
|
38
|
+
* @returns Title case label
|
|
39
|
+
* @public
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* snakeToLabel('user_email') // 'User Email'
|
|
43
|
+
* snakeToLabel('first_name') // 'First Name'
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function snakeToLabel(snakeCase) {
|
|
47
|
+
return snakeCase.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Converts camelCase to Title Case label
|
|
51
|
+
* @param camelCase - Camel case string
|
|
52
|
+
* @returns Title case label
|
|
53
|
+
* @public
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* camelToLabel('userEmail') // 'User Email'
|
|
57
|
+
* camelToLabel('firstName') // 'First Name'
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
function camelToLabel(camelCase) {
|
|
61
|
+
const withSpaces = camelCase.replace(/([A-Z])/g, " $1").trim();
|
|
62
|
+
return withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convert table name to PascalCase doctype name
|
|
66
|
+
* @param tableName - SQL table name (snake_case)
|
|
67
|
+
* @returns PascalCase name
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
function toPascalCase(tableName) {
|
|
71
|
+
return tableName.split(/[-_\s]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Convert to kebab-case slug
|
|
75
|
+
* @param name - Name to convert
|
|
76
|
+
* @returns kebab-case slug
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
function toSlug(name) {
|
|
80
|
+
return name.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Convert PascalCase to snake_case (e.g., for deriving table names from type names)
|
|
84
|
+
* @param pascal - PascalCase string
|
|
85
|
+
* @returns snake_case string
|
|
86
|
+
* @public
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* pascalToSnake('SalesOrder') // 'sales_order'
|
|
90
|
+
* pascalToSnake('SalesOrderItem') // 'sales_order_item'
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
function pascalToSnake(pascal) {
|
|
94
|
+
return pascal.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { camelToLabel, camelToSnake, pascalToSnake, snakeToCamel, snakeToLabel, toPascalCase, toSlug };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.js","names":[],"sources":["../src/naming.ts"],"sourcesContent":["/**\n * Naming Convention Utilities\n * Converts between various naming conventions (snake_case, camelCase, PascalCase, kebab-case)\n * @packageDocumentation\n */\n\n/**\n * Converts snake_case to camelCase\n * @param snakeCase - Snake case string\n * @returns Camel case string\n * @public\n * @example\n * ```typescript\n * snakeToCamel('user_email') // 'userEmail'\n * snakeToCamel('created_at') // 'createdAt'\n * ```\n */\nexport function snakeToCamel(snakeCase: string): string {\n\treturn snakeCase.replace(/_([a-z])/g, (_: string, letter: string) => letter.toUpperCase())\n}\n\n/**\n * Converts camelCase to snake_case\n * @param camelCase - Camel case string\n * @returns Snake case string\n * @public\n * @example\n * ```typescript\n * camelToSnake('userEmail') // 'user_email'\n * camelToSnake('createdAt') // 'created_at'\n * ```\n */\nexport function camelToSnake(camelCase: string): string {\n\treturn camelCase.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)\n}\n\n/**\n * Converts snake_case to Title Case label\n * @param snakeCase - Snake case string\n * @returns Title case label\n * @public\n * @example\n * ```typescript\n * snakeToLabel('user_email') // 'User Email'\n * snakeToLabel('first_name') // 'First Name'\n * ```\n */\nexport function snakeToLabel(snakeCase: string): string {\n\treturn snakeCase\n\t\t.split('_')\n\t\t.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join(' ')\n}\n\n/**\n * Converts camelCase to Title Case label\n * @param camelCase - Camel case string\n * @returns Title case label\n * @public\n * @example\n * ```typescript\n * camelToLabel('userEmail') // 'User Email'\n * camelToLabel('firstName') // 'First Name'\n * ```\n */\nexport function camelToLabel(camelCase: string): string {\n\tconst withSpaces = camelCase.replace(/([A-Z])/g, ' $1').trim()\n\treturn withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1)\n}\n\n/**\n * Convert table name to PascalCase doctype name\n * @param tableName - SQL table name (snake_case)\n * @returns PascalCase name\n * @public\n */\nexport function toPascalCase(tableName: string): string {\n\treturn tableName\n\t\t.split(/[-_\\s]+/)\n\t\t.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join('')\n}\n\n/**\n * Convert to kebab-case slug\n * @param name - Name to convert\n * @returns kebab-case slug\n * @public\n */\nexport function toSlug(name: string): string {\n\treturn name\n\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t.replace(/[\\s_]+/g, '-')\n\t\t.toLowerCase()\n}\n\n/**\n * Convert PascalCase to snake_case (e.g., for deriving table names from type names)\n * @param pascal - PascalCase string\n * @returns snake_case string\n * @public\n * @example\n * ```typescript\n * pascalToSnake('SalesOrder') // 'sales_order'\n * pascalToSnake('SalesOrderItem') // 'sales_order_item'\n * ```\n */\nexport function pascalToSnake(pascal: string): string {\n\treturn pascal\n\t\t.replace(/([a-z])([A-Z])/g, '$1_$2')\n\t\t.replace(/[\\s-]+/g, '_')\n\t\t.to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
-
ACurrencyInput: "currency"
|
|
25
|
+
ACurrencyInput: "currency",
|
|
26
|
+
ASemverInput: "semver"
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
28
29
|
* Resolve a component's semantic category, or `undefined` for an unknown (custom) component —
|
|
@@ -126,4 +127,4 @@ function unwrapInlineLinks(fields, record) {
|
|
|
126
127
|
//#endregion
|
|
127
128
|
export { componentCategory as a, COMPONENT_LINK_EXPANSION as i, CANONICAL_COMPONENTS as n, componentLinkExpansion as o, COMPONENT_CATEGORY as r, resolveLinkRenderMode as s, unwrapInlineLinks as t };
|
|
128
129
|
|
|
129
|
-
//# sourceMappingURL=record-
|
|
130
|
+
//# sourceMappingURL=record-ChZNL_Hb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-ChZNL_Hb.js","names":[],"sources":["../src/component-meta.ts","../src/record.ts"],"sourcesContent":["/**\n * Semantic category for a rendering component.\n *\n * `component` is the primary field axis, so the runtime consumers that need to know what a field\n * *means* (atable cell formatting / filter widgets, record-default init) derive it from here. This\n * is the single source of \"what kind of value does this component render\", keyed by the canonical\n * registered component names — each consumer maps the category to its own concern (filter widget,\n * default value, …).\n *\n * @public\n */\nexport type ComponentCategory =\n\t| 'text'\n\t| 'number'\n\t| 'boolean'\n\t| 'date'\n\t| 'datetime'\n\t| 'duration'\n\t| 'select'\n\t| 'code'\n\t| 'link'\n\t| 'attach'\n\t| 'quantity'\n\t| 'currency'\n\t| 'semver'\n\n/**\n * Canonical component → semantic category. Only the components Stonecrop ships with appear here;\n * custom/unknown component names have no category and consumers fall back to their default.\n * @public\n */\nexport const COMPONENT_CATEGORY: Record<string, ComponentCategory> = {\n\tATextInput: 'text',\n\tATextboxInput: 'text',\n\tANumericInput: 'number',\n\tACheckbox: 'boolean',\n\tADate: 'date',\n\tADatePicker: 'date',\n\tADateSelection: 'date',\n\tADateTime: 'datetime',\n\tADuration: 'duration',\n\tADateRange: 'date',\n\tADropdown: 'select',\n\tASegmentedControl: 'select',\n\tACodeEditor: 'code',\n\tAFormLink: 'link',\n\tAFileAttach: 'attach',\n\tAQuantityInput: 'quantity',\n\tACurrencyInput: 'currency',\n\tASemverInput: 'semver',\n}\n\n/**\n * Resolve a component's semantic category, or `undefined` for an unknown (custom) component —\n * callers treat that as \"no opinion\" and use their own default.\n * @public\n */\nexport function componentCategory(component?: string): ComponentCategory | undefined {\n\treturn component ? COMPONENT_CATEGORY[component] : undefined\n}\n\n/**\n * Whether a link component expands its target doctype, or renders the link inline.\n *\n * This is the *only* axis the component decides. It deliberately does not choose between an\n * embedded record and an embedded table: `cardinality` states whether the value is a scalar or\n * an array, which is a fact about the data rather than a rendering preference, so a component\n * must not be able to override it (an `AForm` over a `noneOrMany` link would be handed an array\n * it cannot render). Component names encode both axes — `AFormLink`/`ATableLink` are the inline\n * pair, `AForm`/`ATable` the expanding pair — but only the inline/expand half is authoritative.\n *\n * @public\n */\nexport type LinkExpansion = 'inline' | 'expand'\n\n/**\n * Canonical link component → expansion. Only components Stonecrop ships with appear here; an\n * unmapped (custom) component has none, and callers treat that as `expand` — the behaviour that\n * predates this map, so a custom component can never silently collapse a link to a picker.\n * @public\n */\nexport const COMPONENT_LINK_EXPANSION: Record<string, LinkExpansion> = {\n\tAFormLink: 'inline',\n\tAForm: 'expand',\n\tATable: 'expand',\n}\n\n/**\n * Resolve a component's link expansion, or `undefined` for an absent/unmapped component.\n * @public\n */\nexport function componentLinkExpansion(component?: string): LinkExpansion | undefined {\n\treturn component ? COMPONENT_LINK_EXPANSION[component] : undefined\n}\n\n/**\n * How a link field renders.\n *\n * - `inline` — a scalar id-picker; the target is *not* expanded (the field keeps its own value\n * and carries a `doctype` prop for async display-text resolution and navigation).\n * - `record` — the target doctype is resolved and embedded as a nested form.\n * - `table` — the target doctype is resolved and embedded as a child table.\n *\n * @public\n */\nexport type LinkRenderMode = 'inline' | 'record' | 'table'\n\n/**\n * Decide how a *declared* link (one with a `LinkDeclaration`) renders.\n *\n * Two independent axes: the **component** picks inline vs expand, and when expanding the\n * **cardinality** picks record vs table (many → table). The declaration's component wins over the\n * field's, matching the precedence the resolver already uses for the rendered component.\n *\n * This is the single definition of \"does this link expand\" — it is consumed by both the client\n * resolver (which builds the nested schema) and the server column builder (which must still\n * SELECT an `inline` link's FK column). Call it; never re-derive the rule at the call site, or\n * the two will drift and the client will render a table for a column the server never selected.\n *\n * @param link - the link declaration (only `component` and `cardinality` are consulted)\n * @param fieldComponent - the linked field's own `component`, used when the declaration names none\n * @public\n */\nexport function resolveLinkRenderMode(\n\tlink: { component?: string; cardinality?: string },\n\tfieldComponent?: string\n): LinkRenderMode {\n\tif (componentLinkExpansion(link.component ?? fieldComponent) === 'inline') return 'inline'\n\treturn link.cardinality === 'noneOrMany' || link.cardinality === 'atLeastOne' ? 'table' : 'record'\n}\n\n/**\n * Every component Stonecrop ships with that can render a value field, sorted by name.\n *\n * The union of the two maps above is the definition, not a copy of it: a shipped component either\n * categorises a value ({@link COMPONENT_CATEGORY}) or is one of the link containers that has no\n * value of its own ({@link COMPONENT_LINK_EXPANSION}'s `AForm`/`ATable`). `AFieldset` is absent by\n * the same rule — it is a `kind: 'fieldset'` container, so it is never a value field's component.\n *\n * `component` is an **open** axis: any string is valid, and naming a custom component is how an app\n * renders a field Stonecrop ships no widget for. This list is therefore the set to *suggest* to an\n * author, and to check first-party data against — never a set to validate arbitrary input against.\n *\n * @public\n */\nexport const CANONICAL_COMPONENTS: readonly string[] = [\n\t...new Set([...Object.keys(COMPONENT_CATEGORY), ...Object.keys(COMPONENT_LINK_EXPANSION)]),\n].toSorted()\n","import { componentLinkExpansion } from './component-meta'\nimport type { DoctypeField } from './field'\nimport { flattenFields } from './flatten'\n\n/**\n * Reduce a record's *inline* link values to the ids that get persisted.\n *\n * The adapter returns an inline link as `{ id, displayText }`, so that is what a record holds\n * everywhere it is read — the store, a list row, a form field. A column takes the id alone, so\n * this is the single definition of the shape a record leaves in, and it belongs at the boundary\n * a record crosses on its way to the server, never on the way into the store.\n *\n * Doing it on the way in destroys the text the adapter looked up: nothing else holds it, so the\n * field that resolved a moment ago renders its raw id, and the same record then renders\n * differently depending on whether anything had edited the form yet. That is the bug this exists\n * to prevent, and its damage is a wrong render, not a throw.\n *\n * Only *inline* links may be reduced. An inline link's value is indistinguishable by inspection\n * from an expanded one (`{ id, ...the whole target record }`), so `component` — which states\n * which of the two a field is — is what tells them apart, via {@link componentLinkExpansion}.\n * Reducing an expanded link would send the id in place of the record.\n *\n * A fieldset's children are the record's own keys, since a fieldset is layout, so they are\n * reduced where every other field is.\n *\n * @param fields - the doctype's top-level fields\n * @param record - the record to reduce; not mutated\n * @returns a shallow copy with every inline link reduced to its id\n * @public\n */\nexport function unwrapInlineLinks(fields: readonly DoctypeField[], record: Record<string, any>): Record<string, any> {\n\tconst inline = new Set(\n\t\tflattenFields(fields)\n\t\t\t.filter(field => field.kind === 'field' && Boolean(field.doctype))\n\t\t\t.filter(field => componentLinkExpansion(field.component) === 'inline')\n\t\t\t.map(field => field.fieldname)\n\t)\n\tif (inline.size === 0) return record\n\n\tconst result: Record<string, any> = { ...record }\n\tfor (const [key, value] of Object.entries(result)) {\n\t\tif (!inline.has(key) || value === null || typeof value !== 'object' || Array.isArray(value)) continue\n\t\t// `'id' in value` rather than a truthiness test: an inline link that was never resolved\n\t\t// is still a bare scalar, and reducing it a second time would be a no-op at best.\n\t\tif ('id' in value) result[key] = value.id\n\t}\n\treturn result\n}\n"],"mappings":";;;;;;;AA+BA,IAAa,qBAAwD;CACpE,YAAY;CACZ,eAAe;CACf,eAAe;CACf,WAAW;CACX,OAAO;CACP,aAAa;CACb,gBAAgB;CAChB,WAAW;CACX,WAAW;CACX,YAAY;CACZ,WAAW;CACX,mBAAmB;CACnB,aAAa;CACb,WAAW;CACX,aAAa;CACb,gBAAgB;CAChB,gBAAgB;CAChB,cAAc;AACf;;;;;;AAOA,SAAgB,kBAAkB,WAAmD;CACpF,OAAO,YAAY,mBAAmB,aAAa,KAAA;AACpD;;;;;;;AAsBA,IAAa,2BAA0D;CACtE,WAAW;CACX,OAAO;CACP,QAAQ;AACT;;;;;AAMA,SAAgB,uBAAuB,WAA+C;CACrF,OAAO,YAAY,yBAAyB,aAAa,KAAA;AAC1D;;;;;;;;;;;;;;;;;AA8BA,SAAgB,sBACf,MACA,gBACiB;CACjB,IAAI,uBAAuB,KAAK,aAAa,cAAc,MAAM,UAAU,OAAO;CAClF,OAAO,KAAK,gBAAgB,gBAAgB,KAAK,gBAAgB,eAAe,UAAU;AAC3F;;;;;;;;;;;;;;;AAgBA,IAAa,uBAA0C,CACtD,mBAAG,IAAI,IAAI,CAAC,GAAG,OAAO,KAAK,kBAAkB,GAAG,GAAG,OAAO,KAAK,wBAAwB,CAAC,CAAC,CAC1F,CAAC,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrHX,SAAgB,kBAAkB,QAAiC,QAAkD;CACpH,MAAM,SAAS,IAAI,IAClB,cAAc,MAAM,CAAC,CACnB,QAAO,UAAS,MAAM,SAAS,WAAW,QAAQ,MAAM,OAAO,CAAC,CAAC,CACjE,QAAO,UAAS,uBAAuB,MAAM,SAAS,MAAM,QAAQ,CAAC,CACrE,KAAI,UAAS,MAAM,SAAS,CAC/B;CACA,IAAI,OAAO,SAAS,GAAG,OAAO;CAE9B,MAAM,SAA8B,EAAE,GAAG,OAAO;CAChD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EAClD,IAAI,CAAC,OAAO,IAAI,GAAG,KAAK,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG;EAG7F,IAAI,QAAQ,OAAO,OAAO,OAAO,MAAM;CACxC;CACA,OAAO;AACR"}
|
package/dist/record.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as unwrapInlineLinks } from "./record-
|
|
1
|
+
import { t as unwrapInlineLinks } from "./record-ChZNL_Hb.js";
|
|
2
2
|
export { unwrapInlineLinks };
|
package/dist/schema.d.ts
CHANGED
|
@@ -433,7 +433,7 @@ export declare const COMPONENT_LINK_EXPANSION: Record<string, LinkExpansion>;
|
|
|
433
433
|
*
|
|
434
434
|
* @public
|
|
435
435
|
*/
|
|
436
|
-
export declare type ComponentCategory = 'text' | 'number' | 'boolean' | 'date' | 'datetime' | 'duration' | 'select' | 'code' | 'link' | 'attach' | 'quantity' | 'currency';
|
|
436
|
+
export declare type ComponentCategory = 'text' | 'number' | 'boolean' | 'date' | 'datetime' | 'duration' | 'select' | 'code' | 'link' | 'attach' | 'quantity' | 'currency' | 'semver';
|
|
437
437
|
|
|
438
438
|
/**
|
|
439
439
|
* Resolve a component's semantic category, or `undefined` for an unknown (custom) component —
|
|
@@ -712,6 +712,7 @@ export declare const DoctypeMeta: z.ZodObject<{
|
|
|
712
712
|
}, z.core.$strip>>>;
|
|
713
713
|
}, z.core.$strip>>;
|
|
714
714
|
inherits: z.ZodOptional<z.ZodString>;
|
|
715
|
+
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
715
716
|
}, z.core.$strip>;
|
|
716
717
|
|
|
717
718
|
/**
|
|
@@ -1933,8 +1934,6 @@ export declare interface ValueField {
|
|
|
1933
1934
|
readOnly?: boolean;
|
|
1934
1935
|
/** Whether the field is hidden from the UI */
|
|
1935
1936
|
hidden?: boolean;
|
|
1936
|
-
/** Default value for new records */
|
|
1937
|
-
default?: unknown;
|
|
1938
1937
|
/** Validation configuration */
|
|
1939
1938
|
validation?: FieldValidation;
|
|
1940
1939
|
/** Cardinality for Link fields — authoritative value on LinkDeclaration takes precedence */
|
|
@@ -1985,7 +1984,7 @@ export declare const ValueFieldSchema: z.ZodObject<{
|
|
|
1985
1984
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
1986
1985
|
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
1987
1986
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
1988
|
-
default: z.ZodOptional<z.
|
|
1987
|
+
default: z.ZodOptional<z.ZodNever>;
|
|
1989
1988
|
validation: z.ZodOptional<z.ZodObject<{
|
|
1990
1989
|
errorMessage: z.ZodString;
|
|
1991
1990
|
}, z.core.$loose>>;
|