@stndrds/schema 0.1.0-alpha.51 → 0.1.0-alpha.53

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.
@@ -473,7 +473,26 @@ var cacheKeys = {
473
473
  // Invalidation Patterns (global)
474
474
  // -------------------------------------------------------------------------
475
475
  /** All cache for a tenant (nuclear option) */
476
- allForTenant: (tenantId) => `*:${tenantId}:*`
476
+ allForTenant: (tenantId) => `*:${tenantId}:*`,
477
+ // -------------------------------------------------------------------------
478
+ // Shared Resources - No tenant scoping
479
+ // -------------------------------------------------------------------------
480
+ /** Object schema for shared object (not tenant-scoped) */
481
+ sharedObjectSchema: (objectId) => `shared:schema:obj:${objectId}`,
482
+ /** Object schema for shared object by name */
483
+ sharedObjectSchemaByName: (name) => `shared:schema:name:${name}`,
484
+ /** Attributes for a shared object */
485
+ sharedObjectAttributes: (objectId) => `shared:attrs:${objectId}`,
486
+ /** Record from a shared object */
487
+ sharedRecord: (recordId) => `shared:record:${recordId}`,
488
+ /** Record list for a shared object */
489
+ sharedRecordList: (objectId, hash) => `shared:records:${objectId}:list:${hash}`,
490
+ /** All shared record lists for an object (for invalidation) */
491
+ allSharedRecordLists: (objectId) => `shared:records:${objectId}:list:*`,
492
+ /** All shared schemas (for invalidation) */
493
+ allSharedSchemas: () => "shared:schema:*",
494
+ /** All shared records (for invalidation) */
495
+ allSharedRecords: () => "shared:record:*"
477
496
  };
