@stndrds/schema 0.1.0-alpha.50 → 0.1.0-alpha.52
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-FDWX5X6L.mjs → chunk-D4AFKFAX.mjs} +449 -124
- package/dist/{chunk-LPCQM5VG.js → chunk-LPOSOME6.js} +588 -263
- package/dist/index.d.mts +70 -3
- package/dist/index.d.ts +70 -3
- package/dist/index.js +8 -6
- package/dist/index.mjs +5 -3
- package/dist/{runtime-BbM_jyVU.d.mts → runtime-C8IgSFtA.d.mts} +974 -411
- package/dist/{runtime-BbM_jyVU.d.ts → runtime-C8IgSFtA.d.ts} +974 -411
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +4 -2
- package/dist/runtime.mjs +5 -3
- package/package.json +2 -2
|
@@ -1,6 +1,295 @@
|
|
|
1
1
|
import { ColorId, IconName, CountryIso3, CurrencyCode, MimeType } from '@stndrds/constants';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Message role in a conversation
|
|
6
|
+
*/
|
|
7
|
+
type AIMessageRole = "user" | "assistant";
|
|
8
|
+
/**
|
|
9
|
+
* Level of "thinking" or reasoning depth
|
|
10
|
+
*/
|
|
11
|
+
type AIThinkingLevel = "none" | "light" | "deep" | "maximum";
|
|
12
|
+
/**
|
|
13
|
+
* Tool call status during execution
|
|
14
|
+
*/
|
|
15
|
+
type AIToolCallStatus = "pending" | "running" | "success" | "error";
|
|
16
|
+
/**
|
|
17
|
+
* Tool call information for chat UI
|
|
18
|
+
*/
|
|
19
|
+
interface AIToolCall {
|
|
20
|
+
/** Unique tool call ID */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Tool name */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Tool arguments */
|
|
25
|
+
args?: Record<string, unknown>;
|
|
26
|
+
/** Tool result (when complete) */
|
|
27
|
+
result?: unknown;
|
|
28
|
+
/** Error message if failed */
|
|
29
|
+
error?: string;
|
|
30
|
+
/** Execution status */
|
|
31
|
+
status: AIToolCallStatus;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Part type for message content
|
|
35
|
+
*/
|
|
36
|
+
type AIChatMessagePartType = "text" | "attachment" | "tool" | "thinking" | "reasoning" | "todo" | "question" | "error" | "approval" | "record" | "search-results" | (string & {});
|
|
37
|
+
/**
|
|
38
|
+
* Data for text part
|
|
39
|
+
*/
|
|
40
|
+
interface TextPartData {
|
|
41
|
+
text: string;
|
|
42
|
+
isStreaming?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Data for tool part (same as AIToolCall)
|
|
46
|
+
*/
|
|
47
|
+
interface ToolPartData {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
args?: Record<string, unknown>;
|
|
51
|
+
result?: unknown;
|
|
52
|
+
error?: string;
|
|
53
|
+
status: AIToolCallStatus;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Data for thinking part
|
|
57
|
+
*/
|
|
58
|
+
interface ThinkingPartData {
|
|
59
|
+
isStreaming: boolean;
|
|
60
|
+
startTime?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Data for reasoning part (Extended Thinking content)
|
|
64
|
+
*/
|
|
65
|
+
interface ReasoningPartData {
|
|
66
|
+
/** Reasoning content (accumulated during streaming) */
|
|
67
|
+
content: string;
|
|
68
|
+
/** Whether reasoning is still streaming */
|
|
69
|
+
isStreaming: boolean;
|
|
70
|
+
/** Start timestamp for elapsed time display */
|
|
71
|
+
startTime?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A part of a chat message.
|
|
75
|
+
* Parts are ordered chronologically as they arrive from the stream.
|
|
76
|
+
*/
|
|
77
|
+
interface AIChatMessagePart {
|
|
78
|
+
/** Part type */
|
|
79
|
+
type: AIChatMessagePartType;
|
|
80
|
+
/** Unique part ID */
|
|
81
|
+
id: string;
|
|
82
|
+
/** Part-specific data */
|
|
83
|
+
data: unknown;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Chat message for runtime/streaming.
|
|
87
|
+
*
|
|
88
|
+
* All content is represented as ordered parts (text, tools, thinking, etc.)
|
|
89
|
+
* Parts are in chronological order as they arrive from the stream.
|
|
90
|
+
*
|
|
91
|
+
* Used in:
|
|
92
|
+
* - useAgentChat hook
|
|
93
|
+
* - AI chat UI components
|
|
94
|
+
* - Stream processing
|
|
95
|
+
*/
|
|
96
|
+
interface AIChatMessage {
|
|
97
|
+
/** Unique message ID */
|
|
98
|
+
id: string;
|
|
99
|
+
/** Message role */
|
|
100
|
+
role: AIMessageRole;
|
|
101
|
+
/** Ordered message parts (text, tools, thinking, etc.) */
|
|
102
|
+
parts: AIChatMessagePart[];
|
|
103
|
+
/** Whether the message is still streaming */
|
|
104
|
+
isStreaming?: boolean;
|
|
105
|
+
/** Message timestamp */
|
|
106
|
+
timestamp?: Date;
|
|
107
|
+
/** Error message if the message failed */
|
|
108
|
+
error?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Question types supported by the agent
|
|
112
|
+
*/
|
|
113
|
+
type AIQuestionType = "text" | "choice" | "confirm" | "multiselect";
|
|
114
|
+
/**
|
|
115
|
+
* Option for choice/multiselect questions
|
|
116
|
+
*/
|
|
117
|
+
interface AIQuestionOption {
|
|
118
|
+
value: string;
|
|
119
|
+
label: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Question from the agent to the user
|
|
124
|
+
*/
|
|
125
|
+
interface AIQuestion {
|
|
126
|
+
/** Unique question ID */
|
|
127
|
+
id: string;
|
|
128
|
+
/** Question type */
|
|
129
|
+
type: AIQuestionType;
|
|
130
|
+
/** Question text */
|
|
131
|
+
question: string;
|
|
132
|
+
/** Options for choice/multiselect */
|
|
133
|
+
options?: AIQuestionOption[];
|
|
134
|
+
/** Placeholder for text input */
|
|
135
|
+
placeholder?: string;
|
|
136
|
+
/** Whether answer is required */
|
|
137
|
+
required?: boolean;
|
|
138
|
+
/** Min selections for multiselect */
|
|
139
|
+
minSelections?: number;
|
|
140
|
+
/** Max selections for multiselect */
|
|
141
|
+
maxSelections?: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Answer format for questions
|
|
145
|
+
*/
|
|
146
|
+
type AIQuestionAnswer = {
|
|
147
|
+
type: "text";
|
|
148
|
+
value: string;
|
|
149
|
+
} | {
|
|
150
|
+
type: "choice";
|
|
151
|
+
value: string;
|
|
152
|
+
} | {
|
|
153
|
+
type: "confirm";
|
|
154
|
+
value: boolean;
|
|
155
|
+
} | {
|
|
156
|
+
type: "multiselect";
|
|
157
|
+
value: string[];
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Todo item status
|
|
161
|
+
*/
|
|
162
|
+
type AITodoStatus = "pending" | "in_progress" | "completed" | "blocked";
|
|
163
|
+
/**
|
|
164
|
+
* Todo item in a task list
|
|
165
|
+
*/
|
|
166
|
+
interface AITodoItem {
|
|
167
|
+
id: string;
|
|
168
|
+
description: string;
|
|
169
|
+
status: AITodoStatus;
|
|
170
|
+
result?: string;
|
|
171
|
+
updatedAt?: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Todo list managed by the agent
|
|
175
|
+
*/
|
|
176
|
+
interface AITodoList {
|
|
177
|
+
items: AITodoItem[];
|
|
178
|
+
progress: number;
|
|
179
|
+
isComplete: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Resolved attachment metadata (populated when fetching messages)
|
|
183
|
+
*/
|
|
184
|
+
interface AIMessageAttachment {
|
|
185
|
+
id: string;
|
|
186
|
+
name: string;
|
|
187
|
+
size: number;
|
|
188
|
+
mimeType: string;
|
|
189
|
+
url: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* AI Conversation record
|
|
193
|
+
*/
|
|
194
|
+
interface AIConversation {
|
|
195
|
+
id: string;
|
|
196
|
+
tenantId: string;
|
|
197
|
+
userId: string;
|
|
198
|
+
title: string | null;
|
|
199
|
+
messageCount: number;
|
|
200
|
+
totalTokens: number;
|
|
201
|
+
totalCost: number;
|
|
202
|
+
createdAt: Date;
|
|
203
|
+
updatedAt: Date;
|
|
204
|
+
deletedAt: Date | null;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* AI Message record
|
|
208
|
+
*/
|
|
209
|
+
interface AIMessage {
|
|
210
|
+
id: string;
|
|
211
|
+
conversationId: string;
|
|
212
|
+
role: AIMessageRole;
|
|
213
|
+
content: string;
|
|
214
|
+
thinkingLevel: AIThinkingLevel | null;
|
|
215
|
+
thinkingSummary: string | null;
|
|
216
|
+
toolCalls: AIToolCallRecord[] | null;
|
|
217
|
+
inputTokens: number | null;
|
|
218
|
+
outputTokens: number | null;
|
|
219
|
+
cost: number | null;
|
|
220
|
+
provider: string | null;
|
|
221
|
+
model: string | null;
|
|
222
|
+
/** File attachment IDs (references files table) */
|
|
223
|
+
attachmentIds: string[] | null;
|
|
224
|
+
/** Resolved attachments (populated when fetching messages) */
|
|
225
|
+
attachments?: AIMessageAttachment[];
|
|
226
|
+
createdAt: Date;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Tool call record stored in JSONB
|
|
230
|
+
*/
|
|
231
|
+
interface AIToolCallRecord {
|
|
232
|
+
/** Tool call ID (from AI SDK) for matching call with result */
|
|
233
|
+
id?: string;
|
|
234
|
+
name: string;
|
|
235
|
+
args: unknown;
|
|
236
|
+
result?: unknown;
|
|
237
|
+
error?: string;
|
|
238
|
+
/** Reasoning/thinking that occurred before this tool call */
|
|
239
|
+
reasoningBefore?: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* AI User Memory record
|
|
243
|
+
*/
|
|
244
|
+
interface AIUserMemory {
|
|
245
|
+
id: string;
|
|
246
|
+
tenantId: string;
|
|
247
|
+
userId: string;
|
|
248
|
+
preferences: Record<string, unknown>;
|
|
249
|
+
facts: string[];
|
|
250
|
+
createdAt: Date;
|
|
251
|
+
updatedAt: Date;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* AI Usage Metrics record
|
|
255
|
+
*/
|
|
256
|
+
interface AIUsageMetrics {
|
|
257
|
+
id: string;
|
|
258
|
+
tenantId: string;
|
|
259
|
+
date: Date;
|
|
260
|
+
requestCount: number;
|
|
261
|
+
totalTokens: number;
|
|
262
|
+
totalCost: number;
|
|
263
|
+
providerBreakdown: Record<string, AIProviderMetrics>;
|
|
264
|
+
toolUsage: Record<string, number>;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Provider-specific metrics
|
|
268
|
+
*/
|
|
269
|
+
interface AIProviderMetrics {
|
|
270
|
+
requests: number;
|
|
271
|
+
tokens: number;
|
|
272
|
+
cost: number;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Input for creating an AI message
|
|
276
|
+
*/
|
|
277
|
+
interface CreateAIMessageInput {
|
|
278
|
+
conversationId: string;
|
|
279
|
+
role: AIMessageRole;
|
|
280
|
+
content: string;
|
|
281
|
+
thinkingLevel?: AIThinkingLevel;
|
|
282
|
+
thinkingSummary?: string;
|
|
283
|
+
toolCalls?: AIToolCallRecord[];
|
|
284
|
+
inputTokens?: number;
|
|
285
|
+
outputTokens?: number;
|
|
286
|
+
cost?: number;
|
|
287
|
+
provider?: string;
|
|
288
|
+
model?: string;
|
|
289
|
+
/** File attachment IDs (references files table) */
|
|
290
|
+
attachmentIds?: string[];
|
|
291
|
+
}
|
|
292
|
+
|
|
4
293
|
/**
|
|
5
294
|
* Brand symbol for nominal typing.
|
|
6
295
|
* This ensures type-safety by making IDs non-interchangeable.
|
|
@@ -4473,8 +4762,8 @@ declare const statusConfigSchema: z.ZodObject<{
|
|
|
4473
4762
|
icon: z.ZodOptional<z.ZodString>;
|
|
4474
4763
|
description: z.ZodOptional<z.ZodString>;
|
|
4475
4764
|
group: z.ZodOptional<z.ZodEnum<{
|
|
4476
|
-
idle: "idle";
|
|
4477
4765
|
in_progress: "in_progress";
|
|
4766
|
+
idle: "idle";
|
|
4478
4767
|
finished: "finished";
|
|
4479
4768
|
}>>;
|
|
4480
4769
|
}, z.core.$strip>>;
|
|
@@ -4533,8 +4822,8 @@ declare const selectConfigSchema: z.ZodObject<{
|
|
|
4533
4822
|
icon: z.ZodOptional<z.ZodString>;
|
|
4534
4823
|
description: z.ZodOptional<z.ZodString>;
|
|
4535
4824
|
group: z.ZodOptional<z.ZodEnum<{
|
|
4536
|
-
idle: "idle";
|
|
4537
4825
|
in_progress: "in_progress";
|
|
4826
|
+
idle: "idle";
|
|
4538
4827
|
finished: "finished";
|
|
4539
4828
|
}>>;
|
|
4540
4829
|
}, z.core.$strip>>;
|
|
@@ -4561,8 +4850,8 @@ declare const multiselectConfigSchema: z.ZodObject<{
|
|
|
4561
4850
|
icon: z.ZodOptional<z.ZodString>;
|
|
4562
4851
|
description: z.ZodOptional<z.ZodString>;
|
|
4563
4852
|
group: z.ZodOptional<z.ZodEnum<{
|
|
4564
|
-
idle: "idle";
|
|
4565
4853
|
in_progress: "in_progress";
|
|
4854
|
+
idle: "idle";
|
|
4566
4855
|
finished: "finished";
|
|
4567
4856
|
}>>;
|
|
4568
4857
|
}, z.core.$strip>>;
|
|
@@ -4715,8 +5004,8 @@ declare const rollupConfigSchema: z.ZodObject<{
|
|
|
4715
5004
|
icon: z.ZodOptional<z.ZodString>;
|
|
4716
5005
|
description: z.ZodOptional<z.ZodString>;
|
|
4717
5006
|
group: z.ZodOptional<z.ZodEnum<{
|
|
4718
|
-
idle: "idle";
|
|
4719
5007
|
in_progress: "in_progress";
|
|
5008
|
+
idle: "idle";
|
|
4720
5009
|
finished: "finished";
|
|
4721
5010
|
}>>;
|
|
4722
5011
|
}, z.core.$strip>>>;
|
|
@@ -5391,12 +5680,17 @@ interface UserProfilesRepository {
|
|
|
5391
5680
|
interface FilesRepository {
|
|
5392
5681
|
/**
|
|
5393
5682
|
* Find file by ID.
|
|
5394
|
-
* Automatically filtered by current tenant context.
|
|
5683
|
+
* Returns file with signed URL. Automatically filtered by current tenant context.
|
|
5395
5684
|
*/
|
|
5396
5685
|
findById(id: Uuid): Promise<File | null>;
|
|
5686
|
+
/**
|
|
5687
|
+
* Find multiple files by IDs.
|
|
5688
|
+
* Returns files with signed URLs. Automatically filtered by current tenant context.
|
|
5689
|
+
*/
|
|
5690
|
+
findByIds(ids: Uuid[]): Promise<File[]>;
|
|
5397
5691
|
/**
|
|
5398
5692
|
* Create file.
|
|
5399
|
-
* Tenant ID is automatically set from context.
|
|
5693
|
+
* Returns file with signed URL. Tenant ID is automatically set from context.
|
|
5400
5694
|
*/
|
|
5401
5695
|
create(data: CreateFile): Promise<File>;
|
|
5402
5696
|
/**
|
|
@@ -5969,6 +6263,150 @@ interface PermissionsRepository {
|
|
|
5969
6263
|
getEffectivePermissions(userProfileId: Uuid): Promise<EffectivePermissions>;
|
|
5970
6264
|
}
|
|
5971
6265
|
|
|
6266
|
+
/**
|
|
6267
|
+
* Repository for AI conversations and messages.
|
|
6268
|
+
*
|
|
6269
|
+
* This repository is optional - if not provided in the DatabaseAdapter,
|
|
6270
|
+
* AI conversation history features are disabled.
|
|
6271
|
+
*
|
|
6272
|
+
* All operations are automatically scoped to the current tenant
|
|
6273
|
+
* from the execution context (via AsyncLocalStorage).
|
|
6274
|
+
*/
|
|
6275
|
+
interface AIConversationsRepository {
|
|
6276
|
+
/**
|
|
6277
|
+
* Find conversation by ID.
|
|
6278
|
+
* Automatically filtered by current tenant context.
|
|
6279
|
+
*/
|
|
6280
|
+
findById(id: Uuid): Promise<AIConversation | null>;
|
|
6281
|
+
/**
|
|
6282
|
+
* List conversations for current user.
|
|
6283
|
+
* Automatically filtered by current tenant and user context.
|
|
6284
|
+
*/
|
|
6285
|
+
list(options?: {
|
|
6286
|
+
limit?: number;
|
|
6287
|
+
offset?: number;
|
|
6288
|
+
includeDeleted?: boolean;
|
|
6289
|
+
}): Promise<{
|
|
6290
|
+
conversations: AIConversation[];
|
|
6291
|
+
total: number;
|
|
6292
|
+
}>;
|
|
6293
|
+
/**
|
|
6294
|
+
* Create conversation.
|
|
6295
|
+
* Tenant ID and User ID are automatically set from context.
|
|
6296
|
+
*/
|
|
6297
|
+
create(data: {
|
|
6298
|
+
title?: string;
|
|
6299
|
+
}): Promise<AIConversation>;
|
|
6300
|
+
/**
|
|
6301
|
+
* Update conversation title.
|
|
6302
|
+
* Automatically filtered by current tenant context.
|
|
6303
|
+
*/
|
|
6304
|
+
updateTitle(id: Uuid, title: string): Promise<AIConversation | null>;
|
|
6305
|
+
/**
|
|
6306
|
+
* Soft delete conversation.
|
|
6307
|
+
* Automatically filtered by current tenant context.
|
|
6308
|
+
*/
|
|
6309
|
+
delete(id: Uuid): Promise<boolean>;
|
|
6310
|
+
/**
|
|
6311
|
+
* Add message to conversation.
|
|
6312
|
+
* Automatically updates conversation stats.
|
|
6313
|
+
*/
|
|
6314
|
+
addMessage(input: CreateAIMessageInput): Promise<AIMessage>;
|
|
6315
|
+
/**
|
|
6316
|
+
* List messages in a conversation.
|
|
6317
|
+
* Automatically filtered by current tenant context (via conversation ownership).
|
|
6318
|
+
*/
|
|
6319
|
+
listMessages(conversationId: Uuid, options?: {
|
|
6320
|
+
limit?: number;
|
|
6321
|
+
offset?: number;
|
|
6322
|
+
}): Promise<{
|
|
6323
|
+
messages: AIMessage[];
|
|
6324
|
+
total: number;
|
|
6325
|
+
}>;
|
|
6326
|
+
/**
|
|
6327
|
+
* Get recent messages for context (last N messages).
|
|
6328
|
+
* Returns messages ordered by created_at ASC.
|
|
6329
|
+
*/
|
|
6330
|
+
getRecentMessages(conversationId: Uuid, count?: number): Promise<AIMessage[]>;
|
|
6331
|
+
}
|
|
6332
|
+
/**
|
|
6333
|
+
* Repository for AI user memory (preferences and learned facts).
|
|
6334
|
+
*
|
|
6335
|
+
* This repository is optional - if not provided in the DatabaseAdapter,
|
|
6336
|
+
* AI personalization features are disabled.
|
|
6337
|
+
*
|
|
6338
|
+
* All operations are automatically scoped to the current tenant and user
|
|
6339
|
+
* from the execution context (via AsyncLocalStorage).
|
|
6340
|
+
*/
|
|
6341
|
+
interface AIUserMemoryRepository {
|
|
6342
|
+
/**
|
|
6343
|
+
* Get memory for current user.
|
|
6344
|
+
* Automatically filtered by current tenant and user context.
|
|
6345
|
+
* Returns null if no memory exists yet.
|
|
6346
|
+
*/
|
|
6347
|
+
get(): Promise<AIUserMemory | null>;
|
|
6348
|
+
/**
|
|
6349
|
+
* Create or update memory for current user.
|
|
6350
|
+
* Tenant ID and User ID are automatically set from context.
|
|
6351
|
+
*/
|
|
6352
|
+
upsert(data: {
|
|
6353
|
+
preferences?: Record<string, unknown>;
|
|
6354
|
+
facts?: string[];
|
|
6355
|
+
}): Promise<AIUserMemory>;
|
|
6356
|
+
/**
|
|
6357
|
+
* Add a fact to user memory.
|
|
6358
|
+
* Automatically appends to existing facts.
|
|
6359
|
+
*/
|
|
6360
|
+
addFact(fact: string): Promise<AIUserMemory>;
|
|
6361
|
+
/**
|
|
6362
|
+
* Remove a fact from user memory.
|
|
6363
|
+
*/
|
|
6364
|
+
removeFact(fact: string): Promise<AIUserMemory>;
|
|
6365
|
+
/**
|
|
6366
|
+
* Update a specific preference.
|
|
6367
|
+
*/
|
|
6368
|
+
setPreference(key: string, value: unknown): Promise<AIUserMemory>;
|
|
6369
|
+
/**
|
|
6370
|
+
* Clear all memory for current user.
|
|
6371
|
+
*/
|
|
6372
|
+
clear(): Promise<void>;
|
|
6373
|
+
}
|
|
6374
|
+
/**
|
|
6375
|
+
* Repository for AI usage metrics.
|
|
6376
|
+
*
|
|
6377
|
+
* This repository is optional - if not provided in the DatabaseAdapter,
|
|
6378
|
+
* AI usage tracking is disabled.
|
|
6379
|
+
*
|
|
6380
|
+
* All operations are automatically scoped to the current tenant
|
|
6381
|
+
* from the execution context (via AsyncLocalStorage).
|
|
6382
|
+
*/
|
|
6383
|
+
interface AIUsageMetricsRepository {
|
|
6384
|
+
/**
|
|
6385
|
+
* Record a usage event (increments counters for the current date).
|
|
6386
|
+
* Automatically handles upsert for the current date.
|
|
6387
|
+
*/
|
|
6388
|
+
recordUsage(data: {
|
|
6389
|
+
provider: string;
|
|
6390
|
+
tokens: number;
|
|
6391
|
+
cost: number;
|
|
6392
|
+
toolName?: string;
|
|
6393
|
+
}): Promise<void>;
|
|
6394
|
+
/**
|
|
6395
|
+
* Get usage metrics for a date range.
|
|
6396
|
+
* Automatically filtered by current tenant context.
|
|
6397
|
+
*/
|
|
6398
|
+
getByDateRange(startDate: Date, endDate: Date): Promise<AIUsageMetrics[]>;
|
|
6399
|
+
/**
|
|
6400
|
+
* Get aggregated usage for current month.
|
|
6401
|
+
* Automatically filtered by current tenant context.
|
|
6402
|
+
*/
|
|
6403
|
+
getCurrentMonthUsage(): Promise<{
|
|
6404
|
+
requestCount: number;
|
|
6405
|
+
totalTokens: number;
|
|
6406
|
+
totalCost: number;
|
|
6407
|
+
}>;
|
|
6408
|
+
}
|
|
6409
|
+
|
|
5972
6410
|
/**
|
|
5973
6411
|
* File content type - supports various formats
|
|
5974
6412
|
* Use Uint8Array for cross-platform compatibility
|
|
@@ -6204,6 +6642,9 @@ interface DatabaseAdapter {
|
|
|
6204
6642
|
audit?: AuditRepository;
|
|
6205
6643
|
storage?: StorageAdapter;
|
|
6206
6644
|
cache?: CacheAdapter;
|
|
6645
|
+
aiConversations?: AIConversationsRepository;
|
|
6646
|
+
aiUserMemory?: AIUserMemoryRepository;
|
|
6647
|
+
aiUsageMetrics?: AIUsageMetricsRepository;
|
|
6207
6648
|
transaction<T>(callback: (adapter: DatabaseAdapter) => Promise<T>): Promise<T>;
|
|
6208
6649
|
}
|
|
6209
6650
|
|
|
@@ -7668,6 +8109,7 @@ interface RecordServiceOptions {
|
|
|
7668
8109
|
declare class RecordService extends BaseService {
|
|
7669
8110
|
private schemaService;
|
|
7670
8111
|
private queryService;
|
|
8112
|
+
private recordResolver;
|
|
7671
8113
|
private relationService;
|
|
7672
8114
|
private userService;
|
|
7673
8115
|
private rollupService;
|
|
@@ -7773,55 +8215,431 @@ declare class RecordService extends BaseService {
|
|
|
7773
8215
|
}
|
|
7774
8216
|
|
|
7775
8217
|
/**
|
|
7776
|
-
*
|
|
8218
|
+
* Default fallback value when expression resolves to empty string
|
|
7777
8219
|
*/
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
errors: RelationValidationError[];
|
|
7781
|
-
}
|
|
8220
|
+
declare const DEFAULT_LABEL_FALLBACK = "(Untitled)";
|
|
8221
|
+
declare function renderLabelExpression(template: string, values: Record<string, unknown>, fallback?: string): string;
|
|
7782
8222
|
/**
|
|
7783
|
-
*
|
|
8223
|
+
* Check if a string is a valid label expression template
|
|
8224
|
+
* A valid template contains at least one {{ variable }} block with a non-empty variable
|
|
7784
8225
|
*/
|
|
7785
|
-
|
|
7786
|
-
/** Attribute name */
|
|
7787
|
-
attribute: string;
|
|
7788
|
-
/** Error message */
|
|
7789
|
-
message: string;
|
|
7790
|
-
/** Invalid record IDs */
|
|
7791
|
-
invalidIds?: string[];
|
|
7792
|
-
}
|
|
8226
|
+
declare function isLabelExpression(value: string): boolean;
|
|
7793
8227
|
/**
|
|
7794
|
-
*
|
|
8228
|
+
* Extract attribute names referenced in a label expression
|
|
8229
|
+
* Useful for validation or dependency tracking
|
|
7795
8230
|
*
|
|
7796
|
-
*
|
|
7797
|
-
*
|
|
7798
|
-
*
|
|
7799
|
-
* on an object to access its record data.
|
|
7800
|
-
*/
|
|
7801
|
-
interface RelationOption {
|
|
7802
|
-
/** Record ID */
|
|
7803
|
-
id: string;
|
|
7804
|
-
/** Object ID */
|
|
7805
|
-
objectId: string;
|
|
7806
|
-
/** Object name (technical name) */
|
|
7807
|
-
objectName: string;
|
|
7808
|
-
/** Object label (display name) */
|
|
7809
|
-
objectLabel: string;
|
|
7810
|
-
/** Object icon */
|
|
7811
|
-
objectIcon?: string;
|
|
7812
|
-
/** Display label (computed from labelExpression) */
|
|
7813
|
-
label: string;
|
|
7814
|
-
}
|
|
7815
|
-
/**
|
|
7816
|
-
* Response for relation options
|
|
8231
|
+
* @example
|
|
8232
|
+
* extractAttributeNames("{{ firstName }} {{ lastName | UPPER }}")
|
|
8233
|
+
* // → ["firstName", "lastName"]
|
|
7817
8234
|
*/
|
|
7818
|
-
|
|
7819
|
-
options: RelationOption[];
|
|
7820
|
-
hasMore: boolean;
|
|
7821
|
-
total: number;
|
|
7822
|
-
}
|
|
8235
|
+
declare function extractAttributeNames(template: string): string[];
|
|
7823
8236
|
/**
|
|
7824
|
-
*
|
|
8237
|
+
* Enrich record values by formatting complex types for display
|
|
8238
|
+
*
|
|
8239
|
+
* Transforms raw values (objects, dates, etc.) into human-readable strings
|
|
8240
|
+
* for use in label expression rendering. Uses formatAttributeValue internally.
|
|
8241
|
+
*
|
|
8242
|
+
* @param values - Record values containing raw attribute values
|
|
8243
|
+
* @param attributes - Attribute definitions for formatting
|
|
8244
|
+
* @returns New object with complex values formatted as strings
|
|
8245
|
+
*
|
|
8246
|
+
* @example
|
|
8247
|
+
* ```typescript
|
|
8248
|
+
* const enriched = enrichValuesForDisplay(
|
|
8249
|
+
* { status: "active", price: { value: 1500, code: "EUR" } },
|
|
8250
|
+
* [
|
|
8251
|
+
* { type: "select", name: "status", options: [{ value: "active", label: "Active" }] },
|
|
8252
|
+
* { type: "currency", name: "price" }
|
|
8253
|
+
* ]
|
|
8254
|
+
* );
|
|
8255
|
+
* // → { status: "Active", price: "1,500.00 EUR" }
|
|
8256
|
+
* ```
|
|
8257
|
+
*/
|
|
8258
|
+
declare function enrichValuesForDisplay(values: Record<string, unknown>, attributes: Attribute[]): Record<string, unknown>;
|
|
8259
|
+
/**
|
|
8260
|
+
* @deprecated Use `enrichValuesForDisplay` instead
|
|
8261
|
+
*/
|
|
8262
|
+
declare const enrichValuesWithSelectLabels: typeof enrichValuesForDisplay;
|
|
8263
|
+
/**
|
|
8264
|
+
* Extract relation IDs from a value (string or array)
|
|
8265
|
+
* For cardinality "many", only the first ID is extracted for label display
|
|
8266
|
+
*
|
|
8267
|
+
* @param val - Relation value (string ID or array of IDs)
|
|
8268
|
+
* @returns Array of IDs (max 1 element for display purposes)
|
|
8269
|
+
*
|
|
8270
|
+
* @example
|
|
8271
|
+
* ```typescript
|
|
8272
|
+
* extractRelationIds("rec-123") // → ["rec-123"]
|
|
8273
|
+
* extractRelationIds(["rec-1", "rec-2"]) // → ["rec-1"]
|
|
8274
|
+
* extractRelationIds(null) // → []
|
|
8275
|
+
* ```
|
|
8276
|
+
*/
|
|
8277
|
+
declare function extractRelationIds(val: unknown): string[];
|
|
8278
|
+
/**
|
|
8279
|
+
* Resolver function type for fetching relation labels
|
|
8280
|
+
* Takes an array of record IDs and returns a map of ID → label
|
|
8281
|
+
*/
|
|
8282
|
+
type RelationLabelResolver = (ids: string[]) => Promise<Map<string, string>>;
|
|
8283
|
+
/**
|
|
8284
|
+
* Compute a label from a template with full relation resolution (1 level deep)
|
|
8285
|
+
*
|
|
8286
|
+
* Uses pre-computed record.label for nested relations to avoid infinite recursion.
|
|
8287
|
+
* This function enriches select/multiselect values AND resolves relation IDs to their labels.
|
|
8288
|
+
*
|
|
8289
|
+
* @param template - Label expression template (e.g., "{{ company }} - {{ name }}")
|
|
8290
|
+
* @param values - Record values to interpolate
|
|
8291
|
+
* @param attributes - Attribute definitions for the object
|
|
8292
|
+
* @param resolveRelationIds - Function to resolve record IDs to their labels
|
|
8293
|
+
* @returns The rendered label string
|
|
8294
|
+
*
|
|
8295
|
+
* @example
|
|
8296
|
+
* ```typescript
|
|
8297
|
+
* const label = await computeLabelWithRelations(
|
|
8298
|
+
* "{{ company }} - {{ name }}",
|
|
8299
|
+
* { company: "rec-123", name: "Product A" },
|
|
8300
|
+
* objectSchema.attributes,
|
|
8301
|
+
* async (ids) => {
|
|
8302
|
+
* const records = await adapter.objectRecords.findByIds(ids);
|
|
8303
|
+
* return new Map(records.map(r => [r.id, r.label]));
|
|
8304
|
+
* }
|
|
8305
|
+
* );
|
|
8306
|
+
* // → "Acme Corp - Product A"
|
|
8307
|
+
* ```
|
|
8308
|
+
*/
|
|
8309
|
+
declare function computeLabelWithRelations(template: string, values: Record<string, unknown>, attributes: Attribute[], resolveRelationIds: RelationLabelResolver): Promise<string>;
|
|
8310
|
+
|
|
8311
|
+
/**
|
|
8312
|
+
* Interface for resolving relation labels.
|
|
8313
|
+
* Allows dependency injection for testing and decoupling.
|
|
8314
|
+
*/
|
|
8315
|
+
interface LabelResolver {
|
|
8316
|
+
resolveRelationIds(ids: string[], attributeId: string): Promise<Array<{
|
|
8317
|
+
id: string;
|
|
8318
|
+
label: string;
|
|
8319
|
+
}>>;
|
|
8320
|
+
findRecordLabels(ids: string[]): Promise<Array<{
|
|
8321
|
+
id: string;
|
|
8322
|
+
label?: string;
|
|
8323
|
+
}>>;
|
|
8324
|
+
}
|
|
8325
|
+
/**
|
|
8326
|
+
* Compute display label from schema expression.
|
|
8327
|
+
* Automatically resolves relation attribute values to their labels
|
|
8328
|
+
* and select/multiselect values to their option labels.
|
|
8329
|
+
*
|
|
8330
|
+
* @param schema - Object schema with labelExpression
|
|
8331
|
+
* @param values - Record values
|
|
8332
|
+
* @param resolver - Resolver for relation labels
|
|
8333
|
+
* @returns Computed label string
|
|
8334
|
+
*/
|
|
8335
|
+
declare function computeLabel(schema: ObjectDefinition, values: Record<string, unknown>, resolver: LabelResolver): Promise<string>;
|
|
8336
|
+
|
|
8337
|
+
/**
|
|
8338
|
+
* Result of a rollup calculation
|
|
8339
|
+
*/
|
|
8340
|
+
interface RollupResult {
|
|
8341
|
+
/** Computed value */
|
|
8342
|
+
value: unknown;
|
|
8343
|
+
/** Number of records that contributed to the calculation */
|
|
8344
|
+
recordCount: number;
|
|
8345
|
+
}
|
|
8346
|
+
/**
|
|
8347
|
+
* Options for RollupService constructor
|
|
8348
|
+
*/
|
|
8349
|
+
interface RollupServiceOptions {
|
|
8350
|
+
/**
|
|
8351
|
+
* Record resolver for cached record fetching.
|
|
8352
|
+
* Required for cached access to records.
|
|
8353
|
+
*/
|
|
8354
|
+
recordResolver: RecordResolverService;
|
|
8355
|
+
}
|
|
8356
|
+
/**
|
|
8357
|
+
* Service for calculating rollup attribute values
|
|
8358
|
+
*
|
|
8359
|
+
* Rollups aggregate values from related records (e.g., sum of order amounts
|
|
8360
|
+
* for a company). They are calculated when needed and can be materialized
|
|
8361
|
+
* (stored) for performance.
|
|
8362
|
+
*
|
|
8363
|
+
* Supports optional caching via CacheAdapter for improved performance.
|
|
8364
|
+
* Rollup values have a short TTL (2 minutes) due to high volatility.
|
|
8365
|
+
*
|
|
8366
|
+
* Phase 3: Supports single-level relation rollups
|
|
8367
|
+
*/
|
|
8368
|
+
declare class RollupService extends BaseService {
|
|
8369
|
+
private recordResolver;
|
|
8370
|
+
constructor(adapter: DatabaseAdapter, options: RollupServiceOptions);
|
|
8371
|
+
/**
|
|
8372
|
+
* Calculate a rollup value for a record
|
|
8373
|
+
*
|
|
8374
|
+
* Results are cached if a CacheAdapter is configured.
|
|
8375
|
+
*
|
|
8376
|
+
* @param recordId - ID of the parent record
|
|
8377
|
+
* @param rollupAttr - Rollup attribute definition
|
|
8378
|
+
* @param schema - Schema of the parent object
|
|
8379
|
+
* @returns Computed rollup value
|
|
8380
|
+
*
|
|
8381
|
+
* @example
|
|
8382
|
+
* ```typescript
|
|
8383
|
+
* // Sum all order amounts for a company
|
|
8384
|
+
* const totalOrders = await rollupService.calculate(
|
|
8385
|
+
* "company-123",
|
|
8386
|
+
* {
|
|
8387
|
+
* type: "rollup",
|
|
8388
|
+
* name: "totalOrders",
|
|
8389
|
+
* relationAttribute: "orders",
|
|
8390
|
+
* targetAttribute: "amount",
|
|
8391
|
+
* function: "sum",
|
|
8392
|
+
* ...
|
|
8393
|
+
* },
|
|
8394
|
+
* companySchema
|
|
8395
|
+
* );
|
|
8396
|
+
* ```
|
|
8397
|
+
*/
|
|
8398
|
+
calculate(recordId: string, rollupAttr: RollupAttribute, schema: ObjectDefinition): Promise<RollupResult>;
|
|
8399
|
+
/**
|
|
8400
|
+
* Internal method to compute rollup value (no caching)
|
|
8401
|
+
*/
|
|
8402
|
+
private computeRollup;
|
|
8403
|
+
/**
|
|
8404
|
+
* Forward pattern: this record has a relation attribute pointing to other records
|
|
8405
|
+
* Example: entreprise222 has relation "entreprises" → companies, rollup collects from companies
|
|
8406
|
+
*/
|
|
8407
|
+
private calculateForward;
|
|
8408
|
+
/**
|
|
8409
|
+
* Reverse pattern: other records have a relation pointing to this record
|
|
8410
|
+
* Example: Company has rollup on "orders", Order has relation "company" → companies
|
|
8411
|
+
*/
|
|
8412
|
+
private calculateReverse;
|
|
8413
|
+
/**
|
|
8414
|
+
* Extract and aggregate values from related records
|
|
8415
|
+
*/
|
|
8416
|
+
private aggregateValues;
|
|
8417
|
+
/**
|
|
8418
|
+
* Calculate rollup values for multiple records (batched)
|
|
8419
|
+
*
|
|
8420
|
+
* More efficient than calling calculate() for each record individually.
|
|
8421
|
+
*/
|
|
8422
|
+
calculateForMany(recordIds: string[], rollupAttr: RollupAttribute, schema: ObjectDefinition): Promise<Map<string, RollupResult>>;
|
|
8423
|
+
/**
|
|
8424
|
+
* Apply aggregation function to a set of values
|
|
8425
|
+
*/
|
|
8426
|
+
private aggregate;
|
|
8427
|
+
/**
|
|
8428
|
+
* Get the default empty value for a rollup function
|
|
8429
|
+
*/
|
|
8430
|
+
private getEmptyValue;
|
|
8431
|
+
/**
|
|
8432
|
+
* Sum numeric values
|
|
8433
|
+
*/
|
|
8434
|
+
private sumNumbers;
|
|
8435
|
+
/**
|
|
8436
|
+
* Average numeric values
|
|
8437
|
+
*/
|
|
8438
|
+
private averageNumbers;
|
|
8439
|
+
/**
|
|
8440
|
+
* Get earliest date from values
|
|
8441
|
+
*/
|
|
8442
|
+
private earliestDate;
|
|
8443
|
+
/**
|
|
8444
|
+
* Get latest date from values
|
|
8445
|
+
*/
|
|
8446
|
+
private latestDate;
|
|
8447
|
+
/**
|
|
8448
|
+
* Recalculate all rollup attributes for a record and update it
|
|
8449
|
+
*
|
|
8450
|
+
* Called after related records change to keep rollups up-to-date.
|
|
8451
|
+
*/
|
|
8452
|
+
recalculateAndUpdate(record: ObjectRecord, schema: ObjectDefinition): Promise<ObjectRecord>;
|
|
8453
|
+
/**
|
|
8454
|
+
* Find parent records that need rollup recalculation when a child record changes
|
|
8455
|
+
*
|
|
8456
|
+
* Used by hooks to determine which parent records to recalculate after
|
|
8457
|
+
* a child record is created, updated, or deleted.
|
|
8458
|
+
*
|
|
8459
|
+
* @param changedRecord - The record that was modified
|
|
8460
|
+
* @param changedSchema - Schema of the changed record's object
|
|
8461
|
+
* @returns Array of parent record IDs that need recalculation
|
|
8462
|
+
*/
|
|
8463
|
+
findAffectedParentRecords(changedRecord: ObjectRecord, changedSchema: ObjectDefinition): Promise<string[]>;
|
|
8464
|
+
/**
|
|
8465
|
+
* Invalidate cached rollups for affected parent records.
|
|
8466
|
+
* Call this after a child record is created, updated, or deleted.
|
|
8467
|
+
*
|
|
8468
|
+
* @param affectedParentIds - Array of parent record IDs whose rollups need invalidation
|
|
8469
|
+
*/
|
|
8470
|
+
invalidateAffectedRollups(affectedParentIds: string[]): Promise<void>;
|
|
8471
|
+
/**
|
|
8472
|
+
* Invalidate all cached rollups for the current tenant.
|
|
8473
|
+
* Use sparingly - prefer targeted invalidation.
|
|
8474
|
+
*/
|
|
8475
|
+
invalidateAllRollups(): Promise<void>;
|
|
8476
|
+
/**
|
|
8477
|
+
* Find records that have forward rollups pointing to the modified record.
|
|
8478
|
+
*
|
|
8479
|
+
* Forward rollups are rollups where the record has a relation attribute
|
|
8480
|
+
* pointing to another object, and the rollup aggregates values from that target.
|
|
8481
|
+
* When the target record changes, we need to recalculate these rollups.
|
|
8482
|
+
*
|
|
8483
|
+
* Example: Order has relation "company" → Company, and rollup "capitalSocial"
|
|
8484
|
+
* aggregating from the Company. When Company.capitalSocial changes,
|
|
8485
|
+
* all Orders pointing to that Company need their rollup recalculated.
|
|
8486
|
+
*
|
|
8487
|
+
* @param changedRecord - The record that was modified
|
|
8488
|
+
* @param changedSchema - Schema of the changed record's object
|
|
8489
|
+
* @returns Array of records that need their forward rollups recalculated
|
|
8490
|
+
*/
|
|
8491
|
+
findRecordsWithForwardRollup(changedRecord: ObjectRecord, changedSchema: ObjectDefinition): Promise<ObjectRecord[]>;
|
|
8492
|
+
}
|
|
8493
|
+
|
|
8494
|
+
/**
|
|
8495
|
+
* Context for rollup cascade operations.
|
|
8496
|
+
* Provides the necessary services via dependency injection.
|
|
8497
|
+
*/
|
|
8498
|
+
interface RollupCascadeContext {
|
|
8499
|
+
rollupService: RollupService;
|
|
8500
|
+
schemaService: ObjectSchemaService;
|
|
8501
|
+
findRecordsByIds: (ids: string[]) => Promise<ObjectRecord[]>;
|
|
8502
|
+
}
|
|
8503
|
+
/**
|
|
8504
|
+
* Recalculate rollups after a record changes.
|
|
8505
|
+
*
|
|
8506
|
+
* This handles three cases:
|
|
8507
|
+
* 1. The record itself has rollups (e.g., aggregating from related records it points to)
|
|
8508
|
+
* 2. Parent records have rollups that aggregate from this record (reverse pattern)
|
|
8509
|
+
* 3. Records that have forward rollups pointing to this record (forward pattern)
|
|
8510
|
+
*
|
|
8511
|
+
* Optimized: Pre-loads schemas by objectId to avoid N redundant calls
|
|
8512
|
+
* when multiple records share the same objectId.
|
|
8513
|
+
*
|
|
8514
|
+
* @param record - The record that was modified
|
|
8515
|
+
* @param schema - Schema of the record's object
|
|
8516
|
+
* @param ctx - Context with required services
|
|
8517
|
+
*/
|
|
8518
|
+
declare function recalculateParentRollups(record: ObjectRecord, schema: ObjectDefinition, ctx: RollupCascadeContext): Promise<void>;
|
|
8519
|
+
|
|
8520
|
+
/**
|
|
8521
|
+
* Service for cached record resolution.
|
|
8522
|
+
*
|
|
8523
|
+
* Centralizes all record fetching with automatic caching to avoid
|
|
8524
|
+
* redundant database queries across services (relation, rollup, formulas).
|
|
8525
|
+
*
|
|
8526
|
+
* Also provides factory methods for creating resolver interfaces used by
|
|
8527
|
+
* helpers (label computation, rollup cascade).
|
|
8528
|
+
*
|
|
8529
|
+
* @example
|
|
8530
|
+
* ```typescript
|
|
8531
|
+
* const resolver = new RecordResolverService(adapter);
|
|
8532
|
+
*
|
|
8533
|
+
* // Cached record fetching
|
|
8534
|
+
* const record = await resolver.findById("rec-123");
|
|
8535
|
+
* const records = await resolver.findByIds(["rec-1", "rec-2"]);
|
|
8536
|
+
*
|
|
8537
|
+
* // Factory methods for helpers
|
|
8538
|
+
* const labelResolver = resolver.createLabelResolver(relationService);
|
|
8539
|
+
* const rollupContext = resolver.createRollupContext(rollupService, schemaService);
|
|
8540
|
+
* ```
|
|
8541
|
+
*/
|
|
8542
|
+
declare class RecordResolverService extends BaseService {
|
|
8543
|
+
constructor(adapter: DatabaseAdapter);
|
|
8544
|
+
/**
|
|
8545
|
+
* Find a record by ID with caching.
|
|
8546
|
+
*
|
|
8547
|
+
* Uses the shared record cache for optimal performance.
|
|
8548
|
+
* Delegates to findByIds for consistent cache handling.
|
|
8549
|
+
*
|
|
8550
|
+
* @param id - Record ID
|
|
8551
|
+
* @returns Record or null if not found
|
|
8552
|
+
*/
|
|
8553
|
+
findById(id: string): Promise<ObjectRecord | null>;
|
|
8554
|
+
/**
|
|
8555
|
+
* Find multiple records by IDs with caching.
|
|
8556
|
+
*
|
|
8557
|
+
* Each record is cached individually for reuse across services.
|
|
8558
|
+
* Only fetches records not already in cache.
|
|
8559
|
+
*
|
|
8560
|
+
* @param ids - Record IDs to fetch
|
|
8561
|
+
* @returns Array of found records (missing IDs are not included)
|
|
8562
|
+
*/
|
|
8563
|
+
findByIds(ids: string[]): Promise<ObjectRecord[]>;
|
|
8564
|
+
/**
|
|
8565
|
+
* Create a RelationLabelResolver callback for computeLabelWithRelations.
|
|
8566
|
+
*
|
|
8567
|
+
* Used by RelationService.resolveLabel() and ObjectSchemaService.
|
|
8568
|
+
*
|
|
8569
|
+
* @returns Callback that resolves record IDs to their labels (cached)
|
|
8570
|
+
*/
|
|
8571
|
+
createRelationLabelResolver(): RelationLabelResolver;
|
|
8572
|
+
/**
|
|
8573
|
+
* Create a LabelResolver interface for label computation helpers.
|
|
8574
|
+
*
|
|
8575
|
+
* Used by RecordService for computing record labels.
|
|
8576
|
+
*
|
|
8577
|
+
* @param relationService - RelationService for resolving relation display labels
|
|
8578
|
+
* @returns LabelResolver interface with cached record fetching
|
|
8579
|
+
*/
|
|
8580
|
+
createLabelResolver(relationService: RelationService): LabelResolver;
|
|
8581
|
+
/**
|
|
8582
|
+
* Create a RollupCascadeContext for rollup recalculation.
|
|
8583
|
+
*
|
|
8584
|
+
* Used by RecordService after create/update/delete operations.
|
|
8585
|
+
*
|
|
8586
|
+
* @param rollupService - RollupService for recalculating rollups
|
|
8587
|
+
* @param schemaService - ObjectSchemaService for fetching schemas
|
|
8588
|
+
* @returns Context with cached record fetching
|
|
8589
|
+
*/
|
|
8590
|
+
createRollupContext(rollupService: RollupService, schemaService: ObjectSchemaService): RollupCascadeContext;
|
|
8591
|
+
}
|
|
8592
|
+
|
|
8593
|
+
/**
|
|
8594
|
+
* Result of relation validation
|
|
8595
|
+
*/
|
|
8596
|
+
interface RelationValidationResult {
|
|
8597
|
+
valid: boolean;
|
|
8598
|
+
errors: RelationValidationError[];
|
|
8599
|
+
}
|
|
8600
|
+
/**
|
|
8601
|
+
* Individual relation validation error
|
|
8602
|
+
*/
|
|
8603
|
+
interface RelationValidationError {
|
|
8604
|
+
/** Attribute name */
|
|
8605
|
+
attribute: string;
|
|
8606
|
+
/** Error message */
|
|
8607
|
+
message: string;
|
|
8608
|
+
/** Invalid record IDs */
|
|
8609
|
+
invalidIds?: string[];
|
|
8610
|
+
}
|
|
8611
|
+
/**
|
|
8612
|
+
* Resolved relation option
|
|
8613
|
+
*
|
|
8614
|
+
* SECURITY: This type intentionally excludes raw record data.
|
|
8615
|
+
* Only the computed label is exposed to prevent unauthorized data access
|
|
8616
|
+
* through relation lookups. Users must have explicit read permissions
|
|
8617
|
+
* on an object to access its record data.
|
|
8618
|
+
*/
|
|
8619
|
+
interface RelationOption {
|
|
8620
|
+
/** Record ID */
|
|
8621
|
+
id: string;
|
|
8622
|
+
/** Object ID */
|
|
8623
|
+
objectId: string;
|
|
8624
|
+
/** Object name (technical name) */
|
|
8625
|
+
objectName: string;
|
|
8626
|
+
/** Object label (display name) */
|
|
8627
|
+
objectLabel: string;
|
|
8628
|
+
/** Object icon */
|
|
8629
|
+
objectIcon?: string;
|
|
8630
|
+
/** Display label (computed from labelExpression) */
|
|
8631
|
+
label: string;
|
|
8632
|
+
}
|
|
8633
|
+
/**
|
|
8634
|
+
* Response for relation options
|
|
8635
|
+
*/
|
|
8636
|
+
interface RelationOptionsResponse {
|
|
8637
|
+
options: RelationOption[];
|
|
8638
|
+
hasMore: boolean;
|
|
8639
|
+
total: number;
|
|
8640
|
+
}
|
|
8641
|
+
/**
|
|
8642
|
+
* Parameters for fetching relation options
|
|
7825
8643
|
*/
|
|
7826
8644
|
interface GetRelationOptionsParams {
|
|
7827
8645
|
/** Search query */
|
|
@@ -7845,6 +8663,11 @@ interface RelationServiceOptions {
|
|
|
7845
8663
|
* If not provided, getOptions() will throw.
|
|
7846
8664
|
*/
|
|
7847
8665
|
queryService?: RecordQueryService;
|
|
8666
|
+
/**
|
|
8667
|
+
* Record resolver for cached record fetching.
|
|
8668
|
+
* Required for cached access to records.
|
|
8669
|
+
*/
|
|
8670
|
+
recordResolver: RecordResolverService;
|
|
7848
8671
|
}
|
|
7849
8672
|
/**
|
|
7850
8673
|
* Request item for batch relation resolution
|
|
@@ -7873,7 +8696,8 @@ interface ResolveIdsBatchResponse {
|
|
|
7873
8696
|
declare class RelationService extends BaseService {
|
|
7874
8697
|
private schemaService;
|
|
7875
8698
|
private queryService?;
|
|
7876
|
-
|
|
8699
|
+
private recordResolver;
|
|
8700
|
+
constructor(adapter: DatabaseAdapter, nativeRegistry: typeof registry, options: RelationServiceOptions);
|
|
7877
8701
|
/**
|
|
7878
8702
|
* Set the query service after construction.
|
|
7879
8703
|
* Useful for breaking circular dependencies during initialization.
|
|
@@ -7985,239 +8809,117 @@ declare class RelationService extends BaseService {
|
|
|
7985
8809
|
* // { "attr-company": [...], "attr-contact": [...] }
|
|
7986
8810
|
* ```
|
|
7987
8811
|
*/
|
|
7988
|
-
resolveIdsBatch(requests: ResolveIdsBatchRequest[]): Promise<ResolveIdsBatchResponse>;
|
|
7989
|
-
/**
|
|
7990
|
-
* Internal method to fetch and resolve multiple composite IDs at once.
|
|
7991
|
-
* Optimized for batch operations - single DB query for all records.
|
|
7992
|
-
*/
|
|
7993
|
-
private fetchResolveIdsBatch;
|
|
7994
|
-
/**
|
|
7995
|
-
* Internal method to fetch and resolve relation IDs (no caching).
|
|
7996
|
-
* Uses batch fetching for performance - fetches all records in one query,
|
|
7997
|
-
* then groups by objectId to minimize schema lookups.
|
|
7998
|
-
*/
|
|
7999
|
-
private fetchResolveIds;
|
|
8000
|
-
/**
|
|
8001
|
-
* Find a relation attribute by ID.
|
|
8002
|
-
* Results are cached if a CacheAdapter is configured.
|
|
8003
|
-
* Cache is invalidated by ObjectSchemaService.invalidateSchemaCache() via allAttributes pattern.
|
|
8004
|
-
*/
|
|
8005
|
-
findAttributeById(attributeId: string): Promise<RelationAttribute | null>;
|
|
8006
|
-
/**
|
|
8007
|
-
* Internal method to fetch attribute by ID (no caching)
|
|
8008
|
-
*/
|
|
8009
|
-
private fetchAttributeById;
|
|
8010
|
-
}
|
|
8011
|
-
|
|
8012
|
-
/**
|
|
8013
|
-
* Resolved relation values for a record
|
|
8014
|
-
* Maps relation attribute name to the resolved record's values
|
|
8015
|
-
*/
|
|
8016
|
-
type ResolvedRelations = Record<string, Record<string, unknown>>;
|
|
8017
|
-
/**
|
|
8018
|
-
* Service for resolving relation values from related records
|
|
8019
|
-
*
|
|
8020
|
-
* Used by formula evaluation to access values from related records
|
|
8021
|
-
* (e.g., "company.name" in a formula on an order)
|
|
8022
|
-
*/
|
|
8023
|
-
declare class RelationResolverService {
|
|
8024
|
-
private adapter;
|
|
8025
|
-
constructor(adapter: DatabaseAdapter);
|
|
8026
|
-
/**
|
|
8027
|
-
* Resolve values from related records for formula evaluation
|
|
8028
|
-
*
|
|
8029
|
-
* Phase 2: Supports 1 level of relation traversal only
|
|
8030
|
-
*
|
|
8031
|
-
* @param record - The source record
|
|
8032
|
-
* @param schema - Schema of the source object
|
|
8033
|
-
* @param relationNames - Names of relation attributes to resolve
|
|
8034
|
-
* @returns Map of relation name to related record's values
|
|
8035
|
-
*
|
|
8036
|
-
* @example
|
|
8037
|
-
* ```typescript
|
|
8038
|
-
* // For an order with company relation
|
|
8039
|
-
* const resolved = await resolver.resolveRelationValues(
|
|
8040
|
-
* orderRecord,
|
|
8041
|
-
* orderSchema,
|
|
8042
|
-
* ["company"]
|
|
8043
|
-
* );
|
|
8044
|
-
* // → { company: { id: "...", name: "Acme Corp", ... } }
|
|
8045
|
-
* ```
|
|
8046
|
-
*/
|
|
8047
|
-
resolveRelationValues(record: ObjectRecord, schema: ObjectDefinition, relationNames: string[]): Promise<ResolvedRelations>;
|
|
8048
|
-
/**
|
|
8049
|
-
* Resolve relation values for multiple records (batched)
|
|
8050
|
-
*
|
|
8051
|
-
* Optimized for list operations - fetches all related records in one batch
|
|
8052
|
-
*
|
|
8053
|
-
* @param records - Source records
|
|
8054
|
-
* @param schema - Schema of the source object
|
|
8055
|
-
* @param relationNames - Names of relation attributes to resolve
|
|
8056
|
-
* @returns Map of record ID to resolved relations
|
|
8057
|
-
*/
|
|
8058
|
-
resolveRelationValuesForMany(records: ObjectRecord[], schema: ObjectDefinition, relationNames: string[]): Promise<Map<string, ResolvedRelations>>;
|
|
8059
|
-
/**
|
|
8060
|
-
* Flatten resolved relations for formula evaluation
|
|
8061
|
-
*
|
|
8062
|
-
* Converts nested structure to dot-notation keys:
|
|
8063
|
-
* { company: { name: "Acme" } } → { "company.name": "Acme" }
|
|
8064
|
-
*
|
|
8065
|
-
* @param resolved - Resolved relations from resolveRelationValues
|
|
8066
|
-
* @returns Flattened values suitable for formula evaluation
|
|
8067
|
-
*/
|
|
8068
|
-
flattenResolvedRelations(resolved: ResolvedRelations): Record<string, unknown>;
|
|
8069
|
-
/**
|
|
8070
|
-
* Extract a single relation ID from a value
|
|
8071
|
-
* Handles both single (string) and multi (array) relations
|
|
8072
|
-
* @internal
|
|
8073
|
-
*/
|
|
8074
|
-
private extractSingleId;
|
|
8075
|
-
}
|
|
8076
|
-
|
|
8077
|
-
/**
|
|
8078
|
-
* Result of a rollup calculation
|
|
8079
|
-
*/
|
|
8080
|
-
interface RollupResult {
|
|
8081
|
-
/** Computed value */
|
|
8082
|
-
value: unknown;
|
|
8083
|
-
/** Number of records that contributed to the calculation */
|
|
8084
|
-
recordCount: number;
|
|
8085
|
-
}
|
|
8086
|
-
/**
|
|
8087
|
-
* Service for calculating rollup attribute values
|
|
8088
|
-
*
|
|
8089
|
-
* Rollups aggregate values from related records (e.g., sum of order amounts
|
|
8090
|
-
* for a company). They are calculated when needed and can be materialized
|
|
8091
|
-
* (stored) for performance.
|
|
8092
|
-
*
|
|
8093
|
-
* Supports optional caching via CacheAdapter for improved performance.
|
|
8094
|
-
* Rollup values have a short TTL (2 minutes) due to high volatility.
|
|
8095
|
-
*
|
|
8096
|
-
* Phase 3: Supports single-level relation rollups
|
|
8097
|
-
*/
|
|
8098
|
-
declare class RollupService extends BaseService {
|
|
8099
|
-
constructor(adapter: DatabaseAdapter);
|
|
8100
|
-
/**
|
|
8101
|
-
* Calculate a rollup value for a record
|
|
8102
|
-
*
|
|
8103
|
-
* Results are cached if a CacheAdapter is configured.
|
|
8104
|
-
*
|
|
8105
|
-
* @param recordId - ID of the parent record
|
|
8106
|
-
* @param rollupAttr - Rollup attribute definition
|
|
8107
|
-
* @param schema - Schema of the parent object
|
|
8108
|
-
* @returns Computed rollup value
|
|
8109
|
-
*
|
|
8110
|
-
* @example
|
|
8111
|
-
* ```typescript
|
|
8112
|
-
* // Sum all order amounts for a company
|
|
8113
|
-
* const totalOrders = await rollupService.calculate(
|
|
8114
|
-
* "company-123",
|
|
8115
|
-
* {
|
|
8116
|
-
* type: "rollup",
|
|
8117
|
-
* name: "totalOrders",
|
|
8118
|
-
* relationAttribute: "orders",
|
|
8119
|
-
* targetAttribute: "amount",
|
|
8120
|
-
* function: "sum",
|
|
8121
|
-
* ...
|
|
8122
|
-
* },
|
|
8123
|
-
* companySchema
|
|
8124
|
-
* );
|
|
8125
|
-
* ```
|
|
8126
|
-
*/
|
|
8127
|
-
calculate(recordId: string, rollupAttr: RollupAttribute, schema: ObjectDefinition): Promise<RollupResult>;
|
|
8128
|
-
/**
|
|
8129
|
-
* Internal method to compute rollup value (no caching)
|
|
8130
|
-
*/
|
|
8131
|
-
private computeRollup;
|
|
8132
|
-
/**
|
|
8133
|
-
* Forward pattern: this record has a relation attribute pointing to other records
|
|
8134
|
-
* Example: entreprise222 has relation "entreprises" → companies, rollup collects from companies
|
|
8135
|
-
*/
|
|
8136
|
-
private calculateForward;
|
|
8137
|
-
/**
|
|
8138
|
-
* Reverse pattern: other records have a relation pointing to this record
|
|
8139
|
-
* Example: Company has rollup on "orders", Order has relation "company" → companies
|
|
8140
|
-
*/
|
|
8141
|
-
private calculateReverse;
|
|
8142
|
-
/**
|
|
8143
|
-
* Extract and aggregate values from related records
|
|
8144
|
-
*/
|
|
8145
|
-
private aggregateValues;
|
|
8146
|
-
/**
|
|
8147
|
-
* Calculate rollup values for multiple records (batched)
|
|
8148
|
-
*
|
|
8149
|
-
* More efficient than calling calculate() for each record individually.
|
|
8150
|
-
*/
|
|
8151
|
-
calculateForMany(recordIds: string[], rollupAttr: RollupAttribute, schema: ObjectDefinition): Promise<Map<string, RollupResult>>;
|
|
8152
|
-
/**
|
|
8153
|
-
* Apply aggregation function to a set of values
|
|
8154
|
-
*/
|
|
8155
|
-
private aggregate;
|
|
8812
|
+
resolveIdsBatch(requests: ResolveIdsBatchRequest[]): Promise<ResolveIdsBatchResponse>;
|
|
8156
8813
|
/**
|
|
8157
|
-
*
|
|
8814
|
+
* Internal method to resolve multiple composite IDs at once.
|
|
8815
|
+
* Optimized for batch operations - single DB query for all records.
|
|
8816
|
+
*
|
|
8817
|
+
* @param compositeIds - Array of composite IDs in format "attributeId:recordId"
|
|
8158
8818
|
*/
|
|
8159
|
-
private
|
|
8819
|
+
private resolveCompositeIds;
|
|
8160
8820
|
/**
|
|
8161
|
-
*
|
|
8821
|
+
* Resolve the display label for a record.
|
|
8822
|
+
* Uses custom template if provided, otherwise falls back to pre-computed label.
|
|
8162
8823
|
*/
|
|
8163
|
-
private
|
|
8824
|
+
private resolveLabel;
|
|
8164
8825
|
/**
|
|
8165
|
-
*
|
|
8826
|
+
* Find a relation attribute by ID.
|
|
8827
|
+
* Results are cached if a CacheAdapter is configured.
|
|
8828
|
+
* Cache is invalidated by ObjectSchemaService.invalidateSchemaCache() via allAttributes pattern.
|
|
8166
8829
|
*/
|
|
8167
|
-
|
|
8830
|
+
findAttributeById(attributeId: string): Promise<RelationAttribute | null>;
|
|
8168
8831
|
/**
|
|
8169
|
-
*
|
|
8832
|
+
* Internal method to fetch attribute by ID (no caching)
|
|
8170
8833
|
*/
|
|
8171
|
-
private
|
|
8834
|
+
private fetchAttributeById;
|
|
8835
|
+
}
|
|
8836
|
+
|
|
8837
|
+
/**
|
|
8838
|
+
* Resolved relation values for a record
|
|
8839
|
+
* Maps relation attribute name to the resolved record's values
|
|
8840
|
+
*/
|
|
8841
|
+
type ResolvedRelations = Record<string, Record<string, unknown>>;
|
|
8842
|
+
/**
|
|
8843
|
+
* Options for FormulaResolverService constructor
|
|
8844
|
+
*/
|
|
8845
|
+
interface FormulaResolverServiceOptions {
|
|
8172
8846
|
/**
|
|
8173
|
-
*
|
|
8847
|
+
* Record resolver for cached record fetching.
|
|
8848
|
+
* Required for cached access to records.
|
|
8174
8849
|
*/
|
|
8175
|
-
|
|
8850
|
+
recordResolver: RecordResolverService;
|
|
8851
|
+
}
|
|
8852
|
+
/**
|
|
8853
|
+
* Service for resolving relation values from related records.
|
|
8854
|
+
*
|
|
8855
|
+
* Used by formula evaluation to access values from related records
|
|
8856
|
+
* (e.g., "company.name" in a formula on an order).
|
|
8857
|
+
*
|
|
8858
|
+
* Supports optional RecordResolverService injection for cached record fetching.
|
|
8859
|
+
*
|
|
8860
|
+
* @example
|
|
8861
|
+
* ```typescript
|
|
8862
|
+
* const resolver = new FormulaResolverService(adapter, { recordResolver });
|
|
8863
|
+
*
|
|
8864
|
+
* // Resolve relation values for formula evaluation
|
|
8865
|
+
* const resolved = await resolver.resolveRelationValues(
|
|
8866
|
+
* orderRecord,
|
|
8867
|
+
* orderSchema,
|
|
8868
|
+
* ["company"]
|
|
8869
|
+
* );
|
|
8870
|
+
* // → { company: { id: "...", name: "Acme Corp", ... } }
|
|
8871
|
+
* ```
|
|
8872
|
+
*/
|
|
8873
|
+
declare class FormulaResolverService extends BaseService {
|
|
8874
|
+
private recordResolver;
|
|
8875
|
+
constructor(adapter: DatabaseAdapter, options: FormulaResolverServiceOptions);
|
|
8176
8876
|
/**
|
|
8177
|
-
*
|
|
8877
|
+
* Resolve values from related records for formula evaluation
|
|
8178
8878
|
*
|
|
8179
|
-
*
|
|
8180
|
-
*/
|
|
8181
|
-
recalculateAndUpdate(record: ObjectRecord, schema: ObjectDefinition): Promise<ObjectRecord>;
|
|
8182
|
-
/**
|
|
8183
|
-
* Find parent records that need rollup recalculation when a child record changes
|
|
8879
|
+
* Supports 1 level of relation traversal only.
|
|
8184
8880
|
*
|
|
8185
|
-
*
|
|
8186
|
-
*
|
|
8881
|
+
* @param record - The source record
|
|
8882
|
+
* @param schema - Schema of the source object
|
|
8883
|
+
* @param relationNames - Names of relation attributes to resolve
|
|
8884
|
+
* @returns Map of relation name to related record's values
|
|
8187
8885
|
*
|
|
8188
|
-
* @
|
|
8189
|
-
*
|
|
8190
|
-
*
|
|
8886
|
+
* @example
|
|
8887
|
+
* ```typescript
|
|
8888
|
+
* const resolved = await resolver.resolveRelationValues(
|
|
8889
|
+
* orderRecord,
|
|
8890
|
+
* orderSchema,
|
|
8891
|
+
* ["company"]
|
|
8892
|
+
* );
|
|
8893
|
+
* // → { company: { id: "...", name: "Acme Corp", ... } }
|
|
8894
|
+
* ```
|
|
8191
8895
|
*/
|
|
8192
|
-
|
|
8896
|
+
resolveRelationValues(record: ObjectRecord, schema: ObjectDefinition, relationNames: string[]): Promise<ResolvedRelations>;
|
|
8193
8897
|
/**
|
|
8194
|
-
*
|
|
8195
|
-
* Call this after a child record is created, updated, or deleted.
|
|
8898
|
+
* Resolve relation values for multiple records (batched)
|
|
8196
8899
|
*
|
|
8197
|
-
*
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
*
|
|
8202
|
-
*
|
|
8900
|
+
* Optimized for list operations - fetches all related records in one batch
|
|
8901
|
+
*
|
|
8902
|
+
* @param records - Source records
|
|
8903
|
+
* @param schema - Schema of the source object
|
|
8904
|
+
* @param relationNames - Names of relation attributes to resolve
|
|
8905
|
+
* @returns Map of record ID to resolved relations
|
|
8203
8906
|
*/
|
|
8204
|
-
|
|
8907
|
+
resolveRelationValuesForMany(records: ObjectRecord[], schema: ObjectDefinition, relationNames: string[]): Promise<Map<string, ResolvedRelations>>;
|
|
8205
8908
|
/**
|
|
8206
|
-
*
|
|
8207
|
-
*
|
|
8208
|
-
* Forward rollups are rollups where the record has a relation attribute
|
|
8209
|
-
* pointing to another object, and the rollup aggregates values from that target.
|
|
8210
|
-
* When the target record changes, we need to recalculate these rollups.
|
|
8909
|
+
* Flatten resolved relations for formula evaluation
|
|
8211
8910
|
*
|
|
8212
|
-
*
|
|
8213
|
-
*
|
|
8214
|
-
* all Orders pointing to that Company need their rollup recalculated.
|
|
8911
|
+
* Converts nested structure to dot-notation keys:
|
|
8912
|
+
* { company: { name: "Acme" } } → { "company.name": "Acme" }
|
|
8215
8913
|
*
|
|
8216
|
-
* @param
|
|
8217
|
-
* @
|
|
8218
|
-
* @returns Array of records that need their forward rollups recalculated
|
|
8914
|
+
* @param resolved - Resolved relations from resolveRelationValues
|
|
8915
|
+
* @returns Flattened values suitable for formula evaluation
|
|
8219
8916
|
*/
|
|
8220
|
-
|
|
8917
|
+
flattenResolvedRelations(resolved: ResolvedRelations): Record<string, unknown>;
|
|
8918
|
+
/**
|
|
8919
|
+
* Extract a single relation ID from a value
|
|
8920
|
+
* Handles both single (string) and multi (array) relations
|
|
8921
|
+
*/
|
|
8922
|
+
private extractSingleId;
|
|
8221
8923
|
}
|
|
8222
8924
|
|
|
8223
8925
|
/**
|
|
@@ -8228,6 +8930,8 @@ interface RollupSchedulerOptions {
|
|
|
8228
8930
|
debounceMs?: number;
|
|
8229
8931
|
/** Maximum pending recalculations before forced flush (default: 100) */
|
|
8230
8932
|
maxPending?: number;
|
|
8933
|
+
/** Record resolver for cached record fetching (required) */
|
|
8934
|
+
recordResolver: RecordResolverService;
|
|
8231
8935
|
}
|
|
8232
8936
|
/**
|
|
8233
8937
|
* Scheduler for debouncing rollup recalculations
|
|
@@ -8237,7 +8941,8 @@ interface RollupSchedulerOptions {
|
|
|
8237
8941
|
*
|
|
8238
8942
|
* @example
|
|
8239
8943
|
* ```typescript
|
|
8240
|
-
* const scheduler = new RollupScheduler(adapter, {
|
|
8944
|
+
* const scheduler = new RollupScheduler(adapter, getSchemaById, {
|
|
8945
|
+
* recordResolver,
|
|
8241
8946
|
* debounceMs: 100,
|
|
8242
8947
|
* maxPending: 50,
|
|
8243
8948
|
* });
|
|
@@ -8257,7 +8962,7 @@ declare class RollupScheduler {
|
|
|
8257
8962
|
private rollupService;
|
|
8258
8963
|
private debounceMs;
|
|
8259
8964
|
private maxPending;
|
|
8260
|
-
constructor(adapter: DatabaseAdapter, getSchemaById: (id: string) => Promise<ObjectDefinition | null>, options
|
|
8965
|
+
constructor(adapter: DatabaseAdapter, getSchemaById: (id: string) => Promise<ObjectDefinition | null>, options: RollupSchedulerOptions);
|
|
8261
8966
|
/**
|
|
8262
8967
|
* Schedule a rollup recalculation for a parent record.
|
|
8263
8968
|
*
|
|
@@ -8326,32 +9031,6 @@ declare function checkRecordModifyOrThrow(policy: RecordPolicy, record: ObjectRe
|
|
|
8326
9031
|
*/
|
|
8327
9032
|
declare function checkRecordDeleteOrThrow(policy: RecordPolicy, record: ObjectRecord, context: PolicyContext): void;
|
|
8328
9033
|
|
|
8329
|
-
/**
|
|
8330
|
-
* Interface for resolving relation labels.
|
|
8331
|
-
* Allows dependency injection for testing and decoupling.
|
|
8332
|
-
*/
|
|
8333
|
-
interface LabelResolver {
|
|
8334
|
-
resolveRelationIds(ids: string[], attributeId: string): Promise<Array<{
|
|
8335
|
-
id: string;
|
|
8336
|
-
label: string;
|
|
8337
|
-
}>>;
|
|
8338
|
-
findRecordLabels(ids: string[]): Promise<Array<{
|
|
8339
|
-
id: string;
|
|
8340
|
-
label?: string;
|
|
8341
|
-
}>>;
|
|
8342
|
-
}
|
|
8343
|
-
/**
|
|
8344
|
-
* Compute display label from schema expression.
|
|
8345
|
-
* Automatically resolves relation attribute values to their labels
|
|
8346
|
-
* and select/multiselect values to their option labels.
|
|
8347
|
-
*
|
|
8348
|
-
* @param schema - Object schema with labelExpression
|
|
8349
|
-
* @param values - Record values
|
|
8350
|
-
* @param resolver - Resolver for relation labels
|
|
8351
|
-
* @returns Computed label string
|
|
8352
|
-
*/
|
|
8353
|
-
declare function computeLabel(schema: ObjectDefinition, values: Record<string, unknown>, resolver: LabelResolver): Promise<string>;
|
|
8354
|
-
|
|
8355
9034
|
/**
|
|
8356
9035
|
* Enrich a record with computed formula values.
|
|
8357
9036
|
*
|
|
@@ -8389,32 +9068,6 @@ declare function createContextForDelete(schema: ObjectDefinition, tenantId: stri
|
|
|
8389
9068
|
*/
|
|
8390
9069
|
declare function createContextForRestore(schema: ObjectDefinition, tenantId: string, record: ObjectRecord, metadata?: Record<string, unknown>): HookContext;
|
|
8391
9070
|
|
|
8392
|
-
/**
|
|
8393
|
-
* Context for rollup cascade operations.
|
|
8394
|
-
* Provides the necessary services via dependency injection.
|
|
8395
|
-
*/
|
|
8396
|
-
interface RollupCascadeContext {
|
|
8397
|
-
rollupService: RollupService;
|
|
8398
|
-
schemaService: ObjectSchemaService;
|
|
8399
|
-
findRecordsByIds: (ids: string[]) => Promise<ObjectRecord[]>;
|
|
8400
|
-
}
|
|
8401
|
-
/**
|
|
8402
|
-
* Recalculate rollups after a record changes.
|
|
8403
|
-
*
|
|
8404
|
-
* This handles three cases:
|
|
8405
|
-
* 1. The record itself has rollups (e.g., aggregating from related records it points to)
|
|
8406
|
-
* 2. Parent records have rollups that aggregate from this record (reverse pattern)
|
|
8407
|
-
* 3. Records that have forward rollups pointing to this record (forward pattern)
|
|
8408
|
-
*
|
|
8409
|
-
* Optimized: Pre-loads schemas by objectId to avoid N redundant calls
|
|
8410
|
-
* when multiple records share the same objectId.
|
|
8411
|
-
*
|
|
8412
|
-
* @param record - The record that was modified
|
|
8413
|
-
* @param schema - Schema of the record's object
|
|
8414
|
-
* @param ctx - Context with required services
|
|
8415
|
-
*/
|
|
8416
|
-
declare function recalculateParentRollups(record: ObjectRecord, schema: ObjectDefinition, ctx: RollupCascadeContext): Promise<void>;
|
|
8417
|
-
|
|
8418
9071
|
/**
|
|
8419
9072
|
* Fluent query builder for schema records.
|
|
8420
9073
|
* Supports chained filters, sorts, and pagination.
|
|
@@ -9432,7 +10085,7 @@ declare function flattenRelationsForEval(resolvedRelations: ResolvedRelations):
|
|
|
9432
10085
|
* // → "Acme Corp - ORD-001"
|
|
9433
10086
|
* ```
|
|
9434
10087
|
*/
|
|
9435
|
-
declare function evaluateFormulaWithRelations(expression: string, record: ObjectRecord, schema: ObjectDefinition, resolver:
|
|
10088
|
+
declare function evaluateFormulaWithRelations(expression: string, record: ObjectRecord, schema: ObjectDefinition, resolver: FormulaResolverService): Promise<unknown>;
|
|
9436
10089
|
/**
|
|
9437
10090
|
* Evaluate a formula attribute that may contain relation references
|
|
9438
10091
|
*
|
|
@@ -9442,7 +10095,7 @@ declare function evaluateFormulaWithRelations(expression: string, record: Object
|
|
|
9442
10095
|
* @param resolver - Relation resolver service
|
|
9443
10096
|
* @returns Formatted computed value
|
|
9444
10097
|
*/
|
|
9445
|
-
declare function evaluateFormulaAttributeWithRelations(attr: FormulaAttribute, record: ObjectRecord, schema: ObjectDefinition, resolver:
|
|
10098
|
+
declare function evaluateFormulaAttributeWithRelations(attr: FormulaAttribute, record: ObjectRecord, schema: ObjectDefinition, resolver: FormulaResolverService): Promise<unknown>;
|
|
9446
10099
|
|
|
9447
10100
|
/**
|
|
9448
10101
|
* Type of a path segment
|
|
@@ -9645,6 +10298,10 @@ interface MockStores {
|
|
|
9645
10298
|
workflows: Map<Uuid, DBWorkflow>;
|
|
9646
10299
|
workflowInstances: Map<Uuid, DBWorkflowInstance>;
|
|
9647
10300
|
workflowParticipations: Map<Uuid, DBWorkflowParticipation>;
|
|
10301
|
+
aiConversations: Map<Uuid, AIConversation>;
|
|
10302
|
+
aiMessages: Map<Uuid, AIMessage>;
|
|
10303
|
+
aiUserMemory: Map<string, AIUserMemory>;
|
|
10304
|
+
aiUsageMetrics: Map<string, AIUsageMetrics>;
|
|
9648
10305
|
}
|
|
9649
10306
|
/**
|
|
9650
10307
|
* Create an in-memory mock adapter for testing and development
|
|
@@ -11051,98 +11708,4 @@ interface FullSyncOptions extends SyncOptions, ViewSyncOptions {
|
|
|
11051
11708
|
*/
|
|
11052
11709
|
declare function syncAll(adapter: DatabaseAdapter, objectRegistry: typeof registry, nativeViewRegistry: typeof viewRegistry, options?: FullSyncOptions): Promise<FullSyncResult>;
|
|
11053
11710
|
|
|
11054
|
-
/**
|
|
11055
|
-
* Default fallback value when expression resolves to empty string
|
|
11056
|
-
*/
|
|
11057
|
-
declare const DEFAULT_LABEL_FALLBACK = "(Untitled)";
|
|
11058
|
-
declare function renderLabelExpression(template: string, values: Record<string, unknown>, fallback?: string): string;
|
|
11059
|
-
/**
|
|
11060
|
-
* Check if a string is a valid label expression template
|
|
11061
|
-
* A valid template contains at least one {{ variable }} block with a non-empty variable
|
|
11062
|
-
*/
|
|
11063
|
-
declare function isLabelExpression(value: string): boolean;
|
|
11064
|
-
/**
|
|
11065
|
-
* Extract attribute names referenced in a label expression
|
|
11066
|
-
* Useful for validation or dependency tracking
|
|
11067
|
-
*
|
|
11068
|
-
* @example
|
|
11069
|
-
* extractAttributeNames("{{ firstName }} {{ lastName | UPPER }}")
|
|
11070
|
-
* // → ["firstName", "lastName"]
|
|
11071
|
-
*/
|
|
11072
|
-
declare function extractAttributeNames(template: string): string[];
|
|
11073
|
-
/**
|
|
11074
|
-
* Enrich record values by formatting complex types for display
|
|
11075
|
-
*
|
|
11076
|
-
* Transforms raw values (objects, dates, etc.) into human-readable strings
|
|
11077
|
-
* for use in label expression rendering. Uses formatAttributeValue internally.
|
|
11078
|
-
*
|
|
11079
|
-
* @param values - Record values containing raw attribute values
|
|
11080
|
-
* @param attributes - Attribute definitions for formatting
|
|
11081
|
-
* @returns New object with complex values formatted as strings
|
|
11082
|
-
*
|
|
11083
|
-
* @example
|
|
11084
|
-
* ```typescript
|
|
11085
|
-
* const enriched = enrichValuesForDisplay(
|
|
11086
|
-
* { status: "active", price: { value: 1500, code: "EUR" } },
|
|
11087
|
-
* [
|
|
11088
|
-
* { type: "select", name: "status", options: [{ value: "active", label: "Active" }] },
|
|
11089
|
-
* { type: "currency", name: "price" }
|
|
11090
|
-
* ]
|
|
11091
|
-
* );
|
|
11092
|
-
* // → { status: "Active", price: "1,500.00 EUR" }
|
|
11093
|
-
* ```
|
|
11094
|
-
*/
|
|
11095
|
-
declare function enrichValuesForDisplay(values: Record<string, unknown>, attributes: Attribute[]): Record<string, unknown>;
|
|
11096
|
-
/**
|
|
11097
|
-
* @deprecated Use `enrichValuesForDisplay` instead
|
|
11098
|
-
*/
|
|
11099
|
-
declare const enrichValuesWithSelectLabels: typeof enrichValuesForDisplay;
|
|
11100
|
-
/**
|
|
11101
|
-
* Extract relation IDs from a value (string or array)
|
|
11102
|
-
* For cardinality "many", only the first ID is extracted for label display
|
|
11103
|
-
*
|
|
11104
|
-
* @param val - Relation value (string ID or array of IDs)
|
|
11105
|
-
* @returns Array of IDs (max 1 element for display purposes)
|
|
11106
|
-
*
|
|
11107
|
-
* @example
|
|
11108
|
-
* ```typescript
|
|
11109
|
-
* extractRelationIds("rec-123") // → ["rec-123"]
|
|
11110
|
-
* extractRelationIds(["rec-1", "rec-2"]) // → ["rec-1"]
|
|
11111
|
-
* extractRelationIds(null) // → []
|
|
11112
|
-
* ```
|
|
11113
|
-
*/
|
|
11114
|
-
declare function extractRelationIds(val: unknown): string[];
|
|
11115
|
-
/**
|
|
11116
|
-
* Resolver function type for fetching relation labels
|
|
11117
|
-
* Takes an array of record IDs and returns a map of ID → label
|
|
11118
|
-
*/
|
|
11119
|
-
type RelationLabelResolver = (ids: string[]) => Promise<Map<string, string>>;
|
|
11120
|
-
/**
|
|
11121
|
-
* Compute a label from a template with full relation resolution (1 level deep)
|
|
11122
|
-
*
|
|
11123
|
-
* Uses pre-computed record.label for nested relations to avoid infinite recursion.
|
|
11124
|
-
* This function enriches select/multiselect values AND resolves relation IDs to their labels.
|
|
11125
|
-
*
|
|
11126
|
-
* @param template - Label expression template (e.g., "{{ company }} - {{ name }}")
|
|
11127
|
-
* @param values - Record values to interpolate
|
|
11128
|
-
* @param attributes - Attribute definitions for the object
|
|
11129
|
-
* @param resolveRelationIds - Function to resolve record IDs to their labels
|
|
11130
|
-
* @returns The rendered label string
|
|
11131
|
-
*
|
|
11132
|
-
* @example
|
|
11133
|
-
* ```typescript
|
|
11134
|
-
* const label = await computeLabelWithRelations(
|
|
11135
|
-
* "{{ company }} - {{ name }}",
|
|
11136
|
-
* { company: "rec-123", name: "Product A" },
|
|
11137
|
-
* objectSchema.attributes,
|
|
11138
|
-
* async (ids) => {
|
|
11139
|
-
* const records = await adapter.objectRecords.findByIds(ids);
|
|
11140
|
-
* return new Map(records.map(r => [r.id, r.label]));
|
|
11141
|
-
* }
|
|
11142
|
-
* );
|
|
11143
|
-
* // → "Acme Corp - Product A"
|
|
11144
|
-
* ```
|
|
11145
|
-
*/
|
|
11146
|
-
declare function computeLabelWithRelations(template: string, values: Record<string, unknown>, attributes: Attribute[], resolveRelationIds: RelationLabelResolver): Promise<string>;
|
|
11147
|
-
|
|
11148
|
-
export { type FlowRow as $, type Attribute as A, type DirectTableTab as B, type CheckboxAttribute as C, type DateAttribute as D, type WorkflowConfig as E, type FileAttribute as F, type Group as G, type SlotMode as H, type InferAttributeValue as I, type AuthMethod as J, type AuthChannel as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type ObjectAction as O, type PhoneAttribute as P, type ParticipantTemplate as Q, type RichtextAttribute as R, type SystemResource as S, type TextAttribute as T, type UserAttribute as U, type ViewLayout as V, type WorkflowTheme as W, type ConditionGroup as X, type ConditionRule as Y, type WorkflowNode as Z, type WorkflowDefinition as _, type SystemAction as a, toSimpleFilterState as a$, type BlockNoteContent as a0, type StatusGroup as a1, type AttributeGroup as a2, type BaseAttribute as a3, type NumberUnit as a4, type DateFormat as a5, type DateValue as a6, type Phone as a7, type Currency as a8, type Location as a9, type CreateAuditLogInput as aA, type AuditListOptions as aB, type AuditServiceOptions as aC, type StorageProvider as aD, type FileVisibility as aE, type File as aF, type CreateFile as aG, type UpdateFile as aH, type TextFilterOperator as aI, type NumberFilterOperator as aJ, type CheckboxFilterOperator as aK, type DateFilterOperator as aL, type SelectFilterOperator as aM, type MultiselectFilterOperator as aN, type RelationFilterOperator as aO, type FilterOperator as aP, type RelativeDateValue as aQ, type CurrencyFilterValue as aR, type PhoneFilterValue as aS, type FilterValue as aT, type FilterRule as aU, type ExtendedFilterRule as aV, type FilterCombinator as aW, type FilterGroup as aX, type AdvancedFilterState as aY, isAdvancedFilterState as aZ, toAdvancedFilterState as a_, type LocationGranularity as aa, RELATION_TARGET_ANY as ab, type RelationAttribute as ac, isUniversalRelation as ad, type BlockNoteBlock as ae, type BlockNoteCustomInlineContent as af, type BlockNoteDefaultProps as ag, type BlockNoteInlineContent as ah, type BlockNoteLink as ai, type BlockNoteStyledText as aj, type BlockNoteStyles as ak, type BlockNoteTableCell as al, type BlockNoteTableCellProps as am, type BlockNoteTableContent as an, type PartialBlockNoteBlock as ao, type PartialBlockNoteContent as ap, type PartialBlockNoteInlineContent as aq, type PartialBlockNoteLink as ar, type PartialBlockNoteStyledText as as, type PartialBlockNoteTableCell as at, type PartialBlockNoteTableContent as au, type AuditResourceType as av, type AuditAction as aw, type AuditActorType as ax, type AuditChange as ay, type AuditLogEntry as az, type TextAreaAttribute as b, type PolicyContext as b$, type SortDirection as b0, type QueryState as b1, OPERATORS_BY_TYPE as b2, type NoValueOperator as b3, NO_VALUE_OPERATORS as b4, isNoValueOperator as b5, type FlowSlot as b6, type FlowRowField as b7, type FlowPage as b8, type FlowRelation as b9, type ExtractRecordInput as bA, type ExtractRecordInputStrict as bB, type ExtractRecordUpdate as bC, type ExtractRecordUpdateStrict as bD, type ExtractAttributes as bE, type TypedObjectRecord as bF, type ExtractObjectRecord as bG, type ExtractObjectRecordWithCustom as bH, RESERVED_ATTRIBUTE_NAMES as bI, SYSTEM_FIELD_NAMES as bJ, type ReservedAttributeName as bK, type SystemFieldName as bL, type Timestamps as bM, type ObjectAttribute as bN, type CompletionStatus as bO, type ObjectRecord as bP, type PermissionScope as bQ, type Role as bR, type Permission as bS, type UserRoleAssignment as bT, type EffectivePermissions as bU, type ObjectPermissions as bV, type SystemPermissions as bW, type CreateRoleInput as bX, type UpdateRoleInput as bY, type CreatePermissionInput as bZ, type AssignRoleInput as b_, type FlowStatus as ba, type FlowDefinition as bb, isFlowDefinition as bc, isFlowPublished as bd, isSystemFlow as be, type GeocodingSuggestion as bf, type GeocodingAutocompleteParams as bg, type ReverseGeocodingParams as bh, type GeocodingParams as bi, type GeocodingAdapter as bj, NoopGeocodingAdapter as bk, type AttributeSchema as bl, type InferRecordFromSchema as bm, type InferRecordWithRequirements as bn, type TypedAttribute as bo, type AttributeMap as bp, type AddAttribute as bq, type InferRecord as br, type InferRecordInput as bs, type InferRecordUpdate as bt, type CustomAttributeValue as bu, type WithCustomAttributes as bv, type RecordMetadata as bw, type SystemFields as bx, type ExtractRecord as by, type ExtractRecordStrict as bz, type RichtextFeature as c, type SignedLinkAuth as c$, type RecordPolicy as c0, PolicyViolationError as c1, type UserRole as c2, type UserStatus as c3, type UserProfile as c4, type CreateUserProfile as c5, type UpdateUserProfile as c6, type InviteUserInput as c7, type TabType as c8, type FormTab as c9, isConditionRule as cA, isConditionGroup as cB, eq as cC, neq as cD, and as cE, or as cF, inValues as cG, isEmpty as cH, isNotEmpty as cI, type WorkflowSlot as cJ, type NodePosition as cK, type CanvasViewport as cL, type WorkflowLayout as cM, type ParticipantAuthConfig as cN, type WorkflowStatus as cO, isWorkflowDefinition as cP, isWorkflowPublished as cQ, isSystemWorkflow as cR, type WorkflowTransition as cS, type WorkflowError as cT, type PendingAction as cU, type WorkflowInstance as cV, isInstanceTerminal as cW, isInstanceWaiting as cX, canResumeInstance as cY, createStartTransition as cZ, type ParticipationStatus as c_, type CustomTab as ca, type ActivityTab as cb, type NotesTab as cc, type FlowsTab as cd, isFormTab as ce, isTableTab as cf, isDirectTableTab as cg, isInverseTableTab as ch, isCustomTab as ci, isActivityTab as cj, isNotesTab as ck, isFlowsTab as cl, type StartNode as cm, type FormNode as cn, type FormFieldRef as co, type ConditionNode as cp, type EndNode as cq, type WorkflowNodeType as cr, isStartNode as cs, isFormNode as ct, isConditionNode as cu, isEndNode as cv, isSimpleFormNode as cw, isAdvancedFormNode as cx, getNodeOutputs as cy, type ConditionOperator as cz, type CurrencyAttribute as d, createCheckboxValidator as d$, type PinCodeAuth as d0, type ParticipationAuth as d1, type WorkflowParticipation as d2, isSignedLinkAuth as d3, isPinCodeAuth as d4, canParticipate as d5, canAuthenticate as d6, canExecuteNode as d7, type GeneratedDocument as d8, type WorkflowExecutionContext as d9, type ValidationMessages as dA, DEFAULT_VALIDATION_MESSAGES as dB, textConfigSchema as dC, textareaConfigSchema as dD, richtextConfigSchema as dE, numberConfigSchema as dF, checkboxConfigSchema as dG, dateConfigSchema as dH, phoneConfigSchema as dI, currencyConfigSchema as dJ, statusConfigSchema as dK, locationConfigSchema as dL, selectConfigSchema as dM, multiselectConfigSchema as dN, fileConfigSchema as dO, userConfigSchema as dP, relationConfigSchema as dQ, ratingConfigSchema as dR, formulaConfigSchema as dS, rollupConfigSchema as dT, attributeConfigSchemas as dU, getAttributeConfigSchema as dV, validateAttributeConfig as dW, parseAttributeConfig as dX, safeParseAttributeConfig as dY, createTextValidator as dZ, createNumberValidator as d_, createEmptyContext as da, getContextValue as db, setContextValue as dc, mergeFormToSlot as dd, type WorkflowAccessMode as de, type ReadOnlyReason as df, type FormFieldContext as dg, type FormFieldRow as dh, type FormNodeInfo as di, type FormContextResponse as dj, type ThemeLogo as dk, type ThemeColors as dl, type ThemeTypography as dm, DEFAULT_THEME as dn, mergeWithDefaults as dp, generateCssVariables as dq, type Uuid as dr, type TenantId as ds, type UserId as dt, asTenantId as du, asUserId as dv, generateId as dw, generatePrefixedId as dx, registry as dy, viewRegistry as dz, type Option as e, SHORTCUT_TO_FILTER_OPERATOR as e$, createDateValidator as e0, createPhoneValidator as e1, createCurrencyValidator as e2, createStatusValidator as e3, createSelectValidator as e4, createMultiselectValidator as e5, createLocationValidator as e6, createFileValidator as e7, createUserValidator as e8, createSingleRelationValidator as e9, type TokenVerificationResult as eA, PinCodeService as eB, getDefaultPinCodeService as eC, initializePinCodeService as eD, type PinCodeGenerationOptions as eE, type PinCodeVerificationResult as eF, type CacheKeyType as eG, hashOptions as eH, type CacheAdapter as eI, type CacheOptions as eJ, cacheKeys as eK, cacheTtl as eL, defaultTtl as eM, NoopCacheAdapter as eN, type FetchResult as eO, type FormattedRecord as eP, type GroupedFetchResult as eQ, type InsertOptions as eR, type QueryBuilderState as eS, type RegistryMap as eT, type RegistryObjectNames as eU, type ShortcutOperator as eV, createDefaultState as eW, formatRecord as eX, formatRecords as eY, QueryMultipleResultsError as eZ, QueryNoResultError as e_, createMultiRelationValidator as ea, createRelationValidator as eb, createRatingValidator as ec, createFormulaValidator as ed, createRollupValidator as ee, createTextAreaValidator as ef, createRichtextValidator as eg, createAttributeValidator as eh, createFormAttributeValidator as ei, createObjectValidator as ej, type ValidationResult as ek, validateAttribute as el, validateObject as em, validateObjectOrThrow as en, createDraftValidator as eo, validateDraft as ep, validateDraftOrThrow as eq, getMissingRequiredAttributes as er, isRecordComplete as es, computeRecordStatus as et, type DatabaseAdapter as eu, ParticipationTokenService as ev, getDefaultTokenService as ew, initializeTokenService as ex, type ParticipationTokenPayload as ey, type TokenGenerationOptions as ez, type StatusAttribute as f, type PathCardinality as f$, createQueryBuilder as f0, QueryBuilder as f1, type QueryBuilderOptions as f2, type EvaluationResult as f3, type EvaluationTrace as f4, evaluateCondition as f5, evaluate as f6, evaluateWithTrace as f7, TenantContextError as f8, addSchemaToContext as f9, success as fA, wait as fB, ConditionExecutor as fC, EndExecutor as fD, FormExecutor as fE, StartExecutor as fF, evaluateFormula as fG, evaluateFormulaAttribute as fH, evaluateFormulaAttributeWithRelations as fI, evaluateFormulaWithRelations as fJ, evaluateFormulaWithResult as fK, extractFormulaVariables as fL, extractRelationNames as fM, extractRelationReferences as fN, flattenRelationsForEval as fO, formatFormulaResult as fP, hasRelationReferences as fQ, validateFormulaExpression as fR, type FormulaResult as fS, getPathDepth as fT, getRelationPath as fU, getTargetAttributeName as fV, InvalidPathError as fW, MaxDepthExceededError as fX, parsePath as fY, pathHasManyCardinality as fZ, validatePath as f_, getSchemaByNameFromContext as fa, getSchemaContext as fb, getSchemaFromContext as fc, hasSchemaContext as fd, runWithMergedSchemaContext as fe, runWithSchemaContext as ff, type SchemaContext as fg, getContext as fh, getTenantId as fi, getUserId as fj, hasContext as fk, runWithContext as fl, withTenantContext as fm, type TenantContext as fn, createDefaultExecutorRegistry as fo, getDefaultExecutorRegistry as fp, type ExecutorCompleteResult as fq, type ExecutorContext as fr, type ExecutorErrorResult as fs, type ExecutorResult as ft, type ExecutorSuccessResult as fu, type ExecutorWaitResult as fv, type NodeExecutor as fw, complete as fx, error as fy, ExecutorRegistry as fz, type SelectAttribute as g, applyDefaultValues as g$, type PathSegment as g0, type PathSegmentType as g1, type SchemaResolver as g2, resolveMultiplePaths as g3, resolveSingleValue as g4, traversePath as g5, type TraversalOptions as g6, type TraversalResult as g7, type AttributeChange as g8, type HookContext as g9, type CreateCustomObjectInput as gA, type AddAttributeInput as gB, type UpdateObjectInput as gC, type ObjectSchemaServiceOptions as gD, ObjectSchemaService as gE, type RecordServiceOptions as gF, RecordService as gG, type RecordQueryServiceOptions as gH, type QueryOptions as gI, type SearchQueryOptions as gJ, type QueryResult as gK, RecordQueryService as gL, type RelationValidationResult as gM, type RelationValidationError as gN, type RelationOption as gO, type RelationOptionsResponse as gP, type GetRelationOptionsParams as gQ, type RelationServiceOptions as gR, type ResolveIdsBatchRequest as gS, type ResolveIdsBatchResponse as gT, RelationService as gU, type ResolvedRelations as gV, RelationResolverService as gW, type RollupResult as gX, RollupService as gY, type RollupSchedulerOptions as gZ, RollupScheduler as g_, type HookDefinition as ga, type HookHandler as gb, type HookType as gc, NoopHookRegistry as gd, type HookRegistry as ge, createMockAdapter as gf, defaultPolicyRegistry as gg, PolicyRegistry as gh, notesPolicy as gi, type ObjectsRepository as gj, type AttributesRepository as gk, type UserProfilesRepository as gl, type FilesRepository as gm, type ObjectRecordsRepository as gn, type ViewsRepository as go, type WorkflowsRepository as gp, type WorkflowInstancesRepository as gq, type WorkflowParticipationsRepository as gr, type AuditRepository as gs, type PermissionsRepository as gt, BaseService as gu, BaseRepository as gv, type SchemaContextAware as gw, SchemaContextAwareRepository as gx, TenantAwareRepository as gy, TenantAwareService as gz, type SingleRelationAttribute as h, extractAttributeNames as h$, checkPermission as h0, getPolicy as h1, buildPolicyContext as h2, checkRecordAccess as h3, checkRecordModifyOrThrow as h4, checkRecordDeleteOrThrow as h5, computeLabel as h6, type LabelResolver as h7, enrichWithFormulas as h8, enrichRecordsWithFormulas as h9, buildAuditChanges as hA, type FileServiceOptions as hB, FileService as hC, GeocodingService as hD, GlobalSearchService as hE, type PermissionServiceOptions as hF, PermissionService as hG, type CreateViewInput as hH, type UpdateViewInput as hI, ViewService as hJ, type FileContent as hK, type StorageUploadInput as hL, type StorageUploadResult as hM, type SignedUrlOptions as hN, type StorageAdapter as hO, type UploadFileInput as hP, type SyncResult as hQ, type SyncOptions as hR, syncNativeObjects as hS, verifyNativeObjectsSync as hT, getSyncPreview as hU, type FullSyncResult as hV, type FullSyncOptions as hW, syncAll as hX, DEFAULT_LABEL_FALLBACK as hY, renderLabelExpression as hZ, isLabelExpression as h_, createContextForCreate as ha, createContextForUpdate as hb, createContextForDelete as hc, createContextForRestore as hd, recalculateParentRollups as he, type RollupCascadeContext as hf, type CreateWorkflowInput as hg, type UpdateWorkflowInput as hh, type WorkflowServiceOptions as hi, WorkflowService as hj, type StartWorkflowInput as hk, type ResumeWorkflowInput as hl, type WorkflowInstanceServiceOptions as hm, WorkflowInstanceService as hn, type CreateParticipationInput as ho, type CreateParticipationResult as hp, type AuthenticationResult as hq, WorkflowParticipationService as hr, type FieldReadOnlyResult as hs, WorkflowRelationService as ht, type UserValidationResult as hu, type UserValidationError as hv, UserService as hw, type UserProfileServiceOptions as hx, UserProfileService as hy, AuditService as hz, type MultiRelationAttribute as i, enrichValuesForDisplay as i0, enrichValuesWithSelectLabels as i1, extractRelationIds as i2, type RelationLabelResolver as i3, computeLabelWithRelations as i4, type DBObject as i5, type CreateDBObject as i6, type UpdateDBObject as i7, type UpsertDBObject as i8, type DBAttribute as i9, type ViewSyncOptions as iA, syncNativeViews as iB, verifyNativeViewsSync as iC, getViewSyncPreview as iD, type CreateDBAttribute as ia, type UpdateDBAttribute as ib, type UpsertDBAttribute as ic, type CreateObjectRecord as id, type ListOptions as ie, type SearchOptions as ig, type GlobalSearchOptions as ih, type GlobalSearchResultItem as ii, type FileListOptions as ij, type DBView as ik, type CreateDBView as il, type UpdateDBView as im, type UpsertDBView as io, type DBWorkflow as ip, type CreateDBWorkflow as iq, type UpdateDBWorkflow as ir, type DBWorkflowInstance as is, type CreateDBWorkflowInstance as it, type UpdateDBWorkflowInstance as iu, type DBWorkflowParticipation as iv, type CreateDBWorkflowParticipation as iw, type UpdateDBWorkflowParticipation as ix, type OperationResult as iy, type ViewSyncResult as iz, type RelationTarget as j, type RatingAttribute as k, type FormulaAttribute as l, type FormulaReturnType as m, type RollupAttribute as n, type RollupFunction as o, type AttributeType as p, type ObjectDefinition as q, type Field as r, type AttributeGroupField as s, type TableTab as t, type InverseTableTab as u, type ViewDefinition as v, type InstanceStatus as w, type Tab as x, type FilterState as y, type SortRule as z };
|
|
11711
|
+
export { type FlowRow as $, type Attribute as A, type DirectTableTab as B, type CheckboxAttribute as C, type DateAttribute as D, type WorkflowConfig as E, type FileAttribute as F, type Group as G, type SlotMode as H, type InferAttributeValue as I, type AuthMethod as J, type AuthChannel as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type ObjectAction as O, type PhoneAttribute as P, type ParticipantTemplate as Q, type RichtextAttribute as R, type SystemResource as S, type TextAttribute as T, type UserAttribute as U, type ViewLayout as V, type WorkflowTheme as W, type ConditionGroup as X, type ConditionRule as Y, type WorkflowNode as Z, type WorkflowDefinition as _, type SystemAction as a, type AuditListOptions as a$, type BlockNoteContent as a0, type AIMessageRole as a1, type AIThinkingLevel as a2, type AIToolCallStatus as a3, type AIToolCall as a4, type AIChatMessagePartType as a5, type TextPartData as a6, type ToolPartData as a7, type ThinkingPartData as a8, type ReasoningPartData as a9, type LocationGranularity as aA, RELATION_TARGET_ANY as aB, type RelationAttribute as aC, isUniversalRelation as aD, type BlockNoteBlock as aE, type BlockNoteCustomInlineContent as aF, type BlockNoteDefaultProps as aG, type BlockNoteInlineContent as aH, type BlockNoteLink as aI, type BlockNoteStyledText as aJ, type BlockNoteStyles as aK, type BlockNoteTableCell as aL, type BlockNoteTableCellProps as aM, type BlockNoteTableContent as aN, type PartialBlockNoteBlock as aO, type PartialBlockNoteContent as aP, type PartialBlockNoteInlineContent as aQ, type PartialBlockNoteLink as aR, type PartialBlockNoteStyledText as aS, type PartialBlockNoteTableCell as aT, type PartialBlockNoteTableContent as aU, type AuditResourceType as aV, type AuditAction as aW, type AuditActorType as aX, type AuditChange as aY, type AuditLogEntry as aZ, type CreateAuditLogInput as a_, type AIChatMessagePart as aa, type AIChatMessage as ab, type AIQuestionType as ac, type AIQuestionOption as ad, type AIQuestion as ae, type AIQuestionAnswer as af, type AITodoStatus as ag, type AITodoItem as ah, type AITodoList as ai, type AIMessageAttachment as aj, type AIConversation as ak, type AIMessage as al, type AIToolCallRecord as am, type AIUserMemory as an, type AIUsageMetrics as ao, type AIProviderMetrics as ap, type CreateAIMessageInput as aq, type StatusGroup as ar, type AttributeGroup as as, type BaseAttribute as at, type NumberUnit as au, type DateFormat as av, type DateValue as aw, type Phone as ax, type Currency as ay, type Location as az, type TextAreaAttribute as b, type ExtractRecordInputStrict as b$, type AuditServiceOptions as b0, type StorageProvider as b1, type FileVisibility as b2, type File as b3, type CreateFile as b4, type UpdateFile as b5, type TextFilterOperator as b6, type NumberFilterOperator as b7, type CheckboxFilterOperator as b8, type DateFilterOperator as b9, type FlowStatus as bA, type FlowDefinition as bB, isFlowDefinition as bC, isFlowPublished as bD, isSystemFlow as bE, type GeocodingSuggestion as bF, type GeocodingAutocompleteParams as bG, type ReverseGeocodingParams as bH, type GeocodingParams as bI, type GeocodingAdapter as bJ, NoopGeocodingAdapter as bK, type AttributeSchema as bL, type InferRecordFromSchema as bM, type InferRecordWithRequirements as bN, type TypedAttribute as bO, type AttributeMap as bP, type AddAttribute as bQ, type InferRecord as bR, type InferRecordInput as bS, type InferRecordUpdate as bT, type CustomAttributeValue as bU, type WithCustomAttributes as bV, type RecordMetadata as bW, type SystemFields as bX, type ExtractRecord as bY, type ExtractRecordStrict as bZ, type ExtractRecordInput as b_, type SelectFilterOperator as ba, type MultiselectFilterOperator as bb, type RelationFilterOperator as bc, type FilterOperator as bd, type RelativeDateValue as be, type CurrencyFilterValue as bf, type PhoneFilterValue as bg, type FilterValue as bh, type FilterRule as bi, type ExtendedFilterRule as bj, type FilterCombinator as bk, type FilterGroup as bl, type AdvancedFilterState as bm, isAdvancedFilterState as bn, toAdvancedFilterState as bo, toSimpleFilterState as bp, type SortDirection as bq, type QueryState as br, OPERATORS_BY_TYPE as bs, type NoValueOperator as bt, NO_VALUE_OPERATORS as bu, isNoValueOperator as bv, type FlowSlot as bw, type FlowRowField as bx, type FlowPage as by, type FlowRelation as bz, type RichtextFeature as c, isConditionGroup as c$, type ExtractRecordUpdate as c0, type ExtractRecordUpdateStrict as c1, type ExtractAttributes as c2, type TypedObjectRecord as c3, type ExtractObjectRecord as c4, type ExtractObjectRecordWithCustom as c5, RESERVED_ATTRIBUTE_NAMES as c6, SYSTEM_FIELD_NAMES as c7, type ReservedAttributeName as c8, type SystemFieldName as c9, type CustomTab as cA, type ActivityTab as cB, type NotesTab as cC, type FlowsTab as cD, isFormTab as cE, isTableTab as cF, isDirectTableTab as cG, isInverseTableTab as cH, isCustomTab as cI, isActivityTab as cJ, isNotesTab as cK, isFlowsTab as cL, type StartNode as cM, type FormNode as cN, type FormFieldRef as cO, type ConditionNode as cP, type EndNode as cQ, type WorkflowNodeType as cR, isStartNode as cS, isFormNode as cT, isConditionNode as cU, isEndNode as cV, isSimpleFormNode as cW, isAdvancedFormNode as cX, getNodeOutputs as cY, type ConditionOperator as cZ, isConditionRule as c_, type Timestamps as ca, type ObjectAttribute as cb, type CompletionStatus as cc, type ObjectRecord as cd, type PermissionScope as ce, type Role as cf, type Permission as cg, type UserRoleAssignment as ch, type EffectivePermissions as ci, type ObjectPermissions as cj, type SystemPermissions as ck, type CreateRoleInput as cl, type UpdateRoleInput as cm, type CreatePermissionInput as cn, type AssignRoleInput as co, type PolicyContext as cp, type RecordPolicy as cq, PolicyViolationError as cr, type UserRole as cs, type UserStatus as ct, type UserProfile as cu, type CreateUserProfile as cv, type UpdateUserProfile as cw, type InviteUserInput as cx, type TabType as cy, type FormTab as cz, type CurrencyAttribute as d, DEFAULT_VALIDATION_MESSAGES as d$, eq as d0, neq as d1, and as d2, or as d3, inValues as d4, isEmpty as d5, isNotEmpty as d6, type WorkflowSlot as d7, type NodePosition as d8, type CanvasViewport as d9, type WorkflowExecutionContext as dA, createEmptyContext as dB, getContextValue as dC, setContextValue as dD, mergeFormToSlot as dE, type WorkflowAccessMode as dF, type ReadOnlyReason as dG, type FormFieldContext as dH, type FormFieldRow as dI, type FormNodeInfo as dJ, type FormContextResponse as dK, type ThemeLogo as dL, type ThemeColors as dM, type ThemeTypography as dN, DEFAULT_THEME as dO, mergeWithDefaults as dP, generateCssVariables as dQ, type Uuid as dR, type TenantId as dS, type UserId as dT, asTenantId as dU, asUserId as dV, generateId as dW, generatePrefixedId as dX, registry as dY, viewRegistry as dZ, type ValidationMessages as d_, type WorkflowLayout as da, type ParticipantAuthConfig as db, type WorkflowStatus as dc, isWorkflowDefinition as dd, isWorkflowPublished as de, isSystemWorkflow as df, type WorkflowTransition as dg, type WorkflowError as dh, type PendingAction as di, type WorkflowInstance as dj, isInstanceTerminal as dk, isInstanceWaiting as dl, canResumeInstance as dm, createStartTransition as dn, type ParticipationStatus as dp, type SignedLinkAuth as dq, type PinCodeAuth as dr, type ParticipationAuth as ds, type WorkflowParticipation as dt, isSignedLinkAuth as du, isPinCodeAuth as dv, canParticipate as dw, canAuthenticate as dx, canExecuteNode as dy, type GeneratedDocument as dz, type Option as e, PinCodeService as e$, textConfigSchema as e0, textareaConfigSchema as e1, richtextConfigSchema as e2, numberConfigSchema as e3, checkboxConfigSchema as e4, dateConfigSchema as e5, phoneConfigSchema as e6, currencyConfigSchema as e7, statusConfigSchema as e8, locationConfigSchema as e9, createMultiRelationValidator as eA, createRelationValidator as eB, createRatingValidator as eC, createFormulaValidator as eD, createRollupValidator as eE, createTextAreaValidator as eF, createRichtextValidator as eG, createAttributeValidator as eH, createFormAttributeValidator as eI, createObjectValidator as eJ, type ValidationResult as eK, validateAttribute as eL, validateObject as eM, validateObjectOrThrow as eN, createDraftValidator as eO, validateDraft as eP, validateDraftOrThrow as eQ, getMissingRequiredAttributes as eR, isRecordComplete as eS, computeRecordStatus as eT, type DatabaseAdapter as eU, ParticipationTokenService as eV, getDefaultTokenService as eW, initializeTokenService as eX, type ParticipationTokenPayload as eY, type TokenGenerationOptions as eZ, type TokenVerificationResult as e_, selectConfigSchema as ea, multiselectConfigSchema as eb, fileConfigSchema as ec, userConfigSchema as ed, relationConfigSchema as ee, ratingConfigSchema as ef, formulaConfigSchema as eg, rollupConfigSchema as eh, attributeConfigSchemas as ei, getAttributeConfigSchema as ej, validateAttributeConfig as ek, parseAttributeConfig as el, safeParseAttributeConfig as em, createTextValidator as en, createNumberValidator as eo, createCheckboxValidator as ep, createDateValidator as eq, createPhoneValidator as er, createCurrencyValidator as es, createStatusValidator as et, createSelectValidator as eu, createMultiselectValidator as ev, createLocationValidator as ew, createFileValidator as ex, createUserValidator as ey, createSingleRelationValidator as ez, type StatusAttribute as f, wait as f$, getDefaultPinCodeService as f0, initializePinCodeService as f1, type PinCodeGenerationOptions as f2, type PinCodeVerificationResult as f3, type CacheKeyType as f4, hashOptions as f5, type CacheAdapter as f6, type CacheOptions as f7, cacheKeys as f8, cacheTtl as f9, getSchemaByNameFromContext as fA, getSchemaContext as fB, getSchemaFromContext as fC, hasSchemaContext as fD, runWithMergedSchemaContext as fE, runWithSchemaContext as fF, type SchemaContext as fG, getContext as fH, getTenantId as fI, getUserId as fJ, hasContext as fK, runWithContext as fL, withTenantContext as fM, type TenantContext as fN, createDefaultExecutorRegistry as fO, getDefaultExecutorRegistry as fP, type ExecutorCompleteResult as fQ, type ExecutorContext as fR, type ExecutorErrorResult as fS, type ExecutorResult as fT, type ExecutorSuccessResult as fU, type ExecutorWaitResult as fV, type NodeExecutor as fW, complete as fX, error as fY, ExecutorRegistry as fZ, success as f_, defaultTtl as fa, NoopCacheAdapter as fb, type FetchResult as fc, type FormattedRecord as fd, type GroupedFetchResult as fe, type InsertOptions as ff, type QueryBuilderState as fg, type RegistryMap as fh, type RegistryObjectNames as fi, type ShortcutOperator as fj, createDefaultState as fk, formatRecord as fl, formatRecords as fm, QueryMultipleResultsError as fn, QueryNoResultError as fo, SHORTCUT_TO_FILTER_OPERATOR as fp, createQueryBuilder as fq, QueryBuilder as fr, type QueryBuilderOptions as fs, type EvaluationResult as ft, type EvaluationTrace as fu, evaluateCondition as fv, evaluate as fw, evaluateWithTrace as fx, TenantContextError as fy, addSchemaToContext as fz, type SelectAttribute as g, TenantAwareRepository as g$, ConditionExecutor as g0, EndExecutor as g1, FormExecutor as g2, StartExecutor as g3, evaluateFormula as g4, evaluateFormulaAttribute as g5, evaluateFormulaAttributeWithRelations as g6, evaluateFormulaWithRelations as g7, evaluateFormulaWithResult as g8, extractFormulaVariables as g9, type HookDefinition as gA, type HookHandler as gB, type HookType as gC, NoopHookRegistry as gD, type HookRegistry as gE, createMockAdapter as gF, defaultPolicyRegistry as gG, PolicyRegistry as gH, notesPolicy as gI, type ObjectsRepository as gJ, type AttributesRepository as gK, type UserProfilesRepository as gL, type FilesRepository as gM, type ObjectRecordsRepository as gN, type ViewsRepository as gO, type WorkflowsRepository as gP, type WorkflowInstancesRepository as gQ, type WorkflowParticipationsRepository as gR, type AuditRepository as gS, type PermissionsRepository as gT, type AIConversationsRepository as gU, type AIUserMemoryRepository as gV, type AIUsageMetricsRepository as gW, BaseService as gX, BaseRepository as gY, type SchemaContextAware as gZ, SchemaContextAwareRepository as g_, extractRelationNames as ga, extractRelationReferences as gb, flattenRelationsForEval as gc, formatFormulaResult as gd, hasRelationReferences as ge, validateFormulaExpression as gf, type FormulaResult as gg, getPathDepth as gh, getRelationPath as gi, getTargetAttributeName as gj, InvalidPathError as gk, MaxDepthExceededError as gl, parsePath as gm, pathHasManyCardinality as gn, validatePath as go, type PathCardinality as gp, type PathSegment as gq, type PathSegmentType as gr, type SchemaResolver as gs, resolveMultiplePaths as gt, resolveSingleValue as gu, traversePath as gv, type TraversalOptions as gw, type TraversalResult as gx, type AttributeChange as gy, type HookContext as gz, type SingleRelationAttribute as h, type UserValidationError as h$, TenantAwareService as h0, type CreateCustomObjectInput as h1, type AddAttributeInput as h2, type UpdateObjectInput as h3, type ObjectSchemaServiceOptions as h4, ObjectSchemaService as h5, type RecordServiceOptions as h6, RecordService as h7, type RecordQueryServiceOptions as h8, type QueryOptions as h9, checkRecordModifyOrThrow as hA, checkRecordDeleteOrThrow as hB, computeLabel as hC, type LabelResolver as hD, enrichWithFormulas as hE, enrichRecordsWithFormulas as hF, createContextForCreate as hG, createContextForUpdate as hH, createContextForDelete as hI, createContextForRestore as hJ, recalculateParentRollups as hK, type RollupCascadeContext as hL, type CreateWorkflowInput as hM, type UpdateWorkflowInput as hN, type WorkflowServiceOptions as hO, WorkflowService as hP, type StartWorkflowInput as hQ, type ResumeWorkflowInput as hR, type WorkflowInstanceServiceOptions as hS, WorkflowInstanceService as hT, type CreateParticipationInput as hU, type CreateParticipationResult as hV, type AuthenticationResult as hW, WorkflowParticipationService as hX, type FieldReadOnlyResult as hY, WorkflowRelationService as hZ, type UserValidationResult as h_, type SearchQueryOptions as ha, type QueryResult as hb, RecordQueryService as hc, type RelationValidationResult as hd, type RelationValidationError as he, type RelationOption as hf, type RelationOptionsResponse as hg, type GetRelationOptionsParams as hh, type RelationServiceOptions as hi, type ResolveIdsBatchRequest as hj, type ResolveIdsBatchResponse as hk, RelationService as hl, RecordResolverService as hm, type ResolvedRelations as hn, type FormulaResolverServiceOptions as ho, FormulaResolverService as hp, type RollupResult as hq, type RollupServiceOptions as hr, RollupService as hs, type RollupSchedulerOptions as ht, RollupScheduler as hu, applyDefaultValues as hv, checkPermission as hw, getPolicy as hx, buildPolicyContext as hy, checkRecordAccess as hz, type MultiRelationAttribute as i, type DBWorkflowParticipation as i$, UserService as i0, type UserProfileServiceOptions as i1, UserProfileService as i2, AuditService as i3, buildAuditChanges as i4, type FileServiceOptions as i5, FileService as i6, GeocodingService as i7, GlobalSearchService as i8, type PermissionServiceOptions as i9, extractRelationIds as iA, type RelationLabelResolver as iB, computeLabelWithRelations as iC, type DBObject as iD, type CreateDBObject as iE, type UpdateDBObject as iF, type UpsertDBObject as iG, type DBAttribute as iH, type CreateDBAttribute as iI, type UpdateDBAttribute as iJ, type UpsertDBAttribute as iK, type CreateObjectRecord as iL, type ListOptions as iM, type SearchOptions as iN, type GlobalSearchOptions as iO, type GlobalSearchResultItem as iP, type FileListOptions as iQ, type DBView as iR, type CreateDBView as iS, type UpdateDBView as iT, type UpsertDBView as iU, type DBWorkflow as iV, type CreateDBWorkflow as iW, type UpdateDBWorkflow as iX, type DBWorkflowInstance as iY, type CreateDBWorkflowInstance as iZ, type UpdateDBWorkflowInstance as i_, PermissionService as ia, type CreateViewInput as ib, type UpdateViewInput as ic, ViewService as id, type FileContent as ie, type StorageUploadInput as ig, type StorageUploadResult as ih, type SignedUrlOptions as ii, type StorageAdapter as ij, type UploadFileInput as ik, type SyncResult as il, type SyncOptions as im, syncNativeObjects as io, verifyNativeObjectsSync as ip, getSyncPreview as iq, type FullSyncResult as ir, type FullSyncOptions as is, syncAll as it, DEFAULT_LABEL_FALLBACK as iu, renderLabelExpression as iv, isLabelExpression as iw, extractAttributeNames as ix, enrichValuesForDisplay as iy, enrichValuesWithSelectLabels as iz, type RelationTarget as j, type CreateDBWorkflowParticipation as j0, type UpdateDBWorkflowParticipation as j1, type OperationResult as j2, type ViewSyncResult as j3, type ViewSyncOptions as j4, syncNativeViews as j5, verifyNativeViewsSync as j6, getViewSyncPreview as j7, type RatingAttribute as k, type FormulaAttribute as l, type FormulaReturnType as m, type RollupAttribute as n, type RollupFunction as o, type AttributeType as p, type ObjectDefinition as q, type Field as r, type AttributeGroupField as s, type TableTab as t, type InverseTableTab as u, type ViewDefinition as v, type InstanceStatus as w, type Tab as x, type FilterState as y, type SortRule as z };
|