@stndrds/schema 1.0.0-alpha.84 → 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,
@@ -3482,7 +3483,7 @@ function createMockAIUsageMetricsRepository(stores) {
3482
3483
  toolUsage[data.toolName] = (_nullishCoalesce(toolUsage[data.toolName], () => ( 0))) + 1;
3483
3484
  }
3484
3485
  const metrics = {
3485
- id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _57 => _57.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
3486
+ id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _57 => _57.id]), () => ( _chunkE6XO2STSjs.generateId.call(void 0, ))),
3486
3487
  tenantId,
3487
3488
  date: new Date(_nullishCoalesce(now.toISOString().split("T")[0], () => ( now.toISOString()))),
3488
3489
  requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _58 => _58.requestCount]), () => ( 0))) + 1,
@@ -3550,7 +3551,7 @@ function createMockFilesRepository(stores) {
3550
3551
  create(data) {
3551
3552
  const tenantId = getTenantId();
3552
3553
  const file2 = {
3553
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3554
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3554
3555
  tenantId,
3555
3556
  name: data.name,
3556
3557
  originalName: data.originalName,
@@ -3656,7 +3657,7 @@ function createMockObjectsRepository(stores) {
3656
3657
  create(data) {
3657
3658
  const tenantId = getTenantId();
3658
3659
  const obj = {
3659
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3660
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3660
3661
  tenantId,
3661
3662
  name: data.name,
3662
3663
  label: data.label,
@@ -3732,7 +3733,7 @@ function createMockObjectsRepository(stores) {
3732
3733
  }
3733
3734
  }
3734
3735
  const newObj = {
3735
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3736
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3736
3737
  tenantId,
3737
3738
  name: data.name,
3738
3739
  label: data.label,
@@ -3764,7 +3765,7 @@ function createMockAttributesRepository(stores) {
3764
3765
  },
3765
3766
  create(data) {
3766
3767
  const attr = {
3767
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
3768
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
3768
3769
  objectId: data.objectId,
3769
3770
  name: data.name,
3770
3771
  label: data.label,
@@ -4083,7 +4084,7 @@ function createMockObjectRecordsRepository(stores) {
4083
4084
  create(data) {
4084
4085
  const tenantId = getTenantId();
4085
4086
  const internal = {
4086
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4087
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4087
4088
  tenantId,
4088
4089
  objectId: data.objectId,
4089
4090
  label: data.label,
@@ -4390,7 +4391,7 @@ function createMockRelationAttributesRepository(stores) {
4390
4391
  results.push(existing);
4391
4392
  } else {
4392
4393
  const row = {
4393
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4394
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4394
4395
  tenantId: context.tenantId,
4395
4396
  fromObject: item.fromObject,
4396
4397
  fromId: item.fromId,
@@ -4550,7 +4551,7 @@ function createMockUserProfilesRepository(stores) {
4550
4551
  create(data) {
4551
4552
  const tenantId = getTenantId();
4552
4553
  const profile = {
4553
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4554
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4554
4555
  tenantId,
4555
4556
  authId: data.authId,
4556
4557
  email: data.email,
@@ -4621,9 +4622,9 @@ function createMockUserProfilesRepository(stores) {
4621
4622
  invite(data) {
4622
4623
  const tenantId = getTenantId();
4623
4624
  const profile = {
4624
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4625
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4625
4626
  tenantId,
4626
- authId: `invited-${_chunkNEVERCM3js.generateId.call(void 0, )}`,
4627
+ authId: `invited-${_chunkE6XO2STSjs.generateId.call(void 0, )}`,
4627
4628
  email: data.email,
4628
4629
  firstName: data.firstName,
4629
4630
  lastName: data.lastName,
@@ -4658,7 +4659,7 @@ function createMockPermissionsRepository(stores) {
4658
4659
  createRole(input) {
4659
4660
  const tenantId = getTenantId();
4660
4661
  const role = {
4661
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4662
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4662
4663
  tenantId,
4663
4664
  name: input.name,
4664
4665
  label: input.label,
@@ -4713,7 +4714,7 @@ function createMockPermissionsRepository(stores) {
4713
4714
  }
4714
4715
  for (const input of permissions) {
4715
4716
  const perm = {
4716
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4717
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4717
4718
  roleId,
4718
4719
  scope: input.scope,
4719
4720
  target: input.target,
@@ -4738,7 +4739,7 @@ function createMockPermissionsRepository(stores) {
4738
4739
  }
4739
4740
  }
4740
4741
  const userRole = {
4741
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
4742
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
4742
4743
  userProfileId: input.userProfileId,
4743
4744
  roleId: input.roleId,
4744
4745
  tenantId: input.tenantId,
@@ -4851,7 +4852,7 @@ function createMockViewsRepository(stores) {
4851
4852
  },
4852
4853
  create(data) {
4853
4854
  const tenantId = getTenantId();
4854
- const id = _chunkNEVERCM3js.generateId.call(void 0, );
4855
+ const id = _chunkE6XO2STSjs.generateId.call(void 0, );
4855
4856
  const now = /* @__PURE__ */ new Date();
4856
4857
  const dbView = {
4857
4858
  id,
@@ -4962,7 +4963,7 @@ function createMockViewOverlaysRepository(stores) {
4962
4963
  },
4963
4964
  create(data) {
4964
4965
  const tenantId = getTenantId();
4965
- const id = _chunkNEVERCM3js.generateId.call(void 0, );
4966
+ const id = _chunkE6XO2STSjs.generateId.call(void 0, );
4966
4967
  const now = /* @__PURE__ */ new Date();
4967
4968
  const overlay = {
4968
4969
  id,
@@ -5094,7 +5095,7 @@ function createMockWorkflowsRepository(stores) {
5094
5095
  const tenantId = getTenantId();
5095
5096
  const now = (/* @__PURE__ */ new Date()).toISOString();
5096
5097
  const workflow2 = {
5097
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5098
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5098
5099
  tenant_id: tenantId,
5099
5100
  name: data.name,
5100
5101
  label: data.label,
@@ -5209,7 +5210,7 @@ function createMockWorkflowInstancesRepository(stores) {
5209
5210
  const tenantId = getTenantId();
5210
5211
  const now = (/* @__PURE__ */ new Date()).toISOString();
5211
5212
  const instance = {
5212
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5213
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5213
5214
  tenant_id: tenantId,
5214
5215
  workflow_id: data.workflowId,
5215
5216
  workflow_version: data.workflowVersion,
@@ -5343,7 +5344,7 @@ function createMockWorkflowInvitationsRepository(stores) {
5343
5344
  const tenantId = getTenantId();
5344
5345
  const now = (/* @__PURE__ */ new Date()).toISOString();
5345
5346
  const invitation = {
5346
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5347
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5347
5348
  tenant_id: tenantId,
5348
5349
  instance_id: data.instanceId,
5349
5350
  recipient_email: data.recipientEmail,
@@ -5411,7 +5412,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
5411
5412
  const tenantId = getTenantId();
5412
5413
  const now = (/* @__PURE__ */ new Date()).toISOString();
5413
5414
  const grant = {
5414
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
5415
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
5415
5416
  tenant_id: tenantId,
5416
5417
  invitation_id: data.invitationId,
5417
5418
  instance_id: data.instanceId,
@@ -5822,6 +5823,9 @@ var FORBIDDEN_PROPERTY_TYPES = [
5822
5823
  "document",
5823
5824
  "richtext"
5824
5825
  ];
5826
+ function hasOptions2(attr) {
5827
+ return attr.type === "select" || attr.type === "status" || attr.type === "multiselect";
5828
+ }
5825
5829
 
5826
5830
  // src/builders/attribute-validators.ts
5827
5831
 
@@ -5926,6 +5930,20 @@ function validateOptions(options, attributeName) {
5926
5930
  validateIconName(option.icon, `option "${option.id}" of "${attributeName}"`);
5927
5931
  }
5928
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
+ }
5929
5947
  }
5930
5948
 
5931
5949
  // src/builders/attribute-builders.ts
@@ -7859,7 +7877,7 @@ var ListViewBuilder = class {
7859
7877
  }
7860
7878
  const config = {
7861
7879
  defaultFilters: this.data.defaultFilters ? {
7862
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
7880
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
7863
7881
  combinator: this.data.defaultFilters.combinator,
7864
7882
  rules: this.data.defaultFilters.rules
7865
7883
  } : void 0,
@@ -7872,7 +7890,7 @@ var ListViewBuilder = class {
7872
7890
  columns: tab.columns,
7873
7891
  columnSizing: tab.columnSizing,
7874
7892
  filters: tab.filters ? {
7875
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
7893
+ id: _chunkE6XO2STSjs.generateId.call(void 0, ),
7876
7894
  combinator: tab.filters.combinator,
7877
7895
  rules: tab.filters.rules
7878
7896
  } : void 0,
@@ -9123,7 +9141,7 @@ var ObjectSchemaService = class extends BaseService {
9123
9141
  const schema = await this.getObjectSchema(dbAttr.objectId);
9124
9142
  await this.adapter.objectRecords.batchRefreshStatus(
9125
9143
  dbAttr.objectId,
9126
- (values) => _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, values)
9144
+ (values) => _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, values)
9127
9145
  );
9128
9146
  }
9129
9147
  return this.convertDBAttributeToAttribute(updatedDbAttr);
@@ -9600,7 +9618,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9600
9618
  }
9601
9619
  }
9602
9620
  try {
9603
- return _chunkHUT6HYXJjs.parseAttributeConfig.call(void 0, attribute.type, configInput);
9621
+ return _chunkZW4N6FV7js.parseAttributeConfig.call(void 0, attribute.type, configInput);
9604
9622
  } catch (error2) {
9605
9623
  if (error2 instanceof Error) {
9606
9624
  throw new Error(`Invalid config for ${attribute.type} attribute: ${error2.message}`);
@@ -10210,6 +10228,7 @@ var BilateralSyncService = class extends BaseService {
10210
10228
  const addedIds = newData.ids.filter((id) => !oldData.ids.includes(id));
10211
10229
  const removedIds = oldData.ids.filter((id) => !newData.ids.includes(id));
10212
10230
  const commonIds = newData.ids.filter((id) => oldData.ids.includes(id));
10231
+ const inverseMappings = this.buildInverseMappings(sourceAttr);
10213
10232
  await Promise.all([
10214
10233
  // Add new relations
10215
10234
  ...addedIds.map(
@@ -10219,7 +10238,9 @@ var BilateralSyncService = class extends BaseService {
10219
10238
  sourceRecordId,
10220
10239
  sourceSchema.name,
10221
10240
  sourceAttr.name,
10222
- newData.properties.get(targetId)
10241
+ newData.properties.get(targetId),
10242
+ inverseMappings,
10243
+ bilateral
10223
10244
  )
10224
10245
  ),
10225
10246
  // Remove deleted relations
@@ -10235,7 +10256,9 @@ var BilateralSyncService = class extends BaseService {
10235
10256
  sourceSchema.name,
10236
10257
  sourceAttr.name,
10237
10258
  newData.properties.get(targetId),
10238
- oldData.properties.get(targetId)
10259
+ oldData.properties.get(targetId),
10260
+ inverseMappings,
10261
+ bilateral
10239
10262
  )
10240
10263
  )
10241
10264
  ]);
@@ -10279,7 +10302,7 @@ var BilateralSyncService = class extends BaseService {
10279
10302
  * Add an ID to an inverse relation (with properties).
10280
10303
  * @private
10281
10304
  */
10282
- async addInverseRelation(targetRecordId, inverseAttr, sourceRecordId, sourceObject, sourceAttribute, properties) {
10305
+ async addInverseRelation(targetRecordId, inverseAttr, sourceRecordId, sourceObject, sourceAttribute, properties, inverseMappings, bilateral) {
10283
10306
  const targetRecord = await this.adapter.objectRecords.findById(targetRecordId);
10284
10307
  if (!targetRecord) {
10285
10308
  return;
@@ -10310,14 +10333,27 @@ var BilateralSyncService = class extends BaseService {
10310
10333
  this.adapter
10311
10334
  );
10312
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
+ }
10313
10349
  }
10314
10350
  }
10315
10351
  /**
10316
10352
  * Update properties of an existing inverse relation.
10317
10353
  * @private
10318
10354
  */
10319
- async updateInverseRelationProperties(targetRecordId, _inverseAttr, sourceRecordId, sourceObject, sourceAttribute, newProperties, oldProperties) {
10320
- 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)) {
10321
10357
  return;
10322
10358
  }
10323
10359
  if (!this.adapter.relationAttributes) {
@@ -10335,12 +10371,32 @@ var BilateralSyncService = class extends BaseService {
10335
10371
  [{ id: targetRecordId, props: newProperties }],
10336
10372
  this.adapter
10337
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
+ }
10338
10387
  } else {
10339
10388
  await this.adapter.relationAttributes.deleteBySource(
10340
10389
  sourceObject,
10341
10390
  sourceRecordId,
10342
10391
  sourceAttribute
10343
10392
  );
10393
+ if (bilateral) {
10394
+ await this.adapter.relationAttributes.deleteBySource(
10395
+ bilateral.object,
10396
+ targetRecordId,
10397
+ bilateral.attribute
10398
+ );
10399
+ }
10344
10400
  }
10345
10401
  }
10346
10402
  /**
@@ -10372,6 +10428,54 @@ var BilateralSyncService = class extends BaseService {
10372
10428
  });
10373
10429
  await this.invalidateTargetRecordCaches(targetRecordId, targetRecord.objectId);
10374
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
+ }
10375
10479
  /**
10376
10480
  * Normalize a relation value to an array of IDs.
10377
10481
  * @private
@@ -10402,7 +10506,7 @@ var BilateralSyncService = class extends BaseService {
10402
10506
  const storage = getSyncContext();
10403
10507
  const existingCtx = storage.getStore();
10404
10508
  const ctx = {
10405
- syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess', _185 => _185.syncing]), () => ( [])))
10509
+ syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess', _187 => _187.syncing]), () => ( [])))
10406
10510
  };
10407
10511
  ctx.syncing.add(syncKey);
10408
10512
  return await storage.run(ctx, fn);
@@ -10510,7 +10614,7 @@ var UserService = class extends BaseService {
10510
10614
  if (roleErrors.length > 0) {
10511
10615
  errors.push({
10512
10616
  attribute: attrName,
10513
- message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _186 => _186.allowedRoles, 'optionalAccess', _187 => _187.join, 'call', _188 => _188(", ")])}`,
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(", ")])}`,
10514
10618
  invalidIds: roleErrors
10515
10619
  });
10516
10620
  }
@@ -11040,7 +11144,7 @@ var RelationPropertiesService = class extends BaseService {
11040
11144
  }
11041
11145
  }
11042
11146
  }
11043
- const shouldStoreAsInverse = _optionalChain([attribute, 'access', _189 => _189.bilateral, 'optionalAccess', _190 => _190.storageOwner]) === false;
11147
+ const shouldStoreAsInverse = _optionalChain([attribute, 'access', _191 => _191.bilateral, 'optionalAccess', _192 => _192.storageOwner]) === false;
11044
11148
  let storageFromObject = schema.name;
11045
11149
  let storageFromAttribute = attributeName;
11046
11150
  if (shouldStoreAsInverse && attribute.bilateral) {
@@ -11052,7 +11156,7 @@ var RelationPropertiesService = class extends BaseService {
11052
11156
  if (shouldStoreAsInverse) {
11053
11157
  const results = await Promise.all(
11054
11158
  normalized.map(
11055
- (item) => _optionalChain([adapter, 'access', _191 => _191.relationAttributes, 'optionalAccess', _192 => _192.findBySource, 'call', _193 => _193(
11159
+ (item) => _optionalChain([adapter, 'access', _193 => _193.relationAttributes, 'optionalAccess', _194 => _194.findBySource, 'call', _195 => _195(
11056
11160
  storageFromObject,
11057
11161
  item.id,
11058
11162
  storageFromAttribute
@@ -11179,7 +11283,7 @@ var RelationPropertiesService = class extends BaseService {
11179
11283
  buildZodSchema(propertySchema) {
11180
11284
  const shape = {};
11181
11285
  for (const def of propertySchema.definitions) {
11182
- shape[def.name] = _chunkHUT6HYXJjs.createFormAttributeValidator.call(void 0, def);
11286
+ shape[def.name] = _chunkZW4N6FV7js.createFormAttributeValidator.call(void 0, def);
11183
11287
  }
11184
11288
  return _zod.z.object(shape);
11185
11289
  }
@@ -11191,7 +11295,7 @@ var RecordQueryService = class extends BaseService {
11191
11295
  super(adapter);
11192
11296
  this.schemaService = schemaService;
11193
11297
  this.options = options;
11194
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _194 => _194.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _195 => _195.policyRegistry]), () => ( defaultPolicyRegistry));
11298
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _196 => _196.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _197 => _197.policyRegistry]), () => ( defaultPolicyRegistry));
11195
11299
  this.relationPropertiesService = new RelationPropertiesService(adapter);
11196
11300
  }
11197
11301
  // ============================================================================
@@ -11242,12 +11346,12 @@ var RecordQueryService = class extends BaseService {
11242
11346
  * Internal list query execution
11243
11347
  */
11244
11348
  async executeListQuery(schema, objectId, options) {
11245
- if (_optionalChain([this, 'access', _196 => _196.options, 'optionalAccess', _197 => _197.permissionService]) && this.userId) {
11349
+ if (_optionalChain([this, 'access', _198 => _198.options, 'optionalAccess', _199 => _199.permissionService]) && this.userId) {
11246
11350
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
11247
11351
  }
11248
- const policy = _optionalChain([options, 'optionalAccess', _198 => _198.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);
11249
11353
  let effectiveOptions = options;
11250
- if (_optionalChain([policy, 'optionalAccess', _199 => _199.applyListFilter]) && this.userId) {
11354
+ if (_optionalChain([policy, 'optionalAccess', _201 => _201.applyListFilter]) && this.userId) {
11251
11355
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
11252
11356
  effectiveOptions = policy.applyListFilter(ctx, options);
11253
11357
  }
@@ -11257,10 +11361,10 @@ var RecordQueryService = class extends BaseService {
11257
11361
  );
11258
11362
  let filteredRecords = result.records;
11259
11363
  let effectiveTotal = result.total;
11260
- if (_optionalChain([policy, 'optionalAccess', _200 => _200.canAccessRecord]) && this.userId) {
11364
+ if (_optionalChain([policy, 'optionalAccess', _202 => _202.canAccessRecord]) && this.userId) {
11261
11365
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
11262
- const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _201 => _201.limit]), () => ( 20));
11263
- const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _202 => _202.offset]), () => ( 0));
11366
+ const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _203 => _203.limit]), () => ( 20));
11367
+ const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _204 => _204.offset]), () => ( 0));
11264
11368
  const overfetchMultiplier = 5;
11265
11369
  const batchSize = requestedLimit * overfetchMultiplier;
11266
11370
  const maxScanRecords = 1e4;
@@ -11282,7 +11386,7 @@ var RecordQueryService = class extends BaseService {
11282
11386
  exhausted = true;
11283
11387
  break;
11284
11388
  }
11285
- const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _203 => _203.canAccessRecord, 'optionalCall', _204 => _204(ctx, record)]));
11389
+ const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _205 => _205.canAccessRecord, 'optionalCall', _206 => _206(ctx, record)]));
11286
11390
  collected.push(...filtered);
11287
11391
  dbOffset += batch.records.length;
11288
11392
  totalScanned += batch.records.length;
@@ -11298,7 +11402,7 @@ var RecordQueryService = class extends BaseService {
11298
11402
  filteredRecords,
11299
11403
  schema
11300
11404
  );
11301
- if (!_optionalChain([options, 'optionalAccess', _205 => _205.skipFormulas])) {
11405
+ if (!_optionalChain([options, 'optionalAccess', _207 => _207.skipFormulas])) {
11302
11406
  return {
11303
11407
  records: enrichRecordsWithFormulas(filteredRecords, schema),
11304
11408
  total: effectiveTotal
@@ -11358,17 +11462,17 @@ var RecordQueryService = class extends BaseService {
11358
11462
  * Internal search query execution
11359
11463
  */
11360
11464
  async executeSearchQuery(schema, objectId, query, options) {
11361
- if (_optionalChain([this, 'access', _206 => _206.options, 'optionalAccess', _207 => _207.permissionService]) && this.userId) {
11465
+ if (_optionalChain([this, 'access', _208 => _208.options, 'optionalAccess', _209 => _209.permissionService]) && this.userId) {
11362
11466
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
11363
11467
  }
11364
11468
  let result;
11365
11469
  if (this.adapter.search) {
11366
11470
  try {
11367
11471
  result = await this.adapter.search.searchRecords(objectId, query, {
11368
- limit: _optionalChain([options, 'optionalAccess', _208 => _208.limit]),
11369
- offset: _optionalChain([options, 'optionalAccess', _209 => _209.offset]),
11370
- sorts: _optionalChain([options, 'optionalAccess', _210 => _210.sorts]),
11371
- filters: _optionalChain([options, 'optionalAccess', _211 => _211.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]),
11372
11476
  attributes: schema.attributes
11373
11477
  });
11374
11478
  result = await this.healSearchResults(result);
@@ -11388,7 +11492,7 @@ var RecordQueryService = class extends BaseService {
11388
11492
  result.records,
11389
11493
  schema
11390
11494
  );
11391
- if (!_optionalChain([options, 'optionalAccess', _212 => _212.skipFormulas])) {
11495
+ if (!_optionalChain([options, 'optionalAccess', _214 => _214.skipFormulas])) {
11392
11496
  return {
11393
11497
  records: enrichRecordsWithFormulas(enrichedRecords, schema),
11394
11498
  total: result.total
@@ -11597,7 +11701,7 @@ var RelationService = class extends BaseService {
11597
11701
  }
11598
11702
  const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
11599
11703
  const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
11600
- if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _213 => _213.size]) === 0) {
11704
+ if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _215 => _215.size]) === 0) {
11601
11705
  errors.push({
11602
11706
  attribute: attr.name,
11603
11707
  message: `No valid target objects found for ${attr.label}`
@@ -11650,7 +11754,7 @@ var RelationService = class extends BaseService {
11650
11754
  for (const target of targets) {
11651
11755
  try {
11652
11756
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
11653
- if (_optionalChain([objectSchema, 'optionalAccess', _214 => _214.id])) {
11757
+ if (_optionalChain([objectSchema, 'optionalAccess', _216 => _216.id])) {
11654
11758
  objectIds.add(objectSchema.id);
11655
11759
  }
11656
11760
  } catch (e17) {
@@ -11719,7 +11823,7 @@ var RelationService = class extends BaseService {
11719
11823
  const targetResults = await Promise.all(
11720
11824
  filteredTargets.map(async (target) => {
11721
11825
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
11722
- if (!_optionalChain([objectSchema, 'optionalAccess', _215 => _215.id])) return { options: [], total: 0 };
11826
+ if (!_optionalChain([objectSchema, 'optionalAccess', _217 => _217.id])) return { options: [], total: 0 };
11723
11827
  const objectId = objectSchema.id;
11724
11828
  const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
11725
11829
  const options = await Promise.all(
@@ -11876,8 +11980,8 @@ var RelationService = class extends BaseService {
11876
11980
  continue;
11877
11981
  }
11878
11982
  const attribute = attributeMap.get(attributeId);
11879
- const targetConfig = _optionalChain([attribute, 'optionalAccess', _216 => _216.targets, 'optionalAccess', _217 => _217.find, 'call', _218 => _218((t) => t.object === objectSchema.name)]);
11880
- const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _219 => _219.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]);
11881
11985
  const label = await this.resolveLabel(record, objectSchema, customTemplate);
11882
11986
  resolved.push({
11883
11987
  _compositeId: compositeId,
@@ -12040,14 +12144,14 @@ var RollupService = class extends BaseService {
12040
12144
  const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
12041
12145
  let sourceObjectId;
12042
12146
  let reverseRelationAttrName;
12043
- if (_optionalChain([sourceSchema, 'optionalAccess', _220 => _220.id])) {
12147
+ if (_optionalChain([sourceSchema, 'optionalAccess', _222 => _222.id])) {
12044
12148
  sourceObjectId = sourceSchema.id;
12045
12149
  const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
12046
12150
  if (attr.type !== "relation") return false;
12047
12151
  const relationConfig = attr;
12048
- return _optionalChain([relationConfig, 'optionalAccess', _221 => _221.targets, 'optionalAccess', _222 => _222.some, 'call', _223 => _223((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)]);
12049
12153
  });
12050
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _224 => _224.name]);
12154
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _226 => _226.name]);
12051
12155
  } else {
12052
12156
  const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
12053
12157
  if (!sourceObject) {
@@ -12058,9 +12162,9 @@ var RollupService = class extends BaseService {
12058
12162
  const reverseRelationAttr = sourceAttributes.find((attr) => {
12059
12163
  if (attr.type !== "relation") return false;
12060
12164
  const relationConfig = attr.config;
12061
- return _optionalChain([relationConfig, 'optionalAccess', _225 => _225.targets, 'optionalAccess', _226 => _226.some, 'call', _227 => _227((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)]);
12062
12166
  });
12063
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _228 => _228.name]);
12167
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _230 => _230.name]);
12064
12168
  }
12065
12169
  if (!reverseRelationAttrName) {
12066
12170
  return { value: null, recordCount: 0 };
@@ -12316,13 +12420,13 @@ var RollupService = class extends BaseService {
12316
12420
  if (!obj) continue;
12317
12421
  for (const rollupDbAttr of rollupAttrs) {
12318
12422
  const rollupConfig = rollupDbAttr.config;
12319
- if (!_optionalChain([rollupConfig, 'optionalAccess', _229 => _229.relationAttribute])) continue;
12423
+ if (!_optionalChain([rollupConfig, 'optionalAccess', _231 => _231.relationAttribute])) continue;
12320
12424
  const relationAttr = attributes.find(
12321
12425
  (a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
12322
12426
  );
12323
12427
  if (!relationAttr) continue;
12324
12428
  const relationConfig = relationAttr.config;
12325
- const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _230 => _230.targets, 'optionalAccess', _231 => _231.some, 'call', _232 => _232(
12429
+ const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _232 => _232.targets, 'optionalAccess', _233 => _233.some, 'call', _234 => _234(
12326
12430
  (t) => t.object === changedSchema.name
12327
12431
  )]);
12328
12432
  if (!targetsChangedObject) continue;
@@ -12347,11 +12451,11 @@ var RecordService = class extends BaseService {
12347
12451
  constructor(adapter, options) {
12348
12452
  super(adapter);
12349
12453
  this.schemaService = new ObjectSchemaService(adapter, registry, {
12350
- auditService: _optionalChain([options, 'optionalAccess', _233 => _233.auditService])
12454
+ auditService: _optionalChain([options, 'optionalAccess', _235 => _235.auditService])
12351
12455
  });
12352
- this.permissionService = _optionalChain([options, 'optionalAccess', _234 => _234.permissionService]);
12353
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _235 => _235.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
12354
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _236 => _236.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _237 => _237.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));
12355
12459
  this.recordResolver = new RecordResolverService(adapter);
12356
12460
  this.queryService = new RecordQueryService(adapter, this.schemaService, {
12357
12461
  permissionService: this.permissionService,
@@ -12366,7 +12470,7 @@ var RecordService = class extends BaseService {
12366
12470
  recordResolver: this.recordResolver
12367
12471
  });
12368
12472
  this.userService = new UserService(adapter);
12369
- this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _238 => _238.hookRegistry]), () => ( new NoopHookRegistry()));
12473
+ this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _240 => _240.hookRegistry]), () => ( new NoopHookRegistry()));
12370
12474
  this.bilateralSyncService = new BilateralSyncService(
12371
12475
  adapter,
12372
12476
  this.schemaService,
@@ -12406,41 +12510,41 @@ var RecordService = class extends BaseService {
12406
12510
  schema,
12407
12511
  this.tenantId,
12408
12512
  dataWithDefaults,
12409
- _optionalChain([options, 'optionalAccess', _239 => _239.hookMetadata])
12513
+ _optionalChain([options, 'optionalAccess', _241 => _241.hookMetadata])
12410
12514
  );
12411
- if (!_optionalChain([options, 'optionalAccess', _240 => _240.skipHooks])) {
12515
+ if (!_optionalChain([options, 'optionalAccess', _242 => _242.skipHooks])) {
12412
12516
  await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
12413
12517
  }
12414
12518
  const normalizedData = this.relationPropertiesService.normalizeRelationValuesForStorage(
12415
12519
  schema,
12416
12520
  dataWithDefaults
12417
12521
  );
12418
- if (_optionalChain([options, 'optionalAccess', _241 => _241.validate]) !== false) {
12419
- if (_optionalChain([options, 'optionalAccess', _242 => _242.allowDraft])) {
12420
- _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);
12421
12525
  } else {
12422
- _chunkHUT6HYXJjs.validateObjectOrThrow.call(void 0, schema, normalizedData);
12526
+ _chunkZW4N6FV7js.validateObjectOrThrow.call(void 0, schema, normalizedData);
12423
12527
  }
12424
- if (!_optionalChain([options, 'optionalAccess', _243 => _243.skipRelationValidation])) {
12528
+ if (!_optionalChain([options, 'optionalAccess', _245 => _245.skipRelationValidation])) {
12425
12529
  await this.relationService.validateRelationsOrThrow(schema, normalizedData);
12426
12530
  }
12427
- if (!_optionalChain([options, 'optionalAccess', _244 => _244.skipUserValidation])) {
12531
+ if (!_optionalChain([options, 'optionalAccess', _246 => _246.skipUserValidation])) {
12428
12532
  await this.userService.validateUsersOrThrow(schema, normalizedData);
12429
12533
  }
12430
12534
  }
12431
- const completionStatus = _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, normalizedData);
12535
+ const completionStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, normalizedData);
12432
12536
  const label = await computeLabel(schema, normalizedData, this.labelResolver);
12433
12537
  const record = await this.adapter.objectRecords.create({
12434
12538
  objectId,
12435
12539
  data: normalizedData,
12436
12540
  label,
12437
12541
  completionStatus,
12438
- metadata: _optionalChain([options, 'optionalAccess', _245 => _245.metadata]),
12542
+ metadata: _optionalChain([options, 'optionalAccess', _247 => _247.metadata]),
12439
12543
  createdBy: this.userId
12440
12544
  });
12441
12545
  for (const [attrName, value] of Object.entries(dataWithDefaults)) {
12442
12546
  const attr = schema.attributes.find((a) => a.name === attrName);
12443
- if (_optionalChain([attr, 'optionalAccess', _246 => _246.type]) === "relation") {
12547
+ if (_optionalChain([attr, 'optionalAccess', _248 => _248.type]) === "relation") {
12444
12548
  const hasProperties2 = attr.properties !== void 0;
12445
12549
  const isBilateral = isBilateralRelation(attr);
12446
12550
  if (hasProperties2 || isBilateral) {
@@ -12454,9 +12558,9 @@ var RecordService = class extends BaseService {
12454
12558
  }
12455
12559
  }
12456
12560
  }
12457
- for (const [attrName, value] of Object.entries(normalizedData)) {
12561
+ for (const [attrName, value] of Object.entries(dataWithDefaults)) {
12458
12562
  const attr = schema.attributes.find((a) => a.name === attrName);
12459
- if (_optionalChain([attr, 'optionalAccess', _247 => _247.type]) === "relation" && isBilateralRelation(attr)) {
12563
+ if (_optionalChain([attr, 'optionalAccess', _249 => _249.type]) === "relation" && isBilateralRelation(attr)) {
12460
12564
  await this.bilateralSyncService.syncBilateralRelation(
12461
12565
  schema,
12462
12566
  record.id,
@@ -12467,7 +12571,7 @@ var RecordService = class extends BaseService {
12467
12571
  );
12468
12572
  }
12469
12573
  }
12470
- if (!_optionalChain([options, 'optionalAccess', _248 => _248.skipHooks])) {
12574
+ if (!_optionalChain([options, 'optionalAccess', _250 => _250.skipHooks])) {
12471
12575
  const afterCtx = {
12472
12576
  ...hookCtx,
12473
12577
  recordId: record.id,
@@ -12477,11 +12581,11 @@ var RecordService = class extends BaseService {
12477
12581
  }
12478
12582
  await recalculateParentRollups(record, schema, this.rollupContext);
12479
12583
  await this.invalidateRecordCaches(record.id, objectId);
12480
- _optionalChain([this, 'access', _249 => _249.adapter, 'access', _250 => _250.search, 'optionalAccess', _251 => _251.indexRecord, 'call', _252 => _252(record, {
12584
+ _optionalChain([this, 'access', _251 => _251.adapter, 'access', _252 => _252.search, 'optionalAccess', _253 => _253.indexRecord, 'call', _254 => _254(record, {
12481
12585
  objectName: schema.name,
12482
12586
  objectLabel: schema.label,
12483
12587
  attributes: schema.attributes
12484
- }), 'access', _253 => _253.catch, 'call', _254 => _254((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))]);
12485
12589
  if (this.auditService && this.userId) {
12486
12590
  this.auditService.logRecordAction({
12487
12591
  action: "record.created",
@@ -12490,7 +12594,7 @@ var RecordService = class extends BaseService {
12490
12594
  objectId: schema.id,
12491
12595
  recordId: record.id,
12492
12596
  recordLabel: record.label,
12493
- metadata: _optionalChain([options, 'optionalAccess', _255 => _255.hookMetadata])
12597
+ metadata: _optionalChain([options, 'optionalAccess', _257 => _257.hookMetadata])
12494
12598
  }).catch(() => {
12495
12599
  });
12496
12600
  }
@@ -12513,7 +12617,7 @@ var RecordService = class extends BaseService {
12513
12617
  return null;
12514
12618
  }
12515
12619
  const schema = await this.schemaService.getObjectSchema(record.objectId);
12516
- if (!_optionalChain([options, 'optionalAccess', _256 => _256.skipPolicyCheck])) {
12620
+ if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipPolicyCheck])) {
12517
12621
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
12518
12622
  if (policy) {
12519
12623
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
@@ -12523,11 +12627,11 @@ var RecordService = class extends BaseService {
12523
12627
  }
12524
12628
  }
12525
12629
  let enrichedRecord = record;
12526
- if (!_optionalChain([options, 'optionalAccess', _257 => _257.skipFormulas])) {
12630
+ if (!_optionalChain([options, 'optionalAccess', _259 => _259.skipFormulas])) {
12527
12631
  enrichedRecord = enrichWithFormulas(record, schema);
12528
12632
  }
12529
12633
  enrichedRecord = await this.enrichRelationProperties(enrichedRecord, schema);
12530
- if (_optionalChain([options, 'optionalAccess', _258 => _258.includeSchema])) {
12634
+ if (_optionalChain([options, 'optionalAccess', _260 => _260.includeSchema])) {
12531
12635
  const recordWithSchema = enrichedRecord;
12532
12636
  recordWithSchema.schema = schema;
12533
12637
  return recordWithSchema;
@@ -12589,9 +12693,9 @@ var RecordService = class extends BaseService {
12589
12693
  existing,
12590
12694
  mergedData,
12591
12695
  changedAttributes,
12592
- _optionalChain([options, 'optionalAccess', _259 => _259.hookMetadata])
12696
+ _optionalChain([options, 'optionalAccess', _261 => _261.hookMetadata])
12593
12697
  );
12594
- if (!_optionalChain([options, 'optionalAccess', _260 => _260.skipHooks])) {
12698
+ if (!_optionalChain([options, 'optionalAccess', _262 => _262.skipHooks])) {
12595
12699
  await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
12596
12700
  }
12597
12701
  const hookModifiedValues = {};
@@ -12606,20 +12710,20 @@ var RecordService = class extends BaseService {
12606
12710
  dataToUpdate
12607
12711
  );
12608
12712
  const normalizedMergedData = { ...existing.values, ...normalizedUpdate };
12609
- if (_optionalChain([options, 'optionalAccess', _261 => _261.validate]) !== false) {
12610
- if (_optionalChain([options, 'optionalAccess', _262 => _262.partial])) {
12611
- _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);
12612
12716
  } else {
12613
- _chunkHUT6HYXJjs.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
12717
+ _chunkZW4N6FV7js.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
12614
12718
  }
12615
- if (!_optionalChain([options, 'optionalAccess', _263 => _263.skipRelationValidation])) {
12719
+ if (!_optionalChain([options, 'optionalAccess', _265 => _265.skipRelationValidation])) {
12616
12720
  await this.relationService.validateRelationsOrThrow(schema, normalizedUpdate);
12617
12721
  }
12618
- if (!_optionalChain([options, 'optionalAccess', _264 => _264.skipUserValidation])) {
12722
+ if (!_optionalChain([options, 'optionalAccess', _266 => _266.skipUserValidation])) {
12619
12723
  await this.userService.validateUsersOrThrow(schema, normalizedUpdate);
12620
12724
  }
12621
12725
  }
12622
- const completionStatus = _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, normalizedMergedData);
12726
+ const completionStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, normalizedMergedData);
12623
12727
  const label = await computeLabel(schema, normalizedMergedData, this.labelResolver);
12624
12728
  const updatePayload = {
12625
12729
  ...normalizedUpdate,
@@ -12628,7 +12732,7 @@ var RecordService = class extends BaseService {
12628
12732
  __lastUpdatedBy: this.userId,
12629
12733
  __expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
12630
12734
  };
12631
- if (_optionalChain([options, 'optionalAccess', _265 => _265.metadata]) !== void 0) {
12735
+ if (_optionalChain([options, 'optionalAccess', _267 => _267.metadata]) !== void 0) {
12632
12736
  const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
12633
12737
  const mergedMetadata = { ...existingMetadata, ...options.metadata };
12634
12738
  const cleanedMetadata = Object.fromEntries(
@@ -12639,20 +12743,20 @@ var RecordService = class extends BaseService {
12639
12743
  const bilateralOldValues = {};
12640
12744
  for (const attrName of Object.keys(normalizedUpdate)) {
12641
12745
  const attr = schema.attributes.find((a) => a.name === attrName);
12642
- if (_optionalChain([attr, 'optionalAccess', _266 => _266.type]) === "relation" && isBilateralRelation(attr)) {
12746
+ if (_optionalChain([attr, 'optionalAccess', _268 => _268.type]) === "relation" && isBilateralRelation(attr)) {
12643
12747
  bilateralOldValues[attrName] = existing.values[attrName];
12644
12748
  }
12645
12749
  }
12646
12750
  const updated = await this.adapter.objectRecords.update(recordId, updatePayload);
12647
12751
  await this.invalidateRecordCaches(recordId, existing.objectId);
12648
- _optionalChain([this, 'access', _267 => _267.adapter, 'access', _268 => _268.search, 'optionalAccess', _269 => _269.indexRecord, 'call', _270 => _270(updated, {
12752
+ _optionalChain([this, 'access', _269 => _269.adapter, 'access', _270 => _270.search, 'optionalAccess', _271 => _271.indexRecord, 'call', _272 => _272(updated, {
12649
12753
  objectName: schema.name,
12650
12754
  objectLabel: schema.label,
12651
12755
  attributes: schema.attributes
12652
- }), 'access', _271 => _271.catch, 'call', _272 => _272((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))]);
12653
12757
  for (const [attrName, value] of Object.entries(dataToUpdate)) {
12654
12758
  const attr = schema.attributes.find((a) => a.name === attrName);
12655
- if (_optionalChain([attr, 'optionalAccess', _273 => _273.type]) === "relation") {
12759
+ if (_optionalChain([attr, 'optionalAccess', _275 => _275.type]) === "relation") {
12656
12760
  const hasProperties2 = attr.properties !== void 0;
12657
12761
  const isBilateral = isBilateralRelation(attr);
12658
12762
  if (hasProperties2 || isBilateral) {
@@ -12666,9 +12770,9 @@ var RecordService = class extends BaseService {
12666
12770
  }
12667
12771
  }
12668
12772
  }
12669
- for (const [attrName, value] of Object.entries(normalizedUpdate)) {
12773
+ for (const [attrName, value] of Object.entries(dataToUpdate)) {
12670
12774
  const attr = schema.attributes.find((a) => a.name === attrName);
12671
- if (_optionalChain([attr, 'optionalAccess', _274 => _274.type]) === "relation" && isBilateralRelation(attr)) {
12775
+ if (_optionalChain([attr, 'optionalAccess', _276 => _276.type]) === "relation" && isBilateralRelation(attr)) {
12672
12776
  const oldValue = bilateralOldValues[attrName];
12673
12777
  await this.bilateralSyncService.syncBilateralRelation(
12674
12778
  schema,
@@ -12679,7 +12783,7 @@ var RecordService = class extends BaseService {
12679
12783
  );
12680
12784
  }
12681
12785
  }
12682
- if (!_optionalChain([options, 'optionalAccess', _275 => _275.skipHooks])) {
12786
+ if (!_optionalChain([options, 'optionalAccess', _277 => _277.skipHooks])) {
12683
12787
  const afterCtx = {
12684
12788
  ...hookCtx,
12685
12789
  record: updated
@@ -12694,7 +12798,7 @@ var RecordService = class extends BaseService {
12694
12798
  if (this.auditService && this.userId && allChangedAttributes.length > 0) {
12695
12799
  const changes = allChangedAttributes.map((attr) => ({
12696
12800
  field: attr,
12697
- oldValue: _optionalChain([hookCtx, 'access', _276 => _276.oldValues, 'optionalAccess', _277 => _277[attr]]),
12801
+ oldValue: _optionalChain([hookCtx, 'access', _278 => _278.oldValues, 'optionalAccess', _279 => _279[attr]]),
12698
12802
  newValue: hookCtx.newValues[attr]
12699
12803
  }));
12700
12804
  this.auditService.logRecordAction({
@@ -12705,7 +12809,7 @@ var RecordService = class extends BaseService {
12705
12809
  recordId: updated.id,
12706
12810
  recordLabel: updated.label,
12707
12811
  changes,
12708
- metadata: _optionalChain([options, 'optionalAccess', _278 => _278.hookMetadata])
12812
+ metadata: _optionalChain([options, 'optionalAccess', _280 => _280.hookMetadata])
12709
12813
  }).catch(() => {
12710
12814
  });
12711
12815
  }
@@ -12737,17 +12841,17 @@ var RecordService = class extends BaseService {
12737
12841
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
12738
12842
  checkRecordDeleteOrThrow(policy, record, ctx);
12739
12843
  }
12740
- if (_optionalChain([options, 'optionalAccess', _279 => _279.checkSystem]) && schema.system) {
12844
+ if (_optionalChain([options, 'optionalAccess', _281 => _281.checkSystem]) && schema.system) {
12741
12845
  throw new ProtectedResourceError("object", schema.name, "delete");
12742
12846
  }
12743
- if (!_optionalChain([options, 'optionalAccess', _280 => _280.skipReferenceCheck])) {
12847
+ if (!_optionalChain([options, 'optionalAccess', _282 => _282.skipReferenceCheck])) {
12744
12848
  const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
12745
12849
  if (references.length > 0) {
12746
12850
  throw new RecordReferencedError(recordId, references);
12747
12851
  }
12748
12852
  }
12749
- const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _281 => _281.hookMetadata]));
12750
- if (!_optionalChain([options, 'optionalAccess', _282 => _282.skipHooks])) {
12853
+ const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _283 => _283.hookMetadata]));
12854
+ if (!_optionalChain([options, 'optionalAccess', _284 => _284.skipHooks])) {
12751
12855
  await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
12752
12856
  }
12753
12857
  for (const attr of schema.attributes) {
@@ -12765,8 +12869,8 @@ var RecordService = class extends BaseService {
12765
12869
  }
12766
12870
  await this.adapter.objectRecords.delete(recordId);
12767
12871
  await this.invalidateRecordCaches(recordId, record.objectId);
12768
- _optionalChain([this, 'access', _283 => _283.adapter, 'access', _284 => _284.search, 'optionalAccess', _285 => _285.removeRecord, 'call', _286 => _286(recordId), 'access', _287 => _287.catch, 'call', _288 => _288((err) => console.error("[search] Failed to remove deleted record", recordId, err))]);
12769
- if (!_optionalChain([options, 'optionalAccess', _289 => _289.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])) {
12770
12874
  await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
12771
12875
  }
12772
12876
  await recalculateParentRollups(record, schema, this.rollupContext);
@@ -12778,7 +12882,7 @@ var RecordService = class extends BaseService {
12778
12882
  objectId: schema.id,
12779
12883
  recordId: record.id,
12780
12884
  recordLabel: record.label,
12781
- metadata: _optionalChain([options, 'optionalAccess', _290 => _290.hookMetadata])
12885
+ metadata: _optionalChain([options, 'optionalAccess', _292 => _292.hookMetadata])
12782
12886
  }).catch(() => {
12783
12887
  });
12784
12888
  }
@@ -12839,18 +12943,18 @@ var RecordService = class extends BaseService {
12839
12943
  this.tenantId
12840
12944
  );
12841
12945
  await checkPermission(this.permissionService, this.userId, schema.name, "update");
12842
- const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _291 => _291.hookMetadata]));
12843
- if (!_optionalChain([options, 'optionalAccess', _292 => _292.skipHooks])) {
12946
+ const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _293 => _293.hookMetadata]));
12947
+ if (!_optionalChain([options, 'optionalAccess', _294 => _294.skipHooks])) {
12844
12948
  await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
12845
12949
  }
12846
12950
  const restored = await this.adapter.objectRecords.restore(recordId);
12847
12951
  await this.invalidateRecordCaches(recordId, record.objectId);
12848
- _optionalChain([this, 'access', _293 => _293.adapter, 'access', _294 => _294.search, 'optionalAccess', _295 => _295.indexRecord, 'call', _296 => _296(restored, {
12952
+ _optionalChain([this, 'access', _295 => _295.adapter, 'access', _296 => _296.search, 'optionalAccess', _297 => _297.indexRecord, 'call', _298 => _298(restored, {
12849
12953
  objectName: schema.name,
12850
12954
  objectLabel: schema.label,
12851
12955
  attributes: schema.attributes
12852
- }), 'access', _297 => _297.catch, 'call', _298 => _298((err) => console.error("[search] Failed to index restored record", restored.id, err))]);
12853
- if (!_optionalChain([options, 'optionalAccess', _299 => _299.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])) {
12854
12958
  const afterCtx = {
12855
12959
  ...hookCtx,
12856
12960
  record: restored
@@ -12865,7 +12969,7 @@ var RecordService = class extends BaseService {
12865
12969
  objectId: schema.id,
12866
12970
  recordId: restored.id,
12867
12971
  recordLabel: restored.label,
12868
- metadata: _optionalChain([options, 'optionalAccess', _300 => _300.hookMetadata])
12972
+ metadata: _optionalChain([options, 'optionalAccess', _302 => _302.hookMetadata])
12869
12973
  }).catch(() => {
12870
12974
  });
12871
12975
  }
@@ -12964,14 +13068,14 @@ var RecordService = class extends BaseService {
12964
13068
  */
12965
13069
  async validateData(objectId, data) {
12966
13070
  const schema = await this.schemaService.getObjectSchema(objectId);
12967
- return _chunkHUT6HYXJjs.validateObject.call(void 0, schema, data);
13071
+ return _chunkZW4N6FV7js.validateObject.call(void 0, schema, data);
12968
13072
  }
12969
13073
  /**
12970
13074
  * Compute the completion status for given data without saving
12971
13075
  */
12972
13076
  async computeStatus(objectId, data) {
12973
13077
  const schema = await this.schemaService.getObjectSchema(objectId);
12974
- return _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, data);
13078
+ return _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, data);
12975
13079
  }
12976
13080
  /**
12977
13081
  * Refresh the completion status of an existing record
@@ -12979,7 +13083,7 @@ var RecordService = class extends BaseService {
12979
13083
  async refreshRecordStatus(recordId) {
12980
13084
  const record = await this.getRecordOrThrow(recordId);
12981
13085
  const schema = await this.schemaService.getObjectSchema(record.objectId);
12982
- const newStatus = _chunkHUT6HYXJjs.computeRecordStatus.call(void 0, schema, record.values);
13086
+ const newStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, record.values);
12983
13087
  if (record.completionStatus !== newStatus) {
12984
13088
  await this.adapter.objectRecords.update(recordId, {
12985
13089
  __completionStatus: newStatus
@@ -13466,7 +13570,7 @@ var WorkflowAccessGrantService = class extends BaseService {
13466
13570
  * Check if a specific token has been revoked.
13467
13571
  */
13468
13572
  isTokenRevoked(dbGrant, jti) {
13469
- return _nullishCoalesce(_optionalChain([dbGrant, 'access', _301 => _301.revoked_token_jtis, 'optionalAccess', _302 => _302.includes, 'call', _303 => _303(jti)]), () => ( false));
13573
+ return _nullishCoalesce(_optionalChain([dbGrant, 'access', _303 => _303.revoked_token_jtis, 'optionalAccess', _304 => _304.includes, 'call', _305 => _305(jti)]), () => ( false));
13470
13574
  }
13471
13575
  /**
13472
13576
  * Validate access token payload against the grant.
@@ -13518,9 +13622,9 @@ var WorkflowInstanceService = class extends BaseService {
13518
13622
  constructor(adapter, workflowService, options) {
13519
13623
  super(adapter);
13520
13624
  this.workflowService = workflowService;
13521
- this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _304 => _304.executorRegistry]), () => ( getDefaultExecutorRegistry()));
13522
- this.schemaService = _optionalChain([options, 'optionalAccess', _305 => _305.schemaService]);
13523
- this.recordService = _optionalChain([options, 'optionalAccess', _306 => _306.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]);
13524
13628
  }
13525
13629
  /**
13526
13630
  * Start a new workflow instance
@@ -13549,8 +13653,8 @@ var WorkflowInstanceService = class extends BaseService {
13549
13653
  context.variables = input.variables;
13550
13654
  }
13551
13655
  const instance = {
13552
- id: _chunkNEVERCM3js.generateId.call(void 0, ),
13553
- 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, ))),
13554
13658
  workflowVersion: workflow2.version,
13555
13659
  workflowSnapshot: workflow2,
13556
13660
  status: "running",
@@ -13702,7 +13806,7 @@ var WorkflowInstanceService = class extends BaseService {
13702
13806
  if (!this.adapter.workflowInstances) {
13703
13807
  return { instances: [], total: 0 };
13704
13808
  }
13705
- if (_optionalChain([options, 'optionalAccess', _307 => _307.workflowName])) {
13809
+ if (_optionalChain([options, 'optionalAccess', _309 => _309.workflowName])) {
13706
13810
  const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
13707
13811
  options.workflowName,
13708
13812
  { status: options.status }
@@ -13716,11 +13820,11 @@ var WorkflowInstanceService = class extends BaseService {
13716
13820
  return { instances: instances2, total: total2 };
13717
13821
  }
13718
13822
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
13719
- limit: _optionalChain([options, 'optionalAccess', _308 => _308.limit]),
13720
- offset: _optionalChain([options, 'optionalAccess', _309 => _309.offset])
13823
+ limit: _optionalChain([options, 'optionalAccess', _310 => _310.limit]),
13824
+ offset: _optionalChain([options, 'optionalAccess', _311 => _311.offset])
13721
13825
  });
13722
13826
  let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
13723
- if (_optionalChain([options, 'optionalAccess', _310 => _310.status])) {
13827
+ if (_optionalChain([options, 'optionalAccess', _312 => _312.status])) {
13724
13828
  instances = instances.filter((i) => i.status === options.status);
13725
13829
  }
13726
13830
  instances = await this.markExpiredInstances(instances);
@@ -13741,9 +13845,9 @@ var WorkflowInstanceService = class extends BaseService {
13741
13845
  return { instances: [], total: 0 };
13742
13846
  }
13743
13847
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
13744
- status: _optionalChain([options, 'optionalAccess', _311 => _311.status]),
13745
- limit: _optionalChain([options, 'optionalAccess', _312 => _312.limit]),
13746
- offset: _optionalChain([options, 'optionalAccess', _313 => _313.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])
13747
13851
  });
13748
13852
  const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
13749
13853
  return { instances, total };
@@ -13778,7 +13882,7 @@ var WorkflowInstanceService = class extends BaseService {
13778
13882
  updatedAt: /* @__PURE__ */ new Date()
13779
13883
  };
13780
13884
  }
13781
- const executionId = _chunkNEVERCM3js.generateId.call(void 0, );
13885
+ const executionId = _chunkE6XO2STSjs.generateId.call(void 0, );
13782
13886
  let current = {
13783
13887
  ...instance,
13784
13888
  context: {
@@ -13809,7 +13913,7 @@ var WorkflowInstanceService = class extends BaseService {
13809
13913
  try {
13810
13914
  const schemas = await Promise.all(
13811
13915
  current.workflowSnapshot.slots.map(
13812
- (slot) => _optionalChain([this, 'access', _314 => _314.schemaService, 'optionalAccess', _315 => _315.getObjectSchemaByName, 'call', _316 => _316(slot.objectName)])
13916
+ (slot) => _optionalChain([this, 'access', _316 => _316.schemaService, 'optionalAccess', _317 => _317.getObjectSchemaByName, 'call', _318 => _318(slot.objectName)])
13813
13917
  )
13814
13918
  );
13815
13919
  objectDefinitions = schemas.filter(
@@ -14067,8 +14171,8 @@ var WorkflowInstanceService = class extends BaseService {
14067
14171
  */
14068
14172
  async snapshotRecord(recordId) {
14069
14173
  try {
14070
- const record = await _optionalChain([this, 'access', _317 => _317.recordService, 'optionalAccess', _318 => _318.getRecord, 'call', _319 => _319(recordId, { skipPolicyCheck: true })]);
14071
- return _optionalChain([record, 'optionalAccess', _320 => _320.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]);
14072
14176
  } catch (e20) {
14073
14177
  return void 0;
14074
14178
  }
@@ -14087,13 +14191,13 @@ var WorkflowInstanceService = class extends BaseService {
14087
14191
  for (const op of [...operations].reverse()) {
14088
14192
  try {
14089
14193
  if (op.operation === "create") {
14090
- await _optionalChain([this, 'access', _321 => _321.recordService, 'optionalAccess', _322 => _322.deleteRecord, 'call', _323 => _323(op.recordId, {
14194
+ await _optionalChain([this, 'access', _323 => _323.recordService, 'optionalAccess', _324 => _324.deleteRecord, 'call', _325 => _325(op.recordId, {
14091
14195
  skipHooks: true,
14092
14196
  skipReferenceCheck: true
14093
14197
  })]);
14094
14198
  rolledBack.push(op.slotId);
14095
14199
  } else if (op.operation === "update" && op.previousData) {
14096
- await _optionalChain([this, 'access', _324 => _324.recordService, 'optionalAccess', _325 => _325.updateRecord, 'call', _326 => _326(op.recordId, op.previousData, {
14200
+ await _optionalChain([this, 'access', _326 => _326.recordService, 'optionalAccess', _327 => _327.updateRecord, 'call', _328 => _328(op.recordId, op.previousData, {
14097
14201
  partial: false
14098
14202
  })]);
14099
14203
  rolledBack.push(op.slotId);
@@ -14217,7 +14321,7 @@ var WorkflowInstanceService = class extends BaseService {
14217
14321
  if (!this.adapter.workflowInstances) {
14218
14322
  return;
14219
14323
  }
14220
- const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _327 => _327.context, 'access', _328 => _328.variables, 'optionalAccess', _329 => _329.__version]), () => ( 0));
14324
+ const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _329 => _329.context, 'access', _330 => _330.variables, 'optionalAccess', _331 => _331.__version]), () => ( 0));
14221
14325
  const nextVersion = currentVersion + 1;
14222
14326
  const instanceWithVersion = {
14223
14327
  ...instance,
@@ -14498,7 +14602,7 @@ var WorkflowRelationService = class extends BaseService {
14498
14602
  if (attr.type !== "relation") continue;
14499
14603
  for (const slot of slots) {
14500
14604
  const slotData = context.slots[slot.id];
14501
- const slotRecordId = _optionalChain([slotData, 'optionalAccess', _330 => _330.id]);
14605
+ const slotRecordId = _optionalChain([slotData, 'optionalAccess', _332 => _332.id]);
14502
14606
  if (!slotRecordId) continue;
14503
14607
  const targetsSlotObject = attr.targets.some(
14504
14608
  (t) => t.object === slot.objectName
@@ -14566,7 +14670,7 @@ var WorkflowService = class extends BaseService {
14566
14670
  if (Array.isArray(options)) {
14567
14671
  this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
14568
14672
  } else {
14569
- this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _331 => _331.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14673
+ this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _333 => _333.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14570
14674
  }
14571
14675
  }
14572
14676
  // ============================================================================
@@ -14681,7 +14785,7 @@ var WorkflowService = class extends BaseService {
14681
14785
  };
14682
14786
  const validationResult = WorkflowDefinitionSchema.safeParse(definition);
14683
14787
  if (!validationResult.success) {
14684
- 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);
14685
14789
  throw new SchemaError(
14686
14790
  `Invalid workflow definition: ${errors.join(", ")}`,
14687
14791
  SchemaErrorCode.VALIDATION_FAILED
@@ -14723,7 +14827,7 @@ var WorkflowService = class extends BaseService {
14723
14827
  };
14724
14828
  const validationResult = WorkflowDefinitionSchema.safeParse(updated);
14725
14829
  if (!validationResult.success) {
14726
- 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);
14727
14831
  throw new SchemaError(
14728
14832
  `Invalid workflow definition: ${errors.join(", ")}`,
14729
14833
  SchemaErrorCode.VALIDATION_FAILED
@@ -14752,7 +14856,7 @@ var WorkflowService = class extends BaseService {
14752
14856
  }
14753
14857
  const validationResult = WorkflowDefinitionSchema.safeParse(existing);
14754
14858
  if (!validationResult.success) {
14755
- 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);
14756
14860
  throw new SchemaError(
14757
14861
  `Cannot publish invalid workflow: ${errors.join(", ")}`,
14758
14862
  SchemaErrorCode.VALIDATION_FAILED
@@ -14864,7 +14968,7 @@ var WorkflowService = class extends BaseService {
14864
14968
  var UserProfileService = class extends BaseService {
14865
14969
  constructor(adapter, options) {
14866
14970
  super(adapter);
14867
- this.auditService = _optionalChain([options, 'optionalAccess', _332 => _332.auditService]);
14971
+ this.auditService = _optionalChain([options, 'optionalAccess', _334 => _334.auditService]);
14868
14972
  }
14869
14973
  // ============================================================================
14870
14974
  // CACHE MANAGEMENT
@@ -14943,7 +15047,7 @@ var UserProfileService = class extends BaseService {
14943
15047
  async deleteAvatar(profileId) {
14944
15048
  const profile = await this.getProfileOrThrow(profileId);
14945
15049
  if (profile.avatarUrl && !profile.avatarUrl.startsWith("https://")) {
14946
- await _optionalChain([this, 'access', _333 => _333.adapter, 'access', _334 => _334.storage, 'optionalAccess', _335 => _335.delete, 'call', _336 => _336(profile.avatarUrl), 'access', _337 => _337.catch, 'call', _338 => _338(() => 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)]);
14947
15051
  }
14948
15052
  return await this.updateProfile(profileId, { avatarUrl: null });
14949
15053
  }
@@ -15094,7 +15198,7 @@ var UserProfileService = class extends BaseService {
15094
15198
  */
15095
15199
  async deleteProfile(profileId, options) {
15096
15200
  const profile = await this.getProfileOrThrow(profileId);
15097
- if (_optionalChain([options, 'optionalAccess', _339 => _339.checkAdmin]) && this.adapter.permissions) {
15201
+ if (_optionalChain([options, 'optionalAccess', _341 => _341.checkAdmin]) && this.adapter.permissions) {
15098
15202
  const ownerCount = await this.adapter.permissions.countUsersWithRole("owner");
15099
15203
  if (ownerCount <= 1) {
15100
15204
  const userRoles = await this.adapter.permissions.getUserRoles(profileId);
@@ -15222,7 +15326,7 @@ var UserProfileService = class extends BaseService {
15222
15326
  var DocumentService = class extends BaseService {
15223
15327
  constructor(adapter, options) {
15224
15328
  super(adapter);
15225
- this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _340 => _340.fileService]), () => ( null));
15329
+ this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _342 => _342.fileService]), () => ( null));
15226
15330
  }
15227
15331
  // ============================================================================
15228
15332
  // CREATE
@@ -15440,7 +15544,7 @@ var DocumentService = class extends BaseService {
15440
15544
  */
15441
15545
  async isComplete(documentId) {
15442
15546
  const document2 = await this.getDocument(documentId);
15443
- return _optionalChain([document2, 'optionalAccess', _341 => _341.status]) !== "draft";
15547
+ return _optionalChain([document2, 'optionalAccess', _343 => _343.status]) !== "draft";
15444
15548
  }
15445
15549
  /**
15446
15550
  * Get document with its slots.
@@ -15683,7 +15787,7 @@ var DocumentProcessingService = class extends BaseService {
15683
15787
  type: "signature",
15684
15788
  provider: this.config.signatureAdapter.name,
15685
15789
  input: { signers, ...options },
15686
- expiresAt: _optionalChain([options, 'optionalAccess', _342 => _342.expiresAt])
15790
+ expiresAt: _optionalChain([options, 'optionalAccess', _344 => _344.expiresAt])
15687
15791
  });
15688
15792
  return job;
15689
15793
  }
@@ -15995,15 +16099,15 @@ var DocumentProcessingService = class extends BaseService {
15995
16099
  return {
15996
16100
  ocr: {
15997
16101
  available: !!this.config.ocrAdapter,
15998
- provider: _optionalChain([this, 'access', _343 => _343.config, 'access', _344 => _344.ocrAdapter, 'optionalAccess', _345 => _345.name])
16102
+ provider: _optionalChain([this, 'access', _345 => _345.config, 'access', _346 => _346.ocrAdapter, 'optionalAccess', _347 => _347.name])
15999
16103
  },
16000
16104
  signature: {
16001
16105
  available: !!this.config.signatureAdapter,
16002
- provider: _optionalChain([this, 'access', _346 => _346.config, 'access', _347 => _347.signatureAdapter, 'optionalAccess', _348 => _348.name])
16106
+ provider: _optionalChain([this, 'access', _348 => _348.config, 'access', _349 => _349.signatureAdapter, 'optionalAccess', _350 => _350.name])
16003
16107
  },
16004
16108
  identityVerification: {
16005
16109
  available: !!this.config.identityAdapter,
16006
- provider: _optionalChain([this, 'access', _349 => _349.config, 'access', _350 => _350.identityAdapter, 'optionalAccess', _351 => _351.name])
16110
+ provider: _optionalChain([this, 'access', _351 => _351.config, 'access', _352 => _352.identityAdapter, 'optionalAccess', _353 => _353.name])
16007
16111
  }
16008
16112
  };
16009
16113
  }
@@ -16025,7 +16129,7 @@ function decodeFileName(name) {
16025
16129
  var FileService = class extends BaseService {
16026
16130
  constructor(adapter, options) {
16027
16131
  super(adapter);
16028
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _352 => _352.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)));
16029
16133
  }
16030
16134
  // ============================================================================
16031
16135
  // UPLOAD (requires StorageAdapter)
@@ -16165,7 +16269,7 @@ var FileService = class extends BaseService {
16165
16269
  */
16166
16270
  async getFile(fileId) {
16167
16271
  const file2 = await this.adapter.files.findById(fileId);
16168
- if (_optionalChain([file2, 'optionalAccess', _353 => _353.deletedAt])) {
16272
+ if (_optionalChain([file2, 'optionalAccess', _355 => _355.deletedAt])) {
16169
16273
  return null;
16170
16274
  }
16171
16275
  return file2;
@@ -16227,12 +16331,12 @@ var FileService = class extends BaseService {
16227
16331
  */
16228
16332
  async deleteFile(fileId, options) {
16229
16333
  const file2 = await this.getFileOrThrow(fileId);
16230
- if (_optionalChain([options, 'optionalAccess', _354 => _354.checkOwnership]) && options.userId) {
16334
+ if (_optionalChain([options, 'optionalAccess', _356 => _356.checkOwnership]) && options.userId) {
16231
16335
  if (file2.uploadedBy !== options.userId) {
16232
16336
  throw new Error("You can only delete files you uploaded");
16233
16337
  }
16234
16338
  }
16235
- if (_optionalChain([options, 'optionalAccess', _355 => _355.hard])) {
16339
+ if (_optionalChain([options, 'optionalAccess', _357 => _357.hard])) {
16236
16340
  await this.adapter.files.hardDelete(fileId);
16237
16341
  } else {
16238
16342
  await this.adapter.files.delete(fileId);
@@ -16263,7 +16367,7 @@ var FileService = class extends BaseService {
16263
16367
  }
16264
16368
  const file2 = await this.getFileOrThrow(fileId);
16265
16369
  await this.adapter.storage.delete(file2.storagePath);
16266
- if (_optionalChain([options, 'optionalAccess', _356 => _356.hard])) {
16370
+ if (_optionalChain([options, 'optionalAccess', _358 => _358.hard])) {
16267
16371
  await this.adapter.files.hardDelete(fileId);
16268
16372
  } else {
16269
16373
  await this.adapter.files.delete(fileId);
@@ -16289,15 +16393,15 @@ var FileService = class extends BaseService {
16289
16393
  const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
16290
16394
  const files = fileResults.filter((f) => f !== null);
16291
16395
  if (files.length === 0) return;
16292
- if (_optionalChain([options, 'optionalAccess', _357 => _357.deleteFromStorage]) && this.adapter.storage) {
16396
+ if (_optionalChain([options, 'optionalAccess', _359 => _359.deleteFromStorage]) && this.adapter.storage) {
16293
16397
  const BATCH_SIZE = 10;
16294
16398
  for (let i = 0; i < files.length; i += BATCH_SIZE) {
16295
16399
  const batch = files.slice(i, i + BATCH_SIZE);
16296
- await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _358 => _358.adapter, 'access', _359 => _359.storage, 'optionalAccess', _360 => _360.delete, 'call', _361 => _361(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)])));
16297
16401
  }
16298
16402
  }
16299
16403
  const idsToDelete = files.map((f) => f.id);
16300
- if (_optionalChain([options, 'optionalAccess', _362 => _362.hard])) {
16404
+ if (_optionalChain([options, 'optionalAccess', _364 => _364.hard])) {
16301
16405
  await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
16302
16406
  } else {
16303
16407
  await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
@@ -16305,12 +16409,12 @@ var FileService = class extends BaseService {
16305
16409
  if (this.auditService && this.userId) {
16306
16410
  await Promise.all(
16307
16411
  files.map(
16308
- (file2) => _optionalChain([this, 'access', _363 => _363.auditService, 'optionalAccess', _364 => _364.logFileAction, 'call', _365 => _365({
16412
+ (file2) => _optionalChain([this, 'access', _365 => _365.auditService, 'optionalAccess', _366 => _366.logFileAction, 'call', _367 => _367({
16309
16413
  action: "file.deleted",
16310
16414
  actorId: _nullishCoalesce(this.userId, () => ( "")),
16311
16415
  fileId: file2.id,
16312
16416
  fileName: file2.name,
16313
- metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _366 => _366.deleteFromStorage]), () => ( false)) }
16417
+ metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _368 => _368.deleteFromStorage]), () => ( false)) }
16314
16418
  })])
16315
16419
  )
16316
16420
  );
@@ -16395,7 +16499,7 @@ var FileService = class extends BaseService {
16395
16499
  return true;
16396
16500
  }
16397
16501
  if (file2.visibility === "restricted") {
16398
- return _nullishCoalesce(_optionalChain([file2, 'access', _367 => _367.allowedUsers, 'optionalAccess', _368 => _368.includes, 'call', _369 => _369(userId)]), () => ( false));
16502
+ return _nullishCoalesce(_optionalChain([file2, 'access', _369 => _369.allowedUsers, 'optionalAccess', _370 => _370.includes, 'call', _371 => _371(userId)]), () => ( false));
16399
16503
  }
16400
16504
  return false;
16401
16505
  }
@@ -16490,7 +16594,7 @@ function withTimeout(promise, ms, label) {
16490
16594
  var GeocodingService = class {
16491
16595
  constructor(adapter, options) {
16492
16596
  this.adapter = adapter;
16493
- this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _370 => _370.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16597
+ this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16494
16598
  }
16495
16599
  /**
16496
16600
  * Search for address suggestions as the user types
@@ -16549,9 +16653,9 @@ var GlobalSearchService = class extends BaseService {
16549
16653
  if (this.adapter.search) {
16550
16654
  try {
16551
16655
  const raw = await this.adapter.search.globalSearch(trimmed, {
16552
- objectNames: _optionalChain([options, 'optionalAccess', _371 => _371.objectNames]),
16553
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.limit]), () => ( 20)),
16554
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _373 => _373.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))
16555
16659
  });
16556
16660
  return await this.healGlobalSearchResults(raw);
16557
16661
  } catch (err) {
@@ -16559,9 +16663,9 @@ var GlobalSearchService = class extends BaseService {
16559
16663
  }
16560
16664
  }
16561
16665
  return this.adapter.objectRecords.globalSearch(trimmed, {
16562
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.limit]), () => ( 20)),
16563
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _375 => _375.offset]), () => ( 0)),
16564
- objectNames: _optionalChain([options, 'optionalAccess', _376 => _376.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])
16565
16669
  });
16566
16670
  }
16567
16671
  /**
@@ -16580,7 +16684,7 @@ var GlobalSearchService = class extends BaseService {
16580
16684
  if (this.adapter.search) {
16581
16685
  try {
16582
16686
  const raw = await this.adapter.search.globalSearchGrouped(trimmed, {
16583
- objectNames: _optionalChain([options, 'optionalAccess', _377 => _377.objectNames])
16687
+ objectNames: _optionalChain([options, 'optionalAccess', _379 => _379.objectNames])
16584
16688
  });
16585
16689
  return await this.healGroupedSearchResults(raw);
16586
16690
  } catch (err) {
@@ -16588,8 +16692,8 @@ var GlobalSearchService = class extends BaseService {
16588
16692
  }
16589
16693
  }
16590
16694
  return this.adapter.objectRecords.globalSearchGrouped(trimmed, {
16591
- objectNames: _optionalChain([options, 'optionalAccess', _378 => _378.objectNames]),
16592
- limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _379 => _379.limitPerGroup]), () => ( 5))
16695
+ objectNames: _optionalChain([options, 'optionalAccess', _380 => _380.objectNames]),
16696
+ limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _381 => _381.limitPerGroup]), () => ( 5))
16593
16697
  });
16594
16698
  }
16595
16699
  // ==========================================================================
@@ -16656,7 +16760,7 @@ var PermissionService = class extends BaseService {
16656
16760
  }
16657
16761
  this.permissionsRepo = adapter.permissions;
16658
16762
  this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
16659
- this.auditService = _optionalChain([options, 'optionalAccess', _380 => _380.auditService]);
16763
+ this.auditService = _optionalChain([options, 'optionalAccess', _382 => _382.auditService]);
16660
16764
  }
16661
16765
  // ============================================================================
16662
16766
  // PERMISSION CHECKS
@@ -16672,11 +16776,11 @@ var PermissionService = class extends BaseService {
16672
16776
  async canAccessObject(userProfileId, objectName, action) {
16673
16777
  const permissions = await this.getEffectivePermissions(userProfileId);
16674
16778
  const wildcardPerms = permissions.objectPermissions["*"];
16675
- if (_optionalChain([wildcardPerms, 'optionalAccess', _381 => _381.includes, 'call', _382 => _382(action)])) {
16779
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _383 => _383.includes, 'call', _384 => _384(action)])) {
16676
16780
  return true;
16677
16781
  }
16678
16782
  const objectPerms = permissions.objectPermissions[objectName];
16679
- return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _383 => _383.includes, 'call', _384 => _384(action)]), () => ( false));
16783
+ return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _385 => _385.includes, 'call', _386 => _386(action)]), () => ( false));
16680
16784
  }
16681
16785
  /**
16682
16786
  * Check if user can access an object, throw ForbiddenError if not.
@@ -16725,12 +16829,12 @@ var PermissionService = class extends BaseService {
16725
16829
  */
16726
16830
  async canAccessSystem(userProfileId, resource, action) {
16727
16831
  const permissions = await this.getEffectivePermissions(userProfileId);
16728
- const wildcardPerms = _optionalChain([permissions, 'access', _385 => _385.systemPermissions, 'optionalAccess', _386 => _386["*"]]);
16729
- if (_optionalChain([wildcardPerms, 'optionalAccess', _387 => _387.includes, 'call', _388 => _388(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)])) {
16730
16834
  return true;
16731
16835
  }
16732
- const resourcePerms = _optionalChain([permissions, 'access', _389 => _389.systemPermissions, 'optionalAccess', _390 => _390[resource]]);
16733
- return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _391 => _391.includes, 'call', _392 => _392(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));
16734
16838
  }
16735
16839
  /**
16736
16840
  * Check if user can access a system resource, throw ForbiddenError if not.
@@ -16756,8 +16860,8 @@ var PermissionService = class extends BaseService {
16756
16860
  */
16757
16861
  async getSystemPermissions(userProfileId, resource) {
16758
16862
  const permissions = await this.getEffectivePermissions(userProfileId);
16759
- const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _393 => _393.systemPermissions, 'optionalAccess', _394 => _394["*"]]), () => ( []));
16760
- const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _395 => _395.systemPermissions, 'optionalAccess', _396 => _396[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]]), () => ( []));
16761
16865
  const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
16762
16866
  return {
16763
16867
  canRead: allPerms.has("read"),
@@ -16900,7 +17004,7 @@ var PermissionService = class extends BaseService {
16900
17004
  action: "role.updated",
16901
17005
  actorId: this.userId,
16902
17006
  roleId,
16903
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _397 => _397.label]), () => ( roleId)),
17007
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _399 => _399.label]), () => ( roleId)),
16904
17008
  metadata: { permissionsUpdated: true, permissionCount: permissions.length }
16905
17009
  });
16906
17010
  }
@@ -16930,7 +17034,7 @@ var PermissionService = class extends BaseService {
16930
17034
  action: "role.assigned",
16931
17035
  actorId: this.userId,
16932
17036
  roleId,
16933
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _398 => _398.label]), () => ( roleId)),
17037
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _400 => _400.label]), () => ( roleId)),
16934
17038
  targetUserId: userProfileId
16935
17039
  });
16936
17040
  }
@@ -16948,7 +17052,7 @@ var PermissionService = class extends BaseService {
16948
17052
  action: "role.revoked",
16949
17053
  actorId: this.userId,
16950
17054
  roleId,
16951
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _399 => _399.label]), () => ( roleId)),
17055
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _401 => _401.label]), () => ( roleId)),
16952
17056
  targetUserId: userProfileId
16953
17057
  });
16954
17058
  }
@@ -17422,7 +17526,7 @@ var ViewService = class extends BaseService {
17422
17526
  dbView.objectName,
17423
17527
  dbView.type,
17424
17528
  objectDefinition,
17425
- dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _400 => _400.config, 'optionalAccess', _401 => _401.layout]), () => ( "page")) : void 0
17529
+ dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _402 => _402.config, 'optionalAccess', _403 => _403.layout]), () => ( "page")) : void 0
17426
17530
  );
17427
17531
  const newConfig = generated.config;
17428
17532
  const updated = await this.adapter.views.update(viewId, { config: newConfig });
@@ -18324,4 +18428,5 @@ var NoopGeocodingAdapter = class {
18324
18428
 
18325
18429
 
18326
18430
 
18327
- 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;