@stndrds/schema 1.0.0-alpha.328 → 1.0.0-alpha.330
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/all-CWDgBPuS.d.ts +1186 -0
- package/dist/all-DilIWUev.d.mts +1186 -0
- package/dist/capabilities.d.mts +94 -94
- package/dist/capabilities.d.ts +94 -94
- package/dist/capabilities.js +2 -2
- package/dist/capabilities.mjs +2 -2
- package/dist/checkbox-CjnTd8DE.d.ts +11 -0
- package/dist/checkbox-preO352q.d.mts +11 -0
- package/dist/config-BQJJHopR.js +13 -0
- package/dist/config-_sOeudpS.mjs +13 -0
- package/dist/core-397tQy5q.js +2 -0
- package/dist/core-BLHhNykL.mjs +2 -0
- package/dist/date-BL3UHIXs.d.mts +24 -0
- package/dist/date-CxwHkbid.d.ts +24 -0
- package/dist/exceptions-DGCzCc9t.d.mts +1405 -0
- package/dist/exceptions-DGCzCc9t.d.ts +1405 -0
- package/dist/exceptions.d.mts +3 -2
- package/dist/exceptions.d.ts +3 -2
- package/dist/exceptions.js +3 -1
- package/dist/exceptions.mjs +3 -1
- package/dist/index-B7HmBsUS.d.ts +53 -0
- package/dist/{helpers-JGJLPkwG.d.ts → index-BoUwfrDH.d.mts} +172 -145
- package/dist/index-C8M7Amy9.d.mts +254 -0
- package/dist/{helpers-Cic6nWBr.d.mts → index-DqwNrDSp.d.ts} +172 -145
- package/dist/index-Uwy7CTKo.d.ts +254 -0
- package/dist/index-XtmC-C7J.d.mts +53 -0
- package/dist/index.d.mts +9203 -9111
- package/dist/index.d.ts +9203 -9111
- package/dist/index.js +21 -27
- package/dist/index.mjs +21 -27
- package/dist/number-Ddi_YYfm.d.mts +11 -0
- package/dist/number-GmD5PM5s.d.ts +11 -0
- package/dist/object-BQuWeYKA.js +4 -0
- package/dist/object-tz3P8Pgh.mjs +4 -0
- package/dist/phone-C0QEfySq.js +2 -0
- package/dist/phone-DHUJN7SI.mjs +2 -0
- package/dist/text-A9AJ1wUO.js +2 -0
- package/dist/text-C8Lb-NFo.mjs +2 -0
- package/dist/text-CxwF5K4k.d.mts +11 -0
- package/dist/text-D6UypN8p.d.ts +11 -0
- package/dist/utils-fXIvFFl6.mjs +2 -0
- package/dist/utils-gY3d9Dwp.js +2 -0
- package/dist/utils.d.mts +3 -2
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +2 -1
- package/dist/utils.mjs +2 -1
- package/dist/validation/all.d.mts +6 -8
- package/dist/validation/all.d.ts +6 -8
- package/dist/validation/all.js +2 -1
- package/dist/validation/all.mjs +2 -1
- package/dist/validation/complex/currency.d.mts +8 -9
- package/dist/validation/complex/currency.d.ts +8 -9
- package/dist/validation/complex/currency.js +2 -1
- package/dist/validation/complex/currency.mjs +2 -1
- package/dist/validation/complex/location.d.mts +14 -15
- package/dist/validation/complex/location.d.ts +14 -15
- package/dist/validation/complex/location.js +2 -1
- package/dist/validation/complex/location.mjs +2 -1
- package/dist/validation/complex/phone.d.mts +8 -9
- package/dist/validation/complex/phone.d.ts +8 -9
- package/dist/validation/complex/phone.js +2 -1
- package/dist/validation/complex/phone.mjs +2 -1
- package/dist/validation/complex/relation.d.mts +8 -9
- package/dist/validation/complex/relation.d.ts +8 -9
- package/dist/validation/complex/relation.js +2 -1
- package/dist/validation/complex/relation.mjs +2 -1
- package/dist/validation/complex/richtext.d.mts +6 -7
- package/dist/validation/complex/richtext.d.ts +6 -7
- package/dist/validation/complex/richtext.js +2 -1
- package/dist/validation/complex/richtext.mjs +2 -1
- package/dist/validation/complex/select.d.mts +8 -9
- package/dist/validation/complex/select.d.ts +8 -9
- package/dist/validation/complex/select.js +2 -1
- package/dist/validation/complex/select.mjs +2 -1
- package/dist/validation/complex/user.d.mts +6 -7
- package/dist/validation/complex/user.d.ts +6 -7
- package/dist/validation/complex/user.js +2 -1
- package/dist/validation/complex/user.mjs +2 -1
- package/dist/validation/computed/formula.d.mts +6 -7
- package/dist/validation/computed/formula.d.ts +6 -7
- package/dist/validation/computed/formula.js +2 -1
- package/dist/validation/computed/formula.mjs +2 -1
- package/dist/validation/computed/rollup.d.mts +6 -7
- package/dist/validation/computed/rollup.d.ts +6 -7
- package/dist/validation/computed/rollup.js +2 -1
- package/dist/validation/computed/rollup.mjs +2 -1
- package/dist/validation/config/index.d.mts +3 -4
- package/dist/validation/config/index.d.ts +3 -4
- package/dist/validation/config/index.js +2 -1
- package/dist/validation/config/index.mjs +2 -1
- package/dist/validation/core/index.d.mts +2 -17
- package/dist/validation/core/index.d.ts +2 -17
- package/dist/validation/core/index.js +2 -1
- package/dist/validation/core/index.mjs +2 -1
- package/dist/validation/object/index.d.mts +2 -29
- package/dist/validation/object/index.d.ts +2 -29
- package/dist/validation/object/index.js +2 -1
- package/dist/validation/object/index.mjs +2 -1
- package/dist/validation/primitives/checkbox.d.mts +2 -10
- package/dist/validation/primitives/checkbox.d.ts +2 -10
- package/dist/validation/primitives/checkbox.js +2 -1
- package/dist/validation/primitives/checkbox.mjs +2 -1
- package/dist/validation/primitives/date.d.mts +2 -23
- package/dist/validation/primitives/date.d.ts +2 -23
- package/dist/validation/primitives/date.js +2 -1
- package/dist/validation/primitives/date.mjs +2 -1
- package/dist/validation/primitives/number.d.mts +2 -10
- package/dist/validation/primitives/number.d.ts +2 -10
- package/dist/validation/primitives/number.js +2 -1
- package/dist/validation/primitives/number.mjs +2 -1
- package/dist/validation/primitives/text.d.mts +2 -10
- package/dist/validation/primitives/text.d.ts +2 -10
- package/dist/validation/primitives/text.js +2 -1
- package/dist/validation/primitives/text.mjs +2 -1
- package/dist/view-config.schema-B4AkqLKQ.mjs +2 -0
- package/dist/view-config.schema-to6p1m8L.js +2 -0
- package/package.json +11 -9
- package/dist/all-DPW8A7kG.d.ts +0 -1178
- package/dist/all-yrWOkrj0.d.mts +0 -1178
- package/dist/attributes-B9zZJdoT.d.mts +0 -1365
- package/dist/attributes-B9zZJdoT.d.ts +0 -1365
- package/dist/chunk-23KPS33D.js +0 -2
- package/dist/chunk-2FJ45VYQ.js +0 -2
- package/dist/chunk-2M4YXNYZ.js +0 -15
- package/dist/chunk-47KVYDKG.js +0 -2
- package/dist/chunk-4OTKOCGB.mjs +0 -2
- package/dist/chunk-4VCADZK4.mjs +0 -2
- package/dist/chunk-DPD6ZWL2.js +0 -2
- package/dist/chunk-EZCWO4XV.mjs +0 -15
- package/dist/chunk-GKXTXH4Y.mjs +0 -2
- package/dist/chunk-GXSNLYRR.js +0 -2
- package/dist/chunk-IBM4ID4Y.js +0 -6
- package/dist/chunk-JFSQ24XR.js +0 -2
- package/dist/chunk-JOS2XMXY.js +0 -2
- package/dist/chunk-JSKLP4GI.js +0 -12
- package/dist/chunk-JVLH3DVZ.js +0 -2
- package/dist/chunk-KG2ADZG6.mjs +0 -2
- package/dist/chunk-KLR22JMC.js +0 -2
- package/dist/chunk-KSPJP74K.mjs +0 -2
- package/dist/chunk-KYPEBOPW.mjs +0 -2
- package/dist/chunk-LB4TNMZU.mjs +0 -2
- package/dist/chunk-LSCBR4VS.js +0 -2
- package/dist/chunk-LWSOKXPF.js +0 -2
- package/dist/chunk-O34B5KOW.mjs +0 -2
- package/dist/chunk-PFO7NWQW.mjs +0 -2
- package/dist/chunk-Q7TQCRSD.mjs +0 -2
- package/dist/chunk-RTHLB6T6.js +0 -2
- package/dist/chunk-SLYRQ72J.js +0 -2
- package/dist/chunk-UXISKZ5Y.js +0 -2
- package/dist/chunk-VKFLXFPP.mjs +0 -2
- package/dist/chunk-WMQRTFOP.mjs +0 -2
- package/dist/chunk-WUFUIJRX.mjs +0 -2
- package/dist/chunk-XAVRKIBE.mjs +0 -6
- package/dist/chunk-XHEBV2HE.js +0 -2
- package/dist/chunk-XMQV2WFY.mjs +0 -2
- package/dist/chunk-XRDP2Y4J.mjs +0 -2
- package/dist/chunk-XRWRECDA.mjs +0 -12
- package/dist/chunk-XUAP7KWK.js +0 -2
- package/dist/chunk-XXTKNIBK.js +0 -2
- package/dist/chunk-YIXNAWH6.mjs +0 -2
- package/dist/chunk-YJSVWV3Z.mjs +0 -2
- package/dist/index-BbYKy1fQ.d.mts +0 -252
- package/dist/index-BjKaOUx3.d.ts +0 -252
- package/dist/types-BpuX5PuM.d.mts +0 -38
- package/dist/types-DLwv9Jgf.d.ts +0 -38
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
import{SchemaError as e,SchemaErrorCode as t,ValidationError as n}from"./exceptions.mjs";import{COLORS as r,ICONS as i}from"@stndrds/constants";import a,{z as o}from"zod";const s=[`skill`,`memory`,`drives`,`artifact`,`meeting`];function isNativeObjectName(e){return s.includes(e)}const c=[`workspace`,`private`],ee=[`all`,...c];function parseResourceVisibility(e){if(typeof e==`string`&&c.includes(e))return e;throw new n(`visibility must be one of: ${c.join(`, `)} (received: ${String(e)})`,[])}const l=[`id`,`createdAt`,`updatedAt`,`createdBy`,`lastUpdatedBy`,`visibility`,`ownedBy`],u=[...l,`objectId`,`label`,`embeddingText`,`values`,`metadata`,`deletedAt`,`deletedBy`,`schemaVersion`,`owned_by`],te=s,ne=new Set(i),d=/^[a-zA-Z_][a-zA-Z0-9_]*$/,re=/^[a-z][a-z0-9-]*$/,f=a.string().min(1,`Object name cannot be empty`).max(63,`Object name is too long (max 63 characters)`).regex(/^[a-z][a-z0-9-]*$/,{message:`Invalid object name format.
|
|
3
|
+
Name must be in kebab-case (slug format):
|
|
4
|
+
✅ Valid: 'products', 'user-profiles', 'order-items'
|
|
5
|
+
❌ Invalid: 'Products', 'userProfiles', 'user_profiles'`});function validateObjectName(n){try{f.parse(n)}catch(n){throw n instanceof a.ZodError?new e(n.issues[0].message,t.INVALID_OBJECT_NAME):n}}function validateViewName(e){if(!e||e.length===0)throw new n(`View name cannot be empty`,[{path:[`name`],message:`View name cannot be empty`}]);if(e.length>63)throw new n(`View name is too long`,[{path:[`name`],message:`View name is too long (max 63 characters)`}]);if(!re.test(e))throw new n(`Invalid view name format`,[{path:[`name`],message:`View name must be in kebab-case (e.g., 'detail', 'list-view')`}])}function assertUniqueBy(e,t,n){let r=new Set;for(let i of e){let e=t(i);if(r.has(e))throw n(e);r.add(e)}}const p=a.string().min(1,`Attribute name cannot be empty`).max(63,`Attribute name is too long (max 63 characters)`).regex(d,{message:`Invalid attribute name format.
|
|
6
|
+
Name must be a valid variable identifier:
|
|
7
|
+
✅ Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
|
|
8
|
+
❌ Invalid: 'first-name', 'first name', '123name', 'first.name'`}).refine(e=>!u.includes(e),{message:`This is a reserved attribute name. Reserved names: ${u.join(`, `)}`});function validateAttributeName(e){if(!e||e.length===0)throw Error(`[AttributeBuilder] Attribute name cannot be empty`);if(e.length>63)throw Error(`[AttributeBuilder] Attribute name is too long (max 63 characters)`);if(!d.test(e))throw Error(`[AttributeBuilder] Invalid attribute name format.
|
|
9
|
+
Name must be a valid variable identifier:
|
|
10
|
+
✅ Valid: 'firstName', 'first_name', 'FirstName', 'FIRST_NAME'
|
|
11
|
+
❌ Invalid: 'first-name', 'first name', '123name', 'first.name'`);if(u.includes(e))throw Error(`[AttributeBuilder] "${e}" is a reserved name and cannot be used as an attribute name.\nReserved names: ${u.join(`, `)}`)}function validateLabel(e){if(!e||e.length===0)throw Error(`[AttributeBuilder] Attribute label cannot be empty`);if(e.length>128)throw Error(`[AttributeBuilder] Attribute label is too long (max 128 characters)`)}function validateIconName(e,t){if(!ne.has(e))throw Error(`[AttributeBuilder] Invalid icon "${e}" in ${t}.\nIcon must be one of the predefined icons from @stndrds/constants.`)}function validateOptions(e,t){let n=new Set;for(let r of t){if(!r.value?.trim())throw Error(`[AttributeBuilder] Option in "${e}" has an empty or missing value.`);if(!r.label?.trim())throw Error(`[AttributeBuilder] Option "${r.value}" in "${e}" has an empty or missing label.`);if(n.has(r.value))throw Error(`[AttributeBuilder] Duplicate option value "${r.value}" in "${e}".`);n.add(r.value)}for(let n of t){if(n.inverse===void 0)continue;let r=t.find(e=>e.value===n.inverse);if(!r)throw Error(`[AttributeBuilder] Option "${n.value}" in "${e}" has inverse "${n.inverse}" which does not match any option value.`);if(r.inverse!==n.value)throw Error(`[AttributeBuilder] Inverse mismatch in "${e}": "${n.value}" points to "${n.inverse}", but "${n.inverse}" points to "${r.inverse??`(none)`}". Inverse pairs must be symmetric.`)}}const m={attributesPerObject:300,tabsPerView:24,groupsPerFormTab:12,fieldsPerGroup:60,fieldsPerFormTab:150,columnsPerTab:50,optionsPerAttribute:200,sidePanelAttributes:100,sidePanelPanes:20,filterRulesPerTab:50,sortsPerTab:20,emailAttributesPerTab:30,objectsPerPlan:20,mutationsPerPlan:500,planBytes:524288,historyDefault:20,historyMax:50,iconQueries:5,iconResults:20},h=Object.keys(r),g=new Set(i),_=o.enum(h).describe(`A color id from the palette`),v=o.string().superRefine((e,t)=>{g.has(e)||t.addIssue({code:`custom`,message:`Invalid icon name`})}).transform(e=>e);var ComputedFormulaParseError=class extends Error{constructor(e){super(e),this.name=`ComputedFormulaParseError`}};function parseComputedFormula(e){let t=new Parser(tokenize(e)),n=t.parseExpression();return t.expectEnd(),n}function tokenize(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===` `||r===`
|
|
12
|
+
`||r===`\r`){n+=1;continue}if(r===`"`||r===`'`){let i=scanString(e,n,r);t.push({kind:`string`,value:i.value,position:n}),n=i.nextIndex;continue}if(isDigit(r)){let r=scanNumber(e,n);t.push({kind:`number`,value:r.value,position:n}),n=r.nextIndex;continue}if(isIdentifierStart(r)){let r=scanIdentifier(e,n),i=r.value.toLowerCase();i===`true`?t.push({kind:`boolean`,value:!0,position:n}):i===`false`?t.push({kind:`boolean`,value:!1,position:n}):i===`null`?t.push({kind:`null`,position:n}):t.push({kind:`identifier`,value:r.value,position:n}),n=r.nextIndex;continue}let i=e.slice(n,n+2);if(i===`>=`||i===`<=`||i===`==`||i===`!=`){t.push({kind:`operator`,value:i,position:n}),n+=2;continue}if(r===`>`||r===`<`||r===`+`||r===`-`||r===`*`||r===`/`){t.push({kind:`operator`,value:r,position:n}),n+=1;continue}if(r===`(`||r===`)`||r===`,`||r===`.`){t.push({kind:`punctuation`,value:r,position:n}),n+=1;continue}throw new ComputedFormulaParseError(`Unexpected character "${r}" at position ${n}`)}return t}function scanString(e,t,n=`"`){let r=``,i=t+1;for(;i<e.length;){let t=e[i];if(t===n)return{value:r,nextIndex:i+1};if(t===`\\`){let t=e[i+1];if(t===void 0)throw new ComputedFormulaParseError(`Unterminated string literal at position ${i}`);r+=decodeEscape(t,i),i+=2;continue}r+=t,i+=1}throw new ComputedFormulaParseError(`Unterminated string literal at position ${t}`)}function decodeEscape(e,t){switch(e){case`"`:case`\\`:return e;case`n`:return`
|
|
13
|
+
`;case`r`:return`\r`;case`t`:return` `;default:throw new ComputedFormulaParseError(`Unknown escape sequence "\\${e}" at position ${t}`)}}function scanNumber(e,t){let n=t;for(;n<e.length&&isDigit(e[n]);)n+=1;if(e[n]===`.`){let t=n;if(n+=1,!isDigit(e[n]))throw new ComputedFormulaParseError(`Invalid number literal at position ${t}`);for(;n<e.length&&isDigit(e[n]);)n+=1}let r=e.slice(t,n),i=Number(r);if(!Number.isFinite(i))throw new ComputedFormulaParseError(`Invalid number literal "${r}"`);return{value:i,nextIndex:n}}function scanIdentifier(e,t){let n=t+1;for(;n<e.length&&isIdentifierPart(e[n]);)n+=1;return{value:e.slice(t,n),nextIndex:n}}function isDigit(e){return e!==void 0&&e>=`0`&&e<=`9`}function isIdentifierStart(e){return e!==void 0&&/[A-Za-z_]/.test(e)}function isIdentifierPart(e){return e!==void 0&&/[A-Za-z0-9_]/.test(e)}var Parser=class{constructor(e){this.tokens=e,this.position=0}parseExpression(){return this.parseBinaryExpression(0)}expectEnd(){let e=this.peek();if(e!==void 0)throw new ComputedFormulaParseError(`Unexpected token ${describeToken(e)} at position ${e.position}`)}parseBinaryExpression(e){let t=this.parsePrimary();for(;;){let n=this.peek();if(n?.kind!==`operator`)return t;let r=getOperatorPrecedence(n.value);if(r<e)return t;let i=n.value;this.consume();let a=this.parseBinaryExpression(r+1);t={kind:`binary`,operator:i,left:t,right:a}}}parsePrimary(){let e=this.consume();if(e===void 0)throw new ComputedFormulaParseError(`Unexpected end of expression`);switch(e.kind){case`string`:case`number`:case`boolean`:return{kind:`literal`,value:e.value};case`null`:return{kind:`literal`,value:null};case`identifier`:return this.parseIdentifier(e.value);case`punctuation`:if(e.value===`(`){let e=this.parseExpression();return this.expectPunctuation(`)`),e}break;case`operator`:if(e.value===`-`){let e=this.consume();if(e?.kind===`number`)return{kind:`literal`,value:-e.value}}}throw new ComputedFormulaParseError(`Expected literal, path, call, or parenthesized expression at position ${e.position}`)}parseIdentifier(e){if(this.matchPunctuation(`(`)){let t=[];if(!this.matchPunctuation(`)`)){do t.push(this.parseExpression());while(this.matchPunctuation(`,`));this.expectPunctuation(`)`)}return{kind:`call`,functionName:e.toLowerCase(),args:t}}let t=[e];for(;this.matchPunctuation(`.`);){let e=this.consume();if(e?.kind!==`identifier`)throw new ComputedFormulaParseError(`Expected attribute name after path separator at position ${e?.position??this.previousPosition()}`);t.push(e.value)}return{kind:`path`,parts:t}}expectPunctuation(e){if(!this.matchPunctuation(e))throw new ComputedFormulaParseError(`Expected "${e}" at position ${this.peek()?.position??this.previousPosition()}`)}matchPunctuation(e){let t=this.peek();return t?.kind===`punctuation`&&t.value===e&&(this.consume(),!0)}peek(){return this.tokens[this.position]}consume(){let e=this.tokens[this.position];return this.position+=1,e}previousPosition(){return this.tokens[this.position-1]?.position??0}};function describeToken(e){switch(e.kind){case`identifier`:case`number`:case`string`:case`boolean`:case`operator`:case`punctuation`:return`"${String(e.value)}"`;case`null`:return`"null"`;default:return e}}function getOperatorPrecedence(e){switch(e){case`*`:case`/`:return 3;case`+`:case`-`:return 2;case`>`:case`<`:case`>=`:case`<=`:case`==`:case`!=`:return 1;default:return e}}const y=o.object({placeholder:o.string().optional(),description:o.string().optional(),defaultValue:o.unknown().optional(),icon:o.string().optional(),order:o.number().int().optional(),hidden:o.boolean().optional(),archived:o.boolean().optional(),deprecated:o.boolean().optional(),metadata:o.record(o.string(),o.unknown()).optional()}),b=[`placeholder`,`description`,`defaultValue`,`icon`,`order`,`hidden`,`archived`,`deprecated`,`metadata`];function refuseForeignKeys(e,t,n=[]){let r=new Set(n);return function refuse(n,i,a,o=[]){let s=e[n];if(s!==void 0&&i!==void 0)for(let e of Object.keys(i))s.has(e)||r.has(e)||a.addIssue({code:`custom`,path:[...o,e],message:`"${e}" is not a ${n} ${t}; keys of ${n}: ${[...s].join(`, `)}`})}}const x=o.object({value:o.string().min(1).describe(`Stored value`),label:o.string().min(1).describe(`Label people see`),description:o.string().describe(`Extra context`).optional(),inverse:o.string().describe(`Paired option's value (symmetric)`).optional(),archived:o.boolean().describe(`Hides without deleting`).optional()}),S=o.enum([`idle`,`in_progress`,`finished`]).describe(`Workflow stage`),C=x.extend({color:_}).strict(),w=C,T=x.extend({color:_,group:S}).strict(),E=x.extend({color:o.string().optional().describe(`A color id`),group:S.optional()}).strict(),D=o.array(E).min(1).refine(e=>{let t=e.map(e=>e.value);return new Set(t).size===t.length},{message:`Duplicate option values are not allowed`});function writeOptionsArraySchema(e){return o.array(e).min(1).max(m.optionsPerAttribute).refine(e=>{let t=e.map(e=>e.value);return new Set(t).size===t.length},{message:`Duplicate option values are not allowed`})}const O=writeOptionsArraySchema(C),k=writeOptionsArraySchema(w),A=writeOptionsArraySchema(T),ie=o.object({object:o.string().min(1).describe(`Target object`),displayTemplate:o.string().optional().describe(`Linked record label template`),filter:o.record(o.string(),o.unknown()).optional().describe(`Restricts linkable records`)}),ae=o.object({object:o.string().min(1).describe(`Other side's object`),attribute:o.string().min(1).describe(`Other side's attribute`),cardinality:o.enum([`one`,`many`]).optional().describe(`Other side's cardinality`),label:o.string().min(1).optional().describe(`Other side's label`),storageOwner:o.boolean().optional().describe(`Owns the join storage`)}),j=o.object({objectName:o.string().min(1).describe(`API name of the object whose options are mirrored`),attributeName:o.string().min(1).describe(`API name of the select/status attribute to mirror options from`),attributeId:o.string().optional().describe(`Id of the source attribute, resolved by the server`)}),M=y.extend({multiline:o.boolean().describe(`Renders as a multi-line textarea`).optional(),minLength:o.number().int().min(0).describe(`Minimum character count`).optional(),maxLength:o.number().int().min(1).describe(`Maximum character count`).optional(),pattern:o.string().describe(`Regular expression the value must match`).optional(),format:o.enum([`email`,`url`,`slug`]).describe(`Validates and renders as this format`).optional()}),oe=y,N=y.extend({renderAs:o.enum([`number`,`rating`]).describe(`Plain number or a star rating`).optional(),min:o.number().describe(`Minimum allowed value`).optional(),max:o.number().describe(`Maximum allowed value`).optional(),unit:o.enum([`integer`,`decimal`,`percentage`]).describe(`How the value is stored and rendered`).optional(),decimals:o.number().int().min(0).max(10).describe(`Decimal places shown`).optional()}),P=y,F=y.extend({dateFormat:o.enum([`short`,`long`,`full`,`relative`]).describe(`How the date is rendered`).optional(),minDate:o.string().describe(`Earliest allowed date (ISO)`).optional(),maxDate:o.string().describe(`Latest allowed date (ISO)`).optional(),includeTime:o.boolean().describe(`Also captures a time of day`).optional(),endDate:o.boolean().describe(`Paired with another date attribute as a range's end`).optional(),timeFormat:o.enum([`12h`,`24h`]).describe(`Clock format when a time is included`).optional()}),I=y.extend({defaultCountryCode:o.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),L=y.extend({defaultCurrency:o.string().length(3).describe(`ISO currency code preselected for new values`).optional(),allowedCurrencies:o.array(o.string().length(3)).describe(`ISO currency codes a value may use; any currency when omitted`).optional(),allowNegative:o.boolean().describe(`Whether a negative amount is accepted`).optional()}),R=y.extend({options:D.describe(`The workflow statuses, in order`)}),z=y.extend({granularity:o.enum([`full`,`address`,`city`,`state`,`country`,`coordinates`]).describe(`How precise a location must be captured`).optional(),defaultCountry:o.string().length(3).describe(`ISO country code preselected for new values`).optional(),allowedCountries:o.array(o.string().length(3)).describe(`ISO country codes a value may use; any country when omitted`).optional()}),B=y.extend({options:D.describe(`Options`),renderAs:o.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),V=y.extend({options:D.describe(`Options`),renderAs:o.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),H=y.extend({types:o.array(o.enum([`user`,`agent`])).min(1).optional().describe(`Which kinds of actor can be picked; both when omitted`),multiple:o.boolean().optional().describe(`Whether more than one actor can be picked`)}),U={name:p.describe(`Property API name`),label:o.string().min(1).describe(`Label people see`),required:o.boolean().describe(`Required on every edge`).optional()},W={id:o.string().optional(),objectId:o.string().optional(),system:o.boolean().optional(),unique:o.boolean().optional()},G=Object.fromEntries(b.map(e=>[e,!0])),K=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],q=[...K,`select`,`multiselect`,`status`],J={text:M,number:N,checkbox:P,date:F,phone:I,currency:L,location:z,select:B,multiselect:V,status:R},se={...J,select:B.extend({options:O.describe(`Options`)}),multiselect:V.extend({options:k.describe(`Options`)}),status:R.extend({options:A.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>se[e].omit(G).shape,storedPropertyMember=e=>o.object({...U,...W,type:o.literal(e).describe(`Property type`),...J[e].shape}).strip(),Y=o.discriminatedUnion(`type`,q.map(storedPropertyMember)),X=o.object({definitions:o.array(Y).min(1).max(m.optionsPerAttribute).describe(`Edge properties`)}).strip().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),ce=refuseForeignKeys(Object.fromEntries(q.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(U),`type`]);function refuseForeignPropertyKeys(e,t){ce(e.type,e,t)}const Z=K.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>o.object({...U,type:e.length===1?o.literal(e[0]).describe(`Property type`):o.enum(e).describe(`Property type`),...propertyWireConfigShapeFor(e[0])}).strict(),Q=o.discriminatedUnion(`type`,[optionPropertyWireMember([`select`,`multiselect`]),optionPropertyWireMember([`status`]),o.object({...U,type:o.enum(K).describe(`Property type`),...Z}).strict().superRefine(refuseForeignPropertyKeys)]),le=o.object({definitions:o.array(Q).min(1).max(m.optionsPerAttribute).describe(`Edge properties`)}).strict().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),$={text:M,richtext:oe,number:N,checkbox:P,date:F,phone:I,currency:L,status:R,location:z,select:B,multiselect:V,user:H,relation:y.extend({targets:o.array(ie).min(1).describe(`Target object(s)`),cardinality:o.enum([`one`,`many`]).describe(`one or many`),maxItems:o.number().int().min(1).optional().describe(`Max linked records`),bilateral:ae.optional().describe(`Syncs the other side's attribute`),properties:X.optional()}),formula:y.extend({expression:o.string().min(1).superRefine((e,t)=>{try{parseComputedFormula(e)}catch(e){t.addIssue({code:o.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid formula expression`})}}).describe(`The formula expression, compiled against this object's attributes`),returnType:o.enum([`text`,`number`,`boolean`,`date`,`select`,`multiselect`]).describe(`The formula's result type`),decimals:o.number().int().min(0).max(10).optional().describe(`Decimal places shown for a number result`),allowRelations:o.boolean().optional().describe(`Whether the expression may read across a relation`),optionsSource:j.optional().describe(`Mirrors an option set`)}),rollup:y.extend({relationAttribute:o.string().min(1).optional().describe(`API name of the relation this rollup aggregates through`),relationPath:o.string().optional().describe(`Not supported yet — single-hop only`),targetAttribute:o.string().min(1).describe(`API name of the attribute aggregated on the relation's target object`),function:o.enum([`sum`,`avg`,`earliest`,`latest`,`count`,`countValues`,`countUniqueValues`,`countEmpty`,`percentEmpty`,`percentNotEmpty`,`original`]).describe(`The aggregation applied across the linked records`),decimals:o.number().int().min(0).max(10).optional().describe(`Decimal places shown for a numeric result`),targetAttributeType:o.string().optional().describe(`Server-set`),targetAttributeOptions:o.array(E).optional().describe(`Server-set`),targetCurrencyCode:o.string().length(3).optional().describe(`Server-set`),optionsSource:j.optional().describe(`Mirrors an option set`)}),document:y.extend({properties:X.optional(),accepts:o.array(o.string().min(1)).optional().describe("MIME prefixes or globs a file must match (e.g. `image/*`, `*.pdf`)"),maxFileSize:o.number().int().min(1).optional().describe(`Maximum file size in bytes`)})};function getAttributeConfigSchema(e){let t=$[e];if(!t)throw new n(`Unsupported attribute type: ${e}`,[]);return t}function parseAttributeConfig(e,t){return getAttributeConfigSchema(e).strip().parse(t)}function getAttributeConfigWriteSchema(e){let t=getAttributeConfigSchema(e).extend({icon:v.optional()});switch(e){case`select`:return t.extend({options:O.describe(`Options`)});case`multiselect`:return t.extend({options:k.describe(`Options`)});case`status`:return t.extend({options:A.describe(`Statuses`)});default:return t}}function validationErrorFromIssues(e){return n.fromZodErrors(e.map(e=>({path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message})))}function parseWriteSchema(e,t){let n=getAttributeConfigWriteSchema(e).strip().safeParse(t);if(!n.success)throw validationErrorFromIssues(n.error.issues);return n.data}function parseAttributeConfigForCreate(e,t){return parseWriteSchema(e,t)}function validatePatchedIcon(e){if(!Object.prototype.hasOwnProperty.call(e,`icon`))return;let t=v.optional().safeParse(e.icon);if(!t.success)throw n.fromZodErrors(t.error.issues.map(e=>({path:[`icon`,...e.path.map(e=>typeof e==`symbol`?String(e):e)],message:e.message})))}function isSelectLike(e){return e===`select`||e===`multiselect`||e===`status`}function parseAttributeConfigForUpdate(e,t){let n=Object.prototype.hasOwnProperty.call(t,`options`),r=Object.prototype.hasOwnProperty.call(t,`icon`),i={...e,...t};if(validatePatchedIcon(t),n){let{icon:t,...n}=i,a=parseWriteSchema(e.type,r?i:n);return!r&&t!==void 0&&(a.icon=t),a}let a=e.options;isSelectLike(e.type)&&(i.options=[{value:`__legacy__`,label:`__legacy__`}]);let o=getAttributeConfigSchema(e.type).strip().safeParse(i);if(!o.success)throw validationErrorFromIssues(o.error.issues);let s=o.data;return isSelectLike(e.type)&&(s.options=a),s}export{validateOptions as A,p as C,validateIconName as D,validateAttributeName as E,c as F,l as I,parseResourceVisibility as L,ee as M,u as N,validateLabel as O,te as P,s as R,m as S,assertUniqueBy as T,T as _,getAttributeConfigWriteSchema as a,_ as b,parseAttributeConfigForCreate as c,Q as d,X as f,S as g,C as h,getAttributeConfigSchema as i,validateViewName as j,validateObjectName as k,parseAttributeConfigForUpdate as l,refuseForeignKeys as m,b as n,w as o,le as p,$ as r,parseAttributeConfig as s,K as t,Y as u,ComputedFormulaParseError as v,f as w,v as x,parseComputedFormula as y,isNativeObjectName as z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
const e={required:e=>`${e.label} is required`,invalidType:(e,t)=>`${e.label} must be a ${t}`,minLength:(e,t)=>`${e.label} must be at least ${t} characters`,maxLength:(e,t)=>`${e.label} must be at most ${t} characters`,invalidPattern:e=>`${e.label} format is invalid`,minValue:(e,t)=>`${e.label} must be at least ${t}`,maxValue:(e,t)=>`${e.label} must be at most ${t}`,mustBeInteger:e=>`${e.label} must be an integer`,invalidDate:e=>`${e.label} must be a valid date`,invalidOption:(e,t)=>`${e.label} must be one of: ${t.join(`, `)}`,invalidId:e=>`${e.label} must be a valid ID`,maxItems:(e,t)=>`${e.label} must have at most ${t} item${t>1?`s`:``}`,invalidRichtext:e=>`${e.label} must be valid rich text content`,invalidPhone:e=>`${e.label} must be a valid phone number`,invalidCurrency:e=>`${e.label} must be a valid currency value`,invalidLocation:e=>`${e.label} must be a valid location`};function formatZodErrors(e){return e.issues.map(e=>({path:e.path.map(String),message:e.message}))}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return formatZodErrors}});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
const e={required:e=>`${e.label} is required`,invalidType:(e,t)=>`${e.label} must be a ${t}`,minLength:(e,t)=>`${e.label} must be at least ${t} characters`,maxLength:(e,t)=>`${e.label} must be at most ${t} characters`,invalidPattern:e=>`${e.label} format is invalid`,minValue:(e,t)=>`${e.label} must be at least ${t}`,maxValue:(e,t)=>`${e.label} must be at most ${t}`,mustBeInteger:e=>`${e.label} must be an integer`,invalidDate:e=>`${e.label} must be a valid date`,invalidOption:(e,t)=>`${e.label} must be one of: ${t.join(`, `)}`,invalidId:e=>`${e.label} must be a valid ID`,maxItems:(e,t)=>`${e.label} must have at most ${t} item${t>1?`s`:``}`,invalidRichtext:e=>`${e.label} must be valid rich text content`,invalidPhone:e=>`${e.label} must be a valid phone number`,invalidCurrency:e=>`${e.label} must be a valid currency value`,invalidLocation:e=>`${e.label} must be a valid location`};function formatZodErrors(e){return e.issues.map(e=>({path:e.path.map(String),message:e.message}))}export{e as n,formatZodErrors as t};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { rt as DateAttribute } from "./exceptions-DGCzCc9t.mjs";
|
|
3
|
+
import { r as ValidationMessages } from "./index-XtmC-C7J.mjs";
|
|
4
|
+
import { z as z$1 } from "zod";
|
|
5
|
+
//#region src/validation/primitives/date.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create a Zod schema for a date attribute.
|
|
8
|
+
*
|
|
9
|
+
* Non-range attributes validate a single coercible date bounded by
|
|
10
|
+
* `minDate`/`maxDate`. Range attributes (`.endDate()`) validate a
|
|
11
|
+
* `{ start, end }` object — `end` may be null, and when present must be
|
|
12
|
+
* on or after `start`. Plain strings normalize to `{ start, end: null }`
|
|
13
|
+
* (mirroring `normalizeDateValue`) so legacy values written before
|
|
14
|
+
* `endDate` was enabled keep validating.
|
|
15
|
+
*
|
|
16
|
+
* Coercion to `Date` only backs correctness/bounds checks against a
|
|
17
|
+
* throwaway copy — the schema never mutates the value itself, so
|
|
18
|
+
* `result.data` is always the original input (ISO string, or `{ start, end }`
|
|
19
|
+
* of ISO strings), never a coerced `Date`. This keeps the stored shape intact
|
|
20
|
+
* for callers that persist `validator.safeParse(value).data`.
|
|
21
|
+
*/
|
|
22
|
+
declare function createDateValidator(attr: DateAttribute, messages?: ValidationMessages): z$1.ZodTypeAny;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createDateValidator as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { rt as DateAttribute } from "./exceptions-DGCzCc9t.js";
|
|
3
|
+
import { r as ValidationMessages } from "./index-B7HmBsUS.js";
|
|
4
|
+
import { z as z$1 } from "zod";
|
|
5
|
+
//#region src/validation/primitives/date.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create a Zod schema for a date attribute.
|
|
8
|
+
*
|
|
9
|
+
* Non-range attributes validate a single coercible date bounded by
|
|
10
|
+
* `minDate`/`maxDate`. Range attributes (`.endDate()`) validate a
|
|
11
|
+
* `{ start, end }` object — `end` may be null, and when present must be
|
|
12
|
+
* on or after `start`. Plain strings normalize to `{ start, end: null }`
|
|
13
|
+
* (mirroring `normalizeDateValue`) so legacy values written before
|
|
14
|
+
* `endDate` was enabled keep validating.
|
|
15
|
+
*
|
|
16
|
+
* Coercion to `Date` only backs correctness/bounds checks against a
|
|
17
|
+
* throwaway copy — the schema never mutates the value itself, so
|
|
18
|
+
* `result.data` is always the original input (ISO string, or `{ start, end }`
|
|
19
|
+
* of ISO strings), never a coerced `Date`. This keeps the stored shape intact
|
|
20
|
+
* for callers that persist `validator.safeParse(value).data`.
|
|
21
|
+
*/
|
|
22
|
+
declare function createDateValidator(attr: DateAttribute, messages?: ValidationMessages): z$1.ZodTypeAny;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createDateValidator as t };
|