@stndrds/schema 1.0.0-alpha.83 → 1.0.0-alpha.85

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.
@@ -2,8 +2,8 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkNEVERCM3js = require('./chunk-NEVERCM3.js');
6
5
 
6
+ var _chunkE6XO2STSjs = require('./chunk-E6XO2STS.js');
7
7
 
8
8
 
9
9
 
@@ -12,7 +12,8 @@ var _chunkNEVERCM3js = require('./chunk-NEVERCM3.js');
12
12
 
13
13
 
14
14
 
15
- var _chunkHUT6HYXJjs = require('./chunk-HUT6HYXJ.js');
15
+
16
+ var _chunkZW4N6FV7js = require('./chunk-ZW4N6FV7.js');
16
17
 
17
18
 
18
19
  var _chunk3RG5ZIWIjs = require('./chunk-3RG5ZIWI.js');
@@ -68,7 +69,7 @@ var WorkflowJwtService = class _WorkflowJwtService {
68
69
  typ: "magic_link",
69
70
  instance: params.instanceId,
70
71
  tenant: params.tenantId
71
- }).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.invitationId).setAudience(params.tenantId).setJti(_chunkNEVERCM3js.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
72
+ }).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.invitationId).setAudience(params.tenantId).setJti(_chunkE6XO2STSjs.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
72
73
  }
73
74
  /**
74
75
  * Sign an access token JWT (long-lived)
@@ -86,7 +87,7 @@ var WorkflowJwtService = class _WorkflowJwtService {
86
87
  instance: params.instanceId,
87
88
  tenant: params.tenantId,
88
89
  scope: params.scope
89
- }).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.grantId).setAudience(params.tenantId).setJti(_chunkNEVERCM3js.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
90
+ }).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.grantId).setAudience(params.tenantId).setJti(_chunkE6XO2STSjs.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
90
91
  }
91
92
  // ============================================================================
92
93
  // VERIFY METHODS
@@ -1043,7 +1044,7 @@ var QueryBuilder = class _QueryBuilder {
1043
1044
  * ```
1044
1045
  */
1045
1046
  tenant(tenantId) {
1046
- return this.clone({ tenantId: _chunkNEVERCM3js.asTenantId.call(void 0, tenantId) });
1047
+ return this.clone({ tenantId: _chunkE6XO2STSjs.asTenantId.call(void 0, tenantId) });
1047
1048
  }
1048
1049
  /**
1049
1050
  * Set user ID for audit/permissions (overrides AsyncLocalStorage context).
@@ -1059,7 +1060,7 @@ var QueryBuilder = class _QueryBuilder {
1059
1060
  * ```
1060
1061
  */
1061
1062
  user(userId) {
1062
- return this.clone({ userId: _chunkNEVERCM3js.asUserId.call(void 0, userId) });
1063
+ return this.clone({ userId: _chunkE6XO2STSjs.asUserId.call(void 0, userId) });
1063
1064
  }
1064
1065
  // ============================================================================
1065
1066
  // TERMINATION METHODS (READ)
@@ -1284,10 +1285,10 @@ var QueryBuilder = class _QueryBuilder {
1284
1285
  function createQueryBuilder(recordService, adapter, objectName, options) {
1285
1286
  const initialState = {};
1286
1287
  if (_optionalChain([options, 'optionalAccess', _25 => _25.tenantId])) {
1287
- initialState.tenantId = _chunkNEVERCM3js.asTenantId.call(void 0, options.tenantId);
1288
+ initialState.tenantId = _chunkE6XO2STSjs.asTenantId.call(void 0, options.tenantId);
1288
1289
  }
1289
1290
  if (_optionalChain([options, 'optionalAccess', _26 => _26.userId])) {
1290
- initialState.userId = _chunkNEVERCM3js.asUserId.call(void 0, options.userId);
1291
+ initialState.userId = _chunkE6XO2STSjs.asUserId.call(void 0, options.userId);
1291
1292
  }
1292
1293
  return new QueryBuilder(recordService, adapter, objectName, initialState);
1293
1294
  }
@@ -2567,7 +2568,7 @@ function formatPhone(value) {
2567
2568
  if (!("phoneNumber" in phone2)) return String(value);
2568
2569
  if (!phone2.phoneNumber) return "";
2569
2570
  if (!phone2.countryCode) return phone2.phoneNumber;
2570
- return _chunkHUT6HYXJjs.formatPhoneForDisplay.call(void 0, phone2);
2571
+ return _chunkZW4N6FV7js.formatPhoneForDisplay.call(void 0, phone2);
2571
2572
  }
2572
2573
  function formatLocation(value, attribute) {
2573
2574
  if (typeof value !== "object" || value === null) return String(value);
@@ -3358,7 +3359,7 @@ function createMockAIConversationsRepository(stores) {
3358
3359
  const userId = requireUserId();
3359
3360
  const now = /* @__PURE__ */ new Date();
3360
3361
  const conversation = {
3361
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3362
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3362
3363
  tenantId,
3363
3364
  userId,
3364
3365
  title: _nullishCoalesce(data.title, () => ( null)),
@@ -3403,7 +3404,7 @@ function createMockAIConversationsRepository(stores) {
3403
3404
  return Promise.reject(new Error("Conversation not found or access denied"));
3404
3405
  }
3405
3406
  const message = {
3406
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3407
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3407
3408
  conversationId: input.conversationId,
3408
3409
  role: input.role,
3409
3410
  content: input.content,
@@ -3458,96 +3459,6 @@ function createMockAIConversationsRepository(stores) {
3458
3459
  }
3459
3460
  };
3460
3461
  }
3461
- function createMockAIUserMemoryRepository(stores) {
3462
- const getKey = () => {
3463
- const tenantId = getTenantId();
3464
- const userId = requireUserId();
3465
- return `${tenantId}:${userId}`;
3466
- };
3467
- return {
3468
- get() {
3469
- const key = getKey();
3470
- return Promise.resolve(_nullishCoalesce(stores.aiUserMemory.get(key), () => ( null)));
3471
- },
3472
- upsert(data) {
3473
- const key = getKey();
3474
- const tenantId = getTenantId();
3475
- const userId = requireUserId();
3476
- const now = /* @__PURE__ */ new Date();
3477
- const existing = stores.aiUserMemory.get(key);
3478
- const memory = {
3479
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _55 => _55.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
3480
- tenantId,
3481
- userId,
3482
- preferences: _nullishCoalesce(_nullishCoalesce(data.preferences, () => ( _optionalChain([existing, 'optionalAccess', _56 => _56.preferences]))), () => ( {})),
3483
- facts: _nullishCoalesce(_nullishCoalesce(data.facts, () => ( _optionalChain([existing, 'optionalAccess', _57 => _57.facts]))), () => ( [])),
3484
- createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _58 => _58.createdAt]), () => ( now)),
3485
- updatedAt: now
3486
- };
3487
- stores.aiUserMemory.set(key, memory);
3488
- return Promise.resolve(memory);
3489
- },
3490
- addFact(fact) {
3491
- const key = getKey();
3492
- const tenantId = getTenantId();
3493
- const userId = requireUserId();
3494
- const now = /* @__PURE__ */ new Date();
3495
- const existing = stores.aiUserMemory.get(key);
3496
- const memory = {
3497
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _59 => _59.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
3498
- tenantId,
3499
- userId,
3500
- preferences: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _60 => _60.preferences]), () => ( {})),
3501
- facts: [..._nullishCoalesce(_optionalChain([existing, 'optionalAccess', _61 => _61.facts]), () => ( [])), fact],
3502
- createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _62 => _62.createdAt]), () => ( now)),
3503
- updatedAt: now
3504
- };
3505
- stores.aiUserMemory.set(key, memory);
3506
- return Promise.resolve(memory);
3507
- },
3508
- removeFact(fact) {
3509
- const key = getKey();
3510
- const tenantId = getTenantId();
3511
- const userId = requireUserId();
3512
- const now = /* @__PURE__ */ new Date();
3513
- const existing = stores.aiUserMemory.get(key);
3514
- const memory = {
3515
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _63 => _63.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
3516
- tenantId,
3517
- userId,
3518
- preferences: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _64 => _64.preferences]), () => ( {})),
3519
- facts: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _65 => _65.facts]), () => ( []))).filter((f) => f !== fact),
3520
- createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _66 => _66.createdAt]), () => ( now)),
3521
- updatedAt: now
3522
- };
3523
- stores.aiUserMemory.set(key, memory);
3524
- return Promise.resolve(memory);
3525
- },
3526
- setPreference(prefKey, value) {
3527
- const memoryKey = getKey();
3528
- const tenantId = getTenantId();
3529
- const userId = requireUserId();
3530
- const now = /* @__PURE__ */ new Date();
3531
- const existing = stores.aiUserMemory.get(memoryKey);
3532
- const memory = {
3533
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _67 => _67.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
3534
- tenantId,
3535
- userId,
3536
- preferences: { ..._nullishCoalesce(_optionalChain([existing, 'optionalAccess', _68 => _68.preferences]), () => ( {})), [prefKey]: value },
3537
- facts: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _69 => _69.facts]), () => ( [])),
3538
- createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _70 => _70.createdAt]), () => ( now)),
3539
- updatedAt: now
3540
- };
3541
- stores.aiUserMemory.set(memoryKey, memory);
3542
- return Promise.resolve(memory);
3543
- },
3544
- clear() {
3545
- const key = getKey();
3546
- stores.aiUserMemory.delete(key);
3547
- return Promise.resolve();
3548
- }
3549
- };
3550
- }
3551
3462
  function createMockAIUsageMetricsRepository(stores) {
3552
3463
  const getDateKey = (date2) => {
3553
3464
  const tenantId = getTenantId();
@@ -3560,24 +3471,24 @@ function createMockAIUsageMetricsRepository(stores) {
3560
3471
  const now = /* @__PURE__ */ new Date();
3561
3472
  const key = getDateKey(now);
3562
3473
  const existing = stores.aiUsageMetrics.get(key);
3563
- const providerBreakdown = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _71 => _71.providerBreakdown]), () => ( {}));
3474
+ const providerBreakdown = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _55 => _55.providerBreakdown]), () => ( {}));
3564
3475
  if (!providerBreakdown[data.provider]) {
3565
3476
  providerBreakdown[data.provider] = { requests: 0, tokens: 0, cost: 0 };
3566
3477
  }
3567
3478
  providerBreakdown[data.provider].requests++;
3568
3479
  providerBreakdown[data.provider].tokens += data.tokens;
3569
3480
  providerBreakdown[data.provider].cost += data.cost;
3570
- const toolUsage = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _72 => _72.toolUsage]), () => ( {}));
3481
+ const toolUsage = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _56 => _56.toolUsage]), () => ( {}));
3571
3482
  if (data.toolName) {
3572
3483
  toolUsage[data.toolName] = (_nullishCoalesce(toolUsage[data.toolName], () => ( 0))) + 1;
3573
3484
  }
3574
3485
  const metrics = {
3575
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _73 => _73.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
3486
+ id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _57 => _57.id]), () => ( _chunkE6XO2STSjs.generateId.call(void 0, ))),
3576
3487
  tenantId,
3577
3488
  date: new Date(_nullishCoalesce(now.toISOString().split("T")[0], () => ( now.toISOString()))),
3578
- requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _74 => _74.requestCount]), () => ( 0))) + 1,
3579
- totalTokens: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _75 => _75.totalTokens]), () => ( 0))) + data.tokens,
3580
- totalCost: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _76 => _76.totalCost]), () => ( 0))) + data.cost,
3489
+ requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _58 => _58.requestCount]), () => ( 0))) + 1,
3490
+ totalTokens: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _59 => _59.totalTokens]), () => ( 0))) + data.tokens,
3491
+ totalCost: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _60 => _60.totalCost]), () => ( 0))) + data.cost,
3581
3492
  providerBreakdown,
3582
3493
  toolUsage
3583
3494
  };
