@stndrds/schema 0.1.0-alpha.59 → 0.1.0-alpha.61

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.
@@ -307,8 +307,8 @@ var cacheKeys = {
307
307
  searchResults: (tenantId, objectId, hash) => `search:${tenantId}:${objectId}:${hash}`,
308
308
  /** All search results for an object (for invalidation) */
309
309
  allSearchResults: (tenantId, objectId) => `search:${tenantId}:${objectId}:*`,
310
- /** Global search results */
311
- globalSearch: (tenantId, hash) => `gsearch:${tenantId}:${hash}`,
310
+ /** Global search results (3-param signature to match cachedList pattern) */
311
+ globalSearch: (tenantId, _id, hash) => `gsearch:${tenantId}:${hash}`,
312
312
  /** All global search results for tenant (for invalidation) */
313
313
  allGlobalSearch: (tenantId) => `gsearch:${tenantId}:*`,
314
314
  // -------------------------------------------------------------------------
@@ -1885,6 +1885,41 @@ function evaluateWithTrace(condition, context) {
1885
1885
  return evaluateCondition(condition, context, true);
1886
1886
  }
1887
1887
 
1888
+ // src/types/errors.ts
1889
+ var RecordReferencedError = class extends Error {
1890
+ constructor(recordId, references) {
1891
+ const total = references.reduce((sum, r) => sum + r.count, 0);
1892
+ super(`Cannot delete record: referenced by ${total} record${total > 1 ? "s" : ""}`);
1893
+ this.recordId = recordId;
1894
+ this.references = references;
1895
+ this.code = "RECORD_REFERENCED";
1896
+ this.name = "RecordReferencedError";
1897
+ }
1898
+ };
1899
+ var AttributeInUseError = class extends Error {
1900
+ constructor(attributeName, usage) {
1901
+ super(`Cannot delete attribute "${attributeName}": used in ${usage}`);
1902
+ this.attributeName = attributeName;
1903
+ this.usage = usage;
1904
+ this.code = "ATTRIBUTE_IN_USE";
1905
+ this.name = "AttributeInUseError";
1906
+ }
1907
+ };
1908
+ var ObjectReferencedError = class extends Error {
1909
+ constructor(objectName, referencingObjects) {
1910
+ super(
1911
+ `Cannot delete object "${objectName}": target of relations in ${referencingObjects.join(", ")}`
1912
+ );
1913
+ this.objectName = objectName;
1914
+ this.referencingObjects = referencingObjects;
1915
+ this.code = "OBJECT_REFERENCED";
1916
+ this.name = "ObjectReferencedError";
1917
+ }
1918
+ };
1919
+ function getErrorMessage(error2) {
1920
+ return error2 instanceof Error ? error2.message : String(error2);
1921
+ }
1922
+
1888
1923
  // src/runtime/executors/types.ts
1889
1924
  var ExecutorRegistry = class {
1890
1925
  constructor() {
@@ -1927,7 +1962,7 @@ var ExecutorRegistry = class {
1927
1962
  return {
1928
1963
  status: "error",
1929
1964
  code: "EXECUTOR_ERROR",
1930
- message: error2 instanceof Error ? error2.message : "Unknown error",
1965
+ message: getErrorMessage(error2),
1931
1966
  retryable: true
1932
1967
  };
1933
1968
  }
@@ -2418,7 +2453,7 @@ function evaluateFormulaWithResult(expression, values) {
2418
2453
  } catch (error2) {
2419
2454
  return {
2420
2455
  value: null,
2421
- error: error2 instanceof Error ? error2.message : "Unknown error"
2456
+ error: getErrorMessage(error2)
2422
2457
  };
2423
2458
  }
2424
2459
  }
@@ -2458,7 +2493,7 @@ function validateFormulaExpression(expression) {
2458
2493
  } catch (error2) {
2459
2494
  return {
2460
2495
  valid: false,
2461
- error: error2 instanceof Error ? error2.message : "Invalid expression"
2496
+ error: getErrorMessage(error2)
2462
2497
  };
2463
2498
  }
2464
2499
  }
@@ -3949,7 +3984,6 @@ function createMockObjectRecordsRepository(stores) {
3949
3984
  objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _84 => _84.label]), () => ( "Unknown")),
3950
3985
  label: renderLabelExpression(labelExpression, enrichedValues),
3951
3986
  recordId: r.id,
3952
- values: r.values,
3953
3987
  completionStatus: r.completionStatus,
3954
3988
  createdAt: r.createdAt,
3955
3989
  updatedAt: r.updatedAt
@@ -3957,6 +3991,36 @@ function createMockObjectRecordsRepository(stores) {
3957
3991
  });
3958
3992
  return Promise.resolve({ results, total });
3959
3993
  },
3994
+ globalSearchGrouped(query, options) {
3995
+ const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _85 => _85.limitPerGroup]), () => ( 5));
3996
+ return this.globalSearch(query, {
3997
+ objectNames: _optionalChain([options, 'optionalAccess', _86 => _86.objectNames]),
3998
+ limit: 500,
3999
+ offset: 0
4000
+ }).then(({ results }) => {
4001
+ const groupMap = /* @__PURE__ */ new Map();
4002
+ for (const result of results) {
4003
+ let group2 = groupMap.get(result.objectName);
4004
+ if (!group2) {
4005
+ group2 = {
4006
+ objectName: result.objectName,
4007
+ objectLabel: result.objectLabel,
4008
+ results: [],
4009
+ totalInGroup: 0
4010
+ };
4011
+ groupMap.set(result.objectName, group2);
4012
+ }
4013
+ group2.totalInGroup++;
4014
+ if (group2.results.length < limitPerGroup) {
4015
+ group2.results.push(result);
4016
+ }
4017
+ }
4018
+ const groups = Array.from(groupMap.values());
4019
+ groups.sort((a, b) => b.totalInGroup - a.totalInGroup);
4020
+ const total = groups.reduce((sum, g) => sum + g.totalInGroup, 0);
4021
+ return { groups, total };
4022
+ });
4023
+ },
3960
4024
  // -------------------------------------------------------------------------
3961
4025
  // Schema Integrity Methods
3962
4026
  // -------------------------------------------------------------------------
@@ -4060,7 +4124,6 @@ function createMockObjectRecordsRepository(stores) {
4060
4124
  }
4061
4125
 
4062
4126
  // src/runtime/mock/mock-relation-attributes.ts
4063
- var _crypto = require('crypto');
4064
4127
  function createMockRelationAttributesRepository(stores) {
4065
4128
  return {
4066
4129
  async upsertBatch(items) {
@@ -4081,7 +4144,7 @@ function createMockRelationAttributesRepository(stores) {
4081
4144
  results.push(existing);
4082
4145
  } else {
4083
4146
  const row = {
4084
- id: _crypto.randomUUID.call(void 0, ),
4147
+ id: _chunkNEVERCM3js.generateId.call(void 0, ),
4085
4148
  tenantId: context.tenantId,
4086
4149
  fromObject: item.fromObject,
4087
4150
  fromId: item.fromId,
@@ -4241,7 +4304,7 @@ function createMockUserProfilesRepository(stores) {
4241
4304
  list(options) {
4242
4305
  const tenantId = getTenantId();
4243
4306
  let results = Array.from(stores.userProfiles.values()).filter((p) => p.tenantId === tenantId);
4244
- if (_optionalChain([options, 'optionalAccess', _85 => _85.limit])) {
4307
+ if (_optionalChain([options, 'optionalAccess', _87 => _87.limit])) {
4245
4308
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4246
4309
  }
4247
4310
  return Promise.resolve(results);
@@ -4329,7 +4392,7 @@ function createMockPermissionsRepository(stores) {
4329
4392
  },
4330
4393
  deleteRole(roleId) {
4331
4394
  const role = stores.roles.get(roleId);
4332
- if (_optionalChain([role, 'optionalAccess', _86 => _86.system])) {
4395
+ if (_optionalChain([role, 'optionalAccess', _88 => _88.system])) {
4333
4396
  return Promise.reject(new Error(`Cannot delete system role ${roleId}`));
4334
4397
  }
4335
4398
  stores.roles.delete(roleId);
@@ -4818,7 +4881,7 @@ function createMockWorkflowInstancesRepository(stores) {
4818
4881
  (i) => i.tenant_id === tenantId
4819
4882
  );
4820
4883
  const total = results.length;
4821
- if (_optionalChain([options, 'optionalAccess', _87 => _87.limit])) {
4884
+ if (_optionalChain([options, 'optionalAccess', _89 => _89.limit])) {
4822
4885
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4823
4886
  }
4824
4887
  return Promise.resolve({ instances: results, total });
@@ -4846,7 +4909,7 @@ function createMockWorkflowInstancesRepository(stores) {
4846
4909
  pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
4847
4910
  error: null,
4848
4911
  started_by: data.startedBy,
4849
- expires_at: _nullishCoalesce(_optionalChain([data, 'access', _88 => _88.expiresAt, 'optionalAccess', _89 => _89.toISOString, 'call', _90 => _90()]), () => ( null)),
4912
+ expires_at: _nullishCoalesce(_optionalChain([data, 'access', _90 => _90.expiresAt, 'optionalAccess', _91 => _91.toISOString, 'call', _92 => _92()]), () => ( null)),
4850
4913
  created_at: now,
4851
4914
  updated_at: now,
4852
4915
  completed_at: null
@@ -4867,8 +4930,8 @@ function createMockWorkflowInstancesRepository(stores) {
4867
4930
  history: _nullishCoalesce(data.history, () => ( existing.history)),
4868
4931
  pending_action: data.pendingAction !== void 0 ? data.pendingAction : existing.pending_action,
4869
4932
  error: data.error !== void 0 ? data.error : existing.error,
4870
- expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _91 => _91.expiresAt, 'optionalAccess', _92 => _92.toISOString, 'call', _93 => _93()]), () => ( null)) : existing.expires_at,
4871
- completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _94 => _94.completedAt, 'optionalAccess', _95 => _95.toISOString, 'call', _96 => _96()]), () => ( null)) : existing.completed_at,
4933
+ expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _93 => _93.expiresAt, 'optionalAccess', _94 => _94.toISOString, 'call', _95 => _95()]), () => ( null)) : existing.expires_at,
4934
+ completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _96 => _96.completedAt, 'optionalAccess', _97 => _97.toISOString, 'call', _98 => _98()]), () => ( null)) : existing.completed_at,
4872
4935
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
4873
4936
  };
4874
4937
  stores.workflowInstances.set(id, updated);
@@ -4901,7 +4964,7 @@ function createMockWorkflowInstancesRepository(stores) {
4901
4964
  pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
4902
4965
  error: null,
4903
4966
  started_by: data.startedBy,
4904
- expires_at: _nullishCoalesce(_optionalChain([data, 'access', _97 => _97.expiresAt, 'optionalAccess', _98 => _98.toISOString, 'call', _99 => _99()]), () => ( null)),
4967
+ expires_at: _nullishCoalesce(_optionalChain([data, 'access', _99 => _99.expiresAt, 'optionalAccess', _100 => _100.toISOString, 'call', _101 => _101()]), () => ( null)),
4905
4968
  created_at: now,
4906
4969
  updated_at: now,
4907
4970
  completed_at: null
@@ -4924,13 +4987,13 @@ function createMockWorkflowInstancesRepository(stores) {
4924
4987
  return slotData.id === recordId;
4925
4988
  });
4926
4989
  });
4927
- if (_optionalChain([options, 'optionalAccess', _100 => _100.status])) {
4990
+ if (_optionalChain([options, 'optionalAccess', _102 => _102.status])) {
4928
4991
  results = results.filter((i) => i.status === options.status);
4929
4992
  }
4930
4993
  const total = results.length;
4931
- if (_optionalChain([options, 'optionalAccess', _101 => _101.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _102 => _102.limit]) !== void 0) {
4932
- const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _103 => _103.offset]), () => ( 0));
4933
- const end = _optionalChain([options, 'optionalAccess', _104 => _104.limit]) ? start + options.limit : void 0;
4994
+ if (_optionalChain([options, 'optionalAccess', _103 => _103.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _104 => _104.limit]) !== void 0) {
4995
+ const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _105 => _105.offset]), () => ( 0));
4996
+ const end = _optionalChain([options, 'optionalAccess', _106 => _106.limit]) ? start + options.limit : void 0;
4934
4997
  results = results.slice(start, end);
4935
4998
  }
4936
4999
  return Promise.resolve({ instances: results, total });
@@ -4986,7 +5049,7 @@ function createMockWorkflowInvitationsRepository(stores) {
4986
5049
  const updated = {
4987
5050
  ...existing,
4988
5051
  status: _nullishCoalesce(data.status, () => ( existing.status)),
4989
- accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _105 => _105.acceptedAt, 'optionalAccess', _106 => _106.toISOString, 'call', _107 => _107()]), () => ( null)) : existing.accepted_at,
5052
+ accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _107 => _107.acceptedAt, 'optionalAccess', _108 => _108.toISOString, 'call', _109 => _109()]), () => ( null)) : existing.accepted_at,
4990
5053
  expires_at: data.expiresAt !== void 0 ? data.expiresAt.toISOString() : existing.expires_at
4991
5054
  };
4992
5055
  stores.workflowInvitations.set(id, updated);
@@ -5052,7 +5115,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
5052
5115
  ...existing,
5053
5116
  last_used_at: data.lastUsedAt !== void 0 ? data.lastUsedAt.toISOString() : existing.last_used_at,
5054
5117
  revoked_token_jtis: _nullishCoalesce(data.revokedTokenJtis, () => ( existing.revoked_token_jtis)),
5055
- revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _108 => _108.revokedAt, 'optionalAccess', _109 => _109.toISOString, 'call', _110 => _110()]), () => ( null)) : existing.revoked_at
5118
+ revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _110 => _110.revokedAt, 'optionalAccess', _111 => _111.toISOString, 'call', _112 => _112()]), () => ( null)) : existing.revoked_at
5056
5119
  };
5057
5120
  stores.workflowAccessGrants.set(id, updated);
5058
5121
  return Promise.resolve(updated);
@@ -5201,7 +5264,7 @@ var notesPolicy = {
5201
5264
  { attribute: "visibility", operator: "is", value: "shared" },
5202
5265
  { attribute: "createdBy", operator: "is", value: ctx.userId }
5203
5266
  ];
