@stndrds/schema 1.0.0-alpha.82 → 1.0.0-alpha.84
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.
- package/dist/{chunk-OR44EVWO.mjs → chunk-HTE7NOF3.mjs} +0 -93
- package/dist/{chunk-WHDJLJRK.js → chunk-I4D33CVC.js} +212 -305
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.mjs +1 -1
- package/dist/{runtime-Ttkdn9W7.d.mts → runtime-BGZqT9aX.d.mts} +7 -48
- package/dist/{runtime-B6Dt5_Gc.d.ts → runtime-BUk5CZfD.d.ts} +7 -48
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/dist/runtime.mjs +1 -1
- package/package.json +2 -2
|
@@ -3458,96 +3458,6 @@ function createMockAIConversationsRepository(stores) {
|
|
|
3458
3458
|
}
|
|
3459
3459
|
};
|
|
3460
3460
|
}
|
|
3461
|
-
function createMockAIUserMemoryRepository(stores) {
|
|
3462
|
-
const getKey = () => {
|
|
3463
|
-
const tenantId = getTenantId();
|
|
3464
|
-
const userId = requireUserId();
|
|
3465
|
-
return `${tenantId}:${userId}`;
|
|
3466
|
-
};
|
|
3467
|
-
return {
|
|
3468
|
-
get() {
|
|
3469
|
-
const key = getKey();
|
|
3470
|
-
return Promise.resolve(_nullishCoalesce(stores.aiUserMemory.get(key), () => ( null)));
|
|
3471
|
-
},
|
|
3472
|
-
upsert(data) {
|
|
3473
|
-
const key = getKey();
|
|
3474
|
-
const tenantId = getTenantId();
|
|
3475
|
-
const userId = requireUserId();
|
|
3476
|
-
const now = /* @__PURE__ */ new Date();
|
|
3477
|
-
const existing = stores.aiUserMemory.get(key);
|
|
3478
|
-
const memory = {
|
|
3479
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _55 => _55.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
3480
|
-
tenantId,
|
|
3481
|
-
userId,
|
|
3482
|
-
preferences: _nullishCoalesce(_nullishCoalesce(data.preferences, () => ( _optionalChain([existing, 'optionalAccess', _56 => _56.preferences]))), () => ( {})),
|
|
3483
|
-
facts: _nullishCoalesce(_nullishCoalesce(data.facts, () => ( _optionalChain([existing, 'optionalAccess', _57 => _57.facts]))), () => ( [])),
|
|
3484
|
-
createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _58 => _58.createdAt]), () => ( now)),
|
|
3485
|
-
updatedAt: now
|
|
3486
|
-
};
|
|
3487
|
-
stores.aiUserMemory.set(key, memory);
|
|
3488
|
-
return Promise.resolve(memory);
|
|
3489
|
-
},
|
|
3490
|
-
addFact(fact) {
|
|
3491
|
-
const key = getKey();
|
|
3492
|
-
const tenantId = getTenantId();
|
|
3493
|
-
const userId = requireUserId();
|
|
3494
|
-
const now = /* @__PURE__ */ new Date();
|
|
3495
|
-
const existing = stores.aiUserMemory.get(key);
|
|
3496
|
-
const memory = {
|
|
3497
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _59 => _59.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
3498
|
-
tenantId,
|
|
3499
|
-
userId,
|
|
3500
|
-
preferences: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _60 => _60.preferences]), () => ( {})),
|
|
3501
|
-
facts: [..._nullishCoalesce(_optionalChain([existing, 'optionalAccess', _61 => _61.facts]), () => ( [])), fact],
|
|
3502
|
-
createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _62 => _62.createdAt]), () => ( now)),
|
|
3503
|
-
updatedAt: now
|
|
3504
|
-
};
|
|
3505
|
-
stores.aiUserMemory.set(key, memory);
|
|
3506
|
-
return Promise.resolve(memory);
|
|
3507
|
-
},
|
|
3508
|
-
removeFact(fact) {
|
|
3509
|
-
const key = getKey();
|
|
3510
|
-
const tenantId = getTenantId();
|
|
3511
|
-
const userId = requireUserId();
|
|
3512
|
-
const now = /* @__PURE__ */ new Date();
|
|
3513
|
-
const existing = stores.aiUserMemory.get(key);
|
|
3514
|
-
const memory = {
|
|
3515
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _63 => _63.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
3516
|
-
tenantId,
|
|
3517
|
-
userId,
|
|
3518
|
-
preferences: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _64 => _64.preferences]), () => ( {})),
|
|
3519
|
-
facts: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _65 => _65.facts]), () => ( []))).filter((f) => f !== fact),
|
|
3520
|
-
createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _66 => _66.createdAt]), () => ( now)),
|
|
3521
|
-
updatedAt: now
|
|
3522
|
-
};
|
|
3523
|
-
stores.aiUserMemory.set(key, memory);
|
|
3524
|
-
return Promise.resolve(memory);
|
|
3525
|
-
},
|
|
3526
|
-
setPreference(prefKey, value) {
|
|
3527
|
-
const memoryKey = getKey();
|
|
3528
|
-
const tenantId = getTenantId();
|
|
3529
|
-
const userId = requireUserId();
|
|
3530
|
-
const now = /* @__PURE__ */ new Date();
|
|
3531
|
-
const existing = stores.aiUserMemory.get(memoryKey);
|
|
3532
|
-
const memory = {
|
|
3533
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _67 => _67.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
3534
|
-
tenantId,
|
|
3535
|
-
userId,
|
|
3536
|
-
preferences: { ..._nullishCoalesce(_optionalChain([existing, 'optionalAccess', _68 => _68.preferences]), () => ( {})), [prefKey]: value },
|
|
3537
|
-
facts: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _69 => _69.facts]), () => ( [])),
|
|
3538
|
-
createdAt: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _70 => _70.createdAt]), () => ( now)),
|
|
3539
|
-
updatedAt: now
|
|
3540
|
-
};
|
|
3541
|
-
stores.aiUserMemory.set(memoryKey, memory);
|
|
3542
|
-
return Promise.resolve(memory);
|
|
3543
|
-
},
|
|
3544
|
-
clear() {
|
|
3545
|
-
const key = getKey();
|
|
3546
|
-
stores.aiUserMemory.delete(key);
|
|
3547
|
-
return Promise.resolve();
|
|
3548
|
-
}
|
|
3549
|
-
};
|
|
3550
|
-
}
|
|
3551
3461
|
function createMockAIUsageMetricsRepository(stores) {
|
|
3552
3462
|
const getDateKey = (date2) => {
|
|
3553
3463
|
const tenantId = getTenantId();
|
|
@@ -3560,24 +3470,24 @@ function createMockAIUsageMetricsRepository(stores) {
|
|
|
3560
3470
|
const now = /* @__PURE__ */ new Date();
|
|
3561
3471
|
const key = getDateKey(now);
|
|
3562
3472
|
const existing = stores.aiUsageMetrics.get(key);
|
|
3563
|
-
const providerBreakdown = _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3473
|
+
const providerBreakdown = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _55 => _55.providerBreakdown]), () => ( {}));
|
|
3564
3474
|
if (!providerBreakdown[data.provider]) {
|
|
3565
3475
|
providerBreakdown[data.provider] = { requests: 0, tokens: 0, cost: 0 };
|
|
3566
3476
|
}
|
|
3567
3477
|
providerBreakdown[data.provider].requests++;
|
|
3568
3478
|
providerBreakdown[data.provider].tokens += data.tokens;
|
|
3569
3479
|
providerBreakdown[data.provider].cost += data.cost;
|
|
3570
|
-
const toolUsage = _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3480
|
+
const toolUsage = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _56 => _56.toolUsage]), () => ( {}));
|
|
3571
3481
|
if (data.toolName) {
|
|
3572
3482
|
toolUsage[data.toolName] = (_nullishCoalesce(toolUsage[data.toolName], () => ( 0))) + 1;
|
|
3573
3483
|
}
|
|
3574
3484
|
const metrics = {
|
|
3575
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3485
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _57 => _57.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
3576
3486
|
tenantId,
|
|
3577
3487
|
date: new Date(_nullishCoalesce(now.toISOString().split("T")[0], () => ( now.toISOString()))),
|
|
3578
|
-
requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3579
|
-
totalTokens: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3580
|
-
totalCost: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3488
|
+
requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _58 => _58.requestCount]), () => ( 0))) + 1,
|
|
3489
|
+
totalTokens: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _59 => _59.totalTokens]), () => ( 0))) + data.tokens,
|
|
3490
|
+
totalCost: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _60 => _60.totalCost]), () => ( 0))) + data.cost,
|
|
3581
3491
|
providerBreakdown,
|
|
3582
3492
|
toolUsage
|
|
3583
3493
|
};
|
|
@@ -3630,7 +3540,7 @@ function createMockFilesRepository(stores) {
|
|
|
3630
3540
|
return {
|
|
3631
3541
|
findById(id) {
|
|
3632
3542
|
const file2 = stores.files.get(id);
|
|
3633
|
-
if (_optionalChain([file2, 'optionalAccess',
|
|
3543
|
+
if (_optionalChain([file2, 'optionalAccess', _61 => _61.deletedAt])) return Promise.resolve(null);
|
|
3634
3544
|
return Promise.resolve(_nullishCoalesce(file2, () => ( null)));
|
|
3635
3545
|
},
|
|
3636
3546
|
findByIds(ids) {
|
|
@@ -3691,10 +3601,10 @@ function createMockFilesRepository(stores) {
|
|
|
3691
3601
|
let results = Array.from(stores.files.values()).filter(
|
|
3692
3602
|
(f) => f.tenantId === tenantId && !f.deletedAt
|
|
3693
3603
|
);
|
|
3694
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3604
|
+
if (_optionalChain([options, 'optionalAccess', _62 => _62.mimeType])) {
|
|
3695
3605
|
results = results.filter((f) => f.mimeType === options.mimeType);
|
|
3696
3606
|
}
|
|
3697
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3607
|
+
if (_optionalChain([options, 'optionalAccess', _63 => _63.limit])) {
|
|
3698
3608
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
3699
3609
|
}
|
|
3700
3610
|
return Promise.resolve(results);
|
|
@@ -4050,7 +3960,7 @@ var SyncError = class extends SchemaError {
|
|
|
4050
3960
|
constructor(objectName, message, cause) {
|
|
4051
3961
|
super(`Failed to sync object "${objectName}": ${message}`, SchemaErrorCode.SYNC_FAILED, {
|
|
4052
3962
|
objectName,
|
|
4053
|
-
cause: _optionalChain([cause, 'optionalAccess',
|
|
3963
|
+
cause: _optionalChain([cause, 'optionalAccess', _64 => _64.message])
|
|
4054
3964
|
});
|
|
4055
3965
|
this.name = "SyncError";
|
|
4056
3966
|
this.objectName = objectName;
|
|
@@ -4238,7 +4148,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4238
4148
|
(r) => r.tenantId === tenantId && r.objectId === objectId && !r.deletedAt
|
|
4239
4149
|
);
|
|
4240
4150
|
const total = results.length;
|
|
4241
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4151
|
+
if (_optionalChain([options, 'optionalAccess', _65 => _65.limit])) {
|
|
4242
4152
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
4243
4153
|
}
|
|
4244
4154
|
const records = results.map(({ tenantId: _t, ...r }) => r);
|
|
@@ -4254,7 +4164,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4254
4164
|
);
|
|
4255
4165
|
});
|
|
4256
4166
|
const total = results.length;
|
|
4257
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4167
|
+
if (_optionalChain([options, 'optionalAccess', _66 => _66.limit])) {
|
|
4258
4168
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
4259
4169
|
}
|
|
4260
4170
|
const records = results.map(({ tenantId: _t, ...r }) => r);
|
|
@@ -4270,7 +4180,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4270
4180
|
}
|
|
4271
4181
|
}
|
|
4272
4182
|
const allowedObjectIds = /* @__PURE__ */ new Set();
|
|
4273
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4183
|
+
if (_optionalChain([options, 'optionalAccess', _67 => _67.objectNames]) && options.objectNames.length > 0) {
|
|
4274
4184
|
for (const obj of objectsMap.values()) {
|
|
4275
4185
|
if (options.objectNames.includes(obj.name)) {
|
|
4276
4186
|
allowedObjectIds.add(obj.id);
|
|
@@ -4289,7 +4199,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4289
4199
|
);
|
|
4290
4200
|
});
|
|
4291
4201
|
const total = matchingRecords.length;
|
|
4292
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4202
|
+
if (_optionalChain([options, 'optionalAccess', _68 => _68.limit])) {
|
|
4293
4203
|
matchingRecords = matchingRecords.slice(
|
|
4294
4204
|
_nullishCoalesce(options.offset, () => ( 0)),
|
|
4295
4205
|
(_nullishCoalesce(options.offset, () => ( 0))) + options.limit
|
|
@@ -4300,11 +4210,11 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4300
4210
|
if (!attributesByObjectId.has(attr.objectId)) {
|
|
4301
4211
|
attributesByObjectId.set(attr.objectId, []);
|
|
4302
4212
|
}
|
|
4303
|
-
_optionalChain([attributesByObjectId, 'access',
|
|
4213
|
+
_optionalChain([attributesByObjectId, 'access', _69 => _69.get, 'call', _70 => _70(attr.objectId), 'optionalAccess', _71 => _71.push, 'call', _72 => _72(attr)]);
|
|
4304
4214
|
}
|
|
4305
4215
|
const results = matchingRecords.map((r) => {
|
|
4306
4216
|
const obj = objectsMap.get(r.objectId);
|
|
4307
|
-
const labelExpression = _nullishCoalesce(_optionalChain([obj, 'optionalAccess',
|
|
4217
|
+
const labelExpression = _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _73 => _73.labelExpression]), () => ( "{{ name }}"));
|
|
4308
4218
|
const dbAttrs = _nullishCoalesce(attributesByObjectId.get(r.objectId), () => ( []));
|
|
4309
4219
|
const attrs = dbAttrs.map((a) => ({
|
|
4310
4220
|
...a.config,
|
|
@@ -4317,8 +4227,8 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4317
4227
|
const enrichedValues = enrichValuesForDisplay(r.values, attrs);
|
|
4318
4228
|
return {
|
|
4319
4229
|
objectId: r.objectId,
|
|
4320
|
-
objectName: _nullishCoalesce(_optionalChain([obj, 'optionalAccess',
|
|
4321
|
-
objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess',
|
|
4230
|
+
objectName: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _74 => _74.name]), () => ( "unknown")),
|
|
4231
|
+
objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _75 => _75.label]), () => ( "Unknown")),
|
|
4322
4232
|
label: renderLabelExpression(labelExpression, enrichedValues),
|
|
4323
4233
|
recordId: r.id,
|
|
4324
4234
|
completionStatus: r.completionStatus,
|
|
@@ -4329,9 +4239,9 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4329
4239
|
return Promise.resolve({ results, total });
|
|
4330
4240
|
},
|
|
4331
4241
|
globalSearchGrouped(query, options) {
|
|
4332
|
-
const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4242
|
+
const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _76 => _76.limitPerGroup]), () => ( 5));
|
|
4333
4243
|
return this.globalSearch(query, {
|
|
4334
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
4244
|
+
objectNames: _optionalChain([options, 'optionalAccess', _77 => _77.objectNames]),
|
|
4335
4245
|
limit: 500,
|
|
4336
4246
|
offset: 0
|
|
4337
4247
|
}).then(({ results }) => {
|
|
@@ -4592,7 +4502,6 @@ function createEmptyStores() {
|
|
|
4592
4502
|
workflowAccessGrants: /* @__PURE__ */ new Map(),
|
|
4593
4503
|
aiConversations: /* @__PURE__ */ new Map(),
|
|
4594
4504
|
aiMessages: /* @__PURE__ */ new Map(),
|
|
4595
|
-
aiUserMemory: /* @__PURE__ */ new Map(),
|
|
4596
4505
|
aiUsageMetrics: /* @__PURE__ */ new Map(),
|
|
4597
4506
|
relationAttributes: /* @__PURE__ */ new Map()
|
|
4598
4507
|
};
|
|
@@ -4678,7 +4587,7 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4678
4587
|
list(options) {
|
|
4679
4588
|
const tenantId = getTenantId();
|
|
4680
4589
|
let results = Array.from(stores.userProfiles.values()).filter((p) => p.tenantId === tenantId);
|
|
4681
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4590
|
+
if (_optionalChain([options, 'optionalAccess', _78 => _78.limit])) {
|
|
4682
4591
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
4683
4592
|
}
|
|
4684
4593
|
return Promise.resolve(results);
|
|
@@ -4692,7 +4601,7 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4692
4601
|
for (const profile of profiles) {
|
|
4693
4602
|
const roleIds = Array.from(stores.userRoles.values()).filter((ur) => ur.userProfileId === profile.id && ur.tenantId === tenantId).map((ur) => ur.roleId);
|
|
4694
4603
|
const roles = Array.from(stores.roles.values()).filter((r) => roleIds.includes(r.id));
|
|
4695
|
-
if (_optionalChain([filters, 'optionalAccess',
|
|
4604
|
+
if (_optionalChain([filters, 'optionalAccess', _79 => _79.allowedRoles]) && filters.allowedRoles.length > 0) {
|
|
4696
4605
|
const allowed = filters.allowedRoles;
|
|
4697
4606
|
const hasMatchingRole = roles.some((r) => allowed.includes(r.name));
|
|
4698
4607
|
if (!hasMatchingRole) continue;
|
|
@@ -4776,7 +4685,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4776
4685
|
},
|
|
4777
4686
|
deleteRole(roleId) {
|
|
4778
4687
|
const role = stores.roles.get(roleId);
|
|
4779
|
-
if (_optionalChain([role, 'optionalAccess',
|
|
4688
|
+
if (_optionalChain([role, 'optionalAccess', _80 => _80.system])) {
|
|
4780
4689
|
return Promise.reject(new Error(`Cannot delete system role ${roleId}`));
|
|
4781
4690
|
}
|
|
4782
4691
|
stores.roles.delete(roleId);
|
|
@@ -5284,7 +5193,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5284
5193
|
(i) => i.tenant_id === tenantId
|
|
5285
5194
|
);
|
|
5286
5195
|
const total = results.length;
|
|
5287
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5196
|
+
if (_optionalChain([options, 'optionalAccess', _81 => _81.limit])) {
|
|
5288
5197
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
5289
5198
|
}
|
|
5290
5199
|
return Promise.resolve({ instances: results, total });
|
|
@@ -5312,7 +5221,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5312
5221
|
pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
|
|
5313
5222
|
error: null,
|
|
5314
5223
|
started_by: data.startedBy,
|
|
5315
|
-
expires_at: _nullishCoalesce(_optionalChain([data, 'access',
|
|
5224
|
+
expires_at: _nullishCoalesce(_optionalChain([data, 'access', _82 => _82.expiresAt, 'optionalAccess', _83 => _83.toISOString, 'call', _84 => _84()]), () => ( null)),
|
|
5316
5225
|
created_at: now,
|
|
5317
5226
|
updated_at: now,
|
|
5318
5227
|
completed_at: null
|
|
@@ -5337,8 +5246,8 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5337
5246
|
history: _nullishCoalesce(data.history, () => ( existing.history)),
|
|
5338
5247
|
pending_action: data.pendingAction !== void 0 ? data.pendingAction : existing.pending_action,
|
|
5339
5248
|
error: data.error !== void 0 ? data.error : existing.error,
|
|
5340
|
-
expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5341
|
-
completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5249
|
+
expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _85 => _85.expiresAt, 'optionalAccess', _86 => _86.toISOString, 'call', _87 => _87()]), () => ( null)) : existing.expires_at,
|
|
5250
|
+
completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _88 => _88.completedAt, 'optionalAccess', _89 => _89.toISOString, 'call', _90 => _90()]), () => ( null)) : existing.completed_at,
|
|
5342
5251
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5343
5252
|
};
|
|
5344
5253
|
stores.workflowInstances.set(id, updated);
|
|
@@ -5371,7 +5280,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5371
5280
|
pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
|
|
5372
5281
|
error: null,
|
|
5373
5282
|
started_by: data.startedBy,
|
|
5374
|
-
expires_at: _nullishCoalesce(_optionalChain([data, 'access',
|
|
5283
|
+
expires_at: _nullishCoalesce(_optionalChain([data, 'access', _91 => _91.expiresAt, 'optionalAccess', _92 => _92.toISOString, 'call', _93 => _93()]), () => ( null)),
|
|
5375
5284
|
created_at: now,
|
|
5376
5285
|
updated_at: now,
|
|
5377
5286
|
completed_at: null
|
|
@@ -5394,13 +5303,13 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5394
5303
|
return slotData.id === recordId;
|
|
5395
5304
|
});
|
|
5396
5305
|
});
|
|
5397
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5306
|
+
if (_optionalChain([options, 'optionalAccess', _94 => _94.status])) {
|
|
5398
5307
|
results = results.filter((i) => i.status === options.status);
|
|
5399
5308
|
}
|
|
5400
5309
|
const total = results.length;
|
|
5401
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5402
|
-
const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
5403
|
-
const end = _optionalChain([options, 'optionalAccess',
|
|
5310
|
+
if (_optionalChain([options, 'optionalAccess', _95 => _95.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _96 => _96.limit]) !== void 0) {
|
|
5311
|
+
const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _97 => _97.offset]), () => ( 0));
|
|
5312
|
+
const end = _optionalChain([options, 'optionalAccess', _98 => _98.limit]) ? start + options.limit : void 0;
|
|
5404
5313
|
results = results.slice(start, end);
|
|
5405
5314
|
}
|
|
5406
5315
|
return Promise.resolve({ instances: results, total });
|
|
@@ -5460,7 +5369,7 @@ function createMockWorkflowInvitationsRepository(stores) {
|
|
|
5460
5369
|
const updated = {
|
|
5461
5370
|
...existing,
|
|
5462
5371
|
status: _nullishCoalesce(data.status, () => ( existing.status)),
|
|
5463
|
-
accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5372
|
+
accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _99 => _99.acceptedAt, 'optionalAccess', _100 => _100.toISOString, 'call', _101 => _101()]), () => ( null)) : existing.accepted_at,
|
|
5464
5373
|
expires_at: data.expiresAt !== void 0 ? data.expiresAt.toISOString() : existing.expires_at
|
|
5465
5374
|
};
|
|
5466
5375
|
stores.workflowInvitations.set(id, updated);
|
|
@@ -5530,7 +5439,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
|
|
|
5530
5439
|
...existing,
|
|
5531
5440
|
last_used_at: data.lastUsedAt !== void 0 ? data.lastUsedAt.toISOString() : existing.last_used_at,
|
|
5532
5441
|
revoked_token_jtis: _nullishCoalesce(data.revokedTokenJtis, () => ( existing.revoked_token_jtis)),
|
|
5533
|
-
revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5442
|
+
revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _102 => _102.revokedAt, 'optionalAccess', _103 => _103.toISOString, 'call', _104 => _104()]), () => ( null)) : existing.revoked_at
|
|
5534
5443
|
};
|
|
5535
5444
|
stores.workflowAccessGrants.set(id, updated);
|
|
5536
5445
|
return Promise.resolve(updated);
|
|
@@ -5556,7 +5465,6 @@ function createMockAdapter() {
|
|
|
5556
5465
|
workflowAccessGrants: createMockWorkflowAccessGrantsRepository(stores),
|
|
5557
5466
|
// AI repositories
|
|
5558
5467
|
aiConversations: createMockAIConversationsRepository(stores),
|
|
5559
|
-
aiUserMemory: createMockAIUserMemoryRepository(stores),
|
|
5560
5468
|
aiUsageMetrics: createMockAIUsageMetricsRepository(stores),
|
|
5561
5469
|
// Relation attributes repository
|
|
5562
5470
|
relationAttributes: createMockRelationAttributesRepository(stores),
|
|
@@ -5583,7 +5491,6 @@ function createMockAdapter() {
|
|
|
5583
5491
|
stores.workflowAccessGrants.clear();
|
|
5584
5492
|
stores.aiConversations.clear();
|
|
5585
5493
|
stores.aiMessages.clear();
|
|
5586
|
-
stores.aiUserMemory.clear();
|
|
5587
5494
|
stores.aiUsageMetrics.clear();
|
|
5588
5495
|
stores.relationAttributes.clear();
|
|
5589
5496
|
}
|
|
@@ -5753,7 +5660,7 @@ var BaseService = class {
|
|
|
5753
5660
|
* @param key - Cache key to invalidate
|
|
5754
5661
|
*/
|
|
5755
5662
|
async invalidateCache(key) {
|
|
5756
|
-
await _optionalChain([this, 'access',
|
|
5663
|
+
await _optionalChain([this, 'access', _105 => _105.cache, 'optionalAccess', _106 => _106.delete, 'call', _107 => _107(key)]);
|
|
5757
5664
|
}
|
|
5758
5665
|
/**
|
|
5759
5666
|
* Invalidate all cache keys matching a pattern.
|
|
@@ -5761,7 +5668,7 @@ var BaseService = class {
|
|
|
5761
5668
|
* @param pattern - Glob-style pattern (e.g., "schema:tenant-123:*")
|
|
5762
5669
|
*/
|
|
5763
5670
|
async invalidateCachePattern(pattern) {
|
|
5764
|
-
await _optionalChain([this, 'access',
|
|
5671
|
+
await _optionalChain([this, 'access', _108 => _108.cache, 'optionalAccess', _109 => _109.deletePattern, 'call', _110 => _110(pattern)]);
|
|
5765
5672
|
}
|
|
5766
5673
|
/**
|
|
5767
5674
|
* Invalidate all cached lists for a resource.
|
|
@@ -5988,17 +5895,17 @@ function validateOptions(options, attributeName) {
|
|
|
5988
5895
|
const ids = /* @__PURE__ */ new Set();
|
|
5989
5896
|
const values = /* @__PURE__ */ new Set();
|
|
5990
5897
|
for (const option of options) {
|
|
5991
|
-
if (!_optionalChain([option, 'access',
|
|
5898
|
+
if (!_optionalChain([option, 'access', _111 => _111.id, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()])) {
|
|
5992
5899
|
throw new Error(
|
|
5993
5900
|
`[AttributeBuilder] Option in "${attributeName}" has an empty or missing id.`
|
|
5994
5901
|
);
|
|
5995
5902
|
}
|
|
5996
|
-
if (!_optionalChain([option, 'access',
|
|
5903
|
+
if (!_optionalChain([option, 'access', _114 => _114.value, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])) {
|
|
5997
5904
|
throw new Error(
|
|
5998
5905
|
`[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing value.`
|
|
5999
5906
|
);
|
|
6000
5907
|
}
|
|
6001
|
-
if (!_optionalChain([option, 'access',
|
|
5908
|
+
if (!_optionalChain([option, 'access', _117 => _117.label, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()])) {
|
|
6002
5909
|
throw new Error(
|
|
6003
5910
|
`[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing label.`
|
|
6004
5911
|
);
|
|
@@ -6096,8 +6003,8 @@ var BaseAttributeBuilder = class {
|
|
|
6096
6003
|
featureGate(flagName, options) {
|
|
6097
6004
|
this.attr.featureGate = {
|
|
6098
6005
|
flag: flagName,
|
|
6099
|
-
expectedValue: _optionalChain([options, 'optionalAccess',
|
|
6100
|
-
fallback: _optionalChain([options, 'optionalAccess',
|
|
6006
|
+
expectedValue: _optionalChain([options, 'optionalAccess', _120 => _120.expectedValue]),
|
|
6007
|
+
fallback: _optionalChain([options, 'optionalAccess', _121 => _121.fallback])
|
|
6101
6008
|
};
|
|
6102
6009
|
return this;
|
|
6103
6010
|
}
|
|
@@ -6540,7 +6447,7 @@ var BaseRelationAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
6540
6447
|
object: objectName,
|
|
6541
6448
|
...options
|
|
6542
6449
|
};
|
|
6543
|
-
_optionalChain([this, 'access',
|
|
6450
|
+
_optionalChain([this, 'access', _122 => _122.attr, 'access', _123 => _123.targets, 'optionalAccess', _124 => _124.push, 'call', _125 => _125(target)]);
|
|
6544
6451
|
return this;
|
|
6545
6452
|
}
|
|
6546
6453
|
/**
|
|
@@ -6652,9 +6559,9 @@ var MultiRelationAttributeBuilder = class extends BaseRelationAttributeBuilder {
|
|
|
6652
6559
|
constructor(name, label, initOptions) {
|
|
6653
6560
|
super("relation", name, label);
|
|
6654
6561
|
this.attr.cardinality = "many";
|
|
6655
|
-
this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess',
|
|
6562
|
+
this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _126 => _126.targets]), () => ( []));
|
|
6656
6563
|
this.attr.defaultValue = [];
|
|
6657
|
-
if (_optionalChain([initOptions, 'optionalAccess',
|
|
6564
|
+
if (_optionalChain([initOptions, 'optionalAccess', _127 => _127.isRequired])) {
|
|
6658
6565
|
this.setRequired(true);
|
|
6659
6566
|
}
|
|
6660
6567
|
}
|
|
@@ -7086,7 +6993,7 @@ var GroupBuilder = class {
|
|
|
7086
6993
|
*/
|
|
7087
6994
|
fields(...names) {
|
|
7088
6995
|
for (const name of names) {
|
|
7089
|
-
_optionalChain([this, 'access',
|
|
6996
|
+
_optionalChain([this, 'access', _128 => _128.data, 'access', _129 => _129.fields, 'optionalAccess', _130 => _130.push, 'call', _131 => _131({ attribute: name })]);
|
|
7090
6997
|
}
|
|
7091
6998
|
return this;
|
|
7092
6999
|
}
|
|
@@ -7095,7 +7002,7 @@ var GroupBuilder = class {
|
|
|
7095
7002
|
* @example .field("name", { span: 8, readOnly: true })
|
|
7096
7003
|
*/
|
|
7097
7004
|
field(attribute, options) {
|
|
7098
|
-
_optionalChain([this, 'access',
|
|
7005
|
+
_optionalChain([this, 'access', _132 => _132.data, 'access', _133 => _133.fields, 'optionalAccess', _134 => _134.push, 'call', _135 => _135({ attribute, ...options })]);
|
|
7099
7006
|
return this;
|
|
7100
7007
|
}
|
|
7101
7008
|
/**
|
|
@@ -7104,7 +7011,7 @@ var GroupBuilder = class {
|
|
|
7104
7011
|
* @example .attributeGroup({ id: "address", label: "Address", attributes: ["street", "city", "postal_code"], displayTemplate: "{street}, {city}" })
|
|
7105
7012
|
*/
|
|
7106
7013
|
attributeGroup(config, options) {
|
|
7107
|
-
_optionalChain([this, 'access',
|
|
7014
|
+
_optionalChain([this, 'access', _136 => _136.data, 'access', _137 => _137.fields, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ attributeGroup: config, ...options })]);
|
|
7108
7015
|
return this;
|
|
7109
7016
|
}
|
|
7110
7017
|
/**
|
|
@@ -8172,8 +8079,8 @@ var WorkflowFormRowBuilder = class {
|
|
|
8172
8079
|
id: `${this.rowData.id}-${slotId}-${attribute}`,
|
|
8173
8080
|
slotId,
|
|
8174
8081
|
attribute,
|
|
8175
|
-
label: _optionalChain([options, 'optionalAccess',
|
|
8176
|
-
required: _optionalChain([options, 'optionalAccess',
|
|
8082
|
+
label: _optionalChain([options, 'optionalAccess', _140 => _140.label]),
|
|
8083
|
+
required: _optionalChain([options, 'optionalAccess', _141 => _141.required])
|
|
8177
8084
|
};
|
|
8178
8085
|
this.rowData.fields.push(field);
|
|
8179
8086
|
return this;
|
|
@@ -8532,7 +8439,7 @@ var WorkflowBuilder = class {
|
|
|
8532
8439
|
* @param options - Slot configuration
|
|
8533
8440
|
*/
|
|
8534
8441
|
slot(id, objectName, options) {
|
|
8535
|
-
if (_optionalChain([this, 'access',
|
|
8442
|
+
if (_optionalChain([this, 'access', _142 => _142.data, 'access', _143 => _143.slots, 'optionalAccess', _144 => _144.some, 'call', _145 => _145((s) => s.id === id)])) {
|
|
8536
8443
|
throw new Error(`[WorkflowBuilder] Duplicate slot id: "${id}"`);
|
|
8537
8444
|
}
|
|
8538
8445
|
const slot = {
|
|
@@ -8543,7 +8450,7 @@ var WorkflowBuilder = class {
|
|
|
8543
8450
|
color: options.color,
|
|
8544
8451
|
icon: options.icon
|
|
8545
8452
|
};
|
|
8546
|
-
_optionalChain([this, 'access',
|
|
8453
|
+
_optionalChain([this, 'access', _146 => _146.data, 'access', _147 => _147.slots, 'optionalAccess', _148 => _148.push, 'call', _149 => _149(slot)]);
|
|
8547
8454
|
return this;
|
|
8548
8455
|
}
|
|
8549
8456
|
// ============================================================================
|
|
@@ -8670,7 +8577,7 @@ var WorkflowBuilder = class {
|
|
|
8670
8577
|
}
|
|
8671
8578
|
}
|
|
8672
8579
|
validateSlotReferences() {
|
|
8673
|
-
const slotIds = _nullishCoalesce(_optionalChain([this, 'access',
|
|
8580
|
+
const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _150 => _150.data, 'access', _151 => _151.slots, 'optionalAccess', _152 => _152.reduce, 'call', _153 => _153((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
|
|
8674
8581
|
for (const node of Object.values(_nullishCoalesce(this.data.nodes, () => ( {})))) {
|
|
8675
8582
|
for (const slotId of getNodeSlotIds(node)) {
|
|
8676
8583
|
if (!slotIds.has(slotId)) {
|
|
@@ -8962,7 +8869,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
8962
8869
|
constructor(adapter, nativeRegistry, options) {
|
|
8963
8870
|
super(adapter);
|
|
8964
8871
|
this.nativeRegistry = nativeRegistry;
|
|
8965
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
8872
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _154 => _154.auditService]);
|
|
8966
8873
|
this.bilateralValidationService = new BilateralValidationService(adapter, this);
|
|
8967
8874
|
}
|
|
8968
8875
|
/**
|
|
@@ -9205,7 +9112,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9205
9112
|
resourceType: "attribute",
|
|
9206
9113
|
resourceId: attributeId,
|
|
9207
9114
|
resourceLabel: updatedDbAttr.label,
|
|
9208
|
-
objectName: _optionalChain([dbObject, 'optionalAccess',
|
|
9115
|
+
objectName: _optionalChain([dbObject, 'optionalAccess', _155 => _155.name]),
|
|
9209
9116
|
objectId: dbAttr.objectId,
|
|
9210
9117
|
changes
|
|
9211
9118
|
});
|
|
@@ -9238,7 +9145,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9238
9145
|
);
|
|
9239
9146
|
}
|
|
9240
9147
|
const dbObject = await this.adapter.objects.findById(dbAttr.objectId);
|
|
9241
|
-
if (_optionalChain([dbObject, 'optionalAccess',
|
|
9148
|
+
if (_optionalChain([dbObject, 'optionalAccess', _156 => _156.labelExpression])) {
|
|
9242
9149
|
const usedAttributes = extractAttributeNames(dbObject.labelExpression);
|
|
9243
9150
|
if (usedAttributes.includes(dbAttr.name)) {
|
|
9244
9151
|
throw new AttributeInUseError(dbAttr.name, "labelExpression");
|
|
@@ -9254,7 +9161,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9254
9161
|
resourceType: "attribute",
|
|
9255
9162
|
resourceId: attributeId,
|
|
9256
9163
|
resourceLabel: dbAttr.label,
|
|
9257
|
-
objectName: _optionalChain([dbObject, 'optionalAccess',
|
|
9164
|
+
objectName: _optionalChain([dbObject, 'optionalAccess', _157 => _157.name]),
|
|
9258
9165
|
objectId: dbAttr.objectId
|
|
9259
9166
|
});
|
|
9260
9167
|
}
|
|
@@ -9269,9 +9176,9 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9269
9176
|
async listAttributes(objectId, options) {
|
|
9270
9177
|
const dbAttributes = await this.adapter.attributes.findByObjectId(objectId);
|
|
9271
9178
|
let filtered = dbAttributes;
|
|
9272
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9179
|
+
if (_optionalChain([options, 'optionalAccess', _158 => _158.systemOnly])) {
|
|
9273
9180
|
filtered = dbAttributes.filter((attr) => attr.system);
|
|
9274
|
-
} else if (_optionalChain([options, 'optionalAccess',
|
|
9181
|
+
} else if (_optionalChain([options, 'optionalAccess', _159 => _159.customOnly])) {
|
|
9275
9182
|
filtered = dbAttributes.filter((attr) => !attr.system);
|
|
9276
9183
|
}
|
|
9277
9184
|
return filtered.map((attr) => this.convertDBAttributeToAttribute(attr));
|
|
@@ -9307,14 +9214,14 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9307
9214
|
pluralLabel: dbObject.pluralLabel,
|
|
9308
9215
|
description: dbObject.description,
|
|
9309
9216
|
labelExpression: dbObject.labelExpression,
|
|
9310
|
-
icon: _optionalChain([dbObject, 'access',
|
|
9217
|
+
icon: _optionalChain([dbObject, 'access', _160 => _160.metadata, 'optionalAccess', _161 => _161.icon])
|
|
9311
9218
|
};
|
|
9312
9219
|
let metadata = dbObject.metadata;
|
|
9313
9220
|
if (updates.icon !== void 0 || updates.metadata !== void 0) {
|
|
9314
9221
|
metadata = {
|
|
9315
9222
|
...dbObject.metadata,
|
|
9316
9223
|
...updates.metadata,
|
|
9317
|
-
icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access',
|
|
9224
|
+
icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _162 => _162.metadata, 'optionalAccess', _163 => _163.icon])))
|
|
9318
9225
|
};
|
|
9319
9226
|
}
|
|
9320
9227
|
const updatedDbObject = await this.adapter.objects.update(objectId, {
|
|
@@ -9570,7 +9477,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9570
9477
|
let properties = inverseDbAttr.config.properties;
|
|
9571
9478
|
if (!properties) {
|
|
9572
9479
|
const nativeObj = this.nativeRegistry.getByName(bilateral.object);
|
|
9573
|
-
const nativeAttr = _optionalChain([nativeObj, 'optionalAccess',
|
|
9480
|
+
const nativeAttr = _optionalChain([nativeObj, 'optionalAccess', _164 => _164.attributes, 'access', _165 => _165.find, 'call', _166 => _166((a) => a.name === bilateral.attribute)]);
|
|
9574
9481
|
if (nativeAttr && "properties" in nativeAttr) {
|
|
9575
9482
|
properties = nativeAttr.properties;
|
|
9576
9483
|
}
|
|
@@ -9659,7 +9566,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9659
9566
|
label: dbObject.label,
|
|
9660
9567
|
pluralLabel: dbObject.pluralLabel,
|
|
9661
9568
|
description: dbObject.description,
|
|
9662
|
-
icon: _optionalChain([dbObject, 'access',
|
|
9569
|
+
icon: _optionalChain([dbObject, 'access', _167 => _167.metadata, 'optionalAccess', _168 => _168.icon]),
|
|
9663
9570
|
labelExpression: dbObject.labelExpression,
|
|
9664
9571
|
attributes,
|
|
9665
9572
|
system: dbObject.system,
|
|
@@ -9759,7 +9666,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9759
9666
|
const hasRelationToTarget = attrs.some((attr) => {
|
|
9760
9667
|
if (attr.type !== "relation") return false;
|
|
9761
9668
|
const config = attr.config;
|
|
9762
|
-
return _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
9669
|
+
return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _169 => _169.targets, 'optionalAccess', _170 => _170.some, 'call', _171 => _171((t) => t.object === targetObjectName)]), () => ( false));
|
|
9763
9670
|
});
|
|
9764
9671
|
if (hasRelationToTarget) {
|
|
9765
9672
|
referencing.push(obj.name);
|
|
@@ -9837,7 +9744,7 @@ Native objects must have system=true. Did you forget to call .system() in your b
|
|
|
9837
9744
|
const existing = this.objects.get(object2.name);
|
|
9838
9745
|
throw new Error(
|
|
9839
9746
|
`[NativeObjectRegistry] Duplicate object name "${object2.name}":
|
|
9840
|
-
- Existing: "${_optionalChain([existing, 'optionalAccess',
|
|
9747
|
+
- Existing: "${_optionalChain([existing, 'optionalAccess', _172 => _172.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _173 => _173.id])})
|
|
9841
9748
|
- New: "${object2.label}" (id: ${object2.id})
|
|
9842
9749
|
Please use unique names for each native object.`
|
|
9843
9750
|
);
|
|
@@ -9954,7 +9861,7 @@ var AuditService = class extends BaseService {
|
|
|
9954
9861
|
this.isFlushing = false;
|
|
9955
9862
|
/** Pending flush promise to allow waiting on concurrent flush */
|
|
9956
9863
|
this.flushPromise = null;
|
|
9957
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9864
|
+
if (_optionalChain([options, 'optionalAccess', _174 => _174.async]) && options.flushIntervalMs) {
|
|
9958
9865
|
this.startFlushTimer();
|
|
9959
9866
|
}
|
|
9960
9867
|
}
|
|
@@ -10152,7 +10059,7 @@ var AuditService = class extends BaseService {
|
|
|
10152
10059
|
return;
|
|
10153
10060
|
}
|
|
10154
10061
|
const resolved = await this.resolveActorEmail(entry);
|
|
10155
|
-
if (_optionalChain([this, 'access',
|
|
10062
|
+
if (_optionalChain([this, 'access', _175 => _175.options, 'optionalAccess', _176 => _176.async])) {
|
|
10156
10063
|
this.buffer.push(resolved);
|
|
10157
10064
|
const batchSize = _nullishCoalesce(this.options.batchSize, () => ( 10));
|
|
10158
10065
|
if (this.buffer.length >= batchSize) {
|
|
@@ -10169,7 +10076,7 @@ var AuditService = class extends BaseService {
|
|
|
10169
10076
|
if (!entry.actorEmail && entry.actorId) {
|
|
10170
10077
|
try {
|
|
10171
10078
|
const profile = await this.adapter.userProfiles.findById(entry.actorId);
|
|
10172
|
-
if (_optionalChain([profile, 'optionalAccess',
|
|
10079
|
+
if (_optionalChain([profile, 'optionalAccess', _177 => _177.email])) {
|
|
10173
10080
|
return { ...entry, actorEmail: profile.email };
|
|
10174
10081
|
}
|
|
10175
10082
|
} catch (e13) {
|
|
@@ -10181,7 +10088,7 @@ var AuditService = class extends BaseService {
|
|
|
10181
10088
|
* Start the flush timer for async mode
|
|
10182
10089
|
*/
|
|
10183
10090
|
startFlushTimer() {
|
|
10184
|
-
const intervalMs = _nullishCoalesce(_optionalChain([this, 'access',
|
|
10091
|
+
const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.flushIntervalMs]), () => ( 1e3));
|
|
10185
10092
|
this.flushTimer = setInterval(() => {
|
|
10186
10093
|
this.flush().catch(() => {
|
|
10187
10094
|
});
|
|
@@ -10211,7 +10118,7 @@ var browserStub4 = {
|
|
|
10211
10118
|
run: (_store, callback) => callback()
|
|
10212
10119
|
};
|
|
10213
10120
|
var AsyncLocalStorageClass4 = null;
|
|
10214
|
-
if (typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
10121
|
+
if (typeof process !== "undefined" && _optionalChain([process, 'access', _180 => _180.versions, 'optionalAccess', _181 => _181.node])) {
|
|
10215
10122
|
try {
|
|
10216
10123
|
if (typeof _chunk3RG5ZIWIjs.__require !== "undefined") {
|
|
10217
10124
|
const asyncHooks = _chunk3RG5ZIWIjs.__require.call(void 0, "async_hooks");
|
|
@@ -10270,7 +10177,7 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10270
10177
|
}
|
|
10271
10178
|
const ctx = getSyncContext().getStore();
|
|
10272
10179
|
const syncKey = `${sourceSchema.name}:${sourceRecordId}:${attributeName}`;
|
|
10273
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
10180
|
+
if (_optionalChain([ctx, 'optionalAccess', _182 => _182.syncing, 'access', _183 => _183.has, 'call', _184 => _184(syncKey)])) {
|
|
10274
10181
|
return;
|
|
10275
10182
|
}
|
|
10276
10183
|
await this.runWithSyncContext(syncKey, async () => {
|
|
@@ -10495,7 +10402,7 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10495
10402
|
const storage = getSyncContext();
|
|
10496
10403
|
const existingCtx = storage.getStore();
|
|
10497
10404
|
const ctx = {
|
|
10498
|
-
syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess',
|
|
10405
|
+
syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess', _185 => _185.syncing]), () => ( [])))
|
|
10499
10406
|
};
|
|
10500
10407
|
ctx.syncing.add(syncKey);
|
|
10501
10408
|
return await storage.run(ctx, fn);
|
|
@@ -10603,7 +10510,7 @@ var UserService = class extends BaseService {
|
|
|
10603
10510
|
if (roleErrors.length > 0) {
|
|
10604
10511
|
errors.push({
|
|
10605
10512
|
attribute: attrName,
|
|
10606
|
-
message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access',
|
|
10513
|
+
message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _186 => _186.allowedRoles, 'optionalAccess', _187 => _187.join, 'call', _188 => _188(", ")])}`,
|
|
10607
10514
|
invalidIds: roleErrors
|
|
10608
10515
|
});
|
|
10609
10516
|
}
|
|
@@ -11133,7 +11040,7 @@ var RelationPropertiesService = class extends BaseService {
|
|
|
11133
11040
|
}
|
|
11134
11041
|
}
|
|
11135
11042
|
}
|
|
11136
|
-
const shouldStoreAsInverse = _optionalChain([attribute, 'access',
|
|
11043
|
+
const shouldStoreAsInverse = _optionalChain([attribute, 'access', _189 => _189.bilateral, 'optionalAccess', _190 => _190.storageOwner]) === false;
|
|
11137
11044
|
let storageFromObject = schema.name;
|
|
11138
11045
|
let storageFromAttribute = attributeName;
|
|
11139
11046
|
if (shouldStoreAsInverse && attribute.bilateral) {
|
|
@@ -11145,7 +11052,7 @@ var RelationPropertiesService = class extends BaseService {
|
|
|
11145
11052
|
if (shouldStoreAsInverse) {
|
|
11146
11053
|
const results = await Promise.all(
|
|
11147
11054
|
normalized.map(
|
|
11148
|
-
(item) => _optionalChain([adapter, 'access',
|
|
11055
|
+
(item) => _optionalChain([adapter, 'access', _191 => _191.relationAttributes, 'optionalAccess', _192 => _192.findBySource, 'call', _193 => _193(
|
|
11149
11056
|
storageFromObject,
|
|
11150
11057
|
item.id,
|
|
11151
11058
|
storageFromAttribute
|
|
@@ -11284,7 +11191,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11284
11191
|
super(adapter);
|
|
11285
11192
|
this.schemaService = schemaService;
|
|
11286
11193
|
this.options = options;
|
|
11287
|
-
this.policyRegistry = _optionalChain([options, 'optionalAccess',
|
|
11194
|
+
this.policyRegistry = _optionalChain([options, 'optionalAccess', _194 => _194.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _195 => _195.policyRegistry]), () => ( defaultPolicyRegistry));
|
|
11288
11195
|
this.relationPropertiesService = new RelationPropertiesService(adapter);
|
|
11289
11196
|
}
|
|
11290
11197
|
// ============================================================================
|
|
@@ -11335,12 +11242,12 @@ var RecordQueryService = class extends BaseService {
|
|
|
11335
11242
|
* Internal list query execution
|
|
11336
11243
|
*/
|
|
11337
11244
|
async executeListQuery(schema, objectId, options) {
|
|
11338
|
-
if (_optionalChain([this, 'access',
|
|
11245
|
+
if (_optionalChain([this, 'access', _196 => _196.options, 'optionalAccess', _197 => _197.permissionService]) && this.userId) {
|
|
11339
11246
|
await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
|
|
11340
11247
|
}
|
|
11341
|
-
const policy = _optionalChain([options, 'optionalAccess',
|
|
11248
|
+
const policy = _optionalChain([options, 'optionalAccess', _198 => _198.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
|
|
11342
11249
|
let effectiveOptions = options;
|
|
11343
|
-
if (_optionalChain([policy, 'optionalAccess',
|
|
11250
|
+
if (_optionalChain([policy, 'optionalAccess', _199 => _199.applyListFilter]) && this.userId) {
|
|
11344
11251
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
11345
11252
|
effectiveOptions = policy.applyListFilter(ctx, options);
|
|
11346
11253
|
}
|
|
@@ -11350,10 +11257,10 @@ var RecordQueryService = class extends BaseService {
|
|
|
11350
11257
|
);
|
|
11351
11258
|
let filteredRecords = result.records;
|
|
11352
11259
|
let effectiveTotal = result.total;
|
|
11353
|
-
if (_optionalChain([policy, 'optionalAccess',
|
|
11260
|
+
if (_optionalChain([policy, 'optionalAccess', _200 => _200.canAccessRecord]) && this.userId) {
|
|
11354
11261
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
11355
|
-
const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess',
|
|
11356
|
-
const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess',
|
|
11262
|
+
const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _201 => _201.limit]), () => ( 20));
|
|
11263
|
+
const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _202 => _202.offset]), () => ( 0));
|
|
11357
11264
|
const overfetchMultiplier = 5;
|
|
11358
11265
|
const batchSize = requestedLimit * overfetchMultiplier;
|
|
11359
11266
|
const maxScanRecords = 1e4;
|
|
@@ -11375,7 +11282,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11375
11282
|
exhausted = true;
|
|
11376
11283
|
break;
|
|
11377
11284
|
}
|
|
11378
|
-
const filtered = batch.records.filter((record) => _optionalChain([policy, 'access',
|
|
11285
|
+
const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _203 => _203.canAccessRecord, 'optionalCall', _204 => _204(ctx, record)]));
|
|
11379
11286
|
collected.push(...filtered);
|
|
11380
11287
|
dbOffset += batch.records.length;
|
|
11381
11288
|
totalScanned += batch.records.length;
|
|
@@ -11391,7 +11298,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11391
11298
|
filteredRecords,
|
|
11392
11299
|
schema
|
|
11393
11300
|
);
|
|
11394
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11301
|
+
if (!_optionalChain([options, 'optionalAccess', _205 => _205.skipFormulas])) {
|
|
11395
11302
|
return {
|
|
11396
11303
|
records: enrichRecordsWithFormulas(filteredRecords, schema),
|
|
11397
11304
|
total: effectiveTotal
|
|
@@ -11451,17 +11358,17 @@ var RecordQueryService = class extends BaseService {
|
|
|
11451
11358
|
* Internal search query execution
|
|
11452
11359
|
*/
|
|
11453
11360
|
async executeSearchQuery(schema, objectId, query, options) {
|
|
11454
|
-
if (_optionalChain([this, 'access',
|
|
11361
|
+
if (_optionalChain([this, 'access', _206 => _206.options, 'optionalAccess', _207 => _207.permissionService]) && this.userId) {
|
|
11455
11362
|
await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
|
|
11456
11363
|
}
|
|
11457
11364
|
let result;
|
|
11458
11365
|
if (this.adapter.search) {
|
|
11459
11366
|
try {
|
|
11460
11367
|
result = await this.adapter.search.searchRecords(objectId, query, {
|
|
11461
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
11462
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
11463
|
-
sorts: _optionalChain([options, 'optionalAccess',
|
|
11464
|
-
filters: _optionalChain([options, 'optionalAccess',
|
|
11368
|
+
limit: _optionalChain([options, 'optionalAccess', _208 => _208.limit]),
|
|
11369
|
+
offset: _optionalChain([options, 'optionalAccess', _209 => _209.offset]),
|
|
11370
|
+
sorts: _optionalChain([options, 'optionalAccess', _210 => _210.sorts]),
|
|
11371
|
+
filters: _optionalChain([options, 'optionalAccess', _211 => _211.filters]),
|
|
11465
11372
|
attributes: schema.attributes
|
|
11466
11373
|
});
|
|
11467
11374
|
result = await this.healSearchResults(result);
|
|
@@ -11481,7 +11388,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11481
11388
|
result.records,
|
|
11482
11389
|
schema
|
|
11483
11390
|
);
|
|
11484
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11391
|
+
if (!_optionalChain([options, 'optionalAccess', _212 => _212.skipFormulas])) {
|
|
11485
11392
|
return {
|
|
11486
11393
|
records: enrichRecordsWithFormulas(enrichedRecords, schema),
|
|
11487
11394
|
total: result.total
|
|
@@ -11690,7 +11597,7 @@ var RelationService = class extends BaseService {
|
|
|
11690
11597
|
}
|
|
11691
11598
|
const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
|
|
11692
11599
|
const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
|
|
11693
|
-
if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess',
|
|
11600
|
+
if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _213 => _213.size]) === 0) {
|
|
11694
11601
|
errors.push({
|
|
11695
11602
|
attribute: attr.name,
|
|
11696
11603
|
message: `No valid target objects found for ${attr.label}`
|
|
@@ -11743,7 +11650,7 @@ var RelationService = class extends BaseService {
|
|
|
11743
11650
|
for (const target of targets) {
|
|
11744
11651
|
try {
|
|
11745
11652
|
const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
|
|
11746
|
-
if (_optionalChain([objectSchema, 'optionalAccess',
|
|
11653
|
+
if (_optionalChain([objectSchema, 'optionalAccess', _214 => _214.id])) {
|
|
11747
11654
|
objectIds.add(objectSchema.id);
|
|
11748
11655
|
}
|
|
11749
11656
|
} catch (e17) {
|
|
@@ -11812,7 +11719,7 @@ var RelationService = class extends BaseService {
|
|
|
11812
11719
|
const targetResults = await Promise.all(
|
|
11813
11720
|
filteredTargets.map(async (target) => {
|
|
11814
11721
|
const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
|
|
11815
|
-
if (!_optionalChain([objectSchema, 'optionalAccess',
|
|
11722
|
+
if (!_optionalChain([objectSchema, 'optionalAccess', _215 => _215.id])) return { options: [], total: 0 };
|
|
11816
11723
|
const objectId = objectSchema.id;
|
|
11817
11724
|
const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
|
|
11818
11725
|
const options = await Promise.all(
|
|
@@ -11969,8 +11876,8 @@ var RelationService = class extends BaseService {
|
|
|
11969
11876
|
continue;
|
|
11970
11877
|
}
|
|
11971
11878
|
const attribute = attributeMap.get(attributeId);
|
|
11972
|
-
const targetConfig = _optionalChain([attribute, 'optionalAccess',
|
|
11973
|
-
const customTemplate = _optionalChain([targetConfig, 'optionalAccess',
|
|
11879
|
+
const targetConfig = _optionalChain([attribute, 'optionalAccess', _216 => _216.targets, 'optionalAccess', _217 => _217.find, 'call', _218 => _218((t) => t.object === objectSchema.name)]);
|
|
11880
|
+
const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _219 => _219.displayTemplate]);
|
|
11974
11881
|
const label = await this.resolveLabel(record, objectSchema, customTemplate);
|
|
11975
11882
|
resolved.push({
|
|
11976
11883
|
_compositeId: compositeId,
|
|
@@ -12133,14 +12040,14 @@ var RollupService = class extends BaseService {
|
|
|
12133
12040
|
const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
|
|
12134
12041
|
let sourceObjectId;
|
|
12135
12042
|
let reverseRelationAttrName;
|
|
12136
|
-
if (_optionalChain([sourceSchema, 'optionalAccess',
|
|
12043
|
+
if (_optionalChain([sourceSchema, 'optionalAccess', _220 => _220.id])) {
|
|
12137
12044
|
sourceObjectId = sourceSchema.id;
|
|
12138
12045
|
const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
|
|
12139
12046
|
if (attr.type !== "relation") return false;
|
|
12140
12047
|
const relationConfig = attr;
|
|
12141
|
-
return _optionalChain([relationConfig, 'optionalAccess',
|
|
12048
|
+
return _optionalChain([relationConfig, 'optionalAccess', _221 => _221.targets, 'optionalAccess', _222 => _222.some, 'call', _223 => _223((t) => t.object === schema.name)]);
|
|
12142
12049
|
});
|
|
12143
|
-
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess',
|
|
12050
|
+
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _224 => _224.name]);
|
|
12144
12051
|
} else {
|
|
12145
12052
|
const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
|
|
12146
12053
|
if (!sourceObject) {
|
|
@@ -12151,9 +12058,9 @@ var RollupService = class extends BaseService {
|
|
|
12151
12058
|
const reverseRelationAttr = sourceAttributes.find((attr) => {
|
|
12152
12059
|
if (attr.type !== "relation") return false;
|
|
12153
12060
|
const relationConfig = attr.config;
|
|
12154
|
-
return _optionalChain([relationConfig, 'optionalAccess',
|
|
12061
|
+
return _optionalChain([relationConfig, 'optionalAccess', _225 => _225.targets, 'optionalAccess', _226 => _226.some, 'call', _227 => _227((t) => t.object === schema.name)]);
|
|
12155
12062
|
});
|
|
12156
|
-
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess',
|
|
12063
|
+
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _228 => _228.name]);
|
|
12157
12064
|
}
|
|
12158
12065
|
if (!reverseRelationAttrName) {
|
|
12159
12066
|
return { value: null, recordCount: 0 };
|
|
@@ -12409,13 +12316,13 @@ var RollupService = class extends BaseService {
|
|
|
12409
12316
|
if (!obj) continue;
|
|
12410
12317
|
for (const rollupDbAttr of rollupAttrs) {
|
|
12411
12318
|
const rollupConfig = rollupDbAttr.config;
|
|
12412
|
-
if (!_optionalChain([rollupConfig, 'optionalAccess',
|
|
12319
|
+
if (!_optionalChain([rollupConfig, 'optionalAccess', _229 => _229.relationAttribute])) continue;
|
|
12413
12320
|
const relationAttr = attributes.find(
|
|
12414
12321
|
(a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
|
|
12415
12322
|
);
|
|
12416
12323
|
if (!relationAttr) continue;
|
|
12417
12324
|
const relationConfig = relationAttr.config;
|
|
12418
|
-
const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess',
|
|
12325
|
+
const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _230 => _230.targets, 'optionalAccess', _231 => _231.some, 'call', _232 => _232(
|
|
12419
12326
|
(t) => t.object === changedSchema.name
|
|
12420
12327
|
)]);
|
|
12421
12328
|
if (!targetsChangedObject) continue;
|
|
@@ -12440,11 +12347,11 @@ var RecordService = class extends BaseService {
|
|
|
12440
12347
|
constructor(adapter, options) {
|
|
12441
12348
|
super(adapter);
|
|
12442
12349
|
this.schemaService = new ObjectSchemaService(adapter, registry, {
|
|
12443
|
-
auditService: _optionalChain([options, 'optionalAccess',
|
|
12350
|
+
auditService: _optionalChain([options, 'optionalAccess', _233 => _233.auditService])
|
|
12444
12351
|
});
|
|
12445
|
-
this.permissionService = _optionalChain([options, 'optionalAccess',
|
|
12446
|
-
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12447
|
-
this.policyRegistry = _optionalChain([options, 'optionalAccess',
|
|
12352
|
+
this.permissionService = _optionalChain([options, 'optionalAccess', _234 => _234.permissionService]);
|
|
12353
|
+
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _235 => _235.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
|
|
12354
|
+
this.policyRegistry = _optionalChain([options, 'optionalAccess', _236 => _236.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _237 => _237.policyRegistry]), () => ( defaultPolicyRegistry));
|
|
12448
12355
|
this.recordResolver = new RecordResolverService(adapter);
|
|
12449
12356
|
this.queryService = new RecordQueryService(adapter, this.schemaService, {
|
|
12450
12357
|
permissionService: this.permissionService,
|
|
@@ -12459,7 +12366,7 @@ var RecordService = class extends BaseService {
|
|
|
12459
12366
|
recordResolver: this.recordResolver
|
|
12460
12367
|
});
|
|
12461
12368
|
this.userService = new UserService(adapter);
|
|
12462
|
-
this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12369
|
+
this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _238 => _238.hookRegistry]), () => ( new NoopHookRegistry()));
|
|
12463
12370
|
this.bilateralSyncService = new BilateralSyncService(
|
|
12464
12371
|
adapter,
|
|
12465
12372
|
this.schemaService,
|
|
@@ -12499,25 +12406,25 @@ var RecordService = class extends BaseService {
|
|
|
12499
12406
|
schema,
|
|
12500
12407
|
this.tenantId,
|
|
12501
12408
|
dataWithDefaults,
|
|
12502
|
-
_optionalChain([options, 'optionalAccess',
|
|
12409
|
+
_optionalChain([options, 'optionalAccess', _239 => _239.hookMetadata])
|
|
12503
12410
|
);
|
|
12504
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12411
|
+
if (!_optionalChain([options, 'optionalAccess', _240 => _240.skipHooks])) {
|
|
12505
12412
|
await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
|
|
12506
12413
|
}
|
|
12507
12414
|
const normalizedData = this.relationPropertiesService.normalizeRelationValuesForStorage(
|
|
12508
12415
|
schema,
|
|
12509
12416
|
dataWithDefaults
|
|
12510
12417
|
);
|
|
12511
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12512
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12418
|
+
if (_optionalChain([options, 'optionalAccess', _241 => _241.validate]) !== false) {
|
|
12419
|
+
if (_optionalChain([options, 'optionalAccess', _242 => _242.allowDraft])) {
|
|
12513
12420
|
_chunkHUT6HYXJjs.validateDraftOrThrow.call(void 0, schema, normalizedData);
|
|
12514
12421
|
} else {
|
|
12515
12422
|
_chunkHUT6HYXJjs.validateObjectOrThrow.call(void 0, schema, normalizedData);
|
|
12516
12423
|
}
|
|
12517
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12424
|
+
if (!_optionalChain([options, 'optionalAccess', _243 => _243.skipRelationValidation])) {
|
|
12518
12425
|
await this.relationService.validateRelationsOrThrow(schema, normalizedData);
|
|
12519
12426
|
}
|
|
12520
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12427
|
+
if (!_optionalChain([options, 'optionalAccess', _244 => _244.skipUserValidation])) {
|
|
12521
12428
|
await this.userService.validateUsersOrThrow(schema, normalizedData);
|
|
12522
12429
|
}
|
|
12523
12430
|
}
|
|
@@ -12528,12 +12435,12 @@ var RecordService = class extends BaseService {
|
|
|
12528
12435
|
data: normalizedData,
|
|
12529
12436
|
label,
|
|
12530
12437
|
completionStatus,
|
|
12531
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
12438
|
+
metadata: _optionalChain([options, 'optionalAccess', _245 => _245.metadata]),
|
|
12532
12439
|
createdBy: this.userId
|
|
12533
12440
|
});
|
|
12534
12441
|
for (const [attrName, value] of Object.entries(dataWithDefaults)) {
|
|
12535
12442
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12536
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
12443
|
+
if (_optionalChain([attr, 'optionalAccess', _246 => _246.type]) === "relation") {
|
|
12537
12444
|
const hasProperties2 = attr.properties !== void 0;
|
|
12538
12445
|
const isBilateral = isBilateralRelation(attr);
|
|
12539
12446
|
if (hasProperties2 || isBilateral) {
|
|
@@ -12549,7 +12456,7 @@ var RecordService = class extends BaseService {
|
|
|
12549
12456
|
}
|
|
12550
12457
|
for (const [attrName, value] of Object.entries(normalizedData)) {
|
|
12551
12458
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12552
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
12459
|
+
if (_optionalChain([attr, 'optionalAccess', _247 => _247.type]) === "relation" && isBilateralRelation(attr)) {
|
|
12553
12460
|
await this.bilateralSyncService.syncBilateralRelation(
|
|
12554
12461
|
schema,
|
|
12555
12462
|
record.id,
|
|
@@ -12560,7 +12467,7 @@ var RecordService = class extends BaseService {
|
|
|
12560
12467
|
);
|
|
12561
12468
|
}
|
|
12562
12469
|
}
|
|
12563
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12470
|
+
if (!_optionalChain([options, 'optionalAccess', _248 => _248.skipHooks])) {
|
|
12564
12471
|
const afterCtx = {
|
|
12565
12472
|
...hookCtx,
|
|
12566
12473
|
recordId: record.id,
|
|
@@ -12570,11 +12477,11 @@ var RecordService = class extends BaseService {
|
|
|
12570
12477
|
}
|
|
12571
12478
|
await recalculateParentRollups(record, schema, this.rollupContext);
|
|
12572
12479
|
await this.invalidateRecordCaches(record.id, objectId);
|
|
12573
|
-
_optionalChain([this, 'access',
|
|
12480
|
+
_optionalChain([this, 'access', _249 => _249.adapter, 'access', _250 => _250.search, 'optionalAccess', _251 => _251.indexRecord, 'call', _252 => _252(record, {
|
|
12574
12481
|
objectName: schema.name,
|
|
12575
12482
|
objectLabel: schema.label,
|
|
12576
12483
|
attributes: schema.attributes
|
|
12577
|
-
}), 'access',
|
|
12484
|
+
}), 'access', _253 => _253.catch, 'call', _254 => _254((err) => console.error("[search] Failed to index created record", record.id, err))]);
|
|
12578
12485
|
if (this.auditService && this.userId) {
|
|
12579
12486
|
this.auditService.logRecordAction({
|
|
12580
12487
|
action: "record.created",
|
|
@@ -12583,7 +12490,7 @@ var RecordService = class extends BaseService {
|
|
|
12583
12490
|
objectId: schema.id,
|
|
12584
12491
|
recordId: record.id,
|
|
12585
12492
|
recordLabel: record.label,
|
|
12586
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
12493
|
+
metadata: _optionalChain([options, 'optionalAccess', _255 => _255.hookMetadata])
|
|
12587
12494
|
}).catch(() => {
|
|
12588
12495
|
});
|
|
12589
12496
|
}
|
|
@@ -12606,7 +12513,7 @@ var RecordService = class extends BaseService {
|
|
|
12606
12513
|
return null;
|
|
12607
12514
|
}
|
|
12608
12515
|
const schema = await this.schemaService.getObjectSchema(record.objectId);
|
|
12609
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12516
|
+
if (!_optionalChain([options, 'optionalAccess', _256 => _256.skipPolicyCheck])) {
|
|
12610
12517
|
const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
|
|
12611
12518
|
if (policy) {
|
|
12612
12519
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
@@ -12616,11 +12523,11 @@ var RecordService = class extends BaseService {
|
|
|
12616
12523
|
}
|
|
12617
12524
|
}
|
|
12618
12525
|
let enrichedRecord = record;
|
|
12619
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12526
|
+
if (!_optionalChain([options, 'optionalAccess', _257 => _257.skipFormulas])) {
|
|
12620
12527
|
enrichedRecord = enrichWithFormulas(record, schema);
|
|
12621
12528
|
}
|
|
12622
12529
|
enrichedRecord = await this.enrichRelationProperties(enrichedRecord, schema);
|
|
12623
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12530
|
+
if (_optionalChain([options, 'optionalAccess', _258 => _258.includeSchema])) {
|
|
12624
12531
|
const recordWithSchema = enrichedRecord;
|
|
12625
12532
|
recordWithSchema.schema = schema;
|
|
12626
12533
|
return recordWithSchema;
|
|
@@ -12682,9 +12589,9 @@ var RecordService = class extends BaseService {
|
|
|
12682
12589
|
existing,
|
|
12683
12590
|
mergedData,
|
|
12684
12591
|
changedAttributes,
|
|
12685
|
-
_optionalChain([options, 'optionalAccess',
|
|
12592
|
+
_optionalChain([options, 'optionalAccess', _259 => _259.hookMetadata])
|
|
12686
12593
|
);
|
|
12687
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12594
|
+
if (!_optionalChain([options, 'optionalAccess', _260 => _260.skipHooks])) {
|
|
12688
12595
|
await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
|
|
12689
12596
|
}
|
|
12690
12597
|
const hookModifiedValues = {};
|
|
@@ -12699,16 +12606,16 @@ var RecordService = class extends BaseService {
|
|
|
12699
12606
|
dataToUpdate
|
|
12700
12607
|
);
|
|
12701
12608
|
const normalizedMergedData = { ...existing.values, ...normalizedUpdate };
|
|
12702
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12703
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12609
|
+
if (_optionalChain([options, 'optionalAccess', _261 => _261.validate]) !== false) {
|
|
12610
|
+
if (_optionalChain([options, 'optionalAccess', _262 => _262.partial])) {
|
|
12704
12611
|
_chunkHUT6HYXJjs.validateDraftOrThrow.call(void 0, schema, normalizedMergedData);
|
|
12705
12612
|
} else {
|
|
12706
12613
|
_chunkHUT6HYXJjs.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
|
|
12707
12614
|
}
|
|
12708
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12615
|
+
if (!_optionalChain([options, 'optionalAccess', _263 => _263.skipRelationValidation])) {
|
|
12709
12616
|
await this.relationService.validateRelationsOrThrow(schema, normalizedUpdate);
|
|
12710
12617
|
}
|
|
12711
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12618
|
+
if (!_optionalChain([options, 'optionalAccess', _264 => _264.skipUserValidation])) {
|
|
12712
12619
|
await this.userService.validateUsersOrThrow(schema, normalizedUpdate);
|
|
12713
12620
|
}
|
|
12714
12621
|
}
|
|
@@ -12721,7 +12628,7 @@ var RecordService = class extends BaseService {
|
|
|
12721
12628
|
__lastUpdatedBy: this.userId,
|
|
12722
12629
|
__expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
|
|
12723
12630
|
};
|
|
12724
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12631
|
+
if (_optionalChain([options, 'optionalAccess', _265 => _265.metadata]) !== void 0) {
|
|
12725
12632
|
const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
|
|
12726
12633
|
const mergedMetadata = { ...existingMetadata, ...options.metadata };
|
|
12727
12634
|
const cleanedMetadata = Object.fromEntries(
|
|
@@ -12732,20 +12639,20 @@ var RecordService = class extends BaseService {
|
|
|
12732
12639
|
const bilateralOldValues = {};
|
|
12733
12640
|
for (const attrName of Object.keys(normalizedUpdate)) {
|
|
12734
12641
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12735
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
12642
|
+
if (_optionalChain([attr, 'optionalAccess', _266 => _266.type]) === "relation" && isBilateralRelation(attr)) {
|
|
12736
12643
|
bilateralOldValues[attrName] = existing.values[attrName];
|
|
12737
12644
|
}
|
|
12738
12645
|
}
|
|
12739
12646
|
const updated = await this.adapter.objectRecords.update(recordId, updatePayload);
|
|
12740
12647
|
await this.invalidateRecordCaches(recordId, existing.objectId);
|
|
12741
|
-
_optionalChain([this, 'access',
|
|
12648
|
+
_optionalChain([this, 'access', _267 => _267.adapter, 'access', _268 => _268.search, 'optionalAccess', _269 => _269.indexRecord, 'call', _270 => _270(updated, {
|
|
12742
12649
|
objectName: schema.name,
|
|
12743
12650
|
objectLabel: schema.label,
|
|
12744
12651
|
attributes: schema.attributes
|
|
12745
|
-
}), 'access',
|
|
12652
|
+
}), 'access', _271 => _271.catch, 'call', _272 => _272((err) => console.error("[search] Failed to index updated record", updated.id, err))]);
|
|
12746
12653
|
for (const [attrName, value] of Object.entries(dataToUpdate)) {
|
|
12747
12654
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12748
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
12655
|
+
if (_optionalChain([attr, 'optionalAccess', _273 => _273.type]) === "relation") {
|
|
12749
12656
|
const hasProperties2 = attr.properties !== void 0;
|
|
12750
12657
|
const isBilateral = isBilateralRelation(attr);
|
|
12751
12658
|
if (hasProperties2 || isBilateral) {
|
|
@@ -12761,7 +12668,7 @@ var RecordService = class extends BaseService {
|
|
|
12761
12668
|
}
|
|
12762
12669
|
for (const [attrName, value] of Object.entries(normalizedUpdate)) {
|
|
12763
12670
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12764
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
12671
|
+
if (_optionalChain([attr, 'optionalAccess', _274 => _274.type]) === "relation" && isBilateralRelation(attr)) {
|
|
12765
12672
|
const oldValue = bilateralOldValues[attrName];
|
|
12766
12673
|
await this.bilateralSyncService.syncBilateralRelation(
|
|
12767
12674
|
schema,
|
|
@@ -12772,7 +12679,7 @@ var RecordService = class extends BaseService {
|
|
|
12772
12679
|
);
|
|
12773
12680
|
}
|
|
12774
12681
|
}
|
|
12775
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12682
|
+
if (!_optionalChain([options, 'optionalAccess', _275 => _275.skipHooks])) {
|
|
12776
12683
|
const afterCtx = {
|
|
12777
12684
|
...hookCtx,
|
|
12778
12685
|
record: updated
|
|
@@ -12787,7 +12694,7 @@ var RecordService = class extends BaseService {
|
|
|
12787
12694
|
if (this.auditService && this.userId && allChangedAttributes.length > 0) {
|
|
12788
12695
|
const changes = allChangedAttributes.map((attr) => ({
|
|
12789
12696
|
field: attr,
|
|
12790
|
-
oldValue: _optionalChain([hookCtx, 'access',
|
|
12697
|
+
oldValue: _optionalChain([hookCtx, 'access', _276 => _276.oldValues, 'optionalAccess', _277 => _277[attr]]),
|
|
12791
12698
|
newValue: hookCtx.newValues[attr]
|
|
12792
12699
|
}));
|
|
12793
12700
|
this.auditService.logRecordAction({
|
|
@@ -12798,7 +12705,7 @@ var RecordService = class extends BaseService {
|
|
|
12798
12705
|
recordId: updated.id,
|
|
12799
12706
|
recordLabel: updated.label,
|
|
12800
12707
|
changes,
|
|
12801
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
12708
|
+
metadata: _optionalChain([options, 'optionalAccess', _278 => _278.hookMetadata])
|
|
12802
12709
|
}).catch(() => {
|
|
12803
12710
|
});
|
|
12804
12711
|
}
|
|
@@ -12830,17 +12737,17 @@ var RecordService = class extends BaseService {
|
|
|
12830
12737
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
12831
12738
|
checkRecordDeleteOrThrow(policy, record, ctx);
|
|
12832
12739
|
}
|
|
12833
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12740
|
+
if (_optionalChain([options, 'optionalAccess', _279 => _279.checkSystem]) && schema.system) {
|
|
12834
12741
|
throw new ProtectedResourceError("object", schema.name, "delete");
|
|
12835
12742
|
}
|
|
12836
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12743
|
+
if (!_optionalChain([options, 'optionalAccess', _280 => _280.skipReferenceCheck])) {
|
|
12837
12744
|
const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
|
|
12838
12745
|
if (references.length > 0) {
|
|
12839
12746
|
throw new RecordReferencedError(recordId, references);
|
|
12840
12747
|
}
|
|
12841
12748
|
}
|
|
12842
|
-
const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess',
|
|
12843
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12749
|
+
const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _281 => _281.hookMetadata]));
|
|
12750
|
+
if (!_optionalChain([options, 'optionalAccess', _282 => _282.skipHooks])) {
|
|
12844
12751
|
await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
|
|
12845
12752
|
}
|
|
12846
12753
|
for (const attr of schema.attributes) {
|
|
@@ -12858,8 +12765,8 @@ var RecordService = class extends BaseService {
|
|
|
12858
12765
|
}
|
|
12859
12766
|
await this.adapter.objectRecords.delete(recordId);
|
|
12860
12767
|
await this.invalidateRecordCaches(recordId, record.objectId);
|
|
12861
|
-
_optionalChain([this, 'access',
|
|
12862
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12768
|
+
_optionalChain([this, 'access', _283 => _283.adapter, 'access', _284 => _284.search, 'optionalAccess', _285 => _285.removeRecord, 'call', _286 => _286(recordId), 'access', _287 => _287.catch, 'call', _288 => _288((err) => console.error("[search] Failed to remove deleted record", recordId, err))]);
|
|
12769
|
+
if (!_optionalChain([options, 'optionalAccess', _289 => _289.skipHooks])) {
|
|
12863
12770
|
await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
|
|
12864
12771
|
}
|
|
12865
12772
|
await recalculateParentRollups(record, schema, this.rollupContext);
|
|
@@ -12871,7 +12778,7 @@ var RecordService = class extends BaseService {
|
|
|
12871
12778
|
objectId: schema.id,
|
|
12872
12779
|
recordId: record.id,
|
|
12873
12780
|
recordLabel: record.label,
|
|
12874
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
12781
|
+
metadata: _optionalChain([options, 'optionalAccess', _290 => _290.hookMetadata])
|
|
12875
12782
|
}).catch(() => {
|
|
12876
12783
|
});
|
|
12877
12784
|
}
|
|
@@ -12932,18 +12839,18 @@ var RecordService = class extends BaseService {
|
|
|
12932
12839
|
this.tenantId
|
|
12933
12840
|
);
|
|
12934
12841
|
await checkPermission(this.permissionService, this.userId, schema.name, "update");
|
|
12935
|
-
const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess',
|
|
12936
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12842
|
+
const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _291 => _291.hookMetadata]));
|
|
12843
|
+
if (!_optionalChain([options, 'optionalAccess', _292 => _292.skipHooks])) {
|
|
12937
12844
|
await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
|
|
12938
12845
|
}
|
|
12939
12846
|
const restored = await this.adapter.objectRecords.restore(recordId);
|
|
12940
12847
|
await this.invalidateRecordCaches(recordId, record.objectId);
|
|
12941
|
-
_optionalChain([this, 'access',
|
|
12848
|
+
_optionalChain([this, 'access', _293 => _293.adapter, 'access', _294 => _294.search, 'optionalAccess', _295 => _295.indexRecord, 'call', _296 => _296(restored, {
|
|
12942
12849
|
objectName: schema.name,
|
|
12943
12850
|
objectLabel: schema.label,
|
|
12944
12851
|
attributes: schema.attributes
|
|
12945
|
-
}), 'access',
|
|
12946
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12852
|
+
}), 'access', _297 => _297.catch, 'call', _298 => _298((err) => console.error("[search] Failed to index restored record", restored.id, err))]);
|
|
12853
|
+
if (!_optionalChain([options, 'optionalAccess', _299 => _299.skipHooks])) {
|
|
12947
12854
|
const afterCtx = {
|
|
12948
12855
|
...hookCtx,
|
|
12949
12856
|
record: restored
|
|
@@ -12958,7 +12865,7 @@ var RecordService = class extends BaseService {
|
|
|
12958
12865
|
objectId: schema.id,
|
|
12959
12866
|
recordId: restored.id,
|
|
12960
12867
|
recordLabel: restored.label,
|
|
12961
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
12868
|
+
metadata: _optionalChain([options, 'optionalAccess', _300 => _300.hookMetadata])
|
|
12962
12869
|
}).catch(() => {
|
|
12963
12870
|
});
|
|
12964
12871
|
}
|
|
@@ -13559,7 +13466,7 @@ var WorkflowAccessGrantService = class extends BaseService {
|
|
|
13559
13466
|
* Check if a specific token has been revoked.
|
|
13560
13467
|
*/
|
|
13561
13468
|
isTokenRevoked(dbGrant, jti) {
|
|
13562
|
-
return _nullishCoalesce(_optionalChain([dbGrant, 'access',
|
|
13469
|
+
return _nullishCoalesce(_optionalChain([dbGrant, 'access', _301 => _301.revoked_token_jtis, 'optionalAccess', _302 => _302.includes, 'call', _303 => _303(jti)]), () => ( false));
|
|
13563
13470
|
}
|
|
13564
13471
|
/**
|
|
13565
13472
|
* Validate access token payload against the grant.
|
|
@@ -13611,9 +13518,9 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13611
13518
|
constructor(adapter, workflowService, options) {
|
|
13612
13519
|
super(adapter);
|
|
13613
13520
|
this.workflowService = workflowService;
|
|
13614
|
-
this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13615
|
-
this.schemaService = _optionalChain([options, 'optionalAccess',
|
|
13616
|
-
this.recordService = _optionalChain([options, 'optionalAccess',
|
|
13521
|
+
this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _304 => _304.executorRegistry]), () => ( getDefaultExecutorRegistry()));
|
|
13522
|
+
this.schemaService = _optionalChain([options, 'optionalAccess', _305 => _305.schemaService]);
|
|
13523
|
+
this.recordService = _optionalChain([options, 'optionalAccess', _306 => _306.recordService]);
|
|
13617
13524
|
}
|
|
13618
13525
|
/**
|
|
13619
13526
|
* Start a new workflow instance
|
|
@@ -13795,7 +13702,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13795
13702
|
if (!this.adapter.workflowInstances) {
|
|
13796
13703
|
return { instances: [], total: 0 };
|
|
13797
13704
|
}
|
|
13798
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13705
|
+
if (_optionalChain([options, 'optionalAccess', _307 => _307.workflowName])) {
|
|
13799
13706
|
const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
|
|
13800
13707
|
options.workflowName,
|
|
13801
13708
|
{ status: options.status }
|
|
@@ -13809,11 +13716,11 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13809
13716
|
return { instances: instances2, total: total2 };
|
|
13810
13717
|
}
|
|
13811
13718
|
const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
|
|
13812
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
13813
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
13719
|
+
limit: _optionalChain([options, 'optionalAccess', _308 => _308.limit]),
|
|
13720
|
+
offset: _optionalChain([options, 'optionalAccess', _309 => _309.offset])
|
|
13814
13721
|
});
|
|
13815
13722
|
let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
|
|
13816
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13723
|
+
if (_optionalChain([options, 'optionalAccess', _310 => _310.status])) {
|
|
13817
13724
|
instances = instances.filter((i) => i.status === options.status);
|
|
13818
13725
|
}
|
|
13819
13726
|
instances = await this.markExpiredInstances(instances);
|
|
@@ -13834,9 +13741,9 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13834
13741
|
return { instances: [], total: 0 };
|
|
13835
13742
|
}
|
|
13836
13743
|
const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
|
|
13837
|
-
status: _optionalChain([options, 'optionalAccess',
|
|
13838
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
13839
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
13744
|
+
status: _optionalChain([options, 'optionalAccess', _311 => _311.status]),
|
|
13745
|
+
limit: _optionalChain([options, 'optionalAccess', _312 => _312.limit]),
|
|
13746
|
+
offset: _optionalChain([options, 'optionalAccess', _313 => _313.offset])
|
|
13840
13747
|
});
|
|
13841
13748
|
const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
|
|
13842
13749
|
return { instances, total };
|
|
@@ -13902,7 +13809,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13902
13809
|
try {
|
|
13903
13810
|
const schemas = await Promise.all(
|
|
13904
13811
|
current.workflowSnapshot.slots.map(
|
|
13905
|
-
(slot) => _optionalChain([this, 'access',
|
|
13812
|
+
(slot) => _optionalChain([this, 'access', _314 => _314.schemaService, 'optionalAccess', _315 => _315.getObjectSchemaByName, 'call', _316 => _316(slot.objectName)])
|
|
13906
13813
|
)
|
|
13907
13814
|
);
|
|
13908
13815
|
objectDefinitions = schemas.filter(
|
|
@@ -14160,8 +14067,8 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
14160
14067
|
*/
|
|
14161
14068
|
async snapshotRecord(recordId) {
|
|
14162
14069
|
try {
|
|
14163
|
-
const record = await _optionalChain([this, 'access',
|
|
14164
|
-
return _optionalChain([record, 'optionalAccess',
|
|
14070
|
+
const record = await _optionalChain([this, 'access', _317 => _317.recordService, 'optionalAccess', _318 => _318.getRecord, 'call', _319 => _319(recordId, { skipPolicyCheck: true })]);
|
|
14071
|
+
return _optionalChain([record, 'optionalAccess', _320 => _320.values]);
|
|
14165
14072
|
} catch (e20) {
|
|
14166
14073
|
return void 0;
|
|
14167
14074
|
}
|
|
@@ -14180,13 +14087,13 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
14180
14087
|
for (const op of [...operations].reverse()) {
|
|
14181
14088
|
try {
|
|
14182
14089
|
if (op.operation === "create") {
|
|
14183
|
-
await _optionalChain([this, 'access',
|
|
14090
|
+
await _optionalChain([this, 'access', _321 => _321.recordService, 'optionalAccess', _322 => _322.deleteRecord, 'call', _323 => _323(op.recordId, {
|
|
14184
14091
|
skipHooks: true,
|
|
14185
14092
|
skipReferenceCheck: true
|
|
14186
14093
|
})]);
|
|
14187
14094
|
rolledBack.push(op.slotId);
|
|
14188
14095
|
} else if (op.operation === "update" && op.previousData) {
|
|
14189
|
-
await _optionalChain([this, 'access',
|
|
14096
|
+
await _optionalChain([this, 'access', _324 => _324.recordService, 'optionalAccess', _325 => _325.updateRecord, 'call', _326 => _326(op.recordId, op.previousData, {
|
|
14190
14097
|
partial: false
|
|
14191
14098
|
})]);
|
|
14192
14099
|
rolledBack.push(op.slotId);
|
|
@@ -14310,7 +14217,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
14310
14217
|
if (!this.adapter.workflowInstances) {
|
|
14311
14218
|
return;
|
|
14312
14219
|
}
|
|
14313
|
-
const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access',
|
|
14220
|
+
const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _327 => _327.context, 'access', _328 => _328.variables, 'optionalAccess', _329 => _329.__version]), () => ( 0));
|
|
14314
14221
|
const nextVersion = currentVersion + 1;
|
|
14315
14222
|
const instanceWithVersion = {
|
|
14316
14223
|
...instance,
|
|
@@ -14591,7 +14498,7 @@ var WorkflowRelationService = class extends BaseService {
|
|
|
14591
14498
|
if (attr.type !== "relation") continue;
|
|
14592
14499
|
for (const slot of slots) {
|
|
14593
14500
|
const slotData = context.slots[slot.id];
|
|
14594
|
-
const slotRecordId = _optionalChain([slotData, 'optionalAccess',
|
|
14501
|
+
const slotRecordId = _optionalChain([slotData, 'optionalAccess', _330 => _330.id]);
|
|
14595
14502
|
if (!slotRecordId) continue;
|
|
14596
14503
|
const targetsSlotObject = attr.targets.some(
|
|
14597
14504
|
(t) => t.object === slot.objectName
|
|
@@ -14659,7 +14566,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14659
14566
|
if (Array.isArray(options)) {
|
|
14660
14567
|
this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
|
|
14661
14568
|
} else {
|
|
14662
|
-
this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
14569
|
+
this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _331 => _331.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
|
|
14663
14570
|
}
|
|
14664
14571
|
}
|
|
14665
14572
|
// ============================================================================
|
|
@@ -14957,7 +14864,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14957
14864
|
var UserProfileService = class extends BaseService {
|
|
14958
14865
|
constructor(adapter, options) {
|
|
14959
14866
|
super(adapter);
|
|
14960
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
14867
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _332 => _332.auditService]);
|
|
14961
14868
|
}
|
|
14962
14869
|
// ============================================================================
|
|
14963
14870
|
// CACHE MANAGEMENT
|
|
@@ -15036,7 +14943,7 @@ var UserProfileService = class extends BaseService {
|
|
|
15036
14943
|
async deleteAvatar(profileId) {
|
|
15037
14944
|
const profile = await this.getProfileOrThrow(profileId);
|
|
15038
14945
|
if (profile.avatarUrl && !profile.avatarUrl.startsWith("https://")) {
|
|
15039
|
-
await _optionalChain([this, 'access',
|
|
14946
|
+
await _optionalChain([this, 'access', _333 => _333.adapter, 'access', _334 => _334.storage, 'optionalAccess', _335 => _335.delete, 'call', _336 => _336(profile.avatarUrl), 'access', _337 => _337.catch, 'call', _338 => _338(() => void 0)]);
|
|
15040
14947
|
}
|
|
15041
14948
|
return await this.updateProfile(profileId, { avatarUrl: null });
|
|
15042
14949
|
}
|
|
@@ -15187,7 +15094,7 @@ var UserProfileService = class extends BaseService {
|
|
|
15187
15094
|
*/
|
|
15188
15095
|
async deleteProfile(profileId, options) {
|
|
15189
15096
|
const profile = await this.getProfileOrThrow(profileId);
|
|
15190
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15097
|
+
if (_optionalChain([options, 'optionalAccess', _339 => _339.checkAdmin]) && this.adapter.permissions) {
|
|
15191
15098
|
const ownerCount = await this.adapter.permissions.countUsersWithRole("owner");
|
|
15192
15099
|
if (ownerCount <= 1) {
|
|
15193
15100
|
const userRoles = await this.adapter.permissions.getUserRoles(profileId);
|
|
@@ -15315,7 +15222,7 @@ var UserProfileService = class extends BaseService {
|
|
|
15315
15222
|
var DocumentService = class extends BaseService {
|
|
15316
15223
|
constructor(adapter, options) {
|
|
15317
15224
|
super(adapter);
|
|
15318
|
-
this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15225
|
+
this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _340 => _340.fileService]), () => ( null));
|
|
15319
15226
|
}
|
|
15320
15227
|
// ============================================================================
|
|
15321
15228
|
// CREATE
|
|
@@ -15533,7 +15440,7 @@ var DocumentService = class extends BaseService {
|
|
|
15533
15440
|
*/
|
|
15534
15441
|
async isComplete(documentId) {
|
|
15535
15442
|
const document2 = await this.getDocument(documentId);
|
|
15536
|
-
return _optionalChain([document2, 'optionalAccess',
|
|
15443
|
+
return _optionalChain([document2, 'optionalAccess', _341 => _341.status]) !== "draft";
|
|
15537
15444
|
}
|
|
15538
15445
|
/**
|
|
15539
15446
|
* Get document with its slots.
|
|
@@ -15776,7 +15683,7 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15776
15683
|
type: "signature",
|
|
15777
15684
|
provider: this.config.signatureAdapter.name,
|
|
15778
15685
|
input: { signers, ...options },
|
|
15779
|
-
expiresAt: _optionalChain([options, 'optionalAccess',
|
|
15686
|
+
expiresAt: _optionalChain([options, 'optionalAccess', _342 => _342.expiresAt])
|
|
15780
15687
|
});
|
|
15781
15688
|
return job;
|
|
15782
15689
|
}
|
|
@@ -16088,15 +15995,15 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
16088
15995
|
return {
|
|
16089
15996
|
ocr: {
|
|
16090
15997
|
available: !!this.config.ocrAdapter,
|
|
16091
|
-
provider: _optionalChain([this, 'access',
|
|
15998
|
+
provider: _optionalChain([this, 'access', _343 => _343.config, 'access', _344 => _344.ocrAdapter, 'optionalAccess', _345 => _345.name])
|
|
16092
15999
|
},
|
|
16093
16000
|
signature: {
|
|
16094
16001
|
available: !!this.config.signatureAdapter,
|
|
16095
|
-
provider: _optionalChain([this, 'access',
|
|
16002
|
+
provider: _optionalChain([this, 'access', _346 => _346.config, 'access', _347 => _347.signatureAdapter, 'optionalAccess', _348 => _348.name])
|
|
16096
16003
|
},
|
|
16097
16004
|
identityVerification: {
|
|
16098
16005
|
available: !!this.config.identityAdapter,
|
|
16099
|
-
provider: _optionalChain([this, 'access',
|
|
16006
|
+
provider: _optionalChain([this, 'access', _349 => _349.config, 'access', _350 => _350.identityAdapter, 'optionalAccess', _351 => _351.name])
|
|
16100
16007
|
}
|
|
16101
16008
|
};
|
|
16102
16009
|
}
|
|
@@ -16118,7 +16025,7 @@ function decodeFileName(name) {
|
|
|
16118
16025
|
var FileService = class extends BaseService {
|
|
16119
16026
|
constructor(adapter, options) {
|
|
16120
16027
|
super(adapter);
|
|
16121
|
-
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16028
|
+
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _352 => _352.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
|
|
16122
16029
|
}
|
|
16123
16030
|
// ============================================================================
|
|
16124
16031
|
// UPLOAD (requires StorageAdapter)
|
|
@@ -16258,7 +16165,7 @@ var FileService = class extends BaseService {
|
|
|
16258
16165
|
*/
|
|
16259
16166
|
async getFile(fileId) {
|
|
16260
16167
|
const file2 = await this.adapter.files.findById(fileId);
|
|
16261
|
-
if (_optionalChain([file2, 'optionalAccess',
|
|
16168
|
+
if (_optionalChain([file2, 'optionalAccess', _353 => _353.deletedAt])) {
|
|
16262
16169
|
return null;
|
|
16263
16170
|
}
|
|
16264
16171
|
return file2;
|
|
@@ -16320,12 +16227,12 @@ var FileService = class extends BaseService {
|
|
|
16320
16227
|
*/
|
|
16321
16228
|
async deleteFile(fileId, options) {
|
|
16322
16229
|
const file2 = await this.getFileOrThrow(fileId);
|
|
16323
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16230
|
+
if (_optionalChain([options, 'optionalAccess', _354 => _354.checkOwnership]) && options.userId) {
|
|
16324
16231
|
if (file2.uploadedBy !== options.userId) {
|
|
16325
16232
|
throw new Error("You can only delete files you uploaded");
|
|
16326
16233
|
}
|
|
16327
16234
|
}
|
|
16328
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16235
|
+
if (_optionalChain([options, 'optionalAccess', _355 => _355.hard])) {
|
|
16329
16236
|
await this.adapter.files.hardDelete(fileId);
|
|
16330
16237
|
} else {
|
|
16331
16238
|
await this.adapter.files.delete(fileId);
|
|
@@ -16356,7 +16263,7 @@ var FileService = class extends BaseService {
|
|
|
16356
16263
|
}
|
|
16357
16264
|
const file2 = await this.getFileOrThrow(fileId);
|
|
16358
16265
|
await this.adapter.storage.delete(file2.storagePath);
|
|
16359
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16266
|
+
if (_optionalChain([options, 'optionalAccess', _356 => _356.hard])) {
|
|
16360
16267
|
await this.adapter.files.hardDelete(fileId);
|
|
16361
16268
|
} else {
|
|
16362
16269
|
await this.adapter.files.delete(fileId);
|
|
@@ -16382,15 +16289,15 @@ var FileService = class extends BaseService {
|
|
|
16382
16289
|
const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
|
|
16383
16290
|
const files = fileResults.filter((f) => f !== null);
|
|
16384
16291
|
if (files.length === 0) return;
|
|
16385
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16292
|
+
if (_optionalChain([options, 'optionalAccess', _357 => _357.deleteFromStorage]) && this.adapter.storage) {
|
|
16386
16293
|
const BATCH_SIZE = 10;
|
|
16387
16294
|
for (let i = 0; i < files.length; i += BATCH_SIZE) {
|
|
16388
16295
|
const batch = files.slice(i, i + BATCH_SIZE);
|
|
16389
|
-
await Promise.all(batch.map((file2) => _optionalChain([this, 'access',
|
|
16296
|
+
await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _358 => _358.adapter, 'access', _359 => _359.storage, 'optionalAccess', _360 => _360.delete, 'call', _361 => _361(file2.storagePath)])));
|
|
16390
16297
|
}
|
|
16391
16298
|
}
|
|
16392
16299
|
const idsToDelete = files.map((f) => f.id);
|
|
16393
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16300
|
+
if (_optionalChain([options, 'optionalAccess', _362 => _362.hard])) {
|
|
16394
16301
|
await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
|
|
16395
16302
|
} else {
|
|
16396
16303
|
await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
|
|
@@ -16398,12 +16305,12 @@ var FileService = class extends BaseService {
|
|
|
16398
16305
|
if (this.auditService && this.userId) {
|
|
16399
16306
|
await Promise.all(
|
|
16400
16307
|
files.map(
|
|
16401
|
-
(file2) => _optionalChain([this, 'access',
|
|
16308
|
+
(file2) => _optionalChain([this, 'access', _363 => _363.auditService, 'optionalAccess', _364 => _364.logFileAction, 'call', _365 => _365({
|
|
16402
16309
|
action: "file.deleted",
|
|
16403
16310
|
actorId: _nullishCoalesce(this.userId, () => ( "")),
|
|
16404
16311
|
fileId: file2.id,
|
|
16405
16312
|
fileName: file2.name,
|
|
16406
|
-
metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16313
|
+
metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _366 => _366.deleteFromStorage]), () => ( false)) }
|
|
16407
16314
|
})])
|
|
16408
16315
|
)
|
|
16409
16316
|
);
|
|
@@ -16488,7 +16395,7 @@ var FileService = class extends BaseService {
|
|
|
16488
16395
|
return true;
|
|
16489
16396
|
}
|
|
16490
16397
|
if (file2.visibility === "restricted") {
|
|
16491
|
-
return _nullishCoalesce(_optionalChain([file2, 'access',
|
|
16398
|
+
return _nullishCoalesce(_optionalChain([file2, 'access', _367 => _367.allowedUsers, 'optionalAccess', _368 => _368.includes, 'call', _369 => _369(userId)]), () => ( false));
|
|
16492
16399
|
}
|
|
16493
16400
|
return false;
|
|
16494
16401
|
}
|
|
@@ -16583,7 +16490,7 @@ function withTimeout(promise, ms, label) {
|
|
|
16583
16490
|
var GeocodingService = class {
|
|
16584
16491
|
constructor(adapter, options) {
|
|
16585
16492
|
this.adapter = adapter;
|
|
16586
|
-
this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16493
|
+
this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _370 => _370.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
|
|
16587
16494
|
}
|
|
16588
16495
|
/**
|
|
16589
16496
|
* Search for address suggestions as the user types
|
|
@@ -16642,9 +16549,9 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16642
16549
|
if (this.adapter.search) {
|
|
16643
16550
|
try {
|
|
16644
16551
|
const raw = await this.adapter.search.globalSearch(trimmed, {
|
|
16645
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16646
|
-
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16647
|
-
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16552
|
+
objectNames: _optionalChain([options, 'optionalAccess', _371 => _371.objectNames]),
|
|
16553
|
+
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _372 => _372.limit]), () => ( 20)),
|
|
16554
|
+
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _373 => _373.offset]), () => ( 0))
|
|
16648
16555
|
});
|
|
16649
16556
|
return await this.healGlobalSearchResults(raw);
|
|
16650
16557
|
} catch (err) {
|
|
@@ -16652,9 +16559,9 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16652
16559
|
}
|
|
16653
16560
|
}
|
|
16654
16561
|
return this.adapter.objectRecords.globalSearch(trimmed, {
|
|
16655
|
-
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16656
|
-
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16657
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16562
|
+
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.limit]), () => ( 20)),
|
|
16563
|
+
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _375 => _375.offset]), () => ( 0)),
|
|
16564
|
+
objectNames: _optionalChain([options, 'optionalAccess', _376 => _376.objectNames])
|
|
16658
16565
|
});
|
|
16659
16566
|
}
|
|
16660
16567
|
/**
|
|
@@ -16673,7 +16580,7 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16673
16580
|
if (this.adapter.search) {
|
|
16674
16581
|
try {
|
|
16675
16582
|
const raw = await this.adapter.search.globalSearchGrouped(trimmed, {
|
|
16676
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16583
|
+
objectNames: _optionalChain([options, 'optionalAccess', _377 => _377.objectNames])
|
|
16677
16584
|
});
|
|
16678
16585
|
return await this.healGroupedSearchResults(raw);
|
|
16679
16586
|
} catch (err) {
|
|
@@ -16681,8 +16588,8 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16681
16588
|
}
|
|
16682
16589
|
}
|
|
16683
16590
|
return this.adapter.objectRecords.globalSearchGrouped(trimmed, {
|
|
16684
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16685
|
-
limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16591
|
+
objectNames: _optionalChain([options, 'optionalAccess', _378 => _378.objectNames]),
|
|
16592
|
+
limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _379 => _379.limitPerGroup]), () => ( 5))
|
|
16686
16593
|
});
|
|
16687
16594
|
}
|
|
16688
16595
|
// ==========================================================================
|
|
@@ -16749,7 +16656,7 @@ var PermissionService = class extends BaseService {
|
|
|
16749
16656
|
}
|
|
16750
16657
|
this.permissionsRepo = adapter.permissions;
|
|
16751
16658
|
this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
|
|
16752
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
16659
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _380 => _380.auditService]);
|
|
16753
16660
|
}
|
|
16754
16661
|
// ============================================================================
|
|
16755
16662
|
// PERMISSION CHECKS
|
|
@@ -16765,11 +16672,11 @@ var PermissionService = class extends BaseService {
|
|
|
16765
16672
|
async canAccessObject(userProfileId, objectName, action) {
|
|
16766
16673
|
const permissions = await this.getEffectivePermissions(userProfileId);
|
|
16767
16674
|
const wildcardPerms = permissions.objectPermissions["*"];
|
|
16768
|
-
if (_optionalChain([wildcardPerms, 'optionalAccess',
|
|
16675
|
+
if (_optionalChain([wildcardPerms, 'optionalAccess', _381 => _381.includes, 'call', _382 => _382(action)])) {
|
|
16769
16676
|
return true;
|
|
16770
16677
|
}
|
|
16771
16678
|
const objectPerms = permissions.objectPermissions[objectName];
|
|
16772
|
-
return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess',
|
|
16679
|
+
return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _383 => _383.includes, 'call', _384 => _384(action)]), () => ( false));
|
|
16773
16680
|
}
|
|
16774
16681
|
/**
|
|
16775
16682
|
* Check if user can access an object, throw ForbiddenError if not.
|
|
@@ -16818,12 +16725,12 @@ var PermissionService = class extends BaseService {
|
|
|
16818
16725
|
*/
|
|
16819
16726
|
async canAccessSystem(userProfileId, resource, action) {
|
|
16820
16727
|
const permissions = await this.getEffectivePermissions(userProfileId);
|
|
16821
|
-
const wildcardPerms = _optionalChain([permissions, 'access',
|
|
16822
|
-
if (_optionalChain([wildcardPerms, 'optionalAccess',
|
|
16728
|
+
const wildcardPerms = _optionalChain([permissions, 'access', _385 => _385.systemPermissions, 'optionalAccess', _386 => _386["*"]]);
|
|
16729
|
+
if (_optionalChain([wildcardPerms, 'optionalAccess', _387 => _387.includes, 'call', _388 => _388(action)])) {
|
|
16823
16730
|
return true;
|
|
16824
16731
|
}
|
|
16825
|
-
const resourcePerms = _optionalChain([permissions, 'access',
|
|
16826
|
-
return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess',
|
|
16732
|
+
const resourcePerms = _optionalChain([permissions, 'access', _389 => _389.systemPermissions, 'optionalAccess', _390 => _390[resource]]);
|
|
16733
|
+
return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _391 => _391.includes, 'call', _392 => _392(action)]), () => ( false));
|
|
16827
16734
|
}
|
|
16828
16735
|
/**
|
|
16829
16736
|
* Check if user can access a system resource, throw ForbiddenError if not.
|
|
@@ -16849,8 +16756,8 @@ var PermissionService = class extends BaseService {
|
|
|
16849
16756
|
*/
|
|
16850
16757
|
async getSystemPermissions(userProfileId, resource) {
|
|
16851
16758
|
const permissions = await this.getEffectivePermissions(userProfileId);
|
|
16852
|
-
const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access',
|
|
16853
|
-
const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access',
|
|
16759
|
+
const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _393 => _393.systemPermissions, 'optionalAccess', _394 => _394["*"]]), () => ( []));
|
|
16760
|
+
const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _395 => _395.systemPermissions, 'optionalAccess', _396 => _396[resource]]), () => ( []));
|
|
16854
16761
|
const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
|
|
16855
16762
|
return {
|
|
16856
16763
|
canRead: allPerms.has("read"),
|
|
@@ -16993,7 +16900,7 @@ var PermissionService = class extends BaseService {
|
|
|
16993
16900
|
action: "role.updated",
|
|
16994
16901
|
actorId: this.userId,
|
|
16995
16902
|
roleId,
|
|
16996
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
16903
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _397 => _397.label]), () => ( roleId)),
|
|
16997
16904
|
metadata: { permissionsUpdated: true, permissionCount: permissions.length }
|
|
16998
16905
|
});
|
|
16999
16906
|
}
|
|
@@ -17023,7 +16930,7 @@ var PermissionService = class extends BaseService {
|
|
|
17023
16930
|
action: "role.assigned",
|
|
17024
16931
|
actorId: this.userId,
|
|
17025
16932
|
roleId,
|
|
17026
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
16933
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _398 => _398.label]), () => ( roleId)),
|
|
17027
16934
|
targetUserId: userProfileId
|
|
17028
16935
|
});
|
|
17029
16936
|
}
|
|
@@ -17041,7 +16948,7 @@ var PermissionService = class extends BaseService {
|
|
|
17041
16948
|
action: "role.revoked",
|
|
17042
16949
|
actorId: this.userId,
|
|
17043
16950
|
roleId,
|
|
17044
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
16951
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _399 => _399.label]), () => ( roleId)),
|
|
17045
16952
|
targetUserId: userProfileId
|
|
17046
16953
|
});
|
|
17047
16954
|
}
|
|
@@ -17515,7 +17422,7 @@ var ViewService = class extends BaseService {
|
|
|
17515
17422
|
dbView.objectName,
|
|
17516
17423
|
dbView.type,
|
|
17517
17424
|
objectDefinition,
|
|
17518
|
-
dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access',
|
|
17425
|
+
dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _400 => _400.config, 'optionalAccess', _401 => _401.layout]), () => ( "page")) : void 0
|
|
17519
17426
|
);
|
|
17520
17427
|
const newConfig = generated.config;
|
|
17521
17428
|
const updated = await this.adapter.views.update(viewId, { config: newConfig });
|