@@ -3630,7 +3541,7 @@ function createMockFilesRepository(stores) {
3630
3541
  return {
3631
3542
  findById(id) {
3632
3543
  const file2 = stores.files.get(id);
3633
- if (_optionalChain([file2, 'optionalAccess', _77 => _77.deletedAt])) return Promise.resolve(null);
3544
+ if (_optionalChain([file2, 'optionalAccess', _61 => _61.deletedAt])) return Promise.resolve(null);
3634
3545
  return Promise.resolve(_nullishCoalesce(file2, () => ( null)));
3635
3546
  },
3636
3547
  findByIds(ids) {
@@ -3640,7 +3551,7 @@ function createMockFilesRepository(stores) {
3640
3551
  create(data) {
3641
3552
  const tenantId = getTenantId();
3642
3553
  const file2 = {
3643
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3554
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3644
3555
  tenantId,
3645
3556
  name: data.name,
3646
3557
  originalName: data.originalName,
@@ -3691,10 +3602,10 @@ function createMockFilesRepository(stores) {
3691
3602
  let results = Array.from(stores.files.values()).filter(
3692
3603
  (f) => f.tenantId === tenantId && !f.deletedAt
3693
3604
  );
3694
- if (_optionalChain([options, 'optionalAccess', _78 => _78.mimeType])) {
3605
+ if (_optionalChain([options, 'optionalAccess', _62 => _62.mimeType])) {
3695
3606
  results = results.filter((f) => f.mimeType === options.mimeType);
3696
3607
  }
3697
- if (_optionalChain([options, 'optionalAccess', _79 => _79.limit])) {
3608
+ if (_optionalChain([options, 'optionalAccess', _63 => _63.limit])) {
3698
3609
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
3699
3610
  }
3700
3611
  return Promise.resolve(results);
@@ -3746,7 +3657,7 @@ function createMockObjectsRepository(stores) {
3746
3657
  create(data) {
3747
3658
  const tenantId = getTenantId();
3748
3659
  const obj = {
3749
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3660
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3750
3661
  tenantId,
3751
3662
  name: data.name,
3752
3663
  label: data.label,
@@ -3822,7 +3733,7 @@ function createMockObjectsRepository(stores) {
3822
3733
  }
3823
3734
  }
3824
3735
  const newObj = {
3825
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3736
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3826
3737
  tenantId,
3827
3738
  name: data.name,
3828
3739
  label: data.label,
@@ -3854,7 +3765,7 @@ function createMockAttributesRepository(stores) {
3854
3765
  },
3855
3766
  create(data) {
3856
3767
  const attr = {
3857
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3768
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3858
3769
  objectId: data.objectId,
3859
3770
  name: data.name,
3860
3771
  label: data.label,
@@ -4050,7 +3961,7 @@ var SyncError = class extends SchemaError {
4050
3961
  constructor(objectName, message, cause) {
4051
3962
  super(`Failed to sync object "${objectName}": ${message}`, SchemaErrorCode.SYNC_FAILED, {
4052
3963
  objectName,
4053
- cause: _optionalChain([cause, 'optionalAccess', _80 => _80.message])
3964
+ cause: _optionalChain([cause, 'optionalAccess', _64 => _64.message])
4054
3965
  });
4055
3966
  this.name = "SyncError";
4056
3967
  this.objectName = objectName;
@@ -4173,7 +4084,7 @@ function createMockObjectRecordsRepository(stores) {
4173
4084
  create(data) {
4174
4085
  const tenantId = getTenantId();
4175
4086
  const internal = {
4176
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4087
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4177
4088
  tenantId,
4178
4089
  objectId: data.objectId,
4179
4090
  label: data.label,
@@ -4238,7 +4149,7 @@ function createMockObjectRecordsRepository(stores) {
4238
4149
  (r) => r.tenantId === tenantId && r.objectId === objectId && !r.deletedAt
4239
4150
  );
4240
4151
  const total = results.length;
4241
- if (_optionalChain([options, 'optionalAccess', _81 => _81.limit])) {
4152
+ if (_optionalChain([options, 'optionalAccess', _65 => _65.limit])) {
4242
4153
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4243
4154
  }
4244
4155
  const records = results.map(({ tenantId: _t, ...r }) => r);
@@ -4254,7 +4165,7 @@ function createMockObjectRecordsRepository(stores) {
4254
4165
  );
4255
4166
  });
4256
4167
  const total = results.length;
4257
- if (_optionalChain([options, 'optionalAccess', _82 => _82.limit])) {
4168
+ if (_optionalChain([options, 'optionalAccess', _66 => _66.limit])) {
4258
4169
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4259
4170
  }
4260
4171
  const records = results.map(({ tenantId: _t, ...r }) => r);
@@ -4270,7 +4181,7 @@ function createMockObjectRecordsRepository(stores) {
4270
4181
  }
4271
4182
  }
4272
4183
  const allowedObjectIds = /* @__PURE__ */ new Set();
4273
- if (_optionalChain([options, 'optionalAccess', _83 => _83.objectNames]) && options.objectNames.length > 0) {
4184
+ if (_optionalChain([options, 'optionalAccess', _67 => _67.objectNames]) && options.objectNames.length > 0) {
4274
4185
  for (const obj of objectsMap.values()) {
4275
4186
  if (options.objectNames.includes(obj.name)) {
4276
4187
  allowedObjectIds.add(obj.id);
@@ -4289,7 +4200,7 @@ function createMockObjectRecordsRepository(stores) {
4289
4200
  );
4290
4201
  });
4291
4202
  const total = matchingRecords.length;
4292
- if (_optionalChain([options, 'optionalAccess', _84 => _84.limit])) {
4203
+ if (_optionalChain([options, 'optionalAccess', _68 => _68.limit])) {
4293
4204
  matchingRecords = matchingRecords.slice(
4294
4205
  _nullishCoalesce(options.offset, () => ( 0)),
4295
4206
  (_nullishCoalesce(options.offset, () => ( 0))) + options.limit
@@ -4300,11 +4211,11 @@ function createMockObjectRecordsRepository(stores) {
4300
4211
  if (!attributesByObjectId.has(attr.objectId)) {
4301
4212
  attributesByObjectId.set(attr.objectId, []);
4302
4213
  }
4303
- _optionalChain([attributesByObjectId, 'access', _85 => _85.get, 'call', _86 => _86(attr.objectId), 'optionalAccess', _87 => _87.push, 'call', _88 => _88(attr)]);
4214
+ _optionalChain([attributesByObjectId, 'access', _69 => _69.get, 'call', _70 => _70(attr.objectId), 'optionalAccess', _71 => _71.push, 'call', _72 => _72(attr)]);
4304
4215
  }
4305
4216
  const results = matchingRecords.map((r) => {
4306
4217
  const obj = objectsMap.get(r.objectId);
4307
- const labelExpression = _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _89 => _89.labelExpression]), () => ( "{{ name }}"));
4218
+ const labelExpression = _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _73 => _73.labelExpression]), () => ( "{{ name }}"));
4308
4219
  const dbAttrs = _nullishCoalesce(attributesByObjectId.get(r.objectId), () => ( []));
4309
4220
  const attrs = dbAttrs.map((a) => ({
4310
4221
  ...a.config,
@@ -4317,8 +4228,8 @@ function createMockObjectRecordsRepository(stores) {
4317
4228
  const enrichedValues = enrichValuesForDisplay(r.values, attrs);
4318
4229
  return {
4319
4230
  objectId: r.objectId,
4320
- objectName: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _90 => _90.name]), () => ( "unknown")),
4321
- objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _91 => _91.label]), () => ( "Unknown")),
4231
+ objectName: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _74 => _74.name]), () => ( "unknown")),
4232
+ objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _75 => _75.label]), () => ( "Unknown")),
4322
4233
  label: renderLabelExpression(labelExpression, enrichedValues),
4323
4234
  recordId: r.id,
4324
4235
  completionStatus: r.completionStatus,
@@ -4329,9 +4240,9 @@ function createMockObjectRecordsRepository(stores) {
4329
4240
  return Promise.resolve({ results, total });
4330
4241
  },
4331
4242
  globalSearchGrouped(query, options) {
4332
- const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _92 => _92.limitPerGroup]), () => ( 5));
4243
+ const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _76 => _76.limitPerGroup]), () => ( 5));
4333
4244
  return this.globalSearch(query, {
4334
- objectNames: _optionalChain([options, 'optionalAccess', _93 => _93.objectNames]),
4245
+ objectNames: _optionalChain([options, 'optionalAccess', _77 => _77.objectNames]),
4335
4246
  limit: 500,
4336
4247
  offset: 0
4337
4248
  }).then(({ results }) => {
@@ -4480,7 +4391,7 @@ function createMockRelationAttributesRepository(stores) {
4480
4391
  results.push(existing);
4481
4392
  } else {
4482
4393
  const row = {
4483
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4394
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4484
4395
  tenantId: context.tenantId,
4485
4396
  fromObject: item.fromObject,
4486
4397
  fromId: item.fromId,
@@ -4592,7 +4503,6 @@ function createEmptyStores() {
4592
4503
  workflowAccessGrants: /* @__PURE__ */ new Map(),
4593
4504
  aiConversations: /* @__PURE__ */ new Map(),
4594
4505
  aiMessages: /* @__PURE__ */ new Map(),
4595
- aiUserMemory: /* @__PURE__ */ new Map(),
4596
4506
  aiUsageMetrics: /* @__PURE__ */ new Map(),
4597
4507
  relationAttributes: /* @__PURE__ */ new Map()
4598
4508
  };
@@ -4641,7 +4551,7 @@ function createMockUserProfilesRepository(stores) {
4641
4551
  create(data) {
4642
4552
  const tenantId = getTenantId();
4643
4553
  const profile = {
4644
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4554
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4645
4555
  tenantId,
4646
4556
  authId: data.authId,
4647
4557
  email: data.email,
@@ -4678,7 +4588,7 @@ function createMockUserProfilesRepository(stores) {
4678
4588
  list(options) {
4679
4589
  const tenantId = getTenantId();
4680
4590
  let results = Array.from(stores.userProfiles.values()).filter((p) => p.tenantId === tenantId);
4681
- if (_optionalChain([options, 'optionalAccess', _94 => _94.limit])) {
4591
+ if (_optionalChain([options, 'optionalAccess', _78 => _78.limit])) {
4682
4592
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4683
4593
  }
4684
4594
  return Promise.resolve(results);
@@ -4692,7 +4602,7 @@ function createMockUserProfilesRepository(stores) {
4692
4602
  for (const profile of profiles) {
4693
4603
  const roleIds = Array.from(stores.userRoles.values()).filter((ur) => ur.userProfileId === profile.id && ur.tenantId === tenantId).map((ur) => ur.roleId);
4694
4604
  const roles = Array.from(stores.roles.values()).filter((r) => roleIds.includes(r.id));
4695
- if (_optionalChain([filters, 'optionalAccess', _95 => _95.allowedRoles]) && filters.allowedRoles.length > 0) {
4605
+ if (_optionalChain([filters, 'optionalAccess', _79 => _79.allowedRoles]) && filters.allowedRoles.length > 0) {
4696
4606
  const allowed = filters.allowedRoles;
4697
4607
  const hasMatchingRole = roles.some((r) => allowed.includes(r.name));
4698
4608
  if (!hasMatchingRole) continue;
@@ -4712,9 +4622,9 @@ function createMockUserProfilesRepository(stores) {
4712
4622
  invite(data) {
4713
4623
  const tenantId = getTenantId();
4714
4624
  const profile = {
4715
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4625
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4716
4626
  tenantId,
4717
- authId: `invited-${_chunkNEVERCM3js.generateId.call(void 0, )}`,
4627
+ authId: `invited-${_chunkE6XO2STSjs.generateId.call(void 0, )}`,
4718
4628
  email: data.email,
4719
4629
  firstName: data.firstName,
4720
4630
  lastName: data.lastName,
@@ -4749,7 +4659,7 @@ function createMockPermissionsRepository(stores) {
4749
4659
  createRole(input) {
4750
4660
  const tenantId = getTenantId();
4751
4661
  const role = {
4752
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4662
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4753
4663
  tenantId,
4754
4664
  name: input.name,
4755
4665
  label: input.label,
@@ -4776,7 +4686,7 @@ function createMockPermissionsRepository(stores) {
4776
4686
  },
4777
4687
  deleteRole(roleId) {
4778
4688
  const role = stores.roles.get(roleId);
4779
- if (_optionalChain([role, 'optionalAccess', _96 => _96.system])) {
4689
+ if (_optionalChain([role, 'optionalAccess', _80 => _80.system])) {
4780
4690
  return Promise.reject(new Error(`Cannot delete system role ${roleId}`));
4781
4691
  }
4782
4692
  stores.roles.delete(roleId);
@@ -4804,7 +4714,7 @@ function createMockPermissionsRepository(stores) {
4804
4714
  }
4805
4715
  for (const input of permissions) {
4806
4716
  const perm = {
4807
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4717
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4808
4718
  roleId,
4809
4719
  scope: input.scope,
4810
4720
  target: input.target,
@@ -4829,7 +4739,7 @@ function createMockPermissionsRepository(stores) {
4829
4739
  }
4830
4740
  }
4831
4741
  const userRole = {
4832
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4742
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4833
4743
  userProfileId: input.userProfileId,
4834
4744
  roleId: input.roleId,
4835
4745
  tenantId: input.tenantId,
@@ -4942,7 +4852,7 @@ function createMockViewsRepository(stores) {
4942
4852
  },
4943
4853
  create(data) {
4944
4854
  const tenantId = getTenantId();
4945
- const id = _chunkNEVERCM3js.generateId.call(void 0, );
4855
+ const id = _chunkE6XO2STSjs.generateId.call(void 0, );
4946
4856
  const now = /* @__PURE__ */ new Date();
4947
4857
  const dbView = {
4948
4858
  id,
@@ -5053,7 +4963,7 @@ function createMockViewOverlaysRepository(stores) {
5053
4963
  },
5054
4964
  create(data) {
5055
4965
  const tenantId = getTenantId();
5056
- const id = _chunkNEVERCM3js.generateId.call(void 0, );
4966
+ const id = _chunkE6XO2STSjs.generateId.call(void 0, );
5057
4967
  const now = /* @__PURE__ */ new Date();
5058
4968
  const overlay = {
5059
4969
  id,
@@ -5185,7 +5095,7 @@ function createMockWorkflowsRepository(stores) {
5185
5095
  const tenantId = getTenantId();
5186
5096
  const now = (/* @__PURE__ */ new Date()).toISOString();
5187
5097
  const workflow2 = {
5188
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5098
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5189
5099
  tenant_id: tenantId,
5190
5100
  name: data.name,
5191
5101
  label: data.label,
@@ -5284,7 +5194,7 @@ function createMockWorkflowInstancesRepository(stores) {
5284
5194
  (i) => i.tenant_id === tenantId
5285
5195
  );
5286
5196
  const total = results.length;
5287
- if (_optionalChain([options, 'optionalAccess', _97 => _97.limit])) {
5197
+ if (_optionalChain([options, 'optionalAccess', _81 => _81.limit])) {
5288
5198
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
5289
5199
  }
5290
5200
  return Promise.resolve({ instances: results, total });
@@ -5300,7 +5210,7 @@ function createMockWorkflowInstancesRepository(stores) {
5300
5210
  const tenantId = getTenantId();
5301
5211
  const now = (/* @__PURE__ */ new Date()).toISOString();
5302
5212
  const instance = {
5303
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5213
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5304
5214
  tenant_id: tenantId,
5305
5215
  workflow_id: data.workflowId,
5306
5216
  workflow_version: data.workflowVersion,
@@ -5312,7 +5222,7 @@ function createMockWorkflowInstancesRepository(stores) {
5312
5222
  pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
5313
5223
  error: null,
5314
5224
  started_by: data.startedBy,
5315
- expires_at: _nullishCoalesce(_optionalChain([data, 'access', _98 => _98.expiresAt, 'optionalAccess', _99 => _99.toISOString, 'call', _100 => _100()]), () => ( null)),
5225
+ expires_at: _nullishCoalesce(_optionalChain([data, 'access', _82 => _82.expiresAt, 'optionalAccess', _83 => _83.toISOString, 'call', _84 => _84()]), () => ( null)),
5316
5226
  created_at: now,
5317
5227
  updated_at: now,
5318
5228
  completed_at: null
@@ -5337,8 +5247,8 @@ function createMockWorkflowInstancesRepository(stores) {
5337
5247
  history: _nullishCoalesce(data.history, () => ( existing.history)),
5338
5248
  pending_action: data.pendingAction !== void 0 ? data.pendingAction : existing.pending_action,
5339
5249
  error: data.error !== void 0 ? data.error : existing.error,
5340
- expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _101 => _101.expiresAt, 'optionalAccess', _102 => _102.toISOString, 'call', _103 => _103()]), () => ( null)) : existing.expires_at,
5341
- completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _104 => _104.completedAt, 'optionalAccess', _105 => _105.toISOString, 'call', _106 => _106()]), () => ( null)) : existing.completed_at,
5250
+ expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _85 => _85.expiresAt, 'optionalAccess', _86 => _86.toISOString, 'call', _87 => _87()]), () => ( null)) : existing.expires_at,
5251
+ completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _88 => _88.completedAt, 'optionalAccess', _89 => _89.toISOString, 'call', _90 => _90()]), () => ( null)) : existing.completed_at,
5342
5252
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
5343
5253
  };
5344
5254
  stores.workflowInstances.set(id, updated);
@@ -5371,7 +5281,7 @@ function createMockWorkflowInstancesRepository(stores) {
5371
5281
  pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
5372
5282
  error: null,
5373
5283
  started_by: data.startedBy,
5374
- expires_at: _nullishCoalesce(_optionalChain([data, 'access', _107 => _107.expiresAt, 'optionalAccess', _108 => _108.toISOString, 'call', _109 => _109()]), () => ( null)),
5284
+ expires_at: _nullishCoalesce(_optionalChain([data, 'access', _91 => _91.expiresAt, 'optionalAccess', _92 => _92.toISOString, 'call', _93 => _93()]), () => ( null)),
5375
5285
  created_at: now,
5376
5286
  updated_at: now,
5377
5287
  completed_at: null
@@ -5394,13 +5304,13 @@ function createMockWorkflowInstancesRepository(stores) {
5394
5304
  return slotData.id === recordId;
5395
5305
  });
5396
5306
  });
5397
- if (_optionalChain([options, 'optionalAccess', _110 => _110.status])) {
5307
+ if (_optionalChain([options, 'optionalAccess', _94 => _94.status])) {
5398
5308
  results = results.filter((i) => i.status === options.status);
5399
5309
  }
5400
5310
  const total = results.length;
5401
- if (_optionalChain([options, 'optionalAccess', _111 => _111.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _112 => _112.limit]) !== void 0) {
5402
- const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _113 => _113.offset]), () => ( 0));
5403
- const end = _optionalChain([options, 'optionalAccess', _114 => _114.limit]) ? start + options.limit : void 0;
5311
+ if (_optionalChain([options, 'optionalAccess', _95 => _95.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _96 => _96.limit]) !== void 0) {
5312
+ const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _97 => _97.offset]), () => ( 0));
5313
+ const end = _optionalChain([options, 'optionalAccess', _98 => _98.limit]) ? start + options.limit : void 0;
5404
5314
  results = results.slice(start, end);
5405
5315
  }
5406
5316
  return Promise.resolve({ instances: results, total });
@@ -5434,7 +5344,7 @@ function createMockWorkflowInvitationsRepository(stores) {
5434
5344
  const tenantId = getTenantId();
5435
5345
  const now = (/* @__PURE__ */ new Date()).toISOString();
5436
5346
  const invitation = {
5437
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5347
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5438
5348
  tenant_id: tenantId,
5439
5349
  instance_id: data.instanceId,
5440
5350
  recipient_email: data.recipientEmail,
@@ -5460,7 +5370,7 @@ function createMockWorkflowInvitationsRepository(stores) {
5460
5370
  const updated = {
5461
5371
  ...existing,
5462
5372
  status: _nullishCoalesce(data.status, () => ( existing.status)),
5463
- accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _115 => _115.acceptedAt, 'optionalAccess', _116 => _116.toISOString, 'call', _117 => _117()]), () => ( null)) : existing.accepted_at,
5373
+ accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _99 => _99.acceptedAt, 'optionalAccess', _100 => _100.toISOString, 'call', _101 => _101()]), () => ( null)) : existing.accepted_at,
5464
5374
  expires_at: data.expiresAt !== void 0 ? data.expiresAt.toISOString() : existing.expires_at
5465
5375
  };
5466
5376
  stores.workflowInvitations.set(id, updated);
@@ -5502,7 +5412,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
5502
5412
  const tenantId = getTenantId();
5503
5413
  const now = (/* @__PURE__ */ new Date()).toISOString();
5504
5414
  const grant = {
5505
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5415
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5506
5416
  tenant_id: tenantId,
5507
5417
  invitation_id: data.invitationId,
5508
5418
  instance_id: data.instanceId,
@@ -5530,7 +5440,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
5530
5440
  ...existing,
5531
5441
  last_used_at: data.lastUsedAt !== void 0 ? data.lastUsedAt.toISOString() : existing.last_used_at,
5532
5442
  revoked_token_jtis: _nullishCoalesce(data.revokedTokenJtis, () => ( existing.revoked_token_jtis)),
5533
- revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _118 => _118.revokedAt, 'optionalAccess', _119 => _119.toISOString, 'call', _120 => _120()]), () => ( null)) : existing.revoked_at
5443
+ revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _102 => _102.revokedAt, 'optionalAccess', _103 => _103.toISOString, 'call', _104 => _104()]), () => ( null)) : existing.revoked_at
5534
5444
  };
5535
5445
  stores.workflowAccessGrants.set(id, updated);
5536
5446
  return Promise.resolve(updated);
@@ -5556,7 +5466,6 @@ function createMockAdapter() {
5556
5466
  workflowAccessGrants: createMockWorkflowAccessGrantsRepository(stores),
5557
5467
  // AI repositories
5558
5468
  aiConversations: createMockAIConversationsRepository(stores),
5559
- aiUserMemory: createMockAIUserMemoryRepository(stores),
5560
5469
  aiUsageMetrics: createMockAIUsageMetricsRepository(stores),
5561
5470
  // Relation attributes repository
5562
5471
  relationAttributes: createMockRelationAttributesRepository(stores),
@@ -5583,7 +5492,6 @@ function createMockAdapter() {
5583
5492
  stores.workflowAccessGrants.clear();
5584
5493
  stores.aiConversations.clear();
5585
5494
  stores.aiMessages.clear();
5586
- stores.aiUserMemory.clear();
5587
5495
  stores.aiUsageMetrics.clear();
5588
5496
  stores.relationAttributes.clear();
5589
5497
  }
@@ -5753,7 +5661,7 @@ var BaseService = class {
5753
5661
  * @param key - Cache key to invalidate
5754
5662
  */
5755
5663
  async invalidateCache(key) {
5756
- await _optionalChain([this, 'access', _121 => _121.cache, 'optionalAccess', _122 => _122.delete, 'call', _123 => _123(key)]);
5664
+ await _optionalChain([this, 'access', _105 => _105.cache, 'optionalAccess', _106 => _106.delete, 'call', _107 => _107(key)]);
5757
5665
  }
5758
5666
  /**
5759
5667
  * Invalidate all cache keys matching a pattern.
@@ -5761,7 +5669,7 @@ var BaseService = class {
5761
5669
  * @param pattern - Glob-style pattern (e.g., "schema:tenant-123:*")
5762
5670
  */
5763
5671
  async invalidateCachePattern(pattern) {
5764
- await _optionalChain([this, 'access', _124 => _124.cache, 'optionalAccess', _125 => _125.deletePattern, 'call', _126 => _126(pattern)]);
5672
+ await _optionalChain([this, 'access', _108 => _108.cache, 'optionalAccess', _109 => _109.deletePattern, 'call', _110 => _110(pattern)]);
5765
5673
  }
5766
5674
  /**
5767
5675
  * Invalidate all cached lists for a resource.
@@ -5915,6 +5823,9 @@ var FORBIDDEN_PROPERTY_TYPES = [
5915
5823
  "document",
5916
5824
  "richtext"
5917
5825
  ];
5826
+ function hasOptions2(attr) {
5827
+ return attr.type === "select" || attr.type === "status" || attr.type === "multiselect";
5828
+ }
5918
5829
 
5919
5830
  // src/builders/attribute-validators.ts
5920
5831
 
@@ -5988,17 +5899,17 @@ function validateOptions(options, attributeName) {
5988
5899
  const ids = /* @__PURE__ */ new Set();
5989
5900
  const values = /* @__PURE__ */ new Set();
5990
5901
  for (const option of options) {
5991
- if (!_optionalChain([option, 'access', _127 => _127.id, 'optionalAccess', _128 => _128.trim, 'call', _129 => _129()])) {
5902
+ if (!_optionalChain([option, 'access', _111 => _111.id, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()])) {
5992
5903
  throw new Error(
5993
5904
  `[AttributeBuilder] Option in "${attributeName}" has an empty or missing id.`
5994
5905
  );
5995
5906
  }
5996
- if (!_optionalChain([option, 'access', _130 => _130.value, 'optionalAccess', _131 => _131.trim, 'call', _132 => _132()])) {
5907
+ if (!_optionalChain([option, 'access', _114 => _114.value, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])) {
5997
5908
  throw new Error(
5998
5909
  `[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing value.`
5999
5910
  );
6000
5911
  }
6001
- if (!_optionalChain([option, 'access', _133 => _133.label, 'optionalAccess', _134 => _134.trim, 'call', _135 => _135()])) {
5912
+ if (!_optionalChain([option, 'access', _117 => _117.label, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()])) {
6002
5913
  throw new Error(
6003
5914
  `[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing label.`
6004
5915
  );
@@ -6019,6 +5930,20 @@ function validateOptions(options, attributeName) {
6019
5930
  validateIconName(option.icon, `option "${option.id}" of "${attributeName}"`);
6020
5931
  }
6021
5932
  }
5933
+ for (const option of options) {
5934
+ if (option.inverse === void 0) continue;
5935
+ const inverseOption = options.find((o) => o.value === option.inverse);
5936
+ if (!inverseOption) {
5937
+ throw new Error(
5938
+ `[AttributeBuilder] Option "${option.value}" in "${attributeName}" has inverse "${option.inverse}" which does not match any option value.`
5939
+ );
5940
+ }
5941
+ if (inverseOption.inverse !== option.value) {
5942
+ throw new Error(
5943
+ `[AttributeBuilder] Inverse mismatch in "${attributeName}": "${option.value}" points to "${option.inverse}", but "${option.inverse}" points to "${_nullishCoalesce(inverseOption.inverse, () => ( "(none)"))}". Inverse pairs must be symmetric.`
5944
+ );
5945
+ }
5946
+ }
6022
5947
  }
6023
5948
 
6024
5949
  // src/builders/attribute-builders.ts
@@ -6096,8 +6021,8 @@ var BaseAttributeBuilder = class {
6096
6021
  featureGate(flagName, options) {
6097
6022
  this.attr.featureGate = {
6098
6023
  flag: flagName,
6099
- expectedValue: _optionalChain([options, 'optionalAccess', _136 => _136.expectedValue]),
6100
- fallback: _optionalChain([options, 'optionalAccess', _137 => _137.fallback])
6024
+ expectedValue: _optionalChain([options, 'optionalAccess', _120 => _120.expectedValue]),
6025
+ fallback: _optionalChain([options, 'optionalAccess', _121 => _121.fallback])
6101
6026
  };
6102
6027
  return this;
6103
6028
  }
@@ -6540,7 +6465,7 @@ var BaseRelationAttributeBuilder = class extends BaseAttributeBuilder {
6540
6465
  object: objectName,
6541
6466
  ...options
6542
6467
  };
6543
- _optionalChain([this, 'access', _138 => _138.attr, 'access', _139 => _139.targets, 'optionalAccess', _140 => _140.push, 'call', _141 => _141(target)]);
6468
+ _optionalChain([this, 'access', _122 => _122.attr, 'access', _123 => _123.targets, 'optionalAccess', _124 => _124.push, 'call', _125 => _125(target)]);
6544
6469
  return this;
6545
6470
  }
6546
6471
  /**
@@ -6652,9 +6577,9 @@ var MultiRelationAttributeBuilder = class extends BaseRelationAttributeBuilder {
6652
6577
  constructor(name, label, initOptions) {
6653
6578
  super("relation", name, label);
6654
6579
  this.attr.cardinality = "many";
6655
- this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _142 => _142.targets]), () => ( []));
6580
+ this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _126 => _126.targets]), () => ( []));
6656
6581
  this.attr.defaultValue = [];
6657
- if (_optionalChain([initOptions, 'optionalAccess', _143 => _143.isRequired])) {
6582
+ if (_optionalChain([initOptions, 'optionalAccess', _127 => _127.isRequired])) {
6658
6583
  this.setRequired(true);
6659
6584
  }
6660
6585
  }
@@ -7086,7 +7011,7 @@ var GroupBuilder = class {
7086
7011
  */
7087
7012
  fields(...names) {
7088
7013
  for (const name of names) {
7089
- _optionalChain([this, 'access', _144 => _144.data, 'access', _145 => _145.fields, 'optionalAccess', _146 => _146.push, 'call', _147 => _147({ attribute: name })]);
7014
+ _optionalChain([this, 'access', _128 => _128.data, 'access', _129 => _129.fields, 'optionalAccess', _130 => _130.push, 'call', _131 => _131({ attribute: name })]);
7090
7015
  }
7091
7016
  return this;
7092
7017
  }
@@ -7095,7 +7020,7 @@ var GroupBuilder = class {
7095
7020
  * @example .field("name", { span: 8, readOnly: true })
7096
7021
  */
7097
7022
  field(attribute, options) {
7098
- _optionalChain([this, 'access', _148 => _148.data, 'access', _149 => _149.fields, 'optionalAccess', _150 => _150.push, 'call', _151 => _151({ attribute, ...options })]);
7023
+ _optionalChain([this, 'access', _132 => _132.data, 'access', _133 => _133.fields, 'optionalAccess', _134 => _134.push, 'call', _135 => _135({ attribute, ...options })]);
7099
7024
  return this;
7100
7025
  }
7101
7026
  /**
@@ -7104,7 +7029,7 @@ var GroupBuilder = class {
7104
7029
  * @example .attributeGroup({ id: "address", label: "Address", attributes: ["street", "city", "postal_code"], displayTemplate: "{street}, {city}" })
7105
7030
  */
7106
7031
  attributeGroup(config, options) {
7107
- _optionalChain([this, 'access', _152 => _152.data, 'access', _153 => _153.fields, 'optionalAccess', _154 => _154.push, 'call', _155 => _155({ attributeGroup: config, ...options })]);
7032
+ _optionalChain([this, 'access', _136 => _136.data, 'access', _137 => _137.fields, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ attributeGroup: config, ...options })]);
7108
7033
  return this;
7109
7034
  }
7110
7035
  /**
@@ -7952,7 +7877,7 @@ var ListViewBuilder = class {
7952
7877
  }
7953
7878
  const config = {
7954
7879
  defaultFilters: this.data.defaultFilters ? {
7955
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
7880
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
7956
7881
  combinator: this.data.defaultFilters.combinator,
7957
7882
  rules: this.data.defaultFilters.rules
7958
7883
  } : void 0,
@@ -7965,7 +7890,7 @@ var ListViewBuilder = class {
7965
7890
  columns: tab.columns,
7966
7891
  columnSizing: tab.columnSizing,
7967
7892
  filters: tab.filters ? {
7968
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
7893
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
7969
7894
  combinator: tab.filters.combinator,
7970
7895
  rules: tab.filters.rules
7971
7896
  } : void 0,
@@ -8172,8 +8097,8 @@ var WorkflowFormRowBuilder = class {
8172
8097
  id: `${this.rowData.id}-${slotId}-${attribute}`,
8173
8098
  slotId,
8174
8099
  attribute,
8175
- label: _optionalChain([options, 'optionalAccess', _156 => _156.label]),
8176
- required: _optionalChain([options, 'optionalAccess', _157 => _157.required])
8100
+ label: _optionalChain([options, 'optionalAccess', _140 => _140.label]),
8101
+ required: _optionalChain([options, 'optionalAccess', _141 => _141.required])
8177
8102
  };
8178
8103
  this.rowData.fields.push(field);
8179
8104
  return this;
@@ -8532,7 +8457,7 @@ var WorkflowBuilder = class {
8532
8457
  * @param options - Slot configuration
8533
8458
  */
8534
8459
  slot(id, objectName, options) {
8535
- if (_optionalChain([this, 'access', _158 => _158.data, 'access', _159 => _159.slots, 'optionalAccess', _160 => _160.some, 'call', _161 => _161((s) => s.id === id)])) {
8460
+ if (_optionalChain([this, 'access', _142 => _142.data, 'access', _143 => _143.slots, 'optionalAccess', _144 => _144.some, 'call', _145 => _145((s) => s.id === id)])) {
8536
8461
  throw new Error(`[WorkflowBuilder] Duplicate slot id: "${id}"`);
8537
8462
  }
8538
8463
  const slot = {
@@ -8543,7 +8468,7 @@ var WorkflowBuilder = class {
8543
8468
  color: options.color,
8544
8469
  icon: options.icon
8545
8470
  };
8546
- _optionalChain([this, 'access', _162 => _162.data, 'access', _163 => _163.slots, 'optionalAccess', _164 => _164.push, 'call', _165 => _165(slot)]);
8471
+ _optionalChain([this, 'access', _146 => _146.data, 'access', _147 => _147.slots, 'optionalAccess', _148 => _148.push, 'call', _149 => _149(slot)]);
8547
8472
  return this;
8548
8473
  }
8549
8474
  // ============================================================================
@@ -8670,7 +8595,7 @@ var WorkflowBuilder = class {
8670
8595
  }
8671
8596
  }
8672
8597
  validateSlotReferences() {
8673
- const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _166 => _166.data, 'access', _167 => _167.slots, 'optionalAccess', _168 => _168.reduce, 'call', _169 => _169((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
8598
+ const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _150 => _150.data, 'access', _151 => _151.slots, 'optionalAccess', _152 => _152.reduce, 'call', _153 => _153((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
8674
8599
  for (const node of Object.values(_nullishCoalesce(this.data.nodes, () => ( {})))) {
8675
8600
  for (const slotId of getNodeSlotIds(node)) {
8676
8601
  if (!slotIds.has(slotId)) {
@@ -8962,7 +8887,7 @@ var ObjectSchemaService = class extends BaseService {
8962
8887
  constructor(adapter, nativeRegistry, options) {
8963
8888
  super(adapter);
8964
8889
  this.nativeRegistry = nativeRegistry;
8965
- this.auditService = _optionalChain([options, 'optionalAccess', _170 => _170.auditService]);
8890
+ this.auditService = _optionalChain([options, 'optionalAccess', _154 => _154.auditService]);
8966
8891
  this.bilateralValidationService = new BilateralValidationService(adapter, this);
8967
8892
  }
8968
8893
  /**
@@ -9205,7 +9130,7 @@ var ObjectSchemaService = class extends BaseService {
9205
9130
  resourceType: "attribute",
9206
9131
  resourceId: attributeId,
9207
9132
  resourceLabel: updatedDbAttr.label,
9208
- objectName: _optionalChain([dbObject, 'optionalAccess', _171 => _171.name]),
9133
+ objectName: _optionalChain([dbObject, 'optionalAccess', _155 => _155.name]),
9209
9134
  objectId: dbAttr.objectId,
9210
9135
  changes
9211
9136
  });
@@ -9216,7 +9141,7 @@ var ObjectSchemaService = class extends BaseService {
9216
9141
  const schema = await this.getObjectSchema(dbAttr.objectId);
9217
9142
  await this.adapter.objectRecords.batchRefreshStatus(
9218
9143
  dbAttr.objectId,
9219
- (values) => _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, values)
9144
+ (values) => _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, values)
9220
9145
  );
9221
9146
  }
9222
9147
  return this.convertDBAttributeToAttribute(updatedDbAttr);
@@ -9238,7 +9163,7 @@ var ObjectSchemaService = class extends BaseService {
9238
9163
  );
9239
9164
  }
9240
9165
  const dbObject = await this.adapter.objects.findById(dbAttr.objectId);
9241
- if (_optionalChain([dbObject, 'optionalAccess', _172 => _172.labelExpression])) {
9166
+ if (_optionalChain([dbObject, 'optionalAccess', _156 => _156.labelExpression])) {
9242
9167
  const usedAttributes = extractAttributeNames(dbObject.labelExpression);
9243
9168
  if (usedAttributes.includes(dbAttr.name)) {
9244
9169
  throw new AttributeInUseError(dbAttr.name, "labelExpression");
@@ -9254,7 +9179,7 @@ var ObjectSchemaService = class extends BaseService {
9254
9179
  resourceType: "attribute",
9255
9180
  resourceId: attributeId,
9256
9181
  resourceLabel: dbAttr.label,
9257
- objectName: _optionalChain([dbObject, 'optionalAccess', _173 => _173.name]),
9182
+ objectName: _optionalChain([dbObject, 'optionalAccess', _157 => _157.name]),
9258
9183
  objectId: dbAttr.objectId
9259
9184
  });
9260
9185
  }
@@ -9269,9 +9194,9 @@ var ObjectSchemaService = class extends BaseService {
9269
9194
  async listAttributes(objectId, options) {
9270
9195
  const dbAttributes = await this.adapter.attributes.findByObjectId(objectId);
9271
9196
  let filtered = dbAttributes;
9272
- if (_optionalChain([options, 'optionalAccess', _174 => _174.systemOnly])) {
9197
+ if (_optionalChain([options, 'optionalAccess', _158 => _158.systemOnly])) {
9273
9198
  filtered = dbAttributes.filter((attr) => attr.system);
9274
- } else if (_optionalChain([options, 'optionalAccess', _175 => _175.customOnly])) {
9199
+ } else if (_optionalChain([options, 'optionalAccess', _159 => _159.customOnly])) {
9275
9200
  filtered = dbAttributes.filter((attr) => !attr.system);
9276
9201
  }
9277
9202
  return filtered.map((attr) => this.convertDBAttributeToAttribute(attr));
@@ -9307,14 +9232,14 @@ var ObjectSchemaService = class extends BaseService {
9307
9232
  pluralLabel: dbObject.pluralLabel,
9308
9233
  description: dbObject.description,
9309
9234
  labelExpression: dbObject.labelExpression,
9310
- icon: _optionalChain([dbObject, 'access', _176 => _176.metadata, 'optionalAccess', _177 => _177.icon])
9235
+ icon: _optionalChain([dbObject, 'access', _160 => _160.metadata, 'optionalAccess', _161 => _161.icon])
9311
9236
  };
9312
9237
  let metadata = dbObject.metadata;
9313
9238
  if (updates.icon !== void 0 || updates.metadata !== void 0) {
9314
9239
  metadata = {
9315
9240
  ...dbObject.metadata,
9316
9241
  ...updates.metadata,
9317
- icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _178 => _178.metadata, 'optionalAccess', _179 => _179.icon])))
9242
+ icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _162 => _162.metadata, 'optionalAccess', _163 => _163.icon])))
9318
9243
  };
9319
9244
  }
9320
9245
  const updatedDbObject = await this.adapter.objects.update(objectId, {
@@ -9570,7 +9495,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9570
9495
  let properties = inverseDbAttr.config.properties;
9571
9496
  if (!properties) {
9572
9497
  const nativeObj = this.nativeRegistry.getByName(bilateral.object);
9573
- const nativeAttr = _optionalChain([nativeObj, 'optionalAccess', _180 => _180.attributes, 'access', _181 => _181.find, 'call', _182 => _182((a) => a.name === bilateral.attribute)]);
9498
+ const nativeAttr = _optionalChain([nativeObj, 'optionalAccess', _164 => _164.attributes, 'access', _165 => _165.find, 'call', _166 => _166((a) => a.name === bilateral.attribute)]);
9574
9499
  if (nativeAttr && "properties" in nativeAttr) {
9575
9500
  properties = nativeAttr.properties;
9576
9501
  }
@@ -9659,7 +9584,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9659
9584
  label: dbObject.label,
9660
9585
  pluralLabel: dbObject.pluralLabel,
9661
9586
  description: dbObject.description,
9662
- icon: _optionalChain([dbObject, 'access', _183 => _183.metadata, 'optionalAccess', _184 => _184.icon]),
9587
+ icon: _optionalChain([dbObject, 'access', _167 => _167.metadata, 'optionalAccess', _168 => _168.icon]),
9663
9588
  labelExpression: dbObject.labelExpression,
9664
9589
  attributes,
9665
9590
  system: dbObject.system,
@@ -9693,7 +9618,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9693
9618
  }
9694
9619
  }
9695
9620
  try {
9696
- return _chunkHUT6HYXJjs.parseAttributeConfig.call(void 0, attribute.type, configInput);
9621
+ return _chunkZW4N6FV7js.parseAttributeConfig.call(void 0, attribute.type, configInput);
9697
9622
  } catch (error2) {
9698
9623
  if (error2 instanceof Error) {
9699
9624
  throw new Error(`Invalid config for ${attribute.type} attribute: ${error2.message}`);
@@ -9759,7 +9684,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9759
9684
  const hasRelationToTarget = attrs.some((attr) => {
9760
9685
  if (attr.type !== "relation") return false;
9761
9686
  const config = attr.config;
9762
- return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _185 => _185.targets, 'optionalAccess', _186 => _186.some, 'call', _187 => _187((t) => t.object === targetObjectName)]), () => ( false));
9687
+ return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _169 => _169.targets, 'optionalAccess', _170 => _170.some, 'call', _171 => _171((t) => t.object === targetObjectName)]), () => ( false));
9763
9688
  });
9764
9689
  if (hasRelationToTarget) {
9765
9690
  referencing.push(obj.name);
@@ -9837,7 +9762,7 @@ Native objects must have system=true. Did you forget to call .system() in your b
9837
9762
  const existing = this.objects.get(object2.name);
9838
9763
  throw new Error(
9839
9764
  `[NativeObjectRegistry] Duplicate object name "${object2.name}":
9840
- - Existing: "${_optionalChain([existing, 'optionalAccess', _188 => _188.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _189 => _189.id])})
9765
+ - Existing: "${_optionalChain([existing, 'optionalAccess', _172 => _172.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _173 => _173.id])})
9841
9766
  - New: "${object2.label}" (id: ${object2.id})
9842
9767
  Please use unique names for each native object.`
9843
9768
  );
@@ -9954,7 +9879,7 @@ var AuditService = class extends BaseService {
9954
9879
  this.isFlushing = false;
9955
9880
  /** Pending flush promise to allow waiting on concurrent flush */
9956
9881
  this.flushPromise = null;
9957
- if (_optionalChain([options, 'optionalAccess', _190 => _190.async]) && options.flushIntervalMs) {
9882
+ if (_optionalChain([options, 'optionalAccess', _174 => _174.async]) && options.flushIntervalMs) {
9958
9883
  this.startFlushTimer();
9959
9884
  }
9960
9885
  }
@@ -10152,7 +10077,7 @@ var AuditService = class extends BaseService {
10152
10077
  return;
10153
10078
  }
10154
10079
  const resolved = await this.resolveActorEmail(entry);
10155
- if (_optionalChain([this, 'access', _191 => _191.options, 'optionalAccess', _192 => _192.async])) {
10080
+ if (_optionalChain([this, 'access', _175 => _175.options, 'optionalAccess', _176 => _176.async])) {
10156
10081
  this.buffer.push(resolved);
10157
10082
  const batchSize = _nullishCoalesce(this.options.batchSize, () => ( 10));
10158
10083
  if (this.buffer.length >= batchSize) {
@@ -10169,7 +10094,7 @@ var AuditService = class extends BaseService {
10169
10094
  if (!entry.actorEmail && entry.actorId) {
10170
10095
  try {
10171
10096
  const profile = await this.adapter.userProfiles.findById(entry.actorId);
10172
- if (_optionalChain([profile, 'optionalAccess', _193 => _193.email])) {
10097
+ if (_optionalChain([profile, 'optionalAccess', _177 => _177.email])) {
10173
10098
  return { ...entry, actorEmail: profile.email };
10174
10099
  }
10175
10100
  } catch (e13) {
@@ -10181,7 +10106,7 @@ var AuditService = class extends BaseService {
10181
10106
  * Start the flush timer for async mode
10182
10107
  */
10183
10108
  startFlushTimer() {
10184
- const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _194 => _194.options, 'optionalAccess', _195 => _195.flushIntervalMs]), () => ( 1e3));
10109
+ const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.flushIntervalMs]), () => ( 1e3));
10185
10110
  this.flushTimer = setInterval(() => {
10186
10111
  this.flush().catch(() => {
10187
10112
  });
@@ -10211,7 +10136,7 @@ var browserStub4 = {
10211
10136
  run: (_store, callback) => callback()
10212
10137
  };
10213
10138
  var AsyncLocalStorageClass4 = null;
10214
- if (typeof process !== "undefined" && _optionalChain([process, 'access', _196 => _196.versions, 'optionalAccess', _197 => _197.node])) {
10139
+ if (typeof process !== "undefined" && _optionalChain([process, 'access', _180 => _180.versions, 'optionalAccess', _181 => _181.node])) {
10215
10140
  try {
10216
10141
  if (typeof _chunk3RG5ZIWIjs.__require !== "undefined") {
10217
10142
  const asyncHooks = _chunk3RG5ZIWIjs.__require.call(void 0, "async_hooks");
@@ -10270,7 +10195,7 @@ var BilateralSyncService = class extends BaseService {
10270
10195
  }
10271
10196
  const ctx = getSyncContext().getStore();
10272
10197
  const syncKey = `${sourceSchema.name}:${sourceRecordId}:${attributeName}`;
10273
- if (_optionalChain([ctx, 'optionalAccess', _198 => _198.syncing, 'access', _199 => _199.has, 'call', _200 => _200(syncKey)])) {
10198
+ if (_optionalChain([ctx, 'optionalAccess', _182 => _182.syncing, 'access', _183 => _183.has, 'call', _184 => _184(syncKey)])) {
10274
10199
  return;
10275
10200
  }
10276
10201
  await this.runWithSyncContext(syncKey, async () => {
@@ -10303,6 +10228,7 @@ var BilateralSyncService = class extends BaseService {
10303
10228
  const addedIds = newData.ids.filter((id) => !oldData.ids.includes(id));
10304
10229
  const removedIds = oldData.ids.filter((id) => !newData.ids.includes(id));
10305
10230
  const commonIds = newData.ids.filter((id) => oldData.ids.includes(id));
10231
+ const inverseMappings = this.buildInverseMappings(sourceAttr);
10306
10232
  await Promise.all([
10307
10233
  // Add new relations
10308
10234
  ...addedIds.map(
@@ -10312,7 +10238,9 @@ var BilateralSyncService = class extends BaseService {
10312
10238
  sourceRecordId,
10313
10239
  sourceSchema.name,
10314
10240
  sourceAttr.name,
10315
- newData.properties.get(targetId)
10241
+ newData.properties.get(targetId),
10242
+ inverseMappings,
10243
+ bilateral
10316
10244
  )
10317
10245
  ),
10318
10246
  // Remove deleted relations
@@ -10328,7 +10256,9 @@ var BilateralSyncService = class extends BaseService {
10328
10256
  sourceSchema.name,
10329
10257
  sourceAttr.name,
10330
10258
  newData.properties.get(targetId),
10331
- oldData.properties.get(targetId)
10259
+ oldData.properties.get(targetId),
10260
+ inverseMappings,
10261
+ bilateral
10332
10262
  )
10333
10263
  )
10334
10264
  ]);
@@ -10372,7 +10302,7 @@ var BilateralSyncService = class extends BaseService {
10372
10302
  * Add an ID to an inverse relation (with properties).
10373
10303
  * @private
10374
10304
  */
10375
- async addInverseRelation(targetRecordId, inverseAttr, sourceRecordId, sourceObject, sourceAttribute, properties) {
10305
+ async addInverseRelation(targetRecordId, inverseAttr, sourceRecordId, sourceObject, sourceAttribute, properties, inverseMappings, bilateral) {
10376
10306
  const targetRecord = await this.adapter.objectRecords.findById(targetRecordId);
10377
10307
  if (!targetRecord) {
10378
10308
  return;
@@ -10403,14 +10333,27 @@ var BilateralSyncService = class extends BaseService {
10403
10333
  this.adapter
10404
10334
  );
10405
10335
  }
10336
+ if (inverseMappings && bilateral) {
10337
+ const invertedProps = this.invertProperties(properties, inverseMappings);
10338
+ const targetSchemaObj = await this.schemaService.getObjectSchemaByName(bilateral.object);
10339
+ if (targetSchemaObj) {
10340
+ await this.relationPropertiesService.syncRelationProperties(
10341
+ targetSchemaObj,
10342
+ targetRecordId,
10343
+ bilateral.attribute,
10344
+ [{ id: sourceRecordId, props: invertedProps }],
10345
+ this.adapter
10346
+ );
10347
+ }
10348
+ }
10406
10349
  }
10407
10350
  }
10408
10351
  /**
10409
10352
  * Update properties of an existing inverse relation.
10410
10353
  * @private
10411
10354
  */
10412
- async updateInverseRelationProperties(targetRecordId, _inverseAttr, sourceRecordId, sourceObject, sourceAttribute, newProperties, oldProperties) {
10413
- if (JSON.stringify(newProperties) === JSON.stringify(oldProperties)) {
10355
+ async updateInverseRelationProperties(targetRecordId, _inverseAttr, sourceRecordId, sourceObject, sourceAttribute, newProperties, oldProperties, inverseMappings, bilateral) {
10356
+ if (_chunkE6XO2STSjs.deepEqual.call(void 0, newProperties, oldProperties)) {
10414
10357
  return;
10415
10358
  }
10416
10359
  if (!this.adapter.relationAttributes) {
@@ -10428,12 +10371,32 @@ var BilateralSyncService = class extends BaseService {
10428
10371
  [{ id: targetRecordId, props: newProperties }],
10429
10372
  this.adapter
10430
10373
  );
10374
+ if (inverseMappings && bilateral) {
10375
+ const invertedProps = this.invertProperties(newProperties, inverseMappings);
10376
+ const targetSchemaObj = await this.schemaService.getObjectSchemaByName(bilateral.object);
10377
+ if (targetSchemaObj) {
10378
+ await this.relationPropertiesService.syncRelationProperties(
10379
+ targetSchemaObj,
10380
+ targetRecordId,
10381
+ bilateral.attribute,
10382
+ [{ id: sourceRecordId, props: invertedProps }],
10383
+ this.adapter
10384
+ );
10385
+ }
10386
+ }
10431
10387
  } else {
10432
10388
  await this.adapter.relationAttributes.deleteBySource(
10433
10389
  sourceObject,
10434
10390
  sourceRecordId,
10435
10391
  sourceAttribute
10436
10392
  );
10393
+ if (bilateral) {
10394
+ await this.adapter.relationAttributes.deleteBySource(
10395
+ bilateral.object,
10396
+ targetRecordId,
10397
+ bilateral.attribute
10398
+ );
10399
+ }
10437
10400
  }
10438
10401
  }
10439
10402
  /**
@@ -10465,6 +10428,54 @@ var BilateralSyncService = class extends BaseService {
10465
10428
  });
10466
10429
  await this.invalidateTargetRecordCaches(targetRecordId, targetRecord.objectId);
10467
10430
  }
10431
+ /**
10432
+ * Build inverse value mappings from property definitions.
10433
+ * Scans all select/status properties for options with `inverse` field.
10434
+ * @returns Map<propertyName, Map<sourceValue, inverseValue>>
10435
+ * @private
10436
+ */
10437
+ buildInverseMappings(sourceAttr) {
10438
+ const mappings = /* @__PURE__ */ new Map();
10439
+ const definitions = _optionalChain([sourceAttr, 'access', _185 => _185.properties, 'optionalAccess', _186 => _186.definitions]);
10440
+ if (!definitions) return mappings;
10441
+ for (const def of definitions) {
10442
+ if (!hasOptions2(def)) continue;
10443
+ const options = def.options;
10444
+ const valueMap = /* @__PURE__ */ new Map();
10445
+ for (const option of options) {
10446
+ if (option.inverse) {
10447
+ valueMap.set(option.value, option.inverse);
10448
+ }
10449
+ }
10450
+ if (valueMap.size > 0) {
10451
+ mappings.set(def.name, valueMap);
10452
+ }
10453
+ }
10454
+ return mappings;
10455
+ }
10456
+ /**
10457
+ * Apply inverse mappings to a set of properties.
10458
+ * Properties without a mapping are copied as-is.
10459
+ * @private
10460
+ */
10461
+ invertProperties(props, mappings) {
10462
+ const result = {};
10463
+ for (const [key, value] of Object.entries(props)) {
10464
+ const valueMap = mappings.get(key);
10465
+ if (!valueMap) {
10466
+ result[key] = value;
10467
+ } else if (typeof value === "string") {
10468
+ result[key] = _nullishCoalesce(valueMap.get(value), () => ( value));
10469
+ } else if (Array.isArray(value)) {
10470
+ result[key] = value.map(
10471
+ (v) => typeof v === "string" ? _nullishCoalesce(valueMap.get(v), () => ( v)) : v
10472
+ );
10473
+ } else {
10474
+ result[key] = value;
10475
+ }
10476
+ }
10477
+ return result;
10478
+ }
10468
10479
  /**
10469
10480
  * Normalize a relation value to an array of IDs.
10470
10481
  * @private
@@ -10495,7 +10506,7 @@ var BilateralSyncService = class extends BaseService {
10495
10506
  const storage = getSyncContext();
10496
10507
  const existingCtx = storage.getStore();
10497
10508
  const ctx = {
10498
- syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess', _201 => _201.syncing]), () => ( [])))
10509
+ syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess', _187 => _187.syncing]), () => ( [])))
10499
10510
  };
10500
10511
  ctx.syncing.add(syncKey);
10501
10512
  return await storage.run(ctx, fn);
@@ -10603,7 +10614,7 @@ var UserService = class extends BaseService {
10603
10614
  if (roleErrors.length > 0) {
10604
10615
  errors.push({
10605
10616
  attribute: attrName,
10606
- message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _202 => _202.allowedRoles, 'optionalAccess', _203 => _203.join, 'call', _204 => _204(", ")])}`,
10617
+ message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _188 => _188.allowedRoles, 'optionalAccess', _189 => _189.join, 'call', _190 => _190(", ")])}`,
10607
10618
  invalidIds: roleErrors
10608
10619
  });
10609
10620
  }
@@ -11133,7 +11144,7 @@ var RelationPropertiesService = class extends BaseService {
11133
11144
  }
11134
11145
  }
11135
11146
  }
11136
- const shouldStoreAsInverse = _optionalChain([attribute, 'access', _205 => _205.bilateral, 'optionalAccess', _206 => _206.storageOwner]) === false;
11147
+ const shouldStoreAsInverse = _optionalChain([attribute, 'access', _191 => _191.bilateral, 'optionalAccess', _192 => _192.storageOwner]) === false;
11137
11148
  let storageFromObject = schema.name;
11138
11149
  let storageFromAttribute = attributeName;
11139
11150
  if (shouldStoreAsInverse && attribute.bilateral) {
@@ -11145,7 +11156,7 @@ var RelationPropertiesService = class extends BaseService {
11145
11156
  if (shouldStoreAsInverse) {
11146
11157
  const results = await Promise.all(
11147
11158
  normalized.map(
11148
- (item) => _optionalChain([adapter, 'access', _207 => _207.relationAttributes, 'optionalAccess', _208 => _208.findBySource, 'call', _209 => _209(
11159
+ (item) => _optionalChain([adapter, 'access', _193 => _193.relationAttributes, 'optionalAccess', _194 => _194.findBySource, 'call', _195 => _195(
11149
11160
  storageFromObject,
11150
11161
  item.id,
11151
11162
  storageFromAttribute
@@ -11272,7 +11283,7 @@ var RelationPropertiesService = class extends BaseService {
11272
11283
  buildZodSchema(propertySchema) {
11273
11284
  const shape = {};
11274
11285
  for (const def of propertySchema.definitions) {
11275
- shape[def.name] = _chunkHUT6HYXJjs.createFormAttributeValidator.call(void 0, def);
11286
+ shape[def.name] = _chunkZW4N6FV7js.createFormAttributeValidator.call(void 0, def);
11276
11287
  }
11277
11288
  return _zod.z.object(shape);
11278
11289
  }
@@ -11284,7 +11295,7 @@ var RecordQueryService = class extends BaseService {
11284
11295
  super(adapter);
11285
11296
  this.schemaService = schemaService;
11286
11297
  this.options = options;
11287
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _210 => _210.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _211 => _211.policyRegistry]), () => ( defaultPolicyRegistry));
11298
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _196 => _196.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _197 => _197.policyRegistry]), () => ( defaultPolicyRegistry));
11288
11299
  this.relationPropertiesService = new RelationPropertiesService(adapter);
11289
11300
  }
11290
11301
  // ============================================================================
@@ -11335,12 +11346,12 @@ var RecordQueryService = class extends BaseService {
11335
11346
  * Internal list query execution
11336
11347
  */
11337
11348
  async executeListQuery(schema, objectId, options) {
11338
- if (_optionalChain([this, 'access', _212 => _212.options, 'optionalAccess', _213 => _213.permissionService]) && this.userId) {
11349
+ if (_optionalChain([this, 'access', _198 => _198.options, 'optionalAccess', _199 => _199.permissionService]) && this.userId) {
11339
11350
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
11340
11351
  }
11341
- const policy = _optionalChain([options, 'optionalAccess', _214 => _214.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
11352
+ const policy = _optionalChain([options, 'optionalAccess', _200 => _200.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
11342
11353
  let effectiveOptions = options;
11343
- if (_optionalChain([policy, 'optionalAccess', _215 => _215.applyListFilter]) && this.userId) {
11354
+ if (_optionalChain([policy, 'optionalAccess', _201 => _201.applyListFilter]) && this.userId) {
11344
11355
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
11345
11356
  effectiveOptions = policy.applyListFilter(ctx, options);
11346
11357
  }
@@ -11350,10 +11361,10 @@ var RecordQueryService = class extends BaseService {
11350
11361
  );
11351
11362
  let filteredRecords = result.records;
11352
11363
  let effectiveTotal = result.total;
11353
- if (_optionalChain([policy, 'optionalAccess', _216 => _216.canAccessRecord]) && this.userId) {
11364
+ if (_optionalChain([policy, 'optionalAccess', _202 => _202.canAccessRecord]) && this.userId) {
11354
11365
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
11355
- const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _217 => _217.limit]), () => ( 20));
11356
- const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _218 => _218.offset]), () => ( 0));
11366
+ const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _203 => _203.limit]), () => ( 20));
11367
+ const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _204 => _204.offset]), () => ( 0));
11357
11368
  const overfetchMultiplier = 5;
11358
11369
  const batchSize = requestedLimit * overfetchMultiplier;
11359
11370
  const maxScanRecords = 1e4;
@@ -11375,7 +11386,7 @@ var RecordQueryService = class extends BaseService {
11375
11386
  exhausted = true;
11376
11387
  break;
11377
11388
  }
11378
- const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _219 => _219.canAccessRecord, 'optionalCall', _220 => _220(ctx, record)]));
11389
+ const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _205 => _205.canAccessRecord, 'optionalCall', _206 => _206(ctx, record)]));
11379
11390
  collected.push(...filtered);
11380
11391
  dbOffset += batch.records.length;
11381
11392
  totalScanned += batch.records.length;
@@ -11391,7 +11402,7 @@ var RecordQueryService = class extends BaseService {
11391
11402
  filteredRecords,
11392
11403
  schema
11393
11404
  );
11394
- if (!_optionalChain([options, 'optionalAccess', _221 => _221.skipFormulas])) {
11405
+ if (!_optionalChain([options, 'optionalAccess', _207 => _207.skipFormulas])) {
11395
11406
  return {
11396
11407
  records: enrichRecordsWithFormulas(filteredRecords, schema),
11397
11408
  total: effectiveTotal
@@ -11451,17 +11462,17 @@ var RecordQueryService = class extends BaseService {
11451
11462
  * Internal search query execution
11452
11463
  */
11453
11464
  async executeSearchQuery(schema, objectId, query, options) {
11454
- if (_optionalChain([this, 'access', _222 => _222.options, 'optionalAccess', _223 => _223.permissionService]) && this.userId) {
11465
+ if (_optionalChain([this, 'access', _208 => _208.options, 'optionalAccess', _209 => _209.permissionService]) && this.userId) {
11455
11466
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
11456
11467
  }
11457
11468
  let result;
11458
11469
  if (this.adapter.search) {
11459
11470
  try {
11460
11471
  result = await this.adapter.search.searchRecords(objectId, query, {
11461
- limit: _optionalChain([options, 'optionalAccess', _224 => _224.limit]),
11462
- offset: _optionalChain([options, 'optionalAccess', _225 => _225.offset]),
11463
- sorts: _optionalChain([options, 'optionalAccess', _226 => _226.sorts]),
11464
- filters: _optionalChain([options, 'optionalAccess', _227 => _227.filters]),
11472
+ limit: _optionalChain([options, 'optionalAccess', _210 => _210.limit]),
11473
+ offset: _optionalChain([options, 'optionalAccess', _211 => _211.offset]),
11474
+ sorts: _optionalChain([options, 'optionalAccess', _212 => _212.sorts]),
11475
+ filters: _optionalChain([options, 'optionalAccess', _213 => _213.filters]),
11465
11476
  attributes: schema.attributes
11466
11477
  });
11467
11478
  result = await this.healSearchResults(result);
@@ -11481,7 +11492,7 @@ var RecordQueryService = class extends BaseService {
11481
11492
  result.records,
11482
11493
  schema
11483
11494
  );
11484
- if (!_optionalChain([options, 'optionalAccess', _228 => _228.skipFormulas])) {
11495
+ if (!_optionalChain([options, 'optionalAccess', _214 => _214.skipFormulas])) {
11485
11496
  return {
11486
11497
  records: enrichRecordsWithFormulas(enrichedRecords, schema),
11487
11498
  total: result.total
@@ -11690,7 +11701,7 @@ var RelationService = class extends BaseService {
11690
11701
  }
11691
11702
  const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
11692
11703
  const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
11693
- if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _229 => _229.size]) === 0) {
11704
+ if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _215 => _215.size]) === 0) {
11694
11705
  errors.push({
11695
11706
  attribute: attr.name,
11696
11707
  message: `No valid target objects found for ${attr.label}`
@@ -11743,7 +11754,7 @@ var RelationService = class extends BaseService {
11743
11754
  for (const target of targets) {
11744
11755
  try {
11745
11756
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
11746
- if (_optionalChain([objectSchema, 'optionalAccess', _230 => _230.id])) {
11757
+ if (_optionalChain([objectSchema, 'optionalAccess', _216 => _216.id])) {
11747
11758
  objectIds.add(objectSchema.id);
11748
11759
  }
11749
11760
  } catch (e17) {
@@ -11812,7 +11823,7 @@ var RelationService = class extends BaseService {
11812
11823
  const targetResults = await Promise.all(
11813
11824
  filteredTargets.map(async (target) => {
11814
11825
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
11815
- if (!_optionalChain([objectSchema, 'optionalAccess', _231 => _231.id])) return { options: [], total: 0 };
11826
+ if (!_optionalChain([objectSchema, 'optionalAccess', _217 => _217.id])) return { options: [], total: 0 };
11816
11827
  const objectId = objectSchema.id;
11817
11828
  const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
11818
11829
  const options = await Promise.all(
@@ -11969,8 +11980,8 @@ var RelationService = class extends BaseService {
11969
11980
  continue;
11970
11981
  }
11971
11982
  const attribute = attributeMap.get(attributeId);
11972
- const targetConfig = _optionalChain([attribute, 'optionalAccess', _232 => _232.targets, 'optionalAccess', _233 => _233.find, 'call', _234 => _234((t) => t.object === objectSchema.name)]);
11973
- const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _235 => _235.displayTemplate]);
11983
+ const targetConfig = _optionalChain([attribute, 'optionalAccess', _218 => _218.targets, 'optionalAccess', _219 => _219.find, 'call', _220 => _220((t) => t.object === objectSchema.name)]);
11984
+ const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _221 => _221.displayTemplate]);
11974
11985
  const label = await this.resolveLabel(record, objectSchema, customTemplate);
11975
11986
  resolved.push({
11976
11987
  _compositeId: compositeId,
@@ -12133,14 +12144,14 @@ var RollupService = class extends BaseService {
12133
12144
  const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
12134
12145
  let sourceObjectId;
12135
12146
  let reverseRelationAttrName;
12136
- if (_optionalChain([sourceSchema, 'optionalAccess', _236 => _236.id])) {
12147
+ if (_optionalChain([sourceSchema, 'optionalAccess', _222 => _222.id])) {
12137
12148
  sourceObjectId = sourceSchema.id;
12138
12149
  const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
12139
12150
  if (attr.type !== "relation") return false;
12140
12151
  const relationConfig = attr;
12141
- return _optionalChain([relationConfig, 'optionalAccess', _237 => _237.targets, 'optionalAccess', _238 => _238.some, 'call', _239 => _239((t) => t.object === schema.name)]);
12152
+ return _optionalChain([relationConfig, 'optionalAccess', _223 => _223.targets, 'optionalAccess', _224 => _224.some, 'call', _225 => _225((t) => t.object === schema.name)]);
12142
12153
  });
12143
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _240 => _240.name]);
12154
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _226 => _226.name]);
12144
12155
  } else {
12145
12156
  const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
12146
12157
  if (!sourceObject) {
@@ -12151,9 +12162,9 @@ var RollupService = class extends BaseService {
12151
12162
  const reverseRelationAttr = sourceAttributes.find((attr) => {
12152
12163
  if (attr.type !== "relation") return false;
12153
12164
  const relationConfig = attr.config;
12154
- return _optionalChain([relationConfig, 'optionalAccess', _241 => _241.targets, 'optionalAccess', _242 => _242.some, 'call', _243 => _243((t) => t.object === schema.name)]);
12165
+ return _optionalChain([relationConfig, 'optionalAccess', _227 => _227.targets, 'optionalAccess', _228 => _228.some, 'call', _229 => _229((t) => t.object === schema.name)]);
12155
12166
  });
12156
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _244 => _244.name]);
12167
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _230 => _230.name]);
12157
12168
  }
12158
12169
  if (!reverseRelationAttrName) {
12159
12170
  return { value: null, recordCount: 0 };
@@ -12409,13 +12420,13 @@ var RollupService = class extends BaseService {
12409
12420
  if (!obj) continue;
12410
12421
  for (const rollupDbAttr of rollupAttrs) {
12411
12422
  const rollupConfig = rollupDbAttr.config;
12412
- if (!_optionalChain([rollupConfig, 'optionalAccess', _245 => _245.relationAttribute])) continue;
12423
+ if (!_optionalChain([rollupConfig, 'optionalAccess', _231 => _231.relationAttribute])) continue;
12413
12424
  const relationAttr = attributes.find(
12414
12425
  (a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
12415
12426
  );
12416
12427
  if (!relationAttr) continue;
12417
12428
  const relationConfig = relationAttr.config;
12418
- const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _246 => _246.targets, 'optionalAccess', _247 => _247.some, 'call', _248 => _248(
12429
+ const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _232 => _232.targets, 'optionalAccess', _233 => _233.some, 'call', _234 => _234(
12419
12430
  (t) => t.object === changedSchema.name
12420
12431
  )]);
12421
12432
  if (!targetsChangedObject) continue;
@@ -12440,11 +12451,11 @@ var RecordService = class extends BaseService {
12440
12451
  constructor(adapter, options) {
12441
12452
  super(adapter);
12442
12453
  this.schemaService = new ObjectSchemaService(adapter, registry, {
12443
- auditService: _optionalChain([options, 'optionalAccess', _249 => _249.auditService])
12454
+ auditService: _optionalChain([options, 'optionalAccess', _235 => _235.auditService])
12444
12455
  });
12445
- this.permissionService = _optionalChain([options, 'optionalAccess', _250 => _250.permissionService]);
12446
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _251 => _251.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
12447
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _252 => _252.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _253 => _253.policyRegistry]), () => ( defaultPolicyRegistry));
12456
+ this.permissionService = _optionalChain([options, 'optionalAccess', _236 => _236.permissionService]);
12457
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _237 => _237.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
12458
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _238 => _238.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _239 => _239.policyRegistry]), () => ( defaultPolicyRegistry));
12448
12459
  this.recordResolver = new RecordResolverService(adapter);
12449
12460
  this.queryService = new RecordQueryService(adapter, this.schemaService, {
12450
12461
  permissionService: this.permissionService,
@@ -12459,7 +12470,7 @@ var RecordService = class extends BaseService {
12459
12470
  recordResolver: this.recordResolver
12460
12471
  });
12461
12472
  this.userService = new UserService(adapter);
12462
- this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _254 => _254.hookRegistry]), () => ( new NoopHookRegistry()));
12473
+ this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _240 => _240.hookRegistry]), () => ( new NoopHookRegistry()));
12463
12474
  this.bilateralSyncService = new BilateralSyncService(
12464
12475
  adapter,
12465
12476
  this.schemaService,
@@ -12499,41 +12510,41 @@ var RecordService = class extends BaseService {
12499
12510
  schema,
12500
12511
  this.tenantId,
12501
12512
  dataWithDefaults,
12502
- _optionalChain([options, 'optionalAccess', _255 => _255.hookMetadata])
12513
+ _optionalChain([options, 'optionalAccess', _241 => _241.hookMetadata])
12503
12514
  );
12504
- if (!_optionalChain([options, 'optionalAccess', _256 => _256.skipHooks])) {
12515
+ if (!_optionalChain([options, 'optionalAccess', _242 => _242.skipHooks])) {
12505
12516
  await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
12506
12517
  }
12507
12518
  const normalizedData = this.relationPropertiesService.normalizeRelationValuesForStorage(
12508
12519
  schema,
12509
12520
  dataWithDefaults
12510
12521
  );
12511
- if (_optionalChain([options, 'optionalAccess', _257 => _257.validate]) !== false) {
12512
- if (_optionalChain([options, 'optionalAccess', _258 => _258.allowDraft])) {
12513
- _chunkHUT6HYXJjs.validateDraftOrThrow.call(void 0, schema, normalizedData);
12522
+ if (_optionalChain([options, 'optionalAccess', _243 => _243.validate]) !== false) {
12523
+ if (_optionalChain([options, 'optionalAccess', _244 => _244.allowDraft])) {
12524
+ _chunkZW4N6FV7js.validateDraftOrThrow.call(void 0, schema, normalizedData);
12514
12525
  } else {
12515
- _chunkHUT6HYXJjs.validateObjectOrThrow.call(void 0, schema, normalizedData);
12526
+ _chunkZW4N6FV7js.validateObjectOrThrow.call(void 0, schema, normalizedData);
12516
12527
  }
12517
- if (!_optionalChain([options, 'optionalAccess', _259 => _259.skipRelationValidation])) {
12528
+ if (!_optionalChain([options, 'optionalAccess', _245 => _245.skipRelationValidation])) {
12518
12529
  await this.relationService.validateRelationsOrThrow(schema, normalizedData);
12519
12530
  }
12520
- if (!_optionalChain([options, 'optionalAccess', _260 => _260.skipUserValidation])) {
12531
+ if (!_optionalChain([options, 'optionalAccess', _246 => _246.skipUserValidation])) {
12521
12532
  await this.userService.validateUsersOrThrow(schema, normalizedData);
12522
12533
  }
12523
12534
  }
12524
- const completionStatus = _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, normalizedData);
12535
+ const completionStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, normalizedData);
12525
12536
  const label = await computeLabel(schema, normalizedData, this.labelResolver);
12526
12537
  const record = await this.adapter.objectRecords.create({
12527
12538
  objectId,
12528
12539
  data: normalizedData,
12529
12540
  label,
12530
12541
  completionStatus,
12531
- metadata: _optionalChain([options, 'optionalAccess', _261 => _261.metadata]),
12542
+ metadata: _optionalChain([options, 'optionalAccess', _247 => _247.metadata]),
12532
12543
  createdBy: this.userId
12533
12544
  });
12534
12545
  for (const [attrName, value] of Object.entries(dataWithDefaults)) {
12535
12546
  const attr = schema.attributes.find((a) => a.name === attrName);
12536
- if (_optionalChain([attr, 'optionalAccess', _262 => _262.type]) === "relation") {
12547
+ if (_optionalChain([attr, 'optionalAccess', _248 => _248.type]) === "relation") {
12537
12548
  const hasProperties2 = attr.properties !== void 0;
12538
12549
  const isBilateral = isBilateralRelation(attr);
12539
12550
  if (hasProperties2 || isBilateral) {
@@ -12547,9 +12558,9 @@ var RecordService = class extends BaseService {
12547
12558
  }
12548
12559
  }
12549
12560
  }
12550
- for (const [attrName, value] of Object.entries(normalizedData)) {
12561
+ for (const [attrName, value] of Object.entries(dataWithDefaults)) {
12551
12562
  const attr = schema.attributes.find((a) => a.name === attrName);
12552
- if (_optionalChain([attr, 'optionalAccess', _263 => _263.type]) === "relation" && isBilateralRelation(attr)) {
12563
+ if (_optionalChain([attr, 'optionalAccess', _249 => _249.type]) === "relation" && isBilateralRelation(attr)) {
12553
12564
  await this.bilateralSyncService.syncBilateralRelation(
12554
12565
  schema,
12555
12566
  record.id,
@@ -12560,7 +12571,7 @@ var RecordService = class extends BaseService {
12560
12571
  );
12561
12572
  }
12562
12573
  }
12563
- if (!_optionalChain([options, 'optionalAccess', _264 => _264.skipHooks])) {
12574
+ if (!_optionalChain([options, 'optionalAccess', _250 => _250.skipHooks])) {
12564
12575
  const afterCtx = {
12565
12576
  ...hookCtx,
12566
12577
  recordId: record.id,
@@ -12570,11 +12581,11 @@ var RecordService = class extends BaseService {
12570
12581
  }
12571
12582
  await recalculateParentRollups(record, schema, this.rollupContext);
12572
12583
  await this.invalidateRecordCaches(record.id, objectId);
12573
- _optionalChain([this, 'access', _265 => _265.adapter, 'access', _266 => _266.search, 'optionalAccess', _267 => _267.indexRecord, 'call', _268 => _268(record, {
12584
+ _optionalChain([this, 'access', _251 => _251.adapter, 'access', _252 => _252.search, 'optionalAccess', _253 => _253.indexRecord, 'call', _254 => _254(record, {
12574
12585
  objectName: schema.name,
12575
12586
  objectLabel: schema.label,
12576
12587
  attributes: schema.attributes
12577
- }), 'access', _269 => _269.catch, 'call', _270 => _270((err) => console.error("[search] Failed to index created record", record.id, err))]);
12588
+ }), 'access', _255 => _255.catch, 'call', _256 => _256((err) => console.error("[search] Failed to index created record", record.id, err))]);
12578
12589
  if (this.auditService && this.userId) {
12579
12590
  this.auditService.logRecordAction({
12580
12591
  action: "record.created",
@@ -12583,7 +12594,7 @@ var RecordService = class extends BaseService {
12583
12594
  objectId: schema.id,
12584
12595
  recordId: record.id,
12585
12596
  recordLabel: record.label,
12586
- metadata: _optionalChain([options, 'optionalAccess', _271 => _271.hookMetadata])
12597
+ metadata: _optionalChain([options, 'optionalAccess', _257 => _257.hookMetadata])
12587
12598
  }).catch(() => {
12588
12599
  });
12589
12600
  }
@@ -12606,7 +12617,7 @@ var RecordService = class extends BaseService {
12606
12617
  return null;
12607
12618
  }
12608
12619
  const schema = await this.schemaService.getObjectSchema(record.objectId);
12609
- if (!_optionalChain([options, 'optionalAccess', _272 => _272.skipPolicyCheck])) {
12620
+ if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipPolicyCheck])) {
12610
12621
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
12611
12622
  if (policy) {
12612
12623
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
@@ -12616,11 +12627,11 @@ var RecordService = class extends BaseService {
12616
12627
  }
12617
12628
  }
12618
12629
  let enrichedRecord = record;
12619
- if (!_optionalChain([options, 'optionalAccess', _273 => _273.skipFormulas])) {
12630
+ if (!_optionalChain([options, 'optionalAccess', _259 => _259.skipFormulas])) {
12620
12631
  enrichedRecord = enrichWithFormulas(record, schema);
12621
12632
  }
12622
12633
  enrichedRecord = await this.enrichRelationProperties(enrichedRecord, schema);
12623
- if (_optionalChain([options, 'optionalAccess', _274 => _274.includeSchema])) {
12634
+ if (_optionalChain([options, 'optionalAccess', _260 => _260.includeSchema])) {
12624
12635
  const recordWithSchema = enrichedRecord;
12625
12636
  recordWithSchema.schema = schema;
12626
12637
  return recordWithSchema;
@@ -12682,9 +12693,9 @@ var RecordService = class extends BaseService {
12682
12693
  existing,
12683
12694
  mergedData,
12684
12695
  changedAttributes,
12685
- _optionalChain([options, 'optionalAccess', _275 => _275.hookMetadata])
12696
+ _optionalChain([options, 'optionalAccess', _261 => _261.hookMetadata])
12686
12697
  );
12687
- if (!_optionalChain([options, 'optionalAccess', _276 => _276.skipHooks])) {
12698
+ if (!_optionalChain([options, 'optionalAccess', _262 => _262.skipHooks])) {
12688
12699
  await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
12689
12700
  }
12690
12701
  const hookModifiedValues = {};
@@ -12699,20 +12710,20 @@ var RecordService = class extends BaseService {
12699
12710
  dataToUpdate
12700
12711
  );
12701
12712
  const normalizedMergedData = { ...existing.values, ...normalizedUpdate };
12702
- if (_optionalChain([options, 'optionalAccess', _277 => _277.validate]) !== false) {
12703
- if (_optionalChain([options, 'optionalAccess', _278 => _278.partial])) {
12704
- _chunkHUT6HYXJjs.validateDraftOrThrow.call(void 0, schema, normalizedMergedData);
12713
+ if (_optionalChain([options, 'optionalAccess', _263 => _263.validate]) !== false) {
12714
+ if (_optionalChain([options, 'optionalAccess', _264 => _264.partial])) {
12715
+ _chunkZW4N6FV7js.validateDraftOrThrow.call(void 0, schema, normalizedMergedData);
12705
12716
  } else {
12706
- _chunkHUT6HYXJjs.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
12717
+ _chunkZW4N6FV7js.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
12707
12718
  }
12708
- if (!_optionalChain([options, 'optionalAccess', _279 => _279.skipRelationValidation])) {
12719
+ if (!_optionalChain([options, 'optionalAccess', _265 => _265.skipRelationValidation])) {
12709
12720
  await this.relationService.validateRelationsOrThrow(schema, normalizedUpdate);
12710
12721
  }
12711
- if (!_optionalChain([options, 'optionalAccess', _280 => _280.skipUserValidation])) {
12722
+ if (!_optionalChain([options, 'optionalAccess', _266 => _266.skipUserValidation])) {
12712
12723
  await this.userService.validateUsersOrThrow(schema, normalizedUpdate);
12713
12724
  }
12714
12725
  }
12715
- const completionStatus = _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, normalizedMergedData);
12726
+ const completionStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, normalizedMergedData);
12716
12727
  const label = await computeLabel(schema, normalizedMergedData, this.labelResolver);
12717
12728
  const updatePayload = {
12718
12729
  ...normalizedUpdate,
@@ -12721,7 +12732,7 @@ var RecordService = class extends BaseService {
12721
12732
  __lastUpdatedBy: this.userId,
12722
12733
  __expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
12723
12734
  };
12724
- if (_optionalChain([options, 'optionalAccess', _281 => _281.metadata]) !== void 0) {
12735
+ if (_optionalChain([options, 'optionalAccess', _267 => _267.metadata]) !== void 0) {
12725
12736
  const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
12726
12737
  const mergedMetadata = { ...existingMetadata, ...options.metadata };
12727
12738
  const cleanedMetadata = Object.fromEntries(
@@ -12732,20 +12743,20 @@ var RecordService = class extends BaseService {
12732
12743
  const bilateralOldValues = {};
12733
12744
  for (const attrName of Object.keys(normalizedUpdate)) {
12734
12745
  const attr = schema.attributes.find((a) => a.name === attrName);
12735
- if (_optionalChain([attr, 'optionalAccess', _282 => _282.type]) === "relation" && isBilateralRelation(attr)) {
12746
+ if (_optionalChain([attr, 'optionalAccess', _268 => _268.type]) === "relation" && isBilateralRelation(attr)) {
12736
12747
  bilateralOldValues[attrName] = existing.values[attrName];
12737
12748
  }
12738
12749
  }
12739
12750
  const updated = await this.adapter.objectRecords.update(recordId, updatePayload);
12740
12751
  await this.invalidateRecordCaches(recordId, existing.objectId);
12741
- _optionalChain([this, 'access', _283 => _283.adapter, 'access', _284 => _284.search, 'optionalAccess', _285 => _285.indexRecord, 'call', _286 => _286(updated, {
12752
+ _optionalChain([this, 'access', _269 => _269.adapter, 'access', _270 => _270.search, 'optionalAccess', _271 => _271.indexRecord, 'call', _272 => _272(updated, {
12742
12753
  objectName: schema.name,
12743
12754
  objectLabel: schema.label,
12744
12755
  attributes: schema.attributes
12745
- }), 'access', _287 => _287.catch, 'call', _288 => _288((err) => console.error("[search] Failed to index updated record", updated.id, err))]);
12756
+ }), 'access', _273 => _273.catch, 'call', _274 => _274((err) => console.error("[search] Failed to index updated record", updated.id, err))]);
12746
12757
  for (const [attrName, value] of Object.entries(dataToUpdate)) {
12747
12758
  const attr = schema.attributes.find((a) => a.name === attrName);
12748
- if (_optionalChain([attr, 'optionalAccess', _289 => _289.type]) === "relation") {
12759
+ if (_optionalChain([attr, 'optionalAccess', _275 => _275.type]) === "relation") {
12749
12760
  const hasProperties2 = attr.properties !== void 0;
12750
12761
  const isBilateral = isBilateralRelation(attr);
12751
12762
  if (hasProperties2 || isBilateral) {
@@ -12759,9 +12770,9 @@ var RecordService = class extends BaseService {
12759
12770
  }
12760
12771
  }
12761
12772
  }
12762
- for (const [attrName, value] of Object.entries(normalizedUpdate)) {
12773
+ for (const [attrName, value] of Object.entries(dataToUpdate)) {
12763
12774
  const attr = schema.attributes.find((a) => a.name === attrName);
12764
- if (_optionalChain([attr, 'optionalAccess', _290 => _290.type]) === "relation" && isBilateralRelation(attr)) {
12775
+ if (_optionalChain([attr, 'optionalAccess', _276 => _276.type]) === "relation" && isBilateralRelation(attr)) {
12765
12776
  const oldValue = bilateralOldValues[attrName];
12766
12777
  await this.bilateralSyncService.syncBilateralRelation(
12767
12778
  schema,
@@ -12772,7 +12783,7 @@ var RecordService = class extends BaseService {
12772
12783
  );
12773
12784
  }
12774
12785
  }
12775
- if (!_optionalChain([options, 'optionalAccess', _291 => _291.skipHooks])) {
12786
+ if (!_optionalChain([options, 'optionalAccess', _277 => _277.skipHooks])) {
12776
12787
  const afterCtx = {
12777
12788
  ...hookCtx,
12778
12789
  record: updated
@@ -12787,7 +12798,7 @@ var RecordService = class extends BaseService {
12787
12798
  if (this.auditService && this.userId && allChangedAttributes.length > 0) {
12788
12799
  const changes = allChangedAttributes.map((attr) => ({
12789
12800
  field: attr,
12790
- oldValue: _optionalChain([hookCtx, 'access', _292 => _292.oldValues, 'optionalAccess', _293 => _293[attr]]),
12801
+ oldValue: _optionalChain([hookCtx, 'access', _278 => _278.oldValues, 'optionalAccess', _279 => _279[attr]]),
12791
12802
  newValue: hookCtx.newValues[attr]
12792
12803
  }));
12793
12804
  this.auditService.logRecordAction({
@@ -12798,7 +12809,7 @@ var RecordService = class extends BaseService {
12798
12809
  recordId: updated.id,
12799
12810
  recordLabel: updated.label,
12800
12811
  changes,
12801
- metadata: _optionalChain([options, 'optionalAccess', _294 => _294.hookMetadata])
12812
+ metadata: _optionalChain([options, 'optionalAccess', _280 => _280.hookMetadata])
12802
12813
  }).catch(() => {
12803
12814
  });
12804
12815
  }
@@ -12830,17 +12841,17 @@ var RecordService = class extends BaseService {
12830
12841
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
12831
12842
  checkRecordDeleteOrThrow(policy, record, ctx);
12832
12843
  }
12833
- if (_optionalChain([options, 'optionalAccess', _295 => _295.checkSystem]) && schema.system) {
12844
+ if (_optionalChain([options, 'optionalAccess', _281 => _281.checkSystem]) && schema.system) {
12834
12845
  throw new ProtectedResourceError("object", schema.name, "delete");
12835
12846
  }
12836
- if (!_optionalChain([options, 'optionalAccess', _296 => _296.skipReferenceCheck])) {
12847
+ if (!_optionalChain([options, 'optionalAccess', _282 => _282.skipReferenceCheck])) {
12837
12848
  const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
12838
12849
  if (references.length > 0) {
12839
12850
  throw new RecordReferencedError(recordId, references);
12840
12851
  }
12841
12852
  }
12842
- const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _297 => _297.hookMetadata]));
12843
- if (!_optionalChain([options, 'optionalAccess', _298 => _298.skipHooks])) {
12853
+ const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _283 => _283.hookMetadata]));
12854
+ if (!_optionalChain([options, 'optionalAccess', _284 => _284.skipHooks])) {
12844
12855
  await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
12845
12856
  }
12846
12857
  for (const attr of schema.attributes) {
@@ -12858,8 +12869,8 @@ var RecordService = class extends BaseService {
12858
12869
  }
12859
12870
  await this.adapter.objectRecords.delete(recordId);
12860
12871
  await this.invalidateRecordCaches(recordId, record.objectId);
12861
- _optionalChain([this, 'access', _299 => _299.adapter, 'access', _300 => _300.search, 'optionalAccess', _301 => _301.removeRecord, 'call', _302 => _302(recordId), 'access', _303 => _303.catch, 'call', _304 => _304((err) => console.error("[search] Failed to remove deleted record", recordId, err))]);
12862
- if (!_optionalChain([options, 'optionalAccess', _305 => _305.skipHooks])) {
12872
+ _optionalChain([this, 'access', _285 => _285.adapter, 'access', _286 => _286.search, 'optionalAccess', _287 => _287.removeRecord, 'call', _288 => _288(recordId), 'access', _289 => _289.catch, 'call', _290 => _290((err) => console.error("[search] Failed to remove deleted record", recordId, err))]);
12873
+ if (!_optionalChain([options, 'optionalAccess', _291 => _291.skipHooks])) {
12863
12874
  await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
12864
12875
  }
12865
12876
  await recalculateParentRollups(record, schema, this.rollupContext);
@@ -12871,7 +12882,7 @@ var RecordService = class extends BaseService {
12871
12882
  objectId: schema.id,
12872
12883
  recordId: record.id,
12873
12884
  recordLabel: record.label,
12874
- metadata: _optionalChain([options, 'optionalAccess', _306 => _306.hookMetadata])
12885
+ metadata: _optionalChain([options, 'optionalAccess', _292 => _292.hookMetadata])
12875
12886
  }).catch(() => {
12876
12887
  });
12877
12888
  }
@@ -12932,18 +12943,18 @@ var RecordService = class extends BaseService {
12932
12943
  this.tenantId
12933
12944
  );
12934
12945
  await checkPermission(this.permissionService, this.userId, schema.name, "update");
12935
- const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _307 => _307.hookMetadata]));
12936
- if (!_optionalChain([options, 'optionalAccess', _308 => _308.skipHooks])) {
12946
+ const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _293 => _293.hookMetadata]));
12947
+ if (!_optionalChain([options, 'optionalAccess', _294 => _294.skipHooks])) {
12937
12948
  await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
12938
12949
  }
12939
12950
  const restored = await this.adapter.objectRecords.restore(recordId);
12940
12951
  await this.invalidateRecordCaches(recordId, record.objectId);
12941
- _optionalChain([this, 'access', _309 => _309.adapter, 'access', _310 => _310.search, 'optionalAccess', _311 => _311.indexRecord, 'call', _312 => _312(restored, {
12952
+ _optionalChain([this, 'access', _295 => _295.adapter, 'access', _296 => _296.search, 'optionalAccess', _297 => _297.indexRecord, 'call', _298 => _298(restored, {
12942
12953
  objectName: schema.name,
12943
12954
  objectLabel: schema.label,
12944
12955
  attributes: schema.attributes
12945
- }), 'access', _313 => _313.catch, 'call', _314 => _314((err) => console.error("[search] Failed to index restored record", restored.id, err))]);
12946
- if (!_optionalChain([options, 'optionalAccess', _315 => _315.skipHooks])) {
12956
+ }), 'access', _299 => _299.catch, 'call', _300 => _300((err) => console.error("[search] Failed to index restored record", restored.id, err))]);
12957
+ if (!_optionalChain([options, 'optionalAccess', _301 => _301.skipHooks])) {
12947
12958
  const afterCtx = {
12948
12959
  ...hookCtx,
12949
12960
  record: restored
@@ -12958,7 +12969,7 @@ var RecordService = class extends BaseService {
12958
12969
  objectId: schema.id,
12959
12970
  recordId: restored.id,
12960
12971
  recordLabel: restored.label,
12961
- metadata: _optionalChain([options, 'optionalAccess', _316 => _316.hookMetadata])
12972
+ metadata: _optionalChain([options, 'optionalAccess', _302 => _302.hookMetadata])
12962
12973
  }).catch(() => {
12963
12974
  });
12964
12975
  }
@@ -13057,14 +13068,14 @@ var RecordService = class extends BaseService {
13057
13068
  */
13058
13069
  async validateData(objectId, data) {
13059
13070
  const schema = await this.schemaService.getObjectSchema(objectId);
13060
- return _chunkHUT6HYXJjs.validateObject.call(void 0, schema, data);
13071
+ return _chunkZW4N6FV7js.validateObject.call(void 0, schema, data);
13061
13072
  }
13062
13073
  /**
13063
13074
  * Compute the completion status for given data without saving
13064
13075
  */
13065
13076
  async computeStatus(objectId, data) {
13066
13077
  const schema = await this.schemaService.getObjectSchema(objectId);
13067
- return _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, data);
13078
+ return _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, data);
13068
13079
  }
13069
13080
  /**
13070
13081
  * Refresh the completion status of an existing record
@@ -13072,7 +13083,7 @@ var RecordService = class extends BaseService {
13072
13083
  async refreshRecordStatus(recordId) {
13073
13084
  const record = await this.getRecordOrThrow(recordId);
13074
13085
  const schema = await this.schemaService.getObjectSchema(record.objectId);
13075
- const newStatus = _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, record.values);
13086
+ const newStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, record.values);
13076
13087
  if (record.completionStatus !== newStatus) {
13077
13088
  await this.adapter.objectRecords.update(recordId, {
13078
13089
  __completionStatus: newStatus
@@ -13559,7 +13570,7 @@ var WorkflowAccessGrantService = class extends BaseService {
13559
13570
  * Check if a specific token has been revoked.
13560
13571
  */
13561
13572
  isTokenRevoked(dbGrant, jti) {
13562
- return _nullishCoalesce(_optionalChain([dbGrant, 'access', _317 => _317.revoked_token_jtis, 'optionalAccess', _318 => _318.includes, 'call', _319 => _319(jti)]), () => ( false));
13573
+ return _nullishCoalesce(_optionalChain([dbGrant, 'access', _303 => _303.revoked_token_jtis, 'optionalAccess', _304 => _304.includes, 'call', _305 => _305(jti)]), () => ( false));
13563
13574
  }
13564
13575
  /**
13565
13576
  * Validate access token payload against the grant.
@@ -13611,9 +13622,9 @@ var WorkflowInstanceService = class extends BaseService {
13611
13622
  constructor(adapter, workflowService, options) {
13612
13623
  super(adapter);
13613
13624
  this.workflowService = workflowService;
13614
- this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _320 => _320.executorRegistry]), () => ( getDefaultExecutorRegistry()));
13615
- this.schemaService = _optionalChain([options, 'optionalAccess', _321 => _321.schemaService]);
13616
- this.recordService = _optionalChain([options, 'optionalAccess', _322 => _322.recordService]);
13625
+ this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _306 => _306.executorRegistry]), () => ( getDefaultExecutorRegistry()));
13626
+ this.schemaService = _optionalChain([options, 'optionalAccess', _307 => _307.schemaService]);
13627
+ this.recordService = _optionalChain([options, 'optionalAccess', _308 => _308.recordService]);
13617
13628
  }
13618
13629
  /**
13619
13630
  * Start a new workflow instance
@@ -13642,8 +13653,8 @@ var WorkflowInstanceService = class extends BaseService {
13642
13653
  context.variables = input.variables;
13643
13654
  }
13644
13655
  const instance = {
13645
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
13646
- workflowId: _nullishCoalesce(workflow2.id, () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
13656
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
13657
+ workflowId: _nullishCoalesce(workflow2.id, () => ( _chunkE6XO2STSjs.generateId.call(void 0, ))),
13647
13658
  workflowVersion: workflow2.version,
13648
13659
  workflowSnapshot: workflow2,
13649
13660
  status: "running",
@@ -13795,7 +13806,7 @@ var WorkflowInstanceService = class extends BaseService {
13795
13806
  if (!this.adapter.workflowInstances) {
13796
13807
  return { instances: [], total: 0 };
13797
13808
  }
13798
- if (_optionalChain([options, 'optionalAccess', _323 => _323.workflowName])) {
13809
+ if (_optionalChain([options, 'optionalAccess', _309 => _309.workflowName])) {
13799
13810
  const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
13800
13811
  options.workflowName,
13801
13812
  { status: options.status }
@@ -13809,11 +13820,11 @@ var WorkflowInstanceService = class extends BaseService {
13809
13820
  return { instances: instances2, total: total2 };
13810
13821
  }
13811
13822
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
13812
- limit: _optionalChain([options, 'optionalAccess', _324 => _324.limit]),
13813
- offset: _optionalChain([options, 'optionalAccess', _325 => _325.offset])
13823
+ limit: _optionalChain([options, 'optionalAccess', _310 => _310.limit]),
13824
+ offset: _optionalChain([options, 'optionalAccess', _311 => _311.offset])
13814
13825
  });
13815
13826
  let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
13816
- if (_optionalChain([options, 'optionalAccess', _326 => _326.status])) {
13827
+ if (_optionalChain([options, 'optionalAccess', _312 => _312.status])) {
13817
13828
  instances = instances.filter((i) => i.status === options.status);
13818
13829
  }
13819
13830
  instances = await this.markExpiredInstances(instances);
@@ -13834,9 +13845,9 @@ var WorkflowInstanceService = class extends BaseService {
13834
13845
  return { instances: [], total: 0 };
13835
13846
  }
13836
13847
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
13837
- status: _optionalChain([options, 'optionalAccess', _327 => _327.status]),
13838
- limit: _optionalChain([options, 'optionalAccess', _328 => _328.limit]),
13839
- offset: _optionalChain([options, 'optionalAccess', _329 => _329.offset])
13848
+ status: _optionalChain([options, 'optionalAccess', _313 => _313.status]),
13849
+ limit: _optionalChain([options, 'optionalAccess', _314 => _314.limit]),
13850
+ offset: _optionalChain([options, 'optionalAccess', _315 => _315.offset])
13840
13851
  });
13841
13852
  const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
13842
13853
  return { instances, total };
@@ -13871,7 +13882,7 @@ var WorkflowInstanceService = class extends BaseService {
13871
13882
  updatedAt: /* @__PURE__ */ new Date()
13872
13883
  };
13873
13884
  }
13874
- const executionId = _chunkNEVERCM3js.generateId.call(void 0, );
13885
+ const executionId = _chunkE6XO2STSjs.generateId.call(void 0, );
13875
13886
  let current = {
13876
13887
  ...instance,
13877
13888
  context: {
@@ -13902,7 +13913,7 @@ var WorkflowInstanceService = class extends BaseService {
13902
13913
  try {
13903
13914
  const schemas = await Promise.all(
13904
13915
  current.workflowSnapshot.slots.map(
13905
- (slot) => _optionalChain([this, 'access', _330 => _330.schemaService, 'optionalAccess', _331 => _331.getObjectSchemaByName, 'call', _332 => _332(slot.objectName)])
13916
+ (slot) => _optionalChain([this, 'access', _316 => _316.schemaService, 'optionalAccess', _317 => _317.getObjectSchemaByName, 'call', _318 => _318(slot.objectName)])
13906
13917
  )
13907
13918
  );
13908
13919
  objectDefinitions = schemas.filter(
@@ -14160,8 +14171,8 @@ var WorkflowInstanceService = class extends BaseService {
14160
14171
  */
14161
14172
  async snapshotRecord(recordId) {
14162
14173
  try {
14163
- const record = await _optionalChain([this, 'access', _333 => _333.recordService, 'optionalAccess', _334 => _334.getRecord, 'call', _335 => _335(recordId, { skipPolicyCheck: true })]);
14164
- return _optionalChain([record, 'optionalAccess', _336 => _336.values]);
14174
+ const record = await _optionalChain([this, 'access', _319 => _319.recordService, 'optionalAccess', _320 => _320.getRecord, 'call', _321 => _321(recordId, { skipPolicyCheck: true })]);
14175
+ return _optionalChain([record, 'optionalAccess', _322 => _322.values]);
14165
14176
  } catch (e20) {
14166
14177
  return void 0;
14167
14178
  }
@@ -14180,13 +14191,13 @@ var WorkflowInstanceService = class extends BaseService {
14180
14191
  for (const op of [...operations].reverse()) {
14181
14192
  try {
14182
14193
  if (op.operation === "create") {
14183
- await _optionalChain([this, 'access', _337 => _337.recordService, 'optionalAccess', _338 => _338.deleteRecord, 'call', _339 => _339(op.recordId, {
14194
+ await _optionalChain([this, 'access', _323 => _323.recordService, 'optionalAccess', _324 => _324.deleteRecord, 'call', _325 => _325(op.recordId, {
14184
14195
  skipHooks: true,
14185
14196
  skipReferenceCheck: true
14186
14197
  })]);
14187
14198
  rolledBack.push(op.slotId);
14188
14199
  } else if (op.operation === "update" && op.previousData) {
14189
- await _optionalChain([this, 'access', _340 => _340.recordService, 'optionalAccess', _341 => _341.updateRecord, 'call', _342 => _342(op.recordId, op.previousData, {
14200
+ await _optionalChain([this, 'access', _326 => _326.recordService, 'optionalAccess', _327 => _327.updateRecord, 'call', _328 => _328(op.recordId, op.previousData, {
14190
14201
  partial: false
14191
14202
  })]);
14192
14203
  rolledBack.push(op.slotId);
@@ -14310,7 +14321,7 @@ var WorkflowInstanceService = class extends BaseService {
14310
14321
  if (!this.adapter.workflowInstances) {
14311
14322
  return;
14312
14323
  }
14313
- const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _343 => _343.context, 'access', _344 => _344.variables, 'optionalAccess', _345 => _345.__version]), () => ( 0));
14324
+ const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _329 => _329.context, 'access', _330 => _330.variables, 'optionalAccess', _331 => _331.__version]), () => ( 0));
14314
14325
  const nextVersion = currentVersion + 1;
14315
14326
  const instanceWithVersion = {
14316
14327
  ...instance,
@@ -14591,7 +14602,7 @@ var WorkflowRelationService = class extends BaseService {
14591
14602
  if (attr.type !== "relation") continue;
14592
14603
  for (const slot of slots) {
14593
14604
  const slotData = context.slots[slot.id];
14594
- const slotRecordId = _optionalChain([slotData, 'optionalAccess', _346 => _346.id]);
14605
+ const slotRecordId = _optionalChain([slotData, 'optionalAccess', _332 => _332.id]);
14595
14606
  if (!slotRecordId) continue;
14596
14607
  const targetsSlotObject = attr.targets.some(
14597
14608
  (t) => t.object === slot.objectName
@@ -14659,7 +14670,7 @@ var WorkflowService = class extends BaseService {
14659
14670
  if (Array.isArray(options)) {
14660
14671
  this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
14661
14672
  } else {
14662
- this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _347 => _347.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14673
+ this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _333 => _333.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14663
14674
  }
14664
14675
  }
14665
14676
  // ============================================================================
@@ -14774,7 +14785,7 @@ var WorkflowService = class extends BaseService {
14774
14785
  };
14775
14786
  const validationResult = WorkflowDefinitionSchema.safeParse(definition);
14776
14787
  if (!validationResult.success) {
14777
- const errors = _chunkHUT6HYXJjs.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
14788
+ const errors = _chunkZW4N6FV7js.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
14778
14789
  throw new SchemaError(
14779
14790
  `Invalid workflow definition: ${errors.join(", ")}`,
14780
14791
  SchemaErrorCode.VALIDATION_FAILED
@@ -14816,7 +14827,7 @@ var WorkflowService = class extends BaseService {
14816
14827
  };
14817
14828
  const validationResult = WorkflowDefinitionSchema.safeParse(updated);
14818
14829
  if (!validationResult.success) {
14819
- const errors = _chunkHUT6HYXJjs.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
14830
+ const errors = _chunkZW4N6FV7js.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
14820
14831
  throw new SchemaError(
14821
14832
  `Invalid workflow definition: ${errors.join(", ")}`,
14822
14833
  SchemaErrorCode.VALIDATION_FAILED
@@ -14845,7 +14856,7 @@ var WorkflowService = class extends BaseService {
14845
14856
  }
14846
14857
  const validationResult = WorkflowDefinitionSchema.safeParse(existing);
14847
14858
  if (!validationResult.success) {
14848
- const errors = _chunkHUT6HYXJjs.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
14859
+ const errors = _chunkZW4N6FV7js.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
14849
14860
  throw new SchemaError(
14850
14861
  `Cannot publish invalid workflow: ${errors.join(", ")}`,
14851
14862
  SchemaErrorCode.VALIDATION_FAILED
@@ -14957,7 +14968,7 @@ var WorkflowService = class extends BaseService {
14957
14968
  var UserProfileService = class extends BaseService {
14958
14969
  constructor(adapter, options) {
14959
14970
  super(adapter);
14960
- this.auditService = _optionalChain([options, 'optionalAccess', _348 => _348.auditService]);
14971
+ this.auditService = _optionalChain([options, 'optionalAccess', _334 => _334.auditService]);
14961
14972
  }
14962
14973
  // ============================================================================
14963
14974
  // CACHE MANAGEMENT
@@ -15036,7 +15047,7 @@ var UserProfileService = class extends BaseService {
15036
15047
  async deleteAvatar(profileId) {
15037
15048
  const profile = await this.getProfileOrThrow(profileId);
15038
15049
  if (profile.avatarUrl && !profile.avatarUrl.startsWith("https://")) {
15039
- await _optionalChain([this, 'access', _349 => _349.adapter, 'access', _350 => _350.storage, 'optionalAccess', _351 => _351.delete, 'call', _352 => _352(profile.avatarUrl), 'access', _353 => _353.catch, 'call', _354 => _354(() => void 0)]);
15050
+ await _optionalChain([this, 'access', _335 => _335.adapter, 'access', _336 => _336.storage, 'optionalAccess', _337 => _337.delete, 'call', _338 => _338(profile.avatarUrl), 'access', _339 => _339.catch, 'call', _340 => _340(() => void 0)]);
15040
15051
  }
15041
15052
  return await this.updateProfile(profileId, { avatarUrl: null });
15042
15053
  }
@@ -15187,7 +15198,7 @@ var UserProfileService = class extends BaseService {
15187
15198
  */
15188
15199
  async deleteProfile(profileId, options) {
15189
15200
  const profile = await this.getProfileOrThrow(profileId);
15190
- if (_optionalChain([options, 'optionalAccess', _355 => _355.checkAdmin]) && this.adapter.permissions) {
15201
+ if (_optionalChain([options, 'optionalAccess', _341 => _341.checkAdmin]) && this.adapter.permissions) {
15191
15202
  const ownerCount = await this.adapter.permissions.countUsersWithRole("owner");
15192
15203
  if (ownerCount <= 1) {
15193
15204
  const userRoles = await this.adapter.permissions.getUserRoles(profileId);
@@ -15315,7 +15326,7 @@ var UserProfileService = class extends BaseService {
15315
15326
  var DocumentService = class extends BaseService {
15316
15327
  constructor(adapter, options) {
15317
15328
  super(adapter);
15318
- this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _356 => _356.fileService]), () => ( null));
15329
+ this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _342 => _342.fileService]), () => ( null));
15319
15330
  }
15320
15331
  // ============================================================================
15321
15332
  // CREATE
@@ -15533,7 +15544,7 @@ var DocumentService = class extends BaseService {
15533
15544
  */
15534
15545
  async isComplete(documentId) {
15535
15546
  const document2 = await this.getDocument(documentId);
15536
- return _optionalChain([document2, 'optionalAccess', _357 => _357.status]) !== "draft";
15547
+ return _optionalChain([document2, 'optionalAccess', _343 => _343.status]) !== "draft";
15537
15548
  }
15538
15549
  /**
15539
15550
  * Get document with its slots.
@@ -15776,7 +15787,7 @@ var DocumentProcessingService = class extends BaseService {
15776
15787
  type: "signature",
15777
15788
  provider: this.config.signatureAdapter.name,
15778
15789
  input: { signers, ...options },
15779
- expiresAt: _optionalChain([options, 'optionalAccess', _358 => _358.expiresAt])
15790
+ expiresAt: _optionalChain([options, 'optionalAccess', _344 => _344.expiresAt])
15780
15791
  });
15781
15792
  return job;
15782
15793
  }
@@ -16088,15 +16099,15 @@ var DocumentProcessingService = class extends BaseService {
16088
16099
  return {
16089
16100
  ocr: {
16090
16101
  available: !!this.config.ocrAdapter,
16091
- provider: _optionalChain([this, 'access', _359 => _359.config, 'access', _360 => _360.ocrAdapter, 'optionalAccess', _361 => _361.name])
16102
+ provider: _optionalChain([this, 'access', _345 => _345.config, 'access', _346 => _346.ocrAdapter, 'optionalAccess', _347 => _347.name])
16092
16103
  },
16093
16104
  signature: {
16094
16105
  available: !!this.config.signatureAdapter,
16095
- provider: _optionalChain([this, 'access', _362 => _362.config, 'access', _363 => _363.signatureAdapter, 'optionalAccess', _364 => _364.name])
16106
+ provider: _optionalChain([this, 'access', _348 => _348.config, 'access', _349 => _349.signatureAdapter, 'optionalAccess', _350 => _350.name])
16096
16107
  },
16097
16108
  identityVerification: {
16098
16109
  available: !!this.config.identityAdapter,
16099
- provider: _optionalChain([this, 'access', _365 => _365.config, 'access', _366 => _366.identityAdapter, 'optionalAccess', _367 => _367.name])
16110
+ provider: _optionalChain([this, 'access', _351 => _351.config, 'access', _352 => _352.identityAdapter, 'optionalAccess', _353 => _353.name])
16100
16111
  }
16101
16112
  };
16102
16113
  }
@@ -16118,7 +16129,7 @@ function decodeFileName(name) {
16118
16129
  var FileService = class extends BaseService {
16119
16130
  constructor(adapter, options) {
16120
16131
  super(adapter);
16121
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _368 => _368.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
16132
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _354 => _354.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
16122
16133
  }
16123
16134
  // ============================================================================
16124
16135
  // UPLOAD (requires StorageAdapter)
@@ -16258,7 +16269,7 @@ var FileService = class extends BaseService {
16258
16269
  */
16259
16270
  async getFile(fileId) {
16260
16271
  const file2 = await this.adapter.files.findById(fileId);
16261
- if (_optionalChain([file2, 'optionalAccess', _369 => _369.deletedAt])) {
16272
+ if (_optionalChain([file2, 'optionalAccess', _355 => _355.deletedAt])) {
16262
16273
  return null;
16263
16274
  }
16264
16275
  return file2;
@@ -16320,12 +16331,12 @@ var FileService = class extends BaseService {
16320
16331
  */
16321
16332
  async deleteFile(fileId, options) {
16322
16333
  const file2 = await this.getFileOrThrow(fileId);
16323
- if (_optionalChain([options, 'optionalAccess', _370 => _370.checkOwnership]) && options.userId) {
16334
+ if (_optionalChain([options, 'optionalAccess', _356 => _356.checkOwnership]) && options.userId) {
16324
16335
  if (file2.uploadedBy !== options.userId) {
16325
16336
  throw new Error("You can only delete files you uploaded");
16326
16337
  }
16327
16338
  }
16328
- if (_optionalChain([options, 'optionalAccess', _371 => _371.hard])) {
16339
+ if (_optionalChain([options, 'optionalAccess', _357 => _357.hard])) {
16329
16340
  await this.adapter.files.hardDelete(fileId);
16330
16341
  } else {
16331
16342
  await this.adapter.files.delete(fileId);
@@ -16356,7 +16367,7 @@ var FileService = class extends BaseService {
16356
16367
  }
16357
16368
  const file2 = await this.getFileOrThrow(fileId);
16358
16369
  await this.adapter.storage.delete(file2.storagePath);
16359
- if (_optionalChain([options, 'optionalAccess', _372 => _372.hard])) {
16370
+ if (_optionalChain([options, 'optionalAccess', _358 => _358.hard])) {
16360
16371
  await this.adapter.files.hardDelete(fileId);
16361
16372
  } else {
16362
16373
  await this.adapter.files.delete(fileId);
@@ -16382,15 +16393,15 @@ var FileService = class extends BaseService {
16382
16393
  const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
16383
16394
  const files = fileResults.filter((f) => f !== null);
16384
16395
  if (files.length === 0) return;
16385
- if (_optionalChain([options, 'optionalAccess', _373 => _373.deleteFromStorage]) && this.adapter.storage) {
16396
+ if (_optionalChain([options, 'optionalAccess', _359 => _359.deleteFromStorage]) && this.adapter.storage) {
16386
16397
  const BATCH_SIZE = 10;
16387
16398
  for (let i = 0; i < files.length; i += BATCH_SIZE) {
16388
16399
  const batch = files.slice(i, i + BATCH_SIZE);
16389
- await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _374 => _374.adapter, 'access', _375 => _375.storage, 'optionalAccess', _376 => _376.delete, 'call', _377 => _377(file2.storagePath)])));
16400
+ await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _360 => _360.adapter, 'access', _361 => _361.storage, 'optionalAccess', _362 => _362.delete, 'call', _363 => _363(file2.storagePath)])));
16390
16401
  }
16391
16402
  }
16392
16403
  const idsToDelete = files.map((f) => f.id);
16393
- if (_optionalChain([options, 'optionalAccess', _378 => _378.hard])) {
16404
+ if (_optionalChain([options, 'optionalAccess', _364 => _364.hard])) {
16394
16405
  await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
16395
16406
  } else {
16396
16407
  await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
@@ -16398,12 +16409,12 @@ var FileService = class extends BaseService {
16398
16409
  if (this.auditService && this.userId) {
16399
16410
  await Promise.all(
16400
16411
  files.map(
16401
- (file2) => _optionalChain([this, 'access', _379 => _379.auditService, 'optionalAccess', _380 => _380.logFileAction, 'call', _381 => _381({
16412
+ (file2) => _optionalChain([this, 'access', _365 => _365.auditService, 'optionalAccess', _366 => _366.logFileAction, 'call', _367 => _367({
16402
16413
  action: "file.deleted",
16403
16414
  actorId: _nullishCoalesce(this.userId, () => ( "")),
16404
16415
  fileId: file2.id,
16405
16416
  fileName: file2.name,
16406
- metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _382 => _382.deleteFromStorage]), () => ( false)) }
16417
+ metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _368 => _368.deleteFromStorage]), () => ( false)) }
16407
16418
  })])
16408
16419
  )
16409
16420
  );
@@ -16488,7 +16499,7 @@ var FileService = class extends BaseService {
16488
16499
  return true;
16489
16500
  }
16490
16501
  if (file2.visibility === "restricted") {
16491
- return _nullishCoalesce(_optionalChain([file2, 'access', _383 => _383.allowedUsers, 'optionalAccess', _384 => _384.includes, 'call', _385 => _385(userId)]), () => ( false));
16502
+ return _nullishCoalesce(_optionalChain([file2, 'access', _369 => _369.allowedUsers, 'optionalAccess', _370 => _370.includes, 'call', _371 => _371(userId)]), () => ( false));
16492
16503
  }
16493
16504
  return false;
16494
16505
  }
@@ -16583,7 +16594,7 @@ function withTimeout(promise, ms, label) {
16583
16594
  var GeocodingService = class {
16584
16595
  constructor(adapter, options) {
16585
16596
  this.adapter = adapter;
16586
- this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _386 => _386.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16597
+ this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16587
16598
  }
16588
16599
  /**
16589
16600
  * Search for address suggestions as the user types
@@ -16642,9 +16653,9 @@ var GlobalSearchService = class extends BaseService {
16642
16653
  if (this.adapter.search) {
16643
16654
  try {
16644
16655
  const raw = await this.adapter.search.globalSearch(trimmed, {
16645
- objectNames: _optionalChain([options, 'optionalAccess', _387 => _387.objectNames]),
16646
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _388 => _388.limit]), () => ( 20)),
16647
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _389 => _389.offset]), () => ( 0))
16656
+ objectNames: _optionalChain([options, 'optionalAccess', _373 => _373.objectNames]),
16657
+ limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.limit]), () => ( 20)),
16658
+ offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _375 => _375.offset]), () => ( 0))
16648
16659
  });
16649
16660
  return await this.healGlobalSearchResults(raw);
16650
16661
  } catch (err) {
@@ -16652,9 +16663,9 @@ var GlobalSearchService = class extends BaseService {
16652
16663
  }
16653
16664
  }
16654
16665
  return this.adapter.objectRecords.globalSearch(trimmed, {
16655
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _390 => _390.limit]), () => ( 20)),
16656
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _391 => _391.offset]), () => ( 0)),
16657
- objectNames: _optionalChain([options, 'optionalAccess', _392 => _392.objectNames])
16666
+ limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _376 => _376.limit]), () => ( 20)),
16667
+ offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _377 => _377.offset]), () => ( 0)),
16668
+ objectNames: _optionalChain([options, 'optionalAccess', _378 => _378.objectNames])
16658
16669
  });
16659
16670
  }
16660
16671
  /**
@@ -16673,7 +16684,7 @@ var GlobalSearchService = class extends BaseService {
16673
16684
  if (this.adapter.search) {
16674
16685
  try {
16675
16686
  const raw = await this.adapter.search.globalSearchGrouped(trimmed, {
16676
- objectNames: _optionalChain([options, 'optionalAccess', _393 => _393.objectNames])
16687
+ objectNames: _optionalChain([options, 'optionalAccess', _379 => _379.objectNames])
16677
16688
  });
16678
16689
  return await this.healGroupedSearchResults(raw);
16679
16690
  } catch (err) {
@@ -16681,8 +16692,8 @@ var GlobalSearchService = class extends BaseService {
16681
16692
  }
16682
16693
  }
16683
16694
  return this.adapter.objectRecords.globalSearchGrouped(trimmed, {
16684
- objectNames: _optionalChain([options, 'optionalAccess', _394 => _394.objectNames]),
16685
- limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _395 => _395.limitPerGroup]), () => ( 5))
16695
+ objectNames: _optionalChain([options, 'optionalAccess', _380 => _380.objectNames]),
16696
+ limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _381 => _381.limitPerGroup]), () => ( 5))
16686
16697
  });
16687
16698
  }
16688
16699
  // ==========================================================================
@@ -16749,7 +16760,7 @@ var PermissionService = class extends BaseService {
16749
16760
  }
16750
16761
  this.permissionsRepo = adapter.permissions;
16751
16762
  this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
16752
- this.auditService = _optionalChain([options, 'optionalAccess', _396 => _396.auditService]);
16763
+ this.auditService = _optionalChain([options, 'optionalAccess', _382 => _382.auditService]);
16753
16764
  }
16754
16765
  // ============================================================================
16755
16766
  // PERMISSION CHECKS
@@ -16765,11 +16776,11 @@ var PermissionService = class extends BaseService {
16765
16776
  async canAccessObject(userProfileId, objectName, action) {
16766
16777
  const permissions = await this.getEffectivePermissions(userProfileId);
16767
16778
  const wildcardPerms = permissions.objectPermissions["*"];
16768
- if (_optionalChain([wildcardPerms, 'optionalAccess', _397 => _397.includes, 'call', _398 => _398(action)])) {
16779
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _383 => _383.includes, 'call', _384 => _384(action)])) {
16769
16780
  return true;
16770
16781
  }
16771
16782
  const objectPerms = permissions.objectPermissions[objectName];
16772
- return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _399 => _399.includes, 'call', _400 => _400(action)]), () => ( false));
16783
+ return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _385 => _385.includes, 'call', _386 => _386(action)]), () => ( false));
16773
16784
  }
16774
16785
  /**
16775
16786
  * Check if user can access an object, throw ForbiddenError if not.
@@ -16818,12 +16829,12 @@ var PermissionService = class extends BaseService {
16818
16829
  */
16819
16830
  async canAccessSystem(userProfileId, resource, action) {
16820
16831
  const permissions = await this.getEffectivePermissions(userProfileId);
16821
- const wildcardPerms = _optionalChain([permissions, 'access', _401 => _401.systemPermissions, 'optionalAccess', _402 => _402["*"]]);
16822
- if (_optionalChain([wildcardPerms, 'optionalAccess', _403 => _403.includes, 'call', _404 => _404(action)])) {
16832
+ const wildcardPerms = _optionalChain([permissions, 'access', _387 => _387.systemPermissions, 'optionalAccess', _388 => _388["*"]]);
16833
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _389 => _389.includes, 'call', _390 => _390(action)])) {
16823
16834
  return true;
16824
16835
  }
16825
- const resourcePerms = _optionalChain([permissions, 'access', _405 => _405.systemPermissions, 'optionalAccess', _406 => _406[resource]]);
16826
- return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _407 => _407.includes, 'call', _408 => _408(action)]), () => ( false));
16836
+ const resourcePerms = _optionalChain([permissions, 'access', _391 => _391.systemPermissions, 'optionalAccess', _392 => _392[resource]]);
16837
+ return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _393 => _393.includes, 'call', _394 => _394(action)]), () => ( false));
16827
16838
  }
16828
16839
  /**
16829
16840
  * Check if user can access a system resource, throw ForbiddenError if not.
@@ -16849,8 +16860,8 @@ var PermissionService = class extends BaseService {
16849
16860
  */
16850
16861
  async getSystemPermissions(userProfileId, resource) {
16851
16862
  const permissions = await this.getEffectivePermissions(userProfileId);
16852
- const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _409 => _409.systemPermissions, 'optionalAccess', _410 => _410["*"]]), () => ( []));
16853
- const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _411 => _411.systemPermissions, 'optionalAccess', _412 => _412[resource]]), () => ( []));
16863
+ const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _395 => _395.systemPermissions, 'optionalAccess', _396 => _396["*"]]), () => ( []));
16864
+ const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _397 => _397.systemPermissions, 'optionalAccess', _398 => _398[resource]]), () => ( []));
16854
16865
  const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
16855
16866
  return {
16856
16867
  canRead: allPerms.has("read"),
@@ -16993,7 +17004,7 @@ var PermissionService = class extends BaseService {
16993
17004
  action: "role.updated",
16994
17005
  actorId: this.userId,
16995
17006
  roleId,
16996
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _413 => _413.label]), () => ( roleId)),
17007
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _399 => _399.label]), () => ( roleId)),
16997
17008
  metadata: { permissionsUpdated: true, permissionCount: permissions.length }
16998
17009
  });
16999
17010
  }
@@ -17023,7 +17034,7 @@ var PermissionService = class extends BaseService {
17023
17034
  action: "role.assigned",
17024
17035
  actorId: this.userId,
17025
17036
  roleId,
17026
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _414 => _414.label]), () => ( roleId)),
17037
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _400 => _400.label]), () => ( roleId)),
17027
17038
  targetUserId: userProfileId
17028
17039
  });
17029
17040
  }
@@ -17041,7 +17052,7 @@ var PermissionService = class extends BaseService {
17041
17052
  action: "role.revoked",
17042
17053
  actorId: this.userId,
17043
17054
  roleId,
17044
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _415 => _415.label]), () => ( roleId)),
17055
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _401 => _401.label]), () => ( roleId)),
17045
17056
  targetUserId: userProfileId
17046
17057
  });
17047
17058
  }
@@ -17515,7 +17526,7 @@ var ViewService = class extends BaseService {
17515
17526
  dbView.objectName,
17516
17527
  dbView.type,
17517
17528
  objectDefinition,
17518
- dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _416 => _416.config, 'optionalAccess', _417 => _417.layout]), () => ( "page")) : void 0
17529
+ dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _402 => _402.config, 'optionalAccess', _403 => _403.layout]), () => ( "page")) : void 0
17519
17530
  );
17520
17531
  const newConfig = generated.config;
17521
17532
  const updated = await this.adapter.views.update(viewId, { config: newConfig });
@@ -18417,4 +18428,5 @@ var NoopGeocodingAdapter = class {
18417
18428
 
18418
18429
 
18419
18430
 
18420
- exports.IDENTITY_PROPERTIES = IDENTITY_PROPERTIES; exports.BEHAVIOR_PROPERTIES = BEHAVIOR_PROPERTIES; exports.PRESENTATION_PROPERTIES = PRESENTATION_PROPERTIES; exports.isIdentityProperty = isIdentityProperty; exports.isBehaviorProperty = isBehaviorProperty; exports.isPresentationProperty = isPresentationProperty; exports.RELATION_TARGET_ANY = RELATION_TARGET_ANY; exports.isUniversalRelation = isUniversalRelation; exports.isBilateralRelation = isBilateralRelation; exports.inferInverseCardinality = inferInverseCardinality; exports.NON_SORTABLE_TYPES = NON_SORTABLE_TYPES; exports.isAttributeSortable = isAttributeSortable; exports.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.getErrorMessage = getErrorMessage; exports.isFlowFieldsRow = isFlowFieldsRow; exports.isLayoutRow = isLayoutRow; exports.isFlowDefinition = isFlowDefinition; exports.isFlowPublished = isFlowPublished; exports.isSystemFlow = isSystemFlow; exports.NoopGeocodingAdapter = NoopGeocodingAdapter; exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES; exports.RESERVED_ATTRIBUTE_NAMES = RESERVED_ATTRIBUTE_NAMES; exports.PolicyViolationError = PolicyViolationError; exports.FORBIDDEN_PROPERTY_TYPES = FORBIDDEN_PROPERTY_TYPES; exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES; exports.getSystemAttributeList = getSystemAttributeList; exports.isSystemAttribute = isSystemAttribute; exports.isSystemAttributeObject = isSystemAttributeObject; exports.nodeTypeRegistry = nodeTypeRegistry; exports.getNodeOutputs = getNodeOutputs; exports.setNodeNext = setNodeNext; exports.getNodeSlotIds = getNodeSlotIds; exports.validateNode = validateNode; exports.getFormFieldRefs = getFormFieldRefs; exports.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isAssignNode = isAssignNode; exports.isEndNode = isEndNode; exports.isConditionRule = isConditionRule; exports.isConditionGroup = isConditionGroup; exports.eq = eq; exports.neq = neq; exports.and = and; exports.or = or; exports.inValues = inValues; exports.isWorkflowDefinition = isWorkflowDefinition; exports.isWorkflowPublished = isWorkflowPublished; exports.isSystemWorkflow = isSystemWorkflow; exports.isInstanceTerminal = isInstanceTerminal; exports.isInstanceWaiting = isInstanceWaiting; exports.canResumeInstance = canResumeInstance; exports.createStartTransition = createStartTransition; exports.isInvitationValid = isInvitationValid; exports.isInvitationAccepted = isInvitationAccepted; exports.isInvitationExpired = isInvitationExpired; exports.isGrantValid = isGrantValid; exports.isGrantRevoked = isGrantRevoked; exports.isTokenRevoked = isTokenRevoked; exports.isGrantExpired = isGrantExpired; exports.canAccessNode = canAccessNode; exports.createEmptyContext = createEmptyContext; exports.getContextValue = getContextValue; exports.setContextValue = setContextValue; exports.isFormFieldsRow = isFormFieldsRow; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; exports.ZONE_ORDER = ZONE_ORDER; exports.ZONE_CONFIG = ZONE_CONFIG; exports.assignNodeZones = assignNodeZones; exports.groupNodesByZone = groupNodesByZone; exports.getZoneAllowedTypes = getZoneAllowedTypes; exports.ConditionOperatorSchema = ConditionOperatorSchema; exports.ConditionRuleSchema = ConditionRuleSchema; exports.ConditionGroupSchema = ConditionGroupSchema; exports.StartNodeSchema = StartNodeSchema; exports.FormFieldRefSchema = FormFieldRefSchema; exports.FlowRowFieldSchema = FlowRowFieldSchema; exports.FlowRowSchema = FlowRowSchema; exports.FormNodeSchema = FormNodeSchema; exports.ConditionNodeSchema = ConditionNodeSchema; exports.AssignmentSourceSchema = AssignmentSourceSchema; exports.AssignmentMappingSchema = AssignmentMappingSchema; exports.AssignNodeSchema = AssignNodeSchema; exports.EndNodeSchema = EndNodeSchema; exports.WorkflowNodeSchema = WorkflowNodeSchema; exports.SlotModeSchema = SlotModeSchema; exports.WorkflowSlotSchema = WorkflowSlotSchema; exports.AuthMethodSchema = AuthMethodSchema; exports.ShareStatusSchema = ShareStatusSchema; exports.WorkflowShareSchema = WorkflowShareSchema; exports.CreateShareInputSchema = CreateShareInputSchema; exports.NodePositionSchema = NodePositionSchema; exports.ViewportSchema = ViewportSchema; exports.WorkflowLayoutSchema = WorkflowLayoutSchema; exports.ThemeColorsSchema = ThemeColorsSchema; exports.ThemeLogoSchema = ThemeLogoSchema; exports.WorkflowThemeSchema = WorkflowThemeSchema; exports.WorkflowConfigSchema = WorkflowConfigSchema; exports.WorkflowStatusSchema = WorkflowStatusSchema; exports.WorkflowDefinitionSchema = WorkflowDefinitionSchema; exports.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.toUndefinedIfEmpty = toUndefinedIfEmpty; exports.hasProperties = hasProperties; exports.EMPTY_VALUE_PLACEHOLDER = EMPTY_VALUE_PLACEHOLDER; exports.formatAttributeValue = formatAttributeValue; exports.DEFAULT_LABEL_FALLBACK = DEFAULT_LABEL_FALLBACK; exports.renderLabelExpression = renderLabelExpression; exports.isLabelExpression = isLabelExpression; exports.extractAttributeNames = extractAttributeNames; exports.enrichValuesForDisplay = enrichValuesForDisplay; exports.enrichValuesWithSelectLabels = enrichValuesWithSelectLabels; exports.extractRelationIds = extractRelationIds; exports.computeLabelWithRelations = computeLabelWithRelations; exports.SchemaErrorCode = SchemaErrorCode; exports.SchemaError = SchemaError; exports.NotFoundError = NotFoundError; exports.ObjectNotFoundError = ObjectNotFoundError; exports.AttributeNotFoundError = AttributeNotFoundError; exports.RecordNotFoundError = RecordNotFoundError; exports.UserProfileNotFoundError = UserProfileNotFoundError; exports.FileNotFoundError = FileNotFoundError; exports.ValidationError = ValidationError; exports.ProtectedResourceError = ProtectedResourceError; exports.SyncError = SyncError; exports.NotSystemObjectError = NotSystemObjectError; exports.DuplicateError = DuplicateError; exports.isSchemaError = isSchemaError; exports.isNotFoundError = isNotFoundError; exports.isValidationError = isValidationError; exports.isProtectedResourceError = isProtectedResourceError; exports.ForbiddenError = ForbiddenError; exports.ProtectedRoleError = ProtectedRoleError; exports.RoleNotFoundError = RoleNotFoundError; exports.isForbiddenError = isForbiddenError; exports.ConcurrentModificationError = ConcurrentModificationError; exports.text = text; exports.textarea = textarea; exports.richtext = richtext; exports.number = number; exports.checkbox = checkbox; exports.date = date; exports.phone = phone; exports.currency = currency; exports.status = status; exports.select = select; exports.multiselect = multiselect; exports.location = location; exports.file = file; exports.user = user; exports.relation = relation; exports.rating = rating; exports.formula = formula; exports.rollup = rollup; exports.document = document; exports.ObjectBuilder = ObjectBuilder; exports.object = object; exports.GroupBuilder = GroupBuilder; exports.RelationGroupBuilder = RelationGroupBuilder; exports.TableTabConfig = TableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.RichtextTabConfig = RichtextTabConfig; exports.ActivityTabConfig = ActivityTabConfig; exports.FlowsTabConfig = FlowsTabConfig; exports.DocumentsTabConfig = DocumentsTabConfig; exports.TabBuilder = TabBuilder; exports.DetailViewBuilder = DetailViewBuilder; exports.ViewBuilder = ViewBuilder; exports.detailView = detailView; exports.view = view; exports.ListViewBuilder = ListViewBuilder; exports.ListViewTabConfigBuilder = ListViewTabConfigBuilder; exports.listView = listView; exports.group = group; exports.relationGroup = relationGroup; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowAssignBuilder = WorkflowAssignBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.WorkflowJwtService = WorkflowJwtService; exports.hashOptions = hashOptions; exports.cacheKeys = cacheKeys; exports.cacheTtl = cacheTtl; exports.defaultTtl = defaultTtl; exports.NoopCacheAdapter = NoopCacheAdapter; exports.formatRecord = formatRecord; exports.formatRecords = formatRecords; exports.createDefaultState = createDefaultState; exports.SHORTCUT_TO_FILTER_OPERATOR = SHORTCUT_TO_FILTER_OPERATOR; exports.QueryNoResultError = QueryNoResultError; exports.QueryMultipleResultsError = QueryMultipleResultsError; exports.TenantContextError = TenantContextError; exports.FeatureFlagsContextError = FeatureFlagsContextError; exports.isFeatureEnabled = isFeatureEnabled; exports.getFeatureValue = getFeatureValue; exports.getFeatureFlags = getFeatureFlags; exports.tryGetFeatureValue = tryGetFeatureValue; exports.hasFeatureFlagsContext = hasFeatureFlagsContext; exports.runWithFeatureFlags = runWithFeatureFlags; exports.withFeatureFlags = withFeatureFlags; exports.getSchemaFromContext = getSchemaFromContext; exports.getSchemaByNameFromContext = getSchemaByNameFromContext; exports.hasSchemaContext = hasSchemaContext; exports.getSchemaContext = getSchemaContext; exports.addSchemaToContext = addSchemaToContext; exports.runWithSchemaContext = runWithSchemaContext; exports.runWithMergedSchemaContext = runWithMergedSchemaContext; exports.getContext = getContext2; exports.getTenantId = getTenantId; exports.getUserId = getUserId; exports.hasContext = hasContext; exports.runWithContext = runWithContext; exports.withTenantContext = withTenantContext; exports.QueryBuilder = QueryBuilder; exports.createQueryBuilder = createQueryBuilder; exports.evaluateCondition = evaluateCondition; exports.evaluate = evaluate; exports.evaluateWithTrace = evaluateWithTrace; exports.ExecutorRegistry = ExecutorRegistry; exports.success = success; exports.wait = wait; exports.complete = complete; exports.error = error; exports.ConditionExecutor = ConditionExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.AssignExecutor = AssignExecutor; exports.StartExecutor = StartExecutor; exports.createDefaultExecutorRegistry = createDefaultExecutorRegistry; exports.getDefaultExecutorRegistry = getDefaultExecutorRegistry; exports.evaluateFormula = evaluateFormula; exports.evaluateFormulaWithResult = evaluateFormulaWithResult; exports.formatFormulaResult = formatFormulaResult; exports.evaluateFormulaAttribute = evaluateFormulaAttribute; exports.validateFormulaExpression = validateFormulaExpression; exports.extractFormulaVariables = extractFormulaVariables; exports.extractRelationReferences = extractRelationReferences; exports.extractRelationNames = extractRelationNames; exports.hasRelationReferences = hasRelationReferences; exports.flattenRelationsForEval = flattenRelationsForEval; exports.evaluateFormulaWithRelations = evaluateFormulaWithRelations; exports.evaluateFormulaAttributeWithRelations = evaluateFormulaAttributeWithRelations; exports.InvalidPathError = InvalidPathError; exports.MaxDepthExceededError = MaxDepthExceededError; exports.parsePath = parsePath; exports.validatePath = validatePath; exports.pathHasManyCardinality = pathHasManyCardinality; exports.getPathDepth = getPathDepth; exports.getTargetAttributeName = getTargetAttributeName; exports.getRelationPath = getRelationPath; exports.traversePath = traversePath; exports.resolveSingleValue = resolveSingleValue; exports.resolveMultiplePaths = resolveMultiplePaths; exports.NoopHookRegistry = NoopHookRegistry; exports.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.SORTABLE_ATTRIBUTE_TYPES = SORTABLE_ATTRIBUTE_TYPES; exports.BaseService = BaseService; exports.BaseRepository = BaseRepository; exports.SchemaContextAwareRepository = SchemaContextAwareRepository; exports.buildAuditChanges = buildAuditChanges; exports.ObjectSchemaService = ObjectSchemaService; exports.AuditService = AuditService; exports.UserService = UserService; exports.applyDefaultValues = applyDefaultValues; exports.checkPermission = checkPermission; exports.getPolicy = getPolicy; exports.buildPolicyContext = buildPolicyContext; exports.checkRecordAccess = checkRecordAccess; exports.checkRecordModifyOrThrow = checkRecordModifyOrThrow; exports.checkRecordDeleteOrThrow = checkRecordDeleteOrThrow; exports.checkSharedObjectWriteAccess = checkSharedObjectWriteAccess; exports.computeLabel = computeLabel; exports.enrichWithFormulas = enrichWithFormulas; exports.enrichRecordsWithFormulas = enrichRecordsWithFormulas; exports.createContextForCreate = createContextForCreate; exports.createContextForUpdate = createContextForUpdate; exports.createContextForDelete = createContextForDelete; exports.createContextForRestore = createContextForRestore; exports.recalculateParentRollups = recalculateParentRollups; exports.RelationPropertiesService = RelationPropertiesService; exports.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; exports.GrantNotFoundError = GrantNotFoundError; exports.GrantExpiredError = GrantExpiredError; exports.GrantRevokedError = GrantRevokedError; exports.TokenRevokedError = TokenRevokedError; exports.WorkflowAccessGrantService = WorkflowAccessGrantService; exports.WorkflowInstanceService = WorkflowInstanceService; exports.InvitationNotFoundError = InvitationNotFoundError; exports.InvitationExpiredError = InvitationExpiredError; exports.InvitationAlreadyAcceptedError = InvitationAlreadyAcceptedError; exports.InvitationRevokedError = InvitationRevokedError; exports.WorkflowInvitationService = WorkflowInvitationService; exports.WorkflowRelationService = WorkflowRelationService; exports.WorkflowService = WorkflowService; exports.UserProfileService = UserProfileService; exports.DocumentService = DocumentService; exports.DocumentProcessingService = DocumentProcessingService; exports.FileService = FileService; exports.GeocodingService = GeocodingService; exports.GlobalSearchService = GlobalSearchService; exports.PermissionService = PermissionService; exports.ViewService = ViewService; exports.seedRegistryViews = seedRegistryViews; exports.syncNativeViews = syncNativeViews; exports.verifyRegistryViewsSeeded = verifyRegistryViewsSeeded; exports.verifyNativeViewsSync = verifyNativeViewsSync; exports.getViewSeedPreview = getViewSeedPreview; exports.getViewSyncPreview = getViewSyncPreview; exports.syncNativeObjects = syncNativeObjects; exports.verifyNativeObjectsSync = verifyNativeObjectsSync; exports.getSyncPreview = getSyncPreview; exports.syncAll = syncAll;
18431
+
18432
+ exports.IDENTITY_PROPERTIES = IDENTITY_PROPERTIES; exports.BEHAVIOR_PROPERTIES = BEHAVIOR_PROPERTIES; exports.PRESENTATION_PROPERTIES = PRESENTATION_PROPERTIES; exports.isIdentityProperty = isIdentityProperty; exports.isBehaviorProperty = isBehaviorProperty; exports.isPresentationProperty = isPresentationProperty; exports.RELATION_TARGET_ANY = RELATION_TARGET_ANY; exports.isUniversalRelation = isUniversalRelation; exports.isBilateralRelation = isBilateralRelation; exports.inferInverseCardinality = inferInverseCardinality; exports.NON_SORTABLE_TYPES = NON_SORTABLE_TYPES; exports.isAttributeSortable = isAttributeSortable; exports.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.getErrorMessage = getErrorMessage; exports.isFlowFieldsRow = isFlowFieldsRow; exports.isLayoutRow = isLayoutRow; exports.isFlowDefinition = isFlowDefinition; exports.isFlowPublished = isFlowPublished; exports.isSystemFlow = isSystemFlow; exports.NoopGeocodingAdapter = NoopGeocodingAdapter; exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES; exports.RESERVED_ATTRIBUTE_NAMES = RESERVED_ATTRIBUTE_NAMES; exports.PolicyViolationError = PolicyViolationError; exports.FORBIDDEN_PROPERTY_TYPES = FORBIDDEN_PROPERTY_TYPES; exports.hasOptions = hasOptions2; exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES; exports.getSystemAttributeList = getSystemAttributeList; exports.isSystemAttribute = isSystemAttribute; exports.isSystemAttributeObject = isSystemAttributeObject; exports.nodeTypeRegistry = nodeTypeRegistry; exports.getNodeOutputs = getNodeOutputs; exports.setNodeNext = setNodeNext; exports.getNodeSlotIds = getNodeSlotIds; exports.validateNode = validateNode; exports.getFormFieldRefs = getFormFieldRefs; exports.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isAssignNode = isAssignNode; exports.isEndNode = isEndNode; exports.isConditionRule = isConditionRule; exports.isConditionGroup = isConditionGroup; exports.eq = eq; exports.neq = neq; exports.and = and; exports.or = or; exports.inValues = inValues; exports.isWorkflowDefinition = isWorkflowDefinition; exports.isWorkflowPublished = isWorkflowPublished; exports.isSystemWorkflow = isSystemWorkflow; exports.isInstanceTerminal = isInstanceTerminal; exports.isInstanceWaiting = isInstanceWaiting; exports.canResumeInstance = canResumeInstance; exports.createStartTransition = createStartTransition; exports.isInvitationValid = isInvitationValid; exports.isInvitationAccepted = isInvitationAccepted; exports.isInvitationExpired = isInvitationExpired; exports.isGrantValid = isGrantValid; exports.isGrantRevoked = isGrantRevoked; exports.isTokenRevoked = isTokenRevoked; exports.isGrantExpired = isGrantExpired; exports.canAccessNode = canAccessNode; exports.createEmptyContext = createEmptyContext; exports.getContextValue = getContextValue; exports.setContextValue = setContextValue; exports.isFormFieldsRow = isFormFieldsRow; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; exports.ZONE_ORDER = ZONE_ORDER; exports.ZONE_CONFIG = ZONE_CONFIG; exports.assignNodeZones = assignNodeZones; exports.groupNodesByZone = groupNodesByZone; exports.getZoneAllowedTypes = getZoneAllowedTypes; exports.ConditionOperatorSchema = ConditionOperatorSchema; exports.ConditionRuleSchema = ConditionRuleSchema; exports.ConditionGroupSchema = ConditionGroupSchema; exports.StartNodeSchema = StartNodeSchema; exports.FormFieldRefSchema = FormFieldRefSchema; exports.FlowRowFieldSchema = FlowRowFieldSchema; exports.FlowRowSchema = FlowRowSchema; exports.FormNodeSchema = FormNodeSchema; exports.ConditionNodeSchema = ConditionNodeSchema; exports.AssignmentSourceSchema = AssignmentSourceSchema; exports.AssignmentMappingSchema = AssignmentMappingSchema; exports.AssignNodeSchema = AssignNodeSchema; exports.EndNodeSchema = EndNodeSchema; exports.WorkflowNodeSchema = WorkflowNodeSchema; exports.SlotModeSchema = SlotModeSchema; exports.WorkflowSlotSchema = WorkflowSlotSchema; exports.AuthMethodSchema = AuthMethodSchema; exports.ShareStatusSchema = ShareStatusSchema; exports.WorkflowShareSchema = WorkflowShareSchema; exports.CreateShareInputSchema = CreateShareInputSchema; exports.NodePositionSchema = NodePositionSchema; exports.ViewportSchema = ViewportSchema; exports.WorkflowLayoutSchema = WorkflowLayoutSchema; exports.ThemeColorsSchema = ThemeColorsSchema; exports.ThemeLogoSchema = ThemeLogoSchema; exports.WorkflowThemeSchema = WorkflowThemeSchema; exports.WorkflowConfigSchema = WorkflowConfigSchema; exports.WorkflowStatusSchema = WorkflowStatusSchema; exports.WorkflowDefinitionSchema = WorkflowDefinitionSchema; exports.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.toUndefinedIfEmpty = toUndefinedIfEmpty; exports.hasProperties = hasProperties; exports.EMPTY_VALUE_PLACEHOLDER = EMPTY_VALUE_PLACEHOLDER; exports.formatAttributeValue = formatAttributeValue; exports.DEFAULT_LABEL_FALLBACK = DEFAULT_LABEL_FALLBACK; exports.renderLabelExpression = renderLabelExpression; exports.isLabelExpression = isLabelExpression; exports.extractAttributeNames = extractAttributeNames; exports.enrichValuesForDisplay = enrichValuesForDisplay; exports.enrichValuesWithSelectLabels = enrichValuesWithSelectLabels; exports.extractRelationIds = extractRelationIds; exports.computeLabelWithRelations = computeLabelWithRelations; exports.SchemaErrorCode = SchemaErrorCode; exports.SchemaError = SchemaError; exports.NotFoundError = NotFoundError; exports.ObjectNotFoundError = ObjectNotFoundError; exports.AttributeNotFoundError = AttributeNotFoundError; exports.RecordNotFoundError = RecordNotFoundError; exports.UserProfileNotFoundError = UserProfileNotFoundError; exports.FileNotFoundError = FileNotFoundError; exports.ValidationError = ValidationError; exports.ProtectedResourceError = ProtectedResourceError; exports.SyncError = SyncError; exports.NotSystemObjectError = NotSystemObjectError; exports.DuplicateError = DuplicateError; exports.isSchemaError = isSchemaError; exports.isNotFoundError = isNotFoundError; exports.isValidationError = isValidationError; exports.isProtectedResourceError = isProtectedResourceError; exports.ForbiddenError = ForbiddenError; exports.ProtectedRoleError = ProtectedRoleError; exports.RoleNotFoundError = RoleNotFoundError; exports.isForbiddenError = isForbiddenError; exports.ConcurrentModificationError = ConcurrentModificationError; exports.text = text; exports.textarea = textarea; exports.richtext = richtext; exports.number = number; exports.checkbox = checkbox; exports.date = date; exports.phone = phone; exports.currency = currency; exports.status = status; exports.select = select; exports.multiselect = multiselect; exports.location = location; exports.file = file; exports.user = user; exports.relation = relation; exports.rating = rating; exports.formula = formula; exports.rollup = rollup; exports.document = document; exports.ObjectBuilder = ObjectBuilder; exports.object = object; exports.GroupBuilder = GroupBuilder; exports.RelationGroupBuilder = RelationGroupBuilder; exports.TableTabConfig = TableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.RichtextTabConfig = RichtextTabConfig; exports.ActivityTabConfig = ActivityTabConfig; exports.FlowsTabConfig = FlowsTabConfig; exports.DocumentsTabConfig = DocumentsTabConfig; exports.TabBuilder = TabBuilder; exports.DetailViewBuilder = DetailViewBuilder; exports.ViewBuilder = ViewBuilder; exports.detailView = detailView; exports.view = view; exports.ListViewBuilder = ListViewBuilder; exports.ListViewTabConfigBuilder = ListViewTabConfigBuilder; exports.listView = listView; exports.group = group; exports.relationGroup = relationGroup; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowAssignBuilder = WorkflowAssignBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.WorkflowJwtService = WorkflowJwtService; exports.hashOptions = hashOptions; exports.cacheKeys = cacheKeys; exports.cacheTtl = cacheTtl; exports.defaultTtl = defaultTtl; exports.NoopCacheAdapter = NoopCacheAdapter; exports.formatRecord = formatRecord; exports.formatRecords = formatRecords; exports.createDefaultState = createDefaultState; exports.SHORTCUT_TO_FILTER_OPERATOR = SHORTCUT_TO_FILTER_OPERATOR; exports.QueryNoResultError = QueryNoResultError; exports.QueryMultipleResultsError = QueryMultipleResultsError; exports.TenantContextError = TenantContextError; exports.FeatureFlagsContextError = FeatureFlagsContextError; exports.isFeatureEnabled = isFeatureEnabled; exports.getFeatureValue = getFeatureValue; exports.getFeatureFlags = getFeatureFlags; exports.tryGetFeatureValue = tryGetFeatureValue; exports.hasFeatureFlagsContext = hasFeatureFlagsContext; exports.runWithFeatureFlags = runWithFeatureFlags; exports.withFeatureFlags = withFeatureFlags; exports.getSchemaFromContext = getSchemaFromContext; exports.getSchemaByNameFromContext = getSchemaByNameFromContext; exports.hasSchemaContext = hasSchemaContext; exports.getSchemaContext = getSchemaContext; exports.addSchemaToContext = addSchemaToContext; exports.runWithSchemaContext = runWithSchemaContext; exports.runWithMergedSchemaContext = runWithMergedSchemaContext; exports.getContext = getContext2; exports.getTenantId = getTenantId; exports.getUserId = getUserId; exports.hasContext = hasContext; exports.runWithContext = runWithContext; exports.withTenantContext = withTenantContext; exports.QueryBuilder = QueryBuilder; exports.createQueryBuilder = createQueryBuilder; exports.evaluateCondition = evaluateCondition; exports.evaluate = evaluate; exports.evaluateWithTrace = evaluateWithTrace; exports.ExecutorRegistry = ExecutorRegistry; exports.success = success; exports.wait = wait; exports.complete = complete; exports.error = error; exports.ConditionExecutor = ConditionExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.AssignExecutor = AssignExecutor; exports.StartExecutor = StartExecutor; exports.createDefaultExecutorRegistry = createDefaultExecutorRegistry; exports.getDefaultExecutorRegistry = getDefaultExecutorRegistry; exports.evaluateFormula = evaluateFormula; exports.evaluateFormulaWithResult = evaluateFormulaWithResult; exports.formatFormulaResult = formatFormulaResult; exports.evaluateFormulaAttribute = evaluateFormulaAttribute; exports.validateFormulaExpression = validateFormulaExpression; exports.extractFormulaVariables = extractFormulaVariables; exports.extractRelationReferences = extractRelationReferences; exports.extractRelationNames = extractRelationNames; exports.hasRelationReferences = hasRelationReferences; exports.flattenRelationsForEval = flattenRelationsForEval; exports.evaluateFormulaWithRelations = evaluateFormulaWithRelations; exports.evaluateFormulaAttributeWithRelations = evaluateFormulaAttributeWithRelations; exports.InvalidPathError = InvalidPathError; exports.MaxDepthExceededError = MaxDepthExceededError; exports.parsePath = parsePath; exports.validatePath = validatePath; exports.pathHasManyCardinality = pathHasManyCardinality; exports.getPathDepth = getPathDepth; exports.getTargetAttributeName = getTargetAttributeName; exports.getRelationPath = getRelationPath; exports.traversePath = traversePath; exports.resolveSingleValue = resolveSingleValue; exports.resolveMultiplePaths = resolveMultiplePaths; exports.NoopHookRegistry = NoopHookRegistry; exports.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.SORTABLE_ATTRIBUTE_TYPES = SORTABLE_ATTRIBUTE_TYPES; exports.BaseService = BaseService; exports.BaseRepository = BaseRepository; exports.SchemaContextAwareRepository = SchemaContextAwareRepository; exports.buildAuditChanges = buildAuditChanges; exports.ObjectSchemaService = ObjectSchemaService; exports.AuditService = AuditService; exports.UserService = UserService; exports.applyDefaultValues = applyDefaultValues; exports.checkPermission = checkPermission; exports.getPolicy = getPolicy; exports.buildPolicyContext = buildPolicyContext; exports.checkRecordAccess = checkRecordAccess; exports.checkRecordModifyOrThrow = checkRecordModifyOrThrow; exports.checkRecordDeleteOrThrow = checkRecordDeleteOrThrow; exports.checkSharedObjectWriteAccess = checkSharedObjectWriteAccess; exports.computeLabel = computeLabel; exports.enrichWithFormulas = enrichWithFormulas; exports.enrichRecordsWithFormulas = enrichRecordsWithFormulas; exports.createContextForCreate = createContextForCreate; exports.createContextForUpdate = createContextForUpdate; exports.createContextForDelete = createContextForDelete; exports.createContextForRestore = createContextForRestore; exports.recalculateParentRollups = recalculateParentRollups; exports.RelationPropertiesService = RelationPropertiesService; exports.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; exports.GrantNotFoundError = GrantNotFoundError; exports.GrantExpiredError = GrantExpiredError; exports.GrantRevokedError = GrantRevokedError; exports.TokenRevokedError = TokenRevokedError; exports.WorkflowAccessGrantService = WorkflowAccessGrantService; exports.WorkflowInstanceService = WorkflowInstanceService; exports.InvitationNotFoundError = InvitationNotFoundError; exports.InvitationExpiredError = InvitationExpiredError; exports.InvitationAlreadyAcceptedError = InvitationAlreadyAcceptedError; exports.InvitationRevokedError = InvitationRevokedError; exports.WorkflowInvitationService = WorkflowInvitationService; exports.WorkflowRelationService = WorkflowRelationService; exports.WorkflowService = WorkflowService; exports.UserProfileService = UserProfileService; exports.DocumentService = DocumentService; exports.DocumentProcessingService = DocumentProcessingService; exports.FileService = FileService; exports.GeocodingService = GeocodingService; exports.GlobalSearchService = GlobalSearchService; exports.PermissionService = PermissionService; exports.ViewService = ViewService; exports.seedRegistryViews = seedRegistryViews; exports.syncNativeViews = syncNativeViews; exports.verifyRegistryViewsSeeded = verifyRegistryViewsSeeded; exports.verifyNativeViewsSync = verifyNativeViewsSync; exports.getViewSeedPreview = getViewSeedPreview; exports.getViewSyncPreview = getViewSyncPreview; exports.syncNativeObjects = syncNativeObjects; exports.verifyNativeObjectsSync = verifyNativeObjectsSync; exports.getSyncPreview = getSyncPreview; exports.syncAll = syncAll;