@stndrds/schema 0.1.0-alpha.58 → 0.1.0-alpha.60

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
  // -------------------------------------------------------------------------
@@ -3949,7 +3949,6 @@ function createMockObjectRecordsRepository(stores) {
3949
3949
  objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _84 => _84.label]), () => ( "Unknown")),
3950
3950
  label: renderLabelExpression(labelExpression, enrichedValues),
3951
3951
  recordId: r.id,
3952
- values: r.values,
3953
3952
  completionStatus: r.completionStatus,
3954
3953
  createdAt: r.createdAt,
3955
3954
  updatedAt: r.updatedAt
@@ -3957,6 +3956,36 @@ function createMockObjectRecordsRepository(stores) {
3957
3956
  });
3958
3957
  return Promise.resolve({ results, total });
3959
3958
  },
3959
+ globalSearchGrouped(query, options) {
3960
+ const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _85 => _85.limitPerGroup]), () => ( 5));
3961
+ return this.globalSearch(query, {
3962
+ objectNames: _optionalChain([options, 'optionalAccess', _86 => _86.objectNames]),
3963
+ limit: 500,
3964
+ offset: 0
3965
+ }).then(({ results }) => {
3966
+ const groupMap = /* @__PURE__ */ new Map();
3967
+ for (const result of results) {
3968
+ let group2 = groupMap.get(result.objectName);
3969
+ if (!group2) {
3970
+ group2 = {
3971
+ objectName: result.objectName,
3972
+ objectLabel: result.objectLabel,
3973
+ results: [],
3974
+ totalInGroup: 0
3975
+ };
3976
+ groupMap.set(result.objectName, group2);
3977
+ }
3978
+ group2.totalInGroup++;
3979
+ if (group2.results.length < limitPerGroup) {
3980
+ group2.results.push(result);
3981
+ }
3982
+ }
3983
+ const groups = Array.from(groupMap.values());
3984
+ groups.sort((a, b) => b.totalInGroup - a.totalInGroup);
3985
+ const total = groups.reduce((sum, g) => sum + g.totalInGroup, 0);
3986
+ return { groups, total };
3987
+ });
3988
+ },
3960
3989
  // -------------------------------------------------------------------------
3961
3990
  // Schema Integrity Methods
3962
3991
  // -------------------------------------------------------------------------
@@ -4059,6 +4088,91 @@ function createMockObjectRecordsRepository(stores) {
4059
4088
  };
4060
4089
  }
4061
4090
 
4091
+ // src/runtime/mock/mock-relation-attributes.ts
4092
+ var _crypto = require('crypto');
4093
+ function createMockRelationAttributesRepository(stores) {
4094
+ return {
4095
+ async upsertBatch(items) {
4096
+ const context = getContext2();
4097
+ if (!context) {
4098
+ throw new Error("Context required for relationAttributes operations");
4099
+ }
4100
+ const results = [];
4101
+ for (const item of items) {
4102
+ const _key = `${context.tenantId}:${item.fromObject}:${item.fromId}:${item.fromAttribute}:${item.toId}`;
4103
+ const existing = Array.from(stores.relationAttributes.values()).find(
4104
+ (row) => row.tenantId === context.tenantId && row.fromObject === item.fromObject && row.fromId === item.fromId && row.fromAttribute === item.fromAttribute && row.toId === item.toId
4105
+ );
4106
+ if (existing) {
4107
+ existing.properties = _nullishCoalesce(item.properties, () => ( {}));
4108
+ existing.updatedAt = /* @__PURE__ */ new Date();
4109
+ existing.updatedBy = _nullishCoalesce(_nullishCoalesce(item.updatedBy, () => ( context.userId)), () => ( null));
4110
+ results.push(existing);
4111
+ } else {
4112
+ const row = {
4113
+ id: _crypto.randomUUID.call(void 0, ),
4114
+ tenantId: context.tenantId,
4115
+ fromObject: item.fromObject,
4116
+ fromId: item.fromId,
4117
+ fromAttribute: item.fromAttribute,
4118
+ toId: item.toId,
4119
+ properties: _nullishCoalesce(item.properties, () => ( {})),
4120
+ createdAt: /* @__PURE__ */ new Date(),
4121
+ updatedAt: /* @__PURE__ */ new Date(),
4122
+ createdBy: _nullishCoalesce(_nullishCoalesce(item.createdBy, () => ( context.userId)), () => ( null)),
4123
+ updatedBy: _nullishCoalesce(_nullishCoalesce(item.updatedBy, () => ( context.userId)), () => ( null))
4124
+ };
4125
+ stores.relationAttributes.set(row.id, row);
4126
+ results.push(row);
4127
+ }
4128
+ }
4129
+ return results;
4130
+ },
4131
+ async findBySource(fromObject, fromId, fromAttribute) {
4132
+ const context = getContext2();
4133
+ if (!context) {
4134
+ throw new Error("Context required for relationAttributes operations");
4135
+ }
4136
+ return Array.from(stores.relationAttributes.values()).filter(
4137
+ (row) => row.tenantId === context.tenantId && row.fromObject === fromObject && row.fromId === fromId && row.fromAttribute === fromAttribute
4138
+ );
4139
+ },
4140
+ async findByTarget(toId) {
4141
+ const context = getContext2();
4142
+ if (!context) {
4143
+ throw new Error("Context required for relationAttributes operations");
4144
+ }
4145
+ return Array.from(stores.relationAttributes.values()).filter(
4146
+ (row) => row.tenantId === context.tenantId && row.toId === toId
4147
+ );
4148
+ },
4149
+ async deleteBySource(fromObject, fromId, fromAttribute) {
4150
+ const context = getContext2();
4151
+ if (!context) {
4152
+ throw new Error("Context required for relationAttributes operations");
4153
+ }
4154
+ const toDelete = Array.from(stores.relationAttributes.entries()).filter(
4155
+ ([_id, row]) => row.tenantId === context.tenantId && row.fromObject === fromObject && row.fromId === fromId && row.fromAttribute === fromAttribute
4156
+ );
4157
+ for (const [id] of toDelete) {
4158
+ stores.relationAttributes.delete(id);
4159
+ }
4160
+ },
4161
+ async deleteByTarget(toId) {
4162
+ const context = getContext2();
4163
+ if (!context) {
4164
+ throw new Error("Context required for relationAttributes operations");
4165
+ }
4166
+ const toDelete = Array.from(stores.relationAttributes.entries()).filter(
4167
+ ([_id, row]) => row.tenantId === context.tenantId && row.toId === toId
4168
+ );
4169
+ for (const [id] of toDelete) {
4170
+ stores.relationAttributes.delete(id);
4171
+ }
4172
+ }
4173
+ };
4174
+ }
4175
+
4062
4176
  // src/runtime/mock/mock-stores.ts
4063
4177
  function createEmptyStores() {
4064
4178
  return {
@@ -4079,7 +4193,8 @@ function createEmptyStores() {
4079
4193
  aiConversations: /* @__PURE__ */ new Map(),
4080
4194
  aiMessages: /* @__PURE__ */ new Map(),
4081
4195
  aiUserMemory: /* @__PURE__ */ new Map(),
4082
- aiUsageMetrics: /* @__PURE__ */ new Map()
4196
+ aiUsageMetrics: /* @__PURE__ */ new Map(),
4197
+ relationAttributes: /* @__PURE__ */ new Map()
4083
4198
  };
4084
4199
  }
4085
4200
 
@@ -4155,7 +4270,7 @@ function createMockUserProfilesRepository(stores) {
4155
4270
  list(options) {
4156
4271
  const tenantId = getTenantId();
4157
4272
  let results = Array.from(stores.userProfiles.values()).filter((p) => p.tenantId === tenantId);
4158
- if (_optionalChain([options, 'optionalAccess', _85 => _85.limit])) {
4273
+ if (_optionalChain([options, 'optionalAccess', _87 => _87.limit])) {
4159
4274
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4160
4275
  }
4161
4276
  return Promise.resolve(results);
@@ -4243,7 +4358,7 @@ function createMockPermissionsRepository(stores) {
4243
4358
  },
4244
4359
  deleteRole(roleId) {
4245
4360
  const role = stores.roles.get(roleId);
4246
- if (_optionalChain([role, 'optionalAccess', _86 => _86.system])) {
4361
+ if (_optionalChain([role, 'optionalAccess', _88 => _88.system])) {
4247
4362
  return Promise.reject(new Error(`Cannot delete system role ${roleId}`));
4248
4363
  }
4249
4364
  stores.roles.delete(roleId);
@@ -4732,7 +4847,7 @@ function createMockWorkflowInstancesRepository(stores) {
4732
4847
  (i) => i.tenant_id === tenantId
4733
4848
  );
4734
4849
  const total = results.length;
4735
- if (_optionalChain([options, 'optionalAccess', _87 => _87.limit])) {
4850
+ if (_optionalChain([options, 'optionalAccess', _89 => _89.limit])) {
4736
4851
  results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
4737
4852
  }
4738
4853
  return Promise.resolve({ instances: results, total });
@@ -4760,7 +4875,7 @@ function createMockWorkflowInstancesRepository(stores) {
4760
4875
  pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
4761
4876
  error: null,
4762
4877
  started_by: data.startedBy,
4763
- expires_at: _nullishCoalesce(_optionalChain([data, 'access', _88 => _88.expiresAt, 'optionalAccess', _89 => _89.toISOString, 'call', _90 => _90()]), () => ( null)),
4878
+ expires_at: _nullishCoalesce(_optionalChain([data, 'access', _90 => _90.expiresAt, 'optionalAccess', _91 => _91.toISOString, 'call', _92 => _92()]), () => ( null)),
4764
4879
  created_at: now,
4765
4880
  updated_at: now,
4766
4881
  completed_at: null
@@ -4781,8 +4896,8 @@ function createMockWorkflowInstancesRepository(stores) {
4781
4896
  history: _nullishCoalesce(data.history, () => ( existing.history)),
4782
4897
  pending_action: data.pendingAction !== void 0 ? data.pendingAction : existing.pending_action,
4783
4898
  error: data.error !== void 0 ? data.error : existing.error,
4784
- expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _91 => _91.expiresAt, 'optionalAccess', _92 => _92.toISOString, 'call', _93 => _93()]), () => ( null)) : existing.expires_at,
4785
- completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _94 => _94.completedAt, 'optionalAccess', _95 => _95.toISOString, 'call', _96 => _96()]), () => ( null)) : existing.completed_at,
4899
+ expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _93 => _93.expiresAt, 'optionalAccess', _94 => _94.toISOString, 'call', _95 => _95()]), () => ( null)) : existing.expires_at,
4900
+ completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _96 => _96.completedAt, 'optionalAccess', _97 => _97.toISOString, 'call', _98 => _98()]), () => ( null)) : existing.completed_at,
4786
4901
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
4787
4902
  };
4788
4903
  stores.workflowInstances.set(id, updated);
@@ -4815,7 +4930,7 @@ function createMockWorkflowInstancesRepository(stores) {
4815
4930
  pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
4816
4931
  error: null,
4817
4932
  started_by: data.startedBy,
4818
- expires_at: _nullishCoalesce(_optionalChain([data, 'access', _97 => _97.expiresAt, 'optionalAccess', _98 => _98.toISOString, 'call', _99 => _99()]), () => ( null)),
4933
+ expires_at: _nullishCoalesce(_optionalChain([data, 'access', _99 => _99.expiresAt, 'optionalAccess', _100 => _100.toISOString, 'call', _101 => _101()]), () => ( null)),
4819
4934
  created_at: now,
4820
4935
  updated_at: now,
4821
4936
  completed_at: null
@@ -4838,13 +4953,13 @@ function createMockWorkflowInstancesRepository(stores) {
4838
4953
  return slotData.id === recordId;
4839
4954
  });
4840
4955
  });
4841
- if (_optionalChain([options, 'optionalAccess', _100 => _100.status])) {
4956
+ if (_optionalChain([options, 'optionalAccess', _102 => _102.status])) {
4842
4957
  results = results.filter((i) => i.status === options.status);
4843
4958
  }
4844
4959
  const total = results.length;
4845
- if (_optionalChain([options, 'optionalAccess', _101 => _101.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _102 => _102.limit]) !== void 0) {
4846
- const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _103 => _103.offset]), () => ( 0));
4847
- const end = _optionalChain([options, 'optionalAccess', _104 => _104.limit]) ? start + options.limit : void 0;
4960
+ if (_optionalChain([options, 'optionalAccess', _103 => _103.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _104 => _104.limit]) !== void 0) {
4961
+ const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _105 => _105.offset]), () => ( 0));
4962
+ const end = _optionalChain([options, 'optionalAccess', _106 => _106.limit]) ? start + options.limit : void 0;
4848
4963
  results = results.slice(start, end);
4849
4964
  }
4850
4965
  return Promise.resolve({ instances: results, total });
@@ -4900,7 +5015,7 @@ function createMockWorkflowInvitationsRepository(stores) {
4900
5015
  const updated = {
4901
5016
  ...existing,
4902
5017
  status: _nullishCoalesce(data.status, () => ( existing.status)),
4903
- accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _105 => _105.acceptedAt, 'optionalAccess', _106 => _106.toISOString, 'call', _107 => _107()]), () => ( null)) : existing.accepted_at,
5018
+ accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _107 => _107.acceptedAt, 'optionalAccess', _108 => _108.toISOString, 'call', _109 => _109()]), () => ( null)) : existing.accepted_at,
4904
5019
  expires_at: data.expiresAt !== void 0 ? data.expiresAt.toISOString() : existing.expires_at
4905
5020
  };
4906
5021
  stores.workflowInvitations.set(id, updated);
@@ -4966,7 +5081,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
4966
5081
  ...existing,
4967
5082
  last_used_at: data.lastUsedAt !== void 0 ? data.lastUsedAt.toISOString() : existing.last_used_at,
4968
5083
  revoked_token_jtis: _nullishCoalesce(data.revokedTokenJtis, () => ( existing.revoked_token_jtis)),
4969
- revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _108 => _108.revokedAt, 'optionalAccess', _109 => _109.toISOString, 'call', _110 => _110()]), () => ( null)) : existing.revoked_at
5084
+ revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _110 => _110.revokedAt, 'optionalAccess', _111 => _111.toISOString, 'call', _112 => _112()]), () => ( null)) : existing.revoked_at
4970
5085
  };
4971
5086
  stores.workflowAccessGrants.set(id, updated);
4972
5087
  return Promise.resolve(updated);
@@ -4994,6 +5109,8 @@ function createMockAdapter() {
4994
5109
  aiConversations: createMockAIConversationsRepository(stores),
4995
5110
  aiUserMemory: createMockAIUserMemoryRepository(stores),
4996
5111
  aiUsageMetrics: createMockAIUsageMetricsRepository(stores),
5112
+ // Relation attributes repository
5113
+ relationAttributes: createMockRelationAttributesRepository(stores),
4997
5114
  async transaction(callback) {
4998
5115
  return await callback(adapter);
4999
5116
  },
@@ -5019,6 +5136,7 @@ function createMockAdapter() {
5019
5136
  stores.aiMessages.clear();
5020
5137
  stores.aiUserMemory.clear();
5021
5138
  stores.aiUsageMetrics.clear();
5139
+ stores.relationAttributes.clear();
5022
5140
  }
5023
5141
  };
5024
5142
  return adapter;
@@ -5112,7 +5230,7 @@ var notesPolicy = {
5112
5230
  { attribute: "visibility", operator: "is", value: "shared" },
5113
5231
  { attribute: "createdBy", operator: "is", value: ctx.userId }
5114
5232
  ];
