cvx-kit 0.1.8 → 0.1.11
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/CHANGELOG.md +32 -0
- package/README.md +28 -28
- package/dist/agent-tools.d.mts +5 -5
- package/dist/agent-tools.mjs.map +1 -1
- package/dist/auth.d.mts +39 -289
- package/dist/auth.mjs.map +1 -1
- package/dist/components/approvals/_generated/api.d.mts +3 -4
- package/dist/components/approvals/_generated/api.mjs.map +1 -1
- package/dist/components/approvals/_generated/component.d.mts +1 -2
- package/dist/components/approvals/_generated/dataModel.d.mts +4 -5
- package/dist/components/approvals/_generated/server.d.mts +12 -13
- package/dist/components/approvals/_generated/server.mjs.map +1 -1
- package/dist/components/approvals/audit.d.mts +8 -8
- package/dist/components/approvals/audit.mjs +1 -1
- package/dist/components/approvals/audit.mjs.map +1 -1
- package/dist/components/approvals/client.d.mts +10 -10
- package/dist/components/approvals/client.mjs.map +1 -1
- package/dist/components/approvals/constants.d.mts +30 -30
- package/dist/components/approvals/constants.mjs.map +1 -1
- package/dist/components/approvals/convex.config.mjs.map +1 -1
- package/dist/components/approvals/decisions.d.mts +6 -6
- package/dist/components/approvals/decisions.mjs.map +1 -1
- package/dist/components/approvals/functions.d.mts +3 -3
- package/dist/components/approvals/functions.mjs.map +1 -1
- package/dist/components/approvals/health.d.mts +2 -2
- package/dist/components/approvals/health.mjs.map +1 -1
- package/dist/components/approvals/requests.d.mts +8 -8
- package/dist/components/approvals/requests.mjs.map +1 -1
- package/dist/components/approvals/validators.d.mts +29 -29
- package/dist/components/approvals/validators.mjs +1 -1
- package/dist/components/approvals/validators.mjs.map +1 -1
- package/dist/components/approvals/workflow.d.mts +3 -3
- package/dist/components/approvals/workflow.mjs.map +1 -1
- package/dist/components/approvals/workflow_steps.d.mts +15 -15
- package/dist/components/approvals/workflow_steps.mjs.map +1 -1
- package/dist/components/foundation/_generated/api.d.mts +3 -4
- package/dist/components/foundation/_generated/api.mjs.map +1 -1
- package/dist/components/foundation/_generated/component.d.mts +1 -2
- package/dist/components/foundation/_generated/dataModel.d.mts +4 -5
- package/dist/components/foundation/_generated/server.d.mts +12 -13
- package/dist/components/foundation/_generated/server.mjs.map +1 -1
- package/dist/components/foundation/client.d.mts +13 -13
- package/dist/components/foundation/client.mjs.map +1 -1
- package/dist/components/foundation/convex.config.mjs.map +1 -1
- package/dist/components/foundation/functions.d.mts +2 -2
- package/dist/components/foundation/functions.mjs.map +1 -1
- package/dist/components/foundation/modules/command/command.d.mts +14 -14
- package/dist/components/foundation/modules/command/command.mjs.map +1 -1
- package/dist/components/foundation/modules/command/lifecycle.d.mts +12 -13
- package/dist/components/foundation/modules/command/lifecycle.mjs.map +1 -1
- package/dist/components/foundation/modules/observability/observability.d.mts +4 -4
- package/dist/components/foundation/modules/observability/observability.mjs.map +1 -1
- package/dist/components/foundation/modules/query/query.d.mts +5 -5
- package/dist/components/foundation/modules/query/query.mjs.map +1 -1
- package/dist/components/foundation/operation.d.mts +5 -6
- package/dist/components/foundation/operation.mjs.map +1 -1
- package/dist/components/foundation/result.d.mts +6 -6
- package/dist/components/foundation/result.mjs.map +1 -1
- package/dist/components/foundation/telemetry.d.mts +2 -2
- package/dist/components/foundation/telemetry.mjs.map +1 -1
- package/dist/crud.d.mts +6 -5
- package/dist/crud.mjs.map +1 -1
- package/dist/effect.d.mts +3 -2
- package/dist/effect.mjs +1 -1
- package/dist/errors.d.mts +4 -4
- package/dist/errors.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/middleware.d.mts +2 -3
- package/dist/middleware.mjs.map +1 -1
- package/dist/modules/contracts/contract.d.mts +12 -13
- package/dist/modules/contracts/contract.mjs.map +1 -1
- package/dist/modules/contracts/convex.d.mts +3 -5
- package/dist/modules/contracts/convex.mjs.map +1 -1
- package/dist/modules/contracts/errors.d.mts +8 -9
- package/dist/modules/contracts/errors.mjs +1 -1
- package/dist/modules/contracts/errors.mjs.map +1 -1
- package/dist/modules/contracts/exposure.d.mts +13 -14
- package/dist/modules/contracts/exposure.mjs +1 -1
- package/dist/modules/contracts/exposure.mjs.map +1 -1
- package/dist/modules/contracts/idempotency.d.mts +15 -16
- package/dist/modules/contracts/idempotency.mjs +1 -1
- package/dist/modules/contracts/idempotency.mjs.map +1 -1
- package/dist/modules/contracts/standard.d.mts +2 -3
- package/dist/modules/contracts/standard.mjs.map +1 -1
- package/dist/modules/contracts/workflow.d.mts +26 -27
- package/dist/modules/contracts/workflow.mjs.map +1 -1
- package/dist/modules/effect/api-runtime.d.mts +10 -11
- package/dist/modules/effect/api-runtime.mjs +1 -1
- package/dist/modules/effect/api-runtime.mjs.map +1 -1
- package/dist/modules/effect/api-zod.d.mts +2 -3
- package/dist/modules/effect/api-zod.mjs.map +1 -1
- package/dist/modules/effect/api.d.mts +4 -5
- package/dist/modules/effect/api.mjs.map +1 -1
- package/dist/modules/effect/auth.d.mts +43 -0
- package/dist/modules/effect/auth.mjs +2 -0
- package/dist/modules/effect/auth.mjs.map +1 -0
- package/dist/modules/effect/client.d.mts +1 -1
- package/dist/modules/effect/client.mjs +1 -1
- package/dist/modules/effect/command.d.mts +4 -5
- package/dist/modules/effect/command.mjs +1 -1
- package/dist/modules/effect/command.mjs.map +1 -1
- package/dist/modules/effect/crud.d.mts +7 -8
- package/dist/modules/effect/crud.mjs +1 -1
- package/dist/modules/effect/crud.mjs.map +1 -1
- package/dist/modules/effect/errors.d.mts +1 -2
- package/dist/modules/effect/errors.mjs.map +1 -1
- package/dist/modules/effect/foundation.d.mts +3 -4
- package/dist/modules/effect/foundation.mjs.map +1 -1
- package/dist/modules/effect/idempotency.d.mts +2 -3
- package/dist/modules/effect/idempotency.mjs.map +1 -1
- package/dist/modules/effect/normalize.d.mts +2 -3
- package/dist/modules/effect/normalize.mjs.map +1 -1
- package/dist/modules/effect/operation.d.mts +17 -18
- package/dist/modules/effect/operation.mjs.map +1 -1
- package/dist/modules/effect/query.d.mts +3 -4
- package/dist/modules/effect/query.mjs +1 -1
- package/dist/modules/effect/query.mjs.map +1 -1
- package/dist/modules/effect/schema.d.mts +8 -9
- package/dist/modules/effect/schema.mjs.map +1 -1
- package/dist/modules/effect/workflow.d.mts +5 -6
- package/dist/modules/effect/workflow.mjs +1 -1
- package/dist/modules/effect/workflow.mjs.map +1 -1
- package/dist/oxlint/architecture.d.mts +6 -7
- package/dist/oxlint/architecture.mjs +1 -1
- package/dist/oxlint/architecture.mjs.map +1 -1
- package/dist/oxlint/ast.d.mts +22 -23
- package/dist/oxlint/ast.mjs +1 -1
- package/dist/oxlint/ast.mjs.map +1 -1
- package/dist/oxlint/ownership.d.mts +2 -3
- package/dist/oxlint/ownership.mjs +1 -1
- package/dist/oxlint/ownership.mjs.map +1 -1
- package/dist/oxlint.d.mts +4 -4
- package/dist/oxlint.mjs +1 -1
- package/dist/oxlint.mjs.map +1 -1
- package/dist/state-machine.d.mts +1 -2
- package/dist/state-machine.mjs.map +1 -1
- package/dist/tenancy.d.mts +6 -6
- package/dist/tenancy.mjs.map +1 -1
- package/dist/triggers.d.mts +6 -6
- package/dist/triggers.mjs.map +1 -1
- package/dist/webhooks.d.mts +5 -6
- package/dist/webhooks.mjs.map +1 -1
- package/dist/zod-table.d.mts +10 -10
- package/dist/zod-table.mjs.map +1 -1
- package/docs/auth.md +131 -1
- package/docs/effect.md +8 -2
- package/docs/llms.md +41 -20
- package/docs/oxlint.md +1 -1
- package/docs/upgrading.md +9 -1
- package/docs/zod-table.md +1 -1
- package/package.json +21 -15
- package/scripts/test-packed-auth.mjs +72 -0
- package/scripts/test-packed-effect.mjs +2 -1
- package/scripts/test-packed-ids.mjs +2 -2
- package/dist/node_modules/@standard-schema/spec/dist/index.d.mts +0 -79
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,38 @@ are this file's matching section.
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased]
|
|
14
14
|
|
|
15
|
+
## [0.1.11] - 2026-10-09
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Configure shared post-auth Effect services and command/query handles once across
|
|
20
|
+
all auth, role, admin, and system constructors with `createEffectAuthFunctions` (#24).
|
|
21
|
+
- Keep query, mutation, action, and internal system capabilities separately typed
|
|
22
|
+
and configured; preserve secured database wrapping and live action membership.
|
|
23
|
+
- Document the shared application factory with packed-compiled examples and
|
|
24
|
+
constructor capability guidance for coding agents.
|
|
25
|
+
|
|
26
|
+
### Verified
|
|
27
|
+
|
|
28
|
+
- Cover denied authentication, roles and membership, request-local scopes, context
|
|
29
|
+
collisions, nested command auditing, and registered mutation rollback.
|
|
30
|
+
- Preserve packed native auth context compatibility on Convex 1.45 and 1.46.
|
|
31
|
+
|
|
32
|
+
## [0.1.10] - 2026-10-09
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Preserve native Convex context types in auth, role, admin, and system function
|
|
37
|
+
constructors so secured handlers bind directly to Effect registries (#22).
|
|
38
|
+
- Install Standard Schema types explicitly so native contract input and output
|
|
39
|
+
inference works in clean installations.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Update package dependencies and migrate the development toolchain to Vite+ 1.1.
|
|
44
|
+
- Require Convex 1.46 or newer and convex-helpers 0.1.127 or newer (below 0.2.0),
|
|
45
|
+
matching workflow 0.4.10.
|
|
46
|
+
|
|
15
47
|
## [0.1.7] - 2026-10-07
|
|
16
48
|
|
|
17
49
|
### Added
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ bun add cvx-kit
|
|
|
13
13
|
# or: npm install cvx-kit
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Supported versions: Convex `^1.
|
|
16
|
+
Supported versions: Convex `^1.46.0`, Zod `^4.5.4`, Bun `1.3+`, and Node.js
|
|
17
17
|
`24+` with npm `11+`. The library runtime is ESM-only.
|
|
18
18
|
|
|
19
19
|
## Toolchain
|
|
@@ -142,39 +142,39 @@ import type { AuditEntryInput } from 'cvx-kit/components/foundation'
|
|
|
142
142
|
import { z } from 'zod'
|
|
143
143
|
|
|
144
144
|
type Host = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
actorId: string
|
|
146
|
+
rename: (id: string, title: string) => Promise<void>
|
|
147
|
+
appendAudit: (entry: AuditEntryInput) => Promise<void>
|
|
148
148
|
}
|
|
149
149
|
const { Command } = createEffectFoundation({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
observability: {
|
|
151
|
+
enabled: false,
|
|
152
|
+
classifyError: () => ({ outcome: 'failed', errorCode: 'RENAME_FAILED' }),
|
|
153
|
+
},
|
|
154
|
+
writeAudit: (host: Host, entry) => host.appendAudit(entry),
|
|
155
155
|
})
|
|
156
156
|
const renameInput = z.object({ id: z.string(), title: z.string() }).strict()
|
|
157
157
|
export const commands = Command({
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
158
|
+
context: (host: Host) => host,
|
|
159
|
+
operations: ({ command }) => ({
|
|
160
|
+
'documents.rename': command({
|
|
161
|
+
input: renameInput,
|
|
162
|
+
result: z.object({ ok: z.literal(true) }).strict(),
|
|
163
|
+
classification: 'business',
|
|
164
|
+
handler: async (input, context) => {
|
|
165
|
+
await context.rename(input.id, input.title)
|
|
166
|
+
return { ok: true as const }
|
|
167
|
+
},
|
|
168
|
+
audit: ({ command }, context) => ({
|
|
169
|
+
operation: 'documents.rename',
|
|
170
|
+
actorId: context.actorId,
|
|
171
|
+
aggregate: { type: 'document', id: command.id },
|
|
172
|
+
}),
|
|
173
|
+
}),
|
|
174
|
+
}),
|
|
175
175
|
})
|
|
176
176
|
export const executeRename = (input: z.input<typeof renameInput>, host: Host) =>
|
|
177
|
-
|
|
177
|
+
commands.exec('documents.rename', input, host)
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
`exec` returns a lazy Effect even for ordinary async handlers. Shared
|
|
@@ -247,7 +247,7 @@ module cycles. Run Oxlint on the whole backend, including `convex.config.ts`;
|
|
|
247
247
|
changed-file-only lint cannot guarantee a project scan. No application-owned
|
|
248
248
|
architecture test framework is required. The plugin also exports `checkArchitecture()`
|
|
249
249
|
for tools that need project diagnostics directly, named `rules`, and `RuleName`. Verified with
|
|
250
|
-
Oxlint 1.
|
|
250
|
+
Oxlint 1.87.0 and Vite+ 1.1.0. See [rule coverage and limitations](./src/docs/oxlint.md)
|
|
251
251
|
and the [migration from the initial 0.1.4 plugin](./src/docs/upgrading.md).
|
|
252
252
|
|
|
253
253
|
Repository checks and the enforced library rules are documented in
|
package/dist/agent-tools.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import { z } from "zod";
|
|
|
7
7
|
* adaptable to ai-sdk tool(). The kit imports neither framework — checked
|
|
8
8
|
* against registry snapshots on 2026-08-14; re-verify at install time.
|
|
9
9
|
*/
|
|
10
|
-
type AgentToolRecord<Result = unknown, Context = never, Input = never> = {
|
|
10
|
+
export type AgentToolRecord<Result = unknown, Context = never, Input = never> = {
|
|
11
11
|
name: string;
|
|
12
12
|
description: string;
|
|
13
13
|
args: z.ZodType;
|
|
@@ -22,7 +22,7 @@ type ToolTable = {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
type ToolHandler<Result> = (ctx: never, input: never) => Promise<Result>;
|
|
25
|
-
type AgentToolHandlers<Result = unknown> = {
|
|
25
|
+
export type AgentToolHandlers<Result = unknown> = {
|
|
26
26
|
/** Mutations: route through command executors — agents get audited commands. */
|
|
27
27
|
create?: ToolHandler<Result>;
|
|
28
28
|
update?: ToolHandler<Result>;
|
|
@@ -48,15 +48,15 @@ declare const listArgs: z.ZodObject<{
|
|
|
48
48
|
* are emitted. Wire mutation handlers to createCrudCommands executors (or
|
|
49
49
|
* your own) so every agent action is an audited command.
|
|
50
50
|
*/
|
|
51
|
-
declare function createAgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers>(table: Table, handlers: Handlers, options?: {
|
|
51
|
+
export declare function createAgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers>(table: Table, handlers: Handlers, options?: {
|
|
52
52
|
descriptions?: Partial<Record<keyof AgentToolHandlers, string>>;
|
|
53
53
|
}): AgentTools<Table, Handlers>;
|
|
54
|
-
type AgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers> = Partial<{ [Verb in keyof Handlers & keyof AgentToolHandlers as `${Table['tableName']}_${Verb}`]: {
|
|
54
|
+
export type AgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers> = Partial<{ [Verb in keyof Handlers & keyof AgentToolHandlers as `${Table['tableName']}_${Verb}`]: {
|
|
55
55
|
name: string;
|
|
56
56
|
description: string;
|
|
57
57
|
args: Verb extends 'create' ? Table['tools']['insert'] : Verb extends 'update' ? Table['tools']['update'] : Verb extends 'list' ? typeof listArgs : Table['tools']['id'];
|
|
58
58
|
handler: NonNullable<Handlers[Verb]>;
|
|
59
59
|
}; }>;
|
|
60
60
|
//#endregion
|
|
61
|
-
export {
|
|
61
|
+
export { type OperationExecutor, type OperationPublicResult, type OperationTool, type OperationToolConverter, type OperationToolDefinition, type OperationToolJsonSchema, type OperationToolOutcome, type SelectedOperation, bindOperationExecutor, createOperationTools, operationToolDialect, selectOperation };
|
|
62
62
|
//# sourceMappingURL=agent-tools.d.mts.map
|
package/dist/agent-tools.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-tools.mjs","names":[],"sources":["../src/agent-tools.ts"],"sourcesContent":["import { convexToZod } from 'convex-helpers/server/zod4'\nimport { paginationOptsValidator } from 'convex/server'\nimport { z } from 'zod'\n\n/**\n * A framework-agnostic tool record: directly spreadable into\n * @convex-dev/agent's createTool ({ description, args, handler }) and\n * adaptable to ai-sdk tool(). The kit imports neither framework — checked\n * against registry snapshots on 2026-08-14; re-verify at install time.\n */\nexport type AgentToolRecord<Result = unknown, Context = never, Input = never> = {\n\tname: string\n\tdescription: string\n\targs: z.ZodType\n\thandler: (ctx: Context, input: Input) => Promise<Result>\n}\n\ntype ToolTable = {\n\ttableName: string\n\ttools: {\n\t\tinsert: z.ZodType\n\t\tupdate: z.ZodType\n\t\tid: z.ZodType\n\t}\n}\n\ntype ToolHandler<Result> = (ctx: never, input: never) => Promise<Result>\n\nexport type AgentToolHandlers<Result = unknown> = {\n\t/** Mutations: route through command executors — agents get audited commands. */\n\tcreate?: ToolHandler<Result>\n\tupdate?: ToolHandler<Result>\n\tarchive?: ToolHandler<Result>\n\t/** Reads: caller-supplied query handlers (reads do not route through commands). */\n\tget?: ToolHandler<Result>\n\tlist?: ToolHandler<Result>\n}\n\nconst listArgs = z.object({ paginationOpts: convexToZod(paginationOptsValidator) }).strict()\n\n/**\n * Emits agent tool definitions from the existing table tool masks: args are\n * the masks (jsonSafeZid keeps ids primitive in generated JSON schemas),\n * names are `<tableName>_<verb>`, and only the kinds you supply handlers for\n * are emitted. Wire mutation handlers to createCrudCommands executors (or\n * your own) so every agent action is an audited command.\n */\nexport function createAgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers>(\n\ttable: Table,\n\thandlers: Handlers,\n\toptions?: { descriptions?: Partial<Record<keyof AgentToolHandlers, string>> },\n) {\n\tconst name = table.tableName\n\tconst masks: Record<keyof AgentToolHandlers, z.ZodType> = {\n\t\tcreate: table.tools.insert,\n\t\tupdate: table.tools.update,\n\t\tarchive: table.tools.id,\n\t\tget: table.tools.id,\n\t\tlist: listArgs,\n\t}\n\tconst defaults: Record<keyof AgentToolHandlers, string> = {\n\t\tcreate: `Create a ${name} record`,\n\t\tupdate: `Update fields of an existing ${name} record`,\n\t\tarchive: `Archive (soft-delete) a ${name} record`,\n\t\tget: `Fetch one ${name} record by id`,\n\t\tlist: `List ${name} records, paginated`,\n\t}\n\tconst tools: Record<string, AgentToolRecord> = {}\n\tfor (const verb of ['create', 'update', 'archive', 'get', 'list'] as const) {\n\t\tconst handler = handlers[verb]\n\t\tif (!handler) continue\n\t\ttools[`${name}_${verb}`] = {\n\t\t\tname: `${name}_${verb}`,\n\t\t\tdescription: options?.descriptions?.[verb] ?? defaults[verb],\n\t\t\targs: masks[verb],\n\t\t\thandler,\n\t\t}\n\t}\n\t// SAFETY: each emitted key combines this table name with a supplied verb; its handler and schema come from those same inputs.\n\treturn tools as AgentTools<Table, Handlers>\n}\n\nexport type AgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers> = Partial<{\n\t[Verb in keyof Handlers & keyof AgentToolHandlers as `${Table['tableName']}_${Verb}`]: {\n\t\tname: string\n\t\tdescription: string\n\t\targs: Verb extends 'create'\n\t\t\t? Table['tools']['insert']\n\t\t\t: Verb extends 'update'\n\t\t\t\t? Table['tools']['update']\n\t\t\t\t: Verb extends 'list'\n\t\t\t\t\t? typeof listArgs\n\t\t\t\t\t: Table['tools']['id']\n\t\thandler: NonNullable<Handlers[Verb]>\n\t}\n}>\nexport {\n\tselectOperation,\n\tbindOperationExecutor,\n\tcreateOperationTools,\n\toperationToolDialect,\n\ttype SelectedOperation,\n\ttype OperationExecutor,\n\ttype OperationPublicResult,\n\ttype OperationToolJsonSchema,\n\ttype OperationToolConverter,\n\ttype OperationToolDefinition,\n\ttype OperationToolOutcome,\n\ttype OperationTool,\n} from './modules/contracts/exposure'\n"],"mappings":"2RAsCA,
|
|
1
|
+
{"version":3,"file":"agent-tools.mjs","names":["listArgs","z","convexToZod","paginationOptsValidator","createAgentTools","name","table","masks","defaults","tools","verb","handler","handlers","options","bindOperationExecutor","createOperationTools","operationToolDialect","selectOperation"],"sources":["../src/agent-tools.ts"],"sourcesContent":["import { convexToZod } from 'convex-helpers/server/zod4'\nimport { paginationOptsValidator } from 'convex/server'\nimport { z } from 'zod'\n\n/**\n * A framework-agnostic tool record: directly spreadable into\n * @convex-dev/agent's createTool ({ description, args, handler }) and\n * adaptable to ai-sdk tool(). The kit imports neither framework — checked\n * against registry snapshots on 2026-08-14; re-verify at install time.\n */\nexport type AgentToolRecord<Result = unknown, Context = never, Input = never> = {\n\tname: string\n\tdescription: string\n\targs: z.ZodType\n\thandler: (ctx: Context, input: Input) => Promise<Result>\n}\n\ntype ToolTable = {\n\ttableName: string\n\ttools: {\n\t\tinsert: z.ZodType\n\t\tupdate: z.ZodType\n\t\tid: z.ZodType\n\t}\n}\n\ntype ToolHandler<Result> = (ctx: never, input: never) => Promise<Result>\n\nexport type AgentToolHandlers<Result = unknown> = {\n\t/** Mutations: route through command executors — agents get audited commands. */\n\tcreate?: ToolHandler<Result>\n\tupdate?: ToolHandler<Result>\n\tarchive?: ToolHandler<Result>\n\t/** Reads: caller-supplied query handlers (reads do not route through commands). */\n\tget?: ToolHandler<Result>\n\tlist?: ToolHandler<Result>\n}\n\nconst listArgs = z.object({ paginationOpts: convexToZod(paginationOptsValidator) }).strict()\n\n/**\n * Emits agent tool definitions from the existing table tool masks: args are\n * the masks (jsonSafeZid keeps ids primitive in generated JSON schemas),\n * names are `<tableName>_<verb>`, and only the kinds you supply handlers for\n * are emitted. Wire mutation handlers to createCrudCommands executors (or\n * your own) so every agent action is an audited command.\n */\nexport function createAgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers>(\n\ttable: Table,\n\thandlers: Handlers,\n\toptions?: { descriptions?: Partial<Record<keyof AgentToolHandlers, string>> },\n) {\n\tconst name = table.tableName\n\tconst masks: Record<keyof AgentToolHandlers, z.ZodType> = {\n\t\tcreate: table.tools.insert,\n\t\tupdate: table.tools.update,\n\t\tarchive: table.tools.id,\n\t\tget: table.tools.id,\n\t\tlist: listArgs,\n\t}\n\tconst defaults: Record<keyof AgentToolHandlers, string> = {\n\t\tcreate: `Create a ${name} record`,\n\t\tupdate: `Update fields of an existing ${name} record`,\n\t\tarchive: `Archive (soft-delete) a ${name} record`,\n\t\tget: `Fetch one ${name} record by id`,\n\t\tlist: `List ${name} records, paginated`,\n\t}\n\tconst tools: Record<string, AgentToolRecord> = {}\n\tfor (const verb of ['create', 'update', 'archive', 'get', 'list'] as const) {\n\t\tconst handler = handlers[verb]\n\t\tif (!handler) continue\n\t\ttools[`${name}_${verb}`] = {\n\t\t\tname: `${name}_${verb}`,\n\t\t\tdescription: options?.descriptions?.[verb] ?? defaults[verb],\n\t\t\targs: masks[verb],\n\t\t\thandler,\n\t\t}\n\t}\n\t// SAFETY: each emitted key combines this table name with a supplied verb; its handler and schema come from those same inputs.\n\treturn tools as AgentTools<Table, Handlers>\n}\n\nexport type AgentTools<Table extends ToolTable, Handlers extends AgentToolHandlers> = Partial<{\n\t[Verb in keyof Handlers & keyof AgentToolHandlers as `${Table['tableName']}_${Verb}`]: {\n\t\tname: string\n\t\tdescription: string\n\t\targs: Verb extends 'create'\n\t\t\t? Table['tools']['insert']\n\t\t\t: Verb extends 'update'\n\t\t\t\t? Table['tools']['update']\n\t\t\t\t: Verb extends 'list'\n\t\t\t\t\t? typeof listArgs\n\t\t\t\t\t: Table['tools']['id']\n\t\thandler: NonNullable<Handlers[Verb]>\n\t}\n}>\nexport {\n\tselectOperation,\n\tbindOperationExecutor,\n\tcreateOperationTools,\n\toperationToolDialect,\n\ttype SelectedOperation,\n\ttype OperationExecutor,\n\ttype OperationPublicResult,\n\ttype OperationToolJsonSchema,\n\ttype OperationToolConverter,\n\ttype OperationToolDefinition,\n\ttype OperationToolOutcome,\n\ttype OperationTool,\n} from './modules/contracts/exposure'\n"],"mappings":"2RAsCA,MAAMA,EAAWC,EAAE,OAAO,CAAE,eAAgBC,EAAYC,CAAuB,CAAE,CAAC,CAAC,CAAC,OAAO,EAS3F,SAAgBC,EACf,EACA,EACA,EACC,CACD,IAAMC,EAAOC,EAAM,UACbC,EAAoD,CACzD,OAAQD,EAAM,MAAM,OACpB,OAAQA,EAAM,MAAM,OACpB,QAASA,EAAM,MAAM,GACrB,IAAKA,EAAM,MAAM,GACjB,KAAMN,CACP,EACMQ,EAAoD,CACzD,OAAQ,YAAYH,EAAK,SACzB,OAAQ,gCAAgCA,EAAK,SAC7C,QAAS,2BAA2BA,EAAK,SACzC,IAAK,aAAaA,EAAK,eACvB,KAAM,QAAQA,EAAK,oBACpB,EACMI,EAAyC,CAAC,EAChD,IAAK,IAAMC,IAAQ,CAAC,SAAU,SAAU,UAAW,MAAO,MAAM,EAAY,CAC3E,IAAMC,EAAUC,EAASF,GACpBC,IACL,EAAM,GAAGN,EAAK,GAAGK,KAAU,CAC1B,KAAM,GAAGL,EAAK,GAAGK,IACjB,YAAaG,GAAS,eAAeH,IAASF,EAASE,GACvD,KAAMH,EAAMG,GACZ,SACD,EACD,CAEA,OAAOD,CACR"}
|
package/dist/auth.d.mts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { ErrorFactory } from "./errors.mjs";
|
|
2
2
|
import { RLSConfig, Rules } from "./tenancy.mjs";
|
|
3
|
+
import { CustomBuilder } from "convex-helpers/server/zod4";
|
|
3
4
|
import { ActionBuilder, DocumentByInfo, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, GenericTableInfo, IndexNames, IndexRange, IndexRangeBuilder, MutationBuilder, NamedIndex, PaginationOptions, PaginationResult, Query, QueryBuilder, QueryInitializer, TableNamesInDataModel, UserIdentity } from "convex/server";
|
|
4
5
|
import { Triggers } from "convex-helpers/server/triggers";
|
|
5
6
|
//#region src/auth.d.ts
|
|
6
7
|
/** The default vocabulary; every app can supply its own via the Role generic. */
|
|
7
|
-
type DefaultRole = 'reader' | 'writer' | 'admin';
|
|
8
|
-
type Actor<Role extends string> = Readonly<{
|
|
8
|
+
export type DefaultRole = 'reader' | 'writer' | 'admin';
|
|
9
|
+
export type Actor<Role extends string> = Readonly<{
|
|
9
10
|
userId: string;
|
|
10
11
|
organizationId: string;
|
|
11
12
|
role: Role;
|
|
12
13
|
}>;
|
|
13
|
-
type AuthBundle<Role extends string> = Readonly<{
|
|
14
|
+
export type AuthBundle<Role extends string> = Readonly<{
|
|
14
15
|
identity: UserIdentity;
|
|
15
16
|
user: Readonly<{
|
|
16
17
|
id: string;
|
|
@@ -29,7 +30,7 @@ type AuthBundle<Role extends string> = Readonly<{
|
|
|
29
30
|
* compose (AND) onto the same wrapped database: queries get a wrapped
|
|
30
31
|
* reader, mutations get triggers first, then a wrapped writer.
|
|
31
32
|
*/
|
|
32
|
-
type SecurityConfig<DataModel extends GenericDataModel, Role extends string> = {
|
|
33
|
+
export type SecurityConfig<DataModel extends GenericDataModel, Role extends string> = {
|
|
33
34
|
/**
|
|
34
35
|
* Tenant isolation. `tables` is THE registry: every listed table gets
|
|
35
36
|
* read/insert/modify gated on row.tenant === ctx.tenant. Pair with
|
|
@@ -54,7 +55,7 @@ type SecurityConfig<DataModel extends GenericDataModel, Role extends string> = {
|
|
|
54
55
|
defaultPolicy?: RLSConfig['defaultPolicy'];
|
|
55
56
|
};
|
|
56
57
|
type AnyAuthContext<DataModel extends GenericDataModel> = GenericQueryCtx<DataModel> | GenericMutationCtx<DataModel> | GenericActionCtx<DataModel>;
|
|
57
|
-
type AuthFunctionsConfig<DataModel extends GenericDataModel, Role extends string> = {
|
|
58
|
+
export type AuthFunctionsConfig<DataModel extends GenericDataModel, Role extends string> = {
|
|
58
59
|
/** The consumer's generated function builders (from ./_generated/server). */
|
|
59
60
|
query: QueryBuilder<DataModel, 'public'>;
|
|
60
61
|
mutation: MutationBuilder<DataModel, 'public'>;
|
|
@@ -121,8 +122,8 @@ type AuthFunctionsConfig<DataModel extends GenericDataModel, Role extends string
|
|
|
121
122
|
security?: SecurityConfig<DataModel, Role>;
|
|
122
123
|
};
|
|
123
124
|
/** WorkOS-style default: `member` writes; reader/writer/admin pass through. */
|
|
124
|
-
declare function defaultRoleMap(roleSlug?: string): DefaultRole | null;
|
|
125
|
-
type IncludedQuery<Table extends GenericTableInfo> = {
|
|
125
|
+
export declare function defaultRoleMap(roleSlug?: string): DefaultRole | null;
|
|
126
|
+
export type IncludedQuery<Table extends GenericTableInfo> = {
|
|
126
127
|
when<Value>(value: Value | null | undefined, select: (query: QueryInitializer<Table>, value: Value) => Query<Table>): IncludedQuery<Table>;
|
|
127
128
|
matching<IndexName extends IndexNames<Table>>(indexName: IndexName, indexRange?: (query: IndexRangeBuilder<DocumentByInfo<Table>, NamedIndex<Table, IndexName>>) => IndexRange, shouldMatch?: boolean): IncludedQuery<Table>;
|
|
128
129
|
otherwise(select: (query: QueryInitializer<Table>) => Query<Table>): Query<Table>;
|
|
@@ -139,9 +140,37 @@ type IncludedQuery<Table extends GenericTableInfo> = {
|
|
|
139
140
|
paginate(opts: PaginationOptions): Promise<PaginationResult<DocumentByInfo<Table>>>;
|
|
140
141
|
paginate<Item>(opts: PaginationOptions, transform: (page: DocumentByInfo<Table>[]) => Item[] | Promise<Item[]>): Promise<PaginationResult<Item>>;
|
|
141
142
|
};
|
|
142
|
-
type Include = <Table extends GenericTableInfo>(query: QueryInitializer<Table>) => IncludedQuery<Table>;
|
|
143
|
+
export type Include = <Table extends GenericTableInfo>(query: QueryInitializer<Table>) => IncludedQuery<Table>;
|
|
144
|
+
/**
|
|
145
|
+
* Keep native contexts symbolic in published declarations. Inferred spreads
|
|
146
|
+
* copy build-time Convex methods and override the consumer's native context.
|
|
147
|
+
*/
|
|
148
|
+
export type AuthFunctions<DataModel extends GenericDataModel, Role extends string = DefaultRole> = {
|
|
149
|
+
include: Include;
|
|
150
|
+
authenticatedUser: (ctx: AnyAuthContext<DataModel>) => Promise<AuthBundle<Role>>;
|
|
151
|
+
authQuery: CustomBuilder<'query', {}, GenericQueryCtx<DataModel> & AuthBundle<Role> & {
|
|
152
|
+
include: Include;
|
|
153
|
+
}, {}, GenericQueryCtx<DataModel>, 'public', object>;
|
|
154
|
+
authMutation: CustomBuilder<'mutation', {}, GenericMutationCtx<DataModel> & AuthBundle<Role> & {
|
|
155
|
+
include: Include;
|
|
156
|
+
}, {}, GenericMutationCtx<DataModel>, 'public', object>;
|
|
157
|
+
authAction: CustomBuilder<'action', {}, GenericActionCtx<DataModel> & AuthBundle<Role>, {}, GenericActionCtx<DataModel>, 'public', object>;
|
|
158
|
+
roleQuery: (...allowed: readonly Role[]) => AuthFunctions<DataModel, Role>['authQuery'];
|
|
159
|
+
roleMutation: (...allowed: readonly Role[]) => AuthFunctions<DataModel, Role>['authMutation'];
|
|
160
|
+
roleAction: (...allowed: readonly Role[]) => AuthFunctions<DataModel, Role>['authAction'];
|
|
161
|
+
adminQuery: AuthFunctions<DataModel, Role>['authQuery'];
|
|
162
|
+
adminMutation: AuthFunctions<DataModel, Role>['authMutation'];
|
|
163
|
+
adminAction: AuthFunctions<DataModel, Role>['authAction'];
|
|
164
|
+
systemQuery: CustomBuilder<'query', {}, GenericQueryCtx<DataModel> & {
|
|
165
|
+
include: Include;
|
|
166
|
+
}, {}, GenericQueryCtx<DataModel>, 'internal', object>;
|
|
167
|
+
systemMutation: CustomBuilder<'mutation', {}, GenericMutationCtx<DataModel> & {
|
|
168
|
+
include: Include;
|
|
169
|
+
}, {}, GenericMutationCtx<DataModel>, 'internal', object>;
|
|
170
|
+
systemAction: CustomBuilder<'action', {}, GenericActionCtx<DataModel>, {}, GenericActionCtx<DataModel>, 'internal', object>;
|
|
171
|
+
};
|
|
143
172
|
/** Builds an include() that selects the first matching indexed query and bounds the read. */
|
|
144
|
-
declare function createInclude(options?: {
|
|
173
|
+
export declare function createInclude(options?: {
|
|
145
174
|
errors?: ErrorFactory;
|
|
146
175
|
maxRows?: number;
|
|
147
176
|
}): Include;
|
|
@@ -153,285 +182,6 @@ declare function createInclude(options?: {
|
|
|
153
182
|
* has a role-gated variant (roleQuery/roleMutation/roleAction), and the
|
|
154
183
|
* admin* constructors are just that gate applied to config.adminRoles.
|
|
155
184
|
*/
|
|
156
|
-
declare function createAuthFunctions<DataModel extends GenericDataModel, const Role extends string = DefaultRole>(config: AuthFunctionsConfig<DataModel, Role>):
|
|
157
|
-
include: Include;
|
|
158
|
-
authenticatedUser: (ctx: AnyAuthContext<DataModel>) => Promise<AuthBundle<Role>>;
|
|
159
|
-
roleQuery: (...allowed: readonly Role[]) => import("convex-helpers/server/zod4").CustomBuilder<"query", {}, {
|
|
160
|
-
db: import("convex/server").GenericDatabaseReader<DataModel>;
|
|
161
|
-
auth: import("convex/server").Auth;
|
|
162
|
-
storage: import("convex/server").StorageReader;
|
|
163
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, {
|
|
164
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
165
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
166
|
-
meta: import("convex/server").QueryMeta;
|
|
167
|
-
identity: UserIdentity;
|
|
168
|
-
user: Readonly<{
|
|
169
|
-
id: string;
|
|
170
|
-
}>;
|
|
171
|
-
org: Readonly<{
|
|
172
|
-
organizationId: string;
|
|
173
|
-
role: Role;
|
|
174
|
-
}>;
|
|
175
|
-
role: Role;
|
|
176
|
-
actor: Readonly<{
|
|
177
|
-
userId: string;
|
|
178
|
-
organizationId: string;
|
|
179
|
-
role: Role;
|
|
180
|
-
}>;
|
|
181
|
-
tenant: string;
|
|
182
|
-
include: Include;
|
|
183
|
-
}, {}, GenericQueryCtx<DataModel>, "public", object>;
|
|
184
|
-
roleMutation: (...allowed: readonly Role[]) => import("convex-helpers/server/zod4").CustomBuilder<"mutation", {}, {
|
|
185
|
-
db: import("convex/server").GenericDatabaseWriter<DataModel>;
|
|
186
|
-
auth: import("convex/server").Auth;
|
|
187
|
-
storage: import("convex/server").StorageWriter;
|
|
188
|
-
scheduler: import("convex/server").Scheduler;
|
|
189
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, import("convex/server").AdvancedRunQueryOptions>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
190
|
-
runMutation: <Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").ArgsAndOptions<Mutation, {
|
|
191
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
192
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
193
|
-
meta: import("convex/server").MutationMeta;
|
|
194
|
-
identity: UserIdentity;
|
|
195
|
-
user: Readonly<{
|
|
196
|
-
id: string;
|
|
197
|
-
}>;
|
|
198
|
-
org: Readonly<{
|
|
199
|
-
organizationId: string;
|
|
200
|
-
role: Role;
|
|
201
|
-
}>;
|
|
202
|
-
role: Role;
|
|
203
|
-
actor: Readonly<{
|
|
204
|
-
userId: string;
|
|
205
|
-
organizationId: string;
|
|
206
|
-
role: Role;
|
|
207
|
-
}>;
|
|
208
|
-
tenant: string;
|
|
209
|
-
include: Include;
|
|
210
|
-
}, {}, GenericMutationCtx<DataModel>, "public", object>;
|
|
211
|
-
roleAction: (...allowed: readonly Role[]) => import("convex-helpers/server/zod4").CustomBuilder<"action", {}, {
|
|
212
|
-
runQuery<Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").OptionalRestArgs<Query>): Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
213
|
-
runMutation<Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").OptionalRestArgs<Mutation>): Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
214
|
-
runAction<Action extends import("convex/server").FunctionReference<"action", "public" | "internal">>(action: Action, ...args: import("convex/server").OptionalRestArgs<Action>): Promise<import("convex/server").FunctionReturnType<Action>>;
|
|
215
|
-
scheduler: import("convex/server").Scheduler;
|
|
216
|
-
auth: import("convex/server").Auth;
|
|
217
|
-
storage: import("convex/server").StorageActionWriter;
|
|
218
|
-
vectorSearch<TableName extends TableNamesInDataModel<DataModel>, IndexName extends import("convex/server").VectorIndexNames<import("convex/server").NamedTableInfo<DataModel, TableName>>>(tableName: TableName, indexName: IndexName, query: {
|
|
219
|
-
vector: number[];
|
|
220
|
-
limit?: number;
|
|
221
|
-
filter?: ((q: import("convex/server").VectorFilterBuilder<DocumentByInfo<import("convex/server").NamedTableInfo<DataModel, TableName>>, import("convex/server").NamedVectorIndex<import("convex/server").NamedTableInfo<DataModel, TableName>, IndexName>>) => import("convex/server").FilterExpression<boolean>) | undefined;
|
|
222
|
-
}): Promise<{
|
|
223
|
-
_id: import("convex/values").GenericId<TableName>;
|
|
224
|
-
_score: number;
|
|
225
|
-
}[]>;
|
|
226
|
-
meta: import("convex/server").ActionMeta;
|
|
227
|
-
identity: UserIdentity;
|
|
228
|
-
user: Readonly<{
|
|
229
|
-
id: string;
|
|
230
|
-
}>;
|
|
231
|
-
org: Readonly<{
|
|
232
|
-
organizationId: string;
|
|
233
|
-
role: Role;
|
|
234
|
-
}>;
|
|
235
|
-
role: Role;
|
|
236
|
-
actor: Readonly<{
|
|
237
|
-
userId: string;
|
|
238
|
-
organizationId: string;
|
|
239
|
-
role: Role;
|
|
240
|
-
}>;
|
|
241
|
-
tenant: string;
|
|
242
|
-
}, {}, GenericActionCtx<DataModel>, "public", object>;
|
|
243
|
-
authQuery: import("convex-helpers/server/zod4").CustomBuilder<"query", {}, {
|
|
244
|
-
db: import("convex/server").GenericDatabaseReader<DataModel>;
|
|
245
|
-
auth: import("convex/server").Auth;
|
|
246
|
-
storage: import("convex/server").StorageReader;
|
|
247
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, {
|
|
248
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
249
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
250
|
-
meta: import("convex/server").QueryMeta;
|
|
251
|
-
identity: UserIdentity;
|
|
252
|
-
user: Readonly<{
|
|
253
|
-
id: string;
|
|
254
|
-
}>;
|
|
255
|
-
org: Readonly<{
|
|
256
|
-
organizationId: string;
|
|
257
|
-
role: Role;
|
|
258
|
-
}>;
|
|
259
|
-
role: Role;
|
|
260
|
-
actor: Readonly<{
|
|
261
|
-
userId: string;
|
|
262
|
-
organizationId: string;
|
|
263
|
-
role: Role;
|
|
264
|
-
}>;
|
|
265
|
-
tenant: string;
|
|
266
|
-
include: Include;
|
|
267
|
-
}, {}, GenericQueryCtx<DataModel>, "public", object>;
|
|
268
|
-
authMutation: import("convex-helpers/server/zod4").CustomBuilder<"mutation", {}, {
|
|
269
|
-
db: import("convex/server").GenericDatabaseWriter<DataModel>;
|
|
270
|
-
auth: import("convex/server").Auth;
|
|
271
|
-
storage: import("convex/server").StorageWriter;
|
|
272
|
-
scheduler: import("convex/server").Scheduler;
|
|
273
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, import("convex/server").AdvancedRunQueryOptions>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
274
|
-
runMutation: <Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").ArgsAndOptions<Mutation, {
|
|
275
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
276
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
277
|
-
meta: import("convex/server").MutationMeta;
|
|
278
|
-
identity: UserIdentity;
|
|
279
|
-
user: Readonly<{
|
|
280
|
-
id: string;
|
|
281
|
-
}>;
|
|
282
|
-
org: Readonly<{
|
|
283
|
-
organizationId: string;
|
|
284
|
-
role: Role;
|
|
285
|
-
}>;
|
|
286
|
-
role: Role;
|
|
287
|
-
actor: Readonly<{
|
|
288
|
-
userId: string;
|
|
289
|
-
organizationId: string;
|
|
290
|
-
role: Role;
|
|
291
|
-
}>;
|
|
292
|
-
tenant: string;
|
|
293
|
-
include: Include;
|
|
294
|
-
}, {}, GenericMutationCtx<DataModel>, "public", object>;
|
|
295
|
-
authAction: import("convex-helpers/server/zod4").CustomBuilder<"action", {}, {
|
|
296
|
-
runQuery<Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").OptionalRestArgs<Query>): Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
297
|
-
runMutation<Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").OptionalRestArgs<Mutation>): Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
298
|
-
runAction<Action extends import("convex/server").FunctionReference<"action", "public" | "internal">>(action: Action, ...args: import("convex/server").OptionalRestArgs<Action>): Promise<import("convex/server").FunctionReturnType<Action>>;
|
|
299
|
-
scheduler: import("convex/server").Scheduler;
|
|
300
|
-
auth: import("convex/server").Auth;
|
|
301
|
-
storage: import("convex/server").StorageActionWriter;
|
|
302
|
-
vectorSearch<TableName extends TableNamesInDataModel<DataModel>, IndexName extends import("convex/server").VectorIndexNames<import("convex/server").NamedTableInfo<DataModel, TableName>>>(tableName: TableName, indexName: IndexName, query: {
|
|
303
|
-
vector: number[];
|
|
304
|
-
limit?: number;
|
|
305
|
-
filter?: ((q: import("convex/server").VectorFilterBuilder<DocumentByInfo<import("convex/server").NamedTableInfo<DataModel, TableName>>, import("convex/server").NamedVectorIndex<import("convex/server").NamedTableInfo<DataModel, TableName>, IndexName>>) => import("convex/server").FilterExpression<boolean>) | undefined;
|
|
306
|
-
}): Promise<{
|
|
307
|
-
_id: import("convex/values").GenericId<TableName>;
|
|
308
|
-
_score: number;
|
|
309
|
-
}[]>;
|
|
310
|
-
meta: import("convex/server").ActionMeta;
|
|
311
|
-
identity: UserIdentity;
|
|
312
|
-
user: Readonly<{
|
|
313
|
-
id: string;
|
|
314
|
-
}>;
|
|
315
|
-
org: Readonly<{
|
|
316
|
-
organizationId: string;
|
|
317
|
-
role: Role;
|
|
318
|
-
}>;
|
|
319
|
-
role: Role;
|
|
320
|
-
actor: Readonly<{
|
|
321
|
-
userId: string;
|
|
322
|
-
organizationId: string;
|
|
323
|
-
role: Role;
|
|
324
|
-
}>;
|
|
325
|
-
tenant: string;
|
|
326
|
-
}, {}, GenericActionCtx<DataModel>, "public", object>;
|
|
327
|
-
adminQuery: import("convex-helpers/server/zod4").CustomBuilder<"query", {}, {
|
|
328
|
-
db: import("convex/server").GenericDatabaseReader<DataModel>;
|
|
329
|
-
auth: import("convex/server").Auth;
|
|
330
|
-
storage: import("convex/server").StorageReader;
|
|
331
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, {
|
|
332
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
333
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
334
|
-
meta: import("convex/server").QueryMeta;
|
|
335
|
-
identity: UserIdentity;
|
|
336
|
-
user: Readonly<{
|
|
337
|
-
id: string;
|
|
338
|
-
}>;
|
|
339
|
-
org: Readonly<{
|
|
340
|
-
organizationId: string;
|
|
341
|
-
role: Role;
|
|
342
|
-
}>;
|
|
343
|
-
role: Role;
|
|
344
|
-
actor: Readonly<{
|
|
345
|
-
userId: string;
|
|
346
|
-
organizationId: string;
|
|
347
|
-
role: Role;
|
|
348
|
-
}>;
|
|
349
|
-
tenant: string;
|
|
350
|
-
include: Include;
|
|
351
|
-
}, {}, GenericQueryCtx<DataModel>, "public", object>;
|
|
352
|
-
adminMutation: import("convex-helpers/server/zod4").CustomBuilder<"mutation", {}, {
|
|
353
|
-
db: import("convex/server").GenericDatabaseWriter<DataModel>;
|
|
354
|
-
auth: import("convex/server").Auth;
|
|
355
|
-
storage: import("convex/server").StorageWriter;
|
|
356
|
-
scheduler: import("convex/server").Scheduler;
|
|
357
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, import("convex/server").AdvancedRunQueryOptions>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
358
|
-
runMutation: <Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").ArgsAndOptions<Mutation, {
|
|
359
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
360
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
361
|
-
meta: import("convex/server").MutationMeta;
|
|
362
|
-
identity: UserIdentity;
|
|
363
|
-
user: Readonly<{
|
|
364
|
-
id: string;
|
|
365
|
-
}>;
|
|
366
|
-
org: Readonly<{
|
|
367
|
-
organizationId: string;
|
|
368
|
-
role: Role;
|
|
369
|
-
}>;
|
|
370
|
-
role: Role;
|
|
371
|
-
actor: Readonly<{
|
|
372
|
-
userId: string;
|
|
373
|
-
organizationId: string;
|
|
374
|
-
role: Role;
|
|
375
|
-
}>;
|
|
376
|
-
tenant: string;
|
|
377
|
-
include: Include;
|
|
378
|
-
}, {}, GenericMutationCtx<DataModel>, "public", object>;
|
|
379
|
-
adminAction: import("convex-helpers/server/zod4").CustomBuilder<"action", {}, {
|
|
380
|
-
runQuery<Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").OptionalRestArgs<Query>): Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
381
|
-
runMutation<Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").OptionalRestArgs<Mutation>): Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
382
|
-
runAction<Action extends import("convex/server").FunctionReference<"action", "public" | "internal">>(action: Action, ...args: import("convex/server").OptionalRestArgs<Action>): Promise<import("convex/server").FunctionReturnType<Action>>;
|
|
383
|
-
scheduler: import("convex/server").Scheduler;
|
|
384
|
-
auth: import("convex/server").Auth;
|
|
385
|
-
storage: import("convex/server").StorageActionWriter;
|
|
386
|
-
vectorSearch<TableName extends TableNamesInDataModel<DataModel>, IndexName extends import("convex/server").VectorIndexNames<import("convex/server").NamedTableInfo<DataModel, TableName>>>(tableName: TableName, indexName: IndexName, query: {
|
|
387
|
-
vector: number[];
|
|
388
|
-
limit?: number;
|
|
389
|
-
filter?: ((q: import("convex/server").VectorFilterBuilder<DocumentByInfo<import("convex/server").NamedTableInfo<DataModel, TableName>>, import("convex/server").NamedVectorIndex<import("convex/server").NamedTableInfo<DataModel, TableName>, IndexName>>) => import("convex/server").FilterExpression<boolean>) | undefined;
|
|
390
|
-
}): Promise<{
|
|
391
|
-
_id: import("convex/values").GenericId<TableName>;
|
|
392
|
-
_score: number;
|
|
393
|
-
}[]>;
|
|
394
|
-
meta: import("convex/server").ActionMeta;
|
|
395
|
-
identity: UserIdentity;
|
|
396
|
-
user: Readonly<{
|
|
397
|
-
id: string;
|
|
398
|
-
}>;
|
|
399
|
-
org: Readonly<{
|
|
400
|
-
organizationId: string;
|
|
401
|
-
role: Role;
|
|
402
|
-
}>;
|
|
403
|
-
role: Role;
|
|
404
|
-
actor: Readonly<{
|
|
405
|
-
userId: string;
|
|
406
|
-
organizationId: string;
|
|
407
|
-
role: Role;
|
|
408
|
-
}>;
|
|
409
|
-
tenant: string;
|
|
410
|
-
}, {}, GenericActionCtx<DataModel>, "public", object>;
|
|
411
|
-
systemQuery: import("convex-helpers/server/zod4").CustomBuilder<"query", {}, {
|
|
412
|
-
db: import("convex/server").GenericDatabaseReader<DataModel>;
|
|
413
|
-
auth: import("convex/server").Auth;
|
|
414
|
-
storage: import("convex/server").StorageReader;
|
|
415
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, {
|
|
416
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
417
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
418
|
-
meta: import("convex/server").QueryMeta;
|
|
419
|
-
include: Include;
|
|
420
|
-
}, {}, GenericQueryCtx<DataModel>, "internal", object>;
|
|
421
|
-
systemMutation: import("convex-helpers/server/zod4").CustomBuilder<"mutation", {}, {
|
|
422
|
-
db: import("convex/server").GenericDatabaseWriter<DataModel>;
|
|
423
|
-
auth: import("convex/server").Auth;
|
|
424
|
-
storage: import("convex/server").StorageWriter;
|
|
425
|
-
scheduler: import("convex/server").Scheduler;
|
|
426
|
-
runQuery: <Query extends import("convex/server").FunctionReference<"query", "public" | "internal">>(query: Query, ...args: import("convex/server").ArgsAndOptions<Query, import("convex/server").AdvancedRunQueryOptions>) => Promise<import("convex/server").FunctionReturnType<Query>>;
|
|
427
|
-
runMutation: <Mutation extends import("convex/server").FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: import("convex/server").ArgsAndOptions<Mutation, {
|
|
428
|
-
transactionLimits?: import("convex/server").TransactionLimits;
|
|
429
|
-
}>) => Promise<import("convex/server").FunctionReturnType<Mutation>>;
|
|
430
|
-
meta: import("convex/server").MutationMeta;
|
|
431
|
-
include: Include;
|
|
432
|
-
}, {}, GenericMutationCtx<DataModel>, "internal", object>;
|
|
433
|
-
systemAction: import("convex-helpers/server/zod4").CustomBuilder<"action", {}, GenericActionCtx<DataModel>, {}, GenericActionCtx<DataModel>, "internal", object>;
|
|
434
|
-
};
|
|
185
|
+
export declare function createAuthFunctions<DataModel extends GenericDataModel, const Role extends string = DefaultRole>(config: AuthFunctionsConfig<DataModel, Role>): AuthFunctions<DataModel, Role>;
|
|
435
186
|
//#endregion
|
|
436
|
-
export { Actor, AuthBundle, AuthFunctionsConfig, DefaultRole, Include, IncludedQuery, SecurityConfig, createAuthFunctions, createInclude, defaultRoleMap };
|
|
437
187
|
//# sourceMappingURL=auth.d.mts.map
|