@stndrds/schema 1.0.0-alpha.350 → 1.0.0-alpha.351

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.
Files changed (85) hide show
  1. package/dist/{all-Dk8PLu1y.d.mts → all-CxrR3FfQ.d.mts} +8 -8
  2. package/dist/{all-CPMOHYla.d.ts → all-DgCMEIjc.d.ts} +8 -8
  3. package/dist/{attributes-mMmH-WOx.d.mts → attributes-BrWmES5w.d.mts} +1 -1
  4. package/dist/{attributes-C2gm0hUJ.d.ts → attributes-DF899HOt.d.ts} +1 -1
  5. package/dist/{checkbox-DO6Mkloc.d.mts → checkbox-Clb_FZ4C.d.mts} +2 -2
  6. package/dist/{checkbox-Ce8gAyQf.d.ts → checkbox-DdyYfy8E.d.ts} +2 -2
  7. package/dist/config-CYuFravl.js +13 -0
  8. package/dist/config-CiAtjzem.mjs +13 -0
  9. package/dist/{date-CMS-GYRM.d.mts → date-CXp1zJM4.d.mts} +2 -2
  10. package/dist/{date-DikDGfre.d.ts → date-DhwNqFU4.d.ts} +2 -2
  11. package/dist/empty-BgAwlO54.mjs +2 -0
  12. package/dist/empty-CRCKZcwK.js +2 -0
  13. package/dist/{exceptions-DxzT8POW.d.ts → exceptions-DrrzAhuA.d.mts} +46 -10
  14. package/dist/{exceptions-DxzT8POW.d.mts → exceptions-DrrzAhuA.d.ts} +46 -10
  15. package/dist/exceptions.d.mts +2 -2
  16. package/dist/exceptions.d.ts +2 -2
  17. package/dist/exceptions.js +1 -1
  18. package/dist/exceptions.mjs +1 -1
  19. package/dist/{index-CRtiKFTH.d.ts → index-BOibflWy.d.ts} +15 -2
  20. package/dist/{index-D26ob_vF.d.mts → index-Bfvc4AZB.d.mts} +15 -2
  21. package/dist/{index-D9OhYX-t.d.ts → index-DCw-X_sc.d.ts} +3 -3
  22. package/dist/{index-BV4yNsr7.d.mts → index-DggAjGTr.d.mts} +1 -1
  23. package/dist/{index-B-mUjnh9.d.mts → index-Lp5dhlhc.d.mts} +3 -3
  24. package/dist/{index-BL7EA39F.d.ts → index-OvRk1isl.d.ts} +1 -1
  25. package/dist/index.d.mts +184 -31
  26. package/dist/index.d.ts +184 -31
  27. package/dist/index.js +9 -9
  28. package/dist/index.mjs +9 -9
  29. package/dist/{number-r6bOZ9jd.d.mts → number-C_ZN3qJO.d.mts} +2 -2
  30. package/dist/{number-Ck0PPSkK.d.ts → number-CoTBX03I.d.ts} +2 -2
  31. package/dist/object-AqI3n2CP.mjs +4 -0
  32. package/dist/object-BEwZx-Fu.js +4 -0
  33. package/dist/{text-B1Vwj7fS.d.mts → text-D_rs4VYZ.d.mts} +2 -2
  34. package/dist/{text-DHg2cmFd.d.ts → text-Z8QjbxUx.d.ts} +2 -2
  35. package/dist/{utils-r53z9KnF.d.mts → utils-Cl3b_6d8.d.mts} +1 -1
  36. package/dist/{utils-Du-He6Ct.d.ts → utils-Cuz_wSKI.d.ts} +1 -1
  37. package/dist/utils.d.mts +1 -1
  38. package/dist/utils.d.ts +1 -1
  39. package/dist/validation/all.d.mts +5 -5
  40. package/dist/validation/all.d.ts +5 -5
  41. package/dist/validation/all.js +1 -1
  42. package/dist/validation/all.mjs +1 -1
  43. package/dist/validation/complex/currency.d.mts +2 -2
  44. package/dist/validation/complex/currency.d.ts +2 -2
  45. package/dist/validation/complex/location.d.mts +2 -2
  46. package/dist/validation/complex/location.d.ts +2 -2
  47. package/dist/validation/complex/phone.d.mts +2 -2
  48. package/dist/validation/complex/phone.d.ts +2 -2
  49. package/dist/validation/complex/relation.d.mts +2 -2
  50. package/dist/validation/complex/relation.d.ts +2 -2
  51. package/dist/validation/complex/richtext.d.mts +2 -2
  52. package/dist/validation/complex/richtext.d.ts +2 -2
  53. package/dist/validation/complex/select.d.mts +2 -2
  54. package/dist/validation/complex/select.d.ts +2 -2
  55. package/dist/validation/complex/user.d.mts +2 -2
  56. package/dist/validation/complex/user.d.ts +2 -2
  57. package/dist/validation/computed/formula.d.mts +2 -2
  58. package/dist/validation/computed/formula.d.ts +2 -2
  59. package/dist/validation/computed/rollup.d.mts +2 -2
  60. package/dist/validation/computed/rollup.d.ts +2 -2
  61. package/dist/validation/config/index.d.mts +2 -2
  62. package/dist/validation/config/index.d.ts +2 -2
  63. package/dist/validation/config/index.js +1 -1
  64. package/dist/validation/config/index.mjs +1 -1
  65. package/dist/validation/core/index.d.mts +1 -1
  66. package/dist/validation/core/index.d.ts +1 -1
  67. package/dist/validation/object/index.d.mts +1 -1
  68. package/dist/validation/object/index.d.ts +1 -1
  69. package/dist/validation/object/index.js +1 -1
  70. package/dist/validation/object/index.mjs +1 -1
  71. package/dist/validation/primitives/checkbox.d.mts +1 -1
  72. package/dist/validation/primitives/checkbox.d.ts +1 -1
  73. package/dist/validation/primitives/date.d.mts +1 -1
  74. package/dist/validation/primitives/date.d.ts +1 -1
  75. package/dist/validation/primitives/number.d.mts +1 -1
  76. package/dist/validation/primitives/number.d.ts +1 -1
  77. package/dist/validation/primitives/text.d.mts +1 -1
  78. package/dist/validation/primitives/text.d.ts +1 -1
  79. package/dist/{view-config.schema-c8LvH8WE.mjs → view-config.schema-CCrM5b-O.mjs} +1 -1
  80. package/dist/{view-config.schema-QmnihdGp.js → view-config.schema-CgU86fLj.js} +1 -1
  81. package/package.json +2 -2
  82. package/dist/config-BiQGgy7f.mjs +0 -13
  83. package/dist/config-WUWITOeW.js +0 -13
  84. package/dist/object-BA3vKFl0.js +0 -4
  85. package/dist/object-C92B0Oei.mjs +0 -4
@@ -1,12 +1,12 @@
1
1
 
2
- import { M as RollupAttribute, i as AttributeType, n as Attribute } from "./attributes-mMmH-WOx.mjs";
3
- import { m as ListViewTabVisibility } from "./index-B-mUjnh9.mjs";
4
- import "./index-D26ob_vF.mjs";
5
- import "./index-BV4yNsr7.mjs";
6
- import "./text-B1Vwj7fS.mjs";
7
- import "./number-r6bOZ9jd.mjs";
8
- import "./checkbox-DO6Mkloc.mjs";
9
- import "./date-CMS-GYRM.mjs";
2
+ import { M as RollupAttribute, i as AttributeType, n as Attribute } from "./attributes-BrWmES5w.mjs";
3
+ import { m as ListViewTabVisibility } from "./index-Lp5dhlhc.mjs";
4
+ import "./index-Bfvc4AZB.mjs";
5
+ import "./index-DggAjGTr.mjs";
6
+ import "./text-D_rs4VYZ.mjs";
7
+ import "./number-C_ZN3qJO.mjs";
8
+ import "./checkbox-Clb_FZ4C.mjs";
9
+ import "./date-CXp1zJM4.mjs";
10
10
  import { z as z$1 } from "zod";
11
11
  import { IconName } from "@stndrds/constants";
12
12
  //#region src/types/filters.d.ts
@@ -1,12 +1,12 @@
1
1
 
2
- import { M as RollupAttribute, i as AttributeType, n as Attribute } from "./attributes-C2gm0hUJ.js";
3
- import { m as ListViewTabVisibility } from "./index-D9OhYX-t.js";
4
- import "./index-CRtiKFTH.js";
5
- import "./index-BL7EA39F.js";
6
- import "./text-DHg2cmFd.js";
7
- import "./number-Ck0PPSkK.js";
8
- import "./checkbox-Ce8gAyQf.js";
9
- import "./date-DikDGfre.js";
2
+ import { M as RollupAttribute, i as AttributeType, n as Attribute } from "./attributes-DF899HOt.js";
3
+ import { m as ListViewTabVisibility } from "./index-DCw-X_sc.js";
4
+ import "./index-BOibflWy.js";
5
+ import "./index-OvRk1isl.js";
6
+ import "./text-Z8QjbxUx.js";
7
+ import "./number-CoTBX03I.js";
8
+ import "./checkbox-DdyYfy8E.js";
9
+ import "./date-DhwNqFU4.js";
10
10
  import { z as z$1 } from "zod";
11
11
  import { IconName } from "@stndrds/constants";
12
12
  //#region src/types/filters.d.ts
@@ -1,5 +1,5 @@
1
1
 
2
- import { r as Uuid } from "./utils-r53z9KnF.mjs";
2
+ import { r as Uuid } from "./utils-Cl3b_6d8.mjs";
3
3
  import { ColorId, CountryIso3, CurrencyCode, IconName } from "@stndrds/constants";
4
4
  //#region src/computed/parser.d.ts
5
5
  type ComputedFormulaAstNode = ComputedFormulaLiteralNode | ComputedFormulaPathNode | ComputedFormulaCallNode | ComputedFormulaBinaryNode;
@@ -1,5 +1,5 @@
1
1
 
2
- import { r as Uuid } from "./utils-Du-He6Ct.js";
2
+ import { r as Uuid } from "./utils-Cuz_wSKI.js";
3
3
  import { ColorId, CountryIso3, CurrencyCode, IconName } from "@stndrds/constants";
4
4
  //#region src/computed/parser.d.ts
5
5
  type ComputedFormulaAstNode = ComputedFormulaLiteralNode | ComputedFormulaPathNode | ComputedFormulaCallNode | ComputedFormulaBinaryNode;
@@ -1,6 +1,6 @@
1
1
 
2
- import { s as CheckboxAttribute } from "./attributes-mMmH-WOx.mjs";
3
- import { r as ValidationMessages } from "./index-BV4yNsr7.mjs";
2
+ import { s as CheckboxAttribute } from "./attributes-BrWmES5w.mjs";
3
+ import { r as ValidationMessages } from "./index-DggAjGTr.mjs";
4
4
  import { z as z$1 } from "zod";
5
5
  //#region src/validation/primitives/checkbox.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
 
2
- import { s as CheckboxAttribute } from "./attributes-C2gm0hUJ.js";
3
- import { r as ValidationMessages } from "./index-BL7EA39F.js";
2
+ import { s as CheckboxAttribute } from "./attributes-DF899HOt.js";
3
+ import { r as ValidationMessages } from "./index-OvRk1isl.js";
4
4
  import { z as z$1 } from "zod";
5
5
  //#region src/validation/primitives/checkbox.d.ts
