Files
template-app/convex/schema.ts
T
2026-11-14 09:56:45 +00:00

125 lines
15 KiB
TypeScript

// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
// Generated by @conusai-kit/data-convex (pnpm convex:gen). Do not edit by hand: regenerate.
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
export default defineSchema({
"account_deletion": defineTable(v.object({ "abandoned": v.array(v.string()), "attempts": v.number(), "completedAt": v.union(v.string(), v.null()), "createdAt": v.string(), "erased": v.array(v.string()), "id": v.string(), "identityNote": v.union(v.union(v.literal("accepted"), v.literal("unknown"), v.literal("unsupported"), v.literal("held")), v.null()), "identitySubjects": v.union(v.array(v.string()), v.null()), "lastFailure": v.union(v.string(), v.null()), "pending": v.array(v.string()), "provider": v.union(v.string(), v.null()), "requestedAt": v.string(), "state": v.union(v.literal("erasing"), v.literal("held"), v.literal("completed")), "steps": v.union(v.array(v.union(v.literal("credentials"), v.literal("service-sessions"), v.literal("provider-account"), v.literal("identity"), v.literal("identity.erase"))), v.null()), "updatedAt": v.string(), "userId": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_unique_userId", ["userId"])
.index("by_state", ["state"]),
"account_session_revocation": defineTable(v.object({ "attempts": v.number(), "claimedUntil": v.union(v.string(), v.null()), "completedAt": v.union(v.string(), v.null()), "createdAt": v.string(), "delivered": v.array(v.string()), "id": v.string(), "lastFailure": v.union(v.string(), v.null()), "nextAttemptAt": v.string(), "pending": v.array(v.string()), "requestedAt": v.string(), "session": v.string(), "state": v.union(v.literal("pending"), v.literal("delivered"), v.literal("lapsed")), "updatedAt": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_unique_session", ["session"])
.index("by_state_nextAttemptAt", ["state", "nextAttemptAt"]),
"app_user_identity": defineTable(v.object({ "createdAt": v.string(), "id": v.string(), "issuer": v.string(), "migrationId": v.union(v.string(), v.null()), "subject": v.string(), "updatedAt": v.string(), "userId": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_unique_issuer_subject", ["issuer", "subject"])
.index("by_userId", ["userId"]),
"auth_api_keys": defineTable(v.object({ "createdAt": v.string(), "expiresAt": v.union(v.string(), v.null()), "id": v.string(), "name": v.string(), "orgId": v.string(), "prefix": v.string(), "revokedAt": v.union(v.string(), v.null()), "tokenHash": v.string(), "updatedAt": v.string(), "userId": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_tokenHash", ["orgId", "tokenHash"])
.index("by_userId", ["orgId", "userId"])
.index("by_prefix", ["orgId", "prefix"]),
"auth_sessions": defineTable(v.object({ "absoluteExpiresAt": v.string(), "accessTokenExpiresAt": v.string(), "createdAt": v.string(), "handleHash": v.string(), "id": v.string(), "issuer": v.string(), "lastSeenAt": v.string(), "revokedAt": v.union(v.string(), v.null()), "subject": v.string(), "tokens": v.string(), "updatedAt": v.string(), "userId": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_unique_handleHash", ["handleHash"])
.index("by_userId", ["userId"])
.index("by_absoluteExpiresAt", ["absoluteExpiresAt"]),
"conusai_idempotency": defineTable(v.object({ "createdAt": v.string(), "key": v.string(), "response": v.string() }))
.index("by_key", ["key"]),
"conusai_jobs": defineTable(v.object({ "attempt": v.number(), "correlationId": v.string(), "createdAt": v.string(), "dedup": v.optional(v.string()), "id": v.string(), "job": v.string(), "lastError": v.optional(v.string()), "leaseUntil": v.optional(v.string()), "onBehalfOf": v.union(v.string(), v.null()), "orgId": v.string(), "payload": v.any(), "projectId": v.optional(v.string()), "retryLimit": v.number(), "runAt": v.string(), "status": v.string(), "workspaceId": v.optional(v.string()) }))
.index("by_app_id", ["id"])
.index("by_dedup", ["dedup"])
.index("by_status_run", ["status", "runAt"]),
"conusai_live_head": defineTable(v.object({ "orgId": v.string(), "prunedThrough": v.number(), "txid": v.number() }))
.index("by_org", ["orgId"]),
"conusai_live_log": defineTable(v.object({ "at": v.number(), "entity": v.string(), "op": v.union(v.literal("u"), v.literal("d")), "orgId": v.string(), "projectId": v.optional(v.string()), "rowId": v.string(), "seq": v.number(), "txid": v.number(), "version": v.union(v.number(), v.null()), "workspaceId": v.optional(v.string()) }))
.index("by_org_position", ["orgId", "txid", "seq"])
.index("by_at", ["at"]),
"conusai_outbox": defineTable(v.object({ "attempts": v.number(), "createdAt": v.string(), "deferrals": v.number(), "deferredSince": v.optional(v.string()), "deferredUntil": v.optional(v.string()), "delivered": v.optional(v.array(v.string())), "dueAt": v.optional(v.string()), "id": v.string(), "lastError": v.optional(v.string()), "name": v.string(), "orgId": v.string(), "payload": v.any(), "publishedAt": v.optional(v.string()), "state": v.optional(v.union(v.literal("pending"), v.literal("published"), v.literal("stuck"))) }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_due", ["state", "dueAt"]),
"extensions": defineTable(v.object({ "createdAt": v.string(), "id": v.string(), "namespace": v.string(), "orgId": v.string(), "payload": v.record(v.string(), v.any()), "payloadVersion": v.number(), "subjectId": v.string(), "subjectType": v.string(), "updatedAt": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_subjectType_subjectId_namespace", ["orgId", "subjectType", "subjectId", "namespace"])
.index("by_namespace", ["orgId", "namespace"]),
"files_file": defineTable(v.object({ "contentType": v.string(), "createdAt": v.string(), "declaredSize": v.union(v.number(), v.null()), "deletingAt": v.union(v.string(), v.null()), "filename": v.string(), "id": v.string(), "orgId": v.string(), "partSize": v.union(v.number(), v.null()), "projectId": v.string(), "sha256": v.union(v.string(), v.null()), "size": v.union(v.number(), v.null()), "status": v.union(v.literal("pending"), v.literal("stored"), v.literal("deleting")), "storageKey": v.string(), "storedAt": v.union(v.string(), v.null()), "updatedAt": v.string(), "uploadId": v.union(v.string(), v.null()), "uploadedBy": v.string(), "version": v.number(), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org_project", ["orgId", "workspaceId", "projectId"])
.index("by_unique_storageKey", ["orgId", "workspaceId", "projectId", "storageKey"])
.index("by_status", ["orgId", "workspaceId", "projectId", "status"])
.index("by_sha256", ["orgId", "workspaceId", "projectId", "sha256"]),
"invitations": defineTable(v.object({ "acceptedAt": v.union(v.string(), v.null()), "createdAt": v.string(), "email": v.string(), "expiresAt": v.string(), "id": v.string(), "invitedBy": v.string(), "orgId": v.string(), "revokedAt": v.optional(v.union(v.string(), v.null())), "role": v.union(v.literal("viewer"), v.literal("member"), v.literal("admin"), v.literal("owner")), "roleKey": v.optional(v.union(v.string(), v.null())), "tokenHash": v.string(), "updatedAt": v.string(), "version": v.number(), "workspaceId": v.union(v.string(), v.null()), "workspaceRole": v.union(v.union(v.literal("viewer"), v.literal("editor"), v.literal("admin")), v.null()) }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_tokenHash", ["orgId", "tokenHash"])
.index("by_email", ["orgId", "email"])
.index("by_acceptedAt", ["orgId", "acceptedAt"])
.index("by_roleKey", ["orgId", "roleKey"]),
"notes_attachment": defineTable(v.object({ "attachedBy": v.string(), "createdAt": v.string(), "fileId": v.string(), "id": v.string(), "noteId": v.string(), "orgId": v.string(), "projectId": v.string(), "updatedAt": v.string(), "version": v.number(), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org_project", ["orgId", "workspaceId", "projectId"])
.index("by_unique_noteId_fileId", ["orgId", "workspaceId", "projectId", "noteId", "fileId"])
.index("by_noteId", ["orgId", "workspaceId", "projectId", "noteId"])
.index("by_fileId", ["orgId", "workspaceId", "projectId", "fileId"]),
"notes_note": defineTable(v.object({ "body": v.string(), "createdAt": v.string(), "createdBy": v.string(), "id": v.string(), "orgId": v.string(), "projectId": v.string(), "title": v.string(), "updatedAt": v.string(), "version": v.number(), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org_project", ["orgId", "workspaceId", "projectId"])
.index("by_createdBy", ["orgId", "workspaceId", "projectId", "createdBy"]),
"notifications_inbox": defineTable(v.object({ "category": v.union(v.literal("invitation"), v.literal("job"), v.literal("notice")), "code": v.union(v.literal("organization_ready"), v.literal("member_joined"), v.literal("access_changed"), v.literal("invitation_accepted"), v.literal("job_completed"), v.literal("job_failed"), v.literal("custom")), "createdAt": v.string(), "description": v.union(v.string(), v.null()), "expiresAt": v.string(), "href": v.union(v.string(), v.null()), "id": v.string(), "key": v.string(), "orgId": v.string(), "readAt": v.union(v.string(), v.null()), "recipientId": v.string(), "title": v.union(v.string(), v.null()), "updatedAt": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_recipientId_key", ["orgId", "recipientId", "key"])
.index("by_recipientId", ["orgId", "recipientId"])
.index("by_recipientId_readAt", ["orgId", "recipientId", "readAt"])
.index("by_expiresAt", ["orgId", "expiresAt"]),
"org_memberships": defineTable(v.object({ "createdAt": v.string(), "id": v.string(), "orgId": v.string(), "role": v.union(v.literal("viewer"), v.literal("member"), v.literal("admin"), v.literal("owner")), "roleKey": v.optional(v.union(v.string(), v.null())), "updatedAt": v.string(), "userId": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_userId", ["orgId", "userId"])
.index("by_role", ["orgId", "role"])
.index("by_roleKey", ["orgId", "roleKey"]),
"organizations": defineTable(v.object({ "branding": v.union(v.object({ "accent": v.optional(v.string()), "displayName": v.optional(v.string()), "logoDark": v.optional(v.string()), "logoLight": v.optional(v.string()), "primary": v.optional(v.string()) }), v.null()), "createdAt": v.string(), "id": v.string(), "name": v.string(), "settings": v.record(v.string(), v.any()), "slug": v.string(), "status": v.union(v.literal("active"), v.literal("suspended")), "updatedAt": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_unique_slug", ["slug"])
.index("by_status", ["status"]),
"project_memberships": defineTable(v.object({ "createdAt": v.string(), "id": v.string(), "orgId": v.string(), "projectId": v.string(), "roleKey": v.string(), "updatedAt": v.string(), "userId": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_projectId_userId", ["orgId", "projectId", "userId"])
.index("by_userId", ["orgId", "userId"])
.index("by_roleKey", ["orgId", "roleKey"]),
"projects": defineTable(v.object({ "archivedAt": v.union(v.string(), v.null()), "createdAt": v.string(), "description": v.optional(v.union(v.string(), v.null())), "id": v.string(), "moduleKey": v.string(), "name": v.string(), "orgId": v.string(), "slug": v.string(), "updatedAt": v.string(), "version": v.number(), "visibility": v.optional(v.union(v.literal("workspace"), v.literal("restricted"))), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org_workspace", ["orgId", "workspaceId"])
.index("by_unique_slug", ["orgId", "workspaceId", "slug"])
.index("by_archivedAt", ["orgId", "workspaceId", "archivedAt"]),
"proposals": defineTable(v.object({ "change": v.record(v.string(), v.any()), "createdAt": v.string(), "createdBy": v.string(), "decidedAt": v.union(v.string(), v.null()), "decidedBy": v.union(v.string(), v.null()), "editedAt": v.union(v.string(), v.null()), "editedBy": v.union(v.string(), v.null()), "evidence": v.array(v.object({ "blockId": v.optional(v.string()), "box": v.optional(v.object({ "height": v.number(), "width": v.number(), "x": v.number(), "y": v.number() })), "fileId": v.string(), "page": v.optional(v.number()), "quote": v.optional(v.string()) })), "id": v.string(), "model": v.string(), "orgId": v.string(), "projectId": v.string(), "promptVersion": v.string(), "reason": v.union(v.string(), v.null()), "status": v.union(v.literal("pending"), v.literal("approved"), v.literal("rejected")), "targetKey": v.string(), "targetRecordId": v.union(v.string(), v.null()), "updatedAt": v.string(), "version": v.number(), "workspaceId": v.string(), "writtenRecordId": v.union(v.string(), v.null()) }))
.index("by_app_id", ["id"])
.index("by_org_project", ["orgId", "workspaceId", "projectId"])
.index("by_status", ["orgId", "workspaceId", "projectId", "status"])
.index("by_targetKey_targetRecordId", ["orgId", "workspaceId", "projectId", "targetKey", "targetRecordId"]),
"tenancy_roles": defineTable(v.object({ "createdAt": v.string(), "createdBy": v.union(v.string(), v.null()), "id": v.string(), "key": v.string(), "knownPermissions": v.array(v.string()), "level": v.union(v.literal("org"), v.literal("workspace"), v.literal("project")), "name": v.string(), "orgId": v.string(), "permissions": v.array(v.string()), "revision": v.number(), "updatedAt": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_key", ["orgId", "key"]),
"users": defineTable(v.object({ "createdAt": v.string(), "displayName": v.string(), "email": v.string(), "id": v.string(), "issuer": v.string(), "locale": v.string(), "subject": v.string(), "updatedAt": v.string(), "version": v.number() }))
.index("by_app_id", ["id"])
.index("by_unique_issuer_subject", ["issuer", "subject"])
.index("by_email", ["email"]),
"workspace_memberships": defineTable(v.object({ "createdAt": v.string(), "id": v.string(), "orgId": v.string(), "role": v.union(v.literal("viewer"), v.literal("editor"), v.literal("admin")), "roleKey": v.optional(v.union(v.string(), v.null())), "updatedAt": v.string(), "userId": v.string(), "version": v.number(), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_workspaceId_userId", ["orgId", "workspaceId", "userId"])
.index("by_userId", ["orgId", "userId"])
.index("by_roleKey", ["orgId", "roleKey"]),
"workspaces": defineTable(v.object({ "createdAt": v.string(), "id": v.string(), "isDefault": v.boolean(), "name": v.string(), "orgId": v.string(), "slug": v.string(), "updatedAt": v.string(), "version": v.number(), "visibility": v.union(v.literal("org"), v.literal("restricted")) }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"])
.index("by_unique_slug", ["orgId", "slug"]),
});