478
497
  var cacheTtl = {
479
498
  /** Object schemas - rarely change (1 hour) */
@@ -2885,6 +2904,7 @@ function createMockObjectsRepository(stores) {
2885
2904
  icon: data.icon,
2886
2905
  labelExpression: data.labelExpression,
2887
2906
  system: _nullishCoalesce(data.system, () => ( false)),
2907
+ sharingMode: _nullishCoalesce(data.sharingMode, () => ( "private")),
2888
2908
  metadata: data.metadata,
2889
2909
  createdAt: /* @__PURE__ */ new Date(),
2890
2910
  updatedAt: /* @__PURE__ */ new Date()
@@ -2943,6 +2963,7 @@ function createMockObjectsRepository(stores) {
2943
2963
  icon: data.icon,
2944
2964
  labelExpression: data.labelExpression,
2945
2965
  system: data.system,
2966
+ sharingMode: data.sharingMode,
2946
2967
  metadata: data.metadata,
2947
2968
  createdAt: /* @__PURE__ */ new Date(),
2948
2969
  updatedAt: /* @__PURE__ */ new Date()
@@ -5692,6 +5713,7 @@ function rollup(config) {
5692
5713
 
5693
5714
  var ObjectBuilder = class {
5694
5715
  constructor(config) {
5716
+ this._sharingMode = "private";
5695
5717
  this.validateName(config.name);
5696
5718
  this.obj = {
5697
5719
  name: config.name,
@@ -5730,6 +5752,29 @@ var ObjectBuilder = class {
5730
5752
  this.obj.system = true;
5731
5753
  return this;
5732
5754
  }
5755
+ /**
5756
+ * Mark this object as shared across all tenants.
5757
+ *
5758
+ * Shared objects are:
5759
+ * - Readable by all tenants
5760
+ * - Only writable by the owner tenant (tenant_id)
5761
+ * - Only syncable by the master tenant (requires masterTenantId in config)
5762
+ *
5763
+ * Records belonging to a shared object inherit the sharing mode.
5764
+ *
5765
+ * @example
5766
+ * ```typescript
5767
+ * const PRODUCT_CATALOG = object({ name: "product-catalog", label: "Product Catalog" })
5768
+ * .shared() // All tenants can read, only master can write
5769
+ * .system()
5770
+ * .labelExpression("{{ name }}")
5771
+ * .attribute(text({ name: "name", label: "Name" }).required());
5772
+ * ```
5773
+ */
5774
+ shared() {
5775
+ this._sharingMode = "shared";
5776
+ return this;
5777
+ }
5733
5778
  /**
5734
5779
  * Add an attribute to the object with type accumulation
5735
5780
  *
@@ -5810,7 +5855,8 @@ The labelExpression defines how records are displayed in lists and relations.
5810
5855
  return {
5811
5856
  ...this.obj,
5812
5857
  pluralLabel: this._pluralLabel,
5813
- labelExpression: this._labelExpression
5858
+ labelExpression: this._labelExpression,
5859
+ sharingMode: this._sharingMode
5814
5860
  };
5815
5861
  }
5816
5862
  /**
@@ -7543,17 +7589,8 @@ function createRollupValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
7543
7589
  function createTextAreaValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
7544
7590
  return _zod.z.string();
7545
7591
  }
7546
- var blockNoteBlockSchema = _zod.z.lazy(
7547
- () => _zod.z.object({
7548
- id: _zod.z.string().min(1, "Block must have an id"),
7549
- type: _zod.z.string().min(1, "Block must have a type"),
7550
- props: _zod.z.record(_zod.z.string(), _zod.z.union([_zod.z.boolean(), _zod.z.number(), _zod.z.string()])),
7551
- content: _zod.z.any().optional(),
7552
- children: _zod.z.array(_zod.z.any())
7553
- })
7554
- );
7555
7592
  function createRichtextValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
7556
- return _zod.z.array(blockNoteBlockSchema, {
7593
+ return _zod.z.string({
7557
7594
  message: messages.invalidRichtext(attr)
7558
7595
  });
7559
7596
  }
@@ -8239,6 +8276,25 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
8239
8276
  const dbObjects = await this.adapter.objects.list();
8240
8277
  return Promise.all(dbObjects.map((dbObject) => this.buildObjectDefinition(dbObject)));
8241
8278
  }
8279
+ /**
8280
+ * Get object ownership info for write access checks.
8281
+ *
8282
+ * Used by RecordService to verify if the current tenant can write
8283
+ * to a shared object's records.
8284
+ *
8285
+ * @param objectId - Object UUID
8286
+ * @returns Object ownership info with tenantId and sharingMode
8287
+ */
8288
+ async getObjectOwnerInfo(objectId) {
8289
+ const dbObject = await this.adapter.objects.findById(objectId);
8290
+ if (!dbObject) {
8291
+ throw new Error(`Object with id "${objectId}" not found`);
8292
+ }
8293
+ return {
8294
+ tenantId: dbObject.tenantId,
8295
+ sharingMode: dbObject.sharingMode
8296
+ };
8297
+ }
8242
8298
  /**
8243
8299
  * Invalidate all schema-related cache for the current tenant.
8244
8300
  * Called automatically after schema mutations.
@@ -9228,6 +9284,15 @@ function checkRecordDeleteOrThrow(policy, record, context) {
9228
9284
  throw new PolicyViolationError(policy.objectName, "delete", record.id);
9229
9285
  }
9230
9286
  }
9287
+ function checkSharedObjectWriteAccess(objectName, sharingMode, objectOwnerTenantId, currentTenantId) {
9288
+ if (sharingMode === "shared" && objectOwnerTenantId !== currentTenantId) {
9289
+ throw new SchemaError(
9290
+ `Cannot modify shared object "${objectName}". Shared objects are read-only for non-owner tenants.`,
9291
+ SchemaErrorCode.FORBIDDEN,
9292
+ { objectName, ownerTenantId: objectOwnerTenantId, currentTenantId }
9293
+ );
9294
+ }
9295
+ }
9231
9296
 
9232
9297
  // src/runtime/services/record/helpers/label.ts
9233
9298
  function extractRelationIds2(val) {
@@ -9596,12 +9661,105 @@ var RecordQueryService = class extends BaseService {
9596
9661
  }
9597
9662
  };
9598
9663
 
9664
+ // src/runtime/services/record/record-resolver.service.ts
9665
+ var RecordResolverService = class extends BaseService {
9666
+ constructor(adapter) {
9667
+ super(adapter);
9668
+ }
9669
+ // ============================================================================
9670
+ // CACHED RECORD ACCESS
9671
+ // ============================================================================
9672
+ /**
9673
+ * Find a record by ID with caching.
9674
+ *
9675
+ * Uses the shared record cache for optimal performance.
9676
+ * Delegates to findByIds for consistent cache handling.
9677
+ *
9678
+ * @param id - Record ID
9679
+ * @returns Record or null if not found
9680
+ */
9681
+ async findById(id) {
9682
+ if (!id) return null;
9683
+ const results = await this.findByIds([id]);
9684
+ return _nullishCoalesce(results[0], () => ( null));
9685
+ }
9686
+ /**
9687
+ * Find multiple records by IDs with caching.
9688
+ *
9689
+ * Each record is cached individually for reuse across services.
9690
+ * Only fetches records not already in cache.
9691
+ *
9692
+ * @param ids - Record IDs to fetch
9693
+ * @returns Array of found records (missing IDs are not included)
9694
+ */
9695
+ async findByIds(ids) {
9696
+ if (!ids || ids.length === 0) {
9697
+ return [];
9698
+ }
9699
+ const uniqueIds = [...new Set(ids)];
9700
+ return this.cachedByMany(
9701
+ "record",
9702
+ uniqueIds,
9703
+ (missingIds) => this.adapter.objectRecords.findByIds(missingIds),
9704
+ (record) => record.id,
9705
+ cacheTtl.records
9706
+ );
9707
+ }
9708
+ // ============================================================================
9709
+ // FACTORY METHODS
9710
+ // ============================================================================
9711
+ /**
9712
+ * Create a RelationLabelResolver callback for computeLabelWithRelations.
9713
+ *
9714
+ * Used by RelationService.resolveLabel() and ObjectSchemaService.
9715
+ *
9716
+ * @returns Callback that resolves record IDs to their labels (cached)
9717
+ */
9718
+ createRelationLabelResolver() {
9719
+ return async (ids) => {
9720
+ const records = await this.findByIds(ids);
9721
+ return new Map(records.map((r) => [r.id, r.label]));
9722
+ };
9723
+ }
9724
+ /**
9725
+ * Create a LabelResolver interface for label computation helpers.
9726
+ *
9727
+ * Used by RecordService for computing record labels.
9728
+ *
9729
+ * @param relationService - RelationService for resolving relation display labels
9730
+ * @returns LabelResolver interface with cached record fetching
9731
+ */
9732
+ createLabelResolver(relationService) {
9733
+ return {
9734
+ resolveRelationIds: (ids, attrId) => relationService.resolveIds(ids, attrId),
9735
+ findRecordLabels: (ids) => this.findByIds(ids)
9736
+ };
9737
+ }
9738
+ /**
9739
+ * Create a RollupCascadeContext for rollup recalculation.
9740
+ *
9741
+ * Used by RecordService after create/update/delete operations.
9742
+ *
9743
+ * @param rollupService - RollupService for recalculating rollups
9744
+ * @param schemaService - ObjectSchemaService for fetching schemas
9745
+ * @returns Context with cached record fetching
9746
+ */
9747
+ createRollupContext(rollupService, schemaService) {
9748
+ return {
9749
+ rollupService,
9750
+ schemaService,
9751
+ findRecordsByIds: (ids) => this.findByIds(ids)
9752
+ };
9753
+ }
9754
+ };
9755
+
9599
9756
  // src/runtime/services/record/relation.service.ts
9600
9757
  var RelationService = class extends BaseService {
9601
9758
  constructor(adapter, nativeRegistry, options) {
9602
9759
  super(adapter);
9603
9760
  this.schemaService = new ObjectSchemaService(adapter, nativeRegistry);
9604
- this.queryService = _optionalChain([options, 'optionalAccess', _222 => _222.queryService]);
9761
+ this.queryService = options.queryService;
9762
+ this.recordResolver = options.recordResolver;
9605
9763
  }
9606
9764
  /**
9607
9765
  * Set the query service after construction.
@@ -9672,14 +9830,14 @@ var RelationService = class extends BaseService {
9672
9830
  }
9673
9831
  const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
9674
9832
  const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
9675
- if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _223 => _223.size]) === 0) {
9833
+ if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _222 => _222.size]) === 0) {
9676
9834
  errors.push({
9677
9835
  attribute: attr.name,
9678
9836
  message: `No valid target objects found for ${attr.label}`
9679
9837
  });
9680
9838
  return errors;
9681
9839
  }
9682
- const records = await this.adapter.objectRecords.findByIds(ids);
9840
+ const records = await this.recordResolver.findByIds(ids);
9683
9841
  const recordMap = new Map(records.map((r) => [r.id, r]));
9684
9842
  const invalidIds = [];
9685
9843
  for (const id of ids) {
@@ -9725,7 +9883,7 @@ var RelationService = class extends BaseService {
9725
9883
  for (const target of targets) {
9726
9884
  try {
9727
9885
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
9728
- if (_optionalChain([objectSchema, 'optionalAccess', _224 => _224.id])) {
9886
+ if (_optionalChain([objectSchema, 'optionalAccess', _223 => _223.id])) {
9729
9887
  objectIds.add(objectSchema.id);
9730
9888
  }
9731
9889
  } catch (e11) {
@@ -9789,7 +9947,7 @@ var RelationService = class extends BaseService {
9789
9947
  let totalCount = 0;
9790
9948
  for (const target of filteredTargets) {
9791
9949
  const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
9792
- if (!_optionalChain([objectSchema, 'optionalAccess', _225 => _225.id])) {
9950
+ if (!_optionalChain([objectSchema, 'optionalAccess', _224 => _224.id])) {
9793
9951
  continue;
9794
9952
  }
9795
9953
  const queryOptions = {
@@ -9801,20 +9959,7 @@ var RelationService = class extends BaseService {
9801
9959
  const result = query ? await queryService.searchRecords(objectSchema.id, query, queryOptions) : await queryService.listRecords(objectSchema.id, queryOptions);
9802
9960
  totalCount += result.total;
9803
9961
  for (const record of result.records) {
9804
- let label;
9805
- if (target.displayTemplate) {
9806
- label = await computeLabelWithRelations(
9807
- target.displayTemplate,
9808
- record.values,
9809
- objectSchema.attributes,
9810
- async (ids) => {
9811
- const linkedRecords = await this.adapter.objectRecords.findByIds(ids);
9812
- return new Map(linkedRecords.map((r) => [r.id, r.label]));
9813
- }
9814
- );
9815
- } else {
9816
- label = record.label;
9817
- }
9962
+ const label = await this.resolveLabel(record, objectSchema, target.displayTemplate);
9818
9963
  allOptions.push({
9819
9964
  id: record.id,
9820
9965
  objectId: objectSchema.id,
@@ -9852,17 +9997,8 @@ var RelationService = class extends BaseService {
9852
9997
  if (!ids || ids.length === 0) {
9853
9998
  return [];
9854
9999
  }
9855
- const compositeIds = ids.map((id) => `${attributeId}:${id}`);
9856
- return this.cachedByMany(
9857
- "resolvedRelation",
9858
- compositeIds,
9859
- async (missingCompositeIds) => {
9860
- const missingRecordIds = missingCompositeIds.map((c) => c.split(":")[1]);
9861
- return this.fetchResolveIds(missingRecordIds, attributeId);
9862
- },
9863
- (item) => `${attributeId}:${item.id}`,
9864
- cacheTtl.resolvedRelations
9865
- );
10000
+ const result = await this.resolveIdsBatch([{ attributeId, ids }]);
10001
+ return _nullishCoalesce(result[attributeId], () => ( []));
9866
10002
  }
9867
10003
  /**
9868
10004
  * Resolve multiple attribute/IDs batches in a single operation.
@@ -9905,7 +10041,7 @@ var RelationService = class extends BaseService {
9905
10041
  const allResolved = await this.cachedByMany(
9906
10042
  "resolvedRelation",
9907
10043
  allCompositeIds,
9908
- (missingCompositeIds) => this.fetchResolveIdsBatch(missingCompositeIds),
10044
+ (missingCompositeIds) => this.resolveCompositeIds(missingCompositeIds),
9909
10045
  (item) => item._compositeId,
9910
10046
  cacheTtl.resolvedRelations
9911
10047
  );
@@ -9926,10 +10062,12 @@ var RelationService = class extends BaseService {
9926
10062
  return response;
9927
10063
  }
9928
10064
  /**
9929
- * Internal method to fetch and resolve multiple composite IDs at once.
10065
+ * Internal method to resolve multiple composite IDs at once.
9930
10066
  * Optimized for batch operations - single DB query for all records.
10067
+ *
10068
+ * @param compositeIds - Array of composite IDs in format "attributeId:recordId"
9931
10069
  */
9932
- async fetchResolveIdsBatch(compositeIds) {
10070
+ async resolveCompositeIds(compositeIds) {
9933
10071
  if (compositeIds.length === 0) {
9934
10072
  return [];
9935
10073
  }
@@ -9939,7 +10077,7 @@ var RelationService = class extends BaseService {
9939
10077
  });
9940
10078
  const uniqueRecordIds = [...new Set(parsed.map((p) => p.recordId))];
9941
10079
  const uniqueAttributeIds = [...new Set(parsed.map((p) => p.attributeId))];
9942
- const records = await this.adapter.objectRecords.findByIds(uniqueRecordIds);
10080
+ const records = await this.recordResolver.findByIds(uniqueRecordIds);
9943
10081
  if (records.length === 0) {
9944
10082
  return [];
9945
10083
  }
@@ -9962,22 +10100,9 @@ var RelationService = class extends BaseService {
9962
10100
  continue;
9963
10101
  }
9964
10102
  const attribute = attributeMap.get(attributeId);
9965
- const targetConfig = _optionalChain([attribute, 'optionalAccess', _226 => _226.targets, 'optionalAccess', _227 => _227.find, 'call', _228 => _228((t) => t.object === objectSchema.name)]);
9966
- const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _229 => _229.displayTemplate]);
9967
- let label;
9968
- if (customTemplate) {
9969
- label = await computeLabelWithRelations(
9970
- customTemplate,
9971
- record.values,
9972
- objectSchema.attributes,
9973
- async (nestedIds) => {
9974
- const linkedRecords = await this.adapter.objectRecords.findByIds(nestedIds);
9975
- return new Map(linkedRecords.map((r) => [r.id, r.label]));
9976
- }
9977
- );
9978
- } else {
9979
- label = record.label;
9980
- }
10103
+ const targetConfig = _optionalChain([attribute, 'optionalAccess', _225 => _225.targets, 'optionalAccess', _226 => _226.find, 'call', _227 => _227((t) => t.object === objectSchema.name)]);
10104
+ const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _228 => _228.displayTemplate]);
10105
+ const label = await this.resolveLabel(record, objectSchema, customTemplate);
9981
10106
  resolved.push({
9982
10107
  _compositeId: compositeId,
9983
10108
  id: record.id,
@@ -9991,59 +10116,22 @@ var RelationService = class extends BaseService {
9991
10116
  return resolved;
9992
10117
  }
9993
10118
  /**
9994
- * Internal method to fetch and resolve relation IDs (no caching).
9995
- * Uses batch fetching for performance - fetches all records in one query,
9996
- * then groups by objectId to minimize schema lookups.
10119
+ * Resolve the display label for a record.
10120
+ * Uses custom template if provided, otherwise falls back to pre-computed label.
9997
10121
  */
9998
- async fetchResolveIds(ids, attributeId) {
9999
- if (ids.length === 0) {
10000
- return [];
10001
- }
10002
- const attribute = await this.findAttributeById(attributeId);
10003
- const records = await this.adapter.objectRecords.findByIds(ids);
10004
- if (records.length === 0) {
10005
- return [];
10006
- }
10007
- const recordsByObjectId = /* @__PURE__ */ new Map();
10008
- for (const record of records) {
10009
- const existing = _nullishCoalesce(recordsByObjectId.get(record.objectId), () => ( []));
10010
- existing.push(record);
10011
- recordsByObjectId.set(record.objectId, existing);
10012
- }
10013
- const resolved = [];
10014
- for (const [objectId, objectRecords] of recordsByObjectId) {
10015
- const objectSchema = await this.schemaService.getObjectSchema(objectId);
10016
- if (!objectSchema) {
10017
- continue;
10018
- }
10019
- const targetConfig = _optionalChain([attribute, 'optionalAccess', _230 => _230.targets, 'optionalAccess', _231 => _231.find, 'call', _232 => _232((t) => t.object === objectSchema.name)]);
10020
- const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _233 => _233.displayTemplate]);
10021
- for (const record of objectRecords) {
10022
- let label;
10023
- if (customTemplate) {
10024
- label = await computeLabelWithRelations(
10025
- customTemplate,
10026
- record.values,
10027
- objectSchema.attributes,
10028
- async (nestedIds) => {
10029
- const linkedRecords = await this.adapter.objectRecords.findByIds(nestedIds);
10030
- return new Map(linkedRecords.map((r) => [r.id, r.label]));
10031
- }
10032
- );
10033
- } else {
10034
- label = record.label;
10122
+ async resolveLabel(record, objectSchema, customTemplate) {
10123
+ if (customTemplate) {
10124
+ return computeLabelWithRelations(
10125
+ customTemplate,
10126
+ record.values,
10127
+ objectSchema.attributes,
10128
+ async (nestedIds) => {
10129
+ const linkedRecords = await this.recordResolver.findByIds(nestedIds);
10130
+ return new Map(linkedRecords.map((r) => [r.id, r.label]));
10035
10131
  }
10036
- resolved.push({
10037
- id: record.id,
10038
- objectId: record.objectId,
10039
- objectName: objectSchema.name,
10040
- objectLabel: objectSchema.label,
10041
- objectIcon: objectSchema.icon,
10042
- label
10043
- });
10044
- }
10132
+ );
10045
10133
  }
10046
- return resolved;
10134
+ return record.label;
10047
10135
  }
10048
10136
  /**
10049
10137
  * Find a relation attribute by ID.
@@ -10074,8 +10162,9 @@ var RelationService = class extends BaseService {
10074
10162
 
10075
10163
  // src/runtime/services/record/rollup.service.ts
10076
10164
  var RollupService = class extends BaseService {
10077
- constructor(adapter) {
10165
+ constructor(adapter, options) {
10078
10166
  super(adapter);
10167
+ this.recordResolver = options.recordResolver;
10079
10168
  }
10080
10169
  /**
10081
10170
  * Calculate a rollup value for a record
@@ -10129,7 +10218,7 @@ var RollupService = class extends BaseService {
10129
10218
  * Example: entreprise222 has relation "entreprises" → companies, rollup collects from companies
10130
10219
  */
10131
10220
  async calculateForward(recordId, rollupAttr) {
10132
- const record = await this.adapter.objectRecords.findById(recordId);
10221
+ const record = await this.recordResolver.findById(recordId);
10133
10222
  if (!record) {
10134
10223
  return { value: null, recordCount: 0 };
10135
10224
  }
@@ -10143,7 +10232,7 @@ var RollupService = class extends BaseService {
10143
10232
  if (relatedIds.length === 0) {
10144
10233
  return { value: this.getEmptyValue(rollupAttr.function), recordCount: 0 };
10145
10234
  }
10146
- const relatedRecords = await this.adapter.objectRecords.findByIds(relatedIds);
10235
+ const relatedRecords = await this.recordResolver.findByIds(relatedIds);
10147
10236
  if (relatedRecords.length === 0) {
10148
10237
  return { value: this.getEmptyValue(rollupAttr.function), recordCount: 0 };
10149
10238
  }
@@ -10154,7 +10243,7 @@ var RollupService = class extends BaseService {
10154
10243
  * Example: Company has rollup on "orders", Order has relation "company" → companies
10155
10244
  */
10156
10245
  async calculateReverse(recordId, rollupAttr, schema) {
10157
- const record = await this.adapter.objectRecords.findById(recordId);
10246
+ const record = await this.recordResolver.findById(recordId);
10158
10247
  if (!record) {
10159
10248
  return { value: null, recordCount: 0 };
10160
10249
  }
@@ -10162,14 +10251,14 @@ var RollupService = class extends BaseService {
10162
10251
  const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
10163
10252
  let sourceObjectId;
10164
10253
  let reverseRelationAttrName;
10165
- if (_optionalChain([sourceSchema, 'optionalAccess', _234 => _234.id])) {
10254
+ if (_optionalChain([sourceSchema, 'optionalAccess', _229 => _229.id])) {
10166
10255
  sourceObjectId = sourceSchema.id;
10167
10256
  const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
10168
10257
  if (attr.type !== "relation") return false;
10169
10258
  const relationConfig = attr;
10170
- return _optionalChain([relationConfig, 'optionalAccess', _235 => _235.targets, 'optionalAccess', _236 => _236.some, 'call', _237 => _237((t) => t.object === schema.name)]);
10259
+ return _optionalChain([relationConfig, 'optionalAccess', _230 => _230.targets, 'optionalAccess', _231 => _231.some, 'call', _232 => _232((t) => t.object === schema.name)]);
10171
10260
  });
10172
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _238 => _238.name]);
10261
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _233 => _233.name]);
10173
10262
  } else {
10174
10263
  const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
10175
10264
  if (!sourceObject) {
@@ -10180,9 +10269,9 @@ var RollupService = class extends BaseService {
10180
10269
  const reverseRelationAttr = sourceAttributes.find((attr) => {
10181
10270
  if (attr.type !== "relation") return false;
10182
10271
  const relationConfig = attr.config;
10183
- return _optionalChain([relationConfig, 'optionalAccess', _239 => _239.targets, 'optionalAccess', _240 => _240.some, 'call', _241 => _241((t) => t.object === schema.name)]);
10272
+ return _optionalChain([relationConfig, 'optionalAccess', _234 => _234.targets, 'optionalAccess', _235 => _235.some, 'call', _236 => _236((t) => t.object === schema.name)]);
10184
10273
  });
10185
- reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _242 => _242.name]);
10274
+ reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _237 => _237.name]);
10186
10275
  }
10187
10276
  if (!reverseRelationAttrName) {
10188
10277
  return { value: null, recordCount: 0 };
@@ -10419,7 +10508,7 @@ var RollupService = class extends BaseService {
10419
10508
  }
10420
10509
  for (const rollupDbAttr of rollupAttrs) {
10421
10510
  const rollupConfig = rollupDbAttr.config;
10422
- if (!_optionalChain([rollupConfig, 'optionalAccess', _243 => _243.relationAttribute])) {
10511
+ if (!_optionalChain([rollupConfig, 'optionalAccess', _238 => _238.relationAttribute])) {
10423
10512
  continue;
10424
10513
  }
10425
10514
  const relationAttr = attributes.find(
@@ -10429,7 +10518,7 @@ var RollupService = class extends BaseService {
10429
10518
  continue;
10430
10519
  }
10431
10520
  const relationConfig = relationAttr.config;
10432
- const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _244 => _244.targets, 'optionalAccess', _245 => _245.some, 'call', _246 => _246(
10521
+ const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _239 => _239.targets, 'optionalAccess', _240 => _240.some, 'call', _241 => _241(
10433
10522
  (t) => t.object === changedSchema.name
10434
10523
  )]);
10435
10524
  if (!targetsChangedObject) {
@@ -10456,30 +10545,30 @@ var RecordService = class extends BaseService {
10456
10545
  constructor(adapter, options) {
10457
10546
  super(adapter);
10458
10547
  this.schemaService = new ObjectSchemaService(adapter, registry, {
10459
- auditService: _optionalChain([options, 'optionalAccess', _247 => _247.auditService])
10548
+ auditService: _optionalChain([options, 'optionalAccess', _242 => _242.auditService])
10460
10549
  });
10461
- this.permissionService = _optionalChain([options, 'optionalAccess', _248 => _248.permissionService]);
10462
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _249 => _249.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
10463
- this.policyRegistry = _optionalChain([options, 'optionalAccess', _250 => _250.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _251 => _251.policyRegistry]), () => ( defaultPolicyRegistry));
10550
+ this.permissionService = _optionalChain([options, 'optionalAccess', _243 => _243.permissionService]);
10551
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _244 => _244.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
10552
+ this.policyRegistry = _optionalChain([options, 'optionalAccess', _245 => _245.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _246 => _246.policyRegistry]), () => ( defaultPolicyRegistry));
10553
+ this.recordResolver = new RecordResolverService(adapter);
10464
10554
  this.queryService = new RecordQueryService(adapter, this.schemaService, {
10465
10555
  permissionService: this.permissionService,
10466
10556
  policyRegistry: this.policyRegistry
10467
10557
  });
10468
10558
  this.relationService = new RelationService(adapter, registry, {
10469
- queryService: this.queryService
10559
+ queryService: this.queryService,
10560
+ recordResolver: this.recordResolver
10561
+ });
10562
+ this.rollupService = new RollupService(adapter, {
10563
+ recordResolver: this.recordResolver
10470
10564
  });
10471
10565
  this.userService = new UserService(adapter);
10472
- this.rollupService = new RollupService(adapter);
10473
- this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _252 => _252.hookRegistry]), () => ( new NoopHookRegistry()));
10474
- this.labelResolver = {
10475
- resolveRelationIds: (ids, attrId) => this.relationService.resolveIds(ids, attrId),
10476
- findRecordLabels: (ids) => this.adapter.objectRecords.findByIds(ids)
10477
- };
10478
- this.rollupContext = {
10479
- rollupService: this.rollupService,
10480
- schemaService: this.schemaService,
10481
- findRecordsByIds: (ids) => this.adapter.objectRecords.findByIds(ids)
10482
- };
10566
+ this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _247 => _247.hookRegistry]), () => ( new NoopHookRegistry()));
10567
+ this.labelResolver = this.recordResolver.createLabelResolver(this.relationService);
10568
+ this.rollupContext = this.recordResolver.createRollupContext(
10569
+ this.rollupService,
10570
+ this.schemaService
10571
+ );
10483
10572
  }
10484
10573
  // ============================================================================
10485
10574
  // CREATE
@@ -10496,27 +10585,34 @@ var RecordService = class extends BaseService {
10496
10585
  */
10497
10586
  async createRecord(objectId, data, options) {
10498
10587
  const schema = await this.schemaService.getObjectSchema(objectId);
10588
+ const ownerInfo = await this.schemaService.getObjectOwnerInfo(objectId);
10589
+ checkSharedObjectWriteAccess(
10590
+ schema.name,
10591
+ ownerInfo.sharingMode,
10592
+ ownerInfo.tenantId,
10593
+ this.tenantId
10594
+ );
10499
10595
  const dataWithDefaults = applyDefaultValues(schema, data);
10500
10596
  await checkPermission(this.permissionService, this.userId, schema.name, "create");
10501
10597
  const hookCtx = createContextForCreate(
10502
10598
  schema,
10503
10599
  this.tenantId,
10504
10600
  dataWithDefaults,
10505
- _optionalChain([options, 'optionalAccess', _253 => _253.hookMetadata])
10601
+ _optionalChain([options, 'optionalAccess', _248 => _248.hookMetadata])
10506
10602
  );
10507
- if (!_optionalChain([options, 'optionalAccess', _254 => _254.skipHooks])) {
10603
+ if (!_optionalChain([options, 'optionalAccess', _249 => _249.skipHooks])) {
10508
10604
  await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
10509
10605
  }
10510
- if (_optionalChain([options, 'optionalAccess', _255 => _255.validate]) !== false) {
10511
- if (_optionalChain([options, 'optionalAccess', _256 => _256.allowDraft])) {
10606
+ if (_optionalChain([options, 'optionalAccess', _250 => _250.validate]) !== false) {
10607
+ if (_optionalChain([options, 'optionalAccess', _251 => _251.allowDraft])) {
10512
10608
  validateDraftOrThrow(schema, dataWithDefaults);
10513
10609
  } else {
10514
10610
  validateObjectOrThrow(schema, dataWithDefaults);
10515
10611
  }
10516
- if (!_optionalChain([options, 'optionalAccess', _257 => _257.skipRelationValidation])) {
10612
+ if (!_optionalChain([options, 'optionalAccess', _252 => _252.skipRelationValidation])) {
10517
10613
  await this.relationService.validateRelationsOrThrow(schema, dataWithDefaults);
10518
10614
  }
10519
- if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipUserValidation])) {
10615
+ if (!_optionalChain([options, 'optionalAccess', _253 => _253.skipUserValidation])) {
10520
10616
  await this.userService.validateUsersOrThrow(schema, dataWithDefaults);
10521
10617
  }
10522
10618
  }
@@ -10527,10 +10623,10 @@ var RecordService = class extends BaseService {
10527
10623
  data: dataWithDefaults,
10528
10624
  label,
10529
10625
  completionStatus,
10530
- metadata: _optionalChain([options, 'optionalAccess', _259 => _259.metadata]),
10626
+ metadata: _optionalChain([options, 'optionalAccess', _254 => _254.metadata]),
10531
10627
  createdBy: this.userId
10532
10628
  });
10533
- if (!_optionalChain([options, 'optionalAccess', _260 => _260.skipHooks])) {
10629
+ if (!_optionalChain([options, 'optionalAccess', _255 => _255.skipHooks])) {
10534
10630
  const afterCtx = {
10535
10631
  ...hookCtx,
10536
10632
  recordId: record.id,
@@ -10550,7 +10646,7 @@ var RecordService = class extends BaseService {
10550
10646
  objectId: schema.id,
10551
10647
  recordId: record.id,
10552
10648
  recordLabel: record.label,
10553
- metadata: _optionalChain([options, 'optionalAccess', _261 => _261.hookMetadata])
10649
+ metadata: _optionalChain([options, 'optionalAccess', _256 => _256.hookMetadata])
10554
10650
  });
10555
10651
  }
10556
10652
  return record;
@@ -10571,7 +10667,7 @@ var RecordService = class extends BaseService {
10571
10667
  return null;
10572
10668
  }
10573
10669
  const schema = await this.schemaService.getObjectSchema(record.objectId);
10574
- if (!_optionalChain([options, 'optionalAccess', _262 => _262.skipPolicyCheck])) {
10670
+ if (!_optionalChain([options, 'optionalAccess', _257 => _257.skipPolicyCheck])) {
10575
10671
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
10576
10672
  if (policy) {
10577
10673
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
@@ -10581,10 +10677,10 @@ var RecordService = class extends BaseService {
10581
10677
  }
10582
10678
  }
10583
10679
  let enrichedRecord = record;
10584
- if (!_optionalChain([options, 'optionalAccess', _263 => _263.skipFormulas])) {
10680
+ if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipFormulas])) {
10585
10681
  enrichedRecord = enrichWithFormulas(record, schema);
10586
10682
  }
10587
- if (_optionalChain([options, 'optionalAccess', _264 => _264.includeSchema])) {
10683
+ if (_optionalChain([options, 'optionalAccess', _259 => _259.includeSchema])) {
10588
10684
  const recordWithSchema = enrichedRecord;
10589
10685
  recordWithSchema.schema = schema;
10590
10686
  return recordWithSchema;
@@ -10613,6 +10709,13 @@ var RecordService = class extends BaseService {
10613
10709
  throw new RecordNotFoundError(recordId);
10614
10710
  }
10615
10711
  const schema = await this.schemaService.getObjectSchema(existing.objectId);
10712
+ const ownerInfo = await this.schemaService.getObjectOwnerInfo(existing.objectId);
10713
+ checkSharedObjectWriteAccess(
10714
+ schema.name,
10715
+ ownerInfo.sharingMode,
10716
+ ownerInfo.tenantId,
10717
+ this.tenantId
10718
+ );
10616
10719
  await checkPermission(this.permissionService, this.userId, schema.name, "update");
10617
10720
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
10618
10721
  if (policy && this.userId) {
@@ -10627,9 +10730,9 @@ var RecordService = class extends BaseService {
10627
10730
  existing,
10628
10731
  mergedData,
10629
10732
  changedAttributes,
10630
- _optionalChain([options, 'optionalAccess', _265 => _265.hookMetadata])
10733
+ _optionalChain([options, 'optionalAccess', _260 => _260.hookMetadata])
10631
10734
  );
10632
- if (!_optionalChain([options, 'optionalAccess', _266 => _266.skipHooks])) {
10735
+ if (!_optionalChain([options, 'optionalAccess', _261 => _261.skipHooks])) {
10633
10736
  await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
10634
10737
  }
10635
10738
  const hookModifiedValues = {};
@@ -10638,19 +10741,19 @@ var RecordService = class extends BaseService {
10638
10741
  hookModifiedValues[key] = hookCtx.newValues[key];
10639
10742
  }
10640
10743
  }
10641
- if (_optionalChain([options, 'optionalAccess', _267 => _267.validate]) !== false) {
10642
- if (_optionalChain([options, 'optionalAccess', _268 => _268.partial])) {
10744
+ if (_optionalChain([options, 'optionalAccess', _262 => _262.validate]) !== false) {
10745
+ if (_optionalChain([options, 'optionalAccess', _263 => _263.partial])) {
10643
10746
  validateDraftOrThrow(schema, mergedData);
10644
10747
  } else {
10645
10748
  validateObjectOrThrow(schema, mergedData);
10646
10749
  }
10647
- if (!_optionalChain([options, 'optionalAccess', _269 => _269.skipRelationValidation])) {
10750
+ if (!_optionalChain([options, 'optionalAccess', _264 => _264.skipRelationValidation])) {
10648
10751
  await this.relationService.validateRelationsOrThrow(schema, {
10649
10752
  ...data,
10650
10753
  ...hookModifiedValues
10651
10754
  });
10652
10755
  }
10653
- if (!_optionalChain([options, 'optionalAccess', _270 => _270.skipUserValidation])) {
10756
+ if (!_optionalChain([options, 'optionalAccess', _265 => _265.skipUserValidation])) {
10654
10757
  await this.userService.validateUsersOrThrow(schema, {
10655
10758
  ...data,
10656
10759
  ...hookModifiedValues
@@ -10666,7 +10769,7 @@ var RecordService = class extends BaseService {
10666
10769
  __label: label,
10667
10770
  __lastUpdatedBy: this.userId
10668
10771
  };
10669
- if (_optionalChain([options, 'optionalAccess', _271 => _271.metadata]) !== void 0) {
10772
+ if (_optionalChain([options, 'optionalAccess', _266 => _266.metadata]) !== void 0) {
10670
10773
  const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
10671
10774
  const mergedMetadata = { ...existingMetadata, ...options.metadata };
10672
10775
  const cleanedMetadata = Object.fromEntries(
@@ -10679,7 +10782,7 @@ var RecordService = class extends BaseService {
10679
10782
  await this.invalidateLists("allRecordLists", existing.objectId);
10680
10783
  await this.invalidateLists("allSearchResults", existing.objectId);
10681
10784
  await this.invalidateCachePattern(cacheKeys.resolvedRelationsByRecord(this.tenantId, recordId));
10682
- if (!_optionalChain([options, 'optionalAccess', _272 => _272.skipHooks])) {
10785
+ if (!_optionalChain([options, 'optionalAccess', _267 => _267.skipHooks])) {
10683
10786
  const afterCtx = {
10684
10787
  ...hookCtx,
10685
10788
  record: updated
@@ -10694,7 +10797,7 @@ var RecordService = class extends BaseService {
10694
10797
  if (this.auditService && this.userId && allChangedAttributes.length > 0) {
10695
10798
  const changes = allChangedAttributes.map((attr) => ({
10696
10799
  field: attr,
10697
- oldValue: _optionalChain([hookCtx, 'access', _273 => _273.oldValues, 'optionalAccess', _274 => _274[attr]]),
10800
+ oldValue: _optionalChain([hookCtx, 'access', _268 => _268.oldValues, 'optionalAccess', _269 => _269[attr]]),
10698
10801
  newValue: hookCtx.newValues[attr]
10699
10802
  }));
10700
10803
  await this.auditService.logRecordAction({
@@ -10705,7 +10808,7 @@ var RecordService = class extends BaseService {
10705
10808
  recordId: updated.id,
10706
10809
  recordLabel: updated.label,
10707
10810
  changes,
10708
- metadata: _optionalChain([options, 'optionalAccess', _275 => _275.hookMetadata])
10811
+ metadata: _optionalChain([options, 'optionalAccess', _270 => _270.hookMetadata])
10709
10812
  });
10710
10813
  }
10711
10814
  return updated;
@@ -10722,23 +10825,30 @@ var RecordService = class extends BaseService {
10722
10825
  throw new RecordNotFoundError(recordId);
10723
10826
  }
10724
10827
  const schema = await this.schemaService.getObjectSchema(record.objectId);
10828
+ const ownerInfo = await this.schemaService.getObjectOwnerInfo(record.objectId);
10829
+ checkSharedObjectWriteAccess(
10830
+ schema.name,
10831
+ ownerInfo.sharingMode,
10832
+ ownerInfo.tenantId,
10833
+ this.tenantId
10834
+ );
10725
10835
  await checkPermission(this.permissionService, this.userId, schema.name, "delete");
10726
10836
  const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
10727
10837
  if (policy && this.userId) {
10728
10838
  const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
10729
10839
  checkRecordDeleteOrThrow(policy, record, ctx);
10730
10840
  }
10731
- if (_optionalChain([options, 'optionalAccess', _276 => _276.checkSystem]) && schema.system) {
10841
+ if (_optionalChain([options, 'optionalAccess', _271 => _271.checkSystem]) && schema.system) {
10732
10842
  throw new ProtectedResourceError("object", schema.name, "delete");
10733
10843
  }
10734
- if (!_optionalChain([options, 'optionalAccess', _277 => _277.skipReferenceCheck])) {
10844
+ if (!_optionalChain([options, 'optionalAccess', _272 => _272.skipReferenceCheck])) {
10735
10845
  const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
10736
10846
  if (references.length > 0) {
10737
10847
  throw new RecordReferencedError(recordId, references);
10738
10848
  }
10739
10849
  }
10740
- const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _278 => _278.hookMetadata]));
10741
- if (!_optionalChain([options, 'optionalAccess', _279 => _279.skipHooks])) {
10850
+ const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _273 => _273.hookMetadata]));
10851
+ if (!_optionalChain([options, 'optionalAccess', _274 => _274.skipHooks])) {
10742
10852
  await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
10743
10853
  }
10744
10854
  await this.adapter.objectRecords.delete(recordId);
@@ -10747,7 +10857,7 @@ var RecordService = class extends BaseService {
10747
10857
  await this.invalidateLists("allSearchResults", record.objectId);
10748
10858
  await this.invalidateCachePattern(cacheKeys.allGlobalSearch(this.tenantId));
10749
10859
  await this.invalidateCachePattern(cacheKeys.resolvedRelationsByRecord(this.tenantId, recordId));
10750
- if (!_optionalChain([options, 'optionalAccess', _280 => _280.skipHooks])) {
10860
+ if (!_optionalChain([options, 'optionalAccess', _275 => _275.skipHooks])) {
10751
10861
  await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
10752
10862
  }
10753
10863
  await recalculateParentRollups(record, schema, this.rollupContext);
@@ -10759,7 +10869,7 @@ var RecordService = class extends BaseService {
10759
10869
  objectId: schema.id,
10760
10870
  recordId: record.id,
10761
10871
  recordLabel: record.label,
10762
- metadata: _optionalChain([options, 'optionalAccess', _281 => _281.hookMetadata])
10872
+ metadata: _optionalChain([options, 'optionalAccess', _276 => _276.hookMetadata])
10763
10873
  });
10764
10874
  }
10765
10875
  }
@@ -10793,9 +10903,16 @@ var RecordService = class extends BaseService {
10793
10903
  );
10794
10904
  }
10795
10905
  const schema = await this.schemaService.getObjectSchema(record.objectId);
10906
+ const ownerInfo = await this.schemaService.getObjectOwnerInfo(record.objectId);
10907
+ checkSharedObjectWriteAccess(
10908
+ schema.name,
10909
+ ownerInfo.sharingMode,
10910
+ ownerInfo.tenantId,
10911
+ this.tenantId
10912
+ );
10796
10913
  await checkPermission(this.permissionService, this.userId, schema.name, "update");
10797
- const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _282 => _282.hookMetadata]));
10798
- if (!_optionalChain([options, 'optionalAccess', _283 => _283.skipHooks])) {
10914
+ const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _277 => _277.hookMetadata]));
10915
+ if (!_optionalChain([options, 'optionalAccess', _278 => _278.skipHooks])) {
10799
10916
  await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
10800
10917
  }
10801
10918
  const restored = await this.adapter.objectRecords.restore(recordId);
@@ -10804,7 +10921,7 @@ var RecordService = class extends BaseService {
10804
10921
  await this.invalidateLists("allSearchResults", record.objectId);
10805
10922
  await this.invalidateCachePattern(cacheKeys.allGlobalSearch(this.tenantId));
10806
10923
  await this.invalidateCachePattern(cacheKeys.resolvedRelationsByRecord(this.tenantId, recordId));
10807
- if (!_optionalChain([options, 'optionalAccess', _284 => _284.skipHooks])) {
10924
+ if (!_optionalChain([options, 'optionalAccess', _279 => _279.skipHooks])) {
10808
10925
  const afterCtx = {
10809
10926
  ...hookCtx,
10810
10927
  record: restored
@@ -10819,7 +10936,7 @@ var RecordService = class extends BaseService {
10819
10936
  objectId: schema.id,
10820
10937
  recordId: restored.id,
10821
10938
  recordLabel: restored.label,
10822
- metadata: _optionalChain([options, 'optionalAccess', _285 => _285.hookMetadata])
10939
+ metadata: _optionalChain([options, 'optionalAccess', _280 => _280.hookMetadata])
10823
10940
  });
10824
10941
  }
10825
10942
  return restored;
@@ -10874,15 +10991,19 @@ var RecordService = class extends BaseService {
10874
10991
  }
10875
10992
  };
10876
10993
 
10877
- // src/runtime/services/record/relation-resolver.service.ts
10878
- var RelationResolverService = class {
10879
- constructor(adapter) {
10880
- this.adapter = adapter;
10994
+ // src/runtime/services/record/formula-resolver.service.ts
10995
+ var FormulaResolverService = class extends BaseService {
10996
+ constructor(adapter, options) {
10997
+ super(adapter);
10998
+ this.recordResolver = options.recordResolver;
10881
10999
  }
11000
+ // ============================================================================
11001
+ // RESOLUTION
11002
+ // ============================================================================
10882
11003
  /**
10883
11004
  * Resolve values from related records for formula evaluation
10884
11005
  *
10885
- * Phase 2: Supports 1 level of relation traversal only
11006
+ * Supports 1 level of relation traversal only.
10886
11007
  *
10887
11008
  * @param record - The source record
10888
11009
  * @param schema - Schema of the source object
@@ -10891,7 +11012,6 @@ var RelationResolverService = class {
10891
11012
  *
10892
11013
  * @example
10893
11014
  * ```typescript
10894
- * // For an order with company relation
10895
11015
  * const resolved = await resolver.resolveRelationValues(
10896
11016
  * orderRecord,
10897
11017
  * orderSchema,
@@ -10920,7 +11040,7 @@ var RelationResolverService = class {
10920
11040
  if (idsToFetch.length === 0) {
10921
11041
  return result;
10922
11042
  }
10923
- const relatedRecords = await this.adapter.objectRecords.findByIds(idsToFetch);
11043
+ const relatedRecords = await this.recordResolver.findByIds(idsToFetch);
10924
11044
  for (const relatedRecord of relatedRecords) {
10925
11045
  const attrName = attrIdMap.get(relatedRecord.id);
10926
11046
  if (attrName) {
@@ -10966,7 +11086,7 @@ var RelationResolverService = class {
10966
11086
  if (allIdsToFetch.size === 0) {
10967
11087
  return resultMap;
10968
11088
  }
10969
- const relatedRecords = await this.adapter.objectRecords.findByIds([...allIdsToFetch]);
11089
+ const relatedRecords = await this.recordResolver.findByIds([...allIdsToFetch]);
10970
11090
  const relatedRecordMap = new Map(relatedRecords.map((r) => [r.id, r]));
10971
11091
  for (const record of records) {
10972
11092
  const result = resultMap.get(record.id);
@@ -10999,10 +11119,12 @@ var RelationResolverService = class {
10999
11119
  }
11000
11120
  return flat;
11001
11121
  }
11122
+ // ============================================================================
11123
+ // PRIVATE HELPERS
11124
+ // ============================================================================
11002
11125
  /**
11003
11126
  * Extract a single relation ID from a value
11004
11127
  * Handles both single (string) and multi (array) relations
11005
- * @internal
11006
11128
  */
11007
11129
  extractSingleId(value) {
11008
11130
  if (typeof value === "string" && value.length > 0) {
@@ -11021,9 +11143,9 @@ var RollupScheduler = class {
11021
11143
  this.adapter = adapter;
11022
11144
  this.getSchemaById = getSchemaById;
11023
11145
  this.pending = /* @__PURE__ */ new Map();
11024
- this.rollupService = new RollupService(adapter);
11025
- this.debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _286 => _286.debounceMs]), () => ( 100));
11026
- this.maxPending = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _287 => _287.maxPending]), () => ( 100));
11146
+ this.rollupService = new RollupService(adapter, { recordResolver: options.recordResolver });
11147
+ this.debounceMs = _nullishCoalesce(options.debounceMs, () => ( 100));
11148
+ this.maxPending = _nullishCoalesce(options.maxPending, () => ( 100));
11027
11149
  }
11028
11150
  /**
11029
11151
  * Schedule a rollup recalculation for a parent record.
@@ -11101,7 +11223,7 @@ var WorkflowService = class extends BaseService {
11101
11223
  if (Array.isArray(options)) {
11102
11224
  this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
11103
11225
  } else {
11104
- this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _288 => _288.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
11226
+ this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _281 => _281.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
11105
11227
  }
11106
11228
  }
11107
11229
  // ============================================================================
@@ -11404,9 +11526,9 @@ var WorkflowInstanceService = class extends BaseService {
11404
11526
  constructor(adapter, workflowService, options) {
11405
11527
  super(adapter);
11406
11528
  this.workflowService = workflowService;
11407
- this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _289 => _289.executorRegistry]), () => ( getDefaultExecutorRegistry()));
11408
- this.schemaService = _optionalChain([options, 'optionalAccess', _290 => _290.schemaService]);
11409
- this.recordService = _optionalChain([options, 'optionalAccess', _291 => _291.recordService]);
11529
+ this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _282 => _282.executorRegistry]), () => ( getDefaultExecutorRegistry()));
11530
+ this.schemaService = _optionalChain([options, 'optionalAccess', _283 => _283.schemaService]);
11531
+ this.recordService = _optionalChain([options, 'optionalAccess', _284 => _284.recordService]);
11410
11532
  }
11411
11533
  /**
11412
11534
  * Start a new workflow instance
@@ -11532,7 +11654,7 @@ var WorkflowInstanceService = class extends BaseService {
11532
11654
  if (!this.adapter.workflowInstances) {
11533
11655
  return { instances: [], total: 0 };
11534
11656
  }
11535
- if (_optionalChain([options, 'optionalAccess', _292 => _292.workflowName])) {
11657
+ if (_optionalChain([options, 'optionalAccess', _285 => _285.workflowName])) {
11536
11658
  const instances2 = await this.getInstancesByWorkflow(options.workflowName);
11537
11659
  let filtered = instances2;
11538
11660
  if (options.status) {
@@ -11546,11 +11668,11 @@ var WorkflowInstanceService = class extends BaseService {
11546
11668
  return { instances: paginated, total: total2 };
11547
11669
  }
11548
11670
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
11549
- limit: _optionalChain([options, 'optionalAccess', _293 => _293.limit]),
11550
- offset: _optionalChain([options, 'optionalAccess', _294 => _294.offset])
11671
+ limit: _optionalChain([options, 'optionalAccess', _286 => _286.limit]),
11672
+ offset: _optionalChain([options, 'optionalAccess', _287 => _287.offset])
11551
11673
  });
11552
11674
  let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
11553
- if (_optionalChain([options, 'optionalAccess', _295 => _295.status])) {
11675
+ if (_optionalChain([options, 'optionalAccess', _288 => _288.status])) {
11554
11676
  instances = instances.filter((i) => i.status === options.status);
11555
11677
  }
11556
11678
  return { instances, total };
@@ -11570,9 +11692,9 @@ var WorkflowInstanceService = class extends BaseService {
11570
11692
  return { instances: [], total: 0 };
11571
11693
  }
11572
11694
  const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
11573
- status: _optionalChain([options, 'optionalAccess', _296 => _296.status]),
11574
- limit: _optionalChain([options, 'optionalAccess', _297 => _297.limit]),
11575
- offset: _optionalChain([options, 'optionalAccess', _298 => _298.offset])
11695
+ status: _optionalChain([options, 'optionalAccess', _289 => _289.status]),
11696
+ limit: _optionalChain([options, 'optionalAccess', _290 => _290.limit]),
11697
+ offset: _optionalChain([options, 'optionalAccess', _291 => _291.offset])
11576
11698
  });
11577
11699
  const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
11578
11700
  return { instances, total };
@@ -11948,7 +12070,7 @@ var WorkflowParticipationService = class extends BaseService {
11948
12070
  SchemaErrorCode.RECORD_NOT_FOUND
11949
12071
  );
11950
12072
  }
11951
- const template = _optionalChain([instance, 'access', _299 => _299.workflowSnapshot, 'access', _300 => _300.participants, 'optionalAccess', _301 => _301.find, 'call', _302 => _302(
12073
+ const template = _optionalChain([instance, 'access', _292 => _292.workflowSnapshot, 'access', _293 => _293.participants, 'optionalAccess', _294 => _294.find, 'call', _295 => _295(
11952
12074
  (p) => p.id === input.participantTemplateId
11953
12075
  )]);
11954
12076
  if (!template) {
@@ -12250,7 +12372,7 @@ var WorkflowRelationService = class extends BaseService {
12250
12372
  if (attr.type !== "relation") continue;
12251
12373
  for (const slot of slots) {
12252
12374
  const slotData = context.slots[slot.id];
12253
- const slotRecordId = _optionalChain([slotData, 'optionalAccess', _303 => _303.id]);
12375
+ const slotRecordId = _optionalChain([slotData, 'optionalAccess', _296 => _296.id]);
12254
12376
  if (!slotRecordId) continue;
12255
12377
  const targetsSlotObject = attr.targets.some(
12256
12378
  (t) => t.object === slot.objectName
@@ -12315,7 +12437,7 @@ var WorkflowRelationService = class extends BaseService {
12315
12437
  var UserProfileService = class extends BaseService {
12316
12438
  constructor(adapter, options) {
12317
12439
  super(adapter);
12318
- this.auditService = _optionalChain([options, 'optionalAccess', _304 => _304.auditService]);
12440
+ this.auditService = _optionalChain([options, 'optionalAccess', _297 => _297.auditService]);
12319
12441
  }
12320
12442
  // ============================================================================
12321
12443
  // CACHE MANAGEMENT
@@ -12478,7 +12600,7 @@ var UserProfileService = class extends BaseService {
12478
12600
  */
12479
12601
  async deleteProfile(profileId, options) {
12480
12602
  const profile = await this.getProfileOrThrow(profileId);
12481
- if (_optionalChain([options, 'optionalAccess', _305 => _305.checkAdmin])) {
12603
+ if (_optionalChain([options, 'optionalAccess', _298 => _298.checkAdmin])) {
12482
12604
  if (profile.role === "admin") {
12483
12605
  const adminCount = await this.adapter.userProfiles.countByRole("admin");
12484
12606
  if (adminCount <= 1) {
@@ -12553,7 +12675,7 @@ var UserProfileService = class extends BaseService {
12553
12675
  */
12554
12676
  async hasRole(profileId, role) {
12555
12677
  const profile = await this.getProfile(profileId);
12556
- return _optionalChain([profile, 'optionalAccess', _306 => _306.role]) === role;
12678
+ return _optionalChain([profile, 'optionalAccess', _299 => _299.role]) === role;
12557
12679
  }
12558
12680
  /**
12559
12681
  * Check if user is admin
@@ -12610,7 +12732,7 @@ var UserProfileService = class extends BaseService {
12610
12732
  var FileService = class extends BaseService {
12611
12733
  constructor(adapter, options) {
12612
12734
  super(adapter);
12613
- this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _307 => _307.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
12735
+ this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _300 => _300.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
12614
12736
  }
12615
12737
  // ============================================================================
12616
12738
  // UPLOAD (requires StorageAdapter)
@@ -12742,7 +12864,7 @@ var FileService = class extends BaseService {
12742
12864
  */
12743
12865
  async getFile(fileId) {
12744
12866
  const file2 = await this.adapter.files.findById(fileId);
12745
- if (_optionalChain([file2, 'optionalAccess', _308 => _308.deletedAt])) {
12867
+ if (_optionalChain([file2, 'optionalAccess', _301 => _301.deletedAt])) {
12746
12868
  return null;
12747
12869
  }
12748
12870
  return file2;
@@ -12804,12 +12926,12 @@ var FileService = class extends BaseService {
12804
12926
  */
12805
12927
  async deleteFile(fileId, options) {
12806
12928
  const file2 = await this.getFileOrThrow(fileId);
12807
- if (_optionalChain([options, 'optionalAccess', _309 => _309.checkOwnership]) && options.userId) {
12929
+ if (_optionalChain([options, 'optionalAccess', _302 => _302.checkOwnership]) && options.userId) {
12808
12930
  if (file2.uploadedBy !== options.userId) {
12809
12931
  throw new Error("You can only delete files you uploaded");
12810
12932
  }
12811
12933
  }
12812
- if (_optionalChain([options, 'optionalAccess', _310 => _310.hard])) {
12934
+ if (_optionalChain([options, 'optionalAccess', _303 => _303.hard])) {
12813
12935
  await this.adapter.files.hardDelete(fileId);
12814
12936
  } else {
12815
12937
  await this.adapter.files.delete(fileId);
@@ -12840,7 +12962,7 @@ var FileService = class extends BaseService {
12840
12962
  }
12841
12963
  const file2 = await this.getFileOrThrow(fileId);
12842
12964
  await this.adapter.storage.delete(file2.storagePath);
12843
- if (_optionalChain([options, 'optionalAccess', _311 => _311.hard])) {
12965
+ if (_optionalChain([options, 'optionalAccess', _304 => _304.hard])) {
12844
12966
  await this.adapter.files.hardDelete(fileId);
12845
12967
  } else {
12846
12968
  await this.adapter.files.delete(fileId);
@@ -12867,10 +12989,10 @@ var FileService = class extends BaseService {
12867
12989
  if (!file2) {
12868
12990
  continue;
12869
12991
  }
12870
- if (_optionalChain([options, 'optionalAccess', _312 => _312.deleteFromStorage]) && this.adapter.storage) {
12992
+ if (_optionalChain([options, 'optionalAccess', _305 => _305.deleteFromStorage]) && this.adapter.storage) {
12871
12993
  await this.adapter.storage.delete(file2.storagePath);
12872
12994
  }
12873
- if (_optionalChain([options, 'optionalAccess', _313 => _313.hard])) {
12995
+ if (_optionalChain([options, 'optionalAccess', _306 => _306.hard])) {
12874
12996
  await this.adapter.files.hardDelete(fileId);
12875
12997
  } else {
12876
12998
  await this.adapter.files.delete(fileId);
@@ -12881,7 +13003,7 @@ var FileService = class extends BaseService {
12881
13003
  actorId: this.userId,
12882
13004
  fileId,
12883
13005
  fileName: file2.name,
12884
- metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _314 => _314.deleteFromStorage]), () => ( false)) }
13006
+ metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _307 => _307.deleteFromStorage]), () => ( false)) }
12885
13007
  });
12886
13008
  }
12887
13009
  }
@@ -12965,7 +13087,7 @@ var FileService = class extends BaseService {
12965
13087
  return true;
12966
13088
  }
12967
13089
  if (file2.visibility === "restricted") {
12968
- return _nullishCoalesce(_optionalChain([file2, 'access', _315 => _315.allowedUsers, 'optionalAccess', _316 => _316.includes, 'call', _317 => _317(userId)]), () => ( false));
13090
+ return _nullishCoalesce(_optionalChain([file2, 'access', _308 => _308.allowedUsers, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(userId)]), () => ( false));
12969
13091
  }
12970
13092
  return false;
12971
13093
  }
@@ -13130,10 +13252,10 @@ var GlobalSearchService = class extends BaseService {
13130
13252
  */
13131
13253
  async executeSearch(query, options) {
13132
13254
  return await this.adapter.objectRecords.globalSearch(query, {
13133
- limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _318 => _318.limit]), () => ( 20)),
13134
- offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _319 => _319.offset]), () => ( 0)),
13135
- objectNames: _optionalChain([options, 'optionalAccess', _320 => _320.objectNames]),
13136
- includeObjectInfo: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _321 => _321.includeObjectInfo]), () => ( true))
13255
+ limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _311 => _311.limit]), () => ( 20)),
13256
+ offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _312 => _312.offset]), () => ( 0)),
13257
+ objectNames: _optionalChain([options, 'optionalAccess', _313 => _313.objectNames]),
13258
+ includeObjectInfo: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _314 => _314.includeObjectInfo]), () => ( true))
13137
13259
  });
13138
13260
  }
13139
13261
  /**
@@ -13183,7 +13305,7 @@ var PermissionService = class extends BaseService {
13183
13305
  }
13184
13306
  this.permissionsRepo = adapter.permissions;
13185
13307
  this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
13186
- this.auditService = _optionalChain([options, 'optionalAccess', _322 => _322.auditService]);
13308
+ this.auditService = _optionalChain([options, 'optionalAccess', _315 => _315.auditService]);
13187
13309
  }
13188
13310
  // ============================================================================
13189
13311
  // PERMISSION CHECKS
@@ -13202,11 +13324,11 @@ var PermissionService = class extends BaseService {
13202
13324
  return true;
13203
13325
  }
13204
13326
  const wildcardPerms = permissions.objectPermissions["*"];
13205
- if (_optionalChain([wildcardPerms, 'optionalAccess', _323 => _323.includes, 'call', _324 => _324(action)])) {
13327
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _316 => _316.includes, 'call', _317 => _317(action)])) {
13206
13328
  return true;
13207
13329
  }
13208
13330
  const objectPerms = permissions.objectPermissions[objectName];
13209
- return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _325 => _325.includes, 'call', _326 => _326(action)]), () => ( false));
13331
+ return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _318 => _318.includes, 'call', _319 => _319(action)]), () => ( false));
13210
13332
  }
13211
13333
  /**
13212
13334
  * Check if user can access an object, throw ForbiddenError if not.
@@ -13261,12 +13383,12 @@ var PermissionService = class extends BaseService {
13261
13383
  if (permissions.isAdmin) {
13262
13384
  return true;
13263
13385
  }
13264
- const wildcardPerms = _optionalChain([permissions, 'access', _327 => _327.systemPermissions, 'optionalAccess', _328 => _328["*"]]);
13265
- if (_optionalChain([wildcardPerms, 'optionalAccess', _329 => _329.includes, 'call', _330 => _330(action)])) {
13386
+ const wildcardPerms = _optionalChain([permissions, 'access', _320 => _320.systemPermissions, 'optionalAccess', _321 => _321["*"]]);
13387
+ if (_optionalChain([wildcardPerms, 'optionalAccess', _322 => _322.includes, 'call', _323 => _323(action)])) {
13266
13388
  return true;
13267
13389
  }
13268
- const resourcePerms = _optionalChain([permissions, 'access', _331 => _331.systemPermissions, 'optionalAccess', _332 => _332[resource]]);
13269
- return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _333 => _333.includes, 'call', _334 => _334(action)]), () => ( false));
13390
+ const resourcePerms = _optionalChain([permissions, 'access', _324 => _324.systemPermissions, 'optionalAccess', _325 => _325[resource]]);
13391
+ return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _326 => _326.includes, 'call', _327 => _327(action)]), () => ( false));
13270
13392
  }
13271
13393
  /**
13272
13394
  * Check if user can access a system resource, throw ForbiddenError if not.
@@ -13295,8 +13417,8 @@ var PermissionService = class extends BaseService {
13295
13417
  if (permissions.isAdmin) {
13296
13418
  return { canRead: true, canCreate: true, canUpdate: true, canDelete: true };
13297
13419
  }
13298
- const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _335 => _335.systemPermissions, 'optionalAccess', _336 => _336["*"]]), () => ( []));
13299
- const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _337 => _337.systemPermissions, 'optionalAccess', _338 => _338[resource]]), () => ( []));
13420
+ const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _328 => _328.systemPermissions, 'optionalAccess', _329 => _329["*"]]), () => ( []));
13421
+ const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _330 => _330.systemPermissions, 'optionalAccess', _331 => _331[resource]]), () => ( []));
13300
13422
  const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
13301
13423
  return {
13302
13424
  canRead: allPerms.has("read"),
@@ -13438,7 +13560,7 @@ var PermissionService = class extends BaseService {
13438
13560
  action: "role.updated",
13439
13561
  actorId: this.userId,
13440
13562
  roleId,
13441
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _339 => _339.label]), () => ( roleId)),
13563
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _332 => _332.label]), () => ( roleId)),
13442
13564
  metadata: { permissionsUpdated: true, permissionCount: permissions.length }
13443
13565
  });
13444
13566
  }
@@ -13468,7 +13590,7 @@ var PermissionService = class extends BaseService {
13468
13590
  action: "role.assigned",
13469
13591
  actorId: this.userId,
13470
13592
  roleId,
13471
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _340 => _340.label]), () => ( roleId)),
13593
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _333 => _333.label]), () => ( roleId)),
13472
13594
  targetUserId: userProfileId
13473
13595
  });
13474
13596
  }
@@ -13486,7 +13608,7 @@ var PermissionService = class extends BaseService {
13486
13608
  action: "role.revoked",
13487
13609
  actorId: this.userId,
13488
13610
  roleId,
13489
- roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _341 => _341.label]), () => ( roleId)),
13611
+ roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _334 => _334.label]), () => ( roleId)),
13490
13612
  targetUserId: userProfileId
13491
13613
  });
13492
13614
  }
@@ -14014,6 +14136,18 @@ async function syncSingleObject(adapter, nativeObject, result, options) {
14014
14136
  if (!nativeObject.system) {
14015
14137
  throw new Error(`Object ${nativeObject.name} is not marked as system`);
14016
14138
  }
14139
+ if (nativeObject.sharingMode === "shared") {
14140
+ if (!options.masterTenantId) {
14141
+ throw new Error(
14142
+ `Cannot sync shared object "${nativeObject.name}": masterTenantId must be configured in tenant options`
14143
+ );
14144
+ }
14145
+ if (options.tenantId && options.tenantId !== options.masterTenantId) {
14146
+ throw new Error(
14147
+ `Cannot sync shared object "${nativeObject.name}": only master tenant "${options.masterTenantId}" can sync shared objects (current: "${options.tenantId}")`
14148
+ );
14149
+ }
14150
+ }
14017
14151
  const existingObject = await adapter.objects.findSystemByName(nativeObject.name);
14018
14152
  const isNew = !existingObject;
14019
14153
  updateObjectStats(result, isNew);
@@ -14058,6 +14192,7 @@ async function upsertObject(adapter, nativeObject, _options) {
14058
14192
  description: nativeObject.description,
14059
14193
  labelExpression: nativeObject.labelExpression,
14060
14194
  icon: nativeObject.icon,
14195
+ sharingMode: _nullishCoalesce(nativeObject.sharingMode, () => ( "private")),
14061
14196
  metadata: nativeObject.metadata
14062
14197
  });
14063
14198
  }
@@ -14480,4 +14615,6 @@ var NoopGeocodingAdapter = class {
14480
14615
 
14481
14616
 
14482
14617
 
14483
- 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.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.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.isWorkflowDefinition = isWorkflowDefinition; exports.isWorkflowPublished = isWorkflowPublished; exports.isSystemWorkflow = isSystemWorkflow; exports.isInstanceTerminal = isInstanceTerminal; exports.isInstanceWaiting = isInstanceWaiting; exports.canResumeInstance = canResumeInstance; exports.createStartTransition = createStartTransition; exports.isSignedLinkAuth = isSignedLinkAuth; exports.isPinCodeAuth = isPinCodeAuth; exports.canParticipate = canParticipate; exports.canAuthenticate = canAuthenticate; exports.canExecuteNode = canExecuteNode; exports.createEmptyContext = createEmptyContext; exports.getContextValue = getContextValue; exports.setContextValue = setContextValue; exports.mergeFormToSlot = mergeFormToSlot; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isParticipationEvent = isParticipationEvent; 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.EndNodeSchema = EndNodeSchema; exports.WorkflowNodeSchema = WorkflowNodeSchema; exports.SlotModeSchema = SlotModeSchema; exports.WorkflowSlotSchema = WorkflowSlotSchema; exports.ParticipantAuthConfigSchema = ParticipantAuthConfigSchema; exports.ParticipantTemplateSchema = ParticipantTemplateSchema; 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.asTenantId = asTenantId; exports.asUserId = asUserId; exports.generateId = generateId; exports.generatePrefixedId = generatePrefixedId; 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.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.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.TabBuilder = TabBuilder; exports.ViewBuilder = ViewBuilder; exports.view = view; exports.group = group; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowParticipantBuilder = WorkflowParticipantBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.DEFAULT_VALIDATION_MESSAGES = DEFAULT_VALIDATION_MESSAGES; exports.textConfigSchema = textConfigSchema; exports.textareaConfigSchema = textareaConfigSchema; exports.richtextConfigSchema = richtextConfigSchema; exports.numberConfigSchema = numberConfigSchema; exports.checkboxConfigSchema = checkboxConfigSchema; exports.dateConfigSchema = dateConfigSchema; exports.phoneConfigSchema = phoneConfigSchema; exports.currencyConfigSchema = currencyConfigSchema; exports.statusConfigSchema = statusConfigSchema; exports.locationConfigSchema = locationConfigSchema; exports.selectConfigSchema = selectConfigSchema; exports.multiselectConfigSchema = multiselectConfigSchema; exports.fileConfigSchema = fileConfigSchema; exports.userConfigSchema = userConfigSchema; exports.relationConfigSchema = relationConfigSchema; exports.ratingConfigSchema = ratingConfigSchema; exports.formulaConfigSchema = formulaConfigSchema; exports.rollupConfigSchema = rollupConfigSchema; exports.attributeConfigSchemas = attributeConfigSchemas; exports.getAttributeConfigSchema = getAttributeConfigSchema; exports.validateAttributeConfig = validateAttributeConfig; exports.parseAttributeConfig = parseAttributeConfig; exports.safeParseAttributeConfig = safeParseAttributeConfig; exports.createTextValidator = createTextValidator; exports.createNumberValidator = createNumberValidator; exports.createCheckboxValidator = createCheckboxValidator; exports.createDateValidator = createDateValidator; exports.createPhoneValidator = createPhoneValidator; exports.createCurrencyValidator = createCurrencyValidator; exports.createStatusValidator = createStatusValidator; exports.createSelectValidator = createSelectValidator; exports.createMultiselectValidator = createMultiselectValidator; exports.createLocationValidator = createLocationValidator; exports.createFileValidator = createFileValidator; exports.createUserValidator = createUserValidator; exports.createSingleRelationValidator = createSingleRelationValidator; exports.createMultiRelationValidator = createMultiRelationValidator; exports.createRelationValidator = createRelationValidator; exports.createRatingValidator = createRatingValidator; exports.createFormulaValidator = createFormulaValidator; exports.createRollupValidator = createRollupValidator; exports.createTextAreaValidator = createTextAreaValidator; exports.createRichtextValidator = createRichtextValidator; exports.createAttributeValidator = createAttributeValidator; exports.createFormAttributeValidator = createFormAttributeValidator; exports.createObjectValidator = createObjectValidator; exports.validateAttribute = validateAttribute; exports.validateObject = validateObject; exports.validateObjectOrThrow = validateObjectOrThrow; exports.createDraftValidator = createDraftValidator; exports.validateDraft = validateDraft; exports.validateDraftOrThrow = validateDraftOrThrow; exports.getMissingRequiredAttributes = getMissingRequiredAttributes; exports.isRecordComplete = isRecordComplete; exports.computeRecordStatus = computeRecordStatus; exports.ParticipationTokenService = ParticipationTokenService; exports.getDefaultTokenService = getDefaultTokenService; exports.initializeTokenService = initializeTokenService; exports.PinCodeService = PinCodeService; exports.getDefaultPinCodeService = getDefaultPinCodeService; exports.initializePinCodeService = initializePinCodeService; 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.getSchemaFromContext = getSchemaFromContext; exports.getSchemaByNameFromContext = getSchemaByNameFromContext; exports.hasSchemaContext = hasSchemaContext; exports.getSchemaContext = getSchemaContext; exports.addSchemaToContext = addSchemaToContext; exports.runWithSchemaContext = runWithSchemaContext; exports.runWithMergedSchemaContext = runWithMergedSchemaContext; exports.getContext = getContext; exports.getTenantId = getTenantId; exports.getUserId = getUserId; exports.hasContext = hasContext; exports.runWithContext = runWithContext; exports.withTenantContext = withTenantContext; exports.QueryBuilder = QueryBuilder; exports.createQueryBuilder = createQueryBuilder; exports.evaluateCondition = evaluateCondition; exports.evaluate = evaluate; exports.evaluateWithTrace = evaluateWithTrace; exports.ExecutorRegistry = ExecutorRegistry; exports.success = success; exports.wait = wait; exports.complete = complete; exports.error = error; exports.ConditionExecutor = ConditionExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.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.TenantAwareRepository = TenantAwareRepository; exports.TenantAwareService = TenantAwareService; 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.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.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.RelationResolverService = RelationResolverService; exports.RollupScheduler = RollupScheduler; exports.WorkflowService = WorkflowService; exports.WorkflowInstanceService = WorkflowInstanceService; exports.WorkflowParticipationService = WorkflowParticipationService; exports.WorkflowRelationService = WorkflowRelationService; exports.UserProfileService = UserProfileService; exports.FileService = FileService; exports.GeocodingService = GeocodingService; exports.GlobalSearchService = GlobalSearchService; exports.PermissionService = PermissionService; exports.ViewService = ViewService; exports.syncNativeViews = syncNativeViews; exports.verifyNativeViewsSync = verifyNativeViewsSync; exports.getViewSyncPreview = getViewSyncPreview; exports.syncNativeObjects = syncNativeObjects; exports.verifyNativeObjectsSync = verifyNativeObjectsSync; exports.getSyncPreview = getSyncPreview; exports.syncAll = syncAll;
14618
+
14619
+
14620
+ 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.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.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.isWorkflowDefinition = isWorkflowDefinition; exports.isWorkflowPublished = isWorkflowPublished; exports.isSystemWorkflow = isSystemWorkflow; exports.isInstanceTerminal = isInstanceTerminal; exports.isInstanceWaiting = isInstanceWaiting; exports.canResumeInstance = canResumeInstance; exports.createStartTransition = createStartTransition; exports.isSignedLinkAuth = isSignedLinkAuth; exports.isPinCodeAuth = isPinCodeAuth; exports.canParticipate = canParticipate; exports.canAuthenticate = canAuthenticate; exports.canExecuteNode = canExecuteNode; exports.createEmptyContext = createEmptyContext; exports.getContextValue = getContextValue; exports.setContextValue = setContextValue; exports.mergeFormToSlot = mergeFormToSlot; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isParticipationEvent = isParticipationEvent; 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.EndNodeSchema = EndNodeSchema; exports.WorkflowNodeSchema = WorkflowNodeSchema; exports.SlotModeSchema = SlotModeSchema; exports.WorkflowSlotSchema = WorkflowSlotSchema; exports.ParticipantAuthConfigSchema = ParticipantAuthConfigSchema; exports.ParticipantTemplateSchema = ParticipantTemplateSchema; 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.asTenantId = asTenantId; exports.asUserId = asUserId; exports.generateId = generateId; exports.generatePrefixedId = generatePrefixedId; 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.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.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.TabBuilder = TabBuilder; exports.ViewBuilder = ViewBuilder; exports.view = view; exports.group = group; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowParticipantBuilder = WorkflowParticipantBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.DEFAULT_VALIDATION_MESSAGES = DEFAULT_VALIDATION_MESSAGES; exports.textConfigSchema = textConfigSchema; exports.textareaConfigSchema = textareaConfigSchema; exports.richtextConfigSchema = richtextConfigSchema; exports.numberConfigSchema = numberConfigSchema; exports.checkboxConfigSchema = checkboxConfigSchema; exports.dateConfigSchema = dateConfigSchema; exports.phoneConfigSchema = phoneConfigSchema; exports.currencyConfigSchema = currencyConfigSchema; exports.statusConfigSchema = statusConfigSchema; exports.locationConfigSchema = locationConfigSchema; exports.selectConfigSchema = selectConfigSchema; exports.multiselectConfigSchema = multiselectConfigSchema; exports.fileConfigSchema = fileConfigSchema; exports.userConfigSchema = userConfigSchema; exports.relationConfigSchema = relationConfigSchema; exports.ratingConfigSchema = ratingConfigSchema; exports.formulaConfigSchema = formulaConfigSchema; exports.rollupConfigSchema = rollupConfigSchema; exports.attributeConfigSchemas = attributeConfigSchemas; exports.getAttributeConfigSchema = getAttributeConfigSchema; exports.validateAttributeConfig = validateAttributeConfig; exports.parseAttributeConfig = parseAttributeConfig; exports.safeParseAttributeConfig = safeParseAttributeConfig; exports.createTextValidator = createTextValidator; exports.createNumberValidator = createNumberValidator; exports.createCheckboxValidator = createCheckboxValidator; exports.createDateValidator = createDateValidator; exports.createPhoneValidator = createPhoneValidator; exports.createCurrencyValidator = createCurrencyValidator; exports.createStatusValidator = createStatusValidator; exports.createSelectValidator = createSelectValidator; exports.createMultiselectValidator = createMultiselectValidator; exports.createLocationValidator = createLocationValidator; exports.createFileValidator = createFileValidator; exports.createUserValidator = createUserValidator; exports.createSingleRelationValidator = createSingleRelationValidator; exports.createMultiRelationValidator = createMultiRelationValidator; exports.createRelationValidator = createRelationValidator; exports.createRatingValidator = createRatingValidator; exports.createFormulaValidator = createFormulaValidator; exports.createRollupValidator = createRollupValidator; exports.createTextAreaValidator = createTextAreaValidator; exports.createRichtextValidator = createRichtextValidator; exports.createAttributeValidator = createAttributeValidator; exports.createFormAttributeValidator = createFormAttributeValidator; exports.createObjectValidator = createObjectValidator; exports.validateAttribute = validateAttribute; exports.validateObject = validateObject; exports.validateObjectOrThrow = validateObjectOrThrow; exports.createDraftValidator = createDraftValidator; exports.validateDraft = validateDraft; exports.validateDraftOrThrow = validateDraftOrThrow; exports.getMissingRequiredAttributes = getMissingRequiredAttributes; exports.isRecordComplete = isRecordComplete; exports.computeRecordStatus = computeRecordStatus; exports.ParticipationTokenService = ParticipationTokenService; exports.getDefaultTokenService = getDefaultTokenService; exports.initializeTokenService = initializeTokenService; exports.PinCodeService = PinCodeService; exports.getDefaultPinCodeService = getDefaultPinCodeService; exports.initializePinCodeService = initializePinCodeService; 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.getSchemaFromContext = getSchemaFromContext; exports.getSchemaByNameFromContext = getSchemaByNameFromContext; exports.hasSchemaContext = hasSchemaContext; exports.getSchemaContext = getSchemaContext; exports.addSchemaToContext = addSchemaToContext; exports.runWithSchemaContext = runWithSchemaContext; exports.runWithMergedSchemaContext = runWithMergedSchemaContext; exports.getContext = getContext; exports.getTenantId = getTenantId; exports.getUserId = getUserId; exports.hasContext = hasContext; exports.runWithContext = runWithContext; exports.withTenantContext = withTenantContext; exports.QueryBuilder = QueryBuilder; exports.createQueryBuilder = createQueryBuilder; exports.evaluateCondition = evaluateCondition; exports.evaluate = evaluate; exports.evaluateWithTrace = evaluateWithTrace; exports.ExecutorRegistry = ExecutorRegistry; exports.success = success; exports.wait = wait; exports.complete = complete; exports.error = error; exports.ConditionExecutor = ConditionExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.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.TenantAwareRepository = TenantAwareRepository; exports.TenantAwareService = TenantAwareService; 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.WorkflowService = WorkflowService; exports.WorkflowInstanceService = WorkflowInstanceService; exports.WorkflowParticipationService = WorkflowParticipationService; exports.WorkflowRelationService = WorkflowRelationService; exports.UserProfileService = UserProfileService; exports.FileService = FileService; exports.GeocodingService = GeocodingService; exports.GlobalSearchService = GlobalSearchService; exports.PermissionService = PermissionService; exports.ViewService = ViewService; exports.syncNativeViews = syncNativeViews; exports.verifyNativeViewsSync = verifyNativeViewsSync; exports.getViewSyncPreview = getViewSyncPreview; exports.syncNativeObjects = syncNativeObjects; exports.verifyNativeObjectsSync = verifyNativeObjectsSync; exports.getSyncPreview = getSyncPreview; exports.syncAll = syncAll;