6
6
  /**
@@ -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"),s=require("./empty-CRCKZcwK.js");let c=require("zod");c=__toESM(c);let l=require("@stndrds/constants");const u=[`skill`,`memory`,`drives`,`artifact`,`meeting`];function isNativeObjectName(e){return u.includes(e)}const d=[`workspace`,`private`],ee=[`all`,...d];function parseResourceVisibility(e){if(typeof e==`string`&&d.includes(e))return e;throw new o.ValidationError(`visibility must be one of: ${d.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`],te=u,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,labelLength:128},ne=Object.keys(l.COLORS),re=new Set(l.ICONS),h=c.z.enum(ne).describe(`A color id from the palette`),g=c.z.string().superRefine((e,t)=>{re.has(e)||t.addIssue({code:`custom`,message:`Invalid icon name`})}).transform(e=>e);function isDateRangeValue(e){return typeof e==`object`&&!!e&&typeof e.start==`string`}function normalizeDateValue(e,t){return s.t(e)?null:isDateRangeValue(e)?t.endDate?{start:e.start,end:e.end??null}:e.start:typeof e==`string`?t.endDate?{start:e,end:null}:e:null}function dateValueStart(e){return typeof e==`string`&&e!==``?e:isDateRangeValue(e)&&e.start!==``?e.start:null}const ie=new Set(l.ICONS),_=/^[a-zA-Z_][a-zA-Z0-9_]*$/,ae=/^[a-z][a-z0-9-]*$/,v=m.labelLength,y=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{y.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(!ae.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 b=c.default.string().min(1,`Attribute name cannot be empty`).max(63,`Attribute name is too long (max 63 characters)`).regex(_,{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(!_.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>v)throw Error(`[AttributeBuilder] Attribute label is too long (max ${v} characters)`)}function validateIconName(e,t){if(!ie.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 oe=[`if`,`concat`,`sum`,`avg`,`count`,`min`,`max`,`earliest`,`latest`,`unique`,`first`,`percent_empty`,`percent_not_empty`,`count_empty`,`count_not_empty`,`count_unique`],x={if:{name:`if`,returnType:`branch`,minArgs:3,maxArgs:3},concat:{name:`concat`,returnType:{kind:`scalar`,type:`text`},minArgs:1},sum:{name:`sum`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},avg:{name:`avg`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count:{name:`count`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},min:{name:`min`,returnType:`source_item`,minArgs:1,maxArgs:1},max:{name:`max`,returnType:`source_item`,minArgs:1,maxArgs:1},earliest:{name:`earliest`,returnType:{kind:`scalar`,type:`date`},minArgs:1,maxArgs:1},latest:{name:`latest`,returnType:{kind:`scalar`,type:`date`},minArgs:1,maxArgs:1},unique:{name:`unique`,returnType:`argument`,minArgs:1,maxArgs:1},first:{name:`first`,returnType:`source_item`,minArgs:1,maxArgs:1},percent_empty:{name:`percent_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},percent_not_empty:{name:`percent_not_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count_empty:{name:`count_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count_not_empty:{name:`count_not_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count_unique:{name:`count_unique`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1}};function isComputedFunctionName(e){return Object.hasOwn(x,e)}var ComputedFormulaParseError=class extends Error{constructor(e){super(e),this.name=`ComputedFormulaParseError`}};function parseComputedFormula(e){let t=new Parser(tokenize(e)),n=t.parseExpression();return t.expectEnd(),n}function tokenize(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===` `||r===`
12
+ `||r===`\r`){n+=1;continue}if(r===`"`||r===`'`){let i=scanString(e,n,r);t.push({kind:`string`,value:i.value,position:n}),n=i.nextIndex;continue}if(isDigit(r)){let r=scanNumber(e,n);t.push({kind:`number`,value:r.value,position:n}),n=r.nextIndex;continue}if(isIdentifierStart(r)){let r=scanIdentifier(e,n),i=r.value.toLowerCase();i===`true`?t.push({kind:`boolean`,value:!0,position:n}):i===`false`?t.push({kind:`boolean`,value:!1,position:n}):i===`null`?t.push({kind:`null`,position:n}):t.push({kind:`identifier`,value:r.value,position:n}),n=r.nextIndex;continue}let i=e.slice(n,n+2);if(i===`>=`||i===`<=`||i===`==`||i===`!=`){t.push({kind:`operator`,value:i,position:n}),n+=2;continue}if(r===`>`||r===`<`||r===`+`||r===`-`||r===`*`||r===`/`){t.push({kind:`operator`,value:r,position:n}),n+=1;continue}if(r===`(`||r===`)`||r===`,`||r===`.`){t.push({kind:`punctuation`,value:r,position:n}),n+=1;continue}throw new ComputedFormulaParseError(`Unexpected character "${r}" at position ${n}`)}return t}function scanString(e,t,n=`"`){let r=``,i=t+1;for(;i<e.length;){let t=e[i];if(t===n)return{value:r,nextIndex:i+1};if(t===`\\`){let t=e[i+1];if(t===void 0)throw new ComputedFormulaParseError(`Unterminated string literal at position ${i}`);r+=decodeEscape(t,i),i+=2;continue}r+=t,i+=1}throw new ComputedFormulaParseError(`Unterminated string literal at position ${t}`)}function decodeEscape(e,t){switch(e){case`"`:case`\\`:return e;case`n`:return`
13
+ `;case`r`:return`\r`;case`t`:return` `;default:throw new ComputedFormulaParseError(`Unknown escape sequence "\\${e}" at position ${t}`)}}function scanNumber(e,t){let n=t;for(;n<e.length&&isDigit(e[n]);)n+=1;if(e[n]===`.`){let t=n;if(n+=1,!isDigit(e[n]))throw new ComputedFormulaParseError(`Invalid number literal at position ${t}`);for(;n<e.length&&isDigit(e[n]);)n+=1}let r=e.slice(t,n),i=Number(r);if(!Number.isFinite(i))throw new ComputedFormulaParseError(`Invalid number literal "${r}"`);return{value:i,nextIndex:n}}function scanIdentifier(e,t){let n=t+1;for(;n<e.length&&isIdentifierPart(e[n]);)n+=1;return{value:e.slice(t,n),nextIndex:n}}function isDigit(e){return e!==void 0&&e>=`0`&&e<=`9`}function isIdentifierStart(e){return e!==void 0&&/[A-Za-z_]/.test(e)}function isIdentifierPart(e){return e!==void 0&&/[A-Za-z0-9_]/.test(e)}var Parser=class{constructor(e){this.tokens=e,this.position=0}parseExpression(){return this.parseBinaryExpression(0)}expectEnd(){let e=this.peek();if(e!==void 0)throw new ComputedFormulaParseError(`Unexpected token ${describeToken(e)} at position ${e.position}`)}parseBinaryExpression(e){let t=this.parsePrimary();for(;;){let n=this.peek();if(n?.kind!==`operator`)return t;let r=getOperatorPrecedence(n.value);if(r<e)return t;let i=n.value;this.consume();let a=this.parseBinaryExpression(r+1);t={kind:`binary`,operator:i,left:t,right:a}}}parsePrimary(){let e=this.consume();if(e===void 0)throw new ComputedFormulaParseError(`Unexpected end of expression`);switch(e.kind){case`string`:case`number`:case`boolean`:return{kind:`literal`,value:e.value};case`null`:return{kind:`literal`,value:null};case`identifier`:return this.parseIdentifier(e.value);case`punctuation`:if(e.value===`(`){let e=this.parseExpression();return this.expectPunctuation(`)`),e}break;case`operator`:if(e.value===`-`){let e=this.consume();if(e?.kind===`number`)return{kind:`literal`,value:-e.value}}}throw new ComputedFormulaParseError(`Expected literal, path, call, or parenthesized expression at position ${e.position}`)}parseIdentifier(e){if(this.matchPunctuation(`(`)){let t=[];if(!this.matchPunctuation(`)`)){do t.push(this.parseExpression());while(this.matchPunctuation(`,`));this.expectPunctuation(`)`)}return{kind:`call`,functionName:e.toLowerCase(),args:t}}let t=[e];for(;this.matchPunctuation(`.`);){let e=this.consume();if(e?.kind!==`identifier`)throw new ComputedFormulaParseError(`Expected attribute name after path separator at position ${e?.position??this.previousPosition()}`);t.push(e.value)}return{kind:`path`,parts:t}}expectPunctuation(e){if(!this.matchPunctuation(e))throw new ComputedFormulaParseError(`Expected "${e}" at position ${this.peek()?.position??this.previousPosition()}`)}matchPunctuation(e){let t=this.peek();return t?.kind===`punctuation`&&t.value===e&&(this.consume(),!0)}peek(){return this.tokens[this.position]}consume(){let e=this.tokens[this.position];return this.position+=1,e}previousPosition(){return this.tokens[this.position-1]?.position??0}};function describeToken(e){switch(e.kind){case`identifier`:case`number`:case`string`:case`boolean`:case`operator`:case`punctuation`:return`"${String(e.value)}"`;case`null`:return`"null"`;default:return e}}function getOperatorPrecedence(e){switch(e){case`*`:case`/`:return 3;case`+`:case`-`:return 2;case`>`:case`<`:case`>=`:case`<=`:case`==`:case`!=`:return 1;default:return e}}function evaluateAst(e,t){switch(e.kind){case`literal`:return e.value;case`path`:return resolvePath(t,e.parts);case`binary`:return evaluateBinary(e.operator,evaluateAst(e.left,t),evaluateAst(e.right,t));case`call`:return evaluateCallNode(e.functionName,e.args,t);default:return unreachable(e)}}function evaluateCallNode(e,t,n){if(assertComputedFunctionName(e),validateArity(e,t.length),e===`if`){let e=evaluateAst(t[0],n);return e===null?null:evaluateAst(e?t[1]:t[2],n)}return evaluateCall(e,t.map(e=>evaluateAst(e,n)))}function resolvePath(e,t){return t.reduce((e,t)=>resolvePathPart(e,t),e)}function resolvePathPart(e,t){if(Array.isArray(e))return e.map(e=>resolvePathPart(e,t));if(!isPlainRecord(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let n=e.values;return isPlainRecord(n)&&Object.hasOwn(n,t)?n[t]??null:null}function evaluateBinary(e,t,n){switch(e){case`+`:return add(t,n);case`-`:return numericBinary(t,n,(e,t)=>e-t);case`*`:return numericBinary(t,n,(e,t)=>e*t);case`/`:return numericBinary(t,n,(e,t)=>e/t);case`>`:return compareWith(t,n,e=>e>0);case`<`:return compareWith(t,n,e=>e<0);case`>=`:return compareWith(t,n,e=>e>=0);case`<=`:return compareWith(t,n,e=>e<=0);case`==`:return equalScalar(t,n);case`!=`:{let e=equalScalar(t,n);return e===null?null:!e}default:return unreachable(e)}}function add(e,t){return typeof e==`string`||typeof t==`string`?`${e??``}${t??``}`:numericBinary(e,t,(e,t)=>e+t)}function compareWith(e,t,n){let r=compare(e,t);return r===null?null:n(r)}function compare(e,t){if(!areCommensurable([e,t]))return null;let n=toFiniteNumber(e),r=toFiniteNumber(t);if(n!==null&&r!==null)return n-r;let i=toDate(e),a=toDate(t);return i&&a?i.getTime()-a.getTime():null}function equalScalar(e,t){return e===t?!0:e==null||t==null?!1:areCommensurable([e,t])?compare(e,t)===0:null}function assertComputedFunctionName(e){if(!isComputedFunctionName(e))throw Error(`Unknown computed function "${e}"`)}function validateArity(e,t){let{minArgs:n,maxArgs:r}=x[e];if(t>=n&&t<=(r??1/0))return;let i=r===void 0?`at least ${n}`:`between ${n} and ${r}`;throw Error(`Function "${e}" expects ${i} arguments, received ${t}`)}function evaluateCall(e,t){switch(e){case`concat`:return t.filter(e=>e!=null).map(String).join(``);case`sum`:return areCommensurable(t)?numericValues(t).reduce((e,t)=>e+t,0):null;case`avg`:{if(!areCommensurable(t))return null;let e=numericValues(t);return e.length>0?e.reduce((e,t)=>e+t,0)/e.length:null}case`count`:return collectionItems(t[0]).length;case`min`:return minMax(t,`min`);case`max`:return minMax(t,`max`);case`earliest`:return dateMinMax(t,`min`);case`latest`:return dateMinMax(t,`max`);case`unique`:return uniqueNonEmpty(collectionItems(t[0]));case`first`:return collectionItems(t[0]).find(e=>e!=null)??null;case`percent_empty`:return percentByEmptyState(t[0],!0);case`percent_not_empty`:return percentByEmptyState(t[0],!1);case`count_empty`:return collectionItems(t[0]).filter(s.t).length;case`count_not_empty`:return collectionItems(t[0]).filter(e=>!s.t(e)).length;case`count_unique`:return uniqueNonEmpty(collectionItems(t[0])).length;default:return unreachable(e)}}function unreachable(e){return e}function numericValues(e){return flatten(e).map(toFiniteNumber).filter(e=>e!==null)}function areCommensurable(e){let t=new Set;for(let n of flatten(e))isCurrencyValue(n)&&t.add(currencyCode(n));return t.size<=1}function currencyCode(e){return e.code.toUpperCase()}function numericBinary(e,t,n){if(!areCommensurable([e,t]))return null;let r=toFiniteNumber(e),i=toFiniteNumber(t);if(r===null||i===null)return null;let a=n(r,i);return Number.isFinite(a)?a:null}function minMax(e,t){if(!areCommensurable(e))return null;let n=numericValues(e);return n.length>0?t===`min`?Math.min(...n):Math.max(...n):dateMinMax(e,t)}function dateMinMax(e,t){let n=flatten(e).map(toDate).filter(e=>e!==null);if(n.length===0)return null;let r=n.map(e=>e.getTime()),i=t===`min`?Math.min(...r):Math.max(...r);return new Date(i).toISOString()}function percentByEmptyState(e,t){let n=collectionItems(e);return n.length===0?0:n.filter(e=>s.t(e)===t).length/n.length}function uniqueNonEmpty(e){let t=new Set,n=[];for(let r of e){if(s.t(r))continue;let e=uniqueKey(r);t.has(e)||(t.add(e),n.push(r))}return n}function collectionItems(e){return e==null?[]:Array.isArray(e)?flatten(e):[e]}function flatten(e){return e.flat(1/0)}function toFiniteNumber(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:null}return isCurrencyValue(e)&&Number.isFinite(e.value)?e.value:null}function isCurrencyValue(e){return typeof e==`object`&&!!e&&typeof e.value==`number`&&typeof e.code==`string`}function toDate(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!=`string`){let t=dateValueStart(e);if(t===null)return null;let n=new Date(t);return Number.isNaN(n.getTime())?null:n}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function uniqueKey(e){if(isCurrencyValue(e))return`currency:${currencyCode(e)}:${e.value}`;let t=toFiniteNumber(e);return t===null?e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`:`number:${t}`}function isPlainRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function formatComputedResult(e,t,n){if(e==null)return null;let stringifyScalar=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date?String(e):null;switch(t){case`number`:{let t=typeof e==`number`?e:Number(e);return Number.isNaN(t)?null:n===void 0?t:Number(t.toFixed(n))}case`boolean`:return!!e;case`date`:return e instanceof Date?e.toISOString():typeof e==`string`?e:null;case`text`:return String(e);case`select`:if(Array.isArray(e)){for(let t of e){if(t==null)continue;let e=stringifyScalar(t);if(e!==null)return e}return null}return stringifyScalar(e);case`multiselect`:return Array.isArray(e)?e.flatMap(e=>{if(e==null)return[];let t=stringifyScalar(e);return t===null?[]:[t]}):stringifyScalar(e)===null?[]:[String(e)];default:throw Error(`Unsupported computed return type: ${t}`)}}function evaluateComputedAst(e,t){return evaluateAst(e,t)}function evaluateComputedFormula(e,t){return evaluateAst(parseComputedFormula(e),t)}function evaluateComputedFormulaWithResult(e,t,n,r){try{let i=evaluateAst(parseComputedFormula(e),t);return{value:n?formatComputedResult(i,n,r):i}}catch(e){return{value:null,error:e instanceof Error?e.message:String(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:h}).strict(),D=E,O=w.extend({color:h,group:T}).strict(),k=w.extend({color:c.z.string().optional().describe(`A color id`),group:T.optional()}).strict(),A=new Set(k.keyof().options),se=[`options`,`targetAttributeOptions`];function withoutUnknownOptionKeys(e){let t=e;for(let n of se){let r=e[n];if(!Array.isArray(r))continue;let i=!1,a=r.map(e=>!isPlainRecord(e)||Object.keys(e).every(e=>A.has(e))?e:(i=!0,Object.fromEntries(Object.entries(e).filter(([e])=>A.has(e)))));i&&(t={...t,[n]:a})}let n=e.properties;if(isPlainRecord(n)&&Array.isArray(n.definitions)){let e=n.definitions,r=e.map(e=>isPlainRecord(e)?withoutUnknownOptionKeys(e):e);r.some((t,n)=>t!==e[n])&&(t={...t,properties:{...n,definitions:r}})}return t}const j=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(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 M=writeOptionsArraySchema(E),N=writeOptionsArraySchema(D),P=writeOptionsArraySchema(O),ce=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`)}),le=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`)}),F=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`)}),I=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()}),ue=S,L=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()}),R=S,z=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()}),B=S.extend({defaultCountryCode:c.z.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),V=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()}),H=S.extend({options:j.describe(`The workflow statuses, in order`)}),U=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()}),W=S.extend({options:j.describe(`Options`),renderAs:c.z.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),G=S.extend({options:j.describe(`Options`),renderAs:c.z.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),de=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`)}),K={name:b.describe(`Property API name`),label:c.z.string().min(1).describe(`Label people see`),required:c.z.boolean().describe(`Required on every edge`).optional()},fe={id:c.z.string().optional(),objectId:c.z.string().optional(),system:c.z.boolean().optional(),unique:c.z.boolean().optional()},pe=Object.fromEntries(C.map(e=>[e,!0])),q=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],J=[...q,`select`,`multiselect`,`status`],Y={text:I,number:L,checkbox:R,date:z,phone:B,currency:V,location:U,select:W,multiselect:G,status:H},me={...Y,select:W.extend({options:M.describe(`Options`)}),multiselect:G.extend({options:N.describe(`Options`)}),status:H.extend({options:P.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>me[e].omit(pe).shape,storedPropertyMember=e=>c.z.object({...K,...fe,type:c.z.literal(e).describe(`Property type`),...Y[e].shape}).strip(),X=c.z.discriminatedUnion(`type`,J.map(storedPropertyMember)),Z=c.z.object({definitions:c.z.array(X).min(1).max(m.optionsPerAttribute).describe(`Edge properties`)}).strip().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),he=refuseForeignKeys(Object.fromEntries(J.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(K),`type`]);function refuseForeignPropertyKeys(e,t){he(e.type,e,t)}const ge=q.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>c.z.object({...K,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({...K,type:c.z.enum(q).describe(`Property type`),...ge}).strict().superRefine(refuseForeignPropertyKeys)]),_e=c.z.object({definitions:c.z.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`),ve=S.extend({targets:c.z.array(ce).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:le.optional().describe(`Syncs the other side's attribute`),properties:Z.optional()}),ye=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`),currencyCode:c.z.string().length(3).optional().describe(`ISO 4217 code a number result renders with; presentation only`),allowRelations:c.z.boolean().optional().describe(`Whether the expression may read across a relation`),optionsSource:F.optional().describe(`Mirrors an option set`)}),be=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:F.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:I,richtext:ue,number:L,checkbox:R,date:z,phone:B,currency:V,status:H,location:U,select:W,multiselect:G,user:de,relation:ve,formula:ye,rollup:be,document:S.extend({properties:Z.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:g.optional()});switch(e){case`select`:return t.extend({options:M.describe(`Options`)});case`multiselect`:return t.extend({options:N.describe(`Options`)});case`status`:return t.extend({options:P.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=g.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 y}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return normalizeDateValue}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return isPlainRecord}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return validateObjectName}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return validateOptions}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return validateViewName}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return validateAttributeName}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return validateIconName}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return isComputedFunctionName}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return validateLabel}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return dateValueStart}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return formatComputedResult}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return parseComputedFormula}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return parseResourceVisibility}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return isNativeObjectName}}),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 evaluateComputedFormula}}),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 Z}}),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 assertUniqueBy}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return b}}),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 _e}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return d}}),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 q}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return withoutUnknownOptionKeys}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return ComputedFormulaParseError}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return evaluateComputedFormulaWithResult}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return evaluateComputedAst}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return isDateRangeValue}});
@@ -0,0 +1,13 @@
1
+ /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
+ import{SchemaError as e,SchemaErrorCode as t,ValidationError as n}from"./exceptions.mjs";import{t as r}from"./empty-BgAwlO54.mjs";import i,{z as a}from"zod";import{COLORS as o,ICONS as s}from"@stndrds/constants";const c=[`skill`,`memory`,`drives`,`artifact`,`meeting`];function isNativeObjectName(e){return c.includes(e)}const l=[`workspace`,`private`],ee=[`all`,...l];function parseResourceVisibility(e){if(typeof e==`string`&&l.includes(e))return e;throw new n(`visibility must be one of: ${l.join(`, `)} (received: ${String(e)})`,[])}const u=[`id`,`createdAt`,`updatedAt`,`createdBy`,`lastUpdatedBy`,`visibility`,`ownedBy`],d=[...u,`objectId`,`label`,`embeddingText`,`values`,`metadata`,`deletedAt`,`deletedBy`,`schemaVersion`,`owned_by`],te=c,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},ne=Object.keys(o),p=new Set(s),m=a.enum(ne).describe(`A color id from the palette`),h=a.string().superRefine((e,t)=>{p.has(e)||t.addIssue({code:`custom`,message:`Invalid icon name`})}).transform(e=>e);function isDateRangeValue(e){return typeof e==`object`&&!!e&&typeof e.start==`string`}function normalizeDateValue(e,t){return r(e)?null:isDateRangeValue(e)?t.endDate?{start:e.start,end:e.end??null}:e.start:typeof e==`string`?t.endDate?{start:e,end:null}:e:null}function dateValueStart(e){return typeof e==`string`&&e!==``?e:isDateRangeValue(e)&&e.start!==``?e.start:null}const re=new Set(s),g=/^[a-zA-Z_][a-zA-Z0-9_]*$/,ie=/^[a-z][a-z0-9-]*$/,_=f.labelLength,v=i.string().min(1,`Object name cannot be empty`).max(63,`Object name is too long (max 63 characters)`).regex(/^[a-z][a-z0-9-]*$/,{message:`Invalid object name format.
3
+ Name must be in kebab-case (slug format):
4
+ ✅ Valid: 'products', 'user-profiles', 'order-items'
5
+ ❌ Invalid: 'Products', 'userProfiles', 'user_profiles'`});function validateObjectName(n){try{v.parse(n)}catch(n){throw n instanceof i.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(!ie.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=i.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
+ 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=>!d.includes(e),{message:`This is a reserved attribute name. Reserved names: ${d.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
+ 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(d.includes(e))throw Error(`[AttributeBuilder] "${e}" is a reserved name and cannot be used as an attribute name.\nReserved names: ${d.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(!re.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 ae=[`if`,`concat`,`sum`,`avg`,`count`,`min`,`max`,`earliest`,`latest`,`unique`,`first`,`percent_empty`,`percent_not_empty`,`count_empty`,`count_not_empty`,`count_unique`],b={if:{name:`if`,returnType:`branch`,minArgs:3,maxArgs:3},concat:{name:`concat`,returnType:{kind:`scalar`,type:`text`},minArgs:1},sum:{name:`sum`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},avg:{name:`avg`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count:{name:`count`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},min:{name:`min`,returnType:`source_item`,minArgs:1,maxArgs:1},max:{name:`max`,returnType:`source_item`,minArgs:1,maxArgs:1},earliest:{name:`earliest`,returnType:{kind:`scalar`,type:`date`},minArgs:1,maxArgs:1},latest:{name:`latest`,returnType:{kind:`scalar`,type:`date`},minArgs:1,maxArgs:1},unique:{name:`unique`,returnType:`argument`,minArgs:1,maxArgs:1},first:{name:`first`,returnType:`source_item`,minArgs:1,maxArgs:1},percent_empty:{name:`percent_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},percent_not_empty:{name:`percent_not_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count_empty:{name:`count_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count_not_empty:{name:`count_not_empty`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1},count_unique:{name:`count_unique`,returnType:{kind:`scalar`,type:`number`},minArgs:1,maxArgs:1}};function isComputedFunctionName(e){return Object.hasOwn(b,e)}var ComputedFormulaParseError=class extends Error{constructor(e){super(e),this.name=`ComputedFormulaParseError`}};function parseComputedFormula(e){let t=new Parser(tokenize(e)),n=t.parseExpression();return t.expectEnd(),n}function tokenize(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===` `||r===`
12
+ `||r===`\r`){n+=1;continue}if(r===`"`||r===`'`){let i=scanString(e,n,r);t.push({kind:`string`,value:i.value,position:n}),n=i.nextIndex;continue}if(isDigit(r)){let r=scanNumber(e,n);t.push({kind:`number`,value:r.value,position:n}),n=r.nextIndex;continue}if(isIdentifierStart(r)){let r=scanIdentifier(e,n),i=r.value.toLowerCase();i===`true`?t.push({kind:`boolean`,value:!0,position:n}):i===`false`?t.push({kind:`boolean`,value:!1,position:n}):i===`null`?t.push({kind:`null`,position:n}):t.push({kind:`identifier`,value:r.value,position:n}),n=r.nextIndex;continue}let i=e.slice(n,n+2);if(i===`>=`||i===`<=`||i===`==`||i===`!=`){t.push({kind:`operator`,value:i,position:n}),n+=2;continue}if(r===`>`||r===`<`||r===`+`||r===`-`||r===`*`||r===`/`){t.push({kind:`operator`,value:r,position:n}),n+=1;continue}if(r===`(`||r===`)`||r===`,`||r===`.`){t.push({kind:`punctuation`,value:r,position:n}),n+=1;continue}throw new ComputedFormulaParseError(`Unexpected character "${r}" at position ${n}`)}return t}function scanString(e,t,n=`"`){let r=``,i=t+1;for(;i<e.length;){let t=e[i];if(t===n)return{value:r,nextIndex:i+1};if(t===`\\`){let t=e[i+1];if(t===void 0)throw new ComputedFormulaParseError(`Unterminated string literal at position ${i}`);r+=decodeEscape(t,i),i+=2;continue}r+=t,i+=1}throw new ComputedFormulaParseError(`Unterminated string literal at position ${t}`)}function decodeEscape(e,t){switch(e){case`"`:case`\\`:return e;case`n`:return`
13
+ `;case`r`:return`\r`;case`t`:return` `;default:throw new ComputedFormulaParseError(`Unknown escape sequence "\\${e}" at position ${t}`)}}function scanNumber(e,t){let n=t;for(;n<e.length&&isDigit(e[n]);)n+=1;if(e[n]===`.`){let t=n;if(n+=1,!isDigit(e[n]))throw new ComputedFormulaParseError(`Invalid number literal at position ${t}`);for(;n<e.length&&isDigit(e[n]);)n+=1}let r=e.slice(t,n),i=Number(r);if(!Number.isFinite(i))throw new ComputedFormulaParseError(`Invalid number literal "${r}"`);return{value:i,nextIndex:n}}function scanIdentifier(e,t){let n=t+1;for(;n<e.length&&isIdentifierPart(e[n]);)n+=1;return{value:e.slice(t,n),nextIndex:n}}function isDigit(e){return e!==void 0&&e>=`0`&&e<=`9`}function isIdentifierStart(e){return e!==void 0&&/[A-Za-z_]/.test(e)}function isIdentifierPart(e){return e!==void 0&&/[A-Za-z0-9_]/.test(e)}var Parser=class{constructor(e){this.tokens=e,this.position=0}parseExpression(){return this.parseBinaryExpression(0)}expectEnd(){let e=this.peek();if(e!==void 0)throw new ComputedFormulaParseError(`Unexpected token ${describeToken(e)} at position ${e.position}`)}parseBinaryExpression(e){let t=this.parsePrimary();for(;;){let n=this.peek();if(n?.kind!==`operator`)return t;let r=getOperatorPrecedence(n.value);if(r<e)return t;let i=n.value;this.consume();let a=this.parseBinaryExpression(r+1);t={kind:`binary`,operator:i,left:t,right:a}}}parsePrimary(){let e=this.consume();if(e===void 0)throw new ComputedFormulaParseError(`Unexpected end of expression`);switch(e.kind){case`string`:case`number`:case`boolean`:return{kind:`literal`,value:e.value};case`null`:return{kind:`literal`,value:null};case`identifier`:return this.parseIdentifier(e.value);case`punctuation`:if(e.value===`(`){let e=this.parseExpression();return this.expectPunctuation(`)`),e}break;case`operator`:if(e.value===`-`){let e=this.consume();if(e?.kind===`number`)return{kind:`literal`,value:-e.value}}}throw new ComputedFormulaParseError(`Expected literal, path, call, or parenthesized expression at position ${e.position}`)}parseIdentifier(e){if(this.matchPunctuation(`(`)){let t=[];if(!this.matchPunctuation(`)`)){do t.push(this.parseExpression());while(this.matchPunctuation(`,`));this.expectPunctuation(`)`)}return{kind:`call`,functionName:e.toLowerCase(),args:t}}let t=[e];for(;this.matchPunctuation(`.`);){let e=this.consume();if(e?.kind!==`identifier`)throw new ComputedFormulaParseError(`Expected attribute name after path separator at position ${e?.position??this.previousPosition()}`);t.push(e.value)}return{kind:`path`,parts:t}}expectPunctuation(e){if(!this.matchPunctuation(e))throw new ComputedFormulaParseError(`Expected "${e}" at position ${this.peek()?.position??this.previousPosition()}`)}matchPunctuation(e){let t=this.peek();return t?.kind===`punctuation`&&t.value===e&&(this.consume(),!0)}peek(){return this.tokens[this.position]}consume(){let e=this.tokens[this.position];return this.position+=1,e}previousPosition(){return this.tokens[this.position-1]?.position??0}};function describeToken(e){switch(e.kind){case`identifier`:case`number`:case`string`:case`boolean`:case`operator`:case`punctuation`:return`"${String(e.value)}"`;case`null`:return`"null"`;default:return e}}function getOperatorPrecedence(e){switch(e){case`*`:case`/`:return 3;case`+`:case`-`:return 2;case`>`:case`<`:case`>=`:case`<=`:case`==`:case`!=`:return 1;default:return e}}function evaluateAst(e,t){switch(e.kind){case`literal`:return e.value;case`path`:return resolvePath(t,e.parts);case`binary`:return evaluateBinary(e.operator,evaluateAst(e.left,t),evaluateAst(e.right,t));case`call`:return evaluateCallNode(e.functionName,e.args,t);default:return unreachable(e)}}function evaluateCallNode(e,t,n){if(assertComputedFunctionName(e),validateArity(e,t.length),e===`if`){let e=evaluateAst(t[0],n);return e===null?null:evaluateAst(e?t[1]:t[2],n)}return evaluateCall(e,t.map(e=>evaluateAst(e,n)))}function resolvePath(e,t){return t.reduce((e,t)=>resolvePathPart(e,t),e)}function resolvePathPart(e,t){if(Array.isArray(e))return e.map(e=>resolvePathPart(e,t));if(!isPlainRecord(e))return null;if(Object.hasOwn(e,t))return e[t]??null;let n=e.values;return isPlainRecord(n)&&Object.hasOwn(n,t)?n[t]??null:null}function evaluateBinary(e,t,n){switch(e){case`+`:return add(t,n);case`-`:return numericBinary(t,n,(e,t)=>e-t);case`*`:return numericBinary(t,n,(e,t)=>e*t);case`/`:return numericBinary(t,n,(e,t)=>e/t);case`>`:return compareWith(t,n,e=>e>0);case`<`:return compareWith(t,n,e=>e<0);case`>=`:return compareWith(t,n,e=>e>=0);case`<=`:return compareWith(t,n,e=>e<=0);case`==`:return equalScalar(t,n);case`!=`:{let e=equalScalar(t,n);return e===null?null:!e}default:return unreachable(e)}}function add(e,t){return typeof e==`string`||typeof t==`string`?`${e??``}${t??``}`:numericBinary(e,t,(e,t)=>e+t)}function compareWith(e,t,n){let r=compare(e,t);return r===null?null:n(r)}function compare(e,t){if(!areCommensurable([e,t]))return null;let n=toFiniteNumber(e),r=toFiniteNumber(t);if(n!==null&&r!==null)return n-r;let i=toDate(e),a=toDate(t);return i&&a?i.getTime()-a.getTime():null}function equalScalar(e,t){return e===t?!0:e==null||t==null?!1:areCommensurable([e,t])?compare(e,t)===0:null}function assertComputedFunctionName(e){if(!isComputedFunctionName(e))throw Error(`Unknown computed function "${e}"`)}function validateArity(e,t){let{minArgs:n,maxArgs:r}=b[e];if(t>=n&&t<=(r??1/0))return;let i=r===void 0?`at least ${n}`:`between ${n} and ${r}`;throw Error(`Function "${e}" expects ${i} arguments, received ${t}`)}function evaluateCall(e,t){switch(e){case`concat`:return t.filter(e=>e!=null).map(String).join(``);case`sum`:return areCommensurable(t)?numericValues(t).reduce((e,t)=>e+t,0):null;case`avg`:{if(!areCommensurable(t))return null;let e=numericValues(t);return e.length>0?e.reduce((e,t)=>e+t,0)/e.length:null}case`count`:return collectionItems(t[0]).length;case`min`:return minMax(t,`min`);case`max`:return minMax(t,`max`);case`earliest`:return dateMinMax(t,`min`);case`latest`:return dateMinMax(t,`max`);case`unique`:return uniqueNonEmpty(collectionItems(t[0]));case`first`:return collectionItems(t[0]).find(e=>e!=null)??null;case`percent_empty`:return percentByEmptyState(t[0],!0);case`percent_not_empty`:return percentByEmptyState(t[0],!1);case`count_empty`:return collectionItems(t[0]).filter(r).length;case`count_not_empty`:return collectionItems(t[0]).filter(e=>!r(e)).length;case`count_unique`:return uniqueNonEmpty(collectionItems(t[0])).length;default:return unreachable(e)}}function unreachable(e){return e}function numericValues(e){return flatten(e).map(toFiniteNumber).filter(e=>e!==null)}function areCommensurable(e){let t=new Set;for(let n of flatten(e))isCurrencyValue(n)&&t.add(currencyCode(n));return t.size<=1}function currencyCode(e){return e.code.toUpperCase()}function numericBinary(e,t,n){if(!areCommensurable([e,t]))return null;let r=toFiniteNumber(e),i=toFiniteNumber(t);if(r===null||i===null)return null;let a=n(r,i);return Number.isFinite(a)?a:null}function minMax(e,t){if(!areCommensurable(e))return null;let n=numericValues(e);return n.length>0?t===`min`?Math.min(...n):Math.max(...n):dateMinMax(e,t)}function dateMinMax(e,t){let n=flatten(e).map(toDate).filter(e=>e!==null);if(n.length===0)return null;let r=n.map(e=>e.getTime()),i=t===`min`?Math.min(...r):Math.max(...r);return new Date(i).toISOString()}function percentByEmptyState(e,t){let n=collectionItems(e);return n.length===0?0:n.filter(e=>r(e)===t).length/n.length}function uniqueNonEmpty(e){let t=new Set,n=[];for(let i of e){if(r(i))continue;let e=uniqueKey(i);t.has(e)||(t.add(e),n.push(i))}return n}function collectionItems(e){return e==null?[]:Array.isArray(e)?flatten(e):[e]}function flatten(e){return e.flat(1/0)}function toFiniteNumber(e){if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:null}return isCurrencyValue(e)&&Number.isFinite(e.value)?e.value:null}function isCurrencyValue(e){return typeof e==`object`&&!!e&&typeof e.value==`number`&&typeof e.code==`string`}function toDate(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e!=`string`){let t=dateValueStart(e);if(t===null)return null;let n=new Date(t);return Number.isNaN(n.getTime())?null:n}let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function uniqueKey(e){if(isCurrencyValue(e))return`currency:${currencyCode(e)}:${e.value}`;let t=toFiniteNumber(e);return t===null?e instanceof Date?`date:${e.toISOString()}`:`${typeof e}:${JSON.stringify(e)}`:`number:${t}`}function isPlainRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function formatComputedResult(e,t,n){if(e==null)return null;let stringifyScalar=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Date?String(e):null;switch(t){case`number`:{let t=typeof e==`number`?e:Number(e);return Number.isNaN(t)?null:n===void 0?t:Number(t.toFixed(n))}case`boolean`:return!!e;case`date`:return e instanceof Date?e.toISOString():typeof e==`string`?e:null;case`text`:return String(e);case`select`:if(Array.isArray(e)){for(let t of e){if(t==null)continue;let e=stringifyScalar(t);if(e!==null)return e}return null}return stringifyScalar(e);case`multiselect`:return Array.isArray(e)?e.flatMap(e=>{if(e==null)return[];let t=stringifyScalar(e);return t===null?[]:[t]}):stringifyScalar(e)===null?[]:[String(e)];default:throw Error(`Unsupported computed return type: ${t}`)}}function evaluateComputedAst(e,t){return evaluateAst(e,t)}function evaluateComputedFormula(e,t){return evaluateAst(parseComputedFormula(e),t)}function evaluateComputedFormulaWithResult(e,t,n,r){try{let i=evaluateAst(parseComputedFormula(e),t);return{value:n?formatComputedResult(i,n,r):i}}catch(e){return{value:null,error:e instanceof Error?e.message:String(e)}}}const x=a.object({placeholder:a.string().optional(),description:a.string().optional(),defaultValue:a.unknown().optional(),icon:a.string().optional(),order:a.number().int().optional(),hidden:a.boolean().optional(),archived:a.boolean().optional(),deprecated:a.boolean().optional(),metadata:a.record(a.string(),a.unknown()).optional()}),S=[`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 C=a.object({value:a.string().min(1).describe(`Stored value`),label:a.string().min(1).describe(`Label people see`),description:a.string().describe(`Extra context`).optional(),inverse:a.string().describe(`Paired option's value (symmetric)`).optional(),archived:a.boolean().describe(`Hides without deleting`).optional()}),w=a.enum([`idle`,`in_progress`,`finished`]).describe(`Workflow stage`),T=C.extend({color:m}).strict(),E=T,D=C.extend({color:m,group:w}).strict(),O=C.extend({color:a.string().optional().describe(`A color id`),group:w.optional()}).strict(),k=new Set(O.keyof().options),oe=[`options`,`targetAttributeOptions`];function withoutUnknownOptionKeys(e){let t=e;for(let n of oe){let r=e[n];if(!Array.isArray(r))continue;let i=!1,a=r.map(e=>!isPlainRecord(e)||Object.keys(e).every(e=>k.has(e))?e:(i=!0,Object.fromEntries(Object.entries(e).filter(([e])=>k.has(e)))));i&&(t={...t,[n]:a})}let n=e.properties;if(isPlainRecord(n)&&Array.isArray(n.definitions)){let e=n.definitions,r=e.map(e=>isPlainRecord(e)?withoutUnknownOptionKeys(e):e);r.some((t,n)=>t!==e[n])&&(t={...t,properties:{...n,definitions:r}})}return t}const A=a.array(O).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 a.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 j=writeOptionsArraySchema(T),M=writeOptionsArraySchema(E),N=writeOptionsArraySchema(D),se=a.object({object:a.string().min(1).describe(`Target object`),displayTemplate:a.string().optional().describe(`Linked record label template`),filter:a.record(a.string(),a.unknown()).optional().describe(`Restricts linkable records`)}),ce=a.object({object:a.string().min(1).describe(`Other side's object`),attribute:a.string().min(1).describe(`Other side's attribute`),cardinality:a.enum([`one`,`many`]).optional().describe(`Other side's cardinality`),label:a.string().min(1).optional().describe(`Other side's label`),storageOwner:a.boolean().optional().describe(`Owns the join storage`)}),P=a.object({objectName:a.string().min(1).describe(`API name of the object whose options are mirrored`),attributeName:a.string().min(1).describe(`API name of the select/status attribute to mirror options from`),attributeId:a.string().optional().describe(`Id of the source attribute, resolved by the server`)}),F=x.extend({multiline:a.boolean().describe(`Renders as a multi-line textarea`).optional(),minLength:a.number().int().min(0).describe(`Minimum character count`).optional(),maxLength:a.number().int().min(1).describe(`Maximum character count`).optional(),pattern:a.string().describe(`Regular expression the value must match`).optional(),format:a.enum([`email`,`url`,`slug`]).describe(`Validates and renders as this format`).optional()}),I=x,L=x.extend({renderAs:a.enum([`number`,`rating`]).describe(`Plain number or a star rating`).optional(),min:a.number().describe(`Minimum allowed value`).optional(),max:a.number().describe(`Maximum allowed value`).optional(),unit:a.enum([`integer`,`decimal`,`percentage`]).describe(`How the value is stored and rendered`).optional(),decimals:a.number().int().min(0).max(10).describe(`Decimal places shown`).optional()}),R=x,z=x.extend({dateFormat:a.enum([`short`,`long`,`full`,`relative`]).describe(`How the date is rendered`).optional(),minDate:a.string().describe(`Earliest allowed date (ISO)`).optional(),maxDate:a.string().describe(`Latest allowed date (ISO)`).optional(),includeTime:a.boolean().describe(`Also captures a time of day`).optional(),endDate:a.boolean().describe(`Paired with another date attribute as a range's end`).optional(),timeFormat:a.enum([`12h`,`24h`]).describe(`Clock format when a time is included`).optional()}),B=x.extend({defaultCountryCode:a.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),V=x.extend({defaultCurrency:a.string().length(3).describe(`ISO currency code preselected for new values`).optional(),allowedCurrencies:a.array(a.string().length(3)).describe(`ISO currency codes a value may use; any currency when omitted`).optional(),allowNegative:a.boolean().describe(`Whether a negative amount is accepted`).optional()}),H=x.extend({options:A.describe(`The workflow statuses, in order`)}),U=x.extend({granularity:a.enum([`full`,`address`,`city`,`state`,`country`,`coordinates`]).describe(`How precise a location must be captured`).optional(),defaultCountry:a.string().length(3).describe(`ISO country code preselected for new values`).optional(),allowedCountries:a.array(a.string().length(3)).describe(`ISO country codes a value may use; any country when omitted`).optional()}),W=x.extend({options:A.describe(`Options`),renderAs:a.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),G=x.extend({options:A.describe(`Options`),renderAs:a.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),le=x.extend({types:a.array(a.enum([`user`,`agent`])).min(1).optional().describe(`Which kinds of actor can be picked; both when omitted`),multiple:a.boolean().optional().describe(`Whether more than one actor can be picked`)}),K={name:y.describe(`Property API name`),label:a.string().min(1).describe(`Label people see`),required:a.boolean().describe(`Required on every edge`).optional()},ue={id:a.string().optional(),objectId:a.string().optional(),system:a.boolean().optional(),unique:a.boolean().optional()},de=Object.fromEntries(S.map(e=>[e,!0])),q=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],J=[...q,`select`,`multiselect`,`status`],Y={text:F,number:L,checkbox:R,date:z,phone:B,currency:V,location:U,select:W,multiselect:G,status:H},fe={...Y,select:W.extend({options:j.describe(`Options`)}),multiselect:G.extend({options:M.describe(`Options`)}),status:H.extend({options:N.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>fe[e].omit(de).shape,storedPropertyMember=e=>a.object({...K,...ue,type:a.literal(e).describe(`Property type`),...Y[e].shape}).strip(),X=a.discriminatedUnion(`type`,J.map(storedPropertyMember)),Z=a.object({definitions:a.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`),pe=refuseForeignKeys(Object.fromEntries(J.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(K),`type`]);function refuseForeignPropertyKeys(e,t){pe(e.type,e,t)}const me=q.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>a.object({...K,type:e.length===1?a.literal(e[0]).describe(`Property type`):a.enum(e).describe(`Property type`),...propertyWireConfigShapeFor(e[0])}).strict(),Q=a.discriminatedUnion(`type`,[optionPropertyWireMember([`select`,`multiselect`]),optionPropertyWireMember([`status`]),a.object({...K,type:a.enum(q).describe(`Property type`),...me}).strict().superRefine(refuseForeignPropertyKeys)]),he=a.object({definitions:a.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`),ge=x.extend({targets:a.array(se).min(1).describe(`Target object(s)`),cardinality:a.enum([`one`,`many`]).describe(`one or many`),maxItems:a.number().int().min(1).optional().describe(`Max linked records`),bilateral:ce.optional().describe(`Syncs the other side's attribute`),properties:Z.optional()}),_e=x.extend({expression:a.string().min(1).superRefine((e,t)=>{try{parseComputedFormula(e)}catch(e){t.addIssue({code:a.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid formula expression`})}}).describe(`The formula expression, compiled against this object's attributes`),returnType:a.enum([`text`,`number`,`boolean`,`date`,`select`,`multiselect`]).describe(`The formula's result type`),decimals:a.number().int().min(0).max(10).optional().describe(`Decimal places shown for a number result`),currencyCode:a.string().length(3).optional().describe(`ISO 4217 code a number result renders with; presentation only`),allowRelations:a.boolean().optional().describe(`Whether the expression may read across a relation`),optionsSource:P.optional().describe(`Mirrors an option set`)}),ve=x.extend({relationAttribute:a.string().min(1).optional().describe(`API name of the relation this rollup aggregates through`),relationPath:a.string().optional().describe(`Not supported yet — single-hop only`),targetAttribute:a.string().min(1).optional().describe(`API name of the attribute aggregated on the relation's target object; not read by count`),function:a.enum([`sum`,`avg`,`earliest`,`latest`,`count`,`countValues`,`countUniqueValues`,`countEmpty`,`percentEmpty`,`percentNotEmpty`,`original`]).describe(`The aggregation applied across the linked records`),decimals:a.number().int().min(0).max(10).optional().describe(`Decimal places shown for a numeric result`),targetAttributeType:a.string().optional().describe(`Server-set`),targetAttributeOptions:a.array(O).optional().describe(`Server-set`),targetCurrencyCode:a.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:I,number:L,checkbox:R,date:z,phone:B,currency:V,status:H,location:U,select:W,multiselect:G,user:le,relation:ge,formula:_e,rollup:ve,document:x.extend({properties:Z.optional(),accepts:a.array(a.string().min(1)).optional().describe("MIME prefixes or globs a file must match (e.g. `image/*`, `*.pdf`)"),maxFileSize:a.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: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 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{v as A,normalizeDateValue as B,isPlainRecord as C,ae as D,b as E,validateObjectName as F,d as G,h as H,validateOptions as I,u as J,te as K,validateViewName as L,validateAttributeName as M,validateIconName as N,isComputedFunctionName as O,validateLabel as P,dateValueStart as R,formatComputedResult as S,parseComputedFormula as T,f as U,m as V,ee as W,c as X,parseResourceVisibility as Y,isNativeObjectName as Z,D as _,getAttributeConfigWriteSchema as a,evaluateComputedFormula as b,parseAttributeConfigForCreate as c,Q as d,Z as f,w as g,T as h,getAttributeConfigSchema as i,assertUniqueBy as j,y as k,parseAttributeConfigForUpdate as l,refuseForeignKeys as m,S as n,E as o,he as p,l as q,$ as r,parseAttributeConfig as s,q as t,X as u,withoutUnknownOptionKeys as v,ComputedFormulaParseError as w,evaluateComputedFormulaWithResult as x,evaluateComputedAst as y,isDateRangeValue as z};
@@ -1,6 +1,6 @@
1
1
 
2
- import { u as DateAttribute } from "./attributes-mMmH-WOx.mjs";
3
- import { r as ValidationMessages } from "./index-BV4yNsr7.mjs";
2
+ import { u as DateAttribute } from "./attributes-BrWmES5w.mjs";
3
+ import { r as ValidationMessages } from "./index-DggAjGTr.mjs";
4
4
  import { z as z$1 } from "zod";
5
5
  //#region src/validation/primitives/date.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
 
2
- import { u as DateAttribute } from "./attributes-C2gm0hUJ.js";
3
- import { r as ValidationMessages } from "./index-BL7EA39F.js";
2
+ import { u as DateAttribute } from "./attributes-DF899HOt.js";
3
+ import { r as ValidationMessages } from "./index-OvRk1isl.js";
4
4
  import { z as z$1 } from "zod";
5
5
  //#region src/validation/primitives/date.d.ts
6
6
  /**
@@ -0,0 +1,2 @@
1
+ /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
+ function isNullishOrEmptyString(e){return e==null||e===``}function isValuePresent(e){return e==null?!1:typeof e==`string`?e.trim()!==``:!Array.isArray(e)||e.length>0}export{isValuePresent as n,isNullishOrEmptyString as t};
@@ -0,0 +1,2 @@
1
+ /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
+ function isNullishOrEmptyString(e){return e==null||e===``}function isValuePresent(e){return e==null?!1:typeof e==`string`?e.trim()!==``:!Array.isArray(e)||e.length>0}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return isValuePresent}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return isNullishOrEmptyString}});
@@ -71,12 +71,14 @@ declare const SchemaErrorCode: {
71
71
  readonly OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED";
72
72
  readonly CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED";
73
73
  readonly SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED";
74
- readonly CRON_REGISTRATION_FAILED: "CRON_REGISTRATION_FAILED";
75
- /** Worker transport cleanup did not prove exclusive ownership was released. */
76
- readonly JOB_WORKER_SHUTDOWN_FAILED: "JOB_WORKER_SHUTDOWN_FAILED";
77
74
  readonly SEARCH_BACKEND_FAILED: "SEARCH_BACKEND_FAILED";
