@lupinum/better-convex-functions 0.1.0 → 0.2.0
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/agent/AGENTS.md +7 -3
- package/dist/agent/pages/docs/build/application-behavior/error-handling.md +40 -1
- package/dist/agent/pages/docs/build/authentication/account-deletion.md +73 -0
- package/dist/agent/pages/docs/build/authentication/backend-authorization.md +6 -1
- package/dist/agent/pages/docs/build/authentication/better-auth-setup.md +3 -1
- package/dist/agent/pages/docs/build/authentication/sign-in-and-sign-out.md +3 -0
- package/dist/agent/pages/docs/build/authentication/transactional-email.md +45 -10
- package/dist/agent/pages/docs/build/files/private-downloads.md +126 -0
- package/dist/agent/pages/docs/build/files/storage-urls.md +8 -3
- package/dist/agent/pages/docs/build/files/upload-files.md +2 -2
- package/dist/agent/pages/docs/build/functions/limits-and-audit.md +142 -4
- package/dist/agent/pages/docs/build/functions/testing.md +24 -0
- package/dist/agent/pages/docs/build/queries/loading-and-stale-data.md +1 -1
- package/dist/agent/pages/docs/build/queries/pagination.md +2 -2
- package/dist/agent/pages/docs/build/queries/reactive-arguments.md +46 -0
- package/dist/agent/pages/docs/build/server/server-convex.md +16 -1
- package/dist/agent/pages/docs/build/write-data/concurrent-operations.md +1 -1
- package/dist/agent/pages/docs/build/write-data/forms.md +1 -1
- package/dist/agent/pages/docs/build/write-data/multi-step-operations.md +1 -1
- package/dist/agent/pages/docs/build/write-data/optimistic-updates.md +1 -1
- package/dist/agent/pages/docs/get-started/add-authentication.md +13 -3
- package/dist/agent/pages/docs/get-started/complete-and-delete.md +2 -0
- package/dist/agent/pages/docs/get-started/first-realtime-page.md +3 -1
- package/dist/agent/pages/docs/get-started/installation.md +3 -0
- package/dist/agent/pages/docs/get-started/next-steps.md +30 -0
- package/dist/agent/pages/docs/get-started/plain-vue.md +143 -41
- package/dist/agent/pages/docs/operations/before-launch.md +1 -1
- package/dist/agent/pages/docs/operations/log-streams.md +128 -0
- package/dist/agent/pages/docs/recipes/dynamic-query-list.md +1 -1
- package/dist/agent/pages/docs/recipes/error-messages.md +1 -1
- package/dist/agent/pages/docs/recipes/guest-users.md +67 -15
- package/dist/agent/pages/docs/recipes/multiple-file-uploads.md +1 -1
- package/dist/agent/pages/docs/recipes/optimistic-todo-list.md +1 -1
- package/dist/agent/pages/docs/recipes/realtime-feed.md +1 -1
- package/dist/agent/pages/docs/recipes/sign-in-link.md +129 -0
- package/dist/agent/pages/docs/reference/api-surface.md +11 -0
- package/dist/agent/pages/docs/reference/error-types.md +12 -2
- package/dist/agent/pages/docs/reference/operation-error-codes.md +15 -1
- package/dist/agent/pages/docs/reference/package-exports.md +3 -2
- package/dist/agent/pages/docs/reference/server-api.md +5 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/internal.d.mts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.mjs +2 -2
- package/dist/shared/{better-convex-functions.Bdo4Aaov.d.mts → better-convex-functions.58GAkR9U.d.mts} +1 -1
- package/dist/shared/{better-convex-functions.BkEAj2tq.d.mts → better-convex-functions.B3cGyLjQ.d.mts} +204 -103
- package/dist/shared/{better-convex-functions.DVNOVULJ.mjs → better-convex-functions.BY1yTglN.mjs} +332 -131
- package/dist/shared/{better-convex-functions.bhHIvhtY.d.ts → better-convex-functions.BpPWw1jZ.d.ts} +1 -1
- package/dist/shared/{better-convex-functions.BgrHMmbW.mjs → better-convex-functions.Cnkl3RDb.mjs} +1 -1
- package/dist/shared/{better-convex-functions.CMT57Zsz.d.ts → better-convex-functions.Wr9dSqS9.d.ts} +204 -103
- package/dist/test.d.mts +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.mjs +1 -1
- package/package.json +1 -1
|
@@ -47,8 +47,8 @@ type SystemActor = {
|
|
|
47
47
|
declare const agentCallerValidator: convex_values.VUnion<{
|
|
48
48
|
door: "mcp";
|
|
49
49
|
principal: {
|
|
50
|
-
userId: string;
|
|
51
50
|
kind: "oauth";
|
|
51
|
+
userId: string;
|
|
52
52
|
clientId: string;
|
|
53
53
|
scopes: string[];
|
|
54
54
|
sessionId: string;
|
|
@@ -64,8 +64,8 @@ declare const agentCallerValidator: convex_values.VUnion<{
|
|
|
64
64
|
}, [convex_values.VObject<{
|
|
65
65
|
door: "mcp";
|
|
66
66
|
principal: {
|
|
67
|
-
userId: string;
|
|
68
67
|
kind: "oauth";
|
|
68
|
+
userId: string;
|
|
69
69
|
clientId: string;
|
|
70
70
|
scopes: string[];
|
|
71
71
|
sessionId: string;
|
|
@@ -77,8 +77,8 @@ declare const agentCallerValidator: convex_values.VUnion<{
|
|
|
77
77
|
}, {
|
|
78
78
|
door: convex_values.VLiteral<"mcp", "required">;
|
|
79
79
|
principal: convex_values.VObject<{
|
|
80
|
-
userId: string;
|
|
81
80
|
kind: "oauth";
|
|
81
|
+
userId: string;
|
|
82
82
|
clientId: string;
|
|
83
83
|
scopes: string[];
|
|
84
84
|
sessionId: string;
|
|
@@ -96,8 +96,8 @@ declare const agentCallerValidator: convex_values.VUnion<{
|
|
|
96
96
|
issuer: convex_values.VString<string, "required">;
|
|
97
97
|
resource: convex_values.VString<string, "required">;
|
|
98
98
|
expiresAt: convex_values.VFloat64<number, "required">;
|
|
99
|
-
}, "required", "
|
|
100
|
-
}, "required", "door" | "principal" | "principal.
|
|
99
|
+
}, "required", "kind" | "userId" | "clientId" | "scopes" | "sessionId" | "grantId" | "issuer" | "resource" | "expiresAt">;
|
|
100
|
+
}, "required", "door" | "principal" | "principal.kind" | "principal.userId" | "principal.clientId" | "principal.scopes" | "principal.sessionId" | "principal.grantId" | "principal.issuer" | "principal.resource" | "principal.expiresAt">, convex_values.VObject<{
|
|
101
101
|
turn?: number | undefined;
|
|
102
102
|
door: "app";
|
|
103
103
|
runId: string;
|
|
@@ -105,7 +105,7 @@ declare const agentCallerValidator: convex_values.VUnion<{
|
|
|
105
105
|
door: convex_values.VLiteral<"app", "required">;
|
|
106
106
|
runId: convex_values.VString<string, "required">;
|
|
107
107
|
turn: convex_values.VFloat64<number | undefined, "optional">;
|
|
108
|
-
}, "required", "door" | "runId" | "turn">], "required", "door" | "principal" | "principal.
|
|
108
|
+
}, "required", "door" | "runId" | "turn">], "required", "door" | "principal" | "principal.kind" | "principal.userId" | "principal.clientId" | "principal.scopes" | "principal.sessionId" | "principal.grantId" | "principal.issuer" | "principal.resource" | "principal.expiresAt" | "runId" | "turn">;
|
|
109
109
|
type AgentCaller = Infer<typeof agentCallerValidator>;
|
|
110
110
|
/**
|
|
111
111
|
* Who an internal operation acts for, as its caller passes it. The internal
|
|
@@ -123,8 +123,8 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
123
123
|
caller: {
|
|
124
124
|
door: "mcp";
|
|
125
125
|
principal: {
|
|
126
|
-
userId: string;
|
|
127
126
|
kind: "oauth";
|
|
127
|
+
userId: string;
|
|
128
128
|
clientId: string;
|
|
129
129
|
scopes: string[];
|
|
130
130
|
sessionId: string;
|
|
@@ -157,8 +157,8 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
157
157
|
caller: {
|
|
158
158
|
door: "mcp";
|
|
159
159
|
principal: {
|
|
160
|
-
userId: string;
|
|
161
160
|
kind: "oauth";
|
|
161
|
+
userId: string;
|
|
162
162
|
clientId: string;
|
|
163
163
|
scopes: string[];
|
|
164
164
|
sessionId: string;
|
|
@@ -177,8 +177,8 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
177
177
|
caller: convex_values.VUnion<{
|
|
178
178
|
door: "mcp";
|
|
179
179
|
principal: {
|
|
180
|
-
userId: string;
|
|
181
180
|
kind: "oauth";
|
|
181
|
+
userId: string;
|
|
182
182
|
clientId: string;
|
|
183
183
|
scopes: string[];
|
|
184
184
|
sessionId: string;
|
|
@@ -194,8 +194,8 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
194
194
|
}, [convex_values.VObject<{
|
|
195
195
|
door: "mcp";
|
|
196
196
|
principal: {
|
|
197
|
-
userId: string;
|
|
198
197
|
kind: "oauth";
|
|
198
|
+
userId: string;
|
|
199
199
|
clientId: string;
|
|
200
200
|
scopes: string[];
|
|
201
201
|
sessionId: string;
|
|
@@ -207,8 +207,8 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
207
207
|
}, {
|
|
208
208
|
door: convex_values.VLiteral<"mcp", "required">;
|
|
209
209
|
principal: convex_values.VObject<{
|
|
210
|
-
userId: string;
|
|
211
210
|
kind: "oauth";
|
|
211
|
+
userId: string;
|
|
212
212
|
clientId: string;
|
|
213
213
|
scopes: string[];
|
|
214
214
|
sessionId: string;
|
|
@@ -226,8 +226,8 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
226
226
|
issuer: convex_values.VString<string, "required">;
|
|
227
227
|
resource: convex_values.VString<string, "required">;
|
|
228
228
|
expiresAt: convex_values.VFloat64<number, "required">;
|
|
229
|
-
}, "required", "
|
|
230
|
-
}, "required", "door" | "principal" | "principal.
|
|
229
|
+
}, "required", "kind" | "userId" | "clientId" | "scopes" | "sessionId" | "grantId" | "issuer" | "resource" | "expiresAt">;
|
|
230
|
+
}, "required", "door" | "principal" | "principal.kind" | "principal.userId" | "principal.clientId" | "principal.scopes" | "principal.sessionId" | "principal.grantId" | "principal.issuer" | "principal.resource" | "principal.expiresAt">, convex_values.VObject<{
|
|
231
231
|
turn?: number | undefined;
|
|
232
232
|
door: "app";
|
|
233
233
|
runId: string;
|
|
@@ -235,11 +235,11 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
235
235
|
door: convex_values.VLiteral<"app", "required">;
|
|
236
236
|
runId: convex_values.VString<string, "required">;
|
|
237
237
|
turn: convex_values.VFloat64<number | undefined, "optional">;
|
|
238
|
-
}, "required", "door" | "runId" | "turn">], "required", "door" | "principal" | "principal.
|
|
238
|
+
}, "required", "door" | "runId" | "turn">], "required", "door" | "principal" | "principal.kind" | "principal.userId" | "principal.clientId" | "principal.scopes" | "principal.sessionId" | "principal.grantId" | "principal.issuer" | "principal.resource" | "principal.expiresAt" | "runId" | "turn">;
|
|
239
239
|
approvalId: convex_values.VString<string | undefined, "optional">;
|
|
240
240
|
followUp: convex_values.VString<string | undefined, "optional">;
|
|
241
241
|
scheduled: convex_values.VLiteral<true | undefined, "optional">;
|
|
242
|
-
}, "required", "kind" | "
|
|
242
|
+
}, "required", "kind" | "approvalId" | "caller" | "followUp" | "caller.door" | "caller.principal" | "caller.principal.kind" | "caller.principal.userId" | "caller.principal.clientId" | "caller.principal.scopes" | "caller.principal.sessionId" | "caller.principal.grantId" | "caller.principal.issuer" | "caller.principal.resource" | "caller.principal.expiresAt" | "caller.runId" | "caller.turn" | "scheduled">, convex_values.VObject<{
|
|
243
243
|
kind: "visitor";
|
|
244
244
|
}, {
|
|
245
245
|
kind: convex_values.VLiteral<"visitor", "required">;
|
|
@@ -249,26 +249,26 @@ declare const actingAsValidator: convex_values.VUnion<{
|
|
|
249
249
|
}, {
|
|
250
250
|
kind: convex_values.VLiteral<"system", "required">;
|
|
251
251
|
job: convex_values.VString<string, "required">;
|
|
252
|
-
}, "required", "kind" | "job">], "required", "kind" | "
|
|
252
|
+
}, "required", "kind" | "job">], "required", "kind" | "job" | "approvalId" | "caller" | "followUp" | "caller.door" | "caller.principal" | "caller.principal.kind" | "caller.principal.userId" | "caller.principal.clientId" | "caller.principal.scopes" | "caller.principal.sessionId" | "caller.principal.grantId" | "caller.principal.issuer" | "caller.principal.resource" | "caller.principal.expiresAt" | "caller.runId" | "caller.turn" | "authId" | "scheduled">;
|
|
253
253
|
type ActingAs = Infer<typeof actingAsValidator>;
|
|
254
254
|
/** The stored form of an actor, for activity and approval rows. */
|
|
255
255
|
declare const actorRecordValidator: convex_values.VObject<{
|
|
256
|
-
userId?: string | undefined;
|
|
257
|
-
clientId?: string | undefined;
|
|
258
256
|
agent?: string | undefined;
|
|
259
257
|
job?: string | undefined;
|
|
260
|
-
|
|
258
|
+
userId?: string | undefined;
|
|
259
|
+
clientId?: string | undefined;
|
|
261
260
|
key: string;
|
|
262
|
-
|
|
261
|
+
kind: "person" | "agent" | "system";
|
|
262
|
+
door: "web" | "mcp" | "app" | "job";
|
|
263
263
|
}, {
|
|
264
264
|
key: convex_values.VString<string, "required">;
|
|
265
265
|
kind: convex_values.VUnion<"person" | "agent" | "system", [convex_values.VLiteral<"person", "required">, convex_values.VLiteral<"agent", "required">, convex_values.VLiteral<"system", "required">], "required", never>;
|
|
266
|
-
door: convex_values.VUnion<"
|
|
266
|
+
door: convex_values.VUnion<"web" | "mcp" | "app" | "job", [convex_values.VLiteral<"web", "required">, convex_values.VLiteral<"mcp", "required">, convex_values.VLiteral<"app", "required">, convex_values.VLiteral<"job", "required">], "required", never>;
|
|
267
267
|
userId: convex_values.VString<string | undefined, "optional">;
|
|
268
268
|
clientId: convex_values.VString<string | undefined, "optional">;
|
|
269
269
|
agent: convex_values.VString<string | undefined, "optional">;
|
|
270
270
|
job: convex_values.VString<string | undefined, "optional">;
|
|
271
|
-
}, "required", "
|
|
271
|
+
}, "required", "key" | "kind" | "agent" | "door" | "job" | "userId" | "clientId">;
|
|
272
272
|
type ActorRecord = Infer<typeof actorRecordValidator>;
|
|
273
273
|
declare function actorRecord(actor: Actor<{
|
|
274
274
|
_id: string;
|
|
@@ -281,20 +281,40 @@ declare function actorRecord(actor: Actor<{
|
|
|
281
281
|
*/
|
|
282
282
|
declare const errorCodes: readonly ["NOT_SIGNED_IN", "ACCOUNT_DISABLED", "FORBIDDEN", "NOT_FOUND", "INVALID_INPUT", "AGENT_DISABLED", "APPROVAL_NOT_FOUND", "APPROVAL_EXPIRED", "APPROVAL_DECLINED", "STALE", "REQUEST_ID_REUSED", "RATE_LIMITED", "TOO_LARGE", "CONFLICT", "FAILED", "STALLED", "MODEL_BUSY", "MODEL_REFUSED", "MODEL_FAILED", "MODEL_TIMEOUT"];
|
|
283
283
|
type ErrorCode = (typeof errorCodes)[number];
|
|
284
|
+
/**
|
|
285
|
+
* Help for the person or agent who meets a failure: `why` it happened and
|
|
286
|
+
* what they can do to `fix` it. The caller reads it as written, so write it
|
|
287
|
+
* for them and never build it from internal state.
|
|
288
|
+
*/
|
|
289
|
+
interface FailureHelp {
|
|
290
|
+
readonly why?: string;
|
|
291
|
+
readonly fix?: string;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Codes that take no help. `NOT_FOUND` must read like a missing row, so it
|
|
295
|
+
* cannot tell that a row the actor may not see exists; `FAILED` keeps its
|
|
296
|
+
* detail in the log.
|
|
297
|
+
*/
|
|
298
|
+
type CodeWithoutHelp = 'NOT_FOUND' | 'FAILED';
|
|
299
|
+
/** A failure as callers receive it: the `ConvexError` data of {@link fail}. */
|
|
300
|
+
interface Failure extends FailureHelp {
|
|
301
|
+
readonly code: ErrorCode;
|
|
302
|
+
readonly message: string;
|
|
303
|
+
}
|
|
284
304
|
/**
|
|
285
305
|
* A failure the caller may see. Anything else stays internal: callers see a
|
|
286
306
|
* generic message and the log keeps the detail. Only `ErrorCode`s, so a
|
|
287
307
|
* misspelled code is a type error and every code a client meets is listed.
|
|
308
|
+
* `help` adds `why` and `fix`, which the web client shows as
|
|
309
|
+
* `ConvexCallError.why` and `.fix`.
|
|
288
310
|
*/
|
|
289
311
|
declare function fail(code: ErrorCode, message: string): never;
|
|
312
|
+
declare function fail(code: Exclude<ErrorCode, CodeWithoutHelp>, message: string, help: FailureHelp): never;
|
|
290
313
|
/**
|
|
291
314
|
* The coded failure inside an error, or `null` for an internal one. Only an `ErrorCode` counts:
|
|
292
315
|
* a `ConvexError` from a dependency or a component may carry any code and private text.
|
|
293
316
|
*/
|
|
294
|
-
declare function failureOf(error: unknown):
|
|
295
|
-
code: ErrorCode;
|
|
296
|
-
message: string;
|
|
297
|
-
} | null;
|
|
317
|
+
declare function failureOf(error: unknown): Failure | null;
|
|
298
318
|
|
|
299
319
|
/**
|
|
300
320
|
* What happens to one field of a table when a person is erased. The entry names
|
|
@@ -328,6 +348,62 @@ declare function eraseUser(ctx: {
|
|
|
328
348
|
};
|
|
329
349
|
}, appUserId: string, step: FunctionReference<'mutation', 'internal', any>): Promise<void>;
|
|
330
350
|
|
|
351
|
+
/** A value `ctx.log.set` takes: what JSON can hold. */
|
|
352
|
+
type LogValue = string | number | boolean | null | readonly LogValue[] | {
|
|
353
|
+
readonly [key: string]: LogValue;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Fields for the event of this call, with `defineFunctions({ observe: true })`. Later calls to
|
|
357
|
+
* `set` replace a field of the same name. A value JSON cannot hold (a BigInt) is left out, so a
|
|
358
|
+
* field never fails the call. Without `observe`, `set` does nothing. Write IDs and codes, never
|
|
359
|
+
* values a person typed (names, amounts, email addresses): log streams copy every line to
|
|
360
|
+
* another service.
|
|
361
|
+
*/
|
|
362
|
+
interface CallLog {
|
|
363
|
+
set(fields: Record<string, LogValue>): void;
|
|
364
|
+
}
|
|
365
|
+
/** The actor as the event shows it: the stored actor record, or the kind alone where only that is known. */
|
|
366
|
+
type ActorField = ReturnType<typeof actorRecord> | {
|
|
367
|
+
kind: 'person' | 'agent' | 'visitor';
|
|
368
|
+
};
|
|
369
|
+
/** What the event of one call knows so far. The wrapper fills it in as the call learns it. */
|
|
370
|
+
interface Seen {
|
|
371
|
+
/** The action, when the call learns it only while it runs (`approve` reads it from the request). */
|
|
372
|
+
action?: string;
|
|
373
|
+
actor?: ActorField;
|
|
374
|
+
/** The key of the agent whose request a person decides: `actor` is the person. */
|
|
375
|
+
agent?: string;
|
|
376
|
+
tenant?: string;
|
|
377
|
+
approval?: string;
|
|
378
|
+
written?: ReadonlySet<string>;
|
|
379
|
+
/** Rows the calls it ran in its own transaction wrote: they write no event, so this one counts them. */
|
|
380
|
+
innerWritten?: Set<string>;
|
|
381
|
+
/** The trace this call belongs to: handed over by its caller, or made when it first starts other work. */
|
|
382
|
+
trace?: string;
|
|
383
|
+
readonly fields: Record<string, LogValue>;
|
|
384
|
+
/**
|
|
385
|
+
* How a call that returned ended, when the work did not run: it waits for a person, a person
|
|
386
|
+
* declined it, or approved work failed with this code while `approve` itself succeeded.
|
|
387
|
+
*/
|
|
388
|
+
outcome?: 'pending' | 'declined' | {
|
|
389
|
+
code: string;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
declare const newSeen: (trace?: string) => Seen;
|
|
393
|
+
/** Records the actor a check found. */
|
|
394
|
+
declare function sawActor(seen: Seen, actor: Actor<{
|
|
395
|
+
_id: string;
|
|
396
|
+
}> | Visitor | SystemActor): void;
|
|
397
|
+
/**
|
|
398
|
+
* The fields of an inner call, handed back to its caller's event: as JSON text, because a
|
|
399
|
+
* Convex value refuses field names a log may use (`größe`, `$set`).
|
|
400
|
+
*/
|
|
401
|
+
declare const handedFields: (seen: Seen) => {
|
|
402
|
+
fields?: string;
|
|
403
|
+
};
|
|
404
|
+
/** Adds the fields an inner call handed back to this call's. */
|
|
405
|
+
declare function tookFields(seen: Seen, fields: string): void;
|
|
406
|
+
|
|
331
407
|
/**
|
|
332
408
|
* Row rules: who may read and write each row. Every app table has one, and the
|
|
333
409
|
* library checks it on every row a handler reads or writes through `ctx.db`,
|
|
@@ -502,42 +578,42 @@ declare function readOnly<C extends object>(ctx: C): C;
|
|
|
502
578
|
declare const libraryTables: {
|
|
503
579
|
/** What agents and jobs did. One row per agent write, approval decision and job run. */
|
|
504
580
|
activity: TableDefinition<VObject<{
|
|
505
|
-
approvalId?: convex_values.GenericId<"approvals"> | undefined;
|
|
506
581
|
tool?: string | undefined;
|
|
507
582
|
tenantId?: string | undefined;
|
|
508
583
|
requestId?: string | undefined;
|
|
509
584
|
call?: string | undefined;
|
|
510
585
|
result?: any;
|
|
586
|
+
approvalId?: convex_values.GenericId<"approvals"> | undefined;
|
|
511
587
|
decidedBy?: string | undefined;
|
|
512
588
|
actor: {
|
|
513
|
-
userId?: string | undefined;
|
|
514
|
-
clientId?: string | undefined;
|
|
515
589
|
agent?: string | undefined;
|
|
516
590
|
job?: string | undefined;
|
|
517
|
-
|
|
591
|
+
userId?: string | undefined;
|
|
592
|
+
clientId?: string | undefined;
|
|
518
593
|
key: string;
|
|
519
|
-
|
|
594
|
+
kind: "person" | "agent" | "system";
|
|
595
|
+
door: "web" | "mcp" | "app" | "job";
|
|
520
596
|
};
|
|
521
597
|
action: string;
|
|
522
598
|
status: "done" | "approved" | "declined" | "failed";
|
|
523
599
|
}, {
|
|
524
600
|
actor: VObject<{
|
|
525
|
-
userId?: string | undefined;
|
|
526
|
-
clientId?: string | undefined;
|
|
527
601
|
agent?: string | undefined;
|
|
528
602
|
job?: string | undefined;
|
|
529
|
-
|
|
603
|
+
userId?: string | undefined;
|
|
604
|
+
clientId?: string | undefined;
|
|
530
605
|
key: string;
|
|
531
|
-
|
|
606
|
+
kind: "person" | "agent" | "system";
|
|
607
|
+
door: "web" | "mcp" | "app" | "job";
|
|
532
608
|
}, {
|
|
533
609
|
key: convex_values.VString<string, "required">;
|
|
534
610
|
kind: convex_values.VUnion<"person" | "agent" | "system", [convex_values.VLiteral<"person", "required">, convex_values.VLiteral<"agent", "required">, convex_values.VLiteral<"system", "required">], "required", never>;
|
|
535
|
-
door: convex_values.VUnion<"
|
|
611
|
+
door: convex_values.VUnion<"web" | "mcp" | "app" | "job", [convex_values.VLiteral<"web", "required">, convex_values.VLiteral<"mcp", "required">, convex_values.VLiteral<"app", "required">, convex_values.VLiteral<"job", "required">], "required", never>;
|
|
536
612
|
userId: convex_values.VString<string | undefined, "optional">;
|
|
537
613
|
clientId: convex_values.VString<string | undefined, "optional">;
|
|
538
614
|
agent: convex_values.VString<string | undefined, "optional">;
|
|
539
615
|
job: convex_values.VString<string | undefined, "optional">;
|
|
540
|
-
}, "required", "
|
|
616
|
+
}, "required", "key" | "kind" | "agent" | "door" | "job" | "userId" | "clientId">;
|
|
541
617
|
action: convex_values.VString<string, "required">;
|
|
542
618
|
tool: convex_values.VString<string | undefined, "optional">;
|
|
543
619
|
/** The tenant the call acted in, for a team's activity feed. */
|
|
@@ -551,14 +627,13 @@ declare const libraryTables: {
|
|
|
551
627
|
result: convex_values.VAny<any, "optional", string>;
|
|
552
628
|
approvalId: convex_values.VId<convex_values.GenericId<"approvals"> | undefined, "optional">;
|
|
553
629
|
decidedBy: convex_values.VString<string | undefined, "optional">;
|
|
554
|
-
}, "required", "
|
|
630
|
+
}, "required", "actor" | "action" | "tool" | "tenantId" | "requestId" | "call" | "status" | "result" | "approvalId" | "decidedBy" | "actor.key" | "actor.kind" | "actor.agent" | "actor.door" | "actor.job" | "actor.userId" | "actor.clientId" | `result.${string}`>, {
|
|
555
631
|
by_actor_request: ["actor.key", "requestId", "_creationTime"];
|
|
556
632
|
by_user: ["actor.userId", "_creationTime"];
|
|
557
633
|
by_tenant: ["tenantId", "_creationTime"];
|
|
558
634
|
}, {}, {}>;
|
|
559
635
|
/** An agent asked for an action its rules hold for a person. */
|
|
560
636
|
approvals: TableDefinition<VObject<{
|
|
561
|
-
followUp?: string | undefined;
|
|
562
637
|
tenantId?: string | undefined;
|
|
563
638
|
requestId?: string | undefined;
|
|
564
639
|
result?: any;
|
|
@@ -570,16 +645,28 @@ declare const libraryTables: {
|
|
|
570
645
|
hash: string;
|
|
571
646
|
}[] | undefined;
|
|
572
647
|
decidedAt?: number | undefined;
|
|
648
|
+
followUp?: string | undefined;
|
|
573
649
|
error?: {
|
|
574
650
|
code: string;
|
|
575
651
|
message: string;
|
|
576
652
|
} | undefined;
|
|
577
|
-
|
|
653
|
+
action: string;
|
|
654
|
+
tool: string;
|
|
655
|
+
status: "approved" | "declined" | "failed" | "pending" | "executing" | "expired" | "cancelled";
|
|
656
|
+
requester: {
|
|
657
|
+
agent?: string | undefined;
|
|
658
|
+
job?: string | undefined;
|
|
659
|
+
userId?: string | undefined;
|
|
660
|
+
clientId?: string | undefined;
|
|
661
|
+
key: string;
|
|
662
|
+
kind: "person" | "agent" | "system";
|
|
663
|
+
door: "web" | "mcp" | "app" | "job";
|
|
664
|
+
};
|
|
578
665
|
caller: {
|
|
579
666
|
door: "mcp";
|
|
580
667
|
principal: {
|
|
581
|
-
userId: string;
|
|
582
668
|
kind: "oauth";
|
|
669
|
+
userId: string;
|
|
583
670
|
clientId: string;
|
|
584
671
|
scopes: string[];
|
|
585
672
|
sessionId: string;
|
|
@@ -593,20 +680,9 @@ declare const libraryTables: {
|
|
|
593
680
|
door: "app";
|
|
594
681
|
runId: string;
|
|
595
682
|
};
|
|
596
|
-
action: string;
|
|
597
|
-
tool: string;
|
|
598
|
-
status: "approved" | "declined" | "failed" | "pending" | "executing" | "expired" | "cancelled";
|
|
599
|
-
requester: {
|
|
600
|
-
userId?: string | undefined;
|
|
601
|
-
clientId?: string | undefined;
|
|
602
|
-
agent?: string | undefined;
|
|
603
|
-
job?: string | undefined;
|
|
604
|
-
kind: "person" | "agent" | "system";
|
|
605
|
-
key: string;
|
|
606
|
-
door: "mcp" | "app" | "job" | "web";
|
|
607
|
-
};
|
|
608
683
|
input: any;
|
|
609
684
|
summary: string;
|
|
685
|
+
expiresAt: number;
|
|
610
686
|
}, {
|
|
611
687
|
action: convex_values.VString<string, "required">;
|
|
612
688
|
tool: convex_values.VString<string, "required">;
|
|
@@ -614,27 +690,27 @@ declare const libraryTables: {
|
|
|
614
690
|
/** One line a person reads before deciding. */
|
|
615
691
|
summary: convex_values.VString<string, "required">;
|
|
616
692
|
requester: VObject<{
|
|
617
|
-
userId?: string | undefined;
|
|
618
|
-
clientId?: string | undefined;
|
|
619
693
|
agent?: string | undefined;
|
|
620
694
|
job?: string | undefined;
|
|
621
|
-
|
|
695
|
+
userId?: string | undefined;
|
|
696
|
+
clientId?: string | undefined;
|
|
622
697
|
key: string;
|
|
623
|
-
|
|
698
|
+
kind: "person" | "agent" | "system";
|
|
699
|
+
door: "web" | "mcp" | "app" | "job";
|
|
624
700
|
}, {
|
|
625
701
|
key: convex_values.VString<string, "required">;
|
|
626
702
|
kind: convex_values.VUnion<"person" | "agent" | "system", [convex_values.VLiteral<"person", "required">, convex_values.VLiteral<"agent", "required">, convex_values.VLiteral<"system", "required">], "required", never>;
|
|
627
|
-
door: convex_values.VUnion<"
|
|
703
|
+
door: convex_values.VUnion<"web" | "mcp" | "app" | "job", [convex_values.VLiteral<"web", "required">, convex_values.VLiteral<"mcp", "required">, convex_values.VLiteral<"app", "required">, convex_values.VLiteral<"job", "required">], "required", never>;
|
|
628
704
|
userId: convex_values.VString<string | undefined, "optional">;
|
|
629
705
|
clientId: convex_values.VString<string | undefined, "optional">;
|
|
630
706
|
agent: convex_values.VString<string | undefined, "optional">;
|
|
631
707
|
job: convex_values.VString<string | undefined, "optional">;
|
|
632
|
-
}, "required", "
|
|
708
|
+
}, "required", "key" | "kind" | "agent" | "door" | "job" | "userId" | "clientId">;
|
|
633
709
|
caller: convex_values.VUnion<{
|
|
634
710
|
door: "mcp";
|
|
635
711
|
principal: {
|
|
636
|
-
userId: string;
|
|
637
712
|
kind: "oauth";
|
|
713
|
+
userId: string;
|
|
638
714
|
clientId: string;
|
|
639
715
|
scopes: string[];
|
|
640
716
|
sessionId: string;
|
|
@@ -650,8 +726,8 @@ declare const libraryTables: {
|
|
|
650
726
|
}, [VObject<{
|
|
651
727
|
door: "mcp";
|
|
652
728
|
principal: {
|
|
653
|
-
userId: string;
|
|
654
729
|
kind: "oauth";
|
|
730
|
+
userId: string;
|
|
655
731
|
clientId: string;
|
|
656
732
|
scopes: string[];
|
|
657
733
|
sessionId: string;
|
|
@@ -663,8 +739,8 @@ declare const libraryTables: {
|
|
|
663
739
|
}, {
|
|
664
740
|
door: convex_values.VLiteral<"mcp", "required">;
|
|
665
741
|
principal: VObject<{
|
|
666
|
-
userId: string;
|
|
667
742
|
kind: "oauth";
|
|
743
|
+
userId: string;
|
|
668
744
|
clientId: string;
|
|
669
745
|
scopes: string[];
|
|
670
746
|
sessionId: string;
|
|
@@ -682,8 +758,8 @@ declare const libraryTables: {
|
|
|
682
758
|
issuer: convex_values.VString<string, "required">;
|
|
683
759
|
resource: convex_values.VString<string, "required">;
|
|
684
760
|
expiresAt: convex_values.VFloat64<number, "required">;
|
|
685
|
-
}, "required", "
|
|
686
|
-
}, "required", "door" | "principal" | "principal.
|
|
761
|
+
}, "required", "kind" | "userId" | "clientId" | "scopes" | "sessionId" | "grantId" | "issuer" | "resource" | "expiresAt">;
|
|
762
|
+
}, "required", "door" | "principal" | "principal.kind" | "principal.userId" | "principal.clientId" | "principal.scopes" | "principal.sessionId" | "principal.grantId" | "principal.issuer" | "principal.resource" | "principal.expiresAt">, VObject<{
|
|
687
763
|
turn?: number | undefined;
|
|
688
764
|
door: "app";
|
|
689
765
|
runId: string;
|
|
@@ -691,7 +767,7 @@ declare const libraryTables: {
|
|
|
691
767
|
door: convex_values.VLiteral<"app", "required">;
|
|
692
768
|
runId: convex_values.VString<string, "required">;
|
|
693
769
|
turn: convex_values.VFloat64<number | undefined, "optional">;
|
|
694
|
-
}, "required", "door" | "runId" | "turn">], "required", "door" | "principal" | "principal.
|
|
770
|
+
}, "required", "door" | "runId" | "turn">], "required", "door" | "principal" | "principal.kind" | "principal.userId" | "principal.clientId" | "principal.scopes" | "principal.sessionId" | "principal.grantId" | "principal.issuer" | "principal.resource" | "principal.expiresAt" | "runId" | "turn">;
|
|
695
771
|
/** The call's tenant, so teammates with an approver role can decide. */
|
|
696
772
|
tenantId: convex_values.VString<string | undefined, "optional">;
|
|
697
773
|
/** The agent's retry key, so a retry after the decision replays the outcome. */
|
|
@@ -726,7 +802,7 @@ declare const libraryTables: {
|
|
|
726
802
|
code: convex_values.VString<string, "required">;
|
|
727
803
|
message: convex_values.VString<string, "required">;
|
|
728
804
|
}, "optional", "code" | "message">;
|
|
729
|
-
}, "required", "
|
|
805
|
+
}, "required", "action" | "tool" | "tenantId" | "requestId" | "status" | "result" | "decidedBy" | `result.${string}` | "requester" | "caller" | "input" | "summary" | "expiresAt" | "callHash" | "plan" | "seen" | "decidedAt" | "followUp" | "error" | "requester.key" | "requester.kind" | "requester.agent" | "requester.door" | "requester.job" | "requester.userId" | "requester.clientId" | "caller.door" | "caller.principal" | "caller.principal.kind" | "caller.principal.userId" | "caller.principal.clientId" | "caller.principal.scopes" | "caller.principal.sessionId" | "caller.principal.grantId" | "caller.principal.issuer" | "caller.principal.resource" | "caller.principal.expiresAt" | "caller.runId" | "caller.turn" | `input.${string}` | `plan.${string}` | "error.code" | "error.message">, {
|
|
730
806
|
by_user_status: ["requester.userId", "status", "expiresAt", "_creationTime"];
|
|
731
807
|
by_requester_status: ["requester.key", "status", "expiresAt", "_creationTime"];
|
|
732
808
|
by_requester_request: ["requester.key", "requestId", "_creationTime"];
|
|
@@ -741,14 +817,14 @@ declare const libraryTables: {
|
|
|
741
817
|
* decide the request too. Written with the request, deleted with it.
|
|
742
818
|
*/
|
|
743
819
|
approvalParties: TableDefinition<VObject<{
|
|
744
|
-
expiresAt: number;
|
|
745
|
-
approvalId: convex_values.GenericId<"approvals">;
|
|
746
820
|
tenantId: string;
|
|
821
|
+
approvalId: convex_values.GenericId<"approvals">;
|
|
822
|
+
expiresAt: number;
|
|
747
823
|
}, {
|
|
748
824
|
approvalId: convex_values.VId<convex_values.GenericId<"approvals">, "required">;
|
|
749
825
|
tenantId: convex_values.VString<string, "required">;
|
|
750
826
|
expiresAt: convex_values.VFloat64<number, "required">;
|
|
751
|
-
}, "required", "
|
|
827
|
+
}, "required", "tenantId" | "approvalId" | "expiresAt">, {
|
|
752
828
|
by_tenant: ["tenantId", "expiresAt", "_creationTime"];
|
|
753
829
|
by_approval: ["approvalId", "_creationTime"];
|
|
754
830
|
}, {}, {}>;
|
|
@@ -765,11 +841,11 @@ declare const libraryTables: {
|
|
|
765
841
|
/** A person turned on one of the app's own agents. It acts for them until it expires or they turn it off. */
|
|
766
842
|
agentGrants: TableDefinition<VObject<{
|
|
767
843
|
revokedAt?: number | undefined;
|
|
844
|
+
agent: string;
|
|
768
845
|
userId: string;
|
|
769
846
|
scopes: string[];
|
|
770
847
|
expiresAt: number;
|
|
771
848
|
authId: string;
|
|
772
|
-
agent: string;
|
|
773
849
|
}, {
|
|
774
850
|
authId: convex_values.VString<string, "required">;
|
|
775
851
|
userId: convex_values.VString<string, "required">;
|
|
@@ -777,7 +853,7 @@ declare const libraryTables: {
|
|
|
777
853
|
scopes: convex_values.VArray<string[], convex_values.VString<string, "required">, "required">;
|
|
778
854
|
expiresAt: convex_values.VFloat64<number, "required">;
|
|
779
855
|
revokedAt: convex_values.VFloat64<number | undefined, "optional">;
|
|
780
|
-
}, "required", "
|
|
856
|
+
}, "required", "agent" | "userId" | "scopes" | "expiresAt" | "authId" | "revokedAt">, {
|
|
781
857
|
by_user_agent: ["userId", "agent", "_creationTime"];
|
|
782
858
|
}, {}, {}>;
|
|
783
859
|
/** One run of an in-app agent and where it stands. Its conversation is in `agentMessages`. */
|
|
@@ -789,11 +865,11 @@ declare const libraryTables: {
|
|
|
789
865
|
claimed?: number | undefined;
|
|
790
866
|
approvalIds?: convex_values.GenericId<"approvals">[] | undefined;
|
|
791
867
|
answer?: string | undefined;
|
|
868
|
+
agent: string;
|
|
792
869
|
userId: string;
|
|
870
|
+
status: "done" | "failed" | "running" | "waiting";
|
|
793
871
|
grantId: convex_values.GenericId<"agentGrants">;
|
|
794
872
|
turn: number;
|
|
795
|
-
agent: string;
|
|
796
|
-
status: "done" | "failed" | "running" | "waiting";
|
|
797
873
|
step: string;
|
|
798
874
|
task: string;
|
|
799
875
|
steps: number;
|
|
@@ -824,7 +900,7 @@ declare const libraryTables: {
|
|
|
824
900
|
code: convex_values.VString<string, "required">;
|
|
825
901
|
message: convex_values.VString<string, "required">;
|
|
826
902
|
}, "optional", "code" | "message">;
|
|
827
|
-
}, "required", "
|
|
903
|
+
}, "required", "agent" | "userId" | "status" | "grantId" | "turn" | "error" | "error.code" | "error.message" | "step" | "task" | "claimed" | "steps" | "stepAt" | "approvalIds" | "answer">, {
|
|
828
904
|
by_user_agent: ["userId", "agent", "_creationTime"];
|
|
829
905
|
by_user_agent_status: ["userId", "agent", "status", "_creationTime"];
|
|
830
906
|
by_status: ["status", "stepAt", "_creationTime"];
|
|
@@ -869,16 +945,16 @@ declare const libraryTables: {
|
|
|
869
945
|
storageId?: convex_values.GenericId<"_storage"> | undefined;
|
|
870
946
|
size?: number | undefined;
|
|
871
947
|
sha256?: string | undefined;
|
|
872
|
-
expiresAt: number;
|
|
873
948
|
status: "claimed" | "open" | "stored";
|
|
949
|
+
expiresAt: number;
|
|
874
950
|
owner: {
|
|
875
|
-
userId?: string | undefined;
|
|
876
|
-
clientId?: string | undefined;
|
|
877
951
|
agent?: string | undefined;
|
|
878
952
|
job?: string | undefined;
|
|
879
|
-
|
|
953
|
+
userId?: string | undefined;
|
|
954
|
+
clientId?: string | undefined;
|
|
880
955
|
key: string;
|
|
881
|
-
|
|
956
|
+
kind: "person" | "agent" | "system";
|
|
957
|
+
door: "web" | "mcp" | "app" | "job";
|
|
882
958
|
};
|
|
883
959
|
tokenHash: string;
|
|
884
960
|
maxBytes: number;
|
|
@@ -888,22 +964,22 @@ declare const libraryTables: {
|
|
|
888
964
|
tokenHash: convex_values.VString<string, "required">;
|
|
889
965
|
/** Who asked for the link. Only this actor can claim the file. */
|
|
890
966
|
owner: VObject<{
|
|
891
|
-
userId?: string | undefined;
|
|
892
|
-
clientId?: string | undefined;
|
|
893
967
|
agent?: string | undefined;
|
|
894
968
|
job?: string | undefined;
|
|
895
|
-
|
|
969
|
+
userId?: string | undefined;
|
|
970
|
+
clientId?: string | undefined;
|
|
896
971
|
key: string;
|
|
897
|
-
|
|
972
|
+
kind: "person" | "agent" | "system";
|
|
973
|
+
door: "web" | "mcp" | "app" | "job";
|
|
898
974
|
}, {
|
|
899
975
|
key: convex_values.VString<string, "required">;
|
|
900
976
|
kind: convex_values.VUnion<"person" | "agent" | "system", [convex_values.VLiteral<"person", "required">, convex_values.VLiteral<"agent", "required">, convex_values.VLiteral<"system", "required">], "required", never>;
|
|
901
|
-
door: convex_values.VUnion<"
|
|
977
|
+
door: convex_values.VUnion<"web" | "mcp" | "app" | "job", [convex_values.VLiteral<"web", "required">, convex_values.VLiteral<"mcp", "required">, convex_values.VLiteral<"app", "required">, convex_values.VLiteral<"job", "required">], "required", never>;
|
|
902
978
|
userId: convex_values.VString<string | undefined, "optional">;
|
|
903
979
|
clientId: convex_values.VString<string | undefined, "optional">;
|
|
904
980
|
agent: convex_values.VString<string | undefined, "optional">;
|
|
905
981
|
job: convex_values.VString<string | undefined, "optional">;
|
|
906
|
-
}, "required", "
|
|
982
|
+
}, "required", "key" | "kind" | "agent" | "door" | "job" | "userId" | "clientId">;
|
|
907
983
|
status: convex_values.VUnion<"claimed" | "open" | "stored", [convex_values.VLiteral<"open", "required">, convex_values.VLiteral<"stored", "required">, convex_values.VLiteral<"claimed", "required">], "required", never>;
|
|
908
984
|
expiresAt: convex_values.VFloat64<number, "required">;
|
|
909
985
|
/** Limits the link was issued with, checked when the bytes arrive. */
|
|
@@ -914,7 +990,7 @@ declare const libraryTables: {
|
|
|
914
990
|
type: convex_values.VString<string | undefined, "optional">;
|
|
915
991
|
size: convex_values.VFloat64<number | undefined, "optional">;
|
|
916
992
|
sha256: convex_values.VString<string | undefined, "optional">;
|
|
917
|
-
}, "required", "type" | "
|
|
993
|
+
}, "required", "type" | "status" | "expiresAt" | "owner" | "tokenHash" | "maxBytes" | "types" | "storageId" | "size" | "sha256" | "owner.key" | "owner.kind" | "owner.agent" | "owner.door" | "owner.job" | "owner.userId" | "owner.clientId">, {
|
|
918
994
|
by_token: ["tokenHash", "_creationTime"];
|
|
919
995
|
by_owner_status_expires: ["owner.key", "status", "expiresAt", "_creationTime"];
|
|
920
996
|
by_status_expires: ["status", "expiresAt", "_creationTime"];
|
|
@@ -927,42 +1003,42 @@ declare const libraryTables: {
|
|
|
927
1003
|
auditLog: TableDefinition<VObject<{
|
|
928
1004
|
tenantId?: string | undefined;
|
|
929
1005
|
actor: {
|
|
930
|
-
userId?: string | undefined;
|
|
931
|
-
clientId?: string | undefined;
|
|
932
1006
|
agent?: string | undefined;
|
|
933
1007
|
job?: string | undefined;
|
|
934
|
-
|
|
1008
|
+
userId?: string | undefined;
|
|
1009
|
+
clientId?: string | undefined;
|
|
935
1010
|
key: string;
|
|
936
|
-
|
|
1011
|
+
kind: "person" | "agent" | "system";
|
|
1012
|
+
door: "web" | "mcp" | "app" | "job";
|
|
937
1013
|
};
|
|
938
1014
|
action: string;
|
|
939
1015
|
rows: string[];
|
|
940
1016
|
more: number;
|
|
941
1017
|
}, {
|
|
942
1018
|
actor: VObject<{
|
|
943
|
-
userId?: string | undefined;
|
|
944
|
-
clientId?: string | undefined;
|
|
945
1019
|
agent?: string | undefined;
|
|
946
1020
|
job?: string | undefined;
|
|
947
|
-
|
|
1021
|
+
userId?: string | undefined;
|
|
1022
|
+
clientId?: string | undefined;
|
|
948
1023
|
key: string;
|
|
949
|
-
|
|
1024
|
+
kind: "person" | "agent" | "system";
|
|
1025
|
+
door: "web" | "mcp" | "app" | "job";
|
|
950
1026
|
}, {
|
|
951
1027
|
key: convex_values.VString<string, "required">;
|
|
952
1028
|
kind: convex_values.VUnion<"person" | "agent" | "system", [convex_values.VLiteral<"person", "required">, convex_values.VLiteral<"agent", "required">, convex_values.VLiteral<"system", "required">], "required", never>;
|
|
953
|
-
door: convex_values.VUnion<"
|
|
1029
|
+
door: convex_values.VUnion<"web" | "mcp" | "app" | "job", [convex_values.VLiteral<"web", "required">, convex_values.VLiteral<"mcp", "required">, convex_values.VLiteral<"app", "required">, convex_values.VLiteral<"job", "required">], "required", never>;
|
|
954
1030
|
userId: convex_values.VString<string | undefined, "optional">;
|
|
955
1031
|
clientId: convex_values.VString<string | undefined, "optional">;
|
|
956
1032
|
agent: convex_values.VString<string | undefined, "optional">;
|
|
957
1033
|
job: convex_values.VString<string | undefined, "optional">;
|
|
958
|
-
}, "required", "
|
|
1034
|
+
}, "required", "key" | "kind" | "agent" | "door" | "job" | "userId" | "clientId">;
|
|
959
1035
|
action: convex_values.VString<string, "required">;
|
|
960
1036
|
tenantId: convex_values.VString<string | undefined, "optional">;
|
|
961
1037
|
/** Ids the call inserted, changed or deleted: the first 50. */
|
|
962
1038
|
rows: convex_values.VArray<string[], convex_values.VString<string, "required">, "required">;
|
|
963
1039
|
/** How many more ids there were beyond `rows`. */
|
|
964
1040
|
more: convex_values.VFloat64<number, "required">;
|
|
965
|
-
}, "required", "actor" | "action" | "tenantId" | "actor.
|
|
1041
|
+
}, "required", "actor" | "action" | "tenantId" | "actor.key" | "actor.kind" | "actor.agent" | "actor.door" | "actor.job" | "actor.userId" | "actor.clientId" | "rows" | "more">, {
|
|
966
1042
|
by_tenant: ["tenantId", "_creationTime"];
|
|
967
1043
|
by_user: ["actor.userId", "_creationTime"];
|
|
968
1044
|
}, {}, {}>;
|
|
@@ -1108,6 +1184,12 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1108
1184
|
erasure?: Erasure;
|
|
1109
1185
|
/** The app schema (`import schema from './schema'`). Required with `erasure`, which checks its map against it. */
|
|
1110
1186
|
schema?: SchemaDefinition<any, boolean>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Write one JSON line on the console for each call: who did which action, in which tenant,
|
|
1189
|
+
* with which result and code, and how many rows it wrote. Queries write one only when they
|
|
1190
|
+
* fail. A Convex log stream sends the lines to your log service. Off by default.
|
|
1191
|
+
*/
|
|
1192
|
+
observe?: boolean;
|
|
1111
1193
|
}): {
|
|
1112
1194
|
/** The policy every operation here checks. */
|
|
1113
1195
|
policy: P;
|
|
@@ -1133,6 +1215,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1133
1215
|
operation: typeof operationMark;
|
|
1134
1216
|
result: infer O;
|
|
1135
1217
|
} ? O : FunctionReturnType<F>>;
|
|
1218
|
+
} & {
|
|
1219
|
+
log: CallLog;
|
|
1136
1220
|
} & {
|
|
1137
1221
|
actor: A extends PublicActionOf<P> ? Visitor | Actor<User> : Actor<User>;
|
|
1138
1222
|
}, args: convex_server.Expand<{ [Property_1 in { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]]?: Exclude<Infer<Args[Property_1]>, undefined> | undefined; } & { [Property_2 in Exclude<keyof Args, { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]>]: Infer<Args[Property_2]>; }>) => Infer<Returns> | Promise<Infer<Returns>>;
|
|
@@ -1197,6 +1281,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1197
1281
|
} ? I : F["_args"]]) => Promise<GenericId<"_scheduled_functions">>;
|
|
1198
1282
|
cancel: (id: GenericId<"_scheduled_functions">) => Promise<void>;
|
|
1199
1283
|
};
|
|
1284
|
+
} & {
|
|
1285
|
+
log: CallLog;
|
|
1200
1286
|
} & {
|
|
1201
1287
|
actor: A extends PublicActionOf<P> ? Visitor | Actor<User> : Actor<User>;
|
|
1202
1288
|
}, args: convex_server.Expand<{ [Property_1 in { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]]?: Exclude<Infer<Args[Property_1]>, undefined> | undefined; } & { [Property_2 in Exclude<keyof Args, { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]>]: Infer<Args[Property_2]>; }>) => Infer<Returns> | Promise<Infer<Returns>>;
|
|
@@ -1223,6 +1309,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1223
1309
|
operation: typeof operationMark;
|
|
1224
1310
|
result: infer O;
|
|
1225
1311
|
} ? O : FunctionReturnType<F>>;
|
|
1312
|
+
} & {
|
|
1313
|
+
log: CallLog;
|
|
1226
1314
|
}, "runQuery"> & {
|
|
1227
1315
|
actor: A extends PublicActionOf<P> ? Visitor | Actor<User> : Actor<User>;
|
|
1228
1316
|
}, args: Readonly<ObjectType<Args>>) => Pl | Promise<Pl>;
|
|
@@ -1278,6 +1366,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1278
1366
|
} ? I : F["_args"]]) => Promise<GenericId<"_scheduled_functions">>;
|
|
1279
1367
|
cancel: (id: GenericId<"_scheduled_functions">) => Promise<void>;
|
|
1280
1368
|
};
|
|
1369
|
+
} & {
|
|
1370
|
+
log: CallLog;
|
|
1281
1371
|
}) & {
|
|
1282
1372
|
actor: A extends PublicActionOf<P> ? Visitor | Actor<User> : Actor<User>;
|
|
1283
1373
|
}, args: ObjectType<Args>, plan: Readonly<Pl>) => Promise<Infer<Returns>> | Infer<Returns>;
|
|
@@ -1300,6 +1390,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1300
1390
|
operation: typeof operationMark;
|
|
1301
1391
|
result: infer O;
|
|
1302
1392
|
} ? O : FunctionReturnType<F>>;
|
|
1393
|
+
} & {
|
|
1394
|
+
log: CallLog;
|
|
1303
1395
|
} & {
|
|
1304
1396
|
actor: Actor<User> | Visitor | SystemActor;
|
|
1305
1397
|
}, args: convex_server.Expand<{ [Property_1 in { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]]?: Exclude<Infer<Args[Property_1]>, undefined> | undefined; } & { [Property_2 in Exclude<keyof Args, { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]>]: Infer<Args[Property_2]>; }>) => Infer<Returns> | Promise<Infer<Returns>>;
|
|
@@ -1360,6 +1452,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1360
1452
|
} ? I : F["_args"]]) => Promise<GenericId<"_scheduled_functions">>;
|
|
1361
1453
|
cancel: (id: GenericId<"_scheduled_functions">) => Promise<void>;
|
|
1362
1454
|
};
|
|
1455
|
+
} & {
|
|
1456
|
+
log: CallLog;
|
|
1363
1457
|
} & {
|
|
1364
1458
|
actor: Actor<User> | Visitor | SystemActor;
|
|
1365
1459
|
}, args: convex_server.Expand<{ [Property_1 in { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]]?: Exclude<Infer<Args[Property_1]>, undefined> | undefined; } & { [Property_2 in Exclude<keyof Args, { [Property in keyof Args]: Args[Property]["isOptional"] extends "optional" ? Property : never; }[keyof Args]>]: Infer<Args[Property_2]>; }>) => Infer<Returns> | Promise<Infer<Returns>>;
|
|
@@ -1433,6 +1527,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1433
1527
|
} ? I : F["_args"]]) => Promise<GenericId<"_scheduled_functions">>;
|
|
1434
1528
|
cancel: (id: GenericId<"_scheduled_functions">) => Promise<void>;
|
|
1435
1529
|
};
|
|
1530
|
+
} & {
|
|
1531
|
+
log: CallLog;
|
|
1436
1532
|
}) & {
|
|
1437
1533
|
actor: ActingAs;
|
|
1438
1534
|
}, args: ObjectType<Args>) => Promise<Infer<Returns>>;
|
|
@@ -1492,6 +1588,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1492
1588
|
} ? I : F["_args"]]) => Promise<GenericId<"_scheduled_functions">>;
|
|
1493
1589
|
cancel: (id: GenericId<"_scheduled_functions">) => Promise<void>;
|
|
1494
1590
|
};
|
|
1591
|
+
} & {
|
|
1592
|
+
log: CallLog;
|
|
1495
1593
|
}) & {
|
|
1496
1594
|
actor: SystemActor;
|
|
1497
1595
|
}, args: ObjectType<Args>) => Promise<Value | void>;
|
|
@@ -1571,6 +1669,8 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1571
1669
|
} ? I : F["_args"]]) => Promise<GenericId<"_scheduled_functions">>;
|
|
1572
1670
|
cancel: (id: GenericId<"_scheduled_functions">) => Promise<void>;
|
|
1573
1671
|
};
|
|
1672
|
+
} & {
|
|
1673
|
+
log: CallLog;
|
|
1574
1674
|
}) & {
|
|
1575
1675
|
actor: A extends PublicActionOf<P> ? Visitor | Actor<User> : Actor<User>;
|
|
1576
1676
|
}, args: ObjectType<Args>) => Promise<Infer<Returns>>;
|
|
@@ -1583,6 +1683,7 @@ declare function defineFunctions<DM extends GenericDataModel, P extends Policy,
|
|
|
1583
1683
|
checked: typeof actionCheckMark;
|
|
1584
1684
|
actor: unknown;
|
|
1585
1685
|
paid: string[];
|
|
1686
|
+
tenant?: string;
|
|
1586
1687
|
}>>;
|
|
1587
1688
|
} & (Erasure extends undefined ? unknown : {
|
|
1588
1689
|
erasure: {
|
|
@@ -1622,13 +1723,13 @@ declare function auditTrail(ctx: {
|
|
|
1622
1723
|
_creationTime: number;
|
|
1623
1724
|
tenantId?: string | undefined;
|
|
1624
1725
|
actor: {
|
|
1625
|
-
userId?: string | undefined;
|
|
1626
|
-
clientId?: string | undefined;
|
|
1627
1726
|
agent?: string | undefined;
|
|
1628
1727
|
job?: string | undefined;
|
|
1629
|
-
|
|
1728
|
+
userId?: string | undefined;
|
|
1729
|
+
clientId?: string | undefined;
|
|
1630
1730
|
key: string;
|
|
1631
|
-
|
|
1731
|
+
kind: "person" | "agent" | "system";
|
|
1732
|
+
door: "web" | "mcp" | "app" | "job";
|
|
1632
1733
|
};
|
|
1633
1734
|
action: string;
|
|
1634
1735
|
rows: string[];
|
|
@@ -1674,5 +1775,5 @@ declare function unguardedFunctions(modules: Record<string, () => Promise<unknow
|
|
|
1674
1775
|
trustedRoutes?: Record<string, string>;
|
|
1675
1776
|
}): Promise<string[]>;
|
|
1676
1777
|
|
|
1677
|
-
export {
|
|
1678
|
-
export type { AgentCaller as A, ErrorCode as E, JobDone as J, LibraryDataModel as L, Plan as P, Rule as R,
|
|
1778
|
+
export { defineFunctions as B, docValidator as D, eraseUser as G, fail as H, libraryTables as I, owner as K, publicRead as M, tenant as N, OPERATION as O, trusted as Q, unchecked as U, actorRecord as b, agentCallerValidator as c, markTools as d, failureOf as f, guarded as g, handedFields as h, internalsOf as i, markHousekeeping as m, newSeen as n, planOf as p, readOnly as r, sawActor as s, tookFields as t, unguardedFunctions as u, allOf as w, anyOf as x, auditTrail as y, custom as z };
|
|
1779
|
+
export type { AgentCaller as A, CallLog as C, ErrorCode as E, FailureHelp as F, JobDone as J, LibraryDataModel as L, Plan as P, Rule as R, Seen as S, ToolSpec as T, Visitor as V, Operation as a, Actor as e, Auth as j, LogValue as k, RuleCtx as l, SystemActor as o, TenantOf as q, TenantRef as v };
|