@stndrds/schema 1.0.0-alpha.333 → 1.0.0-alpha.335

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.
@@ -345,6 +345,7 @@ declare const SCHEMA_LIMITS: {
345
345
  readonly historyMax: 50;
346
346
  readonly iconQueries: 5;
347
347
  readonly iconResults: 20;
348
+ readonly labelLength: 128;
348
349
  };
349
350
  //#endregion
350
351
  //#region src/validation/primitives.d.ts
@@ -345,6 +345,7 @@ declare const SCHEMA_LIMITS: {
345
345
  readonly historyMax: 50;
346
346
  readonly iconQueries: 5;
347
347
  readonly iconResults: 20;
348
+ readonly labelLength: 128;
348
349
  };
349
350
  //#endregion
350
351
  //#region src/validation/primitives.d.ts
@@ -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
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},__toESM=(n,r,o)=>(o=n==null?{}:e(i(n)),__copyProps(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));const o=require("./exceptions.js");let s=require("@stndrds/constants"),c=require("zod");c=__toESM(c);const l=[`skill`,`memory`,`drives`,`artifact`,`meeting`];function isNativeObjectName(e){return l.includes(e)}const u=[`workspace`,`private`],d=[`all`,...u];function parseResourceVisibility(e){if(typeof e==`string`&&u.includes(e))return e;throw new o.ValidationError(`visibility must be one of: ${u.join(`, `)} (received: ${String(e)})`,[])}const f=[`id`,`createdAt`,`updatedAt`,`createdBy`,`lastUpdatedBy`,`visibility`,`ownedBy`],p=[...f,`objectId`,`label`,`embeddingText`,`values`,`metadata`,`deletedAt`,`deletedBy`,`schemaVersion`,`owned_by`],m=l,h={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,labelLength:128},ee=Object.keys(s.COLORS),te=new Set(s.ICONS),g=c.z.enum(ee).describe(`A color id from the palette`),_=c.z.string().superRefine((e,t)=>{te.has(e)||t.addIssue({code:`custom`,message:`Invalid icon name`})}).transform(e=>e),ne=new Set(s.ICONS),v=/^[a-zA-Z_][a-zA-Z0-9_]*$/,re=/^[a-z][a-z0-9-]*$/,y=h.labelLength,b=c.default.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(e){try{b.parse(e)}catch(e){throw e instanceof c.default.ZodError?new o.SchemaError(e.issues[0].message,o.SchemaErrorCode.INVALID_OBJECT_NAME):e}}function validateViewName(e){if(!e||e.length===0)throw new o.ValidationError(`View name cannot be empty`,[{path:[`name`],message:`View name cannot be empty`}]);if(e.length>63)throw new o.ValidationError(`View name is too long`,[{path:[`name`],message:`View name is too long (max 63 characters)`}]);if(!re.test(e))throw new o.ValidationError(`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 x=c.default.string().min(1,`Attribute name cannot be empty`).max(63,`Attribute name is too long (max 63 characters)`).regex(v,{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=>!p.includes(e),{message:`This is a reserved attribute name. Reserved names: ${p.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(!v.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(p.includes(e))throw Error(`[AttributeBuilder] "${e}" is a reserved name and cannot be used as an attribute name.\nReserved names: ${p.join(`, `)}`)}function validateLabel(e){if(!e||e.length===0)throw Error(`[AttributeBuilder] Attribute label cannot be empty`);if(e.length>y)throw Error(`[AttributeBuilder] Attribute label is too long (max ${y} 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.`)}}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 S=c.z.object({placeholder:c.z.string().optional(),description:c.z.string().optional(),defaultValue:c.z.unknown().optional(),icon:c.z.string().optional(),order:c.z.number().int().optional(),hidden:c.z.boolean().optional(),archived:c.z.boolean().optional(),deprecated:c.z.boolean().optional(),metadata:c.z.record(c.z.string(),c.z.unknown()).optional()}),C=[`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 w=c.z.object({value:c.z.string().min(1).describe(`Stored value`),label:c.z.string().min(1).describe(`Label people see`),description:c.z.string().describe(`Extra context`).optional(),inverse:c.z.string().describe(`Paired option's value (symmetric)`).optional(),archived:c.z.boolean().describe(`Hides without deleting`).optional()}),T=c.z.enum([`idle`,`in_progress`,`finished`]).describe(`Workflow stage`),E=w.extend({color:g}).strict(),D=E,O=w.extend({color:g,group:T}).strict(),k=w.extend({color:c.z.string().optional().describe(`A color id`),group:T.optional()}).strict(),A=c.z.array(k).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 c.z.array(e).min(1).max(h.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 j=writeOptionsArraySchema(E),M=writeOptionsArraySchema(D),N=writeOptionsArraySchema(O),ie=c.z.object({object:c.z.string().min(1).describe(`Target object`),displayTemplate:c.z.string().optional().describe(`Linked record label template`),filter:c.z.record(c.z.string(),c.z.unknown()).optional().describe(`Restricts linkable records`)}),ae=c.z.object({object:c.z.string().min(1).describe(`Other side's object`),attribute:c.z.string().min(1).describe(`Other side's attribute`),cardinality:c.z.enum([`one`,`many`]).optional().describe(`Other side's cardinality`),label:c.z.string().min(1).optional().describe(`Other side's label`),storageOwner:c.z.boolean().optional().describe(`Owns the join storage`)}),P=c.z.object({objectName:c.z.string().min(1).describe(`API name of the object whose options are mirrored`),attributeName:c.z.string().min(1).describe(`API name of the select/status attribute to mirror options from`),attributeId:c.z.string().optional().describe(`Id of the source attribute, resolved by the server`)}),F=S.extend({multiline:c.z.boolean().describe(`Renders as a multi-line textarea`).optional(),minLength:c.z.number().int().min(0).describe(`Minimum character count`).optional(),maxLength:c.z.number().int().min(1).describe(`Maximum character count`).optional(),pattern:c.z.string().describe(`Regular expression the value must match`).optional(),format:c.z.enum([`email`,`url`,`slug`]).describe(`Validates and renders as this format`).optional()}),oe=S,I=S.extend({renderAs:c.z.enum([`number`,`rating`]).describe(`Plain number or a star rating`).optional(),min:c.z.number().describe(`Minimum allowed value`).optional(),max:c.z.number().describe(`Maximum allowed value`).optional(),unit:c.z.enum([`integer`,`decimal`,`percentage`]).describe(`How the value is stored and rendered`).optional(),decimals:c.z.number().int().min(0).max(10).describe(`Decimal places shown`).optional()}),L=S,R=S.extend({dateFormat:c.z.enum([`short`,`long`,`full`,`relative`]).describe(`How the date is rendered`).optional(),minDate:c.z.string().describe(`Earliest allowed date (ISO)`).optional(),maxDate:c.z.string().describe(`Latest allowed date (ISO)`).optional(),includeTime:c.z.boolean().describe(`Also captures a time of day`).optional(),endDate:c.z.boolean().describe(`Paired with another date attribute as a range's end`).optional(),timeFormat:c.z.enum([`12h`,`24h`]).describe(`Clock format when a time is included`).optional()}),z=S.extend({defaultCountryCode:c.z.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),B=S.extend({defaultCurrency:c.z.string().length(3).describe(`ISO currency code preselected for new values`).optional(),allowedCurrencies:c.z.array(c.z.string().length(3)).describe(`ISO currency codes a value may use; any currency when omitted`).optional(),allowNegative:c.z.boolean().describe(`Whether a negative amount is accepted`).optional()}),V=S.extend({options:A.describe(`The workflow statuses, in order`)}),H=S.extend({granularity:c.z.enum([`full`,`address`,`city`,`state`,`country`,`coordinates`]).describe(`How precise a location must be captured`).optional(),defaultCountry:c.z.string().length(3).describe(`ISO country code preselected for new values`).optional(),allowedCountries:c.z.array(c.z.string().length(3)).describe(`ISO country codes a value may use; any country when omitted`).optional()}),U=S.extend({options:A.describe(`Options`),renderAs:c.z.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),W=S.extend({options:A.describe(`Options`),renderAs:c.z.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),se=S.extend({types:c.z.array(c.z.enum([`user`,`agent`])).min(1).optional().describe(`Which kinds of actor can be picked; both when omitted`),multiple:c.z.boolean().optional().describe(`Whether more than one actor can be picked`)}),G={name:x.describe(`Property API name`),label:c.z.string().min(1).describe(`Label people see`),required:c.z.boolean().describe(`Required on every edge`).optional()},ce={id:c.z.string().optional(),objectId:c.z.string().optional(),system:c.z.boolean().optional(),unique:c.z.boolean().optional()},le=Object.fromEntries(C.map(e=>[e,!0])),K=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],q=[...K,`select`,`multiselect`,`status`],J={text:F,number:I,checkbox:L,date:R,phone:z,currency:B,location:H,select:U,multiselect:W,status:V},ue={...J,select:U.extend({options:j.describe(`Options`)}),multiselect:W.extend({options:M.describe(`Options`)}),status:V.extend({options:N.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>ue[e].omit(le).shape,storedPropertyMember=e=>c.z.object({...G,...ce,type:c.z.literal(e).describe(`Property type`),...J[e].shape}).strip(),Y=c.z.discriminatedUnion(`type`,q.map(storedPropertyMember)),X=c.z.object({definitions:c.z.array(Y).min(1).max(h.optionsPerAttribute).describe(`Edge properties`)}).strip().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),de=refuseForeignKeys(Object.fromEntries(q.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(G),`type`]);function refuseForeignPropertyKeys(e,t){de(e.type,e,t)}const Z=K.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>c.z.object({...G,type:e.length===1?c.z.literal(e[0]).describe(`Property type`):c.z.enum(e).describe(`Property type`),...propertyWireConfigShapeFor(e[0])}).strict(),Q=c.z.discriminatedUnion(`type`,[optionPropertyWireMember([`select`,`multiselect`]),optionPropertyWireMember([`status`]),c.z.object({...G,type:c.z.enum(K).describe(`Property type`),...Z}).strict().superRefine(refuseForeignPropertyKeys)]),fe=c.z.object({definitions:c.z.array(Q).min(1).max(h.optionsPerAttribute).describe(`Edge properties`)}).strict().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),pe=S.extend({targets:c.z.array(ie).min(1).describe(`Target object(s)`),cardinality:c.z.enum([`one`,`many`]).describe(`one or many`),maxItems:c.z.number().int().min(1).optional().describe(`Max linked records`),bilateral:ae.optional().describe(`Syncs the other side's attribute`),properties:X.optional()}),me=S.extend({expression:c.z.string().min(1).superRefine((e,t)=>{try{parseComputedFormula(e)}catch(e){t.addIssue({code:c.z.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid formula expression`})}}).describe(`The formula expression, compiled against this object's attributes`),returnType:c.z.enum([`text`,`number`,`boolean`,`date`,`select`,`multiselect`]).describe(`The formula's result type`),decimals:c.z.number().int().min(0).max(10).optional().describe(`Decimal places shown for a number result`),allowRelations:c.z.boolean().optional().describe(`Whether the expression may read across a relation`),optionsSource:P.optional().describe(`Mirrors an option set`)}),he=S.extend({relationAttribute:c.z.string().min(1).optional().describe(`API name of the relation this rollup aggregates through`),relationPath:c.z.string().optional().describe(`Not supported yet — single-hop only`),targetAttribute:c.z.string().min(1).optional().describe(`API name of the attribute aggregated on the relation's target object; not read by count`),function:c.z.enum([`sum`,`avg`,`earliest`,`latest`,`count`,`countValues`,`countUniqueValues`,`countEmpty`,`percentEmpty`,`percentNotEmpty`,`original`]).describe(`The aggregation applied across the linked records`),decimals:c.z.number().int().min(0).max(10).optional().describe(`Decimal places shown for a numeric result`),targetAttributeType:c.z.string().optional().describe(`Server-set`),targetAttributeOptions:c.z.array(k).optional().describe(`Server-set`),targetCurrencyCode:c.z.string().length(3).optional().describe(`Server-set`),optionsSource:P.optional().describe(`Mirrors an option set`)});function rollupTargetIssue(e,t){if(e===`rollup`&&t.function!==`count`&&t.targetAttribute===void 0)return{path:[`targetAttribute`],message:`targetAttribute is required for a "${String(t.function)}" rollup`}}const $={text:F,richtext:oe,number:I,checkbox:L,date:R,phone:z,currency:B,status:V,location:H,select:U,multiselect:W,user:se,relation:pe,formula:me,rollup:he,document:S.extend({properties:X.optional(),accepts:c.z.array(c.z.string().min(1)).optional().describe("MIME prefixes or globs a file must match (e.g. `image/*`, `*.pdf`)"),maxFileSize:c.z.number().int().min(1).optional().describe(`Maximum file size in bytes`)})};function getAttributeConfigSchema(e){let t=$[e];if(!t)throw new o.ValidationError(`Unsupported attribute type: ${e}`,[]);return t}function parseAttributeConfig(e,t){let n=getAttributeConfigSchema(e).strip().parse(t),r=rollupTargetIssue(e,n);if(r)throw validationErrorFromIssues([r]);return n}function getAttributeConfigWriteSchema(e){let t=getAttributeConfigSchema(e).extend({icon:_.optional()});switch(e){case`select`:return t.extend({options:j.describe(`Options`)});case`multiselect`:return t.extend({options:M.describe(`Options`)});case`status`:return t.extend({options:N.describe(`Statuses`)});default:return t}}function validationErrorFromIssues(e){return o.ValidationError.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);let r=rollupTargetIssue(e,n.data);if(r)throw validationErrorFromIssues([r]);return n.data}function parseAttributeConfigForCreate(e,t){return parseWriteSchema(e,t)}function validatePatchedIcon(e){if(!Object.prototype.hasOwnProperty.call(e,`icon`))return;let t=_.optional().safeParse(e.icon);if(!t.success)throw o.ValidationError.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}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return validateAttributeName}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return validateOptions}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return validateObjectName}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return parseResourceVisibility}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return validateViewName}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return assertUniqueBy}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return validateLabel}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return getAttributeConfigWriteSchema}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return parseAttributeConfigForCreate}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return getAttributeConfigSchema}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return parseAttributeConfigForUpdate}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return refuseForeignKeys}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return parseAttributeConfig}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ComputedFormulaParseError}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return validateIconName}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return parseComputedFormula}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return isNativeObjectName}});
@@ -1,13 +1,13 @@
1
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.
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`],d=s,f={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,labelLength:128},p=Object.keys(r),te=new Set(i),m=o.enum(p).describe(`A color id from the palette`),h=o.string().superRefine((e,t)=>{te.has(e)||t.addIssue({code:`custom`,message:`Invalid icon name`})}).transform(e=>e),ne=new Set(i),g=/^[a-zA-Z_][a-zA-Z0-9_]*$/,re=/^[a-z][a-z0-9-]*$/,_=f.labelLength,v=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
3
  Name must be in kebab-case (slug format):
4
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.
5
+ ❌ Invalid: 'Products', 'userProfiles', 'user_profiles'`});function validateObjectName(n){try{v.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 y=a.string().min(1,`Attribute name cannot be empty`).max(63,`Attribute name is too long (max 63 characters)`).regex(g,{message:`Invalid attribute name format.
6
6
  Name must be a valid variable identifier:
7
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.
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(!g.test(e))throw Error(`[AttributeBuilder] Invalid attribute name format.
9
9
  Name must be a valid variable identifier:
10
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===`
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>_)throw Error(`[AttributeBuilder] Attribute label is too long (max ${_} 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.`)}}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
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`),ue=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()}),de=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`)}),fe=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).optional().describe(`API name of the attribute aggregated on the relation's target object; not read by count`),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`)});function rollupTargetIssue(e,t){if(e===`rollup`&&t.function!==`count`&&t.targetAttribute===void 0)return{path:[`targetAttribute`],message:`targetAttribute is required for a "${String(t.function)}" rollup`}}const $={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:ue,formula:de,rollup:fe,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){let n=getAttributeConfigSchema(e).strip().parse(t),r=rollupTargetIssue(e,n);if(r)throw validationErrorFromIssues([r]);return n}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);let r=rollupTargetIssue(e,n.data);if(r)throw validationErrorFromIssues([r]);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};
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 b=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()}),x=[`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 S=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()}),C=o.enum([`idle`,`in_progress`,`finished`]).describe(`Workflow stage`),w=S.extend({color:m}).strict(),T=w,E=S.extend({color:m,group:C}).strict(),D=S.extend({color:o.string().optional().describe(`A color id`),group:C.optional()}).strict(),O=o.array(D).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(f.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 k=writeOptionsArraySchema(w),A=writeOptionsArraySchema(T),j=writeOptionsArraySchema(E),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`)}),M=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`)}),N=b.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=b,P=b.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()}),F=b,I=b.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()}),L=b.extend({defaultCountryCode:o.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),R=b.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()}),z=b.extend({options:O.describe(`The workflow statuses, in order`)}),B=b.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()}),V=b.extend({options:O.describe(`Options`),renderAs:o.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),H=b.extend({options:O.describe(`Options`),renderAs:o.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),U=b.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`)}),W={name:y.describe(`Property API name`),label:o.string().min(1).describe(`Label people see`),required:o.boolean().describe(`Required on every edge`).optional()},G={id:o.string().optional(),objectId:o.string().optional(),system:o.boolean().optional(),unique:o.boolean().optional()},K=Object.fromEntries(x.map(e=>[e,!0])),q=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],J=[...q,`select`,`multiselect`,`status`],Y={text:N,number:P,checkbox:F,date:I,phone:L,currency:R,location:B,select:V,multiselect:H,status:z},se={...Y,select:V.extend({options:k.describe(`Options`)}),multiselect:H.extend({options:A.describe(`Options`)}),status:z.extend({options:j.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>se[e].omit(K).shape,storedPropertyMember=e=>o.object({...W,...G,type:o.literal(e).describe(`Property type`),...Y[e].shape}).strip(),X=o.discriminatedUnion(`type`,J.map(storedPropertyMember)),Z=o.object({definitions:o.array(X).min(1).max(f.optionsPerAttribute).describe(`Edge properties`)}).strip().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),ce=refuseForeignKeys(Object.fromEntries(J.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(W),`type`]);function refuseForeignPropertyKeys(e,t){ce(e.type,e,t)}const le=q.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>o.object({...W,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({...W,type:o.enum(q).describe(`Property type`),...le}).strict().superRefine(refuseForeignPropertyKeys)]),ue=o.object({definitions:o.array(Q).min(1).max(f.optionsPerAttribute).describe(`Edge properties`)}).strict().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),de=b.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:Z.optional()}),fe=b.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:M.optional().describe(`Mirrors an option set`)}),pe=b.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).optional().describe(`API name of the attribute aggregated on the relation's target object; not read by count`),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(D).optional().describe(`Server-set`),targetCurrencyCode:o.string().length(3).optional().describe(`Server-set`),optionsSource:M.optional().describe(`Mirrors an option set`)});function rollupTargetIssue(e,t){if(e===`rollup`&&t.function!==`count`&&t.targetAttribute===void 0)return{path:[`targetAttribute`],message:`targetAttribute is required for a "${String(t.function)}" rollup`}}const $={text:N,richtext:oe,number:P,checkbox:F,date:I,phone:L,currency:R,status:z,location:B,select:V,multiselect:H,user:U,relation:de,formula:fe,rollup:pe,document:b.extend({properties:Z.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){let n=getAttributeConfigSchema(e).strip().parse(t),r=rollupTargetIssue(e,n);if(r)throw validationErrorFromIssues([r]);return n}function getAttributeConfigWriteSchema(e){let t=getAttributeConfigSchema(e).extend({icon:h.optional()});switch(e){case`select`:return t.extend({options:k.describe(`Options`)});case`multiselect`:return t.extend({options:A.describe(`Options`)});case`status`:return t.extend({options:j.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);let r=rollupTargetIssue(e,n.data);if(r)throw validationErrorFromIssues([r]);return n.data}function parseAttributeConfigForCreate(e,t){return parseWriteSchema(e,t)}function validatePatchedIcon(e){if(!Object.prototype.hasOwnProperty.call(e,`icon`))return;let t=h.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{h as A,validateAttributeName as C,validateOptions as D,validateObjectName as E,c as F,l as I,parseResourceVisibility as L,ee as M,u as N,validateViewName as O,d as P,s as R,assertUniqueBy as S,validateLabel as T,E as _,getAttributeConfigWriteSchema as a,y as b,parseAttributeConfigForCreate as c,Q as d,Z as f,C as g,w as h,getAttributeConfigSchema as i,f as j,m as k,parseAttributeConfigForUpdate as l,refuseForeignKeys as m,x as n,T as o,ue as p,$ as r,parseAttributeConfig as s,q as t,X as u,ComputedFormulaParseError as v,validateIconName as w,v as x,parseComputedFormula as y,isNativeObjectName as z};
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { $ as BilateralConfig, $t as indexBy, A as StorageError, An as ComputedDependency, At as StatusGroup, B as isObjectReferencedError, Bn as ComputedFormulaLiteralNode, Bt as OptionPropertyAttribute, C as RepositoryOperation, Cn as assertAcyclicComputedDependencies, Ct as RichTextAttribute, D as SchemaErrorCode, Dn as ComputedFunctionName, Dt as SelectAttribute, E as SchemaError, En as COMPUTED_FUNCTION_NAMES, Et as RollupFunction, F as SystemEntityImmutableError, Fn as ComputedValueType, Ft as inferInverseCardinality, G as BuiltInTransform, Gt as resolvePropertyDefinitions, H as isRecordReferencedError, Hn as ComputedFormulaPathNode, Ht as PropertySchema, I as ValidationError, In as ComputedFormulaAstNode, It as isAttributeSortable, J as ATTRIBUTE_TYPES, Jt as Uuid, K as MigrationDefinition, Kt as TenantId, L as ValidationErrorDetail, Ln as ComputedFormulaBinaryNode, Lt as isBilateralRelation, M as SyncCascadeError, Mn as ComputedOptionsSource, Mt as TimeFormat, N as SyncConflictError, Nn as ComputedPlan, Nt as UserAttribute, O as SchemaPlanNotFoundError, On as ComputedFunctionSignature, Ot as SingleRelationAttribute, P as SyncError, Pn as ComputedReturnType, Pt as UserReferenceType, Q as BaseAttribute, Qt as generateId, R as isAttributeInUseError, Rn as ComputedFormulaBinaryOperator, Rt as isUniversalRelation, S as RepositoryError, Sn as ComputedFormulaCompileError, St as RelationTarget, T as RoleNotFoundError, Tn as COMPUTED_FUNCTIONS, Tt as RollupAttribute, U as isSchemaError, Un as parseComputedFormula, Ut as PropertyType, V as isProtectedResourceError, Vn as ComputedFormulaParseError, Vt as PropertyAttribute, W as isValidationError, Wt as hasOptions, X as AttributeGroup, Xt as asUserId, Y as Attribute, Yt as asTenantId, Z as AttributeType, Zt as deepEqual, _ as ProtectedResourceError, _n as CompileComputedFormulaInput, _t as Option, a as ChangeTypeNotSupportedError, an as COMPUTED_FUNCTION_METADATA, at as DateRangeValue, b as RecordReference, bn as ComputedCompileSchema, bt as RELATION_TARGET_ANY, c as DuplicateError, cn as ComputedFormulaResult, ct as FormulaAttribute, d as MigrationTimeoutError, dn as evaluateComputedFormulaWithResult, dt as LocationAttribute, en as NonJsonValueError, et as CheckboxAttribute, f as NotFoundError, fn as formatComputedResult, ft as LocationGranularity, g as OrphanSystemAttributeError, gn as rollupToFormulaExpression, gt as NumberUnit, h as ObjectReferencedError, hn as inferRollupReturnType, ht as NumberAttribute, i as AttributeUsage, in as serializeStableJson, it as DateFormat, j as StorageOperation, jn as ComputedFieldKind, jt as TextAttribute, k as SearchBackendError, kn as isComputedFunctionName, kt as StatusAttribute, l as ForbiddenError, ln as evaluateComputedAst, lt as FormulaReturnType, m as ObjectNotFoundError, mn as compileRollupAttribute, mt as MultiselectAttribute, n as AttributeInUseError, nn as sameStableValue, nt as CurrencyAttribute, o as ConcurrentModificationError, on as ComputedFunctionCategory, ot as DateValue, p as NotImplementedError, pn as isPlainRecord, pt as MultiRelationAttribute, q as SchemaOperation, qt as UserId, r as AttributeNotFoundError, rn as serializeCanonicalJson, rt as DateAttribute, s as DestructiveSyncNotAllowedError, sn as ComputedFunctionMetadata, st as DocumentAttribute, t as AccessDeniedError, tn as canonicalStringify, tt as Currency, u as MemoryNotFoundError, un as evaluateComputedFormula, ut as Location, v as ProtectedRoleError, vn as ComputedCompileAttribute, vt as Phone, w as ReservedObjectNameError, wn as compileComputedFormula, wt as RichtextAttribute, x as RecordReferencedError, xn as ComputedDependencyGraphNode, xt as RelationAttribute, y as RecordNotFoundError, yn as ComputedCompileObject, yt as PhoneAttribute, z as isNotFoundError, zn as ComputedFormulaCallNode, zt as relationTargetsOf } from "./exceptions-DG_iMvYs.mjs";
3
- import { $ as QueryState, A as FormContentDefinition, B as DayMonthValue, C as ContentOpenMode, D as CustomContentDefinition, E as ContentViewDefinition, F as MeetingsContentDefinition, G as FilterOperator, H as EdgeQuantifier, I as RichtextContentDefinition, J as FilterValue, K as FilterRule, L as ViewContentDefinition, M as FormsContentDefinition, N as KanbanCollectionContentDefinition, O as DocumentsContentDefinition, P as ListViewLayout, Q as PhoneFilterValue, R as ViewRead, S as ContentFieldGroup, T as ContentViewContext, U as ExtendedFilterRule, V as DynamicValue, W as FilterCombinator, X as NoValueOperator, Y as NO_VALUE_OPERATORS, Z as OPERATORS_BY_TYPE, _ as CollectionContentDefinition, a as contentViewDefinitionSchemaFor, at as isNoValueOperator, b as ContentCreateMode, c as draftContentViewDefinitionSchemaFor, d as sortsSchema, et as RelativeDateValue, f as colorIdSchema, g as CollectionAction, h as ActivityContentDefinition, i as contentViewDefinitionSchema, it as getRollupFilterOperators, j as FormDensity, k as EmailsContentDefinition, l as filterStateSchema, m as SCHEMA_LIMITS, n as collectionContentSourceSchema, nt as SortRule, o as displayAttributesSchema, p as iconNameSchema, q as FilterState, r as columnsSchema, rt as filterOperatorsByTypeForGeneration, s as draftContentViewDefinitionSchema, t as AsideRule, tt as SortDirection, u as publishedViewContentDefinitionSchema, v as CollectionContentSource, w as ContentPlacement, x as ContentField, y as ColumnReference, z as CurrencyFilterValue } from "./all-BLytyk5I.mjs";
3
+ import { $ as QueryState, A as FormContentDefinition, B as DayMonthValue, C as ContentOpenMode, D as CustomContentDefinition, E as ContentViewDefinition, F as MeetingsContentDefinition, G as FilterOperator, H as EdgeQuantifier, I as RichtextContentDefinition, J as FilterValue, K as FilterRule, L as ViewContentDefinition, M as FormsContentDefinition, N as KanbanCollectionContentDefinition, O as DocumentsContentDefinition, P as ListViewLayout, Q as PhoneFilterValue, R as ViewRead, S as ContentFieldGroup, T as ContentViewContext, U as ExtendedFilterRule, V as DynamicValue, W as FilterCombinator, X as NoValueOperator, Y as NO_VALUE_OPERATORS, Z as OPERATORS_BY_TYPE, _ as CollectionContentDefinition, a as contentViewDefinitionSchemaFor, at as isNoValueOperator, b as ContentCreateMode, c as draftContentViewDefinitionSchemaFor, d as sortsSchema, et as RelativeDateValue, f as colorIdSchema, g as CollectionAction, h as ActivityContentDefinition, i as contentViewDefinitionSchema, it as getRollupFilterOperators, j as FormDensity, k as EmailsContentDefinition, l as filterStateSchema, m as SCHEMA_LIMITS, n as collectionContentSourceSchema, nt as SortRule, o as displayAttributesSchema, p as iconNameSchema, q as FilterState, r as columnsSchema, rt as filterOperatorsByTypeForGeneration, s as draftContentViewDefinitionSchema, t as AsideRule, tt as SortDirection, u as publishedViewContentDefinitionSchema, v as CollectionContentSource, w as ContentPlacement, x as ContentField, y as ColumnReference, z as CurrencyFilterValue } from "./all-hyIoY9Y2.mjs";
4
4
  import { A as FolderPreset, C as ResourceVisibility, D as parseResourceVisibility, E as Timestamps, M as PresetNode, O as DocumentLayout, S as ReservedObjectName, T as SystemFieldName, _ as ObjectRecord, a as validateDraft, b as RESOURCE_VISIBILITIES, c as validateObjectOrThrow, f as createFormAttributeValidator, g as ObjectDefinition, h as ObjectAttribute, j as MAX_PRESET_DEPTH, k as DocumentLayoutVariant, m as ListViewTabVisibility, o as validateDraftOrThrow, p as LIST_VIEW_TAB_VISIBILITIES, r as rejectUnknownAttributesOrThrow, s as validateObject, v as RESERVED_ATTRIBUTE_NAMES, w as SYSTEM_FIELD_NAMES, x as ReservedAttributeName, y as RESERVED_OBJECT_NAMES } from "./index--ukNqScY.mjs";
5
5
  import { S as UpdateObjectInput, _ as statusOptionWriteSchema, b as RelationOption, c as parseAttributeConfigForCreate, d as propertyAttributeWireSchema, f as propertySchemaSchema, g as statusGroupSchema, h as selectOptionWriteSchema, l as parseAttributeConfigForUpdate, m as refuseForeignKeys, n as WIRE_OMITTED_CONFIG_KEYS, o as multiselectOptionWriteSchema, p as propertySchemaWireSchema, r as attributeConfigSchemas, s as parseAttributeConfig, t as SIMPLE_PROPERTY_TYPES, u as propertyAttributeSchema, v as AddAttributeInput, x as RelationOptionsResponse, y as CreateCustomObjectInput } from "./index-gM_g_Y_H.mjs";
6
6
  import { n as DEFAULT_VALIDATION_MESSAGES, r as ValidationMessages, t as formatZodErrors } from "./index-CK7gaSRm.mjs";
@@ -1083,12 +1083,12 @@ export declare const PRESENTATION_PROPERTIES: readonly ["label", "description",
1083
1083
  /**
1084
1084
  * Type of resource that can be audited
1085
1085
  */
1086
- export declare const AUDIT_RESOURCE_TYPES: readonly ["record", "object", "attribute", "view", "user", "role", "settings", "file", "agent", "schema_source"];
1086
+ export declare const AUDIT_RESOURCE_TYPES: readonly ["record", "object", "attribute", "view", "user", "role", "settings", "file", "agent", "schema_source", "tenant_invitation"];
1087
1087
  export type AuditResourceType = (typeof AUDIT_RESOURCE_TYPES)[number];
1088
1088
  /**
1089
1089
  * Actions that can be audited
1090
1090
  */
1091
- export declare const AUDIT_ACTIONS: readonly ["record.created", "record.updated", "record.deleted", "record.restored", "record.purged", "object.created", "object.updated", "object.deleted", "attribute.created", "attribute.updated", "attribute.deleted", "view.created", "view.updated", "view.deleted", "schema_source.applied", "schema_source.removed", "user.created", "user.invited", "user.updated", "user.deleted", "user.login", "user.logout", "role.created", "role.updated", "role.deleted", "role.assigned", "role.revoked", "settings.updated", "file.uploaded", "file.updated", "file.deleted"];
1091
+ export declare const AUDIT_ACTIONS: readonly ["record.created", "record.updated", "record.deleted", "record.restored", "record.purged", "object.created", "object.updated", "object.deleted", "attribute.created", "attribute.updated", "attribute.deleted", "view.created", "view.updated", "view.deleted", "schema_source.applied", "schema_source.presented", "schema_source.removed", "user.created", "user.invited", "user.updated", "user.deleted", "user.login", "user.logout", "tenant_invitation.created", "tenant_invitation.delivery_failed", "tenant_invitation.resent", "tenant_invitation.revoked", "tenant_invitation.accepted", "role.created", "role.updated", "role.deleted", "role.assigned", "role.revoked", "settings.updated", "file.uploaded", "file.updated", "file.deleted"];
1092
1092
  export type AuditAction = (typeof AUDIT_ACTIONS)[number];
1093
1093
  /**
1094
1094
  * Actor type - who performed the action
@@ -4451,6 +4451,43 @@ export interface TenantSettingsResponse extends TenantSettings {
4451
4451
  export declare const DEFAULT_MEETING_BOT_DISPLAY_NAME = "Notetaker";
4452
4452
  export declare const DEFAULT_TENANT_SETTINGS: TenantSettings;
4453
4453
  //#endregion
4454
+ //#region src/types/tenant-invitations.d.ts
4455
+ export declare const TENANT_INVITATION_DEFAULT_TTL_MS = 604800000;
4456
+ export declare const TENANT_INVITATION_MIN_TTL_MS = 3600000;
4457
+ export declare const TENANT_INVITATION_MAX_TTL_MS = 2592000000;
4458
+ export declare const TENANT_INVITATION_RESEND_INTERVAL_MS = 60000;
4459
+ export type TenantInvitationStatus = "pending" | "expired" | "revoked" | "accepted";
4460
+ export type TenantInvitationDeliveryStatus = "pending" | "sent" | "failed";
4461
+ /** Public invitation state. The single-use proof is deliberately not represented here. */
4462
+ export interface TenantInvitation extends Timestamps {
4463
+ id: Uuid;
4464
+ tenantId: TenantId;
4465
+ email: string;
4466
+ roleId: Uuid;
4467
+ invitingActorId: Uuid;
4468
+ status: TenantInvitationStatus;
4469
+ deliveryStatus: TenantInvitationDeliveryStatus;
4470
+ expiresAt: Date;
4471
+ lastSentAt: Date;
4472
+ acceptedAt?: Date;
4473
+ revokedAt?: Date;
4474
+ acceptedProfileId?: Uuid;
4475
+ }
4476
+ export interface CreateTenantInvitationInput {
4477
+ email: string;
4478
+ roleId: Uuid;
4479
+ }
4480
+ /** Verified identity supplied by the authentication boundary, never by request JSON. */
4481
+ export interface AcceptTenantInvitationIdentity {
4482
+ authId: string;
4483
+ email: string;
4484
+ }
4485
+ export interface AcceptTenantInvitationInput {
4486
+ invitationId: Uuid;
4487
+ proof: string;
4488
+ identity: AcceptTenantInvitationIdentity;
4489
+ }
4490
+ //#endregion
4454
4491
  //#region src/connectors/types.d.ts
4455
4492
  /** Built-in external connector providers. Mirrors the runtime's
4456
4493
  * `ConnectorProvider`: mail and calendar are separate keys per vendor, because
@@ -4910,6 +4947,41 @@ export interface InviteUserInput {
4910
4947
  redirectTo?: string;
4911
4948
  }
4912
4949
  //#endregion
4950
+ //#region src/types/schema-groups.d.ts
4951
+ export type SchemaGroupKind = "bundle" | "source";
4952
+ interface SchemaGroupBase {
4953
+ id: string;
4954
+ label: string | null;
4955
+ icon: IconName | null;
4956
+ /** Names `composeTenantSchema(...).owners` gives this group, in composition order. */
4957
+ objectNames: string[];
4958
+ }
4959
+ export interface BundleSchemaGroup extends SchemaGroupBase {
4960
+ kind: "bundle";
4961
+ /** A `tenant_bundles` row with status "active". */
4962
+ installed: boolean;
4963
+ appliedVersion: number | null;
4964
+ availableVersion: number;
4965
+ /** `selectUpdatable` on the row; false when not installed. */
4966
+ updateAvailable: boolean;
4967
+ }
4968
+ export interface SourceSchemaGroup extends SchemaGroupBase {
4969
+ kind: "source";
4970
+ appliedAt: string;
4971
+ }
4972
+ export type SchemaGroup = BundleSchemaGroup | SourceSchemaGroup;
4973
+ export interface SchemaGroupList {
4974
+ groups: SchemaGroup[];
4975
+ }
4976
+ /** Presentation a bundle or a source declares. A key left out (or `undefined`) means "unchanged". */
4977
+ export interface SchemaGroupPresentation {
4978
+ label?: string | null;
4979
+ icon?: IconName | null;
4980
+ }
4981
+ export declare function schemaGroupKey(group: Pick<SchemaGroup, "kind" | "id">): string;
4982
+ /** The one presentation rule, shared by `defineBundle`, `defineSchemaSource` and the source PUT. */
4983
+ export declare function parseSchemaGroupPresentation(input: unknown): SchemaGroupPresentation;
4984
+ //#endregion
4913
4985
  //#region src/types/schema-state.d.ts
4914
4986
  type Without<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
4915
4987
  export type ViewSourceOwner = "core" | `bundle:${string}` | `source:${string}`;
@@ -10056,6 +10128,23 @@ type ArchitectFocus = DraftFocus & {
10056
10128
  * are distinguishable.
10057
10129
  */
10058
10130
  export declare function architectFocusKey(focus: ArchitectFocus): string | null;
10131
+ /**
10132
+ * The key a content's own SECTION carries, distinct from the one its tab pill
10133
+ * carries. One key, one node: both stood for the same content, so a resolver
10134
+ * reading the DOM could only break the tie by document order — and the section
10135
+ * comes first. For the tab the follow had just opened, whose section is the
10136
+ * laid-out one, the follow landed on the corner of the content instead of on
10137
+ * the tab that had just been added.
10138
+ *
10139
+ * The prefix cannot collide with a head: no head starts with `body/`.
10140
+ */
10141
+ export declare function architectContentBodyKey(focus: ArchitectFocus): string | null;
10142
+ /**
10143
+ * Where to look for a focus, in the order a reader would: the thing itself
10144
+ * first — the tab pill for a content — then the body that stands for it when
10145
+ * no pill exists, as in a view that shows a single content and no bar.
10146
+ */
10147
+ export declare function architectFocusCandidates(focus: ArchitectFocus): string[];
10059
10148
  //#endregion
10060
10149
  //#region src/architect/operations/schema.d.ts
10061
10150
  /** Every attribute type: formulas and rollups compile against the drafted state at append. */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { $ as BilateralConfig, $t as indexBy, A as StorageError, An as ComputedDependency, At as StatusGroup, B as isObjectReferencedError, Bn as ComputedFormulaLiteralNode, Bt as OptionPropertyAttribute, C as RepositoryOperation, Cn as assertAcyclicComputedDependencies, Ct as RichTextAttribute, D as SchemaErrorCode, Dn as ComputedFunctionName, Dt as SelectAttribute, E as SchemaError, En as COMPUTED_FUNCTION_NAMES, Et as RollupFunction, F as SystemEntityImmutableError, Fn as ComputedValueType, Ft as inferInverseCardinality, G as BuiltInTransform, Gt as resolvePropertyDefinitions, H as isRecordReferencedError, Hn as ComputedFormulaPathNode, Ht as PropertySchema, I as ValidationError, In as ComputedFormulaAstNode, It as isAttributeSortable, J as ATTRIBUTE_TYPES, Jt as Uuid, K as MigrationDefinition, Kt as TenantId, L as ValidationErrorDetail, Ln as ComputedFormulaBinaryNode, Lt as isBilateralRelation, M as SyncCascadeError, Mn as ComputedOptionsSource, Mt as TimeFormat, N as SyncConflictError, Nn as ComputedPlan, Nt as UserAttribute, O as SchemaPlanNotFoundError, On as ComputedFunctionSignature, Ot as SingleRelationAttribute, P as SyncError, Pn as ComputedReturnType, Pt as UserReferenceType, Q as BaseAttribute, Qt as generateId, R as isAttributeInUseError, Rn as ComputedFormulaBinaryOperator, Rt as isUniversalRelation, S as RepositoryError, Sn as ComputedFormulaCompileError, St as RelationTarget, T as RoleNotFoundError, Tn as COMPUTED_FUNCTIONS, Tt as RollupAttribute, U as isSchemaError, Un as parseComputedFormula, Ut as PropertyType, V as isProtectedResourceError, Vn as ComputedFormulaParseError, Vt as PropertyAttribute, W as isValidationError, Wt as hasOptions, X as AttributeGroup, Xt as asUserId, Y as Attribute, Yt as asTenantId, Z as AttributeType, Zt as deepEqual, _ as ProtectedResourceError, _n as CompileComputedFormulaInput, _t as Option, a as ChangeTypeNotSupportedError, an as COMPUTED_FUNCTION_METADATA, at as DateRangeValue, b as RecordReference, bn as ComputedCompileSchema, bt as RELATION_TARGET_ANY, c as DuplicateError, cn as ComputedFormulaResult, ct as FormulaAttribute, d as MigrationTimeoutError, dn as evaluateComputedFormulaWithResult, dt as LocationAttribute, en as NonJsonValueError, et as CheckboxAttribute, f as NotFoundError, fn as formatComputedResult, ft as LocationGranularity, g as OrphanSystemAttributeError, gn as rollupToFormulaExpression, gt as NumberUnit, h as ObjectReferencedError, hn as inferRollupReturnType, ht as NumberAttribute, i as AttributeUsage, in as serializeStableJson, it as DateFormat, j as StorageOperation, jn as ComputedFieldKind, jt as TextAttribute, k as SearchBackendError, kn as isComputedFunctionName, kt as StatusAttribute, l as ForbiddenError, ln as evaluateComputedAst, lt as FormulaReturnType, m as ObjectNotFoundError, mn as compileRollupAttribute, mt as MultiselectAttribute, n as AttributeInUseError, nn as sameStableValue, nt as CurrencyAttribute, o as ConcurrentModificationError, on as ComputedFunctionCategory, ot as DateValue, p as NotImplementedError, pn as isPlainRecord, pt as MultiRelationAttribute, q as SchemaOperation, qt as UserId, r as AttributeNotFoundError, rn as serializeCanonicalJson, rt as DateAttribute, s as DestructiveSyncNotAllowedError, sn as ComputedFunctionMetadata, st as DocumentAttribute, t as AccessDeniedError, tn as canonicalStringify, tt as Currency, u as MemoryNotFoundError, un as evaluateComputedFormula, ut as Location, v as ProtectedRoleError, vn as ComputedCompileAttribute, vt as Phone, w as ReservedObjectNameError, wn as compileComputedFormula, wt as RichtextAttribute, x as RecordReferencedError, xn as ComputedDependencyGraphNode, xt as RelationAttribute, y as RecordNotFoundError, yn as ComputedCompileObject, yt as PhoneAttribute, z as isNotFoundError, zn as ComputedFormulaCallNode, zt as relationTargetsOf } from "./exceptions-DG_iMvYs.js";
3
- import { $ as QueryState, A as FormContentDefinition, B as DayMonthValue, C as ContentOpenMode, D as CustomContentDefinition, E as ContentViewDefinition, F as MeetingsContentDefinition, G as FilterOperator, H as EdgeQuantifier, I as RichtextContentDefinition, J as FilterValue, K as FilterRule, L as ViewContentDefinition, M as FormsContentDefinition, N as KanbanCollectionContentDefinition, O as DocumentsContentDefinition, P as ListViewLayout, Q as PhoneFilterValue, R as ViewRead, S as ContentFieldGroup, T as ContentViewContext, U as ExtendedFilterRule, V as DynamicValue, W as FilterCombinator, X as NoValueOperator, Y as NO_VALUE_OPERATORS, Z as OPERATORS_BY_TYPE, _ as CollectionContentDefinition, a as contentViewDefinitionSchemaFor, at as isNoValueOperator, b as ContentCreateMode, c as draftContentViewDefinitionSchemaFor, d as sortsSchema, et as RelativeDateValue, f as colorIdSchema, g as CollectionAction, h as ActivityContentDefinition, i as contentViewDefinitionSchema, it as getRollupFilterOperators, j as FormDensity, k as EmailsContentDefinition, l as filterStateSchema, m as SCHEMA_LIMITS, n as collectionContentSourceSchema, nt as SortRule, o as displayAttributesSchema, p as iconNameSchema, q as FilterState, r as columnsSchema, rt as filterOperatorsByTypeForGeneration, s as draftContentViewDefinitionSchema, t as AsideRule, tt as SortDirection, u as publishedViewContentDefinitionSchema, v as CollectionContentSource, w as ContentPlacement, x as ContentField, y as ColumnReference, z as CurrencyFilterValue } from "./all-Cf6oNz9y.js";
3
+ import { $ as QueryState, A as FormContentDefinition, B as DayMonthValue, C as ContentOpenMode, D as CustomContentDefinition, E as ContentViewDefinition, F as MeetingsContentDefinition, G as FilterOperator, H as EdgeQuantifier, I as RichtextContentDefinition, J as FilterValue, K as FilterRule, L as ViewContentDefinition, M as FormsContentDefinition, N as KanbanCollectionContentDefinition, O as DocumentsContentDefinition, P as ListViewLayout, Q as PhoneFilterValue, R as ViewRead, S as ContentFieldGroup, T as ContentViewContext, U as ExtendedFilterRule, V as DynamicValue, W as FilterCombinator, X as NoValueOperator, Y as NO_VALUE_OPERATORS, Z as OPERATORS_BY_TYPE, _ as CollectionContentDefinition, a as contentViewDefinitionSchemaFor, at as isNoValueOperator, b as ContentCreateMode, c as draftContentViewDefinitionSchemaFor, d as sortsSchema, et as RelativeDateValue, f as colorIdSchema, g as CollectionAction, h as ActivityContentDefinition, i as contentViewDefinitionSchema, it as getRollupFilterOperators, j as FormDensity, k as EmailsContentDefinition, l as filterStateSchema, m as SCHEMA_LIMITS, n as collectionContentSourceSchema, nt as SortRule, o as displayAttributesSchema, p as iconNameSchema, q as FilterState, r as columnsSchema, rt as filterOperatorsByTypeForGeneration, s as draftContentViewDefinitionSchema, t as AsideRule, tt as SortDirection, u as publishedViewContentDefinitionSchema, v as CollectionContentSource, w as ContentPlacement, x as ContentField, y as ColumnReference, z as CurrencyFilterValue } from "./all-m7G8bXjY.js";
4
4
  import { A as FolderPreset, C as ResourceVisibility, D as parseResourceVisibility, E as Timestamps, M as PresetNode, O as DocumentLayout, S as ReservedObjectName, T as SystemFieldName, _ as ObjectRecord, a as validateDraft, b as RESOURCE_VISIBILITIES, c as validateObjectOrThrow, f as createFormAttributeValidator, g as ObjectDefinition, h as ObjectAttribute, j as MAX_PRESET_DEPTH, k as DocumentLayoutVariant, m as ListViewTabVisibility, o as validateDraftOrThrow, p as LIST_VIEW_TAB_VISIBILITIES, r as rejectUnknownAttributesOrThrow, s as validateObject, v as RESERVED_ATTRIBUTE_NAMES, w as SYSTEM_FIELD_NAMES, x as ReservedAttributeName, y as RESERVED_OBJECT_NAMES } from "./index-B6DXIuf2.js";
5
5
  import { S as UpdateObjectInput, _ as statusOptionWriteSchema, b as RelationOption, c as parseAttributeConfigForCreate, d as propertyAttributeWireSchema, f as propertySchemaSchema, g as statusGroupSchema, h as selectOptionWriteSchema, l as parseAttributeConfigForUpdate, m as refuseForeignKeys, n as WIRE_OMITTED_CONFIG_KEYS, o as multiselectOptionWriteSchema, p as propertySchemaWireSchema, r as attributeConfigSchemas, s as parseAttributeConfig, t as SIMPLE_PROPERTY_TYPES, u as propertyAttributeSchema, v as AddAttributeInput, x as RelationOptionsResponse, y as CreateCustomObjectInput } from "./index-CePzb28P.js";
6
6
  import { n as DEFAULT_VALIDATION_MESSAGES, r as ValidationMessages, t as formatZodErrors } from "./index-ZnCTYc93.js";
@@ -1083,12 +1083,12 @@ export declare const PRESENTATION_PROPERTIES: readonly ["label", "description",
1083
1083
  /**
1084
1084
  * Type of resource that can be audited
1085
1085
  */
1086
- export declare const AUDIT_RESOURCE_TYPES: readonly ["record", "object", "attribute", "view", "user", "role", "settings", "file", "agent", "schema_source"];
1086
+ export declare const AUDIT_RESOURCE_TYPES: readonly ["record", "object", "attribute", "view", "user", "role", "settings", "file", "agent", "schema_source", "tenant_invitation"];
1087
1087
  export type AuditResourceType = (typeof AUDIT_RESOURCE_TYPES)[number];
1088
1088
  /**
1089
1089
  * Actions that can be audited
1090
1090
  */
1091
- export declare const AUDIT_ACTIONS: readonly ["record.created", "record.updated", "record.deleted", "record.restored", "record.purged", "object.created", "object.updated", "object.deleted", "attribute.created", "attribute.updated", "attribute.deleted", "view.created", "view.updated", "view.deleted", "schema_source.applied", "schema_source.removed", "user.created", "user.invited", "user.updated", "user.deleted", "user.login", "user.logout", "role.created", "role.updated", "role.deleted", "role.assigned", "role.revoked", "settings.updated", "file.uploaded", "file.updated", "file.deleted"];
1091
+ export declare const AUDIT_ACTIONS: readonly ["record.created", "record.updated", "record.deleted", "record.restored", "record.purged", "object.created", "object.updated", "object.deleted", "attribute.created", "attribute.updated", "attribute.deleted", "view.created", "view.updated", "view.deleted", "schema_source.applied", "schema_source.presented", "schema_source.removed", "user.created", "user.invited", "user.updated", "user.deleted", "user.login", "user.logout", "tenant_invitation.created", "tenant_invitation.delivery_failed", "tenant_invitation.resent", "tenant_invitation.revoked", "tenant_invitation.accepted", "role.created", "role.updated", "role.deleted", "role.assigned", "role.revoked", "settings.updated", "file.uploaded", "file.updated", "file.deleted"];
1092
1092
  export type AuditAction = (typeof AUDIT_ACTIONS)[number];
1093
1093
  /**
1094
1094
  * Actor type - who performed the action
@@ -4451,6 +4451,43 @@ export interface TenantSettingsResponse extends TenantSettings {
4451
4451
  export declare const DEFAULT_MEETING_BOT_DISPLAY_NAME = "Notetaker";
4452
4452
  export declare const DEFAULT_TENANT_SETTINGS: TenantSettings;
4453
4453
  //#endregion
4454
+ //#region src/types/tenant-invitations.d.ts
4455
+ export declare const TENANT_INVITATION_DEFAULT_TTL_MS = 604800000;
4456
+ export declare const TENANT_INVITATION_MIN_TTL_MS = 3600000;
4457
+ export declare const TENANT_INVITATION_MAX_TTL_MS = 2592000000;
4458
+ export declare const TENANT_INVITATION_RESEND_INTERVAL_MS = 60000;
4459
+ export type TenantInvitationStatus = "pending" | "expired" | "revoked" | "accepted";
4460
+ export type TenantInvitationDeliveryStatus = "pending" | "sent" | "failed";
4461
+ /** Public invitation state. The single-use proof is deliberately not represented here. */
4462
+ export interface TenantInvitation extends Timestamps {
4463
+ id: Uuid;
4464
+ tenantId: TenantId;
4465
+ email: string;
4466
+ roleId: Uuid;
4467
+ invitingActorId: Uuid;
4468
+ status: TenantInvitationStatus;
4469
+ deliveryStatus: TenantInvitationDeliveryStatus;
4470
+ expiresAt: Date;
4471
+ lastSentAt: Date;
4472
+ acceptedAt?: Date;
4473
+ revokedAt?: Date;
4474
+ acceptedProfileId?: Uuid;
4475
+ }
4476
+ export interface CreateTenantInvitationInput {
4477
+ email: string;
4478
+ roleId: Uuid;
4479
+ }
4480
+ /** Verified identity supplied by the authentication boundary, never by request JSON. */
4481
+ export interface AcceptTenantInvitationIdentity {
4482
+ authId: string;
4483
+ email: string;
4484
+ }
4485
+ export interface AcceptTenantInvitationInput {
4486
+ invitationId: Uuid;
4487
+ proof: string;
4488
+ identity: AcceptTenantInvitationIdentity;
4489
+ }
4490
+ //#endregion
4454
4491
  //#region src/connectors/types.d.ts
4455
4492
  /** Built-in external connector providers. Mirrors the runtime's
4456
4493
  * `ConnectorProvider`: mail and calendar are separate keys per vendor, because
@@ -4910,6 +4947,41 @@ export interface InviteUserInput {
4910
4947
  redirectTo?: string;
4911
4948
  }
4912
4949
  //#endregion
4950
+ //#region src/types/schema-groups.d.ts
4951
+ export type SchemaGroupKind = "bundle" | "source";
4952
+ interface SchemaGroupBase {
4953
+ id: string;
4954
+ label: string | null;
4955
+ icon: IconName | null;
4956
+ /** Names `composeTenantSchema(...).owners` gives this group, in composition order. */
4957
+ objectNames: string[];
4958
+ }
4959
+ export interface BundleSchemaGroup extends SchemaGroupBase {
4960
+ kind: "bundle";
4961
+ /** A `tenant_bundles` row with status "active". */
4962
+ installed: boolean;
4963
+ appliedVersion: number | null;
4964
+ availableVersion: number;
4965
+ /** `selectUpdatable` on the row; false when not installed. */
4966
+ updateAvailable: boolean;
4967
+ }
4968
+ export interface SourceSchemaGroup extends SchemaGroupBase {
4969
+ kind: "source";
4970
+ appliedAt: string;
4971
+ }
4972
+ export type SchemaGroup = BundleSchemaGroup | SourceSchemaGroup;
4973
+ export interface SchemaGroupList {
4974
+ groups: SchemaGroup[];
4975
+ }
4976
+ /** Presentation a bundle or a source declares. A key left out (or `undefined`) means "unchanged". */
4977
+ export interface SchemaGroupPresentation {
4978
+ label?: string | null;
4979
+ icon?: IconName | null;
4980
+ }
4981
+ export declare function schemaGroupKey(group: Pick<SchemaGroup, "kind" | "id">): string;
4982
+ /** The one presentation rule, shared by `defineBundle`, `defineSchemaSource` and the source PUT. */
4983
+ export declare function parseSchemaGroupPresentation(input: unknown): SchemaGroupPresentation;
4984
+ //#endregion
4913
4985
  //#region src/types/schema-state.d.ts
4914
4986
  type Without<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
4915
4987
  export type ViewSourceOwner = "core" | `bundle:${string}` | `source:${string}`;
@@ -10056,6 +10128,23 @@ type ArchitectFocus = DraftFocus & {
10056
10128
  * are distinguishable.
10057
10129
  */
10058
10130
  export declare function architectFocusKey(focus: ArchitectFocus): string | null;
10131
+ /**
10132
+ * The key a content's own SECTION carries, distinct from the one its tab pill
10133
+ * carries. One key, one node: both stood for the same content, so a resolver
10134
+ * reading the DOM could only break the tie by document order — and the section
10135
+ * comes first. For the tab the follow had just opened, whose section is the
10136
+ * laid-out one, the follow landed on the corner of the content instead of on
10137
+ * the tab that had just been added.
10138
+ *
10139
+ * The prefix cannot collide with a head: no head starts with `body/`.
10140
+ */
10141
+ export declare function architectContentBodyKey(focus: ArchitectFocus): string | null;
10142
+ /**
10143
+ * Where to look for a focus, in the order a reader would: the thing itself
10144
+ * first — the tab pill for a content — then the body that stands for it when
10145
+ * no pill exists, as in a view that shows a single content and no bar.
10146
+ */
10147
+ export declare function architectFocusCandidates(focus: ArchitectFocus): string[];
10059
10148
  //#endregion
10060
10149
  //#region src/architect/operations/schema.d.ts
10061
10150
  /** Every attribute type: formulas and rollups compile against the drafted state at append. */