@stndrds/schema 1.0.0-alpha.281 → 1.0.0-alpha.284
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-DanoPxKr.d.ts +879 -0
- package/dist/all-bG_ha0VV.d.mts +879 -0
- package/dist/{attributes-D8eHv5Kf.d.ts → attributes-CNYwg_Nr.d.ts} +14 -13
- package/dist/{attributes--M1ifW8_.d.mts → attributes-CWPLbp7c.d.mts} +14 -13
- package/dist/capabilities.d.mts +146 -0
- package/dist/capabilities.d.ts +146 -0
- package/dist/capabilities.js +77 -0
- package/dist/capabilities.mjs +70 -0
- package/dist/{chunk-A5PPZ2FM.mjs → chunk-5OBQRDRM.mjs} +7 -3
- package/dist/{chunk-ORPCS24B.mjs → chunk-AGRAFDGU.mjs} +72 -16
- package/dist/{chunk-LRFLSFIA.js → chunk-BOICAZHR.js} +9 -4
- package/dist/{chunk-E47WAI5K.js → chunk-I3EYILYO.js} +5 -5
- package/dist/{chunk-OYHBQMC7.js → chunk-K6ET4CXP.js} +3 -3
- package/dist/{chunk-MLTXSBOB.mjs → chunk-PNOWKRH2.mjs} +2 -2
- package/dist/{chunk-XCLVXM7F.mjs → chunk-R57T4UDX.mjs} +1 -1
- package/dist/{chunk-SYQDFZ74.mjs → chunk-RUO25ERR.mjs} +36 -0
- package/dist/{chunk-HWZRSXFB.js → chunk-V26R64A4.js} +36 -0
- package/dist/{chunk-TU6ECJFZ.js → chunk-YZ5RCMIQ.js} +112 -45
- package/dist/exceptions.d.mts +24 -3
- package/dist/exceptions.d.ts +24 -3
- package/dist/exceptions.js +39 -39
- package/dist/exceptions.mjs +1 -1
- package/dist/{helpers-DyoPqiSz.d.ts → helpers-CXkVwpsl.d.ts} +3 -3
- package/dist/{helpers-BiABdSxK.d.mts → helpers-Dul_r9rJ.d.mts} +3 -3
- package/dist/{index-DWoqObyG.d.mts → index-Ca-MzQuU.d.mts} +46 -6
- package/dist/{index-TMlrIKAY.d.ts → index-Ns6KGfrZ.d.ts} +46 -6
- package/dist/index.d.mts +1508 -357
- package/dist/index.d.ts +1508 -357
- package/dist/index.js +1396 -363
- package/dist/index.mjs +1072 -124
- package/dist/{migrations-B1kkIhIX.d.ts → migrations-DaFneOfx.d.ts} +1 -1
- package/dist/{migrations-BNlQVzDC.d.mts → migrations-fRvadl6i.d.mts} +1 -1
- package/dist/{objects-DmMqHn3L.d.mts → objects-CDwMSnqv.d.mts} +2 -4
- package/dist/{objects-DgFojgwH.d.ts → objects-DJv6WrDE.d.ts} +2 -4
- package/dist/{types-DHqXzkgW.d.mts → types-CVYiFc69.d.mts} +1 -1
- package/dist/{types-DYYFto8d.d.ts → types-NGEww_ln.d.ts} +1 -1
- package/dist/utils.js +8 -8
- package/dist/utils.mjs +2 -2
- package/dist/validation/all.d.mts +7 -7
- package/dist/validation/all.d.ts +7 -7
- package/dist/validation/all.js +46 -46
- package/dist/validation/all.mjs +5 -5
- package/dist/validation/complex/currency.d.mts +2 -2
- package/dist/validation/complex/currency.d.ts +2 -2
- package/dist/validation/complex/location.d.mts +2 -2
- package/dist/validation/complex/location.d.ts +2 -2
- package/dist/validation/complex/phone.d.mts +2 -2
- package/dist/validation/complex/phone.d.ts +2 -2
- package/dist/validation/complex/relation.d.mts +2 -2
- package/dist/validation/complex/relation.d.ts +2 -2
- package/dist/validation/complex/richtext.d.mts +2 -2
- package/dist/validation/complex/richtext.d.ts +2 -2
- package/dist/validation/complex/select.d.mts +2 -2
- package/dist/validation/complex/select.d.ts +2 -2
- package/dist/validation/complex/user.d.mts +2 -2
- package/dist/validation/complex/user.d.ts +2 -2
- package/dist/validation/computed/formula.d.mts +2 -2
- package/dist/validation/computed/formula.d.ts +2 -2
- package/dist/validation/computed/rollup.d.mts +2 -2
- package/dist/validation/computed/rollup.d.ts +2 -2
- package/dist/validation/config/index.d.mts +4 -4
- package/dist/validation/config/index.d.ts +4 -4
- package/dist/validation/config/index.js +15 -11
- package/dist/validation/config/index.mjs +2 -2
- package/dist/validation/core/index.d.mts +3 -3
- package/dist/validation/core/index.d.ts +3 -3
- package/dist/validation/object/index.d.mts +5 -5
- package/dist/validation/object/index.d.ts +5 -5
- package/dist/validation/object/index.js +15 -15
- package/dist/validation/object/index.mjs +3 -3
- package/dist/validation/primitives/checkbox.d.mts +2 -2
- package/dist/validation/primitives/checkbox.d.ts +2 -2
- package/dist/validation/primitives/date.d.mts +2 -2
- package/dist/validation/primitives/date.d.ts +2 -2
- package/dist/validation/primitives/number.d.mts +2 -2
- package/dist/validation/primitives/number.d.ts +2 -2
- package/dist/validation/primitives/text.d.mts +2 -2
- package/dist/validation/primitives/text.d.ts +2 -2
- package/package.json +10 -5
- package/dist/all-BVp3k9Hi.d.ts +0 -471
- package/dist/all-CnIU2anT.d.mts +0 -471
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkBOICAZHR_js = require('./chunk-BOICAZHR.js');
|
|
4
|
+
var chunkV26R64A4_js = require('./chunk-V26R64A4.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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_js.ValidationError(m, [{ path: ["quantifier"], message: m }]);
|
|
733
733
|
}
|
|
734
734
|
if (!rootAttr) {
|
|
735
735
|
if (rule.property) {
|
|
736
|
-
throw new
|
|
736
|
+
throw new chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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 chunkV26R64A4_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(chunkBOICAZHR_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(chunkBOICAZHR_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(chunkBOICAZHR_js.SCHEMA_LIMITS.filterRulesPerTab);
|
|
904
904
|
var filterStateSchema = zod.z.object({
|
|
905
905
|
combinator: zod.z.enum(["and", "or"]),
|
|
906
906
|
rules: filterRulesSchema
|
|
@@ -961,20 +961,25 @@ var fieldPresentationShape = {
|
|
|
961
961
|
label: zod.z.string().optional(),
|
|
962
962
|
readOnly: zod.z.boolean().optional()
|
|
963
963
|
};
|
|
964
|
-
var
|
|
965
|
-
/** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
|
|
966
|
-
id: zod.z.string().optional(),
|
|
964
|
+
var fieldShape = {
|
|
967
965
|
attribute: zod.z.string().optional(),
|
|
968
966
|
attributeGroup: attributeGroupFieldSchema.optional(),
|
|
969
967
|
...fieldPresentationShape
|
|
970
|
-
}
|
|
968
|
+
};
|
|
969
|
+
function refineField(field, ctx) {
|
|
971
970
|
if (field.attribute === void 0 === (field.attributeGroup === void 0)) {
|
|
972
971
|
ctx.addIssue({
|
|
973
972
|
code: "custom",
|
|
974
973
|
message: "A field must define exactly one of attribute or attributeGroup"
|
|
975
974
|
});
|
|
976
975
|
}
|
|
977
|
-
}
|
|
976
|
+
}
|
|
977
|
+
var fieldSchema = zod.z.object({
|
|
978
|
+
/** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
|
|
979
|
+
id: zod.z.string().optional(),
|
|
980
|
+
...fieldShape
|
|
981
|
+
}).strict().superRefine(refineField);
|
|
982
|
+
var fieldSlotSchema = zod.z.object({ id: zod.z.string().min(1), ...fieldShape }).strict().superRefine(refineField);
|
|
978
983
|
var baseGroupShape = {
|
|
979
984
|
id: zod.z.string(),
|
|
980
985
|
label: zod.z.string(),
|
|
@@ -986,35 +991,38 @@ var baseGroupShape = {
|
|
|
986
991
|
var fieldGroupWriteSchema = zod.z.object({
|
|
987
992
|
...baseGroupShape,
|
|
988
993
|
type: zod.z.literal("fields"),
|
|
989
|
-
fields: zod.z.array(fieldSchema).max(
|
|
994
|
+
fields: zod.z.array(fieldSchema).max(chunkBOICAZHR_js.SCHEMA_LIMITS.fieldsPerGroup)
|
|
990
995
|
}).strict();
|
|
991
996
|
var groupWriteSchema = fieldGroupWriteSchema;
|
|
992
997
|
var baseTabShape = {
|
|
993
998
|
id: zod.z.string(),
|
|
994
999
|
name: zod.z.string(),
|
|
995
1000
|
label: zod.z.string(),
|
|
996
|
-
icon:
|
|
1001
|
+
icon: chunkBOICAZHR_js.iconNameSchema.optional(),
|
|
997
1002
|
order: zod.z.number().optional()
|
|
998
1003
|
};
|
|
999
|
-
var
|
|
1004
|
+
var formTabGroupsSchema = zod.z.array(groupWriteSchema).max(chunkBOICAZHR_js.SCHEMA_LIMITS.groupsPerFormTab);
|
|
1005
|
+
var formTabShape = {
|
|
1000
1006
|
...baseTabShape,
|
|
1001
1007
|
type: zod.z.literal("form"),
|
|
1002
|
-
groups:
|
|
1008
|
+
groups: formTabGroupsSchema,
|
|
1003
1009
|
formColumns: zod.z.union([zod.z.literal(1), zod.z.literal(2), zod.z.literal(3)]).optional(),
|
|
1004
1010
|
density: zod.z.enum(["compact", "comfortable", "spacious"]).optional()
|
|
1005
|
-
}
|
|
1011
|
+
};
|
|
1012
|
+
var formTabDraftObjectSchema = zod.z.object(formTabShape).strict();
|
|
1013
|
+
function refineFormTab(tab, ctx) {
|
|
1006
1014
|
addDuplicateIdIssues(tab.groups, ctx, ["groups"]);
|
|
1007
1015
|
const totalFields = tab.groups.reduce(
|
|
1008
1016
|
(count, group) => count + (group.type === "fields" ? group.fields.length : 0),
|
|
1009
1017
|
0
|
|
1010
1018
|
);
|
|
1011
|
-
if (totalFields >
|
|
1019
|
+
if (totalFields > chunkBOICAZHR_js.SCHEMA_LIMITS.fieldsPerFormTab) {
|
|
1012
1020
|
ctx.addIssue({
|
|
1013
1021
|
code: "too_big",
|
|
1014
1022
|
origin: "array",
|
|
1015
|
-
maximum:
|
|
1023
|
+
maximum: chunkBOICAZHR_js.SCHEMA_LIMITS.fieldsPerFormTab,
|
|
1016
1024
|
inclusive: true,
|
|
1017
|
-
message: `A form tab can contain at most ${
|
|
1025
|
+
message: `A form tab can contain at most ${chunkBOICAZHR_js.SCHEMA_LIMITS.fieldsPerFormTab} fields`,
|
|
1018
1026
|
path: ["groups"]
|
|
1019
1027
|
});
|
|
1020
1028
|
}
|
|
@@ -1034,7 +1042,9 @@ var formTabWriteSchema = zod.z.object({
|
|
|
1034
1042
|
seenAttributeGroupIds.add(id);
|
|
1035
1043
|
});
|
|
1036
1044
|
});
|
|
1037
|
-
}
|
|
1045
|
+
}
|
|
1046
|
+
var formTabWriteSchema = zod.z.object({ ...formTabShape, groups: formTabGroupsSchema.min(1) }).strict().superRefine(refineFormTab);
|
|
1047
|
+
var formTabDraftSchema = formTabDraftObjectSchema.superRefine(refineFormTab);
|
|
1038
1048
|
var relationSourceSchema = zod.z.object({
|
|
1039
1049
|
type: zod.z.literal("relation"),
|
|
1040
1050
|
attribute: zod.z.string()
|
|
@@ -1216,15 +1226,14 @@ var formsTabSchema = zod.z.object({
|
|
|
1216
1226
|
var emailsTabSchema = zod.z.object({
|
|
1217
1227
|
...baseTabShape,
|
|
1218
1228
|
type: zod.z.literal("emails"),
|
|
1219
|
-
emailAttributeIds: zod.z.array(zod.z.string()).max(
|
|
1229
|
+
emailAttributeIds: zod.z.array(zod.z.string()).max(chunkBOICAZHR_js.SCHEMA_LIMITS.emailAttributesPerTab)
|
|
1220
1230
|
}).strict();
|
|
1221
1231
|
var meetingsTabSchema = zod.z.object({
|
|
1222
1232
|
...baseTabShape,
|
|
1223
1233
|
type: zod.z.literal("meetings"),
|
|
1224
|
-
emailAttributeIds: zod.z.array(zod.z.string()).max(
|
|
1234
|
+
emailAttributeIds: zod.z.array(zod.z.string()).max(chunkBOICAZHR_js.SCHEMA_LIMITS.emailAttributesPerTab)
|
|
1225
1235
|
}).strict();
|
|
1226
|
-
var
|
|
1227
|
-
formTabWriteSchema,
|
|
1236
|
+
var nonFormDetailTabSchemas = [
|
|
1228
1237
|
tableTabSchema,
|
|
1229
1238
|
customTabSchema,
|
|
1230
1239
|
activityTabSchema,
|
|
@@ -1233,11 +1242,19 @@ var detailTabSchema = zod.z.discriminatedUnion("type", [
|
|
|
1233
1242
|
formsTabSchema,
|
|
1234
1243
|
emailsTabSchema,
|
|
1235
1244
|
meetingsTabSchema
|
|
1245
|
+
];
|
|
1246
|
+
var detailTabSchema = zod.z.discriminatedUnion("type", [
|
|
1247
|
+
formTabWriteSchema,
|
|
1248
|
+
...nonFormDetailTabSchemas
|
|
1249
|
+
]);
|
|
1250
|
+
var detailTabDraftSchema = zod.z.discriminatedUnion("type", [
|
|
1251
|
+
formTabDraftSchema,
|
|
1252
|
+
...nonFormDetailTabSchemas
|
|
1236
1253
|
]);
|
|
1237
1254
|
var listTabCommonShape = {
|
|
1238
1255
|
id: zod.z.string(),
|
|
1239
1256
|
label: zod.z.string(),
|
|
1240
|
-
icon:
|
|
1257
|
+
icon: chunkBOICAZHR_js.iconNameSchema.optional(),
|
|
1241
1258
|
default: zod.z.boolean().optional(),
|
|
1242
1259
|
// Which records the tab scopes to. `"all"` is the default and means "impose
|
|
1243
1260
|
// no scope" — the mandatory viewer predicate alone decides, so the tab shows
|
|
@@ -1271,7 +1288,7 @@ var listViewTabSchema = zod.z.discriminatedUnion("layout", [
|
|
|
1271
1288
|
]);
|
|
1272
1289
|
var _listViewConfigSchema = zod.z.object({
|
|
1273
1290
|
defaultFilters: filterGroupSchema.optional(),
|
|
1274
|
-
tabs: zod.z.array(listViewTabSchema).min(1).max(
|
|
1291
|
+
tabs: zod.z.array(listViewTabSchema).min(1).max(chunkBOICAZHR_js.SCHEMA_LIMITS.tabsPerView)
|
|
1275
1292
|
}).strict().superRefine((config, ctx) => {
|
|
1276
1293
|
addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
|
|
1277
1294
|
let hasDefault = false;
|
|
@@ -1287,12 +1304,42 @@ var _listViewConfigSchema = zod.z.object({
|
|
|
1287
1304
|
hasDefault = true;
|
|
1288
1305
|
});
|
|
1289
1306
|
});
|
|
1307
|
+
var sidePanelPaneSchema = zod.z.discriminatedUnion("kind", [
|
|
1308
|
+
zod.z.object({
|
|
1309
|
+
kind: zod.z.literal("fields"),
|
|
1310
|
+
id: zod.z.string().optional(),
|
|
1311
|
+
label: zod.z.string().optional(),
|
|
1312
|
+
attributes: zod.z.array(zod.z.string()).max(chunkBOICAZHR_js.SCHEMA_LIMITS.sidePanelAttributes)
|
|
1313
|
+
}).strict(),
|
|
1314
|
+
zod.z.object({
|
|
1315
|
+
kind: zod.z.literal("activity"),
|
|
1316
|
+
id: zod.z.string().optional(),
|
|
1317
|
+
label: zod.z.string().optional()
|
|
1318
|
+
}).strict(),
|
|
1319
|
+
zod.z.object({
|
|
1320
|
+
kind: zod.z.literal("documents"),
|
|
1321
|
+
// Required here alone: the documents content keys its stored sort mode
|
|
1322
|
+
// on this id, so a pane without one would share the main-column
|
|
1323
|
+
// documents tab's sort.
|
|
1324
|
+
id: zod.z.string(),
|
|
1325
|
+
label: zod.z.string().optional(),
|
|
1326
|
+
allowUpload: zod.z.boolean().optional(),
|
|
1327
|
+
allowRemove: zod.z.boolean().optional()
|
|
1328
|
+
}).strict()
|
|
1329
|
+
]);
|
|
1290
1330
|
var _detailViewConfigSchema = zod.z.object({
|
|
1291
|
-
tabs: zod.z.array(detailTabSchema).min(1).max(
|
|
1331
|
+
tabs: zod.z.array(detailTabSchema).min(1).max(chunkBOICAZHR_js.SCHEMA_LIMITS.tabsPerView),
|
|
1292
1332
|
sidePanel: zod.z.object({
|
|
1293
|
-
attributes: zod.z.array(zod.z.string()).max(
|
|
1333
|
+
attributes: zod.z.array(zod.z.string()).max(chunkBOICAZHR_js.SCHEMA_LIMITS.sidePanelAttributes).optional(),
|
|
1334
|
+
panes: zod.z.array(sidePanelPaneSchema).max(chunkBOICAZHR_js.SCHEMA_LIMITS.sidePanelPanes).optional(),
|
|
1294
1335
|
width: zod.z.number().optional()
|
|
1295
|
-
}).strict().
|
|
1336
|
+
}).strict().refine((sidePanel) => sidePanel.attributes !== void 0 || sidePanel.panes !== void 0, {
|
|
1337
|
+
message: "sidePanel requires attributes or panes"
|
|
1338
|
+
}).refine((sidePanel) => sidePanel.panes === void 0 || sidePanel.panes.length > 0, {
|
|
1339
|
+
message: "sidePanel panes must not be empty"
|
|
1340
|
+
}).refine((sidePanel) => sidePanel.attributes === void 0 || sidePanel.panes === void 0, {
|
|
1341
|
+
message: "sidePanel takes attributes or panes, not both"
|
|
1342
|
+
}).optional()
|
|
1296
1343
|
}).strict().superRefine((config, ctx) => {
|
|
1297
1344
|
addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
|
|
1298
1345
|
addDuplicateNameIssues(config.tabs, ctx, ["tabs"]);
|
|
@@ -1320,8 +1367,19 @@ function parseViewConfig(type, input) {
|
|
|
1320
1367
|
return viewConfigByTypeSchema.parse({ type, config: input }).config;
|
|
1321
1368
|
}
|
|
1322
1369
|
}
|
|
1370
|
+
var LIST_TAB_TABLE_KEYS = ["columnSizing"];
|
|
1371
|
+
var LIST_TAB_KANBAN_KEYS = [
|
|
1372
|
+
"groupByAttribute",
|
|
1373
|
+
"cardUserAttribute",
|
|
1374
|
+
"cardDateAttribute",
|
|
1375
|
+
"kanbanColumnOrder",
|
|
1376
|
+
"kanbanColumnVisibility",
|
|
1377
|
+
"kanbanPinnedColumns"
|
|
1378
|
+
];
|
|
1323
1379
|
|
|
1324
1380
|
exports.ATTRIBUTE_FILTER_OPERATORS = ATTRIBUTE_FILTER_OPERATORS;
|
|
1381
|
+
exports.LIST_TAB_KANBAN_KEYS = LIST_TAB_KANBAN_KEYS;
|
|
1382
|
+
exports.LIST_TAB_TABLE_KEYS = LIST_TAB_TABLE_KEYS;
|
|
1325
1383
|
exports.LIST_VIEW_TAB_VISIBILITIES = LIST_VIEW_TAB_VISIBILITIES;
|
|
1326
1384
|
exports.NO_VALUE_OPERATORS = NO_VALUE_OPERATORS;
|
|
1327
1385
|
exports.OPERATORS_BY_TYPE = OPERATORS_BY_TYPE;
|
|
@@ -1336,17 +1394,25 @@ exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES;
|
|
|
1336
1394
|
exports.SYSTEM_FILTER_ATTRIBUTE_TYPES = SYSTEM_FILTER_ATTRIBUTE_TYPES;
|
|
1337
1395
|
exports.canonicalizeFilterValue = canonicalizeFilterValue;
|
|
1338
1396
|
exports.collectQualifiedRuleIssues = collectQualifiedRuleIssues;
|
|
1397
|
+
exports.columnsSchema = columnsSchema;
|
|
1339
1398
|
exports.currentActor = currentActor;
|
|
1399
|
+
exports.detailTabDraftSchema = detailTabDraftSchema;
|
|
1340
1400
|
exports.detailTabSchema = detailTabSchema;
|
|
1341
1401
|
exports.detailViewConfigSchema = detailViewConfigSchema;
|
|
1342
1402
|
exports.extractCurrencyFilterValue = extractCurrencyFilterValue;
|
|
1343
1403
|
exports.extractFilterValue = extractFilterValue;
|
|
1404
|
+
exports.fieldSchema = fieldSchema;
|
|
1405
|
+
exports.fieldShape = fieldShape;
|
|
1406
|
+
exports.fieldSlotSchema = fieldSlotSchema;
|
|
1407
|
+
exports.filterGroupSchema = filterGroupSchema;
|
|
1408
|
+
exports.filterStateSchema = filterStateSchema;
|
|
1344
1409
|
exports.getAttributeCapabilities = getAttributeCapabilities;
|
|
1345
1410
|
exports.getAttributeFilterOperators = getAttributeFilterOperators;
|
|
1346
1411
|
exports.getOperatorPolarity = getOperatorPolarity;
|
|
1347
1412
|
exports.getRollupFilterOperators = getRollupFilterOperators2;
|
|
1348
1413
|
exports.getSystemAttributeI18nKey = getSystemAttributeI18nKey;
|
|
1349
1414
|
exports.getSystemAttributeList = getSystemAttributeList;
|
|
1415
|
+
exports.groupWriteSchema = groupWriteSchema;
|
|
1350
1416
|
exports.inverseSourceSchema = inverseSourceSchema;
|
|
1351
1417
|
exports.isAttributeFilterable = isAttributeFilterable;
|
|
1352
1418
|
exports.isAttributeGroupable = isAttributeGroupable;
|
|
@@ -1370,6 +1436,7 @@ exports.relationSourceSchema = relationSourceSchema;
|
|
|
1370
1436
|
exports.resolveEffectiveFilterType = resolveEffectiveFilterType;
|
|
1371
1437
|
exports.resolveIsWithinBounds = resolveIsWithinBounds;
|
|
1372
1438
|
exports.resolveUtcDayBounds = resolveUtcDayBounds;
|
|
1439
|
+
exports.sortsSchema = sortsSchema;
|
|
1373
1440
|
exports.tableSourceSchema = tableSourceSchema;
|
|
1374
1441
|
exports.toMultiValueOperator = toMultiValueOperator;
|
|
1375
1442
|
exports.toUtcDayString = toUtcDayString;
|
package/dist/exceptions.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SchemaOperation } from './migrations-
|
|
2
|
-
import './attributes
|
|
1
|
+
import { S as SchemaOperation } from './migrations-fRvadl6i.mjs';
|
|
2
|
+
import './attributes-CWPLbp7c.mjs';
|
|
3
3
|
import '@stndrds/constants';
|
|
4
4
|
import './utils.mjs';
|
|
5
5
|
|
|
@@ -23,6 +23,19 @@ declare const SchemaErrorCode: {
|
|
|
23
23
|
readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
|
|
24
24
|
readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
|
|
25
25
|
readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
|
|
26
|
+
/**
|
|
27
|
+
* A workspace RULE refuses the write — the last owner cannot be removed.
|
|
28
|
+
*
|
|
29
|
+
* Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
|
|
30
|
+
* "should never happen" assertion, a bug signal nobody outside the codebase
|
|
31
|
+
* can act on. This is the opposite — a rule the caller can act on, reached
|
|
32
|
+
* by a request that was entirely well-formed, whose message tells them how.
|
|
33
|
+
*/
|
|
34
|
+
readonly WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT";
|
|
35
|
+
/** The resource's own state refuses the operation — a disarmed reflex run. */
|
|
36
|
+
readonly STATE_GATE: "SCHEMA_STATE_GATE";
|
|
37
|
+
/** The operation needs an actor and the request carried none. */
|
|
38
|
+
readonly ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED";
|
|
26
39
|
readonly CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED";
|
|
27
40
|
readonly CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE";
|
|
28
41
|
/**
|
|
@@ -138,6 +151,8 @@ declare class SchemaError extends Error {
|
|
|
138
151
|
* Base class for "not found" errors
|
|
139
152
|
*/
|
|
140
153
|
declare class NotFoundError extends SchemaError {
|
|
154
|
+
/** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
|
|
155
|
+
readonly _tag = "NotFoundError";
|
|
141
156
|
readonly resourceType: string;
|
|
142
157
|
readonly resourceId: string;
|
|
143
158
|
constructor(resourceType: string, resourceId: string, code?: SchemaErrorCode, message?: string);
|
|
@@ -180,6 +195,8 @@ interface ValidationErrorDetail {
|
|
|
180
195
|
* Validation error thrown when data fails schema validation
|
|
181
196
|
*/
|
|
182
197
|
declare class ValidationError extends SchemaError {
|
|
198
|
+
/** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
|
|
199
|
+
readonly _tag = "ValidationError";
|
|
183
200
|
readonly errors: ValidationErrorDetail[];
|
|
184
201
|
constructor(message: string, errors: ValidationErrorDetail[]);
|
|
185
202
|
/**
|
|
@@ -327,7 +344,11 @@ declare function isValidationError(error: unknown): error is ValidationError;
|
|
|
327
344
|
*/
|
|
328
345
|
declare function isProtectedResourceError(error: unknown): error is ProtectedResourceError;
|
|
329
346
|
/**
|
|
330
|
-
* Error thrown when a user lacks permission to perform an action
|
|
347
|
+
* Error thrown when a user lacks permission to perform an action.
|
|
348
|
+
*
|
|
349
|
+
* That, and nothing else (#2681) — its message is redacted, so it must not
|
|
350
|
+
* carry a refusal a permission grant would not lift: use `WORKSPACE_INVARIANT`,
|
|
351
|
+
* `STATE_GATE`, `ACTOR_CONTEXT_REQUIRED` or `SYSTEM_ENTITY_IMMUTABLE` instead.
|
|
331
352
|
*/
|
|
332
353
|
declare class ForbiddenError extends SchemaError {
|
|
333
354
|
readonly objectName: string;
|
package/dist/exceptions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SchemaOperation } from './migrations-
|
|
2
|
-
import './attributes-
|
|
1
|
+
import { S as SchemaOperation } from './migrations-DaFneOfx.js';
|
|
2
|
+
import './attributes-CNYwg_Nr.js';
|
|
3
3
|
import '@stndrds/constants';
|
|
4
4
|
import './utils.js';
|
|
5
5
|
|
|
@@ -23,6 +23,19 @@ declare const SchemaErrorCode: {
|
|
|
23
23
|
readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
|
|
24
24
|
readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
|
|
25
25
|
readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
|
|
26
|
+
/**
|
|
27
|
+
* A workspace RULE refuses the write — the last owner cannot be removed.
|
|
28
|
+
*
|
|
29
|
+
* Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
|
|
30
|
+
* "should never happen" assertion, a bug signal nobody outside the codebase
|
|
31
|
+
* can act on. This is the opposite — a rule the caller can act on, reached
|
|
32
|
+
* by a request that was entirely well-formed, whose message tells them how.
|
|
33
|
+
*/
|
|
34
|
+
readonly WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT";
|
|
35
|
+
/** The resource's own state refuses the operation — a disarmed reflex run. */
|
|
36
|
+
readonly STATE_GATE: "SCHEMA_STATE_GATE";
|
|
37
|
+
/** The operation needs an actor and the request carried none. */
|
|
38
|
+
readonly ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED";
|
|
26
39
|
readonly CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED";
|
|
27
40
|
readonly CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE";
|
|
28
41
|
/**
|
|
@@ -138,6 +151,8 @@ declare class SchemaError extends Error {
|
|
|
138
151
|
* Base class for "not found" errors
|
|
139
152
|
*/
|
|
140
153
|
declare class NotFoundError extends SchemaError {
|
|
154
|
+
/** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
|
|
155
|
+
readonly _tag = "NotFoundError";
|
|
141
156
|
readonly resourceType: string;
|
|
142
157
|
readonly resourceId: string;
|
|
143
158
|
constructor(resourceType: string, resourceId: string, code?: SchemaErrorCode, message?: string);
|
|
@@ -180,6 +195,8 @@ interface ValidationErrorDetail {
|
|
|
180
195
|
* Validation error thrown when data fails schema validation
|
|
181
196
|
*/
|
|
182
197
|
declare class ValidationError extends SchemaError {
|
|
198
|
+
/** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
|
|
199
|
+
readonly _tag = "ValidationError";
|
|
183
200
|
readonly errors: ValidationErrorDetail[];
|
|
184
201
|
constructor(message: string, errors: ValidationErrorDetail[]);
|
|
185
202
|
/**
|
|
@@ -327,7 +344,11 @@ declare function isValidationError(error: unknown): error is ValidationError;
|
|
|
327
344
|
*/
|
|
328
345
|
declare function isProtectedResourceError(error: unknown): error is ProtectedResourceError;
|
|
329
346
|
/**
|
|
330
|
-
* Error thrown when a user lacks permission to perform an action
|
|
347
|
+
* Error thrown when a user lacks permission to perform an action.
|
|
348
|
+
*
|
|
349
|
+
* That, and nothing else (#2681) — its message is redacted, so it must not
|
|
350
|
+
* carry a refusal a permission grant would not lift: use `WORKSPACE_INVARIANT`,
|
|
351
|
+
* `STATE_GATE`, `ACTOR_CONTEXT_REQUIRED` or `SYSTEM_ENTITY_IMMUTABLE` instead.
|
|
331
352
|
*/
|
|
332
353
|
declare class ForbiddenError extends SchemaError {
|
|
333
354
|
readonly objectName: string;
|