75
+ readonly SEARCH_BACKEND_REJECTED: "SEARCH_BACKEND_REJECTED";
78
76
  readonly INVARIANT_VIOLATION: "INVARIANT_VIOLATION";
79
77
  readonly TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING";
78
+ /** A Hatchet run's metadata does not match the outbox row that produced it — a forged or replayed run (403). */
79
+ readonly JOB_RUN_METADATA_MISMATCH: "JOB_RUN_METADATA_MISMATCH";
80
+ /** A coalesced run failed and the coalescing primitive already handled it (items given back or dropped and reported). */
81
+ readonly JOB_COALESCED_FAILURE_HANDLED: "JOB_COALESCED_FAILURE_HANDLED";
80
82
  readonly FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT";
81
83
  readonly REALTIME_RATE_LIMITED: "REALTIME_RATE_LIMITED";
82
84
  readonly REALTIME_DELIVERY_FAILED: "REALTIME_DELIVERY_FAILED";
@@ -112,6 +114,7 @@ declare const SchemaErrorCode: {
112
114
  readonly AGENT_TOOL_CANCELLATION_POLICY: "AGENT_TOOL_CANCELLATION_POLICY";
113
115
  readonly AGENT_CANCELLATION_WATCH_CAPACITY: "AGENT_CANCELLATION_WATCH_CAPACITY";
114
116
  readonly AGENT_CANCELLATION_CLEANUP: "AGENT_CANCELLATION_CLEANUP";
117
+ readonly AGENT_TURN_FINALIZER_STALLED: "AGENT_TURN_FINALIZER_STALLED";
115
118
  readonly DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND";
116
119
  readonly DEVICE_OFFLINE: "DEVICE_OFFLINE";
117
120
  readonly DEVICE_CAPABILITY_MISMATCH: "DEVICE_CAPABILITY_MISMATCH";
@@ -439,16 +442,49 @@ declare class RepositoryError extends SchemaError {
439
442
  constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
440
443
  }
441
444
  /**
442
- * Error thrown when a search read call fails at the transport level — e.g. the
443
- * Meili client received a non-JSON body (`JSON.parse` SyntaxError) or a network
444
- * failure. Translates an otherwise un-fingerprintable bare exception into a
445
- * typed error with a stable `code` and a user-safe message. The original
446
- * failure text is preserved in `cause`/`details`, never in the message.
445
+ * Why a search backend call failed, as far as retrying is concerned.
446
+ *
447
+ * - `unavailable` — transport-level or otherwise transient: the backend was
448
+ * unreachable, answered garbage, or a task failed for a reason a later
449
+ * attempt may not meet. Worth retrying.
450
+ * - `capacity` — the backend is out of storage (disk full, database size
451
+ * limit). Every retry fails the same way, and on a full disk each one
452
+ * allocates more temporary files.
453
+ * - `rejected` — the backend refused this payload (malformed, too large).
454
+ * Deterministic: the same payload is refused again.
455
+ */
456
+ type SearchBackendFailureKind = "unavailable" | "capacity" | "rejected";
457
+ interface SearchBackendErrorOptions {
458
+ /** Defaults to `unavailable`. */
459
+ kind?: SearchBackendFailureKind;
460
+ /** The backend's own machine code, e.g. Meili's `malformed_payload`. */
461
+ backendCode?: string;
462
+ /**
463
+ * A fixed phrase the adapter chose from what it recognised — e.g.
464
+ * "No space left on device (os error 28)". Never raw backend text: the
465
+ * message is exported to telemetry as a template.
466
+ */
467
+ detail?: string;
468
+ }
469
+ /**
470
+ * Error thrown when a search backend call fails — e.g. the Meili client
471
+ * received a non-JSON body (`JSON.parse` SyntaxError), a network failure, or
472
+ * a write the backend refused. Translates an otherwise un-fingerprintable bare
473
+ * exception into a typed error with a stable `code` and a user-safe message.
474
+ * The original failure text is preserved in `cause`/`details`, never in the
475
+ * message.
476
+ *
477
+ * A refusal the backend will repeat (`capacity`, `rejected`, #4306) takes
478
+ * `SEARCH_BACKEND_REJECTED` and names the backend's code and the adapter's
479
+ * fixed `detail` in its message, so a full disk pages as itself rather than
480
+ * as a transient outage.
447
481
  */
448
482
  declare class SearchBackendError extends SchemaError {
449
483
  readonly scope: string;
450
484
  readonly cause?: string;
451
- constructor(scope: string, cause?: string);
485
+ readonly kind: SearchBackendFailureKind;
486
+ readonly backendCode?: string;
487
+ constructor(scope: string, cause?: string, options?: SearchBackendErrorOptions);
452
488
  }
453
489
  /**
454
490
  * Error thrown when a feature or method is not yet implemented
@@ -551,4 +587,4 @@ declare function isAttributeInUseError(error: unknown): error is AttributeInUseE
551
587
  */
552
588
  declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
553
589
  //#endregion
554
- export { SearchBackendError as A, isNotFoundError as B, RepositoryError as C, SchemaError as D, RoleNotFoundError as E, SyncError as F, isValidationError as G, isProtectedResourceError as H, SystemEntityImmutableError as I, ValidationError as L, StorageOperation as M, SyncCascadeError as N, SchemaErrorCode as O, SyncConflictError as P, ValidationErrorDetail as R, RecordReferencedError as S, ReservedObjectNameError as T, isRecordReferencedError as U, isObjectReferencedError as V, isSchemaError as W, RealtimeDeliveryError as _, AttributeUsage as a, RecordNotFoundError as b, ForbiddenError as c, NotImplementedError as d, ObjectNotFoundError as f, ProtectedRoleError as g, ProtectedResourceError as h, AttributeNotFoundError as i, StorageError as j, SchemaPlanNotFoundError as k, MemoryNotFoundError as l, OrphanSystemAttributeError as m, AmbiguousSchemaChangeError as n, ConcurrentModificationError as o, ObjectReferencedError as p, AttributeInUseError as r, DuplicateError as s, AccessDeniedError as t, NotFoundError as u, RealtimeRateLimitedError as v, RepositoryOperation as w, RecordReference as x, RealtimeSubscriptionError as y, isAttributeInUseError as z };
590
+ export { SearchBackendError as A, ValidationErrorDetail as B, RepositoryError as C, SchemaError as D, RoleNotFoundError as E, SyncCascadeError as F, isRecordReferencedError as G, isNotFoundError as H, SyncConflictError as I, isSchemaError as K, SyncError as L, SearchBackendFailureKind as M, StorageError as N, SchemaErrorCode as O, StorageOperation as P, SystemEntityImmutableError as R, RecordReferencedError as S, ReservedObjectNameError as T, isObjectReferencedError as U, isAttributeInUseError as V, isProtectedResourceError as W, RealtimeDeliveryError as _, AttributeUsage as a, RecordNotFoundError as b, ForbiddenError as c, NotImplementedError as d, ObjectNotFoundError as f, ProtectedRoleError as g, ProtectedResourceError as h, AttributeNotFoundError as i, SearchBackendErrorOptions as j, SchemaPlanNotFoundError as k, MemoryNotFoundError as l, OrphanSystemAttributeError as m, AmbiguousSchemaChangeError as n, ConcurrentModificationError as o, ObjectReferencedError as p, isValidationError as q, AttributeInUseError as r, DuplicateError as s, AccessDeniedError as t, NotFoundError as u, RealtimeRateLimitedError as v, RepositoryOperation as w, RecordReference as x, RealtimeSubscriptionError as y, ValidationError as z };
@@ -71,12 +71,14 @@ declare const SchemaErrorCode: {
71
71
  readonly OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED";
72
72
  readonly CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED";
73
73
  readonly SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED";
74
- readonly CRON_REGISTRATION_FAILED: "CRON_REGISTRATION_FAILED";
75
- /** Worker transport cleanup did not prove exclusive ownership was released. */
76
- readonly JOB_WORKER_SHUTDOWN_FAILED: "JOB_WORKER_SHUTDOWN_FAILED";
77
74
  readonly SEARCH_BACKEND_FAILED: "SEARCH_BACKEND_FAILED";
75
+ readonly SEARCH_BACKEND_REJECTED: "SEARCH_BACKEND_REJECTED";
78
76
  readonly INVARIANT_VIOLATION: "INVARIANT_VIOLATION";
79
77
  readonly TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING";
78
+ /** A Hatchet run's metadata does not match the outbox row that produced it — a forged or replayed run (403). */
79
+ readonly JOB_RUN_METADATA_MISMATCH: "JOB_RUN_METADATA_MISMATCH";
80
+ /** A coalesced run failed and the coalescing primitive already handled it (items given back or dropped and reported). */
81
+ readonly JOB_COALESCED_FAILURE_HANDLED: "JOB_COALESCED_FAILURE_HANDLED";
80
82
  readonly FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT";
81
83
  readonly REALTIME_RATE_LIMITED: "REALTIME_RATE_LIMITED";
82
84
  readonly REALTIME_DELIVERY_FAILED: "REALTIME_DELIVERY_FAILED";
@@ -112,6 +114,7 @@ declare const SchemaErrorCode: {
112
114
  readonly AGENT_TOOL_CANCELLATION_POLICY: "AGENT_TOOL_CANCELLATION_POLICY";
113
115
  readonly AGENT_CANCELLATION_WATCH_CAPACITY: "AGENT_CANCELLATION_WATCH_CAPACITY";
114
116
  readonly AGENT_CANCELLATION_CLEANUP: "AGENT_CANCELLATION_CLEANUP";
117
+ readonly AGENT_TURN_FINALIZER_STALLED: "AGENT_TURN_FINALIZER_STALLED";
115
118
  readonly DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND";
116
119
  readonly DEVICE_OFFLINE: "DEVICE_OFFLINE";
117
120
  readonly DEVICE_CAPABILITY_MISMATCH: "DEVICE_CAPABILITY_MISMATCH";
@@ -439,16 +442,49 @@ declare class RepositoryError extends SchemaError {
439
442
  constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
440
443
  }
441
444
  /**
442
- * Error thrown when a search read call fails at the transport level — e.g. the
443
- * Meili client received a non-JSON body (`JSON.parse` SyntaxError) or a network
444
- * failure. Translates an otherwise un-fingerprintable bare exception into a
445
- * typed error with a stable `code` and a user-safe message. The original
446
- * failure text is preserved in `cause`/`details`, never in the message.
445
+ * Why a search backend call failed, as far as retrying is concerned.
446
+ *
447
+ * - `unavailable` — transport-level or otherwise transient: the backend was
448
+ * unreachable, answered garbage, or a task failed for a reason a later
449
+ * attempt may not meet. Worth retrying.
450
+ * - `capacity` — the backend is out of storage (disk full, database size
451
+ * limit). Every retry fails the same way, and on a full disk each one
452
+ * allocates more temporary files.
453
+ * - `rejected` — the backend refused this payload (malformed, too large).
454
+ * Deterministic: the same payload is refused again.
455
+ */
456
+ type SearchBackendFailureKind = "unavailable" | "capacity" | "rejected";
457
+ interface SearchBackendErrorOptions {
458
+ /** Defaults to `unavailable`. */
459
+ kind?: SearchBackendFailureKind;
460
+ /** The backend's own machine code, e.g. Meili's `malformed_payload`. */
461
+ backendCode?: string;
462
+ /**
463
+ * A fixed phrase the adapter chose from what it recognised — e.g.
464
+ * "No space left on device (os error 28)". Never raw backend text: the
465
+ * message is exported to telemetry as a template.
466
+ */
467
+ detail?: string;
468
+ }
469
+ /**
470
+ * Error thrown when a search backend call fails — e.g. the Meili client
471
+ * received a non-JSON body (`JSON.parse` SyntaxError), a network failure, or
472
+ * a write the backend refused. Translates an otherwise un-fingerprintable bare
473
+ * exception into a typed error with a stable `code` and a user-safe message.
474
+ * The original failure text is preserved in `cause`/`details`, never in the
475
+ * message.
476
+ *
477
+ * A refusal the backend will repeat (`capacity`, `rejected`, #4306) takes
478
+ * `SEARCH_BACKEND_REJECTED` and names the backend's code and the adapter's
479
+ * fixed `detail` in its message, so a full disk pages as itself rather than
480
+ * as a transient outage.
447
481
  */
448
482
  declare class SearchBackendError extends SchemaError {
449
483
  readonly scope: string;
450
484
  readonly cause?: string;
451
- constructor(scope: string, cause?: string);
485
+ readonly kind: SearchBackendFailureKind;
486
+ readonly backendCode?: string;
487
+ constructor(scope: string, cause?: string, options?: SearchBackendErrorOptions);
452
488
  }
453
489
  /**
454
490
  * Error thrown when a feature or method is not yet implemented
@@ -551,4 +587,4 @@ declare function isAttributeInUseError(error: unknown): error is AttributeInUseE
551
587
  */
552
588
  declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
553
589
  //#endregion
554
- export { SearchBackendError as A, isNotFoundError as B, RepositoryError as C, SchemaError as D, RoleNotFoundError as E, SyncError as F, isValidationError as G, isProtectedResourceError as H, SystemEntityImmutableError as I, ValidationError as L, StorageOperation as M, SyncCascadeError as N, SchemaErrorCode as O, SyncConflictError as P, ValidationErrorDetail as R, RecordReferencedError as S, ReservedObjectNameError as T, isRecordReferencedError as U, isObjectReferencedError as V, isSchemaError as W, RealtimeDeliveryError as _, AttributeUsage as a, RecordNotFoundError as b, ForbiddenError as c, NotImplementedError as d, ObjectNotFoundError as f, ProtectedRoleError as g, ProtectedResourceError as h, AttributeNotFoundError as i, StorageError as j, SchemaPlanNotFoundError as k, MemoryNotFoundError as l, OrphanSystemAttributeError as m, AmbiguousSchemaChangeError as n, ConcurrentModificationError as o, ObjectReferencedError as p, AttributeInUseError as r, DuplicateError as s, AccessDeniedError as t, NotFoundError as u, RealtimeRateLimitedError as v, RepositoryOperation as w, RecordReference as x, RealtimeSubscriptionError as y, isAttributeInUseError as z };
590
+ export { SearchBackendError as A, ValidationErrorDetail as B, RepositoryError as C, SchemaError as D, RoleNotFoundError as E, SyncCascadeError as F, isRecordReferencedError as G, isNotFoundError as H, SyncConflictError as I, isSchemaError as K, SyncError as L, SearchBackendFailureKind as M, StorageError as N, SchemaErrorCode as O, StorageOperation as P, SystemEntityImmutableError as R, RecordReferencedError as S, ReservedObjectNameError as T, isObjectReferencedError as U, isAttributeInUseError as V, isProtectedResourceError as W, RealtimeDeliveryError as _, AttributeUsage as a, RecordNotFoundError as b, ForbiddenError as c, NotImplementedError as d, ObjectNotFoundError as f, ProtectedRoleError as g, ProtectedResourceError as h, AttributeNotFoundError as i, SearchBackendErrorOptions as j, SchemaPlanNotFoundError as k, MemoryNotFoundError as l, OrphanSystemAttributeError as m, AmbiguousSchemaChangeError as n, ConcurrentModificationError as o, ObjectReferencedError as p, isValidationError as q, AttributeInUseError as r, DuplicateError as s, AccessDeniedError as t, NotFoundError as u, RealtimeRateLimitedError as v, RepositoryOperation as w, RecordReference as x, RealtimeSubscriptionError as y, ValidationError as z };
@@ -1,3 +1,3 @@
1
1
 
2
- import { A as SearchBackendError, B as isNotFoundError, C as RepositoryError, D as SchemaError, E as RoleNotFoundError, F as SyncError, G as isValidationError, H as isProtectedResourceError, I as SystemEntityImmutableError, L as ValidationError, M as StorageOperation, N as SyncCascadeError, O as SchemaErrorCode, P as SyncConflictError, R as ValidationErrorDetail, S as RecordReferencedError, T as ReservedObjectNameError, U as isRecordReferencedError, V as isObjectReferencedError, W as isSchemaError, _ as RealtimeDeliveryError, a as AttributeUsage, b as RecordNotFoundError, c as ForbiddenError, d as NotImplementedError, f as ObjectNotFoundError, g as ProtectedRoleError, h as ProtectedResourceError, i as AttributeNotFoundError, j as StorageError, k as SchemaPlanNotFoundError, l as MemoryNotFoundError, m as OrphanSystemAttributeError, n as AmbiguousSchemaChangeError, o as ConcurrentModificationError, p as ObjectReferencedError, r as AttributeInUseError, s as DuplicateError, t as AccessDeniedError, u as NotFoundError, v as RealtimeRateLimitedError, w as RepositoryOperation, x as RecordReference, y as RealtimeSubscriptionError, z as isAttributeInUseError } from "./exceptions-DxzT8POW.mjs";
3
- export { AccessDeniedError, AmbiguousSchemaChangeError, AttributeInUseError, AttributeNotFoundError, AttributeUsage, ConcurrentModificationError, DuplicateError, ForbiddenError, MemoryNotFoundError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RealtimeDeliveryError, RealtimeRateLimitedError, RealtimeSubscriptionError, RecordNotFoundError, RecordReference, RecordReferencedError, RepositoryError, RepositoryOperation, ReservedObjectNameError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, StorageError, StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
2
+ import { A as SearchBackendError, B as ValidationErrorDetail, C as RepositoryError, D as SchemaError, E as RoleNotFoundError, F as SyncCascadeError, G as isRecordReferencedError, H as isNotFoundError, I as SyncConflictError, K as isSchemaError, L as SyncError, M as SearchBackendFailureKind, N as StorageError, O as SchemaErrorCode, P as StorageOperation, R as SystemEntityImmutableError, S as RecordReferencedError, T as ReservedObjectNameError, U as isObjectReferencedError, V as isAttributeInUseError, W as isProtectedResourceError, _ as RealtimeDeliveryError, a as AttributeUsage, b as RecordNotFoundError, c as ForbiddenError, d as NotImplementedError, f as ObjectNotFoundError, g as ProtectedRoleError, h as ProtectedResourceError, i as AttributeNotFoundError, j as SearchBackendErrorOptions, k as SchemaPlanNotFoundError, l as MemoryNotFoundError, m as OrphanSystemAttributeError, n as AmbiguousSchemaChangeError, o as ConcurrentModificationError, p as ObjectReferencedError, q as isValidationError, r as AttributeInUseError, s as DuplicateError, t as AccessDeniedError, u as NotFoundError, v as RealtimeRateLimitedError, w as RepositoryOperation, x as RecordReference, y as RealtimeSubscriptionError, z as ValidationError } from "./exceptions-DrrzAhuA.mjs";
3
+ export { AccessDeniedError, AmbiguousSchemaChangeError, AttributeInUseError, AttributeNotFoundError, AttributeUsage, ConcurrentModificationError, DuplicateError, ForbiddenError, MemoryNotFoundError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RealtimeDeliveryError, RealtimeRateLimitedError, RealtimeSubscriptionError, RecordNotFoundError, RecordReference, RecordReferencedError, RepositoryError, RepositoryOperation, ReservedObjectNameError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, SearchBackendErrorOptions, SearchBackendFailureKind, StorageError, StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
@@ -1,3 +1,3 @@
1
1
 
2
- import { A as SearchBackendError, B as isNotFoundError, C as RepositoryError, D as SchemaError, E as RoleNotFoundError, F as SyncError, G as isValidationError, H as isProtectedResourceError, I as SystemEntityImmutableError, L as ValidationError, M as StorageOperation, N as SyncCascadeError, O as SchemaErrorCode, P as SyncConflictError, R as ValidationErrorDetail, S as RecordReferencedError, T as ReservedObjectNameError, U as isRecordReferencedError, V as isObjectReferencedError, W as isSchemaError, _ as RealtimeDeliveryError, a as AttributeUsage, b as RecordNotFoundError, c as ForbiddenError, d as NotImplementedError, f as ObjectNotFoundError, g as ProtectedRoleError, h as ProtectedResourceError, i as AttributeNotFoundError, j as StorageError, k as SchemaPlanNotFoundError, l as MemoryNotFoundError, m as OrphanSystemAttributeError, n as AmbiguousSchemaChangeError, o as ConcurrentModificationError, p as ObjectReferencedError, r as AttributeInUseError, s as DuplicateError, t as AccessDeniedError, u as NotFoundError, v as RealtimeRateLimitedError, w as RepositoryOperation, x as RecordReference, y as RealtimeSubscriptionError, z as isAttributeInUseError } from "./exceptions-DxzT8POW.js";
3
- export { AccessDeniedError, AmbiguousSchemaChangeError, AttributeInUseError, AttributeNotFoundError, AttributeUsage, ConcurrentModificationError, DuplicateError, ForbiddenError, MemoryNotFoundError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RealtimeDeliveryError, RealtimeRateLimitedError, RealtimeSubscriptionError, RecordNotFoundError, RecordReference, RecordReferencedError, RepositoryError, RepositoryOperation, ReservedObjectNameError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, StorageError, StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
2
+ import { A as SearchBackendError, B as ValidationErrorDetail, C as RepositoryError, D as SchemaError, E as RoleNotFoundError, F as SyncCascadeError, G as isRecordReferencedError, H as isNotFoundError, I as SyncConflictError, K as isSchemaError, L as SyncError, M as SearchBackendFailureKind, N as StorageError, O as SchemaErrorCode, P as StorageOperation, R as SystemEntityImmutableError, S as RecordReferencedError, T as ReservedObjectNameError, U as isObjectReferencedError, V as isAttributeInUseError, W as isProtectedResourceError, _ as RealtimeDeliveryError, a as AttributeUsage, b as RecordNotFoundError, c as ForbiddenError, d as NotImplementedError, f as ObjectNotFoundError, g as ProtectedRoleError, h as ProtectedResourceError, i as AttributeNotFoundError, j as SearchBackendErrorOptions, k as SchemaPlanNotFoundError, l as MemoryNotFoundError, m as OrphanSystemAttributeError, n as AmbiguousSchemaChangeError, o as ConcurrentModificationError, p as ObjectReferencedError, q as isValidationError, r as AttributeInUseError, s as DuplicateError, t as AccessDeniedError, u as NotFoundError, v as RealtimeRateLimitedError, w as RepositoryOperation, x as RecordReference, y as RealtimeSubscriptionError, z as ValidationError } from "./exceptions-DrrzAhuA.js";
3
+ export { AccessDeniedError, AmbiguousSchemaChangeError, AttributeInUseError, AttributeNotFoundError, AttributeUsage, ConcurrentModificationError, DuplicateError, ForbiddenError, MemoryNotFoundError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RealtimeDeliveryError, RealtimeRateLimitedError, RealtimeSubscriptionError, RecordNotFoundError, RecordReference, RecordReferencedError, RepositoryError, RepositoryOperation, ReservedObjectNameError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, SearchBackendErrorOptions, SearchBackendFailureKind, StorageError, StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
@@ -1,2 +1,2 @@
1
1
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e={DRAFT_REVISION_CONFLICT:`DRAFT_REVISION_CONFLICT`,UNKNOWN:`SCHEMA_UNKNOWN_ERROR`,OBJECT_NOT_FOUND:`SCHEMA_OBJECT_NOT_FOUND`,ATTRIBUTE_NOT_FOUND:`SCHEMA_ATTRIBUTE_NOT_FOUND`,RECORD_NOT_FOUND:`SCHEMA_RECORD_NOT_FOUND`,SOURCE_NOT_FOUND:`SCHEMA_SOURCE_NOT_FOUND`,ROLE_NOT_FOUND:`SCHEMA_ROLE_NOT_FOUND`,MEMORY_NOT_FOUND:`SCHEMA_MEMORY_NOT_FOUND`,SCHEMA_PLAN_NOT_FOUND:`SCHEMA_PLAN_NOT_FOUND`,VALIDATION_FAILED:`SCHEMA_VALIDATION_FAILED`,INVALID_ATTRIBUTE_NAME:`SCHEMA_INVALID_ATTRIBUTE_NAME`,INVALID_OBJECT_NAME:`SCHEMA_INVALID_OBJECT_NAME`,RESERVED_OBJECT_NAME:`SCHEMA_RESERVED_OBJECT_NAME`,PROTECTED_OBJECT:`SCHEMA_PROTECTED_OBJECT`,PROTECTED_ATTRIBUTE:`SCHEMA_PROTECTED_ATTRIBUTE`,PROTECTED_VIEW:`SCHEMA_PROTECTED_VIEW`,PROTECTED_ROLE:`SCHEMA_PROTECTED_ROLE`,FORBIDDEN:`SCHEMA_FORBIDDEN`,ACCESS_DENIED:`SCHEMA_ACCESS_DENIED`,WORKSPACE_INVARIANT:`SCHEMA_WORKSPACE_INVARIANT`,STATE_GATE:`SCHEMA_STATE_GATE`,ACTOR_CONTEXT_REQUIRED:`SCHEMA_ACTOR_CONTEXT_REQUIRED`,CONNECTOR_AUTH_FAILED:`SCHEMA_CONNECTOR_AUTH_FAILED`,CONNECTOR_INVALID_STATE:`SCHEMA_CONNECTOR_INVALID_STATE`,CONNECTOR_GRANT_ORPHANED:`SCHEMA_CONNECTOR_GRANT_ORPHANED`,SYNC_FAILED:`SCHEMA_SYNC_FAILED`,SYNC_CONFLICT:`SCHEMA_SYNC_CONFLICT`,SYNC_CASCADE:`SCHEMA_SYNC_CASCADE`,ORPHAN_SYSTEM_ATTRIBUTE:`SCHEMA_ORPHAN_SYSTEM_ATTRIBUTE`,SYSTEM_ENTITY_IMMUTABLE:`SCHEMA_SYSTEM_ENTITY_IMMUTABLE`,AMBIGUOUS_CHANGE:`SCHEMA_AMBIGUOUS_CHANGE`,DUPLICATE:`SCHEMA_DUPLICATE`,DUPLICATE_OBJECT:`SCHEMA_DUPLICATE_OBJECT`,DUPLICATE_ATTRIBUTE:`SCHEMA_DUPLICATE_ATTRIBUTE`,CONFLICT:`SCHEMA_CONFLICT`,STORAGE_UPLOAD_FAILED:`SCHEMA_STORAGE_UPLOAD_FAILED`,STORAGE_DOWNLOAD_FAILED:`SCHEMA_STORAGE_DOWNLOAD_FAILED`,STORAGE_DELETE_FAILED:`SCHEMA_STORAGE_DELETE_FAILED`,STORAGE_URL_FAILED:`SCHEMA_STORAGE_URL_FAILED`,REPOSITORY_CREATE_FAILED:`SCHEMA_REPOSITORY_CREATE_FAILED`,REPOSITORY_UPDATE_FAILED:`SCHEMA_REPOSITORY_UPDATE_FAILED`,REPOSITORY_DELETE_FAILED:`SCHEMA_REPOSITORY_DELETE_FAILED`,REPOSITORY_QUERY_FAILED:`SCHEMA_REPOSITORY_QUERY_FAILED`,NOT_IMPLEMENTED:`SCHEMA_NOT_IMPLEMENTED`,TIMEOUT:`SCHEMA_TIMEOUT`,RECORD_REFERENCED:`SCHEMA_RECORD_REFERENCED`,ATTRIBUTE_IN_USE:`SCHEMA_ATTRIBUTE_IN_USE`,OBJECT_REFERENCED:`SCHEMA_OBJECT_REFERENCED`,CONFIGURATION_REQUIRED:`CONFIGURATION_REQUIRED`,SEARCH_ADAPTER_REQUIRED:`SEARCH_ADAPTER_REQUIRED`,CRON_REGISTRATION_FAILED:`CRON_REGISTRATION_FAILED`,JOB_WORKER_SHUTDOWN_FAILED:`JOB_WORKER_SHUTDOWN_FAILED`,SEARCH_BACKEND_FAILED:`SEARCH_BACKEND_FAILED`,INVARIANT_VIOLATION:`INVARIANT_VIOLATION`,TENANT_CONTEXT_MISSING:`TENANT_CONTEXT_MISSING`,FEATURE_FLAGS_CONTEXT:`FEATURE_FLAGS_CONTEXT`,REALTIME_RATE_LIMITED:`REALTIME_RATE_LIMITED`,REALTIME_DELIVERY_FAILED:`REALTIME_DELIVERY_FAILED`,REALTIME_SUBSCRIPTION_FAILED:`REALTIME_SUBSCRIPTION_FAILED`,AGENT_UNKNOWN:`AGENT_UNKNOWN`,AGENT_DEPTH_EXCEEDED:`AGENT_DEPTH_EXCEEDED`,AGENT_COST_LIMIT_EXCEEDED:`AGENT_COST_LIMIT_EXCEEDED`,AGENT_TREE_COST_LIMIT_EXCEEDED:`AGENT_TREE_COST_LIMIT_EXCEEDED`,CREDITS_EXHAUSTED:`CREDITS_EXHAUSTED`,QUOTA_EXCEEDED:`QUOTA_EXCEEDED`,AGENT_SESSION_NOT_FOUND:`AGENT_SESSION_NOT_FOUND`,AGENT_DEFINITION_NOT_FOUND:`AGENT_DEFINITION_NOT_FOUND`,AGENT_RUN_CONFIG:`AGENT_RUN_CONFIG`,AGENT_STREAMING:`AGENT_STREAMING`,AGENT_MISSING_ACTOR:`AGENT_MISSING_ACTOR`,AGENT_INVALID_STATE:`AGENT_INVALID_STATE`,AGENT_COMPACTION_IMPOSSIBLE:`AGENT_COMPACTION_IMPOSSIBLE`,AGENT_COMPACTION_TIMEOUT:`AGENT_COMPACTION_TIMEOUT`,AGENT_LEASE_HELD:`AGENT_LEASE_HELD`,AGENT_LEASE_UNAVAILABLE:`AGENT_LEASE_UNAVAILABLE`,AGENT_WORK_MODE_REQUIRED:`AGENT_WORK_MODE_REQUIRED`,AGENT_MESSAGE_NOT_FOUND:`AGENT_MESSAGE_NOT_FOUND`,AGENT_MESSAGE_NOT_EDITABLE:`AGENT_MESSAGE_NOT_EDITABLE`,INVALID_TOOL_INPUT:`INVALID_TOOL_INPUT`,EDIT_MATCH_NOT_FOUND:`EDIT_MATCH_NOT_FOUND`,EDIT_MATCH_AMBIGUOUS:`EDIT_MATCH_AMBIGUOUS`,EDIT_NO_CHANGE:`EDIT_NO_CHANGE`,EDIT_TARGET_UNAVAILABLE:`EDIT_TARGET_UNAVAILABLE`,EDIT_TARGET_UNSUPPORTED:`EDIT_TARGET_UNSUPPORTED`,AGENT_EXECUTION_CANCELLED:`AGENT_EXECUTION_CANCELLED`,AGENT_EXECUTION_TIMEOUT:`AGENT_EXECUTION_TIMEOUT`,AGENT_EXTERNAL_OUTCOME_UNKNOWN:`AGENT_EXTERNAL_OUTCOME_UNKNOWN`,AGENT_TOOL_CANCELLATION_POLICY:`AGENT_TOOL_CANCELLATION_POLICY`,AGENT_CANCELLATION_WATCH_CAPACITY:`AGENT_CANCELLATION_WATCH_CAPACITY`,AGENT_CANCELLATION_CLEANUP:`AGENT_CANCELLATION_CLEANUP`,DEVICE_NOT_FOUND:`DEVICE_NOT_FOUND`,DEVICE_OFFLINE:`DEVICE_OFFLINE`,DEVICE_CAPABILITY_MISMATCH:`DEVICE_CAPABILITY_MISMATCH`,DEVICE_CHANNEL_PROTOCOL:`DEVICE_CHANNEL_PROTOCOL`,AI_UNKNOWN:`AI_UNKNOWN`,AI_USAGE_LIMIT_EXCEEDED:`AI_USAGE_LIMIT_EXCEEDED`,AI_INVALID_USAGE:`AI_INVALID_USAGE`,AI_INVALID_MODEL:`AI_INVALID_MODEL`,AI_INVALID_MODEL_INPUT:`AI_INVALID_MODEL_INPUT`,AI_REPOSITORY_ERROR:`AI_REPOSITORY_ERROR`,AI_GENERATION_FAILED:`AI_GENERATION_FAILED`,AI_DECISION_FAILED:`AI_DECISION_FAILED`,AI_IMAGE_USAGE_PENDING:`AI_IMAGE_USAGE_PENDING`,AI_IMAGE_GENERATION_INDETERMINATE:`AI_IMAGE_GENERATION_INDETERMINATE`,AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE:`AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE`,AI_IMAGE_PUBLICATION_FAILED:`AI_IMAGE_PUBLICATION_FAILED`,DOCUMENT_MIME_NOT_ACCEPTED:`DOCUMENT_MIME_NOT_ACCEPTED`,DOCUMENT_MULTIPLE_NOT_ALLOWED:`DOCUMENT_MULTIPLE_NOT_ALLOWED`,DOCUMENT_NOT_FOUND_FOR_OPERATION:`DOCUMENT_NOT_FOUND_FOR_OPERATION`,DOCUMENT_STORAGE_FAILED:`DOCUMENT_STORAGE_FAILED`,DOCUMENT_SIZE_EXCEEDED:`DOCUMENT_SIZE_EXCEEDED`,DOCUMENT_OCR_FAILED:`DOCUMENT_OCR_FAILED`,DOCUMENT_BLOB_EMPTY:`DOCUMENT_BLOB_EMPTY`,DOCUMENT_FILE_TOO_LARGE:`DOCUMENT_FILE_TOO_LARGE`,DOCUMENT_FILE_NOT_FOUND:`DOCUMENT_FILE_NOT_FOUND`,DOCUMENT_FILE_ALREADY_PACKED:`DOCUMENT_FILE_ALREADY_PACKED`,DOCUMENT_RECORD_NOT_FOUND:`DOCUMENT_RECORD_NOT_FOUND`,DOCUMENT_RECORD_OBJECT_MISMATCH:`DOCUMENT_RECORD_OBJECT_MISMATCH`,DOCUMENT_FOLDER_SERVICE_UNAVAILABLE:`DOCUMENT_FOLDER_SERVICE_UNAVAILABLE`,DOCUMENT_FOLDER_PATH_NOT_FOUND:`DOCUMENT_FOLDER_PATH_NOT_FOUND`,EMAIL_PROVIDER_API_FAILED:`EMAIL_PROVIDER_API_FAILED`,EMAIL_SEND_FAILED:`EMAIL_SEND_FAILED`,EMAIL_SENT_NOT_STORED:`EMAIL_SENT_NOT_STORED`,EMAIL_BATCH_ITEM_FAILED:`EMAIL_BATCH_ITEM_FAILED`,CALENDAR_PROVIDER_API_FAILED:`CALENDAR_PROVIDER_API_FAILED`,REFLEX_INVALID_TRANSITION:`REFLEX_INVALID_TRANSITION`,REFLEX_INVALID_TOKEN:`REFLEX_INVALID_TOKEN`,REFLEX_CAPABILITY_DENIED:`REFLEX_CAPABILITY_DENIED`,REFLEX_GATEWAY_UNAVAILABLE:`REFLEX_GATEWAY_UNAVAILABLE`,REFLEX_BUNDLE_FAILED:`REFLEX_BUNDLE_FAILED`,REFLEX_EGRESS_DENIED:`REFLEX_EGRESS_DENIED`,REFLEX_PROTOCOL_VIOLATION:`REFLEX_PROTOCOL_VIOLATION`,REFLEX_RUN_FAILED:`REFLEX_RUN_FAILED`,REFLEX_RUN_TIMEOUT:`REFLEX_RUN_TIMEOUT`,REFLEX_DEPENDENCY_DRIFT:`REFLEX_DEPENDENCY_DRIFT`,REFLEX_NOT_READY:`REFLEX_NOT_READY`,REFLEX_INVARIANT_VIOLATION:`REFLEX_INVARIANT_VIOLATION`,EMBEDDING_MODEL_UNAVAILABLE:`EMBEDDING_MODEL_UNAVAILABLE`,EMBEDDING_DIMENSION_MISMATCH:`EMBEDDING_DIMENSION_MISMATCH`};var SchemaError=class extends Error{constructor(t,n=e.UNKNOWN,r){super(t),this.name=`SchemaError`,this.code=n,this.details=r,Object.setPrototypeOf(this,new.target.prototype)}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details}}},NotFoundError=class extends SchemaError{constructor(t,n,r=e.RECORD_NOT_FOUND,i=`${t} with id "${n}" not found`){super(i,r,{resourceType:t,resourceId:n}),this._tag=`NotFoundError`,this.name=`NotFoundError`,this.resourceType=t,this.resourceId=n}},ObjectNotFoundError=class extends NotFoundError{constructor(t){super(`Object`,t,e.OBJECT_NOT_FOUND),this.name=`ObjectNotFoundError`}},AttributeNotFoundError=class extends NotFoundError{constructor(t){super(`Attribute`,t,e.ATTRIBUTE_NOT_FOUND),this.name=`AttributeNotFoundError`}},RecordNotFoundError=class extends NotFoundError{constructor(t){super(`Record`,t,e.RECORD_NOT_FOUND),this.name=`RecordNotFoundError`}},SchemaPlanNotFoundError=class extends NotFoundError{constructor(t){super(`Schema plan`,t,e.SCHEMA_PLAN_NOT_FOUND),this.name=`SchemaPlanNotFoundError`}},t=class ValidationError extends SchemaError{constructor(t,n){super(t,e.VALIDATION_FAILED,{errors:n}),this._tag=`ValidationError`,this.name=`ValidationError`,this.errors=n}static fromZodErrors(e){let t=e.map(e=>({path:e.path.map(String),message:e.message})),n=`Validation failed: ${t.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `)}`;return new ValidationError(n,t)}},AmbiguousSchemaChangeError=class extends t{constructor(t,n){super(t,n),this.code=e.AMBIGUOUS_CHANGE,this.name=`AmbiguousSchemaChangeError`}},ProtectedResourceError=class extends SchemaError{constructor(t,n,r){let i=t===`object`?e.PROTECTED_OBJECT:t===`view`?e.PROTECTED_VIEW:e.PROTECTED_ATTRIBUTE;super(`Cannot ${r} system ${t} "${n}"`,i,{resourceType:t,resourceName:n,operation:r}),this.name=`ProtectedResourceError`,this.resourceType=t,this.resourceName=n,this.operation=r}},SyncError=class extends SchemaError{constructor(t,n,r){super(`Failed to sync object "${t}": ${n}`,e.SYNC_FAILED,{objectName:t,cause:r?.message}),this.name=`SyncError`,this.objectName=t,this.cause=r}},SystemEntityImmutableError=class extends SchemaError{constructor(t,n){super(`Cannot mutate system ${t} "${n}". System entities are declared in code and immutable at runtime.`,e.SYSTEM_ENTITY_IMMUTABLE,{entityType:t,entityName:n}),this.name=`SystemEntityImmutableError`,this.entityType=t,this.entityName=n}},SyncConflictError=class extends SchemaError{constructor(t){let n=t.attributeName?`"${t.objectName}.${t.attributeName}"`:`"${t.objectName}"`;super(`Cannot promote runtime entity ${n}: ${t.reason}. Resolve via: (1) relax the code constraint, (2) migrate runtime values manually, or (3) rename the code declaration.`,e.SYNC_CONFLICT,{objectName:t.objectName,attributeName:t.attributeName,reason:t.reason}),this.name=`SyncConflictError`,this.objectName=t.objectName,this.attributeName=t.attributeName,this.reason=t.reason}},SyncCascadeError=class extends SchemaError{constructor(t,n){super(`Cannot demote object "${t}": attributes ${n.join(`, `)} are still declared in code. Remove them from code first, or restore the object.`,e.SYNC_CASCADE,{objectName:t,conflictingAttributes:n}),this.name=`SyncCascadeError`,this.objectName=t,this.conflictingAttributes=n}},OrphanSystemAttributeError=class extends SchemaError{constructor(t,n){super(`Attribute "${t}.${n}" is system:true but its object parent is system:false. This is an invariant violation.`,e.ORPHAN_SYSTEM_ATTRIBUTE,{objectName:t,attributeName:n}),this.name=`OrphanSystemAttributeError`,this.objectName=t,this.attributeName=n}},DuplicateError=class extends SchemaError{constructor(t,n,r){let i=t===`object`?e.DUPLICATE_OBJECT:t===`attribute`?e.DUPLICATE_ATTRIBUTE:e.DUPLICATE,a=`${t.charAt(0).toUpperCase()}${t.slice(1)} "${n}" already exists`;super(r??a,i,{resourceType:t,resourceName:n}),this.name=`DuplicateError`,this.resourceType=t,this.resourceName=n}};const n={builder:`cannot be built by a consumer`,registry:`cannot be registered by a consumer`,bundle:`cannot be claimed by a bundle`,source:`cannot be declared by a schema source`};var ReservedObjectNameError=class extends SchemaError{constructor(t,r){super(`"${t}" is a framework-native object name and ${n[r]}: the framework ships it, pick another name.`,e.RESERVED_OBJECT_NAME,{objectName:t,context:r}),this.name=`ReservedObjectNameError`,this.objectName=t}};function isSchemaError(e){return e instanceof SchemaError}function isNotFoundError(e){return e instanceof NotFoundError}function isValidationError(e){return e instanceof t}function isProtectedResourceError(e){return e instanceof ProtectedResourceError}var ForbiddenError=class extends SchemaError{constructor(t,n,r){super(`No ${n} permission on object "${t}"`,e.FORBIDDEN,{objectName:t,action:n,userId:r}),this._tag=`ForbiddenError`,this.name=`ForbiddenError`,this.objectName=t,this.action=n,this.userId=r}},ProtectedRoleError=class extends SchemaError{constructor(t,n){super(`Cannot ${n} system role "${t}"`,e.PROTECTED_ROLE,{roleName:t,operation:n}),this.name=`ProtectedRoleError`,this.roleName=t,this.operation=n}},RoleNotFoundError=class extends NotFoundError{constructor(t){super(`Role`,t,e.ROLE_NOT_FOUND),this.name=`RoleNotFoundError`}},ConcurrentModificationError=class extends SchemaError{constructor(t){super(`Record ${t} was modified by another request. Please refresh and try again.`,e.CONFLICT,{recordId:t})}},StorageError=class extends SchemaError{constructor(t,n,r,i){let a=t===`upload`?e.STORAGE_UPLOAD_FAILED:t===`download`?e.STORAGE_DOWNLOAD_FAILED:t===`delete`?e.STORAGE_DELETE_FAILED:e.STORAGE_URL_FAILED;super(`Storage ${t} failed: ${n}`,a,{operation:t,path:r,cause:i}),this.name=`StorageError`,this.operation=t,this.path=r,this.cause=i}},AccessDeniedError=class extends SchemaError{constructor(t,n){super(n??`Access denied to resource: ${t}`,e.ACCESS_DENIED,{resource:t,reason:n}),this.name=`AccessDeniedError`,this.resource=t,this.reason=n}},RepositoryError=class extends SchemaError{constructor(t,n,r,i){let a=t===`create`?e.REPOSITORY_CREATE_FAILED:t===`update`?e.REPOSITORY_UPDATE_FAILED:t===`delete`?e.REPOSITORY_DELETE_FAILED:e.REPOSITORY_QUERY_FAILED;super(`Failed to ${t} ${n}: ${r}${i?` (${i})`:``}`,a,{operation:t,entity:n,cause:i}),this.name=`RepositoryError`,this.operation=t,this.entity=n,this.cause=i}},SearchBackendError=class extends SchemaError{constructor(t,n){super(`Search backend unavailable for ${t}`,e.SEARCH_BACKEND_FAILED,{scope:t,cause:n}),this.name=`SearchBackendError`,this.scope=t,this.cause=n}},NotImplementedError=class extends SchemaError{constructor(t,n){let r=n?`${t}: not implemented (${n})`:`${t}: not implemented`;super(r,e.NOT_IMPLEMENTED,{feature:t,milestone:n}),this.name=`NotImplementedError`,this.feature=t,this.milestone=n}},MemoryNotFoundError=class extends NotFoundError{constructor(t){super(`Memory`,t,e.MEMORY_NOT_FOUND),this.name=`MemoryNotFoundError`}},RecordReferencedError=class extends SchemaError{constructor(t,n){let r=n.reduce((e,t)=>e+t.count,0);super(`Cannot delete record: referenced by ${r} record${r>1?`s`:``}`,e.RECORD_REFERENCED,{recordId:t,references:n}),this.name=`RecordReferencedError`,this.recordId=t,this.references=n}},AttributeInUseError=class extends SchemaError{constructor(t,n,r){super(`Cannot delete attribute "${t}": used in ${n}${r===void 0?``:` ${r}`}`,e.ATTRIBUTE_IN_USE,{attributeName:t,usage:n,...r===void 0?{}:{location:r}}),this.name=`AttributeInUseError`,this.attributeName=t,this.usage=n,this.location=r}},ObjectReferencedError=class extends SchemaError{constructor(t,n){super(`Cannot delete object "${t}": target of relations in ${n.join(`, `)}`,e.OBJECT_REFERENCED,{objectName:t,referencingObjects:n}),this.name=`ObjectReferencedError`,this.objectName=t,this.referencingObjects=n}},RealtimeRateLimitedError=class extends SchemaError{constructor(){super(`Supabase Realtime delivery was rate limited`,e.REALTIME_RATE_LIMITED),this.name=`RealtimeRateLimitedError`}},RealtimeDeliveryError=class extends SchemaError{constructor(){super(`Supabase Realtime delivery failed`,e.REALTIME_DELIVERY_FAILED),this.name=`RealtimeDeliveryError`}},RealtimeSubscriptionError=class extends SchemaError{constructor(){super(`Supabase Realtime subscription failed`,e.REALTIME_SUBSCRIPTION_FAILED),this.name=`RealtimeSubscriptionError`}};function isRecordReferencedError(e){return e instanceof RecordReferencedError}function isAttributeInUseError(e){return e instanceof AttributeInUseError}function isObjectReferencedError(e){return e instanceof ObjectReferencedError}exports.AccessDeniedError=AccessDeniedError,exports.AmbiguousSchemaChangeError=AmbiguousSchemaChangeError,exports.AttributeInUseError=AttributeInUseError,exports.AttributeNotFoundError=AttributeNotFoundError,exports.ConcurrentModificationError=ConcurrentModificationError,exports.DuplicateError=DuplicateError,exports.ForbiddenError=ForbiddenError,exports.MemoryNotFoundError=MemoryNotFoundError,exports.NotFoundError=NotFoundError,exports.NotImplementedError=NotImplementedError,exports.ObjectNotFoundError=ObjectNotFoundError,exports.ObjectReferencedError=ObjectReferencedError,exports.OrphanSystemAttributeError=OrphanSystemAttributeError,exports.ProtectedResourceError=ProtectedResourceError,exports.ProtectedRoleError=ProtectedRoleError,exports.RealtimeDeliveryError=RealtimeDeliveryError,exports.RealtimeRateLimitedError=RealtimeRateLimitedError,exports.RealtimeSubscriptionError=RealtimeSubscriptionError,exports.RecordNotFoundError=RecordNotFoundError,exports.RecordReferencedError=RecordReferencedError,exports.RepositoryError=RepositoryError,exports.ReservedObjectNameError=ReservedObjectNameError,exports.RoleNotFoundError=RoleNotFoundError,exports.SchemaError=SchemaError,exports.SchemaErrorCode=e,exports.SchemaPlanNotFoundError=SchemaPlanNotFoundError,exports.SearchBackendError=SearchBackendError,exports.StorageError=StorageError,exports.SyncCascadeError=SyncCascadeError,exports.SyncConflictError=SyncConflictError,exports.SyncError=SyncError,exports.SystemEntityImmutableError=SystemEntityImmutableError,exports.ValidationError=t,exports.isAttributeInUseError=isAttributeInUseError,exports.isNotFoundError=isNotFoundError,exports.isObjectReferencedError=isObjectReferencedError,exports.isProtectedResourceError=isProtectedResourceError,exports.isRecordReferencedError=isRecordReferencedError,exports.isSchemaError=isSchemaError,exports.isValidationError=isValidationError;
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e={DRAFT_REVISION_CONFLICT:`DRAFT_REVISION_CONFLICT`,UNKNOWN:`SCHEMA_UNKNOWN_ERROR`,OBJECT_NOT_FOUND:`SCHEMA_OBJECT_NOT_FOUND`,ATTRIBUTE_NOT_FOUND:`SCHEMA_ATTRIBUTE_NOT_FOUND`,RECORD_NOT_FOUND:`SCHEMA_RECORD_NOT_FOUND`,SOURCE_NOT_FOUND:`SCHEMA_SOURCE_NOT_FOUND`,ROLE_NOT_FOUND:`SCHEMA_ROLE_NOT_FOUND`,MEMORY_NOT_FOUND:`SCHEMA_MEMORY_NOT_FOUND`,SCHEMA_PLAN_NOT_FOUND:`SCHEMA_PLAN_NOT_FOUND`,VALIDATION_FAILED:`SCHEMA_VALIDATION_FAILED`,INVALID_ATTRIBUTE_NAME:`SCHEMA_INVALID_ATTRIBUTE_NAME`,INVALID_OBJECT_NAME:`SCHEMA_INVALID_OBJECT_NAME`,RESERVED_OBJECT_NAME:`SCHEMA_RESERVED_OBJECT_NAME`,PROTECTED_OBJECT:`SCHEMA_PROTECTED_OBJECT`,PROTECTED_ATTRIBUTE:`SCHEMA_PROTECTED_ATTRIBUTE`,PROTECTED_VIEW:`SCHEMA_PROTECTED_VIEW`,PROTECTED_ROLE:`SCHEMA_PROTECTED_ROLE`,FORBIDDEN:`SCHEMA_FORBIDDEN`,ACCESS_DENIED:`SCHEMA_ACCESS_DENIED`,WORKSPACE_INVARIANT:`SCHEMA_WORKSPACE_INVARIANT`,STATE_GATE:`SCHEMA_STATE_GATE`,ACTOR_CONTEXT_REQUIRED:`SCHEMA_ACTOR_CONTEXT_REQUIRED`,CONNECTOR_AUTH_FAILED:`SCHEMA_CONNECTOR_AUTH_FAILED`,CONNECTOR_INVALID_STATE:`SCHEMA_CONNECTOR_INVALID_STATE`,CONNECTOR_GRANT_ORPHANED:`SCHEMA_CONNECTOR_GRANT_ORPHANED`,SYNC_FAILED:`SCHEMA_SYNC_FAILED`,SYNC_CONFLICT:`SCHEMA_SYNC_CONFLICT`,SYNC_CASCADE:`SCHEMA_SYNC_CASCADE`,ORPHAN_SYSTEM_ATTRIBUTE:`SCHEMA_ORPHAN_SYSTEM_ATTRIBUTE`,SYSTEM_ENTITY_IMMUTABLE:`SCHEMA_SYSTEM_ENTITY_IMMUTABLE`,AMBIGUOUS_CHANGE:`SCHEMA_AMBIGUOUS_CHANGE`,DUPLICATE:`SCHEMA_DUPLICATE`,DUPLICATE_OBJECT:`SCHEMA_DUPLICATE_OBJECT`,DUPLICATE_ATTRIBUTE:`SCHEMA_DUPLICATE_ATTRIBUTE`,CONFLICT:`SCHEMA_CONFLICT`,STORAGE_UPLOAD_FAILED:`SCHEMA_STORAGE_UPLOAD_FAILED`,STORAGE_DOWNLOAD_FAILED:`SCHEMA_STORAGE_DOWNLOAD_FAILED`,STORAGE_DELETE_FAILED:`SCHEMA_STORAGE_DELETE_FAILED`,STORAGE_URL_FAILED:`SCHEMA_STORAGE_URL_FAILED`,REPOSITORY_CREATE_FAILED:`SCHEMA_REPOSITORY_CREATE_FAILED`,REPOSITORY_UPDATE_FAILED:`SCHEMA_REPOSITORY_UPDATE_FAILED`,REPOSITORY_DELETE_FAILED:`SCHEMA_REPOSITORY_DELETE_FAILED`,REPOSITORY_QUERY_FAILED:`SCHEMA_REPOSITORY_QUERY_FAILED`,NOT_IMPLEMENTED:`SCHEMA_NOT_IMPLEMENTED`,TIMEOUT:`SCHEMA_TIMEOUT`,RECORD_REFERENCED:`SCHEMA_RECORD_REFERENCED`,ATTRIBUTE_IN_USE:`SCHEMA_ATTRIBUTE_IN_USE`,OBJECT_REFERENCED:`SCHEMA_OBJECT_REFERENCED`,CONFIGURATION_REQUIRED:`CONFIGURATION_REQUIRED`,SEARCH_ADAPTER_REQUIRED:`SEARCH_ADAPTER_REQUIRED`,SEARCH_BACKEND_FAILED:`SEARCH_BACKEND_FAILED`,SEARCH_BACKEND_REJECTED:`SEARCH_BACKEND_REJECTED`,INVARIANT_VIOLATION:`INVARIANT_VIOLATION`,TENANT_CONTEXT_MISSING:`TENANT_CONTEXT_MISSING`,JOB_RUN_METADATA_MISMATCH:`JOB_RUN_METADATA_MISMATCH`,JOB_COALESCED_FAILURE_HANDLED:`JOB_COALESCED_FAILURE_HANDLED`,FEATURE_FLAGS_CONTEXT:`FEATURE_FLAGS_CONTEXT`,REALTIME_RATE_LIMITED:`REALTIME_RATE_LIMITED`,REALTIME_DELIVERY_FAILED:`REALTIME_DELIVERY_FAILED`,REALTIME_SUBSCRIPTION_FAILED:`REALTIME_SUBSCRIPTION_FAILED`,AGENT_UNKNOWN:`AGENT_UNKNOWN`,AGENT_DEPTH_EXCEEDED:`AGENT_DEPTH_EXCEEDED`,AGENT_COST_LIMIT_EXCEEDED:`AGENT_COST_LIMIT_EXCEEDED`,AGENT_TREE_COST_LIMIT_EXCEEDED:`AGENT_TREE_COST_LIMIT_EXCEEDED`,CREDITS_EXHAUSTED:`CREDITS_EXHAUSTED`,QUOTA_EXCEEDED:`QUOTA_EXCEEDED`,AGENT_SESSION_NOT_FOUND:`AGENT_SESSION_NOT_FOUND`,AGENT_DEFINITION_NOT_FOUND:`AGENT_DEFINITION_NOT_FOUND`,AGENT_RUN_CONFIG:`AGENT_RUN_CONFIG`,AGENT_STREAMING:`AGENT_STREAMING`,AGENT_MISSING_ACTOR:`AGENT_MISSING_ACTOR`,AGENT_INVALID_STATE:`AGENT_INVALID_STATE`,AGENT_COMPACTION_IMPOSSIBLE:`AGENT_COMPACTION_IMPOSSIBLE`,AGENT_COMPACTION_TIMEOUT:`AGENT_COMPACTION_TIMEOUT`,AGENT_LEASE_HELD:`AGENT_LEASE_HELD`,AGENT_LEASE_UNAVAILABLE:`AGENT_LEASE_UNAVAILABLE`,AGENT_WORK_MODE_REQUIRED:`AGENT_WORK_MODE_REQUIRED`,AGENT_MESSAGE_NOT_FOUND:`AGENT_MESSAGE_NOT_FOUND`,AGENT_MESSAGE_NOT_EDITABLE:`AGENT_MESSAGE_NOT_EDITABLE`,INVALID_TOOL_INPUT:`INVALID_TOOL_INPUT`,EDIT_MATCH_NOT_FOUND:`EDIT_MATCH_NOT_FOUND`,EDIT_MATCH_AMBIGUOUS:`EDIT_MATCH_AMBIGUOUS`,EDIT_NO_CHANGE:`EDIT_NO_CHANGE`,EDIT_TARGET_UNAVAILABLE:`EDIT_TARGET_UNAVAILABLE`,EDIT_TARGET_UNSUPPORTED:`EDIT_TARGET_UNSUPPORTED`,AGENT_EXECUTION_CANCELLED:`AGENT_EXECUTION_CANCELLED`,AGENT_EXECUTION_TIMEOUT:`AGENT_EXECUTION_TIMEOUT`,AGENT_EXTERNAL_OUTCOME_UNKNOWN:`AGENT_EXTERNAL_OUTCOME_UNKNOWN`,AGENT_TOOL_CANCELLATION_POLICY:`AGENT_TOOL_CANCELLATION_POLICY`,AGENT_CANCELLATION_WATCH_CAPACITY:`AGENT_CANCELLATION_WATCH_CAPACITY`,AGENT_CANCELLATION_CLEANUP:`AGENT_CANCELLATION_CLEANUP`,AGENT_TURN_FINALIZER_STALLED:`AGENT_TURN_FINALIZER_STALLED`,DEVICE_NOT_FOUND:`DEVICE_NOT_FOUND`,DEVICE_OFFLINE:`DEVICE_OFFLINE`,DEVICE_CAPABILITY_MISMATCH:`DEVICE_CAPABILITY_MISMATCH`,DEVICE_CHANNEL_PROTOCOL:`DEVICE_CHANNEL_PROTOCOL`,AI_UNKNOWN:`AI_UNKNOWN`,AI_USAGE_LIMIT_EXCEEDED:`AI_USAGE_LIMIT_EXCEEDED`,AI_INVALID_USAGE:`AI_INVALID_USAGE`,AI_INVALID_MODEL:`AI_INVALID_MODEL`,AI_INVALID_MODEL_INPUT:`AI_INVALID_MODEL_INPUT`,AI_REPOSITORY_ERROR:`AI_REPOSITORY_ERROR`,AI_GENERATION_FAILED:`AI_GENERATION_FAILED`,AI_DECISION_FAILED:`AI_DECISION_FAILED`,AI_IMAGE_USAGE_PENDING:`AI_IMAGE_USAGE_PENDING`,AI_IMAGE_GENERATION_INDETERMINATE:`AI_IMAGE_GENERATION_INDETERMINATE`,AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE:`AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE`,AI_IMAGE_PUBLICATION_FAILED:`AI_IMAGE_PUBLICATION_FAILED`,DOCUMENT_MIME_NOT_ACCEPTED:`DOCUMENT_MIME_NOT_ACCEPTED`,DOCUMENT_MULTIPLE_NOT_ALLOWED:`DOCUMENT_MULTIPLE_NOT_ALLOWED`,DOCUMENT_NOT_FOUND_FOR_OPERATION:`DOCUMENT_NOT_FOUND_FOR_OPERATION`,DOCUMENT_STORAGE_FAILED:`DOCUMENT_STORAGE_FAILED`,DOCUMENT_SIZE_EXCEEDED:`DOCUMENT_SIZE_EXCEEDED`,DOCUMENT_OCR_FAILED:`DOCUMENT_OCR_FAILED`,DOCUMENT_BLOB_EMPTY:`DOCUMENT_BLOB_EMPTY`,DOCUMENT_FILE_TOO_LARGE:`DOCUMENT_FILE_TOO_LARGE`,DOCUMENT_FILE_NOT_FOUND:`DOCUMENT_FILE_NOT_FOUND`,DOCUMENT_FILE_ALREADY_PACKED:`DOCUMENT_FILE_ALREADY_PACKED`,DOCUMENT_RECORD_NOT_FOUND:`DOCUMENT_RECORD_NOT_FOUND`,DOCUMENT_RECORD_OBJECT_MISMATCH:`DOCUMENT_RECORD_OBJECT_MISMATCH`,DOCUMENT_FOLDER_SERVICE_UNAVAILABLE:`DOCUMENT_FOLDER_SERVICE_UNAVAILABLE`,DOCUMENT_FOLDER_PATH_NOT_FOUND:`DOCUMENT_FOLDER_PATH_NOT_FOUND`,EMAIL_PROVIDER_API_FAILED:`EMAIL_PROVIDER_API_FAILED`,EMAIL_SEND_FAILED:`EMAIL_SEND_FAILED`,EMAIL_SENT_NOT_STORED:`EMAIL_SENT_NOT_STORED`,EMAIL_BATCH_ITEM_FAILED:`EMAIL_BATCH_ITEM_FAILED`,CALENDAR_PROVIDER_API_FAILED:`CALENDAR_PROVIDER_API_FAILED`,REFLEX_INVALID_TRANSITION:`REFLEX_INVALID_TRANSITION`,REFLEX_INVALID_TOKEN:`REFLEX_INVALID_TOKEN`,REFLEX_CAPABILITY_DENIED:`REFLEX_CAPABILITY_DENIED`,REFLEX_GATEWAY_UNAVAILABLE:`REFLEX_GATEWAY_UNAVAILABLE`,REFLEX_BUNDLE_FAILED:`REFLEX_BUNDLE_FAILED`,REFLEX_EGRESS_DENIED:`REFLEX_EGRESS_DENIED`,REFLEX_PROTOCOL_VIOLATION:`REFLEX_PROTOCOL_VIOLATION`,REFLEX_RUN_FAILED:`REFLEX_RUN_FAILED`,REFLEX_RUN_TIMEOUT:`REFLEX_RUN_TIMEOUT`,REFLEX_DEPENDENCY_DRIFT:`REFLEX_DEPENDENCY_DRIFT`,REFLEX_NOT_READY:`REFLEX_NOT_READY`,REFLEX_INVARIANT_VIOLATION:`REFLEX_INVARIANT_VIOLATION`,EMBEDDING_MODEL_UNAVAILABLE:`EMBEDDING_MODEL_UNAVAILABLE`,EMBEDDING_DIMENSION_MISMATCH:`EMBEDDING_DIMENSION_MISMATCH`};var SchemaError=class extends Error{constructor(t,n=e.UNKNOWN,r){super(t),this.name=`SchemaError`,this.code=n,this.details=r,Object.setPrototypeOf(this,new.target.prototype)}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details}}},NotFoundError=class extends SchemaError{constructor(t,n,r=e.RECORD_NOT_FOUND,i=`${t} with id "${n}" not found`){super(i,r,{resourceType:t,resourceId:n}),this._tag=`NotFoundError`,this.name=`NotFoundError`,this.resourceType=t,this.resourceId=n}},ObjectNotFoundError=class extends NotFoundError{constructor(t){super(`Object`,t,e.OBJECT_NOT_FOUND),this.name=`ObjectNotFoundError`}},AttributeNotFoundError=class extends NotFoundError{constructor(t){super(`Attribute`,t,e.ATTRIBUTE_NOT_FOUND),this.name=`AttributeNotFoundError`}},RecordNotFoundError=class extends NotFoundError{constructor(t){super(`Record`,t,e.RECORD_NOT_FOUND),this.name=`RecordNotFoundError`}},SchemaPlanNotFoundError=class extends NotFoundError{constructor(t){super(`Schema plan`,t,e.SCHEMA_PLAN_NOT_FOUND),this.name=`SchemaPlanNotFoundError`}},t=class ValidationError extends SchemaError{constructor(t,n){super(t,e.VALIDATION_FAILED,{errors:n}),this._tag=`ValidationError`,this.name=`ValidationError`,this.errors=n}static fromZodErrors(e){let t=e.map(e=>({path:e.path.map(String),message:e.message})),n=`Validation failed: ${t.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `)}`;return new ValidationError(n,t)}},AmbiguousSchemaChangeError=class extends t{constructor(t,n){super(t,n),this.code=e.AMBIGUOUS_CHANGE,this.name=`AmbiguousSchemaChangeError`}},ProtectedResourceError=class extends SchemaError{constructor(t,n,r){let i=t===`object`?e.PROTECTED_OBJECT:t===`view`?e.PROTECTED_VIEW:e.PROTECTED_ATTRIBUTE;super(`Cannot ${r} system ${t} "${n}"`,i,{resourceType:t,resourceName:n,operation:r}),this.name=`ProtectedResourceError`,this.resourceType=t,this.resourceName=n,this.operation=r}},SyncError=class extends SchemaError{constructor(t,n,r){super(`Failed to sync object "${t}": ${n}`,e.SYNC_FAILED,{objectName:t,cause:r?.message}),this.name=`SyncError`,this.objectName=t,this.cause=r}},SystemEntityImmutableError=class extends SchemaError{constructor(t,n){super(`Cannot mutate system ${t} "${n}". System entities are declared in code and immutable at runtime.`,e.SYSTEM_ENTITY_IMMUTABLE,{entityType:t,entityName:n}),this.name=`SystemEntityImmutableError`,this.entityType=t,this.entityName=n}},SyncConflictError=class extends SchemaError{constructor(t){let n=t.attributeName?`"${t.objectName}.${t.attributeName}"`:`"${t.objectName}"`;super(`Cannot promote runtime entity ${n}: ${t.reason}. Resolve via: (1) relax the code constraint, (2) migrate runtime values manually, or (3) rename the code declaration.`,e.SYNC_CONFLICT,{objectName:t.objectName,attributeName:t.attributeName,reason:t.reason}),this.name=`SyncConflictError`,this.objectName=t.objectName,this.attributeName=t.attributeName,this.reason=t.reason}},SyncCascadeError=class extends SchemaError{constructor(t,n){super(`Cannot demote object "${t}": attributes ${n.join(`, `)} are still declared in code. Remove them from code first, or restore the object.`,e.SYNC_CASCADE,{objectName:t,conflictingAttributes:n}),this.name=`SyncCascadeError`,this.objectName=t,this.conflictingAttributes=n}},OrphanSystemAttributeError=class extends SchemaError{constructor(t,n){super(`Attribute "${t}.${n}" is system:true but its object parent is system:false. This is an invariant violation.`,e.ORPHAN_SYSTEM_ATTRIBUTE,{objectName:t,attributeName:n}),this.name=`OrphanSystemAttributeError`,this.objectName=t,this.attributeName=n}},DuplicateError=class extends SchemaError{constructor(t,n,r){let i=t===`object`?e.DUPLICATE_OBJECT:t===`attribute`?e.DUPLICATE_ATTRIBUTE:e.DUPLICATE,a=`${t.charAt(0).toUpperCase()}${t.slice(1)} "${n}" already exists`;super(r??a,i,{resourceType:t,resourceName:n}),this.name=`DuplicateError`,this.resourceType=t,this.resourceName=n}};const n={builder:`cannot be built by a consumer`,registry:`cannot be registered by a consumer`,bundle:`cannot be claimed by a bundle`,source:`cannot be declared by a schema source`};var ReservedObjectNameError=class extends SchemaError{constructor(t,r){super(`"${t}" is a framework-native object name and ${n[r]}: the framework ships it, pick another name.`,e.RESERVED_OBJECT_NAME,{objectName:t,context:r}),this.name=`ReservedObjectNameError`,this.objectName=t}};function isSchemaError(e){return e instanceof SchemaError}function isNotFoundError(e){return e instanceof NotFoundError}function isValidationError(e){return e instanceof t}function isProtectedResourceError(e){return e instanceof ProtectedResourceError}var ForbiddenError=class extends SchemaError{constructor(t,n,r){super(`No ${n} permission on object "${t}"`,e.FORBIDDEN,{objectName:t,action:n,userId:r}),this._tag=`ForbiddenError`,this.name=`ForbiddenError`,this.objectName=t,this.action=n,this.userId=r}},ProtectedRoleError=class extends SchemaError{constructor(t,n){super(`Cannot ${n} system role "${t}"`,e.PROTECTED_ROLE,{roleName:t,operation:n}),this.name=`ProtectedRoleError`,this.roleName=t,this.operation=n}},RoleNotFoundError=class extends NotFoundError{constructor(t){super(`Role`,t,e.ROLE_NOT_FOUND),this.name=`RoleNotFoundError`}},ConcurrentModificationError=class extends SchemaError{constructor(t){super(`Record ${t} was modified by another request. Please refresh and try again.`,e.CONFLICT,{recordId:t})}},StorageError=class extends SchemaError{constructor(t,n,r,i){let a=t===`upload`?e.STORAGE_UPLOAD_FAILED:t===`download`?e.STORAGE_DOWNLOAD_FAILED:t===`delete`?e.STORAGE_DELETE_FAILED:e.STORAGE_URL_FAILED;super(`Storage ${t} failed: ${n}`,a,{operation:t,path:r,cause:i}),this.name=`StorageError`,this.operation=t,this.path=r,this.cause=i}},AccessDeniedError=class extends SchemaError{constructor(t,n){super(n??`Access denied to resource: ${t}`,e.ACCESS_DENIED,{resource:t,reason:n}),this.name=`AccessDeniedError`,this.resource=t,this.reason=n}},RepositoryError=class extends SchemaError{constructor(t,n,r,i){let a=t===`create`?e.REPOSITORY_CREATE_FAILED:t===`update`?e.REPOSITORY_UPDATE_FAILED:t===`delete`?e.REPOSITORY_DELETE_FAILED:e.REPOSITORY_QUERY_FAILED;super(`Failed to ${t} ${n}: ${r}${i?` (${i})`:``}`,a,{operation:t,entity:n,cause:i}),this.name=`RepositoryError`,this.operation=t,this.entity=n,this.cause=i}};function searchBackendMessage(e,t,n,r){return t===`unavailable`?`Search backend unavailable for ${e}`:`${t===`capacity`?`Search backend out of capacity for ${e}`:`Search backend rejected ${e}`}${n?`: ${n}`:``}${r?` — ${r}`:``}`}var SearchBackendError=class extends SchemaError{constructor(t,n,r={}){let i=r.kind??`unavailable`;super(searchBackendMessage(t,i,r.backendCode,r.detail),i===`unavailable`?e.SEARCH_BACKEND_FAILED:e.SEARCH_BACKEND_REJECTED,{scope:t,cause:n,kind:i,...r.backendCode?{backendCode:r.backendCode}:{}}),this.name=`SearchBackendError`,this.scope=t,this.cause=n,this.kind=i,this.backendCode=r.backendCode}},NotImplementedError=class extends SchemaError{constructor(t,n){let r=n?`${t}: not implemented (${n})`:`${t}: not implemented`;super(r,e.NOT_IMPLEMENTED,{feature:t,milestone:n}),this.name=`NotImplementedError`,this.feature=t,this.milestone=n}},MemoryNotFoundError=class extends NotFoundError{constructor(t){super(`Memory`,t,e.MEMORY_NOT_FOUND),this.name=`MemoryNotFoundError`}},RecordReferencedError=class extends SchemaError{constructor(t,n){let r=n.reduce((e,t)=>e+t.count,0);super(`Cannot delete record: referenced by ${r} record${r>1?`s`:``}`,e.RECORD_REFERENCED,{recordId:t,references:n}),this.name=`RecordReferencedError`,this.recordId=t,this.references=n}},AttributeInUseError=class extends SchemaError{constructor(t,n,r){super(`Cannot delete attribute "${t}": used in ${n}${r===void 0?``:` ${r}`}`,e.ATTRIBUTE_IN_USE,{attributeName:t,usage:n,...r===void 0?{}:{location:r}}),this.name=`AttributeInUseError`,this.attributeName=t,this.usage=n,this.location=r}},ObjectReferencedError=class extends SchemaError{constructor(t,n){super(`Cannot delete object "${t}": target of relations in ${n.join(`, `)}`,e.OBJECT_REFERENCED,{objectName:t,referencingObjects:n}),this.name=`ObjectReferencedError`,this.objectName=t,this.referencingObjects=n}},RealtimeRateLimitedError=class extends SchemaError{constructor(){super(`Supabase Realtime delivery was rate limited`,e.REALTIME_RATE_LIMITED),this.name=`RealtimeRateLimitedError`}},RealtimeDeliveryError=class extends SchemaError{constructor(){super(`Supabase Realtime delivery failed`,e.REALTIME_DELIVERY_FAILED),this.name=`RealtimeDeliveryError`}},RealtimeSubscriptionError=class extends SchemaError{constructor(){super(`Supabase Realtime subscription failed`,e.REALTIME_SUBSCRIPTION_FAILED),this.name=`RealtimeSubscriptionError`}};function isRecordReferencedError(e){return e instanceof RecordReferencedError}function isAttributeInUseError(e){return e instanceof AttributeInUseError}function isObjectReferencedError(e){return e instanceof ObjectReferencedError}exports.AccessDeniedError=AccessDeniedError,exports.AmbiguousSchemaChangeError=AmbiguousSchemaChangeError,exports.AttributeInUseError=AttributeInUseError,exports.AttributeNotFoundError=AttributeNotFoundError,exports.ConcurrentModificationError=ConcurrentModificationError,exports.DuplicateError=DuplicateError,exports.ForbiddenError=ForbiddenError,exports.MemoryNotFoundError=MemoryNotFoundError,exports.NotFoundError=NotFoundError,exports.NotImplementedError=NotImplementedError,exports.ObjectNotFoundError=ObjectNotFoundError,exports.ObjectReferencedError=ObjectReferencedError,exports.OrphanSystemAttributeError=OrphanSystemAttributeError,exports.ProtectedResourceError=ProtectedResourceError,exports.ProtectedRoleError=ProtectedRoleError,exports.RealtimeDeliveryError=RealtimeDeliveryError,exports.RealtimeRateLimitedError=RealtimeRateLimitedError,exports.RealtimeSubscriptionError=RealtimeSubscriptionError,exports.RecordNotFoundError=RecordNotFoundError,exports.RecordReferencedError=RecordReferencedError,exports.RepositoryError=RepositoryError,exports.ReservedObjectNameError=ReservedObjectNameError,exports.RoleNotFoundError=RoleNotFoundError,exports.SchemaError=SchemaError,exports.SchemaErrorCode=e,exports.SchemaPlanNotFoundError=SchemaPlanNotFoundError,exports.SearchBackendError=SearchBackendError,exports.StorageError=StorageError,exports.SyncCascadeError=SyncCascadeError,exports.SyncConflictError=SyncConflictError,exports.SyncError=SyncError,exports.SystemEntityImmutableError=SystemEntityImmutableError,exports.ValidationError=t,exports.isAttributeInUseError=isAttributeInUseError,exports.isNotFoundError=isNotFoundError,exports.isObjectReferencedError=isObjectReferencedError,exports.isProtectedResourceError=isProtectedResourceError,exports.isRecordReferencedError=isRecordReferencedError,exports.isSchemaError=isSchemaError,exports.isValidationError=isValidationError;