5115
- if (!_optionalChain([options, 'optionalAccess', _111 => _111.filters]) || options.filters.rules.length === 0) {
5233
+ if (!_optionalChain([options, 'optionalAccess', _113 => _113.filters]) || options.filters.rules.length === 0) {
5116
5234
  return {
5117
5235
  ...options,
5118
5236
  filters: { combinator: "or", rules: visibilityRules }
@@ -5258,7 +5376,7 @@ var BaseService = class {
5258
5376
  * @param key - Cache key to invalidate
5259
5377
  */
5260
5378
  async invalidateCache(key) {
5261
- await _optionalChain([this, 'access', _112 => _112.cache, 'optionalAccess', _113 => _113.delete, 'call', _114 => _114(key)]);
5379
+ await _optionalChain([this, 'access', _114 => _114.cache, 'optionalAccess', _115 => _115.delete, 'call', _116 => _116(key)]);
5262
5380
  }
5263
5381
  /**
5264
5382
  * Invalidate all cache keys matching a pattern.
@@ -5266,7 +5384,7 @@ var BaseService = class {
5266
5384
  * @param pattern - Glob-style pattern (e.g., "schema:tenant-123:*")
5267
5385
  */
5268
5386
  async invalidateCachePattern(pattern) {
5269
- await _optionalChain([this, 'access', _115 => _115.cache, 'optionalAccess', _116 => _116.deletePattern, 'call', _117 => _117(pattern)]);
5387
+ await _optionalChain([this, 'access', _117 => _117.cache, 'optionalAccess', _118 => _118.deletePattern, 'call', _119 => _119(pattern)]);
5270
5388
  }
5271
5389
  /**
5272
5390
  * Invalidate all cached lists for a resource.
@@ -5464,17 +5582,17 @@ function validateOptions(options, attributeName) {
5464
5582
  const ids = /* @__PURE__ */ new Set();
5465
5583
  const values = /* @__PURE__ */ new Set();
5466
5584
  for (const option of options) {
5467
- if (!_optionalChain([option, 'access', _118 => _118.id, 'optionalAccess', _119 => _119.trim, 'call', _120 => _120()])) {
5585
+ if (!_optionalChain([option, 'access', _120 => _120.id, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()])) {
5468
5586
  throw new Error(
5469
5587
  `[AttributeBuilder] Option in "${attributeName}" has an empty or missing id.`
5470
5588
  );
5471
5589
  }
5472
- if (!_optionalChain([option, 'access', _121 => _121.value, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()])) {
5590
+ if (!_optionalChain([option, 'access', _123 => _123.value, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()])) {
5473
5591
  throw new Error(
5474
5592
  `[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing value.`
5475
5593
  );
5476
5594
  }
5477
- if (!_optionalChain([option, 'access', _124 => _124.label, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()])) {
5595
+ if (!_optionalChain([option, 'access', _126 => _126.label, 'optionalAccess', _127 => _127.trim, 'call', _128 => _128()])) {
5478
5596
  throw new Error(
5479
5597
  `[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing label.`
5480
5598
  );
@@ -5497,6 +5615,292 @@ function validateOptions(options, attributeName) {
5497
5615
  }
5498
5616
  }
5499
5617
 
5618
+ // src/types/relation-properties.ts
5619
+ var FORBIDDEN_PROPERTY_TYPES = [
5620
+ "formula",
5621
+ "rollup",
5622
+ "relation",
5623
+ "file",
5624
+ "user",
5625
+ "document",
5626
+ "richtext"
5627
+ ];
5628
+
5629
+ // src/builders/property-schema-builder.ts
5630
+ var PropertySchemaBuilder = class {
5631
+ constructor() {
5632
+ this.definitions = [];
5633
+ }
5634
+ /**
5635
+ * Add a property to the schema
5636
+ * The type of property is automatically detected based on the builder methods used
5637
+ */
5638
+ add(name, configure) {
5639
+ const builder = new PropertyTypeBuilder(name);
5640
+ const configured = configure(builder);
5641
+ const definition = configured.build();
5642
+ this.definitions.push(definition);
5643
+ return this;
5644
+ }
5645
+ /**
5646
+ * Build the final PropertySchema
5647
+ */
5648
+ build() {
5649
+ return {
5650
+ definitions: this.definitions
5651
+ };
5652
+ }
5653
+ };
5654
+ var PropertyTypeBuilder = class {
5655
+ constructor(name) {
5656
+ this.name = name;
5657
+ }
5658
+ // Explicit type constructors
5659
+ text() {
5660
+ return new TextPropertyBuilder(this.name);
5661
+ }
5662
+ textarea() {
5663
+ return new TextareaPropertyBuilder(this.name);
5664
+ }
5665
+ number() {
5666
+ return new NumberPropertyBuilder(this.name);
5667
+ }
5668
+ checkbox() {
5669
+ return new CheckboxPropertyBuilder(this.name);
5670
+ }
5671
+ date() {
5672
+ return new DatePropertyBuilder(this.name);
5673
+ }
5674
+ phone() {
5675
+ return new PhonePropertyBuilder(this.name);
5676
+ }
5677
+ currency() {
5678
+ return new CurrencyPropertyBuilder(this.name);
5679
+ }
5680
+ status() {
5681
+ return new StatusPropertyBuilder(this.name);
5682
+ }
5683
+ select() {
5684
+ return new SelectPropertyBuilder(this.name);
5685
+ }
5686
+ multiselect() {
5687
+ return new MultiselectPropertyBuilder(this.name);
5688
+ }
5689
+ rating() {
5690
+ return new RatingPropertyBuilder(this.name);
5691
+ }
5692
+ location() {
5693
+ return new LocationPropertyBuilder(this.name);
5694
+ }
5695
+ };
5696
+ var BasePropertyBuilder = class {
5697
+ constructor(name) {
5698
+ this.definition = { name };
5699
+ }
5700
+ /**
5701
+ * Set the label
5702
+ */
5703
+ label(label) {
5704
+ this.definition.label = label;
5705
+ return this;
5706
+ }
5707
+ /**
5708
+ * Mark as required
5709
+ */
5710
+ required() {
5711
+ this.definition.required = true;
5712
+ return this;
5713
+ }
5714
+ /**
5715
+ * Set description
5716
+ */
5717
+ description(description) {
5718
+ this.definition.description = description;
5719
+ return this;
5720
+ }
5721
+ /**
5722
+ * Build the final definition
5723
+ */
5724
+ build() {
5725
+ return this.definition;
5726
+ }
5727
+ };
5728
+ var TextPropertyBuilder = class extends BasePropertyBuilder {
5729
+ constructor(name) {
5730
+ super(name);
5731
+ this.definition.type = "text";
5732
+ }
5733
+ minLength(value) {
5734
+ this.definition.minLength = value;
5735
+ return this;
5736
+ }
5737
+ maxLength(value) {
5738
+ this.definition.maxLength = value;
5739
+ return this;
5740
+ }
5741
+ pattern(pattern) {
5742
+ this.definition.pattern = pattern;
5743
+ return this;
5744
+ }
5745
+ placeholder(value) {
5746
+ this.definition.placeholder = value;
5747
+ return this;
5748
+ }
5749
+ };
5750
+ var TextareaPropertyBuilder = class extends BasePropertyBuilder {
5751
+ constructor(name) {
5752
+ super(name);
5753
+ this.definition.type = "textarea";
5754
+ }
5755
+ minLength(value) {
5756
+ this.definition.minLength = value;
5757
+ return this;
5758
+ }
5759
+ maxLength(value) {
5760
+ this.definition.maxLength = value;
5761
+ return this;
5762
+ }
5763
+ placeholder(value) {
5764
+ this.definition.placeholder = value;
5765
+ return this;
5766
+ }
5767
+ };
5768
+ var NumberPropertyBuilder = class extends BasePropertyBuilder {
5769
+ constructor(name) {
5770
+ super(name);
5771
+ this.definition.type = "number";
5772
+ }
5773
+ min(value) {
5774
+ this.definition.min = value;
5775
+ return this;
5776
+ }
5777
+ max(value) {
5778
+ this.definition.max = value;
5779
+ return this;
5780
+ }
5781
+ decimal(places) {
5782
+ this.definition.decimal = places;
5783
+ return this;
5784
+ }
5785
+ integer() {
5786
+ this.definition.integer = true;
5787
+ return this;
5788
+ }
5789
+ placeholder(value) {
5790
+ this.definition.placeholder = value;
5791
+ return this;
5792
+ }
5793
+ };
5794
+ var CheckboxPropertyBuilder = class extends BasePropertyBuilder {
5795
+ constructor(name) {
5796
+ super(name);
5797
+ this.definition.type = "checkbox";
5798
+ }
5799
+ };
5800
+ var DatePropertyBuilder = class extends BasePropertyBuilder {
5801
+ constructor(name) {
5802
+ super(name);
5803
+ this.definition.type = "date";
5804
+ }
5805
+ includeTime() {
5806
+ this.definition.includeTime = true;
5807
+ return this;
5808
+ }
5809
+ min(date2) {
5810
+ this.definition.min = date2;
5811
+ return this;
5812
+ }
5813
+ max(date2) {
5814
+ this.definition.max = date2;
5815
+ return this;
5816
+ }
5817
+ };
5818
+ var PhonePropertyBuilder = class extends BasePropertyBuilder {
5819
+ constructor(name) {
5820
+ super(name);
5821
+ this.definition.type = "phone";
5822
+ }
5823
+ };
5824
+ var CurrencyPropertyBuilder = class extends BasePropertyBuilder {
5825
+ constructor(name) {
5826
+ super(name);
5827
+ this.definition.type = "currency";
5828
+ }
5829
+ currency(code) {
5830
+ this.definition.currency = code;
5831
+ return this;
5832
+ }
5833
+ min(value) {
5834
+ this.definition.min = value;
5835
+ return this;
5836
+ }
5837
+ max(value) {
5838
+ this.definition.max = value;
5839
+ return this;
5840
+ }
5841
+ };
5842
+ var StatusPropertyBuilder = class extends BasePropertyBuilder {
5843
+ constructor(name) {
5844
+ super(name);
5845
+ this.definition.type = "status";
5846
+ }
5847
+ options(options) {
5848
+ this.definition.options = options;
5849
+ return this;
5850
+ }
5851
+ };
5852
+ var SelectPropertyBuilder = class extends BasePropertyBuilder {
5853
+ constructor(name) {
5854
+ super(name);
5855
+ this.definition.type = "select";
5856
+ }
5857
+ options(options) {
5858
+ this.definition.options = options;
5859
+ return this;
5860
+ }
5861
+ };
5862
+ var MultiselectPropertyBuilder = class extends BasePropertyBuilder {
5863
+ constructor(name) {
5864
+ super(name);
5865
+ this.definition.type = "multiselect";
5866
+ }
5867
+ options(options) {
5868
+ this.definition.options = options;
5869
+ return this;
5870
+ }
5871
+ maxSelections(value) {
5872
+ this.definition.maxSelections = value;
5873
+ return this;
5874
+ }
5875
+ };
5876
+ var RatingPropertyBuilder = class extends BasePropertyBuilder {
5877
+ constructor(name) {
5878
+ super(name);
5879
+ this.definition.type = "rating";
5880
+ }
5881
+ max(value) {
5882
+ this.definition.max = value;
5883
+ return this;
5884
+ }
5885
+ icon(icon) {
5886
+ this.definition.icon = icon;
5887
+ return this;
5888
+ }
5889
+ };
5890
+ var LocationPropertyBuilder = class extends BasePropertyBuilder {
5891
+ constructor(name) {
5892
+ super(name);
5893
+ this.definition.type = "location";
5894
+ }
5895
+ };
5896
+ function validatePropertyType(type) {
5897
+ if (FORBIDDEN_PROPERTY_TYPES.includes(type)) {
5898
+ throw new Error(
5899
+ `Property type "${type}" is not supported in .qualifyWith(). Only simple types (text, number, date, select, etc.) are allowed. Complex types (formula, rollup, relation, file, user, document) would require duplicating backend behavior.`
5900
+ );
5901
+ }
5902
+ }
5903
+
5500
5904
  // src/builders/attribute-builders.ts
5501
5905
  var BaseAttributeBuilder = class {
5502
5906
  constructor(type, name, label) {
@@ -5572,8 +5976,8 @@ var BaseAttributeBuilder = class {
5572
5976
  featureGate(flagName, options) {
5573
5977
  this.attr.featureGate = {
5574
5978
  flag: flagName,
5575
- expectedValue: _optionalChain([options, 'optionalAccess', _127 => _127.expectedValue]),
5576
- fallback: _optionalChain([options, 'optionalAccess', _128 => _128.fallback])
5979
+ expectedValue: _optionalChain([options, 'optionalAccess', _129 => _129.expectedValue]),
5980
+ fallback: _optionalChain([options, 'optionalAccess', _130 => _130.fallback])
5577
5981
  };
5578
5982
  return this;
5579
5983
  }
@@ -6021,7 +6425,7 @@ var SingleRelationAttributeBuilder = class extends BaseAttributeBuilder {
6021
6425
  object: objectName,
6022
6426
  ...options
6023
6427
  };
6024
- _optionalChain([this, 'access', _129 => _129.attr, 'access', _130 => _130.targets, 'optionalAccess', _131 => _131.push, 'call', _132 => _132(target)]);
6428
+ _optionalChain([this, 'access', _131 => _131.attr, 'access', _132 => _132.targets, 'optionalAccess', _133 => _133.push, 'call', _134 => _134(target)]);
6025
6429
  return this;
6026
6430
  }
6027
6431
  /**
@@ -6053,6 +6457,32 @@ var SingleRelationAttributeBuilder = class extends BaseAttributeBuilder {
6053
6457
  );
6054
6458
  return multiBuilder;
6055
6459
  }
6460
+ /**
6461
+ * Add properties to qualify the relation
6462
+ * Must be called AFTER .to() to ensure targets are defined
6463
+ *
6464
+ * @example
6465
+ * ```typescript
6466
+ * relation({ name: "mainCompany", label: "Main Company" })
6467
+ * .to("companies")
6468
+ * .qualifyWith(props => props
6469
+ * .add("role", select => select.options([...]).required())
6470
+ * .add("shares", number => number.min(0))
6471
+ * )
6472
+ * ```
6473
+ */
6474
+ qualifyWith(configure) {
6475
+ const targets = this.attr.targets;
6476
+ if (!targets || targets.length === 0) {
6477
+ throw new Error(
6478
+ '.qualifyWith() must be called AFTER .to(). Example: relation({ name: "mainCompany" }).to("companies").qualifyWith(...)'
6479
+ );
6480
+ }
6481
+ const builder = new PropertySchemaBuilder();
6482
+ const schema = configure(builder).build();
6483
+ this.attr.properties = schema;
6484
+ return this;
6485
+ }
6056
6486
  required() {
6057
6487
  this.setRequired(true);
6058
6488
  return this;
@@ -6066,9 +6496,9 @@ var MultiRelationAttributeBuilder = class extends BaseAttributeBuilder {
6066
6496
  constructor(name, label, initOptions) {
6067
6497
  super("relation", name, label);
6068
6498
  this.attr.cardinality = "many";
6069
- this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _133 => _133.targets]), () => ( []));
6499
+ this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _135 => _135.targets]), () => ( []));
6070
6500
  this.attr.defaultValue = [];
6071
- if (_optionalChain([initOptions, 'optionalAccess', _134 => _134.isRequired])) {
6501
+ if (_optionalChain([initOptions, 'optionalAccess', _136 => _136.isRequired])) {
6072
6502
  this.setRequired(true);
6073
6503
  }
6074
6504
  }
@@ -6082,7 +6512,7 @@ var MultiRelationAttributeBuilder = class extends BaseAttributeBuilder {
6082
6512
  object: objectName,
6083
6513
  ...options
6084
6514
  };
6085
- _optionalChain([this, 'access', _135 => _135.attr, 'access', _136 => _136.targets, 'optionalAccess', _137 => _137.push, 'call', _138 => _138(target)]);
6515
+ _optionalChain([this, 'access', _137 => _137.attr, 'access', _138 => _138.targets, 'optionalAccess', _139 => _139.push, 'call', _140 => _140(target)]);
6086
6516
  return this;
6087
6517
  }
6088
6518
  /**
@@ -6114,6 +6544,33 @@ var MultiRelationAttributeBuilder = class extends BaseAttributeBuilder {
6114
6544
  this.attr.maxItems = count;
6115
6545
  return this;
6116
6546
  }
6547
+ /**
6548
+ * Add properties to qualify the relation
6549
+ * Must be called AFTER .to() or .many() to ensure targets are defined
6550
+ *
6551
+ * @example
6552
+ * ```typescript
6553
+ * relation({ name: "companies", label: "Companies" })
6554
+ * .to("companies")
6555
+ * .many()
6556
+ * .qualifyWith(props => props
6557
+ * .add("role", select => select.options([...]).required())
6558
+ * .add("shares", number => number.min(0))
6559
+ * )
6560
+ * ```
6561
+ */
6562
+ qualifyWith(configure) {
6563
+ const targets = this.attr.targets;
6564
+ if (!targets || targets.length === 0) {
6565
+ throw new Error(
6566
+ '.qualifyWith() must be called AFTER .to() or .many(). Example: relation({ name: "companies" }).to("companies").many().qualifyWith(...)'
6567
+ );
6568
+ }
6569
+ const builder = new PropertySchemaBuilder();
6570
+ const schema = configure(builder).build();
6571
+ this.attr.properties = schema;
6572
+ return this;
6573
+ }
6117
6574
  required() {
6118
6575
  this.setRequired(true);
6119
6576
  return this;
@@ -6499,7 +6956,7 @@ function object(config) {
6499
6956
  }
6500
6957
 
6501
6958
  // src/builders/view-builder.ts
6502
- var _crypto = require('crypto');
6959
+
6503
6960
 
6504
6961
  var GroupBuilder = class {
6505
6962
  constructor(id, label) {
@@ -6536,7 +6993,7 @@ var GroupBuilder = class {
6536
6993
  */
6537
6994
  fields(...names) {
6538
6995
  for (const name of names) {
6539
- _optionalChain([this, 'access', _139 => _139.data, 'access', _140 => _140.fields, 'optionalAccess', _141 => _141.push, 'call', _142 => _142({ attribute: name })]);
6996
+ _optionalChain([this, 'access', _141 => _141.data, 'access', _142 => _142.fields, 'optionalAccess', _143 => _143.push, 'call', _144 => _144({ attribute: name })]);
6540
6997
  }
6541
6998
  return this;
6542
6999
  }
@@ -6545,7 +7002,7 @@ var GroupBuilder = class {
6545
7002
  * @example .field("name", { span: 8, readOnly: true })
6546
7003
  */
6547
7004
  field(attribute, options) {
6548
- _optionalChain([this, 'access', _143 => _143.data, 'access', _144 => _144.fields, 'optionalAccess', _145 => _145.push, 'call', _146 => _146({ attribute, ...options })]);
7005
+ _optionalChain([this, 'access', _145 => _145.data, 'access', _146 => _146.fields, 'optionalAccess', _147 => _147.push, 'call', _148 => _148({ attribute, ...options })]);
6549
7006
  return this;
6550
7007
  }
6551
7008
  /**
@@ -6554,7 +7011,7 @@ var GroupBuilder = class {
6554
7011
  * @example .attributeGroup({ id: "address", label: "Address", attributes: ["street", "city", "postal_code"], displayTemplate: "{street}, {city}" })
6555
7012
  */
6556
7013
  attributeGroup(config, options) {
6557
- _optionalChain([this, 'access', _147 => _147.data, 'access', _148 => _148.fields, 'optionalAccess', _149 => _149.push, 'call', _150 => _150({ attributeGroup: config, ...options })]);
7014
+ _optionalChain([this, 'access', _149 => _149.data, 'access', _150 => _150.fields, 'optionalAccess', _151 => _151.push, 'call', _152 => _152({ attributeGroup: config, ...options })]);
6558
7015
  return this;
6559
7016
  }
6560
7017
  /**
@@ -7486,8 +7943,8 @@ var WorkflowFormRowBuilder = class {
7486
7943
  id: `${this.rowData.id}-${slotId}-${attribute}`,
7487
7944
  slotId,
7488
7945
  attribute,
7489
- label: _optionalChain([options, 'optionalAccess', _151 => _151.label]),
7490
- required: _optionalChain([options, 'optionalAccess', _152 => _152.required])
7946
+ label: _optionalChain([options, 'optionalAccess', _153 => _153.label]),
7947
+ required: _optionalChain([options, 'optionalAccess', _154 => _154.required])
7491
7948
  };
7492
7949
  this.rowData.fields.push(field);
7493
7950
  return this;
@@ -7778,7 +8235,7 @@ var WorkflowBuilder = class {
7778
8235
  * @param options - Slot configuration
7779
8236
  */
7780
8237
  slot(id, objectName, options) {
7781
- if (_optionalChain([this, 'access', _153 => _153.data, 'access', _154 => _154.slots, 'optionalAccess', _155 => _155.some, 'call', _156 => _156((s) => s.id === id)])) {
8238
+ if (_optionalChain([this, 'access', _155 => _155.data, 'access', _156 => _156.slots, 'optionalAccess', _157 => _157.some, 'call', _158 => _158((s) => s.id === id)])) {
7782
8239
  throw new Error(`[WorkflowBuilder] Duplicate slot id: "${id}"`);
7783
8240
  }
7784
8241
  const slot = {
@@ -7789,7 +8246,7 @@ var WorkflowBuilder = class {
7789
8246
  color: options.color,
7790
8247
  icon: options.icon
7791
8248
  };
7792
- _optionalChain([this, 'access', _157 => _157.data, 'access', _158 => _158.slots, 'optionalAccess', _159 => _159.push, 'call', _160 => _160(slot)]);
8249
+ _optionalChain([this, 'access', _159 => _159.data, 'access', _160 => _160.slots, 'optionalAccess', _161 => _161.push, 'call', _162 => _162(slot)]);
7793
8250
  return this;
7794
8251
  }
7795
8252
  // ============================================================================
@@ -7921,7 +8378,7 @@ var WorkflowBuilder = class {
7921
8378
  }
7922
8379
  }
7923
8380
  validateSlotReferences() {
7924
- 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()));
8381
+ 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()));
7925
8382
  for (const node of Object.values(_nullishCoalesce(this.data.nodes, () => ( {})))) {
7926
8383
  if (node.type === "form") {
7927
8384
  const referencedSlots = /* @__PURE__ */ new Set();
@@ -8159,7 +8616,7 @@ var ObjectSchemaService = class extends BaseService {
8159
8616
  constructor(adapter, nativeRegistry, options) {
8160
8617
  super(adapter);
8161
8618
  this.nativeRegistry = nativeRegistry;
8162
- this.auditService = _optionalChain([options, 'optionalAccess', _165 => _165.auditService]);
8619
+ this.auditService = _optionalChain([options, 'optionalAccess', _167 => _167.auditService]);
8163
8620
  }
8164
8621
  /**
8165
8622
  * Create a new custom object.
@@ -8372,7 +8829,7 @@ var ObjectSchemaService = class extends BaseService {
8372
8829
  resourceType: "attribute",
8373
8830
  resourceId: attributeId,
8374
8831
  resourceLabel: updatedDbAttr.label,
8375
- objectName: _optionalChain([dbObject, 'optionalAccess', _166 => _166.name]),
8832
+ objectName: _optionalChain([dbObject, 'optionalAccess', _168 => _168.name]),
8376
8833
  objectId: dbAttr.objectId,
8377
8834
  changes
8378
8835
  });
@@ -8405,7 +8862,7 @@ var ObjectSchemaService = class extends BaseService {
8405
8862
  );
8406
8863
  }
8407
8864
  const dbObject = await this.adapter.objects.findById(dbAttr.objectId);
8408
- if (_optionalChain([dbObject, 'optionalAccess', _167 => _167.labelExpression])) {
8865
+ if (_optionalChain([dbObject, 'optionalAccess', _169 => _169.labelExpression])) {
8409
8866
  const usedAttributes = extractAttributeNames(dbObject.labelExpression);
8410
8867
  if (usedAttributes.includes(dbAttr.name)) {
8411
8868
  throw new AttributeInUseError(dbAttr.name, "labelExpression");
@@ -8421,7 +8878,7 @@ var ObjectSchemaService = class extends BaseService {
8421
8878
  resourceType: "attribute",
8422
8879
  resourceId: attributeId,
8423
8880
  resourceLabel: dbAttr.label,
8424
- objectName: _optionalChain([dbObject, 'optionalAccess', _168 => _168.name]),
8881
+ objectName: _optionalChain([dbObject, 'optionalAccess', _170 => _170.name]),
8425
8882
  objectId: dbAttr.objectId
8426
8883
  });
8427
8884
  }
@@ -8436,9 +8893,9 @@ var ObjectSchemaService = class extends BaseService {
8436
8893
  async listAttributes(objectId, options) {
8437
8894
  const dbAttributes = await this.adapter.attributes.findByObjectId(objectId);
8438
8895
  let filtered = dbAttributes;
8439
- if (_optionalChain([options, 'optionalAccess', _169 => _169.systemOnly])) {
8896
+ if (_optionalChain([options, 'optionalAccess', _171 => _171.systemOnly])) {
8440
8897
  filtered = dbAttributes.filter((attr) => attr.system);
8441
- } else if (_optionalChain([options, 'optionalAccess', _170 => _170.customOnly])) {
8898
+ } else if (_optionalChain([options, 'optionalAccess', _172 => _172.customOnly])) {
8442
8899
  filtered = dbAttributes.filter((attr) => !attr.system);
8443
8900
  }
8444
8901
  return filtered.map((attr) => this.convertDBAttributeToAttribute(attr));
@@ -8474,14 +8931,14 @@ var ObjectSchemaService = class extends BaseService {
8474
8931
  pluralLabel: dbObject.pluralLabel,
8475
8932
  description: dbObject.description,
8476
8933
  labelExpression: dbObject.labelExpression,
8477
- icon: _optionalChain([dbObject, 'access', _171 => _171.metadata, 'optionalAccess', _172 => _172.icon])
8934
+ icon: _optionalChain([dbObject, 'access', _173 => _173.metadata, 'optionalAccess', _174 => _174.icon])
8478
8935
  };
8479
8936
  let metadata = dbObject.metadata;
8480
8937
  if (updates.icon !== void 0 || updates.metadata !== void 0) {
8481
8938
  metadata = {
8482
8939
  ...dbObject.metadata,
8483
8940
  ...updates.metadata,
8484
- icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _173 => _173.metadata, 'optionalAccess', _174 => _174.icon])))
8941
+ icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _175 => _175.metadata, 'optionalAccess', _176 => _176.icon])))
8485
8942
  };
8486
8943
  }
8487
8944
  const updatedDbObject = await this.adapter.objects.update(objectId, {
@@ -8761,7 +9218,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
8761
9218
  label: dbObject.label,
8762
9219
  pluralLabel: dbObject.pluralLabel,
8763
9220
  description: dbObject.description,
8764
- icon: _optionalChain([dbObject, 'access', _175 => _175.metadata, 'optionalAccess', _176 => _176.icon]),
9221
+ icon: _optionalChain([dbObject, 'access', _177 => _177.metadata, 'optionalAccess', _178 => _178.icon]),
8765
9222
  labelExpression: dbObject.labelExpression,
8766
9223
  attributes,
8767
9224
  system: dbObject.system,
@@ -8861,7 +9318,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
8861
9318
  const hasRelationToTarget = attrs.some((attr) => {
8862
9319
  if (attr.type !== "relation") return false;
8863
9320
  const config = attr.config;
8864
- return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _177 => _177.targets, 'optionalAccess', _178 => _178.some, 'call', _179 => _179((t) => t.object === targetObjectName)]), () => ( false));
9321
+ return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _179 => _179.targets, 'optionalAccess', _180 => _180.some, 'call', _181 => _181((t) => t.object === targetObjectName)]), () => ( false));
8865
9322
  });
8866
9323
  if (hasRelationToTarget) {
8867
9324
  referencing.push(obj.name);
@@ -8939,7 +9396,7 @@ Native objects must have system=true. Did you forget to call .system() in your b
8939
9396
  const existing = this.objects.get(object2.name);
8940
9397
  throw new Error(
8941
9398
  `[NativeObjectRegistry] Duplicate object name "${object2.name}":
8942
- - Existing: "${_optionalChain([existing, 'optionalAccess', _180 => _180.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _181 => _181.id])})
9399
+ - Existing: "${_optionalChain([existing, 'optionalAccess', _182 => _182.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _183 => _183.id])})
8943
9400
  - New: "${object2.label}" (id: ${object2.id})
8944
9401
  Please use unique names for each native object.`
8945
9402
  );
@@ -9056,7 +9513,7 @@ var AuditService = class extends BaseService {
9056
9513
  this.isFlushing = false;
9057
9514
  /** Pending flush promise to allow waiting on concurrent flush */
9058
9515
  this.flushPromise = null;
9059
- if (_optionalChain([options, 'optionalAccess', _182 => _182.async]) && options.flushIntervalMs) {
9516
+ if (_optionalChain([options, 'optionalAccess', _184 => _184.async]) && options.flushIntervalMs) {
9060
9517
  this.startFlushTimer();
9061
9518
  }
9062
9519
  }
@@ -9253,7 +9710,7 @@ var AuditService = class extends BaseService {
9253
9710
  if (!this.adapter.audit) {
9254
9711
  return;
9255
9712
  }
9256
- if (_optionalChain([this, 'access', _183 => _183.options, 'optionalAccess', _184 => _184.async])) {
9713
+ if (_optionalChain([this, 'access', _185 => _185.options, 'optionalAccess', _186 => _186.async])) {
9257
9714
  this.buffer.push(entry);
9258
9715
  const batchSize = _nullishCoalesce(this.options.batchSize, () => ( 10));
9259
9716
  if (this.buffer.length >= batchSize) {
@@ -9267,7 +9724,7 @@ var AuditService = class extends BaseService {
9267
9724
  * Start the flush timer for async mode
9268
9725
  */
9269
9726
  startFlushTimer() {
9270
- const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _185 => _185.options, 'optionalAccess', _186 => _186.flushIntervalMs]), () => ( 1e3));
9727
+ const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _187 => _187.options, 'optionalAccess', _188 => _188.flushIntervalMs]), () => ( 1e3));
9271
9728
  this.flushTimer = setInterval(() => {
9272
9729
  this.flush().catch(() => {
9273
9730
  });
@@ -9375,7 +9832,7 @@ var UserService = class extends BaseService {
9375
9832
  if (roleErrors.length > 0) {
9376
9833
  errors.push({
9377
9834
  attribute: attrName,
9378
- 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(", ")])}`,
9835
+ 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(", ")])}`,
9379
9836
  invalidIds: roleErrors
9380
9837
  });
9381
9838
  }
@@ -9697,7 +10154,7 @@ var RecordQueryService = class extends BaseService {
9697
10154
  super(adapter);
9698
10155
  this.schemaService = schemaService;
9699
10156
  this.options = options;
9700
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _190 => _190.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _191 => _191.policyRegistry]), () => ( defaultPolicyRegistry));
10157
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _192 => _192.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _193 => _193.policyRegistry]), () => ( defaultPolicyRegistry));
9701
10158
  }
9702
10159
  // ============================================================================
9703
10160
  // LIST
@@ -9747,12 +10204,12 @@ var RecordQueryService = class extends BaseService {
9747
10204
  * Internal list query execution
9748
10205
  */
9749
10206
  async executeListQuery(schema, objectId, options) {
9750
- if (_optionalChain([this, 'access', _192 => _192.options, 'optionalAccess', _193 => _193.permissionService]) && this.userId) {
10207
+ if (_optionalChain([this, 'access', _194 => _194.options, 'optionalAccess', _195 => _195.permissionService]) && this.userId) {
9751
10208
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
9752
10209
  }
9753
- const policy = _optionalChain([options, 'optionalAccess', _194 => _194.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
10210
+ const policy = _optionalChain([options, 'optionalAccess', _196 => _196.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
9754
10211
  let effectiveOptions = options;
9755
- if (_optionalChain([policy, 'optionalAccess', _195 => _195.applyListFilter]) && this.userId) {
10212
+ if (_optionalChain([policy, 'optionalAccess', _197 => _197.applyListFilter]) && this.userId) {
9756
10213
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
9757
10214
  effectiveOptions = policy.applyListFilter(ctx, options);
9758
10215
  }
@@ -9762,10 +10219,10 @@ var RecordQueryService = class extends BaseService {
9762
10219
  );
9763
10220
  let filteredRecords = result.records;
9764
10221
  let effectiveTotal = result.total;
9765
- if (_optionalChain([policy, 'optionalAccess', _196 => _196.canAccessRecord]) && this.userId) {
10222
+ if (_optionalChain([policy, 'optionalAccess', _198 => _198.canAccessRecord]) && this.userId) {
9766
10223
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
9767
- const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _197 => _197.limit]), () => ( 20));
9768
- const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _198 => _198.offset]), () => ( 0));
10224
+ const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _199 => _199.limit]), () => ( 20));
10225
+ const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _200 => _200.offset]), () => ( 0));
9769
10226
  const overfetchMultiplier = 5;
9770
10227
  const batchSize = requestedLimit * overfetchMultiplier;
9771
10228
  const maxScanRecords = 1e4;
@@ -9787,7 +10244,7 @@ var RecordQueryService = class extends BaseService {
9787
10244
  exhausted = true;
9788
10245
  break;
9789
10246
  }
9790
- const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _199 => _199.canAccessRecord, 'optionalCall', _200 => _200(ctx, record)]));
10247
+ const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _201 => _201.canAccessRecord, 'optionalCall', _202 => _202(ctx, record)]));
9791
10248
  collected.push(...filtered);
