@stndrds/schema 1.0.0-alpha.264 → 1.0.0-alpha.265
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/{attributes-DUuaECJI.d.ts → attributes-_b3Db8vT.d.ts} +1 -1
- package/dist/{attributes-DCgZhISp.d.mts → attributes-lBLiOIY3.d.mts} +1 -1
- package/dist/chunk-NGGU6BSN.mjs +216 -0
- package/dist/chunk-NI3HCSYH.js +229 -0
- package/dist/{chunk-54WDPQ6R.mjs → chunk-QIWADKYA.mjs} +12 -216
- package/dist/{chunk-TS3PJOMZ.js → chunk-ZBQEMIAV.js} +11 -227
- package/dist/exceptions.d.mts +458 -0
- package/dist/exceptions.d.ts +458 -0
- package/dist/exceptions.js +154 -0
- package/dist/exceptions.mjs +1 -0
- package/dist/{helpers-B4qBjTd0.d.ts → helpers-eyrnPJEF.d.ts} +4 -39
- package/dist/{helpers-B_NlMAm2.d.mts → helpers-uKLet0kF.d.mts} +4 -39
- package/dist/index.d.mts +111 -450
- package/dist/index.d.ts +111 -450
- package/dist/index.js +127 -111
- package/dist/index.mjs +24 -7
- package/dist/migrations-BXd2ZGfM.d.mts +39 -0
- package/dist/migrations-DcuJZ8qO.d.ts +39 -0
- package/dist/{types-15lGDPlN.d.mts → types-DNz3ITS-.d.mts} +1 -1
- package/dist/{types-CqZZxm_V.d.ts → types-DqLi1tx1.d.ts} +1 -1
- package/dist/validation/all.d.mts +4 -3
- package/dist/validation/all.d.ts +4 -3
- package/dist/validation/all.js +10 -9
- package/dist/validation/all.mjs +4 -3
- package/dist/validation/complex/currency.d.mts +2 -2
- package/dist/validation/complex/currency.d.ts +2 -2
- package/dist/validation/complex/location.d.mts +2 -2
- package/dist/validation/complex/location.d.ts +2 -2
- package/dist/validation/complex/phone.d.mts +2 -2
- package/dist/validation/complex/phone.d.ts +2 -2
- package/dist/validation/complex/relation.d.mts +2 -2
- package/dist/validation/complex/relation.d.ts +2 -2
- package/dist/validation/complex/richtext.d.mts +2 -2
- package/dist/validation/complex/richtext.d.ts +2 -2
- package/dist/validation/complex/select.d.mts +2 -2
- package/dist/validation/complex/select.d.ts +2 -2
- package/dist/validation/complex/user.d.mts +2 -2
- package/dist/validation/complex/user.d.ts +2 -2
- package/dist/validation/computed/formula.d.mts +2 -2
- package/dist/validation/computed/formula.d.ts +2 -2
- package/dist/validation/computed/rollup.d.mts +2 -2
- package/dist/validation/computed/rollup.d.ts +2 -2
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/core/index.d.mts +3 -3
- package/dist/validation/core/index.d.ts +3 -3
- package/dist/validation/object/index.d.mts +5 -4
- package/dist/validation/object/index.d.ts +5 -4
- package/dist/validation/object/index.js +16 -15
- package/dist/validation/object/index.mjs +4 -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 +7 -2
package/dist/index.js
CHANGED
|
@@ -3,20 +3,21 @@
|
|
|
3
3
|
var chunkFRCDMQER_js = require('./chunk-FRCDMQER.js');
|
|
4
4
|
require('./chunk-PGERPYDR.js');
|
|
5
5
|
var chunkL4U5QEQL_js = require('./chunk-L4U5QEQL.js');
|
|
6
|
-
var
|
|
6
|
+
var chunkNI3HCSYH_js = require('./chunk-NI3HCSYH.js');
|
|
7
|
+
require('./chunk-5WATIVCA.js');
|
|
7
8
|
require('./chunk-SI34M4IC.js');
|
|
8
9
|
require('./chunk-YIP5FJ5H.js');
|
|
9
10
|
require('./chunk-QAF3HNKQ.js');
|
|
11
|
+
require('./chunk-EW5XR2X3.js');
|
|
10
12
|
require('./chunk-QWKLQRBX.js');
|
|
11
13
|
require('./chunk-KNGWHQLR.js');
|
|
12
14
|
require('./chunk-HTSTPTNZ.js');
|
|
13
15
|
require('./chunk-V2UA2D4E.js');
|
|
14
|
-
require('./chunk-
|
|
16
|
+
var chunkZBQEMIAV_js = require('./chunk-ZBQEMIAV.js');
|
|
15
17
|
require('./chunk-ACKMC6FL.js');
|
|
16
18
|
require('./chunk-E6JUYGJX.js');
|
|
17
19
|
var chunkEBGRZUIH_js = require('./chunk-EBGRZUIH.js');
|
|
18
20
|
require('./chunk-EEH4XQ7W.js');
|
|
19
|
-
require('./chunk-EW5XR2X3.js');
|
|
20
21
|
var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
|
|
21
22
|
var constants = require('@stndrds/constants');
|
|
22
23
|
var z3 = require('zod');
|
|
@@ -1204,17 +1205,25 @@ var DEFAULT_ROLES = {
|
|
|
1204
1205
|
/** Standard user - can work with business data and view people */
|
|
1205
1206
|
MEMBER: "member",
|
|
1206
1207
|
/** Default role for agent actors - CRUD on records + documents/files */
|
|
1207
|
-
AGENT_DEFAULT: "agent_default"
|
|
1208
|
+
AGENT_DEFAULT: "agent_default",
|
|
1209
|
+
/**
|
|
1210
|
+
* Default role for reflex actors — deliberately NO record access (D22).
|
|
1211
|
+
* An agent is interactive, watched, and acts once; a reflex is unattended and
|
|
1212
|
+
* repeats. Real access is a per-reflex role derived from its first rehearsal.
|
|
1213
|
+
*/
|
|
1214
|
+
REFLEX_DEFAULT: "reflex_default"
|
|
1208
1215
|
};
|
|
1209
1216
|
var DEFAULT_ROLE_LABELS = {
|
|
1210
1217
|
owner: "Owner",
|
|
1211
1218
|
member: "Member",
|
|
1212
|
-
agent_default: "Agent Default"
|
|
1219
|
+
agent_default: "Agent Default",
|
|
1220
|
+
reflex_default: "Reflex Default"
|
|
1213
1221
|
};
|
|
1214
1222
|
var DEFAULT_ROLE_DESCRIPTIONS = {
|
|
1215
1223
|
owner: "Full access to all platform features and data",
|
|
1216
1224
|
member: "Can view, create, edit and delete business data",
|
|
1217
|
-
agent_default: "Default role for AI agents \u2014 CRUD on records plus documents and files"
|
|
1225
|
+
agent_default: "Default role for AI agents \u2014 CRUD on records plus documents and files",
|
|
1226
|
+
reflex_default: "Default role for reflexes \u2014 no data access; each reflex is granted exactly what its rehearsal showed it uses"
|
|
1218
1227
|
};
|
|
1219
1228
|
var ALL_ACTIONS2 = ["read", "create", "update", "delete", "manage"];
|
|
1220
1229
|
var MEMBER_CONNECTOR_ACTIONS = ["read", "create", "delete"];
|
|
@@ -1244,6 +1253,13 @@ var DEFAULT_ROLE_PERMISSIONS = {
|
|
|
1244
1253
|
{ target: "session", actions: ["observe"] }
|
|
1245
1254
|
],
|
|
1246
1255
|
object: [{ target: "*", actions: ["read", "create", "update", "delete"] }]
|
|
1256
|
+
},
|
|
1257
|
+
reflex_default: {
|
|
1258
|
+
// Intentionally empty (D22): a reflex starts with no access at all. Real
|
|
1259
|
+
// access is a per-reflex role derived from its first rehearsal, not a
|
|
1260
|
+
// shared default.
|
|
1261
|
+
system: [],
|
|
1262
|
+
object: []
|
|
1247
1263
|
}
|
|
1248
1264
|
};
|
|
1249
1265
|
function isDefaultRole(roleName) {
|
|
@@ -1347,7 +1363,7 @@ var DEFAULT_AGENT_EXECUTION_CONFIG = {
|
|
|
1347
1363
|
var AgentBuilder = class {
|
|
1348
1364
|
constructor(config) {
|
|
1349
1365
|
if (!config.name || config.name.trim().length === 0) {
|
|
1350
|
-
throw new
|
|
1366
|
+
throw new chunkZBQEMIAV_js.ValidationError("Agent name is required", []);
|
|
1351
1367
|
}
|
|
1352
1368
|
this.bp = { name: config.name, system: true, triggers: [] };
|
|
1353
1369
|
}
|
|
@@ -1420,15 +1436,15 @@ var AgentBuilder = class {
|
|
|
1420
1436
|
}
|
|
1421
1437
|
build() {
|
|
1422
1438
|
if (!this.bp.systemPrompt) {
|
|
1423
|
-
throw new
|
|
1439
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Agent "${this.bp.name}": systemPrompt is required`, []);
|
|
1424
1440
|
}
|
|
1425
1441
|
if (!this.bp.model) {
|
|
1426
|
-
throw new
|
|
1442
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Agent "${this.bp.name}": model is required`, []);
|
|
1427
1443
|
}
|
|
1428
1444
|
assertUniqueBy(
|
|
1429
1445
|
this.bp.triggers,
|
|
1430
1446
|
(t) => t.name,
|
|
1431
|
-
(name) => new
|
|
1447
|
+
(name) => new chunkZBQEMIAV_js.ValidationError(`Agent "${this.bp.name}": duplicate trigger name "${name}"`, [])
|
|
1432
1448
|
);
|
|
1433
1449
|
return {
|
|
1434
1450
|
...this.bp,
|
|
@@ -1482,7 +1498,7 @@ var BaseAttributeBuilder = class {
|
|
|
1482
1498
|
* @see https://standardschema.dev/
|
|
1483
1499
|
*/
|
|
1484
1500
|
get "~standard"() {
|
|
1485
|
-
const zodSchema =
|
|
1501
|
+
const zodSchema = chunkNI3HCSYH_js.createAttributeValidator(this.build());
|
|
1486
1502
|
return createStandardSchemaProps(zodSchema);
|
|
1487
1503
|
}
|
|
1488
1504
|
constructor(type, name, label) {
|
|
@@ -2225,9 +2241,9 @@ var RollupAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
2225
2241
|
if (fn === "original" && targetType !== void 0 && targetType !== "select" && targetType !== "status" && targetType !== "multiselect") {
|
|
2226
2242
|
const relation2 = this.attr.relationAttribute ?? "relation";
|
|
2227
2243
|
const target = this.attr.targetAttribute ?? "field";
|
|
2228
|
-
throw new
|
|
2244
|
+
throw new chunkZBQEMIAV_js.SchemaError(
|
|
2229
2245
|
`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${targetType}") was given. To surface a plain ${targetType} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${relation2}.${target}").`,
|
|
2230
|
-
|
|
2246
|
+
chunkZBQEMIAV_js.SchemaErrorCode.VALIDATION_FAILED
|
|
2231
2247
|
);
|
|
2232
2248
|
}
|
|
2233
2249
|
return super.build();
|
|
@@ -2737,7 +2753,7 @@ var ObjectBuilder = class {
|
|
|
2737
2753
|
* @see https://standardschema.dev/
|
|
2738
2754
|
*/
|
|
2739
2755
|
get "~standard"() {
|
|
2740
|
-
const zodSchema =
|
|
2756
|
+
const zodSchema = chunkNI3HCSYH_js.createObjectValidator(this.build());
|
|
2741
2757
|
return createStandardSchemaProps(zodSchema);
|
|
2742
2758
|
}
|
|
2743
2759
|
/**
|
|
@@ -2951,26 +2967,26 @@ var ObjectBuilder = class {
|
|
|
2951
2967
|
throw new Error("[ObjectBuilder] Missing required field: label");
|
|
2952
2968
|
}
|
|
2953
2969
|
if (!this._labelExpression) {
|
|
2954
|
-
throw new
|
|
2970
|
+
throw new chunkZBQEMIAV_js.SchemaError(
|
|
2955
2971
|
`Object "${this.obj.name}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,
|
|
2956
|
-
|
|
2972
|
+
chunkZBQEMIAV_js.SchemaErrorCode.VALIDATION_FAILED
|
|
2957
2973
|
);
|
|
2958
2974
|
}
|
|
2959
2975
|
const labelResult = labelExpressionSchema.safeParse(this._labelExpression);
|
|
2960
2976
|
if (!labelResult.success) {
|
|
2961
2977
|
const errorMsg = labelResult.error.issues[0]?.message ?? "Invalid labelExpression";
|
|
2962
|
-
throw new
|
|
2978
|
+
throw new chunkZBQEMIAV_js.SchemaError(
|
|
2963
2979
|
`Invalid labelExpression for "${this.obj.name}": ${errorMsg}`,
|
|
2964
|
-
|
|
2980
|
+
chunkZBQEMIAV_js.SchemaErrorCode.VALIDATION_FAILED
|
|
2965
2981
|
);
|
|
2966
2982
|
}
|
|
2967
2983
|
if (this._embeddingExpression !== void 0) {
|
|
2968
2984
|
const embeddingResult = labelExpressionSchema.safeParse(this._embeddingExpression);
|
|
2969
2985
|
if (!embeddingResult.success) {
|
|
2970
2986
|
const errorMsg = embeddingResult.error.issues[0]?.message ?? "Invalid embeddingExpression";
|
|
2971
|
-
throw new
|
|
2987
|
+
throw new chunkZBQEMIAV_js.SchemaError(
|
|
2972
2988
|
`Invalid embeddingExpression for "${this.obj.name}": ${errorMsg}`,
|
|
2973
|
-
|
|
2989
|
+
chunkZBQEMIAV_js.SchemaErrorCode.VALIDATION_FAILED
|
|
2974
2990
|
);
|
|
2975
2991
|
}
|
|
2976
2992
|
}
|
|
@@ -3011,7 +3027,7 @@ var ObjectBuilder = class {
|
|
|
3011
3027
|
objectNameSchema.parse(name);
|
|
3012
3028
|
} catch (error) {
|
|
3013
3029
|
if (error instanceof z3__default.default.ZodError) {
|
|
3014
|
-
throw new
|
|
3030
|
+
throw new chunkZBQEMIAV_js.SchemaError(error.issues[0].message, chunkZBQEMIAV_js.SchemaErrorCode.INVALID_OBJECT_NAME);
|
|
3015
3031
|
}
|
|
3016
3032
|
throw error;
|
|
3017
3033
|
}
|
|
@@ -3022,7 +3038,7 @@ function object(config) {
|
|
|
3022
3038
|
}
|
|
3023
3039
|
function validatePresetStructure(presetId, nodes, depth) {
|
|
3024
3040
|
const fail = (message, detail) => {
|
|
3025
|
-
throw new
|
|
3041
|
+
throw new chunkZBQEMIAV_js.ValidationError(message, [
|
|
3026
3042
|
{ path: ["documentLayout", "presets", presetId], message: detail }
|
|
3027
3043
|
]);
|
|
3028
3044
|
};
|
|
@@ -4257,7 +4273,7 @@ function jsonFlag(name, defaultValue) {
|
|
|
4257
4273
|
|
|
4258
4274
|
// src/feature-flags/flag-registry.ts
|
|
4259
4275
|
function duplicateFlagError(name) {
|
|
4260
|
-
return new
|
|
4276
|
+
return new chunkZBQEMIAV_js.DuplicateError(
|
|
4261
4277
|
"feature flag",
|
|
4262
4278
|
name,
|
|
4263
4279
|
`Flag "${name}" is already registered. Each flag name must be unique.`
|
|
@@ -4335,7 +4351,7 @@ var FlagRegistry = class {
|
|
|
4335
4351
|
getOrThrow(name) {
|
|
4336
4352
|
const flag = this.get(name);
|
|
4337
4353
|
if (!flag) {
|
|
4338
|
-
throw new
|
|
4354
|
+
throw new chunkZBQEMIAV_js.NotFoundError(
|
|
4339
4355
|
"Feature flag",
|
|
4340
4356
|
name,
|
|
4341
4357
|
void 0,
|
|
@@ -4492,19 +4508,19 @@ var FlagService = class {
|
|
|
4492
4508
|
*/
|
|
4493
4509
|
async setOverride(flagName, level, value, options = {}) {
|
|
4494
4510
|
if (!this.repository) {
|
|
4495
|
-
throw new
|
|
4511
|
+
throw new chunkZBQEMIAV_js.SchemaError(
|
|
4496
4512
|
"Cannot set override: no FeatureFlagsRepository configured. Add featureFlags to your DatabaseAdapter to enable runtime overrides.",
|
|
4497
|
-
|
|
4513
|
+
chunkZBQEMIAV_js.SchemaErrorCode.CONFIGURATION_REQUIRED
|
|
4498
4514
|
);
|
|
4499
4515
|
}
|
|
4500
4516
|
const flag = this.registry.get(flagName);
|
|
4501
4517
|
if (flag && !flag.allowedLevels.includes(level)) {
|
|
4502
4518
|
const message = `Flag "${flagName}" does not allow ${level}-level overrides. Allowed levels: ${flag.allowedLevels.join(", ")}`;
|
|
4503
|
-
throw new
|
|
4519
|
+
throw new chunkZBQEMIAV_js.ValidationError(message, [{ path: ["level"], message }]);
|
|
4504
4520
|
}
|
|
4505
4521
|
if (flag?.system) {
|
|
4506
4522
|
const message = `Flag "${flagName}" is a system flag and cannot be overridden via API.`;
|
|
4507
|
-
throw new
|
|
4523
|
+
throw new chunkZBQEMIAV_js.ValidationError(message, [{ path: ["flagName"], message }]);
|
|
4508
4524
|
}
|
|
4509
4525
|
await this.repository.setOverride({
|
|
4510
4526
|
flagName,
|
|
@@ -4524,9 +4540,9 @@ var FlagService = class {
|
|
|
4524
4540
|
*/
|
|
4525
4541
|
async deleteOverride(flagName, level, targetId) {
|
|
4526
4542
|
if (!this.repository) {
|
|
4527
|
-
throw new
|
|
4543
|
+
throw new chunkZBQEMIAV_js.SchemaError(
|
|
4528
4544
|
"Cannot delete override: no FeatureFlagsRepository configured.",
|
|
4529
|
-
|
|
4545
|
+
chunkZBQEMIAV_js.SchemaErrorCode.CONFIGURATION_REQUIRED
|
|
4530
4546
|
);
|
|
4531
4547
|
}
|
|
4532
4548
|
await this.repository.deleteOverride(flagName, level, targetId);
|
|
@@ -4663,7 +4679,7 @@ var NativeObjectRegistryClass = class {
|
|
|
4663
4679
|
if (!object2.system) {
|
|
4664
4680
|
const message = `[NativeObjectRegistry] Cannot register object "${object2.name}" (id: ${object2.id}): missing system flag.
|
|
4665
4681
|
Native objects must have system=true. Did you call .runtime() on the builder? Remove that call \u2014 objects are system:true by default.`;
|
|
4666
|
-
throw new
|
|
4682
|
+
throw new chunkZBQEMIAV_js.ValidationError(message, []);
|
|
4667
4683
|
}
|
|
4668
4684
|
if (this.objects.has(object2.name)) {
|
|
4669
4685
|
const existing = this.objects.get(object2.name);
|
|
@@ -4671,7 +4687,7 @@ Native objects must have system=true. Did you call .runtime() on the builder? Re
|
|
|
4671
4687
|
- Existing: "${existing?.label}" (id: ${existing?.id})
|
|
4672
4688
|
- New: "${object2.label}" (id: ${object2.id})
|
|
4673
4689
|
Please use unique names for each native object.`;
|
|
4674
|
-
throw new
|
|
4690
|
+
throw new chunkZBQEMIAV_js.DuplicateError("object", object2.name, message);
|
|
4675
4691
|
}
|
|
4676
4692
|
this.objects.set(object2.name, cloneObjectDefinition(object2));
|
|
4677
4693
|
}
|
|
@@ -4703,7 +4719,7 @@ Please use unique names for each native object.`;
|
|
|
4703
4719
|
if (!object2) {
|
|
4704
4720
|
const message = `[NativeObjectRegistry] Native object "${name}" not found.
|
|
4705
4721
|
Available objects: ${this.listNames().join(", ")}`;
|
|
4706
|
-
throw new
|
|
4722
|
+
throw new chunkZBQEMIAV_js.NotFoundError("Native object", name, chunkZBQEMIAV_js.SchemaErrorCode.OBJECT_NOT_FOUND, message);
|
|
4707
4723
|
}
|
|
4708
4724
|
return object2;
|
|
4709
4725
|
}
|
|
@@ -4842,7 +4858,7 @@ var ViewRegistry = class {
|
|
|
4842
4858
|
const key = this.makeKey(view.object, view.name, view.type);
|
|
4843
4859
|
if (this.views.has(key)) {
|
|
4844
4860
|
const message = `[ViewRegistry] Duplicate view: "${view.name}" (${view.type}) for object "${view.object}"`;
|
|
4845
|
-
throw new
|
|
4861
|
+
throw new chunkZBQEMIAV_js.DuplicateError("view", key, message);
|
|
4846
4862
|
}
|
|
4847
4863
|
const storedView = cloneViewDefinition(view);
|
|
4848
4864
|
this.views.set(key, storedView);
|
|
@@ -4887,7 +4903,7 @@ var ViewRegistry = class {
|
|
|
4887
4903
|
const availableNames = available.map((v) => `${v.name} (${v.type})`).join(", ") || "(none)";
|
|
4888
4904
|
const message = `[ViewRegistry] View "${viewName}" not found for object "${objectName}".
|
|
4889
4905
|
Available views: ${availableNames}`;
|
|
4890
|
-
throw new
|
|
4906
|
+
throw new chunkZBQEMIAV_js.NotFoundError("View", `${objectName}:${viewName}`, void 0, message);
|
|
4891
4907
|
}
|
|
4892
4908
|
return view;
|
|
4893
4909
|
}
|
|
@@ -5193,7 +5209,7 @@ var FormRegistry = class {
|
|
|
5193
5209
|
const forms = Array.isArray(formOrForms) ? formOrForms : [formOrForms];
|
|
5194
5210
|
for (const f of forms) {
|
|
5195
5211
|
if (this.forms.has(f.name)) {
|
|
5196
|
-
throw new
|
|
5212
|
+
throw new chunkZBQEMIAV_js.DuplicateError("form", f.name, `[FormRegistry] Duplicate form: "${f.name}"`);
|
|
5197
5213
|
}
|
|
5198
5214
|
this.forms.set(f.name, cloneFormDefinition(f));
|
|
5199
5215
|
}
|
|
@@ -7152,7 +7168,7 @@ function assertOperatorForType(operator, type, context) {
|
|
|
7152
7168
|
if (!ops?.includes(normalized)) {
|
|
7153
7169
|
const validList = ops?.length ? ops.join(", ") : "(no operators registered for this type)";
|
|
7154
7170
|
const summary = `Operator "${operator}" is not valid for ${context} type "${type}". Valid operators: ${validList}.`;
|
|
7155
|
-
throw new
|
|
7171
|
+
throw new chunkZBQEMIAV_js.ValidationError(summary, [
|
|
7156
7172
|
{
|
|
7157
7173
|
path: ["operator"],
|
|
7158
7174
|
message: summary
|
|
@@ -7169,7 +7185,7 @@ function assertRelativeDateValue(rule) {
|
|
|
7169
7185
|
const valid = typeof v === "object" && v !== null && typeof v.amount === "number" && Number.isFinite(v.amount) && v.amount > 0 && typeof v.unit === "string" && RELATIVE_DATE_UNITS.has(v.unit) && typeof v.direction === "string" && RELATIVE_DATE_DIRECTIONS.has(v.direction);
|
|
7170
7186
|
if (!valid) {
|
|
7171
7187
|
const m = `Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;
|
|
7172
|
-
throw new
|
|
7188
|
+
throw new chunkZBQEMIAV_js.ValidationError(m, [{ path: ["value"], message: m }]);
|
|
7173
7189
|
}
|
|
7174
7190
|
}
|
|
7175
7191
|
function assertDynamicValueForAttribute(rule, attrType) {
|
|
@@ -7177,28 +7193,28 @@ function assertDynamicValueForAttribute(rule, attrType) {
|
|
|
7177
7193
|
const v = rule.value;
|
|
7178
7194
|
if (v.dynamic === "actor" && attrType !== "user") {
|
|
7179
7195
|
const m = `actor token (@me) is only valid on user attributes, not "${attrType}"`;
|
|
7180
|
-
throw new
|
|
7196
|
+
throw new chunkZBQEMIAV_js.ValidationError(m, [{ path: ["value"], message: m }]);
|
|
7181
7197
|
}
|
|
7182
7198
|
if (v.dynamic === "date" && attrType !== "date") {
|
|
7183
7199
|
const m = `date token (@today/@now) is only valid on date attributes, not "${attrType}"`;
|
|
7184
|
-
throw new
|
|
7200
|
+
throw new chunkZBQEMIAV_js.ValidationError(m, [{ path: ["value"], message: m }]);
|
|
7185
7201
|
}
|
|
7186
7202
|
}
|
|
7187
7203
|
function validateQualifiedRule(rule, context) {
|
|
7188
7204
|
const rootAttr = context.attributes.find((a) => a.name === rule.attribute);
|
|
7189
7205
|
const systemOps = SYSTEM_FILTER_OPERATORS[rule.attribute];
|
|
7190
7206
|
if (!(rootAttr || systemOps)) {
|
|
7191
|
-
throw new
|
|
7207
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Unknown attribute: ${rule.attribute}`, [
|
|
7192
7208
|
{ path: ["attribute"], message: `Unknown attribute: ${rule.attribute}` }
|
|
7193
7209
|
]);
|
|
7194
7210
|
}
|
|
7195
7211
|
if (rule.quantifier !== void 0 && !rule.property) {
|
|
7196
7212
|
const m = `quantifier is only valid on qualified edge rules (set "property")`;
|
|
7197
|
-
throw new
|
|
7213
|
+
throw new chunkZBQEMIAV_js.ValidationError(m, [{ path: ["quantifier"], message: m }]);
|
|
7198
7214
|
}
|
|
7199
7215
|
if (!rootAttr) {
|
|
7200
7216
|
if (rule.property) {
|
|
7201
|
-
throw new
|
|
7217
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Cannot qualify system attribute "${rule.attribute}"`, [
|
|
7202
7218
|
{ path: ["property"], message: `"${rule.attribute}" is a system column, not a reference` }
|
|
7203
7219
|
]);
|
|
7204
7220
|
}
|
|
@@ -7209,7 +7225,7 @@ function validateQualifiedRule(rule, context) {
|
|
|
7209
7225
|
);
|
|
7210
7226
|
if (!systemOps.includes(normalizedOperator)) {
|
|
7211
7227
|
const summary = `Operator "${rule.operator}" is not valid for system attribute "${rule.attribute}". Valid operators: ${systemOps.join(", ")}.`;
|
|
7212
|
-
throw new
|
|
7228
|
+
throw new chunkZBQEMIAV_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
|
|
7213
7229
|
}
|
|
7214
7230
|
rule.operator = normalizedOperator;
|
|
7215
7231
|
assertRelativeDateValue(rule);
|
|
@@ -7225,26 +7241,26 @@ function validateQualifiedRule(rule, context) {
|
|
|
7225
7241
|
if (!ops.includes(normalizedOperator)) {
|
|
7226
7242
|
const validList = ops.length ? ops.join(", ") : "(not filterable)";
|
|
7227
7243
|
const summary = `Operator "${rule.operator}" is not valid for attribute "${rootAttr.name}". Valid operators: ${validList}.`;
|
|
7228
|
-
throw new
|
|
7244
|
+
throw new chunkZBQEMIAV_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
|
|
7229
7245
|
}
|
|
7230
7246
|
rule.operator = normalizedOperator;
|
|
7231
7247
|
assertRelativeDateValue(rule);
|
|
7232
7248
|
return;
|
|
7233
7249
|
}
|
|
7234
7250
|
if (!REFERENCE_TYPES.has(rootAttr.type)) {
|
|
7235
|
-
throw new
|
|
7251
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Cannot qualify ${rootAttr.type} attribute "${rule.attribute}"`, [
|
|
7236
7252
|
{ path: ["property"], message: `Attribute "${rule.attribute}" is not a reference type` }
|
|
7237
7253
|
]);
|
|
7238
7254
|
}
|
|
7239
7255
|
const propSchema = rootAttr.properties;
|
|
7240
7256
|
if (!propSchema) {
|
|
7241
|
-
throw new
|
|
7257
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Attribute "${rule.attribute}" has no qualifyWith schema`, [
|
|
7242
7258
|
{ path: ["property"], message: `"${rule.attribute}" has no qualifyWith` }
|
|
7243
7259
|
]);
|
|
7244
7260
|
}
|
|
7245
7261
|
const propDef = propSchema.definitions.find((p) => p.name === rule.property);
|
|
7246
7262
|
if (!propDef) {
|
|
7247
|
-
throw new
|
|
7263
|
+
throw new chunkZBQEMIAV_js.ValidationError(
|
|
7248
7264
|
`Property "${rule.property}" not defined on "${rule.attribute}".qualifyWith()`,
|
|
7249
7265
|
[{ path: ["property"], message: `Unknown property: ${rule.property}` }]
|
|
7250
7266
|
);
|
|
@@ -7292,10 +7308,10 @@ function canonicalStringify(value) {
|
|
|
7292
7308
|
case "object":
|
|
7293
7309
|
break;
|
|
7294
7310
|
default:
|
|
7295
|
-
throw new
|
|
7311
|
+
throw new chunkZBQEMIAV_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
|
|
7296
7312
|
}
|
|
7297
7313
|
const obj = v;
|
|
7298
|
-
if (seen.has(obj)) throw new
|
|
7314
|
+
if (seen.has(obj)) throw new chunkZBQEMIAV_js.ValidationError("Cannot canonicalize circular structure", []);
|
|
7299
7315
|
seen.add(obj);
|
|
7300
7316
|
try {
|
|
7301
7317
|
if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
|
|
@@ -7352,177 +7368,177 @@ Object.defineProperty(exports, "parseComputedFormula", {
|
|
|
7352
7368
|
enumerable: true,
|
|
7353
7369
|
get: function () { return chunkL4U5QEQL_js.parseComputedFormula; }
|
|
7354
7370
|
});
|
|
7371
|
+
Object.defineProperty(exports, "createFormAttributeValidator", {
|
|
7372
|
+
enumerable: true,
|
|
7373
|
+
get: function () { return chunkNI3HCSYH_js.createFormAttributeValidator; }
|
|
7374
|
+
});
|
|
7375
|
+
Object.defineProperty(exports, "rejectUnknownAttributesOrThrow", {
|
|
7376
|
+
enumerable: true,
|
|
7377
|
+
get: function () { return chunkNI3HCSYH_js.rejectUnknownAttributesOrThrow; }
|
|
7378
|
+
});
|
|
7379
|
+
Object.defineProperty(exports, "validateDraft", {
|
|
7380
|
+
enumerable: true,
|
|
7381
|
+
get: function () { return chunkNI3HCSYH_js.validateDraft; }
|
|
7382
|
+
});
|
|
7383
|
+
Object.defineProperty(exports, "validateDraftOrThrow", {
|
|
7384
|
+
enumerable: true,
|
|
7385
|
+
get: function () { return chunkNI3HCSYH_js.validateDraftOrThrow; }
|
|
7386
|
+
});
|
|
7387
|
+
Object.defineProperty(exports, "validateObject", {
|
|
7388
|
+
enumerable: true,
|
|
7389
|
+
get: function () { return chunkNI3HCSYH_js.validateObject; }
|
|
7390
|
+
});
|
|
7391
|
+
Object.defineProperty(exports, "validateObjectOrThrow", {
|
|
7392
|
+
enumerable: true,
|
|
7393
|
+
get: function () { return chunkNI3HCSYH_js.validateObjectOrThrow; }
|
|
7394
|
+
});
|
|
7355
7395
|
Object.defineProperty(exports, "AccessDeniedError", {
|
|
7356
7396
|
enumerable: true,
|
|
7357
|
-
get: function () { return
|
|
7397
|
+
get: function () { return chunkZBQEMIAV_js.AccessDeniedError; }
|
|
7358
7398
|
});
|
|
7359
7399
|
Object.defineProperty(exports, "AttributeInUseError", {
|
|
7360
7400
|
enumerable: true,
|
|
7361
|
-
get: function () { return
|
|
7401
|
+
get: function () { return chunkZBQEMIAV_js.AttributeInUseError; }
|
|
7362
7402
|
});
|
|
7363
7403
|
Object.defineProperty(exports, "AttributeNotFoundError", {
|
|
7364
7404
|
enumerable: true,
|
|
7365
|
-
get: function () { return
|
|
7405
|
+
get: function () { return chunkZBQEMIAV_js.AttributeNotFoundError; }
|
|
7366
7406
|
});
|
|
7367
7407
|
Object.defineProperty(exports, "ChangeTypeNotSupportedError", {
|
|
7368
7408
|
enumerable: true,
|
|
7369
|
-
get: function () { return
|
|
7409
|
+
get: function () { return chunkZBQEMIAV_js.ChangeTypeNotSupportedError; }
|
|
7370
7410
|
});
|
|
7371
7411
|
Object.defineProperty(exports, "ConcurrentModificationError", {
|
|
7372
7412
|
enumerable: true,
|
|
7373
|
-
get: function () { return
|
|
7413
|
+
get: function () { return chunkZBQEMIAV_js.ConcurrentModificationError; }
|
|
7374
7414
|
});
|
|
7375
7415
|
Object.defineProperty(exports, "DestructiveSyncNotAllowedError", {
|
|
7376
7416
|
enumerable: true,
|
|
7377
|
-
get: function () { return
|
|
7417
|
+
get: function () { return chunkZBQEMIAV_js.DestructiveSyncNotAllowedError; }
|
|
7378
7418
|
});
|
|
7379
7419
|
Object.defineProperty(exports, "DuplicateError", {
|
|
7380
7420
|
enumerable: true,
|
|
7381
|
-
get: function () { return
|
|
7421
|
+
get: function () { return chunkZBQEMIAV_js.DuplicateError; }
|
|
7382
7422
|
});
|
|
7383
7423
|
Object.defineProperty(exports, "ForbiddenError", {
|
|
7384
7424
|
enumerable: true,
|
|
7385
|
-
get: function () { return
|
|
7425
|
+
get: function () { return chunkZBQEMIAV_js.ForbiddenError; }
|
|
7386
7426
|
});
|
|
7387
7427
|
Object.defineProperty(exports, "MemoryNotFoundError", {
|
|
7388
7428
|
enumerable: true,
|
|
7389
|
-
get: function () { return
|
|
7429
|
+
get: function () { return chunkZBQEMIAV_js.MemoryNotFoundError; }
|
|
7390
7430
|
});
|
|
7391
7431
|
Object.defineProperty(exports, "MigrationTimeoutError", {
|
|
7392
7432
|
enumerable: true,
|
|
7393
|
-
get: function () { return
|
|
7433
|
+
get: function () { return chunkZBQEMIAV_js.MigrationTimeoutError; }
|
|
7394
7434
|
});
|
|
7395
7435
|
Object.defineProperty(exports, "NotFoundError", {
|
|
7396
7436
|
enumerable: true,
|
|
7397
|
-
get: function () { return
|
|
7437
|
+
get: function () { return chunkZBQEMIAV_js.NotFoundError; }
|
|
7398
7438
|
});
|
|
7399
7439
|
Object.defineProperty(exports, "NotImplementedError", {
|
|
7400
7440
|
enumerable: true,
|
|
7401
|
-
get: function () { return
|
|
7441
|
+
get: function () { return chunkZBQEMIAV_js.NotImplementedError; }
|
|
7402
7442
|
});
|
|
7403
7443
|
Object.defineProperty(exports, "ObjectNotFoundError", {
|
|
7404
7444
|
enumerable: true,
|
|
7405
|
-
get: function () { return
|
|
7445
|
+
get: function () { return chunkZBQEMIAV_js.ObjectNotFoundError; }
|
|
7406
7446
|
});
|
|
7407
7447
|
Object.defineProperty(exports, "ObjectReferencedError", {
|
|
7408
7448
|
enumerable: true,
|
|
7409
|
-
get: function () { return
|
|
7449
|
+
get: function () { return chunkZBQEMIAV_js.ObjectReferencedError; }
|
|
7410
7450
|
});
|
|
7411
7451
|
Object.defineProperty(exports, "OrphanSystemAttributeError", {
|
|
7412
7452
|
enumerable: true,
|
|
7413
|
-
get: function () { return
|
|
7453
|
+
get: function () { return chunkZBQEMIAV_js.OrphanSystemAttributeError; }
|
|
7414
7454
|
});
|
|
7415
7455
|
Object.defineProperty(exports, "ProtectedResourceError", {
|
|
7416
7456
|
enumerable: true,
|
|
7417
|
-
get: function () { return
|
|
7457
|
+
get: function () { return chunkZBQEMIAV_js.ProtectedResourceError; }
|
|
7418
7458
|
});
|
|
7419
7459
|
Object.defineProperty(exports, "ProtectedRoleError", {
|
|
7420
7460
|
enumerable: true,
|
|
7421
|
-
get: function () { return
|
|
7461
|
+
get: function () { return chunkZBQEMIAV_js.ProtectedRoleError; }
|
|
7422
7462
|
});
|
|
7423
7463
|
Object.defineProperty(exports, "RecordNotFoundError", {
|
|
7424
7464
|
enumerable: true,
|
|
7425
|
-
get: function () { return
|
|
7465
|
+
get: function () { return chunkZBQEMIAV_js.RecordNotFoundError; }
|
|
7426
7466
|
});
|
|
7427
7467
|
Object.defineProperty(exports, "RecordReferencedError", {
|
|
7428
7468
|
enumerable: true,
|
|
7429
|
-
get: function () { return
|
|
7469
|
+
get: function () { return chunkZBQEMIAV_js.RecordReferencedError; }
|
|
7430
7470
|
});
|
|
7431
7471
|
Object.defineProperty(exports, "RepositoryError", {
|
|
7432
7472
|
enumerable: true,
|
|
7433
|
-
get: function () { return
|
|
7473
|
+
get: function () { return chunkZBQEMIAV_js.RepositoryError; }
|
|
7434
7474
|
});
|
|
7435
7475
|
Object.defineProperty(exports, "RoleNotFoundError", {
|
|
7436
7476
|
enumerable: true,
|
|
7437
|
-
get: function () { return
|
|
7477
|
+
get: function () { return chunkZBQEMIAV_js.RoleNotFoundError; }
|
|
7438
7478
|
});
|
|
7439
7479
|
Object.defineProperty(exports, "SchemaError", {
|
|
7440
7480
|
enumerable: true,
|
|
7441
|
-
get: function () { return
|
|
7481
|
+
get: function () { return chunkZBQEMIAV_js.SchemaError; }
|
|
7442
7482
|
});
|
|
7443
7483
|
Object.defineProperty(exports, "SchemaErrorCode", {
|
|
7444
7484
|
enumerable: true,
|
|
7445
|
-
get: function () { return
|
|
7485
|
+
get: function () { return chunkZBQEMIAV_js.SchemaErrorCode; }
|
|
7446
7486
|
});
|
|
7447
7487
|
Object.defineProperty(exports, "SearchBackendError", {
|
|
7448
7488
|
enumerable: true,
|
|
7449
|
-
get: function () { return
|
|
7489
|
+
get: function () { return chunkZBQEMIAV_js.SearchBackendError; }
|
|
7450
7490
|
});
|
|
7451
7491
|
Object.defineProperty(exports, "StorageError", {
|
|
7452
7492
|
enumerable: true,
|
|
7453
|
-
get: function () { return
|
|
7493
|
+
get: function () { return chunkZBQEMIAV_js.StorageError; }
|
|
7454
7494
|
});
|
|
7455
7495
|
Object.defineProperty(exports, "SyncCascadeError", {
|
|
7456
7496
|
enumerable: true,
|
|
7457
|
-
get: function () { return
|
|
7497
|
+
get: function () { return chunkZBQEMIAV_js.SyncCascadeError; }
|
|
7458
7498
|
});
|
|
7459
7499
|
Object.defineProperty(exports, "SyncConflictError", {
|
|
7460
7500
|
enumerable: true,
|
|
7461
|
-
get: function () { return
|
|
7501
|
+
get: function () { return chunkZBQEMIAV_js.SyncConflictError; }
|
|
7462
7502
|
});
|
|
7463
7503
|
Object.defineProperty(exports, "SyncError", {
|
|
7464
7504
|
enumerable: true,
|
|
7465
|
-
get: function () { return
|
|
7505
|
+
get: function () { return chunkZBQEMIAV_js.SyncError; }
|
|
7466
7506
|
});
|
|
7467
7507
|
Object.defineProperty(exports, "SystemEntityImmutableError", {
|
|
7468
7508
|
enumerable: true,
|
|
7469
|
-
get: function () { return
|
|
7509
|
+
get: function () { return chunkZBQEMIAV_js.SystemEntityImmutableError; }
|
|
7470
7510
|
});
|
|
7471
7511
|
Object.defineProperty(exports, "ValidationError", {
|
|
7472
7512
|
enumerable: true,
|
|
7473
|
-
get: function () { return
|
|
7474
|
-
});
|
|
7475
|
-
Object.defineProperty(exports, "createFormAttributeValidator", {
|
|
7476
|
-
enumerable: true,
|
|
7477
|
-
get: function () { return chunkTS3PJOMZ_js.createFormAttributeValidator; }
|
|
7513
|
+
get: function () { return chunkZBQEMIAV_js.ValidationError; }
|
|
7478
7514
|
});
|
|
7479
7515
|
Object.defineProperty(exports, "isAttributeInUseError", {
|
|
7480
7516
|
enumerable: true,
|
|
7481
|
-
get: function () { return
|
|
7517
|
+
get: function () { return chunkZBQEMIAV_js.isAttributeInUseError; }
|
|
7482
7518
|
});
|
|
7483
7519
|
Object.defineProperty(exports, "isNotFoundError", {
|
|
7484
7520
|
enumerable: true,
|
|
7485
|
-
get: function () { return
|
|
7521
|
+
get: function () { return chunkZBQEMIAV_js.isNotFoundError; }
|
|
7486
7522
|
});
|
|
7487
7523
|
Object.defineProperty(exports, "isObjectReferencedError", {
|
|
7488
7524
|
enumerable: true,
|
|
7489
|
-
get: function () { return
|
|
7525
|
+
get: function () { return chunkZBQEMIAV_js.isObjectReferencedError; }
|
|
7490
7526
|
});
|
|
7491
7527
|
Object.defineProperty(exports, "isProtectedResourceError", {
|
|
7492
7528
|
enumerable: true,
|
|
7493
|
-
get: function () { return
|
|
7529
|
+
get: function () { return chunkZBQEMIAV_js.isProtectedResourceError; }
|
|
7494
7530
|
});
|
|
7495
7531
|
Object.defineProperty(exports, "isRecordReferencedError", {
|
|
7496
7532
|
enumerable: true,
|
|
7497
|
-
get: function () { return
|
|
7533
|
+
get: function () { return chunkZBQEMIAV_js.isRecordReferencedError; }
|
|
7498
7534
|
});
|
|
7499
7535
|
Object.defineProperty(exports, "isSchemaError", {
|
|
7500
7536
|
enumerable: true,
|
|
7501
|
-
get: function () { return
|
|
7537
|
+
get: function () { return chunkZBQEMIAV_js.isSchemaError; }
|
|
7502
7538
|
});
|
|
7503
7539
|
Object.defineProperty(exports, "isValidationError", {
|
|
7504
7540
|
enumerable: true,
|
|
7505
|
-
get: function () { return
|
|
7506
|
-
});
|
|
7507
|
-
Object.defineProperty(exports, "rejectUnknownAttributesOrThrow", {
|
|
7508
|
-
enumerable: true,
|
|
7509
|
-
get: function () { return chunkTS3PJOMZ_js.rejectUnknownAttributesOrThrow; }
|
|
7510
|
-
});
|
|
7511
|
-
Object.defineProperty(exports, "validateDraft", {
|
|
7512
|
-
enumerable: true,
|
|
7513
|
-
get: function () { return chunkTS3PJOMZ_js.validateDraft; }
|
|
7514
|
-
});
|
|
7515
|
-
Object.defineProperty(exports, "validateDraftOrThrow", {
|
|
7516
|
-
enumerable: true,
|
|
7517
|
-
get: function () { return chunkTS3PJOMZ_js.validateDraftOrThrow; }
|
|
7518
|
-
});
|
|
7519
|
-
Object.defineProperty(exports, "validateObject", {
|
|
7520
|
-
enumerable: true,
|
|
7521
|
-
get: function () { return chunkTS3PJOMZ_js.validateObject; }
|
|
7522
|
-
});
|
|
7523
|
-
Object.defineProperty(exports, "validateObjectOrThrow", {
|
|
7524
|
-
enumerable: true,
|
|
7525
|
-
get: function () { return chunkTS3PJOMZ_js.validateObjectOrThrow; }
|
|
7541
|
+
get: function () { return chunkZBQEMIAV_js.isValidationError; }
|
|
7526
7542
|
});
|
|
7527
7543
|
Object.defineProperty(exports, "DEFAULT_VALIDATION_MESSAGES", {
|
|
7528
7544
|
enumerable: true,
|