@stndrds/schema 0.1.0-alpha.57 → 0.1.0-alpha.58
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-DPRLHGPO.js → chunk-2OS63USQ.js} +270 -916
- package/dist/{chunk-YVUSATKC.mjs → chunk-JRY236AO.mjs} +76 -722
- package/dist/chunk-NEVERCM3.js +41 -0
- package/dist/chunk-SV4BCGQU.mjs +617 -0
- package/dist/chunk-U4AB53AM.js +617 -0
- package/dist/chunk-V2RPPE2Y.mjs +41 -0
- package/dist/index.d.mts +51 -29
- package/dist/index.d.ts +51 -29
- package/dist/index.js +10 -100
- package/dist/index.mjs +76 -166
- package/dist/{runtime-BqJdmg_4.d.mts → runtime-C4vB_EcQ.d.ts} +5 -1645
- package/dist/{runtime-BqJdmg_4.d.ts → runtime-SCsDOQi0.d.mts} +5 -1645
- package/dist/runtime.d.mts +3 -1
- package/dist/runtime.d.ts +3 -1
- package/dist/runtime.js +4 -2
- package/dist/runtime.mjs +3 -1
- package/dist/utils.d.mts +154 -0
- package/dist/utils.d.ts +154 -0
- package/dist/utils.js +19 -0
- package/dist/utils.mjs +19 -0
- package/dist/validation/validators.d.mts +4 -0
- package/dist/validation/validators.d.ts +4 -0
- package/dist/validation/validators.js +121 -0
- package/dist/validation/validators.mjs +121 -0
- package/dist/validators-BgmWgr-G.d.mts +1488 -0
- package/dist/validators-miARInAq.d.ts +1488 -0
- package/package.json +12 -2
|
@@ -1,40 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var _chunk3RG5ZIWIjs = require('./chunk-3RG5ZIWI.js');
|
|
4
3
|
|
|
5
|
-
// src/runtime/auth/workflow-jwt.service.ts
|
|
6
|
-
var _jose = require('jose');
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const r = Math.random() * 16 | 0;
|
|
21
|
-
const v = c === "x" ? r : r & 3 | 8;
|
|
22
|
-
return v.toString(16);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function generatePrefixedId(prefix) {
|
|
26
|
-
return `${prefix}_${generateId()}`;
|
|
27
|
-
}
|
|
28
|
-
function slugify(input) {
|
|
29
|
-
return input.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9\s_-]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
30
|
-
}
|
|
31
|
-
function generateTemplateName(label) {
|
|
32
|
-
const slug = slugify(label) || "template";
|
|
33
|
-
const suffix = generateId().slice(0, 8);
|
|
34
|
-
return `${slug}-${suffix}`;
|
|
35
|
-
}
|
|
5
|
+
var _chunkNEVERCM3js = require('./chunk-NEVERCM3.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkU4AB53AMjs = require('./chunk-U4AB53AM.js');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunk3RG5ZIWIjs = require('./chunk-3RG5ZIWI.js');
|
|
36
17
|
|
|
37
18
|
// src/runtime/auth/workflow-jwt.service.ts
|
|
19
|
+
var _jose = require('jose');
|
|
38
20
|
var WorkflowJwtService = class _WorkflowJwtService {
|
|
39
21
|
constructor(config) {
|
|
40
22
|
this.config = config;
|
|
@@ -84,7 +66,7 @@ var WorkflowJwtService = class _WorkflowJwtService {
|
|
|
84
66
|
typ: "magic_link",
|
|
85
67
|
instance: params.instanceId,
|
|
86
68
|
tenant: params.tenantId
|
|
87
|
-
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.invitationId).setAudience(params.tenantId).setJti(generateId()).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
|
|
69
|
+
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.invitationId).setAudience(params.tenantId).setJti(_chunkNEVERCM3js.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
|
|
88
70
|
}
|
|
89
71
|
/**
|
|
90
72
|
* Sign an access token JWT (long-lived)
|
|
@@ -102,7 +84,7 @@ var WorkflowJwtService = class _WorkflowJwtService {
|
|
|
102
84
|
instance: params.instanceId,
|
|
103
85
|
tenant: params.tenantId,
|
|
104
86
|
scope: params.scope
|
|
105
|
-
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.grantId).setAudience(params.tenantId).setJti(generateId()).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
|
|
87
|
+
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.grantId).setAudience(params.tenantId).setJti(_chunkNEVERCM3js.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
|
|
106
88
|
}
|
|
107
89
|
// ============================================================================
|
|
108
90
|
// VERIFY METHODS
|
|
@@ -212,6 +194,26 @@ var WorkflowJwtService = class _WorkflowJwtService {
|
|
|
212
194
|
}
|
|
213
195
|
};
|
|
214
196
|
|
|
197
|
+
// src/lib/object-helpers.ts
|
|
198
|
+
function isEmpty(obj) {
|
|
199
|
+
if (obj === null || obj === void 0) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (typeof obj !== "object") {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
return Object.keys(obj).length === 0;
|
|
206
|
+
}
|
|
207
|
+
function isNotEmpty(obj) {
|
|
208
|
+
return obj !== null && obj !== void 0 && typeof obj === "object" && Object.keys(obj).length > 0;
|
|
209
|
+
}
|
|
210
|
+
function toUndefinedIfEmpty(obj) {
|
|
211
|
+
return isNotEmpty(obj) ? obj : void 0;
|
|
212
|
+
}
|
|
213
|
+
function hasProperties(obj) {
|
|
214
|
+
return isNotEmpty(obj);
|
|
215
|
+
}
|
|
216
|
+
|
|
215
217
|
// src/runtime/cache.ts
|
|
216
218
|
function fnv1aHash(str) {
|
|
217
219
|
let hash = 2166136261;
|
|
@@ -222,7 +224,7 @@ function fnv1aHash(str) {
|
|
|
222
224
|
return hash.toString(16).padStart(8, "0");
|
|
223
225
|
}
|
|
224
226
|
function hashOptions(options) {
|
|
225
|
-
if (
|
|
227
|
+
if (isEmpty(options)) {
|
|
226
228
|
return "default";
|
|
227
229
|
}
|
|
228
230
|
const sortedJson = JSON.stringify(options, (_, value) => {
|
|
@@ -1039,7 +1041,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
1039
1041
|
* ```
|
|
1040
1042
|
*/
|
|
1041
1043
|
tenant(tenantId) {
|
|
1042
|
-
return this.clone({ tenantId: asTenantId(tenantId) });
|
|
1044
|
+
return this.clone({ tenantId: _chunkNEVERCM3js.asTenantId.call(void 0, tenantId) });
|
|
1043
1045
|
}
|
|
1044
1046
|
/**
|
|
1045
1047
|
* Set user ID for audit/permissions (overrides AsyncLocalStorage context).
|
|
@@ -1055,7 +1057,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
1055
1057
|
* ```
|
|
1056
1058
|
*/
|
|
1057
1059
|
user(userId) {
|
|
1058
|
-
return this.clone({ userId: asUserId(userId) });
|
|
1060
|
+
return this.clone({ userId: _chunkNEVERCM3js.asUserId.call(void 0, userId) });
|
|
1059
1061
|
}
|
|
1060
1062
|
// ============================================================================
|
|
1061
1063
|
// TERMINATION METHODS (READ)
|
|
@@ -1280,10 +1282,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
1280
1282
|
function createQueryBuilder(recordService, adapter, objectName, options) {
|
|
1281
1283
|
const initialState = {};
|
|
1282
1284
|
if (_optionalChain([options, 'optionalAccess', _25 => _25.tenantId])) {
|
|
1283
|
-
initialState.tenantId = asTenantId(options.tenantId);
|
|
1285
|
+
initialState.tenantId = _chunkNEVERCM3js.asTenantId.call(void 0, options.tenantId);
|
|
1284
1286
|
}
|
|
1285
1287
|
if (_optionalChain([options, 'optionalAccess', _26 => _26.userId])) {
|
|
1286
|
-
initialState.userId = asUserId(options.userId);
|
|
1288
|
+
initialState.userId = _chunkNEVERCM3js.asUserId.call(void 0, options.userId);
|
|
1287
1289
|
}
|
|
1288
1290
|
return new QueryBuilder(recordService, adapter, objectName, initialState);
|
|
1289
1291
|
}
|
|
@@ -1345,12 +1347,6 @@ function or(...rules) {
|
|
|
1345
1347
|
function inValues(field, values) {
|
|
1346
1348
|
return { field, operator: "in", value: values };
|
|
1347
1349
|
}
|
|
1348
|
-
function isEmpty(field) {
|
|
1349
|
-
return { field, operator: "isEmpty", value: null };
|
|
1350
|
-
}
|
|
1351
|
-
function isNotEmpty(field) {
|
|
1352
|
-
return { field, operator: "isNotEmpty", value: null };
|
|
1353
|
-
}
|
|
1354
1350
|
|
|
1355
1351
|
// src/types/workflows/definition.ts
|
|
1356
1352
|
function isWorkflowDefinition(obj) {
|
|
@@ -1460,16 +1456,6 @@ function setContextValue(context, path, value) {
|
|
|
1460
1456
|
}
|
|
1461
1457
|
current[parts[parts.length - 1]] = value;
|
|
1462
1458
|
}
|
|
1463
|
-
function mergeFormToSlot(context, nodeId, slotId) {
|
|
1464
|
-
const formData = context.forms[nodeId];
|
|
1465
|
-
if (!formData) {
|
|
1466
|
-
return;
|
|
1467
|
-
}
|
|
1468
|
-
if (!context.slots[slotId]) {
|
|
1469
|
-
context.slots[slotId] = {};
|
|
1470
|
-
}
|
|
1471
|
-
Object.assign(context.slots[slotId], formData);
|
|
1472
|
-
}
|
|
1473
1459
|
|
|
1474
1460
|
// src/types/workflows/theme.ts
|
|
1475
1461
|
var DEFAULT_THEME = {
|
|
@@ -1823,9 +1809,9 @@ function compareValues(actual, operator, expected) {
|
|
|
1823
1809
|
return typeof actual === "string" && typeof expected === "string" ? actual.endsWith(expected) : false;
|
|
1824
1810
|
// Presence
|
|
1825
1811
|
case "isEmpty":
|
|
1826
|
-
return
|
|
1812
|
+
return isEmptyValue(actual);
|
|
1827
1813
|
case "isNotEmpty":
|
|
1828
|
-
return !
|
|
1814
|
+
return !isEmptyValue(actual);
|
|
1829
1815
|
// Set membership
|
|
1830
1816
|
case "in":
|
|
1831
1817
|
if (Array.isArray(expected)) {
|
|
@@ -1841,7 +1827,7 @@ function compareValues(actual, operator, expected) {
|
|
|
1841
1827
|
return false;
|
|
1842
1828
|
}
|
|
1843
1829
|
}
|
|
1844
|
-
function
|
|
1830
|
+
function isEmptyValue(value) {
|
|
1845
1831
|
if (value === null || value === void 0) {
|
|
1846
1832
|
return true;
|
|
1847
1833
|
}
|
|
@@ -1851,7 +1837,7 @@ function isEmpty2(value) {
|
|
|
1851
1837
|
if (Array.isArray(value) && value.length === 0) {
|
|
1852
1838
|
return true;
|
|
1853
1839
|
}
|
|
1854
|
-
if (typeof value === "object" &&
|
|
1840
|
+
if (typeof value === "object" && isEmpty(value)) {
|
|
1855
1841
|
return true;
|
|
1856
1842
|
}
|
|
1857
1843
|
return false;
|
|
@@ -2096,7 +2082,7 @@ var DocumentExecutor = class {
|
|
|
2096
2082
|
validateSlotReferences(node, workflowSlots) {
|
|
2097
2083
|
const errors = [];
|
|
2098
2084
|
if (node.targetSlotIds && node.targetSlotIds.length > 0) {
|
|
2099
|
-
const slotIdSet =
|
|
2085
|
+
const slotIdSet = workflowSlots.reduce((set, s) => set.add(s.id), /* @__PURE__ */ new Set());
|
|
2100
2086
|
for (const slotId of node.targetSlotIds) {
|
|
2101
2087
|
if (!slotIdSet.has(slotId)) {
|
|
2102
2088
|
errors.push(
|
|
@@ -2132,24 +2118,25 @@ var FormExecutor = class {
|
|
|
2132
2118
|
}
|
|
2133
2119
|
execute(node, context) {
|
|
2134
2120
|
const { input } = context;
|
|
2135
|
-
if (
|
|
2121
|
+
if (isEmpty(input)) {
|
|
2136
2122
|
const requiredParticipationId = _nullishCoalesce(node.participantId, () => ( void 0));
|
|
2137
2123
|
return wait(`Waiting for form submission: ${node.label}`, {
|
|
2138
2124
|
requiredParticipationId
|
|
2139
2125
|
});
|
|
2140
2126
|
}
|
|
2127
|
+
const formInput = input;
|
|
2141
2128
|
const slotIds = this.extractSlotIds(node);
|
|
2142
2129
|
if (slotIds.size === 0) {
|
|
2143
2130
|
return error("MISSING_FIELDS", "FormNode must have fields or rows with slot references");
|
|
2144
2131
|
}
|
|
2145
2132
|
const contextUpdates = {
|
|
2146
2133
|
forms: {
|
|
2147
|
-
[node.id]:
|
|
2134
|
+
[node.id]: formInput
|
|
2148
2135
|
},
|
|
2149
2136
|
slots: {}
|
|
2150
2137
|
};
|
|
2151
2138
|
for (const slotId of slotIds) {
|
|
2152
|
-
const slotInput = _nullishCoalesce(
|
|
2139
|
+
const slotInput = _nullishCoalesce(formInput[slotId], () => ( {}));
|
|
2153
2140
|
if (!contextUpdates.slots) {
|
|
2154
2141
|
contextUpdates.slots = {};
|
|
2155
2142
|
}
|
|
@@ -2177,9 +2164,9 @@ var FormExecutor = class {
|
|
|
2177
2164
|
}
|
|
2178
2165
|
canExecute(node, context) {
|
|
2179
2166
|
if (node.participantId && context.executorId) {
|
|
2180
|
-
return
|
|
2167
|
+
return hasProperties(context.input);
|
|
2181
2168
|
}
|
|
2182
|
-
return
|
|
2169
|
+
return hasProperties(context.input);
|
|
2183
2170
|
}
|
|
2184
2171
|
validate(node) {
|
|
2185
2172
|
const errors = [];
|
|
@@ -2740,7 +2727,7 @@ function createMockAIConversationsRepository(stores) {
|
|
|
2740
2727
|
const userId = requireUserId();
|
|
2741
2728
|
const now = /* @__PURE__ */ new Date();
|
|
2742
2729
|
const conversation = {
|
|
2743
|
-
id: generateId(),
|
|
2730
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
2744
2731
|
tenantId,
|
|
2745
2732
|
userId,
|
|
2746
2733
|
title: _nullishCoalesce(data.title, () => ( null)),
|
|
@@ -2776,7 +2763,7 @@ function createMockAIConversationsRepository(stores) {
|
|
|
2776
2763
|
addMessage(input) {
|
|
2777
2764
|
const now = /* @__PURE__ */ new Date();
|
|
2778
2765
|
const message = {
|
|
2779
|
-
id: generateId(),
|
|
2766
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
2780
2767
|
conversationId: input.conversationId,
|
|
2781
2768
|
role: input.role,
|
|
2782
2769
|
content: input.content,
|
|
@@ -2834,7 +2821,7 @@ function createMockAIUserMemoryRepository(stores) {
|
|
|
2834
2821
|
const now = /* @__PURE__ */ new Date();
|
|
2835
2822
|
const existing = stores.aiUserMemory.get(key);
|
|
2836
2823
|
const memory = {
|
|
2837
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _39 => _39.id]), () => ( generateId())),
|
|
2824
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _39 => _39.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
2838
2825
|
tenantId,
|
|
2839
2826
|
userId,
|
|
2840
2827
|
preferences: _nullishCoalesce(_nullishCoalesce(data.preferences, () => ( _optionalChain([existing, 'optionalAccess', _40 => _40.preferences]))), () => ( {})),
|
|
@@ -2852,7 +2839,7 @@ function createMockAIUserMemoryRepository(stores) {
|
|
|
2852
2839
|
const now = /* @__PURE__ */ new Date();
|
|
2853
2840
|
const existing = stores.aiUserMemory.get(key);
|
|
2854
2841
|
const memory = {
|
|
2855
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _43 => _43.id]), () => ( generateId())),
|
|
2842
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _43 => _43.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
2856
2843
|
tenantId,
|
|
2857
2844
|
userId,
|
|
2858
2845
|
preferences: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _44 => _44.preferences]), () => ( {})),
|
|
@@ -2870,7 +2857,7 @@ function createMockAIUserMemoryRepository(stores) {
|
|
|
2870
2857
|
const now = /* @__PURE__ */ new Date();
|
|
2871
2858
|
const existing = stores.aiUserMemory.get(key);
|
|
2872
2859
|
const memory = {
|
|
2873
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _47 => _47.id]), () => ( generateId())),
|
|
2860
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _47 => _47.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
2874
2861
|
tenantId,
|
|
2875
2862
|
userId,
|
|
2876
2863
|
preferences: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _48 => _48.preferences]), () => ( {})),
|
|
@@ -2888,7 +2875,7 @@ function createMockAIUserMemoryRepository(stores) {
|
|
|
2888
2875
|
const now = /* @__PURE__ */ new Date();
|
|
2889
2876
|
const existing = stores.aiUserMemory.get(memoryKey);
|
|
2890
2877
|
const memory = {
|
|
2891
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _51 => _51.id]), () => ( generateId())),
|
|
2878
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _51 => _51.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
2892
2879
|
tenantId,
|
|
2893
2880
|
userId,
|
|
2894
2881
|
preferences: { ..._nullishCoalesce(_optionalChain([existing, 'optionalAccess', _52 => _52.preferences]), () => ( {})), [prefKey]: value },
|
|
@@ -2930,7 +2917,7 @@ function createMockAIUsageMetricsRepository(stores) {
|
|
|
2930
2917
|
toolUsage[data.toolName] = (_nullishCoalesce(toolUsage[data.toolName], () => ( 0))) + 1;
|
|
2931
2918
|
}
|
|
2932
2919
|
const metrics = {
|
|
2933
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _57 => _57.id]), () => ( generateId())),
|
|
2920
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _57 => _57.id]), () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
2934
2921
|
tenantId,
|
|
2935
2922
|
date: new Date(_nullishCoalesce(now.toISOString().split("T")[0], () => ( now.toISOString()))),
|
|
2936
2923
|
requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _58 => _58.requestCount]), () => ( 0))) + 1,
|
|
@@ -2998,7 +2985,7 @@ function createMockFilesRepository(stores) {
|
|
|
2998
2985
|
create(data) {
|
|
2999
2986
|
const tenantId = getTenantId();
|
|
3000
2987
|
const file2 = {
|
|
3001
|
-
id: generateId(),
|
|
2988
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
3002
2989
|
tenantId,
|
|
3003
2990
|
name: data.name,
|
|
3004
2991
|
originalName: data.originalName,
|
|
@@ -3099,7 +3086,7 @@ function createMockObjectsRepository(stores) {
|
|
|
3099
3086
|
create(data) {
|
|
3100
3087
|
const tenantId = getTenantId();
|
|
3101
3088
|
const obj = {
|
|
3102
|
-
id: generateId(),
|
|
3089
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
3103
3090
|
tenantId,
|
|
3104
3091
|
name: data.name,
|
|
3105
3092
|
label: data.label,
|
|
@@ -3158,7 +3145,7 @@ function createMockObjectsRepository(stores) {
|
|
|
3158
3145
|
}
|
|
3159
3146
|
}
|
|
3160
3147
|
const newObj = {
|
|
3161
|
-
id: generateId(),
|
|
3148
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
3162
3149
|
tenantId,
|
|
3163
3150
|
name: data.name,
|
|
3164
3151
|
label: data.label,
|
|
@@ -3190,7 +3177,7 @@ function createMockAttributesRepository(stores) {
|
|
|
3190
3177
|
},
|
|
3191
3178
|
create(data) {
|
|
3192
3179
|
const attr = {
|
|
3193
|
-
id: generateId(),
|
|
3180
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
3194
3181
|
objectId: data.objectId,
|
|
3195
3182
|
name: data.name,
|
|
3196
3183
|
label: data.label,
|
|
@@ -3471,9 +3458,6 @@ var ConcurrentModificationError = class extends SchemaError {
|
|
|
3471
3458
|
);
|
|
3472
3459
|
}
|
|
3473
3460
|
};
|
|
3474
|
-
function isConcurrentModificationError(error2) {
|
|
3475
|
-
return error2 instanceof ConcurrentModificationError;
|
|
3476
|
-
}
|
|
3477
3461
|
|
|
3478
3462
|
// src/format.ts
|
|
3479
3463
|
var _constants = require('@stndrds/constants');
|
|
@@ -3822,7 +3806,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
3822
3806
|
create(data) {
|
|
3823
3807
|
const tenantId = getTenantId();
|
|
3824
3808
|
const internal = {
|
|
3825
|
-
id: generateId(),
|
|
3809
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
3826
3810
|
tenantId,
|
|
3827
3811
|
objectId: data.objectId,
|
|
3828
3812
|
label: data.label,
|
|
@@ -4136,7 +4120,7 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4136
4120
|
create(data) {
|
|
4137
4121
|
const tenantId = getTenantId();
|
|
4138
4122
|
const profile = {
|
|
4139
|
-
id: generateId(),
|
|
4123
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4140
4124
|
tenantId,
|
|
4141
4125
|
authId: data.authId,
|
|
4142
4126
|
email: data.email,
|
|
@@ -4194,9 +4178,9 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4194
4178
|
invite(data) {
|
|
4195
4179
|
const tenantId = getTenantId();
|
|
4196
4180
|
const profile = {
|
|
4197
|
-
id: generateId(),
|
|
4181
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4198
4182
|
tenantId,
|
|
4199
|
-
authId: `invited-${generateId()}`,
|
|
4183
|
+
authId: `invited-${_chunkNEVERCM3js.generateId.call(void 0, )}`,
|
|
4200
4184
|
email: data.email,
|
|
4201
4185
|
firstName: data.firstName,
|
|
4202
4186
|
lastName: data.lastName,
|
|
@@ -4232,7 +4216,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4232
4216
|
createRole(input) {
|
|
4233
4217
|
const tenantId = getTenantId();
|
|
4234
4218
|
const role = {
|
|
4235
|
-
id: generateId(),
|
|
4219
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4236
4220
|
tenantId,
|
|
4237
4221
|
name: input.name,
|
|
4238
4222
|
label: input.label,
|
|
@@ -4287,7 +4271,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4287
4271
|
}
|
|
4288
4272
|
for (const input of permissions) {
|
|
4289
4273
|
const perm = {
|
|
4290
|
-
id: generateId(),
|
|
4274
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4291
4275
|
roleId,
|
|
4292
4276
|
scope: input.scope,
|
|
4293
4277
|
target: input.target,
|
|
@@ -4302,7 +4286,8 @@ function createMockPermissionsRepository(stores) {
|
|
|
4302
4286
|
getUserRoles(userProfileId) {
|
|
4303
4287
|
const tenantId = getTenantId();
|
|
4304
4288
|
const roleIds = Array.from(stores.userRoles.values()).filter((ur) => ur.userProfileId === userProfileId && ur.tenantId === tenantId).map((ur) => ur.roleId);
|
|
4305
|
-
const
|
|
4289
|
+
const roleIdsSet = new Set(roleIds);
|
|
4290
|
+
const roles = Array.from(stores.roles.values()).filter((r) => roleIdsSet.has(r.id));
|
|
4306
4291
|
return Promise.resolve(roles);
|
|
4307
4292
|
},
|
|
4308
4293
|
assignRole(input) {
|
|
@@ -4312,7 +4297,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4312
4297
|
}
|
|
4313
4298
|
}
|
|
4314
4299
|
const userRole = {
|
|
4315
|
-
id: generateId(),
|
|
4300
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4316
4301
|
userProfileId: input.userProfileId,
|
|
4317
4302
|
roleId: input.roleId,
|
|
4318
4303
|
tenantId: input.tenantId,
|
|
@@ -4416,7 +4401,7 @@ function createMockViewsRepository(stores) {
|
|
|
4416
4401
|
},
|
|
4417
4402
|
create(data) {
|
|
4418
4403
|
const tenantId = getTenantId();
|
|
4419
|
-
const id = generateId();
|
|
4404
|
+
const id = _chunkNEVERCM3js.generateId.call(void 0, );
|
|
4420
4405
|
const now = /* @__PURE__ */ new Date();
|
|
4421
4406
|
const dbView = {
|
|
4422
4407
|
id,
|
|
@@ -4518,7 +4503,7 @@ function createMockViewOverlaysRepository(stores) {
|
|
|
4518
4503
|
const views = Array.from(stores.views.values()).filter(
|
|
4519
4504
|
(v) => v.tenantId === tenantId && v.objectName === objectName && v.type === type
|
|
4520
4505
|
);
|
|
4521
|
-
const viewIds =
|
|
4506
|
+
const viewIds = views.reduce((set, v) => set.add(v.id), /* @__PURE__ */ new Set());
|
|
4522
4507
|
return Promise.resolve(
|
|
4523
4508
|
_nullishCoalesce(Array.from(stores.viewOverlays.values()).find(
|
|
4524
4509
|
(o) => o.tenantId === tenantId && o.userId === userId && o.isUserDefault === true && viewIds.has(o.viewId)
|
|
@@ -4527,7 +4512,7 @@ function createMockViewOverlaysRepository(stores) {
|
|
|
4527
4512
|
},
|
|
4528
4513
|
create(data) {
|
|
4529
4514
|
const tenantId = getTenantId();
|
|
4530
|
-
const id = generateId();
|
|
4515
|
+
const id = _chunkNEVERCM3js.generateId.call(void 0, );
|
|
4531
4516
|
const now = /* @__PURE__ */ new Date();
|
|
4532
4517
|
const overlay = {
|
|
4533
4518
|
id,
|
|
@@ -4603,7 +4588,7 @@ function createMockViewOverlaysRepository(stores) {
|
|
|
4603
4588
|
const views = Array.from(stores.views.values()).filter(
|
|
4604
4589
|
(v) => v.tenantId === tenantId && v.objectName === objectName && v.type === type
|
|
4605
4590
|
);
|
|
4606
|
-
const viewIds =
|
|
4591
|
+
const viewIds = views.reduce((set, v) => set.add(v.id), /* @__PURE__ */ new Set());
|
|
4607
4592
|
for (const overlay of stores.viewOverlays.values()) {
|
|
4608
4593
|
if (overlay.tenantId === tenantId && overlay.userId === userId && overlay.isUserDefault === true && viewIds.has(overlay.viewId)) {
|
|
4609
4594
|
overlay.isUserDefault = false;
|
|
@@ -4659,7 +4644,7 @@ function createMockWorkflowsRepository(stores) {
|
|
|
4659
4644
|
const tenantId = getTenantId();
|
|
4660
4645
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4661
4646
|
const workflow2 = {
|
|
4662
|
-
id: generateId(),
|
|
4647
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4663
4648
|
tenant_id: tenantId,
|
|
4664
4649
|
name: data.name,
|
|
4665
4650
|
label: data.label,
|
|
@@ -4763,7 +4748,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
4763
4748
|
const tenantId = getTenantId();
|
|
4764
4749
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4765
4750
|
const instance = {
|
|
4766
|
-
id: generateId(),
|
|
4751
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4767
4752
|
tenant_id: tenantId,
|
|
4768
4753
|
workflow_id: data.workflowId,
|
|
4769
4754
|
workflow_version: data.workflowVersion,
|
|
@@ -4893,7 +4878,7 @@ function createMockWorkflowInvitationsRepository(stores) {
|
|
|
4893
4878
|
const tenantId = getTenantId();
|
|
4894
4879
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4895
4880
|
const invitation = {
|
|
4896
|
-
id: generateId(),
|
|
4881
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4897
4882
|
tenant_id: tenantId,
|
|
4898
4883
|
instance_id: data.instanceId,
|
|
4899
4884
|
recipient_email: data.recipientEmail,
|
|
@@ -4957,7 +4942,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
|
|
|
4957
4942
|
const tenantId = getTenantId();
|
|
4958
4943
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4959
4944
|
const grant = {
|
|
4960
|
-
id: generateId(),
|
|
4945
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
4961
4946
|
tenant_id: tenantId,
|
|
4962
4947
|
invitation_id: data.invitationId,
|
|
4963
4948
|
instance_id: data.instanceId,
|
|
@@ -7899,13 +7884,13 @@ var WorkflowBuilder = class {
|
|
|
7899
7884
|
if (!this.startNodeId) {
|
|
7900
7885
|
throw new Error("[WorkflowBuilder] A start node is required. Use .start() to add one.");
|
|
7901
7886
|
}
|
|
7902
|
-
if (
|
|
7887
|
+
if (isEmpty(this.data.nodes)) {
|
|
7903
7888
|
throw new Error("[WorkflowBuilder] At least one node is required.");
|
|
7904
7889
|
}
|
|
7905
7890
|
if (!this.data.slots || this.data.slots.length === 0) {
|
|
7906
7891
|
throw new Error("[WorkflowBuilder] At least one slot is required. Use .slot() to add slots.");
|
|
7907
7892
|
}
|
|
7908
|
-
const hasEndNode = Object.values(this.data.nodes).some((n) => n.type === "end");
|
|
7893
|
+
const hasEndNode = this.data.nodes ? Object.values(this.data.nodes).some((n) => n.type === "end") : false;
|
|
7909
7894
|
if (!hasEndNode) {
|
|
7910
7895
|
throw new Error(
|
|
7911
7896
|
"[WorkflowBuilder] At least one end node is required. Use .end() to add one."
|
|
@@ -7936,7 +7921,7 @@ var WorkflowBuilder = class {
|
|
|
7936
7921
|
}
|
|
7937
7922
|
}
|
|
7938
7923
|
validateSlotReferences() {
|
|
7939
|
-
const slotIds =
|
|
7924
|
+
const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _161 => _161.data, 'access', _162 => _162.slots, 'optionalAccess', _163 => _163.reduce, 'call', _164 => _164((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
|
|
7940
7925
|
for (const node of Object.values(_nullishCoalesce(this.data.nodes, () => ( {})))) {
|
|
7941
7926
|
if (node.type === "form") {
|
|
7942
7927
|
const referencedSlots = /* @__PURE__ */ new Set();
|
|
@@ -8041,22 +8026,6 @@ function isBehaviorProperty(property) {
|
|
|
8041
8026
|
function isPresentationProperty(property) {
|
|
8042
8027
|
return PRESENTATION_PROPERTIES.includes(property);
|
|
8043
8028
|
}
|
|
8044
|
-
function getPropertyProtectionLevel(property) {
|
|
8045
|
-
if (isIdentityProperty(property)) return "identity";
|
|
8046
|
-
if (isBehaviorProperty(property)) return "behavior";
|
|
8047
|
-
if (isPresentationProperty(property)) return "presentation";
|
|
8048
|
-
return "unknown";
|
|
8049
|
-
}
|
|
8050
|
-
function filterPropertiesByCategory(properties, category) {
|
|
8051
|
-
switch (category) {
|
|
8052
|
-
case "identity":
|
|
8053
|
-
return properties.filter(isIdentityProperty);
|
|
8054
|
-
case "behavior":
|
|
8055
|
-
return properties.filter(isBehaviorProperty);
|
|
8056
|
-
case "presentation":
|
|
8057
|
-
return properties.filter(isPresentationProperty);
|
|
8058
|
-
}
|
|
8059
|
-
}
|
|
8060
8029
|
|
|
8061
8030
|
// src/types/errors.ts
|
|
8062
8031
|
var RecordReferencedError = class extends Error {
|
|
@@ -8170,563 +8139,6 @@ function isSystemAttributeObject(attr) {
|
|
|
8170
8139
|
return attr.system === true;
|
|
8171
8140
|
}
|
|
8172
8141
|
|
|
8173
|
-
// src/validation/validators.ts
|
|
8174
|
-
|
|
8175
|
-
var regexPatternCache = /* @__PURE__ */ new Map();
|
|
8176
|
-
function getCachedRegex(pattern) {
|
|
8177
|
-
let cached = regexPatternCache.get(pattern);
|
|
8178
|
-
if (!cached) {
|
|
8179
|
-
cached = new RegExp(pattern);
|
|
8180
|
-
regexPatternCache.set(pattern, cached);
|
|
8181
|
-
}
|
|
8182
|
-
return cached;
|
|
8183
|
-
}
|
|
8184
|
-
var DEFAULT_VALIDATION_MESSAGES = {
|
|
8185
|
-
required: (attr) => `${attr.label} is required`,
|
|
8186
|
-
invalidType: (attr, expected) => `${attr.label} must be a ${expected}`,
|
|
8187
|
-
minLength: (attr, min) => `${attr.label} must be at least ${min} characters`,
|
|
8188
|
-
maxLength: (attr, max) => `${attr.label} must be at most ${max} characters`,
|
|
8189
|
-
invalidPattern: (attr) => `${attr.label} format is invalid`,
|
|
8190
|
-
minValue: (attr, min) => `${attr.label} must be at least ${min}`,
|
|
8191
|
-
maxValue: (attr, max) => `${attr.label} must be at most ${max}`,
|
|
8192
|
-
mustBeInteger: (attr) => `${attr.label} must be an integer`,
|
|
8193
|
-
invalidDate: (attr) => `${attr.label} must be a valid date`,
|
|
8194
|
-
invalidOption: (attr, options) => `${attr.label} must be one of: ${options.join(", ")}`,
|
|
8195
|
-
invalidId: (attr) => `${attr.label} must be a valid ID`,
|
|
8196
|
-
minItems: (attr, min) => `${attr.label} must have at least ${min} item${min > 1 ? "s" : ""}`,
|
|
8197
|
-
maxItems: (attr, max) => `${attr.label} must have at most ${max} item${max > 1 ? "s" : ""}`,
|
|
8198
|
-
invalidRichtext: (attr) => `${attr.label} must be valid rich text content`,
|
|
8199
|
-
invalidPhone: (attr) => `${attr.label} must be a valid phone number`,
|
|
8200
|
-
invalidCurrency: (attr) => `${attr.label} must be a valid currency value`,
|
|
8201
|
-
invalidLocation: (attr) => `${attr.label} must be a valid location`
|
|
8202
|
-
};
|
|
8203
|
-
var baseConfigSchema = _zod.z.object({
|
|
8204
|
-
disabled: _zod.z.boolean().optional(),
|
|
8205
|
-
placeholder: _zod.z.string().optional(),
|
|
8206
|
-
description: _zod.z.string().optional(),
|
|
8207
|
-
defaultValue: _zod.z.unknown().optional(),
|
|
8208
|
-
icon: _zod.z.string().optional(),
|
|
8209
|
-
order: _zod.z.number().int().optional(),
|
|
8210
|
-
hidden: _zod.z.boolean().optional(),
|
|
8211
|
-
archived: _zod.z.boolean().optional(),
|
|
8212
|
-
deprecated: _zod.z.boolean().optional(),
|
|
8213
|
-
metadata: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional()
|
|
8214
|
-
});
|
|
8215
|
-
var optionSchema = _zod.z.object({
|
|
8216
|
-
id: _zod.z.string().min(1),
|
|
8217
|
-
label: _zod.z.string().min(1),
|
|
8218
|
-
value: _zod.z.string().min(1),
|
|
8219
|
-
color: _zod.z.string().optional(),
|
|
8220
|
-
icon: _zod.z.string().optional(),
|
|
8221
|
-
description: _zod.z.string().optional(),
|
|
8222
|
-
group: _zod.z.enum(["idle", "in_progress", "finished"]).optional()
|
|
8223
|
-
});
|
|
8224
|
-
var optionsArraySchema = _zod.z.array(optionSchema).min(1).refine(
|
|
8225
|
-
(options) => {
|
|
8226
|
-
const values = options.map((o) => o.value);
|
|
8227
|
-
return new Set(values).size === values.length;
|
|
8228
|
-
},
|
|
8229
|
-
{ message: "Duplicate option values are not allowed" }
|
|
8230
|
-
);
|
|
8231
|
-
var relationTargetSchema = _zod.z.object({
|
|
8232
|
-
object: _zod.z.string().min(1),
|
|
8233
|
-
displayTemplate: _zod.z.string().optional(),
|
|
8234
|
-
filter: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional()
|
|
8235
|
-
});
|
|
8236
|
-
var textConfigSchema = baseConfigSchema.extend({
|
|
8237
|
-
minLength: _zod.z.number().int().min(0).optional(),
|
|
8238
|
-
maxLength: _zod.z.number().int().min(1).optional(),
|
|
8239
|
-
pattern: _zod.z.string().optional()
|
|
8240
|
-
});
|
|
8241
|
-
var textareaConfigSchema = baseConfigSchema;
|
|
8242
|
-
var richtextConfigSchema = baseConfigSchema.extend({
|
|
8243
|
-
features: _zod.z.array(
|
|
8244
|
-
_zod.z.enum(["headings", "bold", "italic", "lists", "links", "images", "codeBlocks", "tables"])
|
|
8245
|
-
).optional()
|
|
8246
|
-
});
|
|
8247
|
-
var numberConfigSchema = baseConfigSchema.extend({
|
|
8248
|
-
min: _zod.z.number().optional(),
|
|
8249
|
-
max: _zod.z.number().optional(),
|
|
8250
|
-
unit: _zod.z.enum(["integer", "decimal", "percentage"]).optional(),
|
|
8251
|
-
decimals: _zod.z.number().int().min(0).optional()
|
|
8252
|
-
});
|
|
8253
|
-
var checkboxConfigSchema = baseConfigSchema;
|
|
8254
|
-
var dateConfigSchema = baseConfigSchema.extend({
|
|
8255
|
-
dateFormat: _zod.z.enum(["short", "long", "full", "relative"]).optional(),
|
|
8256
|
-
minDate: _zod.z.string().optional(),
|
|
8257
|
-
maxDate: _zod.z.string().optional()
|
|
8258
|
-
});
|
|
8259
|
-
var phoneConfigSchema = baseConfigSchema.extend({
|
|
8260
|
-
defaultCountryCode: _zod.z.string().length(3).optional()
|
|
8261
|
-
});
|
|
8262
|
-
var currencyConfigSchema = baseConfigSchema.extend({
|
|
8263
|
-
defaultCurrency: _zod.z.string().length(3).optional(),
|
|
8264
|
-
allowedCurrencies: _zod.z.array(_zod.z.string().length(3)).optional()
|
|
8265
|
-
});
|
|
8266
|
-
var statusConfigSchema = baseConfigSchema.extend({
|
|
8267
|
-
options: optionsArraySchema
|
|
8268
|
-
});
|
|
8269
|
-
var locationConfigSchema = baseConfigSchema.extend({
|
|
8270
|
-
granularity: _zod.z.enum(["full", "address", "city", "state", "country", "coordinates"]),
|
|
8271
|
-
enableAutocomplete: _zod.z.boolean().optional(),
|
|
8272
|
-
enableMap: _zod.z.boolean().optional(),
|
|
8273
|
-
defaultCountry: _zod.z.string().length(3).optional(),
|
|
8274
|
-
allowedCountries: _zod.z.array(_zod.z.string().length(3)).optional(),
|
|
8275
|
-
displayFormat: _zod.z.enum(["single_line", "multi_line", "compact"]).optional()
|
|
8276
|
-
});
|
|
8277
|
-
var selectConfigSchema = baseConfigSchema.extend({
|
|
8278
|
-
options: optionsArraySchema
|
|
8279
|
-
});
|
|
8280
|
-
var multiselectConfigSchema = baseConfigSchema.extend({
|
|
8281
|
-
options: optionsArraySchema
|
|
8282
|
-
});
|
|
8283
|
-
var fileConfigSchema = baseConfigSchema.extend({
|
|
8284
|
-
maxFiles: _zod.z.number().int().min(1).optional(),
|
|
8285
|
-
maxSize: _zod.z.number().int().min(1).optional(),
|
|
8286
|
-
allowedTypes: _zod.z.array(_zod.z.string()).optional(),
|
|
8287
|
-
multiple: _zod.z.boolean().optional()
|
|
8288
|
-
});
|
|
8289
|
-
var userConfigSchema = baseConfigSchema.extend({
|
|
8290
|
-
allowedRoles: _zod.z.array(_zod.z.string()).optional(),
|
|
8291
|
-
multiple: _zod.z.boolean().optional()
|
|
8292
|
-
});
|
|
8293
|
-
var relationConfigSchema = baseConfigSchema.extend({
|
|
8294
|
-
targets: _zod.z.array(relationTargetSchema).min(1),
|
|
8295
|
-
cardinality: _zod.z.enum(["one", "many"]),
|
|
8296
|
-
minItems: _zod.z.number().int().min(0).optional(),
|
|
8297
|
-
maxItems: _zod.z.number().int().min(1).optional()
|
|
8298
|
-
});
|
|
8299
|
-
var ratingConfigSchema = baseConfigSchema.extend({
|
|
8300
|
-
max: _zod.z.number().int().min(1).optional(),
|
|
8301
|
-
iconType: _zod.z.enum(["star", "heart", "thumbs", "number"]).optional()
|
|
8302
|
-
});
|
|
8303
|
-
var formulaConfigSchema = baseConfigSchema.extend({
|
|
8304
|
-
expression: _zod.z.string().min(1),
|
|
8305
|
-
returnType: _zod.z.enum(["text", "number", "boolean", "date"]),
|
|
8306
|
-
decimals: _zod.z.number().int().min(0).max(10).optional(),
|
|
8307
|
-
allowRelations: _zod.z.boolean().optional()
|
|
8308
|
-
});
|
|
8309
|
-
var rollupConfigSchema = baseConfigSchema.extend({
|
|
8310
|
-
relationAttribute: _zod.z.string().min(1).optional(),
|
|
8311
|
-
relationPath: _zod.z.string().optional(),
|
|
8312
|
-
targetAttribute: _zod.z.string().min(1),
|
|
8313
|
-
function: _zod.z.enum([
|
|
8314
|
-
// Numeric aggregates
|
|
8315
|
-
"sum",
|
|
8316
|
-
"avg",
|
|
8317
|
-
// Date aggregates
|
|
8318
|
-
"earliest",
|
|
8319
|
-
"latest",
|
|
8320
|
-
// Count (universal)
|
|
8321
|
-
"count",
|
|
8322
|
-
"countValues",
|
|
8323
|
-
"countUniqueValues",
|
|
8324
|
-
"countEmpty",
|
|
8325
|
-
// Percent (universal)
|
|
8326
|
-
"percentEmpty",
|
|
8327
|
-
"percentNotEmpty",
|
|
8328
|
-
// Lookup (universal)
|
|
8329
|
-
"original"
|
|
8330
|
-
]),
|
|
8331
|
-
decimals: _zod.z.number().int().min(0).max(10).optional(),
|
|
8332
|
-
targetAttributeType: _zod.z.string().optional(),
|
|
8333
|
-
targetAttributeOptions: _zod.z.array(
|
|
8334
|
-
_zod.z.object({
|
|
8335
|
-
id: _zod.z.string(),
|
|
8336
|
-
label: _zod.z.string(),
|
|
8337
|
-
value: _zod.z.string(),
|
|
8338
|
-
color: _zod.z.string().optional(),
|
|
8339
|
-
icon: _zod.z.string().optional(),
|
|
8340
|
-
description: _zod.z.string().optional(),
|
|
8341
|
-
group: _zod.z.enum(["idle", "in_progress", "finished"]).optional()
|
|
8342
|
-
})
|
|
8343
|
-
).optional()
|
|
8344
|
-
});
|
|
8345
|
-
var documentConfigSchema = baseConfigSchema.extend({
|
|
8346
|
-
templateId: _zod.z.string().optional(),
|
|
8347
|
-
allowedTemplates: _zod.z.array(_zod.z.string()).optional(),
|
|
8348
|
-
multiple: _zod.z.boolean().optional(),
|
|
8349
|
-
maxDocuments: _zod.z.number().int().min(1).optional(),
|
|
8350
|
-
autoProcess: _zod.z.boolean().optional()
|
|
8351
|
-
});
|
|
8352
|
-
var attributeConfigSchemas = {
|
|
8353
|
-
text: textConfigSchema,
|
|
8354
|
-
textarea: textareaConfigSchema,
|
|
8355
|
-
richtext: richtextConfigSchema,
|
|
8356
|
-
number: numberConfigSchema,
|
|
8357
|
-
checkbox: checkboxConfigSchema,
|
|
8358
|
-
date: dateConfigSchema,
|
|
8359
|
-
phone: phoneConfigSchema,
|
|
8360
|
-
currency: currencyConfigSchema,
|
|
8361
|
-
status: statusConfigSchema,
|
|
8362
|
-
location: locationConfigSchema,
|
|
8363
|
-
select: selectConfigSchema,
|
|
8364
|
-
multiselect: multiselectConfigSchema,
|
|
8365
|
-
file: fileConfigSchema,
|
|
8366
|
-
user: userConfigSchema,
|
|
8367
|
-
relation: relationConfigSchema,
|
|
8368
|
-
rating: ratingConfigSchema,
|
|
8369
|
-
formula: formulaConfigSchema,
|
|
8370
|
-
rollup: rollupConfigSchema,
|
|
8371
|
-
document: documentConfigSchema
|
|
8372
|
-
};
|
|
8373
|
-
function getAttributeConfigSchema(type) {
|
|
8374
|
-
return attributeConfigSchemas[type];
|
|
8375
|
-
}
|
|
8376
|
-
function validateAttributeConfig(type, config) {
|
|
8377
|
-
const schema = getAttributeConfigSchema(type);
|
|
8378
|
-
const result = schema.safeParse(config);
|
|
8379
|
-
if (result.success) {
|
|
8380
|
-
return { success: true, data: result.data };
|
|
8381
|
-
}
|
|
8382
|
-
return {
|
|
8383
|
-
success: false,
|
|
8384
|
-
errors: result.error.issues.map((err) => `${err.path.join(".")}: ${err.message}`)
|
|
8385
|
-
};
|
|
8386
|
-
}
|
|
8387
|
-
function parseAttributeConfig(type, config) {
|
|
8388
|
-
const schema = getAttributeConfigSchema(type);
|
|
8389
|
-
return schema.strip().parse(config);
|
|
8390
|
-
}
|
|
8391
|
-
function safeParseAttributeConfig(type, config) {
|
|
8392
|
-
const schema = getAttributeConfigSchema(type);
|
|
8393
|
-
const result = schema.strip().safeParse(config);
|
|
8394
|
-
return result.success ? result.data : void 0;
|
|
8395
|
-
}
|
|
8396
|
-
function createTextValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8397
|
-
let schema = _zod.z.string();
|
|
8398
|
-
if (attr.minLength !== void 0) {
|
|
8399
|
-
schema = schema.min(attr.minLength, messages.minLength(attr, attr.minLength));
|
|
8400
|
-
}
|
|
8401
|
-
if (attr.maxLength !== void 0) {
|
|
8402
|
-
schema = schema.max(attr.maxLength, messages.maxLength(attr, attr.maxLength));
|
|
8403
|
-
}
|
|
8404
|
-
if (attr.pattern) {
|
|
8405
|
-
schema = schema.regex(getCachedRegex(attr.pattern), messages.invalidPattern(attr));
|
|
8406
|
-
}
|
|
8407
|
-
return schema;
|
|
8408
|
-
}
|
|
8409
|
-
function createNumberValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8410
|
-
let schema = _zod.z.number();
|
|
8411
|
-
if (attr.min !== void 0) {
|
|
8412
|
-
schema = schema.min(attr.min, messages.minValue(attr, attr.min));
|
|
8413
|
-
}
|
|
8414
|
-
if (attr.max !== void 0) {
|
|
8415
|
-
schema = schema.max(attr.max, messages.maxValue(attr, attr.max));
|
|
8416
|
-
}
|
|
8417
|
-
if (attr.unit === "integer") {
|
|
8418
|
-
schema = schema.int(messages.mustBeInteger(attr));
|
|
8419
|
-
}
|
|
8420
|
-
return schema;
|
|
8421
|
-
}
|
|
8422
|
-
function createCheckboxValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8423
|
-
return _zod.z.boolean();
|
|
8424
|
-
}
|
|
8425
|
-
function createDateValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8426
|
-
return _zod.z.coerce.date({ message: messages.invalidDate(attr) });
|
|
8427
|
-
}
|
|
8428
|
-
function createPhoneValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8429
|
-
return _zod.z.object(
|
|
8430
|
-
{
|
|
8431
|
-
countryCode: _zod.z.string().length(3),
|
|
8432
|
-
phoneNumber: _zod.z.string().min(1)
|
|
8433
|
-
},
|
|
8434
|
-
{ message: messages.invalidPhone(attr) }
|
|
8435
|
-
);
|
|
8436
|
-
}
|
|
8437
|
-
function createCurrencyValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8438
|
-
return _zod.z.object(
|
|
8439
|
-
{
|
|
8440
|
-
code: _zod.z.string().length(3),
|
|
8441
|
-
value: _zod.z.number().min(0)
|
|
8442
|
-
},
|
|
8443
|
-
{ message: messages.invalidCurrency(attr) }
|
|
8444
|
-
);
|
|
8445
|
-
}
|
|
8446
|
-
function createStatusValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8447
|
-
const validValues = attr.options.map((opt) => opt.value);
|
|
8448
|
-
return _zod.z.enum(validValues, {
|
|
8449
|
-
message: messages.invalidOption(attr, validValues)
|
|
8450
|
-
});
|
|
8451
|
-
}
|
|
8452
|
-
function createSelectValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8453
|
-
const validValues = attr.options.map((opt) => opt.value);
|
|
8454
|
-
return _zod.z.enum(validValues, {
|
|
8455
|
-
message: messages.invalidOption(attr, validValues)
|
|
8456
|
-
});
|
|
8457
|
-
}
|
|
8458
|
-
function createMultiselectValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8459
|
-
const validValues = attr.options.map((opt) => opt.value);
|
|
8460
|
-
return _zod.z.array(
|
|
8461
|
-
_zod.z.enum(validValues, {
|
|
8462
|
-
message: messages.invalidOption(attr, validValues)
|
|
8463
|
-
})
|
|
8464
|
-
);
|
|
8465
|
-
}
|
|
8466
|
-
function createLocationValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8467
|
-
return _zod.z.object(
|
|
8468
|
-
{
|
|
8469
|
-
address: _zod.z.string().optional(),
|
|
8470
|
-
address2: _zod.z.string().optional(),
|
|
8471
|
-
city: _zod.z.string().optional(),
|
|
8472
|
-
state: _zod.z.string().optional(),
|
|
8473
|
-
postalCode: _zod.z.string().optional(),
|
|
8474
|
-
country: _zod.z.string().length(3).optional(),
|
|
8475
|
-
latitude: _zod.z.number().optional(),
|
|
8476
|
-
longitude: _zod.z.number().optional()
|
|
8477
|
-
},
|
|
8478
|
-
{ message: messages.invalidLocation(attr) }
|
|
8479
|
-
);
|
|
8480
|
-
}
|
|
8481
|
-
function createFileValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8482
|
-
const uuidSchema = _zod.z.uuid({
|
|
8483
|
-
message: messages.invalidId(attr)
|
|
8484
|
-
});
|
|
8485
|
-
if (attr.multiple) {
|
|
8486
|
-
let arraySchema = _zod.z.array(uuidSchema);
|
|
8487
|
-
if (attr.maxFiles) {
|
|
8488
|
-
arraySchema = arraySchema.max(attr.maxFiles, messages.maxItems(attr, attr.maxFiles));
|
|
8489
|
-
}
|
|
8490
|
-
return arraySchema;
|
|
8491
|
-
}
|
|
8492
|
-
return uuidSchema;
|
|
8493
|
-
}
|
|
8494
|
-
function createUserValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8495
|
-
const uuidSchema = _zod.z.uuid({
|
|
8496
|
-
message: messages.invalidId(attr)
|
|
8497
|
-
});
|
|
8498
|
-
if (attr.multiple) {
|
|
8499
|
-
return _zod.z.array(uuidSchema);
|
|
8500
|
-
}
|
|
8501
|
-
return uuidSchema;
|
|
8502
|
-
}
|
|
8503
|
-
function createSingleRelationValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8504
|
-
const uuidSchema = _zod.z.uuid({
|
|
8505
|
-
message: messages.invalidId(attr)
|
|
8506
|
-
});
|
|
8507
|
-
return _zod.z.union([uuidSchema, _zod.z.null()]);
|
|
8508
|
-
}
|
|
8509
|
-
function createMultiRelationValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8510
|
-
const uuidSchema = _zod.z.uuid({
|
|
8511
|
-
message: messages.invalidId(attr)
|
|
8512
|
-
});
|
|
8513
|
-
let arraySchema = _zod.z.array(uuidSchema);
|
|
8514
|
-
if (attr.minItems !== void 0) {
|
|
8515
|
-
arraySchema = arraySchema.min(attr.minItems, messages.minItems(attr, attr.minItems));
|
|
8516
|
-
}
|
|
8517
|
-
if (attr.maxItems !== void 0) {
|
|
8518
|
-
arraySchema = arraySchema.max(attr.maxItems, messages.maxItems(attr, attr.maxItems));
|
|
8519
|
-
}
|
|
8520
|
-
return arraySchema;
|
|
8521
|
-
}
|
|
8522
|
-
function createRelationValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8523
|
-
if (attr.cardinality === "many") {
|
|
8524
|
-
return createMultiRelationValidator(attr, messages);
|
|
8525
|
-
}
|
|
8526
|
-
return createSingleRelationValidator(attr, messages);
|
|
8527
|
-
}
|
|
8528
|
-
function createRatingValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8529
|
-
let schema = _zod.z.number().min(0);
|
|
8530
|
-
if (attr.max !== void 0) {
|
|
8531
|
-
schema = schema.max(attr.max, messages.maxValue(attr, attr.max));
|
|
8532
|
-
}
|
|
8533
|
-
return schema;
|
|
8534
|
-
}
|
|
8535
|
-
function createFormulaValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8536
|
-
return _zod.z.unknown();
|
|
8537
|
-
}
|
|
8538
|
-
function createRollupValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8539
|
-
return _zod.z.unknown();
|
|
8540
|
-
}
|
|
8541
|
-
function createTextAreaValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8542
|
-
return _zod.z.string();
|
|
8543
|
-
}
|
|
8544
|
-
function createRichtextValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8545
|
-
return _zod.z.string({
|
|
8546
|
-
message: messages.invalidRichtext(attr)
|
|
8547
|
-
});
|
|
8548
|
-
}
|
|
8549
|
-
function createAttributeValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8550
|
-
switch (attr.type) {
|
|
8551
|
-
case "text":
|
|
8552
|
-
return createTextValidator(attr, messages);
|
|
8553
|
-
case "textarea":
|
|
8554
|
-
return createTextAreaValidator(attr, messages);
|
|
8555
|
-
case "richtext":
|
|
8556
|
-
return createRichtextValidator(attr, messages);
|
|
8557
|
-
case "number":
|
|
8558
|
-
return createNumberValidator(attr, messages);
|
|
8559
|
-
case "checkbox":
|
|
8560
|
-
return createCheckboxValidator(attr, messages);
|
|
8561
|
-
case "date":
|
|
8562
|
-
return createDateValidator(attr, messages);
|
|
8563
|
-
case "phone":
|
|
8564
|
-
return createPhoneValidator(attr, messages);
|
|
8565
|
-
case "currency":
|
|
8566
|
-
return createCurrencyValidator(attr, messages);
|
|
8567
|
-
case "status":
|
|
8568
|
-
return createStatusValidator(attr, messages);
|
|
8569
|
-
case "location":
|
|
8570
|
-
return createLocationValidator(attr, messages);
|
|
8571
|
-
case "select":
|
|
8572
|
-
return createSelectValidator(attr, messages);
|
|
8573
|
-
case "multiselect":
|
|
8574
|
-
return createMultiselectValidator(attr, messages);
|
|
8575
|
-
case "file":
|
|
8576
|
-
return createFileValidator(attr, messages);
|
|
8577
|
-
case "user":
|
|
8578
|
-
return createUserValidator(attr, messages);
|
|
8579
|
-
case "relation":
|
|
8580
|
-
return createRelationValidator(attr, messages);
|
|
8581
|
-
case "rating":
|
|
8582
|
-
return createRatingValidator(attr, messages);
|
|
8583
|
-
case "formula":
|
|
8584
|
-
return createFormulaValidator(attr, messages);
|
|
8585
|
-
case "rollup":
|
|
8586
|
-
return createRollupValidator(attr, messages);
|
|
8587
|
-
default:
|
|
8588
|
-
return _zod.z.unknown();
|
|
8589
|
-
}
|
|
8590
|
-
}
|
|
8591
|
-
function isEmptyValue(value) {
|
|
8592
|
-
if (value === null || value === void 0) return true;
|
|
8593
|
-
if (typeof value === "string" && value.trim() === "") return true;
|
|
8594
|
-
if (value instanceof Date) return false;
|
|
8595
|
-
if (typeof value === "object" && !Array.isArray(value)) {
|
|
8596
|
-
return Object.values(value).every(
|
|
8597
|
-
(v) => v === null || v === void 0 || typeof v === "string" && v.trim() === ""
|
|
8598
|
-
);
|
|
8599
|
-
}
|
|
8600
|
-
return false;
|
|
8601
|
-
}
|
|
8602
|
-
function withEmptyToNull(validator) {
|
|
8603
|
-
return _zod.z.preprocess((val) => isEmptyValue(val) ? null : val, validator.nullish());
|
|
8604
|
-
}
|
|
8605
|
-
function createFormAttributeValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
8606
|
-
const validator = createAttributeValidator(attr, messages);
|
|
8607
|
-
if (!attr.required) {
|
|
8608
|
-
return withEmptyToNull(validator);
|
|
8609
|
-
}
|
|
8610
|
-
return validator;
|
|
8611
|
-
}
|
|
8612
|
-
function createObjectValidator(objectDef) {
|
|
8613
|
-
const shape = {};
|
|
8614
|
-
for (const attr of objectDef.attributes) {
|
|
8615
|
-
const validator = createAttributeValidator(attr);
|
|
8616
|
-
shape[attr.name] = attr.required ? validator : withEmptyToNull(validator);
|
|
8617
|
-
}
|
|
8618
|
-
return _zod.z.object(shape).passthrough();
|
|
8619
|
-
}
|
|
8620
|
-
function validateAttribute(attr, value) {
|
|
8621
|
-
const validator = createAttributeValidator(attr);
|
|
8622
|
-
if (!attr.required && (value === void 0 || value === null)) {
|
|
8623
|
-
return { success: true, data: { [attr.name]: value } };
|
|
8624
|
-
}
|
|
8625
|
-
const result = validator.safeParse(value);
|
|
8626
|
-
if (result.success) {
|
|
8627
|
-
return {
|
|
8628
|
-
success: true,
|
|
8629
|
-
data: { [attr.name]: result.data }
|
|
8630
|
-
};
|
|
8631
|
-
}
|
|
8632
|
-
return {
|
|
8633
|
-
success: false,
|
|
8634
|
-
errors: result.error.issues.map((err) => ({
|
|
8635
|
-
path: [attr.name, ...err.path.map(String)],
|
|
8636
|
-
message: err.message
|
|
8637
|
-
}))
|
|
8638
|
-
};
|
|
8639
|
-
}
|
|
8640
|
-
function validateObject(objectDef, data) {
|
|
8641
|
-
const validator = createObjectValidator(objectDef);
|
|
8642
|
-
const result = validator.safeParse(data);
|
|
8643
|
-
if (result.success) {
|
|
8644
|
-
return {
|
|
8645
|
-
success: true,
|
|
8646
|
-
data: result.data
|
|
8647
|
-
};
|
|
8648
|
-
}
|
|
8649
|
-
return {
|
|
8650
|
-
success: false,
|
|
8651
|
-
errors: result.error.issues.map((err) => ({
|
|
8652
|
-
path: err.path.map(String),
|
|
8653
|
-
message: err.message
|
|
8654
|
-
}))
|
|
8655
|
-
};
|
|
8656
|
-
}
|
|
8657
|
-
function validateObjectOrThrow(objectDef, data) {
|
|
8658
|
-
const result = validateObject(objectDef, data);
|
|
8659
|
-
if (!result.success) {
|
|
8660
|
-
const errorMessages = _optionalChain([result, 'access', _165 => _165.errors, 'optionalAccess', _166 => _166.map, 'call', _167 => _167((err) => `${err.path.join(".")}: ${err.message}`), 'access', _168 => _168.join, 'call', _169 => _169("\n")]) || "Unknown validation error";
|
|
8661
|
-
throw new Error(`Validation failed for ${objectDef.label}:
|
|
8662
|
-
${errorMessages}`);
|
|
8663
|
-
}
|
|
8664
|
-
return result.data;
|
|
8665
|
-
}
|
|
8666
|
-
function createDraftValidator(objectDef) {
|
|
8667
|
-
const shape = {};
|
|
8668
|
-
for (const attr of objectDef.attributes) {
|
|
8669
|
-
const validator = createAttributeValidator(attr);
|
|
8670
|
-
shape[attr.name] = withEmptyToNull(validator);
|
|
8671
|
-
}
|
|
8672
|
-
return _zod.z.object(shape).passthrough();
|
|
8673
|
-
}
|
|
8674
|
-
function validateDraft(objectDef, data) {
|
|
8675
|
-
const validator = createDraftValidator(objectDef);
|
|
8676
|
-
const result = validator.safeParse(data);
|
|
8677
|
-
if (result.success) {
|
|
8678
|
-
return {
|
|
8679
|
-
success: true,
|
|
8680
|
-
data: result.data
|
|
8681
|
-
};
|
|
8682
|
-
}
|
|
8683
|
-
return {
|
|
8684
|
-
success: false,
|
|
8685
|
-
errors: result.error.issues.map((err) => ({
|
|
8686
|
-
path: err.path.map(String),
|
|
8687
|
-
message: err.message
|
|
8688
|
-
}))
|
|
8689
|
-
};
|
|
8690
|
-
}
|
|
8691
|
-
function validateDraftOrThrow(objectDef, data) {
|
|
8692
|
-
const result = validateDraft(objectDef, data);
|
|
8693
|
-
if (!result.success) {
|
|
8694
|
-
const errorMessages = _optionalChain([result, 'access', _170 => _170.errors, 'optionalAccess', _171 => _171.map, 'call', _172 => _172((err) => `${err.path.join(".")}: ${err.message}`), 'access', _173 => _173.join, 'call', _174 => _174("\n")]) || "Unknown validation error";
|
|
8695
|
-
throw new Error(`Draft validation failed for ${objectDef.label}:
|
|
8696
|
-
${errorMessages}`);
|
|
8697
|
-
}
|
|
8698
|
-
return result.data;
|
|
8699
|
-
}
|
|
8700
|
-
function isValuePresent(value) {
|
|
8701
|
-
if (value === void 0 || value === null) {
|
|
8702
|
-
return false;
|
|
8703
|
-
}
|
|
8704
|
-
if (typeof value === "string" && value.trim() === "") {
|
|
8705
|
-
return false;
|
|
8706
|
-
}
|
|
8707
|
-
return true;
|
|
8708
|
-
}
|
|
8709
|
-
function getMissingRequiredAttributes(objectDef, data) {
|
|
8710
|
-
const missing = [];
|
|
8711
|
-
for (const attr of objectDef.attributes) {
|
|
8712
|
-
if (attr.required && !isValuePresent(data[attr.name])) {
|
|
8713
|
-
missing.push(attr);
|
|
8714
|
-
}
|
|
8715
|
-
}
|
|
8716
|
-
return missing;
|
|
8717
|
-
}
|
|
8718
|
-
function isRecordComplete(objectDef, data) {
|
|
8719
|
-
const missing = getMissingRequiredAttributes(objectDef, data);
|
|
8720
|
-
if (missing.length > 0) {
|
|
8721
|
-
return false;
|
|
8722
|
-
}
|
|
8723
|
-
const validation = validateObject(objectDef, data);
|
|
8724
|
-
return validation.success;
|
|
8725
|
-
}
|
|
8726
|
-
function computeRecordStatus(objectDef, data) {
|
|
8727
|
-
return isRecordComplete(objectDef, data) ? "complete" : "draft";
|
|
8728
|
-
}
|
|
8729
|
-
|
|
8730
8142
|
// src/runtime/services/audit/helpers.ts
|
|
8731
8143
|
function buildAuditChanges(oldValues, newValues, fieldsToCheck) {
|
|
8732
8144
|
const changes = [];
|
|
@@ -8747,7 +8159,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
8747
8159
|
constructor(adapter, nativeRegistry, options) {
|
|
8748
8160
|
super(adapter);
|
|
8749
8161
|
this.nativeRegistry = nativeRegistry;
|
|
8750
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
8162
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _165 => _165.auditService]);
|
|
8751
8163
|
}
|
|
8752
8164
|
/**
|
|
8753
8165
|
* Create a new custom object.
|
|
@@ -8960,7 +8372,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
8960
8372
|
resourceType: "attribute",
|
|
8961
8373
|
resourceId: attributeId,
|
|
8962
8374
|
resourceLabel: updatedDbAttr.label,
|
|
8963
|
-
objectName: _optionalChain([dbObject, 'optionalAccess',
|
|
8375
|
+
objectName: _optionalChain([dbObject, 'optionalAccess', _166 => _166.name]),
|
|
8964
8376
|
objectId: dbAttr.objectId,
|
|
8965
8377
|
changes
|
|
8966
8378
|
});
|
|
@@ -8971,7 +8383,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
8971
8383
|
const schema = await this.getObjectSchema(dbAttr.objectId);
|
|
8972
8384
|
await this.adapter.objectRecords.batchRefreshStatus(
|
|
8973
8385
|
dbAttr.objectId,
|
|
8974
|
-
(values) => computeRecordStatus(schema, values)
|
|
8386
|
+
(values) => _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, values)
|
|
8975
8387
|
);
|
|
8976
8388
|
}
|
|
8977
8389
|
return this.convertDBAttributeToAttribute(updatedDbAttr);
|
|
@@ -8993,7 +8405,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
8993
8405
|
);
|
|
8994
8406
|
}
|
|
8995
8407
|
const dbObject = await this.adapter.objects.findById(dbAttr.objectId);
|
|
8996
|
-
if (_optionalChain([dbObject, 'optionalAccess',
|
|
8408
|
+
if (_optionalChain([dbObject, 'optionalAccess', _167 => _167.labelExpression])) {
|
|
8997
8409
|
const usedAttributes = extractAttributeNames(dbObject.labelExpression);
|
|
8998
8410
|
if (usedAttributes.includes(dbAttr.name)) {
|
|
8999
8411
|
throw new AttributeInUseError(dbAttr.name, "labelExpression");
|
|
@@ -9009,7 +8421,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9009
8421
|
resourceType: "attribute",
|
|
9010
8422
|
resourceId: attributeId,
|
|
9011
8423
|
resourceLabel: dbAttr.label,
|
|
9012
|
-
objectName: _optionalChain([dbObject, 'optionalAccess',
|
|
8424
|
+
objectName: _optionalChain([dbObject, 'optionalAccess', _168 => _168.name]),
|
|
9013
8425
|
objectId: dbAttr.objectId
|
|
9014
8426
|
});
|
|
9015
8427
|
}
|
|
@@ -9024,9 +8436,9 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9024
8436
|
async listAttributes(objectId, options) {
|
|
9025
8437
|
const dbAttributes = await this.adapter.attributes.findByObjectId(objectId);
|
|
9026
8438
|
let filtered = dbAttributes;
|
|
9027
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
8439
|
+
if (_optionalChain([options, 'optionalAccess', _169 => _169.systemOnly])) {
|
|
9028
8440
|
filtered = dbAttributes.filter((attr) => attr.system);
|
|
9029
|
-
} else if (_optionalChain([options, 'optionalAccess',
|
|
8441
|
+
} else if (_optionalChain([options, 'optionalAccess', _170 => _170.customOnly])) {
|
|
9030
8442
|
filtered = dbAttributes.filter((attr) => !attr.system);
|
|
9031
8443
|
}
|
|
9032
8444
|
return filtered.map((attr) => this.convertDBAttributeToAttribute(attr));
|
|
@@ -9062,14 +8474,14 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9062
8474
|
pluralLabel: dbObject.pluralLabel,
|
|
9063
8475
|
description: dbObject.description,
|
|
9064
8476
|
labelExpression: dbObject.labelExpression,
|
|
9065
|
-
icon: _optionalChain([dbObject, 'access',
|
|
8477
|
+
icon: _optionalChain([dbObject, 'access', _171 => _171.metadata, 'optionalAccess', _172 => _172.icon])
|
|
9066
8478
|
};
|
|
9067
8479
|
let metadata = dbObject.metadata;
|
|
9068
8480
|
if (updates.icon !== void 0 || updates.metadata !== void 0) {
|
|
9069
8481
|
metadata = {
|
|
9070
8482
|
...dbObject.metadata,
|
|
9071
8483
|
...updates.metadata,
|
|
9072
|
-
icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access',
|
|
8484
|
+
icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _173 => _173.metadata, 'optionalAccess', _174 => _174.icon])))
|
|
9073
8485
|
};
|
|
9074
8486
|
}
|
|
9075
8487
|
const updatedDbObject = await this.adapter.objects.update(objectId, {
|
|
@@ -9349,7 +8761,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9349
8761
|
label: dbObject.label,
|
|
9350
8762
|
pluralLabel: dbObject.pluralLabel,
|
|
9351
8763
|
description: dbObject.description,
|
|
9352
|
-
icon: _optionalChain([dbObject, 'access',
|
|
8764
|
+
icon: _optionalChain([dbObject, 'access', _175 => _175.metadata, 'optionalAccess', _176 => _176.icon]),
|
|
9353
8765
|
labelExpression: dbObject.labelExpression,
|
|
9354
8766
|
attributes,
|
|
9355
8767
|
system: dbObject.system,
|
|
@@ -9383,7 +8795,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9383
8795
|
}
|
|
9384
8796
|
}
|
|
9385
8797
|
try {
|
|
9386
|
-
return parseAttributeConfig(attribute.type, configInput);
|
|
8798
|
+
return _chunkU4AB53AMjs.parseAttributeConfig.call(void 0, attribute.type, configInput);
|
|
9387
8799
|
} catch (error2) {
|
|
9388
8800
|
if (error2 instanceof Error) {
|
|
9389
8801
|
throw new Error(`Invalid config for ${attribute.type} attribute: ${error2.message}`);
|
|
@@ -9449,7 +8861,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9449
8861
|
const hasRelationToTarget = attrs.some((attr) => {
|
|
9450
8862
|
if (attr.type !== "relation") return false;
|
|
9451
8863
|
const config = attr.config;
|
|
9452
|
-
return _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
8864
|
+
return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _177 => _177.targets, 'optionalAccess', _178 => _178.some, 'call', _179 => _179((t) => t.object === targetObjectName)]), () => ( false));
|
|
9453
8865
|
});
|
|
9454
8866
|
if (hasRelationToTarget) {
|
|
9455
8867
|
referencing.push(obj.name);
|
|
@@ -9527,7 +8939,7 @@ Native objects must have system=true. Did you forget to call .system() in your b
|
|
|
9527
8939
|
const existing = this.objects.get(object2.name);
|
|
9528
8940
|
throw new Error(
|
|
9529
8941
|
`[NativeObjectRegistry] Duplicate object name "${object2.name}":
|
|
9530
|
-
- Existing: "${_optionalChain([existing, 'optionalAccess',
|
|
8942
|
+
- Existing: "${_optionalChain([existing, 'optionalAccess', _180 => _180.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _181 => _181.id])})
|
|
9531
8943
|
- New: "${object2.label}" (id: ${object2.id})
|
|
9532
8944
|
Please use unique names for each native object.`
|
|
9533
8945
|
);
|
|
@@ -9644,7 +9056,7 @@ var AuditService = class extends BaseService {
|
|
|
9644
9056
|
this.isFlushing = false;
|
|
9645
9057
|
/** Pending flush promise to allow waiting on concurrent flush */
|
|
9646
9058
|
this.flushPromise = null;
|
|
9647
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9059
|
+
if (_optionalChain([options, 'optionalAccess', _182 => _182.async]) && options.flushIntervalMs) {
|
|
9648
9060
|
this.startFlushTimer();
|
|
9649
9061
|
}
|
|
9650
9062
|
}
|
|
@@ -9841,7 +9253,7 @@ var AuditService = class extends BaseService {
|
|
|
9841
9253
|
if (!this.adapter.audit) {
|
|
9842
9254
|
return;
|
|
9843
9255
|
}
|
|
9844
|
-
if (_optionalChain([this, 'access',
|
|
9256
|
+
if (_optionalChain([this, 'access', _183 => _183.options, 'optionalAccess', _184 => _184.async])) {
|
|
9845
9257
|
this.buffer.push(entry);
|
|
9846
9258
|
const batchSize = _nullishCoalesce(this.options.batchSize, () => ( 10));
|
|
9847
9259
|
if (this.buffer.length >= batchSize) {
|
|
@@ -9855,7 +9267,7 @@ var AuditService = class extends BaseService {
|
|
|
9855
9267
|
* Start the flush timer for async mode
|
|
9856
9268
|
*/
|
|
9857
9269
|
startFlushTimer() {
|
|
9858
|
-
const intervalMs = _nullishCoalesce(_optionalChain([this, 'access',
|
|
9270
|
+
const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _185 => _185.options, 'optionalAccess', _186 => _186.flushIntervalMs]), () => ( 1e3));
|
|
9859
9271
|
this.flushTimer = setInterval(() => {
|
|
9860
9272
|
this.flush().catch(() => {
|
|
9861
9273
|
});
|
|
@@ -9963,7 +9375,7 @@ var UserService = class extends BaseService {
|
|
|
9963
9375
|
if (roleErrors.length > 0) {
|
|
9964
9376
|
errors.push({
|
|
9965
9377
|
attribute: attrName,
|
|
9966
|
-
message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access',
|
|
9378
|
+
message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _187 => _187.allowedRoles, 'optionalAccess', _188 => _188.join, 'call', _189 => _189(", ")])}`,
|
|
9967
9379
|
invalidIds: roleErrors
|
|
9968
9380
|
});
|
|
9969
9381
|
}
|
|
@@ -10238,7 +9650,7 @@ async function preloadSchemas(records, schemaService) {
|
|
|
10238
9650
|
if (records.length === 0) {
|
|
10239
9651
|
return schemasByObjectId;
|
|
10240
9652
|
}
|
|
10241
|
-
const uniqueObjectIds = [...
|
|
9653
|
+
const uniqueObjectIds = [...records.reduce((set, r) => set.add(r.objectId), /* @__PURE__ */ new Set())];
|
|
10242
9654
|
await Promise.all(
|
|
10243
9655
|
uniqueObjectIds.map(async (objId) => {
|
|
10244
9656
|
const schema = await schemaService.getObjectSchema(objId);
|
|
@@ -10285,7 +9697,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
10285
9697
|
super(adapter);
|
|
10286
9698
|
this.schemaService = schemaService;
|
|
10287
9699
|
this.options = options;
|
|
10288
|
-
this.policyRegistry = _optionalChain([options, 'optionalAccess',
|
|
9700
|
+
this.policyRegistry = _optionalChain([options, 'optionalAccess', _190 => _190.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _191 => _191.policyRegistry]), () => ( defaultPolicyRegistry));
|
|
10289
9701
|
}
|
|
10290
9702
|
// ============================================================================
|
|
10291
9703
|
// LIST
|
|
@@ -10335,12 +9747,12 @@ var RecordQueryService = class extends BaseService {
|
|
|
10335
9747
|
* Internal list query execution
|
|
10336
9748
|
*/
|
|
10337
9749
|
async executeListQuery(schema, objectId, options) {
|
|
10338
|
-
if (_optionalChain([this, 'access',
|
|
9750
|
+
if (_optionalChain([this, 'access', _192 => _192.options, 'optionalAccess', _193 => _193.permissionService]) && this.userId) {
|
|
10339
9751
|
await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
|
|
10340
9752
|
}
|
|
10341
|
-
const policy = _optionalChain([options, 'optionalAccess',
|
|
9753
|
+
const policy = _optionalChain([options, 'optionalAccess', _194 => _194.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
|
|
10342
9754
|
let effectiveOptions = options;
|
|
10343
|
-
if (_optionalChain([policy, 'optionalAccess',
|
|
9755
|
+
if (_optionalChain([policy, 'optionalAccess', _195 => _195.applyListFilter]) && this.userId) {
|
|
10344
9756
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
10345
9757
|
effectiveOptions = policy.applyListFilter(ctx, options);
|
|
10346
9758
|
}
|
|
@@ -10350,10 +9762,10 @@ var RecordQueryService = class extends BaseService {
|
|
|
10350
9762
|
);
|
|
10351
9763
|
let filteredRecords = result.records;
|
|
10352
9764
|
let effectiveTotal = result.total;
|
|
10353
|
-
if (_optionalChain([policy, 'optionalAccess',
|
|
9765
|
+
if (_optionalChain([policy, 'optionalAccess', _196 => _196.canAccessRecord]) && this.userId) {
|
|
10354
9766
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
10355
|
-
const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess',
|
|
10356
|
-
const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess',
|
|
9767
|
+
const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _197 => _197.limit]), () => ( 20));
|
|
9768
|
+
const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _198 => _198.offset]), () => ( 0));
|
|
10357
9769
|
const overfetchMultiplier = 5;
|
|
10358
9770
|
const batchSize = requestedLimit * overfetchMultiplier;
|
|
10359
9771
|
const maxScanRecords = 1e4;
|
|
@@ -10375,7 +9787,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
10375
9787
|
exhausted = true;
|
|
10376
9788
|
break;
|
|
10377
9789
|
}
|
|
10378
|
-
const filtered = batch.records.filter((record) => _optionalChain([policy, 'access',
|
|
9790
|
+
const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _199 => _199.canAccessRecord, 'optionalCall', _200 => _200(ctx, record)]));
|
|
10379
9791
|
collected.push(...filtered);
|
|
10380
9792
|
dbOffset += batch.records.length;
|
|
10381
9793
|
totalScanned += batch.records.length;
|
|
@@ -10387,7 +9799,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
10387
9799
|
effectiveTotal = exhausted ? collected.length : Math.max(collected.length, result.total);
|
|
10388
9800
|
filteredRecords = collected.slice(requestedOffset, requestedOffset + requestedLimit);
|
|
10389
9801
|
}
|
|
10390
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
9802
|
+
if (!_optionalChain([options, 'optionalAccess', _201 => _201.skipFormulas])) {
|
|
10391
9803
|
return {
|
|
10392
9804
|
records: enrichRecordsWithFormulas(filteredRecords, schema),
|
|
10393
9805
|
total: effectiveTotal
|
|
@@ -10447,14 +9859,14 @@ var RecordQueryService = class extends BaseService {
|
|
|
10447
9859
|
* Internal search query execution
|
|
10448
9860
|
*/
|
|
10449
9861
|
async executeSearchQuery(schema, objectId, query, options) {
|
|
10450
|
-
if (_optionalChain([this, 'access',
|
|
9862
|
+
if (_optionalChain([this, 'access', _202 => _202.options, 'optionalAccess', _203 => _203.permissionService]) && this.userId) {
|
|
10451
9863
|
await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
|
|
10452
9864
|
}
|
|
10453
9865
|
const result = await runWithSchemaContext(
|
|
10454
9866
|
[schema],
|
|
10455
9867
|
() => this.adapter.objectRecords.search(objectId, query, options)
|
|
10456
9868
|
);
|
|
10457
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
9869
|
+
if (!_optionalChain([options, 'optionalAccess', _204 => _204.skipFormulas])) {
|
|
10458
9870
|
return {
|
|
10459
9871
|
records: enrichRecordsWithFormulas(result.records, schema),
|
|
10460
9872
|
total: result.total
|
|
@@ -10633,7 +10045,7 @@ var RelationService = class extends BaseService {
|
|
|
10633
10045
|
}
|
|
10634
10046
|
const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
|
|
10635
10047
|
const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
|
|
10636
|
-
if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess',
|
|
10048
|
+
if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _205 => _205.size]) === 0) {
|
|
10637
10049
|
errors.push({
|
|
10638
10050
|
attribute: attr.name,
|
|
10639
10051
|
message: `No valid target objects found for ${attr.label}`
|
|
@@ -10686,7 +10098,7 @@ var RelationService = class extends BaseService {
|
|
|
10686
10098
|
for (const target of targets) {
|
|
10687
10099
|
try {
|
|
10688
10100
|
const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
|
|
10689
|
-
if (_optionalChain([objectSchema, 'optionalAccess',
|
|
10101
|
+
if (_optionalChain([objectSchema, 'optionalAccess', _206 => _206.id])) {
|
|
10690
10102
|
objectIds.add(objectSchema.id);
|
|
10691
10103
|
}
|
|
10692
10104
|
} catch (e12) {
|
|
@@ -10755,7 +10167,7 @@ var RelationService = class extends BaseService {
|
|
|
10755
10167
|
const targetResults = await Promise.all(
|
|
10756
10168
|
filteredTargets.map(async (target) => {
|
|
10757
10169
|
const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
|
|
10758
|
-
if (!_optionalChain([objectSchema, 'optionalAccess',
|
|
10170
|
+
if (!_optionalChain([objectSchema, 'optionalAccess', _207 => _207.id])) return { options: [], total: 0 };
|
|
10759
10171
|
const objectId = objectSchema.id;
|
|
10760
10172
|
const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
|
|
10761
10173
|
const options = await Promise.all(
|
|
@@ -10885,8 +10297,10 @@ var RelationService = class extends BaseService {
|
|
|
10885
10297
|
const [attributeId, recordId] = c.split(":");
|
|
10886
10298
|
return { compositeId: c, attributeId, recordId };
|
|
10887
10299
|
});
|
|
10888
|
-
const uniqueRecordIds = [...
|
|
10889
|
-
const uniqueAttributeIds = [
|
|
10300
|
+
const uniqueRecordIds = [...parsed.reduce((set, p) => set.add(p.recordId), /* @__PURE__ */ new Set())];
|
|
10301
|
+
const uniqueAttributeIds = [
|
|
10302
|
+
...parsed.reduce((set, p) => set.add(p.attributeId), /* @__PURE__ */ new Set())
|
|
10303
|
+
];
|
|
10890
10304
|
const records = await this.recordResolver.findByIds(uniqueRecordIds);
|
|
10891
10305
|
if (records.length === 0) {
|
|
10892
10306
|
return [];
|
|
@@ -10895,7 +10309,7 @@ var RelationService = class extends BaseService {
|
|
|
10895
10309
|
const attributePromises = uniqueAttributeIds.map((id) => this.findAttributeById(id));
|
|
10896
10310
|
const attributes = await Promise.all(attributePromises);
|
|
10897
10311
|
const attributeMap = new Map(uniqueAttributeIds.map((id, i) => [id, attributes[i]]));
|
|
10898
|
-
const uniqueObjectIds = [...
|
|
10312
|
+
const uniqueObjectIds = [...records.reduce((set, r) => set.add(r.objectId), /* @__PURE__ */ new Set())];
|
|
10899
10313
|
const schemaPromises = uniqueObjectIds.map((id) => this.schemaService.getObjectSchema(id));
|
|
10900
10314
|
const schemas = await Promise.all(schemaPromises);
|
|
10901
10315
|
const schemaMap = new Map(uniqueObjectIds.map((id, i) => [id, schemas[i]]));
|
|
@@ -10910,8 +10324,8 @@ var RelationService = class extends BaseService {
|
|
|
10910
10324
|
continue;
|
|
10911
10325
|
}
|
|
10912
10326
|
const attribute = attributeMap.get(attributeId);
|
|
10913
|
-
const targetConfig = _optionalChain([attribute, 'optionalAccess',
|
|
10914
|
-
const customTemplate = _optionalChain([targetConfig, 'optionalAccess',
|
|
10327
|
+
const targetConfig = _optionalChain([attribute, 'optionalAccess', _208 => _208.targets, 'optionalAccess', _209 => _209.find, 'call', _210 => _210((t) => t.object === objectSchema.name)]);
|
|
10328
|
+
const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _211 => _211.displayTemplate]);
|
|
10915
10329
|
const label = await this.resolveLabel(record, objectSchema, customTemplate);
|
|
10916
10330
|
resolved.push({
|
|
10917
10331
|
_compositeId: compositeId,
|
|
@@ -11061,14 +10475,14 @@ var RollupService = class extends BaseService {
|
|
|
11061
10475
|
const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
|
|
11062
10476
|
let sourceObjectId;
|
|
11063
10477
|
let reverseRelationAttrName;
|
|
11064
|
-
if (_optionalChain([sourceSchema, 'optionalAccess',
|
|
10478
|
+
if (_optionalChain([sourceSchema, 'optionalAccess', _212 => _212.id])) {
|
|
11065
10479
|
sourceObjectId = sourceSchema.id;
|
|
11066
10480
|
const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
|
|
11067
10481
|
if (attr.type !== "relation") return false;
|
|
11068
10482
|
const relationConfig = attr;
|
|
11069
|
-
return _optionalChain([relationConfig, 'optionalAccess',
|
|
10483
|
+
return _optionalChain([relationConfig, 'optionalAccess', _213 => _213.targets, 'optionalAccess', _214 => _214.some, 'call', _215 => _215((t) => t.object === schema.name)]);
|
|
11070
10484
|
});
|
|
11071
|
-
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess',
|
|
10485
|
+
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _216 => _216.name]);
|
|
11072
10486
|
} else {
|
|
11073
10487
|
const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
|
|
11074
10488
|
if (!sourceObject) {
|
|
@@ -11079,9 +10493,9 @@ var RollupService = class extends BaseService {
|
|
|
11079
10493
|
const reverseRelationAttr = sourceAttributes.find((attr) => {
|
|
11080
10494
|
if (attr.type !== "relation") return false;
|
|
11081
10495
|
const relationConfig = attr.config;
|
|
11082
|
-
return _optionalChain([relationConfig, 'optionalAccess',
|
|
10496
|
+
return _optionalChain([relationConfig, 'optionalAccess', _217 => _217.targets, 'optionalAccess', _218 => _218.some, 'call', _219 => _219((t) => t.object === schema.name)]);
|
|
11083
10497
|
});
|
|
11084
|
-
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess',
|
|
10498
|
+
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _220 => _220.name]);
|
|
11085
10499
|
}
|
|
11086
10500
|
if (!reverseRelationAttrName) {
|
|
11087
10501
|
return { value: null, recordCount: 0 };
|
|
@@ -11148,7 +10562,10 @@ var RollupService = class extends BaseService {
|
|
|
11148
10562
|
return values.filter((v) => v != null && v !== "").length;
|
|
11149
10563
|
case "countUniqueValues": {
|
|
11150
10564
|
const nonEmpty = values.filter((v) => v != null && v !== "");
|
|
11151
|
-
return
|
|
10565
|
+
return nonEmpty.reduce(
|
|
10566
|
+
(set, v) => set.add(JSON.stringify(v)),
|
|
10567
|
+
/* @__PURE__ */ new Set()
|
|
10568
|
+
).size;
|
|
11152
10569
|
}
|
|
11153
10570
|
case "countEmpty":
|
|
11154
10571
|
return values.filter((v) => v == null || v === "").length;
|
|
@@ -11334,13 +10751,13 @@ var RollupService = class extends BaseService {
|
|
|
11334
10751
|
if (!obj) continue;
|
|
11335
10752
|
for (const rollupDbAttr of rollupAttrs) {
|
|
11336
10753
|
const rollupConfig = rollupDbAttr.config;
|
|
11337
|
-
if (!_optionalChain([rollupConfig, 'optionalAccess',
|
|
10754
|
+
if (!_optionalChain([rollupConfig, 'optionalAccess', _221 => _221.relationAttribute])) continue;
|
|
11338
10755
|
const relationAttr = attributes.find(
|
|
11339
10756
|
(a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
|
|
11340
10757
|
);
|
|
11341
10758
|
if (!relationAttr) continue;
|
|
11342
10759
|
const relationConfig = relationAttr.config;
|
|
11343
|
-
const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess',
|
|
10760
|
+
const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _222 => _222.targets, 'optionalAccess', _223 => _223.some, 'call', _224 => _224(
|
|
11344
10761
|
(t) => t.object === changedSchema.name
|
|
11345
10762
|
)]);
|
|
11346
10763
|
if (!targetsChangedObject) continue;
|
|
@@ -11365,11 +10782,11 @@ var RecordService = class extends BaseService {
|
|
|
11365
10782
|
constructor(adapter, options) {
|
|
11366
10783
|
super(adapter);
|
|
11367
10784
|
this.schemaService = new ObjectSchemaService(adapter, registry, {
|
|
11368
|
-
auditService: _optionalChain([options, 'optionalAccess',
|
|
10785
|
+
auditService: _optionalChain([options, 'optionalAccess', _225 => _225.auditService])
|
|
11369
10786
|
});
|
|
11370
|
-
this.permissionService = _optionalChain([options, 'optionalAccess',
|
|
11371
|
-
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11372
|
-
this.policyRegistry = _optionalChain([options, 'optionalAccess',
|
|
10787
|
+
this.permissionService = _optionalChain([options, 'optionalAccess', _226 => _226.permissionService]);
|
|
10788
|
+
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _227 => _227.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
|
|
10789
|
+
this.policyRegistry = _optionalChain([options, 'optionalAccess', _228 => _228.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _229 => _229.policyRegistry]), () => ( defaultPolicyRegistry));
|
|
11373
10790
|
this.recordResolver = new RecordResolverService(adapter);
|
|
11374
10791
|
this.queryService = new RecordQueryService(adapter, this.schemaService, {
|
|
11375
10792
|
permissionService: this.permissionService,
|
|
@@ -11383,7 +10800,7 @@ var RecordService = class extends BaseService {
|
|
|
11383
10800
|
recordResolver: this.recordResolver
|
|
11384
10801
|
});
|
|
11385
10802
|
this.userService = new UserService(adapter);
|
|
11386
|
-
this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
10803
|
+
this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _230 => _230.hookRegistry]), () => ( new NoopHookRegistry()));
|
|
11387
10804
|
this.labelResolver = this.recordResolver.createLabelResolver(this.relationService);
|
|
11388
10805
|
this.rollupContext = this.recordResolver.createRollupContext(
|
|
11389
10806
|
this.rollupService,
|
|
@@ -11418,35 +10835,35 @@ var RecordService = class extends BaseService {
|
|
|
11418
10835
|
schema,
|
|
11419
10836
|
this.tenantId,
|
|
11420
10837
|
dataWithDefaults,
|
|
11421
|
-
_optionalChain([options, 'optionalAccess',
|
|
10838
|
+
_optionalChain([options, 'optionalAccess', _231 => _231.hookMetadata])
|
|
11422
10839
|
);
|
|
11423
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10840
|
+
if (!_optionalChain([options, 'optionalAccess', _232 => _232.skipHooks])) {
|
|
11424
10841
|
await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
|
|
11425
10842
|
}
|
|
11426
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11427
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11428
|
-
validateDraftOrThrow(schema, dataWithDefaults);
|
|
10843
|
+
if (_optionalChain([options, 'optionalAccess', _233 => _233.validate]) !== false) {
|
|
10844
|
+
if (_optionalChain([options, 'optionalAccess', _234 => _234.allowDraft])) {
|
|
10845
|
+
_chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, dataWithDefaults);
|
|
11429
10846
|
} else {
|
|
11430
|
-
validateObjectOrThrow(schema, dataWithDefaults);
|
|
10847
|
+
_chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, dataWithDefaults);
|
|
11431
10848
|
}
|
|
11432
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10849
|
+
if (!_optionalChain([options, 'optionalAccess', _235 => _235.skipRelationValidation])) {
|
|
11433
10850
|
await this.relationService.validateRelationsOrThrow(schema, dataWithDefaults);
|
|
11434
10851
|
}
|
|
11435
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10852
|
+
if (!_optionalChain([options, 'optionalAccess', _236 => _236.skipUserValidation])) {
|
|
11436
10853
|
await this.userService.validateUsersOrThrow(schema, dataWithDefaults);
|
|
11437
10854
|
}
|
|
11438
10855
|
}
|
|
11439
|
-
const completionStatus = computeRecordStatus(schema, dataWithDefaults);
|
|
10856
|
+
const completionStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, dataWithDefaults);
|
|
11440
10857
|
const label = await computeLabel(schema, dataWithDefaults, this.labelResolver);
|
|
11441
10858
|
const record = await this.adapter.objectRecords.create({
|
|
11442
10859
|
objectId,
|
|
11443
10860
|
data: dataWithDefaults,
|
|
11444
10861
|
label,
|
|
11445
10862
|
completionStatus,
|
|
11446
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
10863
|
+
metadata: _optionalChain([options, 'optionalAccess', _237 => _237.metadata]),
|
|
11447
10864
|
createdBy: this.userId
|
|
11448
10865
|
});
|
|
11449
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10866
|
+
if (!_optionalChain([options, 'optionalAccess', _238 => _238.skipHooks])) {
|
|
11450
10867
|
const afterCtx = {
|
|
11451
10868
|
...hookCtx,
|
|
11452
10869
|
recordId: record.id,
|
|
@@ -11464,7 +10881,7 @@ var RecordService = class extends BaseService {
|
|
|
11464
10881
|
objectId: schema.id,
|
|
11465
10882
|
recordId: record.id,
|
|
11466
10883
|
recordLabel: record.label,
|
|
11467
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
10884
|
+
metadata: _optionalChain([options, 'optionalAccess', _239 => _239.hookMetadata])
|
|
11468
10885
|
}).catch((err) => {
|
|
11469
10886
|
console.error(
|
|
11470
10887
|
"Audit log failed (record.created):",
|
|
@@ -11490,7 +10907,7 @@ var RecordService = class extends BaseService {
|
|
|
11490
10907
|
return null;
|
|
11491
10908
|
}
|
|
11492
10909
|
const schema = await this.schemaService.getObjectSchema(record.objectId);
|
|
11493
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10910
|
+
if (!_optionalChain([options, 'optionalAccess', _240 => _240.skipPolicyCheck])) {
|
|
11494
10911
|
const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
|
|
11495
10912
|
if (policy) {
|
|
11496
10913
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
@@ -11500,10 +10917,10 @@ var RecordService = class extends BaseService {
|
|
|
11500
10917
|
}
|
|
11501
10918
|
}
|
|
11502
10919
|
let enrichedRecord = record;
|
|
11503
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10920
|
+
if (!_optionalChain([options, 'optionalAccess', _241 => _241.skipFormulas])) {
|
|
11504
10921
|
enrichedRecord = enrichWithFormulas(record, schema);
|
|
11505
10922
|
}
|
|
11506
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
10923
|
+
if (_optionalChain([options, 'optionalAccess', _242 => _242.includeSchema])) {
|
|
11507
10924
|
const recordWithSchema = enrichedRecord;
|
|
11508
10925
|
recordWithSchema.schema = schema;
|
|
11509
10926
|
return recordWithSchema;
|
|
@@ -11565,9 +10982,9 @@ var RecordService = class extends BaseService {
|
|
|
11565
10982
|
existing,
|
|
11566
10983
|
mergedData,
|
|
11567
10984
|
changedAttributes,
|
|
11568
|
-
_optionalChain([options, 'optionalAccess',
|
|
10985
|
+
_optionalChain([options, 'optionalAccess', _243 => _243.hookMetadata])
|
|
11569
10986
|
);
|
|
11570
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
10987
|
+
if (!_optionalChain([options, 'optionalAccess', _244 => _244.skipHooks])) {
|
|
11571
10988
|
await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
|
|
11572
10989
|
}
|
|
11573
10990
|
const hookModifiedValues = {};
|
|
@@ -11576,26 +10993,26 @@ var RecordService = class extends BaseService {
|
|
|
11576
10993
|
hookModifiedValues[key] = hookCtx.newValues[key];
|
|
11577
10994
|
}
|
|
11578
10995
|
}
|
|
11579
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11580
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11581
|
-
validateDraftOrThrow(schema, mergedData);
|
|
10996
|
+
if (_optionalChain([options, 'optionalAccess', _245 => _245.validate]) !== false) {
|
|
10997
|
+
if (_optionalChain([options, 'optionalAccess', _246 => _246.partial])) {
|
|
10998
|
+
_chunkU4AB53AMjs.validateDraftOrThrow.call(void 0, schema, mergedData);
|
|
11582
10999
|
} else {
|
|
11583
|
-
validateObjectOrThrow(schema, mergedData);
|
|
11000
|
+
_chunkU4AB53AMjs.validateObjectOrThrow.call(void 0, schema, mergedData);
|
|
11584
11001
|
}
|
|
11585
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11002
|
+
if (!_optionalChain([options, 'optionalAccess', _247 => _247.skipRelationValidation])) {
|
|
11586
11003
|
await this.relationService.validateRelationsOrThrow(schema, {
|
|
11587
11004
|
...data,
|
|
11588
11005
|
...hookModifiedValues
|
|
11589
11006
|
});
|
|
11590
11007
|
}
|
|
11591
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11008
|
+
if (!_optionalChain([options, 'optionalAccess', _248 => _248.skipUserValidation])) {
|
|
11592
11009
|
await this.userService.validateUsersOrThrow(schema, {
|
|
11593
11010
|
...data,
|
|
11594
11011
|
...hookModifiedValues
|
|
11595
11012
|
});
|
|
11596
11013
|
}
|
|
11597
11014
|
}
|
|
11598
|
-
const completionStatus = computeRecordStatus(schema, mergedData);
|
|
11015
|
+
const completionStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, mergedData);
|
|
11599
11016
|
const label = await computeLabel(schema, mergedData, this.labelResolver);
|
|
11600
11017
|
const updatePayload = {
|
|
11601
11018
|
...data,
|
|
@@ -11605,7 +11022,7 @@ var RecordService = class extends BaseService {
|
|
|
11605
11022
|
__lastUpdatedBy: this.userId,
|
|
11606
11023
|
__expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
|
|
11607
11024
|
};
|
|
11608
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11025
|
+
if (_optionalChain([options, 'optionalAccess', _249 => _249.metadata]) !== void 0) {
|
|
11609
11026
|
const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
|
|
11610
11027
|
const mergedMetadata = { ...existingMetadata, ...options.metadata };
|
|
11611
11028
|
const cleanedMetadata = Object.fromEntries(
|
|
@@ -11615,7 +11032,7 @@ var RecordService = class extends BaseService {
|
|
|
11615
11032
|
}
|
|
11616
11033
|
const updated = await this.adapter.objectRecords.update(recordId, updatePayload);
|
|
11617
11034
|
await this.invalidateRecordCaches(recordId, existing.objectId);
|
|
11618
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11035
|
+
if (!_optionalChain([options, 'optionalAccess', _250 => _250.skipHooks])) {
|
|
11619
11036
|
const afterCtx = {
|
|
11620
11037
|
...hookCtx,
|
|
11621
11038
|
record: updated
|
|
@@ -11630,7 +11047,7 @@ var RecordService = class extends BaseService {
|
|
|
11630
11047
|
if (this.auditService && this.userId && allChangedAttributes.length > 0) {
|
|
11631
11048
|
const changes = allChangedAttributes.map((attr) => ({
|
|
11632
11049
|
field: attr,
|
|
11633
|
-
oldValue: _optionalChain([hookCtx, 'access',
|
|
11050
|
+
oldValue: _optionalChain([hookCtx, 'access', _251 => _251.oldValues, 'optionalAccess', _252 => _252[attr]]),
|
|
11634
11051
|
newValue: hookCtx.newValues[attr]
|
|
11635
11052
|
}));
|
|
11636
11053
|
this.auditService.logRecordAction({
|
|
@@ -11641,7 +11058,7 @@ var RecordService = class extends BaseService {
|
|
|
11641
11058
|
recordId: updated.id,
|
|
11642
11059
|
recordLabel: updated.label,
|
|
11643
11060
|
changes,
|
|
11644
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
11061
|
+
metadata: _optionalChain([options, 'optionalAccess', _253 => _253.hookMetadata])
|
|
11645
11062
|
}).catch((err) => {
|
|
11646
11063
|
console.error(
|
|
11647
11064
|
"Audit log failed (record.updated):",
|
|
@@ -11676,22 +11093,22 @@ var RecordService = class extends BaseService {
|
|
|
11676
11093
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
11677
11094
|
checkRecordDeleteOrThrow(policy, record, ctx);
|
|
11678
11095
|
}
|
|
11679
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11096
|
+
if (_optionalChain([options, 'optionalAccess', _254 => _254.checkSystem]) && schema.system) {
|
|
11680
11097
|
throw new ProtectedResourceError("object", schema.name, "delete");
|
|
11681
11098
|
}
|
|
11682
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11099
|
+
if (!_optionalChain([options, 'optionalAccess', _255 => _255.skipReferenceCheck])) {
|
|
11683
11100
|
const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
|
|
11684
11101
|
if (references.length > 0) {
|
|
11685
11102
|
throw new RecordReferencedError(recordId, references);
|
|
11686
11103
|
}
|
|
11687
11104
|
}
|
|
11688
|
-
const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess',
|
|
11689
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11105
|
+
const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _256 => _256.hookMetadata]));
|
|
11106
|
+
if (!_optionalChain([options, 'optionalAccess', _257 => _257.skipHooks])) {
|
|
11690
11107
|
await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
|
|
11691
11108
|
}
|
|
11692
11109
|
await this.adapter.objectRecords.delete(recordId);
|
|
11693
11110
|
await this.invalidateRecordCaches(recordId, record.objectId);
|
|
11694
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11111
|
+
if (!_optionalChain([options, 'optionalAccess', _258 => _258.skipHooks])) {
|
|
11695
11112
|
await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
|
|
11696
11113
|
}
|
|
11697
11114
|
await recalculateParentRollups(record, schema, this.rollupContext);
|
|
@@ -11703,7 +11120,7 @@ var RecordService = class extends BaseService {
|
|
|
11703
11120
|
objectId: schema.id,
|
|
11704
11121
|
recordId: record.id,
|
|
11705
11122
|
recordLabel: record.label,
|
|
11706
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
11123
|
+
metadata: _optionalChain([options, 'optionalAccess', _259 => _259.hookMetadata])
|
|
11707
11124
|
}).catch((err) => {
|
|
11708
11125
|
console.error(
|
|
11709
11126
|
"Audit log failed (record.deleted):",
|
|
@@ -11746,13 +11163,13 @@ var RecordService = class extends BaseService {
|
|
|
11746
11163
|
this.tenantId
|
|
11747
11164
|
);
|
|
11748
11165
|
await checkPermission(this.permissionService, this.userId, schema.name, "update");
|
|
11749
|
-
const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess',
|
|
11750
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11166
|
+
const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _260 => _260.hookMetadata]));
|
|
11167
|
+
if (!_optionalChain([options, 'optionalAccess', _261 => _261.skipHooks])) {
|
|
11751
11168
|
await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
|
|
11752
11169
|
}
|
|
11753
11170
|
const restored = await this.adapter.objectRecords.restore(recordId);
|
|
11754
11171
|
await this.invalidateRecordCaches(recordId, record.objectId);
|
|
11755
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11172
|
+
if (!_optionalChain([options, 'optionalAccess', _262 => _262.skipHooks])) {
|
|
11756
11173
|
const afterCtx = {
|
|
11757
11174
|
...hookCtx,
|
|
11758
11175
|
record: restored
|
|
@@ -11767,7 +11184,7 @@ var RecordService = class extends BaseService {
|
|
|
11767
11184
|
objectId: schema.id,
|
|
11768
11185
|
recordId: restored.id,
|
|
11769
11186
|
recordLabel: restored.label,
|
|
11770
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
11187
|
+
metadata: _optionalChain([options, 'optionalAccess', _263 => _263.hookMetadata])
|
|
11771
11188
|
}).catch((err) => {
|
|
11772
11189
|
console.error(
|
|
11773
11190
|
"Audit log failed (record.restored):",
|
|
@@ -11816,14 +11233,14 @@ var RecordService = class extends BaseService {
|
|
|
11816
11233
|
*/
|
|
11817
11234
|
async validateData(objectId, data) {
|
|
11818
11235
|
const schema = await this.schemaService.getObjectSchema(objectId);
|
|
11819
|
-
return validateObject(schema, data);
|
|
11236
|
+
return _chunkU4AB53AMjs.validateObject.call(void 0, schema, data);
|
|
11820
11237
|
}
|
|
11821
11238
|
/**
|
|
11822
11239
|
* Compute the completion status for given data without saving
|
|
11823
11240
|
*/
|
|
11824
11241
|
async computeStatus(objectId, data) {
|
|
11825
11242
|
const schema = await this.schemaService.getObjectSchema(objectId);
|
|
11826
|
-
return computeRecordStatus(schema, data);
|
|
11243
|
+
return _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, data);
|
|
11827
11244
|
}
|
|
11828
11245
|
/**
|
|
11829
11246
|
* Refresh the completion status of an existing record
|
|
@@ -11831,7 +11248,7 @@ var RecordService = class extends BaseService {
|
|
|
11831
11248
|
async refreshRecordStatus(recordId) {
|
|
11832
11249
|
const record = await this.getRecordOrThrow(recordId);
|
|
11833
11250
|
const schema = await this.schemaService.getObjectSchema(record.objectId);
|
|
11834
|
-
const newStatus = computeRecordStatus(schema, record.values);
|
|
11251
|
+
const newStatus = _chunkU4AB53AMjs.computeRecordStatus.call(void 0, schema, record.values);
|
|
11835
11252
|
if (record.completionStatus !== newStatus) {
|
|
11836
11253
|
await this.adapter.objectRecords.update(recordId, {
|
|
11837
11254
|
__completionStatus: newStatus
|
|
@@ -12148,7 +11565,7 @@ var DocumentRendererService = class {
|
|
|
12148
11565
|
throw new StorageDownloadNotSupportedError();
|
|
12149
11566
|
}
|
|
12150
11567
|
let storagePath = fileId;
|
|
12151
|
-
if (_optionalChain([this, 'access',
|
|
11568
|
+
if (_optionalChain([this, 'access', _264 => _264.options, 'optionalAccess', _265 => _265.filesRepository])) {
|
|
12152
11569
|
const file2 = await this.options.filesRepository.findById(fileId);
|
|
12153
11570
|
if (!file2) {
|
|
12154
11571
|
throw new Error(`Template file not found: ${fileId}`);
|
|
@@ -12166,8 +11583,8 @@ var DocumentRendererService = class {
|
|
|
12166
11583
|
for (const field of fields) {
|
|
12167
11584
|
const rawValue = getContextValue(context, field.contextPath);
|
|
12168
11585
|
const attrInfo = await this.getAttributeInfo(field.contextPath, workflow2);
|
|
12169
|
-
if (_optionalChain([attrInfo, 'optionalAccess',
|
|
12170
|
-
if (attrInfo.attribute.type === "relation" && rawValue && _optionalChain([this, 'access',
|
|
11586
|
+
if (_optionalChain([attrInfo, 'optionalAccess', _266 => _266.attribute])) {
|
|
11587
|
+
if (attrInfo.attribute.type === "relation" && rawValue && _optionalChain([this, 'access', _267 => _267.options, 'optionalAccess', _268 => _268.relationService])) {
|
|
12171
11588
|
const ids = Array.isArray(rawValue) ? rawValue : [rawValue];
|
|
12172
11589
|
const stringIds = ids.filter((id) => typeof id === "string");
|
|
12173
11590
|
if (stringIds.length > 0) {
|
|
@@ -12188,7 +11605,7 @@ var DocumentRendererService = class {
|
|
|
12188
11605
|
resolved.set(field.id, this.formatValueSimple(rawValue, field.fallback));
|
|
12189
11606
|
}
|
|
12190
11607
|
}
|
|
12191
|
-
if (relationBatch.length > 0 && _optionalChain([this, 'access',
|
|
11608
|
+
if (relationBatch.length > 0 && _optionalChain([this, 'access', _269 => _269.options, 'optionalAccess', _270 => _270.relationService])) {
|
|
12192
11609
|
try {
|
|
12193
11610
|
const batchResult = await this.options.relationService.resolveIdsBatch(
|
|
12194
11611
|
relationBatch.map((r) => ({ attributeId: r.attributeId, ids: r.ids }))
|
|
@@ -12197,12 +11614,12 @@ var DocumentRendererService = class {
|
|
|
12197
11614
|
const options = _nullishCoalesce(batchResult[attributeId], () => ( []));
|
|
12198
11615
|
const labels = options.map((o) => o.label);
|
|
12199
11616
|
const field = fields.find((f) => f.id === fieldId);
|
|
12200
|
-
resolved.set(fieldId, labels.join(", ") || _optionalChain([field, 'optionalAccess',
|
|
11617
|
+
resolved.set(fieldId, labels.join(", ") || _optionalChain([field, 'optionalAccess', _271 => _271.fallback]) || "");
|
|
12201
11618
|
}
|
|
12202
11619
|
} catch (e14) {
|
|
12203
11620
|
for (const { fieldId, ids } of relationBatch) {
|
|
12204
11621
|
const field = fields.find((f) => f.id === fieldId);
|
|
12205
|
-
resolved.set(fieldId, ids.join(", ") || _optionalChain([field, 'optionalAccess',
|
|
11622
|
+
resolved.set(fieldId, ids.join(", ") || _optionalChain([field, 'optionalAccess', _272 => _272.fallback]) || "");
|
|
12206
11623
|
}
|
|
12207
11624
|
}
|
|
12208
11625
|
}
|
|
@@ -12213,7 +11630,7 @@ var DocumentRendererService = class {
|
|
|
12213
11630
|
* Parses paths like "slots.client.firstName" to find the attribute definition
|
|
12214
11631
|
*/
|
|
12215
11632
|
async getAttributeInfo(contextPath, workflow2) {
|
|
12216
|
-
const schemaService = _optionalChain([this, 'access',
|
|
11633
|
+
const schemaService = _optionalChain([this, 'access', _273 => _273.options, 'optionalAccess', _274 => _274.schemaService]);
|
|
12217
11634
|
if (!schemaService) {
|
|
12218
11635
|
return null;
|
|
12219
11636
|
}
|
|
@@ -12226,7 +11643,7 @@ var DocumentRendererService = class {
|
|
|
12226
11643
|
}
|
|
12227
11644
|
const slotId = parts[1];
|
|
12228
11645
|
const attributeName = parts[2];
|
|
12229
|
-
const slot = _optionalChain([workflow2, 'access',
|
|
11646
|
+
const slot = _optionalChain([workflow2, 'access', _275 => _275.slots, 'optionalAccess', _276 => _276.find, 'call', _277 => _277((s) => s.id === slotId)]);
|
|
12230
11647
|
if (!slot) {
|
|
12231
11648
|
return null;
|
|
12232
11649
|
}
|
|
@@ -12425,7 +11842,7 @@ var DocumentProcessingHook = class extends BaseService {
|
|
|
12425
11842
|
const pendingIds = [];
|
|
12426
11843
|
for (const [nodeId, doc] of Object.entries(context.documents)) {
|
|
12427
11844
|
const metadata = doc.metadata;
|
|
12428
|
-
if (_optionalChain([metadata, 'optionalAccess',
|
|
11845
|
+
if (_optionalChain([metadata, 'optionalAccess', _278 => _278.status]) === "pending") {
|
|
12429
11846
|
pendingIds.push(nodeId);
|
|
12430
11847
|
}
|
|
12431
11848
|
}
|
|
@@ -12476,12 +11893,12 @@ var DocumentProcessingHook = class extends BaseService {
|
|
|
12476
11893
|
}
|
|
12477
11894
|
for (const slotId of targetSlotIds) {
|
|
12478
11895
|
try {
|
|
12479
|
-
const recordId = _optionalChain([context, 'access',
|
|
11896
|
+
const recordId = _optionalChain([context, 'access', _279 => _279.createdRecordIds, 'optionalAccess', _280 => _280[slotId]]);
|
|
12480
11897
|
if (!recordId) {
|
|
12481
11898
|
continue;
|
|
12482
11899
|
}
|
|
12483
|
-
const slotDef = _optionalChain([workflow2, 'access',
|
|
12484
|
-
const objectName = _optionalChain([slotDef, 'optionalAccess',
|
|
11900
|
+
const slotDef = _optionalChain([workflow2, 'access', _281 => _281.slots, 'optionalAccess', _282 => _282.find, 'call', _283 => _283((s) => s.id === slotId)]);
|
|
11901
|
+
const objectName = _optionalChain([slotDef, 'optionalAccess', _284 => _284.objectName]);
|
|
12485
11902
|
if (!objectName) {
|
|
12486
11903
|
continue;
|
|
12487
11904
|
}
|
|
@@ -12498,7 +11915,7 @@ var DocumentProcessingHook = class extends BaseService {
|
|
|
12498
11915
|
attachedDocumentIds.push(result.document.id);
|
|
12499
11916
|
const record = await recordService.getRecord(recordId);
|
|
12500
11917
|
if (record) {
|
|
12501
|
-
const attachments = _nullishCoalesce(_optionalChain([record, 'access',
|
|
11918
|
+
const attachments = _nullishCoalesce(_optionalChain([record, 'access', _285 => _285.values, 'optionalAccess', _286 => _286.attachments]), () => ( []));
|
|
12502
11919
|
await recordService.updateRecord(
|
|
12503
11920
|
recordId,
|
|
12504
11921
|
{ attachments: [...attachments, result.document.id] },
|
|
@@ -12764,7 +12181,7 @@ var WorkflowAccessGrantService = class extends BaseService {
|
|
|
12764
12181
|
* Check if a specific token has been revoked.
|
|
12765
12182
|
*/
|
|
12766
12183
|
isTokenRevoked(dbGrant, jti) {
|
|
12767
|
-
return _nullishCoalesce(_optionalChain([dbGrant, 'access',
|
|
12184
|
+
return _nullishCoalesce(_optionalChain([dbGrant, 'access', _287 => _287.revoked_token_jtis, 'optionalAccess', _288 => _288.includes, 'call', _289 => _289(jti)]), () => ( false));
|
|
12768
12185
|
}
|
|
12769
12186
|
/**
|
|
12770
12187
|
* Validate access token payload against the grant.
|
|
@@ -12816,10 +12233,10 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
12816
12233
|
constructor(adapter, workflowService, options) {
|
|
12817
12234
|
super(adapter);
|
|
12818
12235
|
this.workflowService = workflowService;
|
|
12819
|
-
this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12820
|
-
this.schemaService = _optionalChain([options, 'optionalAccess',
|
|
12821
|
-
this.recordService = _optionalChain([options, 'optionalAccess',
|
|
12822
|
-
this.documentProcessingHook = _optionalChain([options, 'optionalAccess',
|
|
12236
|
+
this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _290 => _290.executorRegistry]), () => ( getDefaultExecutorRegistry()));
|
|
12237
|
+
this.schemaService = _optionalChain([options, 'optionalAccess', _291 => _291.schemaService]);
|
|
12238
|
+
this.recordService = _optionalChain([options, 'optionalAccess', _292 => _292.recordService]);
|
|
12239
|
+
this.documentProcessingHook = _optionalChain([options, 'optionalAccess', _293 => _293.documentProcessingHook]);
|
|
12823
12240
|
}
|
|
12824
12241
|
/**
|
|
12825
12242
|
* Start a new workflow instance
|
|
@@ -12848,8 +12265,8 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
12848
12265
|
context.variables = input.variables;
|
|
12849
12266
|
}
|
|
12850
12267
|
const instance = {
|
|
12851
|
-
id: generateId(),
|
|
12852
|
-
workflowId: _nullishCoalesce(workflow2.id, () => ( generateId())),
|
|
12268
|
+
id: _chunkNEVERCM3js.generateId.call(void 0, ),
|
|
12269
|
+
workflowId: _nullishCoalesce(workflow2.id, () => ( _chunkNEVERCM3js.generateId.call(void 0, ))),
|
|
12853
12270
|
workflowVersion: workflow2.version,
|
|
12854
12271
|
workflowSnapshot: workflow2,
|
|
12855
12272
|
status: "running",
|
|
@@ -13001,7 +12418,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13001
12418
|
if (!this.adapter.workflowInstances) {
|
|
13002
12419
|
return { instances: [], total: 0 };
|
|
13003
12420
|
}
|
|
13004
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12421
|
+
if (_optionalChain([options, 'optionalAccess', _294 => _294.workflowName])) {
|
|
13005
12422
|
const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
|
|
13006
12423
|
options.workflowName,
|
|
13007
12424
|
{ status: options.status }
|
|
@@ -13015,11 +12432,11 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13015
12432
|
return { instances: instances2, total: total2 };
|
|
13016
12433
|
}
|
|
13017
12434
|
const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
|
|
13018
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
13019
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
12435
|
+
limit: _optionalChain([options, 'optionalAccess', _295 => _295.limit]),
|
|
12436
|
+
offset: _optionalChain([options, 'optionalAccess', _296 => _296.offset])
|
|
13020
12437
|
});
|
|
13021
12438
|
let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
|
|
13022
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12439
|
+
if (_optionalChain([options, 'optionalAccess', _297 => _297.status])) {
|
|
13023
12440
|
instances = instances.filter((i) => i.status === options.status);
|
|
13024
12441
|
}
|
|
13025
12442
|
instances = await this.markExpiredInstances(instances);
|
|
@@ -13040,9 +12457,9 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13040
12457
|
return { instances: [], total: 0 };
|
|
13041
12458
|
}
|
|
13042
12459
|
const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
|
|
13043
|
-
status: _optionalChain([options, 'optionalAccess',
|
|
13044
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
13045
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
12460
|
+
status: _optionalChain([options, 'optionalAccess', _298 => _298.status]),
|
|
12461
|
+
limit: _optionalChain([options, 'optionalAccess', _299 => _299.limit]),
|
|
12462
|
+
offset: _optionalChain([options, 'optionalAccess', _300 => _300.offset])
|
|
13046
12463
|
});
|
|
13047
12464
|
const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
|
|
13048
12465
|
return { instances, total };
|
|
@@ -13077,7 +12494,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13077
12494
|
updatedAt: /* @__PURE__ */ new Date()
|
|
13078
12495
|
};
|
|
13079
12496
|
}
|
|
13080
|
-
const executionId = generateId();
|
|
12497
|
+
const executionId = _chunkNEVERCM3js.generateId.call(void 0, );
|
|
13081
12498
|
let current = {
|
|
13082
12499
|
...instance,
|
|
13083
12500
|
context: {
|
|
@@ -13108,7 +12525,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13108
12525
|
try {
|
|
13109
12526
|
const schemas = await Promise.all(
|
|
13110
12527
|
current.workflowSnapshot.slots.map(
|
|
13111
|
-
(slot) => _optionalChain([this, 'access',
|
|
12528
|
+
(slot) => _optionalChain([this, 'access', _301 => _301.schemaService, 'optionalAccess', _302 => _302.getObjectSchemaByName, 'call', _303 => _303(slot.objectName)])
|
|
13112
12529
|
)
|
|
13113
12530
|
);
|
|
13114
12531
|
objectDefinitions = schemas.filter(
|
|
@@ -13373,8 +12790,8 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13373
12790
|
*/
|
|
13374
12791
|
async snapshotRecord(recordId) {
|
|
13375
12792
|
try {
|
|
13376
|
-
const record = await _optionalChain([this, 'access',
|
|
13377
|
-
return _optionalChain([record, 'optionalAccess',
|
|
12793
|
+
const record = await _optionalChain([this, 'access', _304 => _304.recordService, 'optionalAccess', _305 => _305.getRecord, 'call', _306 => _306(recordId, { skipPolicyCheck: true })]);
|
|
12794
|
+
return _optionalChain([record, 'optionalAccess', _307 => _307.values]);
|
|
13378
12795
|
} catch (e18) {
|
|
13379
12796
|
return void 0;
|
|
13380
12797
|
}
|
|
@@ -13393,13 +12810,13 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13393
12810
|
for (const op of [...operations].reverse()) {
|
|
13394
12811
|
try {
|
|
13395
12812
|
if (op.operation === "create") {
|
|
13396
|
-
await _optionalChain([this, 'access',
|
|
12813
|
+
await _optionalChain([this, 'access', _308 => _308.recordService, 'optionalAccess', _309 => _309.deleteRecord, 'call', _310 => _310(op.recordId, {
|
|
13397
12814
|
skipHooks: true,
|
|
13398
12815
|
skipReferenceCheck: true
|
|
13399
12816
|
})]);
|
|
13400
12817
|
rolledBack.push(op.slotId);
|
|
13401
12818
|
} else if (op.operation === "update" && op.previousData) {
|
|
13402
|
-
await _optionalChain([this, 'access',
|
|
12819
|
+
await _optionalChain([this, 'access', _311 => _311.recordService, 'optionalAccess', _312 => _312.updateRecord, 'call', _313 => _313(op.recordId, op.previousData, {
|
|
13403
12820
|
partial: false
|
|
13404
12821
|
})]);
|
|
13405
12822
|
rolledBack.push(op.slotId);
|
|
@@ -13523,7 +12940,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13523
12940
|
if (!this.adapter.workflowInstances) {
|
|
13524
12941
|
return;
|
|
13525
12942
|
}
|
|
13526
|
-
const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access',
|
|
12943
|
+
const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _314 => _314.context, 'access', _315 => _315.variables, 'optionalAccess', _316 => _316.__version]), () => ( 0));
|
|
13527
12944
|
const nextVersion = currentVersion + 1;
|
|
13528
12945
|
const instanceWithVersion = {
|
|
13529
12946
|
...instance,
|
|
@@ -13804,7 +13221,7 @@ var WorkflowRelationService = class extends BaseService {
|
|
|
13804
13221
|
if (attr.type !== "relation") continue;
|
|
13805
13222
|
for (const slot of slots) {
|
|
13806
13223
|
const slotData = context.slots[slot.id];
|
|
13807
|
-
const slotRecordId = _optionalChain([slotData, 'optionalAccess',
|
|
13224
|
+
const slotRecordId = _optionalChain([slotData, 'optionalAccess', _317 => _317.id]);
|
|
13808
13225
|
if (!slotRecordId) continue;
|
|
13809
13226
|
const targetsSlotObject = attr.targets.some(
|
|
13810
13227
|
(t) => t.object === slot.objectName
|
|
@@ -13872,7 +13289,7 @@ var WorkflowService = class extends BaseService {
|
|
|
13872
13289
|
if (Array.isArray(options)) {
|
|
13873
13290
|
this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
|
|
13874
13291
|
} else {
|
|
13875
|
-
this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13292
|
+
this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _318 => _318.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
|
|
13876
13293
|
}
|
|
13877
13294
|
}
|
|
13878
13295
|
// ============================================================================
|
|
@@ -13987,7 +13404,7 @@ var WorkflowService = class extends BaseService {
|
|
|
13987
13404
|
};
|
|
13988
13405
|
const validationResult = WorkflowDefinitionSchema.safeParse(definition);
|
|
13989
13406
|
if (!validationResult.success) {
|
|
13990
|
-
const errors = validationResult.error.
|
|
13407
|
+
const errors = _chunkU4AB53AMjs.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
|
|
13991
13408
|
throw new SchemaError(
|
|
13992
13409
|
`Invalid workflow definition: ${errors.join(", ")}`,
|
|
13993
13410
|
SchemaErrorCode.VALIDATION_FAILED
|
|
@@ -14029,7 +13446,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14029
13446
|
};
|
|
14030
13447
|
const validationResult = WorkflowDefinitionSchema.safeParse(updated);
|
|
14031
13448
|
if (!validationResult.success) {
|
|
14032
|
-
const errors = validationResult.error.
|
|
13449
|
+
const errors = _chunkU4AB53AMjs.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
|
|
14033
13450
|
throw new SchemaError(
|
|
14034
13451
|
`Invalid workflow definition: ${errors.join(", ")}`,
|
|
14035
13452
|
SchemaErrorCode.VALIDATION_FAILED
|
|
@@ -14058,7 +13475,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14058
13475
|
}
|
|
14059
13476
|
const validationResult = WorkflowDefinitionSchema.safeParse(existing);
|
|
14060
13477
|
if (!validationResult.success) {
|
|
14061
|
-
const errors = validationResult.error.
|
|
13478
|
+
const errors = _chunkU4AB53AMjs.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
|
|
14062
13479
|
throw new SchemaError(
|
|
14063
13480
|
`Cannot publish invalid workflow: ${errors.join(", ")}`,
|
|
14064
13481
|
SchemaErrorCode.VALIDATION_FAILED
|
|
@@ -14170,7 +13587,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14170
13587
|
var UserProfileService = class extends BaseService {
|
|
14171
13588
|
constructor(adapter, options) {
|
|
14172
13589
|
super(adapter);
|
|
14173
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
13590
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _319 => _319.auditService]);
|
|
14174
13591
|
}
|
|
14175
13592
|
// ============================================================================
|
|
14176
13593
|
// CACHE MANAGEMENT
|
|
@@ -14333,7 +13750,7 @@ var UserProfileService = class extends BaseService {
|
|
|
14333
13750
|
*/
|
|
14334
13751
|
async deleteProfile(profileId, options) {
|
|
14335
13752
|
const profile = await this.getProfileOrThrow(profileId);
|
|
14336
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13753
|
+
if (_optionalChain([options, 'optionalAccess', _320 => _320.checkAdmin])) {
|
|
14337
13754
|
if (profile.role === "admin") {
|
|
14338
13755
|
const adminCount = await this.adapter.userProfiles.countByRole("admin");
|
|
14339
13756
|
if (adminCount <= 1) {
|
|
@@ -14408,7 +13825,7 @@ var UserProfileService = class extends BaseService {
|
|
|
14408
13825
|
*/
|
|
14409
13826
|
async hasRole(profileId, role) {
|
|
14410
13827
|
const profile = await this.getProfile(profileId);
|
|
14411
|
-
return _optionalChain([profile, 'optionalAccess',
|
|
13828
|
+
return _optionalChain([profile, 'optionalAccess', _321 => _321.role]) === role;
|
|
14412
13829
|
}
|
|
14413
13830
|
/**
|
|
14414
13831
|
* Check if user is admin
|
|
@@ -14842,7 +14259,7 @@ var DocumentTemplateService = class extends BaseService {
|
|
|
14842
14259
|
* Includes both system templates and tenant-specific templates.
|
|
14843
14260
|
*/
|
|
14844
14261
|
async listTemplates(options) {
|
|
14845
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
14262
|
+
if (_optionalChain([options, 'optionalAccess', _322 => _322.systemOnly])) {
|
|
14846
14263
|
return SYSTEM_TEMPLATES;
|
|
14847
14264
|
}
|
|
14848
14265
|
const templates = [...SYSTEM_TEMPLATES];
|
|
@@ -14925,8 +14342,8 @@ var DocumentTemplateService = class extends BaseService {
|
|
|
14925
14342
|
var DocumentService = class extends BaseService {
|
|
14926
14343
|
constructor(adapter, options) {
|
|
14927
14344
|
super(adapter);
|
|
14928
|
-
this.templateService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
14929
|
-
this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
14345
|
+
this.templateService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _323 => _323.templateService]), () => ( new DocumentTemplateService(adapter)));
|
|
14346
|
+
this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _324 => _324.fileService]), () => ( null));
|
|
14930
14347
|
}
|
|
14931
14348
|
// ============================================================================
|
|
14932
14349
|
// CREATE
|
|
@@ -15143,7 +14560,7 @@ var DocumentService = class extends BaseService {
|
|
|
15143
14560
|
const template = await this.templateService.getTemplateOrThrow(document2.templateId);
|
|
15144
14561
|
const slots = await this.getSlots(documentId);
|
|
15145
14562
|
const requiredSlots = template.slots.filter((s) => s.required);
|
|
15146
|
-
const filledSlotNames =
|
|
14563
|
+
const filledSlotNames = slots.reduce((set, s) => set.add(s.slotName), /* @__PURE__ */ new Set());
|
|
15147
14564
|
const allRequiredFilled = requiredSlots.every((s) => filledSlotNames.has(s.name));
|
|
15148
14565
|
if (!allRequiredFilled) {
|
|
15149
14566
|
return await this.updateStatus(documentId, "draft");
|
|
@@ -15177,7 +14594,7 @@ var DocumentService = class extends BaseService {
|
|
|
15177
14594
|
*/
|
|
15178
14595
|
async isComplete(documentId) {
|
|
15179
14596
|
const document2 = await this.getDocument(documentId);
|
|
15180
|
-
return _optionalChain([document2, 'optionalAccess',
|
|
14597
|
+
return _optionalChain([document2, 'optionalAccess', _325 => _325.status]) !== "draft";
|
|
15181
14598
|
}
|
|
15182
14599
|
/**
|
|
15183
14600
|
* Get document with its template and slots.
|
|
@@ -15435,7 +14852,7 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15435
14852
|
type: "signature",
|
|
15436
14853
|
provider: this.config.signatureAdapter.name,
|
|
15437
14854
|
input: { signers, ...options },
|
|
15438
|
-
expiresAt: _optionalChain([options, 'optionalAccess',
|
|
14855
|
+
expiresAt: _optionalChain([options, 'optionalAccess', _326 => _326.expiresAt])
|
|
15439
14856
|
});
|
|
15440
14857
|
return job;
|
|
15441
14858
|
}
|
|
@@ -15592,7 +15009,7 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15592
15009
|
}
|
|
15593
15010
|
const document2 = await this.documentService.getDocumentOrThrow(documentId);
|
|
15594
15011
|
const template = await this.templateService.getTemplateOrThrow(document2.templateId);
|
|
15595
|
-
if (!_optionalChain([template, 'access',
|
|
15012
|
+
if (!_optionalChain([template, 'access', _327 => _327.autoProcessing, 'optionalAccess', _328 => _328.identityVerification, 'optionalAccess', _329 => _329.enabled])) {
|
|
15596
15013
|
throw new Error("Identity verification is not enabled for this document type");
|
|
15597
15014
|
}
|
|
15598
15015
|
const job = await this.adapter.documentJobs.create({
|
|
@@ -15678,13 +15095,13 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15678
15095
|
const template = await this.templateService.getTemplateOrThrow(document2.templateId);
|
|
15679
15096
|
const slots = await this.documentService.getSlots(documentId);
|
|
15680
15097
|
const jobs = [];
|
|
15681
|
-
if (_optionalChain([template, 'access',
|
|
15098
|
+
if (_optionalChain([template, 'access', _330 => _330.autoProcessing, 'optionalAccess', _331 => _331.ocr, 'optionalAccess', _332 => _332.enabled]) && this.config.ocrAdapter) {
|
|
15682
15099
|
for (const slot of slots) {
|
|
15683
15100
|
const job = await this.processOcr(documentId, slot.slotName);
|
|
15684
15101
|
jobs.push(job);
|
|
15685
15102
|
}
|
|
15686
15103
|
}
|
|
15687
|
-
if (_optionalChain([template, 'access',
|
|
15104
|
+
if (_optionalChain([template, 'access', _333 => _333.autoProcessing, 'optionalAccess', _334 => _334.identityVerification, 'optionalAccess', _335 => _335.enabled]) && this.config.identityAdapter) {
|
|
15688
15105
|
const job = await this.verifyIdentity(documentId);
|
|
15689
15106
|
jobs.push(job);
|
|
15690
15107
|
}
|
|
@@ -15755,15 +15172,15 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15755
15172
|
return {
|
|
15756
15173
|
ocr: {
|
|
15757
15174
|
available: !!this.config.ocrAdapter,
|
|
15758
|
-
provider: _optionalChain([this, 'access',
|
|
15175
|
+
provider: _optionalChain([this, 'access', _336 => _336.config, 'access', _337 => _337.ocrAdapter, 'optionalAccess', _338 => _338.name])
|
|
15759
15176
|
},
|
|
15760
15177
|
signature: {
|
|
15761
15178
|
available: !!this.config.signatureAdapter,
|
|
15762
|
-
provider: _optionalChain([this, 'access',
|
|
15179
|
+
provider: _optionalChain([this, 'access', _339 => _339.config, 'access', _340 => _340.signatureAdapter, 'optionalAccess', _341 => _341.name])
|
|
15763
15180
|
},
|
|
15764
15181
|
identityVerification: {
|
|
15765
15182
|
available: !!this.config.identityAdapter,
|
|
15766
|
-
provider: _optionalChain([this, 'access',
|
|
15183
|
+
provider: _optionalChain([this, 'access', _342 => _342.config, 'access', _343 => _343.identityAdapter, 'optionalAccess', _344 => _344.name])
|
|
15767
15184
|
}
|
|
15768
15185
|
};
|
|
15769
15186
|
}
|
|
@@ -15773,7 +15190,7 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15773
15190
|
var FileService = class extends BaseService {
|
|
15774
15191
|
constructor(adapter, options) {
|
|
15775
15192
|
super(adapter);
|
|
15776
|
-
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15193
|
+
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _345 => _345.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
|
|
15777
15194
|
}
|
|
15778
15195
|
// ============================================================================
|
|
15779
15196
|
// UPLOAD (requires StorageAdapter)
|
|
@@ -15912,7 +15329,7 @@ var FileService = class extends BaseService {
|
|
|
15912
15329
|
*/
|
|
15913
15330
|
async getFile(fileId) {
|
|
15914
15331
|
const file2 = await this.adapter.files.findById(fileId);
|
|
15915
|
-
if (_optionalChain([file2, 'optionalAccess',
|
|
15332
|
+
if (_optionalChain([file2, 'optionalAccess', _346 => _346.deletedAt])) {
|
|
15916
15333
|
return null;
|
|
15917
15334
|
}
|
|
15918
15335
|
return file2;
|
|
@@ -15974,12 +15391,12 @@ var FileService = class extends BaseService {
|
|
|
15974
15391
|
*/
|
|
15975
15392
|
async deleteFile(fileId, options) {
|
|
15976
15393
|
const file2 = await this.getFileOrThrow(fileId);
|
|
15977
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15394
|
+
if (_optionalChain([options, 'optionalAccess', _347 => _347.checkOwnership]) && options.userId) {
|
|
15978
15395
|
if (file2.uploadedBy !== options.userId) {
|
|
15979
15396
|
throw new Error("You can only delete files you uploaded");
|
|
15980
15397
|
}
|
|
15981
15398
|
}
|
|
15982
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15399
|
+
if (_optionalChain([options, 'optionalAccess', _348 => _348.hard])) {
|
|
15983
15400
|
await this.adapter.files.hardDelete(fileId);
|
|
15984
15401
|
} else {
|
|
15985
15402
|
await this.adapter.files.delete(fileId);
|
|
@@ -16010,7 +15427,7 @@ var FileService = class extends BaseService {
|
|
|
16010
15427
|
}
|
|
16011
15428
|
const file2 = await this.getFileOrThrow(fileId);
|
|
16012
15429
|
await this.adapter.storage.delete(file2.storagePath);
|
|
16013
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15430
|
+
if (_optionalChain([options, 'optionalAccess', _349 => _349.hard])) {
|
|
16014
15431
|
await this.adapter.files.hardDelete(fileId);
|
|
16015
15432
|
} else {
|
|
16016
15433
|
await this.adapter.files.delete(fileId);
|
|
@@ -16036,15 +15453,15 @@ var FileService = class extends BaseService {
|
|
|
16036
15453
|
const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
|
|
16037
15454
|
const files = fileResults.filter((f) => f !== null);
|
|
16038
15455
|
if (files.length === 0) return;
|
|
16039
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15456
|
+
if (_optionalChain([options, 'optionalAccess', _350 => _350.deleteFromStorage]) && this.adapter.storage) {
|
|
16040
15457
|
const BATCH_SIZE = 10;
|
|
16041
15458
|
for (let i = 0; i < files.length; i += BATCH_SIZE) {
|
|
16042
15459
|
const batch = files.slice(i, i + BATCH_SIZE);
|
|
16043
|
-
await Promise.all(batch.map((file2) => _optionalChain([this, 'access',
|
|
15460
|
+
await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _351 => _351.adapter, 'access', _352 => _352.storage, 'optionalAccess', _353 => _353.delete, 'call', _354 => _354(file2.storagePath)])));
|
|
16044
15461
|
}
|
|
16045
15462
|
}
|
|
16046
15463
|
const idsToDelete = files.map((f) => f.id);
|
|
16047
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15464
|
+
if (_optionalChain([options, 'optionalAccess', _355 => _355.hard])) {
|
|
16048
15465
|
await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
|
|
16049
15466
|
} else {
|
|
16050
15467
|
await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
|
|
@@ -16052,12 +15469,12 @@ var FileService = class extends BaseService {
|
|
|
16052
15469
|
if (this.auditService && this.userId) {
|
|
16053
15470
|
await Promise.all(
|
|
16054
15471
|
files.map(
|
|
16055
|
-
(file2) => _optionalChain([this, 'access',
|
|
15472
|
+
(file2) => _optionalChain([this, 'access', _356 => _356.auditService, 'optionalAccess', _357 => _357.logFileAction, 'call', _358 => _358({
|
|
16056
15473
|
action: "file.deleted",
|
|
16057
15474
|
actorId: _nullishCoalesce(this.userId, () => ( "")),
|
|
16058
15475
|
fileId: file2.id,
|
|
16059
15476
|
fileName: file2.name,
|
|
16060
|
-
metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15477
|
+
metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _359 => _359.deleteFromStorage]), () => ( false)) }
|
|
16061
15478
|
})])
|
|
16062
15479
|
)
|
|
16063
15480
|
);
|
|
@@ -16135,7 +15552,7 @@ var FileService = class extends BaseService {
|
|
|
16135
15552
|
if (!file2) {
|
|
16136
15553
|
return false;
|
|
16137
15554
|
}
|
|
16138
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15555
|
+
if (_optionalChain([options, 'optionalAccess', _360 => _360.isAdmin])) {
|
|
16139
15556
|
return true;
|
|
16140
15557
|
}
|
|
16141
15558
|
if (file2.visibility === "public") {
|
|
@@ -16145,7 +15562,7 @@ var FileService = class extends BaseService {
|
|
|
16145
15562
|
return true;
|
|
16146
15563
|
}
|
|
16147
15564
|
if (file2.visibility === "restricted") {
|
|
16148
|
-
return _nullishCoalesce(_optionalChain([file2, 'access',
|
|
15565
|
+
return _nullishCoalesce(_optionalChain([file2, 'access', _361 => _361.allowedUsers, 'optionalAccess', _362 => _362.includes, 'call', _363 => _363(userId)]), () => ( false));
|
|
16149
15566
|
}
|
|
16150
15567
|
return false;
|
|
16151
15568
|
}
|
|
@@ -16240,7 +15657,7 @@ function withTimeout(promise, ms, label) {
|
|
|
16240
15657
|
var GeocodingService = class {
|
|
16241
15658
|
constructor(adapter, options) {
|
|
16242
15659
|
this.adapter = adapter;
|
|
16243
|
-
this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15660
|
+
this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _364 => _364.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
|
|
16244
15661
|
}
|
|
16245
15662
|
/**
|
|
16246
15663
|
* Search for address suggestions as the user types
|
|
@@ -16324,10 +15741,10 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16324
15741
|
*/
|
|
16325
15742
|
async executeSearch(query, options) {
|
|
16326
15743
|
return await this.adapter.objectRecords.globalSearch(query, {
|
|
16327
|
-
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16328
|
-
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16329
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16330
|
-
includeObjectInfo: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15744
|
+
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _365 => _365.limit]), () => ( 20)),
|
|
15745
|
+
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _366 => _366.offset]), () => ( 0)),
|
|
15746
|
+
objectNames: _optionalChain([options, 'optionalAccess', _367 => _367.objectNames]),
|
|
15747
|
+
includeObjectInfo: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _368 => _368.includeObjectInfo]), () => ( true))
|
|
16331
15748
|
});
|
|
16332
15749
|
}
|
|
16333
15750
|
/**
|
|
@@ -16338,7 +15755,7 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16338
15755
|
* @returns Results grouped by object name
|
|
16339
15756
|
*/
|
|
16340
15757
|
async searchGrouped(query, options) {
|
|
16341
|
-
const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15758
|
+
const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _369 => _369.limitPerGroup]), () => ( 5));
|
|
16342
15759
|
const estimatedGroupCount = 10;
|
|
16343
15760
|
const fetchLimit = Math.min(limitPerGroup * estimatedGroupCount, 100);
|
|
16344
15761
|
const { results, total } = await this.search(query, {
|
|
@@ -16380,7 +15797,7 @@ var PermissionService = class extends BaseService {
|
|
|
16380
15797
|
}
|
|
16381
15798
|
this.permissionsRepo = adapter.permissions;
|
|
16382
15799
|
this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
|
|
16383
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
15800
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _370 => _370.auditService]);
|
|
16384
15801
|
}
|
|
16385
15802
|
// ============================================================================
|
|
16386
15803
|
// PERMISSION CHECKS
|
|
@@ -16399,11 +15816,11 @@ var PermissionService = class extends BaseService {
|
|
|
16399
15816
|
return true;
|
|
16400
15817
|
}
|
|
16401
15818
|
const wildcardPerms = permissions.objectPermissions["*"];
|
|
16402
|
-
if (_optionalChain([wildcardPerms, 'optionalAccess',
|
|
15819
|
+
if (_optionalChain([wildcardPerms, 'optionalAccess', _371 => _371.includes, 'call', _372 => _372(action)])) {
|
|
16403
15820
|
return true;
|
|
16404
15821
|
}
|
|
16405
15822
|
const objectPerms = permissions.objectPermissions[objectName];
|
|
16406
|
-
return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess',
|
|
15823
|
+
return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _373 => _373.includes, 'call', _374 => _374(action)]), () => ( false));
|
|
16407
15824
|
}
|
|
16408
15825
|
/**
|
|
16409
15826
|
* Check if user can access an object, throw ForbiddenError if not.
|
|
@@ -16458,12 +15875,12 @@ var PermissionService = class extends BaseService {
|
|
|
16458
15875
|
if (permissions.isAdmin) {
|
|
16459
15876
|
return true;
|
|
16460
15877
|
}
|
|
16461
|
-
const wildcardPerms = _optionalChain([permissions, 'access',
|
|
16462
|
-
if (_optionalChain([wildcardPerms, 'optionalAccess',
|
|
15878
|
+
const wildcardPerms = _optionalChain([permissions, 'access', _375 => _375.systemPermissions, 'optionalAccess', _376 => _376["*"]]);
|
|
15879
|
+
if (_optionalChain([wildcardPerms, 'optionalAccess', _377 => _377.includes, 'call', _378 => _378(action)])) {
|
|
16463
15880
|
return true;
|
|
16464
15881
|
}
|
|
16465
|
-
const resourcePerms = _optionalChain([permissions, 'access',
|
|
16466
|
-
return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess',
|
|
15882
|
+
const resourcePerms = _optionalChain([permissions, 'access', _379 => _379.systemPermissions, 'optionalAccess', _380 => _380[resource]]);
|
|
15883
|
+
return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _381 => _381.includes, 'call', _382 => _382(action)]), () => ( false));
|
|
16467
15884
|
}
|
|
16468
15885
|
/**
|
|
16469
15886
|
* Check if user can access a system resource, throw ForbiddenError if not.
|
|
@@ -16492,8 +15909,8 @@ var PermissionService = class extends BaseService {
|
|
|
16492
15909
|
if (permissions.isAdmin) {
|
|
16493
15910
|
return { canRead: true, canCreate: true, canUpdate: true, canDelete: true };
|
|
16494
15911
|
}
|
|
16495
|
-
const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access',
|
|
16496
|
-
const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access',
|
|
15912
|
+
const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _383 => _383.systemPermissions, 'optionalAccess', _384 => _384["*"]]), () => ( []));
|
|
15913
|
+
const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _385 => _385.systemPermissions, 'optionalAccess', _386 => _386[resource]]), () => ( []));
|
|
16497
15914
|
const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
|
|
16498
15915
|
return {
|
|
16499
15916
|
canRead: allPerms.has("read"),
|
|
@@ -16636,7 +16053,7 @@ var PermissionService = class extends BaseService {
|
|
|
16636
16053
|
action: "role.updated",
|
|
16637
16054
|
actorId: this.userId,
|
|
16638
16055
|
roleId,
|
|
16639
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
16056
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _387 => _387.label]), () => ( roleId)),
|
|
16640
16057
|
metadata: { permissionsUpdated: true, permissionCount: permissions.length }
|
|
16641
16058
|
});
|
|
16642
16059
|
}
|
|
@@ -16666,7 +16083,7 @@ var PermissionService = class extends BaseService {
|
|
|
16666
16083
|
action: "role.assigned",
|
|
16667
16084
|
actorId: this.userId,
|
|
16668
16085
|
roleId,
|
|
16669
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
16086
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _388 => _388.label]), () => ( roleId)),
|
|
16670
16087
|
targetUserId: userProfileId
|
|
16671
16088
|
});
|
|
16672
16089
|
}
|
|
@@ -16684,7 +16101,7 @@ var PermissionService = class extends BaseService {
|
|
|
16684
16101
|
action: "role.revoked",
|
|
16685
16102
|
actorId: this.userId,
|
|
16686
16103
|
roleId,
|
|
16687
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
16104
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _389 => _389.label]), () => ( roleId)),
|
|
16688
16105
|
targetUserId: userProfileId
|
|
16689
16106
|
});
|
|
16690
16107
|
}
|
|
@@ -16717,7 +16134,7 @@ var PermissionService = class extends BaseService {
|
|
|
16717
16134
|
DEFAULT_ROLE_PERMISSIONS
|
|
16718
16135
|
} = await Promise.resolve().then(() => _interopRequireWildcard(require("./default-roles-C3FYDYMN.js")));
|
|
16719
16136
|
const existingRoles = await this.getRoles();
|
|
16720
|
-
const existingRoleNames =
|
|
16137
|
+
const existingRoleNames = existingRoles.reduce((set, r) => set.add(r.name), /* @__PURE__ */ new Set());
|
|
16721
16138
|
for (const roleName of Object.values(DEFAULT_ROLES)) {
|
|
16722
16139
|
if (existingRoleNames.has(roleName)) {
|
|
16723
16140
|
continue;
|
|
@@ -17160,7 +16577,7 @@ var ViewService = class extends BaseService {
|
|
|
17160
16577
|
dbView.objectName,
|
|
17161
16578
|
dbView.type,
|
|
17162
16579
|
objectDefinition,
|
|
17163
|
-
dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access',
|
|
16580
|
+
dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _390 => _390.config, 'optionalAccess', _391 => _391.layout]), () => ( "page")) : void 0
|
|
17164
16581
|
);
|
|
17165
16582
|
const newConfig = generated.config;
|
|
17166
16583
|
const updated = await this.adapter.views.update(viewId, { config: newConfig });
|
|
@@ -17211,7 +16628,7 @@ var ViewService = class extends BaseService {
|
|
|
17211
16628
|
*/
|
|
17212
16629
|
async hasUserCustomizations(viewId, userId) {
|
|
17213
16630
|
const overlay = await this.adapter.viewOverlays.findByViewAndUser(viewId, userId);
|
|
17214
|
-
return overlay !== null &&
|
|
16631
|
+
return overlay !== null && hasProperties(overlay.configOverrides);
|
|
17215
16632
|
}
|
|
17216
16633
|
// ============================================================================
|
|
17217
16634
|
// OVERLAY MERGE LOGIC
|
|
@@ -17586,8 +17003,9 @@ async function handleDryRun(adapter, nativeObject, existingObject, result, optio
|
|
|
17586
17003
|
if (options.verbose) {
|
|
17587
17004
|
console.info(`[SyncService] Would ${isNew ? "create" : "update"} object: ${nativeObject.name}`);
|
|
17588
17005
|
}
|
|
17006
|
+
const existingAttrs = existingObject ? await adapter.attributes.findByObjectId(existingObject.id) : [];
|
|
17589
17007
|
for (const attr of nativeObject.attributes) {
|
|
17590
|
-
const existingAttr =
|
|
17008
|
+
const existingAttr = _nullishCoalesce(existingAttrs.find((a) => a.name === attr.name), () => ( null));
|
|
17591
17009
|
if (existingAttr) {
|
|
17592
17010
|
result.attributesUpdated++;
|
|
17593
17011
|
} else {
|
|
@@ -17609,8 +17027,9 @@ async function upsertObject(adapter, nativeObject, _options) {
|
|
|
17609
17027
|
});
|
|
17610
17028
|
}
|
|
17611
17029
|
async function syncAttributes(adapter, nativeObject, dbObject, existingObject, result) {
|
|
17030
|
+
const existingAttrs = existingObject ? await adapter.attributes.findByObjectId(dbObject.id) : [];
|
|
17612
17031
|
for (const [index, attr] of nativeObject.attributes.entries()) {
|
|
17613
|
-
const existingAttr =
|
|
17032
|
+
const existingAttr = _nullishCoalesce(existingAttrs.find((a) => a.name === attr.name), () => ( null));
|
|
17614
17033
|
await adapter.attributes.upsert({
|
|
17615
17034
|
objectId: dbObject.id,
|
|
17616
17035
|
name: attr.name,
|
|
@@ -18024,69 +17443,4 @@ var NoopGeocodingAdapter = class {
|
|
|
18024
17443
|
|
|
18025
17444
|
|
|
18026
17445
|
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18086
|
-
|
|
18087
|
-
|
|
18088
|
-
|
|
18089
|
-
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
exports.IDENTITY_PROPERTIES = IDENTITY_PROPERTIES; exports.BEHAVIOR_PROPERTIES = BEHAVIOR_PROPERTIES; exports.PRESENTATION_PROPERTIES = PRESENTATION_PROPERTIES; exports.isIdentityProperty = isIdentityProperty; exports.isBehaviorProperty = isBehaviorProperty; exports.isPresentationProperty = isPresentationProperty; exports.getPropertyProtectionLevel = getPropertyProtectionLevel; exports.filterPropertiesByCategory = filterPropertiesByCategory; exports.RELATION_TARGET_ANY = RELATION_TARGET_ANY; exports.isUniversalRelation = isUniversalRelation; exports.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.NoopGeocodingAdapter = NoopGeocodingAdapter; exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES; exports.RESERVED_ATTRIBUTE_NAMES = RESERVED_ATTRIBUTE_NAMES; exports.PolicyViolationError = PolicyViolationError; exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES; exports.getSystemAttributeList = getSystemAttributeList; exports.isSystemAttribute = isSystemAttribute; exports.isSystemAttributeObject = isSystemAttributeObject; exports.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isDocumentNode = isDocumentNode; exports.isEndNode = isEndNode; exports.getNodeOutputs = getNodeOutputs; exports.isConditionRule = isConditionRule; exports.isConditionGroup = isConditionGroup; exports.eq = eq; exports.neq = neq; exports.and = and; exports.or = or; exports.inValues = inValues; exports.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.isWorkflowDefinition = isWorkflowDefinition; exports.isWorkflowPublished = isWorkflowPublished; exports.isSystemWorkflow = isSystemWorkflow; exports.isInstanceTerminal = isInstanceTerminal; exports.isInstanceWaiting = isInstanceWaiting; exports.canResumeInstance = canResumeInstance; exports.createStartTransition = createStartTransition; exports.isInvitationValid = isInvitationValid; exports.isInvitationAccepted = isInvitationAccepted; exports.isInvitationExpired = isInvitationExpired; exports.isGrantValid = isGrantValid; exports.isGrantRevoked = isGrantRevoked; exports.isTokenRevoked = isTokenRevoked; exports.isGrantExpired = isGrantExpired; exports.canAccessNode = canAccessNode; exports.createEmptyContext = createEmptyContext; exports.getContextValue = getContextValue; exports.setContextValue = setContextValue; exports.mergeFormToSlot = mergeFormToSlot; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; exports.ConditionOperatorSchema = ConditionOperatorSchema; exports.ConditionRuleSchema = ConditionRuleSchema; exports.ConditionGroupSchema = ConditionGroupSchema; exports.StartNodeSchema = StartNodeSchema; exports.FormFieldRefSchema = FormFieldRefSchema; exports.FlowRowFieldSchema = FlowRowFieldSchema; exports.FlowRowSchema = FlowRowSchema; exports.FormNodeSchema = FormNodeSchema; exports.ConditionNodeSchema = ConditionNodeSchema; exports.DocumentNodeSchema = DocumentNodeSchema; exports.EndNodeSchema = EndNodeSchema; exports.WorkflowNodeSchema = WorkflowNodeSchema; exports.SlotModeSchema = SlotModeSchema; exports.WorkflowSlotSchema = WorkflowSlotSchema; exports.AuthMethodSchema = AuthMethodSchema; exports.ShareStatusSchema = ShareStatusSchema; exports.WorkflowShareSchema = WorkflowShareSchema; exports.CreateShareInputSchema = CreateShareInputSchema; exports.NodePositionSchema = NodePositionSchema; exports.ViewportSchema = ViewportSchema; exports.WorkflowLayoutSchema = WorkflowLayoutSchema; exports.ThemeColorsSchema = ThemeColorsSchema; exports.ThemeLogoSchema = ThemeLogoSchema; exports.WorkflowThemeSchema = WorkflowThemeSchema; exports.WorkflowConfigSchema = WorkflowConfigSchema; exports.WorkflowStatusSchema = WorkflowStatusSchema; exports.WorkflowDefinitionSchema = WorkflowDefinitionSchema; exports.asTenantId = asTenantId; exports.asUserId = asUserId; exports.generateId = generateId; exports.generatePrefixedId = generatePrefixedId; exports.slugify = slugify; exports.generateTemplateName = generateTemplateName; exports.EMPTY_VALUE_PLACEHOLDER = EMPTY_VALUE_PLACEHOLDER; exports.formatAttributeValue = formatAttributeValue; exports.SchemaErrorCode = SchemaErrorCode; exports.SchemaError = SchemaError; exports.NotFoundError = NotFoundError; exports.ObjectNotFoundError = ObjectNotFoundError; exports.AttributeNotFoundError = AttributeNotFoundError; exports.RecordNotFoundError = RecordNotFoundError; exports.UserProfileNotFoundError = UserProfileNotFoundError; exports.FileNotFoundError = FileNotFoundError; exports.ValidationError = ValidationError; exports.ProtectedResourceError = ProtectedResourceError; exports.SyncError = SyncError; exports.NotSystemObjectError = NotSystemObjectError; exports.DuplicateError = DuplicateError; exports.isSchemaError = isSchemaError; exports.isNotFoundError = isNotFoundError; exports.isValidationError = isValidationError; exports.isProtectedResourceError = isProtectedResourceError; exports.ForbiddenError = ForbiddenError; exports.ProtectedRoleError = ProtectedRoleError; exports.RoleNotFoundError = RoleNotFoundError; exports.isForbiddenError = isForbiddenError; exports.ConcurrentModificationError = ConcurrentModificationError; exports.isConcurrentModificationError = isConcurrentModificationError; exports.text = text; exports.textarea = textarea; exports.richtext = richtext; exports.number = number; exports.checkbox = checkbox; exports.date = date; exports.phone = phone; exports.currency = currency; exports.status = status; exports.select = select; exports.multiselect = multiselect; exports.location = location; exports.file = file; exports.user = user; exports.relation = relation; exports.rating = rating; exports.formula = formula; exports.rollup = rollup; exports.document = document; exports.ObjectBuilder = ObjectBuilder; exports.object = object; exports.GroupBuilder = GroupBuilder; exports.DirectTableTabConfig = DirectTableTabConfig; exports.InverseTableTabConfig = InverseTableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.NotesTabConfig = NotesTabConfig; exports.ActivityTabConfig = ActivityTabConfig; exports.FlowsTabConfig = FlowsTabConfig; exports.DocumentsTabConfig = DocumentsTabConfig; exports.TabBuilder = TabBuilder; exports.DetailViewBuilder = DetailViewBuilder; exports.ViewBuilder = ViewBuilder; exports.detailView = detailView; exports.view = view; exports.ListViewBuilder = ListViewBuilder; exports.ListViewTabConfigBuilder = ListViewTabConfigBuilder; exports.listView = listView; exports.group = group; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.SYSTEM_TEMPLATE_IDS = SYSTEM_TEMPLATE_IDS; exports.FRENCH_ID_CARD = FRENCH_ID_CARD; exports.PASSPORT = PASSPORT; exports.DRIVING_LICENSE = DRIVING_LICENSE; exports.PROOF_OF_ADDRESS = PROOF_OF_ADDRESS; exports.SIGNABLE_CONTRACT = SIGNABLE_CONTRACT; exports.GENERIC_DOCUMENT = GENERIC_DOCUMENT; exports.SYSTEM_TEMPLATES = SYSTEM_TEMPLATES; exports.getSystemTemplate = getSystemTemplate; exports.isSystemTemplate = isSystemTemplate; exports.DEFAULT_VALIDATION_MESSAGES = DEFAULT_VALIDATION_MESSAGES; exports.textConfigSchema = textConfigSchema; exports.textareaConfigSchema = textareaConfigSchema; exports.richtextConfigSchema = richtextConfigSchema; exports.numberConfigSchema = numberConfigSchema; exports.checkboxConfigSchema = checkboxConfigSchema; exports.dateConfigSchema = dateConfigSchema; exports.phoneConfigSchema = phoneConfigSchema; exports.currencyConfigSchema = currencyConfigSchema; exports.statusConfigSchema = statusConfigSchema; exports.locationConfigSchema = locationConfigSchema; exports.selectConfigSchema = selectConfigSchema; exports.multiselectConfigSchema = multiselectConfigSchema; exports.fileConfigSchema = fileConfigSchema; exports.userConfigSchema = userConfigSchema; exports.relationConfigSchema = relationConfigSchema; exports.ratingConfigSchema = ratingConfigSchema; exports.formulaConfigSchema = formulaConfigSchema; exports.rollupConfigSchema = rollupConfigSchema; exports.documentConfigSchema = documentConfigSchema; exports.attributeConfigSchemas = attributeConfigSchemas; exports.getAttributeConfigSchema = getAttributeConfigSchema; exports.validateAttributeConfig = validateAttributeConfig; exports.parseAttributeConfig = parseAttributeConfig; exports.safeParseAttributeConfig = safeParseAttributeConfig; exports.createTextValidator = createTextValidator; exports.createNumberValidator = createNumberValidator; exports.createCheckboxValidator = createCheckboxValidator; exports.createDateValidator = createDateValidator; exports.createPhoneValidator = createPhoneValidator; exports.createCurrencyValidator = createCurrencyValidator; exports.createStatusValidator = createStatusValidator; exports.createSelectValidator = createSelectValidator; exports.createMultiselectValidator = createMultiselectValidator; exports.createLocationValidator = createLocationValidator; exports.createFileValidator = createFileValidator; exports.createUserValidator = createUserValidator; exports.createSingleRelationValidator = createSingleRelationValidator; exports.createMultiRelationValidator = createMultiRelationValidator; exports.createRelationValidator = createRelationValidator; exports.createRatingValidator = createRatingValidator; exports.createFormulaValidator = createFormulaValidator; exports.createRollupValidator = createRollupValidator; exports.createTextAreaValidator = createTextAreaValidator; exports.createRichtextValidator = createRichtextValidator; exports.createAttributeValidator = createAttributeValidator; exports.createFormAttributeValidator = createFormAttributeValidator; exports.createObjectValidator = createObjectValidator; exports.validateAttribute = validateAttribute; exports.validateObject = validateObject; exports.validateObjectOrThrow = validateObjectOrThrow; exports.createDraftValidator = createDraftValidator; exports.validateDraft = validateDraft; exports.validateDraftOrThrow = validateDraftOrThrow; exports.getMissingRequiredAttributes = getMissingRequiredAttributes; exports.isRecordComplete = isRecordComplete; exports.computeRecordStatus = computeRecordStatus; exports.WorkflowJwtService = WorkflowJwtService; exports.hashOptions = hashOptions; exports.cacheKeys = cacheKeys; exports.cacheTtl = cacheTtl; exports.defaultTtl = defaultTtl; exports.NoopCacheAdapter = NoopCacheAdapter; exports.formatRecord = formatRecord; exports.formatRecords = formatRecords; exports.createDefaultState = createDefaultState; exports.SHORTCUT_TO_FILTER_OPERATOR = SHORTCUT_TO_FILTER_OPERATOR; exports.QueryNoResultError = QueryNoResultError; exports.QueryMultipleResultsError = QueryMultipleResultsError; exports.TenantContextError = TenantContextError; exports.FeatureFlagsContextError = FeatureFlagsContextError; exports.isFeatureEnabled = isFeatureEnabled; exports.getFeatureValue = getFeatureValue; exports.getFeatureFlags = getFeatureFlags; exports.tryGetFeatureValue = tryGetFeatureValue; exports.hasFeatureFlagsContext = hasFeatureFlagsContext; exports.runWithFeatureFlags = runWithFeatureFlags; exports.withFeatureFlags = withFeatureFlags; exports.getSchemaFromContext = getSchemaFromContext; exports.getSchemaByNameFromContext = getSchemaByNameFromContext; exports.hasSchemaContext = hasSchemaContext; exports.getSchemaContext = getSchemaContext; exports.addSchemaToContext = addSchemaToContext; exports.runWithSchemaContext = runWithSchemaContext; exports.runWithMergedSchemaContext = runWithMergedSchemaContext; exports.getContext = getContext2; exports.getTenantId = getTenantId; exports.getUserId = getUserId; exports.hasContext = hasContext; exports.runWithContext = runWithContext; exports.withTenantContext = withTenantContext; exports.QueryBuilder = QueryBuilder; exports.createQueryBuilder = createQueryBuilder; exports.evaluateCondition = evaluateCondition; exports.evaluate = evaluate; exports.evaluateWithTrace = evaluateWithTrace; exports.ExecutorRegistry = ExecutorRegistry; exports.success = success; exports.wait = wait; exports.complete = complete; exports.error = error; exports.ConditionExecutor = ConditionExecutor; exports.DocumentExecutor = DocumentExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.StartExecutor = StartExecutor; exports.createDefaultExecutorRegistry = createDefaultExecutorRegistry; exports.getDefaultExecutorRegistry = getDefaultExecutorRegistry; exports.evaluateFormula = evaluateFormula; exports.evaluateFormulaWithResult = evaluateFormulaWithResult; exports.formatFormulaResult = formatFormulaResult; exports.evaluateFormulaAttribute = evaluateFormulaAttribute; exports.validateFormulaExpression = validateFormulaExpression; exports.extractFormulaVariables = extractFormulaVariables; exports.extractRelationReferences = extractRelationReferences; exports.extractRelationNames = extractRelationNames; exports.hasRelationReferences = hasRelationReferences; exports.flattenRelationsForEval = flattenRelationsForEval; exports.evaluateFormulaWithRelations = evaluateFormulaWithRelations; exports.evaluateFormulaAttributeWithRelations = evaluateFormulaAttributeWithRelations; exports.InvalidPathError = InvalidPathError; exports.MaxDepthExceededError = MaxDepthExceededError; exports.parsePath = parsePath; exports.validatePath = validatePath; exports.pathHasManyCardinality = pathHasManyCardinality; exports.getPathDepth = getPathDepth; exports.getTargetAttributeName = getTargetAttributeName; exports.getRelationPath = getRelationPath; exports.traversePath = traversePath; exports.resolveSingleValue = resolveSingleValue; exports.resolveMultiplePaths = resolveMultiplePaths; exports.NoopHookRegistry = NoopHookRegistry; exports.DEFAULT_LABEL_FALLBACK = DEFAULT_LABEL_FALLBACK; exports.renderLabelExpression = renderLabelExpression; exports.isLabelExpression = isLabelExpression; exports.extractAttributeNames = extractAttributeNames; exports.enrichValuesForDisplay = enrichValuesForDisplay; exports.enrichValuesWithSelectLabels = enrichValuesWithSelectLabels; exports.extractRelationIds = extractRelationIds; exports.computeLabelWithRelations = computeLabelWithRelations; exports.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.notesPolicy = notesPolicy; exports.BaseService = BaseService; exports.BaseRepository = BaseRepository; exports.SchemaContextAwareRepository = SchemaContextAwareRepository; exports.buildAuditChanges = buildAuditChanges; exports.ObjectSchemaService = ObjectSchemaService; exports.AuditService = AuditService; exports.UserService = UserService; exports.applyDefaultValues = applyDefaultValues; exports.checkPermission = checkPermission; exports.getPolicy = getPolicy; exports.buildPolicyContext = buildPolicyContext; exports.checkRecordAccess = checkRecordAccess; exports.checkRecordModifyOrThrow = checkRecordModifyOrThrow; exports.checkRecordDeleteOrThrow = checkRecordDeleteOrThrow; exports.checkSharedObjectWriteAccess = checkSharedObjectWriteAccess; exports.computeLabel = computeLabel; exports.enrichWithFormulas = enrichWithFormulas; exports.enrichRecordsWithFormulas = enrichRecordsWithFormulas; exports.createContextForCreate = createContextForCreate; exports.createContextForUpdate = createContextForUpdate; exports.createContextForDelete = createContextForDelete; exports.createContextForRestore = createContextForRestore; exports.recalculateParentRollups = recalculateParentRollups; exports.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; exports.DocumentRenderError = DocumentRenderError; exports.StorageDownloadNotSupportedError = StorageDownloadNotSupportedError; exports.DocumentRendererService = DocumentRendererService; exports.DocumentProcessingHook = DocumentProcessingHook; exports.GrantNotFoundError = GrantNotFoundError; exports.GrantExpiredError = GrantExpiredError; exports.GrantRevokedError = GrantRevokedError; exports.TokenRevokedError = TokenRevokedError; exports.WorkflowAccessGrantService = WorkflowAccessGrantService; exports.WorkflowInstanceService = WorkflowInstanceService; exports.InvitationNotFoundError = InvitationNotFoundError; exports.InvitationExpiredError = InvitationExpiredError; exports.InvitationAlreadyAcceptedError = InvitationAlreadyAcceptedError; exports.InvitationRevokedError = InvitationRevokedError; exports.WorkflowInvitationService = WorkflowInvitationService; exports.WorkflowRelationService = WorkflowRelationService; exports.WorkflowService = WorkflowService; exports.UserProfileService = UserProfileService; exports.DocumentGenerationTemplateNotFoundError = DocumentGenerationTemplateNotFoundError; exports.DocumentGenerationNotConfiguredError = DocumentGenerationNotConfiguredError; exports.DocumentGenerationService = DocumentGenerationService; exports.DocumentTemplateService = DocumentTemplateService; exports.DocumentService = DocumentService; exports.DocumentProcessingService = DocumentProcessingService; exports.FileService = FileService; exports.GeocodingService = GeocodingService; exports.GlobalSearchService = GlobalSearchService; exports.PermissionService = PermissionService; exports.ViewService = ViewService; exports.seedRegistryViews = seedRegistryViews; exports.syncNativeViews = syncNativeViews; exports.verifyRegistryViewsSeeded = verifyRegistryViewsSeeded; exports.verifyNativeViewsSync = verifyNativeViewsSync; exports.getViewSeedPreview = getViewSeedPreview; exports.getViewSyncPreview = getViewSyncPreview; exports.syncNativeObjects = syncNativeObjects; exports.verifyNativeObjectsSync = verifyNativeObjectsSync; exports.getSyncPreview = getSyncPreview; exports.syncAll = syncAll;
|
|
17446
|
+
exports.IDENTITY_PROPERTIES = IDENTITY_PROPERTIES; exports.BEHAVIOR_PROPERTIES = BEHAVIOR_PROPERTIES; exports.PRESENTATION_PROPERTIES = PRESENTATION_PROPERTIES; exports.isIdentityProperty = isIdentityProperty; exports.isBehaviorProperty = isBehaviorProperty; exports.isPresentationProperty = isPresentationProperty; exports.RELATION_TARGET_ANY = RELATION_TARGET_ANY; exports.isUniversalRelation = isUniversalRelation; exports.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.NoopGeocodingAdapter = NoopGeocodingAdapter; exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES; exports.RESERVED_ATTRIBUTE_NAMES = RESERVED_ATTRIBUTE_NAMES; exports.PolicyViolationError = PolicyViolationError; exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES; exports.getSystemAttributeList = getSystemAttributeList; exports.isSystemAttribute = isSystemAttribute; exports.isSystemAttributeObject = isSystemAttributeObject; exports.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isDocumentNode = isDocumentNode; exports.isEndNode = isEndNode; exports.getNodeOutputs = getNodeOutputs; exports.isConditionRule = isConditionRule; exports.isConditionGroup = isConditionGroup; exports.eq = eq; exports.neq = neq; exports.and = and; exports.or = or; exports.inValues = inValues; exports.isWorkflowDefinition = isWorkflowDefinition; exports.isWorkflowPublished = isWorkflowPublished; exports.isSystemWorkflow = isSystemWorkflow; exports.isInstanceTerminal = isInstanceTerminal; exports.isInstanceWaiting = isInstanceWaiting; exports.canResumeInstance = canResumeInstance; exports.createStartTransition = createStartTransition; exports.isInvitationValid = isInvitationValid; exports.isInvitationAccepted = isInvitationAccepted; exports.isInvitationExpired = isInvitationExpired; exports.isGrantValid = isGrantValid; exports.isGrantRevoked = isGrantRevoked; exports.isTokenRevoked = isTokenRevoked; exports.isGrantExpired = isGrantExpired; exports.canAccessNode = canAccessNode; exports.createEmptyContext = createEmptyContext; exports.getContextValue = getContextValue; exports.setContextValue = setContextValue; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; exports.ConditionOperatorSchema = ConditionOperatorSchema; exports.ConditionRuleSchema = ConditionRuleSchema; exports.ConditionGroupSchema = ConditionGroupSchema; exports.StartNodeSchema = StartNodeSchema; exports.FormFieldRefSchema = FormFieldRefSchema; exports.FlowRowFieldSchema = FlowRowFieldSchema; exports.FlowRowSchema = FlowRowSchema; exports.FormNodeSchema = FormNodeSchema; exports.ConditionNodeSchema = ConditionNodeSchema; exports.DocumentNodeSchema = DocumentNodeSchema; exports.EndNodeSchema = EndNodeSchema; exports.WorkflowNodeSchema = WorkflowNodeSchema; exports.SlotModeSchema = SlotModeSchema; exports.WorkflowSlotSchema = WorkflowSlotSchema; exports.AuthMethodSchema = AuthMethodSchema; exports.ShareStatusSchema = ShareStatusSchema; exports.WorkflowShareSchema = WorkflowShareSchema; exports.CreateShareInputSchema = CreateShareInputSchema; exports.NodePositionSchema = NodePositionSchema; exports.ViewportSchema = ViewportSchema; exports.WorkflowLayoutSchema = WorkflowLayoutSchema; exports.ThemeColorsSchema = ThemeColorsSchema; exports.ThemeLogoSchema = ThemeLogoSchema; exports.WorkflowThemeSchema = WorkflowThemeSchema; exports.WorkflowConfigSchema = WorkflowConfigSchema; exports.WorkflowStatusSchema = WorkflowStatusSchema; exports.WorkflowDefinitionSchema = WorkflowDefinitionSchema; exports.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.toUndefinedIfEmpty = toUndefinedIfEmpty; exports.hasProperties = hasProperties; exports.EMPTY_VALUE_PLACEHOLDER = EMPTY_VALUE_PLACEHOLDER; exports.formatAttributeValue = formatAttributeValue; exports.SchemaErrorCode = SchemaErrorCode; exports.SchemaError = SchemaError; exports.NotFoundError = NotFoundError; exports.ObjectNotFoundError = ObjectNotFoundError; exports.AttributeNotFoundError = AttributeNotFoundError; exports.RecordNotFoundError = RecordNotFoundError; exports.UserProfileNotFoundError = UserProfileNotFoundError; exports.FileNotFoundError = FileNotFoundError; exports.ValidationError = ValidationError; exports.ProtectedResourceError = ProtectedResourceError; exports.SyncError = SyncError; exports.NotSystemObjectError = NotSystemObjectError; exports.DuplicateError = DuplicateError; exports.isSchemaError = isSchemaError; exports.isNotFoundError = isNotFoundError; exports.isValidationError = isValidationError; exports.isProtectedResourceError = isProtectedResourceError; exports.ForbiddenError = ForbiddenError; exports.ProtectedRoleError = ProtectedRoleError; exports.RoleNotFoundError = RoleNotFoundError; exports.isForbiddenError = isForbiddenError; exports.ConcurrentModificationError = ConcurrentModificationError; exports.text = text; exports.textarea = textarea; exports.richtext = richtext; exports.number = number; exports.checkbox = checkbox; exports.date = date; exports.phone = phone; exports.currency = currency; exports.status = status; exports.select = select; exports.multiselect = multiselect; exports.location = location; exports.file = file; exports.user = user; exports.relation = relation; exports.rating = rating; exports.formula = formula; exports.rollup = rollup; exports.document = document; exports.ObjectBuilder = ObjectBuilder; exports.object = object; exports.GroupBuilder = GroupBuilder; exports.DirectTableTabConfig = DirectTableTabConfig; exports.InverseTableTabConfig = InverseTableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.NotesTabConfig = NotesTabConfig; exports.ActivityTabConfig = ActivityTabConfig; exports.FlowsTabConfig = FlowsTabConfig; exports.DocumentsTabConfig = DocumentsTabConfig; exports.TabBuilder = TabBuilder; exports.DetailViewBuilder = DetailViewBuilder; exports.ViewBuilder = ViewBuilder; exports.detailView = detailView; exports.view = view; exports.ListViewBuilder = ListViewBuilder; exports.ListViewTabConfigBuilder = ListViewTabConfigBuilder; exports.listView = listView; exports.group = group; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; exports.SYSTEM_TEMPLATE_IDS = SYSTEM_TEMPLATE_IDS; exports.FRENCH_ID_CARD = FRENCH_ID_CARD; exports.PASSPORT = PASSPORT; exports.DRIVING_LICENSE = DRIVING_LICENSE; exports.PROOF_OF_ADDRESS = PROOF_OF_ADDRESS; exports.SIGNABLE_CONTRACT = SIGNABLE_CONTRACT; exports.GENERIC_DOCUMENT = GENERIC_DOCUMENT; exports.SYSTEM_TEMPLATES = SYSTEM_TEMPLATES; exports.getSystemTemplate = getSystemTemplate; exports.isSystemTemplate = isSystemTemplate; exports.WorkflowJwtService = WorkflowJwtService; exports.hashOptions = hashOptions; exports.cacheKeys = cacheKeys; exports.cacheTtl = cacheTtl; exports.defaultTtl = defaultTtl; exports.NoopCacheAdapter = NoopCacheAdapter; exports.formatRecord = formatRecord; exports.formatRecords = formatRecords; exports.createDefaultState = createDefaultState; exports.SHORTCUT_TO_FILTER_OPERATOR = SHORTCUT_TO_FILTER_OPERATOR; exports.QueryNoResultError = QueryNoResultError; exports.QueryMultipleResultsError = QueryMultipleResultsError; exports.TenantContextError = TenantContextError; exports.FeatureFlagsContextError = FeatureFlagsContextError; exports.isFeatureEnabled = isFeatureEnabled; exports.getFeatureValue = getFeatureValue; exports.getFeatureFlags = getFeatureFlags; exports.tryGetFeatureValue = tryGetFeatureValue; exports.hasFeatureFlagsContext = hasFeatureFlagsContext; exports.runWithFeatureFlags = runWithFeatureFlags; exports.withFeatureFlags = withFeatureFlags; exports.getSchemaFromContext = getSchemaFromContext; exports.getSchemaByNameFromContext = getSchemaByNameFromContext; exports.hasSchemaContext = hasSchemaContext; exports.getSchemaContext = getSchemaContext; exports.addSchemaToContext = addSchemaToContext; exports.runWithSchemaContext = runWithSchemaContext; exports.runWithMergedSchemaContext = runWithMergedSchemaContext; exports.getContext = getContext2; exports.getTenantId = getTenantId; exports.getUserId = getUserId; exports.hasContext = hasContext; exports.runWithContext = runWithContext; exports.withTenantContext = withTenantContext; exports.QueryBuilder = QueryBuilder; exports.createQueryBuilder = createQueryBuilder; exports.evaluateCondition = evaluateCondition; exports.evaluate = evaluate; exports.evaluateWithTrace = evaluateWithTrace; exports.ExecutorRegistry = ExecutorRegistry; exports.success = success; exports.wait = wait; exports.complete = complete; exports.error = error; exports.ConditionExecutor = ConditionExecutor; exports.DocumentExecutor = DocumentExecutor; exports.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.StartExecutor = StartExecutor; exports.createDefaultExecutorRegistry = createDefaultExecutorRegistry; exports.getDefaultExecutorRegistry = getDefaultExecutorRegistry; exports.evaluateFormula = evaluateFormula; exports.evaluateFormulaWithResult = evaluateFormulaWithResult; exports.formatFormulaResult = formatFormulaResult; exports.evaluateFormulaAttribute = evaluateFormulaAttribute; exports.validateFormulaExpression = validateFormulaExpression; exports.extractFormulaVariables = extractFormulaVariables; exports.extractRelationReferences = extractRelationReferences; exports.extractRelationNames = extractRelationNames; exports.hasRelationReferences = hasRelationReferences; exports.flattenRelationsForEval = flattenRelationsForEval; exports.evaluateFormulaWithRelations = evaluateFormulaWithRelations; exports.evaluateFormulaAttributeWithRelations = evaluateFormulaAttributeWithRelations; exports.InvalidPathError = InvalidPathError; exports.MaxDepthExceededError = MaxDepthExceededError; exports.parsePath = parsePath; exports.validatePath = validatePath; exports.pathHasManyCardinality = pathHasManyCardinality; exports.getPathDepth = getPathDepth; exports.getTargetAttributeName = getTargetAttributeName; exports.getRelationPath = getRelationPath; exports.traversePath = traversePath; exports.resolveSingleValue = resolveSingleValue; exports.resolveMultiplePaths = resolveMultiplePaths; exports.NoopHookRegistry = NoopHookRegistry; exports.DEFAULT_LABEL_FALLBACK = DEFAULT_LABEL_FALLBACK; exports.renderLabelExpression = renderLabelExpression; exports.isLabelExpression = isLabelExpression; exports.extractAttributeNames = extractAttributeNames; exports.enrichValuesForDisplay = enrichValuesForDisplay; exports.enrichValuesWithSelectLabels = enrichValuesWithSelectLabels; exports.extractRelationIds = extractRelationIds; exports.computeLabelWithRelations = computeLabelWithRelations; exports.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.notesPolicy = notesPolicy; exports.BaseService = BaseService; exports.BaseRepository = BaseRepository; exports.SchemaContextAwareRepository = SchemaContextAwareRepository; exports.buildAuditChanges = buildAuditChanges; exports.ObjectSchemaService = ObjectSchemaService; exports.AuditService = AuditService; exports.UserService = UserService; exports.applyDefaultValues = applyDefaultValues; exports.checkPermission = checkPermission; exports.getPolicy = getPolicy; exports.buildPolicyContext = buildPolicyContext; exports.checkRecordAccess = checkRecordAccess; exports.checkRecordModifyOrThrow = checkRecordModifyOrThrow; exports.checkRecordDeleteOrThrow = checkRecordDeleteOrThrow; exports.checkSharedObjectWriteAccess = checkSharedObjectWriteAccess; exports.computeLabel = computeLabel; exports.enrichWithFormulas = enrichWithFormulas; exports.enrichRecordsWithFormulas = enrichRecordsWithFormulas; exports.createContextForCreate = createContextForCreate; exports.createContextForUpdate = createContextForUpdate; exports.createContextForDelete = createContextForDelete; exports.createContextForRestore = createContextForRestore; exports.recalculateParentRollups = recalculateParentRollups; exports.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; exports.DocumentRenderError = DocumentRenderError; exports.StorageDownloadNotSupportedError = StorageDownloadNotSupportedError; exports.DocumentRendererService = DocumentRendererService; exports.DocumentProcessingHook = DocumentProcessingHook; exports.GrantNotFoundError = GrantNotFoundError; exports.GrantExpiredError = GrantExpiredError; exports.GrantRevokedError = GrantRevokedError; exports.TokenRevokedError = TokenRevokedError; exports.WorkflowAccessGrantService = WorkflowAccessGrantService; exports.WorkflowInstanceService = WorkflowInstanceService; exports.InvitationNotFoundError = InvitationNotFoundError; exports.InvitationExpiredError = InvitationExpiredError; exports.InvitationAlreadyAcceptedError = InvitationAlreadyAcceptedError; exports.InvitationRevokedError = InvitationRevokedError; exports.WorkflowInvitationService = WorkflowInvitationService; exports.WorkflowRelationService = WorkflowRelationService; exports.WorkflowService = WorkflowService; exports.UserProfileService = UserProfileService; exports.DocumentGenerationTemplateNotFoundError = DocumentGenerationTemplateNotFoundError; exports.DocumentGenerationNotConfiguredError = DocumentGenerationNotConfiguredError; exports.DocumentGenerationService = DocumentGenerationService; exports.DocumentTemplateService = DocumentTemplateService; exports.DocumentService = DocumentService; exports.DocumentProcessingService = DocumentProcessingService; exports.FileService = FileService; exports.GeocodingService = GeocodingService; exports.GlobalSearchService = GlobalSearchService; exports.PermissionService = PermissionService; exports.ViewService = ViewService; exports.seedRegistryViews = seedRegistryViews; exports.syncNativeViews = syncNativeViews; exports.verifyRegistryViewsSeeded = verifyRegistryViewsSeeded; exports.verifyNativeViewsSync = verifyNativeViewsSync; exports.getViewSeedPreview = getViewSeedPreview; exports.getViewSyncPreview = getViewSyncPreview; exports.syncNativeObjects = syncNativeObjects; exports.verifyNativeObjectsSync = verifyNativeObjectsSync; exports.getSyncPreview = getSyncPreview; exports.syncAll = syncAll;
|