@stndrds/schema 1.0.0-alpha.279 → 1.0.0-alpha.280
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-C0hXd79K.d.mts +482 -0
- package/dist/all-Ig0ig9wp.d.ts +482 -0
- package/dist/{chunk-ZEPGMHCK.js → chunk-3PGLMGTR.js} +4 -4
- package/dist/{chunk-DEHBEFGO.js → chunk-FAEOVIDJ.js} +3 -3
- package/dist/{chunk-ZBWTAKZO.js → chunk-M3WFXOA4.js} +4 -1
- package/dist/{chunk-PQEOIDXD.mjs → chunk-MSIGO7JA.mjs} +1 -1
- package/dist/{chunk-QMAVKX3Y.js → chunk-MXYCCUNB.js} +35 -35
- package/dist/chunk-NUEIGMYS.mjs +74 -0
- package/dist/{chunk-QUZ3PN36.mjs → chunk-PUMM6SPY.mjs} +1 -1
- package/dist/{chunk-5PLJHYSL.mjs → chunk-TBAD2T7Q.mjs} +2 -2
- package/dist/{chunk-V2WJFUZW.mjs → chunk-XDA5PZRT.mjs} +4 -1
- package/dist/{chunk-FRCDMQER.js → chunk-XTBGGJ3G.js} +34 -0
- package/dist/exceptions.d.mts +3 -0
- package/dist/exceptions.d.ts +3 -0
- package/dist/exceptions.js +39 -39
- package/dist/exceptions.mjs +1 -1
- package/dist/index.d.mts +8 -23
- package/dist/index.d.ts +8 -23
- package/dist/index.js +204 -232
- package/dist/index.mjs +11 -42
- package/dist/utils.d.mts +16 -1
- package/dist/utils.d.ts +16 -1
- package/dist/utils.js +11 -6
- package/dist/utils.mjs +2 -1
- package/dist/validation/all.d.mts +1 -1
- package/dist/validation/all.d.ts +1 -1
- package/dist/validation/all.js +29 -29
- package/dist/validation/all.mjs +4 -4
- 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
- package/dist/all-Bk8cRKsu.d.mts +0 -482
- package/dist/all-C_tC90ZM.d.ts +0 -482
- package/dist/chunk-QY6QFRRV.mjs +0 -41
|
@@ -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 chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.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 chunkM3WFXOA4_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 chunkM3WFXOA4_js.ValidationError.fromZodErrors(
|
|
598
598
|
result.error.issues.map((issue) => ({
|
|
599
599
|
path: [
|
|
600
600
|
"icon",
|
|
@@ -143,7 +143,10 @@ var SchemaErrorCode = {
|
|
|
143
143
|
REFLEX_EGRESS_DENIED: "REFLEX_EGRESS_DENIED",
|
|
144
144
|
REFLEX_PROTOCOL_VIOLATION: "REFLEX_PROTOCOL_VIOLATION",
|
|
145
145
|
REFLEX_RUN_FAILED: "REFLEX_RUN_FAILED",
|
|
146
|
-
REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT"
|
|
146
|
+
REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT",
|
|
147
|
+
REFLEX_DEPENDENCY_DRIFT: "REFLEX_DEPENDENCY_DRIFT",
|
|
148
|
+
REFLEX_NOT_READY: "REFLEX_NOT_READY",
|
|
149
|
+
REFLEX_INVARIANT_VIOLATION: "REFLEX_INVARIANT_VIOLATION"
|
|
147
150
|
};
|
|
148
151
|
var SchemaError = class extends Error {
|
|
149
152
|
constructor(message, code = SchemaErrorCode.UNKNOWN, details) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkFAEOVIDJ_js = require('./chunk-FAEOVIDJ.js');
|
|
4
|
+
var chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_js.ValidationError(m, [{ path: ["quantifier"], message: m }]);
|
|
733
733
|
}
|
|
734
734
|
if (!rootAttr) {
|
|
735
735
|
if (rule.property) {
|
|
736
|
-
throw new
|
|
736
|
+
throw new chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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 chunkM3WFXOA4_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(chunkFAEOVIDJ_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(chunkFAEOVIDJ_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(chunkFAEOVIDJ_js.SCHEMA_LIMITS.filterRulesPerTab);
|
|
904
904
|
var filterStateSchema = zod.z.object({
|
|
905
905
|
combinator: zod.z.enum(["and", "or"]),
|
|
906
906
|
rules: filterRulesSchema
|
|
@@ -984,13 +984,13 @@ var baseGroupShape = {
|
|
|
984
984
|
var fieldGroupWriteSchema = zod.z.object({
|
|
985
985
|
...baseGroupShape,
|
|
986
986
|
type: zod.z.literal("fields"),
|
|
987
|
-
fields: zod.z.array(fieldSchema).max(
|
|
987
|
+
fields: zod.z.array(fieldSchema).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.fieldsPerGroup)
|
|
988
988
|
}).strict();
|
|
989
989
|
var relationGroupSchema = zod.z.object({
|
|
990
990
|
...baseGroupShape,
|
|
991
991
|
type: zod.z.literal("relation"),
|
|
992
992
|
attribute: zod.z.string(),
|
|
993
|
-
columns: zod.z.array(zod.z.string()).max(
|
|
993
|
+
columns: zod.z.array(zod.z.string()).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.columnsPerTab).optional(),
|
|
994
994
|
readOnly: zod.z.boolean().optional(),
|
|
995
995
|
allowCreate: zod.z.boolean().optional()
|
|
996
996
|
}).strict();
|
|
@@ -999,13 +999,13 @@ var baseTabShape = {
|
|
|
999
999
|
id: zod.z.string(),
|
|
1000
1000
|
name: zod.z.string(),
|
|
1001
1001
|
label: zod.z.string(),
|
|
1002
|
-
icon:
|
|
1002
|
+
icon: chunkFAEOVIDJ_js.iconNameSchema.optional(),
|
|
1003
1003
|
order: zod.z.number().optional()
|
|
1004
1004
|
};
|
|
1005
1005
|
var formTabWriteSchema = zod.z.object({
|
|
1006
1006
|
...baseTabShape,
|
|
1007
1007
|
type: zod.z.literal("form"),
|
|
1008
|
-
groups: zod.z.array(groupWriteSchema).min(1).max(
|
|
1008
|
+
groups: zod.z.array(groupWriteSchema).min(1).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.groupsPerFormTab),
|
|
1009
1009
|
formColumns: zod.z.union([zod.z.literal(1), zod.z.literal(2), zod.z.literal(3)]).optional(),
|
|
1010
1010
|
density: zod.z.enum(["compact", "comfortable", "spacious"]).optional()
|
|
1011
1011
|
}).strict().superRefine((tab, ctx) => {
|
|
@@ -1014,13 +1014,13 @@ var formTabWriteSchema = zod.z.object({
|
|
|
1014
1014
|
(count, group) => count + (group.type === "fields" ? group.fields.length : 0),
|
|
1015
1015
|
0
|
|
1016
1016
|
);
|
|
1017
|
-
if (totalFields >
|
|
1017
|
+
if (totalFields > chunkFAEOVIDJ_js.SCHEMA_LIMITS.fieldsPerFormTab) {
|
|
1018
1018
|
ctx.addIssue({
|
|
1019
1019
|
code: "too_big",
|
|
1020
1020
|
origin: "array",
|
|
1021
|
-
maximum:
|
|
1021
|
+
maximum: chunkFAEOVIDJ_js.SCHEMA_LIMITS.fieldsPerFormTab,
|
|
1022
1022
|
inclusive: true,
|
|
1023
|
-
message: `A form tab can contain at most ${
|
|
1023
|
+
message: `A form tab can contain at most ${chunkFAEOVIDJ_js.SCHEMA_LIMITS.fieldsPerFormTab} fields`,
|
|
1024
1024
|
path: ["groups"]
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
@@ -1222,12 +1222,12 @@ var formsTabSchema = zod.z.object({
|
|
|
1222
1222
|
var emailsTabSchema = zod.z.object({
|
|
1223
1223
|
...baseTabShape,
|
|
1224
1224
|
type: zod.z.literal("emails"),
|
|
1225
|
-
emailAttributeIds: zod.z.array(zod.z.string()).max(
|
|
1225
|
+
emailAttributeIds: zod.z.array(zod.z.string()).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.emailAttributesPerTab)
|
|
1226
1226
|
}).strict();
|
|
1227
1227
|
var meetingsTabSchema = zod.z.object({
|
|
1228
1228
|
...baseTabShape,
|
|
1229
1229
|
type: zod.z.literal("meetings"),
|
|
1230
|
-
emailAttributeIds: zod.z.array(zod.z.string()).max(
|
|
1230
|
+
emailAttributeIds: zod.z.array(zod.z.string()).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.emailAttributesPerTab)
|
|
1231
1231
|
}).strict();
|
|
1232
1232
|
var detailTabSchema = zod.z.discriminatedUnion("type", [
|
|
1233
1233
|
formTabWriteSchema,
|
|
@@ -1243,7 +1243,7 @@ var detailTabSchema = zod.z.discriminatedUnion("type", [
|
|
|
1243
1243
|
var listTabCommonShape = {
|
|
1244
1244
|
id: zod.z.string(),
|
|
1245
1245
|
label: zod.z.string(),
|
|
1246
|
-
icon:
|
|
1246
|
+
icon: chunkFAEOVIDJ_js.iconNameSchema.optional(),
|
|
1247
1247
|
default: zod.z.boolean().optional(),
|
|
1248
1248
|
// Which records the tab scopes to. `"all"` is the default and means "impose
|
|
1249
1249
|
// no scope" — the mandatory viewer predicate alone decides, so the tab shows
|
|
@@ -1277,7 +1277,7 @@ var listViewTabSchema = zod.z.discriminatedUnion("layout", [
|
|
|
1277
1277
|
]);
|
|
1278
1278
|
var _listViewConfigSchema = zod.z.object({
|
|
1279
1279
|
defaultFilters: filterGroupSchema.optional(),
|
|
1280
|
-
tabs: zod.z.array(listViewTabSchema).min(1).max(
|
|
1280
|
+
tabs: zod.z.array(listViewTabSchema).min(1).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.tabsPerView)
|
|
1281
1281
|
}).strict().superRefine((config, ctx) => {
|
|
1282
1282
|
addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
|
|
1283
1283
|
let hasDefault = false;
|
|
@@ -1294,9 +1294,9 @@ var _listViewConfigSchema = zod.z.object({
|
|
|
1294
1294
|
});
|
|
1295
1295
|
});
|
|
1296
1296
|
var _detailViewConfigSchema = zod.z.object({
|
|
1297
|
-
tabs: zod.z.array(detailTabSchema).min(1).max(
|
|
1297
|
+
tabs: zod.z.array(detailTabSchema).min(1).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.tabsPerView),
|
|
1298
1298
|
sidePanel: zod.z.object({
|
|
1299
|
-
attributes: zod.z.array(zod.z.string()).max(
|
|
1299
|
+
attributes: zod.z.array(zod.z.string()).max(chunkFAEOVIDJ_js.SCHEMA_LIMITS.sidePanelAttributes),
|
|
1300
1300
|
width: zod.z.number().optional()
|
|
1301
1301
|
}).strict().optional()
|
|
1302
1302
|
}).strict().superRefine((config, ctx) => {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ValidationError } from './chunk-XDA5PZRT.mjs';
|
|
2
|
+
|
|
3
|
+
// src/utils/canonical-json.ts
|
|
4
|
+
function canonicalStringify(value) {
|
|
5
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6
|
+
function encode(v) {
|
|
7
|
+
if (v === null) return "null";
|
|
8
|
+
switch (typeof v) {
|
|
9
|
+
case "string":
|
|
10
|
+
case "number":
|
|
11
|
+
case "boolean":
|
|
12
|
+
return JSON.stringify(v);
|
|
13
|
+
case "undefined":
|
|
14
|
+
return void 0;
|
|
15
|
+
case "object":
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
throw new ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
|
|
19
|
+
}
|
|
20
|
+
const obj = v;
|
|
21
|
+
if (seen.has(obj)) throw new ValidationError("Cannot canonicalize circular structure", []);
|
|
22
|
+
seen.add(obj);
|
|
23
|
+
try {
|
|
24
|
+
if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
|
|
25
|
+
const entries = Object.entries(obj).map(([k, val]) => [k, encode(val)]).filter((pair) => pair[1] !== void 0).sort(([a], [b]) => a < b ? -1 : 1);
|
|
26
|
+
return `{${entries.map(([k, val]) => `${JSON.stringify(k)}:${val}`).join(",")}}`;
|
|
27
|
+
} finally {
|
|
28
|
+
seen.delete(obj);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return encode(value) ?? "null";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/utils.ts
|
|
35
|
+
function asTenantId(id) {
|
|
36
|
+
return id;
|
|
37
|
+
}
|
|
38
|
+
function asUserId(id) {
|
|
39
|
+
return id;
|
|
40
|
+
}
|
|
41
|
+
function generateId() {
|
|
42
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
43
|
+
return crypto.randomUUID();
|
|
44
|
+
}
|
|
45
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
46
|
+
const r = Math.random() * 16 | 0;
|
|
47
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
48
|
+
return v.toString(16);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function indexBy(items, keyFn) {
|
|
52
|
+
return new Map(items.map((item) => [keyFn(item), item]));
|
|
53
|
+
}
|
|
54
|
+
function deepEqual(a, b) {
|
|
55
|
+
if (a === b) return true;
|
|
56
|
+
if (a == null || b == null) return false;
|
|
57
|
+
if (typeof a !== typeof b) return false;
|
|
58
|
+
if (Array.isArray(a)) {
|
|
59
|
+
if (!Array.isArray(b)) return false;
|
|
60
|
+
if (a.length !== b.length) return false;
|
|
61
|
+
return a.every((item, index) => deepEqual(item, b[index]));
|
|
62
|
+
}
|
|
63
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
64
|
+
const aObj = a;
|
|
65
|
+
const bObj = b;
|
|
66
|
+
const aKeys = Object.keys(aObj);
|
|
67
|
+
const bKeys = Object.keys(bObj);
|
|
68
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
69
|
+
return aKeys.every((key) => key in bObj && deepEqual(aObj[key], bObj[key]));
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { asTenantId, asUserId, canonicalStringify, deepEqual, generateId, indexBy };
|
|
@@ -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-XDA5PZRT.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-MSIGO7JA.mjs';
|
|
2
|
+
import { ValidationError } from './chunk-XDA5PZRT.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
// src/types/system-attributes.ts
|
|
@@ -141,7 +141,10 @@ var SchemaErrorCode = {
|
|
|
141
141
|
REFLEX_EGRESS_DENIED: "REFLEX_EGRESS_DENIED",
|
|
142
142
|
REFLEX_PROTOCOL_VIOLATION: "REFLEX_PROTOCOL_VIOLATION",
|
|
143
143
|
REFLEX_RUN_FAILED: "REFLEX_RUN_FAILED",
|
|
144
|
-
REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT"
|
|
144
|
+
REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT",
|
|
145
|
+
REFLEX_DEPENDENCY_DRIFT: "REFLEX_DEPENDENCY_DRIFT",
|
|
146
|
+
REFLEX_NOT_READY: "REFLEX_NOT_READY",
|
|
147
|
+
REFLEX_INVARIANT_VIOLATION: "REFLEX_INVARIANT_VIOLATION"
|
|
145
148
|
};
|
|
146
149
|
var SchemaError = class extends Error {
|
|
147
150
|
constructor(message, code = SchemaErrorCode.UNKNOWN, details) {
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.js');
|
|
4
|
+
|
|
5
|
+
// src/utils/canonical-json.ts
|
|
6
|
+
function canonicalStringify(value) {
|
|
7
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8
|
+
function encode(v) {
|
|
9
|
+
if (v === null) return "null";
|
|
10
|
+
switch (typeof v) {
|
|
11
|
+
case "string":
|
|
12
|
+
case "number":
|
|
13
|
+
case "boolean":
|
|
14
|
+
return JSON.stringify(v);
|
|
15
|
+
case "undefined":
|
|
16
|
+
return void 0;
|
|
17
|
+
case "object":
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
throw new chunkM3WFXOA4_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
|
|
21
|
+
}
|
|
22
|
+
const obj = v;
|
|
23
|
+
if (seen.has(obj)) throw new chunkM3WFXOA4_js.ValidationError("Cannot canonicalize circular structure", []);
|
|
24
|
+
seen.add(obj);
|
|
25
|
+
try {
|
|
26
|
+
if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
|
|
27
|
+
const entries = Object.entries(obj).map(([k, val]) => [k, encode(val)]).filter((pair) => pair[1] !== void 0).sort(([a], [b]) => a < b ? -1 : 1);
|
|
28
|
+
return `{${entries.map(([k, val]) => `${JSON.stringify(k)}:${val}`).join(",")}}`;
|
|
29
|
+
} finally {
|
|
30
|
+
seen.delete(obj);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return encode(value) ?? "null";
|
|
34
|
+
}
|
|
35
|
+
|
|
3
36
|
// src/utils.ts
|
|
4
37
|
function asTenantId(id) {
|
|
5
38
|
return id;
|
|
@@ -42,6 +75,7 @@ function deepEqual(a, b) {
|
|
|
42
75
|
|
|
43
76
|
exports.asTenantId = asTenantId;
|
|
44
77
|
exports.asUserId = asUserId;
|
|
78
|
+
exports.canonicalStringify = canonicalStringify;
|
|
45
79
|
exports.deepEqual = deepEqual;
|
|
46
80
|
exports.generateId = generateId;
|
|
47
81
|
exports.indexBy = indexBy;
|
package/dist/exceptions.d.mts
CHANGED
|
@@ -113,6 +113,9 @@ declare const SchemaErrorCode: {
|
|
|
113
113
|
readonly REFLEX_PROTOCOL_VIOLATION: "REFLEX_PROTOCOL_VIOLATION";
|
|
114
114
|
readonly REFLEX_RUN_FAILED: "REFLEX_RUN_FAILED";
|
|
115
115
|
readonly REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT";
|
|
116
|
+
readonly REFLEX_DEPENDENCY_DRIFT: "REFLEX_DEPENDENCY_DRIFT";
|
|
117
|
+
readonly REFLEX_NOT_READY: "REFLEX_NOT_READY";
|
|
118
|
+
readonly REFLEX_INVARIANT_VIOLATION: "REFLEX_INVARIANT_VIOLATION";
|
|
116
119
|
};
|
|
117
120
|
type SchemaErrorCode = (typeof SchemaErrorCode)[keyof typeof SchemaErrorCode];
|
|
118
121
|
/**
|
package/dist/exceptions.d.ts
CHANGED
|
@@ -113,6 +113,9 @@ declare const SchemaErrorCode: {
|
|
|
113
113
|
readonly REFLEX_PROTOCOL_VIOLATION: "REFLEX_PROTOCOL_VIOLATION";
|
|
114
114
|
readonly REFLEX_RUN_FAILED: "REFLEX_RUN_FAILED";
|
|
115
115
|
readonly REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT";
|
|
116
|
+
readonly REFLEX_DEPENDENCY_DRIFT: "REFLEX_DEPENDENCY_DRIFT";
|
|
117
|
+
readonly REFLEX_NOT_READY: "REFLEX_NOT_READY";
|
|
118
|
+
readonly REFLEX_INVARIANT_VIOLATION: "REFLEX_INVARIANT_VIOLATION";
|
|
116
119
|
};
|
|
117
120
|
type SchemaErrorCode = (typeof SchemaErrorCode)[keyof typeof SchemaErrorCode];
|
|
118
121
|
/**
|