@stndrds/schema 1.0.0-alpha.280 → 1.0.0-alpha.281
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-Ig0ig9wp.d.ts → all-BVp3k9Hi.d.ts} +4 -15
- package/dist/{all-C0hXd79K.d.mts → all-CnIU2anT.d.mts} +4 -15
- package/dist/{chunk-MSIGO7JA.mjs → chunk-A5PPZ2FM.mjs} +1 -1
- package/dist/{chunk-3PGLMGTR.js → chunk-E47WAI5K.js} +4 -4
- package/dist/{chunk-M3WFXOA4.js → chunk-HWZRSXFB.js} +2 -0
- package/dist/{chunk-FAEOVIDJ.js → chunk-LRFLSFIA.js} +3 -3
- package/dist/{chunk-PUMM6SPY.mjs → chunk-MLTXSBOB.mjs} +1 -1
- package/dist/{chunk-TBAD2T7Q.mjs → chunk-ORPCS24B.mjs} +5 -11
- package/dist/{chunk-XTBGGJ3G.js → chunk-OYHBQMC7.js} +3 -3
- package/dist/{chunk-XDA5PZRT.mjs → chunk-SYQDFZ74.mjs} +2 -0
- package/dist/{chunk-MXYCCUNB.js → chunk-TU6ECJFZ.js} +37 -43
- package/dist/{chunk-NUEIGMYS.mjs → chunk-XCLVXM7F.mjs} +1 -1
- package/dist/exceptions.d.mts +2 -0
- package/dist/exceptions.d.ts +2 -0
- package/dist/exceptions.js +39 -39
- package/dist/exceptions.mjs +1 -1
- package/dist/{index-C3P5Dnwt.d.mts → index-DWoqObyG.d.mts} +13 -22
- package/dist/{index-SpFpkWVC.d.ts → index-TMlrIKAY.d.ts} +13 -22
- package/dist/index.d.mts +253 -73
- package/dist/index.d.ts +253 -73
- package/dist/index.js +1175 -286
- package/dist/index.mjs +970 -93
- package/dist/utils.js +8 -8
- package/dist/utils.mjs +2 -2
- package/dist/validation/all.d.mts +2 -2
- package/dist/validation/all.d.ts +2 -2
- package/dist/validation/all.js +29 -29
- package/dist/validation/all.mjs +4 -4
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/config/index.js +11 -11
- package/dist/validation/config/index.mjs +2 -2
- package/dist/validation/object/index.js +14 -14
- package/dist/validation/object/index.mjs +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './types-DYYFto8d.js';
|
|
2
2
|
import './validation/core/index.js';
|
|
3
|
-
import { D as DetailViewConfig, L as ListViewConfig, V as ViewType, a as ViewConfig } from './index-
|
|
3
|
+
import { D as DetailViewConfig, L as ListViewConfig, V as ViewType, a as ViewConfig } from './index-TMlrIKAY.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import './helpers-DyoPqiSz.js';
|
|
6
6
|
|
|
@@ -67,12 +67,13 @@ declare const tableSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
67
67
|
}, z.core.$strict>], "type">;
|
|
68
68
|
declare const detailTabSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
69
69
|
type: z.ZodLiteral<"form">;
|
|
70
|
-
groups: z.ZodArray<z.
|
|
70
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
71
71
|
type: z.ZodLiteral<"fields">;
|
|
72
72
|
fields: z.ZodArray<z.ZodObject<{
|
|
73
73
|
span: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>, z.ZodLiteral<8>, z.ZodLiteral<9>, z.ZodLiteral<10>, z.ZodLiteral<11>, z.ZodLiteral<12>]>>;
|
|
74
74
|
label: z.ZodOptional<z.ZodString>;
|
|
75
75
|
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
id: z.ZodOptional<z.ZodString>;
|
|
76
77
|
attribute: z.ZodOptional<z.ZodString>;
|
|
77
78
|
attributeGroup: z.ZodOptional<z.ZodObject<{
|
|
78
79
|
id: z.ZodString;
|
|
@@ -88,19 +89,7 @@ declare const detailTabSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
88
89
|
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
89
90
|
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
90
91
|
order: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
}, z.core.$strict
|
|
92
|
-
type: z.ZodLiteral<"relation">;
|
|
93
|
-
attribute: z.ZodString;
|
|
94
|
-
columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
95
|
-
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
-
allowCreate: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
-
id: z.ZodString;
|
|
98
|
-
label: z.ZodString;
|
|
99
|
-
description: z.ZodOptional<z.ZodString>;
|
|
100
|
-
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
-
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
103
|
-
}, z.core.$strict>], "type">>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
104
93
|
formColumns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
|
|
105
94
|
density: z.ZodOptional<z.ZodEnum<{
|
|
106
95
|
compact: "compact";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './types-DHqXzkgW.mjs';
|
|
2
2
|
import './validation/core/index.mjs';
|
|
3
|
-
import { D as DetailViewConfig, L as ListViewConfig, V as ViewType, a as ViewConfig } from './index-
|
|
3
|
+
import { D as DetailViewConfig, L as ListViewConfig, V as ViewType, a as ViewConfig } from './index-DWoqObyG.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import './helpers-BiABdSxK.mjs';
|
|
6
6
|
|
|
@@ -67,12 +67,13 @@ declare const tableSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
67
67
|
}, z.core.$strict>], "type">;
|
|
68
68
|
declare const detailTabSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
69
69
|
type: z.ZodLiteral<"form">;
|
|
70
|
-
groups: z.ZodArray<z.
|
|
70
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
71
71
|
type: z.ZodLiteral<"fields">;
|
|
72
72
|
fields: z.ZodArray<z.ZodObject<{
|
|
73
73
|
span: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>, z.ZodLiteral<8>, z.ZodLiteral<9>, z.ZodLiteral<10>, z.ZodLiteral<11>, z.ZodLiteral<12>]>>;
|
|
74
74
|
label: z.ZodOptional<z.ZodString>;
|
|
75
75
|
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
id: z.ZodOptional<z.ZodString>;
|
|
76
77
|
attribute: z.ZodOptional<z.ZodString>;
|
|
77
78
|
attributeGroup: z.ZodOptional<z.ZodObject<{
|
|
78
79
|
id: z.ZodString;
|
|
@@ -88,19 +89,7 @@ declare const detailTabSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
88
89
|
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
89
90
|
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
90
91
|
order: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
}, z.core.$strict
|
|
92
|
-
type: z.ZodLiteral<"relation">;
|
|
93
|
-
attribute: z.ZodString;
|
|
94
|
-
columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
95
|
-
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
-
allowCreate: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
-
id: z.ZodString;
|
|
98
|
-
label: z.ZodString;
|
|
99
|
-
description: z.ZodOptional<z.ZodString>;
|
|
100
|
-
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
-
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
103
|
-
}, z.core.$strict>], "type">>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
104
93
|
formColumns: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
|
|
105
94
|
density: z.ZodOptional<z.ZodEnum<{
|
|
106
95
|
compact: "compact";
|
|
@@ -9,7 +9,7 @@ var chunk5WATIVCA_js = require('./chunk-5WATIVCA.js');
|
|
|
9
9
|
var chunkSI34M4IC_js = require('./chunk-SI34M4IC.js');
|
|
10
10
|
var chunkYIP5FJ5H_js = require('./chunk-YIP5FJ5H.js');
|
|
11
11
|
var chunkZPFOKBIN_js = require('./chunk-ZPFOKBIN.js');
|
|
12
|
-
var
|
|
12
|
+
var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
|
|
13
13
|
var chunkACKMC6FL_js = require('./chunk-ACKMC6FL.js');
|
|
14
14
|
var chunkE6JUYGJX_js = require('./chunk-E6JUYGJX.js');
|
|
15
15
|
var chunkQ4SZAMJT_js = require('./chunk-Q4SZAMJT.js');
|
|
@@ -162,7 +162,7 @@ function validateObjectOrThrow(objectDef, data) {
|
|
|
162
162
|
if (!result.success) {
|
|
163
163
|
const errors = result.errors ?? [];
|
|
164
164
|
const detail = errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("\n") || "Unknown validation error";
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkHWZRSXFB_js.ValidationError(
|
|
166
166
|
`Validation failed for ${objectDef.label}:
|
|
167
167
|
${detail}`,
|
|
168
168
|
errors.map((err) => ({ path: err.path, message: err.message }))
|
|
@@ -189,7 +189,7 @@ function validateDraftOrThrow(objectDef, data) {
|
|
|
189
189
|
if (!result.success) {
|
|
190
190
|
const errors = result.errors ?? [];
|
|
191
191
|
const detail = errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("\n") || "Unknown validation error";
|
|
192
|
-
throw new
|
|
192
|
+
throw new chunkHWZRSXFB_js.ValidationError(
|
|
193
193
|
`Draft validation failed for ${objectDef.label}:
|
|
194
194
|
${detail}`,
|
|
195
195
|
errors.map((err) => ({ path: err.path, message: err.message }))
|
|
@@ -201,7 +201,7 @@ function rejectUnknownAttributesOrThrow(objectDef, data) {
|
|
|
201
201
|
const knownNames = new Set(objectDef.attributes.map((a) => a.name));
|
|
202
202
|
const unknownKeys = Object.keys(data).filter((key) => !knownNames.has(key));
|
|
203
203
|
if (unknownKeys.length > 0) {
|
|
204
|
-
throw new
|
|
204
|
+
throw new chunkHWZRSXFB_js.ValidationError(
|
|
205
205
|
`Unknown attribute${unknownKeys.length > 1 ? "s" : ""} for ${objectDef.label}: ${unknownKeys.join(", ")}`,
|
|
206
206
|
unknownKeys.map((key) => ({ path: [key], message: "Unknown attribute" }))
|
|
207
207
|
);
|
|
@@ -105,6 +105,8 @@ var SchemaErrorCode = {
|
|
|
105
105
|
AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT",
|
|
106
106
|
AGENT_LEASE_HELD: "AGENT_LEASE_HELD",
|
|
107
107
|
AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED",
|
|
108
|
+
AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND",
|
|
109
|
+
AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE",
|
|
108
110
|
// AI / LLM
|
|
109
111
|
AI_UNKNOWN: "AI_UNKNOWN",
|
|
110
112
|
AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
var constants = require('@stndrds/constants');
|
|
6
6
|
|
|
@@ -571,7 +571,7 @@ function getAttributeConfigWriteSchema(type) {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
function validationErrorFromIssues(issues) {
|
|
574
|
-
return
|
|
574
|
+
return chunkHWZRSXFB_js.ValidationError.fromZodErrors(
|
|
575
575
|
issues.map((issue) => ({
|
|
576
576
|
path: issue.path.map((segment) => typeof segment === "symbol" ? String(segment) : segment),
|
|
577
577
|
message: issue.message
|
|
@@ -594,7 +594,7 @@ function validatePatchedIcon(patch) {
|
|
|
594
594
|
}
|
|
595
595
|
const result = iconNameSchema.optional().safeParse(patch.icon);
|
|
596
596
|
if (!result.success) {
|
|
597
|
-
throw
|
|
597
|
+
throw chunkHWZRSXFB_js.ValidationError.fromZodErrors(
|
|
598
598
|
result.error.issues.map((issue) => ({
|
|
599
599
|
path: [
|
|
600
600
|
"icon",
|
|
@@ -7,7 +7,7 @@ import { createCheckboxValidator } from './chunk-OSSGN43B.mjs';
|
|
|
7
7
|
import { createDateValidator } from './chunk-Q44QKLN4.mjs';
|
|
8
8
|
import { createNumberValidator } from './chunk-UANQJ2GH.mjs';
|
|
9
9
|
import { createTextValidator } from './chunk-O73ROMWQ.mjs';
|
|
10
|
-
import { ValidationError } from './chunk-
|
|
10
|
+
import { ValidationError } from './chunk-SYQDFZ74.mjs';
|
|
11
11
|
import { createCurrencyValidator } from './chunk-AYVHMVKQ.mjs';
|
|
12
12
|
import { createLocationValidator } from './chunk-YUFTHPOE.mjs';
|
|
13
13
|
import { createPhoneValidator } from './chunk-R5LAJCBU.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SCHEMA_LIMITS, iconNameSchema } from './chunk-
|
|
2
|
-
import { ValidationError } from './chunk-
|
|
1
|
+
import { SCHEMA_LIMITS, iconNameSchema } from './chunk-A5PPZ2FM.mjs';
|
|
2
|
+
import { ValidationError } from './chunk-SYQDFZ74.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
// src/types/system-attributes.ts
|
|
@@ -960,6 +960,8 @@ var fieldPresentationShape = {
|
|
|
960
960
|
readOnly: z.boolean().optional()
|
|
961
961
|
};
|
|
962
962
|
var fieldSchema = z.object({
|
|
963
|
+
/** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
|
|
964
|
+
id: z.string().optional(),
|
|
963
965
|
attribute: z.string().optional(),
|
|
964
966
|
attributeGroup: attributeGroupFieldSchema.optional(),
|
|
965
967
|
...fieldPresentationShape
|
|
@@ -984,15 +986,7 @@ var fieldGroupWriteSchema = z.object({
|
|
|
984
986
|
type: z.literal("fields"),
|
|
985
987
|
fields: z.array(fieldSchema).max(SCHEMA_LIMITS.fieldsPerGroup)
|
|
986
988
|
}).strict();
|
|
987
|
-
var
|
|
988
|
-
...baseGroupShape,
|
|
989
|
-
type: z.literal("relation"),
|
|
990
|
-
attribute: z.string(),
|
|
991
|
-
columns: z.array(z.string()).max(SCHEMA_LIMITS.columnsPerTab).optional(),
|
|
992
|
-
readOnly: z.boolean().optional(),
|
|
993
|
-
allowCreate: z.boolean().optional()
|
|
994
|
-
}).strict();
|
|
995
|
-
var groupWriteSchema = z.discriminatedUnion("type", [fieldGroupWriteSchema, relationGroupSchema]);
|
|
989
|
+
var groupWriteSchema = fieldGroupWriteSchema;
|
|
996
990
|
var baseTabShape = {
|
|
997
991
|
id: z.string(),
|
|
998
992
|
name: z.string(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
|
|
4
4
|
|
|
5
5
|
// src/utils/canonical-json.ts
|
|
6
6
|
function canonicalStringify(value) {
|
|
@@ -17,10 +17,10 @@ function canonicalStringify(value) {
|
|
|
17
17
|
case "object":
|
|
18
18
|
break;
|
|
19
19
|
default:
|
|
20
|
-
throw new
|
|
20
|
+
throw new chunkHWZRSXFB_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
|
|
21
21
|
}
|
|
22
22
|
const obj = v;
|
|
23
|
-
if (seen.has(obj)) throw new
|
|
23
|
+
if (seen.has(obj)) throw new chunkHWZRSXFB_js.ValidationError("Cannot canonicalize circular structure", []);
|
|
24
24
|
seen.add(obj);
|
|
25
25
|
try {
|
|
26
26
|
if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
|
|
@@ -103,6 +103,8 @@ var SchemaErrorCode = {
|
|
|
103
103
|
AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT",
|
|
104
104
|
AGENT_LEASE_HELD: "AGENT_LEASE_HELD",
|
|
105
105
|
AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED",
|
|
106
|
+
AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND",
|
|
107
|
+
AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE",
|
|
106
108
|
// AI / LLM
|
|
107
109
|
AI_UNKNOWN: "AI_UNKNOWN",
|
|
108
110
|
AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkLRFLSFIA_js = require('./chunk-LRFLSFIA.js');
|
|
4
|
+
var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
// src/types/system-attributes.ts
|
|
@@ -500,7 +500,7 @@ function canonicalizeFilterValue(rule, effectiveType) {
|
|
|
500
500
|
const message = `Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(
|
|
501
501
|
value
|
|
502
502
|
)}`;
|
|
503
|
-
throw new
|
|
503
|
+
throw new chunkHWZRSXFB_js.ValidationError(message, [{ path: ["value"], message }]);
|
|
504
504
|
}
|
|
505
505
|
function hasCurrencyAmount(value) {
|
|
506
506
|
if (typeof value !== "object") return true;
|
|
@@ -661,13 +661,13 @@ function resolveCanonicalOperator(rawOperator, effectiveType) {
|
|
|
661
661
|
const replacement = REMOVED_OPERATOR_REPLACEMENTS[rawOperator];
|
|
662
662
|
if (replacement) {
|
|
663
663
|
const m = `Unknown filter operator "${rawOperator}" \u2014 use ${replacement}`;
|
|
664
|
-
throw new
|
|
664
|
+
throw new chunkHWZRSXFB_js.ValidationError(m, [{ path: ["operator"], message: m }]);
|
|
665
665
|
}
|
|
666
666
|
const normalized = normalizeOperator(rawOperator);
|
|
667
667
|
const membership = SUBSTRING_TO_MEMBERSHIP[normalized];
|
|
668
668
|
if (membership && SET_MEMBERSHIP_TYPES.has(effectiveType)) {
|
|
669
669
|
const m = `Operator "${normalized}" is not valid for type "${effectiveType}" \u2014 use "${membership}"`;
|
|
670
|
-
throw new
|
|
670
|
+
throw new chunkHWZRSXFB_js.ValidationError(m, [{ path: ["operator"], message: m }]);
|
|
671
671
|
}
|
|
672
672
|
return normalized;
|
|
673
673
|
}
|
|
@@ -677,7 +677,7 @@ function assertOperatorForType(operator, type, context) {
|
|
|
677
677
|
if (!ops?.includes(normalized)) {
|
|
678
678
|
const validList = ops?.length ? ops.join(", ") : "(no operators registered for this type)";
|
|
679
679
|
const summary = `Operator "${operator}" is not valid for ${context} type "${type}". Valid operators: ${validList}.`;
|
|
680
|
-
throw new
|
|
680
|
+
throw new chunkHWZRSXFB_js.ValidationError(summary, [
|
|
681
681
|
{
|
|
682
682
|
path: ["operator"],
|
|
683
683
|
message: summary
|
|
@@ -690,7 +690,7 @@ function assertRelativeDateValue(rule) {
|
|
|
690
690
|
if (rule.operator !== "is_within") return;
|
|
691
691
|
if (!isRelativeDateValue(rule.value)) {
|
|
692
692
|
const m = `Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;
|
|
693
|
-
throw new
|
|
693
|
+
throw new chunkHWZRSXFB_js.ValidationError(m, [{ path: ["value"], message: m }]);
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
function applyCanonicalForm(rule, operator, effectiveType) {
|
|
@@ -703,11 +703,11 @@ function assertDynamicValueForAttribute(rule, attrType) {
|
|
|
703
703
|
const v = rule.value;
|
|
704
704
|
if (v.dynamic === "actor" && attrType !== "user") {
|
|
705
705
|
const m = `actor token (@me) is only valid on user attributes, not "${attrType}"`;
|
|
706
|
-
throw new
|
|
706
|
+
throw new chunkHWZRSXFB_js.ValidationError(m, [{ path: ["value"], message: m }]);
|
|
707
707
|
}
|
|
708
708
|
if (v.dynamic === "date" && attrType !== "date") {
|
|
709
709
|
const m = `date token (@today/@now) is only valid on date attributes, not "${attrType}"`;
|
|
710
|
-
throw new
|
|
710
|
+
throw new chunkHWZRSXFB_js.ValidationError(m, [{ path: ["value"], message: m }]);
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
function collectQualifiedRuleIssues(rule, context) {
|
|
@@ -715,7 +715,7 @@ function collectQualifiedRuleIssues(rule, context) {
|
|
|
715
715
|
validateQualifiedRule({ ...rule }, context);
|
|
716
716
|
return [];
|
|
717
717
|
} catch (error) {
|
|
718
|
-
if (!(error instanceof
|
|
718
|
+
if (!(error instanceof chunkHWZRSXFB_js.ValidationError)) throw error;
|
|
719
719
|
return error.errors.map((issue) => ({ ...issue, path: [...issue.path] }));
|
|
720
720
|
}
|
|
721
721
|
}
|
|
@@ -723,17 +723,17 @@ function validateQualifiedRule(rule, context) {
|
|
|
723
723
|
const rootAttr = context.attributes.find((a) => a.name === rule.attribute);
|
|
724
724
|
const systemOps = SYSTEM_FILTER_OPERATORS[rule.attribute];
|
|
725
725
|
if (!(rootAttr || systemOps)) {
|
|
726
|
-
throw new
|
|
726
|
+
throw new chunkHWZRSXFB_js.ValidationError(`Unknown attribute: ${rule.attribute}`, [
|
|
727
727
|
{ path: ["attribute"], message: `Unknown attribute: ${rule.attribute}` }
|
|
728
728
|
]);
|
|
729
729
|
}
|
|
730
730
|
if (rule.quantifier !== void 0 && !rule.property) {
|
|
731
731
|
const m = `quantifier is only valid on qualified edge rules (set "property")`;
|
|
732
|
-
throw new
|
|
732
|
+
throw new chunkHWZRSXFB_js.ValidationError(m, [{ path: ["quantifier"], message: m }]);
|
|
733
733
|
}
|
|
734
734
|
if (!rootAttr) {
|
|
735
735
|
if (rule.property) {
|
|
736
|
-
throw new
|
|
736
|
+
throw new chunkHWZRSXFB_js.ValidationError(`Cannot qualify system attribute "${rule.attribute}"`, [
|
|
737
737
|
{ path: ["property"], message: `"${rule.attribute}" is a system column, not a reference` }
|
|
738
738
|
]);
|
|
739
739
|
}
|
|
@@ -741,7 +741,7 @@ function validateQualifiedRule(rule, context) {
|
|
|
741
741
|
const normalizedOperator2 = resolveCanonicalOperator(rule.operator, effectiveType);
|
|
742
742
|
if (!systemOps.includes(normalizedOperator2)) {
|
|
743
743
|
const summary = `Operator "${rule.operator}" is not valid for system attribute "${rule.attribute}". Valid operators: ${systemOps.join(", ")}.`;
|
|
744
|
-
throw new
|
|
744
|
+
throw new chunkHWZRSXFB_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
|
|
745
745
|
}
|
|
746
746
|
applyCanonicalForm(rule, normalizedOperator2, effectiveType);
|
|
747
747
|
return;
|
|
@@ -753,25 +753,25 @@ function validateQualifiedRule(rule, context) {
|
|
|
753
753
|
if (!ops.includes(normalizedOperator2)) {
|
|
754
754
|
const validList = ops.length ? ops.join(", ") : "(not filterable)";
|
|
755
755
|
const summary = `Operator "${rule.operator}" is not valid for attribute "${rootAttr.name}". Valid operators: ${validList}.`;
|
|
756
|
-
throw new
|
|
756
|
+
throw new chunkHWZRSXFB_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
|
|
757
757
|
}
|
|
758
758
|
applyCanonicalForm(rule, normalizedOperator2, resolveEffectiveFilterType(rootAttr));
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
761
|
if (!REFERENCE_TYPES.has(rootAttr.type)) {
|
|
762
|
-
throw new
|
|
762
|
+
throw new chunkHWZRSXFB_js.ValidationError(`Cannot qualify ${rootAttr.type} attribute "${rule.attribute}"`, [
|
|
763
763
|
{ path: ["property"], message: `Attribute "${rule.attribute}" is not a reference type` }
|
|
764
764
|
]);
|
|
765
765
|
}
|
|
766
766
|
const propSchema = rootAttr.properties;
|
|
767
767
|
if (!propSchema) {
|
|
768
|
-
throw new
|
|
768
|
+
throw new chunkHWZRSXFB_js.ValidationError(`Attribute "${rule.attribute}" has no qualifyWith schema`, [
|
|
769
769
|
{ path: ["property"], message: `"${rule.attribute}" has no qualifyWith` }
|
|
770
770
|
]);
|
|
771
771
|
}
|
|
772
772
|
const propDef = propSchema.definitions.find((p) => p.name === rule.property);
|
|
773
773
|
if (!propDef) {
|
|
774
|
-
throw new
|
|
774
|
+
throw new chunkHWZRSXFB_js.ValidationError(
|
|
775
775
|
`Property "${rule.property}" not defined on "${rule.attribute}".qualifyWith()`,
|
|
776
776
|
[{ path: ["property"], message: `Unknown property: ${rule.property}` }]
|
|
777
777
|
);
|
|
@@ -787,7 +787,7 @@ function parseResourceVisibility(value) {
|
|
|
787
787
|
if (typeof value === "string" && RESOURCE_VISIBILITIES.includes(value)) {
|
|
788
788
|
return value;
|
|
789
789
|
}
|
|
790
|
-
throw new
|
|
790
|
+
throw new chunkHWZRSXFB_js.ValidationError(
|
|
791
791
|
`visibility must be one of: ${RESOURCE_VISIBILITIES.join(", ")} (received: ${String(value)})`,
|
|
792
792
|
[]
|
|
793
793
|
);
|
|
@@ -821,12 +821,12 @@ var RESERVED_OBJECT_NAMES = ["skill"];
|
|
|
821
821
|
// src/validators/view-config.schema.ts
|
|
822
822
|
var createModeSchema = zod.z.enum(["redirect", "inline", "peek"]);
|
|
823
823
|
var nonEmptyStringArraySchema = zod.z.array(zod.z.string()).min(1);
|
|
824
|
-
var columnsSchema = zod.z.array(zod.z.string()).max(
|
|
824
|
+
var columnsSchema = zod.z.array(zod.z.string()).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.columnsPerTab);
|
|
825
825
|
var sortRuleSchema = zod.z.object({
|
|
826
826
|
attribute: zod.z.string(),
|
|
827
827
|
direction: zod.z.enum(["asc", "desc"])
|
|
828
828
|
}).strict();
|
|
829
|
-
var sortsSchema = zod.z.array(sortRuleSchema).max(
|
|
829
|
+
var sortsSchema = zod.z.array(sortRuleSchema).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.sortsPerTab);
|
|
830
830
|
var relativeDateValueSchema = zod.z.object({
|
|
831
831
|
amount: zod.z.number(),
|
|
832
832
|
unit: zod.z.enum(["days", "weeks", "months", "years"]),
|
|
@@ -900,7 +900,7 @@ var filterRuleSchema = zod.z.object({
|
|
|
900
900
|
operator: filterOperatorSchema,
|
|
901
901
|
value: filterValueSchema
|
|
902
902
|
}).strict();
|
|
903
|
-
var filterRulesSchema = zod.z.array(filterRuleSchema).max(
|
|
903
|
+
var filterRulesSchema = zod.z.array(filterRuleSchema).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.filterRulesPerTab);
|
|
904
904
|
var filterStateSchema = zod.z.object({
|
|
905
905
|
combinator: zod.z.enum(["and", "or"]),
|
|
906
906
|
rules: filterRulesSchema
|
|
@@ -962,6 +962,8 @@ var fieldPresentationShape = {
|
|
|
962
962
|
readOnly: zod.z.boolean().optional()
|
|
963
963
|
};
|
|
964
964
|
var fieldSchema = zod.z.object({
|
|
965
|
+
/** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
|
|
966
|
+
id: zod.z.string().optional(),
|
|
965
967
|
attribute: zod.z.string().optional(),
|
|
966
968
|
attributeGroup: attributeGroupFieldSchema.optional(),
|
|
967
969
|
...fieldPresentationShape
|
|
@@ -984,28 +986,20 @@ var baseGroupShape = {
|
|
|
984
986
|
var fieldGroupWriteSchema = zod.z.object({
|
|
985
987
|
...baseGroupShape,
|
|
986
988
|
type: zod.z.literal("fields"),
|
|
987
|
-
fields: zod.z.array(fieldSchema).max(
|
|
989
|
+
fields: zod.z.array(fieldSchema).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.fieldsPerGroup)
|
|
988
990
|
}).strict();
|
|
989
|
-
var
|
|
990
|
-
...baseGroupShape,
|
|
991
|
-
type: zod.z.literal("relation"),
|
|
992
|
-
attribute: zod.z.string(),
|
|
993
|
-
columns: zod.z.array(zod.z.string()).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.columnsPerTab).optional(),
|
|
994
|
-
readOnly: zod.z.boolean().optional(),
|
|
995
|
-
allowCreate: zod.z.boolean().optional()
|
|
996
|
-
}).strict();
|
|
997
|
-
var groupWriteSchema = zod.z.discriminatedUnion("type", [fieldGroupWriteSchema, relationGroupSchema]);
|
|
991
|
+
var groupWriteSchema = fieldGroupWriteSchema;
|
|
998
992
|
var baseTabShape = {
|
|
999
993
|
id: zod.z.string(),
|
|
1000
994
|
name: zod.z.string(),
|
|
1001
995
|
label: zod.z.string(),
|
|
1002
|
-
icon:
|
|
996
|
+
icon: chunkLRFLSFIA_js.iconNameSchema.optional(),
|
|
1003
997
|
order: zod.z.number().optional()
|
|
1004
998
|
};
|
|
1005
999
|
var formTabWriteSchema = zod.z.object({
|
|
1006
1000
|
...baseTabShape,
|
|
1007
1001
|
type: zod.z.literal("form"),
|
|
1008
|
-
groups: zod.z.array(groupWriteSchema).min(1).max(
|
|
1002
|
+
groups: zod.z.array(groupWriteSchema).min(1).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.groupsPerFormTab),
|
|
1009
1003
|
formColumns: zod.z.union([zod.z.literal(1), zod.z.literal(2), zod.z.literal(3)]).optional(),
|
|
1010
1004
|
density: zod.z.enum(["compact", "comfortable", "spacious"]).optional()
|
|
1011
1005
|
}).strict().superRefine((tab, ctx) => {
|
|
@@ -1014,13 +1008,13 @@ var formTabWriteSchema = zod.z.object({
|
|
|
1014
1008
|
(count, group) => count + (group.type === "fields" ? group.fields.length : 0),
|
|
1015
1009
|
0
|
|
1016
1010
|
);
|
|
1017
|
-
if (totalFields >
|
|
1011
|
+
if (totalFields > chunkLRFLSFIA_js.SCHEMA_LIMITS.fieldsPerFormTab) {
|
|
1018
1012
|
ctx.addIssue({
|
|
1019
1013
|
code: "too_big",
|
|
1020
1014
|
origin: "array",
|
|
1021
|
-
maximum:
|
|
1015
|
+
maximum: chunkLRFLSFIA_js.SCHEMA_LIMITS.fieldsPerFormTab,
|
|
1022
1016
|
inclusive: true,
|
|
1023
|
-
message: `A form tab can contain at most ${
|
|
1017
|
+
message: `A form tab can contain at most ${chunkLRFLSFIA_js.SCHEMA_LIMITS.fieldsPerFormTab} fields`,
|
|
1024
1018
|
path: ["groups"]
|
|
1025
1019
|
});
|
|
1026
1020
|
}
|
|
@@ -1222,12 +1216,12 @@ var formsTabSchema = zod.z.object({
|
|
|
1222
1216
|
var emailsTabSchema = zod.z.object({
|
|
1223
1217
|
...baseTabShape,
|
|
1224
1218
|
type: zod.z.literal("emails"),
|
|
1225
|
-
emailAttributeIds: zod.z.array(zod.z.string()).max(
|
|
1219
|
+
emailAttributeIds: zod.z.array(zod.z.string()).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.emailAttributesPerTab)
|
|
1226
1220
|
}).strict();
|
|
1227
1221
|
var meetingsTabSchema = zod.z.object({
|
|
1228
1222
|
...baseTabShape,
|
|
1229
1223
|
type: zod.z.literal("meetings"),
|
|
1230
|
-
emailAttributeIds: zod.z.array(zod.z.string()).max(
|
|
1224
|
+
emailAttributeIds: zod.z.array(zod.z.string()).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.emailAttributesPerTab)
|
|
1231
1225
|
}).strict();
|
|
1232
1226
|
var detailTabSchema = zod.z.discriminatedUnion("type", [
|
|
1233
1227
|
formTabWriteSchema,
|
|
@@ -1243,7 +1237,7 @@ var detailTabSchema = zod.z.discriminatedUnion("type", [
|
|
|
1243
1237
|
var listTabCommonShape = {
|
|
1244
1238
|
id: zod.z.string(),
|
|
1245
1239
|
label: zod.z.string(),
|
|
1246
|
-
icon:
|
|
1240
|
+
icon: chunkLRFLSFIA_js.iconNameSchema.optional(),
|
|
1247
1241
|
default: zod.z.boolean().optional(),
|
|
1248
1242
|
// Which records the tab scopes to. `"all"` is the default and means "impose
|
|
1249
1243
|
// no scope" — the mandatory viewer predicate alone decides, so the tab shows
|
|
@@ -1277,7 +1271,7 @@ var listViewTabSchema = zod.z.discriminatedUnion("layout", [
|
|
|
1277
1271
|
]);
|
|
1278
1272
|
var _listViewConfigSchema = zod.z.object({
|
|
1279
1273
|
defaultFilters: filterGroupSchema.optional(),
|
|
1280
|
-
tabs: zod.z.array(listViewTabSchema).min(1).max(
|
|
1274
|
+
tabs: zod.z.array(listViewTabSchema).min(1).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.tabsPerView)
|
|
1281
1275
|
}).strict().superRefine((config, ctx) => {
|
|
1282
1276
|
addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
|
|
1283
1277
|
let hasDefault = false;
|
|
@@ -1294,9 +1288,9 @@ var _listViewConfigSchema = zod.z.object({
|
|
|
1294
1288
|
});
|
|
1295
1289
|
});
|
|
1296
1290
|
var _detailViewConfigSchema = zod.z.object({
|
|
1297
|
-
tabs: zod.z.array(detailTabSchema).min(1).max(
|
|
1291
|
+
tabs: zod.z.array(detailTabSchema).min(1).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.tabsPerView),
|
|
1298
1292
|
sidePanel: zod.z.object({
|
|
1299
|
-
attributes: zod.z.array(zod.z.string()).max(
|
|
1293
|
+
attributes: zod.z.array(zod.z.string()).max(chunkLRFLSFIA_js.SCHEMA_LIMITS.sidePanelAttributes),
|
|
1300
1294
|
width: zod.z.number().optional()
|
|
1301
1295
|
}).strict().optional()
|
|
1302
1296
|
}).strict().superRefine((config, ctx) => {
|
package/dist/exceptions.d.mts
CHANGED
|
@@ -81,6 +81,8 @@ declare const SchemaErrorCode: {
|
|
|
81
81
|
readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
|
|
82
82
|
readonly AGENT_LEASE_HELD: "AGENT_LEASE_HELD";
|
|
83
83
|
readonly AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED";
|
|
84
|
+
readonly AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND";
|
|
85
|
+
readonly AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE";
|
|
84
86
|
readonly AI_UNKNOWN: "AI_UNKNOWN";
|
|
85
87
|
readonly AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED";
|
|
86
88
|
readonly AI_INVALID_USAGE: "AI_INVALID_USAGE";
|
package/dist/exceptions.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ declare const SchemaErrorCode: {
|
|
|
81
81
|
readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
|
|
82
82
|
readonly AGENT_LEASE_HELD: "AGENT_LEASE_HELD";
|
|
83
83
|
readonly AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED";
|
|
84
|
+
readonly AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND";
|
|
85
|
+
readonly AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE";
|
|
84
86
|
readonly AI_UNKNOWN: "AI_UNKNOWN";
|
|
85
87
|
readonly AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED";
|
|
86
88
|
readonly AI_INVALID_USAGE: "AI_INVALID_USAGE";
|