@stndrds/schema 1.0.0-alpha.84 → 1.0.0-alpha.87
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-I4D33CVC.js → chunk-B23XC4L2.js} +980 -292
- package/dist/{chunk-NEVERCM3.js → chunk-E6XO2STS.js} +21 -1
- package/dist/{chunk-HTE7NOF3.mjs → chunk-IFJJT3JZ.mjs} +705 -17
- package/dist/{chunk-7VNLLASJ.mjs → chunk-JUVFK6XD.mjs} +2 -1
- package/dist/{chunk-V2RPPE2Y.mjs → chunk-XAORXFAX.mjs} +21 -1
- package/dist/{chunk-HUT6HYXJ.js → chunk-ZW4N6FV7.js} +2 -1
- package/dist/index.d.mts +305 -8
- package/dist/index.d.ts +305 -8
- package/dist/index.js +31 -7
- package/dist/index.mjs +27 -3
- package/dist/{runtime-BUk5CZfD.d.ts → runtime-Cg0Rwnwx.d.ts} +766 -362
- package/dist/{runtime-BGZqT9aX.d.mts → runtime-Dz1JEYu7.d.mts} +766 -362
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +14 -4
- package/dist/runtime.mjs +13 -3
- package/dist/utils.d.mts +20 -1
- package/dist/utils.d.ts +20 -1
- package/dist/utils.js +4 -2
- package/dist/utils.mjs +3 -1
- package/dist/validation/validators.d.mts +1 -1
- package/dist/validation/validators.d.ts +1 -1
- package/dist/validation/validators.js +2 -2
- package/dist/validation/validators.mjs +1 -1
- package/dist/{validators-BeBrdQCB.d.mts → validators-CJmtOk1a.d.mts} +29 -1
- package/dist/{validators-UuAMCPc6.d.ts → validators-pv_b6bI_.d.ts} +29 -1
- package/package.json +2 -2
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var _chunkNEVERCM3js = require('./chunk-NEVERCM3.js');
|
|
6
5
|
|
|
6
|
+
var _chunkE6XO2STSjs = require('./chunk-E6XO2STS.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -12,7 +12,8 @@ var _chunkNEVERCM3js = require('./chunk-NEVERCM3.js');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
var _chunkZW4N6FV7js = require('./chunk-ZW4N6FV7.js');
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
var _chunk3RG5ZIWIjs = require('./chunk-3RG5ZIWI.js');
|
|
@@ -68,7 +69,7 @@ var WorkflowJwtService = class _WorkflowJwtService {
|
|
|
68
69
|
typ: "magic_link",
|
|
69
70
|
instance: params.instanceId,
|
|
70
71
|
tenant: params.tenantId
|
|
71
|
-
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.invitationId).setAudience(params.tenantId).setJti(
|
|
72
|
+
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.invitationId).setAudience(params.tenantId).setJti(_chunkE6XO2STSjs.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
|
|
72
73
|
}
|
|
73
74
|
/**
|
|
74
75
|
* Sign an access token JWT (long-lived)
|
|
@@ -86,7 +87,7 @@ var WorkflowJwtService = class _WorkflowJwtService {
|
|
|
86
87
|
instance: params.instanceId,
|
|
87
88
|
tenant: params.tenantId,
|
|
88
89
|
scope: params.scope
|
|
89
|
-
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.grantId).setAudience(params.tenantId).setJti(
|
|
90
|
+
}).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuer(this.issuer).setSubject(params.grantId).setAudience(params.tenantId).setJti(_chunkE6XO2STSjs.generateId.call(void 0, )).setIssuedAt().setExpirationTime(expiresIn).sign(this.privateKey);
|
|
90
91
|
}
|
|
91
92
|
// ============================================================================
|
|
92
93
|
// VERIFY METHODS
|
|
@@ -1043,7 +1044,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
1043
1044
|
* ```
|
|
1044
1045
|
*/
|
|
1045
1046
|
tenant(tenantId) {
|
|
1046
|
-
return this.clone({ tenantId:
|
|
1047
|
+
return this.clone({ tenantId: _chunkE6XO2STSjs.asTenantId.call(void 0, tenantId) });
|
|
1047
1048
|
}
|
|
1048
1049
|
/**
|
|
1049
1050
|
* Set user ID for audit/permissions (overrides AsyncLocalStorage context).
|
|
@@ -1059,7 +1060,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
1059
1060
|
* ```
|
|
1060
1061
|
*/
|
|
1061
1062
|
user(userId) {
|
|
1062
|
-
return this.clone({ userId:
|
|
1063
|
+
return this.clone({ userId: _chunkE6XO2STSjs.asUserId.call(void 0, userId) });
|
|
1063
1064
|
}
|
|
1064
1065
|
// ============================================================================
|
|
1065
1066
|
// TERMINATION METHODS (READ)
|
|
@@ -1284,10 +1285,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
1284
1285
|
function createQueryBuilder(recordService, adapter, objectName, options) {
|
|
1285
1286
|
const initialState = {};
|
|
1286
1287
|
if (_optionalChain([options, 'optionalAccess', _25 => _25.tenantId])) {
|
|
1287
|
-
initialState.tenantId =
|
|
1288
|
+
initialState.tenantId = _chunkE6XO2STSjs.asTenantId.call(void 0, options.tenantId);
|
|
1288
1289
|
}
|
|
1289
1290
|
if (_optionalChain([options, 'optionalAccess', _26 => _26.userId])) {
|
|
1290
|
-
initialState.userId =
|
|
1291
|
+
initialState.userId = _chunkE6XO2STSjs.asUserId.call(void 0, options.userId);
|
|
1291
1292
|
}
|
|
1292
1293
|
return new QueryBuilder(recordService, adapter, objectName, initialState);
|
|
1293
1294
|
}
|
|
@@ -1389,6 +1390,9 @@ function isConditionNode(node) {
|
|
|
1389
1390
|
function isAssignNode(node) {
|
|
1390
1391
|
return node.type === "assign";
|
|
1391
1392
|
}
|
|
1393
|
+
function isAINode(node) {
|
|
1394
|
+
return node.type === "ai";
|
|
1395
|
+
}
|
|
1392
1396
|
function isEndNode(node) {
|
|
1393
1397
|
return node.type === "end";
|
|
1394
1398
|
}
|
|
@@ -1529,6 +1533,47 @@ var assignNodeType = {
|
|
|
1529
1533
|
};
|
|
1530
1534
|
nodeTypeRegistry.register(assignNodeType);
|
|
1531
1535
|
|
|
1536
|
+
// src/types/workflows/node-types/ai.node-type.ts
|
|
1537
|
+
var aiNodeType = {
|
|
1538
|
+
type: "ai",
|
|
1539
|
+
isLinear: true,
|
|
1540
|
+
structural: false,
|
|
1541
|
+
getOutputs(node) {
|
|
1542
|
+
return node.next ? [node.next] : [];
|
|
1543
|
+
},
|
|
1544
|
+
setNext(node, targetId) {
|
|
1545
|
+
return { ...node, next: targetId };
|
|
1546
|
+
},
|
|
1547
|
+
getSlotIds(node) {
|
|
1548
|
+
const slotIds = /* @__PURE__ */ new Set();
|
|
1549
|
+
const action = node.action;
|
|
1550
|
+
if (action.type === "document-generation") {
|
|
1551
|
+
for (const id of action.inputSlotIds) slotIds.add(id);
|
|
1552
|
+
for (const id of action.targetSlotIds) slotIds.add(id);
|
|
1553
|
+
} else if (action.type === "code-execution") {
|
|
1554
|
+
for (const id of _nullishCoalesce(action.inputSlotIds, () => ( []))) slotIds.add(id);
|
|
1555
|
+
}
|
|
1556
|
+
return [...slotIds];
|
|
1557
|
+
},
|
|
1558
|
+
validate(node) {
|
|
1559
|
+
const errors = [];
|
|
1560
|
+
if (!node.label) errors.push("AINode must have a label");
|
|
1561
|
+
if (!node.action) errors.push("AINode must have an action");
|
|
1562
|
+
if (!node.next) errors.push("AINode must have a 'next' target");
|
|
1563
|
+
if (_optionalChain([node, 'access', _29 => _29.action, 'optionalAccess', _30 => _30.type]) === "document-generation") {
|
|
1564
|
+
if (!node.action.templateId) errors.push("Document generation must have a templateId");
|
|
1565
|
+
if (!_optionalChain([node, 'access', _31 => _31.action, 'access', _32 => _32.inputSlotIds, 'optionalAccess', _33 => _33.length]))
|
|
1566
|
+
errors.push("Document generation must have input slots");
|
|
1567
|
+
if (!_optionalChain([node, 'access', _34 => _34.action, 'access', _35 => _35.targetSlotIds, 'optionalAccess', _36 => _36.length]))
|
|
1568
|
+
errors.push("Document generation must have target slots");
|
|
1569
|
+
} else if (_optionalChain([node, 'access', _37 => _37.action, 'optionalAccess', _38 => _38.type]) === "code-execution") {
|
|
1570
|
+
if (!node.action.code) errors.push("Code execution must have code");
|
|
1571
|
+
}
|
|
1572
|
+
return errors;
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
nodeTypeRegistry.register(aiNodeType);
|
|
1576
|
+
|
|
1532
1577
|
// src/types/workflows/node-types/end.node-type.ts
|
|
1533
1578
|
var endNodeType = {
|
|
1534
1579
|
type: "end",
|
|
@@ -1741,14 +1786,15 @@ function isInvitationOrGrantEvent(event) {
|
|
|
1741
1786
|
var ZONE_ORDER = ["collect", "actions"];
|
|
1742
1787
|
var ZONE_CONFIG = {
|
|
1743
1788
|
collect: { allowedNodeTypes: ["form", "condition"] },
|
|
1744
|
-
actions: { allowedNodeTypes: ["condition", "assign"] }
|
|
1789
|
+
actions: { allowedNodeTypes: ["condition", "assign", "ai"] }
|
|
1745
1790
|
};
|
|
1746
1791
|
var TERMINAL_NODE_TYPES = /* @__PURE__ */ new Set(["start", "end"]);
|
|
1747
1792
|
var NODE_TYPE_ZONE = {
|
|
1748
1793
|
form: "collect",
|
|
1749
1794
|
condition: "collect",
|
|
1750
1795
|
// default — overridden by assignNodeZones logic
|
|
1751
|
-
assign: "actions"
|
|
1796
|
+
assign: "actions",
|
|
1797
|
+
ai: "actions"
|
|
1752
1798
|
};
|
|
1753
1799
|
function assignNodeZones(orderedNodes) {
|
|
1754
1800
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -1833,9 +1879,14 @@ var StartNodeSchema = _zod.z.object({
|
|
|
1833
1879
|
id: _zod.z.string().min(1),
|
|
1834
1880
|
next: _zod.z.string().nullish()
|
|
1835
1881
|
});
|
|
1882
|
+
var RelationFieldConfigSchema = _zod.z.object({
|
|
1883
|
+
visibleProperties: _zod.z.array(_zod.z.string()).optional(),
|
|
1884
|
+
allowCreate: _zod.z.boolean().optional()
|
|
1885
|
+
}).optional();
|
|
1836
1886
|
var FormFieldRefSchema = _zod.z.object({
|
|
1837
1887
|
slotId: _zod.z.string().min(1, "slotId is required"),
|
|
1838
|
-
attribute: _zod.z.string().min(1, "attribute is required")
|
|
1888
|
+
attribute: _zod.z.string().min(1, "attribute is required"),
|
|
1889
|
+
relationConfig: RelationFieldConfigSchema
|
|
1839
1890
|
});
|
|
1840
1891
|
var FlowRowFieldSchema = _zod.z.object({
|
|
1841
1892
|
id: _zod.z.string().min(1),
|
|
@@ -1843,7 +1894,8 @@ var FlowRowFieldSchema = _zod.z.object({
|
|
|
1843
1894
|
attribute: _zod.z.string().min(1),
|
|
1844
1895
|
label: _zod.z.string().max(200).optional(),
|
|
1845
1896
|
tooltip: _zod.z.string().max(1e3).optional(),
|
|
1846
|
-
required: _zod.z.boolean().optional()
|
|
1897
|
+
required: _zod.z.boolean().optional(),
|
|
1898
|
+
relationConfig: RelationFieldConfigSchema
|
|
1847
1899
|
});
|
|
1848
1900
|
var FlowFieldsRowSchema = _zod.z.object({
|
|
1849
1901
|
id: _zod.z.string().min(1),
|
|
@@ -1924,6 +1976,35 @@ var AssignNodeSchema = _zod.z.object({
|
|
|
1924
1976
|
assignments: _zod.z.array(AssignmentMappingSchema).min(1),
|
|
1925
1977
|
next: _zod.z.string().nullish()
|
|
1926
1978
|
});
|
|
1979
|
+
var DocumentGenerationActionSchema = _zod.z.object({
|
|
1980
|
+
type: _zod.z.literal("document-generation"),
|
|
1981
|
+
templateId: _zod.z.string().min(1, "Template ID is required"),
|
|
1982
|
+
inputSlotIds: _zod.z.array(_zod.z.string().min(1)).min(1, "At least one input slot is required"),
|
|
1983
|
+
targetSlotIds: _zod.z.array(_zod.z.string().min(1)).min(1, "At least one target slot is required"),
|
|
1984
|
+
outputFormat: _zod.z.enum(["pdf", "docx"]),
|
|
1985
|
+
aiInstructions: _zod.z.string().nullish()
|
|
1986
|
+
});
|
|
1987
|
+
var CodeExecutionActionSchema = _zod.z.object({
|
|
1988
|
+
type: _zod.z.literal("code-execution"),
|
|
1989
|
+
code: _zod.z.string().min(1, "Code is required"),
|
|
1990
|
+
language: _zod.z.enum(["javascript", "typescript", "python"]),
|
|
1991
|
+
inputSlotIds: _zod.z.array(_zod.z.string().min(1)).optional(),
|
|
1992
|
+
outputVariable: _zod.z.string().optional(),
|
|
1993
|
+
packages: _zod.z.array(_zod.z.string()).optional()
|
|
1994
|
+
});
|
|
1995
|
+
var AIActionConfigSchema = _zod.z.discriminatedUnion("type", [
|
|
1996
|
+
DocumentGenerationActionSchema,
|
|
1997
|
+
CodeExecutionActionSchema
|
|
1998
|
+
]);
|
|
1999
|
+
var AINodeSchema = _zod.z.object({
|
|
2000
|
+
type: _zod.z.literal("ai"),
|
|
2001
|
+
id: _zod.z.string().min(1),
|
|
2002
|
+
label: _zod.z.string().min(1),
|
|
2003
|
+
description: _zod.z.string().nullish(),
|
|
2004
|
+
action: AIActionConfigSchema,
|
|
2005
|
+
timeoutMs: _zod.z.number().positive().optional(),
|
|
2006
|
+
next: _zod.z.string().nullish()
|
|
2007
|
+
});
|
|
1927
2008
|
var EndNodeSchema = _zod.z.object({
|
|
1928
2009
|
type: _zod.z.literal("end"),
|
|
1929
2010
|
id: _zod.z.string().min(1),
|
|
@@ -1935,6 +2016,7 @@ var WorkflowNodeSchema = _zod.z.discriminatedUnion("type", [
|
|
|
1935
2016
|
FormNodeSchema,
|
|
1936
2017
|
ConditionNodeSchema,
|
|
1937
2018
|
AssignNodeSchema,
|
|
2019
|
+
AINodeSchema,
|
|
1938
2020
|
EndNodeSchema
|
|
1939
2021
|
]);
|
|
1940
2022
|
var SlotModeSchema = _zod.z.enum(["create", "select", "optional"]);
|
|
@@ -2048,7 +2130,7 @@ var WorkflowDefinitionSchema = _zod.z.object({
|
|
|
2048
2130
|
).refine(
|
|
2049
2131
|
(def) => {
|
|
2050
2132
|
const startNode = def.nodes[def.startNodeId];
|
|
2051
|
-
return _optionalChain([startNode, 'optionalAccess',
|
|
2133
|
+
return _optionalChain([startNode, 'optionalAccess', _39 => _39.type]) === "start";
|
|
2052
2134
|
},
|
|
2053
2135
|
{
|
|
2054
2136
|
message: "startNodeId must reference a node of type 'start'"
|
|
@@ -2308,8 +2390,8 @@ function wait(reason, options) {
|
|
|
2308
2390
|
return {
|
|
2309
2391
|
status: "wait",
|
|
2310
2392
|
reason,
|
|
2311
|
-
requiredParticipationId: _optionalChain([options, 'optionalAccess',
|
|
2312
|
-
expiresAt: _optionalChain([options, 'optionalAccess',
|
|
2393
|
+
requiredParticipationId: _optionalChain([options, 'optionalAccess', _40 => _40.requiredParticipationId]),
|
|
2394
|
+
expiresAt: _optionalChain([options, 'optionalAccess', _41 => _41.expiresAt])
|
|
2313
2395
|
};
|
|
2314
2396
|
}
|
|
2315
2397
|
function complete(finalStatus) {
|
|
@@ -2397,7 +2479,7 @@ var FormExecutor = class {
|
|
|
2397
2479
|
}
|
|
2398
2480
|
execute(node, context) {
|
|
2399
2481
|
const { input } = context;
|
|
2400
|
-
const hasContent = (_nullishCoalesce(_optionalChain([node, 'access',
|
|
2482
|
+
const hasContent = (_nullishCoalesce(_optionalChain([node, 'access', _42 => _42.fields, 'optionalAccess', _43 => _43.length]), () => ( 0))) > 0 || (_nullishCoalesce(_optionalChain([node, 'access', _44 => _44.rows, 'optionalAccess', _45 => _45.length]), () => ( 0))) > 0;
|
|
2401
2483
|
if (!hasContent) {
|
|
2402
2484
|
if (!node.next) {
|
|
2403
2485
|
return error("MISSING_NEXT", `FormNode "${node.id}" has no 'next' target defined`);
|
|
@@ -2496,9 +2578,9 @@ var FormExecutor = class {
|
|
|
2496
2578
|
continue;
|
|
2497
2579
|
}
|
|
2498
2580
|
const attribute = object2.attributes.find((a) => a.name === fieldRef.attribute);
|
|
2499
|
-
if (!_optionalChain([attribute, 'optionalAccess',
|
|
2581
|
+
if (!_optionalChain([attribute, 'optionalAccess', _46 => _46.required])) continue;
|
|
2500
2582
|
const slotInput = input[fieldRef.slotId];
|
|
2501
|
-
const value = _optionalChain([slotInput, 'optionalAccess',
|
|
2583
|
+
const value = _optionalChain([slotInput, 'optionalAccess', _47 => _47[fieldRef.attribute]]);
|
|
2502
2584
|
if (value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0) {
|
|
2503
2585
|
errors.push(
|
|
2504
2586
|
`Field "${_nullishCoalesce(attribute.label, () => ( fieldRef.attribute))}" is required for ${slot.label}`
|
|
@@ -2567,7 +2649,7 @@ function formatPhone(value) {
|
|
|
2567
2649
|
if (!("phoneNumber" in phone2)) return String(value);
|
|
2568
2650
|
if (!phone2.phoneNumber) return "";
|
|
2569
2651
|
if (!phone2.countryCode) return phone2.phoneNumber;
|
|
2570
|
-
return
|
|
2652
|
+
return _chunkZW4N6FV7js.formatPhoneForDisplay.call(void 0, phone2);
|
|
2571
2653
|
}
|
|
2572
2654
|
function formatLocation(value, attribute) {
|
|
2573
2655
|
if (typeof value !== "object" || value === null) return String(value);
|
|
@@ -2610,13 +2692,13 @@ function formatLocation(value, attribute) {
|
|
|
2610
2692
|
}
|
|
2611
2693
|
function formatSelect(value, attribute) {
|
|
2612
2694
|
if (typeof value !== "string") return String(value);
|
|
2613
|
-
const option = _optionalChain([attribute, 'access',
|
|
2614
|
-
return _nullishCoalesce(_optionalChain([option, 'optionalAccess',
|
|
2695
|
+
const option = _optionalChain([attribute, 'access', _48 => _48.options, 'optionalAccess', _49 => _49.find, 'call', _50 => _50((o) => o.value === value)]);
|
|
2696
|
+
return _nullishCoalesce(_optionalChain([option, 'optionalAccess', _51 => _51.label]), () => ( String(value)));
|
|
2615
2697
|
}
|
|
2616
2698
|
function formatMultiselect(value, attribute) {
|
|
2617
2699
|
if (!Array.isArray(value)) return String(value);
|
|
2618
2700
|
if (attribute.options) {
|
|
2619
|
-
const labels = value.map((v) => _optionalChain([attribute, 'access',
|
|
2701
|
+
const labels = value.map((v) => _optionalChain([attribute, 'access', _52 => _52.options, 'access', _53 => _53.find, 'call', _54 => _54((o) => o.value === v), 'optionalAccess', _55 => _55.label])).filter(Boolean);
|
|
2620
2702
|
return labels.join(", ");
|
|
2621
2703
|
}
|
|
2622
2704
|
return value.join(", ");
|
|
@@ -2878,7 +2960,7 @@ var AssignExecutor = class {
|
|
|
2878
2960
|
if (!node.targetSlotId) {
|
|
2879
2961
|
errors.push("AssignNode must have a target slot");
|
|
2880
2962
|
}
|
|
2881
|
-
if (!_optionalChain([node, 'access',
|
|
2963
|
+
if (!_optionalChain([node, 'access', _56 => _56.assignments, 'optionalAccess', _57 => _57.length])) {
|
|
2882
2964
|
errors.push("AssignNode must have at least one assignment");
|
|
2883
2965
|
}
|
|
2884
2966
|
if (!node.next) {
|
|
@@ -2898,6 +2980,214 @@ function resolveSource(source, slotValues) {
|
|
|
2898
2980
|
}
|
|
2899
2981
|
}
|
|
2900
2982
|
|
|
2983
|
+
// src/runtime/executors/ai.executor.ts
|
|
2984
|
+
var AIExecutor = class {
|
|
2985
|
+
constructor(actionRegistry) {
|
|
2986
|
+
this.actionRegistry = actionRegistry;
|
|
2987
|
+
this.nodeType = "ai";
|
|
2988
|
+
}
|
|
2989
|
+
async execute(node, ctx) {
|
|
2990
|
+
if (!node.next) {
|
|
2991
|
+
return error("MISSING_NEXT", "AINode must have a 'next' target");
|
|
2992
|
+
}
|
|
2993
|
+
const handler = this.actionRegistry.get(node.action.type);
|
|
2994
|
+
if (!handler) {
|
|
2995
|
+
return error(
|
|
2996
|
+
"UNKNOWN_AI_ACTION",
|
|
2997
|
+
`No handler registered for AI action type: ${node.action.type}`
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
3000
|
+
const result = await handler.execute(node.action, ctx);
|
|
3001
|
+
if (!result.success) {
|
|
3002
|
+
return error("AI_ACTION_FAILED", _nullishCoalesce(result.error, () => ( "AI action failed")), true);
|
|
3003
|
+
}
|
|
3004
|
+
return success(node.next, result.contextUpdates);
|
|
3005
|
+
}
|
|
3006
|
+
validate(node) {
|
|
3007
|
+
const errors = [];
|
|
3008
|
+
if (!node.label) errors.push("AINode must have a label");
|
|
3009
|
+
if (!node.action) errors.push("AINode must have an action");
|
|
3010
|
+
if (!node.next) errors.push("AINode must have a 'next' target");
|
|
3011
|
+
return errors;
|
|
3012
|
+
}
|
|
3013
|
+
};
|
|
3014
|
+
|
|
3015
|
+
// src/runtime/executors/ai-actions/types.ts
|
|
3016
|
+
var AIActionRegistry = class {
|
|
3017
|
+
constructor() {
|
|
3018
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
3019
|
+
}
|
|
3020
|
+
register(handler) {
|
|
3021
|
+
this.handlers.set(handler.actionType, handler);
|
|
3022
|
+
}
|
|
3023
|
+
get(actionType) {
|
|
3024
|
+
return this.handlers.get(actionType);
|
|
3025
|
+
}
|
|
3026
|
+
has(actionType) {
|
|
3027
|
+
return this.handlers.has(actionType);
|
|
3028
|
+
}
|
|
3029
|
+
};
|
|
3030
|
+
|
|
3031
|
+
// src/runtime/executors/ai-actions/document-generation.handler.ts
|
|
3032
|
+
var DocumentGenerationHandler = class {
|
|
3033
|
+
constructor(deps = null) {
|
|
3034
|
+
this.deps = deps;
|
|
3035
|
+
this.actionType = "document-generation";
|
|
3036
|
+
}
|
|
3037
|
+
async execute(action, ctx) {
|
|
3038
|
+
if (!this.deps) {
|
|
3039
|
+
return {
|
|
3040
|
+
success: false,
|
|
3041
|
+
error: "Document generation not configured. Provide sandbox, fileService, and storage in SchemaModule."
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
const { sandbox, fileService, storage } = this.deps;
|
|
3045
|
+
const file2 = await fileService.getFile(action.templateId);
|
|
3046
|
+
if (!file2) {
|
|
3047
|
+
return {
|
|
3048
|
+
success: false,
|
|
3049
|
+
error: `Template file not found: ${action.templateId}`
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
3052
|
+
if (!storage.download) {
|
|
3053
|
+
return {
|
|
3054
|
+
success: false,
|
|
3055
|
+
error: "StorageAdapter.download() not implemented. Required for document generation."
|
|
3056
|
+
};
|
|
3057
|
+
}
|
|
3058
|
+
let templateContent;
|
|
3059
|
+
try {
|
|
3060
|
+
const buffer = await storage.download(file2.storagePath);
|
|
3061
|
+
templateContent = new Uint8Array(buffer);
|
|
3062
|
+
} catch (err) {
|
|
3063
|
+
return {
|
|
3064
|
+
success: false,
|
|
3065
|
+
error: `Failed to download template "${file2.name}": ${err instanceof Error ? err.message : "unknown error"}`
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
3068
|
+
const slotData = {};
|
|
3069
|
+
for (const slotId of action.inputSlotIds) {
|
|
3070
|
+
slotData[slotId] = _nullishCoalesce(ctx.executionContext.slots[slotId], () => ( {}));
|
|
3071
|
+
}
|
|
3072
|
+
const instructions = [
|
|
3073
|
+
"Generate a professional document based on the provided template and data.",
|
|
3074
|
+
_nullishCoalesce(action.aiInstructions, () => ( "")),
|
|
3075
|
+
"",
|
|
3076
|
+
"## Data Context",
|
|
3077
|
+
"```json",
|
|
3078
|
+
JSON.stringify(slotData, null, 2),
|
|
3079
|
+
"```",
|
|
3080
|
+
"",
|
|
3081
|
+
"## Instructions",
|
|
3082
|
+
"1. Unpack the template: python3 /workspace/scripts/office/unpack.py /workspace/template.docx /workspace/unpacked/",
|
|
3083
|
+
"2. Analyze the XML structure in /workspace/unpacked/word/document.xml",
|
|
3084
|
+
"3. Read the data from /workspace/data.json",
|
|
3085
|
+
"4. Modify the XML content using the provided data \u2014 replace placeholders, fill tables, update fields",
|
|
3086
|
+
"5. Pack: python3 /workspace/scripts/office/pack.py /workspace/unpacked/ /workspace/output.docx",
|
|
3087
|
+
"6. Validate: python3 /workspace/scripts/office/validate.py /workspace/output.docx",
|
|
3088
|
+
action.outputFormat === "pdf" ? "7. Convert to PDF: python3 /workspace/scripts/office/convert.py /workspace/output.docx pdf /workspace/" : ""
|
|
3089
|
+
].filter(Boolean).join("\n");
|
|
3090
|
+
const outputPath = action.outputFormat === "pdf" ? "/workspace/output.pdf" : "/workspace/output.docx";
|
|
3091
|
+
try {
|
|
3092
|
+
const result = await sandbox.executeAgent({
|
|
3093
|
+
instructions,
|
|
3094
|
+
template: "stndrds-pdf",
|
|
3095
|
+
inputFiles: [
|
|
3096
|
+
{
|
|
3097
|
+
path: "/workspace/template.docx",
|
|
3098
|
+
content: templateContent
|
|
3099
|
+
},
|
|
3100
|
+
{
|
|
3101
|
+
path: "/workspace/data.json",
|
|
3102
|
+
content: JSON.stringify(slotData, null, 2)
|
|
3103
|
+
}
|
|
3104
|
+
],
|
|
3105
|
+
expectedOutputs: [outputPath],
|
|
3106
|
+
timeoutMs: 6e5,
|
|
3107
|
+
maxIterations: 20
|
|
3108
|
+
});
|
|
3109
|
+
if (!result.success || result.artifacts.length === 0) {
|
|
3110
|
+
return {
|
|
3111
|
+
success: false,
|
|
3112
|
+
error: _nullishCoalesce(result.summary, () => ( "Agent failed to generate document"))
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
const contextUpdates = {};
|
|
3116
|
+
for (const slotId of action.targetSlotIds) {
|
|
3117
|
+
contextUpdates[slotId] = {
|
|
3118
|
+
..._nullishCoalesce(ctx.executionContext.slots[slotId], () => ( {})),
|
|
3119
|
+
_generatedDocuments: result.artifacts.map((a) => ({
|
|
3120
|
+
path: a.path,
|
|
3121
|
+
mimeType: a.mimeType
|
|
3122
|
+
}))
|
|
3123
|
+
};
|
|
3124
|
+
}
|
|
3125
|
+
return { success: true, contextUpdates };
|
|
3126
|
+
} catch (err) {
|
|
3127
|
+
return {
|
|
3128
|
+
success: false,
|
|
3129
|
+
error: err instanceof Error ? err.message : "Document generation failed"
|
|
3130
|
+
};
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
};
|
|
3134
|
+
|
|
3135
|
+
// src/runtime/executors/ai-actions/code-execution.handler.ts
|
|
3136
|
+
var CodeExecutionHandler = class {
|
|
3137
|
+
constructor(sandbox = null) {
|
|
3138
|
+
this.sandbox = sandbox;
|
|
3139
|
+
this.actionType = "code-execution";
|
|
3140
|
+
}
|
|
3141
|
+
async execute(action, ctx) {
|
|
3142
|
+
if (!this.sandbox) {
|
|
3143
|
+
return {
|
|
3144
|
+
success: false,
|
|
3145
|
+
error: "Code execution handler not configured. Inject a SandboxExecutor via constructor."
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
const env = {};
|
|
3149
|
+
for (const slotId of _nullishCoalesce(action.inputSlotIds, () => ( []))) {
|
|
3150
|
+
const slotData = _nullishCoalesce(ctx.executionContext.slots[slotId], () => ( {}));
|
|
3151
|
+
env[`SLOT_${slotId.toUpperCase()}`] = JSON.stringify(slotData);
|
|
3152
|
+
}
|
|
3153
|
+
try {
|
|
3154
|
+
const result = await this.sandbox.executeCode({
|
|
3155
|
+
code: action.code,
|
|
3156
|
+
language: action.language,
|
|
3157
|
+
env,
|
|
3158
|
+
packages: action.packages,
|
|
3159
|
+
timeoutMs: 3e4
|
|
3160
|
+
// 30s for code mode
|
|
3161
|
+
});
|
|
3162
|
+
if (result.exitCode !== 0) {
|
|
3163
|
+
return {
|
|
3164
|
+
success: false,
|
|
3165
|
+
error: `Code execution failed (exit ${result.exitCode}): ${result.stderr}`
|
|
3166
|
+
};
|
|
3167
|
+
}
|
|
3168
|
+
const contextUpdates = {};
|
|
3169
|
+
if (action.outputVariable) {
|
|
3170
|
+
contextUpdates[action.outputVariable] = result.stdout.trim();
|
|
3171
|
+
}
|
|
3172
|
+
return { success: true, contextUpdates };
|
|
3173
|
+
} catch (err) {
|
|
3174
|
+
return {
|
|
3175
|
+
success: false,
|
|
3176
|
+
error: err instanceof Error ? err.message : "Code execution failed"
|
|
3177
|
+
};
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
|
|
3182
|
+
// src/runtime/executors/ai-actions/index.ts
|
|
3183
|
+
function createDefaultAIActionRegistry(deps) {
|
|
3184
|
+
const registry2 = new AIActionRegistry();
|
|
3185
|
+
const docGenDeps = _optionalChain([deps, 'optionalAccess', _58 => _58.sandbox]) && _optionalChain([deps, 'optionalAccess', _59 => _59.fileService]) && _optionalChain([deps, 'optionalAccess', _60 => _60.storage]) ? { sandbox: deps.sandbox, fileService: deps.fileService, storage: deps.storage } : null;
|
|
3186
|
+
registry2.register(new DocumentGenerationHandler(docGenDeps));
|
|
3187
|
+
registry2.register(new CodeExecutionHandler(_nullishCoalesce(_optionalChain([deps, 'optionalAccess', _61 => _61.sandbox]), () => ( null))));
|
|
3188
|
+
return registry2;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
2901
3191
|
// src/runtime/executors/start.executor.ts
|
|
2902
3192
|
var StartExecutor = class {
|
|
2903
3193
|
constructor() {
|
|
@@ -3184,7 +3474,7 @@ async function parsePath(path, startSchema, getSchema, maxDepth = 5) {
|
|
|
3184
3474
|
}
|
|
3185
3475
|
if (attr.type === "relation") {
|
|
3186
3476
|
const relationAttr = attr;
|
|
3187
|
-
const targetObject = _optionalChain([relationAttr, 'access',
|
|
3477
|
+
const targetObject = _optionalChain([relationAttr, 'access', _62 => _62.targets, 'access', _63 => _63[0], 'optionalAccess', _64 => _64.object]);
|
|
3188
3478
|
if (!targetObject) {
|
|
3189
3479
|
throw new InvalidPathError(path, segmentName, "Relation has no target object");
|
|
3190
3480
|
}
|
|
@@ -3247,7 +3537,7 @@ function getRelationPath(path) {
|
|
|
3247
3537
|
|
|
3248
3538
|
// src/runtime/formula/path-traversal.ts
|
|
3249
3539
|
async function traversePath(record, path, startSchemaName, adapter, getSchema, options) {
|
|
3250
|
-
const maxDepth = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3540
|
+
const maxDepth = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _65 => _65.maxDepth]), () => ( 5));
|
|
3251
3541
|
const startSchema = await getSchema(startSchemaName);
|
|
3252
3542
|
if (!startSchema) {
|
|
3253
3543
|
return { values: [], recordCounts: [0] };
|
|
@@ -3343,12 +3633,12 @@ function createMockAIConversationsRepository(stores) {
|
|
|
3343
3633
|
const userId = requireUserId();
|
|
3344
3634
|
let results = Array.from(stores.aiConversations.values()).filter((c) => {
|
|
3345
3635
|
if (c.tenantId !== tenantId || c.userId !== userId) return false;
|
|
3346
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
3636
|
+
if (!_optionalChain([options, 'optionalAccess', _66 => _66.includeDeleted]) && c.deletedAt) return false;
|
|
3347
3637
|
return true;
|
|
3348
3638
|
});
|
|
3349
3639
|
results.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
3350
3640
|
const total = results.length;
|
|
3351
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3641
|
+
if (_optionalChain([options, 'optionalAccess', _67 => _67.limit])) {
|
|
3352
3642
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
3353
3643
|
}
|
|
3354
3644
|
return Promise.resolve({ conversations: results, total });
|
|
@@ -3358,7 +3648,7 @@ function createMockAIConversationsRepository(stores) {
|
|
|
3358
3648
|
const userId = requireUserId();
|
|
3359
3649
|
const now = /* @__PURE__ */ new Date();
|
|
3360
3650
|
const conversation = {
|
|
3361
|
-
id:
|
|
3651
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
3362
3652
|
tenantId,
|
|
3363
3653
|
userId,
|
|
3364
3654
|
title: _nullishCoalesce(data.title, () => ( null)),
|
|
@@ -3403,7 +3693,7 @@ function createMockAIConversationsRepository(stores) {
|
|
|
3403
3693
|
return Promise.reject(new Error("Conversation not found or access denied"));
|
|
3404
3694
|
}
|
|
3405
3695
|
const message = {
|
|
3406
|
-
id:
|
|
3696
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
3407
3697
|
conversationId: input.conversationId,
|
|
3408
3698
|
role: input.role,
|
|
3409
3699
|
content: input.content,
|
|
@@ -3438,7 +3728,7 @@ function createMockAIConversationsRepository(stores) {
|
|
|
3438
3728
|
}
|
|
3439
3729
|
let results = Array.from(stores.aiMessages.values()).filter((m) => m.conversationId === conversationId).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
3440
3730
|
const total = results.length;
|
|
3441
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3731
|
+
if (_optionalChain([options, 'optionalAccess', _68 => _68.limit])) {
|
|
3442
3732
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
3443
3733
|
}
|
|
3444
3734
|
return Promise.resolve({ messages: results, total });
|
|
@@ -3470,24 +3760,24 @@ function createMockAIUsageMetricsRepository(stores) {
|
|
|
3470
3760
|
const now = /* @__PURE__ */ new Date();
|
|
3471
3761
|
const key = getDateKey(now);
|
|
3472
3762
|
const existing = stores.aiUsageMetrics.get(key);
|
|
3473
|
-
const providerBreakdown = _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3763
|
+
const providerBreakdown = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _69 => _69.providerBreakdown]), () => ( {}));
|
|
3474
3764
|
if (!providerBreakdown[data.provider]) {
|
|
3475
3765
|
providerBreakdown[data.provider] = { requests: 0, tokens: 0, cost: 0 };
|
|
3476
3766
|
}
|
|
3477
3767
|
providerBreakdown[data.provider].requests++;
|
|
3478
3768
|
providerBreakdown[data.provider].tokens += data.tokens;
|
|
3479
3769
|
providerBreakdown[data.provider].cost += data.cost;
|
|
3480
|
-
const toolUsage = _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3770
|
+
const toolUsage = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _70 => _70.toolUsage]), () => ( {}));
|
|
3481
3771
|
if (data.toolName) {
|
|
3482
3772
|
toolUsage[data.toolName] = (_nullishCoalesce(toolUsage[data.toolName], () => ( 0))) + 1;
|
|
3483
3773
|
}
|
|
3484
3774
|
const metrics = {
|
|
3485
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3775
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _71 => _71.id]), () => ( _chunkE6XO2STSjs.generateId.call(void 0, ))),
|
|
3486
3776
|
tenantId,
|
|
3487
3777
|
date: new Date(_nullishCoalesce(now.toISOString().split("T")[0], () => ( now.toISOString()))),
|
|
3488
|
-
requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3489
|
-
totalTokens: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3490
|
-
totalCost: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3778
|
+
requestCount: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _72 => _72.requestCount]), () => ( 0))) + 1,
|
|
3779
|
+
totalTokens: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _73 => _73.totalTokens]), () => ( 0))) + data.tokens,
|
|
3780
|
+
totalCost: (_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _74 => _74.totalCost]), () => ( 0))) + data.cost,
|
|
3491
3781
|
providerBreakdown,
|
|
3492
3782
|
toolUsage
|
|
3493
3783
|
};
|
|
@@ -3540,7 +3830,7 @@ function createMockFilesRepository(stores) {
|
|
|
3540
3830
|
return {
|
|
3541
3831
|
findById(id) {
|
|
3542
3832
|
const file2 = stores.files.get(id);
|
|
3543
|
-
if (_optionalChain([file2, 'optionalAccess',
|
|
3833
|
+
if (_optionalChain([file2, 'optionalAccess', _75 => _75.deletedAt])) return Promise.resolve(null);
|
|
3544
3834
|
return Promise.resolve(_nullishCoalesce(file2, () => ( null)));
|
|
3545
3835
|
},
|
|
3546
3836
|
findByIds(ids) {
|
|
@@ -3550,7 +3840,7 @@ function createMockFilesRepository(stores) {
|
|
|
3550
3840
|
create(data) {
|
|
3551
3841
|
const tenantId = getTenantId();
|
|
3552
3842
|
const file2 = {
|
|
3553
|
-
id:
|
|
3843
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
3554
3844
|
tenantId,
|
|
3555
3845
|
name: data.name,
|
|
3556
3846
|
originalName: data.originalName,
|
|
@@ -3601,10 +3891,10 @@ function createMockFilesRepository(stores) {
|
|
|
3601
3891
|
let results = Array.from(stores.files.values()).filter(
|
|
3602
3892
|
(f) => f.tenantId === tenantId && !f.deletedAt
|
|
3603
3893
|
);
|
|
3604
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3894
|
+
if (_optionalChain([options, 'optionalAccess', _76 => _76.mimeType])) {
|
|
3605
3895
|
results = results.filter((f) => f.mimeType === options.mimeType);
|
|
3606
3896
|
}
|
|
3607
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3897
|
+
if (_optionalChain([options, 'optionalAccess', _77 => _77.limit])) {
|
|
3608
3898
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
3609
3899
|
}
|
|
3610
3900
|
return Promise.resolve(results);
|
|
@@ -3656,7 +3946,7 @@ function createMockObjectsRepository(stores) {
|
|
|
3656
3946
|
create(data) {
|
|
3657
3947
|
const tenantId = getTenantId();
|
|
3658
3948
|
const obj = {
|
|
3659
|
-
id:
|
|
3949
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
3660
3950
|
tenantId,
|
|
3661
3951
|
name: data.name,
|
|
3662
3952
|
label: data.label,
|
|
@@ -3732,7 +4022,7 @@ function createMockObjectsRepository(stores) {
|
|
|
3732
4022
|
}
|
|
3733
4023
|
}
|
|
3734
4024
|
const newObj = {
|
|
3735
|
-
id:
|
|
4025
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
3736
4026
|
tenantId,
|
|
3737
4027
|
name: data.name,
|
|
3738
4028
|
label: data.label,
|
|
@@ -3764,7 +4054,7 @@ function createMockAttributesRepository(stores) {
|
|
|
3764
4054
|
},
|
|
3765
4055
|
create(data) {
|
|
3766
4056
|
const attr = {
|
|
3767
|
-
id:
|
|
4057
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
3768
4058
|
objectId: data.objectId,
|
|
3769
4059
|
name: data.name,
|
|
3770
4060
|
label: data.label,
|
|
@@ -3960,7 +4250,7 @@ var SyncError = class extends SchemaError {
|
|
|
3960
4250
|
constructor(objectName, message, cause) {
|
|
3961
4251
|
super(`Failed to sync object "${objectName}": ${message}`, SchemaErrorCode.SYNC_FAILED, {
|
|
3962
4252
|
objectName,
|
|
3963
|
-
cause: _optionalChain([cause, 'optionalAccess',
|
|
4253
|
+
cause: _optionalChain([cause, 'optionalAccess', _78 => _78.message])
|
|
3964
4254
|
});
|
|
3965
4255
|
this.name = "SyncError";
|
|
3966
4256
|
this.objectName = objectName;
|
|
@@ -4083,7 +4373,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4083
4373
|
create(data) {
|
|
4084
4374
|
const tenantId = getTenantId();
|
|
4085
4375
|
const internal = {
|
|
4086
|
-
id:
|
|
4376
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4087
4377
|
tenantId,
|
|
4088
4378
|
objectId: data.objectId,
|
|
4089
4379
|
label: data.label,
|
|
@@ -4148,7 +4438,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4148
4438
|
(r) => r.tenantId === tenantId && r.objectId === objectId && !r.deletedAt
|
|
4149
4439
|
);
|
|
4150
4440
|
const total = results.length;
|
|
4151
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4441
|
+
if (_optionalChain([options, 'optionalAccess', _79 => _79.limit])) {
|
|
4152
4442
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
4153
4443
|
}
|
|
4154
4444
|
const records = results.map(({ tenantId: _t, ...r }) => r);
|
|
@@ -4164,7 +4454,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4164
4454
|
);
|
|
4165
4455
|
});
|
|
4166
4456
|
const total = results.length;
|
|
4167
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4457
|
+
if (_optionalChain([options, 'optionalAccess', _80 => _80.limit])) {
|
|
4168
4458
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
4169
4459
|
}
|
|
4170
4460
|
const records = results.map(({ tenantId: _t, ...r }) => r);
|
|
@@ -4180,7 +4470,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4180
4470
|
}
|
|
4181
4471
|
}
|
|
4182
4472
|
const allowedObjectIds = /* @__PURE__ */ new Set();
|
|
4183
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4473
|
+
if (_optionalChain([options, 'optionalAccess', _81 => _81.objectNames]) && options.objectNames.length > 0) {
|
|
4184
4474
|
for (const obj of objectsMap.values()) {
|
|
4185
4475
|
if (options.objectNames.includes(obj.name)) {
|
|
4186
4476
|
allowedObjectIds.add(obj.id);
|
|
@@ -4199,7 +4489,7 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4199
4489
|
);
|
|
4200
4490
|
});
|
|
4201
4491
|
const total = matchingRecords.length;
|
|
4202
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4492
|
+
if (_optionalChain([options, 'optionalAccess', _82 => _82.limit])) {
|
|
4203
4493
|
matchingRecords = matchingRecords.slice(
|
|
4204
4494
|
_nullishCoalesce(options.offset, () => ( 0)),
|
|
4205
4495
|
(_nullishCoalesce(options.offset, () => ( 0))) + options.limit
|
|
@@ -4210,11 +4500,11 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4210
4500
|
if (!attributesByObjectId.has(attr.objectId)) {
|
|
4211
4501
|
attributesByObjectId.set(attr.objectId, []);
|
|
4212
4502
|
}
|
|
4213
|
-
_optionalChain([attributesByObjectId, 'access',
|
|
4503
|
+
_optionalChain([attributesByObjectId, 'access', _83 => _83.get, 'call', _84 => _84(attr.objectId), 'optionalAccess', _85 => _85.push, 'call', _86 => _86(attr)]);
|
|
4214
4504
|
}
|
|
4215
4505
|
const results = matchingRecords.map((r) => {
|
|
4216
4506
|
const obj = objectsMap.get(r.objectId);
|
|
4217
|
-
const labelExpression = _nullishCoalesce(_optionalChain([obj, 'optionalAccess',
|
|
4507
|
+
const labelExpression = _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _87 => _87.labelExpression]), () => ( "{{ name }}"));
|
|
4218
4508
|
const dbAttrs = _nullishCoalesce(attributesByObjectId.get(r.objectId), () => ( []));
|
|
4219
4509
|
const attrs = dbAttrs.map((a) => ({
|
|
4220
4510
|
...a.config,
|
|
@@ -4227,8 +4517,8 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4227
4517
|
const enrichedValues = enrichValuesForDisplay(r.values, attrs);
|
|
4228
4518
|
return {
|
|
4229
4519
|
objectId: r.objectId,
|
|
4230
|
-
objectName: _nullishCoalesce(_optionalChain([obj, 'optionalAccess',
|
|
4231
|
-
objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess',
|
|
4520
|
+
objectName: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _88 => _88.name]), () => ( "unknown")),
|
|
4521
|
+
objectLabel: _nullishCoalesce(_optionalChain([obj, 'optionalAccess', _89 => _89.label]), () => ( "Unknown")),
|
|
4232
4522
|
label: renderLabelExpression(labelExpression, enrichedValues),
|
|
4233
4523
|
recordId: r.id,
|
|
4234
4524
|
completionStatus: r.completionStatus,
|
|
@@ -4239,9 +4529,9 @@ function createMockObjectRecordsRepository(stores) {
|
|
|
4239
4529
|
return Promise.resolve({ results, total });
|
|
4240
4530
|
},
|
|
4241
4531
|
globalSearchGrouped(query, options) {
|
|
4242
|
-
const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4532
|
+
const limitPerGroup = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.limitPerGroup]), () => ( 5));
|
|
4243
4533
|
return this.globalSearch(query, {
|
|
4244
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
4534
|
+
objectNames: _optionalChain([options, 'optionalAccess', _91 => _91.objectNames]),
|
|
4245
4535
|
limit: 500,
|
|
4246
4536
|
offset: 0
|
|
4247
4537
|
}).then(({ results }) => {
|
|
@@ -4390,7 +4680,7 @@ function createMockRelationAttributesRepository(stores) {
|
|
|
4390
4680
|
results.push(existing);
|
|
4391
4681
|
} else {
|
|
4392
4682
|
const row = {
|
|
4393
|
-
id:
|
|
4683
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4394
4684
|
tenantId: context.tenantId,
|
|
4395
4685
|
fromObject: item.fromObject,
|
|
4396
4686
|
fromId: item.fromId,
|
|
@@ -4550,7 +4840,7 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4550
4840
|
create(data) {
|
|
4551
4841
|
const tenantId = getTenantId();
|
|
4552
4842
|
const profile = {
|
|
4553
|
-
id:
|
|
4843
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4554
4844
|
tenantId,
|
|
4555
4845
|
authId: data.authId,
|
|
4556
4846
|
email: data.email,
|
|
@@ -4587,7 +4877,7 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4587
4877
|
list(options) {
|
|
4588
4878
|
const tenantId = getTenantId();
|
|
4589
4879
|
let results = Array.from(stores.userProfiles.values()).filter((p) => p.tenantId === tenantId);
|
|
4590
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4880
|
+
if (_optionalChain([options, 'optionalAccess', _92 => _92.limit])) {
|
|
4591
4881
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
4592
4882
|
}
|
|
4593
4883
|
return Promise.resolve(results);
|
|
@@ -4601,7 +4891,7 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4601
4891
|
for (const profile of profiles) {
|
|
4602
4892
|
const roleIds = Array.from(stores.userRoles.values()).filter((ur) => ur.userProfileId === profile.id && ur.tenantId === tenantId).map((ur) => ur.roleId);
|
|
4603
4893
|
const roles = Array.from(stores.roles.values()).filter((r) => roleIds.includes(r.id));
|
|
4604
|
-
if (_optionalChain([filters, 'optionalAccess',
|
|
4894
|
+
if (_optionalChain([filters, 'optionalAccess', _93 => _93.allowedRoles]) && filters.allowedRoles.length > 0) {
|
|
4605
4895
|
const allowed = filters.allowedRoles;
|
|
4606
4896
|
const hasMatchingRole = roles.some((r) => allowed.includes(r.name));
|
|
4607
4897
|
if (!hasMatchingRole) continue;
|
|
@@ -4621,9 +4911,9 @@ function createMockUserProfilesRepository(stores) {
|
|
|
4621
4911
|
invite(data) {
|
|
4622
4912
|
const tenantId = getTenantId();
|
|
4623
4913
|
const profile = {
|
|
4624
|
-
id:
|
|
4914
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4625
4915
|
tenantId,
|
|
4626
|
-
authId: `invited-${
|
|
4916
|
+
authId: `invited-${_chunkE6XO2STSjs.generateId.call(void 0, )}`,
|
|
4627
4917
|
email: data.email,
|
|
4628
4918
|
firstName: data.firstName,
|
|
4629
4919
|
lastName: data.lastName,
|
|
@@ -4658,7 +4948,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4658
4948
|
createRole(input) {
|
|
4659
4949
|
const tenantId = getTenantId();
|
|
4660
4950
|
const role = {
|
|
4661
|
-
id:
|
|
4951
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4662
4952
|
tenantId,
|
|
4663
4953
|
name: input.name,
|
|
4664
4954
|
label: input.label,
|
|
@@ -4685,7 +4975,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4685
4975
|
},
|
|
4686
4976
|
deleteRole(roleId) {
|
|
4687
4977
|
const role = stores.roles.get(roleId);
|
|
4688
|
-
if (_optionalChain([role, 'optionalAccess',
|
|
4978
|
+
if (_optionalChain([role, 'optionalAccess', _94 => _94.system])) {
|
|
4689
4979
|
return Promise.reject(new Error(`Cannot delete system role ${roleId}`));
|
|
4690
4980
|
}
|
|
4691
4981
|
stores.roles.delete(roleId);
|
|
@@ -4713,7 +5003,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4713
5003
|
}
|
|
4714
5004
|
for (const input of permissions) {
|
|
4715
5005
|
const perm = {
|
|
4716
|
-
id:
|
|
5006
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4717
5007
|
roleId,
|
|
4718
5008
|
scope: input.scope,
|
|
4719
5009
|
target: input.target,
|
|
@@ -4738,7 +5028,7 @@ function createMockPermissionsRepository(stores) {
|
|
|
4738
5028
|
}
|
|
4739
5029
|
}
|
|
4740
5030
|
const userRole = {
|
|
4741
|
-
id:
|
|
5031
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
4742
5032
|
userProfileId: input.userProfileId,
|
|
4743
5033
|
roleId: input.roleId,
|
|
4744
5034
|
tenantId: input.tenantId,
|
|
@@ -4851,7 +5141,7 @@ function createMockViewsRepository(stores) {
|
|
|
4851
5141
|
},
|
|
4852
5142
|
create(data) {
|
|
4853
5143
|
const tenantId = getTenantId();
|
|
4854
|
-
const id =
|
|
5144
|
+
const id = _chunkE6XO2STSjs.generateId.call(void 0, );
|
|
4855
5145
|
const now = /* @__PURE__ */ new Date();
|
|
4856
5146
|
const dbView = {
|
|
4857
5147
|
id,
|
|
@@ -4962,7 +5252,7 @@ function createMockViewOverlaysRepository(stores) {
|
|
|
4962
5252
|
},
|
|
4963
5253
|
create(data) {
|
|
4964
5254
|
const tenantId = getTenantId();
|
|
4965
|
-
const id =
|
|
5255
|
+
const id = _chunkE6XO2STSjs.generateId.call(void 0, );
|
|
4966
5256
|
const now = /* @__PURE__ */ new Date();
|
|
4967
5257
|
const overlay = {
|
|
4968
5258
|
id,
|
|
@@ -5094,7 +5384,7 @@ function createMockWorkflowsRepository(stores) {
|
|
|
5094
5384
|
const tenantId = getTenantId();
|
|
5095
5385
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5096
5386
|
const workflow2 = {
|
|
5097
|
-
id:
|
|
5387
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
5098
5388
|
tenant_id: tenantId,
|
|
5099
5389
|
name: data.name,
|
|
5100
5390
|
label: data.label,
|
|
@@ -5193,7 +5483,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5193
5483
|
(i) => i.tenant_id === tenantId
|
|
5194
5484
|
);
|
|
5195
5485
|
const total = results.length;
|
|
5196
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5486
|
+
if (_optionalChain([options, 'optionalAccess', _95 => _95.limit])) {
|
|
5197
5487
|
results = results.slice(_nullishCoalesce(options.offset, () => ( 0)), (_nullishCoalesce(options.offset, () => ( 0))) + options.limit);
|
|
5198
5488
|
}
|
|
5199
5489
|
return Promise.resolve({ instances: results, total });
|
|
@@ -5209,7 +5499,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5209
5499
|
const tenantId = getTenantId();
|
|
5210
5500
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5211
5501
|
const instance = {
|
|
5212
|
-
id:
|
|
5502
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
5213
5503
|
tenant_id: tenantId,
|
|
5214
5504
|
workflow_id: data.workflowId,
|
|
5215
5505
|
workflow_version: data.workflowVersion,
|
|
@@ -5221,7 +5511,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5221
5511
|
pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
|
|
5222
5512
|
error: null,
|
|
5223
5513
|
started_by: data.startedBy,
|
|
5224
|
-
expires_at: _nullishCoalesce(_optionalChain([data, 'access',
|
|
5514
|
+
expires_at: _nullishCoalesce(_optionalChain([data, 'access', _96 => _96.expiresAt, 'optionalAccess', _97 => _97.toISOString, 'call', _98 => _98()]), () => ( null)),
|
|
5225
5515
|
created_at: now,
|
|
5226
5516
|
updated_at: now,
|
|
5227
5517
|
completed_at: null
|
|
@@ -5246,8 +5536,8 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5246
5536
|
history: _nullishCoalesce(data.history, () => ( existing.history)),
|
|
5247
5537
|
pending_action: data.pendingAction !== void 0 ? data.pendingAction : existing.pending_action,
|
|
5248
5538
|
error: data.error !== void 0 ? data.error : existing.error,
|
|
5249
|
-
expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5250
|
-
completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5539
|
+
expires_at: data.expiresAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _99 => _99.expiresAt, 'optionalAccess', _100 => _100.toISOString, 'call', _101 => _101()]), () => ( null)) : existing.expires_at,
|
|
5540
|
+
completed_at: data.completedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _102 => _102.completedAt, 'optionalAccess', _103 => _103.toISOString, 'call', _104 => _104()]), () => ( null)) : existing.completed_at,
|
|
5251
5541
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5252
5542
|
};
|
|
5253
5543
|
stores.workflowInstances.set(id, updated);
|
|
@@ -5280,7 +5570,7 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5280
5570
|
pending_action: _nullishCoalesce(data.pendingAction, () => ( null)),
|
|
5281
5571
|
error: null,
|
|
5282
5572
|
started_by: data.startedBy,
|
|
5283
|
-
expires_at: _nullishCoalesce(_optionalChain([data, 'access',
|
|
5573
|
+
expires_at: _nullishCoalesce(_optionalChain([data, 'access', _105 => _105.expiresAt, 'optionalAccess', _106 => _106.toISOString, 'call', _107 => _107()]), () => ( null)),
|
|
5284
5574
|
created_at: now,
|
|
5285
5575
|
updated_at: now,
|
|
5286
5576
|
completed_at: null
|
|
@@ -5303,13 +5593,13 @@ function createMockWorkflowInstancesRepository(stores) {
|
|
|
5303
5593
|
return slotData.id === recordId;
|
|
5304
5594
|
});
|
|
5305
5595
|
});
|
|
5306
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5596
|
+
if (_optionalChain([options, 'optionalAccess', _108 => _108.status])) {
|
|
5307
5597
|
results = results.filter((i) => i.status === options.status);
|
|
5308
5598
|
}
|
|
5309
5599
|
const total = results.length;
|
|
5310
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5311
|
-
const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
5312
|
-
const end = _optionalChain([options, 'optionalAccess',
|
|
5600
|
+
if (_optionalChain([options, 'optionalAccess', _109 => _109.offset]) !== void 0 || _optionalChain([options, 'optionalAccess', _110 => _110.limit]) !== void 0) {
|
|
5601
|
+
const start = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _111 => _111.offset]), () => ( 0));
|
|
5602
|
+
const end = _optionalChain([options, 'optionalAccess', _112 => _112.limit]) ? start + options.limit : void 0;
|
|
5313
5603
|
results = results.slice(start, end);
|
|
5314
5604
|
}
|
|
5315
5605
|
return Promise.resolve({ instances: results, total });
|
|
@@ -5343,7 +5633,7 @@ function createMockWorkflowInvitationsRepository(stores) {
|
|
|
5343
5633
|
const tenantId = getTenantId();
|
|
5344
5634
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5345
5635
|
const invitation = {
|
|
5346
|
-
id:
|
|
5636
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
5347
5637
|
tenant_id: tenantId,
|
|
5348
5638
|
instance_id: data.instanceId,
|
|
5349
5639
|
recipient_email: data.recipientEmail,
|
|
@@ -5369,7 +5659,7 @@ function createMockWorkflowInvitationsRepository(stores) {
|
|
|
5369
5659
|
const updated = {
|
|
5370
5660
|
...existing,
|
|
5371
5661
|
status: _nullishCoalesce(data.status, () => ( existing.status)),
|
|
5372
|
-
accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5662
|
+
accepted_at: data.acceptedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _113 => _113.acceptedAt, 'optionalAccess', _114 => _114.toISOString, 'call', _115 => _115()]), () => ( null)) : existing.accepted_at,
|
|
5373
5663
|
expires_at: data.expiresAt !== void 0 ? data.expiresAt.toISOString() : existing.expires_at
|
|
5374
5664
|
};
|
|
5375
5665
|
stores.workflowInvitations.set(id, updated);
|
|
@@ -5411,7 +5701,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
|
|
|
5411
5701
|
const tenantId = getTenantId();
|
|
5412
5702
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5413
5703
|
const grant = {
|
|
5414
|
-
id:
|
|
5704
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
5415
5705
|
tenant_id: tenantId,
|
|
5416
5706
|
invitation_id: data.invitationId,
|
|
5417
5707
|
instance_id: data.instanceId,
|
|
@@ -5439,7 +5729,7 @@ function createMockWorkflowAccessGrantsRepository(stores) {
|
|
|
5439
5729
|
...existing,
|
|
5440
5730
|
last_used_at: data.lastUsedAt !== void 0 ? data.lastUsedAt.toISOString() : existing.last_used_at,
|
|
5441
5731
|
revoked_token_jtis: _nullishCoalesce(data.revokedTokenJtis, () => ( existing.revoked_token_jtis)),
|
|
5442
|
-
revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access',
|
|
5732
|
+
revoked_at: data.revokedAt !== void 0 ? _nullishCoalesce(_optionalChain([data, 'access', _116 => _116.revokedAt, 'optionalAccess', _117 => _117.toISOString, 'call', _118 => _118()]), () => ( null)) : existing.revoked_at
|
|
5443
5733
|
};
|
|
5444
5734
|
stores.workflowAccessGrants.set(id, updated);
|
|
5445
5735
|
return Promise.resolve(updated);
|
|
@@ -5660,7 +5950,7 @@ var BaseService = class {
|
|
|
5660
5950
|
* @param key - Cache key to invalidate
|
|
5661
5951
|
*/
|
|
5662
5952
|
async invalidateCache(key) {
|
|
5663
|
-
await _optionalChain([this, 'access',
|
|
5953
|
+
await _optionalChain([this, 'access', _119 => _119.cache, 'optionalAccess', _120 => _120.delete, 'call', _121 => _121(key)]);
|
|
5664
5954
|
}
|
|
5665
5955
|
/**
|
|
5666
5956
|
* Invalidate all cache keys matching a pattern.
|
|
@@ -5668,7 +5958,7 @@ var BaseService = class {
|
|
|
5668
5958
|
* @param pattern - Glob-style pattern (e.g., "schema:tenant-123:*")
|
|
5669
5959
|
*/
|
|
5670
5960
|
async invalidateCachePattern(pattern) {
|
|
5671
|
-
await _optionalChain([this, 'access',
|
|
5961
|
+
await _optionalChain([this, 'access', _122 => _122.cache, 'optionalAccess', _123 => _123.deletePattern, 'call', _124 => _124(pattern)]);
|
|
5672
5962
|
}
|
|
5673
5963
|
/**
|
|
5674
5964
|
* Invalidate all cached lists for a resource.
|
|
@@ -5822,6 +6112,9 @@ var FORBIDDEN_PROPERTY_TYPES = [
|
|
|
5822
6112
|
"document",
|
|
5823
6113
|
"richtext"
|
|
5824
6114
|
];
|
|
6115
|
+
function hasOptions2(attr) {
|
|
6116
|
+
return attr.type === "select" || attr.type === "status" || attr.type === "multiselect";
|
|
6117
|
+
}
|
|
5825
6118
|
|
|
5826
6119
|
// src/builders/attribute-validators.ts
|
|
5827
6120
|
|
|
@@ -5895,17 +6188,17 @@ function validateOptions(options, attributeName) {
|
|
|
5895
6188
|
const ids = /* @__PURE__ */ new Set();
|
|
5896
6189
|
const values = /* @__PURE__ */ new Set();
|
|
5897
6190
|
for (const option of options) {
|
|
5898
|
-
if (!_optionalChain([option, 'access',
|
|
6191
|
+
if (!_optionalChain([option, 'access', _125 => _125.id, 'optionalAccess', _126 => _126.trim, 'call', _127 => _127()])) {
|
|
5899
6192
|
throw new Error(
|
|
5900
6193
|
`[AttributeBuilder] Option in "${attributeName}" has an empty or missing id.`
|
|
5901
6194
|
);
|
|
5902
6195
|
}
|
|
5903
|
-
if (!_optionalChain([option, 'access',
|
|
6196
|
+
if (!_optionalChain([option, 'access', _128 => _128.value, 'optionalAccess', _129 => _129.trim, 'call', _130 => _130()])) {
|
|
5904
6197
|
throw new Error(
|
|
5905
6198
|
`[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing value.`
|
|
5906
6199
|
);
|
|
5907
6200
|
}
|
|
5908
|
-
if (!_optionalChain([option, 'access',
|
|
6201
|
+
if (!_optionalChain([option, 'access', _131 => _131.label, 'optionalAccess', _132 => _132.trim, 'call', _133 => _133()])) {
|
|
5909
6202
|
throw new Error(
|
|
5910
6203
|
`[AttributeBuilder] Option "${option.id}" in "${attributeName}" has an empty or missing label.`
|
|
5911
6204
|
);
|
|
@@ -5926,6 +6219,20 @@ function validateOptions(options, attributeName) {
|
|
|
5926
6219
|
validateIconName(option.icon, `option "${option.id}" of "${attributeName}"`);
|
|
5927
6220
|
}
|
|
5928
6221
|
}
|
|
6222
|
+
for (const option of options) {
|
|
6223
|
+
if (option.inverse === void 0) continue;
|
|
6224
|
+
const inverseOption = options.find((o) => o.value === option.inverse);
|
|
6225
|
+
if (!inverseOption) {
|
|
6226
|
+
throw new Error(
|
|
6227
|
+
`[AttributeBuilder] Option "${option.value}" in "${attributeName}" has inverse "${option.inverse}" which does not match any option value.`
|
|
6228
|
+
);
|
|
6229
|
+
}
|
|
6230
|
+
if (inverseOption.inverse !== option.value) {
|
|
6231
|
+
throw new Error(
|
|
6232
|
+
`[AttributeBuilder] Inverse mismatch in "${attributeName}": "${option.value}" points to "${option.inverse}", but "${option.inverse}" points to "${_nullishCoalesce(inverseOption.inverse, () => ( "(none)"))}". Inverse pairs must be symmetric.`
|
|
6233
|
+
);
|
|
6234
|
+
}
|
|
6235
|
+
}
|
|
5929
6236
|
}
|
|
5930
6237
|
|
|
5931
6238
|
// src/builders/attribute-builders.ts
|
|
@@ -6003,8 +6310,8 @@ var BaseAttributeBuilder = class {
|
|
|
6003
6310
|
featureGate(flagName, options) {
|
|
6004
6311
|
this.attr.featureGate = {
|
|
6005
6312
|
flag: flagName,
|
|
6006
|
-
expectedValue: _optionalChain([options, 'optionalAccess',
|
|
6007
|
-
fallback: _optionalChain([options, 'optionalAccess',
|
|
6313
|
+
expectedValue: _optionalChain([options, 'optionalAccess', _134 => _134.expectedValue]),
|
|
6314
|
+
fallback: _optionalChain([options, 'optionalAccess', _135 => _135.fallback])
|
|
6008
6315
|
};
|
|
6009
6316
|
return this;
|
|
6010
6317
|
}
|
|
@@ -6447,7 +6754,7 @@ var BaseRelationAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
6447
6754
|
object: objectName,
|
|
6448
6755
|
...options
|
|
6449
6756
|
};
|
|
6450
|
-
_optionalChain([this, 'access',
|
|
6757
|
+
_optionalChain([this, 'access', _136 => _136.attr, 'access', _137 => _137.targets, 'optionalAccess', _138 => _138.push, 'call', _139 => _139(target)]);
|
|
6451
6758
|
return this;
|
|
6452
6759
|
}
|
|
6453
6760
|
/**
|
|
@@ -6559,9 +6866,9 @@ var MultiRelationAttributeBuilder = class extends BaseRelationAttributeBuilder {
|
|
|
6559
6866
|
constructor(name, label, initOptions) {
|
|
6560
6867
|
super("relation", name, label);
|
|
6561
6868
|
this.attr.cardinality = "many";
|
|
6562
|
-
this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess',
|
|
6869
|
+
this.attr.targets = _nullishCoalesce(_optionalChain([initOptions, 'optionalAccess', _140 => _140.targets]), () => ( []));
|
|
6563
6870
|
this.attr.defaultValue = [];
|
|
6564
|
-
if (_optionalChain([initOptions, 'optionalAccess',
|
|
6871
|
+
if (_optionalChain([initOptions, 'optionalAccess', _141 => _141.isRequired])) {
|
|
6565
6872
|
this.setRequired(true);
|
|
6566
6873
|
}
|
|
6567
6874
|
}
|
|
@@ -6993,7 +7300,7 @@ var GroupBuilder = class {
|
|
|
6993
7300
|
*/
|
|
6994
7301
|
fields(...names) {
|
|
6995
7302
|
for (const name of names) {
|
|
6996
|
-
_optionalChain([this, 'access',
|
|
7303
|
+
_optionalChain([this, 'access', _142 => _142.data, 'access', _143 => _143.fields, 'optionalAccess', _144 => _144.push, 'call', _145 => _145({ attribute: name })]);
|
|
6997
7304
|
}
|
|
6998
7305
|
return this;
|
|
6999
7306
|
}
|
|
@@ -7002,7 +7309,7 @@ var GroupBuilder = class {
|
|
|
7002
7309
|
* @example .field("name", { span: 8, readOnly: true })
|
|
7003
7310
|
*/
|
|
7004
7311
|
field(attribute, options) {
|
|
7005
|
-
_optionalChain([this, 'access',
|
|
7312
|
+
_optionalChain([this, 'access', _146 => _146.data, 'access', _147 => _147.fields, 'optionalAccess', _148 => _148.push, 'call', _149 => _149({ attribute, ...options })]);
|
|
7006
7313
|
return this;
|
|
7007
7314
|
}
|
|
7008
7315
|
/**
|
|
@@ -7011,7 +7318,7 @@ var GroupBuilder = class {
|
|
|
7011
7318
|
* @example .attributeGroup({ id: "address", label: "Address", attributes: ["street", "city", "postal_code"], displayTemplate: "{street}, {city}" })
|
|
7012
7319
|
*/
|
|
7013
7320
|
attributeGroup(config, options) {
|
|
7014
|
-
_optionalChain([this, 'access',
|
|
7321
|
+
_optionalChain([this, 'access', _150 => _150.data, 'access', _151 => _151.fields, 'optionalAccess', _152 => _152.push, 'call', _153 => _153({ attributeGroup: config, ...options })]);
|
|
7015
7322
|
return this;
|
|
7016
7323
|
}
|
|
7017
7324
|
/**
|
|
@@ -7859,7 +8166,7 @@ var ListViewBuilder = class {
|
|
|
7859
8166
|
}
|
|
7860
8167
|
const config = {
|
|
7861
8168
|
defaultFilters: this.data.defaultFilters ? {
|
|
7862
|
-
id:
|
|
8169
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
7863
8170
|
combinator: this.data.defaultFilters.combinator,
|
|
7864
8171
|
rules: this.data.defaultFilters.rules
|
|
7865
8172
|
} : void 0,
|
|
@@ -7872,7 +8179,7 @@ var ListViewBuilder = class {
|
|
|
7872
8179
|
columns: tab.columns,
|
|
7873
8180
|
columnSizing: tab.columnSizing,
|
|
7874
8181
|
filters: tab.filters ? {
|
|
7875
|
-
id:
|
|
8182
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
7876
8183
|
combinator: tab.filters.combinator,
|
|
7877
8184
|
rules: tab.filters.rules
|
|
7878
8185
|
} : void 0,
|
|
@@ -7880,7 +8187,10 @@ var ListViewBuilder = class {
|
|
|
7880
8187
|
groupByAttribute: tab.groupByAttribute,
|
|
7881
8188
|
cardUserAttribute: tab.cardUserAttribute,
|
|
7882
8189
|
cardDateAttribute: tab.cardDateAttribute,
|
|
7883
|
-
createMode: tab.createMode
|
|
8190
|
+
createMode: tab.createMode,
|
|
8191
|
+
kanbanColumnOrder: tab.kanbanColumnOrder,
|
|
8192
|
+
kanbanColumnVisibility: tab.kanbanColumnVisibility,
|
|
8193
|
+
kanbanPinnedColumns: tab.kanbanPinnedColumns
|
|
7884
8194
|
}))
|
|
7885
8195
|
};
|
|
7886
8196
|
return {
|
|
@@ -7969,6 +8279,34 @@ var ListViewTabConfigBuilder = class _ListViewTabConfigBuilder {
|
|
|
7969
8279
|
this.tabData.cardDateAttribute = attributeName;
|
|
7970
8280
|
return this;
|
|
7971
8281
|
}
|
|
8282
|
+
/**
|
|
8283
|
+
* Set the order of kanban columns by option values (for kanban layout only)
|
|
8284
|
+
* @param order - Array of option values in desired order
|
|
8285
|
+
* @example .kanbanColumnOrder(["new", "in_progress", "done"])
|
|
8286
|
+
*/
|
|
8287
|
+
kanbanColumnOrder(order) {
|
|
8288
|
+
this.tabData.kanbanColumnOrder = order;
|
|
8289
|
+
return this;
|
|
8290
|
+
}
|
|
8291
|
+
/**
|
|
8292
|
+
* Set the visibility of kanban columns by option values (for kanban layout only)
|
|
8293
|
+
* @param visibility - Record mapping option values to visibility (true = visible, false = hidden)
|
|
8294
|
+
* @example .kanbanColumnVisibility({ "new": true, "archived": false })
|
|
8295
|
+
*/
|
|
8296
|
+
kanbanColumnVisibility(visibility) {
|
|
8297
|
+
this.tabData.kanbanColumnVisibility = visibility;
|
|
8298
|
+
return this;
|
|
8299
|
+
}
|
|
8300
|
+
/**
|
|
8301
|
+
* Set pinned kanban columns by option values (for kanban layout only)
|
|
8302
|
+
* Pinned columns remain fixed during horizontal scrolling
|
|
8303
|
+
* @param pinnedColumns - Array of option values to pin
|
|
8304
|
+
* @example .kanbanPinnedColumns(["new", "done"])
|
|
8305
|
+
*/
|
|
8306
|
+
kanbanPinnedColumns(pinnedColumns) {
|
|
8307
|
+
this.tabData.kanbanPinnedColumns = pinnedColumns;
|
|
8308
|
+
return this;
|
|
8309
|
+
}
|
|
7972
8310
|
/**
|
|
7973
8311
|
* Set creation behavior when clicking "+"
|
|
7974
8312
|
* @param mode - "redirect" (navigate to detail), "inline" (empty row), or "modal" (stacked modal)
|
|
@@ -8079,8 +8417,33 @@ var WorkflowFormRowBuilder = class {
|
|
|
8079
8417
|
id: `${this.rowData.id}-${slotId}-${attribute}`,
|
|
8080
8418
|
slotId,
|
|
8081
8419
|
attribute,
|
|
8082
|
-
label: _optionalChain([options, 'optionalAccess',
|
|
8083
|
-
required: _optionalChain([options, 'optionalAccess',
|
|
8420
|
+
label: _optionalChain([options, 'optionalAccess', _154 => _154.label]),
|
|
8421
|
+
required: _optionalChain([options, 'optionalAccess', _155 => _155.required])
|
|
8422
|
+
};
|
|
8423
|
+
this.rowData.fields.push(field);
|
|
8424
|
+
return this;
|
|
8425
|
+
}
|
|
8426
|
+
/**
|
|
8427
|
+
* Add a relation field to the current row.
|
|
8428
|
+
* Use this for relation attributes that need specific configuration
|
|
8429
|
+
* (e.g., which qualified properties to display).
|
|
8430
|
+
*
|
|
8431
|
+
* @param slotId - The slot containing the relation attribute
|
|
8432
|
+
* @param attribute - The relation attribute name
|
|
8433
|
+
* @param options - Optional label, required flag, and relation config
|
|
8434
|
+
*/
|
|
8435
|
+
relationField(slotId, attribute, options) {
|
|
8436
|
+
const relationConfig = _optionalChain([options, 'optionalAccess', _156 => _156.visibleProperties]) || _optionalChain([options, 'optionalAccess', _157 => _157.allowCreate]) !== void 0 ? {
|
|
8437
|
+
visibleProperties: _optionalChain([options, 'optionalAccess', _158 => _158.visibleProperties]),
|
|
8438
|
+
allowCreate: _optionalChain([options, 'optionalAccess', _159 => _159.allowCreate])
|
|
8439
|
+
} : void 0;
|
|
8440
|
+
const field = {
|
|
8441
|
+
id: `${this.rowData.id}-${slotId}-${attribute}`,
|
|
8442
|
+
slotId,
|
|
8443
|
+
attribute,
|
|
8444
|
+
label: _optionalChain([options, 'optionalAccess', _160 => _160.label]),
|
|
8445
|
+
required: _optionalChain([options, 'optionalAccess', _161 => _161.required]),
|
|
8446
|
+
relationConfig
|
|
8084
8447
|
};
|
|
8085
8448
|
this.rowData.fields.push(field);
|
|
8086
8449
|
return this;
|
|
@@ -8091,6 +8454,24 @@ var WorkflowFormRowBuilder = class {
|
|
|
8091
8454
|
row(id) {
|
|
8092
8455
|
return this.formBuilder._finalizeRow(this.rowData).row(id);
|
|
8093
8456
|
}
|
|
8457
|
+
/**
|
|
8458
|
+
* Add a heading row (finalizes the current field row first)
|
|
8459
|
+
*/
|
|
8460
|
+
heading(content, level) {
|
|
8461
|
+
return this.formBuilder._finalizeRow(this.rowData).heading(content, level);
|
|
8462
|
+
}
|
|
8463
|
+
/**
|
|
8464
|
+
* Add a visual separator (finalizes the current field row first)
|
|
8465
|
+
*/
|
|
8466
|
+
separator() {
|
|
8467
|
+
return this.formBuilder._finalizeRow(this.rowData).separator();
|
|
8468
|
+
}
|
|
8469
|
+
/**
|
|
8470
|
+
* Add a static text row (finalizes the current field row first)
|
|
8471
|
+
*/
|
|
8472
|
+
text(content) {
|
|
8473
|
+
return this.formBuilder._finalizeRow(this.rowData).text(content);
|
|
8474
|
+
}
|
|
8094
8475
|
/**
|
|
8095
8476
|
* Set the next node and finish this form
|
|
8096
8477
|
*/
|
|
@@ -8121,13 +8502,56 @@ var WorkflowFormBuilder = class {
|
|
|
8121
8502
|
this.rowOrder++;
|
|
8122
8503
|
return new WorkflowFormRowBuilder(this, id, this.rowOrder);
|
|
8123
8504
|
}
|
|
8505
|
+
/**
|
|
8506
|
+
* Add a heading row to the form
|
|
8507
|
+
*/
|
|
8508
|
+
heading(content, level) {
|
|
8509
|
+
this.rowOrder++;
|
|
8510
|
+
const row = {
|
|
8511
|
+
id: `heading-${this.rowOrder}`,
|
|
8512
|
+
order: this.rowOrder,
|
|
8513
|
+
type: "heading",
|
|
8514
|
+
content,
|
|
8515
|
+
level
|
|
8516
|
+
};
|
|
8517
|
+
this.rows.push(row);
|
|
8518
|
+
return this;
|
|
8519
|
+
}
|
|
8520
|
+
/**
|
|
8521
|
+
* Add a visual separator row to the form
|
|
8522
|
+
*/
|
|
8523
|
+
separator() {
|
|
8524
|
+
this.rowOrder++;
|
|
8525
|
+
const row = {
|
|
8526
|
+
id: `separator-${this.rowOrder}`,
|
|
8527
|
+
order: this.rowOrder,
|
|
8528
|
+
type: "separator"
|
|
8529
|
+
};
|
|
8530
|
+
this.rows.push(row);
|
|
8531
|
+
return this;
|
|
8532
|
+
}
|
|
8533
|
+
/**
|
|
8534
|
+
* Add a static text row to the form
|
|
8535
|
+
*/
|
|
8536
|
+
text(content) {
|
|
8537
|
+
this.rowOrder++;
|
|
8538
|
+
const row = {
|
|
8539
|
+
id: `text-${this.rowOrder}`,
|
|
8540
|
+
order: this.rowOrder,
|
|
8541
|
+
type: "text",
|
|
8542
|
+
content
|
|
8543
|
+
};
|
|
8544
|
+
this.rows.push(row);
|
|
8545
|
+
return this;
|
|
8546
|
+
}
|
|
8124
8547
|
/**
|
|
8125
8548
|
* Set the next node and complete the form definition
|
|
8126
8549
|
*/
|
|
8127
8550
|
next(nodeId) {
|
|
8128
|
-
|
|
8551
|
+
const hasFieldRows = this.rows.some((r) => !r.type || r.type === "fields");
|
|
8552
|
+
if (!hasFieldRows) {
|
|
8129
8553
|
throw new Error(
|
|
8130
|
-
`[WorkflowBuilder] Form "${this.nodeId}" has no rows. Use .row() to add
|
|
8554
|
+
`[WorkflowBuilder] Form "${this.nodeId}" has no field rows. Use .row() to add fields.`
|
|
8131
8555
|
);
|
|
8132
8556
|
}
|
|
8133
8557
|
return this.workflowBuilder._addFormNode({
|
|
@@ -8178,6 +8602,22 @@ var WorkflowSimpleFormBuilder = class {
|
|
|
8178
8602
|
}
|
|
8179
8603
|
return this;
|
|
8180
8604
|
}
|
|
8605
|
+
/**
|
|
8606
|
+
* Add a relation field with optional configuration.
|
|
8607
|
+
* Use this for relation attributes that need specific configuration
|
|
8608
|
+
* (e.g., which qualified properties to display).
|
|
8609
|
+
*/
|
|
8610
|
+
relationField(slotId, attribute, options) {
|
|
8611
|
+
this.fieldList.push({
|
|
8612
|
+
slotId,
|
|
8613
|
+
attribute,
|
|
8614
|
+
relationConfig: options ? {
|
|
8615
|
+
visibleProperties: options.visibleProperties,
|
|
8616
|
+
allowCreate: options.allowCreate
|
|
8617
|
+
} : void 0
|
|
8618
|
+
});
|
|
8619
|
+
return this;
|
|
8620
|
+
}
|
|
8181
8621
|
/**
|
|
8182
8622
|
* Set the next node and complete the form definition
|
|
8183
8623
|
*/
|
|
@@ -8319,6 +8759,68 @@ var WorkflowAssignBuilder = class {
|
|
|
8319
8759
|
});
|
|
8320
8760
|
}
|
|
8321
8761
|
};
|
|
8762
|
+
var WorkflowAIBuilder = class {
|
|
8763
|
+
/** @internal */
|
|
8764
|
+
constructor(workflowBuilder, nodeId, label) {
|
|
8765
|
+
this.action = null;
|
|
8766
|
+
this.workflowBuilder = workflowBuilder;
|
|
8767
|
+
this.nodeId = nodeId;
|
|
8768
|
+
this.label = label;
|
|
8769
|
+
}
|
|
8770
|
+
/**
|
|
8771
|
+
* Set the description for this AI node
|
|
8772
|
+
*/
|
|
8773
|
+
describe(description) {
|
|
8774
|
+
this.nodeDescription = description;
|
|
8775
|
+
return this;
|
|
8776
|
+
}
|
|
8777
|
+
/**
|
|
8778
|
+
* Set a custom timeout (default: 120_000ms)
|
|
8779
|
+
*/
|
|
8780
|
+
timeout(ms) {
|
|
8781
|
+
this.nodeTimeoutMs = ms;
|
|
8782
|
+
return this;
|
|
8783
|
+
}
|
|
8784
|
+
/**
|
|
8785
|
+
* Configure document generation action
|
|
8786
|
+
*/
|
|
8787
|
+
documentGeneration(config) {
|
|
8788
|
+
this.action = {
|
|
8789
|
+
type: "document-generation",
|
|
8790
|
+
...config
|
|
8791
|
+
};
|
|
8792
|
+
return this;
|
|
8793
|
+
}
|
|
8794
|
+
/**
|
|
8795
|
+
* Configure code execution action
|
|
8796
|
+
*/
|
|
8797
|
+
codeExecution(config) {
|
|
8798
|
+
this.action = {
|
|
8799
|
+
type: "code-execution",
|
|
8800
|
+
...config
|
|
8801
|
+
};
|
|
8802
|
+
return this;
|
|
8803
|
+
}
|
|
8804
|
+
/**
|
|
8805
|
+
* Set the next node and complete the AI node definition
|
|
8806
|
+
*/
|
|
8807
|
+
next(nodeId) {
|
|
8808
|
+
if (!this.action) {
|
|
8809
|
+
throw new Error(
|
|
8810
|
+
`[WorkflowBuilder] AI node "${this.nodeId}" must have an action. Use .documentGeneration() or .codeExecution() first.`
|
|
8811
|
+
);
|
|
8812
|
+
}
|
|
8813
|
+
return this.workflowBuilder._addNode({
|
|
8814
|
+
type: "ai",
|
|
8815
|
+
id: this.nodeId,
|
|
8816
|
+
label: this.label,
|
|
8817
|
+
description: this.nodeDescription,
|
|
8818
|
+
action: this.action,
|
|
8819
|
+
timeoutMs: this.nodeTimeoutMs,
|
|
8820
|
+
next: nodeId
|
|
8821
|
+
});
|
|
8822
|
+
}
|
|
8823
|
+
};
|
|
8322
8824
|
var WorkflowEndBuilder = class {
|
|
8323
8825
|
/** @internal */
|
|
8324
8826
|
constructor(workflowBuilder, nodeId) {
|
|
@@ -8439,7 +8941,7 @@ var WorkflowBuilder = class {
|
|
|
8439
8941
|
* @param options - Slot configuration
|
|
8440
8942
|
*/
|
|
8441
8943
|
slot(id, objectName, options) {
|
|
8442
|
-
if (_optionalChain([this, 'access',
|
|
8944
|
+
if (_optionalChain([this, 'access', _162 => _162.data, 'access', _163 => _163.slots, 'optionalAccess', _164 => _164.some, 'call', _165 => _165((s) => s.id === id)])) {
|
|
8443
8945
|
throw new Error(`[WorkflowBuilder] Duplicate slot id: "${id}"`);
|
|
8444
8946
|
}
|
|
8445
8947
|
const slot = {
|
|
@@ -8450,7 +8952,7 @@ var WorkflowBuilder = class {
|
|
|
8450
8952
|
color: options.color,
|
|
8451
8953
|
icon: options.icon
|
|
8452
8954
|
};
|
|
8453
|
-
_optionalChain([this, 'access',
|
|
8955
|
+
_optionalChain([this, 'access', _166 => _166.data, 'access', _167 => _167.slots, 'optionalAccess', _168 => _168.push, 'call', _169 => _169(slot)]);
|
|
8454
8956
|
return this;
|
|
8455
8957
|
}
|
|
8456
8958
|
// ============================================================================
|
|
@@ -8490,6 +8992,12 @@ var WorkflowBuilder = class {
|
|
|
8490
8992
|
assign(id, label, targetSlotId) {
|
|
8491
8993
|
return new WorkflowAssignBuilder(this, id, label, targetSlotId);
|
|
8492
8994
|
}
|
|
8995
|
+
/**
|
|
8996
|
+
* Define an AI node (run an AI action like document generation or code execution)
|
|
8997
|
+
*/
|
|
8998
|
+
ai(id, label) {
|
|
8999
|
+
return new WorkflowAIBuilder(this, id, label);
|
|
9000
|
+
}
|
|
8493
9001
|
/**
|
|
8494
9002
|
* Define an end node
|
|
8495
9003
|
*/
|
|
@@ -8577,7 +9085,7 @@ var WorkflowBuilder = class {
|
|
|
8577
9085
|
}
|
|
8578
9086
|
}
|
|
8579
9087
|
validateSlotReferences() {
|
|
8580
|
-
const slotIds = _nullishCoalesce(_optionalChain([this, 'access',
|
|
9088
|
+
const slotIds = _nullishCoalesce(_optionalChain([this, 'access', _170 => _170.data, 'access', _171 => _171.slots, 'optionalAccess', _172 => _172.reduce, 'call', _173 => _173((set, s) => set.add(s.id), /* @__PURE__ */ new Set())]), () => ( /* @__PURE__ */ new Set()));
|
|
8581
9089
|
for (const node of Object.values(_nullishCoalesce(this.data.nodes, () => ( {})))) {
|
|
8582
9090
|
for (const slotId of getNodeSlotIds(node)) {
|
|
8583
9091
|
if (!slotIds.has(slotId)) {
|
|
@@ -8869,7 +9377,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
8869
9377
|
constructor(adapter, nativeRegistry, options) {
|
|
8870
9378
|
super(adapter);
|
|
8871
9379
|
this.nativeRegistry = nativeRegistry;
|
|
8872
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
9380
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _174 => _174.auditService]);
|
|
8873
9381
|
this.bilateralValidationService = new BilateralValidationService(adapter, this);
|
|
8874
9382
|
}
|
|
8875
9383
|
/**
|
|
@@ -9112,7 +9620,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9112
9620
|
resourceType: "attribute",
|
|
9113
9621
|
resourceId: attributeId,
|
|
9114
9622
|
resourceLabel: updatedDbAttr.label,
|
|
9115
|
-
objectName: _optionalChain([dbObject, 'optionalAccess',
|
|
9623
|
+
objectName: _optionalChain([dbObject, 'optionalAccess', _175 => _175.name]),
|
|
9116
9624
|
objectId: dbAttr.objectId,
|
|
9117
9625
|
changes
|
|
9118
9626
|
});
|
|
@@ -9123,7 +9631,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9123
9631
|
const schema = await this.getObjectSchema(dbAttr.objectId);
|
|
9124
9632
|
await this.adapter.objectRecords.batchRefreshStatus(
|
|
9125
9633
|
dbAttr.objectId,
|
|
9126
|
-
(values) =>
|
|
9634
|
+
(values) => _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, values)
|
|
9127
9635
|
);
|
|
9128
9636
|
}
|
|
9129
9637
|
return this.convertDBAttributeToAttribute(updatedDbAttr);
|
|
@@ -9145,7 +9653,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9145
9653
|
);
|
|
9146
9654
|
}
|
|
9147
9655
|
const dbObject = await this.adapter.objects.findById(dbAttr.objectId);
|
|
9148
|
-
if (_optionalChain([dbObject, 'optionalAccess',
|
|
9656
|
+
if (_optionalChain([dbObject, 'optionalAccess', _176 => _176.labelExpression])) {
|
|
9149
9657
|
const usedAttributes = extractAttributeNames(dbObject.labelExpression);
|
|
9150
9658
|
if (usedAttributes.includes(dbAttr.name)) {
|
|
9151
9659
|
throw new AttributeInUseError(dbAttr.name, "labelExpression");
|
|
@@ -9161,7 +9669,7 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9161
9669
|
resourceType: "attribute",
|
|
9162
9670
|
resourceId: attributeId,
|
|
9163
9671
|
resourceLabel: dbAttr.label,
|
|
9164
|
-
objectName: _optionalChain([dbObject, 'optionalAccess',
|
|
9672
|
+
objectName: _optionalChain([dbObject, 'optionalAccess', _177 => _177.name]),
|
|
9165
9673
|
objectId: dbAttr.objectId
|
|
9166
9674
|
});
|
|
9167
9675
|
}
|
|
@@ -9176,9 +9684,9 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9176
9684
|
async listAttributes(objectId, options) {
|
|
9177
9685
|
const dbAttributes = await this.adapter.attributes.findByObjectId(objectId);
|
|
9178
9686
|
let filtered = dbAttributes;
|
|
9179
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9687
|
+
if (_optionalChain([options, 'optionalAccess', _178 => _178.systemOnly])) {
|
|
9180
9688
|
filtered = dbAttributes.filter((attr) => attr.system);
|
|
9181
|
-
} else if (_optionalChain([options, 'optionalAccess',
|
|
9689
|
+
} else if (_optionalChain([options, 'optionalAccess', _179 => _179.customOnly])) {
|
|
9182
9690
|
filtered = dbAttributes.filter((attr) => !attr.system);
|
|
9183
9691
|
}
|
|
9184
9692
|
return filtered.map((attr) => this.convertDBAttributeToAttribute(attr));
|
|
@@ -9214,14 +9722,14 @@ var ObjectSchemaService = class extends BaseService {
|
|
|
9214
9722
|
pluralLabel: dbObject.pluralLabel,
|
|
9215
9723
|
description: dbObject.description,
|
|
9216
9724
|
labelExpression: dbObject.labelExpression,
|
|
9217
|
-
icon: _optionalChain([dbObject, 'access',
|
|
9725
|
+
icon: _optionalChain([dbObject, 'access', _180 => _180.metadata, 'optionalAccess', _181 => _181.icon])
|
|
9218
9726
|
};
|
|
9219
9727
|
let metadata = dbObject.metadata;
|
|
9220
9728
|
if (updates.icon !== void 0 || updates.metadata !== void 0) {
|
|
9221
9729
|
metadata = {
|
|
9222
9730
|
...dbObject.metadata,
|
|
9223
9731
|
...updates.metadata,
|
|
9224
|
-
icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access',
|
|
9732
|
+
icon: _nullishCoalesce(updates.icon, () => ( _optionalChain([dbObject, 'access', _182 => _182.metadata, 'optionalAccess', _183 => _183.icon])))
|
|
9225
9733
|
};
|
|
9226
9734
|
}
|
|
9227
9735
|
const updatedDbObject = await this.adapter.objects.update(objectId, {
|
|
@@ -9477,7 +9985,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9477
9985
|
let properties = inverseDbAttr.config.properties;
|
|
9478
9986
|
if (!properties) {
|
|
9479
9987
|
const nativeObj = this.nativeRegistry.getByName(bilateral.object);
|
|
9480
|
-
const nativeAttr = _optionalChain([nativeObj, 'optionalAccess',
|
|
9988
|
+
const nativeAttr = _optionalChain([nativeObj, 'optionalAccess', _184 => _184.attributes, 'access', _185 => _185.find, 'call', _186 => _186((a) => a.name === bilateral.attribute)]);
|
|
9481
9989
|
if (nativeAttr && "properties" in nativeAttr) {
|
|
9482
9990
|
properties = nativeAttr.properties;
|
|
9483
9991
|
}
|
|
@@ -9566,7 +10074,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9566
10074
|
label: dbObject.label,
|
|
9567
10075
|
pluralLabel: dbObject.pluralLabel,
|
|
9568
10076
|
description: dbObject.description,
|
|
9569
|
-
icon: _optionalChain([dbObject, 'access',
|
|
10077
|
+
icon: _optionalChain([dbObject, 'access', _187 => _187.metadata, 'optionalAccess', _188 => _188.icon]),
|
|
9570
10078
|
labelExpression: dbObject.labelExpression,
|
|
9571
10079
|
attributes,
|
|
9572
10080
|
system: dbObject.system,
|
|
@@ -9600,7 +10108,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9600
10108
|
}
|
|
9601
10109
|
}
|
|
9602
10110
|
try {
|
|
9603
|
-
return
|
|
10111
|
+
return _chunkZW4N6FV7js.parseAttributeConfig.call(void 0, attribute.type, configInput);
|
|
9604
10112
|
} catch (error2) {
|
|
9605
10113
|
if (error2 instanceof Error) {
|
|
9606
10114
|
throw new Error(`Invalid config for ${attribute.type} attribute: ${error2.message}`);
|
|
@@ -9666,7 +10174,7 @@ Reserved names: ${RESERVED_ATTRIBUTE_NAMES.join(", ")}`
|
|
|
9666
10174
|
const hasRelationToTarget = attrs.some((attr) => {
|
|
9667
10175
|
if (attr.type !== "relation") return false;
|
|
9668
10176
|
const config = attr.config;
|
|
9669
|
-
return _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
10177
|
+
return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _189 => _189.targets, 'optionalAccess', _190 => _190.some, 'call', _191 => _191((t) => t.object === targetObjectName)]), () => ( false));
|
|
9670
10178
|
});
|
|
9671
10179
|
if (hasRelationToTarget) {
|
|
9672
10180
|
referencing.push(obj.name);
|
|
@@ -9744,7 +10252,7 @@ Native objects must have system=true. Did you forget to call .system() in your b
|
|
|
9744
10252
|
const existing = this.objects.get(object2.name);
|
|
9745
10253
|
throw new Error(
|
|
9746
10254
|
`[NativeObjectRegistry] Duplicate object name "${object2.name}":
|
|
9747
|
-
- Existing: "${_optionalChain([existing, 'optionalAccess',
|
|
10255
|
+
- Existing: "${_optionalChain([existing, 'optionalAccess', _192 => _192.label])}" (id: ${_optionalChain([existing, 'optionalAccess', _193 => _193.id])})
|
|
9748
10256
|
- New: "${object2.label}" (id: ${object2.id})
|
|
9749
10257
|
Please use unique names for each native object.`
|
|
9750
10258
|
);
|
|
@@ -9861,7 +10369,7 @@ var AuditService = class extends BaseService {
|
|
|
9861
10369
|
this.isFlushing = false;
|
|
9862
10370
|
/** Pending flush promise to allow waiting on concurrent flush */
|
|
9863
10371
|
this.flushPromise = null;
|
|
9864
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
10372
|
+
if (_optionalChain([options, 'optionalAccess', _194 => _194.async]) && options.flushIntervalMs) {
|
|
9865
10373
|
this.startFlushTimer();
|
|
9866
10374
|
}
|
|
9867
10375
|
}
|
|
@@ -10059,7 +10567,7 @@ var AuditService = class extends BaseService {
|
|
|
10059
10567
|
return;
|
|
10060
10568
|
}
|
|
10061
10569
|
const resolved = await this.resolveActorEmail(entry);
|
|
10062
|
-
if (_optionalChain([this, 'access',
|
|
10570
|
+
if (_optionalChain([this, 'access', _195 => _195.options, 'optionalAccess', _196 => _196.async])) {
|
|
10063
10571
|
this.buffer.push(resolved);
|
|
10064
10572
|
const batchSize = _nullishCoalesce(this.options.batchSize, () => ( 10));
|
|
10065
10573
|
if (this.buffer.length >= batchSize) {
|
|
@@ -10076,7 +10584,7 @@ var AuditService = class extends BaseService {
|
|
|
10076
10584
|
if (!entry.actorEmail && entry.actorId) {
|
|
10077
10585
|
try {
|
|
10078
10586
|
const profile = await this.adapter.userProfiles.findById(entry.actorId);
|
|
10079
|
-
if (_optionalChain([profile, 'optionalAccess',
|
|
10587
|
+
if (_optionalChain([profile, 'optionalAccess', _197 => _197.email])) {
|
|
10080
10588
|
return { ...entry, actorEmail: profile.email };
|
|
10081
10589
|
}
|
|
10082
10590
|
} catch (e13) {
|
|
@@ -10088,7 +10596,7 @@ var AuditService = class extends BaseService {
|
|
|
10088
10596
|
* Start the flush timer for async mode
|
|
10089
10597
|
*/
|
|
10090
10598
|
startFlushTimer() {
|
|
10091
|
-
const intervalMs = _nullishCoalesce(_optionalChain([this, 'access',
|
|
10599
|
+
const intervalMs = _nullishCoalesce(_optionalChain([this, 'access', _198 => _198.options, 'optionalAccess', _199 => _199.flushIntervalMs]), () => ( 1e3));
|
|
10092
10600
|
this.flushTimer = setInterval(() => {
|
|
10093
10601
|
this.flush().catch(() => {
|
|
10094
10602
|
});
|
|
@@ -10118,7 +10626,7 @@ var browserStub4 = {
|
|
|
10118
10626
|
run: (_store, callback) => callback()
|
|
10119
10627
|
};
|
|
10120
10628
|
var AsyncLocalStorageClass4 = null;
|
|
10121
|
-
if (typeof process !== "undefined" && _optionalChain([process, 'access',
|
|
10629
|
+
if (typeof process !== "undefined" && _optionalChain([process, 'access', _200 => _200.versions, 'optionalAccess', _201 => _201.node])) {
|
|
10122
10630
|
try {
|
|
10123
10631
|
if (typeof _chunk3RG5ZIWIjs.__require !== "undefined") {
|
|
10124
10632
|
const asyncHooks = _chunk3RG5ZIWIjs.__require.call(void 0, "async_hooks");
|
|
@@ -10177,7 +10685,7 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10177
10685
|
}
|
|
10178
10686
|
const ctx = getSyncContext().getStore();
|
|
10179
10687
|
const syncKey = `${sourceSchema.name}:${sourceRecordId}:${attributeName}`;
|
|
10180
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
10688
|
+
if (_optionalChain([ctx, 'optionalAccess', _202 => _202.syncing, 'access', _203 => _203.has, 'call', _204 => _204(syncKey)])) {
|
|
10181
10689
|
return;
|
|
10182
10690
|
}
|
|
10183
10691
|
await this.runWithSyncContext(syncKey, async () => {
|
|
@@ -10210,6 +10718,7 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10210
10718
|
const addedIds = newData.ids.filter((id) => !oldData.ids.includes(id));
|
|
10211
10719
|
const removedIds = oldData.ids.filter((id) => !newData.ids.includes(id));
|
|
10212
10720
|
const commonIds = newData.ids.filter((id) => oldData.ids.includes(id));
|
|
10721
|
+
const inverseMappings = this.buildInverseMappings(sourceAttr);
|
|
10213
10722
|
await Promise.all([
|
|
10214
10723
|
// Add new relations
|
|
10215
10724
|
...addedIds.map(
|
|
@@ -10219,7 +10728,9 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10219
10728
|
sourceRecordId,
|
|
10220
10729
|
sourceSchema.name,
|
|
10221
10730
|
sourceAttr.name,
|
|
10222
|
-
newData.properties.get(targetId)
|
|
10731
|
+
newData.properties.get(targetId),
|
|
10732
|
+
inverseMappings,
|
|
10733
|
+
bilateral
|
|
10223
10734
|
)
|
|
10224
10735
|
),
|
|
10225
10736
|
// Remove deleted relations
|
|
@@ -10235,7 +10746,9 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10235
10746
|
sourceSchema.name,
|
|
10236
10747
|
sourceAttr.name,
|
|
10237
10748
|
newData.properties.get(targetId),
|
|
10238
|
-
oldData.properties.get(targetId)
|
|
10749
|
+
oldData.properties.get(targetId),
|
|
10750
|
+
inverseMappings,
|
|
10751
|
+
bilateral
|
|
10239
10752
|
)
|
|
10240
10753
|
)
|
|
10241
10754
|
]);
|
|
@@ -10279,7 +10792,7 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10279
10792
|
* Add an ID to an inverse relation (with properties).
|
|
10280
10793
|
* @private
|
|
10281
10794
|
*/
|
|
10282
|
-
async addInverseRelation(targetRecordId, inverseAttr, sourceRecordId, sourceObject, sourceAttribute, properties) {
|
|
10795
|
+
async addInverseRelation(targetRecordId, inverseAttr, sourceRecordId, sourceObject, sourceAttribute, properties, inverseMappings, bilateral) {
|
|
10283
10796
|
const targetRecord = await this.adapter.objectRecords.findById(targetRecordId);
|
|
10284
10797
|
if (!targetRecord) {
|
|
10285
10798
|
return;
|
|
@@ -10310,14 +10823,27 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10310
10823
|
this.adapter
|
|
10311
10824
|
);
|
|
10312
10825
|
}
|
|
10826
|
+
if (inverseMappings && bilateral) {
|
|
10827
|
+
const invertedProps = this.invertProperties(properties, inverseMappings);
|
|
10828
|
+
const targetSchemaObj = await this.schemaService.getObjectSchemaByName(bilateral.object);
|
|
10829
|
+
if (targetSchemaObj) {
|
|
10830
|
+
await this.relationPropertiesService.syncRelationProperties(
|
|
10831
|
+
targetSchemaObj,
|
|
10832
|
+
targetRecordId,
|
|
10833
|
+
bilateral.attribute,
|
|
10834
|
+
[{ id: sourceRecordId, props: invertedProps }],
|
|
10835
|
+
this.adapter
|
|
10836
|
+
);
|
|
10837
|
+
}
|
|
10838
|
+
}
|
|
10313
10839
|
}
|
|
10314
10840
|
}
|
|
10315
10841
|
/**
|
|
10316
10842
|
* Update properties of an existing inverse relation.
|
|
10317
10843
|
* @private
|
|
10318
10844
|
*/
|
|
10319
|
-
async updateInverseRelationProperties(targetRecordId, _inverseAttr, sourceRecordId, sourceObject, sourceAttribute, newProperties, oldProperties) {
|
|
10320
|
-
if (
|
|
10845
|
+
async updateInverseRelationProperties(targetRecordId, _inverseAttr, sourceRecordId, sourceObject, sourceAttribute, newProperties, oldProperties, inverseMappings, bilateral) {
|
|
10846
|
+
if (_chunkE6XO2STSjs.deepEqual.call(void 0, newProperties, oldProperties)) {
|
|
10321
10847
|
return;
|
|
10322
10848
|
}
|
|
10323
10849
|
if (!this.adapter.relationAttributes) {
|
|
@@ -10335,12 +10861,32 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10335
10861
|
[{ id: targetRecordId, props: newProperties }],
|
|
10336
10862
|
this.adapter
|
|
10337
10863
|
);
|
|
10864
|
+
if (inverseMappings && bilateral) {
|
|
10865
|
+
const invertedProps = this.invertProperties(newProperties, inverseMappings);
|
|
10866
|
+
const targetSchemaObj = await this.schemaService.getObjectSchemaByName(bilateral.object);
|
|
10867
|
+
if (targetSchemaObj) {
|
|
10868
|
+
await this.relationPropertiesService.syncRelationProperties(
|
|
10869
|
+
targetSchemaObj,
|
|
10870
|
+
targetRecordId,
|
|
10871
|
+
bilateral.attribute,
|
|
10872
|
+
[{ id: sourceRecordId, props: invertedProps }],
|
|
10873
|
+
this.adapter
|
|
10874
|
+
);
|
|
10875
|
+
}
|
|
10876
|
+
}
|
|
10338
10877
|
} else {
|
|
10339
10878
|
await this.adapter.relationAttributes.deleteBySource(
|
|
10340
10879
|
sourceObject,
|
|
10341
10880
|
sourceRecordId,
|
|
10342
10881
|
sourceAttribute
|
|
10343
10882
|
);
|
|
10883
|
+
if (bilateral) {
|
|
10884
|
+
await this.adapter.relationAttributes.deleteBySource(
|
|
10885
|
+
bilateral.object,
|
|
10886
|
+
targetRecordId,
|
|
10887
|
+
bilateral.attribute
|
|
10888
|
+
);
|
|
10889
|
+
}
|
|
10344
10890
|
}
|
|
10345
10891
|
}
|
|
10346
10892
|
/**
|
|
@@ -10372,6 +10918,54 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10372
10918
|
});
|
|
10373
10919
|
await this.invalidateTargetRecordCaches(targetRecordId, targetRecord.objectId);
|
|
10374
10920
|
}
|
|
10921
|
+
/**
|
|
10922
|
+
* Build inverse value mappings from property definitions.
|
|
10923
|
+
* Scans all select/status properties for options with `inverse` field.
|
|
10924
|
+
* @returns Map<propertyName, Map<sourceValue, inverseValue>>
|
|
10925
|
+
* @private
|
|
10926
|
+
*/
|
|
10927
|
+
buildInverseMappings(sourceAttr) {
|
|
10928
|
+
const mappings = /* @__PURE__ */ new Map();
|
|
10929
|
+
const definitions = _optionalChain([sourceAttr, 'access', _205 => _205.properties, 'optionalAccess', _206 => _206.definitions]);
|
|
10930
|
+
if (!definitions) return mappings;
|
|
10931
|
+
for (const def of definitions) {
|
|
10932
|
+
if (!hasOptions2(def)) continue;
|
|
10933
|
+
const options = def.options;
|
|
10934
|
+
const valueMap = /* @__PURE__ */ new Map();
|
|
10935
|
+
for (const option of options) {
|
|
10936
|
+
if (option.inverse) {
|
|
10937
|
+
valueMap.set(option.value, option.inverse);
|
|
10938
|
+
}
|
|
10939
|
+
}
|
|
10940
|
+
if (valueMap.size > 0) {
|
|
10941
|
+
mappings.set(def.name, valueMap);
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
return mappings;
|
|
10945
|
+
}
|
|
10946
|
+
/**
|
|
10947
|
+
* Apply inverse mappings to a set of properties.
|
|
10948
|
+
* Properties without a mapping are copied as-is.
|
|
10949
|
+
* @private
|
|
10950
|
+
*/
|
|
10951
|
+
invertProperties(props, mappings) {
|
|
10952
|
+
const result = {};
|
|
10953
|
+
for (const [key, value] of Object.entries(props)) {
|
|
10954
|
+
const valueMap = mappings.get(key);
|
|
10955
|
+
if (!valueMap) {
|
|
10956
|
+
result[key] = value;
|
|
10957
|
+
} else if (typeof value === "string") {
|
|
10958
|
+
result[key] = _nullishCoalesce(valueMap.get(value), () => ( value));
|
|
10959
|
+
} else if (Array.isArray(value)) {
|
|
10960
|
+
result[key] = value.map(
|
|
10961
|
+
(v) => typeof v === "string" ? _nullishCoalesce(valueMap.get(v), () => ( v)) : v
|
|
10962
|
+
);
|
|
10963
|
+
} else {
|
|
10964
|
+
result[key] = value;
|
|
10965
|
+
}
|
|
10966
|
+
}
|
|
10967
|
+
return result;
|
|
10968
|
+
}
|
|
10375
10969
|
/**
|
|
10376
10970
|
* Normalize a relation value to an array of IDs.
|
|
10377
10971
|
* @private
|
|
@@ -10402,7 +10996,7 @@ var BilateralSyncService = class extends BaseService {
|
|
|
10402
10996
|
const storage = getSyncContext();
|
|
10403
10997
|
const existingCtx = storage.getStore();
|
|
10404
10998
|
const ctx = {
|
|
10405
|
-
syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess',
|
|
10999
|
+
syncing: new Set(_nullishCoalesce(_optionalChain([existingCtx, 'optionalAccess', _207 => _207.syncing]), () => ( [])))
|
|
10406
11000
|
};
|
|
10407
11001
|
ctx.syncing.add(syncKey);
|
|
10408
11002
|
return await storage.run(ctx, fn);
|
|
@@ -10510,7 +11104,7 @@ var UserService = class extends BaseService {
|
|
|
10510
11104
|
if (roleErrors.length > 0) {
|
|
10511
11105
|
errors.push({
|
|
10512
11106
|
attribute: attrName,
|
|
10513
|
-
message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access',
|
|
11107
|
+
message: `Users do not have required role for ${attr.label}. Allowed roles: ${_optionalChain([attr, 'access', _208 => _208.allowedRoles, 'optionalAccess', _209 => _209.join, 'call', _210 => _210(", ")])}`,
|
|
10514
11108
|
invalidIds: roleErrors
|
|
10515
11109
|
});
|
|
10516
11110
|
}
|
|
@@ -11040,7 +11634,7 @@ var RelationPropertiesService = class extends BaseService {
|
|
|
11040
11634
|
}
|
|
11041
11635
|
}
|
|
11042
11636
|
}
|
|
11043
|
-
const shouldStoreAsInverse = _optionalChain([attribute, 'access',
|
|
11637
|
+
const shouldStoreAsInverse = _optionalChain([attribute, 'access', _211 => _211.bilateral, 'optionalAccess', _212 => _212.storageOwner]) === false;
|
|
11044
11638
|
let storageFromObject = schema.name;
|
|
11045
11639
|
let storageFromAttribute = attributeName;
|
|
11046
11640
|
if (shouldStoreAsInverse && attribute.bilateral) {
|
|
@@ -11052,7 +11646,7 @@ var RelationPropertiesService = class extends BaseService {
|
|
|
11052
11646
|
if (shouldStoreAsInverse) {
|
|
11053
11647
|
const results = await Promise.all(
|
|
11054
11648
|
normalized.map(
|
|
11055
|
-
(item) => _optionalChain([adapter, 'access',
|
|
11649
|
+
(item) => _optionalChain([adapter, 'access', _213 => _213.relationAttributes, 'optionalAccess', _214 => _214.findBySource, 'call', _215 => _215(
|
|
11056
11650
|
storageFromObject,
|
|
11057
11651
|
item.id,
|
|
11058
11652
|
storageFromAttribute
|
|
@@ -11179,7 +11773,7 @@ var RelationPropertiesService = class extends BaseService {
|
|
|
11179
11773
|
buildZodSchema(propertySchema) {
|
|
11180
11774
|
const shape = {};
|
|
11181
11775
|
for (const def of propertySchema.definitions) {
|
|
11182
|
-
shape[def.name] =
|
|
11776
|
+
shape[def.name] = _chunkZW4N6FV7js.createFormAttributeValidator.call(void 0, def);
|
|
11183
11777
|
}
|
|
11184
11778
|
return _zod.z.object(shape);
|
|
11185
11779
|
}
|
|
@@ -11191,7 +11785,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11191
11785
|
super(adapter);
|
|
11192
11786
|
this.schemaService = schemaService;
|
|
11193
11787
|
this.options = options;
|
|
11194
|
-
this.policyRegistry = _optionalChain([options, 'optionalAccess',
|
|
11788
|
+
this.policyRegistry = _optionalChain([options, 'optionalAccess', _216 => _216.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _217 => _217.policyRegistry]), () => ( defaultPolicyRegistry));
|
|
11195
11789
|
this.relationPropertiesService = new RelationPropertiesService(adapter);
|
|
11196
11790
|
}
|
|
11197
11791
|
// ============================================================================
|
|
@@ -11242,12 +11836,12 @@ var RecordQueryService = class extends BaseService {
|
|
|
11242
11836
|
* Internal list query execution
|
|
11243
11837
|
*/
|
|
11244
11838
|
async executeListQuery(schema, objectId, options) {
|
|
11245
|
-
if (_optionalChain([this, 'access',
|
|
11839
|
+
if (_optionalChain([this, 'access', _218 => _218.options, 'optionalAccess', _219 => _219.permissionService]) && this.userId) {
|
|
11246
11840
|
await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
|
|
11247
11841
|
}
|
|
11248
|
-
const policy = _optionalChain([options, 'optionalAccess',
|
|
11842
|
+
const policy = _optionalChain([options, 'optionalAccess', _220 => _220.skipPolicyFilter]) ? void 0 : getPolicy(this.policyRegistry, this.userId, schema.name);
|
|
11249
11843
|
let effectiveOptions = options;
|
|
11250
|
-
if (_optionalChain([policy, 'optionalAccess',
|
|
11844
|
+
if (_optionalChain([policy, 'optionalAccess', _221 => _221.applyListFilter]) && this.userId) {
|
|
11251
11845
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
11252
11846
|
effectiveOptions = policy.applyListFilter(ctx, options);
|
|
11253
11847
|
}
|
|
@@ -11257,10 +11851,10 @@ var RecordQueryService = class extends BaseService {
|
|
|
11257
11851
|
);
|
|
11258
11852
|
let filteredRecords = result.records;
|
|
11259
11853
|
let effectiveTotal = result.total;
|
|
11260
|
-
if (_optionalChain([policy, 'optionalAccess',
|
|
11854
|
+
if (_optionalChain([policy, 'optionalAccess', _222 => _222.canAccessRecord]) && this.userId) {
|
|
11261
11855
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
11262
|
-
const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess',
|
|
11263
|
-
const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess',
|
|
11856
|
+
const requestedLimit = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _223 => _223.limit]), () => ( 20));
|
|
11857
|
+
const requestedOffset = _nullishCoalesce(_optionalChain([effectiveOptions, 'optionalAccess', _224 => _224.offset]), () => ( 0));
|
|
11264
11858
|
const overfetchMultiplier = 5;
|
|
11265
11859
|
const batchSize = requestedLimit * overfetchMultiplier;
|
|
11266
11860
|
const maxScanRecords = 1e4;
|
|
@@ -11282,7 +11876,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11282
11876
|
exhausted = true;
|
|
11283
11877
|
break;
|
|
11284
11878
|
}
|
|
11285
|
-
const filtered = batch.records.filter((record) => _optionalChain([policy, 'access',
|
|
11879
|
+
const filtered = batch.records.filter((record) => _optionalChain([policy, 'access', _225 => _225.canAccessRecord, 'optionalCall', _226 => _226(ctx, record)]));
|
|
11286
11880
|
collected.push(...filtered);
|
|
11287
11881
|
dbOffset += batch.records.length;
|
|
11288
11882
|
totalScanned += batch.records.length;
|
|
@@ -11298,7 +11892,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11298
11892
|
filteredRecords,
|
|
11299
11893
|
schema
|
|
11300
11894
|
);
|
|
11301
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11895
|
+
if (!_optionalChain([options, 'optionalAccess', _227 => _227.skipFormulas])) {
|
|
11302
11896
|
return {
|
|
11303
11897
|
records: enrichRecordsWithFormulas(filteredRecords, schema),
|
|
11304
11898
|
total: effectiveTotal
|
|
@@ -11358,17 +11952,17 @@ var RecordQueryService = class extends BaseService {
|
|
|
11358
11952
|
* Internal search query execution
|
|
11359
11953
|
*/
|
|
11360
11954
|
async executeSearchQuery(schema, objectId, query, options) {
|
|
11361
|
-
if (_optionalChain([this, 'access',
|
|
11955
|
+
if (_optionalChain([this, 'access', _228 => _228.options, 'optionalAccess', _229 => _229.permissionService]) && this.userId) {
|
|
11362
11956
|
await checkPermission(this.options.permissionService, this.userId, schema.name, "read");
|
|
11363
11957
|
}
|
|
11364
11958
|
let result;
|
|
11365
11959
|
if (this.adapter.search) {
|
|
11366
11960
|
try {
|
|
11367
11961
|
result = await this.adapter.search.searchRecords(objectId, query, {
|
|
11368
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
11369
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
11370
|
-
sorts: _optionalChain([options, 'optionalAccess',
|
|
11371
|
-
filters: _optionalChain([options, 'optionalAccess',
|
|
11962
|
+
limit: _optionalChain([options, 'optionalAccess', _230 => _230.limit]),
|
|
11963
|
+
offset: _optionalChain([options, 'optionalAccess', _231 => _231.offset]),
|
|
11964
|
+
sorts: _optionalChain([options, 'optionalAccess', _232 => _232.sorts]),
|
|
11965
|
+
filters: _optionalChain([options, 'optionalAccess', _233 => _233.filters]),
|
|
11372
11966
|
attributes: schema.attributes
|
|
11373
11967
|
});
|
|
11374
11968
|
result = await this.healSearchResults(result);
|
|
@@ -11388,7 +11982,7 @@ var RecordQueryService = class extends BaseService {
|
|
|
11388
11982
|
result.records,
|
|
11389
11983
|
schema
|
|
11390
11984
|
);
|
|
11391
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
11985
|
+
if (!_optionalChain([options, 'optionalAccess', _234 => _234.skipFormulas])) {
|
|
11392
11986
|
return {
|
|
11393
11987
|
records: enrichRecordsWithFormulas(enrichedRecords, schema),
|
|
11394
11988
|
total: result.total
|
|
@@ -11597,7 +12191,7 @@ var RelationService = class extends BaseService {
|
|
|
11597
12191
|
}
|
|
11598
12192
|
const isUniversal = attr.targets.length === 1 && attr.targets[0].object === RELATION_TARGET_ANY;
|
|
11599
12193
|
const validObjectIds = isUniversal ? null : await this.getValidObjectIds(attr.targets);
|
|
11600
|
-
if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess',
|
|
12194
|
+
if (!isUniversal && _optionalChain([validObjectIds, 'optionalAccess', _235 => _235.size]) === 0) {
|
|
11601
12195
|
errors.push({
|
|
11602
12196
|
attribute: attr.name,
|
|
11603
12197
|
message: `No valid target objects found for ${attr.label}`
|
|
@@ -11650,7 +12244,7 @@ var RelationService = class extends BaseService {
|
|
|
11650
12244
|
for (const target of targets) {
|
|
11651
12245
|
try {
|
|
11652
12246
|
const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
|
|
11653
|
-
if (_optionalChain([objectSchema, 'optionalAccess',
|
|
12247
|
+
if (_optionalChain([objectSchema, 'optionalAccess', _236 => _236.id])) {
|
|
11654
12248
|
objectIds.add(objectSchema.id);
|
|
11655
12249
|
}
|
|
11656
12250
|
} catch (e17) {
|
|
@@ -11719,7 +12313,7 @@ var RelationService = class extends BaseService {
|
|
|
11719
12313
|
const targetResults = await Promise.all(
|
|
11720
12314
|
filteredTargets.map(async (target) => {
|
|
11721
12315
|
const objectSchema = await this.schemaService.getObjectSchemaByName(target.object);
|
|
11722
|
-
if (!_optionalChain([objectSchema, 'optionalAccess',
|
|
12316
|
+
if (!_optionalChain([objectSchema, 'optionalAccess', _237 => _237.id])) return { options: [], total: 0 };
|
|
11723
12317
|
const objectId = objectSchema.id;
|
|
11724
12318
|
const result = query ? await queryService.searchRecords(objectId, query, queryOptions) : await queryService.listRecords(objectId, queryOptions);
|
|
11725
12319
|
const options = await Promise.all(
|
|
@@ -11876,8 +12470,8 @@ var RelationService = class extends BaseService {
|
|
|
11876
12470
|
continue;
|
|
11877
12471
|
}
|
|
11878
12472
|
const attribute = attributeMap.get(attributeId);
|
|
11879
|
-
const targetConfig = _optionalChain([attribute, 'optionalAccess',
|
|
11880
|
-
const customTemplate = _optionalChain([targetConfig, 'optionalAccess',
|
|
12473
|
+
const targetConfig = _optionalChain([attribute, 'optionalAccess', _238 => _238.targets, 'optionalAccess', _239 => _239.find, 'call', _240 => _240((t) => t.object === objectSchema.name)]);
|
|
12474
|
+
const customTemplate = _optionalChain([targetConfig, 'optionalAccess', _241 => _241.displayTemplate]);
|
|
11881
12475
|
const label = await this.resolveLabel(record, objectSchema, customTemplate);
|
|
11882
12476
|
resolved.push({
|
|
11883
12477
|
_compositeId: compositeId,
|
|
@@ -12040,14 +12634,14 @@ var RollupService = class extends BaseService {
|
|
|
12040
12634
|
const sourceSchema = getSchemaByNameFromContext(sourceObjectName);
|
|
12041
12635
|
let sourceObjectId;
|
|
12042
12636
|
let reverseRelationAttrName;
|
|
12043
|
-
if (_optionalChain([sourceSchema, 'optionalAccess',
|
|
12637
|
+
if (_optionalChain([sourceSchema, 'optionalAccess', _242 => _242.id])) {
|
|
12044
12638
|
sourceObjectId = sourceSchema.id;
|
|
12045
12639
|
const reverseRelationAttr = sourceSchema.attributes.find((attr) => {
|
|
12046
12640
|
if (attr.type !== "relation") return false;
|
|
12047
12641
|
const relationConfig = attr;
|
|
12048
|
-
return _optionalChain([relationConfig, 'optionalAccess',
|
|
12642
|
+
return _optionalChain([relationConfig, 'optionalAccess', _243 => _243.targets, 'optionalAccess', _244 => _244.some, 'call', _245 => _245((t) => t.object === schema.name)]);
|
|
12049
12643
|
});
|
|
12050
|
-
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess',
|
|
12644
|
+
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _246 => _246.name]);
|
|
12051
12645
|
} else {
|
|
12052
12646
|
const sourceObject = await this.adapter.objects.findByName(sourceObjectName);
|
|
12053
12647
|
if (!sourceObject) {
|
|
@@ -12058,9 +12652,9 @@ var RollupService = class extends BaseService {
|
|
|
12058
12652
|
const reverseRelationAttr = sourceAttributes.find((attr) => {
|
|
12059
12653
|
if (attr.type !== "relation") return false;
|
|
12060
12654
|
const relationConfig = attr.config;
|
|
12061
|
-
return _optionalChain([relationConfig, 'optionalAccess',
|
|
12655
|
+
return _optionalChain([relationConfig, 'optionalAccess', _247 => _247.targets, 'optionalAccess', _248 => _248.some, 'call', _249 => _249((t) => t.object === schema.name)]);
|
|
12062
12656
|
});
|
|
12063
|
-
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess',
|
|
12657
|
+
reverseRelationAttrName = _optionalChain([reverseRelationAttr, 'optionalAccess', _250 => _250.name]);
|
|
12064
12658
|
}
|
|
12065
12659
|
if (!reverseRelationAttrName) {
|
|
12066
12660
|
return { value: null, recordCount: 0 };
|
|
@@ -12316,13 +12910,13 @@ var RollupService = class extends BaseService {
|
|
|
12316
12910
|
if (!obj) continue;
|
|
12317
12911
|
for (const rollupDbAttr of rollupAttrs) {
|
|
12318
12912
|
const rollupConfig = rollupDbAttr.config;
|
|
12319
|
-
if (!_optionalChain([rollupConfig, 'optionalAccess',
|
|
12913
|
+
if (!_optionalChain([rollupConfig, 'optionalAccess', _251 => _251.relationAttribute])) continue;
|
|
12320
12914
|
const relationAttr = attributes.find(
|
|
12321
12915
|
(a) => a.type === "relation" && a.name === rollupConfig.relationAttribute
|
|
12322
12916
|
);
|
|
12323
12917
|
if (!relationAttr) continue;
|
|
12324
12918
|
const relationConfig = relationAttr.config;
|
|
12325
|
-
const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess',
|
|
12919
|
+
const targetsChangedObject = _optionalChain([relationConfig, 'optionalAccess', _252 => _252.targets, 'optionalAccess', _253 => _253.some, 'call', _254 => _254(
|
|
12326
12920
|
(t) => t.object === changedSchema.name
|
|
12327
12921
|
)]);
|
|
12328
12922
|
if (!targetsChangedObject) continue;
|
|
@@ -12347,11 +12941,11 @@ var RecordService = class extends BaseService {
|
|
|
12347
12941
|
constructor(adapter, options) {
|
|
12348
12942
|
super(adapter);
|
|
12349
12943
|
this.schemaService = new ObjectSchemaService(adapter, registry, {
|
|
12350
|
-
auditService: _optionalChain([options, 'optionalAccess',
|
|
12944
|
+
auditService: _optionalChain([options, 'optionalAccess', _255 => _255.auditService])
|
|
12351
12945
|
});
|
|
12352
|
-
this.permissionService = _optionalChain([options, 'optionalAccess',
|
|
12353
|
-
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12354
|
-
this.policyRegistry = _optionalChain([options, 'optionalAccess',
|
|
12946
|
+
this.permissionService = _optionalChain([options, 'optionalAccess', _256 => _256.permissionService]);
|
|
12947
|
+
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _257 => _257.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
|
|
12948
|
+
this.policyRegistry = _optionalChain([options, 'optionalAccess', _258 => _258.policyRegistry]) === null ? null : _nullishCoalesce(_optionalChain([options, 'optionalAccess', _259 => _259.policyRegistry]), () => ( defaultPolicyRegistry));
|
|
12355
12949
|
this.recordResolver = new RecordResolverService(adapter);
|
|
12356
12950
|
this.queryService = new RecordQueryService(adapter, this.schemaService, {
|
|
12357
12951
|
permissionService: this.permissionService,
|
|
@@ -12366,7 +12960,7 @@ var RecordService = class extends BaseService {
|
|
|
12366
12960
|
recordResolver: this.recordResolver
|
|
12367
12961
|
});
|
|
12368
12962
|
this.userService = new UserService(adapter);
|
|
12369
|
-
this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12963
|
+
this.hookRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _260 => _260.hookRegistry]), () => ( new NoopHookRegistry()));
|
|
12370
12964
|
this.bilateralSyncService = new BilateralSyncService(
|
|
12371
12965
|
adapter,
|
|
12372
12966
|
this.schemaService,
|
|
@@ -12406,41 +13000,41 @@ var RecordService = class extends BaseService {
|
|
|
12406
13000
|
schema,
|
|
12407
13001
|
this.tenantId,
|
|
12408
13002
|
dataWithDefaults,
|
|
12409
|
-
_optionalChain([options, 'optionalAccess',
|
|
13003
|
+
_optionalChain([options, 'optionalAccess', _261 => _261.hookMetadata])
|
|
12410
13004
|
);
|
|
12411
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13005
|
+
if (!_optionalChain([options, 'optionalAccess', _262 => _262.skipHooks])) {
|
|
12412
13006
|
await this.hookRegistry.execute("beforeCreate", schema.name, hookCtx);
|
|
12413
13007
|
}
|
|
12414
13008
|
const normalizedData = this.relationPropertiesService.normalizeRelationValuesForStorage(
|
|
12415
13009
|
schema,
|
|
12416
13010
|
dataWithDefaults
|
|
12417
13011
|
);
|
|
12418
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12419
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12420
|
-
|
|
13012
|
+
if (_optionalChain([options, 'optionalAccess', _263 => _263.validate]) !== false) {
|
|
13013
|
+
if (_optionalChain([options, 'optionalAccess', _264 => _264.allowDraft])) {
|
|
13014
|
+
_chunkZW4N6FV7js.validateDraftOrThrow.call(void 0, schema, normalizedData);
|
|
12421
13015
|
} else {
|
|
12422
|
-
|
|
13016
|
+
_chunkZW4N6FV7js.validateObjectOrThrow.call(void 0, schema, normalizedData);
|
|
12423
13017
|
}
|
|
12424
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13018
|
+
if (!_optionalChain([options, 'optionalAccess', _265 => _265.skipRelationValidation])) {
|
|
12425
13019
|
await this.relationService.validateRelationsOrThrow(schema, normalizedData);
|
|
12426
13020
|
}
|
|
12427
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13021
|
+
if (!_optionalChain([options, 'optionalAccess', _266 => _266.skipUserValidation])) {
|
|
12428
13022
|
await this.userService.validateUsersOrThrow(schema, normalizedData);
|
|
12429
13023
|
}
|
|
12430
13024
|
}
|
|
12431
|
-
const completionStatus =
|
|
13025
|
+
const completionStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, normalizedData);
|
|
12432
13026
|
const label = await computeLabel(schema, normalizedData, this.labelResolver);
|
|
12433
13027
|
const record = await this.adapter.objectRecords.create({
|
|
12434
13028
|
objectId,
|
|
12435
13029
|
data: normalizedData,
|
|
12436
13030
|
label,
|
|
12437
13031
|
completionStatus,
|
|
12438
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
13032
|
+
metadata: _optionalChain([options, 'optionalAccess', _267 => _267.metadata]),
|
|
12439
13033
|
createdBy: this.userId
|
|
12440
13034
|
});
|
|
12441
13035
|
for (const [attrName, value] of Object.entries(dataWithDefaults)) {
|
|
12442
13036
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12443
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
13037
|
+
if (_optionalChain([attr, 'optionalAccess', _268 => _268.type]) === "relation") {
|
|
12444
13038
|
const hasProperties2 = attr.properties !== void 0;
|
|
12445
13039
|
const isBilateral = isBilateralRelation(attr);
|
|
12446
13040
|
if (hasProperties2 || isBilateral) {
|
|
@@ -12454,9 +13048,9 @@ var RecordService = class extends BaseService {
|
|
|
12454
13048
|
}
|
|
12455
13049
|
}
|
|
12456
13050
|
}
|
|
12457
|
-
for (const [attrName, value] of Object.entries(
|
|
13051
|
+
for (const [attrName, value] of Object.entries(dataWithDefaults)) {
|
|
12458
13052
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12459
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
13053
|
+
if (_optionalChain([attr, 'optionalAccess', _269 => _269.type]) === "relation" && isBilateralRelation(attr)) {
|
|
12460
13054
|
await this.bilateralSyncService.syncBilateralRelation(
|
|
12461
13055
|
schema,
|
|
12462
13056
|
record.id,
|
|
@@ -12467,7 +13061,7 @@ var RecordService = class extends BaseService {
|
|
|
12467
13061
|
);
|
|
12468
13062
|
}
|
|
12469
13063
|
}
|
|
12470
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13064
|
+
if (!_optionalChain([options, 'optionalAccess', _270 => _270.skipHooks])) {
|
|
12471
13065
|
const afterCtx = {
|
|
12472
13066
|
...hookCtx,
|
|
12473
13067
|
recordId: record.id,
|
|
@@ -12477,11 +13071,11 @@ var RecordService = class extends BaseService {
|
|
|
12477
13071
|
}
|
|
12478
13072
|
await recalculateParentRollups(record, schema, this.rollupContext);
|
|
12479
13073
|
await this.invalidateRecordCaches(record.id, objectId);
|
|
12480
|
-
_optionalChain([this, 'access',
|
|
13074
|
+
_optionalChain([this, 'access', _271 => _271.adapter, 'access', _272 => _272.search, 'optionalAccess', _273 => _273.indexRecord, 'call', _274 => _274(record, {
|
|
12481
13075
|
objectName: schema.name,
|
|
12482
13076
|
objectLabel: schema.label,
|
|
12483
13077
|
attributes: schema.attributes
|
|
12484
|
-
}), 'access',
|
|
13078
|
+
}), 'access', _275 => _275.catch, 'call', _276 => _276((err) => console.error("[search] Failed to index created record", record.id, err))]);
|
|
12485
13079
|
if (this.auditService && this.userId) {
|
|
12486
13080
|
this.auditService.logRecordAction({
|
|
12487
13081
|
action: "record.created",
|
|
@@ -12490,7 +13084,7 @@ var RecordService = class extends BaseService {
|
|
|
12490
13084
|
objectId: schema.id,
|
|
12491
13085
|
recordId: record.id,
|
|
12492
13086
|
recordLabel: record.label,
|
|
12493
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
13087
|
+
metadata: _optionalChain([options, 'optionalAccess', _277 => _277.hookMetadata])
|
|
12494
13088
|
}).catch(() => {
|
|
12495
13089
|
});
|
|
12496
13090
|
}
|
|
@@ -12513,7 +13107,7 @@ var RecordService = class extends BaseService {
|
|
|
12513
13107
|
return null;
|
|
12514
13108
|
}
|
|
12515
13109
|
const schema = await this.schemaService.getObjectSchema(record.objectId);
|
|
12516
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13110
|
+
if (!_optionalChain([options, 'optionalAccess', _278 => _278.skipPolicyCheck])) {
|
|
12517
13111
|
const policy = getPolicy(this.policyRegistry, this.userId, schema.name);
|
|
12518
13112
|
if (policy) {
|
|
12519
13113
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
@@ -12523,11 +13117,11 @@ var RecordService = class extends BaseService {
|
|
|
12523
13117
|
}
|
|
12524
13118
|
}
|
|
12525
13119
|
let enrichedRecord = record;
|
|
12526
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13120
|
+
if (!_optionalChain([options, 'optionalAccess', _279 => _279.skipFormulas])) {
|
|
12527
13121
|
enrichedRecord = enrichWithFormulas(record, schema);
|
|
12528
13122
|
}
|
|
12529
13123
|
enrichedRecord = await this.enrichRelationProperties(enrichedRecord, schema);
|
|
12530
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13124
|
+
if (_optionalChain([options, 'optionalAccess', _280 => _280.includeSchema])) {
|
|
12531
13125
|
const recordWithSchema = enrichedRecord;
|
|
12532
13126
|
recordWithSchema.schema = schema;
|
|
12533
13127
|
return recordWithSchema;
|
|
@@ -12589,9 +13183,9 @@ var RecordService = class extends BaseService {
|
|
|
12589
13183
|
existing,
|
|
12590
13184
|
mergedData,
|
|
12591
13185
|
changedAttributes,
|
|
12592
|
-
_optionalChain([options, 'optionalAccess',
|
|
13186
|
+
_optionalChain([options, 'optionalAccess', _281 => _281.hookMetadata])
|
|
12593
13187
|
);
|
|
12594
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13188
|
+
if (!_optionalChain([options, 'optionalAccess', _282 => _282.skipHooks])) {
|
|
12595
13189
|
await this.hookRegistry.execute("beforeUpdate", schema.name, hookCtx);
|
|
12596
13190
|
}
|
|
12597
13191
|
const hookModifiedValues = {};
|
|
@@ -12606,20 +13200,20 @@ var RecordService = class extends BaseService {
|
|
|
12606
13200
|
dataToUpdate
|
|
12607
13201
|
);
|
|
12608
13202
|
const normalizedMergedData = { ...existing.values, ...normalizedUpdate };
|
|
12609
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12610
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
12611
|
-
|
|
13203
|
+
if (_optionalChain([options, 'optionalAccess', _283 => _283.validate]) !== false) {
|
|
13204
|
+
if (_optionalChain([options, 'optionalAccess', _284 => _284.partial])) {
|
|
13205
|
+
_chunkZW4N6FV7js.validateDraftOrThrow.call(void 0, schema, normalizedMergedData);
|
|
12612
13206
|
} else {
|
|
12613
|
-
|
|
13207
|
+
_chunkZW4N6FV7js.validateObjectOrThrow.call(void 0, schema, normalizedMergedData);
|
|
12614
13208
|
}
|
|
12615
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13209
|
+
if (!_optionalChain([options, 'optionalAccess', _285 => _285.skipRelationValidation])) {
|
|
12616
13210
|
await this.relationService.validateRelationsOrThrow(schema, normalizedUpdate);
|
|
12617
13211
|
}
|
|
12618
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13212
|
+
if (!_optionalChain([options, 'optionalAccess', _286 => _286.skipUserValidation])) {
|
|
12619
13213
|
await this.userService.validateUsersOrThrow(schema, normalizedUpdate);
|
|
12620
13214
|
}
|
|
12621
13215
|
}
|
|
12622
|
-
const completionStatus =
|
|
13216
|
+
const completionStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, normalizedMergedData);
|
|
12623
13217
|
const label = await computeLabel(schema, normalizedMergedData, this.labelResolver);
|
|
12624
13218
|
const updatePayload = {
|
|
12625
13219
|
...normalizedUpdate,
|
|
@@ -12628,7 +13222,7 @@ var RecordService = class extends BaseService {
|
|
|
12628
13222
|
__lastUpdatedBy: this.userId,
|
|
12629
13223
|
__expectedUpdatedAt: existing.updatedAt instanceof Date ? existing.updatedAt.toISOString() : existing.updatedAt
|
|
12630
13224
|
};
|
|
12631
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13225
|
+
if (_optionalChain([options, 'optionalAccess', _287 => _287.metadata]) !== void 0) {
|
|
12632
13226
|
const existingMetadata = _nullishCoalesce(existing.metadata, () => ( {}));
|
|
12633
13227
|
const mergedMetadata = { ...existingMetadata, ...options.metadata };
|
|
12634
13228
|
const cleanedMetadata = Object.fromEntries(
|
|
@@ -12639,20 +13233,20 @@ var RecordService = class extends BaseService {
|
|
|
12639
13233
|
const bilateralOldValues = {};
|
|
12640
13234
|
for (const attrName of Object.keys(normalizedUpdate)) {
|
|
12641
13235
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12642
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
13236
|
+
if (_optionalChain([attr, 'optionalAccess', _288 => _288.type]) === "relation" && isBilateralRelation(attr)) {
|
|
12643
13237
|
bilateralOldValues[attrName] = existing.values[attrName];
|
|
12644
13238
|
}
|
|
12645
13239
|
}
|
|
12646
13240
|
const updated = await this.adapter.objectRecords.update(recordId, updatePayload);
|
|
12647
13241
|
await this.invalidateRecordCaches(recordId, existing.objectId);
|
|
12648
|
-
_optionalChain([this, 'access',
|
|
13242
|
+
_optionalChain([this, 'access', _289 => _289.adapter, 'access', _290 => _290.search, 'optionalAccess', _291 => _291.indexRecord, 'call', _292 => _292(updated, {
|
|
12649
13243
|
objectName: schema.name,
|
|
12650
13244
|
objectLabel: schema.label,
|
|
12651
13245
|
attributes: schema.attributes
|
|
12652
|
-
}), 'access',
|
|
13246
|
+
}), 'access', _293 => _293.catch, 'call', _294 => _294((err) => console.error("[search] Failed to index updated record", updated.id, err))]);
|
|
12653
13247
|
for (const [attrName, value] of Object.entries(dataToUpdate)) {
|
|
12654
13248
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12655
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
13249
|
+
if (_optionalChain([attr, 'optionalAccess', _295 => _295.type]) === "relation") {
|
|
12656
13250
|
const hasProperties2 = attr.properties !== void 0;
|
|
12657
13251
|
const isBilateral = isBilateralRelation(attr);
|
|
12658
13252
|
if (hasProperties2 || isBilateral) {
|
|
@@ -12666,9 +13260,9 @@ var RecordService = class extends BaseService {
|
|
|
12666
13260
|
}
|
|
12667
13261
|
}
|
|
12668
13262
|
}
|
|
12669
|
-
for (const [attrName, value] of Object.entries(
|
|
13263
|
+
for (const [attrName, value] of Object.entries(dataToUpdate)) {
|
|
12670
13264
|
const attr = schema.attributes.find((a) => a.name === attrName);
|
|
12671
|
-
if (_optionalChain([attr, 'optionalAccess',
|
|
13265
|
+
if (_optionalChain([attr, 'optionalAccess', _296 => _296.type]) === "relation" && isBilateralRelation(attr)) {
|
|
12672
13266
|
const oldValue = bilateralOldValues[attrName];
|
|
12673
13267
|
await this.bilateralSyncService.syncBilateralRelation(
|
|
12674
13268
|
schema,
|
|
@@ -12679,7 +13273,7 @@ var RecordService = class extends BaseService {
|
|
|
12679
13273
|
);
|
|
12680
13274
|
}
|
|
12681
13275
|
}
|
|
12682
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13276
|
+
if (!_optionalChain([options, 'optionalAccess', _297 => _297.skipHooks])) {
|
|
12683
13277
|
const afterCtx = {
|
|
12684
13278
|
...hookCtx,
|
|
12685
13279
|
record: updated
|
|
@@ -12694,7 +13288,7 @@ var RecordService = class extends BaseService {
|
|
|
12694
13288
|
if (this.auditService && this.userId && allChangedAttributes.length > 0) {
|
|
12695
13289
|
const changes = allChangedAttributes.map((attr) => ({
|
|
12696
13290
|
field: attr,
|
|
12697
|
-
oldValue: _optionalChain([hookCtx, 'access',
|
|
13291
|
+
oldValue: _optionalChain([hookCtx, 'access', _298 => _298.oldValues, 'optionalAccess', _299 => _299[attr]]),
|
|
12698
13292
|
newValue: hookCtx.newValues[attr]
|
|
12699
13293
|
}));
|
|
12700
13294
|
this.auditService.logRecordAction({
|
|
@@ -12705,7 +13299,7 @@ var RecordService = class extends BaseService {
|
|
|
12705
13299
|
recordId: updated.id,
|
|
12706
13300
|
recordLabel: updated.label,
|
|
12707
13301
|
changes,
|
|
12708
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
13302
|
+
metadata: _optionalChain([options, 'optionalAccess', _300 => _300.hookMetadata])
|
|
12709
13303
|
}).catch(() => {
|
|
12710
13304
|
});
|
|
12711
13305
|
}
|
|
@@ -12737,17 +13331,17 @@ var RecordService = class extends BaseService {
|
|
|
12737
13331
|
const ctx = buildPolicyContext(schema.name, this.userId, this.tenantId);
|
|
12738
13332
|
checkRecordDeleteOrThrow(policy, record, ctx);
|
|
12739
13333
|
}
|
|
12740
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13334
|
+
if (_optionalChain([options, 'optionalAccess', _301 => _301.checkSystem]) && schema.system) {
|
|
12741
13335
|
throw new ProtectedResourceError("object", schema.name, "delete");
|
|
12742
13336
|
}
|
|
12743
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13337
|
+
if (!_optionalChain([options, 'optionalAccess', _302 => _302.skipReferenceCheck])) {
|
|
12744
13338
|
const references = await this.adapter.objectRecords.countRecordsReferencingId(recordId);
|
|
12745
13339
|
if (references.length > 0) {
|
|
12746
13340
|
throw new RecordReferencedError(recordId, references);
|
|
12747
13341
|
}
|
|
12748
13342
|
}
|
|
12749
|
-
const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess',
|
|
12750
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13343
|
+
const hookCtx = createContextForDelete(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _303 => _303.hookMetadata]));
|
|
13344
|
+
if (!_optionalChain([options, 'optionalAccess', _304 => _304.skipHooks])) {
|
|
12751
13345
|
await this.hookRegistry.execute("beforeDelete", schema.name, hookCtx);
|
|
12752
13346
|
}
|
|
12753
13347
|
for (const attr of schema.attributes) {
|
|
@@ -12765,8 +13359,8 @@ var RecordService = class extends BaseService {
|
|
|
12765
13359
|
}
|
|
12766
13360
|
await this.adapter.objectRecords.delete(recordId);
|
|
12767
13361
|
await this.invalidateRecordCaches(recordId, record.objectId);
|
|
12768
|
-
_optionalChain([this, 'access',
|
|
12769
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13362
|
+
_optionalChain([this, 'access', _305 => _305.adapter, 'access', _306 => _306.search, 'optionalAccess', _307 => _307.removeRecord, 'call', _308 => _308(recordId), 'access', _309 => _309.catch, 'call', _310 => _310((err) => console.error("[search] Failed to remove deleted record", recordId, err))]);
|
|
13363
|
+
if (!_optionalChain([options, 'optionalAccess', _311 => _311.skipHooks])) {
|
|
12770
13364
|
await this.hookRegistry.execute("afterDelete", schema.name, hookCtx);
|
|
12771
13365
|
}
|
|
12772
13366
|
await recalculateParentRollups(record, schema, this.rollupContext);
|
|
@@ -12778,7 +13372,7 @@ var RecordService = class extends BaseService {
|
|
|
12778
13372
|
objectId: schema.id,
|
|
12779
13373
|
recordId: record.id,
|
|
12780
13374
|
recordLabel: record.label,
|
|
12781
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
13375
|
+
metadata: _optionalChain([options, 'optionalAccess', _312 => _312.hookMetadata])
|
|
12782
13376
|
}).catch(() => {
|
|
12783
13377
|
});
|
|
12784
13378
|
}
|
|
@@ -12839,18 +13433,18 @@ var RecordService = class extends BaseService {
|
|
|
12839
13433
|
this.tenantId
|
|
12840
13434
|
);
|
|
12841
13435
|
await checkPermission(this.permissionService, this.userId, schema.name, "update");
|
|
12842
|
-
const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess',
|
|
12843
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13436
|
+
const hookCtx = createContextForRestore(schema, this.tenantId, record, _optionalChain([options, 'optionalAccess', _313 => _313.hookMetadata]));
|
|
13437
|
+
if (!_optionalChain([options, 'optionalAccess', _314 => _314.skipHooks])) {
|
|
12844
13438
|
await this.hookRegistry.execute("beforeRestore", schema.name, hookCtx);
|
|
12845
13439
|
}
|
|
12846
13440
|
const restored = await this.adapter.objectRecords.restore(recordId);
|
|
12847
13441
|
await this.invalidateRecordCaches(recordId, record.objectId);
|
|
12848
|
-
_optionalChain([this, 'access',
|
|
13442
|
+
_optionalChain([this, 'access', _315 => _315.adapter, 'access', _316 => _316.search, 'optionalAccess', _317 => _317.indexRecord, 'call', _318 => _318(restored, {
|
|
12849
13443
|
objectName: schema.name,
|
|
12850
13444
|
objectLabel: schema.label,
|
|
12851
13445
|
attributes: schema.attributes
|
|
12852
|
-
}), 'access',
|
|
12853
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
13446
|
+
}), 'access', _319 => _319.catch, 'call', _320 => _320((err) => console.error("[search] Failed to index restored record", restored.id, err))]);
|
|
13447
|
+
if (!_optionalChain([options, 'optionalAccess', _321 => _321.skipHooks])) {
|
|
12854
13448
|
const afterCtx = {
|
|
12855
13449
|
...hookCtx,
|
|
12856
13450
|
record: restored
|
|
@@ -12865,7 +13459,7 @@ var RecordService = class extends BaseService {
|
|
|
12865
13459
|
objectId: schema.id,
|
|
12866
13460
|
recordId: restored.id,
|
|
12867
13461
|
recordLabel: restored.label,
|
|
12868
|
-
metadata: _optionalChain([options, 'optionalAccess',
|
|
13462
|
+
metadata: _optionalChain([options, 'optionalAccess', _322 => _322.hookMetadata])
|
|
12869
13463
|
}).catch(() => {
|
|
12870
13464
|
});
|
|
12871
13465
|
}
|
|
@@ -12964,14 +13558,14 @@ var RecordService = class extends BaseService {
|
|
|
12964
13558
|
*/
|
|
12965
13559
|
async validateData(objectId, data) {
|
|
12966
13560
|
const schema = await this.schemaService.getObjectSchema(objectId);
|
|
12967
|
-
return
|
|
13561
|
+
return _chunkZW4N6FV7js.validateObject.call(void 0, schema, data);
|
|
12968
13562
|
}
|
|
12969
13563
|
/**
|
|
12970
13564
|
* Compute the completion status for given data without saving
|
|
12971
13565
|
*/
|
|
12972
13566
|
async computeStatus(objectId, data) {
|
|
12973
13567
|
const schema = await this.schemaService.getObjectSchema(objectId);
|
|
12974
|
-
return
|
|
13568
|
+
return _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, data);
|
|
12975
13569
|
}
|
|
12976
13570
|
/**
|
|
12977
13571
|
* Refresh the completion status of an existing record
|
|
@@ -12979,7 +13573,7 @@ var RecordService = class extends BaseService {
|
|
|
12979
13573
|
async refreshRecordStatus(recordId) {
|
|
12980
13574
|
const record = await this.getRecordOrThrow(recordId);
|
|
12981
13575
|
const schema = await this.schemaService.getObjectSchema(record.objectId);
|
|
12982
|
-
const newStatus =
|
|
13576
|
+
const newStatus = _chunkZW4N6FV7js.computeRecordStatus.call(void 0, schema, record.values);
|
|
12983
13577
|
if (record.completionStatus !== newStatus) {
|
|
12984
13578
|
await this.adapter.objectRecords.update(recordId, {
|
|
12985
13579
|
__completionStatus: newStatus
|
|
@@ -13466,7 +14060,7 @@ var WorkflowAccessGrantService = class extends BaseService {
|
|
|
13466
14060
|
* Check if a specific token has been revoked.
|
|
13467
14061
|
*/
|
|
13468
14062
|
isTokenRevoked(dbGrant, jti) {
|
|
13469
|
-
return _nullishCoalesce(_optionalChain([dbGrant, 'access',
|
|
14063
|
+
return _nullishCoalesce(_optionalChain([dbGrant, 'access', _323 => _323.revoked_token_jtis, 'optionalAccess', _324 => _324.includes, 'call', _325 => _325(jti)]), () => ( false));
|
|
13470
14064
|
}
|
|
13471
14065
|
/**
|
|
13472
14066
|
* Validate access token payload against the grant.
|
|
@@ -13518,15 +14112,15 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13518
14112
|
constructor(adapter, workflowService, options) {
|
|
13519
14113
|
super(adapter);
|
|
13520
14114
|
this.workflowService = workflowService;
|
|
13521
|
-
this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13522
|
-
this.schemaService = _optionalChain([options, 'optionalAccess',
|
|
13523
|
-
this.recordService = _optionalChain([options, 'optionalAccess',
|
|
14115
|
+
this.executorRegistry = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _326 => _326.executorRegistry]), () => ( getDefaultExecutorRegistry()));
|
|
14116
|
+
this.schemaService = _optionalChain([options, 'optionalAccess', _327 => _327.schemaService]);
|
|
14117
|
+
this.recordService = _optionalChain([options, 'optionalAccess', _328 => _328.recordService]);
|
|
13524
14118
|
}
|
|
13525
14119
|
/**
|
|
13526
14120
|
* Start a new workflow instance
|
|
13527
14121
|
*/
|
|
13528
14122
|
async startWorkflow(input) {
|
|
13529
|
-
|
|
14123
|
+
let workflow2 = await this.workflowService.getWorkflow(input.workflowName);
|
|
13530
14124
|
if (!workflow2) {
|
|
13531
14125
|
throw new SchemaError(
|
|
13532
14126
|
`Workflow "${input.workflowName}" not found`,
|
|
@@ -13539,6 +14133,20 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13539
14133
|
SchemaErrorCode.VALIDATION_FAILED
|
|
13540
14134
|
);
|
|
13541
14135
|
}
|
|
14136
|
+
if (workflow2.system && this.adapter.workflows) {
|
|
14137
|
+
const dbWorkflow = await this.adapter.workflows.upsert({
|
|
14138
|
+
name: workflow2.name,
|
|
14139
|
+
label: _nullishCoalesce(workflow2.label, () => ( workflow2.name)),
|
|
14140
|
+
description: workflow2.description,
|
|
14141
|
+
status: "published",
|
|
14142
|
+
version: workflow2.version,
|
|
14143
|
+
slots: _nullishCoalesce(workflow2.slots, () => ( [])),
|
|
14144
|
+
nodes: workflow2.nodes,
|
|
14145
|
+
startNodeId: workflow2.startNodeId,
|
|
14146
|
+
system: true
|
|
14147
|
+
});
|
|
14148
|
+
workflow2 = { ...workflow2, id: dbWorkflow.id };
|
|
14149
|
+
}
|
|
13542
14150
|
const context = createEmptyContext();
|
|
13543
14151
|
if (input.initialSlots) {
|
|
13544
14152
|
for (const [slotId, data] of Object.entries(input.initialSlots)) {
|
|
@@ -13549,8 +14157,8 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13549
14157
|
context.variables = input.variables;
|
|
13550
14158
|
}
|
|
13551
14159
|
const instance = {
|
|
13552
|
-
id:
|
|
13553
|
-
workflowId: _nullishCoalesce(workflow2.id, () => (
|
|
14160
|
+
id: _chunkE6XO2STSjs.generateId.call(void 0, ),
|
|
14161
|
+
workflowId: _nullishCoalesce(workflow2.id, () => ( _chunkE6XO2STSjs.generateId.call(void 0, ))),
|
|
13554
14162
|
workflowVersion: workflow2.version,
|
|
13555
14163
|
workflowSnapshot: workflow2,
|
|
13556
14164
|
status: "running",
|
|
@@ -13702,7 +14310,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13702
14310
|
if (!this.adapter.workflowInstances) {
|
|
13703
14311
|
return { instances: [], total: 0 };
|
|
13704
14312
|
}
|
|
13705
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
14313
|
+
if (_optionalChain([options, 'optionalAccess', _329 => _329.workflowName])) {
|
|
13706
14314
|
const allDbInstances = await this.adapter.workflowInstances.findByWorkflowName(
|
|
13707
14315
|
options.workflowName,
|
|
13708
14316
|
{ status: options.status }
|
|
@@ -13716,11 +14324,11 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13716
14324
|
return { instances: instances2, total: total2 };
|
|
13717
14325
|
}
|
|
13718
14326
|
const { instances: dbInstances, total } = await this.adapter.workflowInstances.list({
|
|
13719
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
13720
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
14327
|
+
limit: _optionalChain([options, 'optionalAccess', _330 => _330.limit]),
|
|
14328
|
+
offset: _optionalChain([options, 'optionalAccess', _331 => _331.offset])
|
|
13721
14329
|
});
|
|
13722
14330
|
let instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
|
|
13723
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
14331
|
+
if (_optionalChain([options, 'optionalAccess', _332 => _332.status])) {
|
|
13724
14332
|
instances = instances.filter((i) => i.status === options.status);
|
|
13725
14333
|
}
|
|
13726
14334
|
instances = await this.markExpiredInstances(instances);
|
|
@@ -13741,9 +14349,9 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13741
14349
|
return { instances: [], total: 0 };
|
|
13742
14350
|
}
|
|
13743
14351
|
const { instances: dbInstances, total } = await this.adapter.workflowInstances.findByRecordInSlots(objectName, recordId, {
|
|
13744
|
-
status: _optionalChain([options, 'optionalAccess',
|
|
13745
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
13746
|
-
offset: _optionalChain([options, 'optionalAccess',
|
|
14352
|
+
status: _optionalChain([options, 'optionalAccess', _333 => _333.status]),
|
|
14353
|
+
limit: _optionalChain([options, 'optionalAccess', _334 => _334.limit]),
|
|
14354
|
+
offset: _optionalChain([options, 'optionalAccess', _335 => _335.offset])
|
|
13747
14355
|
});
|
|
13748
14356
|
const instances = dbInstances.map((db) => this.convertDBInstanceToInstance(db));
|
|
13749
14357
|
return { instances, total };
|
|
@@ -13778,7 +14386,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13778
14386
|
updatedAt: /* @__PURE__ */ new Date()
|
|
13779
14387
|
};
|
|
13780
14388
|
}
|
|
13781
|
-
const executionId =
|
|
14389
|
+
const executionId = _chunkE6XO2STSjs.generateId.call(void 0, );
|
|
13782
14390
|
let current = {
|
|
13783
14391
|
...instance,
|
|
13784
14392
|
context: {
|
|
@@ -13809,7 +14417,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
13809
14417
|
try {
|
|
13810
14418
|
const schemas = await Promise.all(
|
|
13811
14419
|
current.workflowSnapshot.slots.map(
|
|
13812
|
-
(slot) => _optionalChain([this, 'access',
|
|
14420
|
+
(slot) => _optionalChain([this, 'access', _336 => _336.schemaService, 'optionalAccess', _337 => _337.getObjectSchemaByName, 'call', _338 => _338(slot.objectName)])
|
|
13813
14421
|
)
|
|
13814
14422
|
);
|
|
13815
14423
|
objectDefinitions = schemas.filter(
|
|
@@ -14067,8 +14675,8 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
14067
14675
|
*/
|
|
14068
14676
|
async snapshotRecord(recordId) {
|
|
14069
14677
|
try {
|
|
14070
|
-
const record = await _optionalChain([this, 'access',
|
|
14071
|
-
return _optionalChain([record, 'optionalAccess',
|
|
14678
|
+
const record = await _optionalChain([this, 'access', _339 => _339.recordService, 'optionalAccess', _340 => _340.getRecord, 'call', _341 => _341(recordId, { skipPolicyCheck: true })]);
|
|
14679
|
+
return _optionalChain([record, 'optionalAccess', _342 => _342.values]);
|
|
14072
14680
|
} catch (e20) {
|
|
14073
14681
|
return void 0;
|
|
14074
14682
|
}
|
|
@@ -14087,13 +14695,13 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
14087
14695
|
for (const op of [...operations].reverse()) {
|
|
14088
14696
|
try {
|
|
14089
14697
|
if (op.operation === "create") {
|
|
14090
|
-
await _optionalChain([this, 'access',
|
|
14698
|
+
await _optionalChain([this, 'access', _343 => _343.recordService, 'optionalAccess', _344 => _344.deleteRecord, 'call', _345 => _345(op.recordId, {
|
|
14091
14699
|
skipHooks: true,
|
|
14092
14700
|
skipReferenceCheck: true
|
|
14093
14701
|
})]);
|
|
14094
14702
|
rolledBack.push(op.slotId);
|
|
14095
14703
|
} else if (op.operation === "update" && op.previousData) {
|
|
14096
|
-
await _optionalChain([this, 'access',
|
|
14704
|
+
await _optionalChain([this, 'access', _346 => _346.recordService, 'optionalAccess', _347 => _347.updateRecord, 'call', _348 => _348(op.recordId, op.previousData, {
|
|
14097
14705
|
partial: false
|
|
14098
14706
|
})]);
|
|
14099
14707
|
rolledBack.push(op.slotId);
|
|
@@ -14217,7 +14825,7 @@ var WorkflowInstanceService = class extends BaseService {
|
|
|
14217
14825
|
if (!this.adapter.workflowInstances) {
|
|
14218
14826
|
return;
|
|
14219
14827
|
}
|
|
14220
|
-
const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access',
|
|
14828
|
+
const currentVersion = _nullishCoalesce(_optionalChain([instance, 'access', _349 => _349.context, 'access', _350 => _350.variables, 'optionalAccess', _351 => _351.__version]), () => ( 0));
|
|
14221
14829
|
const nextVersion = currentVersion + 1;
|
|
14222
14830
|
const instanceWithVersion = {
|
|
14223
14831
|
...instance,
|
|
@@ -14498,7 +15106,7 @@ var WorkflowRelationService = class extends BaseService {
|
|
|
14498
15106
|
if (attr.type !== "relation") continue;
|
|
14499
15107
|
for (const slot of slots) {
|
|
14500
15108
|
const slotData = context.slots[slot.id];
|
|
14501
|
-
const slotRecordId = _optionalChain([slotData, 'optionalAccess',
|
|
15109
|
+
const slotRecordId = _optionalChain([slotData, 'optionalAccess', _352 => _352.id]);
|
|
14502
15110
|
if (!slotRecordId) continue;
|
|
14503
15111
|
const targetsSlotObject = attr.targets.some(
|
|
14504
15112
|
(t) => t.object === slot.objectName
|
|
@@ -14566,7 +15174,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14566
15174
|
if (Array.isArray(options)) {
|
|
14567
15175
|
this.systemWorkflows = new Map(options.map((w) => [w.name, w]));
|
|
14568
15176
|
} else {
|
|
14569
|
-
this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15177
|
+
this.systemWorkflows = new Map((_nullishCoalesce(_optionalChain([options, 'optionalAccess', _353 => _353.systemWorkflows]), () => ( []))).map((w) => [w.name, w]));
|
|
14570
15178
|
}
|
|
14571
15179
|
}
|
|
14572
15180
|
// ============================================================================
|
|
@@ -14681,7 +15289,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14681
15289
|
};
|
|
14682
15290
|
const validationResult = WorkflowDefinitionSchema.safeParse(definition);
|
|
14683
15291
|
if (!validationResult.success) {
|
|
14684
|
-
const errors =
|
|
15292
|
+
const errors = _chunkZW4N6FV7js.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
|
|
14685
15293
|
throw new SchemaError(
|
|
14686
15294
|
`Invalid workflow definition: ${errors.join(", ")}`,
|
|
14687
15295
|
SchemaErrorCode.VALIDATION_FAILED
|
|
@@ -14723,7 +15331,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14723
15331
|
};
|
|
14724
15332
|
const validationResult = WorkflowDefinitionSchema.safeParse(updated);
|
|
14725
15333
|
if (!validationResult.success) {
|
|
14726
|
-
const errors =
|
|
15334
|
+
const errors = _chunkZW4N6FV7js.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
|
|
14727
15335
|
throw new SchemaError(
|
|
14728
15336
|
`Invalid workflow definition: ${errors.join(", ")}`,
|
|
14729
15337
|
SchemaErrorCode.VALIDATION_FAILED
|
|
@@ -14752,7 +15360,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14752
15360
|
}
|
|
14753
15361
|
const validationResult = WorkflowDefinitionSchema.safeParse(existing);
|
|
14754
15362
|
if (!validationResult.success) {
|
|
14755
|
-
const errors =
|
|
15363
|
+
const errors = _chunkZW4N6FV7js.formatZodErrors.call(void 0, validationResult.error).map((err) => err.message);
|
|
14756
15364
|
throw new SchemaError(
|
|
14757
15365
|
`Cannot publish invalid workflow: ${errors.join(", ")}`,
|
|
14758
15366
|
SchemaErrorCode.VALIDATION_FAILED
|
|
@@ -14864,7 +15472,7 @@ var WorkflowService = class extends BaseService {
|
|
|
14864
15472
|
var UserProfileService = class extends BaseService {
|
|
14865
15473
|
constructor(adapter, options) {
|
|
14866
15474
|
super(adapter);
|
|
14867
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
15475
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _354 => _354.auditService]);
|
|
14868
15476
|
}
|
|
14869
15477
|
// ============================================================================
|
|
14870
15478
|
// CACHE MANAGEMENT
|
|
@@ -14943,7 +15551,7 @@ var UserProfileService = class extends BaseService {
|
|
|
14943
15551
|
async deleteAvatar(profileId) {
|
|
14944
15552
|
const profile = await this.getProfileOrThrow(profileId);
|
|
14945
15553
|
if (profile.avatarUrl && !profile.avatarUrl.startsWith("https://")) {
|
|
14946
|
-
await _optionalChain([this, 'access',
|
|
15554
|
+
await _optionalChain([this, 'access', _355 => _355.adapter, 'access', _356 => _356.storage, 'optionalAccess', _357 => _357.delete, 'call', _358 => _358(profile.avatarUrl), 'access', _359 => _359.catch, 'call', _360 => _360(() => void 0)]);
|
|
14947
15555
|
}
|
|
14948
15556
|
return await this.updateProfile(profileId, { avatarUrl: null });
|
|
14949
15557
|
}
|
|
@@ -15094,7 +15702,7 @@ var UserProfileService = class extends BaseService {
|
|
|
15094
15702
|
*/
|
|
15095
15703
|
async deleteProfile(profileId, options) {
|
|
15096
15704
|
const profile = await this.getProfileOrThrow(profileId);
|
|
15097
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
15705
|
+
if (_optionalChain([options, 'optionalAccess', _361 => _361.checkAdmin]) && this.adapter.permissions) {
|
|
15098
15706
|
const ownerCount = await this.adapter.permissions.countUsersWithRole("owner");
|
|
15099
15707
|
if (ownerCount <= 1) {
|
|
15100
15708
|
const userRoles = await this.adapter.permissions.getUserRoles(profileId);
|
|
@@ -15222,7 +15830,7 @@ var UserProfileService = class extends BaseService {
|
|
|
15222
15830
|
var DocumentService = class extends BaseService {
|
|
15223
15831
|
constructor(adapter, options) {
|
|
15224
15832
|
super(adapter);
|
|
15225
|
-
this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
15833
|
+
this.fileService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _362 => _362.fileService]), () => ( null));
|
|
15226
15834
|
}
|
|
15227
15835
|
// ============================================================================
|
|
15228
15836
|
// CREATE
|
|
@@ -15440,7 +16048,7 @@ var DocumentService = class extends BaseService {
|
|
|
15440
16048
|
*/
|
|
15441
16049
|
async isComplete(documentId) {
|
|
15442
16050
|
const document2 = await this.getDocument(documentId);
|
|
15443
|
-
return _optionalChain([document2, 'optionalAccess',
|
|
16051
|
+
return _optionalChain([document2, 'optionalAccess', _363 => _363.status]) !== "draft";
|
|
15444
16052
|
}
|
|
15445
16053
|
/**
|
|
15446
16054
|
* Get document with its slots.
|
|
@@ -15683,7 +16291,7 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15683
16291
|
type: "signature",
|
|
15684
16292
|
provider: this.config.signatureAdapter.name,
|
|
15685
16293
|
input: { signers, ...options },
|
|
15686
|
-
expiresAt: _optionalChain([options, 'optionalAccess',
|
|
16294
|
+
expiresAt: _optionalChain([options, 'optionalAccess', _364 => _364.expiresAt])
|
|
15687
16295
|
});
|
|
15688
16296
|
return job;
|
|
15689
16297
|
}
|
|
@@ -15995,15 +16603,15 @@ var DocumentProcessingService = class extends BaseService {
|
|
|
15995
16603
|
return {
|
|
15996
16604
|
ocr: {
|
|
15997
16605
|
available: !!this.config.ocrAdapter,
|
|
15998
|
-
provider: _optionalChain([this, 'access',
|
|
16606
|
+
provider: _optionalChain([this, 'access', _365 => _365.config, 'access', _366 => _366.ocrAdapter, 'optionalAccess', _367 => _367.name])
|
|
15999
16607
|
},
|
|
16000
16608
|
signature: {
|
|
16001
16609
|
available: !!this.config.signatureAdapter,
|
|
16002
|
-
provider: _optionalChain([this, 'access',
|
|
16610
|
+
provider: _optionalChain([this, 'access', _368 => _368.config, 'access', _369 => _369.signatureAdapter, 'optionalAccess', _370 => _370.name])
|
|
16003
16611
|
},
|
|
16004
16612
|
identityVerification: {
|
|
16005
16613
|
available: !!this.config.identityAdapter,
|
|
16006
|
-
provider: _optionalChain([this, 'access',
|
|
16614
|
+
provider: _optionalChain([this, 'access', _371 => _371.config, 'access', _372 => _372.identityAdapter, 'optionalAccess', _373 => _373.name])
|
|
16007
16615
|
}
|
|
16008
16616
|
};
|
|
16009
16617
|
}
|
|
@@ -16025,7 +16633,7 @@ function decodeFileName(name) {
|
|
|
16025
16633
|
var FileService = class extends BaseService {
|
|
16026
16634
|
constructor(adapter, options) {
|
|
16027
16635
|
super(adapter);
|
|
16028
|
-
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16636
|
+
this.auditService = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _374 => _374.auditService]), () => ( (adapter.audit ? new AuditService(adapter) : void 0)));
|
|
16029
16637
|
}
|
|
16030
16638
|
// ============================================================================
|
|
16031
16639
|
// UPLOAD (requires StorageAdapter)
|
|
@@ -16165,7 +16773,7 @@ var FileService = class extends BaseService {
|
|
|
16165
16773
|
*/
|
|
16166
16774
|
async getFile(fileId) {
|
|
16167
16775
|
const file2 = await this.adapter.files.findById(fileId);
|
|
16168
|
-
if (_optionalChain([file2, 'optionalAccess',
|
|
16776
|
+
if (_optionalChain([file2, 'optionalAccess', _375 => _375.deletedAt])) {
|
|
16169
16777
|
return null;
|
|
16170
16778
|
}
|
|
16171
16779
|
return file2;
|
|
@@ -16227,12 +16835,12 @@ var FileService = class extends BaseService {
|
|
|
16227
16835
|
*/
|
|
16228
16836
|
async deleteFile(fileId, options) {
|
|
16229
16837
|
const file2 = await this.getFileOrThrow(fileId);
|
|
16230
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16838
|
+
if (_optionalChain([options, 'optionalAccess', _376 => _376.checkOwnership]) && options.userId) {
|
|
16231
16839
|
if (file2.uploadedBy !== options.userId) {
|
|
16232
16840
|
throw new Error("You can only delete files you uploaded");
|
|
16233
16841
|
}
|
|
16234
16842
|
}
|
|
16235
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16843
|
+
if (_optionalChain([options, 'optionalAccess', _377 => _377.hard])) {
|
|
16236
16844
|
await this.adapter.files.hardDelete(fileId);
|
|
16237
16845
|
} else {
|
|
16238
16846
|
await this.adapter.files.delete(fileId);
|
|
@@ -16263,7 +16871,7 @@ var FileService = class extends BaseService {
|
|
|
16263
16871
|
}
|
|
16264
16872
|
const file2 = await this.getFileOrThrow(fileId);
|
|
16265
16873
|
await this.adapter.storage.delete(file2.storagePath);
|
|
16266
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16874
|
+
if (_optionalChain([options, 'optionalAccess', _378 => _378.hard])) {
|
|
16267
16875
|
await this.adapter.files.hardDelete(fileId);
|
|
16268
16876
|
} else {
|
|
16269
16877
|
await this.adapter.files.delete(fileId);
|
|
@@ -16289,15 +16897,15 @@ var FileService = class extends BaseService {
|
|
|
16289
16897
|
const fileResults = await Promise.all(fileIds.map((id) => this.getFile(id)));
|
|
16290
16898
|
const files = fileResults.filter((f) => f !== null);
|
|
16291
16899
|
if (files.length === 0) return;
|
|
16292
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16900
|
+
if (_optionalChain([options, 'optionalAccess', _379 => _379.deleteFromStorage]) && this.adapter.storage) {
|
|
16293
16901
|
const BATCH_SIZE = 10;
|
|
16294
16902
|
for (let i = 0; i < files.length; i += BATCH_SIZE) {
|
|
16295
16903
|
const batch = files.slice(i, i + BATCH_SIZE);
|
|
16296
|
-
await Promise.all(batch.map((file2) => _optionalChain([this, 'access',
|
|
16904
|
+
await Promise.all(batch.map((file2) => _optionalChain([this, 'access', _380 => _380.adapter, 'access', _381 => _381.storage, 'optionalAccess', _382 => _382.delete, 'call', _383 => _383(file2.storagePath)])));
|
|
16297
16905
|
}
|
|
16298
16906
|
}
|
|
16299
16907
|
const idsToDelete = files.map((f) => f.id);
|
|
16300
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
16908
|
+
if (_optionalChain([options, 'optionalAccess', _384 => _384.hard])) {
|
|
16301
16909
|
await Promise.all(idsToDelete.map((id) => this.adapter.files.hardDelete(id)));
|
|
16302
16910
|
} else {
|
|
16303
16911
|
await Promise.all(idsToDelete.map((id) => this.adapter.files.delete(id)));
|
|
@@ -16305,12 +16913,12 @@ var FileService = class extends BaseService {
|
|
|
16305
16913
|
if (this.auditService && this.userId) {
|
|
16306
16914
|
await Promise.all(
|
|
16307
16915
|
files.map(
|
|
16308
|
-
(file2) => _optionalChain([this, 'access',
|
|
16916
|
+
(file2) => _optionalChain([this, 'access', _385 => _385.auditService, 'optionalAccess', _386 => _386.logFileAction, 'call', _387 => _387({
|
|
16309
16917
|
action: "file.deleted",
|
|
16310
16918
|
actorId: _nullishCoalesce(this.userId, () => ( "")),
|
|
16311
16919
|
fileId: file2.id,
|
|
16312
16920
|
fileName: file2.name,
|
|
16313
|
-
metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16921
|
+
metadata: { deletedFromStorage: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _388 => _388.deleteFromStorage]), () => ( false)) }
|
|
16314
16922
|
})])
|
|
16315
16923
|
)
|
|
16316
16924
|
);
|
|
@@ -16395,7 +17003,7 @@ var FileService = class extends BaseService {
|
|
|
16395
17003
|
return true;
|
|
16396
17004
|
}
|
|
16397
17005
|
if (file2.visibility === "restricted") {
|
|
16398
|
-
return _nullishCoalesce(_optionalChain([file2, 'access',
|
|
17006
|
+
return _nullishCoalesce(_optionalChain([file2, 'access', _389 => _389.allowedUsers, 'optionalAccess', _390 => _390.includes, 'call', _391 => _391(userId)]), () => ( false));
|
|
16399
17007
|
}
|
|
16400
17008
|
return false;
|
|
16401
17009
|
}
|
|
@@ -16490,7 +17098,7 @@ function withTimeout(promise, ms, label) {
|
|
|
16490
17098
|
var GeocodingService = class {
|
|
16491
17099
|
constructor(adapter, options) {
|
|
16492
17100
|
this.adapter = adapter;
|
|
16493
|
-
this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
17101
|
+
this.timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _392 => _392.timeoutMs]), () => ( GEOCODING_TIMEOUT_MS));
|
|
16494
17102
|
}
|
|
16495
17103
|
/**
|
|
16496
17104
|
* Search for address suggestions as the user types
|
|
@@ -16549,9 +17157,9 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16549
17157
|
if (this.adapter.search) {
|
|
16550
17158
|
try {
|
|
16551
17159
|
const raw = await this.adapter.search.globalSearch(trimmed, {
|
|
16552
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16553
|
-
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16554
|
-
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
17160
|
+
objectNames: _optionalChain([options, 'optionalAccess', _393 => _393.objectNames]),
|
|
17161
|
+
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _394 => _394.limit]), () => ( 20)),
|
|
17162
|
+
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _395 => _395.offset]), () => ( 0))
|
|
16555
17163
|
});
|
|
16556
17164
|
return await this.healGlobalSearchResults(raw);
|
|
16557
17165
|
} catch (err) {
|
|
@@ -16559,9 +17167,9 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16559
17167
|
}
|
|
16560
17168
|
}
|
|
16561
17169
|
return this.adapter.objectRecords.globalSearch(trimmed, {
|
|
16562
|
-
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16563
|
-
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
16564
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
17170
|
+
limit: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _396 => _396.limit]), () => ( 20)),
|
|
17171
|
+
offset: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _397 => _397.offset]), () => ( 0)),
|
|
17172
|
+
objectNames: _optionalChain([options, 'optionalAccess', _398 => _398.objectNames])
|
|
16565
17173
|
});
|
|
16566
17174
|
}
|
|
16567
17175
|
/**
|
|
@@ -16580,7 +17188,7 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16580
17188
|
if (this.adapter.search) {
|
|
16581
17189
|
try {
|
|
16582
17190
|
const raw = await this.adapter.search.globalSearchGrouped(trimmed, {
|
|
16583
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
17191
|
+
objectNames: _optionalChain([options, 'optionalAccess', _399 => _399.objectNames])
|
|
16584
17192
|
});
|
|
16585
17193
|
return await this.healGroupedSearchResults(raw);
|
|
16586
17194
|
} catch (err) {
|
|
@@ -16588,8 +17196,8 @@ var GlobalSearchService = class extends BaseService {
|
|
|
16588
17196
|
}
|
|
16589
17197
|
}
|
|
16590
17198
|
return this.adapter.objectRecords.globalSearchGrouped(trimmed, {
|
|
16591
|
-
objectNames: _optionalChain([options, 'optionalAccess',
|
|
16592
|
-
limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
17199
|
+
objectNames: _optionalChain([options, 'optionalAccess', _400 => _400.objectNames]),
|
|
17200
|
+
limitPerGroup: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _401 => _401.limitPerGroup]), () => ( 5))
|
|
16593
17201
|
});
|
|
16594
17202
|
}
|
|
16595
17203
|
// ==========================================================================
|
|
@@ -16656,7 +17264,7 @@ var PermissionService = class extends BaseService {
|
|
|
16656
17264
|
}
|
|
16657
17265
|
this.permissionsRepo = adapter.permissions;
|
|
16658
17266
|
this.permissionCache = _nullishCoalesce(adapter.cache, () => ( new NoopCacheAdapter()));
|
|
16659
|
-
this.auditService = _optionalChain([options, 'optionalAccess',
|
|
17267
|
+
this.auditService = _optionalChain([options, 'optionalAccess', _402 => _402.auditService]);
|
|
16660
17268
|
}
|
|
16661
17269
|
// ============================================================================
|
|
16662
17270
|
// PERMISSION CHECKS
|
|
@@ -16672,11 +17280,11 @@ var PermissionService = class extends BaseService {
|
|
|
16672
17280
|
async canAccessObject(userProfileId, objectName, action) {
|
|
16673
17281
|
const permissions = await this.getEffectivePermissions(userProfileId);
|
|
16674
17282
|
const wildcardPerms = permissions.objectPermissions["*"];
|
|
16675
|
-
if (_optionalChain([wildcardPerms, 'optionalAccess',
|
|
17283
|
+
if (_optionalChain([wildcardPerms, 'optionalAccess', _403 => _403.includes, 'call', _404 => _404(action)])) {
|
|
16676
17284
|
return true;
|
|
16677
17285
|
}
|
|
16678
17286
|
const objectPerms = permissions.objectPermissions[objectName];
|
|
16679
|
-
return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess',
|
|
17287
|
+
return _nullishCoalesce(_optionalChain([objectPerms, 'optionalAccess', _405 => _405.includes, 'call', _406 => _406(action)]), () => ( false));
|
|
16680
17288
|
}
|
|
16681
17289
|
/**
|
|
16682
17290
|
* Check if user can access an object, throw ForbiddenError if not.
|
|
@@ -16725,12 +17333,12 @@ var PermissionService = class extends BaseService {
|
|
|
16725
17333
|
*/
|
|
16726
17334
|
async canAccessSystem(userProfileId, resource, action) {
|
|
16727
17335
|
const permissions = await this.getEffectivePermissions(userProfileId);
|
|
16728
|
-
const wildcardPerms = _optionalChain([permissions, 'access',
|
|
16729
|
-
if (_optionalChain([wildcardPerms, 'optionalAccess',
|
|
17336
|
+
const wildcardPerms = _optionalChain([permissions, 'access', _407 => _407.systemPermissions, 'optionalAccess', _408 => _408["*"]]);
|
|
17337
|
+
if (_optionalChain([wildcardPerms, 'optionalAccess', _409 => _409.includes, 'call', _410 => _410(action)])) {
|
|
16730
17338
|
return true;
|
|
16731
17339
|
}
|
|
16732
|
-
const resourcePerms = _optionalChain([permissions, 'access',
|
|
16733
|
-
return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess',
|
|
17340
|
+
const resourcePerms = _optionalChain([permissions, 'access', _411 => _411.systemPermissions, 'optionalAccess', _412 => _412[resource]]);
|
|
17341
|
+
return _nullishCoalesce(_optionalChain([resourcePerms, 'optionalAccess', _413 => _413.includes, 'call', _414 => _414(action)]), () => ( false));
|
|
16734
17342
|
}
|
|
16735
17343
|
/**
|
|
16736
17344
|
* Check if user can access a system resource, throw ForbiddenError if not.
|
|
@@ -16756,8 +17364,8 @@ var PermissionService = class extends BaseService {
|
|
|
16756
17364
|
*/
|
|
16757
17365
|
async getSystemPermissions(userProfileId, resource) {
|
|
16758
17366
|
const permissions = await this.getEffectivePermissions(userProfileId);
|
|
16759
|
-
const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access',
|
|
16760
|
-
const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access',
|
|
17367
|
+
const wildcardPerms = _nullishCoalesce(_optionalChain([permissions, 'access', _415 => _415.systemPermissions, 'optionalAccess', _416 => _416["*"]]), () => ( []));
|
|
17368
|
+
const resourcePerms = _nullishCoalesce(_optionalChain([permissions, 'access', _417 => _417.systemPermissions, 'optionalAccess', _418 => _418[resource]]), () => ( []));
|
|
16761
17369
|
const allPerms = /* @__PURE__ */ new Set([...wildcardPerms, ...resourcePerms]);
|
|
16762
17370
|
return {
|
|
16763
17371
|
canRead: allPerms.has("read"),
|
|
@@ -16900,7 +17508,7 @@ var PermissionService = class extends BaseService {
|
|
|
16900
17508
|
action: "role.updated",
|
|
16901
17509
|
actorId: this.userId,
|
|
16902
17510
|
roleId,
|
|
16903
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
17511
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _419 => _419.label]), () => ( roleId)),
|
|
16904
17512
|
metadata: { permissionsUpdated: true, permissionCount: permissions.length }
|
|
16905
17513
|
});
|
|
16906
17514
|
}
|
|
@@ -16930,7 +17538,7 @@ var PermissionService = class extends BaseService {
|
|
|
16930
17538
|
action: "role.assigned",
|
|
16931
17539
|
actorId: this.userId,
|
|
16932
17540
|
roleId,
|
|
16933
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
17541
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _420 => _420.label]), () => ( roleId)),
|
|
16934
17542
|
targetUserId: userProfileId
|
|
16935
17543
|
});
|
|
16936
17544
|
}
|
|
@@ -16948,7 +17556,7 @@ var PermissionService = class extends BaseService {
|
|
|
16948
17556
|
action: "role.revoked",
|
|
16949
17557
|
actorId: this.userId,
|
|
16950
17558
|
roleId,
|
|
16951
|
-
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess',
|
|
17559
|
+
roleLabel: _nullishCoalesce(_optionalChain([role, 'optionalAccess', _421 => _421.label]), () => ( roleId)),
|
|
16952
17560
|
targetUserId: userProfileId
|
|
16953
17561
|
});
|
|
16954
17562
|
}
|
|
@@ -16956,6 +17564,74 @@ var PermissionService = class extends BaseService {
|
|
|
16956
17564
|
// ============================================================================
|
|
16957
17565
|
// INITIALIZATION
|
|
16958
17566
|
// ============================================================================
|
|
17567
|
+
/**
|
|
17568
|
+
* Reset all roles and permissions to their default configuration.
|
|
17569
|
+
*
|
|
17570
|
+
* This will:
|
|
17571
|
+
* 1. Delete all custom (non-system) roles and reassign their users to the default member role
|
|
17572
|
+
* 2. Reset permissions on the default roles (owner, member) back to defaults
|
|
17573
|
+
* 3. Invalidate all permission caches
|
|
17574
|
+
*
|
|
17575
|
+
* @example
|
|
17576
|
+
* ```typescript
|
|
17577
|
+
* const service = new PermissionService(adapter);
|
|
17578
|
+
* await service.resetToDefaults();
|
|
17579
|
+
* ```
|
|
17580
|
+
*/
|
|
17581
|
+
async resetToDefaults() {
|
|
17582
|
+
const { DEFAULT_ROLES, DEFAULT_ROLE_PERMISSIONS } = await Promise.resolve().then(() => _interopRequireWildcard(require("./default-roles-5K3GHJTS.js")));
|
|
17583
|
+
await this.initializeDefaultRoles();
|
|
17584
|
+
const allRoles = await this.getRoles();
|
|
17585
|
+
const memberRole = allRoles.find((r) => r.name === DEFAULT_ROLES.MEMBER);
|
|
17586
|
+
if (!memberRole) {
|
|
17587
|
+
throw new Error("Default member role not found after initialization");
|
|
17588
|
+
}
|
|
17589
|
+
const customRoles = allRoles.filter(
|
|
17590
|
+
(r) => !Object.values(DEFAULT_ROLES).includes(
|
|
17591
|
+
r.name
|
|
17592
|
+
)
|
|
17593
|
+
);
|
|
17594
|
+
for (const role of customRoles) {
|
|
17595
|
+
const usersWithRole = await this.permissionsRepo.countUsersWithRole(role.name);
|
|
17596
|
+
if (usersWithRole > 0) {
|
|
17597
|
+
}
|
|
17598
|
+
await this.permissionsRepo.deleteRole(role.id);
|
|
17599
|
+
}
|
|
17600
|
+
for (const roleName of Object.values(DEFAULT_ROLES)) {
|
|
17601
|
+
const role = allRoles.find((r) => r.name === roleName);
|
|
17602
|
+
if (!role) continue;
|
|
17603
|
+
const permConfig = DEFAULT_ROLE_PERMISSIONS[roleName];
|
|
17604
|
+
const permissionInputs = [];
|
|
17605
|
+
for (const perm of permConfig.system) {
|
|
17606
|
+
permissionInputs.push({
|
|
17607
|
+
scope: "system",
|
|
17608
|
+
target: perm.target,
|
|
17609
|
+
actions: perm.actions
|
|
17610
|
+
});
|
|
17611
|
+
}
|
|
17612
|
+
for (const perm of permConfig.object) {
|
|
17613
|
+
permissionInputs.push({
|
|
17614
|
+
scope: "object",
|
|
17615
|
+
target: perm.target,
|
|
17616
|
+
actions: perm.actions
|
|
17617
|
+
});
|
|
17618
|
+
}
|
|
17619
|
+
await this.permissionsRepo.setPermissions(role.id, permissionInputs);
|
|
17620
|
+
}
|
|
17621
|
+
await this.invalidateAllCache();
|
|
17622
|
+
if (this.auditService && this.userId) {
|
|
17623
|
+
await this.auditService.logRoleAction({
|
|
17624
|
+
action: "role.updated",
|
|
17625
|
+
actorId: this.userId,
|
|
17626
|
+
roleId: "all",
|
|
17627
|
+
roleLabel: "All roles",
|
|
17628
|
+
metadata: {
|
|
17629
|
+
resetToDefaults: true,
|
|
17630
|
+
customRolesDeleted: customRoles.length
|
|
17631
|
+
}
|
|
17632
|
+
});
|
|
17633
|
+
}
|
|
17634
|
+
}
|
|
16959
17635
|
/**
|
|
16960
17636
|
* Initialize default roles for the tenant if they don't exist.
|
|
16961
17637
|
*
|
|
@@ -17422,7 +18098,7 @@ var ViewService = class extends BaseService {
|
|
|
17422
18098
|
dbView.objectName,
|
|
17423
18099
|
dbView.type,
|
|
17424
18100
|
objectDefinition,
|
|
17425
|
-
dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access',
|
|
18101
|
+
dbView.type === "detail" ? _nullishCoalesce(_optionalChain([dbView, 'access', _422 => _422.config, 'optionalAccess', _423 => _423.layout]), () => ( "page")) : void 0
|
|
17426
18102
|
);
|
|
17427
18103
|
const newConfig = generated.config;
|
|
17428
18104
|
const updated = await this.adapter.views.update(viewId, { config: newConfig });
|
|
@@ -18324,4 +19000,16 @@ var NoopGeocodingAdapter = class {
|
|
|
18324
19000
|
|
|
18325
19001
|
|
|
18326
19002
|
|
|
18327
|
-
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.isBilateralRelation = isBilateralRelation; exports.inferInverseCardinality = inferInverseCardinality; exports.NON_SORTABLE_TYPES = NON_SORTABLE_TYPES; exports.isAttributeSortable = isAttributeSortable; exports.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.getErrorMessage = getErrorMessage; exports.isFlowFieldsRow = isFlowFieldsRow; exports.isLayoutRow = isLayoutRow; exports.isFlowDefinition = isFlowDefinition; exports.isFlowPublished = isFlowPublished; exports.isSystemFlow = isSystemFlow; exports.NoopGeocodingAdapter = NoopGeocodingAdapter; exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES; exports.RESERVED_ATTRIBUTE_NAMES = RESERVED_ATTRIBUTE_NAMES; exports.PolicyViolationError = PolicyViolationError; exports.FORBIDDEN_PROPERTY_TYPES = FORBIDDEN_PROPERTY_TYPES; exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES; exports.getSystemAttributeList = getSystemAttributeList; exports.isSystemAttribute = isSystemAttribute; exports.isSystemAttributeObject = isSystemAttributeObject; exports.nodeTypeRegistry = nodeTypeRegistry; exports.getNodeOutputs = getNodeOutputs; exports.setNodeNext = setNodeNext; exports.getNodeSlotIds = getNodeSlotIds; exports.validateNode = validateNode; exports.getFormFieldRefs = getFormFieldRefs; exports.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isAssignNode = isAssignNode; exports.isEndNode = isEndNode; 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.isFormFieldsRow = isFormFieldsRow; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; exports.ZONE_ORDER = ZONE_ORDER; exports.ZONE_CONFIG = ZONE_CONFIG; exports.assignNodeZones = assignNodeZones; exports.groupNodesByZone = groupNodesByZone; exports.getZoneAllowedTypes = getZoneAllowedTypes; 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.AssignmentSourceSchema = AssignmentSourceSchema; exports.AssignmentMappingSchema = AssignmentMappingSchema; exports.AssignNodeSchema = AssignNodeSchema; 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.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.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.RelationGroupBuilder = RelationGroupBuilder; exports.TableTabConfig = TableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.RichtextTabConfig = RichtextTabConfig; 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.relationGroup = relationGroup; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowAssignBuilder = WorkflowAssignBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; 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.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.AssignExecutor = AssignExecutor; 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.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.SORTABLE_ATTRIBUTE_TYPES = SORTABLE_ATTRIBUTE_TYPES; 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.RelationPropertiesService = RelationPropertiesService; exports.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; 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.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;
|
|
19003
|
+
|
|
19004
|
+
|
|
19005
|
+
|
|
19006
|
+
|
|
19007
|
+
|
|
19008
|
+
|
|
19009
|
+
|
|
19010
|
+
|
|
19011
|
+
|
|
19012
|
+
|
|
19013
|
+
|
|
19014
|
+
|
|
19015
|
+
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.isBilateralRelation = isBilateralRelation; exports.inferInverseCardinality = inferInverseCardinality; exports.NON_SORTABLE_TYPES = NON_SORTABLE_TYPES; exports.isAttributeSortable = isAttributeSortable; exports.RecordReferencedError = RecordReferencedError; exports.AttributeInUseError = AttributeInUseError; exports.ObjectReferencedError = ObjectReferencedError; exports.getErrorMessage = getErrorMessage; exports.isFlowFieldsRow = isFlowFieldsRow; exports.isLayoutRow = isLayoutRow; exports.isFlowDefinition = isFlowDefinition; exports.isFlowPublished = isFlowPublished; exports.isSystemFlow = isSystemFlow; exports.NoopGeocodingAdapter = NoopGeocodingAdapter; exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES; exports.RESERVED_ATTRIBUTE_NAMES = RESERVED_ATTRIBUTE_NAMES; exports.PolicyViolationError = PolicyViolationError; exports.FORBIDDEN_PROPERTY_TYPES = FORBIDDEN_PROPERTY_TYPES; exports.hasOptions = hasOptions2; exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES; exports.getSystemAttributeList = getSystemAttributeList; exports.isSystemAttribute = isSystemAttribute; exports.isSystemAttributeObject = isSystemAttributeObject; exports.nodeTypeRegistry = nodeTypeRegistry; exports.getNodeOutputs = getNodeOutputs; exports.setNodeNext = setNodeNext; exports.getNodeSlotIds = getNodeSlotIds; exports.validateNode = validateNode; exports.getFormFieldRefs = getFormFieldRefs; exports.isSimpleFormNode = isSimpleFormNode; exports.isAdvancedFormNode = isAdvancedFormNode; exports.isStartNode = isStartNode; exports.isFormNode = isFormNode; exports.isConditionNode = isConditionNode; exports.isAssignNode = isAssignNode; exports.isAINode = isAINode; exports.isEndNode = isEndNode; 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.isFormFieldsRow = isFormFieldsRow; exports.DEFAULT_THEME = DEFAULT_THEME; exports.mergeWithDefaults = mergeWithDefaults; exports.generateCssVariables = generateCssVariables; exports.isInstanceEvent = isInstanceEvent; exports.isNodeEvent = isNodeEvent; exports.isInvitationOrGrantEvent = isInvitationOrGrantEvent; exports.ZONE_ORDER = ZONE_ORDER; exports.ZONE_CONFIG = ZONE_CONFIG; exports.assignNodeZones = assignNodeZones; exports.groupNodesByZone = groupNodesByZone; exports.getZoneAllowedTypes = getZoneAllowedTypes; 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.AssignmentSourceSchema = AssignmentSourceSchema; exports.AssignmentMappingSchema = AssignmentMappingSchema; exports.AssignNodeSchema = AssignNodeSchema; exports.DocumentGenerationActionSchema = DocumentGenerationActionSchema; exports.CodeExecutionActionSchema = CodeExecutionActionSchema; exports.AIActionConfigSchema = AIActionConfigSchema; exports.AINodeSchema = AINodeSchema; 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.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.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.RelationGroupBuilder = RelationGroupBuilder; exports.TableTabConfig = TableTabConfig; exports.CustomTabConfig = CustomTabConfig; exports.RichtextTabConfig = RichtextTabConfig; 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.relationGroup = relationGroup; exports.WorkflowFormRowBuilder = WorkflowFormRowBuilder; exports.WorkflowFormBuilder = WorkflowFormBuilder; exports.WorkflowSimpleFormBuilder = WorkflowSimpleFormBuilder; exports.WorkflowConditionBuilder = WorkflowConditionBuilder; exports.WorkflowAssignBuilder = WorkflowAssignBuilder; exports.WorkflowAIBuilder = WorkflowAIBuilder; exports.WorkflowEndBuilder = WorkflowEndBuilder; exports.WorkflowStartBuilder = WorkflowStartBuilder; exports.WorkflowBuilder = WorkflowBuilder; exports.workflow = workflow; exports.registry = registry; 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.EndExecutor = EndExecutor; exports.FormExecutor = FormExecutor; exports.AssignExecutor = AssignExecutor; exports.AIExecutor = AIExecutor; exports.AIActionRegistry = AIActionRegistry; exports.DocumentGenerationHandler = DocumentGenerationHandler; exports.CodeExecutionHandler = CodeExecutionHandler; exports.createDefaultAIActionRegistry = createDefaultAIActionRegistry; 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.createMockAdapter = createMockAdapter; exports.PolicyRegistry = PolicyRegistry; exports.defaultPolicyRegistry = defaultPolicyRegistry; exports.SORTABLE_ATTRIBUTE_TYPES = SORTABLE_ATTRIBUTE_TYPES; 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.RelationPropertiesService = RelationPropertiesService; exports.RecordQueryService = RecordQueryService; exports.RecordResolverService = RecordResolverService; exports.RelationService = RelationService; exports.RollupService = RollupService; exports.RecordService = RecordService; exports.FormulaResolverService = FormulaResolverService; exports.RollupScheduler = RollupScheduler; 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.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;
|