9792
10249
  dbOffset += batch.records.length;
9793
10250
  totalScanned += batch.records.length;
@@ -9799,7 +10256,14 @@ var RecordQueryService = class extends BaseService {
9799
10256
  effectiveTotal = exhausted ? collected.length : Math.max(collected.length, result.total);
9800
10257
  filteredRecords = collected.slice(requestedOffset, requestedOffset + requestedLimit);
9801
10258
  }
9802
- if (!_optionalChain([options, 'optionalAccess', _201 => _201.skipFormulas])) {
10259
+ if (_optionalChain([options, 'optionalAccess', _203 => _203.include]) && options.include.length > 0) {
10260
+ filteredRecords = await this.includeRelationsWithProperties(
10261
+ filteredRecords,
10262
+ schema,
10263
+ options.include
10264
+ );
10265
+ }
10266
+ if (!_optionalChain([options, 'optionalAccess', _204 => _204.skipFormulas])) {
9803
10267
  return {
9804
10268
  records: enrichRecordsWithFormulas(filteredRecords, schema),
9805
10269
  total: effectiveTotal
@@ -9859,14 +10323,14 @@ var RecordQueryService = class extends BaseService {
9859
10323
  * Internal search query execution
9860
10324
  */
9861
10325
  async executeSearchQuery(schema, objectId, query, options) {
9862
- if (_optionalChain([this, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.permissionService]) && this.userId) {
10326
+ if (_optionalChain([this, 'access', _205 => _205.options, 'optionalAccess', _206 => _206.permissionService]) && this.userId) {
9863
10327
  await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
9864
10328
  }
9865
10329
  const result = await runWithSchemaContext(
9866
10330
  [schema],
9867
10331
  () => this.adapter.objectRecords.search(objectId, query, options)
9868
10332
  );
9869
- if (!_optionalChain([options, 'optionalAccess', _204 => _204.skipFormulas])) {
10333
+ if (!_optionalChain([options, 'optionalAccess', _207 => _207.skipFormulas])) {
9870
10334
  return {
9871
10335
  records: enrichRecordsWithFormulas(result.records, schema),
9872
10336
  total: result.total
@@ -9874,6 +10338,79 @@ var RecordQueryService = class extends BaseService {
9874
10338
  }
9875
10339
  return result;
9876
10340
  }
10341
+ // ============================================================================
10342
+ // INCLUDE RELATIONS WITH PROPERTIES
10343
+ // ============================================================================
10344
+ /**
10345
+ * Include relation properties in records.
10346
+ *
10347
+ * For each requested relation attribute:
10348
+ * - If attribute has properties → Fetch from relation_attributes and return hybrid format
10349
+ * - If attribute has NO properties → Return legacy format (string[] or string)
10350
+ *
10351
+ * Uses batch loading to avoid N+1 queries.
10352
+ *
10353
+ * @param records - Records to enrich with relation properties
10354
+ * @param schema - Object schema
10355
+ * @param includes - Array of relation attribute names to include
10356
+ * @returns Records enriched with relation properties in hybrid format
10357
+ * @private
10358
+ */
10359
+ async includeRelationsWithProperties(records, schema, includes) {
10360
+ if (records.length === 0 || includes.length === 0) {
10361
+ return records;
10362
+ }
10363
+ for (const includeName of includes) {
10364
+ const attr = schema.attributes.find((a) => a.name === includeName);
10365
+ if (!attr || attr.type !== "relation") {
10366
+ continue;
10367
+ }
10368
+ if (attr.properties && this.adapter.relationAttributes) {
10369
+ const recordIds = records.map((r) => r.id);
10370
+ const relationAttributesRepo = this.adapter.relationAttributes;
10371
+ const allRelationProps = await Promise.all(
10372
+ recordIds.map(
10373
+ (recordId) => relationAttributesRepo.findBySource(schema.name, recordId, includeName)
10374
+ )
10375
+ );
10376
+ const propsByRecord = /* @__PURE__ */ new Map();
10377
+ allRelationProps.forEach((props, index) => {
10378
+ const recordId = recordIds[index];
10379
+ const propsMap = /* @__PURE__ */ new Map();
10380
+ for (const prop of props) {
10381
+ propsMap.set(prop.toId, prop.properties);
10382
+ }
10383
+ propsByRecord.set(recordId, propsMap);
10384
+ });
10385
+ for (const record of records) {
10386
+ const currentValue = record.values[includeName];
10387
+ const propsMap = propsByRecord.get(record.id);
10388
+ if (!currentValue) {
10389
+ continue;
10390
+ }
10391
+ if (!propsMap) {
10392
+ continue;
10393
+ }
10394
+ if (attr.cardinality === "many" && Array.isArray(currentValue)) {
10395
+ record.values[includeName] = currentValue.map((id) => {
10396
+ if (typeof id === "string") {
10397
+ const props = propsMap.get(id);
10398
+ return props ? { id, props } : { id };
10399
+ }
10400
+ return id;
10401
+ });
10402
+ } else if (attr.cardinality === "one") {
10403
+ const id = typeof currentValue === "string" ? currentValue : null;
10404
+ if (id) {
10405
+ const props = propsMap.get(id);
10406
+ record.values[includeName] = props ? { id, props } : { id };
10407
+ }
10408
+ }
10409
+ }
10410
+ }
10411
+ }
10412
+ return records;
10413
+ }
9877
10414
  };
9878
10415
 
9879
10416
  // src/runtime/services/record/record-resolver.service.ts
@@ -9968,6 +10505,280 @@ var RecordResolverService = class extends BaseService {
9968
10505
  }
9969
10506
  };
9970
10507
 
10508
+ // src/runtime/services/record/relation-properties.service.ts
10509
+
10510
+ var RelationPropertiesService = class extends BaseService {
10511
+ constructor(adapter) {
10512
+ super(adapter);
10513
+ }
10514
+ // ============================================================================
10515
+ // PUBLIC API
10516
+ // ============================================================================
10517
+ /**
10518
+ * Normalize relation values for storage in object_records table.
10519
+ *
10520
+ * Extracts IDs from hybrid format ({ id, props }) and returns legacy format (string[] or string).
10521
+ * This ensures object_records.values only contains IDs, while properties are in relation_attributes.
10522
+ *
10523
+ * @param schema - Object schema
10524
+ * @param data - Record data with hybrid relation values
10525
+ * @returns Data with relation values normalized to ID-only format
10526
+ */
10527
+ normalizeRelationValuesForStorage(schema, data) {
10528
+ const normalized = { ...data };
10529
+ for (const attr of schema.attributes) {
10530
+ if (attr.type !== "relation" || !attr.properties) {
10531
+ continue;
10532
+ }
10533
+ const value = data[attr.name];
10534
+ if (value === null || value === void 0) {
10535
+ continue;
10536
+ }
10537
+ if (attr.cardinality === "many" && Array.isArray(value)) {
10538
+ normalized[attr.name] = value.map((item) => {
10539
+ if (typeof item === "string") return item;
10540
+ if (typeof item === "object" && item !== null && "id" in item) {
10541
+ return item.id;
10542
+ }
10543
+ return item;
10544
+ });
10545
+ } else if (typeof value === "object" && value !== null && "id" in value) {
10546
+ normalized[attr.name] = value.id;
10547
+ }
10548
+ }
10549
+ return normalized;
10550
+ }
10551
+ /**
10552
+ * Synchronize relation properties for a given attribute.
10553
+ *
10554
+ * Handles:
10555
+ * - Format normalization (legacy → new)
10556
+ * - Validation of properties
10557
+ * - Upsert for present IDs
10558
+ * - Delete for absent IDs
10559
+ *
10560
+ * @param schema - Object schema
10561
+ * @param recordId - Source record ID
10562
+ * @param attributeName - Relation attribute name
10563
+ * @param relationValue - Relation value (hybrid format)
10564
+ * @param adapter - Database adapter
10565
+ */
10566
+ async syncRelationProperties(schema, recordId, attributeName, relationValue, adapter) {
10567
+ const attribute = schema.attributes.find((a) => a.name === attributeName);
10568
+ if (!attribute || attribute.type !== "relation") {
10569
+ return;
10570
+ }
10571
+ if (!attribute.properties) {
10572
+ return;
10573
+ }
10574
+ const normalized = this.normalizeRelationValue(relationValue);
10575
+ for (const item of normalized) {
10576
+ if (item.props) {
10577
+ this.validateProperties(attribute.properties, item.props);
10578
+ }
10579
+ }
10580
+ const existing = await _optionalChain([adapter, 'access', _208 => _208.relationAttributes, 'optionalAccess', _209 => _209.findBySource, 'call', _210 => _210(
10581
+ schema.name,
10582
+ recordId,
10583
+ attributeName
10584
+ )]);
10585
+ const existingIds = new Set((_nullishCoalesce(existing, () => ( []))).map((r) => r.toId));
10586
+ const newIds = new Set(normalized.map((item) => item.id));
10587
+ const toUpsert = normalized.filter((item) => item.props !== void 0);
10588
+ const toDelete = Array.from(existingIds).filter((id) => !newIds.has(id));
10589
+ if (toUpsert.length > 0 && adapter.relationAttributes) {
10590
+ const inputs = toUpsert.map((item) => ({
10591
+ fromObject: schema.name,
10592
+ fromId: recordId,
10593
+ fromAttribute: attributeName,
10594
+ toId: item.id,
10595
+ properties: _nullishCoalesce(item.props, () => ( {})),
10596
+ updatedBy: _nullishCoalesce(this.userId, () => ( void 0)),
10597
+ createdBy: _nullishCoalesce(this.userId, () => ( void 0))
10598
+ }));
10599
+ await adapter.relationAttributes.upsertBatch(inputs);
10600
+ }
10601
+ if (toDelete.length > 0 && adapter.relationAttributes && existing) {
10602
+ for (const toId of toDelete) {
10603
+ const relation2 = existing.find((r) => r.toId === toId);
10604
+ if (relation2) {
10605
+ }
10606
+ }
10607
+ await adapter.relationAttributes.deleteBySource(schema.name, recordId, attributeName);
10608
+ if (toUpsert.length > 0) {
10609
+ const inputs = toUpsert.map((item) => ({
10610
+ fromObject: schema.name,
10611
+ fromId: recordId,
10612
+ fromAttribute: attributeName,
10613
+ toId: item.id,
10614
+ properties: _nullishCoalesce(item.props, () => ( {})),
10615
+ updatedBy: _nullishCoalesce(this.userId, () => ( void 0)),
10616
+ createdBy: _nullishCoalesce(this.userId, () => ( void 0))
10617
+ }));
10618
+ await adapter.relationAttributes.upsertBatch(inputs);
10619
+ }
10620
+ }
10621
+ }
10622
+ /**
10623
+ * Validate relation properties against PropertySchema.
10624
+ *
10625
+ * Uses Zod for runtime validation based on PropertyDefinition types.
10626
+ *
10627
+ * @param propertySchema - Schema defining allowed properties
10628
+ * @param properties - Properties to validate
10629
+ * @throws {z.ZodError} if validation fails
10630
+ */
10631
+ validateProperties(propertySchema, properties) {
10632
+ const schema = this.buildZodSchema(propertySchema);
10633
+ schema.parse(properties);
10634
+ }
10635
+ // ============================================================================
10636
+ // PRIVATE HELPERS
10637
+ // ============================================================================
10638
+ /**
10639
+ * Normalize relation value to unified internal format.
10640
+ *
10641
+ * Converts:
10642
+ * - string[] → Array<{ id, props?: undefined }>
10643
+ * - string → [{ id, props?: undefined }]
10644
+ * - null → []
10645
+ * - Array<{ id, props }> → Array<{ id, props }> (passthrough)
10646
+ * - { id, props } → [{ id, props }] (single to array)
10647
+ *
10648
+ * @param value - Relation value in hybrid format
10649
+ * @returns Normalized array of relation items
10650
+ * @private
10651
+ */
10652
+ normalizeRelationValue(value) {
10653
+ if (value === null || value === void 0) {
10654
+ return [];
10655
+ }
10656
+ if (typeof value === "string") {
10657
+ return [{ id: value }];
10658
+ }
10659
+ if (!Array.isArray(value) && typeof value === "object" && "id" in value) {
10660
+ return [value];
10661
+ }
10662
+ if (Array.isArray(value)) {
10663
+ return value.map((item) => {
10664
+ if (typeof item === "string") {
10665
+ return { id: item };
10666
+ }
10667
+ return item;
10668
+ });
10669
+ }
10670
+ return [];
10671
+ }
10672
+ /**
10673
+ * Build Zod schema from PropertySchema definition.
10674
+ *
10675
+ * Dynamically generates validation schema based on PropertyDefinition types.
10676
+ *
10677
+ * @param propertySchema - PropertySchema with definitions
10678
+ * @returns Zod schema for validation
10679
+ * @private
10680
+ */
10681
+ buildZodSchema(propertySchema) {
10682
+ const shape = {};
10683
+ for (const def of propertySchema.definitions) {
10684
+ let fieldSchema = this.buildFieldSchema(def);
10685
+ if (!def.required) {
10686
+ fieldSchema = fieldSchema.optional();
10687
+ }
10688
+ shape[def.name] = fieldSchema;
10689
+ }
10690
+ return _zod.z.object(shape);
10691
+ }
10692
+ /**
10693
+ * Build Zod schema for a single property field.
10694
+ *
10695
+ * @param def - PropertyDefinition
10696
+ * @returns Zod schema for the field
10697
+ * @private
10698
+ */
10699
+ buildFieldSchema(def) {
10700
+ switch (def.type) {
10701
+ case "text":
10702
+ case "textarea": {
10703
+ let schema = _zod.z.string();
10704
+ if (def.minLength !== void 0) {
10705
+ schema = schema.min(def.minLength);
10706
+ }
10707
+ if (def.maxLength !== void 0) {
10708
+ schema = schema.max(def.maxLength);
10709
+ }
10710
+ if (def.type === "text" && def.pattern) {
10711
+ schema = schema.regex(new RegExp(def.pattern));
10712
+ }
10713
+ return schema;
10714
+ }
10715
+ case "number": {
10716
+ let schema = _zod.z.number();
10717
+ if (def.min !== void 0) {
10718
+ schema = schema.min(def.min);
10719
+ }
10720
+ if (def.max !== void 0) {
10721
+ schema = schema.max(def.max);
10722
+ }
10723
+ if (def.integer) {
10724
+ schema = schema.int();
10725
+ }
10726
+ return schema;
10727
+ }
10728
+ case "checkbox": {
10729
+ return _zod.z.boolean();
10730
+ }
10731
+ case "date": {
10732
+ const schema = _zod.z.string().datetime();
10733
+ return schema;
10734
+ }
10735
+ case "phone": {
10736
+ return _zod.z.string();
10737
+ }
10738
+ case "currency": {
10739
+ let schema = _zod.z.number();
10740
+ if (def.min !== void 0) {
10741
+ schema = schema.min(def.min);
10742
+ }
10743
+ if (def.max !== void 0) {
10744
+ schema = schema.max(def.max);
10745
+ }
10746
+ return schema;
10747
+ }
10748
+ case "status":
10749
+ case "select": {
10750
+ const validValues = def.options.map((opt) => opt.value);
10751
+ return _zod.z.enum(validValues);
10752
+ }
10753
+ case "multiselect": {
10754
+ const validValues = def.options.map((opt) => opt.value);
10755
+ let schema = _zod.z.array(_zod.z.enum(validValues));
10756
+ if (def.maxSelections !== void 0) {
10757
+ schema = schema.max(def.maxSelections);
10758
+ }
10759
+ return schema;
10760
+ }
10761
+ case "rating": {
10762
+ let schema = _zod.z.number().int();
10763
+ if (def.max !== void 0) {
10764
+ schema = schema.max(def.max);
10765
+ }
10766
+ return schema.min(0);
10767
+ }
10768
+ case "location": {
10769
+ return _zod.z.object({
10770
+ address: _zod.z.string().optional(),
10771
+ lat: _zod.z.number().optional(),
10772
+ lng: _zod.z.number().optional()
10773
+ });
10774
+ }
10775
+ default: {
10776
+ return _zod.z.unknown();
10777
+ }
10778
+ }
10779
+ }
10780
+ };
10781
+
9971
10782
  // src/runtime/services/record/relation.service.ts
9972
10783
  var RelationService = class extends BaseService {
9973
10784
  constructor(adapter, nativeRegistry, options) {
@@ -10045,7 +10856,7 @@ var RelationService = class extends BaseService {
10045
10856
  }
10046
10857
  const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
10047
10858
  const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
10048
- if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _205 => _205.size]) === 0) {
10859
+ if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _211 => _211.size]) === 0) {
10049
10860
  errors.push({
10050
10861
  attribute: attr.name,
10051
10862
  message: `No valid target objects found for ${attr.label}`
@@ -10098,7 +10909,7 @@ var RelationService = class extends BaseService {
10098
10909
  for (const target of targets) {
10099
10910
  try {
10100
10911
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
10101
- if (_optionalChain([objectSchema, 'optionalAccess', _206 => _206.id])) {
10912
+ if (_optionalChain([objectSchema, 'optionalAccess', _212 => _212.id])) {
10102
10913
  objectIds.add(objectSchema.id);
10103
10914
  }
10104
10915
  } catch (e12) {
@@ -10167,7 +10978,7 @@ var RelationService = class extends BaseService {
10167
10978
  const targetResults = await Promise.all(
10168
10979
  filteredTargets.map(async (target) => {
10169
10980
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
10170
- if (!_optionalChain([objectSchema, 'optionalAccess', _207 => _207.id])) return { options: [], total: 0 };
10981
+ if (!_optionalChain([objectSchema, 'optionalAccess', _213 => _213.id])) return { options: [], total: 0 };
10171
10982
  const objectId = objectSchema.id;
10172
10983
  const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
10173
10984
  const options = await Promise.all(
@@ -10324,8 +11135,8 @@ var RelationService = class extends BaseService {
10324
11135
  continue;
10325
11136
  }
10326
11137
  const attribute = attributeMap.get(attributeId);
10327
- const targetConfig = _optionalChain([attribute, 'optionalAccess', _208 => _208.targets, 'optionalAccess', _209 => _209.find, 'call', _210 => _210((t) => t.object === objectSchema.name)]);
10328
- const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _211 => _211.displayTemplate]);
11138
+ const targetConfig = _optionalChain([attribute, 'optionalAccess', _214 => _214.targets, 'optionalAccess', _215 => _215.find, 'call', _216 => _216((t) => t.object === objectSchema.name)]);
11139
+ const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _217 => _217.displayTemplate]);
10329
11140
  const label = await this.resolveLabel(record, objectSchema, customTemplate);
10330
11141
  resolved.push({
10331
11142
  _compositeId: compositeId,
@@ -10475,14 +11286,14 @@ var RollupService = class extends BaseService {
10475
11286
  const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
10476
11287
  let sourceObjectId;
10477
11288
  let reverseRelationAttrName;
10478
- if (_optionalChain([sourceSchema, 'optionalAccess', _212 => _212.id])) {
11289
+ if (_optionalChain([sourceSchema, 'optionalAccess', _218 => _218.id])) {
10479
11290
  sourceObjectId = sourceSchema.id;
10480
11291
  const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
10481
11292
  if (attr.type !== "relation") return false;
10482
11293
  const relationConfig = attr;
10483
- return _optionalChain([relationConfig, 'optionalAccess', _213 => _213.targets, 'optionalAccess', _214 => _214.some, 'call', _215 => _215((t) => t.object === schema.name)]);
11294
+ return _optionalChain([relationConfig, 'optionalAccess', _219 => _219.targets, 'optionalAccess', _220 => _220.some, 'call', _221 => _221((t) => t.object === schema.name)]);
10484
11295
  });
10485
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _216 => _216.name]);
11296
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _222 => _222.name]);
10486
11297
  } else {
10487
11298
  const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
10488
11299
  if (!sourceObject) {
@@ -10493,9 +11304,9 @@ var RollupService = class extends BaseService {
10493
11304
  const reverseRelationAttr = sourceAttributes.find((attr) => {
10494
11305
  if (attr.type !== "relation") return false;
10495
11306
  const relationConfig = attr.config;
10496
- return _optionalChain([relationConfig, 'optionalAccess', _217 => _217.targets, 'optionalAccess', _218 => _218.some, 'call', _219 => _219((t) => t.object === schema.name)]);
11307
+ return _optionalChain([relationConfig, 'optionalAccess', _223 => _223.targets, 'optionalAccess', _224 => _224.some, 'call', _225 => _225((t) => t.object === schema.name)]);
10497
11308
  });
10498
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _220 => _220.name]);
11309
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _226 => _226.name]);
10499
11310
  }
10500
11311
  if (!reverseRelationAttrName) {
10501
11312
  return { value: null, recordCount: 0 };
@@ -10751,13 +11562,13 @@ var RollupService = class extends BaseService {
10751
11562
  if (!obj) continue;
10752
11563
  for (const rollupDbAttr of rollupAttrs) {
10753
11564
  const rollupConfig = rollupDbAttr.config;
10754
- if (!_optionalChain([rollupConfig, 'optionalAccess', _221 => _221.relationAttribute])) continue;
11565
+ if (!_optionalChain([rollupConfig, 'optionalAccess', _227 => _227.relationAttribute])) continue;
10755
11566
  const relationAttr = attributes.find(
10756
11567
  (a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
10757
11568
  );
10758
11569
  if (!relationAttr) continue;
10759
11570
  const relationConfig = relationAttr.config;
10760
- const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _222 => _222.targets, 'optionalAccess', _223 => _223.some, 'call', _224 => _224(
11571
+ const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _228 => _228.targets, 'optionalAccess', _229 => _229.some, 'call', _230 => _230(
10761
11572
  (t) => t.object === changedSchema.name
10762
11573
  )]);
10763
11574
  if (!targetsChangedObject) continue;
@@ -10782,11 +11593,11 @@ var RecordService = class extends BaseService {
10782
11593
  constructor(adapter, options) {
10783
11594
  super(adapter);
10784
11595
  this.schemaService = new ObjectSchemaService(adapter, registry, {
10785
- auditService: _optionalChain([options, 'optionalAccess', _225 => _225.auditService])
11596
+ auditService: _optionalChain([options, 'optionalAccess', _231 => _231.auditService])
10786
11597
  });
10787
- this.permissionService = _optionalChain([options, 'optionalAccess', _226 => _226.permissionService]);
10788
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _227 => _227.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
10789
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _228 => _228.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _229 => _229.policyRegistry]), () => ( defaultPolicyRegistry));
11598
+ this.permissionService = _optionalChain([options, 'optionalAccess', _232 => _232.permissionService]);
11599
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _233 => _233.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
11600
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _234 => _234.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _235 => _235.policyRegistry]), () => ( defaultPolicyRegistry));
10790
11601
  this.recordResolver = new RecordResolverService(adapter);
10791
11602
  this.queryService = new RecordQueryService(adapter, this.schemaService, {
10792
11603
  permissionService: this.permissionService,
@@ -10796,11 +11607,12 @@ var RecordService = class extends BaseService {
10796
11607
  queryService: this.queryService,
10797
11608
  recordResolver: this.recordResolver
10798
11609
  });
11610
+ this.relationPropertiesService = new RelationPropertiesService(adapter);
10799
11611
  this.rollupService = new RollupService(adapter, {
10800
11612
  recordResolver: this.recordResolver
10801
11613
  });
10802
11614
  this.userService = new UserService(adapter);
10803
- this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _230 => _230.hookRegistry]), () => ( new NoopHookRegistry()));
11615
+ this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _236 => _236.hookRegistry]), () => ( new NoopHookRegistry()));
10804
11616
  this.labelResolver = this.recordResolver.createLabelResolver(this.relationService);
10805
11617
  this.rollupContext = this.recordResolver.createRollupContext(
10806
11618
  this.rollupService,
@@ -10835,35 +11647,51 @@ var RecordService = class extends BaseService {
10835
11647
  schema,
10836
11648
  this.tenantId,
10837
11649
  dataWithDefaults,
10838
- _optionalChain([options, 'optionalAccess', _231 => _231.hookMetadata])
11650
+ _optionalChain([options, 'optionalAccess', _237 => _237.hookMetadata])
10839
11651
  );
10840
- if (!_optionalChain([options, 'optionalAccess', _232 => _232.skipHooks])) {
11652
+ if (!_optionalChain([options, 'optionalAccess', _238 => _238.skipHooks])) {
10841
11653
  await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
10842
11654
  }
10843
- if (_optionalChain([options, 'optionalAccess', _233 => _233.validate]) !== false) {
10844
- if (_optionalChain([options, 'optionalAccess', _234 => _234.allowDraft])) {
10845
- _chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, dataWithDefaults);
11655
+ const normalizedData = this.relationPropertiesService.normalizeRelationValuesForStorage(
11656
+ schema,
11657
+ dataWithDefaults
11658
+ );
11659
+ if (_optionalChain([options, 'optionalAccess', _239 => _239.validate]) !== false) {
11660
+ if (_optionalChain([options, 'optionalAccess', _240 => _240.allowDraft])) {
11661
+ _chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, normalizedData);
10846
11662
  } else {
10847
- _chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, dataWithDefaults);
11663
+ _chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, normalizedData);
10848
11664
  }
10849
- if (!_optionalChain([options, 'optionalAccess', _235 => _235.skipRelationValidation])) {
10850
- await this.relationService.validateRelationsOrThrow(schema, dataWithDefaults);
11665
+ if (!_optionalChain([options, 'optionalAccess', _241 => _241.skipRelationValidation])) {
11666
+ await this.relationService.validateRelationsOrThrow(schema, normalizedData);
10851
11667
  }
10852
- if (!_optionalChain([options, 'optionalAccess', _236 => _236.skipUserValidation])) {
10853
- await this.userService.validateUsersOrThrow(schema, dataWithDefaults);
11668
+ if (!_optionalChain([options, 'optionalAccess', _242 => _242.skipUserValidation])) {
11669
+ await this.userService.validateUsersOrThrow(schema, normalizedData);
10854
11670
  }
10855
11671
  }
10856
- const completionStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, dataWithDefaults);
10857
- const label = await computeLabel(schema, dataWithDefaults, this.labelResolver);
11672
+ const completionStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, normalizedData);
11673
+ const label = await computeLabel(schema, normalizedData, this.labelResolver);
10858
11674
  const record = await this.adapter.objectRecords.create({
10859
11675
  objectId,
10860
- data: dataWithDefaults,
11676
+ data: normalizedData,
10861
11677
  label,
10862
11678
  completionStatus,
10863
- metadata: _optionalChain([options, 'optionalAccess', _237 => _237.metadata]),
11679
+ metadata: _optionalChain([options, 'optionalAccess', _243 => _243.metadata]),
10864
11680
  createdBy: this.userId
10865
11681
  });
10866
- if (!_optionalChain([options, 'optionalAccess', _238 => _238.skipHooks])) {
11682
+ for (const [attrName, value] of Object.entries(dataWithDefaults)) {
11683
+ const attr = schema.attributes.find((a) => a.name === attrName);
11684
+ if (_optionalChain([attr, 'optionalAccess', _244 => _244.type]) === "relation" && attr.properties) {
11685
+ await this.relationPropertiesService.syncRelationProperties(
11686
+ schema,
11687
+ record.id,
11688
+ attrName,
11689
+ value,
11690
+ this.adapter
11691
+ );
11692
+ }
11693
+ }
11694
+ if (!_optionalChain([options, 'optionalAccess', _245 => _245.skipHooks])) {
10867
11695
  const afterCtx = {
10868
11696
  ...hookCtx,
10869
11697
  recordId: record.id,
@@ -10881,7 +11709,7 @@ var RecordService = class extends BaseService {
10881
11709
  objectId: schema.id,
10882
11710
  recordId: record.id,
10883
11711
  recordLabel: record.label,
10884
- metadata: _optionalChain([options, 'optionalAccess', _239 => _239.hookMetadata])
11712
+ metadata: _optionalChain([options, 'optionalAccess', _246 => _246.hookMetadata])
10885
11713
  }).catch((err) => {
10886
11714
  console.error(
10887
11715
  "Audit log failed (record.created):",
@@ -10907,7 +11735,7 @@ var RecordService = class extends BaseService {
10907
11735
  return null;
10908
11736
  }
10909
11737
  const schema = await this.schemaService.getObjectSchema(record.objectId);
10910
- if (!_optionalChain([options, 'optionalAccess', _240 => _240.skipPolicyCheck])) {
11738
+ if (!_optionalChain([options, 'optionalAccess', _247 => _247.skipPolicyCheck])) {
10911
11739
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
10912
11740
  if (policy) {
10913
11741
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
@@ -10917,10 +11745,10 @@ var RecordService = class extends BaseService {
10917
11745
  }
10918
11746
  }
10919
11747
  let enrichedRecord = record;
10920
- if (!_optionalChain([options, 'optionalAccess', _241 => _241.skipFormulas])) {
11748
+ if (!_optionalChain([options, 'optionalAccess', _248 => _248.skipFormulas])) {
10921
11749
  enrichedRecord = enrichWithFormulas(record, schema);
10922
11750
  }
10923
- if (_optionalChain([options, 'optionalAccess', _242 => _242.includeSchema])) {
11751
+ if (_optionalChain([options, 'optionalAccess', _249 => _249.includeSchema])) {
10924
11752
  const recordWithSchema = enrichedRecord;
10925
11753
  recordWithSchema.schema = schema;
10926
11754
  return recordWithSchema;
@@ -10982,9 +11810,9 @@ var RecordService = class extends BaseService {
10982
11810
  existing,
10983
11811
  mergedData,
10984
11812
  changedAttributes,
10985
- _optionalChain([options, 'optionalAccess', _243 => _243.hookMetadata])
11813
+ _optionalChain([options, 'optionalAccess', _250 => _250.hookMetadata])
10986
11814
  );
10987
- if (!_optionalChain([options, 'optionalAccess', _244 => _244.skipHooks])) {
11815
+ if (!_optionalChain([options, 'optionalAccess', _251 => _251.skipHooks])) {
10988
11816
  await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
10989
11817
  }
10990
11818
  const hookModifiedValues = {};
@@ -10993,36 +11821,35 @@ var RecordService = class extends BaseService {
10993
11821
  hookModifiedValues[key] = hookCtx.newValues[key];
10994
11822
  }
10995
11823
  }
10996
- if (_optionalChain([options, 'optionalAccess', _245 => _245.validate]) !== false) {
10997
- if (_optionalChain([options, 'optionalAccess', _246 => _246.partial])) {
10998
- _chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, mergedData);
11824
+ const dataToUpdate = { ...data, ...hookModifiedValues };
11825
+ const normalizedUpdate = this.relationPropertiesService.normalizeRelationValuesForStorage(
11826
+ schema,
11827
+ dataToUpdate
11828
+ );
11829
+ const normalizedMergedData = { ...existing.values, ...normalizedUpdate };
11830
+ if (_optionalChain([options, 'optionalAccess', _252 => _252.validate]) !== false) {
11831
+ if (_optionalChain([options, 'optionalAccess', _253 => _253.partial])) {
11832
+ _chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, normalizedMergedData);
10999
11833
  } else {
11000
- _chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, mergedData);
11834
+ _chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
11001
11835
  }
11002
- if (!_optionalChain([options, 'optionalAccess', _247 => _247.skipRelationValidation])) {
11003
- await this.relationService.validateRelationsOrThrow(schema, {
11004
- ...data,
11005
- ...hookModifiedValues
11006
- });
11836
+ if (!_optionalChain([options, 'optionalAccess', _254 => _254.skipRelationValidation])) {
11837
+ await this.relationService.validateRelationsOrThrow(schema, normalizedUpdate);
11007
11838
  }
11008
- if (!_optionalChain([options, 'optionalAccess', _248 => _248.skipUserValidation])) {
11009
- await this.userService.validateUsersOrThrow(schema, {
11010
- ...data,
11011
- ...hookModifiedValues
11012
- });
11839
+ if (!_optionalChain([options, 'optionalAccess', _255 => _255.skipUserValidation])) {
11840
+ await this.userService.validateUsersOrThrow(schema, normalizedUpdate);
11013
11841
  }
11014
11842
  }
11015
- const completionStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, mergedData);
11016
- const label = await computeLabel(schema, mergedData, this.labelResolver);
11843
+ const completionStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, normalizedMergedData);
11844
+ const label = await computeLabel(schema, normalizedMergedData, this.labelResolver);
11017
11845
  const updatePayload = {
11018
- ...data,
11019
- ...hookModifiedValues,
11846
+ ...normalizedUpdate,
11020
11847
  __completionStatus: completionStatus,
11021
11848
  __label: label,
11022
11849
  __lastUpdatedBy: this.userId,
11023
11850
  __expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
11024
11851
  };
11025
- if (_optionalChain([options, 'optionalAccess', _249 => _249.metadata]) !== void 0) {
11852
+ if (_optionalChain([options, 'optionalAccess', _256 => _256.metadata]) !== void 0) {
11026
11853
  const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
11027
11854
  const mergedMetadata = { ...existingMetadata, ...options.metadata };
11028
11855
  const cleanedMetadata = Object.fromEntries(
@@ -11032,7 +11859,19 @@ var RecordService = class extends BaseService {
11032
11859
  }
11033
11860
  const updated = await this.adapter.objectRecords.update(recordId, updatePayload);
11034
11861
  await this.invalidateRecordCaches(recordId, existing.objectId);
11035
- if (!_optionalChain([options, 'optionalAccess', _250 => _250.skipHooks])) {
11862
+ for (const [attrName, value] of Object.entries(dataToUpdate)) {
11863
+ const attr = schema.attributes.find((a) => a.name === attrName);
11864
+ if (_optionalChain([attr, 'optionalAccess', _257 => _257.type]) === "relation" && attr.properties) {
11865
+ await this.relationPropertiesService.syncRelationProperties(
11866
+ schema,
11867
+ recordId,
11868
+ attrName,
11869
+ value,
11870
+ this.adapter
11871
+ );
11872
+ }
11873
+ }
11874
+ if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipHooks])) {
11036
11875
  const afterCtx = {
11037
11876
  ...hookCtx,
11038
11877
  record: updated
@@ -11047,7 +11886,7 @@ var RecordService = class extends BaseService {
11047
11886
  if (this.auditService && this.userId && allChangedAttributes.length > 0) {
11048
11887
  const changes = allChangedAttributes.map((attr) => ({
11049
11888
  field: attr,
11050
- oldValue: _optionalChain([hookCtx, 'access', _251 => _251.oldValues, 'optionalAccess', _252 => _252[attr]]),
11889
+ oldValue: _optionalChain([hookCtx, 'access', _259 => _259.oldValues, 'optionalAccess', _260 => _260[attr]]),
11051
11890
  newValue: hookCtx.newValues[attr]
11052
11891
  }));
11053
11892
  this.auditService.logRecordAction({
@@ -11058,7 +11897,7 @@ var RecordService = class extends BaseService {
11058
11897
  recordId: updated.id,
11059
11898
  recordLabel: updated.label,
11060
11899
  changes,
11061
- metadata: _optionalChain([options, 'optionalAccess', _253 => _253.hookMetadata])
11900
+ metadata: _optionalChain([options, 'optionalAccess', _261 => _261.hookMetadata])
11062
11901
  }).catch((err) => {
11063
11902
  console.error(
11064
11903
  "Audit log failed (record.updated):",
@@ -11093,22 +11932,22 @@ var RecordService = class extends BaseService {
11093
11932
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
11094
11933
  checkRecordDeleteOrThrow(policy, record, ctx);
11095
11934
  }
11096
- if (_optionalChain([options, 'optionalAccess', _254 => _254.checkSystem]) && schema.system) {
11935
+ if (_optionalChain([options, 'optionalAccess', _262 => _262.checkSystem]) && schema.system) {
11097
11936
  throw new ProtectedResourceError("object", schema.name, "delete");
11098
11937
  }
11099
- if (!_optionalChain([options, 'optionalAccess', _255 => _255.skipReferenceCheck])) {
11938
+ if (!_optionalChain([options, 'optionalAccess', _263 => _263.skipReferenceCheck])) {
11100
11939
  const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
11101
11940
  if (references.length > 0) {
11102
11941
  throw new RecordReferencedError(recordId, references);
11103
11942
  }
11104
11943
  }
11105
- const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _256 => _256.hookMetadata]));
11106
- if (!_optionalChain([options, 'optionalAccess', _257 => _257.skipHooks])) {
11944
+ const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _264 => _264.hookMetadata]));
11945
+ if (!_optionalChain([options, 'optionalAccess', _265 => _265.skipHooks])) {
11107
11946
  await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
11108
11947
  }
11109
11948
  await this.adapter.objectRecords.delete(recordId);
11110
11949
  await this.invalidateRecordCaches(recordId, record.objectId);
11111
- if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipHooks])) {
11950
+ if (!_optionalChain([options, 'optionalAccess', _266 => _266.skipHooks])) {
11112
11951
  await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
11113
11952
  }
11114
11953
  await recalculateParentRollups(record, schema, this.rollupContext);
@@ -11120,7 +11959,7 @@ var RecordService = class extends BaseService {
11120
11959
  objectId: schema.id,
11121
11960
  recordId: record.id,
11122
11961
  recordLabel: record.label,
11123
- metadata: _optionalChain([options, 'optionalAccess', _259 => _259.hookMetadata])
11962
+ metadata: _optionalChain([options, 'optionalAccess', _267 => _267.hookMetadata])
11124
11963
  }).catch((err) => {
11125
11964
  console.error(
11126
11965
  "Audit log failed (record.deleted):",
@@ -11163,13 +12002,13 @@ var RecordService = class extends BaseService {
11163
12002
  this.tenantId
11164
12003
  );
11165
12004
  await checkPermission(this.permissionService, this.userId, schema.name, "update");
11166
- const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _260 => _260.hookMetadata]));
11167
- if (!_optionalChain([options, 'optionalAccess', _261 => _261.skipHooks])) {
12005
+ const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _268 => _268.hookMetadata]));
12006
+ if (!_optionalChain([options, 'optionalAccess', _269 => _269.skipHooks])) {
11168
12007
  await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
11169
12008
  }
11170
12009
  const restored = await this.adapter.objectRecords.restore(recordId);
11171
12010
  await this.invalidateRecordCaches(recordId, record.objectId);
11172
- if (!_optionalChain([options, 'optionalAccess', _262 => _262.skipHooks])) {
12011
+ if (!_optionalChain([options, 'optionalAccess', _270 => _270.skipHooks])) {
11173
12012
  const afterCtx = {
11174
12013
  ...hookCtx,
11175
12014
  record: restored
@@ -11184,7 +12023,7 @@ var RecordService = class extends BaseService {
11184
12023
  objectId: schema.id,
11185
12024
  recordId: restored.id,
11186
12025
  recordLabel: restored.label,
11187
- metadata: _optionalChain([options, 'optionalAccess', _263 => _263.hookMetadata])
12026
+ metadata: _optionalChain([options, 'optionalAccess', _271 => _271.hookMetadata])
11188
12027
  }).catch((err) => {
11189
12028
  console.error(
11190
12029
  "Audit log failed (record.restored):",
@@ -11565,7 +12404,7 @@ var DocumentRendererService = class {
11565
12404
  throw new StorageDownloadNotSupportedError();
11566
12405
  }
11567
12406
  let storagePath = fileId;
11568
- if (_optionalChain([this, 'access', _264 => _264.options, 'optionalAccess', _265 => _265.filesRepository])) {
12407
+ if (_optionalChain([this, 'access', _272 => _272.options, 'optionalAccess', _273 => _273.filesRepository])) {
11569
12408
  const file2 = await this.options.filesRepository.findById(fileId);
11570
12409
  if (!file2) {
11571
12410
  throw new Error(`Template file not found: ${fileId}`);
@@ -11583,8 +12422,8 @@ var DocumentRendererService = class {
11583
12422
  for (const field of fields) {
11584
12423
  const rawValue = getContextValue(context, field.contextPath);
11585
12424
  const attrInfo = await this.getAttributeInfo(field.contextPath, workflow2);
11586
- if (_optionalChain([attrInfo, 'optionalAccess', _266 => _266.attribute])) {
11587
- if (attrInfo.attribute.type === "relation" && rawValue && _optionalChain([this, 'access', _267 => _267.options, 'optionalAccess', _268 => _268.relationService])) {
12425
+ if (_optionalChain([attrInfo, 'optionalAccess', _274 => _274.attribute])) {
12426
+ if (attrInfo.attribute.type === "relation" && rawValue && _optionalChain([this, 'access', _275 => _275.options, 'optionalAccess', _276 => _276.relationService])) {
11588
12427
  const ids = Array.isArray(rawValue) ? rawValue : [rawValue];
11589
12428
  const stringIds = ids.filter((id) => typeof id === "string");
11590
12429
  if (stringIds.length > 0) {
@@ -11605,7 +12444,7 @@ var DocumentRendererService = class {
11605
12444
  resolved.set(field.id, this.formatValueSimple(rawValue, field.fallback));
11606
12445
  }
11607
12446
  }
11608
- if (relationBatch.length > 0 && _optionalChain([this, 'access', _269 => _269.options, 'optionalAccess', _270 => _270.relationService])) {
12447
+ if (relationBatch.length > 0 && _optionalChain([this, 'access', _277 => _277.options, 'optionalAccess', _278 => _278.relationService])) {
11609
12448
  try {
11610
12449
  const batchResult = await this.options.relationService.resolveIdsBatch(
11611
12450
  relationBatch.map((r) => ({ attributeId: r.attributeId, ids: r.ids }))
@@ -11614,12 +12453,12 @@ var DocumentRendererService = class {
11614
12453
  const options = _nullishCoalesce(batchResult[attributeId], () => ( []));
11615
12454
  const labels = options.map((o) => o.label);
11616
12455
  const field = fields.find((f) => f.id === fieldId);
11617
- resolved.set(fieldId, labels.join(", ") || _optionalChain([field, 'optionalAccess', _271 => _271.fallback]) || "");
12456
+ resolved.set(fieldId, labels.join(", ") || _optionalChain([field, 'optionalAccess', _279 => _279.fallback]) || "");
11618
12457
  }
11619
12458
  } catch (e14) {
11620
12459
  for (const { fieldId, ids } of relationBatch) {
11621
12460
  const field = fields.find((f) => f.id === fieldId);
11622
- resolved.set(fieldId, ids.join(", ") || _optionalChain([field, 'optionalAccess', _272 => _272.fallback]) || "");
12461
+ resolved.set(fieldId, ids.join(", ") || _optionalChain([field, 'optionalAccess', _280 => _280.fallback]) || "");
11623
12462
  }
11624
12463
  }
11625
12464
  }
@@ -11630,7 +12469,7 @@ var DocumentRendererService = class {
11630
12469
  * Parses paths like "slots.client.firstName" to find the attribute definition
11631
12470
  */
11632
12471
  async getAttributeInfo(contextPath, workflow2) {
11633
- const schemaService = _optionalChain([this, 'access', _273 => _273.options, 'optionalAccess', _274 => _274.schemaService]);
12472
+ const schemaService = _optionalChain([this, 'access', _281 => _281.options, 'optionalAccess', _282 => _282.schemaService]);
11634
12473
  if (!schemaService) {
11635
12474
  return null;
11636
12475
  }
@@ -11643,7 +12482,7 @@ var DocumentRendererService = class {
11643
12482
  }
11644
12483
  const slotId = parts[1];
11645
12484
  const attributeName = parts[2];
11646
- const slot = _optionalChain([workflow2, 'access', _275 => _275.slots, 'optionalAccess', _276 => _276.find, 'call', _277 => _277((s) => s.id === slotId)]);
12485
+ const slot = _optionalChain([workflow2, 'access', _283 => _283.slots, 'optionalAccess', _284 => _284.find, 'call', _285 => _285((s) => s.id === slotId)]);
11647
12486
  if (!slot) {
11648
12487
  return null;
11649
12488
  }
@@ -11842,7 +12681,7 @@ var DocumentProcessingHook = class extends BaseService {
11842
12681
  const pendingIds = [];
11843
12682
  for (const [nodeId, doc] of Object.entries(context.documents)) {
11844
12683
  const metadata = doc.metadata;
11845
- if (_optionalChain([metadata, 'optionalAccess', _278 => _278.status]) === "pending") {
12684
+ if (_optionalChain([metadata, 'optionalAccess', _286 => _286.status]) === "pending") {
11846
12685
  pendingIds.push(nodeId);
11847
12686
  }
11848
12687
  }
@@ -11893,12 +12732,12 @@ var DocumentProcessingHook = class extends BaseService {
11893
12732
  }
11894
12733
  for (const slotId of targetSlotIds) {
11895
12734
  try {
11896
- const recordId = _optionalChain([context, 'access', _279 => _279.createdRecordIds, 'optionalAccess', _280 => _280[slotId]]);
12735
+ const recordId = _optionalChain([context, 'access', _287 => _287.createdRecordIds, 'optionalAccess', _288 => _288[slotId]]);
11897
12736
  if (!recordId) {
11898
12737
  continue;
11899
12738
  }
11900
- const slotDef = _optionalChain([workflow2, 'access', _281 => _281.slots, 'optionalAccess', _282 => _282.find, 'call', _283 => _283((s) => s.id === slotId)]);
11901
- const objectName = _optionalChain([slotDef, 'optionalAccess', _284 => _284.objectName]);
12739
+ const slotDef = _optionalChain([workflow2, 'access', _289 => _289.slots, 'optionalAccess', _290 => _290.find, 'call', _291 => _291((s) => s.id === slotId)]);
12740
+ const objectName = _optionalChain([slotDef, 'optionalAccess', _292 => _292.objectName]);
11902
12741
  if (!objectName) {
11903
12742
  continue;
11904
12743
  }
@@ -11915,7 +12754,7 @@ var DocumentProcessingHook = class extends BaseService {
11915
12754
  attachedDocumentIds.push(result.document.id);
11916
12755
  const record = await recordService.getRecord(recordId);
11917
12756
  if (record) {
11918
- const attachments = _nullishCoalesce(_optionalChain([record, 'access', _285 => _285.values, 'optionalAccess', _286 => _286.attachments]), () => ( []));
12757
+ const attachments = _nullishCoalesce(_optionalChain([record, 'access', _293 => _293.values, 'optionalAccess', _294 => _294.attachments]), () => ( []));
11919
12758
  await recordService.updateRecord(
11920
12759
  recordId,
11921
12760
  { attachments: [...attachments, result.document.id] },
@@ -12181,7 +13020,7 @@ var WorkflowAccessGrantService = class extends BaseService {
12181
13020
  * Check if a specific token has been revoked.
12182
13021
  */
12183
13022
  isTokenRevoked(dbGrant, jti) {
12184
- return _nullishCoalesce(_optionalChain([dbGrant, 'access', _287 => _287.revoked_token_jtis, 'optionalAccess', _288 => _288.includes, 'call', _289 => _289(jti)]), () => ( false));
13023
+ return _nullishCoalesce(_optionalChain([dbGrant, 'access', _295 => _295.revoked_token_jtis, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(jti)]), () => ( false));
12185
13024
  }
12186
13025
  /**
12187
13026
  * Validate access token payload against the grant.
@@ -12233,10 +13072,10 @@ var WorkflowInstanceService = class extends BaseService {
12233
13072
  constructor(adapter, workflowService, options) {
12234
13073
  super(adapter);
12235
13074
  this.workflowService = workflowService;
12236
- this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _290 => _290.executorRegistry]), () => ( getDefaultExecutorRegistry()));
12237
- this.schemaService = _optionalChain([options, 'optionalAccess', _291 => _291.schemaService]);
12238
- this.recordService = _optionalChain([options, 'optionalAccess', _292 => _292.recordService]);
12239
- this.documentProcessingHook = _optionalChain([options, 'optionalAccess', _293 => _293.documentProcessingHook]);
13075
+ this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _298 => _298.executorRegistry]), () => ( getDefaultExecutorRegistry()));
13076
+ this.schemaService = _optionalChain([options, 'optionalAccess', _299 => _299.schemaService]);
13077
+ this.recordService = _optionalChain([options, 'optionalAccess', _300 => _300.recordService]);
13078
+ this.documentProcessingHook = _optionalChain([options, 'optionalAccess', _301 => _301.documentProcessingHook]);
12240
13079
  }
12241
13080
  /**
12242
13081
  * Start a new workflow instance
@@ -12418,7 +13257,7 @@ var WorkflowInstanceService = class extends BaseService {
12418
13257
  if (!this.adapter.workflowInstances) {
12419
13258
  return { instances: [], total: 0 };
12420
13259
  }
12421
- if (_optionalChain([options, 'optionalAccess', _294 => _294.workflowName])) {
13260
+ if (_optionalChain([options, 'optionalAccess', _302 => _302.workflowName])) {
12422
13261
  const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
12423
13262
  options.workflowName,
12424
13263
  { status: options.status }
@@ -12432,11 +13271,11 @@ var WorkflowInstanceService = class extends BaseService {
12432
13271
  return { instances: instances2, total: total2 };
12433
13272
  }
12434
13273
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
12435
- limit: _optionalChain([options, 'optionalAccess', _295 => _295.limit]),
12436
- offset: _optionalChain([options, 'optionalAccess', _296 => _296.offset])
13274
+ limit: _optionalChain([options, 'optionalAccess', _303 => _303.limit]),
13275
+ offset: _optionalChain([options, 'optionalAccess', _304 => _304.offset])
12437
13276
  });
12438
13277
  let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
12439
- if (_optionalChain([options, 'optionalAccess', _297 => _297.status])) {
13278
+ if (_optionalChain([options, 'optionalAccess', _305 => _305.status])) {
12440
13279
  instances = instances.filter((i) => i.status === options.status);
12441
13280
  }
12442
13281
  instances = await this.markExpiredInstances(instances);
@@ -12457,9 +13296,9 @@ var WorkflowInstanceService = class extends BaseService {
12457
13296
  return { instances: [], total: 0 };
12458
13297
  }
12459
13298
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
12460
- status: _optionalChain([options, 'optionalAccess', _298 => _298.status]),
12461
- limit: _optionalChain([options, 'optionalAccess', _299 => _299.limit]),
12462
- offset: _optionalChain([options, 'optionalAccess', _300 => _300.offset])
13299
+ status: _optionalChain([options, 'optionalAccess', _306 => _306.status]),
13300
+ limit: _optionalChain([options, 'optionalAccess', _307 => _307.limit]),
13301
+ offset: _optionalChain([options, 'optionalAccess', _308 => _308.offset])
12463
13302
  });
12464
13303
  const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
12465
13304
  return { instances, total };
@@ -12525,7 +13364,7 @@ var WorkflowInstanceService = class extends BaseService {
12525
13364
  try {
12526
13365
  const schemas = await Promise.all(
12527
13366
  current.workflowSnapshot.slots.map(
12528
- (slot) => _optionalChain([this, 'access', _301 => _301.schemaService, 'optionalAccess', _302 => _302.getObjectSchemaByName, 'call', _303 => _303(slot.objectName)])
13367
+ (slot) => _optionalChain([this, 'access', _309 => _309.schemaService, 'optionalAccess', _310 => _310.getObjectSchemaByName, 'call', _311 => _311(slot.objectName)])
12529
13368
  )
12530
13369
  );
12531
13370
  objectDefinitions = schemas.filter(
@@ -12790,8 +13629,8 @@ var WorkflowInstanceService = class extends BaseService {
12790
13629
  */
12791
13630
  async snapshotRecord(recordId) {
12792
13631
  try {
12793
- const record = await _optionalChain([this, 'access', _304 => _304.recordService, 'optionalAccess', _305 => _305.getRecord, 'call', _306 => _306(recordId, { skipPolicyCheck: true })]);
12794
- return _optionalChain([record, 'optionalAccess', _307 => _307.values]);
13632
+ const record = await _optionalChain([this, 'access', _312 => _312.recordService, 'optionalAccess', _313 => _313.getRecord, 'call', _314 => _314(recordId, { skipPolicyCheck: true })]);
13633
+ return _optionalChain([record, 'optionalAccess', _315 => _315.values]);
12795
13634
  } catch (e18) {
12796
13635
  return void 0;
12797
13636
  }
@@ -12810,13 +13649,13 @@ var WorkflowInstanceService = class extends BaseService {
12810
13649
  for (const op of [...operations].reverse()) {
12811
13650
  try {
12812
13651
  if (op.operation === "create") {
12813
- await _optionalChain([this, 'access', _308 => _308.recordService, 'optionalAccess', _309 => _309.deleteRecord, 'call', _310 => _310(op.recordId, {
13652
+ await _optionalChain([this, 'access', _316 => _316.recordService, 'optionalAccess', _317 => _317.deleteRecord, 'call', _318 => _318(op.recordId, {
12814
13653
  skipHooks: true,
12815
13654
  skipReferenceCheck: true
12816
13655
  })]);
12817
13656
  rolledBack.push(op.slotId);
12818
13657
  } else if (op.operation === "update" && op.previousData) {
12819
- await _optionalChain([this, 'access', _311 => _311.recordService, 'optionalAccess', _312 => _312.updateRecord, 'call', _313 => _313(op.recordId, op.previousData, {
13658
+ await _optionalChain([this, 'access', _319 => _319.recordService, 'optionalAccess', _320 => _320.updateRecord, 'call', _321 => _321(op.recordId, op.previousData, {
12820
13659
  partial: false
12821
13660
  })]);
12822
13661
  rolledBack.push(op.slotId);
@@ -12940,7 +13779,7 @@ var WorkflowInstanceService = class extends BaseService {
12940
13779
  if (!this.adapter.workflowInstances) {
12941
13780
  return;
12942
13781
  }
12943
- const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _314 => _314.context, 'access', _315 => _315.variables, 'optionalAccess', _316 => _316.__version]), () => ( 0));
13782
+ const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _322 => _322.context, 'access', _323 => _323.variables, 'optionalAccess', _324 => _324.__version]), () => ( 0));
12944
13783
  const nextVersion = currentVersion + 1;
12945
13784
  const instanceWithVersion = {
12946
13785
  ...instance,
@@ -13221,7 +14060,7 @@ var WorkflowRelationService = class extends BaseService {
13221
14060
  if (attr.type !== "relation") continue;
13222
14061
  for (const slot of slots) {
13223
14062
  const slotData = context.slots[slot.id];
13224
- const slotRecordId = _optionalChain([slotData, 'optionalAccess', _317 => _317.id]);
14063
+ const slotRecordId = _optionalChain([slotData, 'optionalAccess', _325 => _325.id]);
13225
14064
  if (!slotRecordId) continue;
13226
14065
  const targetsSlotObject = attr.targets.some(
13227
14066
  (t) => t.object === slot.objectName
@@ -13289,7 +14128,7 @@ var WorkflowService = class extends BaseService {
13289
14128
  if (Array.isArray(options)) {
13290
14129
  this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
13291
14130
  } else {
13292
- this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _318 => _318.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
14131
+ this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _326 => _326.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
13293
14132
  }
13294
14133
  }
13295
14134
  // ============================================================================
@@ -13587,7 +14426,7 @@ var WorkflowService = class extends BaseService {
13587
14426
  var UserProfileService = class extends BaseService {
13588
14427
  constructor(adapter, options) {
13589
14428
  super(adapter);
13590
- this.auditService = _optionalChain([options, 'optionalAccess', _319 => _319.auditService]);
14429
+ this.auditService = _optionalChain([options, 'optionalAccess', _327 => _327.auditService]);
13591
14430
  }
13592
14431
  // ============================================================================
13593
14432
  // CACHE MANAGEMENT
@@ -13750,7 +14589,7 @@ var UserProfileService = class extends BaseService {
13750
14589
  */
13751
14590
  async deleteProfile(profileId, options) {
13752
14591
  const profile = await this.getProfileOrThrow(profileId);
13753
- if (_optionalChain([options, 'optionalAccess', _320 => _320.checkAdmin])) {
14592
+ if (_optionalChain([options, 'optionalAccess', _328 => _328.checkAdmin])) {
13754
14593
  if (profile.role === "admin") {
13755
14594
  const adminCount = await this.adapter.userProfiles.countByRole("admin");
13756
14595
  if (adminCount <= 1) {
@@ -13825,7 +14664,7 @@ var UserProfileService = class extends BaseService {
13825
14664
  */
13826
14665
  async hasRole(profileId, role) {
13827
14666
  const profile = await this.getProfile(profileId);
13828
- return _optionalChain([profile, 'optionalAccess', _321 => _321.role]) === role;
14667
+ return _optionalChain([profile, 'optionalAccess', _329 => _329.role]) === role;
13829
14668
  }
13830
14669
  /**
13831
14670
  * Check if user is admin
@@ -14259,7 +15098,7 @@ var DocumentTemplateService = class extends BaseService {
14259
15098
  * Includes both system templates and tenant-specific templates.
14260
15099
  */
14261
15100
  async listTemplates(options) {
14262
- if (_optionalChain([options, 'optionalAccess', _322 => _322.systemOnly])) {
15101
+ if (_optionalChain([options, 'optionalAccess', _330 => _330.systemOnly])) {
14263
15102
  return SYSTEM_TEMPLATES;
14264
15103
  }
14265
15104
  const templates = [...SYSTEM_TEMPLATES];
@@ -14342,8 +15181,8 @@ var DocumentTemplateService = class extends BaseService {
14342
15181
  var DocumentService = class extends BaseService {
14343
15182
  constructor(adapter, options) {
14344
15183
  super(adapter);
14345
- this.templateService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _323 => _323.templateService]), () => ( new DocumentTemplateService(adapter)));
14346
- this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _324 => _324.fileService]), () => ( null));
15184
+ this.templateService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _331 => _331.templateService]), () => ( new DocumentTemplateService(adapter)));
15185
+ this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _332 => _332.fileService]), () => ( null));
14347
15186
  }
14348
15187
  // ============================================================================
14349
15188
  // CREATE
@@ -14594,7 +15433,7 @@ var DocumentService = class extends BaseService {
14594
15433
  */
14595
15434
  async isComplete(documentId) {
14596
15435
  const document2 = await this.getDocument(documentId);
14597
- return _optionalChain([document2, 'optionalAccess', _325 => _325.status]) !== "draft";
15436
+ return _optionalChain([document2, 'optionalAccess', _333 => _333.status]) !== "draft";
14598
15437
  }
14599
15438
  /**
14600
15439
  * Get document with its template and slots.
@@ -14852,7 +15691,7 @@ var DocumentProcessingService = class extends BaseService {
14852
15691
  type: "signature",
14853
15692
  provider: this.config.signatureAdapter.name,
14854
15693
  input: { signers, ...options },
14855
- expiresAt: _optionalChain([options, 'optionalAccess', _326 => _326.expiresAt])
15694
+ expiresAt: _optionalChain([options, 'optionalAccess', _334 => _334.expiresAt])
14856
15695
  });
14857
15696
  return job;
14858
15697
  }
@@ -15009,7 +15848,7 @@ var DocumentProcessingService = class extends BaseService {
15009
15848
  }
15010
15849
  const document2 = await this.documentService.getDocumentOrThrow(documentId);
15011
15850
  const template = await this.templateService.getTemplateOrThrow(document2.templateId);
15012
- if (!_optionalChain([template, 'access', _327 => _327.autoProcessing, 'optionalAccess', _328 => _328.identityVerification, 'optionalAccess', _329 => _329.enabled])) {
15851
+ if (!_optionalChain([template, 'access', _335 => _335.autoProcessing, 'optionalAccess', _336 => _336.identityVerification, 'optionalAccess', _337 => _337.enabled])) {
15013
15852
  throw new Error("Identity verification is not enabled for this document type");
15014
15853
  }
15015
15854
  const job = await this.adapter.documentJobs.create({
@@ -15095,13 +15934,13 @@ var DocumentProcessingService = class extends BaseService {
15095
15934
  const template = await this.templateService.getTemplateOrThrow(document2.templateId);
15096
15935
  const slots = await this.documentService.getSlots(documentId);
15097
15936
  const jobs = [];
15098
- if (_optionalChain([template, 'access', _330 => _330.autoProcessing, 'optionalAccess', _331 => _331.ocr, 'optionalAccess', _332 => _332.enabled]) && this.config.ocrAdapter) {
15937
+ if (_optionalChain([template, 'access', _338 => _338.autoProcessing, 'optionalAccess', _339 => _339.ocr, 'optionalAccess', _340 => _340.enabled]) && this.config.ocrAdapter) {
15099
15938
  for (const slot of slots) {
15100
15939
  const job = await this.processOcr(documentId, slot.slotName);
15101
15940
  jobs.push(job);
15102
15941
  }
15103
15942
  }
15104
- if (_optionalChain([template, 'access', _333 => _333.autoProcessing, 'optionalAccess', _334 => _334.identityVerification, 'optionalAccess', _335 => _335.enabled]) && this.config.identityAdapter) {
15943
+ if (_optionalChain([template, 'access', _341 => _341.autoProcessing, 'optionalAccess', _342 => _342.identityVerification, 'optionalAccess', _343 => _343.enabled]) && this.config.identityAdapter) {
15105
15944
  const job = await this.verifyIdentity(documentId);
15106
15945
  jobs.push(job);
15107
15946
  }
@@ -15172,15 +16011,15 @@ var DocumentProcessingService = class extends BaseService {
15172
16011
  return {
15173
16012
  ocr: {
15174
16013
  available: !!this.config.ocrAdapter,
15175
- provider: _optionalChain([this, 'access', _336 => _336.config, 'access', _337 => _337.ocrAdapter, 'optionalAccess', _338 => _338.name])
16014
+ provider: _optionalChain([this, 'access', _344 => _344.config, 'access', _345 => _345.ocrAdapter, 'optionalAccess', _346 => _346.name])
15176
16015
  },
15177
16016
  signature: {
15178
16017
  available: !!this.config.signatureAdapter,
15179
- provider: _optionalChain([this, 'access', _339 => _339.config, 'access', _340 => _340.signatureAdapter, 'optionalAccess', _341 => _341.name])
16018
+ provider: _optionalChain([this, 'access', _347 => _347.config, 'access', _348 => _348.signatureAdapter, 'optionalAccess', _349 => _349.name])
15180
16019
  },
15181
16020
  identityVerification: {
15182
16021
  available: !!this.config.identityAdapter,
15183
- provider: _optionalChain([this, 'access', _342 => _342.config, 'access', _343 => _343.identityAdapter, 'optionalAccess', _344 => _344.name])
16022
+ provider: _optionalChain([this, 'access', _350 => _350.config, 'access', _351 => _351.identityAdapter, 'optionalAccess', _352 => _352.name])
15184
16023
  }
15185
16024
  };
15186
16025
  }
@@ -15190,7 +16029,7 @@ var DocumentProcessingService = class extends BaseService {
15190
16029
  var FileService = class extends BaseService {
15191
16030
  constructor(adapter, options) {
15192
16031
  super(adapter);
15193
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _345 => _345.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
16032
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _353 => _353.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
15194
16033
  }
15195
16034
  // ============================================================================
15196
16035
  // UPLOAD (requires StorageAdapter)
@@ -15329,7 +16168,7 @@ var FileService = class extends BaseService {
15329
16168
  */
15330
16169
  async getFile(fileId) {
15331
16170
  const file2 = await this.adapter.files.findById(fileId);
15332
- if (_optionalChain([file2, 'optionalAccess', _346 => _346.deletedAt])) {
16171
+ if (_optionalChain([file2, 'optionalAccess', _354 => _354.deletedAt])) {
15333
16172
  return null;
15334
16173
  }
15335
16174
  return file2;
@@ -15391,12 +16230,12 @@ var FileService = class extends BaseService {
15391
16230
  */
15392
16231
  async deleteFile(fileId, options) {
15393
16232
  const file2 = await this.getFileOrThrow(fileId);
15394
- if (_optionalChain([options, 'optionalAccess', _347 => _347.checkOwnership]) && options.userId) {
16233
+ if (_optionalChain([options, 'optionalAccess', _355 => _355.checkOwnership]) && options.userId) {
15395
16234
  if (file2.uploadedBy !== options.userId) {
15396
16235
  throw new Error("You can only delete files you uploaded");
15397
16236
  }
15398
16237
  }
15399
- if (_optionalChain([options, 'optionalAccess', _348 => _348.hard])) {
16238
+ if (_optionalChain([options, 'optionalAccess', _356 => _356.hard])) {
15400
16239
  await this.adapter.files.hardDelete(fileId);
15401
16240
  } else {
15402
16241
  await this.adapter.files.delete(fileId);
@@ -15427,7 +16266,7 @@ var FileService = class extends BaseService {
15427
16266
  }
15428
16267
  const file2 = await this.getFileOrThrow(fileId);
15429
16268
  await this.adapter.storage.delete(file2.storagePath);
15430
- if (_optionalChain([options, 'optionalAccess', _349 => _349.hard])) {
16269
+ if (_optionalChain([options, 'optionalAccess', _357 => _357.hard])) {
15431
16270
  await this.adapter.files.hardDelete(fileId);
15432
16271
  } else {
15433
16272
  await this.adapter.files.delete(fileId);
@@ -15453,15 +16292,15 @@ var FileService = class extends BaseService {
15453
16292
  const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
15454
16293
  const files = fileResults.filter((f) => f !== null);
15455
16294
  if (files.length === 0) return;
15456
- if (_optionalChain([options, 'optionalAccess', _350 => _350.deleteFromStorage]) && this.adapter.storage) {
16295
+ if (_optionalChain([options, 'optionalAccess', _358 => _358.deleteFromStorage]) && this.adapter.storage) {
15457
16296
  const BATCH_SIZE = 10;
15458
16297
  for (let i = 0; i < files.length; i += BATCH_SIZE) {
15459
16298
  const batch = files.slice(i, i + BATCH_SIZE);
15460
- await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _351 => _351.adapter, 'access', _352 => _352.storage, 'optionalAccess', _353 => _353.delete, 'call', _354 => _354(file2.storagePath)])));
16299
+ 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)])));
15461
16300
  }
15462
16301
  }
15463
16302
  const idsToDelete = files.map((f) => f.id);
15464
- if (_optionalChain([options, 'optionalAccess', _355 => _355.hard])) {
16303
+ if (_optionalChain([options, 'optionalAccess', _363 => _363.hard])) {
15465
16304
  await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
15466
16305
  } else {
15467
16306
  await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
@@ -15469,12 +16308,12 @@ var FileService = class extends BaseService {
15469
16308
  if (this.auditService && this.userId) {
15470
16309
  await Promise.all(
15471
16310
  files.map(
15472
- (file2) => _optionalChain([this, 'access', _356 => _356.auditService, 'optionalAccess', _357 => _357.logFileAction, 'call', _358 => _358({
16311
+ (file2) => _optionalChain([this, 'access', _364 => _364.auditService, 'optionalAccess', _365 => _365.logFileAction, 'call', _366 => _366({
15473
16312
  action: "file.deleted",
15474
16313
  actorId: _nullishCoalesce(this.userId, () => ( "")),
15475
16314
  fileId: file2.id,
15476
16315
  fileName: file2.name,
15477
- metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _359 => _359.deleteFromStorage]), () => ( false)) }
16316
+ metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _367 => _367.deleteFromStorage]), () => ( false)) }
15478
16317
  })])
15479
16318
  )
15480
16319
  );
@@ -15552,7 +16391,7 @@ var FileService = class extends BaseService {
15552
16391
  if (!file2) {
15553
16392
  return false;
15554
16393
  }
15555
- if (_optionalChain([options, 'optionalAccess', _360 => _360.isAdmin])) {
16394
+ if (_optionalChain([options, 'optionalAccess', _368 => _368.isAdmin])) {
15556
16395
  return true;
15557
16396
  }
15558
16397
  if (file2.visibility === "public") {
@@ -15562,7 +16401,7 @@ var FileService = class extends BaseService {
15562
16401
  return true;
15563
16402
  }
15564
16403
  if (file2.visibility === "restricted") {
15565
- return _nullishCoalesce(_optionalChain([file2, 'access', _361 => _361.allowedUsers, 'optionalAccess', _362 => _362.includes, 'call', _363 => _363(userId)]), () => ( false));
16404
+ return _nullishCoalesce(_optionalChain([file2, 'access', _369 => _369.allowedUsers, 'optionalAccess', _370 => _370.includes, 'call', _371 => _371(userId)]), () => ( false));
15566
16405
  }
15567
16406
  return false;
15568
16407
  }
@@ -15657,7 +16496,7 @@ function withTimeout(promise, ms, label) {
15657
16496
  var GeocodingService = class {
15658
16497
  constructor(adapter, options) {
15659
16498
  this.adapter = adapter;
15660
- this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _364 => _364.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
16499
+ this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
15661
16500
  }
15662
16501
  /**
15663
16502
  * Search for address suggestions as the user types
@@ -15707,23 +16546,6 @@ var GlobalSearchService = class extends BaseService {
15707
16546
  * @param query - Search query string
15708
16547
  * @param options - Search options (pagination, object filters)
15709
16548
  * @returns Matching records with object metadata and total count
15710
- *
15711
- * @example
15712
- * ```typescript
15713
- * // Basic search
15714
- * const { results, total } = await service.search("nike air");
15715
- *
15716
- * // With pagination
15717
- * const { results, total } = await service.search("nike", {
15718
- * limit: 10,
15719
- * offset: 20
15720
- * });
15721
- *
15722
- * // Filter by object types
15723
- * const { results, total } = await service.search("nike", {
15724
- * objectNames: ["products", "orders"]
15725
- * });
15726
- * ```
15727
16549
  */
15728
16550
  async search(query, options) {
15729
16551
  if (!query || query.trim().length === 0) {
@@ -15731,58 +16553,36 @@ var GlobalSearchService = class extends BaseService {
15731
16553
  }
15732
16554
  return this.cachedList(
15733
16555
  "globalSearch",
15734
- "global",
16556
+ "search",
15735
16557
  { query: query.trim(), ...options },
15736
- () => this.executeSearch(query.trim(), options)
16558
+ () => this.adapter.objectRecords.globalSearch(query.trim(), {
16559
+ limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _373 => _373.limit]), () => ( 20)),
16560
+ offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.offset]), () => ( 0)),
16561
+ objectNames: _optionalChain([options, 'optionalAccess', _375 => _375.objectNames])
16562
+ })
15737
16563
  );
15738
16564
  }
15739
16565
  /**
15740
- * Internal search execution (extracted for caching)
15741
- */
15742
- async executeSearch(query, options) {
15743
- return await this.adapter.objectRecords.globalSearch(query, {
15744
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _365 => _365.limit]), () => ( 20)),
15745
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _366 => _366.offset]), () => ( 0)),
15746
- objectNames: _optionalChain([options, 'optionalAccess', _367 => _367.objectNames]),
15747
- includeObjectInfo: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _368 => _368.includeObjectInfo]), () => ( true))
15748
- });
15749
- }
15750
- /**
15751
- * Search and group results by object type
16566
+ * Search and group results by object type.
16567
+ * Delegates grouping to the database for accurate per-group counts.
15752
16568
  *
15753
16569
  * @param query - Search query string
15754
- * @param options - Search options
15755
- * @returns Results grouped by object name
16570
+ * @param options - Search options (object filters, limit per group)
16571
+ * @returns Results grouped by object name with per-group totals
15756
16572
  */
15757
16573
  async searchGrouped(query, options) {
15758
- const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _369 => _369.limitPerGroup]), () => ( 5));
15759
- const estimatedGroupCount = 10;
15760
- const fetchLimit = Math.min(limitPerGroup * estimatedGroupCount, 100);
15761
- const { results, total } = await this.search(query, {
15762
- ...options,
15763
- limit: fetchLimit,
15764
- offset: 0
15765
- });
15766
- const groupMap = /* @__PURE__ */ new Map();
15767
- for (const result of results) {
15768
- const existing = groupMap.get(result.objectName);
15769
- if (existing) {
15770
- existing.results.push(result);
15771
- } else {
15772
- groupMap.set(result.objectName, {
15773
- objectName: result.objectName,
15774
- objectLabel: result.objectLabel,
15775
- results: [result]
15776
- });
15777
- }
16574
+ if (!query || query.trim().length === 0) {
16575
+ return { groups: [], total: 0 };
15778
16576
  }
15779
- const groups = Array.from(groupMap.values()).map((g) => ({
15780
- ...g,
15781
- results: g.results.slice(0, limitPerGroup),
15782
- count: g.results.length
15783
- }));
15784
- groups.sort((a, b) => b.count - a.count);
15785
- return { groups, total };
16577
+ return this.cachedList(
16578
+ "globalSearch",
16579
+ "grouped",
16580
+ { query: query.trim(), ...options },
16581
+ () => this.adapter.objectRecords.globalSearchGrouped(query.trim(), {
16582
+ objectNames: _optionalChain([options, 'optionalAccess', _376 => _376.objectNames]),
16583
+ limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _377 => _377.limitPerGroup]), () => ( 5))
16584
+ })
16585
+ );
15786
16586
  }
15787
16587
  };
15788
16588
 
@@ -15797,7 +16597,7 @@ var PermissionService = class extends BaseService {
15797
16597
  }
15798
16598
  this.permissionsRepo = adapter.permissions;
15799
16599
  this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
15800
- this.auditService = _optionalChain([options, 'optionalAccess', _370 => _370.auditService]);
16600
+ this.auditService = _optionalChain([options, 'optionalAccess', _378 => _378.auditService]);
15801
16601
  }
15802
16602
  // ============================================================================
15803
16603
  // PERMISSION CHECKS
@@ -15816,11 +16616,11 @@ var PermissionService = class extends BaseService {
15816
16616
  return true;
15817
16617
  }
15818
16618
  const wildcardPerms = permissions.objectPermissions["*"];
15819
- if (_optionalChain([wildcardPerms, 'optionalAccess', _371 => _371.includes, 'call', _372 => _372(action)])) {
16619
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _379 => _379.includes, 'call', _380 => _380(action)])) {
15820
16620
  return true;
15821
16621
  }
15822
16622
  const objectPerms = permissions.objectPermissions[objectName];
15823
- return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _373 => _373.includes, 'call', _374 => _374(action)]), () => ( false));
16623
+ return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _381 => _381.includes, 'call', _382 => _382(action)]), () => ( false));
15824
16624
  }
15825
16625
  /**
15826
16626
  * Check if user can access an object, throw ForbiddenError if not.
@@ -15875,12 +16675,12 @@ var PermissionService = class extends BaseService {
15875
16675
  if (permissions.isAdmin) {
15876
16676
  return true;
15877
16677
  }
15878
- const wildcardPerms = _optionalChain([permissions, 'access', _375 => _375.systemPermissions, 'optionalAccess', _376 => _376["*"]]);
15879
- if (_optionalChain([wildcardPerms, 'optionalAccess', _377 => _377.includes, 'call', _378 => _378(action)])) {
16678
+ const wildcardPerms = _optionalChain([permissions, 'access', _383 => _383.systemPermissions, 'optionalAccess', _384 => _384["*"]]);
16679
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _385 => _385.includes, 'call', _386 => _386(action)])) {
15880
16680
  return true;
15881
16681
  }
15882
- const resourcePerms = _optionalChain([permissions, 'access', _379 => _379.systemPermissions, 'optionalAccess', _380 => _380[resource]]);
15883
- return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _381 => _381.includes, 'call', _382 => _382(action)]), () => ( false));
16682
+ const resourcePerms = _optionalChain([permissions, 'access', _387 => _387.systemPermissions, 'optionalAccess', _388 => _388[resource]]);
16683
+ return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _389 => _389.includes, 'call', _390 => _390(action)]), () => ( false));
15884
16684
  }
15885
16685
  /**
15886
16686
  * Check if user can access a system resource, throw ForbiddenError if not.
@@ -15909,8 +16709,8 @@ var PermissionService = class extends BaseService {
15909
16709
  if (permissions.isAdmin) {
15910
16710
  return { canRead: true, canCreate: true, canUpdate: true, canDelete: true };
15911
16711
  }
15912
- const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _383 => _383.systemPermissions, 'optionalAccess', _384 => _384["*"]]), () => ( []));
15913
- const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _385 => _385.systemPermissions, 'optionalAccess', _386 => _386[resource]]), () => ( []));
16712
+ const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _391 => _391.systemPermissions, 'optionalAccess', _392 => _392["*"]]), () => ( []));
16713
+ const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _393 => _393.systemPermissions, 'optionalAccess', _394 => _394[resource]]), () => ( []));
15914
16714
  const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
15915
16715
  return {
15916
16716
  canRead: allPerms.has("read"),
@@ -16053,7 +16853,7 @@ var PermissionService = class extends BaseService {
16053
16853
  action: "role.updated",
16054
16854
  actorId: this.userId,
16055
16855
  roleId,
16056
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _387 => _387.label]), () => ( roleId)),
16856
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _395 => _395.label]), () => ( roleId)),
16057
16857
  metadata: { permissionsUpdated: true, permissionCount: permissions.length }
16058
16858
  });
16059
16859
  }
@@ -16083,7 +16883,7 @@ var PermissionService = class extends BaseService {
16083
16883
  action: "role.assigned",
16084
16884
  actorId: this.userId,
16085
16885
  roleId,
16086
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _388 => _388.label]), () => ( roleId)),
16886
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _396 => _396.label]), () => ( roleId)),
16087
16887
  targetUserId: userProfileId
16088
16888
  });
16089
16889
  }
@@ -16101,7 +16901,7 @@ var PermissionService = class extends BaseService {
16101
16901
  action: "role.revoked",
16102
16902
  actorId: this.userId,
16103
16903
  roleId,
16104
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _389 => _389.label]), () => ( roleId)),
16904
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _397 => _397.label]), () => ( roleId)),
16105
16905
  targetUserId: userProfileId
16106
16906
  });
16107
16907
  }
@@ -16577,7 +17377,7 @@ var ViewService = class extends BaseService {
16577
17377
  dbView.objectName,
16578
17378
  dbView.type,
16579
17379
  objectDefinition,
16580
- dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _390 => _390.config, 'optionalAccess', _391 => _391.layout]), () => ( "page")) : void 0
17380
+ dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _398 => _398.config, 'optionalAccess', _399 => _399.layout]), () => ( "page")) : void 0
16581
17381
  );
16582
17382
  const newConfig = generated.config;
16583
17383
  const updated = await this.adapter.views.update(viewId, { config: newConfig });
@@ -17443,4 +18243,22 @@ var NoopGeocodingAdapter = class {
17443
18243
 
17444
18244
 
17445
18245
 
17446
- 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.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.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.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;
18246
+
18247
+
18248
+
18249
+
18250
+
18251
+
18252
+
18253
+
18254
+
18255
+
18256
+
18257
+
18258
+
18259
+
18260
+
18261
+
18262
+
18263
+
18264
+ 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;