Files
template-app/convex/schema.ts
T

109 lines
14 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(), "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("completed")), "steps": v.union(v.array(v.union(v.literal("credentials"), v.literal("service-sessions"), v.literal("provider-account"), v.literal("identity"))), 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_outbox": defineTable(v.object({ "attempts": v.number(), "createdAt": v.string(), "deferrals": v.number(), "deferredSince": v.optional(v.string()), "deferredUntil": 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()) }))
.index("by_app_id", ["id"])
.index("by_org", ["orgId"]),
"documents_document": defineTable(v.object({ "createdAt": v.string(), "failureCode": v.union(v.union(v.literal("file_missing"), v.literal("file_changed"), v.literal("ocr_failed"), v.literal("extraction_refused"), v.literal("extraction_truncated"), v.literal("extraction_invalid")), v.null()), "fileId": v.string(), "filename": v.string(), "finishedAt": v.union(v.string(), v.null()), "id": v.string(), "ocrJobId": v.union(v.number(), v.null()), "orgId": v.string(), "pageCount": v.union(v.number(), v.null()), "projectId": v.string(), "proposedCount": v.union(v.number(), v.null()), "skippedPages": v.union(v.array(v.object({ "page": v.number(), "pageClass": v.union(v.literal("text"), v.literal("table"), v.literal("drawing"), v.literal("scan"), v.literal("empty")) })), v.null()), "status": v.union(v.literal("processing"), v.literal("extracted"), v.literal("failed")), "updatedAt": v.string(), "version": v.number(), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org_project", ["orgId", "workspaceId", "projectId"])
.index("by_unique_fileId", ["orgId", "workspaceId", "projectId", "fileId"])
.index("by_status", ["orgId", "workspaceId", "projectId", "status"]),
"documents_line": defineTable(v.object({ "approvedBy": v.string(), "createdAt": v.string(), "documentId": v.string(), "edited": v.boolean(), "id": v.string(), "label": v.string(), "orgId": v.string(), "page": v.number(), "position": v.number(), "projectId": v.string(), "proposalId": v.string(), "quote": v.string(), "updatedAt": v.string(), "value": v.string(), "version": v.number(), "workspaceId": v.string() }))
.index("by_app_id", ["id"])
.index("by_org_project", ["orgId", "workspaceId", "projectId"])
.index("by_unique_proposalId", ["orgId", "workspaceId", "projectId", "proposalId"])
.index("by_documentId", ["orgId", "workspaceId", "projectId", "documentId"]),
"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(), "role": v.union(v.literal("viewer"), v.literal("member"), v.literal("admin"), v.literal("owner")), "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"]),
"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"]),
"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")), "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"]),
"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"]),
"projects": defineTable(v.object({ "archivedAt": v.union(v.string(), v.null()), "createdAt": v.string(), "id": v.string(), "moduleKey": v.string(), "name": v.string(), "orgId": v.string(), "slug": v.string(), "updatedAt": v.string(), "version": v.number(), "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"]),
"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")), "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"]),
"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"]),
});