5204
- if (!_optionalChain([options, 'optionalAccess', _111 => _111.filters]) || options.filters.rules.length === 0) {
5267
+ if (!_optionalChain([options, 'optionalAccess', _113 => _113.filters]) || options.filters.rules.length === 0) {
5205
5268
  return {
5206
5269
  ...options,
5207
5270
  filters: { combinator: "or", rules: visibilityRules }
@@ -5347,7 +5410,7 @@ var BaseService = class {
5347
5410
  * @param key - Cache key to invalidate
5348
5411
  */
5349
5412
  async invalidateCache(key) {
5350
- await _optionalChain([this, 'access', _112 => _112.cache, 'optionalAccess', _113 => _113.delete, 'call', _114 => _114(key)]);
5413
+ await _optionalChain([this, 'access', _114 => _114.cache, 'optionalAccess', _115 => _115.delete, 'call', _116 => _116(key)]);
5351
5414
  }
5352
5415
  /**
5353
5416
  * Invalidate all cache keys matching a pattern.
@@ -5355,7 +5418,7 @@ var BaseService = class {
5355
5418
  * @param pattern - Glob-style pattern (e.g., "schema:tenant-123:*")
5356
5419
  */
5357
5420
  async invalidateCachePattern(pattern) {
5358
- await _optionalChain([this, 'access', _115 => _115.cache, 'optionalAccess', _116 => _116.deletePattern, 'call', _117 => _117(pattern)]);
5421
+ await _optionalChain([this, 'access', _117 => _117.cache, 'optionalAccess', _118 => _118.deletePattern, 'call', _119 => _119(pattern)]);
5359
5422
  }
5360
5423
  /**
5361
5424
  * Invalidate all cached lists for a resource.
@@ -5553,17 +5616,17 @@ function validateOptions(options, attributeName) {
5553
5616
  const ids = /* @__PURE__ */ new Set();
5554
5617
  const values = /* @__PURE__ */ new Set();
5555
5618
  for (const option of options) {
5556
- if (!_optionalChain([option, 'access', _118 => _118.id, 'optionalAccess', _119 => _119.trim, 'call', _120 => _120()])) {
5619
+ if (!_optionalChain([option, 'access', _120 => _120.id, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()])) {
5557
5620
  throw new Error(
5558
5621
  `[AttributeBuilder] Option in "${attributeName}" has an empty or missing id.`
5559
5622
  );
5560
5623
  }
5561
- if (!_optionalChain([option, 'access', _121 => _121.value, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()])) {
5624
+ if (!_optionalChain([option, 'access', _123 => _123.value, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()])) {
5562
5625
  throw new Error(
5563
5626
  `[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing value.`
5564
5627
  );
5565
5628
  }
5566
- if (!_optionalChain([option, 'access', _124 => _124.label, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()])) {
5629
+ if (!_optionalChain([option, 'access', _126 => _126.label, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()])) {
5567
5630
  throw new Error(
5568
5631
  `[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing label.`
5569
5632
  );
@@ -5947,8 +6010,8 @@ var BaseAttributeBuilder = class {
5947
6010
  featureGate(flagName, options) {
5948
6011
  this.attr.featureGate = {
5949
6012
  flag: flagName,
5950
- expectedValue: _optionalChain([options, 'optionalAccess', _127 => _127.expectedValue]),
5951
- fallback: _optionalChain([options, 'optionalAccess', _128 => _128.fallback])
6013
+ expectedValue: _optionalChain([options, 'optionalAccess', _129 => _129.expectedValue]),
6014
+ fallback: _optionalChain([options, 'optionalAccess', _130 => _130.fallback])
5952
6015
  };
5953
6016
  return this;
5954
6017
  }
@@ -6396,7 +6459,7 @@ var SingleRelationAttributeBuilder = class extends BaseAttributeBuilder {
6396
6459
  object: objectName,
6397
6460
  ...options
6398
6461
  };
6399
- _optionalChain([this, 'access', _129 => _129.attr, 'access', _130 => _130.targets, 'optionalAccess', _131 => _131.push, 'call', _132 => _132(target)]);
6462
+ _optionalChain([this, 'access', _131 => _131.attr, 'access', _132 => _132.targets, 'optionalAccess', _133 => _133.push, 'call', _134 => _134(target)]);
6400
6463
  return this;
6401
6464
  }
6402
6465
  /**
@@ -6467,9 +6530,9 @@ var MultiRelationAttributeBuilder = class extends BaseAttributeBuilder {
6467
6530
  constructor(name, label, initOptions) {
6468
6531
  super("relation", name, label);
6469
6532
  this.attr.cardinality = "many";
6470
- this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _133 => _133.targets]), () => ( []));
6533
+ this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _135 => _135.targets]), () => ( []));
6471
6534
  this.attr.defaultValue = [];
6472
- if (_optionalChain([initOptions, 'optionalAccess', _134 => _134.isRequired])) {
6535
+ if (_optionalChain([initOptions, 'optionalAccess', _136 => _136.isRequired])) {
6473
6536
  this.setRequired(true);
6474
6537
  }
6475
6538
  }
@@ -6483,7 +6546,7 @@ var MultiRelationAttributeBuilder = class extends BaseAttributeBuilder {
6483
6546
  object: objectName,
6484
6547
  ...options
6485
6548
  };
6486
- _optionalChain([this, 'access', _135 => _135.attr, 'access', _136 => _136.targets, 'optionalAccess', _137 => _137.push, 'call', _138 => _138(target)]);
6549
+ _optionalChain([this, 'access', _137 => _137.attr, 'access', _138 => _138.targets, 'optionalAccess', _139 => _139.push, 'call', _140 => _140(target)]);
6487
6550
  return this;
6488
6551
  }
6489
6552
  /**
@@ -6928,7 +6991,6 @@ function object(config) {
6928
6991
 
6929
6992
  // src/builders/view-builder.ts
6930
6993
 
6931
-
6932
6994
  var GroupBuilder = class {
6933
6995
  constructor(id, label) {
6934
6996
  this.data = { fields: [] };
@@ -6964,7 +7026,7 @@ var GroupBuilder = class {
6964
7026
  */
6965
7027
  fields(...names) {
6966
7028
  for (const name of names) {
6967
- _optionalChain([this, 'access', _139 => _139.data, 'access', _140 => _140.fields, 'optionalAccess', _141 => _141.push, 'call', _142 => _142({ attribute: name })]);
7029
+ _optionalChain([this, 'access', _141 => _141.data, 'access', _142 => _142.fields, 'optionalAccess', _143 => _143.push, 'call', _144 => _144({ attribute: name })]);
6968
7030
  }
6969
7031
  return this;
6970
7032
  }
@@ -6973,7 +7035,7 @@ var GroupBuilder = class {
6973
7035
  * @example .field("name", { span: 8, readOnly: true })
6974
7036
  */
6975
7037
  field(attribute, options) {
6976
- _optionalChain([this, 'access', _143 => _143.data, 'access', _144 => _144.fields, 'optionalAccess', _145 => _145.push, 'call', _146 => _146({ attribute, ...options })]);
7038
+ _optionalChain([this, 'access', _145 => _145.data, 'access', _146 => _146.fields, 'optionalAccess', _147 => _147.push, 'call', _148 => _148({ attribute, ...options })]);
6977
7039
  return this;
6978
7040
  }
6979
7041
  /**
@@ -6982,7 +7044,7 @@ var GroupBuilder = class {
6982
7044
  * @example .attributeGroup({ id: "address", label: "Address", attributes: ["street", "city", "postal_code"], displayTemplate: "{street}, {city}" })
6983
7045
  */
6984
7046
  attributeGroup(config, options) {
6985
- _optionalChain([this, 'access', _147 => _147.data, 'access', _148 => _148.fields, 'optionalAccess', _149 => _149.push, 'call', _150 => _150({ attributeGroup: config, ...options })]);
7047
+ _optionalChain([this, 'access', _149 => _149.data, 'access', _150 => _150.fields, 'optionalAccess', _151 => _151.push, 'call', _152 => _152({ attributeGroup: config, ...options })]);
6986
7048
  return this;
6987
7049
  }
6988
7050
  /**
@@ -7787,7 +7849,7 @@ var ListViewBuilder = class {
7787
7849
  columns: this.data.columns,
7788
7850
  columnSizing: this.data.columnSizing,
7789
7851
  defaultFilters: this.data.defaultFilters ? {
7790
- id: _crypto.randomUUID.call(void 0, ),
7852
+ id: _chunkNEVERCM3js.generateId.call(void 0, ),
7791
7853
  combinator: this.data.defaultFilters.combinator,
7792
7854
  rules: this.data.defaultFilters.rules
7793
7855
  } : void 0,
@@ -7798,7 +7860,7 @@ var ListViewBuilder = class {
7798
7860
  label: tab.label,
7799
7861
  icon: tab.icon,
7800
7862
  filters: tab.filters ? {
7801
- id: _crypto.randomUUID.call(void 0, ),
7863
+ id: _chunkNEVERCM3js.generateId.call(void 0, ),
7802
7864
  combinator: tab.filters.combinator,
7803
7865
  rules: tab.filters.rules
7804
7866
  } : void 0,
@@ -7914,8 +7976,8 @@ var WorkflowFormRowBuilder = class {
7914
7976
  id: `${this.rowData.id}-${slotId}-${attribute}`,
7915
7977
  slotId,
7916
7978
  attribute,
7917
- label: _optionalChain([options, 'optionalAccess', _151 => _151.label]),
7918
- required: _optionalChain([options, 'optionalAccess', _152 => _152.required])
7979
+ label: _optionalChain([options, 'optionalAccess', _153 => _153.label]),
7980
+ required: _optionalChain([options, 'optionalAccess', _154 => _154.required])
7919
7981
  };
7920
7982
  this.rowData.fields.push(field);
7921
7983
  return this;
@@ -8206,7 +8268,7 @@ var WorkflowBuilder = class {
8206
8268
  * @param options - Slot configuration
8207
8269
  */
8208
8270
  slot(id, objectName, options) {
8209
- if (_optionalChain([this, 'access', _153 => _153.data, 'access', _154 => _154.slots, 'optionalAccess', _155 => _155.some, 'call', _156 => _156((s) => s.id === id)])) {
8271
+ if (_optionalChain([this, 'access', _155 => _155.data, 'access', _156 => _156.slots, 'optionalAccess', _157 => _157.some, 'call', _158 => _158((s) => s.id === id)])) {
8210
8272
  throw new Error(`[WorkflowBuilder] Duplicate slot id: "${id}"`);
8211
8273
  }
8212
8274
  const slot = {
@@ -8217,7 +8279,7 @@ var WorkflowBuilder = class {
8217
8279
  color: options.color,
8218
8280
  icon: options.icon
8219
8281
  };
8220
- _optionalChain([this, 'access', _157 => _157.data, 'access', _158 => _158.slots, 'optionalAccess', _159 => _159.push, 'call', _160 => _160(slot)]);
8282
+ _optionalChain([this, 'access', _159 => _159.data, 'access', _160 => _160.slots, 'optionalAccess', _161 => _161.push, 'call', _162 => _162(slot)]);
8221
8283
  return this;
8222
8284
  }
8223
8285
  // ============================================================================
@@ -8349,7 +8411,7 @@ var WorkflowBuilder = class {
8349
8411
  }
8350
8412
  }
8351
8413
  validateSlotReferences() {
8352
- const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _161 => _161.data, 'access', _162 => _162.slots, 'optionalAccess', _163 => _163.reduce, 'call', _164 => _164((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
8414
+ const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _163 => _163.data, 'access', _164 => _164.slots, 'optionalAccess', _165 => _165.reduce, 'call', _166 => _166((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
8353
8415
  for (const node of Object.values(_nullishCoalesce(this.data.nodes, () => ( {})))) {
8354
8416
  if (node.type === "form") {
8355
8417
  const referencedSlots = /* @__PURE__ */ new Set();
@@ -8455,38 +8517,6 @@ function isPresentationProperty(property) {
8455
8517
  return PRESENTATION_PROPERTIES.includes(property);
8456
8518
  }
8457
8519
 
8458
- // src/types/errors.ts
8459
- var RecordReferencedError = class extends Error {
8460
- constructor(recordId, references) {
8461
- const total = references.reduce((sum, r) => sum + r.count, 0);
8462
- super(`Cannot delete record: referenced by ${total} record${total > 1 ? "s" : ""}`);
8463
- this.recordId = recordId;
8464
- this.references = references;
8465
- this.code = "RECORD_REFERENCED";
8466
- this.name = "RecordReferencedError";
8467
- }
8468
- };
8469
- var AttributeInUseError = class extends Error {
8470
- constructor(attributeName, usage) {
8471
- super(`Cannot delete attribute "${attributeName}": used in ${usage}`);
8472
- this.attributeName = attributeName;
8473
- this.usage = usage;
8474
- this.code = "ATTRIBUTE_IN_USE";
8475
- this.name = "AttributeInUseError";
8476
- }
8477
- };
8478
- var ObjectReferencedError = class extends Error {
8479
- constructor(objectName, referencingObjects) {
8480
- super(
8481
- `Cannot delete object "${objectName}": target of relations in ${referencingObjects.join(", ")}`
8482
- );
8483
- this.objectName = objectName;
8484
- this.referencingObjects = referencingObjects;
8485
- this.code = "OBJECT_REFERENCED";
8486
- this.name = "ObjectReferencedError";
8487
- }
8488
- };
8489
-
8490
8520
  // src/types/system-attributes.ts
8491
8521
  var SYSTEM_ATTRIBUTES = {
8492
8522
  createdAt: {
@@ -8587,7 +8617,7 @@ var ObjectSchemaService = class extends BaseService {
8587
8617
  constructor(adapter, nativeRegistry, options) {
8588
8618
  super(adapter);
8589
8619
  this.nativeRegistry = nativeRegistry;
8590
- this.auditService = _optionalChain([options, 'optionalAccess', _165 => _165.auditService]);
8620
+ this.auditService = _optionalChain([options, 'optionalAccess', _167 => _167.auditService]);
8591
8621
  }
8592
8622
  /**
8593
8623
  * Create a new custom object.
@@ -8800,7 +8830,7 @@ var ObjectSchemaService = class extends BaseService {
8800
8830
  resourceType: "attribute",
8801
8831
  resourceId: attributeId,
8802
8832
  resourceLabel: updatedDbAttr.label,
8803
- objectName: _optionalChain([dbObject, 'optionalAccess', _166 => _166.name]),
8833
+ objectName: _optionalChain([dbObject, 'optionalAccess', _168 => _168.name]),
8804
8834
  objectId: dbAttr.objectId,
8805
8835
  changes
8806
8836
  });
@@ -8833,7 +8863,7 @@ var ObjectSchemaService = class extends BaseService {
8833
8863
  );
8834
8864
  }
8835
8865
  const dbObject = await this.adapter.objects.findById(dbAttr.objectId);
8836
- if (_optionalChain([dbObject, 'optionalAccess', _167 => _167.labelExpression])) {
8866
+ if (_optionalChain([dbObject, 'optionalAccess', _169 => _169.labelExpression])) {
8837
8867
  const usedAttributes = extractAttributeNames(dbObject.labelExpression);
8838
8868
  if (usedAttributes.includes(dbAttr.name)) {
8839
8869
  throw new AttributeInUseError(dbAttr.name, "labelExpression");
@@ -8849,7 +8879,7 @@ var ObjectSchemaService = class extends BaseService {
8849
8879
  resourceType: "attribute",
8850
8880
  resourceId: attributeId,
8851
8881
  resourceLabel: dbAttr.label,
8852
- objectName: _optionalChain([dbObject, 'optionalAccess', _168 => _168.name]),
8882
+ objectName: _optionalChain([dbObject, 'optionalAccess', _170 => _170.name]),
8853
8883
  objectId: dbAttr.objectId
8854
8884
  });
8855
8885
  }
@@ -8864,9 +8894,9 @@ var ObjectSchemaService = class extends BaseService {
8864
8894
  async listAttributes(objectId, options) {
8865
8895
  const dbAttributes = await this.adapter.attributes.findByObjectId(objectId);
8866
8896
  let filtered = dbAttributes;
8867
- if (_optionalChain([options, 'optionalAccess', _169 => _169.systemOnly])) {
8897
+ if (_optionalChain([options, 'optionalAccess', _171 => _171.systemOnly])) {
8868
8898
  filtered = dbAttributes.filter((attr) => attr.system);
8869
- } else if (_optionalChain([options, 'optionalAccess', _170 => _170.customOnly])) {
8899
+ } else if (_optionalChain([options, 'optionalAccess', _172 => _172.customOnly])) {
8870
8900
  filtered = dbAttributes.filter((attr) => !attr.system);
8871
8901
  }
8872
8902
  return filtered.map((attr) => this.convertDBAttributeToAttribute(attr));
@@ -8902,14 +8932,14 @@ var ObjectSchemaService = class extends BaseService {
8902
8932
  pluralLabel: dbObject.pluralLabel,
8903
8933
  description: dbObject.description,
8904
8934
  labelExpression: dbObject.labelExpression,
8905
- icon: _optionalChain([dbObject, 'access', _171 => _171.metadata, 'optionalAccess', _172 => _172.icon])
8935
+ icon: _optionalChain([dbObject, 'access', _173 => _173.metadata, 'optionalAccess', _174 => _174.icon])
8906
8936
  };
8907
8937
  let metadata = dbObject.metadata;
8908
8938
  if (updates.icon !== void 0 || updates.metadata !== void 0) {
8909
8939
  metadata = {
8910
8940
  ...dbObject.metadata,
8911
8941
  ...updates.metadata,
8912
- icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _173 => _173.metadata, 'optionalAccess', _174 => _174.icon])))
8942
+ icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _175 => _175.metadata, 'optionalAccess', _176 => _176.icon])))
8913
8943
  };
8914
8944
  }
8915
8945
  const updatedDbObject = await this.adapter.objects.update(objectId, {
@@ -9189,7 +9219,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9189
9219
  label: dbObject.label,
9190
9220
  pluralLabel: dbObject.pluralLabel,
9191
9221
  description: dbObject.description,
9192
- icon: _optionalChain([dbObject, 'access', _175 => _175.metadata, 'optionalAccess', _176 => _176.icon]),
9222
+ icon: _optionalChain([dbObject, 'access', _177 => _177.metadata, 'optionalAccess', _178 => _178.icon]),
9193
9223
  labelExpression: dbObject.labelExpression,
9194
9224
  attributes,
9195
9225
  system: dbObject.system,
@@ -9289,7 +9319,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
9289
9319
  const hasRelationToTarget = attrs.some((attr) => {
9290
9320
  if (attr.type !== "relation") return false;
9291
9321
  const config = attr.config;
9292
- return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _177 => _177.targets, 'optionalAccess', _178 => _178.some, 'call', _179 => _179((t) => t.object === targetObjectName)]), () => ( false));
9322
+ return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _179 => _179.targets, 'optionalAccess', _180 => _180.some, 'call', _181 => _181((t) => t.object === targetObjectName)]), () => ( false));
9293
9323
  });
9294
9324
  if (hasRelationToTarget) {
9295
9325
  referencing.push(obj.name);
@@ -9367,7 +9397,7 @@ Native objects must have system=true. Did you forget to call .system() in your b
9367
9397
  const existing = this.objects.get(object2.name);
9368
9398
  throw new Error(
9369
9399
  `[NativeObjectRegistry] Duplicate object name "${object2.name}":
9370
- - Existing: "${_optionalChain([existing, 'optionalAccess', _180 => _180.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _181 => _181.id])})
9400
+ - Existing: "${_optionalChain([existing, 'optionalAccess', _182 => _182.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _183 => _183.id])})
9371
9401
  - New: "${object2.label}" (id: ${object2.id})
9372
9402
  Please use unique names for each native object.`
9373
9403
  );
@@ -9484,7 +9514,7 @@ var AuditService = class extends BaseService {
9484
9514
  this.isFlushing = false;
9485
9515
  /** Pending flush promise to allow waiting on concurrent flush */
9486
9516
  this.flushPromise = null;
9487
- if (_optionalChain([options, 'optionalAccess', _182 => _182.async]) && options.flushIntervalMs) {
9517
+ if (_optionalChain([options, 'optionalAccess', _184 => _184.async]) && options.flushIntervalMs) {
9488
9518
  this.startFlushTimer();
9489
9519
  }
9490
9520
  }
@@ -9681,7 +9711,7 @@ var AuditService = class extends BaseService {
9681
9711
  if (!this.adapter.audit) {
9682
9712
  return;
9683
9713
  }
9684
- if (_optionalChain([this, 'access', _183 => _183.options, 'optionalAccess', _184 => _184.async])) {
9714
+ if (_optionalChain([this, 'access', _185 => _185.options, 'optionalAccess', _186 => _186.async])) {
9685
9715
  this.buffer.push(entry);
9686
9716
  const batchSize = _nullishCoalesce(this.options.batchSize, () => ( 10));
9687
9717
  if (this.buffer.length >= batchSize) {
@@ -9695,7 +9725,7 @@ var AuditService = class extends BaseService {
9695
9725
  * Start the flush timer for async mode
9696
9726
  */
9697
9727
  startFlushTimer() {
9698
- const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _185 => _185.options, 'optionalAccess', _186 => _186.flushIntervalMs]), () => ( 1e3));
9728
+ const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _187 => _187.options, 'optionalAccess', _188 => _188.flushIntervalMs]), () => ( 1e3));
9699
9729
  this.flushTimer = setInterval(() => {
9700
9730
  this.flush().catch(() => {
9701
9731
  });
@@ -9803,7 +9833,7 @@ var UserService = class extends BaseService {
9803
9833
  if (roleErrors.length > 0) {
9804
9834
  errors.push({
9805
9835
  attribute: attrName,
9806
- message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _187 => _187.allowedRoles, 'optionalAccess', _188 => _188.join, 'call', _189 => _189(", ")])}`,
9836
+ message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _189 => _189.allowedRoles, 'optionalAccess', _190 => _190.join, 'call', _191 => _191(", ")])}`,
9807
9837
  invalidIds: roleErrors
9808
9838
  });
9809
9839
  }
@@ -10125,7 +10155,7 @@ var RecordQueryService = class extends BaseService {
10125
10155
  super(adapter);
10126
10156
  this.schemaService = schemaService;
10127
10157
  this.options = options;
10128
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _190 => _190.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _191 => _191.policyRegistry]), () => ( defaultPolicyRegistry));
10158
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _192 => _192.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _193 => _193.policyRegistry]), () => ( defaultPolicyRegistry));
10129
10159
  }
10130
10160
  // ============================================================================
10131
10161
  // LIST
@@ -10175,12 +10205,12 @@ var RecordQueryService = class extends BaseService {
10175
10205
  * Internal list query execution
10176
10206
  */
10177
10207
  async executeListQuery(schema, objectId, options) {
10178
- if (_optionalChain([this, 'access', _192 => _192.options, 'optionalAccess', _193 => _193.permissionService]) && this.userId) {
10208
+ if (_optionalChain([this, 'access', _194 => _194.options, 'optionalAccess', _195 => _195.permissionService]) && this.userId) {
10179
10209
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
10180
10210
  }
10181
- const policy = _optionalChain([options, 'optionalAccess', _194 => _194.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
10211
+ const policy = _optionalChain([options, 'optionalAccess', _196 => _196.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
10182
10212
  let effectiveOptions = options;
10183
- if (_optionalChain([policy, 'optionalAccess', _195 => _195.applyListFilter]) && this.userId) {
10213
+ if (_optionalChain([policy, 'optionalAccess', _197 => _197.applyListFilter]) && this.userId) {
10184
10214
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
10185
10215
  effectiveOptions = policy.applyListFilter(ctx, options);
10186
10216
  }
@@ -10190,10 +10220,10 @@ var RecordQueryService = class extends BaseService {
10190
10220
  );
10191
10221
  let filteredRecords = result.records;
10192
10222
  let effectiveTotal = result.total;
10193
- if (_optionalChain([policy, 'optionalAccess', _196 => _196.canAccessRecord]) && this.userId) {
10223
+ if (_optionalChain([policy, 'optionalAccess', _198 => _198.canAccessRecord]) && this.userId) {
10194
10224
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
10195
- const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _197 => _197.limit]), () => ( 20));
10196
- const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _198 => _198.offset]), () => ( 0));
10225
+ const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _199 => _199.limit]), () => ( 20));
10226
+ const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _200 => _200.offset]), () => ( 0));
10197
10227
  const overfetchMultiplier = 5;
10198
10228
  const batchSize = requestedLimit * overfetchMultiplier;
10199
10229
  const maxScanRecords = 1e4;
@@ -10215,7 +10245,7 @@ var RecordQueryService = class extends BaseService {
10215
10245
  exhausted = true;
10216
10246
  break;
10217
10247
  }
10218
- const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _199 => _199.canAccessRecord, 'optionalCall', _200 => _200(ctx, record)]));
10248
+ const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _201 => _201.canAccessRecord, 'optionalCall', _202 => _202(ctx, record)]));
10219
10249
  collected.push(...filtered);
10220
10250
  dbOffset += batch.records.length;
10221
10251
  totalScanned += batch.records.length;
@@ -10227,14 +10257,14 @@ var RecordQueryService = class extends BaseService {
10227
10257
  effectiveTotal = exhausted ? collected.length : Math.max(collected.length, result.total);
10228
10258
  filteredRecords = collected.slice(requestedOffset, requestedOffset + requestedLimit);
10229
10259
  }
10230
- if (_optionalChain([options, 'optionalAccess', _201 => _201.include]) && options.include.length > 0) {
10260
+ if (_optionalChain([options, 'optionalAccess', _203 => _203.include]) && options.include.length > 0) {
10231
10261
  filteredRecords = await this.includeRelationsWithProperties(
10232
10262
  filteredRecords,
10233
10263
  schema,
10234
10264
  options.include
10235
10265
  );
10236
10266
  }
10237
- if (!_optionalChain([options, 'optionalAccess', _202 => _202.skipFormulas])) {
10267
+ if (!_optionalChain([options, 'optionalAccess', _204 => _204.skipFormulas])) {
10238
10268
  return {
10239
10269
  records: enrichRecordsWithFormulas(filteredRecords, schema),
10240
10270
  total: effectiveTotal
@@ -10294,14 +10324,14 @@ var RecordQueryService = class extends BaseService {
10294
10324
  * Internal search query execution
10295
10325
  */
10296
10326
  async executeSearchQuery(schema, objectId, query, options) {
10297
- if (_optionalChain([this, 'access', _203 => _203.options, 'optionalAccess', _204 => _204.permissionService]) && this.userId) {
10327
+ if (_optionalChain([this, 'access', _205 => _205.options, 'optionalAccess', _206 => _206.permissionService]) && this.userId) {
10298
10328
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
10299
10329
  }
10300
10330
  const result = await runWithSchemaContext(
10301
10331
  [schema],
10302
10332
  () => this.adapter.objectRecords.search(objectId, query, options)
10303
10333
  );
10304
- if (!_optionalChain([options, 'optionalAccess', _205 => _205.skipFormulas])) {
10334
+ if (!_optionalChain([options, 'optionalAccess', _207 => _207.skipFormulas])) {
10305
10335
  return {
10306
10336
  records: enrichRecordsWithFormulas(result.records, schema),
10307
10337
  total: result.total
@@ -10548,7 +10578,7 @@ var RelationPropertiesService = class extends BaseService {
10548
10578
  this.validateProperties(attribute.properties, item.props);
10549
10579
  }
10550
10580
  }
10551
- const existing = await _optionalChain([adapter, 'access', _206 => _206.relationAttributes, 'optionalAccess', _207 => _207.findBySource, 'call', _208 => _208(
10581
+ const existing = await _optionalChain([adapter, 'access', _208 => _208.relationAttributes, 'optionalAccess', _209 => _209.findBySource, 'call', _210 => _210(
10552
10582
  schema.name,
10553
10583
  recordId,
10554
10584
  attributeName
@@ -10827,7 +10857,7 @@ var RelationService = class extends BaseService {
10827
10857
  }
10828
10858
  const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
10829
10859
  const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
10830
- if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _209 => _209.size]) === 0) {
10860
+ if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _211 => _211.size]) === 0) {
10831
10861
  errors.push({
10832
10862
  attribute: attr.name,
10833
10863
  message: `No valid target objects found for ${attr.label}`
@@ -10880,7 +10910,7 @@ var RelationService = class extends BaseService {
10880
10910
  for (const target of targets) {
10881
10911
  try {
10882
10912
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
10883
- if (_optionalChain([objectSchema, 'optionalAccess', _210 => _210.id])) {
10913
+ if (_optionalChain([objectSchema, 'optionalAccess', _212 => _212.id])) {
10884
10914
  objectIds.add(objectSchema.id);
10885
10915
  }
10886
10916
  } catch (e12) {
@@ -10949,7 +10979,7 @@ var RelationService = class extends BaseService {
10949
10979
  const targetResults = await Promise.all(
10950
10980
  filteredTargets.map(async (target) => {
10951
10981
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
10952
- if (!_optionalChain([objectSchema, 'optionalAccess', _211 => _211.id])) return { options: [], total: 0 };
10982
+ if (!_optionalChain([objectSchema, 'optionalAccess', _213 => _213.id])) return { options: [], total: 0 };
10953
10983
  const objectId = objectSchema.id;
10954
10984
  const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
10955
10985
  const options = await Promise.all(
@@ -11106,8 +11136,8 @@ var RelationService = class extends BaseService {
11106
11136
  continue;
11107
11137
  }
11108
11138
  const attribute = attributeMap.get(attributeId);
11109
- const targetConfig = _optionalChain([attribute, 'optionalAccess', _212 => _212.targets, 'optionalAccess', _213 => _213.find, 'call', _214 => _214((t) => t.object === objectSchema.name)]);
11110
- const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _215 => _215.displayTemplate]);
11139
+ const targetConfig = _optionalChain([attribute, 'optionalAccess', _214 => _214.targets, 'optionalAccess', _215 => _215.find, 'call', _216 => _216((t) => t.object === objectSchema.name)]);
11140
+ const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _217 => _217.displayTemplate]);
11111
11141
  const label = await this.resolveLabel(record, objectSchema, customTemplate);
11112
11142
  resolved.push({
11113
11143
  _compositeId: compositeId,
@@ -11257,14 +11287,14 @@ var RollupService = class extends BaseService {
11257
11287
  const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
11258
11288
  let sourceObjectId;
11259
11289
  let reverseRelationAttrName;
11260
- if (_optionalChain([sourceSchema, 'optionalAccess', _216 => _216.id])) {
11290
+ if (_optionalChain([sourceSchema, 'optionalAccess', _218 => _218.id])) {
11261
11291
  sourceObjectId = sourceSchema.id;
11262
11292
  const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
11263
11293
  if (attr.type !== "relation") return false;
11264
11294
  const relationConfig = attr;
11265
- return _optionalChain([relationConfig, 'optionalAccess', _217 => _217.targets, 'optionalAccess', _218 => _218.some, 'call', _219 => _219((t) => t.object === schema.name)]);
11295
+ return _optionalChain([relationConfig, 'optionalAccess', _219 => _219.targets, 'optionalAccess', _220 => _220.some, 'call', _221 => _221((t) => t.object === schema.name)]);
11266
11296
  });
11267
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _220 => _220.name]);
11297
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _222 => _222.name]);
11268
11298
  } else {
11269
11299
  const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
11270
11300
  if (!sourceObject) {
@@ -11275,9 +11305,9 @@ var RollupService = class extends BaseService {
11275
11305
  const reverseRelationAttr = sourceAttributes.find((attr) => {
11276
11306
  if (attr.type !== "relation") return false;
11277
11307
  const relationConfig = attr.config;
11278
- return _optionalChain([relationConfig, 'optionalAccess', _221 => _221.targets, 'optionalAccess', _222 => _222.some, 'call', _223 => _223((t) => t.object === schema.name)]);
11308
+ return _optionalChain([relationConfig, 'optionalAccess', _223 => _223.targets, 'optionalAccess', _224 => _224.some, 'call', _225 => _225((t) => t.object === schema.name)]);
11279
11309
  });
11280
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _224 => _224.name]);
11310
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _226 => _226.name]);
11281
11311
  }
11282
11312
  if (!reverseRelationAttrName) {
11283
11313
  return { value: null, recordCount: 0 };
@@ -11533,13 +11563,13 @@ var RollupService = class extends BaseService {
11533
11563
  if (!obj) continue;
11534
11564
  for (const rollupDbAttr of rollupAttrs) {
11535
11565
  const rollupConfig = rollupDbAttr.config;
11536
- if (!_optionalChain([rollupConfig, 'optionalAccess', _225 => _225.relationAttribute])) continue;
11566
+ if (!_optionalChain([rollupConfig, 'optionalAccess', _227 => _227.relationAttribute])) continue;
11537
11567
  const relationAttr = attributes.find(
11538
11568
  (a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
11539
11569
  );
11540
11570
  if (!relationAttr) continue;
11541
11571
  const relationConfig = relationAttr.config;
11542
- const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _226 => _226.targets, 'optionalAccess', _227 => _227.some, 'call', _228 => _228(
11572
+ const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _228 => _228.targets, 'optionalAccess', _229 => _229.some, 'call', _230 => _230(
11543
11573
  (t) => t.object === changedSchema.name
11544
11574
  )]);
11545
11575
  if (!targetsChangedObject) continue;
@@ -11564,11 +11594,11 @@ var RecordService = class extends BaseService {
11564
11594
  constructor(adapter, options) {
11565
11595
  super(adapter);
11566
11596
  this.schemaService = new ObjectSchemaService(adapter, registry, {
11567
- auditService: _optionalChain([options, 'optionalAccess', _229 => _229.auditService])
11597
+ auditService: _optionalChain([options, 'optionalAccess', _231 => _231.auditService])
11568
11598
  });
11569
- this.permissionService = _optionalChain([options, 'optionalAccess', _230 => _230.permissionService]);
11570
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _231 => _231.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
11571
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _232 => _232.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _233 => _233.policyRegistry]), () => ( defaultPolicyRegistry));
11599
+ this.permissionService = _optionalChain([options, 'optionalAccess', _232 => _232.permissionService]);
11600
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _233 => _233.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
11601
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _234 => _234.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _235 => _235.policyRegistry]), () => ( defaultPolicyRegistry));
11572
11602
  this.recordResolver = new RecordResolverService(adapter);
11573
11603
  this.queryService = new RecordQueryService(adapter, this.schemaService, {
11574
11604
  permissionService: this.permissionService,
@@ -11583,7 +11613,7 @@ var RecordService = class extends BaseService {
11583
11613
  recordResolver: this.recordResolver
11584
11614
  });
11585
11615
  this.userService = new UserService(adapter);
11586
- this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _234 => _234.hookRegistry]), () => ( new NoopHookRegistry()));
11616
+ this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _236 => _236.hookRegistry]), () => ( new NoopHookRegistry()));
11587
11617
  this.labelResolver = this.recordResolver.createLabelResolver(this.relationService);
11588
11618
  this.rollupContext = this.recordResolver.createRollupContext(
11589
11619
  this.rollupService,
@@ -11618,25 +11648,25 @@ var RecordService = class extends BaseService {
11618
11648
  schema,
11619
11649
  this.tenantId,
11620
11650
  dataWithDefaults,
11621
- _optionalChain([options, 'optionalAccess', _235 => _235.hookMetadata])
11651
+ _optionalChain([options, 'optionalAccess', _237 => _237.hookMetadata])
11622
11652
  );
11623
- if (!_optionalChain([options, 'optionalAccess', _236 => _236.skipHooks])) {
11653
+ if (!_optionalChain([options, 'optionalAccess', _238 => _238.skipHooks])) {
11624
11654
  await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
11625
11655
  }
11626
11656
  const normalizedData = this.relationPropertiesService.normalizeRelationValuesForStorage(
11627
11657
  schema,
11628
11658
  dataWithDefaults
11629
11659
  );
11630
- if (_optionalChain([options, 'optionalAccess', _237 => _237.validate]) !== false) {
11631
- if (_optionalChain([options, 'optionalAccess', _238 => _238.allowDraft])) {
11660
+ if (_optionalChain([options, 'optionalAccess', _239 => _239.validate]) !== false) {
11661
+ if (_optionalChain([options, 'optionalAccess', _240 => _240.allowDraft])) {
11632
11662
  _chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, normalizedData);
11633
11663
  } else {
11634
11664
  _chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, normalizedData);
11635
11665
  }
11636
- if (!_optionalChain([options, 'optionalAccess', _239 => _239.skipRelationValidation])) {
11666
+ if (!_optionalChain([options, 'optionalAccess', _241 => _241.skipRelationValidation])) {
11637
11667
  await this.relationService.validateRelationsOrThrow(schema, normalizedData);
11638
11668
  }
11639
- if (!_optionalChain([options, 'optionalAccess', _240 => _240.skipUserValidation])) {
11669
+ if (!_optionalChain([options, 'optionalAccess', _242 => _242.skipUserValidation])) {
11640
11670
  await this.userService.validateUsersOrThrow(schema, normalizedData);
11641
11671
  }
11642
11672
  }
@@ -11647,12 +11677,12 @@ var RecordService = class extends BaseService {
11647
11677
  data: normalizedData,
11648
11678
  label,
11649
11679
  completionStatus,
11650
- metadata: _optionalChain([options, 'optionalAccess', _241 => _241.metadata]),
11680
+ metadata: _optionalChain([options, 'optionalAccess', _243 => _243.metadata]),
11651
11681
  createdBy: this.userId
11652
11682
  });
11653
11683
  for (const [attrName, value] of Object.entries(dataWithDefaults)) {
11654
11684
  const attr = schema.attributes.find((a) => a.name === attrName);
11655
- if (_optionalChain([attr, 'optionalAccess', _242 => _242.type]) === "relation" && attr.properties) {
11685
+ if (_optionalChain([attr, 'optionalAccess', _244 => _244.type]) === "relation" && attr.properties) {
11656
11686
  await this.relationPropertiesService.syncRelationProperties(
11657
11687
  schema,
11658
11688
  record.id,
@@ -11662,7 +11692,7 @@ var RecordService = class extends BaseService {
11662
11692
  );
11663
11693
  }
11664
11694
  }
11665
- if (!_optionalChain([options, 'optionalAccess', _243 => _243.skipHooks])) {
11695
+ if (!_optionalChain([options, 'optionalAccess', _245 => _245.skipHooks])) {
11666
11696
  const afterCtx = {
11667
11697
  ...hookCtx,
11668
11698
  recordId: record.id,
@@ -11680,7 +11710,7 @@ var RecordService = class extends BaseService {
11680
11710
  objectId: schema.id,
11681
11711
  recordId: record.id,
11682
11712
  recordLabel: record.label,
11683
- metadata: _optionalChain([options, 'optionalAccess', _244 => _244.hookMetadata])
11713
+ metadata: _optionalChain([options, 'optionalAccess', _246 => _246.hookMetadata])
11684
11714
  }).catch((err) => {
11685
11715
  console.error(
11686
11716
  "Audit log failed (record.created):",
@@ -11706,7 +11736,7 @@ var RecordService = class extends BaseService {
11706
11736
  return null;
11707
11737
  }
11708
11738
  const schema = await this.schemaService.getObjectSchema(record.objectId);
11709
- if (!_optionalChain([options, 'optionalAccess', _245 => _245.skipPolicyCheck])) {
11739
+ if (!_optionalChain([options, 'optionalAccess', _247 => _247.skipPolicyCheck])) {
11710
11740
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
11711
11741
  if (policy) {
11712
11742
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
@@ -11716,10 +11746,10 @@ var RecordService = class extends BaseService {
11716
11746
  }
11717
11747
  }
11718
11748
  let enrichedRecord = record;
11719
- if (!_optionalChain([options, 'optionalAccess', _246 => _246.skipFormulas])) {
11749
+ if (!_optionalChain([options, 'optionalAccess', _248 => _248.skipFormulas])) {
11720
11750
  enrichedRecord = enrichWithFormulas(record, schema);
11721
11751
  }
11722
- if (_optionalChain([options, 'optionalAccess', _247 => _247.includeSchema])) {
11752
+ if (_optionalChain([options, 'optionalAccess', _249 => _249.includeSchema])) {
11723
11753
  const recordWithSchema = enrichedRecord;
11724
11754
  recordWithSchema.schema = schema;
11725
11755
  return recordWithSchema;
@@ -11781,9 +11811,9 @@ var RecordService = class extends BaseService {
11781
11811
  existing,
11782
11812
  mergedData,
11783
11813
  changedAttributes,
11784
- _optionalChain([options, 'optionalAccess', _248 => _248.hookMetadata])
11814
+ _optionalChain([options, 'optionalAccess', _250 => _250.hookMetadata])
11785
11815
  );
11786
- if (!_optionalChain([options, 'optionalAccess', _249 => _249.skipHooks])) {
11816
+ if (!_optionalChain([options, 'optionalAccess', _251 => _251.skipHooks])) {
11787
11817
  await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
11788
11818
  }
11789
11819
  const hookModifiedValues = {};
@@ -11798,16 +11828,16 @@ var RecordService = class extends BaseService {
11798
11828
  dataToUpdate
11799
11829
  );
11800
11830
  const normalizedMergedData = { ...existing.values, ...normalizedUpdate };
11801
- if (_optionalChain([options, 'optionalAccess', _250 => _250.validate]) !== false) {
11802
- if (_optionalChain([options, 'optionalAccess', _251 => _251.partial])) {
11831
+ if (_optionalChain([options, 'optionalAccess', _252 => _252.validate]) !== false) {
11832
+ if (_optionalChain([options, 'optionalAccess', _253 => _253.partial])) {
11803
11833
  _chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, normalizedMergedData);
11804
11834
  } else {
11805
11835
  _chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
11806
11836
  }
11807
- if (!_optionalChain([options, 'optionalAccess', _252 => _252.skipRelationValidation])) {
11837
+ if (!_optionalChain([options, 'optionalAccess', _254 => _254.skipRelationValidation])) {
11808
11838
  await this.relationService.validateRelationsOrThrow(schema, normalizedUpdate);
11809
11839
  }
11810
- if (!_optionalChain([options, 'optionalAccess', _253 => _253.skipUserValidation])) {
11840
+ if (!_optionalChain([options, 'optionalAccess', _255 => _255.skipUserValidation])) {
11811
11841
  await this.userService.validateUsersOrThrow(schema, normalizedUpdate);
11812
11842
  }
11813
11843
  }
@@ -11820,7 +11850,7 @@ var RecordService = class extends BaseService {
11820
11850
  __lastUpdatedBy: this.userId,
11821
11851
  __expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
11822
11852
  };
11823
- if (_optionalChain([options, 'optionalAccess', _254 => _254.metadata]) !== void 0) {
11853
+ if (_optionalChain([options, 'optionalAccess', _256 => _256.metadata]) !== void 0) {
11824
11854
  const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
11825
11855
  const mergedMetadata = { ...existingMetadata, ...options.metadata };
11826
11856
  const cleanedMetadata = Object.fromEntries(
@@ -11832,7 +11862,7 @@ var RecordService = class extends BaseService {
11832
11862
  await this.invalidateRecordCaches(recordId, existing.objectId);
11833
11863
  for (const [attrName, value] of Object.entries(dataToUpdate)) {
11834
11864
  const attr = schema.attributes.find((a) => a.name === attrName);
11835
- if (_optionalChain([attr, 'optionalAccess', _255 => _255.type]) === "relation" && attr.properties) {
11865
+ if (_optionalChain([attr, 'optionalAccess', _257 => _257.type]) === "relation" && attr.properties) {
11836
11866
  await this.relationPropertiesService.syncRelationProperties(
11837
11867
  schema,
11838
11868
  recordId,
@@ -11842,7 +11872,7 @@ var RecordService = class extends BaseService {
11842
11872
  );
11843
11873
  }
11844
11874
  }
11845
- if (!_optionalChain([options, 'optionalAccess', _256 => _256.skipHooks])) {
11875
+ if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipHooks])) {
11846
11876
  const afterCtx = {
11847
11877
  ...hookCtx,
11848
11878
  record: updated
@@ -11857,7 +11887,7 @@ var RecordService = class extends BaseService {
11857
11887
  if (this.auditService && this.userId && allChangedAttributes.length > 0) {
11858
11888
  const changes = allChangedAttributes.map((attr) => ({
11859
11889
  field: attr,
11860
- oldValue: _optionalChain([hookCtx, 'access', _257 => _257.oldValues, 'optionalAccess', _258 => _258[attr]]),
11890
+ oldValue: _optionalChain([hookCtx, 'access', _259 => _259.oldValues, 'optionalAccess', _260 => _260[attr]]),
11861
11891
  newValue: hookCtx.newValues[attr]
11862
11892
  }));
11863
11893
  this.auditService.logRecordAction({
@@ -11868,7 +11898,7 @@ var RecordService = class extends BaseService {
11868
11898
  recordId: updated.id,
11869
11899
  recordLabel: updated.label,
11870
11900
  changes,
11871
- metadata: _optionalChain([options, 'optionalAccess', _259 => _259.hookMetadata])
11901
+ metadata: _optionalChain([options, 'optionalAccess', _261 => _261.hookMetadata])
11872
11902
  }).catch((err) => {
11873
11903
  console.error(
11874
11904
  "Audit log failed (record.updated):",
@@ -11903,22 +11933,22 @@ var RecordService = class extends BaseService {
11903
11933
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
11904
11934
  checkRecordDeleteOrThrow(policy, record, ctx);
11905
11935
  }
11906
- if (_optionalChain([options, 'optionalAccess', _260 => _260.checkSystem]) && schema.system) {
11936
+ if (_optionalChain([options, 'optionalAccess', _262 => _262.checkSystem]) && schema.system) {
11907
11937
  throw new ProtectedResourceError("object", schema.name, "delete");
11908
11938
  }
11909
- if (!_optionalChain([options, 'optionalAccess', _261 => _261.skipReferenceCheck])) {
11939
+ if (!_optionalChain([options, 'optionalAccess', _263 => _263.skipReferenceCheck])) {
11910
11940
  const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
11911
11941
  if (references.length > 0) {
11912
11942
  throw new RecordReferencedError(recordId, references);
11913
11943
  }
11914
11944
  }
11915
- const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _262 => _262.hookMetadata]));
11916
- if (!_optionalChain([options, 'optionalAccess', _263 => _263.skipHooks])) {
11945
+ const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _264 => _264.hookMetadata]));
11946
+ if (!_optionalChain([options, 'optionalAccess', _265 => _265.skipHooks])) {
11917
11947
  await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
11918
11948
  }
11919
11949
  await this.adapter.objectRecords.delete(recordId);
11920
11950
  await this.invalidateRecordCaches(recordId, record.objectId);
11921
- if (!_optionalChain([options, 'optionalAccess', _264 => _264.skipHooks])) {
11951
+ if (!_optionalChain([options, 'optionalAccess', _266 => _266.skipHooks])) {
11922
11952
  await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
11923
11953
  }
11924
11954
  await recalculateParentRollups(record, schema, this.rollupContext);
@@ -11930,7 +11960,7 @@ var RecordService = class extends BaseService {
11930
11960
  objectId: schema.id,
11931
11961
  recordId: record.id,
11932
11962
  recordLabel: record.label,
11933
- metadata: _optionalChain([options, 'optionalAccess', _265 => _265.hookMetadata])
11963
+ metadata: _optionalChain([options, 'optionalAccess', _267 => _267.hookMetadata])
11934
11964
  }).catch((err) => {
11935
11965
  console.error(
11936
11966
  "Audit log failed (record.deleted):",
@@ -11973,13 +12003,13 @@ var RecordService = class extends BaseService {
11973
12003
  this.tenantId
11974
12004
  );
11975
12005
  await checkPermission(this.permissionService, this.userId, schema.name, "update");
11976
- const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _266 => _266.hookMetadata]));
11977
- if (!_optionalChain([options, 'optionalAccess', _267 => _267.skipHooks])) {
12006
+ const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _268 => _268.hookMetadata]));
12007
+ if (!_optionalChain([options, 'optionalAccess', _269 => _269.skipHooks])) {
11978
12008
  await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
11979
12009
  }
11980
12010
  const restored = await this.adapter.objectRecords.restore(recordId);
11981
12011
  await this.invalidateRecordCaches(recordId, record.objectId);
11982
- if (!_optionalChain([options, 'optionalAccess', _268 => _268.skipHooks])) {
12012
+ if (!_optionalChain([options, 'optionalAccess', _270 => _270.skipHooks])) {
11983
12013
  const afterCtx = {
11984
12014
  ...hookCtx,
11985
12015
  record: restored
@@ -11994,7 +12024,7 @@ var RecordService = class extends BaseService {
11994
12024
  objectId: schema.id,
11995
12025
  recordId: restored.id,
11996
12026
  recordLabel: restored.label,
11997
- metadata: _optionalChain([options, 'optionalAccess', _269 => _269.hookMetadata])
12027
+ metadata: _optionalChain([options, 'optionalAccess', _271 => _271.hookMetadata])
11998
12028
  }).catch((err) => {
11999
12029
  console.error(
12000
12030
  "Audit log failed (record.restored):",
@@ -12358,7 +12388,7 @@ var DocumentRendererService = class {
12358
12388
  throw error2;
12359
12389
  }
12360
12390
  throw new DocumentRenderError(
12361
- `Failed to render document: ${error2 instanceof Error ? error2.message : String(error2)}`,
12391
+ `Failed to render document: ${getErrorMessage(error2)}`,
12362
12392
  template.id,
12363
12393
  error2
12364
12394
  );
@@ -12375,7 +12405,7 @@ var DocumentRendererService = class {
12375
12405
  throw new StorageDownloadNotSupportedError();
12376
12406
  }
12377
12407
  let storagePath = fileId;
12378
- if (_optionalChain([this, 'access', _270 => _270.options, 'optionalAccess', _271 => _271.filesRepository])) {
12408
+ if (_optionalChain([this, 'access', _272 => _272.options, 'optionalAccess', _273 => _273.filesRepository])) {
12379
12409
  const file2 = await this.options.filesRepository.findById(fileId);
12380
12410
  if (!file2) {
12381
12411
  throw new Error(`Template file not found: ${fileId}`);
@@ -12393,8 +12423,8 @@ var DocumentRendererService = class {
12393
12423
  for (const field of fields) {
12394
12424
  const rawValue = getContextValue(context, field.contextPath);
12395
12425
  const attrInfo = await this.getAttributeInfo(field.contextPath, workflow2);
12396
- if (_optionalChain([attrInfo, 'optionalAccess', _272 => _272.attribute])) {
12397
- if (attrInfo.attribute.type === "relation" && rawValue && _optionalChain([this, 'access', _273 => _273.options, 'optionalAccess', _274 => _274.relationService])) {
12426
+ if (_optionalChain([attrInfo, 'optionalAccess', _274 => _274.attribute])) {
12427
+ if (attrInfo.attribute.type === "relation" && rawValue && _optionalChain([this, 'access', _275 => _275.options, 'optionalAccess', _276 => _276.relationService])) {
12398
12428
  const ids = Array.isArray(rawValue) ? rawValue : [rawValue];
12399
12429
  const stringIds = ids.filter((id) => typeof id === "string");
12400
12430
  if (stringIds.length > 0) {
@@ -12415,7 +12445,7 @@ var DocumentRendererService = class {
12415
12445
  resolved.set(field.id, this.formatValueSimple(rawValue, field.fallback));
12416
12446
  }
12417
12447
  }
12418
- if (relationBatch.length > 0 && _optionalChain([this, 'access', _275 => _275.options, 'optionalAccess', _276 => _276.relationService])) {
12448
+ if (relationBatch.length > 0 && _optionalChain([this, 'access', _277 => _277.options, 'optionalAccess', _278 => _278.relationService])) {
12419
12449
  try {
12420
12450
  const batchResult = await this.options.relationService.resolveIdsBatch(
12421
12451
  relationBatch.map((r) => ({ attributeId: r.attributeId, ids: r.ids }))
@@ -12424,12 +12454,12 @@ var DocumentRendererService = class {
12424
12454
  const options = _nullishCoalesce(batchResult[attributeId], () => ( []));
12425
12455
  const labels = options.map((o) => o.label);
12426
12456
  const field = fields.find((f) => f.id === fieldId);
12427
- resolved.set(fieldId, labels.join(", ") || _optionalChain([field, 'optionalAccess', _277 => _277.fallback]) || "");
12457
+ resolved.set(fieldId, labels.join(", ") || _optionalChain([field, 'optionalAccess', _279 => _279.fallback]) || "");
12428
12458
  }
12429
12459
  } catch (e14) {
12430
12460
  for (const { fieldId, ids } of relationBatch) {
12431
12461
  const field = fields.find((f) => f.id === fieldId);
12432
- resolved.set(fieldId, ids.join(", ") || _optionalChain([field, 'optionalAccess', _278 => _278.fallback]) || "");
12462
+ resolved.set(fieldId, ids.join(", ") || _optionalChain([field, 'optionalAccess', _280 => _280.fallback]) || "");
12433
12463
  }
12434
12464
  }
12435
12465
  }
@@ -12440,7 +12470,7 @@ var DocumentRendererService = class {
12440
12470
  * Parses paths like "slots.client.firstName" to find the attribute definition
12441
12471
  */
12442
12472
  async getAttributeInfo(contextPath, workflow2) {
12443
- const schemaService = _optionalChain([this, 'access', _279 => _279.options, 'optionalAccess', _280 => _280.schemaService]);
12473
+ const schemaService = _optionalChain([this, 'access', _281 => _281.options, 'optionalAccess', _282 => _282.schemaService]);
12444
12474
  if (!schemaService) {
12445
12475
  return null;
12446
12476
  }
@@ -12453,7 +12483,7 @@ var DocumentRendererService = class {
12453
12483
  }
12454
12484
  const slotId = parts[1];
12455
12485
  const attributeName = parts[2];
12456
- const slot = _optionalChain([workflow2, 'access', _281 => _281.slots, 'optionalAccess', _282 => _282.find, 'call', _283 => _283((s) => s.id === slotId)]);
12486
+ const slot = _optionalChain([workflow2, 'access', _283 => _283.slots, 'optionalAccess', _284 => _284.find, 'call', _285 => _285((s) => s.id === slotId)]);
12457
12487
  if (!slot) {
12458
12488
  return null;
12459
12489
  }
@@ -12630,7 +12660,7 @@ var DocumentProcessingHook = class extends BaseService {
12630
12660
  metadata: { ...metadata, status: "completed" }
12631
12661
  };
12632
12662
  } catch (error2) {
12633
- const errorMessage = error2 instanceof Error ? error2.message : String(error2);
12663
+ const errorMessage = getErrorMessage(error2);
12634
12664
  updatedDocuments[nodeId] = {
12635
12665
  ...doc,
12636
12666
  metadata: { ...metadata, status: "failed", error: errorMessage }
@@ -12652,7 +12682,7 @@ var DocumentProcessingHook = class extends BaseService {
12652
12682
  const pendingIds = [];
12653
12683
  for (const [nodeId, doc] of Object.entries(context.documents)) {
12654
12684
  const metadata = doc.metadata;
12655
- if (_optionalChain([metadata, 'optionalAccess', _284 => _284.status]) === "pending") {
12685
+ if (_optionalChain([metadata, 'optionalAccess', _286 => _286.status]) === "pending") {
12656
12686
  pendingIds.push(nodeId);
12657
12687
  }
12658
12688
  }
@@ -12703,12 +12733,12 @@ var DocumentProcessingHook = class extends BaseService {
12703
12733
  }
12704
12734
  for (const slotId of targetSlotIds) {
12705
12735
  try {
12706
- const recordId = _optionalChain([context, 'access', _285 => _285.createdRecordIds, 'optionalAccess', _286 => _286[slotId]]);
12736
+ const recordId = _optionalChain([context, 'access', _287 => _287.createdRecordIds, 'optionalAccess', _288 => _288[slotId]]);
12707
12737
  if (!recordId) {
12708
12738
  continue;
12709
12739
  }
12710
- const slotDef = _optionalChain([workflow2, 'access', _287 => _287.slots, 'optionalAccess', _288 => _288.find, 'call', _289 => _289((s) => s.id === slotId)]);
12711
- const objectName = _optionalChain([slotDef, 'optionalAccess', _290 => _290.objectName]);
12740
+ const slotDef = _optionalChain([workflow2, 'access', _289 => _289.slots, 'optionalAccess', _290 => _290.find, 'call', _291 => _291((s) => s.id === slotId)]);
12741
+ const objectName = _optionalChain([slotDef, 'optionalAccess', _292 => _292.objectName]);
12712
12742
  if (!objectName) {
12713
12743
  continue;
12714
12744
  }
@@ -12725,7 +12755,7 @@ var DocumentProcessingHook = class extends BaseService {
12725
12755
  attachedDocumentIds.push(result.document.id);
12726
12756
  const record = await recordService.getRecord(recordId);
12727
12757
  if (record) {
12728
- const attachments = _nullishCoalesce(_optionalChain([record, 'access', _291 => _291.values, 'optionalAccess', _292 => _292.attachments]), () => ( []));
12758
+ const attachments = _nullishCoalesce(_optionalChain([record, 'access', _293 => _293.values, 'optionalAccess', _294 => _294.attachments]), () => ( []));
12729
12759
  await recordService.updateRecord(
12730
12760
  recordId,
12731
12761
  { attachments: [...attachments, result.document.id] },
@@ -12991,7 +13021,7 @@ var WorkflowAccessGrantService = class extends BaseService {
12991
13021
  * Check if a specific token has been revoked.
12992
13022
  */
12993
13023
  isTokenRevoked(dbGrant, jti) {
12994
- return _nullishCoalesce(_optionalChain([dbGrant, 'access', _293 => _293.revoked_token_jtis, 'optionalAccess', _294 => _294.includes, 'call', _295 => _295(jti)]), () => ( false));
13024
+ return _nullishCoalesce(_optionalChain([dbGrant, 'access', _295 => _295.revoked_token_jtis, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(jti)]), () => ( false));
12995
13025
  }
12996
13026
  /**
12997
13027
  * Validate access token payload against the grant.
@@ -13043,10 +13073,10 @@ var WorkflowInstanceService = class extends BaseService {
13043
13073
  constructor(adapter, workflowService, options) {
13044
13074
  super(adapter);
13045
13075
  this.workflowService = workflowService;
13046
- this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _296 => _296.executorRegistry]), () => ( getDefaultExecutorRegistry()));
13047
- this.schemaService = _optionalChain([options, 'optionalAccess', _297 => _297.schemaService]);
13048
- this.recordService = _optionalChain([options, 'optionalAccess', _298 => _298.recordService]);
13049
- this.documentProcessingHook = _optionalChain([options, 'optionalAccess', _299 => _299.documentProcessingHook]);
13076
+ this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _298 => _298.executorRegistry]), () => ( getDefaultExecutorRegistry()));
13077
+ this.schemaService = _optionalChain([options, 'optionalAccess', _299 => _299.schemaService]);
13078
+ this.recordService = _optionalChain([options, 'optionalAccess', _300 => _300.recordService]);
13079
+ this.documentProcessingHook = _optionalChain([options, 'optionalAccess', _301 => _301.documentProcessingHook]);
13050
13080
  }
13051
13081
  /**
13052
13082
  * Start a new workflow instance
@@ -13097,7 +13127,7 @@ var WorkflowInstanceService = class extends BaseService {
13097
13127
  status: "failed",
13098
13128
  error: {
13099
13129
  code: "UNEXPECTED_ERROR",
13100
- message: error2 instanceof Error ? error2.message : String(error2),
13130
+ message: getErrorMessage(error2),
13101
13131
  nodeId: instance.currentNodeId,
13102
13132
  timestamp: /* @__PURE__ */ new Date()
13103
13133
  },
@@ -13143,7 +13173,7 @@ var WorkflowInstanceService = class extends BaseService {
13143
13173
  status: "failed",
13144
13174
  error: {
13145
13175
  code: "UNEXPECTED_ERROR",
13146
- message: error2 instanceof Error ? error2.message : String(error2),
13176
+ message: getErrorMessage(error2),
13147
13177
  nodeId: updatedInstance.currentNodeId,
13148
13178
  timestamp: /* @__PURE__ */ new Date()
13149
13179
  },
@@ -13228,7 +13258,7 @@ var WorkflowInstanceService = class extends BaseService {
13228
13258
  if (!this.adapter.workflowInstances) {
13229
13259
  return { instances: [], total: 0 };
13230
13260
  }
13231
- if (_optionalChain([options, 'optionalAccess', _300 => _300.workflowName])) {
13261
+ if (_optionalChain([options, 'optionalAccess', _302 => _302.workflowName])) {
13232
13262
  const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
13233
13263
  options.workflowName,
13234
13264
  { status: options.status }
@@ -13242,11 +13272,11 @@ var WorkflowInstanceService = class extends BaseService {
13242
13272
  return { instances: instances2, total: total2 };
13243
13273
  }
13244
13274
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
13245
- limit: _optionalChain([options, 'optionalAccess', _301 => _301.limit]),
13246
- offset: _optionalChain([options, 'optionalAccess', _302 => _302.offset])
13275
+ limit: _optionalChain([options, 'optionalAccess', _303 => _303.limit]),
13276
+ offset: _optionalChain([options, 'optionalAccess', _304 => _304.offset])
13247
13277
  });
13248
13278
  let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
13249
- if (_optionalChain([options, 'optionalAccess', _303 => _303.status])) {
13279
+ if (_optionalChain([options, 'optionalAccess', _305 => _305.status])) {
13250
13280
  instances = instances.filter((i) => i.status === options.status);
13251
13281
  }
13252
13282
  instances = await this.markExpiredInstances(instances);
@@ -13267,9 +13297,9 @@ var WorkflowInstanceService = class extends BaseService {
13267
13297
  return { instances: [], total: 0 };
13268
13298
  }
13269
13299
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
13270
- status: _optionalChain([options, 'optionalAccess', _304 => _304.status]),
13271
- limit: _optionalChain([options, 'optionalAccess', _305 => _305.limit]),
13272
- offset: _optionalChain([options, 'optionalAccess', _306 => _306.offset])
13300
+ status: _optionalChain([options, 'optionalAccess', _306 => _306.status]),
13301
+ limit: _optionalChain([options, 'optionalAccess', _307 => _307.limit]),
13302
+ offset: _optionalChain([options, 'optionalAccess', _308 => _308.offset])
13273
13303
  });
13274
13304
  const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
13275
13305
  return { instances, total };
@@ -13335,7 +13365,7 @@ var WorkflowInstanceService = class extends BaseService {
13335
13365
  try {
13336
13366
  const schemas = await Promise.all(
13337
13367
  current.workflowSnapshot.slots.map(
13338
- (slot) => _optionalChain([this, 'access', _307 => _307.schemaService, 'optionalAccess', _308 => _308.getObjectSchemaByName, 'call', _309 => _309(slot.objectName)])
13368
+ (slot) => _optionalChain([this, 'access', _309 => _309.schemaService, 'optionalAccess', _310 => _310.getObjectSchemaByName, 'call', _311 => _311(slot.objectName)])
13339
13369
  )
13340
13370
  );
13341
13371
  objectDefinitions = schemas.filter(
@@ -13584,7 +13614,7 @@ var WorkflowInstanceService = class extends BaseService {
13584
13614
  const rolledBackSlots = await this.rollbackSlotOperations(completedOperations);
13585
13615
  const rollbackInfo = rolledBackSlots.length > 0 ? ` Rolled back slots: [${rolledBackSlots.join(", ")}].` : "";
13586
13616
  throw new SchemaError(
13587
- `Failed to persist slot "${slot.id}" (${slot.objectName}): ${error2 instanceof Error ? error2.message : String(error2)}.${rollbackInfo}`,
13617
+ `Failed to persist slot "${slot.id}" (${slot.objectName}): ${getErrorMessage(error2)}.${rollbackInfo}`,
13588
13618
  SchemaErrorCode.VALIDATION_FAILED
13589
13619
  );
13590
13620
  }
@@ -13600,8 +13630,8 @@ var WorkflowInstanceService = class extends BaseService {
13600
13630
  */
13601
13631
  async snapshotRecord(recordId) {
13602
13632
  try {
13603
- const record = await _optionalChain([this, 'access', _310 => _310.recordService, 'optionalAccess', _311 => _311.getRecord, 'call', _312 => _312(recordId, { skipPolicyCheck: true })]);
13604
- return _optionalChain([record, 'optionalAccess', _313 => _313.values]);
13633
+ const record = await _optionalChain([this, 'access', _312 => _312.recordService, 'optionalAccess', _313 => _313.getRecord, 'call', _314 => _314(recordId, { skipPolicyCheck: true })]);
13634
+ return _optionalChain([record, 'optionalAccess', _315 => _315.values]);
13605
13635
  } catch (e18) {
13606
13636
  return void 0;
13607
13637
  }
@@ -13620,13 +13650,13 @@ var WorkflowInstanceService = class extends BaseService {
13620
13650
  for (const op of [...operations].reverse()) {
13621
13651
  try {
13622
13652
  if (op.operation === "create") {
13623
- await _optionalChain([this, 'access', _314 => _314.recordService, 'optionalAccess', _315 => _315.deleteRecord, 'call', _316 => _316(op.recordId, {
13653
+ await _optionalChain([this, 'access', _316 => _316.recordService, 'optionalAccess', _317 => _317.deleteRecord, 'call', _318 => _318(op.recordId, {
13624
13654
  skipHooks: true,
13625
13655
  skipReferenceCheck: true
13626
13656
  })]);
13627
13657
  rolledBack.push(op.slotId);
13628
13658
  } else if (op.operation === "update" && op.previousData) {
13629
- await _optionalChain([this, 'access', _317 => _317.recordService, 'optionalAccess', _318 => _318.updateRecord, 'call', _319 => _319(op.recordId, op.previousData, {
13659
+ await _optionalChain([this, 'access', _319 => _319.recordService, 'optionalAccess', _320 => _320.updateRecord, 'call', _321 => _321(op.recordId, op.previousData, {
13630
13660
  partial: false
13631
13661
  })]);
13632
13662
  rolledBack.push(op.slotId);
@@ -13750,7 +13780,7 @@ var WorkflowInstanceService = class extends BaseService {
13750
13780
  if (!this.adapter.workflowInstances) {
13751
13781
  return;
13752
13782
  }
13753
- const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _320 => _320.context, 'access', _321 => _321.variables, 'optionalAccess', _322 => _322.__version]), () => ( 0));
13783
+ const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _322 => _322.context, 'access', _323 => _323.variables, 'optionalAccess', _324 => _324.__version]), () => ( 0));
13754
13784
  const nextVersion = currentVersion + 1;
13755
13785
  const instanceWithVersion = {
13756
13786
  ...instance,
@@ -14031,7 +14061,7 @@ var WorkflowRelationService = class extends BaseService {
14031
14061
  if (attr.type !== "relation") continue;
14032
14062
  for (const slot of slots) {
14033
14063
  const slotData = context.slots[slot.id];
14034
- const slotRecordId = _optionalChain([slotData, 'optionalAccess', _323 => _323.id]);
14064
+ const slotRecordId = _optionalChain([slotData, 'optionalAccess', _325 => _325.id]);
14035
14065
  if (!slotRecordId) continue;
14036
14066
  const targetsSlotObject = attr.targets.some(
14037
14067
  (t) => t.object === slot.objectName
@@ -14099,7 +14129,7 @@ var WorkflowService = class extends BaseService {
14099
14129
  if (Array.isArray(options)) {
14100
14130
  this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
14101
14131
  } else {
14102
- this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _324 => _324.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14132
+ this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _326 => _326.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14103
14133
  }
14104
14134
  }
14105
14135
  // ============================================================================
@@ -14397,7 +14427,7 @@ var WorkflowService = class extends BaseService {
14397
14427
  var UserProfileService = class extends BaseService {
14398
14428
  constructor(adapter, options) {
14399
14429
  super(adapter);
14400
- this.auditService = _optionalChain([options, 'optionalAccess', _325 => _325.auditService]);
14430
+ this.auditService = _optionalChain([options, 'optionalAccess', _327 => _327.auditService]);
14401
14431
  }
14402
14432
  // ============================================================================
14403
14433
  // CACHE MANAGEMENT
@@ -14560,7 +14590,7 @@ var UserProfileService = class extends BaseService {
14560
14590
  */
14561
14591
  async deleteProfile(profileId, options) {
14562
14592
  const profile = await this.getProfileOrThrow(profileId);
14563
- if (_optionalChain([options, 'optionalAccess', _326 => _326.checkAdmin])) {
14593
+ if (_optionalChain([options, 'optionalAccess', _328 => _328.checkAdmin])) {
14564
14594
  if (profile.role === "admin") {
14565
14595
  const adminCount = await this.adapter.userProfiles.countByRole("admin");
14566
14596
  if (adminCount <= 1) {
@@ -14635,7 +14665,7 @@ var UserProfileService = class extends BaseService {
14635
14665
  */
14636
14666
  async hasRole(profileId, role) {
14637
14667
  const profile = await this.getProfile(profileId);
14638
- return _optionalChain([profile, 'optionalAccess', _327 => _327.role]) === role;
14668
+ return _optionalChain([profile, 'optionalAccess', _329 => _329.role]) === role;
14639
14669
  }
14640
14670
  /**
14641
14671
  * Check if user is admin
@@ -15069,7 +15099,7 @@ var DocumentTemplateService = class extends BaseService {
15069
15099
  * Includes both system templates and tenant-specific templates.
15070
15100
  */
15071
15101
  async listTemplates(options) {
15072
- if (_optionalChain([options, 'optionalAccess', _328 => _328.systemOnly])) {
15102
+ if (_optionalChain([options, 'optionalAccess', _330 => _330.systemOnly])) {
15073
15103
  return SYSTEM_TEMPLATES;
15074
15104
  }
15075
15105
  const templates = [...SYSTEM_TEMPLATES];
@@ -15152,8 +15182,8 @@ var DocumentTemplateService = class extends BaseService {
15152
15182
  var DocumentService = class extends BaseService {
15153
15183
  constructor(adapter, options) {
15154
15184
  super(adapter);
15155
- this.templateService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _329 => _329.templateService]), () => ( new DocumentTemplateService(adapter)));
15156
- this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _330 => _330.fileService]), () => ( null));
15185
+ this.templateService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _331 => _331.templateService]), () => ( new DocumentTemplateService(adapter)));
15186
+ this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _332 => _332.fileService]), () => ( null));
15157
15187
  }
15158
15188
  // ============================================================================
15159
15189
  // CREATE
@@ -15404,7 +15434,7 @@ var DocumentService = class extends BaseService {
15404
15434
  */
15405
15435
  async isComplete(documentId) {
15406
15436
  const document2 = await this.getDocument(documentId);
15407
- return _optionalChain([document2, 'optionalAccess', _331 => _331.status]) !== "draft";
15437
+ return _optionalChain([document2, 'optionalAccess', _333 => _333.status]) !== "draft";
15408
15438
  }
15409
15439
  /**
15410
15440
  * Get document with its template and slots.
@@ -15623,7 +15653,7 @@ var DocumentProcessingService = class extends BaseService {
15623
15653
  await this.documentService.recalculateStatus(job.documentId);
15624
15654
  return completedJob;
15625
15655
  } catch (error2) {
15626
- const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
15656
+ const errorMessage = getErrorMessage(error2);
15627
15657
  const failedJob = await this.adapter.documentJobs.markFailed(jobId, errorMessage);
15628
15658
  if (job.slotName) {
15629
15659
  const slot = await this.adapter.documentSlots.findByDocumentAndSlot(
@@ -15662,7 +15692,7 @@ var DocumentProcessingService = class extends BaseService {
15662
15692
  type: "signature",
15663
15693
  provider: this.config.signatureAdapter.name,
15664
15694
  input: { signers, ...options },
15665
- expiresAt: _optionalChain([options, 'optionalAccess', _332 => _332.expiresAt])
15695
+ expiresAt: _optionalChain([options, 'optionalAccess', _334 => _334.expiresAt])
15666
15696
  });
15667
15697
  return job;
15668
15698
  }
@@ -15718,7 +15748,7 @@ var DocumentProcessingService = class extends BaseService {
15718
15748
  await this.documentService.updateStatus(job.documentId, "processing");
15719
15749
  return updatedJob;
15720
15750
  } catch (error2) {
15721
- const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
15751
+ const errorMessage = getErrorMessage(error2);
15722
15752
  const failedJob = await this.adapter.documentJobs.markFailed(jobId, errorMessage);
15723
15753
  await this.documentService.recalculateStatus(job.documentId);
15724
15754
  return failedJob;
@@ -15819,7 +15849,7 @@ var DocumentProcessingService = class extends BaseService {
15819
15849
  }
15820
15850
  const document2 = await this.documentService.getDocumentOrThrow(documentId);
15821
15851
  const template = await this.templateService.getTemplateOrThrow(document2.templateId);
15822
- if (!_optionalChain([template, 'access', _333 => _333.autoProcessing, 'optionalAccess', _334 => _334.identityVerification, 'optionalAccess', _335 => _335.enabled])) {
15852
+ if (!_optionalChain([template, 'access', _335 => _335.autoProcessing, 'optionalAccess', _336 => _336.identityVerification, 'optionalAccess', _337 => _337.enabled])) {
15823
15853
  throw new Error("Identity verification is not enabled for this document type");
15824
15854
  }
15825
15855
  const job = await this.adapter.documentJobs.create({
@@ -15887,7 +15917,7 @@ var DocumentProcessingService = class extends BaseService {
15887
15917
  await this.documentService.recalculateStatus(job.documentId);
15888
15918
  return completedJob;
15889
15919
  } catch (error2) {
15890
- const errorMessage = error2 instanceof Error ? error2.message : "Unknown error";
15920
+ const errorMessage = getErrorMessage(error2);
15891
15921
  const failedJob = await this.adapter.documentJobs.markFailed(jobId, errorMessage);
15892
15922
  await this.documentService.recalculateStatus(job.documentId);
15893
15923
  return failedJob;
@@ -15905,13 +15935,13 @@ var DocumentProcessingService = class extends BaseService {
15905
15935
  const template = await this.templateService.getTemplateOrThrow(document2.templateId);
15906
15936
  const slots = await this.documentService.getSlots(documentId);
15907
15937
  const jobs = [];
15908
- if (_optionalChain([template, 'access', _336 => _336.autoProcessing, 'optionalAccess', _337 => _337.ocr, 'optionalAccess', _338 => _338.enabled]) && this.config.ocrAdapter) {
15938
+ if (_optionalChain([template, 'access', _338 => _338.autoProcessing, 'optionalAccess', _339 => _339.ocr, 'optionalAccess', _340 => _340.enabled]) && this.config.ocrAdapter) {
15909
15939
  for (const slot of slots) {
15910
15940
  const job = await this.processOcr(documentId, slot.slotName);
15911
15941
  jobs.push(job);
15912
15942
  }
15913
15943
  }
15914
- if (_optionalChain([template, 'access', _339 => _339.autoProcessing, 'optionalAccess', _340 => _340.identityVerification, 'optionalAccess', _341 => _341.enabled]) && this.config.identityAdapter) {
15944
+ if (_optionalChain([template, 'access', _341 => _341.autoProcessing, 'optionalAccess', _342 => _342.identityVerification, 'optionalAccess', _343 => _343.enabled]) && this.config.identityAdapter) {
15915
15945
  const job = await this.verifyIdentity(documentId);
15916
15946
  jobs.push(job);
15917
15947
  }
@@ -15982,15 +16012,15 @@ var DocumentProcessingService = class extends BaseService {
15982
16012
  return {
15983
16013
  ocr: {
15984
16014
  available: !!this.config.ocrAdapter,
15985
- provider: _optionalChain([this, 'access', _342 => _342.config, 'access', _343 => _343.ocrAdapter, 'optionalAccess', _344 => _344.name])
16015
+ provider: _optionalChain([this, 'access', _344 => _344.config, 'access', _345 => _345.ocrAdapter, 'optionalAccess', _346 => _346.name])
15986
16016
  },
15987
16017
  signature: {
15988
16018
  available: !!this.config.signatureAdapter,
15989
- provider: _optionalChain([this, 'access', _345 => _345.config, 'access', _346 => _346.signatureAdapter, 'optionalAccess', _347 => _347.name])
16019
+ provider: _optionalChain([this, 'access', _347 => _347.config, 'access', _348 => _348.signatureAdapter, 'optionalAccess', _349 => _349.name])
15990
16020
  },
15991
16021
  identityVerification: {
15992
16022
  available: !!this.config.identityAdapter,
15993
- provider: _optionalChain([this, 'access', _348 => _348.config, 'access', _349 => _349.identityAdapter, 'optionalAccess', _350 => _350.name])
16023
+ provider: _optionalChain([this, 'access', _350 => _350.config, 'access', _351 => _351.identityAdapter, 'optionalAccess', _352 => _352.name])
15994
16024
  }
15995
16025
  };
15996
16026
  }
@@ -16000,7 +16030,7 @@ var DocumentProcessingService = class extends BaseService {
16000
16030
  var FileService = class extends BaseService {
16001
16031
  constructor(adapter, options) {
16002
16032
  super(adapter);
16003
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _351 => _351.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
16033
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _353 => _353.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
16004
16034
  }
16005
16035
  // ============================================================================
16006
16036
  // UPLOAD (requires StorageAdapter)
@@ -16139,7 +16169,7 @@ var FileService = class extends BaseService {
16139
16169
  */
16140
16170
  async getFile(fileId) {
16141
16171
  const file2 = await this.adapter.files.findById(fileId);
16142
- if (_optionalChain([file2, 'optionalAccess', _352 => _352.deletedAt])) {
16172
+ if (_optionalChain([file2, 'optionalAccess', _354 => _354.deletedAt])) {
16143
16173
  return null;
16144
16174
  }
16145
16175
  return file2;
@@ -16201,12 +16231,12 @@ var FileService = class extends BaseService {
16201
16231
  */
16202
16232
  async deleteFile(fileId, options) {
16203
16233
  const file2 = await this.getFileOrThrow(fileId);
16204
- if (_optionalChain([options, 'optionalAccess', _353 => _353.checkOwnership]) && options.userId) {
16234
+ if (_optionalChain([options, 'optionalAccess', _355 => _355.checkOwnership]) && options.userId) {
16205
16235
  if (file2.uploadedBy !== options.userId) {
16206
16236
  throw new Error("You can only delete files you uploaded");
16207
16237
  }
16208
16238
  }
16209
- if (_optionalChain([options, 'optionalAccess', _354 => _354.hard])) {
16239
+ if (_optionalChain([options, 'optionalAccess', _356 => _356.hard])) {
16210
16240
  await this.adapter.files.hardDelete(fileId);
16211
16241
  } else {
16212
16242
  await this.adapter.files.delete(fileId);
@@ -16237,7 +16267,7 @@ var FileService = class extends BaseService {
16237
16267
  }
16238
16268
  const file2 = await this.getFileOrThrow(fileId);
16239
16269
  await this.adapter.storage.delete(file2.storagePath);
16240
- if (_optionalChain([options, 'optionalAccess', _355 => _355.hard])) {
16270
+ if (_optionalChain([options, 'optionalAccess', _357 => _357.hard])) {
16241
16271
  await this.adapter.files.hardDelete(fileId);
16242
16272
  } else {
16243
16273
  await this.adapter.files.delete(fileId);
@@ -16263,15 +16293,15 @@ var FileService = class extends BaseService {
16263
16293
  const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
16264
16294
  const files = fileResults.filter((f) => f !== null);
16265
16295
  if (files.length === 0) return;
16266
- if (_optionalChain([options, 'optionalAccess', _356 => _356.deleteFromStorage]) && this.adapter.storage) {
16296
+ if (_optionalChain([options, 'optionalAccess', _358 => _358.deleteFromStorage]) && this.adapter.storage) {
16267
16297
  const BATCH_SIZE = 10;
16268
16298
  for (let i = 0; i < files.length; i += BATCH_SIZE) {
16269
16299
  const batch = files.slice(i, i + BATCH_SIZE);
16270
- await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _357 => _357.adapter, 'access', _358 => _358.storage, 'optionalAccess', _359 => _359.delete, 'call', _360 => _360(file2.storagePath)])));
16300
+ await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _359 => _359.adapter, 'access', _360 => _360.storage, 'optionalAccess', _361 => _361.delete, 'call', _362 => _362(file2.storagePath)])));
16271
16301
  }
16272
16302
  }
16273
16303
  const idsToDelete = files.map((f) => f.id);
16274
- if (_optionalChain([options, 'optionalAccess', _361 => _361.hard])) {
16304
+ if (_optionalChain([options, 'optionalAccess', _363 => _363.hard])) {
16275
16305
  await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
16276
16306
  } else {
16277
16307
  await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
@@ -16279,12 +16309,12 @@ var FileService = class extends BaseService {
16279
16309
  if (this.auditService && this.userId) {
16280
16310
  await Promise.all(
16281
16311
  files.map(
16282
- (file2) => _optionalChain([this, 'access', _362 => _362.auditService, 'optionalAccess', _363 => _363.logFileAction, 'call', _364 => _364({
16312
+ (file2) => _optionalChain([this, 'access', _364 => _364.auditService, 'optionalAccess', _365 => _365.logFileAction, 'call', _366 => _366({
16283
16313
  action: "file.deleted",
16284
16314
  actorId: _nullishCoalesce(this.userId, () => ( "")),
16285
16315
  fileId: file2.id,
16286
16316
  fileName: file2.name,
16287
- metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _365 => _365.deleteFromStorage]), () => ( false)) }
16317
+ metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _367 => _367.deleteFromStorage]), () => ( false)) }
16288
16318
  })])
16289
16319
  )
16290
16320
  );
@@ -16362,7 +16392,7 @@ var FileService = class extends BaseService {
16362
16392
  if (!file2) {
16363
16393
  return false;
16364
16394
  }
16365
- if (_optionalChain([options, 'optionalAccess', _366 => _366.isAdmin])) {
16395
+ if (_optionalChain([options, 'optionalAccess', _368 => _368.isAdmin])) {
16366
16396
  return true;
16367
16397
  }
16368
16398
  if (file2.visibility === "public") {
@@ -16372,7 +16402,7 @@ var FileService = class extends BaseService {
16372
16402
  return true;
16373
16403
  }
16374
16404
  if (file2.visibility === "restricted") {
16375
- return _nullishCoalesce(_optionalChain([file2, 'access', _367 => _367.allowedUsers, 'optionalAccess', _368 => _368.includes, 'call', _369 => _369(userId)]), () => ( false));
16405
+ return _nullishCoalesce(_optionalChain([file2, 'access', _369 => _369.allowedUsers, 'optionalAccess', _370 => _370.includes, 'call', _371 => _371(userId)]), () => ( false));
16376
16406
  }
16377
16407
  return false;
16378
16408
  }
@@ -16467,7 +16497,7 @@ function withTimeout(promise, ms, label) {
16467
16497
  var GeocodingService = class {
16468
16498
  constructor(adapter, options) {
16469
16499
  this.adapter = adapter;
16470
- this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _370 => _370.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16500
+ this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16471
16501
  }
16472
16502
  /**
16473
16503
  * Search for address suggestions as the user types
@@ -16517,23 +16547,6 @@ var GlobalSearchService = class extends BaseService {
16517
16547
  * @param query - Search query string
16518
16548
  * @param options - Search options (pagination, object filters)
16519
16549
  * @returns Matching records with object metadata and total count
16520
- *
16521
- * @example
16522
- * ```typescript
16523
- * // Basic search
16524
- * const { results, total } = await service.search("nike air");
16525
- *
16526
- * // With pagination
16527
- * const { results, total } = await service.search("nike", {
16528
- * limit: 10,
16529
- * offset: 20
16530
- * });
16531
- *
16532
- * // Filter by object types
16533
- * const { results, total } = await service.search("nike", {
16534
- * objectNames: ["products", "orders"]
16535
- * });
16536
- * ```
16537
16550
  */
16538
16551
  async search(query, options) {
16539
16552
  if (!query || query.trim().length === 0) {
@@ -16541,58 +16554,36 @@ var GlobalSearchService = class extends BaseService {
16541
16554
  }
16542
16555
  return this.cachedList(
16543
16556
  "globalSearch",
16544
- "global",
16557
+ "search",
16545
16558
  { query: query.trim(), ...options },
16546
- () => this.executeSearch(query.trim(), options)
16559
+ () => this.adapter.objectRecords.globalSearch(query.trim(), {
16560
+ limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _373 => _373.limit]), () => ( 20)),
16561
+ offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.offset]), () => ( 0)),
16562
+ objectNames: _optionalChain([options, 'optionalAccess', _375 => _375.objectNames])
16563
+ })
16547
16564
  );
16548
16565
  }
16549
16566
  /**
16550
- * Internal search execution (extracted for caching)
16551
- */
16552
- async executeSearch(query, options) {
16553
- return await this.adapter.objectRecords.globalSearch(query, {
16554
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _371 => _371.limit]), () => ( 20)),
16555
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.offset]), () => ( 0)),
16556
- objectNames: _optionalChain([options, 'optionalAccess', _373 => _373.objectNames]),
16557
- includeObjectInfo: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.includeObjectInfo]), () => ( true))
16558
- });
16559
- }
16560
- /**
16561
- * Search and group results by object type
16567
+ * Search and group results by object type.
16568
+ * Delegates grouping to the database for accurate per-group counts.
16562
16569
  *
16563
16570
  * @param query - Search query string
16564
- * @param options - Search options
16565
- * @returns Results grouped by object name
16571
+ * @param options - Search options (object filters, limit per group)
16572
+ * @returns Results grouped by object name with per-group totals
16566
16573
  */
16567
16574
  async searchGrouped(query, options) {
16568
- const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _375 => _375.limitPerGroup]), () => ( 5));
16569
- const estimatedGroupCount = 10;
16570
- const fetchLimit = Math.min(limitPerGroup * estimatedGroupCount, 100);
16571
- const { results, total } = await this.search(query, {
16572
- ...options,
16573
- limit: fetchLimit,
16574
- offset: 0
16575
- });
16576
- const groupMap = /* @__PURE__ */ new Map();
16577
- for (const result of results) {
16578
- const existing = groupMap.get(result.objectName);
16579
- if (existing) {
16580
- existing.results.push(result);
16581
- } else {
16582
- groupMap.set(result.objectName, {
16583
- objectName: result.objectName,
16584
- objectLabel: result.objectLabel,
16585
- results: [result]
16586
- });
16587
- }
16575
+ if (!query || query.trim().length === 0) {
16576
+ return { groups: [], total: 0 };
16588
16577
  }
16589
- const groups = Array.from(groupMap.values()).map((g) => ({
16590
- ...g,
16591
- results: g.results.slice(0, limitPerGroup),
16592
- count: g.results.length
16593
- }));
16594
- groups.sort((a, b) => b.count - a.count);
16595
- return { groups, total };
16578
+ return this.cachedList(
16579
+ "globalSearch",
16580
+ "grouped",
16581
+ { query: query.trim(), ...options },
16582
+ () => this.adapter.objectRecords.globalSearchGrouped(query.trim(), {
16583
+ objectNames: _optionalChain([options, 'optionalAccess', _376 => _376.objectNames]),
16584
+ limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _377 => _377.limitPerGroup]), () => ( 5))
16585
+ })
16586
+ );
16596
16587
  }
16597
16588
  };
16598
16589
 
@@ -16607,7 +16598,7 @@ var PermissionService = class extends BaseService {
16607
16598
  }
16608
16599
  this.permissionsRepo = adapter.permissions;
16609
16600
  this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
16610
- this.auditService = _optionalChain([options, 'optionalAccess', _376 => _376.auditService]);
16601
+ this.auditService = _optionalChain([options, 'optionalAccess', _378 => _378.auditService]);
16611
16602
  }
16612
16603
  // ============================================================================
16613
16604
  // PERMISSION CHECKS
@@ -16626,11 +16617,11 @@ var PermissionService = class extends BaseService {
16626
16617
  return true;
16627
16618
  }
16628
16619
  const wildcardPerms = permissions.objectPermissions["*"];
16629
- if (_optionalChain([wildcardPerms, 'optionalAccess', _377 => _377.includes, 'call', _378 => _378(action)])) {
16620
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _379 => _379.includes, 'call', _380 => _380(action)])) {
16630
16621
  return true;
16631
16622
  }
16632
16623
  const objectPerms = permissions.objectPermissions[objectName];
16633
- return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _379 => _379.includes, 'call', _380 => _380(action)]), () => ( false));
16624
+ return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _381 => _381.includes, 'call', _382 => _382(action)]), () => ( false));
16634
16625
  }
16635
16626
  /**
16636
16627
  * Check if user can access an object, throw ForbiddenError if not.
@@ -16685,12 +16676,12 @@ var PermissionService = class extends BaseService {
16685
16676
  if (permissions.isAdmin) {
16686
16677
  return true;
16687
16678
  }
16688
- const wildcardPerms = _optionalChain([permissions, 'access', _381 => _381.systemPermissions, 'optionalAccess', _382 => _382["*"]]);
16689
- if (_optionalChain([wildcardPerms, 'optionalAccess', _383 => _383.includes, 'call', _384 => _384(action)])) {
16679
+ const wildcardPerms = _optionalChain([permissions, 'access', _383 => _383.systemPermissions, 'optionalAccess', _384 => _384["*"]]);
16680
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _385 => _385.includes, 'call', _386 => _386(action)])) {
16690
16681
  return true;
16691
16682
  }
16692
- const resourcePerms = _optionalChain([permissions, 'access', _385 => _385.systemPermissions, 'optionalAccess', _386 => _386[resource]]);
16693
- return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _387 => _387.includes, 'call', _388 => _388(action)]), () => ( false));
16683
+ const resourcePerms = _optionalChain([permissions, 'access', _387 => _387.systemPermissions, 'optionalAccess', _388 => _388[resource]]);
16684
+ return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _389 => _389.includes, 'call', _390 => _390(action)]), () => ( false));
16694
16685
  }
16695
16686
  /**
16696
16687
  * Check if user can access a system resource, throw ForbiddenError if not.
@@ -16719,8 +16710,8 @@ var PermissionService = class extends BaseService {
16719
16710
  if (permissions.isAdmin) {
16720
16711
  return { canRead: true, canCreate: true, canUpdate: true, canDelete: true };
16721
16712
  }
16722
- const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _389 => _389.systemPermissions, 'optionalAccess', _390 => _390["*"]]), () => ( []));
16723
- const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _391 => _391.systemPermissions, 'optionalAccess', _392 => _392[resource]]), () => ( []));
16713
+ const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _391 => _391.systemPermissions, 'optionalAccess', _392 => _392["*"]]), () => ( []));
16714
+ const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _393 => _393.systemPermissions, 'optionalAccess', _394 => _394[resource]]), () => ( []));
16724
16715
  const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
16725
16716
  return {
16726
16717
  canRead: allPerms.has("read"),
@@ -16863,7 +16854,7 @@ var PermissionService = class extends BaseService {
16863
16854
  action: "role.updated",
16864
16855
  actorId: this.userId,
16865
16856
  roleId,
16866
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _393 => _393.label]), () => ( roleId)),
16857
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _395 => _395.label]), () => ( roleId)),
16867
16858
  metadata: { permissionsUpdated: true, permissionCount: permissions.length }
16868
16859
  });
16869
16860
  }
@@ -16893,7 +16884,7 @@ var PermissionService = class extends BaseService {
16893
16884
  action: "role.assigned",
16894
16885
  actorId: this.userId,
16895
16886
  roleId,
16896
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _394 => _394.label]), () => ( roleId)),
16887
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _396 => _396.label]), () => ( roleId)),
16897
16888
  targetUserId: userProfileId
16898
16889
  });
16899
16890
  }
@@ -16911,7 +16902,7 @@ var PermissionService = class extends BaseService {
16911
16902
  action: "role.revoked",
16912
16903
  actorId: this.userId,
16913
16904
  roleId,
16914
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _395 => _395.label]), () => ( roleId)),
16905
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _397 => _397.label]), () => ( roleId)),
16915
16906
  targetUserId: userProfileId
16916
16907
  });
16917
16908
  }
@@ -17387,7 +17378,7 @@ var ViewService = class extends BaseService {
17387
17378
  dbView.objectName,
17388
17379
  dbView.type,
17389
17380
  objectDefinition,
17390
- dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _396 => _396.config, 'optionalAccess', _397 => _397.layout]), () => ( "page")) : void 0
17381
+ dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _398 => _398.config, 'optionalAccess', _399 => _399.layout]), () => ( "page")) : void 0
17391
17382
  );
17392
17383
  const newConfig = generated.config;
17393
17384
  const updated = await this.adapter.views.update(viewId, { config: newConfig });
@@ -17657,7 +17648,7 @@ function handleViewSyncError(result, view2, error2) {
17657
17648
  result.errors.push({
17658
17649
  viewName: view2.name,
17659
17650
  objectName: view2.object,
17660
- error: error2 instanceof Error ? error2.message : String(error2)
17651
+ error: getErrorMessage(error2)
17661
17652
  });
17662
17653
  }
17663
17654
  async function cleanupOrphanViews(tx, viewsByObjectAndType, result, options) {
@@ -17678,7 +17669,7 @@ function handleTransactionError(result, error2) {
17678
17669
  result.errors.push({
17679
17670
  viewName: "transaction",
17680
17671
  objectName: "",
17681
- error: error2 instanceof Error ? error2.message : String(error2)
17672
+ error: getErrorMessage(error2)
17682
17673
  });
17683
17674
  }
17684
17675
  function logSyncComplete(result, options) {
@@ -17749,7 +17740,7 @@ async function syncNativeObjects(adapter, nativeRegistry, options = {}) {
17749
17740
  result.success = false;
17750
17741
  result.errors.push({
17751
17742
  objectName: nativeObject.name,
17752
- error: error2 instanceof Error ? error2.message : String(error2)
17743
+ error: getErrorMessage(error2)
17753
17744
  });
17754
17745
  }
17755
17746
  }
@@ -17758,7 +17749,7 @@ async function syncNativeObjects(adapter, nativeRegistry, options = {}) {
17758
17749
  result.success = false;
17759
17750
  result.errors.push({
17760
17751
  objectName: "transaction",
17761
- error: error2 instanceof Error ? error2.message : String(error2)
17752
+ error: getErrorMessage(error2)
17762
17753
  });
17763
17754
  }
17764
17755
  if (options.verbose) {
@@ -18271,4 +18262,5 @@ var NoopGeocodingAdapter = class {
18271
18262
 
18272
18263
 
18273
18264
 
18274
- 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.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; 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.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isDocumentNode = isDocumentNode; exports.isEndNode = isEndNode; exports.getNodeOutputs = getNodeOutputs; 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.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; 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.DocumentNodeSchema = DocumentNodeSchema; 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.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.PropertySchemaBuilder = PropertySchemaBuilder; exports.PropertyTypeBuilder = PropertyTypeBuilder; exports.BasePropertyBuilder = BasePropertyBuilder; exports.TextPropertyBuilder = TextPropertyBuilder; exports.TextareaPropertyBuilder = TextareaPropertyBuilder; exports.NumberPropertyBuilder = NumberPropertyBuilder; exports.CheckboxPropertyBuilder = CheckboxPropertyBuilder; exports.DatePropertyBuilder = DatePropertyBuilder; exports.PhonePropertyBuilder = PhonePropertyBuilder; exports.CurrencyPropertyBuilder = CurrencyPropertyBuilder; exports.StatusPropertyBuilder = StatusPropertyBuilder; exports.SelectPropertyBuilder = SelectPropertyBuilder; exports.MultiselectPropertyBuilder = MultiselectPropertyBuilder; exports.RatingPropertyBuilder = RatingPropertyBuilder; exports.LocationPropertyBuilder = LocationPropertyBuilder; exports.validatePropertyType = validatePropertyType; 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.DirectTableTabConfig = DirectTableTabConfig; exports.InverseTableTabConfig = InverseTableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.NotesTabConfig = NotesTabConfig; 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.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.SYSTEM_TEMPLATE_IDS = SYSTEM_TEMPLATE_IDS; exports.FRENCH_ID_CARD = FRENCH_ID_CARD; exports.PASSPORT = PASSPORT; exports.DRIVING_LICENSE = DRIVING_LICENSE; exports.PROOF_OF_ADDRESS = PROOF_OF_ADDRESS; exports.SIGNABLE_CONTRACT = SIGNABLE_CONTRACT; exports.GENERIC_DOCUMENT = GENERIC_DOCUMENT; exports.SYSTEM_TEMPLATES = SYSTEM_TEMPLATES; exports.getSystemTemplate = getSystemTemplate; exports.isSystemTemplate = isSystemTemplate; 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.DocumentExecutor = DocumentExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; 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.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.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.notesPolicy = notesPolicy; 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.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationPropertiesService = RelationPropertiesService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; exports.DocumentRenderError = DocumentRenderError; exports.StorageDownloadNotSupportedError = StorageDownloadNotSupportedError; exports.DocumentRendererService = DocumentRendererService; exports.DocumentProcessingHook = DocumentProcessingHook; 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.DocumentGenerationTemplateNotFoundError = DocumentGenerationTemplateNotFoundError; exports.DocumentGenerationNotConfiguredError = DocumentGenerationNotConfiguredError; exports.DocumentGenerationService = DocumentGenerationService; exports.DocumentTemplateService = DocumentTemplateService; 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;
18265
+
18266
+ 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.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.getErrorMessage = getErrorMessage; 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.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isDocumentNode = isDocumentNode; exports.isEndNode = isEndNode; exports.getNodeOutputs = getNodeOutputs; 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.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; 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.DocumentNodeSchema = DocumentNodeSchema; 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.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.PropertySchemaBuilder = PropertySchemaBuilder; exports.PropertyTypeBuilder = PropertyTypeBuilder; exports.BasePropertyBuilder = BasePropertyBuilder; exports.TextPropertyBuilder = TextPropertyBuilder; exports.TextareaPropertyBuilder = TextareaPropertyBuilder; exports.NumberPropertyBuilder = NumberPropertyBuilder; exports.CheckboxPropertyBuilder = CheckboxPropertyBuilder; exports.DatePropertyBuilder = DatePropertyBuilder; exports.PhonePropertyBuilder = PhonePropertyBuilder; exports.CurrencyPropertyBuilder = CurrencyPropertyBuilder; exports.StatusPropertyBuilder = StatusPropertyBuilder; exports.SelectPropertyBuilder = SelectPropertyBuilder; exports.MultiselectPropertyBuilder = MultiselectPropertyBuilder; exports.RatingPropertyBuilder = RatingPropertyBuilder; exports.LocationPropertyBuilder = LocationPropertyBuilder; exports.validatePropertyType = validatePropertyType; 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.DirectTableTabConfig = DirectTableTabConfig; exports.InverseTableTabConfig = InverseTableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.NotesTabConfig = NotesTabConfig; 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.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.SYSTEM_TEMPLATE_IDS = SYSTEM_TEMPLATE_IDS; exports.FRENCH_ID_CARD = FRENCH_ID_CARD; exports.PASSPORT = PASSPORT; exports.DRIVING_LICENSE = DRIVING_LICENSE; exports.PROOF_OF_ADDRESS = PROOF_OF_ADDRESS; exports.SIGNABLE_CONTRACT = SIGNABLE_CONTRACT; exports.GENERIC_DOCUMENT = GENERIC_DOCUMENT; exports.SYSTEM_TEMPLATES = SYSTEM_TEMPLATES; exports.getSystemTemplate = getSystemTemplate; exports.isSystemTemplate = isSystemTemplate; 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.DocumentExecutor = DocumentExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; 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.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.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.notesPolicy = notesPolicy; 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.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationPropertiesService = RelationPropertiesService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; exports.DocumentRenderError = DocumentRenderError; exports.StorageDownloadNotSupportedError = StorageDownloadNotSupportedError; exports.DocumentRendererService = DocumentRendererService; exports.DocumentProcessingHook = DocumentProcessingHook; 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.DocumentGenerationTemplateNotFoundError = DocumentGenerationTemplateNotFoundError; exports.DocumentGenerationNotConfiguredError = DocumentGenerationNotConfiguredError; exports.DocumentGenerationService = DocumentGenerationService; exports.DocumentTemplateService = DocumentTemplateService; 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;