happy2 0.0.5
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/README.md +82 -0
- package/package.json +74 -0
- package/packages/happy2-server/Dockerfile +18 -0
- package/packages/happy2-server/README.md +418 -0
- package/packages/happy2-server/bin/happy2.js +3 -0
- package/packages/happy2-server/dist/cli.d.ts +3 -0
- package/packages/happy2-server/dist/cli.d.ts.map +1 -0
- package/packages/happy2-server/dist/cli.js +44 -0
- package/packages/happy2-server/dist/cli.js.map +1 -0
- package/packages/happy2-server/dist/index.d.ts +24 -0
- package/packages/happy2-server/dist/index.d.ts.map +1 -0
- package/packages/happy2-server/dist/index.js +22 -0
- package/packages/happy2-server/dist/index.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/builtin-images.d.ts +8 -0
- package/packages/happy2-server/dist/modules/agents/builtin-images.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/builtin-images.js +283 -0
- package/packages/happy2-server/dist/modules/agents/builtin-images.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/command.d.ts +3 -0
- package/packages/happy2-server/dist/modules/agents/command.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/command.js +7 -0
- package/packages/happy2-server/dist/modules/agents/command.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/daemon.d.ts +106 -0
- package/packages/happy2-server/dist/modules/agents/daemon.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/daemon.js +522 -0
- package/packages/happy2-server/dist/modules/agents/daemon.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/docker.d.ts +51 -0
- package/packages/happy2-server/dist/modules/agents/docker.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/docker.js +256 -0
- package/packages/happy2-server/dist/modules/agents/docker.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/docker.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/agents/docker.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/docker.test.js +155 -0
- package/packages/happy2-server/dist/modules/agents/docker.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/index.d.ts +5 -0
- package/packages/happy2-server/dist/modules/agents/index.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/index.js +4 -0
- package/packages/happy2-server/dist/modules/agents/index.js.map +1 -0
- package/packages/happy2-server/dist/modules/agents/service.d.ts +140 -0
- package/packages/happy2-server/dist/modules/agents/service.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agents/service.js +1283 -0
- package/packages/happy2-server/dist/modules/agents/service.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/cloudflare-access.d.ts +15 -0
- package/packages/happy2-server/dist/modules/auth/cloudflare-access.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/cloudflare-access.js +49 -0
- package/packages/happy2-server/dist/modules/auth/cloudflare-access.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/crypto.d.ts +4 -0
- package/packages/happy2-server/dist/modules/auth/crypto.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/crypto.js +31 -0
- package/packages/happy2-server/dist/modules/auth/crypto.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/crypto.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/auth/crypto.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/crypto.test.js +11 -0
- package/packages/happy2-server/dist/modules/auth/crypto.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/email.d.ts +3 -0
- package/packages/happy2-server/dist/modules/auth/email.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/email.js +22 -0
- package/packages/happy2-server/dist/modules/auth/email.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/metadata.d.ts +5 -0
- package/packages/happy2-server/dist/modules/auth/metadata.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/metadata.js +28 -0
- package/packages/happy2-server/dist/modules/auth/metadata.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/metadata.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/auth/metadata.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/metadata.test.js +10 -0
- package/packages/happy2-server/dist/modules/auth/metadata.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/methods.d.ts +10 -0
- package/packages/happy2-server/dist/modules/auth/methods.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/methods.js +21 -0
- package/packages/happy2-server/dist/modules/auth/methods.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/methods.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/auth/methods.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/methods.test.js +16 -0
- package/packages/happy2-server/dist/modules/auth/methods.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/oidc.d.ts +9 -0
- package/packages/happy2-server/dist/modules/auth/oidc.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/oidc.js +68 -0
- package/packages/happy2-server/dist/modules/auth/oidc.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/service.d.ts +44 -0
- package/packages/happy2-server/dist/modules/auth/service.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/service.js +208 -0
- package/packages/happy2-server/dist/modules/auth/service.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/tokens.d.ts +21 -0
- package/packages/happy2-server/dist/modules/auth/tokens.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/tokens.js +79 -0
- package/packages/happy2-server/dist/modules/auth/tokens.js.map +1 -0
- package/packages/happy2-server/dist/modules/automation/repository.d.ts +127 -0
- package/packages/happy2-server/dist/modules/automation/repository.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/automation/repository.js +821 -0
- package/packages/happy2-server/dist/modules/automation/repository.js.map +1 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.d.ts +839 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.js +5795 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.js.map +1 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.test.js +620 -0
- package/packages/happy2-server/dist/modules/collaboration/repository.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/collaboration/types.d.ts +243 -0
- package/packages/happy2-server/dist/modules/collaboration/types.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/collaboration/types.js +8 -0
- package/packages/happy2-server/dist/modules/collaboration/types.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/defaults.d.ts +8 -0
- package/packages/happy2-server/dist/modules/config/defaults.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/defaults.js +70 -0
- package/packages/happy2-server/dist/modules/config/defaults.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/defaults.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/config/defaults.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/defaults.test.js +27 -0
- package/packages/happy2-server/dist/modules/config/defaults.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/environment.d.ts +4 -0
- package/packages/happy2-server/dist/modules/config/environment.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/environment.js +92 -0
- package/packages/happy2-server/dist/modules/config/environment.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/loader.d.ts +5 -0
- package/packages/happy2-server/dist/modules/config/loader.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/loader.js +251 -0
- package/packages/happy2-server/dist/modules/config/loader.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/loader.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/config/loader.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/loader.test.js +108 -0
- package/packages/happy2-server/dist/modules/config/loader.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/paths.d.ts +7 -0
- package/packages/happy2-server/dist/modules/config/paths.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/paths.js +15 -0
- package/packages/happy2-server/dist/modules/config/paths.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/paths.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/config/paths.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/paths.test.js +22 -0
- package/packages/happy2-server/dist/modules/config/paths.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/runtime.d.ts +6 -0
- package/packages/happy2-server/dist/modules/config/runtime.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/runtime.js +14 -0
- package/packages/happy2-server/dist/modules/config/runtime.js.map +1 -0
- package/packages/happy2-server/dist/modules/config/type.d.ts +88 -0
- package/packages/happy2-server/dist/modules/config/type.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/config/type.js +2 -0
- package/packages/happy2-server/dist/modules/config/type.js.map +1 -0
- package/packages/happy2-server/dist/modules/database.d.ts +105 -0
- package/packages/happy2-server/dist/modules/database.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/database.js +583 -0
- package/packages/happy2-server/dist/modules/database.js.map +1 -0
- package/packages/happy2-server/dist/modules/drizzle.d.ts +11 -0
- package/packages/happy2-server/dist/modules/drizzle.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/drizzle.js +31 -0
- package/packages/happy2-server/dist/modules/drizzle.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/lock.d.ts +3 -0
- package/packages/happy2-server/dist/modules/files/lock.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/lock.js +83 -0
- package/packages/happy2-server/dist/modules/files/lock.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/media.d.ts +18 -0
- package/packages/happy2-server/dist/modules/files/media.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/media.js +352 -0
- package/packages/happy2-server/dist/modules/files/media.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/provider.d.ts +130 -0
- package/packages/happy2-server/dist/modules/files/provider.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/provider.js +448 -0
- package/packages/happy2-server/dist/modules/files/provider.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/quota.d.ts +58 -0
- package/packages/happy2-server/dist/modules/files/quota.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/quota.js +180 -0
- package/packages/happy2-server/dist/modules/files/quota.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/routes.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/files/routes.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/routes.test.js +163 -0
- package/packages/happy2-server/dist/modules/files/routes.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/scanner.d.ts +27 -0
- package/packages/happy2-server/dist/modules/files/scanner.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/scanner.js +66 -0
- package/packages/happy2-server/dist/modules/files/scanner.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/storage.d.ts +95 -0
- package/packages/happy2-server/dist/modules/files/storage.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/storage.js +855 -0
- package/packages/happy2-server/dist/modules/files/storage.js.map +1 -0
- package/packages/happy2-server/dist/modules/files/storage.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/files/storage.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/files/storage.test.js +170 -0
- package/packages/happy2-server/dist/modules/files/storage.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/index.d.ts +6 -0
- package/packages/happy2-server/dist/modules/integrations/index.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/index.js +6 -0
- package/packages/happy2-server/dist/modules/integrations/index.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/repository.d.ts +136 -0
- package/packages/happy2-server/dist/modules/integrations/repository.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/repository.js +1229 -0
- package/packages/happy2-server/dist/modules/integrations/repository.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/repository.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/integrations/repository.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/repository.test.js +345 -0
- package/packages/happy2-server/dist/modules/integrations/repository.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/routes.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/integrations/routes.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/routes.test.js +161 -0
- package/packages/happy2-server/dist/modules/integrations/routes.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/secrets.d.ts +19 -0
- package/packages/happy2-server/dist/modules/integrations/secrets.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/secrets.js +69 -0
- package/packages/happy2-server/dist/modules/integrations/secrets.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.d.ts +32 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.js +185 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.test.js +56 -0
- package/packages/happy2-server/dist/modules/integrations/ssrf.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/transport.d.ts +21 -0
- package/packages/happy2-server/dist/modules/integrations/transport.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/transport.js +108 -0
- package/packages/happy2-server/dist/modules/integrations/transport.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/transport.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/integrations/transport.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/transport.test.js +66 -0
- package/packages/happy2-server/dist/modules/integrations/transport.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/types.d.ts +155 -0
- package/packages/happy2-server/dist/modules/integrations/types.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/integrations/types.js +26 -0
- package/packages/happy2-server/dist/modules/integrations/types.js.map +1 -0
- package/packages/happy2-server/dist/modules/operations/export-worker.d.ts +16 -0
- package/packages/happy2-server/dist/modules/operations/export-worker.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/operations/export-worker.js +56 -0
- package/packages/happy2-server/dist/modules/operations/export-worker.js.map +1 -0
- package/packages/happy2-server/dist/modules/operations/repository.d.ts +215 -0
- package/packages/happy2-server/dist/modules/operations/repository.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/operations/repository.js +2011 -0
- package/packages/happy2-server/dist/modules/operations/repository.js.map +1 -0
- package/packages/happy2-server/dist/modules/operations/repository.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/operations/repository.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/operations/repository.test.js +610 -0
- package/packages/happy2-server/dist/modules/operations/repository.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/operations/types.d.ts +144 -0
- package/packages/happy2-server/dist/modules/operations/types.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/operations/types.js +9 -0
- package/packages/happy2-server/dist/modules/operations/types.js.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/events.d.ts +99 -0
- package/packages/happy2-server/dist/modules/realtime/events.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/events.js +173 -0
- package/packages/happy2-server/dist/modules/realtime/events.js.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/index.d.ts +4 -0
- package/packages/happy2-server/dist/modules/realtime/index.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/index.js +4 -0
- package/packages/happy2-server/dist/modules/realtime/index.js.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/local.d.ts +37 -0
- package/packages/happy2-server/dist/modules/realtime/local.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/local.js +181 -0
- package/packages/happy2-server/dist/modules/realtime/local.js.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/local.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/realtime/local.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/local.test.js +186 -0
- package/packages/happy2-server/dist/modules/realtime/local.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/pubsub.d.ts +26 -0
- package/packages/happy2-server/dist/modules/realtime/pubsub.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/realtime/pubsub.js +7 -0
- package/packages/happy2-server/dist/modules/realtime/pubsub.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/database-idempotency.d.ts +15 -0
- package/packages/happy2-server/dist/modules/request/database-idempotency.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/database-idempotency.js +141 -0
- package/packages/happy2-server/dist/modules/request/database-idempotency.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/idempotency-hook.d.ts +12 -0
- package/packages/happy2-server/dist/modules/request/idempotency-hook.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/idempotency-hook.js +98 -0
- package/packages/happy2-server/dist/modules/request/idempotency-hook.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/idempotency.d.ts +146 -0
- package/packages/happy2-server/dist/modules/request/idempotency.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/idempotency.js +312 -0
- package/packages/happy2-server/dist/modules/request/idempotency.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/idempotency.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/request/idempotency.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/idempotency.test.js +191 -0
- package/packages/happy2-server/dist/modules/request/idempotency.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/index.d.ts +5 -0
- package/packages/happy2-server/dist/modules/request/index.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/index.js +5 -0
- package/packages/happy2-server/dist/modules/request/index.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.d.ts +100 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.js +239 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.js.map +1 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.test.js +123 -0
- package/packages/happy2-server/dist/modules/request/rate-limit.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/schema.d.ts +31454 -0
- package/packages/happy2-server/dist/modules/schema.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/schema.js +1081 -0
- package/packages/happy2-server/dist/modules/schema.js.map +1 -0
- package/packages/happy2-server/dist/modules/workspace/index.d.ts +3 -0
- package/packages/happy2-server/dist/modules/workspace/index.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/workspace/index.js +3 -0
- package/packages/happy2-server/dist/modules/workspace/index.js.map +1 -0
- package/packages/happy2-server/dist/modules/workspace/service.d.ts +54 -0
- package/packages/happy2-server/dist/modules/workspace/service.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/workspace/service.js +997 -0
- package/packages/happy2-server/dist/modules/workspace/service.js.map +1 -0
- package/packages/happy2-server/dist/modules/workspace/types.d.ts +58 -0
- package/packages/happy2-server/dist/modules/workspace/types.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/workspace/types.js +11 -0
- package/packages/happy2-server/dist/modules/workspace/types.js.map +1 -0
- package/packages/happy2-server/dist/routes/agents.d.ts +5 -0
- package/packages/happy2-server/dist/routes/agents.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/agents.js +225 -0
- package/packages/happy2-server/dist/routes/agents.js.map +1 -0
- package/packages/happy2-server/dist/routes/auth.d.ts +5 -0
- package/packages/happy2-server/dist/routes/auth.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/auth.js +128 -0
- package/packages/happy2-server/dist/routes/auth.js.map +1 -0
- package/packages/happy2-server/dist/routes/automation.d.ts +6 -0
- package/packages/happy2-server/dist/routes/automation.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/automation.js +315 -0
- package/packages/happy2-server/dist/routes/automation.js.map +1 -0
- package/packages/happy2-server/dist/routes/basic.d.ts +3 -0
- package/packages/happy2-server/dist/routes/basic.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/basic.js +5 -0
- package/packages/happy2-server/dist/routes/basic.js.map +1 -0
- package/packages/happy2-server/dist/routes/collaboration.d.ts +7 -0
- package/packages/happy2-server/dist/routes/collaboration.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/collaboration.js +1285 -0
- package/packages/happy2-server/dist/routes/collaboration.js.map +1 -0
- package/packages/happy2-server/dist/routes/files.d.ts +9 -0
- package/packages/happy2-server/dist/routes/files.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/files.js +397 -0
- package/packages/happy2-server/dist/routes/files.js.map +1 -0
- package/packages/happy2-server/dist/routes/integrations.d.ts +6 -0
- package/packages/happy2-server/dist/routes/integrations.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/integrations.js +486 -0
- package/packages/happy2-server/dist/routes/integrations.js.map +1 -0
- package/packages/happy2-server/dist/routes/operations.d.ts +5 -0
- package/packages/happy2-server/dist/routes/operations.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/operations.js +588 -0
- package/packages/happy2-server/dist/routes/operations.js.map +1 -0
- package/packages/happy2-server/dist/routes/operations.test.d.ts +2 -0
- package/packages/happy2-server/dist/routes/operations.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/operations.test.js +106 -0
- package/packages/happy2-server/dist/routes/operations.test.js.map +1 -0
- package/packages/happy2-server/dist/routes/sync.d.ts +6 -0
- package/packages/happy2-server/dist/routes/sync.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/sync.js +549 -0
- package/packages/happy2-server/dist/routes/sync.js.map +1 -0
- package/packages/happy2-server/dist/routes/workspace.d.ts +5 -0
- package/packages/happy2-server/dist/routes/workspace.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/workspace.js +240 -0
- package/packages/happy2-server/dist/routes/workspace.js.map +1 -0
- package/packages/happy2-server/dist/runner.d.ts +3 -0
- package/packages/happy2-server/dist/runner.d.ts.map +1 -0
- package/packages/happy2-server/dist/runner.js +30 -0
- package/packages/happy2-server/dist/runner.js.map +1 -0
- package/packages/happy2-server/dist/server.d.ts +32 -0
- package/packages/happy2-server/dist/server.d.ts.map +1 -0
- package/packages/happy2-server/dist/server.js +284 -0
- package/packages/happy2-server/dist/server.js.map +1 -0
- package/packages/happy2-server/dist/standalone.d.ts +13 -0
- package/packages/happy2-server/dist/standalone.d.ts.map +1 -0
- package/packages/happy2-server/dist/standalone.js +99 -0
- package/packages/happy2-server/dist/standalone.js.map +1 -0
- package/packages/happy2-server/dist/web/assets/figtree-latin-wght-normal-D_ZTVpCC.woff2 +0 -0
- package/packages/happy2-server/dist/web/assets/happy-otter-Q2O_g-DT.png +0 -0
- package/packages/happy2-server/dist/web/assets/index-COvbX8JP.css +2 -0
- package/packages/happy2-server/dist/web/assets/index-DdpugxMO.js +57 -0
- package/packages/happy2-server/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/packages/happy2-server/dist/web/assets/onboarding-CRUpq9xl.png +0 -0
- package/packages/happy2-server/dist/web/index.html +13 -0
- package/packages/happy2-server/drizzle/0000_initial.sql +13 -0
- package/packages/happy2-server/drizzle/0001_accounts_profiles_files.sql +42 -0
- package/packages/happy2-server/drizzle/0002_file_visibility_and_uploader.sql +5 -0
- package/packages/happy2-server/drizzle/0003_collaboration.sql +565 -0
- package/packages/happy2-server/drizzle/0004_collaboration_expansion.sql +1099 -0
- package/packages/happy2-server/drizzle/0005_ai_agents.sql +85 -0
- package/packages/happy2-server/drizzle/0006_rig_global_event_queue.sql +10 -0
- package/packages/happy2-server/drizzle/0007_rename_server_identity.sql +3 -0
- package/packages/happy2-server/drizzle/0008_agent_message_streaming.sql +47 -0
- package/packages/happy2-server/drizzle/0009_chat_workspace_binding_lookup.sql +2 -0
- package/packages/happy2-server/drizzle/0010_rig_secret_assignments.sql +21 -0
- package/packages/happy2-server/drizzle/meta/_journal.json +83 -0
- package/packages/happy2-server/happy2.example.toml +104 -0
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { integer, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
3
|
+
// Generated from the fully migrated SQLite schema. Migrations remain the DDL authority.
|
|
4
|
+
export const accountBans = sqliteTable("account_bans", {
|
|
5
|
+
id: text("id").primaryKey().notNull(),
|
|
6
|
+
accountId: text("account_id").notNull(),
|
|
7
|
+
bannedByUserId: text("banned_by_user_id"),
|
|
8
|
+
reason: text("reason"),
|
|
9
|
+
bannedAt: text("banned_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
10
|
+
expiresAt: text("expires_at"),
|
|
11
|
+
revokedAt: text("revoked_at"),
|
|
12
|
+
revokedByUserId: text("revoked_by_user_id"),
|
|
13
|
+
revokeReason: text("revoke_reason"),
|
|
14
|
+
});
|
|
15
|
+
export const accounts = sqliteTable("accounts", {
|
|
16
|
+
id: text("id").primaryKey().notNull(),
|
|
17
|
+
email: text("email").notNull(),
|
|
18
|
+
passwordHash: text("password_hash"),
|
|
19
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
20
|
+
active: integer("active").notNull().default(0),
|
|
21
|
+
bannedAt: text("banned_at"),
|
|
22
|
+
deletedAt: text("deleted_at"),
|
|
23
|
+
banExpiresAt: text("ban_expires_at"),
|
|
24
|
+
banReason: text("ban_reason"),
|
|
25
|
+
bannedByUserId: text("banned_by_user_id"),
|
|
26
|
+
});
|
|
27
|
+
export const apiCredentials = sqliteTable("api_credentials", {
|
|
28
|
+
id: text("id").primaryKey().notNull(),
|
|
29
|
+
integrationId: text("integration_id"),
|
|
30
|
+
userId: text("user_id"),
|
|
31
|
+
botId: text("bot_id"),
|
|
32
|
+
name: text("name").notNull(),
|
|
33
|
+
tokenPrefix: text("token_prefix").notNull(),
|
|
34
|
+
tokenHash: text("token_hash").notNull(),
|
|
35
|
+
scopesJson: text("scopes_json").notNull().default("[]"),
|
|
36
|
+
createdByUserId: text("created_by_user_id"),
|
|
37
|
+
expiresAt: text("expires_at"),
|
|
38
|
+
lastUsedAt: text("last_used_at"),
|
|
39
|
+
revokedAt: text("revoked_at"),
|
|
40
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
41
|
+
});
|
|
42
|
+
export const auditLogEntries = sqliteTable("audit_log_entries", {
|
|
43
|
+
id: text("id").primaryKey().notNull(),
|
|
44
|
+
actorUserId: text("actor_user_id"),
|
|
45
|
+
actorIntegrationId: text("actor_integration_id"),
|
|
46
|
+
action: text("action").notNull(),
|
|
47
|
+
targetType: text("target_type").notNull(),
|
|
48
|
+
targetId: text("target_id"),
|
|
49
|
+
chatId: text("chat_id"),
|
|
50
|
+
beforeJson: text("before_json"),
|
|
51
|
+
afterJson: text("after_json"),
|
|
52
|
+
metadataJson: text("metadata_json"),
|
|
53
|
+
clientIp: text("client_ip"),
|
|
54
|
+
device: text("device"),
|
|
55
|
+
appVersion: text("app_version"),
|
|
56
|
+
userAgent: text("user_agent"),
|
|
57
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
58
|
+
});
|
|
59
|
+
export const authMagicLinks = sqliteTable("auth_magic_links", {
|
|
60
|
+
tokenHash: text("token_hash").primaryKey().notNull(),
|
|
61
|
+
accountId: text("account_id").notNull(),
|
|
62
|
+
expiresAt: text("expires_at").notNull(),
|
|
63
|
+
consumedAt: text("consumed_at"),
|
|
64
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
65
|
+
});
|
|
66
|
+
export const authOidcStates = sqliteTable("auth_oidc_states", {
|
|
67
|
+
state: text("state").primaryKey().notNull(),
|
|
68
|
+
provider: text("provider").notNull(),
|
|
69
|
+
codeVerifier: text("code_verifier").notNull(),
|
|
70
|
+
nonce: text("nonce").notNull(),
|
|
71
|
+
redirectUri: text("redirect_uri").notNull(),
|
|
72
|
+
expiresAt: text("expires_at").notNull(),
|
|
73
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
74
|
+
});
|
|
75
|
+
export const authSessionEvents = sqliteTable("auth_session_events", {
|
|
76
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
77
|
+
sessionId: text("session_id").notNull(),
|
|
78
|
+
eventType: text("event_type").notNull(),
|
|
79
|
+
ip: text("ip"),
|
|
80
|
+
forwardedFor: text("forwarded_for"),
|
|
81
|
+
location: text("location"),
|
|
82
|
+
device: text("device"),
|
|
83
|
+
appVersion: text("app_version"),
|
|
84
|
+
userAgent: text("user_agent"),
|
|
85
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
86
|
+
});
|
|
87
|
+
export const authSessions = sqliteTable("auth_sessions", {
|
|
88
|
+
id: text("id").primaryKey().notNull(),
|
|
89
|
+
accountId: text("account_id").notNull(),
|
|
90
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
91
|
+
expiresAt: text("expires_at").notNull(),
|
|
92
|
+
lastSeenAt: text("last_seen_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
93
|
+
revokedAt: text("revoked_at"),
|
|
94
|
+
});
|
|
95
|
+
export const automationRuns = sqliteTable("automation_runs", {
|
|
96
|
+
id: text("id").primaryKey().notNull(),
|
|
97
|
+
automationId: text("automation_id").notNull(),
|
|
98
|
+
triggerEventId: text("trigger_event_id"),
|
|
99
|
+
scheduledFor: text("scheduled_for"),
|
|
100
|
+
status: text("status").notNull().default("pending"),
|
|
101
|
+
attempts: integer("attempts").notNull().default(0),
|
|
102
|
+
inputJson: text("input_json"),
|
|
103
|
+
resultJson: text("result_json"),
|
|
104
|
+
lastError: text("last_error"),
|
|
105
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
106
|
+
startedAt: text("started_at"),
|
|
107
|
+
completedAt: text("completed_at"),
|
|
108
|
+
});
|
|
109
|
+
export const automations = sqliteTable("automations", {
|
|
110
|
+
id: text("id").primaryKey().notNull(),
|
|
111
|
+
name: text("name").notNull(),
|
|
112
|
+
createdByUserId: text("created_by_user_id"),
|
|
113
|
+
botId: text("bot_id"),
|
|
114
|
+
chatId: text("chat_id"),
|
|
115
|
+
triggerType: text("trigger_type").notNull(),
|
|
116
|
+
triggerConfigJson: text("trigger_config_json").notNull().default("{}"),
|
|
117
|
+
actionType: text("action_type").notNull().default("send_message"),
|
|
118
|
+
actionConfigJson: text("action_config_json").notNull().default("{}"),
|
|
119
|
+
timezone: text("timezone"),
|
|
120
|
+
nextRunAt: text("next_run_at"),
|
|
121
|
+
active: integer("active").notNull().default(1),
|
|
122
|
+
createdSequence: integer("created_sequence").notNull().default(0),
|
|
123
|
+
lastRunAt: text("last_run_at"),
|
|
124
|
+
lastError: text("last_error"),
|
|
125
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
126
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
127
|
+
deletedAt: text("deleted_at"),
|
|
128
|
+
});
|
|
129
|
+
export const backupRecords = sqliteTable("backup_records", {
|
|
130
|
+
id: text("id").primaryKey().notNull(),
|
|
131
|
+
storageProvider: text("storage_provider").notNull(),
|
|
132
|
+
storageKey: text("storage_key").notNull(),
|
|
133
|
+
checksumSha256: text("checksum_sha256"),
|
|
134
|
+
size: integer("size"),
|
|
135
|
+
status: text("status").notNull().default("pending"),
|
|
136
|
+
createdByUserId: text("created_by_user_id"),
|
|
137
|
+
metadataJson: text("metadata_json"),
|
|
138
|
+
lastError: text("last_error"),
|
|
139
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
140
|
+
completedAt: text("completed_at"),
|
|
141
|
+
retentionUntil: text("retention_until"),
|
|
142
|
+
});
|
|
143
|
+
export const botIdentities = sqliteTable("bot_identities", {
|
|
144
|
+
id: text("id").primaryKey().notNull(),
|
|
145
|
+
name: text("name").notNull(),
|
|
146
|
+
username: text("username").notNull(),
|
|
147
|
+
description: text("description"),
|
|
148
|
+
photoFileId: text("photo_file_id"),
|
|
149
|
+
ownerUserId: text("owner_user_id"),
|
|
150
|
+
createdByUserId: text("created_by_user_id"),
|
|
151
|
+
active: integer("active").notNull().default(1),
|
|
152
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
153
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
154
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
155
|
+
deletedAt: text("deleted_at"),
|
|
156
|
+
});
|
|
157
|
+
export const agentImages = sqliteTable("agent_images", {
|
|
158
|
+
id: text("id").primaryKey().notNull(),
|
|
159
|
+
name: text("name").notNull(),
|
|
160
|
+
dockerfile: text("dockerfile").notNull(),
|
|
161
|
+
definitionHash: text("definition_hash").notNull(),
|
|
162
|
+
dockerTag: text("docker_tag").notNull(),
|
|
163
|
+
buildContext: text("build_context"),
|
|
164
|
+
builtinKey: text("builtin_key"),
|
|
165
|
+
status: text("status").notNull().default("pending"),
|
|
166
|
+
buildAttempt: integer("build_attempt").notNull().default(0),
|
|
167
|
+
buildProgress: integer("build_progress").notNull().default(0),
|
|
168
|
+
buildLog: text("build_log").notNull().default(""),
|
|
169
|
+
buildLogTruncated: integer("build_log_truncated").notNull().default(0),
|
|
170
|
+
lastBuildLogLine: text("last_build_log_line"),
|
|
171
|
+
buildLogUpdatedAt: text("build_log_updated_at"),
|
|
172
|
+
dockerImageId: text("docker_image_id"),
|
|
173
|
+
lastError: text("last_error"),
|
|
174
|
+
buildRequestedAt: text("build_requested_at"),
|
|
175
|
+
buildStartedAt: text("build_started_at"),
|
|
176
|
+
readyAt: text("ready_at"),
|
|
177
|
+
workerId: text("worker_id"),
|
|
178
|
+
leaseExpiresAt: text("lease_expires_at"),
|
|
179
|
+
createdByUserId: text("created_by_user_id"),
|
|
180
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
181
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
182
|
+
});
|
|
183
|
+
export const agentImageSettings = sqliteTable("agent_image_settings", {
|
|
184
|
+
id: integer("id").primaryKey().notNull(),
|
|
185
|
+
defaultImageId: text("default_image_id").references(() => agentImages.id, {
|
|
186
|
+
onDelete: "restrict",
|
|
187
|
+
}),
|
|
188
|
+
updatedByUserId: text("updated_by_user_id").references(() => users.id, {
|
|
189
|
+
onDelete: "set null",
|
|
190
|
+
}),
|
|
191
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
192
|
+
});
|
|
193
|
+
export const agentRigBindings = sqliteTable("agent_rig_bindings", {
|
|
194
|
+
userId: text("user_id")
|
|
195
|
+
.notNull()
|
|
196
|
+
.references(() => users.id, { onDelete: "cascade" }),
|
|
197
|
+
chatId: text("chat_id")
|
|
198
|
+
.notNull()
|
|
199
|
+
.references(() => chats.id, { onDelete: "cascade" }),
|
|
200
|
+
imageId: text("image_id")
|
|
201
|
+
.notNull()
|
|
202
|
+
.references(() => agentImages.id, { onDelete: "restrict" }),
|
|
203
|
+
sessionId: text("session_id").notNull(),
|
|
204
|
+
containerName: text("container_name").notNull(),
|
|
205
|
+
cwd: text("cwd").notNull(),
|
|
206
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
207
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
208
|
+
}, (table) => [primaryKey({ columns: [table.userId, table.chatId] })]);
|
|
209
|
+
export const agentSecretAgentAssignments = sqliteTable("agent_secret_agent_assignments", {
|
|
210
|
+
secretId: text("secret_id").notNull(),
|
|
211
|
+
agentUserId: text("agent_user_id")
|
|
212
|
+
.notNull()
|
|
213
|
+
.references(() => users.id, { onDelete: "cascade" }),
|
|
214
|
+
createdByUserId: text("created_by_user_id").references(() => users.id, {
|
|
215
|
+
onDelete: "set null",
|
|
216
|
+
}),
|
|
217
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
218
|
+
}, (table) => [primaryKey({ columns: [table.secretId, table.agentUserId] })]);
|
|
219
|
+
export const agentSecretChannelAssignments = sqliteTable("agent_secret_channel_assignments", {
|
|
220
|
+
secretId: text("secret_id").notNull(),
|
|
221
|
+
chatId: text("chat_id")
|
|
222
|
+
.notNull()
|
|
223
|
+
.references(() => chats.id, { onDelete: "cascade" }),
|
|
224
|
+
createdByUserId: text("created_by_user_id").references(() => users.id, {
|
|
225
|
+
onDelete: "set null",
|
|
226
|
+
}),
|
|
227
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
228
|
+
}, (table) => [primaryKey({ columns: [table.secretId, table.chatId] })]);
|
|
229
|
+
export const callCredentialLeases = sqliteTable("call_credential_leases", {
|
|
230
|
+
id: text("id").primaryKey().notNull(),
|
|
231
|
+
callId: text("call_id").notNull(),
|
|
232
|
+
userId: text("user_id").notNull(),
|
|
233
|
+
provider: text("provider").notNull(),
|
|
234
|
+
credentialUsername: text("credential_username").notNull(),
|
|
235
|
+
expiresAt: text("expires_at").notNull(),
|
|
236
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
237
|
+
revokedAt: text("revoked_at"),
|
|
238
|
+
});
|
|
239
|
+
export const callEvents = sqliteTable("call_events", {
|
|
240
|
+
id: text("id").primaryKey().notNull(),
|
|
241
|
+
callId: text("call_id").notNull(),
|
|
242
|
+
kind: text("kind").notNull(),
|
|
243
|
+
actorUserId: text("actor_user_id"),
|
|
244
|
+
targetUserId: text("target_user_id"),
|
|
245
|
+
payloadJson: text("payload_json"),
|
|
246
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
247
|
+
});
|
|
248
|
+
export const callParticipants = sqliteTable("call_participants", {
|
|
249
|
+
callId: text("call_id").notNull(),
|
|
250
|
+
userId: text("user_id").notNull(),
|
|
251
|
+
invitedByUserId: text("invited_by_user_id"),
|
|
252
|
+
status: text("status").notNull().default("invited"),
|
|
253
|
+
invitedAt: text("invited_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
254
|
+
ringingAt: text("ringing_at"),
|
|
255
|
+
joinedAt: text("joined_at"),
|
|
256
|
+
leftAt: text("left_at"),
|
|
257
|
+
lastSeenAt: text("last_seen_at"),
|
|
258
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
259
|
+
});
|
|
260
|
+
export const calls = sqliteTable("calls", {
|
|
261
|
+
id: text("id").primaryKey().notNull(),
|
|
262
|
+
chatId: text("chat_id").notNull(),
|
|
263
|
+
createdByUserId: text("created_by_user_id"),
|
|
264
|
+
kind: text("kind").notNull().default("audio"),
|
|
265
|
+
status: text("status").notNull().default("ringing"),
|
|
266
|
+
provider: text("provider").notNull().default("webrtc"),
|
|
267
|
+
providerRoomId: text("provider_room_id"),
|
|
268
|
+
providerDataJson: text("provider_data_json"),
|
|
269
|
+
startedAt: text("started_at"),
|
|
270
|
+
endedAt: text("ended_at"),
|
|
271
|
+
endReason: text("end_reason"),
|
|
272
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
273
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
274
|
+
});
|
|
275
|
+
export const chatBookmarks = sqliteTable("chat_bookmarks", {
|
|
276
|
+
id: text("id").primaryKey().notNull(),
|
|
277
|
+
chatId: text("chat_id").notNull(),
|
|
278
|
+
kind: text("kind").notNull(),
|
|
279
|
+
title: text("title").notNull(),
|
|
280
|
+
url: text("url"),
|
|
281
|
+
messageId: text("message_id"),
|
|
282
|
+
fileId: text("file_id"),
|
|
283
|
+
emoji: text("emoji"),
|
|
284
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
285
|
+
createdByUserId: text("created_by_user_id"),
|
|
286
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
287
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
288
|
+
});
|
|
289
|
+
export const chatMembers = sqliteTable("chat_members", {
|
|
290
|
+
chatId: text("chat_id").notNull(),
|
|
291
|
+
userId: text("user_id").notNull(),
|
|
292
|
+
role: text("role").notNull().default("member"),
|
|
293
|
+
membershipEpoch: text("membership_epoch").notNull(),
|
|
294
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
295
|
+
joinedAt: text("joined_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
296
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
297
|
+
leftAt: text("left_at"),
|
|
298
|
+
lastReadMessageId: text("last_read_message_id"),
|
|
299
|
+
lastReadSequence: integer("last_read_sequence").notNull().default(0),
|
|
300
|
+
lastReadPts: integer("last_read_pts").notNull().default(0),
|
|
301
|
+
lastReadAt: text("last_read_at"),
|
|
302
|
+
unreadCount: integer("unread_count").notNull().default(0),
|
|
303
|
+
mentionCount: integer("mention_count").notNull().default(0),
|
|
304
|
+
invitedByUserId: text("invited_by_user_id"),
|
|
305
|
+
removedByUserId: text("removed_by_user_id"),
|
|
306
|
+
});
|
|
307
|
+
export const chatPins = sqliteTable("chat_pins", {
|
|
308
|
+
id: text("id").primaryKey().notNull(),
|
|
309
|
+
chatId: text("chat_id").notNull(),
|
|
310
|
+
messageId: text("message_id").notNull(),
|
|
311
|
+
pinnedByUserId: text("pinned_by_user_id"),
|
|
312
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
313
|
+
});
|
|
314
|
+
export const chatSyncCompactions = sqliteTable("chat_sync_compactions", {
|
|
315
|
+
id: text("id").primaryKey().notNull(),
|
|
316
|
+
chatId: text("chat_id").notNull(),
|
|
317
|
+
previousMinPts: integer("previous_min_pts").notNull(),
|
|
318
|
+
newMinPts: integer("new_min_pts").notNull(),
|
|
319
|
+
updatesDeleted: integer("updates_deleted").notNull().default(0),
|
|
320
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
321
|
+
});
|
|
322
|
+
export const chatUpdates = sqliteTable("chat_updates", {
|
|
323
|
+
chatId: text("chat_id").notNull(),
|
|
324
|
+
pts: integer("pts").notNull(),
|
|
325
|
+
ptsCount: integer("pts_count").notNull().default(1),
|
|
326
|
+
kind: text("kind").notNull(),
|
|
327
|
+
entityId: text("entity_id"),
|
|
328
|
+
payloadJson: text("payload_json"),
|
|
329
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
330
|
+
});
|
|
331
|
+
export const chats = sqliteTable("chats", {
|
|
332
|
+
id: text("id").primaryKey().notNull(),
|
|
333
|
+
kind: text("kind").notNull(),
|
|
334
|
+
name: text("name"),
|
|
335
|
+
slug: text("slug"),
|
|
336
|
+
topic: text("topic"),
|
|
337
|
+
createdByUserId: text("created_by_user_id"),
|
|
338
|
+
dmKey: text("dm_key"),
|
|
339
|
+
pts: integer("pts").notNull().default(0),
|
|
340
|
+
minRecoverablePts: integer("min_recoverable_pts").notNull().default(0),
|
|
341
|
+
lastMessageSequence: integer("last_message_sequence").notNull().default(0),
|
|
342
|
+
lastChangeSequence: integer("last_change_sequence").notNull().default(0),
|
|
343
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
344
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
345
|
+
deletedAt: text("deleted_at"),
|
|
346
|
+
dmType: text("dm_type").notNull().default("none"),
|
|
347
|
+
visibility: text("visibility").notNull().default("private"),
|
|
348
|
+
ownerUserId: text("owner_user_id"),
|
|
349
|
+
photoFileId: text("photo_file_id"),
|
|
350
|
+
isListed: integer("is_listed").notNull().default(1),
|
|
351
|
+
archivedAt: text("archived_at"),
|
|
352
|
+
archivedByUserId: text("archived_by_user_id"),
|
|
353
|
+
archiveReason: text("archive_reason"),
|
|
354
|
+
deletedByUserId: text("deleted_by_user_id"),
|
|
355
|
+
deleteReason: text("delete_reason"),
|
|
356
|
+
retentionMode: text("retention_mode").notNull().default("inherit"),
|
|
357
|
+
retentionSeconds: integer("retention_seconds"),
|
|
358
|
+
defaultExpiryMode: text("default_expiry_mode").notNull().default("none"),
|
|
359
|
+
defaultSelfDestructSeconds: integer("default_self_destruct_seconds"),
|
|
360
|
+
defaultAfterReadScope: text("default_after_read_scope").notNull().default("any_reader"),
|
|
361
|
+
lifecycleVersion: integer("lifecycle_version").notNull().default(1),
|
|
362
|
+
});
|
|
363
|
+
export const agentTurns = sqliteTable("agent_turns", {
|
|
364
|
+
userMessageId: text("user_message_id")
|
|
365
|
+
.notNull()
|
|
366
|
+
.references(() => messages.id, { onDelete: "cascade" }),
|
|
367
|
+
agentUserId: text("agent_user_id")
|
|
368
|
+
.notNull()
|
|
369
|
+
.references(() => users.id, { onDelete: "cascade" }),
|
|
370
|
+
chatId: text("chat_id")
|
|
371
|
+
.notNull()
|
|
372
|
+
.references(() => chats.id, { onDelete: "cascade" }),
|
|
373
|
+
sessionId: text("session_id")
|
|
374
|
+
.notNull()
|
|
375
|
+
.references(() => agentRigBindings.sessionId, { onDelete: "cascade" }),
|
|
376
|
+
runId: text("run_id"),
|
|
377
|
+
baselineMessageCount: integer("baseline_message_count"),
|
|
378
|
+
lastSessionEventId: text("last_session_event_id"),
|
|
379
|
+
streamCommittedText: text("stream_committed_text").notNull().default(""),
|
|
380
|
+
status: text("status").notNull().default("pending"),
|
|
381
|
+
assistantMessageId: text("assistant_message_id").references(() => messages.id, {
|
|
382
|
+
onDelete: "set null",
|
|
383
|
+
}),
|
|
384
|
+
lastError: text("last_error"),
|
|
385
|
+
workerId: text("worker_id"),
|
|
386
|
+
leaseExpiresAt: text("lease_expires_at"),
|
|
387
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
388
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
389
|
+
completedAt: text("completed_at"),
|
|
390
|
+
}, (table) => [primaryKey({ columns: [table.userMessageId, table.agentUserId] })]);
|
|
391
|
+
export const rigEventSyncState = sqliteTable("rig_event_sync_state", {
|
|
392
|
+
id: integer("id").primaryKey().notNull(),
|
|
393
|
+
cursor: integer("cursor"),
|
|
394
|
+
trimmedThrough: integer("trimmed_through"),
|
|
395
|
+
eventsSinceTrim: integer("events_since_trim").notNull().default(0),
|
|
396
|
+
lastTrimmedAt: text("last_trimmed_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
397
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
398
|
+
});
|
|
399
|
+
export const clientMutations = sqliteTable("client_mutations", {
|
|
400
|
+
actorUserId: text("actor_user_id").notNull(),
|
|
401
|
+
scope: text("scope").notNull(),
|
|
402
|
+
clientMutationId: text("client_mutation_id").notNull(),
|
|
403
|
+
resultJson: text("result_json").notNull(),
|
|
404
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
405
|
+
expiresAt: text("expires_at"),
|
|
406
|
+
lastAccessedAt: text("last_accessed_at"),
|
|
407
|
+
});
|
|
408
|
+
export const customEmojiRevisions = sqliteTable("custom_emoji_revisions", {
|
|
409
|
+
id: text("id").primaryKey().notNull(),
|
|
410
|
+
customEmojiId: text("custom_emoji_id").notNull(),
|
|
411
|
+
name: text("name").notNull(),
|
|
412
|
+
fileId: text("file_id").notNull(),
|
|
413
|
+
changedByUserId: text("changed_by_user_id"),
|
|
414
|
+
changeKind: text("change_kind").notNull(),
|
|
415
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
416
|
+
});
|
|
417
|
+
export const customEmojis = sqliteTable("custom_emojis", {
|
|
418
|
+
id: text("id").primaryKey().notNull(),
|
|
419
|
+
name: text("name").notNull(),
|
|
420
|
+
fileId: text("file_id").notNull(),
|
|
421
|
+
createdByUserId: text("created_by_user_id"),
|
|
422
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
423
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
424
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
425
|
+
deletedAt: text("deleted_at"),
|
|
426
|
+
deletedByUserId: text("deleted_by_user_id"),
|
|
427
|
+
promotedAt: text("promoted_at"),
|
|
428
|
+
promotedByUserId: text("promoted_by_user_id"),
|
|
429
|
+
});
|
|
430
|
+
export const dataExportJobs = sqliteTable("data_export_jobs", {
|
|
431
|
+
id: text("id").primaryKey().notNull(),
|
|
432
|
+
requestedByUserId: text("requested_by_user_id"),
|
|
433
|
+
kind: text("kind").notNull(),
|
|
434
|
+
targetId: text("target_id"),
|
|
435
|
+
status: text("status").notNull().default("pending"),
|
|
436
|
+
outputFileId: text("output_file_id"),
|
|
437
|
+
optionsJson: text("options_json"),
|
|
438
|
+
lastError: text("last_error"),
|
|
439
|
+
expiresAt: text("expires_at"),
|
|
440
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
441
|
+
startedAt: text("started_at"),
|
|
442
|
+
completedAt: text("completed_at"),
|
|
443
|
+
});
|
|
444
|
+
export const fileAccessGrants = sqliteTable("file_access_grants", {
|
|
445
|
+
id: text("id").primaryKey().notNull(),
|
|
446
|
+
fileId: text("file_id").notNull(),
|
|
447
|
+
principalType: text("principal_type").notNull(),
|
|
448
|
+
principalId: text("principal_id").notNull(),
|
|
449
|
+
sourceMessageId: text("source_message_id"),
|
|
450
|
+
grantedByUserId: text("granted_by_user_id"),
|
|
451
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
452
|
+
expiresAt: text("expires_at"),
|
|
453
|
+
});
|
|
454
|
+
export const fileDerivatives = sqliteTable("file_derivatives", {
|
|
455
|
+
sourceFileId: text("source_file_id").notNull(),
|
|
456
|
+
derivedFileId: text("derived_file_id").notNull(),
|
|
457
|
+
kind: text("kind").notNull(),
|
|
458
|
+
variant: text("variant").notNull().default("default"),
|
|
459
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
460
|
+
});
|
|
461
|
+
export const fileProcessingJobs = sqliteTable("file_processing_jobs", {
|
|
462
|
+
id: text("id").primaryKey().notNull(),
|
|
463
|
+
fileId: text("file_id").notNull(),
|
|
464
|
+
kind: text("kind").notNull(),
|
|
465
|
+
status: text("status").notNull().default("pending"),
|
|
466
|
+
inputJson: text("input_json"),
|
|
467
|
+
resultJson: text("result_json"),
|
|
468
|
+
attempts: integer("attempts").notNull().default(0),
|
|
469
|
+
runAfter: text("run_after").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
470
|
+
lockedAt: text("locked_at"),
|
|
471
|
+
lockedBy: text("locked_by"),
|
|
472
|
+
lastError: text("last_error"),
|
|
473
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
474
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
475
|
+
completedAt: text("completed_at"),
|
|
476
|
+
});
|
|
477
|
+
export const fileScanEvents = sqliteTable("file_scan_events", {
|
|
478
|
+
id: text("id").primaryKey().notNull(),
|
|
479
|
+
fileId: text("file_id").notNull(),
|
|
480
|
+
scanner: text("scanner").notNull(),
|
|
481
|
+
status: text("status").notNull(),
|
|
482
|
+
resultJson: text("result_json"),
|
|
483
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
484
|
+
});
|
|
485
|
+
export const fileUploadParts = sqliteTable("file_upload_parts", {
|
|
486
|
+
uploadSessionId: text("upload_session_id").notNull(),
|
|
487
|
+
partNumber: integer("part_number").notNull(),
|
|
488
|
+
byteOffset: integer("byte_offset").notNull(),
|
|
489
|
+
size: integer("size").notNull(),
|
|
490
|
+
checksumSha256: text("checksum_sha256"),
|
|
491
|
+
storageEtag: text("storage_etag"),
|
|
492
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
493
|
+
});
|
|
494
|
+
export const fileUploadSessions = sqliteTable("file_upload_sessions", {
|
|
495
|
+
id: text("id").primaryKey().notNull(),
|
|
496
|
+
userId: text("user_id").notNull(),
|
|
497
|
+
fileId: text("file_id"),
|
|
498
|
+
storageProvider: text("storage_provider").notNull().default("local"),
|
|
499
|
+
storageKey: text("storage_key").notNull(),
|
|
500
|
+
originalName: text("original_name").notNull(),
|
|
501
|
+
contentType: text("content_type").notNull(),
|
|
502
|
+
expectedSize: integer("expected_size").notNull(),
|
|
503
|
+
receivedSize: integer("received_size").notNull().default(0),
|
|
504
|
+
chunkSize: integer("chunk_size").notNull(),
|
|
505
|
+
checksumSha256: text("checksum_sha256"),
|
|
506
|
+
status: text("status").notNull().default("pending"),
|
|
507
|
+
clientMutationId: text("client_mutation_id"),
|
|
508
|
+
metadataJson: text("metadata_json"),
|
|
509
|
+
lastError: text("last_error"),
|
|
510
|
+
expiresAt: text("expires_at").notNull(),
|
|
511
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
512
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
513
|
+
completedAt: text("completed_at"),
|
|
514
|
+
});
|
|
515
|
+
export const files = sqliteTable("files", {
|
|
516
|
+
id: text("id").primaryKey().notNull(),
|
|
517
|
+
userId: text("user_id").notNull(),
|
|
518
|
+
storageName: text("storage_name").notNull(),
|
|
519
|
+
contentType: text("content_type").notNull(),
|
|
520
|
+
size: integer("size").notNull(),
|
|
521
|
+
width: integer("width").notNull(),
|
|
522
|
+
height: integer("height").notNull(),
|
|
523
|
+
thumbhash: text("thumbhash").notNull(),
|
|
524
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
525
|
+
uploadedByUserId: text("uploaded_by_user_id"),
|
|
526
|
+
isPublic: integer("is_public").notNull().default(0),
|
|
527
|
+
kind: text("kind").notNull().default("file"),
|
|
528
|
+
originalName: text("original_name"),
|
|
529
|
+
durationMs: integer("duration_ms"),
|
|
530
|
+
storageProvider: text("storage_provider").notNull().default("local"),
|
|
531
|
+
storageKey: text("storage_key"),
|
|
532
|
+
checksumSha256: text("checksum_sha256"),
|
|
533
|
+
accessScope: text("access_scope").notNull().default("private"),
|
|
534
|
+
uploadStatus: text("upload_status").notNull().default("complete"),
|
|
535
|
+
scanStatus: text("scan_status").notNull().default("unscanned"),
|
|
536
|
+
scannedAt: text("scanned_at"),
|
|
537
|
+
scanResultJson: text("scan_result_json"),
|
|
538
|
+
mediaMetadataJson: text("media_metadata_json"),
|
|
539
|
+
codec: text("codec"),
|
|
540
|
+
previewFileId: text("preview_file_id"),
|
|
541
|
+
thumbnailFileId: text("thumbnail_file_id"),
|
|
542
|
+
orphanedAt: text("orphaned_at"),
|
|
543
|
+
retentionUntil: text("retention_until"),
|
|
544
|
+
deletedAt: text("deleted_at"),
|
|
545
|
+
deletedByUserId: text("deleted_by_user_id"),
|
|
546
|
+
deleteReason: text("delete_reason"),
|
|
547
|
+
});
|
|
548
|
+
export const idempotencyKeys = sqliteTable("idempotency_keys", {
|
|
549
|
+
id: text("id").primaryKey().notNull(),
|
|
550
|
+
principalType: text("principal_type").notNull(),
|
|
551
|
+
principalId: text("principal_id").notNull(),
|
|
552
|
+
scope: text("scope").notNull(),
|
|
553
|
+
idempotencyKey: text("idempotency_key").notNull(),
|
|
554
|
+
requestHash: text("request_hash").notNull(),
|
|
555
|
+
status: text("status").notNull().default("in_progress"),
|
|
556
|
+
responseStatus: integer("response_status"),
|
|
557
|
+
responseJson: text("response_json"),
|
|
558
|
+
lockedUntil: text("locked_until"),
|
|
559
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
560
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
561
|
+
expiresAt: text("expires_at").notNull(),
|
|
562
|
+
});
|
|
563
|
+
export const integrations = sqliteTable("integrations", {
|
|
564
|
+
id: text("id").primaryKey().notNull(),
|
|
565
|
+
kind: text("kind").notNull(),
|
|
566
|
+
name: text("name").notNull(),
|
|
567
|
+
description: text("description"),
|
|
568
|
+
botId: text("bot_id"),
|
|
569
|
+
createdByUserId: text("created_by_user_id"),
|
|
570
|
+
scopesJson: text("scopes_json").notNull().default("[]"),
|
|
571
|
+
configJson: text("config_json"),
|
|
572
|
+
active: integer("active").notNull().default(1),
|
|
573
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
574
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
575
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
576
|
+
deletedAt: text("deleted_at"),
|
|
577
|
+
});
|
|
578
|
+
export const messageAttachments = sqliteTable("message_attachments", {
|
|
579
|
+
messageId: text("message_id").notNull(),
|
|
580
|
+
fileId: text("file_id").notNull(),
|
|
581
|
+
position: integer("position").notNull().default(0),
|
|
582
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
583
|
+
});
|
|
584
|
+
export const messageForwardMetadata = sqliteTable("message_forward_metadata", {
|
|
585
|
+
messageId: text("message_id").primaryKey().notNull(),
|
|
586
|
+
sourceMessageId: text("source_message_id"),
|
|
587
|
+
sourceChatId: text("source_chat_id"),
|
|
588
|
+
sourceSenderUserId: text("source_sender_user_id"),
|
|
589
|
+
sourceSenderBotId: text("source_sender_bot_id"),
|
|
590
|
+
sourceSenderName: text("source_sender_name"),
|
|
591
|
+
sourceCreatedAt: text("source_created_at"),
|
|
592
|
+
sourceTextSnapshot: text("source_text_snapshot"),
|
|
593
|
+
forwardedByUserId: text("forwarded_by_user_id"),
|
|
594
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
595
|
+
});
|
|
596
|
+
export const messageMentions = sqliteTable("message_mentions", {
|
|
597
|
+
id: text("id").primaryKey().notNull(),
|
|
598
|
+
messageId: text("message_id").notNull(),
|
|
599
|
+
kind: text("kind").notNull(),
|
|
600
|
+
mentionedUserId: text("mentioned_user_id"),
|
|
601
|
+
startOffset: integer("start_offset").notNull(),
|
|
602
|
+
length: integer("length").notNull(),
|
|
603
|
+
rawText: text("raw_text").notNull(),
|
|
604
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
605
|
+
});
|
|
606
|
+
export const messageReceipts = sqliteTable("message_receipts", {
|
|
607
|
+
messageId: text("message_id").notNull(),
|
|
608
|
+
userId: text("user_id").notNull(),
|
|
609
|
+
deliveredAt: text("delivered_at"),
|
|
610
|
+
readAt: text("read_at"),
|
|
611
|
+
expiryTriggeredAt: text("expiry_triggered_at"),
|
|
612
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
613
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
614
|
+
});
|
|
615
|
+
export const messageRevisions = sqliteTable("message_revisions", {
|
|
616
|
+
id: text("id").primaryKey().notNull(),
|
|
617
|
+
messageId: text("message_id").notNull(),
|
|
618
|
+
revision: integer("revision").notNull(),
|
|
619
|
+
text: text("text").notNull().default(""),
|
|
620
|
+
contentJson: text("content_json"),
|
|
621
|
+
editedByUserId: text("edited_by_user_id"),
|
|
622
|
+
editReason: text("edit_reason"),
|
|
623
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
624
|
+
});
|
|
625
|
+
export const messageSearchDocuments = sqliteTable("message_search_documents", {
|
|
626
|
+
messageId: text("message_id").primaryKey().notNull(),
|
|
627
|
+
chatId: text("chat_id").notNull(),
|
|
628
|
+
normalizedText: text("normalized_text").notNull(),
|
|
629
|
+
normalizedLength: integer("normalized_length").notNull(),
|
|
630
|
+
gramCount: integer("gram_count").notNull().default(0),
|
|
631
|
+
indexedRevision: integer("indexed_revision").notNull(),
|
|
632
|
+
contentHash: text("content_hash"),
|
|
633
|
+
messageCreatedAt: text("message_created_at").notNull(),
|
|
634
|
+
indexedAt: text("indexed_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
635
|
+
});
|
|
636
|
+
export const messageSearchNgrams = sqliteTable("message_search_ngrams", {
|
|
637
|
+
gram: text("gram").notNull(),
|
|
638
|
+
messageId: text("message_id").notNull(),
|
|
639
|
+
occurrences: integer("occurrences").notNull().default(1),
|
|
640
|
+
});
|
|
641
|
+
export const messages = sqliteTable("messages", {
|
|
642
|
+
id: text("id").primaryKey().notNull(),
|
|
643
|
+
chatId: text("chat_id").notNull(),
|
|
644
|
+
sequence: integer("sequence").notNull(),
|
|
645
|
+
changePts: integer("change_pts").notNull(),
|
|
646
|
+
senderUserId: text("sender_user_id"),
|
|
647
|
+
kind: text("kind").notNull().default("user"),
|
|
648
|
+
text: text("text").notNull().default(""),
|
|
649
|
+
quotedMessageId: text("quoted_message_id"),
|
|
650
|
+
threadRootMessageId: text("thread_root_message_id"),
|
|
651
|
+
forwardedFromMessageId: text("forwarded_from_message_id"),
|
|
652
|
+
expiresAt: text("expires_at"),
|
|
653
|
+
editedAt: text("edited_at"),
|
|
654
|
+
deletedAt: text("deleted_at"),
|
|
655
|
+
deletedByUserId: text("deleted_by_user_id"),
|
|
656
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
657
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
658
|
+
senderBotId: text("sender_bot_id"),
|
|
659
|
+
contentJson: text("content_json"),
|
|
660
|
+
revision: integer("revision").notNull().default(1),
|
|
661
|
+
editedByUserId: text("edited_by_user_id"),
|
|
662
|
+
editReason: text("edit_reason"),
|
|
663
|
+
publishedAt: text("published_at"),
|
|
664
|
+
expiryMode: text("expiry_mode").notNull().default("none"),
|
|
665
|
+
selfDestructSeconds: integer("self_destruct_seconds"),
|
|
666
|
+
afterReadScope: text("after_read_scope").notNull().default("any_reader"),
|
|
667
|
+
firstReadAt: text("first_read_at"),
|
|
668
|
+
hardDeleteAt: text("hard_delete_at"),
|
|
669
|
+
deleteReason: text("delete_reason"),
|
|
670
|
+
});
|
|
671
|
+
export const moderationActions = sqliteTable("moderation_actions", {
|
|
672
|
+
id: text("id").primaryKey().notNull(),
|
|
673
|
+
reportId: text("report_id"),
|
|
674
|
+
actorUserId: text("actor_user_id"),
|
|
675
|
+
targetUserId: text("target_user_id"),
|
|
676
|
+
chatId: text("chat_id"),
|
|
677
|
+
messageId: text("message_id"),
|
|
678
|
+
fileId: text("file_id"),
|
|
679
|
+
action: text("action").notNull(),
|
|
680
|
+
reason: text("reason"),
|
|
681
|
+
metadataJson: text("metadata_json"),
|
|
682
|
+
automationRunId: text("automation_run_id"),
|
|
683
|
+
expiresAt: text("expires_at"),
|
|
684
|
+
revokedAt: text("revoked_at"),
|
|
685
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
686
|
+
});
|
|
687
|
+
export const moderationReports = sqliteTable("moderation_reports", {
|
|
688
|
+
id: text("id").primaryKey().notNull(),
|
|
689
|
+
reportedByUserId: text("reported_by_user_id"),
|
|
690
|
+
targetUserId: text("target_user_id"),
|
|
691
|
+
chatId: text("chat_id"),
|
|
692
|
+
messageId: text("message_id"),
|
|
693
|
+
fileId: text("file_id"),
|
|
694
|
+
reason: text("reason").notNull(),
|
|
695
|
+
details: text("details"),
|
|
696
|
+
status: text("status").notNull().default("open"),
|
|
697
|
+
assignedToUserId: text("assigned_to_user_id"),
|
|
698
|
+
resolution: text("resolution"),
|
|
699
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
700
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
701
|
+
resolvedAt: text("resolved_at"),
|
|
702
|
+
});
|
|
703
|
+
export const notifications = sqliteTable("notifications", {
|
|
704
|
+
id: text("id").primaryKey().notNull(),
|
|
705
|
+
userId: text("user_id").notNull(),
|
|
706
|
+
kind: text("kind").notNull(),
|
|
707
|
+
chatId: text("chat_id"),
|
|
708
|
+
messageId: text("message_id"),
|
|
709
|
+
threadRootMessageId: text("thread_root_message_id"),
|
|
710
|
+
actorUserId: text("actor_user_id"),
|
|
711
|
+
actorBotId: text("actor_bot_id"),
|
|
712
|
+
payloadJson: text("payload_json"),
|
|
713
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
714
|
+
readAt: text("read_at"),
|
|
715
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
716
|
+
expiresAt: text("expires_at"),
|
|
717
|
+
});
|
|
718
|
+
export const oidcIdentities = sqliteTable("oidc_identities", {
|
|
719
|
+
provider: text("provider").notNull(),
|
|
720
|
+
subject: text("subject").notNull(),
|
|
721
|
+
accountId: text("account_id").notNull(),
|
|
722
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
723
|
+
});
|
|
724
|
+
export const rateLimitBuckets = sqliteTable("rate_limit_buckets", {
|
|
725
|
+
principalKey: text("principal_key").notNull(),
|
|
726
|
+
action: text("action").notNull(),
|
|
727
|
+
windowStartedAt: text("window_started_at").notNull(),
|
|
728
|
+
windowSeconds: integer("window_seconds").notNull(),
|
|
729
|
+
requestCount: integer("request_count").notNull().default(0),
|
|
730
|
+
blockedUntil: text("blocked_until"),
|
|
731
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
732
|
+
});
|
|
733
|
+
export const reactions = sqliteTable("reactions", {
|
|
734
|
+
messageId: text("message_id").notNull(),
|
|
735
|
+
userId: text("user_id").notNull(),
|
|
736
|
+
reactionKey: text("reaction_key").notNull(),
|
|
737
|
+
emoji: text("emoji"),
|
|
738
|
+
customEmojiId: text("custom_emoji_id"),
|
|
739
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
740
|
+
customEmojiNameSnapshot: text("custom_emoji_name_snapshot"),
|
|
741
|
+
customEmojiFileIdSnapshot: text("custom_emoji_file_id_snapshot"),
|
|
742
|
+
});
|
|
743
|
+
export const retentionRuns = sqliteTable("retention_runs", {
|
|
744
|
+
id: text("id").primaryKey().notNull(),
|
|
745
|
+
scope: text("scope").notNull(),
|
|
746
|
+
status: text("status").notNull().default("running"),
|
|
747
|
+
itemsExamined: integer("items_examined").notNull().default(0),
|
|
748
|
+
itemsDeleted: integer("items_deleted").notNull().default(0),
|
|
749
|
+
detailsJson: text("details_json"),
|
|
750
|
+
lastError: text("last_error"),
|
|
751
|
+
startedAt: text("started_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
752
|
+
completedAt: text("completed_at"),
|
|
753
|
+
});
|
|
754
|
+
export const scheduledMessageAttachments = sqliteTable("scheduled_message_attachments", {
|
|
755
|
+
scheduledMessageId: text("scheduled_message_id").notNull(),
|
|
756
|
+
fileId: text("file_id").notNull(),
|
|
757
|
+
position: integer("position").notNull().default(0),
|
|
758
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
759
|
+
});
|
|
760
|
+
export const scheduledMessages = sqliteTable("scheduled_messages", {
|
|
761
|
+
id: text("id").primaryKey().notNull(),
|
|
762
|
+
chatId: text("chat_id").notNull(),
|
|
763
|
+
createdByUserId: text("created_by_user_id"),
|
|
764
|
+
senderBotId: text("sender_bot_id"),
|
|
765
|
+
text: text("text").notNull().default(""),
|
|
766
|
+
contentJson: text("content_json"),
|
|
767
|
+
quotedMessageId: text("quoted_message_id"),
|
|
768
|
+
threadRootMessageId: text("thread_root_message_id"),
|
|
769
|
+
forwardedFromMessageId: text("forwarded_from_message_id"),
|
|
770
|
+
scheduledFor: text("scheduled_for").notNull(),
|
|
771
|
+
timezone: text("timezone"),
|
|
772
|
+
status: text("status").notNull().default("scheduled"),
|
|
773
|
+
publishedMessageId: text("published_message_id"),
|
|
774
|
+
lastError: text("last_error"),
|
|
775
|
+
clientMutationId: text("client_mutation_id"),
|
|
776
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
777
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
778
|
+
cancelledAt: text("cancelled_at"),
|
|
779
|
+
publishedAt: text("published_at"),
|
|
780
|
+
});
|
|
781
|
+
export const searchIndexState = sqliteTable("search_index_state", {
|
|
782
|
+
entityKind: text("entity_kind").primaryKey().notNull(),
|
|
783
|
+
version: integer("version").notNull().default(1),
|
|
784
|
+
status: text("status").notNull().default("ready"),
|
|
785
|
+
lastIndexedId: text("last_indexed_id"),
|
|
786
|
+
lastError: text("last_error"),
|
|
787
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
788
|
+
});
|
|
789
|
+
export const serverSettings = sqliteTable("server_settings", {
|
|
790
|
+
id: integer("id").primaryKey({ autoIncrement: true }).notNull(),
|
|
791
|
+
name: text("name").notNull(),
|
|
792
|
+
title: text("title"),
|
|
793
|
+
photoFileId: text("photo_file_id"),
|
|
794
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
795
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
796
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
797
|
+
defaultRetentionMode: text("default_retention_mode").notNull().default("forever"),
|
|
798
|
+
defaultRetentionSeconds: integer("default_retention_seconds"),
|
|
799
|
+
defaultFileQuotaBytes: integer("default_file_quota_bytes"),
|
|
800
|
+
maxUploadBytes: integer("max_upload_bytes"),
|
|
801
|
+
syncEventRetentionSeconds: integer("sync_event_retention_seconds").notNull().default(2592000),
|
|
802
|
+
chatUpdateRetentionSeconds: integer("chat_update_retention_seconds").notNull().default(2592000),
|
|
803
|
+
idempotencyRetentionSeconds: integer("idempotency_retention_seconds").notNull().default(604800),
|
|
804
|
+
});
|
|
805
|
+
export const serverSyncState = sqliteTable("server_sync_state", {
|
|
806
|
+
id: integer("id").primaryKey({ autoIncrement: true }).notNull(),
|
|
807
|
+
generation: text("generation").notNull(),
|
|
808
|
+
sequence: integer("sequence").notNull().default(0),
|
|
809
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
810
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
811
|
+
automationEventSequence: integer("automation_event_sequence").notNull().default(0),
|
|
812
|
+
minRecoverableSequence: integer("min_recoverable_sequence").notNull().default(0),
|
|
813
|
+
lastCompactedAt: text("last_compacted_at"),
|
|
814
|
+
compactionVersion: integer("compaction_version").notNull().default(0),
|
|
815
|
+
});
|
|
816
|
+
export const slashCommands = sqliteTable("slash_commands", {
|
|
817
|
+
id: text("id").primaryKey().notNull(),
|
|
818
|
+
integrationId: text("integration_id").notNull(),
|
|
819
|
+
command: text("command").notNull(),
|
|
820
|
+
description: text("description"),
|
|
821
|
+
usageHint: text("usage_hint"),
|
|
822
|
+
handlerUrl: text("handler_url").notNull(),
|
|
823
|
+
active: integer("active").notNull().default(1),
|
|
824
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
825
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
826
|
+
});
|
|
827
|
+
export const syncCompactions = sqliteTable("sync_compactions", {
|
|
828
|
+
id: text("id").primaryKey().notNull(),
|
|
829
|
+
generation: text("generation").notNull(),
|
|
830
|
+
previousMinSequence: integer("previous_min_sequence").notNull(),
|
|
831
|
+
newMinSequence: integer("new_min_sequence").notNull(),
|
|
832
|
+
eventsDeleted: integer("events_deleted").notNull().default(0),
|
|
833
|
+
mutationsDeleted: integer("mutations_deleted").notNull().default(0),
|
|
834
|
+
startedAt: text("started_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
835
|
+
completedAt: text("completed_at"),
|
|
836
|
+
detailsJson: text("details_json"),
|
|
837
|
+
});
|
|
838
|
+
export const syncConsumers = sqliteTable("sync_consumers", {
|
|
839
|
+
id: text("id").primaryKey().notNull(),
|
|
840
|
+
userId: text("user_id").notNull(),
|
|
841
|
+
deviceId: text("device_id").notNull(),
|
|
842
|
+
generation: text("generation").notNull(),
|
|
843
|
+
sequence: integer("sequence").notNull().default(0),
|
|
844
|
+
lastSeenAt: text("last_seen_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
845
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
846
|
+
revokedAt: text("revoked_at"),
|
|
847
|
+
});
|
|
848
|
+
export const syncEvents = sqliteTable("sync_events", {
|
|
849
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
850
|
+
sequence: integer("sequence").notNull(),
|
|
851
|
+
kind: text("kind").notNull(),
|
|
852
|
+
chatId: text("chat_id"),
|
|
853
|
+
chatPts: integer("chat_pts"),
|
|
854
|
+
entityId: text("entity_id"),
|
|
855
|
+
actorUserId: text("actor_user_id"),
|
|
856
|
+
targetUserId: text("target_user_id"),
|
|
857
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
858
|
+
});
|
|
859
|
+
export const threadParticipants = sqliteTable("thread_participants", {
|
|
860
|
+
threadRootMessageId: text("thread_root_message_id").notNull(),
|
|
861
|
+
userId: text("user_id").notNull(),
|
|
862
|
+
replyCount: integer("reply_count").notNull().default(0),
|
|
863
|
+
firstParticipatedAt: text("first_participated_at")
|
|
864
|
+
.notNull()
|
|
865
|
+
.default(sql.raw("CURRENT_TIMESTAMP")),
|
|
866
|
+
lastParticipatedAt: text("last_participated_at")
|
|
867
|
+
.notNull()
|
|
868
|
+
.default(sql.raw("CURRENT_TIMESTAMP")),
|
|
869
|
+
});
|
|
870
|
+
export const threadUserStates = sqliteTable("thread_user_states", {
|
|
871
|
+
threadRootMessageId: text("thread_root_message_id").notNull(),
|
|
872
|
+
userId: text("user_id").notNull(),
|
|
873
|
+
subscribed: integer("subscribed").notNull().default(1),
|
|
874
|
+
notificationLevel: text("notification_level").notNull().default("all"),
|
|
875
|
+
lastReadMessageId: text("last_read_message_id"),
|
|
876
|
+
lastReadSequence: integer("last_read_sequence").notNull().default(0),
|
|
877
|
+
unreadCount: integer("unread_count").notNull().default(0),
|
|
878
|
+
mentionCount: integer("mention_count").notNull().default(0),
|
|
879
|
+
lastParticipatedAt: text("last_participated_at"),
|
|
880
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
881
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
882
|
+
});
|
|
883
|
+
export const threads = sqliteTable("threads", {
|
|
884
|
+
rootMessageId: text("root_message_id").primaryKey().notNull(),
|
|
885
|
+
chatId: text("chat_id").notNull(),
|
|
886
|
+
createdByUserId: text("created_by_user_id"),
|
|
887
|
+
replyCount: integer("reply_count").notNull().default(0),
|
|
888
|
+
lastPts: integer("last_pts").notNull().default(0),
|
|
889
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
890
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
891
|
+
lastReplyMessageId: text("last_reply_message_id"),
|
|
892
|
+
lastReplySequence: integer("last_reply_sequence").notNull().default(0),
|
|
893
|
+
participantCount: integer("participant_count").notNull().default(0),
|
|
894
|
+
});
|
|
895
|
+
export const userBookmarks = sqliteTable("user_bookmarks", {
|
|
896
|
+
id: text("id").primaryKey().notNull(),
|
|
897
|
+
userId: text("user_id").notNull(),
|
|
898
|
+
chatId: text("chat_id"),
|
|
899
|
+
messageId: text("message_id"),
|
|
900
|
+
fileId: text("file_id"),
|
|
901
|
+
url: text("url"),
|
|
902
|
+
title: text("title"),
|
|
903
|
+
note: text("note"),
|
|
904
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
905
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
906
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
907
|
+
});
|
|
908
|
+
export const userChatPreferences = sqliteTable("user_chat_preferences", {
|
|
909
|
+
userId: text("user_id").notNull(),
|
|
910
|
+
chatId: text("chat_id").notNull(),
|
|
911
|
+
starred: integer("starred").notNull().default(0),
|
|
912
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
913
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
914
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
915
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
916
|
+
notificationLevel: text("notification_level").notNull().default("all"),
|
|
917
|
+
mutedUntil: text("muted_until"),
|
|
918
|
+
notifyThreadReplies: integer("notify_thread_replies").notNull().default(1),
|
|
919
|
+
showMessagePreviews: integer("show_message_previews").notNull().default(1),
|
|
920
|
+
});
|
|
921
|
+
export const userNotificationPreferences = sqliteTable("user_notification_preferences", {
|
|
922
|
+
userId: text("user_id").primaryKey().notNull(),
|
|
923
|
+
directMessages: text("direct_messages").notNull().default("all"),
|
|
924
|
+
mentions: text("mentions").notNull().default("all"),
|
|
925
|
+
threadReplies: text("thread_replies").notNull().default("all"),
|
|
926
|
+
reactions: text("reactions").notNull().default("all"),
|
|
927
|
+
calls: text("calls").notNull().default("all"),
|
|
928
|
+
emailNotifications: integer("email_notifications").notNull().default(0),
|
|
929
|
+
desktopNotifications: integer("desktop_notifications").notNull().default(1),
|
|
930
|
+
dndStartMinutes: integer("dnd_start_minutes"),
|
|
931
|
+
dndEndMinutes: integer("dnd_end_minutes"),
|
|
932
|
+
timezone: text("timezone"),
|
|
933
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
934
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
935
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
936
|
+
});
|
|
937
|
+
export const userPresenceSettings = sqliteTable("user_presence_settings", {
|
|
938
|
+
userId: text("user_id").primaryKey().notNull(),
|
|
939
|
+
availability: text("availability").notNull().default("automatic"),
|
|
940
|
+
customStatusText: text("custom_status_text"),
|
|
941
|
+
customStatusEmoji: text("custom_status_emoji"),
|
|
942
|
+
statusExpiresAt: text("status_expires_at"),
|
|
943
|
+
dndUntil: text("dnd_until"),
|
|
944
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
945
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
946
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
947
|
+
});
|
|
948
|
+
export const userStorageQuotas = sqliteTable("user_storage_quotas", {
|
|
949
|
+
userId: text("user_id").primaryKey().notNull(),
|
|
950
|
+
quotaBytes: integer("quota_bytes"),
|
|
951
|
+
usedBytes: integer("used_bytes").notNull().default(0),
|
|
952
|
+
reservedBytes: integer("reserved_bytes").notNull().default(0),
|
|
953
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
954
|
+
});
|
|
955
|
+
export const users = sqliteTable("users", {
|
|
956
|
+
id: text("id").primaryKey().notNull(),
|
|
957
|
+
accountId: text("account_id"),
|
|
958
|
+
kind: text("kind").notNull().default("human"),
|
|
959
|
+
agentImageId: text("agent_image_id"),
|
|
960
|
+
createdByUserId: text("created_by_user_id"),
|
|
961
|
+
firstName: text("first_name").notNull(),
|
|
962
|
+
lastName: text("last_name"),
|
|
963
|
+
username: text("username").notNull(),
|
|
964
|
+
email: text("email"),
|
|
965
|
+
phone: text("phone"),
|
|
966
|
+
photoFileId: text("photo_file_id"),
|
|
967
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
968
|
+
title: text("title"),
|
|
969
|
+
role: text("role").notNull().default("member"),
|
|
970
|
+
deletedAt: text("deleted_at"),
|
|
971
|
+
lastAccessAt: text("last_access_at"),
|
|
972
|
+
syncSequence: integer("sync_sequence").notNull().default(0),
|
|
973
|
+
});
|
|
974
|
+
export const webhookDeliveries = sqliteTable("webhook_deliveries", {
|
|
975
|
+
id: text("id").primaryKey().notNull(),
|
|
976
|
+
subscriptionId: text("subscription_id").notNull(),
|
|
977
|
+
eventId: text("event_id").notNull(),
|
|
978
|
+
eventType: text("event_type").notNull(),
|
|
979
|
+
payloadJson: text("payload_json").notNull(),
|
|
980
|
+
status: text("status").notNull().default("pending"),
|
|
981
|
+
attempts: integer("attempts").notNull().default(0),
|
|
982
|
+
nextAttemptAt: text("next_attempt_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
983
|
+
responseStatus: integer("response_status"),
|
|
984
|
+
responseBody: text("response_body"),
|
|
985
|
+
lastError: text("last_error"),
|
|
986
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
987
|
+
deliveredAt: text("delivered_at"),
|
|
988
|
+
});
|
|
989
|
+
export const webhookSubscriptions = sqliteTable("webhook_subscriptions", {
|
|
990
|
+
id: text("id").primaryKey().notNull(),
|
|
991
|
+
integrationId: text("integration_id").notNull(),
|
|
992
|
+
direction: text("direction").notNull(),
|
|
993
|
+
chatId: text("chat_id"),
|
|
994
|
+
url: text("url"),
|
|
995
|
+
tokenHash: text("token_hash"),
|
|
996
|
+
signingSecretCiphertext: text("signing_secret_ciphertext"),
|
|
997
|
+
eventTypesJson: text("event_types_json").notNull().default("[]"),
|
|
998
|
+
active: integer("active").notNull().default(1),
|
|
999
|
+
createdAt: text("created_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
1000
|
+
updatedAt: text("updated_at").notNull().default(sql.raw("CURRENT_TIMESTAMP")),
|
|
1001
|
+
});
|
|
1002
|
+
export const schema = {
|
|
1003
|
+
accountBans,
|
|
1004
|
+
accounts,
|
|
1005
|
+
agentImages,
|
|
1006
|
+
agentImageSettings,
|
|
1007
|
+
agentTurns,
|
|
1008
|
+
agentRigBindings,
|
|
1009
|
+
agentSecretAgentAssignments,
|
|
1010
|
+
agentSecretChannelAssignments,
|
|
1011
|
+
apiCredentials,
|
|
1012
|
+
auditLogEntries,
|
|
1013
|
+
authMagicLinks,
|
|
1014
|
+
authOidcStates,
|
|
1015
|
+
authSessionEvents,
|
|
1016
|
+
authSessions,
|
|
1017
|
+
automationRuns,
|
|
1018
|
+
automations,
|
|
1019
|
+
backupRecords,
|
|
1020
|
+
botIdentities,
|
|
1021
|
+
callCredentialLeases,
|
|
1022
|
+
callEvents,
|
|
1023
|
+
callParticipants,
|
|
1024
|
+
calls,
|
|
1025
|
+
chatBookmarks,
|
|
1026
|
+
chatMembers,
|
|
1027
|
+
chatPins,
|
|
1028
|
+
chatSyncCompactions,
|
|
1029
|
+
chatUpdates,
|
|
1030
|
+
chats,
|
|
1031
|
+
clientMutations,
|
|
1032
|
+
customEmojiRevisions,
|
|
1033
|
+
customEmojis,
|
|
1034
|
+
dataExportJobs,
|
|
1035
|
+
fileAccessGrants,
|
|
1036
|
+
fileDerivatives,
|
|
1037
|
+
fileProcessingJobs,
|
|
1038
|
+
fileScanEvents,
|
|
1039
|
+
fileUploadParts,
|
|
1040
|
+
fileUploadSessions,
|
|
1041
|
+
files,
|
|
1042
|
+
idempotencyKeys,
|
|
1043
|
+
integrations,
|
|
1044
|
+
messageAttachments,
|
|
1045
|
+
messageForwardMetadata,
|
|
1046
|
+
messageMentions,
|
|
1047
|
+
messageReceipts,
|
|
1048
|
+
messageRevisions,
|
|
1049
|
+
messageSearchDocuments,
|
|
1050
|
+
messageSearchNgrams,
|
|
1051
|
+
messages,
|
|
1052
|
+
moderationActions,
|
|
1053
|
+
moderationReports,
|
|
1054
|
+
notifications,
|
|
1055
|
+
oidcIdentities,
|
|
1056
|
+
rateLimitBuckets,
|
|
1057
|
+
reactions,
|
|
1058
|
+
retentionRuns,
|
|
1059
|
+
rigEventSyncState,
|
|
1060
|
+
scheduledMessageAttachments,
|
|
1061
|
+
scheduledMessages,
|
|
1062
|
+
searchIndexState,
|
|
1063
|
+
serverSettings,
|
|
1064
|
+
serverSyncState,
|
|
1065
|
+
slashCommands,
|
|
1066
|
+
syncCompactions,
|
|
1067
|
+
syncConsumers,
|
|
1068
|
+
syncEvents,
|
|
1069
|
+
threadParticipants,
|
|
1070
|
+
threadUserStates,
|
|
1071
|
+
threads,
|
|
1072
|
+
userBookmarks,
|
|
1073
|
+
userChatPreferences,
|
|
1074
|
+
userNotificationPreferences,
|
|
1075
|
+
userPresenceSettings,
|
|
1076
|
+
userStorageQuotas,
|
|
1077
|
+
users,
|
|
1078
|
+
webhookDeliveries,
|
|
1079
|
+
webhookSubscriptions,
|
|
1080
|
+
};
|
|
1081
|
+
//# sourceMappingURL=schema.js.map
|