@stndrds/schema 1.0.0-alpha.350 → 1.0.0-alpha.352
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-Dk8PLu1y.d.mts → all-BmVuO_vv.d.mts} +38 -38
- package/dist/{all-CPMOHYla.d.ts → all-Bv-5hu8j.d.ts} +38 -38
- package/dist/{attributes-mMmH-WOx.d.mts → attributes-Cft68n4u.d.mts} +1 -1
- package/dist/{attributes-C2gm0hUJ.d.ts → attributes-gEcJp-WP.d.ts} +1 -1
- package/dist/capabilities.d.mts +5 -13
- package/dist/capabilities.d.ts +5 -13
- package/dist/capabilities.js +1 -1
- package/dist/capabilities.mjs +1 -1
- package/dist/{checkbox-DO6Mkloc.d.mts → checkbox-C-kdNm3A.d.mts} +2 -2
- package/dist/{checkbox-Ce8gAyQf.d.ts → checkbox-C7ctkYoQ.d.ts} +2 -2
- package/dist/config-CYuFravl.js +13 -0
- package/dist/config-CiAtjzem.mjs +13 -0
- package/dist/{date-DikDGfre.d.ts → date-CY4L11B_.d.ts} +2 -2
- package/dist/{date-CMS-GYRM.d.mts → date-mQ8gxU85.d.mts} +2 -2
- package/dist/empty-BgAwlO54.mjs +2 -0
- package/dist/empty-CRCKZcwK.js +2 -0
- package/dist/{exceptions-DxzT8POW.d.ts → exceptions-704MxF-j.d.mts} +98 -34
- package/dist/{exceptions-DxzT8POW.d.mts → exceptions-704MxF-j.d.ts} +98 -34
- package/dist/exceptions.d.mts +2 -2
- package/dist/exceptions.d.ts +2 -2
- package/dist/exceptions.js +1 -1
- package/dist/exceptions.mjs +1 -1
- package/dist/{index-D26ob_vF.d.mts → index-BV_w2VTh.d.mts} +15 -2
- package/dist/{index-BL7EA39F.d.ts → index-Bbc3qfJ3.d.ts} +1 -1
- package/dist/{index-BV4yNsr7.d.mts → index-Cga9i2js.d.mts} +1 -1
- package/dist/{index-D9OhYX-t.d.ts → index-DQ4cGca2.d.mts} +50 -11
- package/dist/{index-B-mUjnh9.d.mts → index-DmS-DtU4.d.ts} +50 -11
- package/dist/{index-CRtiKFTH.d.ts → index-UYQmTrEG.d.ts} +15 -2
- package/dist/index.d.mts +1313 -1245
- package/dist/index.d.ts +1313 -1245
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/dist/{number-Ck0PPSkK.d.ts → number-CAAAb8Wz.d.ts} +2 -2
- package/dist/{number-r6bOZ9jd.d.mts → number-eNEdOtC3.d.mts} +2 -2
- package/dist/object-sbH7KtsH.mjs +4 -0
- package/dist/object-xwmmQZ8z.js +4 -0
- package/dist/{phone-MN6Li5Wx.js → phone-BXTenBvF.js} +1 -1
- package/dist/{phone-CsV9QNwF.mjs → phone-CRbCvH20.mjs} +1 -1
- package/dist/{text-B1Vwj7fS.d.mts → text-BKyAPMGX.d.mts} +2 -2
- package/dist/{text-DHg2cmFd.d.ts → text-CP1eHBEv.d.ts} +2 -2
- package/dist/{utils-Du-He6Ct.d.ts → utils-C6VEXia7.d.ts} +3 -3
- package/dist/{utils-r53z9KnF.d.mts → utils-CnhbUWev.d.mts} +3 -3
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/validation/all.d.mts +5 -5
- package/dist/validation/all.d.ts +5 -5
- 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/phone.js +1 -1
- package/dist/validation/complex/phone.mjs +1 -1
- 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 +2 -2
- package/dist/validation/config/index.d.ts +2 -2
- package/dist/validation/config/index.js +1 -1
- package/dist/validation/config/index.mjs +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/object/index.js +1 -1
- package/dist/validation/object/index.mjs +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-c8LvH8WE.mjs → view-config.schema-CCrM5b-O.mjs} +1 -1
- package/dist/{view-config.schema-QmnihdGp.js → view-config.schema-CgU86fLj.js} +1 -1
- package/package.json +2 -2
- package/dist/config-BiQGgy7f.mjs +0 -13
- package/dist/config-WUWITOeW.js +0 -13
- package/dist/object-BA3vKFl0.js +0 -4
- package/dist/object-C92B0Oei.mjs +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { r as Uuid } from "./utils-
|
|
2
|
+
import { r as Uuid } from "./utils-CnhbUWev.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-
|
|
2
|
+
import { r as Uuid } from "./utils-C6VEXia7.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;
|
package/dist/capabilities.d.mts
CHANGED
|
@@ -51,17 +51,14 @@ export declare const sortsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
51
51
|
*/
|
|
52
52
|
export type FilterStateInput = z$1.infer<typeof filtersSchema>;
|
|
53
53
|
export type FilterRuleInput = FilterStateInput["rules"][number];
|
|
54
|
-
/** How a capability mutates data, which decides
|
|
54
|
+
/** How a capability mutates data, which decides its tool risk. */
|
|
55
55
|
export type CapabilityKind = "read" | "create" | "update" | "delete";
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* The single-record capabilities, defined once.
|
|
58
58
|
*
|
|
59
|
-
* Deliberately five entries
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* yield no object to grant a permission on; and the `bulk_*` record tools, where
|
|
63
|
-
* one call mutates many records and would be recorded as a single effect, making
|
|
64
|
-
* an effects report understate what happened.
|
|
59
|
+
* Deliberately five entries: each is scoped to one object, so its kind maps to
|
|
60
|
+
* one permission. `get_schema`, `global_search` and the `bulk_*`
|
|
61
|
+
* record tools are not single-record operations and live elsewhere.
|
|
65
62
|
*
|
|
66
63
|
* `description` is NOT here: the tools compute it per call from their config
|
|
67
64
|
* (`schemaInContext` changes the wording), and `schema-tools-descriptions.test.ts`
|
|
@@ -145,9 +142,4 @@ export type RecordCapabilityName = keyof typeof RECORD_CAPABILITIES;
|
|
|
145
142
|
* would have filled in anyway.
|
|
146
143
|
*/
|
|
147
144
|
export type CapabilityInput<N extends RecordCapabilityName> = z$1.input<(typeof RECORD_CAPABILITIES)[N]["input"]>;
|
|
148
|
-
/**
|
|
149
|
-
* The capability → kind projection, derived rather than restated. The reflexes
|
|
150
|
-
* module reads this instead of maintaining its own table (D26/D28).
|
|
151
|
-
*/
|
|
152
|
-
export declare const RECORD_CAPABILITY_KINDS: Readonly<Record<RecordCapabilityName, CapabilityKind>>;
|
|
153
145
|
//#endregion
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -51,17 +51,14 @@ export declare const sortsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
51
51
|
*/
|
|
52
52
|
export type FilterStateInput = z$1.infer<typeof filtersSchema>;
|
|
53
53
|
export type FilterRuleInput = FilterStateInput["rules"][number];
|
|
54
|
-
/** How a capability mutates data, which decides
|
|
54
|
+
/** How a capability mutates data, which decides its tool risk. */
|
|
55
55
|
export type CapabilityKind = "read" | "create" | "update" | "delete";
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* The single-record capabilities, defined once.
|
|
58
58
|
*
|
|
59
|
-
* Deliberately five entries
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* yield no object to grant a permission on; and the `bulk_*` record tools, where
|
|
63
|
-
* one call mutates many records and would be recorded as a single effect, making
|
|
64
|
-
* an effects report understate what happened.
|
|
59
|
+
* Deliberately five entries: each is scoped to one object, so its kind maps to
|
|
60
|
+
* one permission. `get_schema`, `global_search` and the `bulk_*`
|
|
61
|
+
* record tools are not single-record operations and live elsewhere.
|
|
65
62
|
*
|
|
66
63
|
* `description` is NOT here: the tools compute it per call from their config
|
|
67
64
|
* (`schemaInContext` changes the wording), and `schema-tools-descriptions.test.ts`
|
|
@@ -145,9 +142,4 @@ export type RecordCapabilityName = keyof typeof RECORD_CAPABILITIES;
|
|
|
145
142
|
* would have filled in anyway.
|
|
146
143
|
*/
|
|
147
144
|
export type CapabilityInput<N extends RecordCapabilityName> = z$1.input<(typeof RECORD_CAPABILITIES)[N]["input"]>;
|
|
148
|
-
/**
|
|
149
|
-
* The capability → kind projection, derived rather than restated. The reflexes
|
|
150
|
-
* module reads this instead of maintaining its own table (D26/D28).
|
|
151
|
-
*/
|
|
152
|
-
export declare const RECORD_CAPABILITY_KINDS: Readonly<Record<RecordCapabilityName, CapabilityKind>>;
|
|
153
145
|
//#endregion
|
package/dist/capabilities.js
CHANGED
|
@@ -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`});let e=require("zod");const t=`Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.`,n=`Relevance ranking for a name or a phrase — matches tokens, not values. Exact criteria go in filters with NO query.`,r=` For large text content (> a few KB), write it to a sandbox file first and pass {"$fromSandboxFile": "/workspace/<file>"} as the attribute value — the server substitutes the file content.`,i=e.z.object({combinator:e.z.enum([`and`,`or`]).default(`and`),rules:e.z.array(e.z.object({attribute:e.z.string().describe(`Attribute name on the object being searched`),property:e.z.string().optional().describe(`Optional, and the only way to read one part of a compound value. On a relation / document / user attribute declared with .qualifyWith({...}) it names an EDGE property (not the linked record); on a location attribute it is one of city | postalCode | country, which is how a postal code or a city is filtered exactly. The operator must be valid for that property's type. See <filter_operators>.`),operator:e.z.string().describe(`Filter operator (canonical: is, is_not, contains, not_contains, starts_with, ends_with, less_than, greater_than, less_or_equal, greater_or_equal, is_within, on_day_month, any_of, none_of, is_empty, is_not_empty). Short codes (lt, gt, lte, gte, eq, neq, in) are accepted as input and auto-normalized to the canonical names. The valid set depends on the attribute type (or property type when 'property' is set) — see <filter_operators>.`),value:e.z.unknown().nullable().describe(`Value matching the attribute (or property) type: scalar for is/contains/less_than/etc (checkbox is: true|false); array (string[]) for any_of/none_of; null for is_empty/is_not_empty; { amount, unit, direction } for is_within; { day, month } for on_day_month.`)}))}),a=e.z.array(e.z.object({attribute:e.z.string().describe(`Attribute name`),direction:e.z.enum([`asc`,`desc`])})),o=e.z.object({recordId:e.z.string().describe(`Record UUID`),fields:e.z.array(e.z.string()).optional().describe(`Attribute names to return`)}),s=e.z.object({objectId:e.z.string().describe(t),_displayLabel:e.z.string().optional().describe(`Display label`),query:e.z.string().optional().describe(n),limit:e.z.number().optional().describe(`Max results per call: 1-1000 (default 20). Paginate via offset for more.`),offset:e.z.number().optional().describe(`Skip N records (default 0)`),fields:e.z.array(e.z.string()).optional().describe(`Attribute names to include in values`),filters:i.optional().describe(`Structured filter: { combinator: 'and'|'or', rules: [{attribute, operator, value, property?}] }. Operators are constrained per attribute type — see <filter_operators>. Use 'property' on a rule to filter on a qualified edge property.`),sorts:a.optional().describe(`Sorts: [{ attribute, direction: 'asc'|'desc' }]`)}),c=e.z.object({objectId:e.z.string().describe(t),_displayLabel:e.z.string().optional().describe(`Display label`),data:e.z.record(e.z.string(),e.z.unknown()).describe(`Record data.${r}`)}),l=e.z.object({recordId:e.z.string().describe(`Record UUID`),data:e.z.record(e.z.string(),e.z.unknown()).describe(`Fields to update.${r}`)}),u=e.z.object({recordId:e.z.string().describe(`Record UUID`)}),d={get_record:{name:`get_record`,kind:`read`,input:o},search_records:{name:`search_records`,kind:`read`,input:s},create_record:{name:`create_record`,kind:`create`,input:c},update_record:{name:`update_record`,kind:`update`,input:l},delete_record:{name:`delete_record`,kind:`delete`,input:u}}
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("zod");const t=`Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.`,n=`Relevance ranking for a name or a phrase — matches tokens, not values. Exact criteria go in filters with NO query.`,r=` For large text content (> a few KB), write it to a sandbox file first and pass {"$fromSandboxFile": "/workspace/<file>"} as the attribute value — the server substitutes the file content.`,i=e.z.object({combinator:e.z.enum([`and`,`or`]).default(`and`),rules:e.z.array(e.z.object({attribute:e.z.string().describe(`Attribute name on the object being searched`),property:e.z.string().optional().describe(`Optional, and the only way to read one part of a compound value. On a relation / document / user attribute declared with .qualifyWith({...}) it names an EDGE property (not the linked record); on a location attribute it is one of city | postalCode | country, which is how a postal code or a city is filtered exactly. The operator must be valid for that property's type. See <filter_operators>.`),operator:e.z.string().describe(`Filter operator (canonical: is, is_not, contains, not_contains, starts_with, ends_with, less_than, greater_than, less_or_equal, greater_or_equal, is_within, on_day_month, any_of, none_of, is_empty, is_not_empty). Short codes (lt, gt, lte, gte, eq, neq, in) are accepted as input and auto-normalized to the canonical names. The valid set depends on the attribute type (or property type when 'property' is set) — see <filter_operators>.`),value:e.z.unknown().nullable().describe(`Value matching the attribute (or property) type: scalar for is/contains/less_than/etc (checkbox is: true|false); array (string[]) for any_of/none_of; null for is_empty/is_not_empty; { amount, unit, direction } for is_within; { day, month } for on_day_month.`)}))}),a=e.z.array(e.z.object({attribute:e.z.string().describe(`Attribute name`),direction:e.z.enum([`asc`,`desc`])})),o=e.z.object({recordId:e.z.string().describe(`Record UUID`),fields:e.z.array(e.z.string()).optional().describe(`Attribute names to return`)}),s=e.z.object({objectId:e.z.string().describe(t),_displayLabel:e.z.string().optional().describe(`Display label`),query:e.z.string().optional().describe(n),limit:e.z.number().optional().describe(`Max results per call: 1-1000 (default 20). Paginate via offset for more.`),offset:e.z.number().optional().describe(`Skip N records (default 0)`),fields:e.z.array(e.z.string()).optional().describe(`Attribute names to include in values`),filters:i.optional().describe(`Structured filter: { combinator: 'and'|'or', rules: [{attribute, operator, value, property?}] }. Operators are constrained per attribute type — see <filter_operators>. Use 'property' on a rule to filter on a qualified edge property.`),sorts:a.optional().describe(`Sorts: [{ attribute, direction: 'asc'|'desc' }]`)}),c=e.z.object({objectId:e.z.string().describe(t),_displayLabel:e.z.string().optional().describe(`Display label`),data:e.z.record(e.z.string(),e.z.unknown()).describe(`Record data.${r}`)}),l=e.z.object({recordId:e.z.string().describe(`Record UUID`),data:e.z.record(e.z.string(),e.z.unknown()).describe(`Fields to update.${r}`)}),u=e.z.object({recordId:e.z.string().describe(`Record UUID`)}),d={get_record:{name:`get_record`,kind:`read`,input:o},search_records:{name:`search_records`,kind:`read`,input:s},create_record:{name:`create_record`,kind:`create`,input:c},update_record:{name:`update_record`,kind:`update`,input:l},delete_record:{name:`delete_record`,kind:`delete`,input:u}};exports.OBJECT_ID_DESCRIPTION=t,exports.QUERY_DESCRIPTION=n,exports.RECORD_CAPABILITIES=d,exports.SANDBOX_FILE_DATA_HINT=r,exports.filtersSchema=i,exports.sortsSchema=a;
|
package/dist/capabilities.mjs
CHANGED
|
@@ -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
|
-
import{z as e}from"zod";const t=`Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.`,n=`Relevance ranking for a name or a phrase — matches tokens, not values. Exact criteria go in filters with NO query.`,r=` For large text content (> a few KB), write it to a sandbox file first and pass {"$fromSandboxFile": "/workspace/<file>"} as the attribute value — the server substitutes the file content.`,i=e.object({combinator:e.enum([`and`,`or`]).default(`and`),rules:e.array(e.object({attribute:e.string().describe(`Attribute name on the object being searched`),property:e.string().optional().describe(`Optional, and the only way to read one part of a compound value. On a relation / document / user attribute declared with .qualifyWith({...}) it names an EDGE property (not the linked record); on a location attribute it is one of city | postalCode | country, which is how a postal code or a city is filtered exactly. The operator must be valid for that property's type. See <filter_operators>.`),operator:e.string().describe(`Filter operator (canonical: is, is_not, contains, not_contains, starts_with, ends_with, less_than, greater_than, less_or_equal, greater_or_equal, is_within, on_day_month, any_of, none_of, is_empty, is_not_empty). Short codes (lt, gt, lte, gte, eq, neq, in) are accepted as input and auto-normalized to the canonical names. The valid set depends on the attribute type (or property type when 'property' is set) — see <filter_operators>.`),value:e.unknown().nullable().describe(`Value matching the attribute (or property) type: scalar for is/contains/less_than/etc (checkbox is: true|false); array (string[]) for any_of/none_of; null for is_empty/is_not_empty; { amount, unit, direction } for is_within; { day, month } for on_day_month.`)}))}),a=e.array(e.object({attribute:e.string().describe(`Attribute name`),direction:e.enum([`asc`,`desc`])})),o=e.object({recordId:e.string().describe(`Record UUID`),fields:e.array(e.string()).optional().describe(`Attribute names to return`)}),s=e.object({objectId:e.string().describe(t),_displayLabel:e.string().optional().describe(`Display label`),query:e.string().optional().describe(n),limit:e.number().optional().describe(`Max results per call: 1-1000 (default 20). Paginate via offset for more.`),offset:e.number().optional().describe(`Skip N records (default 0)`),fields:e.array(e.string()).optional().describe(`Attribute names to include in values`),filters:i.optional().describe(`Structured filter: { combinator: 'and'|'or', rules: [{attribute, operator, value, property?}] }. Operators are constrained per attribute type — see <filter_operators>. Use 'property' on a rule to filter on a qualified edge property.`),sorts:a.optional().describe(`Sorts: [{ attribute, direction: 'asc'|'desc' }]`)}),c=e.object({objectId:e.string().describe(t),_displayLabel:e.string().optional().describe(`Display label`),data:e.record(e.string(),e.unknown()).describe(`Record data.${r}`)}),l=e.object({recordId:e.string().describe(`Record UUID`),data:e.record(e.string(),e.unknown()).describe(`Fields to update.${r}`)}),u=e.object({recordId:e.string().describe(`Record UUID`)}),d={get_record:{name:`get_record`,kind:`read`,input:o},search_records:{name:`search_records`,kind:`read`,input:s},create_record:{name:`create_record`,kind:`create`,input:c},update_record:{name:`update_record`,kind:`update`,input:l},delete_record:{name:`delete_record`,kind:`delete`,input:u}}
|
|
2
|
+
import{z as e}from"zod";const t=`Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.`,n=`Relevance ranking for a name or a phrase — matches tokens, not values. Exact criteria go in filters with NO query.`,r=` For large text content (> a few KB), write it to a sandbox file first and pass {"$fromSandboxFile": "/workspace/<file>"} as the attribute value — the server substitutes the file content.`,i=e.object({combinator:e.enum([`and`,`or`]).default(`and`),rules:e.array(e.object({attribute:e.string().describe(`Attribute name on the object being searched`),property:e.string().optional().describe(`Optional, and the only way to read one part of a compound value. On a relation / document / user attribute declared with .qualifyWith({...}) it names an EDGE property (not the linked record); on a location attribute it is one of city | postalCode | country, which is how a postal code or a city is filtered exactly. The operator must be valid for that property's type. See <filter_operators>.`),operator:e.string().describe(`Filter operator (canonical: is, is_not, contains, not_contains, starts_with, ends_with, less_than, greater_than, less_or_equal, greater_or_equal, is_within, on_day_month, any_of, none_of, is_empty, is_not_empty). Short codes (lt, gt, lte, gte, eq, neq, in) are accepted as input and auto-normalized to the canonical names. The valid set depends on the attribute type (or property type when 'property' is set) — see <filter_operators>.`),value:e.unknown().nullable().describe(`Value matching the attribute (or property) type: scalar for is/contains/less_than/etc (checkbox is: true|false); array (string[]) for any_of/none_of; null for is_empty/is_not_empty; { amount, unit, direction } for is_within; { day, month } for on_day_month.`)}))}),a=e.array(e.object({attribute:e.string().describe(`Attribute name`),direction:e.enum([`asc`,`desc`])})),o=e.object({recordId:e.string().describe(`Record UUID`),fields:e.array(e.string()).optional().describe(`Attribute names to return`)}),s=e.object({objectId:e.string().describe(t),_displayLabel:e.string().optional().describe(`Display label`),query:e.string().optional().describe(n),limit:e.number().optional().describe(`Max results per call: 1-1000 (default 20). Paginate via offset for more.`),offset:e.number().optional().describe(`Skip N records (default 0)`),fields:e.array(e.string()).optional().describe(`Attribute names to include in values`),filters:i.optional().describe(`Structured filter: { combinator: 'and'|'or', rules: [{attribute, operator, value, property?}] }. Operators are constrained per attribute type — see <filter_operators>. Use 'property' on a rule to filter on a qualified edge property.`),sorts:a.optional().describe(`Sorts: [{ attribute, direction: 'asc'|'desc' }]`)}),c=e.object({objectId:e.string().describe(t),_displayLabel:e.string().optional().describe(`Display label`),data:e.record(e.string(),e.unknown()).describe(`Record data.${r}`)}),l=e.object({recordId:e.string().describe(`Record UUID`),data:e.record(e.string(),e.unknown()).describe(`Fields to update.${r}`)}),u=e.object({recordId:e.string().describe(`Record UUID`)}),d={get_record:{name:`get_record`,kind:`read`,input:o},search_records:{name:`search_records`,kind:`read`,input:s},create_record:{name:`create_record`,kind:`create`,input:c},update_record:{name:`update_record`,kind:`update`,input:l},delete_record:{name:`delete_record`,kind:`delete`,input:u}};export{t as OBJECT_ID_DESCRIPTION,n as QUERY_DESCRIPTION,d as RECORD_CAPABILITIES,r as SANDBOX_FILE_DATA_HINT,i as filtersSchema,a as sortsSchema};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { s as CheckboxAttribute } from "./attributes-
|
|
3
|
-
import { r as ValidationMessages } from "./index-
|
|
2
|
+
import { s as CheckboxAttribute } from "./attributes-Cft68n4u.mjs";
|
|
3
|
+
import { r as ValidationMessages } from "./index-Cga9i2js.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-
|
|
3
|
-
import { r as ValidationMessages } from "./index-
|
|
2
|
+
import { s as CheckboxAttribute } from "./attributes-gEcJp-WP.js";
|
|
3
|
+
import { r as ValidationMessages } from "./index-Bbc3qfJ3.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-
|
|
3
|
-
import { r as ValidationMessages } from "./index-
|
|
2
|
+
import { u as DateAttribute } from "./attributes-gEcJp-WP.js";
|
|
3
|
+
import { r as ValidationMessages } from "./index-Bbc3qfJ3.js";
|
|
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-
|
|
3
|
-
import { r as ValidationMessages } from "./index-
|
|
2
|
+
import { u as DateAttribute } from "./attributes-Cft68n4u.mjs";
|
|
3
|
+
import { r as ValidationMessages } from "./index-Cga9i2js.mjs";
|
|
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}});
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
|
|
2
|
+
import { z as z$1 } from "zod";
|
|
3
|
+
//#region src/lib/permission-grants.d.ts
|
|
4
|
+
declare const PERMISSION_ACTIONS: readonly ["read", "create", "update", "delete", "manage"];
|
|
5
|
+
/** The only definition of a valid grant (spec B1). */
|
|
6
|
+
declare const permissionGrantSchema: z$1.ZodObject<{
|
|
7
|
+
scope: z$1.ZodEnum<{
|
|
8
|
+
object: "object";
|
|
9
|
+
system: "system";
|
|
10
|
+
}>;
|
|
11
|
+
target: z$1.ZodString;
|
|
12
|
+
actions: z$1.ZodArray<z$1.ZodEnum<{
|
|
13
|
+
read: "read";
|
|
14
|
+
create: "create";
|
|
15
|
+
update: "update";
|
|
16
|
+
delete: "delete";
|
|
17
|
+
manage: "manage";
|
|
18
|
+
}>>;
|
|
19
|
+
}, z$1.core.$strict>;
|
|
20
|
+
type PermissionGrant = z$1.infer<typeof permissionGrantSchema>;
|
|
21
|
+
interface GrantIssue {
|
|
22
|
+
target: string;
|
|
23
|
+
reason: "shape" | "unknown-resource" | "off-level" | "split-capability" | "unknown-object" | "object-action";
|
|
24
|
+
}
|
|
25
|
+
declare function findGrantIssues(grants: readonly unknown[], context: {
|
|
26
|
+
objectNames: ReadonlySet<string>;
|
|
27
|
+
}): GrantIssue[];
|
|
28
|
+
//#endregion
|
|
2
29
|
//#region src/exceptions.d.ts
|
|
3
30
|
/**
|
|
4
31
|
* Error codes for schema exceptions
|
|
@@ -12,7 +39,6 @@ declare const SchemaErrorCode: {
|
|
|
12
39
|
readonly SOURCE_NOT_FOUND: "SCHEMA_SOURCE_NOT_FOUND";
|
|
13
40
|
readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
|
|
14
41
|
readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
|
|
15
|
-
readonly SCHEMA_PLAN_NOT_FOUND: "SCHEMA_PLAN_NOT_FOUND";
|
|
16
42
|
readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
|
|
17
43
|
readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
|
|
18
44
|
readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
|
|
@@ -22,6 +48,8 @@ declare const SchemaErrorCode: {
|
|
|
22
48
|
readonly PROTECTED_ATTRIBUTE: "SCHEMA_PROTECTED_ATTRIBUTE";
|
|
23
49
|
readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
|
|
24
50
|
readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
|
|
51
|
+
/** A saved permission grant is outside the permission catalog (spec B1). */
|
|
52
|
+
readonly PERMISSION_INVALID_GRANT: "SCHEMA_PERMISSION_INVALID_GRANT";
|
|
25
53
|
readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
|
|
26
54
|
readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
|
|
27
55
|
/**
|
|
@@ -33,7 +61,7 @@ declare const SchemaErrorCode: {
|
|
|
33
61
|
* by a request that was entirely well-formed, whose message tells them how.
|
|
34
62
|
*/
|
|
35
63
|
readonly WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT";
|
|
36
|
-
/** The resource's own state refuses the operation — a
|
|
64
|
+
/** The resource's own state refuses the operation — e.g. a draft already being sent. */
|
|
37
65
|
readonly STATE_GATE: "SCHEMA_STATE_GATE";
|
|
38
66
|
/** The operation needs an actor and the request carried none. */
|
|
39
67
|
readonly ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED";
|
|
@@ -52,6 +80,9 @@ declare const SchemaErrorCode: {
|
|
|
52
80
|
readonly ORPHAN_SYSTEM_ATTRIBUTE: "SCHEMA_ORPHAN_SYSTEM_ATTRIBUTE";
|
|
53
81
|
readonly SYSTEM_ENTITY_IMMUTABLE: "SCHEMA_SYSTEM_ENTITY_IMMUTABLE";
|
|
54
82
|
readonly AMBIGUOUS_CHANGE: "SCHEMA_AMBIGUOUS_CHANGE";
|
|
83
|
+
readonly RECORD_GRANT_ON_WORKSPACE: "RECORD_GRANT_ON_WORKSPACE";
|
|
84
|
+
readonly RECORD_GRANT_INVALID_ACTOR: "RECORD_GRANT_INVALID_ACTOR";
|
|
85
|
+
readonly RECORD_GRANT_UNSHAREABLE_OBJECT: "RECORD_GRANT_UNSHAREABLE_OBJECT";
|
|
55
86
|
readonly DUPLICATE: "SCHEMA_DUPLICATE";
|
|
56
87
|
readonly DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT";
|
|
57
88
|
readonly DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE";
|
|
@@ -71,12 +102,14 @@ declare const SchemaErrorCode: {
|
|
|
71
102
|
readonly OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED";
|
|
72
103
|
readonly CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED";
|
|
73
104
|
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
105
|
readonly SEARCH_BACKEND_FAILED: "SEARCH_BACKEND_FAILED";
|
|
106
|
+
readonly SEARCH_BACKEND_REJECTED: "SEARCH_BACKEND_REJECTED";
|
|
78
107
|
readonly INVARIANT_VIOLATION: "INVARIANT_VIOLATION";
|
|
79
108
|
readonly TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING";
|
|
109
|
+
/** A Hatchet run's metadata does not match the outbox row that produced it — a forged or replayed run (403). */
|
|
110
|
+
readonly JOB_RUN_METADATA_MISMATCH: "JOB_RUN_METADATA_MISMATCH";
|
|
111
|
+
/** A coalesced run failed and the coalescing primitive already handled it (items given back or dropped and reported). */
|
|
112
|
+
readonly JOB_COALESCED_FAILURE_HANDLED: "JOB_COALESCED_FAILURE_HANDLED";
|
|
80
113
|
readonly FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT";
|
|
81
114
|
readonly REALTIME_RATE_LIMITED: "REALTIME_RATE_LIMITED";
|
|
82
115
|
readonly REALTIME_DELIVERY_FAILED: "REALTIME_DELIVERY_FAILED";
|
|
@@ -97,7 +130,6 @@ declare const SchemaErrorCode: {
|
|
|
97
130
|
readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
|
|
98
131
|
readonly AGENT_LEASE_HELD: "AGENT_LEASE_HELD";
|
|
99
132
|
readonly AGENT_LEASE_UNAVAILABLE: "AGENT_LEASE_UNAVAILABLE";
|
|
100
|
-
readonly AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED";
|
|
101
133
|
readonly AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND";
|
|
102
134
|
readonly AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE";
|
|
103
135
|
readonly INVALID_TOOL_INPUT: "INVALID_TOOL_INPUT";
|
|
@@ -112,6 +144,12 @@ declare const SchemaErrorCode: {
|
|
|
112
144
|
readonly AGENT_TOOL_CANCELLATION_POLICY: "AGENT_TOOL_CANCELLATION_POLICY";
|
|
113
145
|
readonly AGENT_CANCELLATION_WATCH_CAPACITY: "AGENT_CANCELLATION_WATCH_CAPACITY";
|
|
114
146
|
readonly AGENT_CANCELLATION_CLEANUP: "AGENT_CANCELLATION_CLEANUP";
|
|
147
|
+
readonly AGENT_TURN_FINALIZER_STALLED: "AGENT_TURN_FINALIZER_STALLED";
|
|
148
|
+
readonly WORKSTATION_NOT_READY: "WORKSTATION_NOT_READY";
|
|
149
|
+
readonly WORKSTATION_IN_USE: "WORKSTATION_IN_USE";
|
|
150
|
+
readonly WORKSTATION_NOT_CONNECTED: "WORKSTATION_NOT_CONNECTED";
|
|
151
|
+
readonly WORKSTATION_AUTH_FAILED: "WORKSTATION_AUTH_FAILED";
|
|
152
|
+
readonly WORKSTATION_RUN_FAILED: "WORKSTATION_RUN_FAILED";
|
|
115
153
|
readonly DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND";
|
|
116
154
|
readonly DEVICE_OFFLINE: "DEVICE_OFFLINE";
|
|
117
155
|
readonly DEVICE_CAPABILITY_MISMATCH: "DEVICE_CAPABILITY_MISMATCH";
|
|
@@ -128,6 +166,7 @@ declare const SchemaErrorCode: {
|
|
|
128
166
|
readonly AI_IMAGE_GENERATION_INDETERMINATE: "AI_IMAGE_GENERATION_INDETERMINATE";
|
|
129
167
|
readonly AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE: "AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE";
|
|
130
168
|
readonly AI_IMAGE_PUBLICATION_FAILED: "AI_IMAGE_PUBLICATION_FAILED";
|
|
169
|
+
readonly FILE_PUBLIC_NOT_ATTACHABLE: "FILE_PUBLIC_NOT_ATTACHABLE";
|
|
131
170
|
readonly DOCUMENT_MIME_NOT_ACCEPTED: "DOCUMENT_MIME_NOT_ACCEPTED";
|
|
132
171
|
readonly DOCUMENT_MULTIPLE_NOT_ALLOWED: "DOCUMENT_MULTIPLE_NOT_ALLOWED";
|
|
133
172
|
readonly DOCUMENT_NOT_FOUND_FOR_OPERATION: "DOCUMENT_NOT_FOUND_FOR_OPERATION";
|
|
@@ -147,18 +186,6 @@ declare const SchemaErrorCode: {
|
|
|
147
186
|
readonly EMAIL_SENT_NOT_STORED: "EMAIL_SENT_NOT_STORED";
|
|
148
187
|
readonly EMAIL_BATCH_ITEM_FAILED: "EMAIL_BATCH_ITEM_FAILED";
|
|
149
188
|
readonly CALENDAR_PROVIDER_API_FAILED: "CALENDAR_PROVIDER_API_FAILED";
|
|
150
|
-
readonly REFLEX_INVALID_TRANSITION: "REFLEX_INVALID_TRANSITION";
|
|
151
|
-
readonly REFLEX_INVALID_TOKEN: "REFLEX_INVALID_TOKEN";
|
|
152
|
-
readonly REFLEX_CAPABILITY_DENIED: "REFLEX_CAPABILITY_DENIED";
|
|
153
|
-
readonly REFLEX_GATEWAY_UNAVAILABLE: "REFLEX_GATEWAY_UNAVAILABLE";
|
|
154
|
-
readonly REFLEX_BUNDLE_FAILED: "REFLEX_BUNDLE_FAILED";
|
|
155
|
-
readonly REFLEX_EGRESS_DENIED: "REFLEX_EGRESS_DENIED";
|
|
156
|
-
readonly REFLEX_PROTOCOL_VIOLATION: "REFLEX_PROTOCOL_VIOLATION";
|
|
157
|
-
readonly REFLEX_RUN_FAILED: "REFLEX_RUN_FAILED";
|
|
158
|
-
readonly REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT";
|
|
159
|
-
readonly REFLEX_DEPENDENCY_DRIFT: "REFLEX_DEPENDENCY_DRIFT";
|
|
160
|
-
readonly REFLEX_NOT_READY: "REFLEX_NOT_READY";
|
|
161
|
-
readonly REFLEX_INVARIANT_VIOLATION: "REFLEX_INVARIANT_VIOLATION";
|
|
162
189
|
/** The embeddings feature is enabled but no Gateway credential is configured. */
|
|
163
190
|
readonly EMBEDDING_MODEL_UNAVAILABLE: "EMBEDDING_MODEL_UNAVAILABLE";
|
|
164
191
|
/** The provider returned vectors whose length differs from the configured dimensions. */
|
|
@@ -207,14 +234,6 @@ declare class AttributeNotFoundError extends NotFoundError {
|
|
|
207
234
|
declare class RecordNotFoundError extends NotFoundError {
|
|
208
235
|
constructor(recordId: string);
|
|
209
236
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Schema plan not found error — raised when a `planId` sent by an approver
|
|
212
|
-
* (who never receives the plan payload itself, only its id) does not match
|
|
213
|
-
* any stored plan.
|
|
214
|
-
*/
|
|
215
|
-
declare class SchemaPlanNotFoundError extends NotFoundError {
|
|
216
|
-
constructor(planId: string);
|
|
217
|
-
}
|
|
218
237
|
/**
|
|
219
238
|
* Validation error with field-level details
|
|
220
239
|
*/
|
|
@@ -244,7 +263,9 @@ declare class ValidationError extends SchemaError {
|
|
|
244
263
|
* system attribute that disappeared alongside a new one of the same type
|
|
245
264
|
* (rename or drop + add?), or a retype whose stored values the new type cannot
|
|
246
265
|
* read. Refused at boot and at source push; resolved by a hand-written SQL
|
|
247
|
-
* migration,
|
|
266
|
+
* migration, by shipping a real removal and addition in separate deploys, or —
|
|
267
|
+
* on a source push, for a rename or a `text → phone` / `number → currency`
|
|
268
|
+
* retype — by the resolution the refusal names (#4362).
|
|
248
269
|
* HTTP status: 400 Bad Request.
|
|
249
270
|
*
|
|
250
271
|
* The first detail's `path[0]` is the declared attribute name, so the boot
|
|
@@ -390,6 +411,16 @@ declare class ProtectedRoleError extends SchemaError {
|
|
|
390
411
|
readonly operation: "delete" | "modify";
|
|
391
412
|
constructor(roleName: string, operation: "delete" | "modify");
|
|
392
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Error thrown when a saved permission grant falls outside the permission
|
|
416
|
+
* catalog (spec B1): an unknown resource, a level the catalog never declared,
|
|
417
|
+
* a split capability, an unknown object, or a shape the schema rejects.
|
|
418
|
+
*/
|
|
419
|
+
declare class InvalidPermissionGrantError extends SchemaError {
|
|
420
|
+
readonly issues: GrantIssue[];
|
|
421
|
+
readonly _tag = "InvalidPermissionGrantError";
|
|
422
|
+
constructor(issues: GrantIssue[]);
|
|
423
|
+
}
|
|
393
424
|
/**
|
|
394
425
|
* Role not found error
|
|
395
426
|
*/
|
|
@@ -439,16 +470,49 @@ declare class RepositoryError extends SchemaError {
|
|
|
439
470
|
constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
|
|
440
471
|
}
|
|
441
472
|
/**
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
473
|
+
* Why a search backend call failed, as far as retrying is concerned.
|
|
474
|
+
*
|
|
475
|
+
* - `unavailable` — transport-level or otherwise transient: the backend was
|
|
476
|
+
* unreachable, answered garbage, or a task failed for a reason a later
|
|
477
|
+
* attempt may not meet. Worth retrying.
|
|
478
|
+
* - `capacity` — the backend is out of storage (disk full, database size
|
|
479
|
+
* limit). Every retry fails the same way, and on a full disk each one
|
|
480
|
+
* allocates more temporary files.
|
|
481
|
+
* - `rejected` — the backend refused this payload (malformed, too large).
|
|
482
|
+
* Deterministic: the same payload is refused again.
|
|
483
|
+
*/
|
|
484
|
+
type SearchBackendFailureKind = "unavailable" | "capacity" | "rejected";
|
|
485
|
+
interface SearchBackendErrorOptions {
|
|
486
|
+
/** Defaults to `unavailable`. */
|
|
487
|
+
kind?: SearchBackendFailureKind;
|
|
488
|
+
/** The backend's own machine code, e.g. Meili's `malformed_payload`. */
|
|
489
|
+
backendCode?: string;
|
|
490
|
+
/**
|
|
491
|
+
* A fixed phrase the adapter chose from what it recognised — e.g.
|
|
492
|
+
* "No space left on device (os error 28)". Never raw backend text: the
|
|
493
|
+
* message is exported to telemetry as a template.
|
|
494
|
+
*/
|
|
495
|
+
detail?: string;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Error thrown when a search backend call fails — e.g. the Meili client
|
|
499
|
+
* received a non-JSON body (`JSON.parse` SyntaxError), a network failure, or
|
|
500
|
+
* a write the backend refused. Translates an otherwise un-fingerprintable bare
|
|
501
|
+
* exception into a typed error with a stable `code` and a user-safe message.
|
|
502
|
+
* The original failure text is preserved in `cause`/`details`, never in the
|
|
503
|
+
* message.
|
|
504
|
+
*
|
|
505
|
+
* A refusal the backend will repeat (`capacity`, `rejected`, #4306) takes
|
|
506
|
+
* `SEARCH_BACKEND_REJECTED` and names the backend's code and the adapter's
|
|
507
|
+
* fixed `detail` in its message, so a full disk pages as itself rather than
|
|
508
|
+
* as a transient outage.
|
|
447
509
|
*/
|
|
448
510
|
declare class SearchBackendError extends SchemaError {
|
|
449
511
|
readonly scope: string;
|
|
450
512
|
readonly cause?: string;
|
|
451
|
-
|
|
513
|
+
readonly kind: SearchBackendFailureKind;
|
|
514
|
+
readonly backendCode?: string;
|
|
515
|
+
constructor(scope: string, cause?: string, options?: SearchBackendErrorOptions);
|
|
452
516
|
}
|
|
453
517
|
/**
|
|
454
518
|
* Error thrown when a feature or method is not yet implemented
|
|
@@ -551,4 +615,4 @@ declare function isAttributeInUseError(error: unknown): error is AttributeInUseE
|
|
|
551
615
|
*/
|
|
552
616
|
declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
|
|
553
617
|
//#endregion
|
|
554
|
-
export { SearchBackendError as A,
|
|
618
|
+
export { SearchBackendError as A, ValidationErrorDetail as B, RecordReferencedError as C, RoleNotFoundError as D, ReservedObjectNameError as E, SyncCascadeError as F, isRecordReferencedError as G, isNotFoundError as H, SyncConflictError as I, GrantIssue as J, isSchemaError as K, SyncError as L, SearchBackendFailureKind as M, StorageError as N, SchemaError as O, StorageOperation as P, permissionGrantSchema as Q, SystemEntityImmutableError as R, RecordReference as S, RepositoryOperation as T, isObjectReferencedError as U, isAttributeInUseError as V, isProtectedResourceError as W, PermissionGrant as X, PERMISSION_ACTIONS as Y, findGrantIssues as Z, ProtectedRoleError as _, AttributeUsage as a, RealtimeSubscriptionError as b, ForbiddenError as c, NotFoundError as d, NotImplementedError as f, ProtectedResourceError as g, OrphanSystemAttributeError as h, AttributeNotFoundError as i, SearchBackendErrorOptions as j, SchemaErrorCode as k, InvalidPermissionGrantError as l, ObjectReferencedError as m, AmbiguousSchemaChangeError as n, ConcurrentModificationError as o, ObjectNotFoundError as p, isValidationError as q, AttributeInUseError as r, DuplicateError as s, AccessDeniedError as t, MemoryNotFoundError as u, RealtimeDeliveryError as v, RepositoryError as w, RecordNotFoundError as x, RealtimeRateLimitedError as y, ValidationError as z };
|