@stndrds/schema 1.0.0-alpha.349 → 1.0.0-alpha.350
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{all-DZp7BWOq.d.ts → all-CPMOHYla.d.ts} +8 -8
- package/dist/{all-CnoQ40WJ.d.mts → all-Dk8PLu1y.d.mts} +8 -8
- package/dist/attributes-C2gm0hUJ.d.ts +684 -0
- package/dist/attributes-mMmH-WOx.d.mts +684 -0
- package/dist/{checkbox-De7-FSiU.d.mts → checkbox-Ce8gAyQf.d.ts} +2 -2
- package/dist/{checkbox-Cli_fh_9.d.ts → checkbox-DO6Mkloc.d.mts} +2 -2
- package/dist/{date-CxGxPeHR.d.mts → date-CMS-GYRM.d.mts} +2 -2
- package/dist/{date-CJGbHQZF.d.ts → date-DikDGfre.d.ts} +2 -2
- package/dist/exceptions-DxzT8POW.d.mts +554 -0
- package/dist/exceptions-DxzT8POW.d.ts +554 -0
- package/dist/exceptions.d.mts +2 -2
- package/dist/exceptions.d.ts +2 -2
- package/dist/exceptions.js +1 -2
- package/dist/exceptions.mjs +1 -2
- package/dist/{index-Dz6tbe0o.d.ts → index-B-mUjnh9.d.mts} +3 -6
- package/dist/{index-C9whsQlG.d.ts → index-BL7EA39F.d.ts} +1 -1
- package/dist/{index-fWrEgqge.d.mts → index-BV4yNsr7.d.mts} +1 -1
- package/dist/{index-UancE_wI.d.ts → index-CRtiKFTH.d.ts} +1 -1
- package/dist/{index-DqfX-ct_.d.mts → index-D26ob_vF.d.mts} +1 -1
- package/dist/{index-DRfeDI4f.d.mts → index-D9OhYX-t.d.ts} +3 -6
- package/dist/index.d.mts +49 -96
- package/dist/index.d.ts +49 -96
- package/dist/index.js +3 -3
- package/dist/index.mjs +7 -7
- package/dist/{number-DJ-nhMMq.d.mts → number-Ck0PPSkK.d.ts} +2 -2
- package/dist/{number-BtJHcFCQ.d.ts → number-r6bOZ9jd.d.mts} +2 -2
- package/dist/{text-RUwIi6jM.d.mts → text-B1Vwj7fS.d.mts} +2 -2
- package/dist/{text-qHaUKcUU.d.ts → text-DHg2cmFd.d.ts} +2 -2
- package/dist/utils-Du-He6Ct.d.ts +163 -0
- package/dist/utils-r53z9KnF.d.mts +163 -0
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/validation/all.d.mts +4 -4
- package/dist/validation/all.d.ts +4 -4
- package/dist/validation/all.js +1 -1
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/complex/currency.d.mts +2 -2
- package/dist/validation/complex/currency.d.ts +2 -2
- package/dist/validation/complex/location.d.mts +2 -2
- package/dist/validation/complex/location.d.ts +2 -2
- package/dist/validation/complex/phone.d.mts +2 -2
- package/dist/validation/complex/phone.d.ts +2 -2
- package/dist/validation/complex/relation.d.mts +2 -2
- package/dist/validation/complex/relation.d.ts +2 -2
- package/dist/validation/complex/richtext.d.mts +2 -2
- package/dist/validation/complex/richtext.d.ts +2 -2
- package/dist/validation/complex/select.d.mts +2 -2
- package/dist/validation/complex/select.d.ts +2 -2
- package/dist/validation/complex/user.d.mts +2 -2
- package/dist/validation/complex/user.d.ts +2 -2
- package/dist/validation/computed/formula.d.mts +2 -2
- package/dist/validation/computed/formula.d.ts +2 -2
- package/dist/validation/computed/rollup.d.mts +2 -2
- package/dist/validation/computed/rollup.d.ts +2 -2
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/core/index.d.mts +1 -1
- package/dist/validation/core/index.d.ts +1 -1
- package/dist/validation/object/index.d.mts +1 -1
- package/dist/validation/object/index.d.ts +1 -1
- package/dist/validation/primitives/checkbox.d.mts +1 -1
- package/dist/validation/primitives/checkbox.d.ts +1 -1
- package/dist/validation/primitives/date.d.mts +1 -1
- package/dist/validation/primitives/date.d.ts +1 -1
- package/dist/validation/primitives/number.d.mts +1 -1
- package/dist/validation/primitives/number.d.ts +1 -1
- package/dist/validation/primitives/text.d.mts +1 -1
- package/dist/validation/primitives/text.d.ts +1 -1
- package/dist/view-config.schema-QmnihdGp.js +2 -0
- package/dist/view-config.schema-c8LvH8WE.mjs +2 -0
- package/package.json +2 -2
- package/dist/exceptions-B2EKDci0.d.mts +0 -1460
- package/dist/exceptions-B2EKDci0.d.ts +0 -1460
- package/dist/view-config.schema-PCAznd98.mjs +0 -2
- package/dist/view-config.schema-VEoY_VAd.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as ValidationResult, n as DEFAULT_VALIDATION_MESSAGES, r as ValidationMessages, t as formatZodErrors } from "../../index-
|
|
2
|
+
import { i as ValidationResult, n as DEFAULT_VALIDATION_MESSAGES, r as ValidationMessages, t as formatZodErrors } from "../../index-BV4yNsr7.mjs";
|
|
3
3
|
export { DEFAULT_VALIDATION_MESSAGES, type ValidationMessages, type ValidationResult, formatZodErrors };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as ValidationResult, n as DEFAULT_VALIDATION_MESSAGES, r as ValidationMessages, t as formatZodErrors } from "../../index-
|
|
2
|
+
import { i as ValidationResult, n as DEFAULT_VALIDATION_MESSAGES, r as ValidationMessages, t as formatZodErrors } from "../../index-BL7EA39F.js";
|
|
3
3
|
export { DEFAULT_VALIDATION_MESSAGES, type ValidationMessages, type ValidationResult, formatZodErrors };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as validateDraft, c as validateObjectOrThrow, d as createAttributeValidator, f as createFormAttributeValidator, i as validateAttribute, l as createDraftValidator, n as isRecordComplete, o as validateDraftOrThrow, r as rejectUnknownAttributesOrThrow, s as validateObject, t as getMissingRequiredAttributes, u as createObjectValidator } from "../../index-
|
|
2
|
+
import { a as validateDraft, c as validateObjectOrThrow, d as createAttributeValidator, f as createFormAttributeValidator, i as validateAttribute, l as createDraftValidator, n as isRecordComplete, o as validateDraftOrThrow, r as rejectUnknownAttributesOrThrow, s as validateObject, t as getMissingRequiredAttributes, u as createObjectValidator } from "../../index-B-mUjnh9.mjs";
|
|
3
3
|
export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as validateDraft, c as validateObjectOrThrow, d as createAttributeValidator, f as createFormAttributeValidator, i as validateAttribute, l as createDraftValidator, n as isRecordComplete, o as validateDraftOrThrow, r as rejectUnknownAttributesOrThrow, s as validateObject, t as getMissingRequiredAttributes, u as createObjectValidator } from "../../index-
|
|
2
|
+
import { a as validateDraft, c as validateObjectOrThrow, d as createAttributeValidator, f as createFormAttributeValidator, i as validateAttribute, l as createDraftValidator, n as isRecordComplete, o as validateDraftOrThrow, r as rejectUnknownAttributesOrThrow, s as validateObject, t as getMissingRequiredAttributes, u as createObjectValidator } from "../../index-D9OhYX-t.js";
|
|
3
3
|
export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
+
const e=require("./config-WUWITOeW.js"),t=require("./exceptions.js");let n=require("zod");const r={createdAt:`createdAt`,updatedAt:`updatedAt`,createdBy:`createdBy`,lastUpdatedBy:`lastUpdatedBy`,attachments:`attachments`};function getSystemAttributeI18nKey(e){return r[e]}const i={createdAt:{id:`system:createdAt`,name:`createdAt`,label:`Created time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was created`},updatedAt:{id:`system:updatedAt`,name:`updatedAt`,label:`Last edited time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was last modified`},createdBy:{id:`system:createdBy`,name:`createdBy`,label:`Created by`,type:`user`,required:!1,system:!0,multiple:!1,icon:`user`,description:`Actor who created this record`},lastUpdatedBy:{id:`system:lastUpdatedBy`,name:`lastUpdatedBy`,label:`Last edited by`,type:`user`,required:!1,system:!0,multiple:!1,icon:`user`,description:`Actor who last modified this record`},attachments:{id:`system:attachments`,name:`attachments`,label:`Attachments`,type:`document`,required:!1,system:!0,hidden:!0,icon:`paperclip`,description:`Free-form document attachments`}};function getSystemAttributeList(){return Object.values(i)}function isManagedSystemAttribute(e){return e.id?.startsWith(`system:`)??!1}const a=[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`],o=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_empty`,`is_not_empty`],s=[`is`],c=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`is_empty`,`is_not_empty`],l=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],u=[`any_of`,`none_of`,`is_empty`,`is_not_empty`],d=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],f=[`is_empty`,`is_not_empty`],p=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`contains`,`not_contains`,`is_empty`,`is_not_empty`],m=[`city`,`postalCode`,`country`];function isLocationFilterProperty(e){return m.includes(e)}function isLocationPartOperator(e){return a.includes(e)}const h={text:a,richtext:[],number:o,checkbox:s,date:c,phone:[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`is_empty`,`is_not_empty`],currency:o,status:l,select:l,multiselect:u,location:[],user:d,relation:d,formula:p,document:f},g=new Set([`formula`,`rollup`]),ee=new Set([`user`,`relation`,`document`]),_=new Set([`text`,`richtext`,`number`,`select`,`multiselect`,`status`,`date`,`phone`,`currency`,`location`,`user`,`relation`,`document`]),v=new Set([`text`,`number`,`date`,`phone`,`currency`,`select`,`multiselect`]),te=new Set([`text`,`phone`,`status`,`select`,`multiselect`]),ne=new Set([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`]);function getAttributeCapabilities(e){let t=!!(e.hidden||e.archived),n=!e.archived,r=g.has(e.type),i=e.type===`document`,a=ee.has(e.type),o=getAttributeCardinality(e),s=t?[]:getRawFilterOperators(e),c=s.length>0&&!t,l=!t&&te.has(e.type),u=!t&&ne.has(e.type),d=!t&&isGroupableType(e.type),f=!t&&e.type===`status`,p=isManagedSystemAttribute(e),m=r||i||p,h=!(t||m),_=isRequiredForbidden(e.type)?`forbidden`:`allowed`,y=getDefaultValueCapability(e.type),b=supportsMaxItems(e),x=v.has(e.type),S=!(!e.deprecated||t),C=resolveEditMode(e);return{lifecycle:{active:n,deprecated:!!e.deprecated,visibleInArchitect:!0,visibleInRuntime:!t,warningWhenDeprecated:S},storage:{mode:r?`computed`:a?`edge`:`value`,cardinality:o,edgeBacked:a,preservesExistingValues:!!e.archived,qualifiedProperties:supportsQualifiedProperties(e.type),polymorphic:getPolymorphicCapability(e),maxItems:b},authoring:{editable:h,readOnly:m,directEdit:h&&C===`inline`,required:_,defaultValue:y,placeholder:x,maxItems:b},presentation:{formField:!t&&isFormFieldType(e.type),tableCell:!t&&isTableCellType(e.type),defaultColumn:!t&&isDefaultColumnType(e.type),compactDisplay:!t,popoverEditor:!t&&C===`popover`,placeholder:x,warningWhenDeprecated:S},query:{filterable:c,searchable:l,sortable:u,groupable:d,kanbanGroupable:f,operators:s},agent:{readable:!t,writable:h&&!i,compactReadable:!t,contentReadable:!t&&isContentReadableType(e.type),requiresDedicatedTool:i},exchange:{importable:!t,exportable:!t,schemaExportable:!0,metadataExportable:!1}}}function getAttributeFilterOperators(e){return getAttributeCapabilities(e).query.operators}function isAttributeFilterable(e){return getAttributeCapabilities(e).query.filterable}function isAttributeSearchable(e){return getAttributeCapabilities(e).query.searchable}function isAttributeSortable(e){return getAttributeCapabilities(e).query.sortable}function isAttributeGroupable(e){return getAttributeCapabilities(e).query.groupable}function isAttributeKanbanGroupable(e){return getAttributeCapabilities(e).query.kanbanGroupable}function resolveEffectiveFilterType(e){if(e.type!==`rollup`)return e.type;let t=e;if(t.function===`earliest`||t.function===`latest`)return`date`;if(t.function===`original`){let e=t.targetAttributeType;if(e&&hasFilterOperatorEntry(e))return e}return`number`}function getRollupFilterOperators$1(e){let t=resolveEffectiveFilterType(e);return hasFilterOperatorEntry(t)?h[t]:h.number}function getRawFilterOperators(e){return e.type===`rollup`?getRollupFilterOperators$1(e):h[e.type]??[]}function getAttributeCardinality(e){return e.type===`multiselect`||e.type===`document`||e.type===`user`&&e.multiple===!0||e.type===`relation`&&e.cardinality===`many`?`many`:`one`}function getPolymorphicCapability(e){if(e.type!==`relation`)return`none`;let t=e.targets??[];return t.length===1&&t[0]?.object===`*`?`internal`:t.length>1?`code-only`:`none`}function supportsMaxItems(e){return e.type===`multiselect`||e.type===`relation`&&e.cardinality===`many`}function supportsQualifiedProperties(e){return e===`relation`||e===`document`}function isRequiredForbidden(e){return e===`checkbox`||e===`formula`||e===`rollup`}function getDefaultValueCapability(e){return e===`checkbox`?`automatic`:e===`formula`||e===`rollup`?`forbidden`:_.has(e)?`static`:`forbidden`}function isDefaultColumnType(e){return isTableCellType(e)}function isTableCellType(e){return e!==`richtext`&&e!==`document`}function isFormFieldType(e){return e!==`richtext`}function resolveEditMode(e){switch(e.type){case`checkbox`:return`inline`;case`number`:return e.renderAs===`rating`?`inline`:`default`;case`select`:case`multiselect`:return e.renderAs===`badges`?`inline`:`popover`;case`status`:case`relation`:case`user`:case`date`:return`popover`;default:return`default`}}function isGroupableType(e){return e===`status`||e===`currency`}function isContentReadableType(e){return e===`richtext`||e===`document`}function hasFilterOperatorEntry(e){return Object.prototype.hasOwnProperty.call(h,e)}const y=h,b=[`is_empty`,`is_not_empty`];function isNoValueOperator(e){return b.includes(e)}function filterOperatorsByTypeForGeneration(e){return e===`rollup`?b:y[e]??[]}function getRollupFilterOperators(e){return getRollupFilterOperators$1(e)}const x=/^\d{4}-\d{2}-\d{2}$/u;function isCalendarDay(e){if(!x.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function isDynamicValue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`dynamic`in e}function currentActor(){return{dynamic:`actor`,ref:`current`}}function today(){return{dynamic:`date`,anchor:`today`}}function now(){return{dynamic:`date`,anchor:`now`}}function toAmount(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 null}function extractCurrencyFilterValue(e){return typeof e==`object`&&e?`value`in e?toAmount(e.value):null:toAmount(e)}function extractFilterValue(e){return e==null?null:typeof e==`object`&&`value`in e?e.value??null:e}const S=new Set([`is_not`,`not_contains`,`none_of`,`is_empty`]),C={is_not:`is`,not_contains:`contains`,none_of:`any_of`,is_empty:`is_not_empty`};function getOperatorPolarity(e){return S.has(e)?`none`:`any`}function normalizeForEdgeRpc(e){return C[e]??e}const w={is:`any_of`,is_not:`none_of`};function toMultiValueOperator(e){return w[e]??e}const T=new Set(Object.values(w).filter(e=>e!==void 0));function isSetMembershipOperator(e){return T.has(e)}function canonicalizeFilterValue(e,n){let r=e.value;if(isNoValueOperator(e.operator)||r==null||isDynamicValue(r))return;if(isSetMembershipOperator(e.operator)){Array.isArray(r)||(e.value=[r]);return}if(n!==`currency`)return;let i=extractCurrencyFilterValue(r);if(i!==null){e.value=i;return}if(!hasCurrencyAmount(r))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(r)}`;throw new t.ValidationError(a,[{path:[`value`],message:a}])}function hasCurrencyAmount(e){return typeof e!=`object`||`value`in e&&e.value!=null}const E={eq:`is`,equals:`is`,equal:`is`,"==":`is`,"=":`is`,neq:`is_not`,notEqual:`is_not`,isNot:`is_not`,"!=":`is_not`,"<>":`is_not`,lt:`less_than`,"<":`less_than`,gt:`greater_than`,">":`greater_than`,lte:`less_or_equal`,"<=":`less_or_equal`,gte:`greater_or_equal`,">=":`greater_or_equal`,in:`any_of`,isAnyOf:`any_of`,anyOf:`any_of`,oneOf:`any_of`,notIn:`none_of`,not_in:`none_of`,isNoneOf:`none_of`,noneOf:`none_of`,notOneOf:`none_of`,startsWith:`starts_with`,beginsWith:`starts_with`,endsWith:`ends_with`,doesNotContain:`not_contains`,notContain:`not_contains`,isEmpty:`is_empty`,isNotEmpty:`is_not_empty`};function normalizeOperator(e){return E[e]??e}function normalizeFilterRule(e){let t=normalizeOperator(e.operator);return t===e.operator?e:{...e,operator:t}}const D=864e5,O=new Set([`days`,`weeks`,`months`,`years`]),k=new Set([`past`,`future`]);function isRelativeDateValue(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.unit==`string`&&O.has(t.unit)&&typeof t.direction==`string`&&k.has(t.direction)}function utcDayStart(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function shiftUtcDay(e,t,n){if(n===`days`)return e+t*D;if(n===`weeks`)return e+t*7*D;let r=new Date(e),i=r.getUTCFullYear()+(n===`years`?t:0),a=r.getUTCMonth()+(n===`months`?t:0),o=new Date(Date.UTC(i,a+1,0)).getUTCDate();return Date.UTC(i,a,Math.min(r.getUTCDate(),o))}function resolveIsWithinBounds(e,t=new Date){if(!isRelativeDateValue(e))return null;let n=utcDayStart(t),r=Math.trunc(e.amount),i=e.direction===`past`?{startMs:shiftUtcDay(n,-r,e.unit),endMs:n+D}:{startMs:n,endMs:shiftUtcDay(n,r,e.unit)+D};return Number.isFinite(i.startMs)&&Number.isFinite(i.endMs)?i:null}function resolveUtcDayBounds(e){if(!Number.isFinite(e))return null;let t=utcDayStart(new Date(e));return Number.isFinite(t)?{startMs:t,endMs:t+D}:null}function toUtcDayString(e){return new Date(e).toISOString().slice(0,10)}const A=new Set([`relation`,`document`,`user`]),j=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],re={id:j,objectId:j,tenantId:j,label:y.text,createdAt:y.date,updatedAt:y.date,deletedAt:y.date,createdBy:y.user,lastUpdatedBy:y.user},M={id:`text`,objectId:`text`,objectName:`text`,tenantId:`text`,label:`text`,createdAt:`date`,updatedAt:`date`,deletedAt:`date`,deletedBy:`user`,createdBy:`user`,lastUpdatedBy:`user`,visibility:`select`,ownedBy:`user`},N={before:`"less_than"`,after:`"greater_than"`,on_or_before:`"less_or_equal"`,on_or_after:`"greater_or_equal"`,is_checked:`"is" with value true`,is_not_checked:`"is" with value false`,day_month_eq:`"on_day_month"`},ie=new Set(Object.entries(h).filter(([,e])=>e.includes(`any_of`)&&!e.includes(`contains`)).map(([e])=>e)),ae={contains:`any_of`,not_contains:`none_of`};function resolveCanonicalOperator(e,n){let r=N[e];if(r){let n=`Unknown filter operator "${e}" — use ${r}`;throw new t.ValidationError(n,[{path:[`operator`],message:n}])}let i=normalizeOperator(e),a=ae[i];if(a&&ie.has(n)){let e=`Operator "${i}" is not valid for type "${n}" — use "${a}"`;throw new t.ValidationError(e,[{path:[`operator`],message:e}])}return i}function assertOperatorForType(e,n,r){let i=resolveCanonicalOperator(e,n),a=y[n];if(!a?.includes(i)){let i=`Operator "${e}" is not valid for ${r} type "${n}". Valid operators: ${a?.length?a.join(`, `):`(no operators registered for this type)`}.`;throw new t.ValidationError(i,[{path:[`operator`],message:i}])}return i}function assertRelativeDateValue(e){if(e.operator===`is_within`&&!isRelativeDateValue(e.value)){let e=`Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;throw new t.ValidationError(e,[{path:[`value`],message:e}])}}const oe=/^(\d{4}-\d{2}-\d{2})(?:[T ](?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:(?:0\d|1[0-3])(?::[0-5]\d)?|14(?::00)?))?)?$/,se=new Set([`is`,`is_not`,`less_than`,`less_or_equal`,`greater_than`,`greater_or_equal`]);function assertAbsoluteDateValue(e,n){if(n!==`date`||!se.has(e.operator))return;let r=e.value;if(r==null||isDynamicValue(r)||typeof r==`string`&&isCastableDay(r))return;let i=`Filter on a date attribute expected a YYYY-MM-DD day, optionally followed by a time, received ${JSON.stringify(r)}`;throw new t.ValidationError(i,[{path:[`value`],message:i}])}function isCastableDay(e){let t=oe.exec(e)?.[1];return!t||t.startsWith(`0000-`)?!1:isCalendarDay(t)}function resolveComparandType(e){return e.type===`formula`&&e.returnType===`date`?`date`:resolveEffectiveFilterType(e)}function applyCanonicalForm(e,t,n){e.operator=t,canonicalizeFilterValue(e,n),assertRelativeDateValue(e),assertAbsoluteDateValue(e,n)}function assertDynamicValueForAttribute(e,n){if(!isDynamicValue(e.value))return;let r=e.value;if(r.dynamic===`actor`&&n!==`user`){let e=`actor token (@me) is only valid on user attributes, not "${n}"`;throw new t.ValidationError(e,[{path:[`value`],message:e}])}if(r.dynamic===`date`&&n!==`date`){let e=`date token (@today/@now) is only valid on date attributes, not "${n}"`;throw new t.ValidationError(e,[{path:[`value`],message:e}])}}const P=m.map(e=>`"${e}"`).join(`, `);function operatorList(e){return e.length?e.join(`, `):`(not filterable)`}function qualifyWithSchema(e){if(A.has(e.type))return e.properties}function locationPartsHint(e){return e===`location`?` A location is filtered on one of its parts: set "property" to one of ${P} and use a text operator (e.g. contains).`:``}function dottedPathHint(e,t,n){let r=` Dotted paths are not supported — `;if(n.type===`location`)return`${r}set "attribute" to "${e}" and "property" to ${isLocationFilterProperty(t)?`"${t}"`:`one of ${P}`}.`;let i=qualifyWithSchema(n);if(i){let n=i.definitions.map(e=>`"${e.name}"`).join(`, `);return`${r}set "attribute" to "${e}" and "property" to ${i.definitions.some(e=>e.name===t)?`"${t}"`:`one of ${n}`} to filter on the edge property.`}let a=getAttributeFilterOperators(n);return`${r}${a.length?`set "attribute" to "${e}" and use one of ${a.join(`, `)}`:`"${e}" is not filterable`}; the full-text "query" parameter matches tokens by relevance, not values.`}function collectQualifiedRuleIssues(e,n){try{return validateQualifiedRule({...e},n),[]}catch(e){if(!(e instanceof t.ValidationError))throw e;return e.errors.map(e=>({...e,path:[...e.path]}))}}function validateQualifiedRule(e,n){let r=n.attributes.find(t=>t.name===e.attribute),i=re[e.attribute];if(!(r||i)){let[r,...i]=e.attribute.split(`.`),a=i.length>0?n.attributes.find(e=>e.name===r):void 0,o=a?dottedPathHint(r??``,i[0]??``,a):e.attribute.includes(`.`)?` Dotted paths are not supported — filter on the attribute name alone with a structured operator (contains, any_of, …); the full-text "query" parameter matches tokens by relevance, not values.`:``,s=`Unknown attribute: ${e.attribute}${o}`;throw new t.ValidationError(s,[{path:[`attribute`],message:s}])}if(e.quantifier!==void 0&&!e.property){let e=`quantifier is only valid on qualified edge rules (set "property")`;throw new t.ValidationError(e,[{path:[`quantifier`],message:e}])}if(!r){if(e.property)throw new t.ValidationError(`Cannot qualify system attribute "${e.attribute}"`,[{path:[`property`],message:`"${e.attribute}" is a system column, not a reference`}]);let n=M[e.attribute]??`text`,r=resolveCanonicalOperator(e.operator,n);if(!i.includes(r)){let n=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${i.join(`, `)}.`;throw new t.ValidationError(n,[{path:[`operator`],message:n}])}applyCanonicalForm(e,r,n);return}if(!e.property){assertDynamicValueForAttribute(e,r.type);let n=getAttributeFilterOperators(r),i=resolveCanonicalOperator(e.operator,r.type);if(!n.includes(i)){let i=`Operator "${e.operator}" is not valid for attribute "${r.name}". Valid operators: ${operatorList(n)}.${locationPartsHint(r.type)}`;throw new t.ValidationError(i,[{path:[`operator`],message:i}])}applyCanonicalForm(e,i,resolveComparandType(r));return}if(r.type===`location`){if(e.quantifier!==void 0){let e=`quantifier is not valid on a location part — a location is one value, not a set of edges`;throw new t.ValidationError(e,[{path:[`quantifier`],message:e}])}if(!isLocationFilterProperty(e.property)){let n=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${P}.`;throw new t.ValidationError(n,[{path:[`property`],message:n}])}assertDynamicValueForAttribute(e,`text`),applyCanonicalForm(e,assertOperatorForType(e.operator,`text`,`property`),`text`);return}if(!A.has(r.type))throw new t.ValidationError(`Cannot qualify ${r.type} attribute "${e.attribute}"`,[{path:[`property`],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=r.properties;if(!a)throw new t.ValidationError(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:[`property`],message:`"${e.attribute}" has no qualifyWith`}]);let o=a.definitions.find(t=>t.name===e.property);if(!o)throw new t.ValidationError(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:[`property`],message:`Unknown property: ${e.property}`}]);applyCanonicalForm(e,assertOperatorForType(e.operator,o.type,`property`),o.type)}const F=1e4;function isPlainJsonObject(e){let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null&&t.constructor?.name===`Object`}function addJsonIssue(e,t,n=[]){e.addIssue({code:`custom`,message:t,path:n})}function pushJsonArrayChildren(e,t,n,r){for(let n of Reflect.ownKeys(e))if(n!==`length`){if(n===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,[...t.path,n]);continue}(typeof n==`symbol`||!/^(0|[1-9]\d*)$/.test(n))&&addJsonIssue(r,`Arrays cannot contain non-index JSON properties`,[...t.path,n])}for(let i=e.length-1;i>=0;i--){let a=Object.getOwnPropertyDescriptor(e,String(i)),o=[...t.path,i];if(!(a&&`value`in a)){addJsonIssue(r,`Sparse arrays are not valid JSON values`,o);continue}n.push({kind:`enter`,value:a.value,path:o,depth:t.depth+1})}}function pushJsonObjectChildren(e,t,n,r){let i=Reflect.ownKeys(e);for(let a=i.length-1;a>=0;a--){let o=i[a],s=[...t.path,o];if(o===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,s);continue}if(typeof o==`symbol`){addJsonIssue(r,`Symbol keys are not valid JSON keys`,s);continue}let c=Object.getOwnPropertyDescriptor(e,o);if(!(c?.enumerable&&`value`in c)){addJsonIssue(r,`Custom props must contain enumerable data properties only`,s);continue}n.push({kind:`enter`,value:c.value,path:s,depth:t.depth+1})}}function validateJsonProps(e,t){if(typeof e!=`object`||!e){addJsonIssue(t,`Expected a plain JSON object`);return}try{if(Array.isArray(e)||!isPlainJsonObject(e)){addJsonIssue(t,`Expected a plain JSON object`);return}}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`);return}let n=new WeakSet,r=[{kind:`enter`,value:e,path:[],depth:0}],i=0;for(;r.length>0;){let e=r.pop();if(!e)break;if(e.kind===`exit`){n.delete(e.value);continue}if(i++,i>F){addJsonIssue(t,`Custom props cannot exceed ${F.toLocaleString(`en-US`)} total JSON nodes`,e.path);return}if(e.depth>64){addJsonIssue(t,`Custom props cannot exceed depth 64`,e.path);continue}let a=e.value;if(!(a===null||typeof a==`string`||typeof a==`boolean`||typeof a==`number`&&Number.isFinite(a))){if(typeof a!=`object`){addJsonIssue(t,`Expected a JSON value`,e.path);continue}if(n.has(a)){addJsonIssue(t,`Custom props cannot contain circular references`,e.path);continue}try{if(Array.isArray(a)){n.add(a),r.push({kind:`exit`,value:a}),pushJsonArrayChildren(a,e,r,t);continue}if(!isPlainJsonObject(a)){addJsonIssue(t,`Expected an array or plain JSON object`,e.path);continue}n.add(a),r.push({kind:`exit`,value:a}),pushJsonObjectChildren(a,e,r,t)}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`,e.path)}}}}const I=n.z.unknown().superRefine(validateJsonProps).transform(e=>e),L=n.z.array(n.z.string()).max(e.j.columnsPerTab),R=n.z.array(n.z.string().min(1)).max(e.j.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:`Displayed attribute names must be unique`}),z=n.z.object({attribute:n.z.string().describe(`Attribute to sort by`),direction:n.z.enum([`asc`,`desc`]).describe(`asc or desc`)}).strict(),B=n.z.array(z).max(e.j.sortsPerTab),V=n.z.object({amount:n.z.number().describe(`Count`),unit:n.z.enum([`days`,`weeks`,`months`,`years`]).describe(`Unit`),direction:n.z.enum([`past`,`future`]).describe(`Past or future`)}).strict(),H=n.z.object({value:n.z.number().nullable().describe(`Amount`),code:n.z.array(n.z.string()).optional().describe(`Currency codes`)}).strict(),U=n.z.object({phoneNumber:n.z.string().nullable().describe(`Number`),countryCode:n.z.string().optional().describe(`ISO country code`)}).strict(),W=n.z.discriminatedUnion(`dynamic`,[n.z.object({dynamic:n.z.literal(`actor`).describe(`Resolved at filter time`),ref:n.z.literal(`current`).describe(`The current actor`)}).strict(),n.z.object({dynamic:n.z.literal(`date`).describe(`Resolved at filter time`),anchor:n.z.enum([`today`,`now`]).describe(`Anchor`)}).strict()]),G=n.z.object({month:n.z.number().describe(`1-12`),day:n.z.number().describe(`Day`)}).strict(),K=n.z.union([n.z.string(),n.z.number(),n.z.boolean(),n.z.array(n.z.string()),V,H,U,G,W,n.z.null()]),ce=n.z.enum([`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`any_of`,`none_of`],{error:e=>{let t=e.input,n=typeof t==`string`?N[t]:void 0;return n?`Unknown filter operator "${t}" — use ${n}`:void 0}}),le=n.z.object({attribute:n.z.string().describe(`Attribute to filter on`),property:n.z.string().optional().describe(`Qualified edge property`),quantifier:n.z.enum([`any`,`none`]).optional().describe(`For a multi-value attribute`),operator:ce.describe(`Comparison`),value:K.describe(`Comparison value, by attribute type`)}).strict(),ue=n.z.array(le).max(e.j.filterRulesPerTab),q=n.z.object({combinator:n.z.enum([`and`,`or`]).describe(`Match every rule or any rule`),rules:ue.describe(`The rules`)}).strict(),de={span:n.z.union([n.z.literal(1),n.z.literal(2),n.z.literal(3),n.z.literal(4),n.z.literal(5),n.z.literal(6),n.z.literal(7),n.z.literal(8),n.z.literal(9),n.z.literal(10),n.z.literal(11),n.z.literal(12)]).optional().describe(`Columns of 12 this field occupies`),label:n.z.string().optional().describe(`Overrides the attribute's label`),readOnly:n.z.boolean().optional().describe(`Shows the value, not editable`)},fe=n.z.object({attribute:n.z.string().describe(`Attribute API name shown by this field`),...de}).strict(),pe=n.z.object({name:n.z.string().describe(`Group API name, unique in the form`),label:n.z.string().describe(`Label people see`),description:n.z.string().optional().describe(`Extra context under the label`),collapsible:n.z.boolean().optional().describe(`Whether the group can be collapsed`),collapsed:n.z.boolean().optional().describe(`Whether the group starts collapsed`),fields:n.z.array(fe).max(e.j.fieldsPerGroup).describe(`Fields in this group, in order`)}).strict();function refineFormContent(t,n){t.groups.reduce((e,t)=>e+t.fields.length,0)>e.j.fieldsPerFormTab&&n.addIssue({code:`too_big`,origin:`array`,maximum:e.j.fieldsPerFormTab,inclusive:!0,message:`A form content can contain at most ${e.j.fieldsPerFormTab} fields`,path:[`groups`]});let r=new Set,i=new Set;t.groups.forEach((e,t)=>{r.has(e.name)&&n.addIssue({code:`custom`,message:`Duplicate group name "${e.name}"`,path:[`groups`,t,`name`]}),r.add(e.name),e.fields.forEach((e,r)=>{i.has(e.attribute)&&n.addIssue({code:`custom`,message:`Duplicate field attribute "${e.attribute}"`,path:[`groups`,t,`fields`,r,`attribute`]}),i.add(e.attribute)})})}const J={name:n.z.string().describe(`Content API name, unique in the view`),label:n.z.string().optional().describe(`Label people see`),icon:e.A.optional().describe(`Icon name`),placement:n.z.enum([`main`,`aside`]).describe(`main: the tab strip. aside: the side panel`)},Y=n.z.object({object:n.z.string().optional().describe(`Every record of this object`),relation:n.z.string().optional().describe(`Records linked through this relation`)}).strict().superRefine((e,t)=>{e.object===void 0&&e.relation===void 0&&t.addIssue({code:`custom`,message:`Collection source must define an object, a relation, or both`})}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),me={...J,type:n.z.literal(`collection`),source:Y.describe(`object: every record; relation: records linked to this record; both: records of object whose relation points at this record`),visibility:n.z.enum(e.M).optional().describe(`all: no scope; workspace: every member; private: viewer's own`),columns:n.z.array(n.z.union([n.z.string(),n.z.object({relationProperty:n.z.string().refine(e=>e.trim().length>0).describe(`Qualified edge property shown as a column`)}).strict()])).max(e.j.columnsPerTab).optional().describe(`Table columns, in order`),descriptionAttribute:n.z.string().optional().describe(`Secondary line under each row's title (list layout)`),displayAttributes:R.optional().describe(`Attributes shown on each card`),filters:q.optional().describe(`Restricts which records show`),sorts:B.optional().describe(`Sort order`),actions:n.z.enum([`create`,`update`,`delete`,`attach`,`detach`]).array().optional().describe(`Offered actions; absent = every action, [] = none`),openMode:n.z.enum([`page`,`peek`]).optional().describe(`page or peek (the record panel)`),createMode:n.z.enum([`page`,`peek`,`inline`]).optional().describe(`page, peek, or inline (creates without opening)`)},he=n.z.object({...me,layout:n.z.enum([`table`,`list`,`kanban`]).describe(`table columns, list cards, kanban board grouped by a select/status attribute`),columnSizing:n.z.record(n.z.string(),n.z.number()).optional().describe(`Column widths in pixels, by attribute name`),groupByAttribute:n.z.string().optional().describe(`Kanban only: the select or status attribute that names the columns`),kanbanColumnOrder:n.z.array(n.z.string()).optional().describe(`Kanban: column order by option value`),kanbanColumnVisibility:n.z.record(n.z.string(),n.z.boolean()).optional().describe(`Kanban: which columns are shown`),kanbanPinnedColumns:n.z.array(n.z.string()).optional().describe(`Kanban: columns pinned first`)}).strict().superRefine((e,t)=>{let n=[`groupByAttribute`,`kanbanColumnOrder`,`kanbanColumnVisibility`,`kanbanPinnedColumns`];if(e.layout===`kanban`){e.groupByAttribute===void 0&&t.addIssue({code:`custom`,path:[`groupByAttribute`],message:`A kanban layout requires groupByAttribute`});return}for(let r of n)e[r]!==void 0&&t.addIssue({code:`custom`,path:[r],message:`Only a kanban layout groups by an attribute`})}),X={...J,type:n.z.literal(`form`),groups:n.z.array(pe).max(e.j.groupsPerFormTab).describe(`Field groups, in order`),formColumns:n.z.union([n.z.literal(1),n.z.literal(2),n.z.literal(3)]).optional().describe(`Grid columns, 1-3`),density:n.z.enum([`compact`,`comfortable`,`spacious`]).optional().describe(`Vertical spacing between fields`)},ge=n.z.object(X).strict().superRefine(refineFormContent),_e=n.z.object({...X,groups:X.groups.min(1,`A published form content requires at least one group`)}).strict().superRefine(refineFormContent),Z=[he,n.z.object({...J,type:n.z.literal(`custom`),extension:n.z.string().describe(`Name of a registered extension`),parameters:n.z.lazy(()=>I).optional().describe(`Extension parameters`)}).strict(),n.z.object({...J,type:n.z.literal(`activity`)}).strict(),n.z.object({...J,type:n.z.literal(`richtext`),attribute:n.z.string().describe(`Richtext attribute edited in place`),titleAttribute:n.z.string().optional().describe(`Text attribute shown as the title`)}).strict(),n.z.object({...J,type:n.z.literal(`documents`),allowUpload:n.z.boolean().optional().describe(`Lets people add files here`),allowRemove:n.z.boolean().optional().describe(`Lets people remove files here`),hideAttachments:n.z.boolean().optional().describe(`Hides files attached elsewhere (e.g. emails)`),relations:n.z.array(n.z.string()).optional().describe(`Document relations shown; the record's own files if absent`)}).strict(),n.z.object({...J,type:n.z.literal(`forms`),objectName:n.z.string().optional().describe(`Limits to this object's published forms`)}).strict(),n.z.object({...J,type:n.z.literal(`emails`),emailAttributes:n.z.array(n.z.string()).max(e.j.emailAttributesPerTab).describe(`Addresses`)}).strict(),n.z.object({...J,type:n.z.literal(`meetings`),emailAttributes:n.z.array(n.z.string()).max(e.j.emailAttributesPerTab).describe(`Addresses`)}).strict()],ve=n.z.discriminatedUnion(`type`,[ge,...Z]),Q=n.z.discriminatedUnion(`type`,[_e,...Z]),$={object:n.z.string(),name:n.z.string(),label:n.z.string(),description:n.z.string().optional(),icon:e.A.optional(),context:n.z.enum([`collection`,`record`]),default:n.z.boolean().optional()},ye=n.z.object({...$,contents:n.z.array(ve).max(e.j.tabsPerView)}).strict(),be=n.z.object({...$,contents:n.z.array(Q).max(e.j.tabsPerView)}).strict();function addDuplicateContentNameIssues(e,t){let n=new Set;e.contents.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate content name "${e.name}"`,path:[`contents`,r,`name`]}),n.add(e.name)})}function draftContentViewDefinitionSchemaFor(){return ye.superRefine((e,t)=>{addDuplicateContentNameIssues(e,t)})}function contentViewDefinitionSchemaFor(){return be.superRefine((e,t)=>{addDuplicateContentNameIssues(e,t),e.contents.some(e=>e.placement===`main`)||t.addIssue({code:`custom`,message:`A published view requires at least one main content`,path:[`contents`]})})}const xe=draftContentViewDefinitionSchemaFor(),Se=contentViewDefinitionSchemaFor();Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return getSystemAttributeI18nKey}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return isDynamicValue}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return getOperatorPolarity}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return extractCurrencyFilterValue}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return toMultiValueOperator}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return isAttributeKanbanGroupable}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return getAttributeFilterOperators}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return filterOperatorsByTypeForGeneration}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return isLocationFilterProperty}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return isAttributeSearchable}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return getRollupFilterOperators}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return today}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return isCalendarDay}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return extractFilterValue}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return isNoValueOperator}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return canonicalizeFilterValue}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return normalizeForEdgeRpc}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return isAttributeFilterable}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return getAttributeCapabilities}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return isAttributeGroupable}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return resolveEffectiveFilterType}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return isLocationPartOperator}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return resolveUtcDayBounds}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return normalizeFilterRule}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return getSystemAttributeList}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return resolveIsWithinBounds}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return isRelativeDateValue}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return contentViewDefinitionSchemaFor}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return now}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return currentActor}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return validateQualifiedRule}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return collectQualifiedRuleIssues}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return isAttributeSortable}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return draftContentViewDefinitionSchemaFor}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return isManagedSystemAttribute}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return toUtcDayString}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return isSetMembershipOperator}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return normalizeOperator}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return h}});
|
|
@@ -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
|
+
import{ValidationError as e}from"./exceptions.mjs";import{A as t,M as n,j as r}from"./config-BiQGgy7f.mjs";import{z as i}from"zod";const a={createdAt:`createdAt`,updatedAt:`updatedAt`,createdBy:`createdBy`,lastUpdatedBy:`lastUpdatedBy`,attachments:`attachments`};function getSystemAttributeI18nKey(e){return a[e]}const o={createdAt:{id:`system:createdAt`,name:`createdAt`,label:`Created time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was created`},updatedAt:{id:`system:updatedAt`,name:`updatedAt`,label:`Last edited time`,type:`date`,required:!1,system:!0,icon:`clock-circle`,description:`When this record was last modified`},createdBy:{id:`system:createdBy`,name:`createdBy`,label:`Created by`,type:`user`,required:!1,system:!0,multiple:!1,icon:`user`,description:`Actor who created this record`},lastUpdatedBy:{id:`system:lastUpdatedBy`,name:`lastUpdatedBy`,label:`Last edited by`,type:`user`,required:!1,system:!0,multiple:!1,icon:`user`,description:`Actor who last modified this record`},attachments:{id:`system:attachments`,name:`attachments`,label:`Attachments`,type:`document`,required:!1,system:!0,hidden:!0,icon:`paperclip`,description:`Free-form document attachments`}};function getSystemAttributeList(){return Object.values(o)}function isManagedSystemAttribute(e){return e.id?.startsWith(`system:`)??!1}const s=[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`],c=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_empty`,`is_not_empty`],l=[`is`],u=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`is_empty`,`is_not_empty`],d=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],f=[`any_of`,`none_of`,`is_empty`,`is_not_empty`],p=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],m=[`is_empty`,`is_not_empty`],h=[`is`,`is_not`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`contains`,`not_contains`,`is_empty`,`is_not_empty`],g=[`city`,`postalCode`,`country`];function isLocationFilterProperty(e){return g.includes(e)}function isLocationPartOperator(e){return s.includes(e)}const _={text:s,richtext:[],number:c,checkbox:l,date:u,phone:[`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`is_empty`,`is_not_empty`],currency:c,status:d,select:d,multiselect:f,location:[],user:p,relation:p,formula:h,document:m},ee=new Set([`formula`,`rollup`]),v=new Set([`user`,`relation`,`document`]),y=new Set([`text`,`richtext`,`number`,`select`,`multiselect`,`status`,`date`,`phone`,`currency`,`location`,`user`,`relation`,`document`]),te=new Set([`text`,`number`,`date`,`phone`,`currency`,`select`,`multiselect`]),b=new Set([`text`,`phone`,`status`,`select`,`multiselect`]),x=new Set([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`]);function getAttributeCapabilities(e){let t=!!(e.hidden||e.archived),n=!e.archived,r=ee.has(e.type),i=e.type===`document`,a=v.has(e.type),o=getAttributeCardinality(e),s=t?[]:getRawFilterOperators(e),c=s.length>0&&!t,l=!t&&b.has(e.type),u=!t&&x.has(e.type),d=!t&&isGroupableType(e.type),f=!t&&e.type===`status`,p=isManagedSystemAttribute(e),m=r||i||p,h=!(t||m),g=isRequiredForbidden(e.type)?`forbidden`:`allowed`,_=getDefaultValueCapability(e.type),y=supportsMaxItems(e),S=te.has(e.type),C=!(!e.deprecated||t),w=resolveEditMode(e);return{lifecycle:{active:n,deprecated:!!e.deprecated,visibleInArchitect:!0,visibleInRuntime:!t,warningWhenDeprecated:C},storage:{mode:r?`computed`:a?`edge`:`value`,cardinality:o,edgeBacked:a,preservesExistingValues:!!e.archived,qualifiedProperties:supportsQualifiedProperties(e.type),polymorphic:getPolymorphicCapability(e),maxItems:y},authoring:{editable:h,readOnly:m,directEdit:h&&w===`inline`,required:g,defaultValue:_,placeholder:S,maxItems:y},presentation:{formField:!t&&isFormFieldType(e.type),tableCell:!t&&isTableCellType(e.type),defaultColumn:!t&&isDefaultColumnType(e.type),compactDisplay:!t,popoverEditor:!t&&w===`popover`,placeholder:S,warningWhenDeprecated:C},query:{filterable:c,searchable:l,sortable:u,groupable:d,kanbanGroupable:f,operators:s},agent:{readable:!t,writable:h&&!i,compactReadable:!t,contentReadable:!t&&isContentReadableType(e.type),requiresDedicatedTool:i},exchange:{importable:!t,exportable:!t,schemaExportable:!0,metadataExportable:!1}}}function getAttributeFilterOperators(e){return getAttributeCapabilities(e).query.operators}function isAttributeFilterable(e){return getAttributeCapabilities(e).query.filterable}function isAttributeSearchable(e){return getAttributeCapabilities(e).query.searchable}function isAttributeSortable(e){return getAttributeCapabilities(e).query.sortable}function isAttributeGroupable(e){return getAttributeCapabilities(e).query.groupable}function isAttributeKanbanGroupable(e){return getAttributeCapabilities(e).query.kanbanGroupable}function resolveEffectiveFilterType(e){if(e.type!==`rollup`)return e.type;let t=e;if(t.function===`earliest`||t.function===`latest`)return`date`;if(t.function===`original`){let e=t.targetAttributeType;if(e&&hasFilterOperatorEntry(e))return e}return`number`}function getRollupFilterOperators$1(e){let t=resolveEffectiveFilterType(e);return hasFilterOperatorEntry(t)?_[t]:_.number}function getRawFilterOperators(e){return e.type===`rollup`?getRollupFilterOperators$1(e):_[e.type]??[]}function getAttributeCardinality(e){return e.type===`multiselect`||e.type===`document`||e.type===`user`&&e.multiple===!0||e.type===`relation`&&e.cardinality===`many`?`many`:`one`}function getPolymorphicCapability(e){if(e.type!==`relation`)return`none`;let t=e.targets??[];return t.length===1&&t[0]?.object===`*`?`internal`:t.length>1?`code-only`:`none`}function supportsMaxItems(e){return e.type===`multiselect`||e.type===`relation`&&e.cardinality===`many`}function supportsQualifiedProperties(e){return e===`relation`||e===`document`}function isRequiredForbidden(e){return e===`checkbox`||e===`formula`||e===`rollup`}function getDefaultValueCapability(e){return e===`checkbox`?`automatic`:e===`formula`||e===`rollup`?`forbidden`:y.has(e)?`static`:`forbidden`}function isDefaultColumnType(e){return isTableCellType(e)}function isTableCellType(e){return e!==`richtext`&&e!==`document`}function isFormFieldType(e){return e!==`richtext`}function resolveEditMode(e){switch(e.type){case`checkbox`:return`inline`;case`number`:return e.renderAs===`rating`?`inline`:`default`;case`select`:case`multiselect`:return e.renderAs===`badges`?`inline`:`popover`;case`status`:case`relation`:case`user`:case`date`:return`popover`;default:return`default`}}function isGroupableType(e){return e===`status`||e===`currency`}function isContentReadableType(e){return e===`richtext`||e===`document`}function hasFilterOperatorEntry(e){return Object.prototype.hasOwnProperty.call(_,e)}const S=_,C=[`is_empty`,`is_not_empty`];function isNoValueOperator(e){return C.includes(e)}function filterOperatorsByTypeForGeneration(e){return e===`rollup`?C:S[e]??[]}function getRollupFilterOperators(e){return getRollupFilterOperators$1(e)}const w=/^\d{4}-\d{2}-\d{2}$/u;function isCalendarDay(e){if(!w.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function isDynamicValue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`dynamic`in e}function currentActor(){return{dynamic:`actor`,ref:`current`}}function today(){return{dynamic:`date`,anchor:`today`}}function now(){return{dynamic:`date`,anchor:`now`}}function toAmount(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 null}function extractCurrencyFilterValue(e){return typeof e==`object`&&e?`value`in e?toAmount(e.value):null:toAmount(e)}function extractFilterValue(e){return e==null?null:typeof e==`object`&&`value`in e?e.value??null:e}const ne=new Set([`is_not`,`not_contains`,`none_of`,`is_empty`]),re={is_not:`is`,not_contains:`contains`,none_of:`any_of`,is_empty:`is_not_empty`};function getOperatorPolarity(e){return ne.has(e)?`none`:`any`}function normalizeForEdgeRpc(e){return re[e]??e}const T={is:`any_of`,is_not:`none_of`};function toMultiValueOperator(e){return T[e]??e}const E=new Set(Object.values(T).filter(e=>e!==void 0));function isSetMembershipOperator(e){return E.has(e)}function canonicalizeFilterValue(t,n){let r=t.value;if(isNoValueOperator(t.operator)||r==null||isDynamicValue(r))return;if(isSetMembershipOperator(t.operator)){Array.isArray(r)||(t.value=[r]);return}if(n!==`currency`)return;let i=extractCurrencyFilterValue(r);if(i!==null){t.value=i;return}if(!hasCurrencyAmount(r))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(r)}`;throw new e(a,[{path:[`value`],message:a}])}function hasCurrencyAmount(e){return typeof e!=`object`||`value`in e&&e.value!=null}const D={eq:`is`,equals:`is`,equal:`is`,"==":`is`,"=":`is`,neq:`is_not`,notEqual:`is_not`,isNot:`is_not`,"!=":`is_not`,"<>":`is_not`,lt:`less_than`,"<":`less_than`,gt:`greater_than`,">":`greater_than`,lte:`less_or_equal`,"<=":`less_or_equal`,gte:`greater_or_equal`,">=":`greater_or_equal`,in:`any_of`,isAnyOf:`any_of`,anyOf:`any_of`,oneOf:`any_of`,notIn:`none_of`,not_in:`none_of`,isNoneOf:`none_of`,noneOf:`none_of`,notOneOf:`none_of`,startsWith:`starts_with`,beginsWith:`starts_with`,endsWith:`ends_with`,doesNotContain:`not_contains`,notContain:`not_contains`,isEmpty:`is_empty`,isNotEmpty:`is_not_empty`};function normalizeOperator(e){return D[e]??e}function normalizeFilterRule(e){let t=normalizeOperator(e.operator);return t===e.operator?e:{...e,operator:t}}const O=864e5,ie=new Set([`days`,`weeks`,`months`,`years`]),ae=new Set([`past`,`future`]);function isRelativeDateValue(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.amount==`number`&&Number.isFinite(t.amount)&&t.amount>0&&typeof t.unit==`string`&&ie.has(t.unit)&&typeof t.direction==`string`&&ae.has(t.direction)}function utcDayStart(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function shiftUtcDay(e,t,n){if(n===`days`)return e+t*O;if(n===`weeks`)return e+t*7*O;let r=new Date(e),i=r.getUTCFullYear()+(n===`years`?t:0),a=r.getUTCMonth()+(n===`months`?t:0),o=new Date(Date.UTC(i,a+1,0)).getUTCDate();return Date.UTC(i,a,Math.min(r.getUTCDate(),o))}function resolveIsWithinBounds(e,t=new Date){if(!isRelativeDateValue(e))return null;let n=utcDayStart(t),r=Math.trunc(e.amount),i=e.direction===`past`?{startMs:shiftUtcDay(n,-r,e.unit),endMs:n+O}:{startMs:n,endMs:shiftUtcDay(n,r,e.unit)+O};return Number.isFinite(i.startMs)&&Number.isFinite(i.endMs)?i:null}function resolveUtcDayBounds(e){if(!Number.isFinite(e))return null;let t=utcDayStart(new Date(e));return Number.isFinite(t)?{startMs:t,endMs:t+O}:null}function toUtcDayString(e){return new Date(e).toISOString().slice(0,10)}const k=new Set([`relation`,`document`,`user`]),A=[`is`,`is_not`,`any_of`,`none_of`,`is_empty`,`is_not_empty`],oe={id:A,objectId:A,tenantId:A,label:S.text,createdAt:S.date,updatedAt:S.date,deletedAt:S.date,createdBy:S.user,lastUpdatedBy:S.user},j={id:`text`,objectId:`text`,objectName:`text`,tenantId:`text`,label:`text`,createdAt:`date`,updatedAt:`date`,deletedAt:`date`,deletedBy:`user`,createdBy:`user`,lastUpdatedBy:`user`,visibility:`select`,ownedBy:`user`},M={before:`"less_than"`,after:`"greater_than"`,on_or_before:`"less_or_equal"`,on_or_after:`"greater_or_equal"`,is_checked:`"is" with value true`,is_not_checked:`"is" with value false`,day_month_eq:`"on_day_month"`},se=new Set(Object.entries(_).filter(([,e])=>e.includes(`any_of`)&&!e.includes(`contains`)).map(([e])=>e)),ce={contains:`any_of`,not_contains:`none_of`};function resolveCanonicalOperator(t,n){let r=M[t];if(r){let n=`Unknown filter operator "${t}" — use ${r}`;throw new e(n,[{path:[`operator`],message:n}])}let i=normalizeOperator(t),a=ce[i];if(a&&se.has(n)){let t=`Operator "${i}" is not valid for type "${n}" — use "${a}"`;throw new e(t,[{path:[`operator`],message:t}])}return i}function assertOperatorForType(t,n,r){let i=resolveCanonicalOperator(t,n),a=S[n];if(!a?.includes(i)){let i=`Operator "${t}" is not valid for ${r} type "${n}". Valid operators: ${a?.length?a.join(`, `):`(no operators registered for this type)`}.`;throw new e(i,[{path:[`operator`],message:i}])}return i}function assertRelativeDateValue(t){if(t.operator===`is_within`&&!isRelativeDateValue(t.value)){let t=`Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;throw new e(t,[{path:[`value`],message:t}])}}const N=/^(\d{4}-\d{2}-\d{2})(?:[T ](?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:(?:0\d|1[0-3])(?::[0-5]\d)?|14(?::00)?))?)?$/,P=new Set([`is`,`is_not`,`less_than`,`less_or_equal`,`greater_than`,`greater_or_equal`]);function assertAbsoluteDateValue(t,n){if(n!==`date`||!P.has(t.operator))return;let r=t.value;if(r==null||isDynamicValue(r)||typeof r==`string`&&isCastableDay(r))return;let i=`Filter on a date attribute expected a YYYY-MM-DD day, optionally followed by a time, received ${JSON.stringify(r)}`;throw new e(i,[{path:[`value`],message:i}])}function isCastableDay(e){let t=N.exec(e)?.[1];return!t||t.startsWith(`0000-`)?!1:isCalendarDay(t)}function resolveComparandType(e){return e.type===`formula`&&e.returnType===`date`?`date`:resolveEffectiveFilterType(e)}function applyCanonicalForm(e,t,n){e.operator=t,canonicalizeFilterValue(e,n),assertRelativeDateValue(e),assertAbsoluteDateValue(e,n)}function assertDynamicValueForAttribute(t,n){if(!isDynamicValue(t.value))return;let r=t.value;if(r.dynamic===`actor`&&n!==`user`){let t=`actor token (@me) is only valid on user attributes, not "${n}"`;throw new e(t,[{path:[`value`],message:t}])}if(r.dynamic===`date`&&n!==`date`){let t=`date token (@today/@now) is only valid on date attributes, not "${n}"`;throw new e(t,[{path:[`value`],message:t}])}}const F=g.map(e=>`"${e}"`).join(`, `);function operatorList(e){return e.length?e.join(`, `):`(not filterable)`}function qualifyWithSchema(e){if(k.has(e.type))return e.properties}function locationPartsHint(e){return e===`location`?` A location is filtered on one of its parts: set "property" to one of ${F} and use a text operator (e.g. contains).`:``}function dottedPathHint(e,t,n){let r=` Dotted paths are not supported — `;if(n.type===`location`)return`${r}set "attribute" to "${e}" and "property" to ${isLocationFilterProperty(t)?`"${t}"`:`one of ${F}`}.`;let i=qualifyWithSchema(n);if(i){let n=i.definitions.map(e=>`"${e.name}"`).join(`, `);return`${r}set "attribute" to "${e}" and "property" to ${i.definitions.some(e=>e.name===t)?`"${t}"`:`one of ${n}`} to filter on the edge property.`}let a=getAttributeFilterOperators(n);return`${r}${a.length?`set "attribute" to "${e}" and use one of ${a.join(`, `)}`:`"${e}" is not filterable`}; the full-text "query" parameter matches tokens by relevance, not values.`}function collectQualifiedRuleIssues(t,n){try{return validateQualifiedRule({...t},n),[]}catch(t){if(!(t instanceof e))throw t;return t.errors.map(e=>({...e,path:[...e.path]}))}}function validateQualifiedRule(t,n){let r=n.attributes.find(e=>e.name===t.attribute),i=oe[t.attribute];if(!(r||i)){let[r,...i]=t.attribute.split(`.`),a=i.length>0?n.attributes.find(e=>e.name===r):void 0,o=a?dottedPathHint(r??``,i[0]??``,a):t.attribute.includes(`.`)?` Dotted paths are not supported — filter on the attribute name alone with a structured operator (contains, any_of, …); the full-text "query" parameter matches tokens by relevance, not values.`:``,s=`Unknown attribute: ${t.attribute}${o}`;throw new e(s,[{path:[`attribute`],message:s}])}if(t.quantifier!==void 0&&!t.property){let t=`quantifier is only valid on qualified edge rules (set "property")`;throw new e(t,[{path:[`quantifier`],message:t}])}if(!r){if(t.property)throw new e(`Cannot qualify system attribute "${t.attribute}"`,[{path:[`property`],message:`"${t.attribute}" is a system column, not a reference`}]);let n=j[t.attribute]??`text`,r=resolveCanonicalOperator(t.operator,n);if(!i.includes(r)){let n=`Operator "${t.operator}" is not valid for system attribute "${t.attribute}". Valid operators: ${i.join(`, `)}.`;throw new e(n,[{path:[`operator`],message:n}])}applyCanonicalForm(t,r,n);return}if(!t.property){assertDynamicValueForAttribute(t,r.type);let n=getAttributeFilterOperators(r),i=resolveCanonicalOperator(t.operator,r.type);if(!n.includes(i)){let i=`Operator "${t.operator}" is not valid for attribute "${r.name}". Valid operators: ${operatorList(n)}.${locationPartsHint(r.type)}`;throw new e(i,[{path:[`operator`],message:i}])}applyCanonicalForm(t,i,resolveComparandType(r));return}if(r.type===`location`){if(t.quantifier!==void 0){let t=`quantifier is not valid on a location part — a location is one value, not a set of edges`;throw new e(t,[{path:[`quantifier`],message:t}])}if(!isLocationFilterProperty(t.property)){let n=`Property "${t.property}" is not a part of location "${t.attribute}". Valid parts: ${F}.`;throw new e(n,[{path:[`property`],message:n}])}assertDynamicValueForAttribute(t,`text`),applyCanonicalForm(t,assertOperatorForType(t.operator,`text`,`property`),`text`);return}if(!k.has(r.type))throw new e(`Cannot qualify ${r.type} attribute "${t.attribute}"`,[{path:[`property`],message:`Attribute "${t.attribute}" is not a reference type`}]);let a=r.properties;if(!a)throw new e(`Attribute "${t.attribute}" has no qualifyWith schema`,[{path:[`property`],message:`"${t.attribute}" has no qualifyWith`}]);let o=a.definitions.find(e=>e.name===t.property);if(!o)throw new e(`Property "${t.property}" not defined on "${t.attribute}".qualifyWith()`,[{path:[`property`],message:`Unknown property: ${t.property}`}]);applyCanonicalForm(t,assertOperatorForType(t.operator,o.type,`property`),o.type)}const I=1e4;function isPlainJsonObject(e){let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null&&t.constructor?.name===`Object`}function addJsonIssue(e,t,n=[]){e.addIssue({code:`custom`,message:t,path:n})}function pushJsonArrayChildren(e,t,n,r){for(let n of Reflect.ownKeys(e))if(n!==`length`){if(n===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,[...t.path,n]);continue}(typeof n==`symbol`||!/^(0|[1-9]\d*)$/.test(n))&&addJsonIssue(r,`Arrays cannot contain non-index JSON properties`,[...t.path,n])}for(let i=e.length-1;i>=0;i--){let a=Object.getOwnPropertyDescriptor(e,String(i)),o=[...t.path,i];if(!(a&&`value`in a)){addJsonIssue(r,`Sparse arrays are not valid JSON values`,o);continue}n.push({kind:`enter`,value:a.value,path:o,depth:t.depth+1})}}function pushJsonObjectChildren(e,t,n,r){let i=Reflect.ownKeys(e);for(let a=i.length-1;a>=0;a--){let o=i[a],s=[...t.path,o];if(o===`__proto__`){addJsonIssue(r,`The __proto__ key is not allowed in custom props`,s);continue}if(typeof o==`symbol`){addJsonIssue(r,`Symbol keys are not valid JSON keys`,s);continue}let c=Object.getOwnPropertyDescriptor(e,o);if(!(c?.enumerable&&`value`in c)){addJsonIssue(r,`Custom props must contain enumerable data properties only`,s);continue}n.push({kind:`enter`,value:c.value,path:s,depth:t.depth+1})}}function validateJsonProps(e,t){if(typeof e!=`object`||!e){addJsonIssue(t,`Expected a plain JSON object`);return}try{if(Array.isArray(e)||!isPlainJsonObject(e)){addJsonIssue(t,`Expected a plain JSON object`);return}}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`);return}let n=new WeakSet,r=[{kind:`enter`,value:e,path:[],depth:0}],i=0;for(;r.length>0;){let e=r.pop();if(!e)break;if(e.kind===`exit`){n.delete(e.value);continue}if(i++,i>I){addJsonIssue(t,`Custom props cannot exceed ${I.toLocaleString(`en-US`)} total JSON nodes`,e.path);return}if(e.depth>64){addJsonIssue(t,`Custom props cannot exceed depth 64`,e.path);continue}let a=e.value;if(!(a===null||typeof a==`string`||typeof a==`boolean`||typeof a==`number`&&Number.isFinite(a))){if(typeof a!=`object`){addJsonIssue(t,`Expected a JSON value`,e.path);continue}if(n.has(a)){addJsonIssue(t,`Custom props cannot contain circular references`,e.path);continue}try{if(Array.isArray(a)){n.add(a),r.push({kind:`exit`,value:a}),pushJsonArrayChildren(a,e,r,t);continue}if(!isPlainJsonObject(a)){addJsonIssue(t,`Expected an array or plain JSON object`,e.path);continue}n.add(a),r.push({kind:`exit`,value:a}),pushJsonObjectChildren(a,e,r,t)}catch{addJsonIssue(t,`Custom props contain an object that cannot be safely inspected`,e.path)}}}}const L=i.unknown().superRefine(validateJsonProps).transform(e=>e),R=i.array(i.string()).max(r.columnsPerTab),z=i.array(i.string().min(1)).max(r.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:`Displayed attribute names must be unique`}),B=i.object({attribute:i.string().describe(`Attribute to sort by`),direction:i.enum([`asc`,`desc`]).describe(`asc or desc`)}).strict(),V=i.array(B).max(r.sortsPerTab),H=i.object({amount:i.number().describe(`Count`),unit:i.enum([`days`,`weeks`,`months`,`years`]).describe(`Unit`),direction:i.enum([`past`,`future`]).describe(`Past or future`)}).strict(),U=i.object({value:i.number().nullable().describe(`Amount`),code:i.array(i.string()).optional().describe(`Currency codes`)}).strict(),W=i.object({phoneNumber:i.string().nullable().describe(`Number`),countryCode:i.string().optional().describe(`ISO country code`)}).strict(),G=i.discriminatedUnion(`dynamic`,[i.object({dynamic:i.literal(`actor`).describe(`Resolved at filter time`),ref:i.literal(`current`).describe(`The current actor`)}).strict(),i.object({dynamic:i.literal(`date`).describe(`Resolved at filter time`),anchor:i.enum([`today`,`now`]).describe(`Anchor`)}).strict()]),le=i.object({month:i.number().describe(`1-12`),day:i.number().describe(`Day`)}).strict(),ue=i.union([i.string(),i.number(),i.boolean(),i.array(i.string()),H,U,W,le,G,i.null()]),de=i.enum([`is`,`is_not`,`contains`,`not_contains`,`starts_with`,`ends_with`,`is_empty`,`is_not_empty`,`less_than`,`greater_than`,`less_or_equal`,`greater_or_equal`,`is_within`,`on_day_month`,`any_of`,`none_of`],{error:e=>{let t=e.input,n=typeof t==`string`?M[t]:void 0;return n?`Unknown filter operator "${t}" — use ${n}`:void 0}}),fe=i.object({attribute:i.string().describe(`Attribute to filter on`),property:i.string().optional().describe(`Qualified edge property`),quantifier:i.enum([`any`,`none`]).optional().describe(`For a multi-value attribute`),operator:de.describe(`Comparison`),value:ue.describe(`Comparison value, by attribute type`)}).strict(),pe=i.array(fe).max(r.filterRulesPerTab),K=i.object({combinator:i.enum([`and`,`or`]).describe(`Match every rule or any rule`),rules:pe.describe(`The rules`)}).strict(),me={span:i.union([i.literal(1),i.literal(2),i.literal(3),i.literal(4),i.literal(5),i.literal(6),i.literal(7),i.literal(8),i.literal(9),i.literal(10),i.literal(11),i.literal(12)]).optional().describe(`Columns of 12 this field occupies`),label:i.string().optional().describe(`Overrides the attribute's label`),readOnly:i.boolean().optional().describe(`Shows the value, not editable`)},he=i.object({attribute:i.string().describe(`Attribute API name shown by this field`),...me}).strict(),ge=i.object({name:i.string().describe(`Group API name, unique in the form`),label:i.string().describe(`Label people see`),description:i.string().optional().describe(`Extra context under the label`),collapsible:i.boolean().optional().describe(`Whether the group can be collapsed`),collapsed:i.boolean().optional().describe(`Whether the group starts collapsed`),fields:i.array(he).max(r.fieldsPerGroup).describe(`Fields in this group, in order`)}).strict();function refineFormContent(e,t){e.groups.reduce((e,t)=>e+t.fields.length,0)>r.fieldsPerFormTab&&t.addIssue({code:`too_big`,origin:`array`,maximum:r.fieldsPerFormTab,inclusive:!0,message:`A form content can contain at most ${r.fieldsPerFormTab} fields`,path:[`groups`]});let n=new Set,i=new Set;e.groups.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate group name "${e.name}"`,path:[`groups`,r,`name`]}),n.add(e.name),e.fields.forEach((e,n)=>{i.has(e.attribute)&&t.addIssue({code:`custom`,message:`Duplicate field attribute "${e.attribute}"`,path:[`groups`,r,`fields`,n,`attribute`]}),i.add(e.attribute)})})}const q={name:i.string().describe(`Content API name, unique in the view`),label:i.string().optional().describe(`Label people see`),icon:t.optional().describe(`Icon name`),placement:i.enum([`main`,`aside`]).describe(`main: the tab strip. aside: the side panel`)},J=i.object({object:i.string().optional().describe(`Every record of this object`),relation:i.string().optional().describe(`Records linked through this relation`)}).strict().superRefine((e,t)=>{e.object===void 0&&e.relation===void 0&&t.addIssue({code:`custom`,message:`Collection source must define an object, a relation, or both`})}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),_e={...q,type:i.literal(`collection`),source:J.describe(`object: every record; relation: records linked to this record; both: records of object whose relation points at this record`),visibility:i.enum(n).optional().describe(`all: no scope; workspace: every member; private: viewer's own`),columns:i.array(i.union([i.string(),i.object({relationProperty:i.string().refine(e=>e.trim().length>0).describe(`Qualified edge property shown as a column`)}).strict()])).max(r.columnsPerTab).optional().describe(`Table columns, in order`),descriptionAttribute:i.string().optional().describe(`Secondary line under each row's title (list layout)`),displayAttributes:z.optional().describe(`Attributes shown on each card`),filters:K.optional().describe(`Restricts which records show`),sorts:V.optional().describe(`Sort order`),actions:i.enum([`create`,`update`,`delete`,`attach`,`detach`]).array().optional().describe(`Offered actions; absent = every action, [] = none`),openMode:i.enum([`page`,`peek`]).optional().describe(`page or peek (the record panel)`),createMode:i.enum([`page`,`peek`,`inline`]).optional().describe(`page, peek, or inline (creates without opening)`)},Y=i.object({..._e,layout:i.enum([`table`,`list`,`kanban`]).describe(`table columns, list cards, kanban board grouped by a select/status attribute`),columnSizing:i.record(i.string(),i.number()).optional().describe(`Column widths in pixels, by attribute name`),groupByAttribute:i.string().optional().describe(`Kanban only: the select or status attribute that names the columns`),kanbanColumnOrder:i.array(i.string()).optional().describe(`Kanban: column order by option value`),kanbanColumnVisibility:i.record(i.string(),i.boolean()).optional().describe(`Kanban: which columns are shown`),kanbanPinnedColumns:i.array(i.string()).optional().describe(`Kanban: columns pinned first`)}).strict().superRefine((e,t)=>{let n=[`groupByAttribute`,`kanbanColumnOrder`,`kanbanColumnVisibility`,`kanbanPinnedColumns`];if(e.layout===`kanban`){e.groupByAttribute===void 0&&t.addIssue({code:`custom`,path:[`groupByAttribute`],message:`A kanban layout requires groupByAttribute`});return}for(let r of n)e[r]!==void 0&&t.addIssue({code:`custom`,path:[r],message:`Only a kanban layout groups by an attribute`})}),X={...q,type:i.literal(`form`),groups:i.array(ge).max(r.groupsPerFormTab).describe(`Field groups, in order`),formColumns:i.union([i.literal(1),i.literal(2),i.literal(3)]).optional().describe(`Grid columns, 1-3`),density:i.enum([`compact`,`comfortable`,`spacious`]).optional().describe(`Vertical spacing between fields`)},ve=i.object(X).strict().superRefine(refineFormContent),ye=i.object({...X,groups:X.groups.min(1,`A published form content requires at least one group`)}).strict().superRefine(refineFormContent),Z=[Y,i.object({...q,type:i.literal(`custom`),extension:i.string().describe(`Name of a registered extension`),parameters:i.lazy(()=>L).optional().describe(`Extension parameters`)}).strict(),i.object({...q,type:i.literal(`activity`)}).strict(),i.object({...q,type:i.literal(`richtext`),attribute:i.string().describe(`Richtext attribute edited in place`),titleAttribute:i.string().optional().describe(`Text attribute shown as the title`)}).strict(),i.object({...q,type:i.literal(`documents`),allowUpload:i.boolean().optional().describe(`Lets people add files here`),allowRemove:i.boolean().optional().describe(`Lets people remove files here`),hideAttachments:i.boolean().optional().describe(`Hides files attached elsewhere (e.g. emails)`),relations:i.array(i.string()).optional().describe(`Document relations shown; the record's own files if absent`)}).strict(),i.object({...q,type:i.literal(`forms`),objectName:i.string().optional().describe(`Limits to this object's published forms`)}).strict(),i.object({...q,type:i.literal(`emails`),emailAttributes:i.array(i.string()).max(r.emailAttributesPerTab).describe(`Addresses`)}).strict(),i.object({...q,type:i.literal(`meetings`),emailAttributes:i.array(i.string()).max(r.emailAttributesPerTab).describe(`Addresses`)}).strict()],be=i.discriminatedUnion(`type`,[ve,...Z]),Q=i.discriminatedUnion(`type`,[ye,...Z]),$={object:i.string(),name:i.string(),label:i.string(),description:i.string().optional(),icon:t.optional(),context:i.enum([`collection`,`record`]),default:i.boolean().optional()},xe=i.object({...$,contents:i.array(be).max(r.tabsPerView)}).strict(),Se=i.object({...$,contents:i.array(Q).max(r.tabsPerView)}).strict();function addDuplicateContentNameIssues(e,t){let n=new Set;e.contents.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,message:`Duplicate content name "${e.name}"`,path:[`contents`,r,`name`]}),n.add(e.name)})}function draftContentViewDefinitionSchemaFor(){return xe.superRefine((e,t)=>{addDuplicateContentNameIssues(e,t)})}function contentViewDefinitionSchemaFor(){return Se.superRefine((e,t)=>{addDuplicateContentNameIssues(e,t),e.contents.some(e=>e.placement===`main`)||t.addIssue({code:`custom`,message:`A published view requires at least one main content`,path:[`contents`]})})}const Ce=draftContentViewDefinitionSchemaFor(),we=contentViewDefinitionSchemaFor();export{getSystemAttributeI18nKey as $,isDynamicValue as A,g as B,getOperatorPolarity as C,extractCurrencyFilterValue as D,toMultiValueOperator as E,S as F,isAttributeKanbanGroupable as G,getAttributeFilterOperators as H,filterOperatorsByTypeForGeneration as I,isLocationFilterProperty as J,isAttributeSearchable as K,getRollupFilterOperators as L,today as M,isCalendarDay as N,extractFilterValue as O,C as P,a as Q,isNoValueOperator as R,canonicalizeFilterValue as S,normalizeForEdgeRpc as T,isAttributeFilterable as U,getAttributeCapabilities as V,isAttributeGroupable as W,resolveEffectiveFilterType as X,isLocationPartOperator as Y,o as Z,resolveUtcDayBounds as _,z as a,normalizeFilterRule as b,K as c,M as d,getSystemAttributeList as et,j as f,resolveIsWithinBounds as g,isRelativeDateValue as h,contentViewDefinitionSchemaFor as i,now as j,currentActor as k,Q as l,validateQualifiedRule as m,R as n,Ce as o,collectQualifiedRuleIssues as p,isAttributeSortable as q,we as r,draftContentViewDefinitionSchemaFor as s,J as t,isManagedSystemAttribute as tt,V as u,toUtcDayString as v,isSetMembershipOperator as w,normalizeOperator as x,D as y,_ as z};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/schema",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.350",
|
|
4
4
|
"description": "Standard schema definitions and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
"@standard-schema/spec": "^1.1.0",
|
|
238
238
|
"libphonenumber-js": "^1.12.31",
|
|
239
239
|
"zod": "^4.2.1",
|
|
240
|
-
"@stndrds/constants": "1.0.0-alpha.
|
|
240
|
+
"@stndrds/constants": "1.0.0-alpha.350"
|
|
241
241
|
},
|
|
242
242
|
"devDependencies": {
|
|
243
243
|
"@types/node": "^25.0.3",
|