ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto
16
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(shared): move db types from api to shared

byarielm.fyi a5d3994b 43064de7

verified
+211 -148
+16 -147
packages/api/src/db/types.ts
··· 1 1 /** 2 2 * Database Schema Types 3 - * Generated from scripts/init-db.sql 4 - */ 5 - 6 - import type { ColumnType } from 'kysely'; 7 - 8 - /** 9 - * Timestamp columns that are auto-generated 10 - */ 11 - export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> 12 - ? ColumnType<S, I | undefined, U> 13 - : ColumnType<T, T | undefined, T>; 14 - 15 - export type Timestamp = ColumnType<Date, Date | string, Date | string>; 16 - 17 - /** 18 - * OAuth State Storage (transient) 19 - */ 20 - export interface OAuthStatesTable { 21 - state: string; 22 - data: Record<string, unknown>; 23 - created_at: Generated<Timestamp>; 24 - } 25 - 26 - /** 27 - * OAuth Sessions (transient) 28 - */ 29 - export interface OAuthSessionsTable { 30 - did: string; 31 - session_data: Record<string, unknown>; 32 - updated_at: Generated<Timestamp>; 33 - } 34 - 35 - /** 36 - * User Sessions (transient) 37 - */ 38 - export interface UserSessionsTable { 39 - session_id: string; 40 - did: string; 41 - fingerprint: string; 42 - created_at: Generated<Timestamp>; 43 - expires_at: Timestamp; 44 - } 45 - 46 - /** 47 - * User Uploads (persistent) 3 + * Re-exported from @atlast/shared so both api and worker can share the same types. 48 4 */ 49 - export interface UserUploadsTable { 50 - upload_id: string; 51 - user_did: string; 52 - source_platform: string; 53 - created_at: Generated<Timestamp>; 54 - total_users: Generated<number>; 55 - matched_users: Generated<number>; 56 - unmatched_users: Generated<number>; 57 - } 58 5 59 - /** 60 - * Source Accounts (persistent) 61 - */ 62 - export interface SourceAccountsTable { 63 - id: Generated<number>; 64 - source_platform: string; 65 - original_username: string; 66 - normalized_username: string; 67 - date_on_source: Timestamp | null; 68 - created_at: Generated<Timestamp>; 69 - } 70 - 71 - /** 72 - * User-Source Follows (join table) 73 - */ 74 - export interface UserSourceFollowsTable { 75 - user_did: string; 76 - upload_id: string; 77 - source_account_id: number; 78 - found_at: Generated<Timestamp>; 79 - } 80 - 81 - /** 82 - * AT Protocol Matches (persistent) 83 - */ 84 - export interface AtprotoMatchesTable { 85 - id: Generated<number>; 86 - source_account_id: number; 87 - atproto_did: string; 88 - atproto_handle: string; 89 - display_name: string | null; 90 - match_score: number; 91 - post_count: number | null; 92 - follower_count: number | null; 93 - follow_status: Generated<Record<string, unknown>>; 94 - found_at: Generated<Timestamp>; 95 - } 96 - 97 - /** 98 - * User Match Status (persistent) 99 - */ 100 - export interface UserMatchStatusTable { 101 - user_did: string; 102 - match_id: number; 103 - viewed: Generated<boolean>; 104 - dismissed: Generated<boolean>; 105 - followed: Generated<boolean>; 106 - notified: Generated<boolean>; 107 - updated_at: Generated<Timestamp>; 108 - } 109 - 110 - /** 111 - * Notification Queue (transient - for Phase 2) 112 - */ 113 - export interface NotificationQueueTable { 114 - id: Generated<number>; 115 - user_did: string; 116 - match_id: number; 117 - notification_type: 'in_app' | 'bluesky_dm' | 'partner_api'; 118 - status: Generated<'pending' | 'sent' | 'failed'>; 119 - attempts: Generated<number>; 120 - last_attempt: Timestamp | null; 121 - error_message: string | null; 122 - created_at: Generated<Timestamp>; 123 - } 124 - 125 - /** 126 - * Partner API Keys (for Phase 2) 127 - */ 128 - export interface PartnerApiKeysTable { 129 - id: Generated<number>; 130 - partner_name: string; 131 - api_key_hash: string; 132 - created_at: Generated<Timestamp>; 133 - last_used: Timestamp | null; 134 - is_active: Generated<boolean>; 135 - } 136 - 137 - /** 138 - * Database schema interface 139 - */ 140 - export interface Database { 141 - oauth_states: OAuthStatesTable; 142 - oauth_sessions: OAuthSessionsTable; 143 - user_sessions: UserSessionsTable; 144 - user_uploads: UserUploadsTable; 145 - source_accounts: SourceAccountsTable; 146 - user_source_follows: UserSourceFollowsTable; 147 - atproto_matches: AtprotoMatchesTable; 148 - user_match_status: UserMatchStatusTable; 149 - notification_queue: NotificationQueueTable; 150 - partner_api_keys: PartnerApiKeysTable; 151 - } 6 + export type { 7 + Generated, 8 + Timestamp, 9 + OAuthStatesTable, 10 + OAuthSessionsTable, 11 + UserSessionsTable, 12 + UserUploadsTable, 13 + SourceAccountsTable, 14 + UserSourceFollowsTable, 15 + AtprotoMatchesTable, 16 + UserMatchStatusTable, 17 + NotificationQueueTable, 18 + PartnerApiKeysTable, 19 + Database, 20 + } from '@atlast/shared/types/database';
+3
packages/shared/package.json
··· 7 7 "exports": { 8 8 ".": "./src/index.ts", 9 9 "./types/*": "./src/types/*" 10 + }, 11 + "dependencies": { 12 + "kysely": "^0.28.10" 10 13 } 11 14 }
+15
packages/shared/src/index.ts
··· 1 1 export { Platform, type PlatformConfig } from './types/platform'; 2 2 export type { ExtensionImportRequest, ExtensionImportResponse } from './types/import'; 3 + export type { 4 + Generated, 5 + Timestamp, 6 + Database, 7 + OAuthStatesTable, 8 + OAuthSessionsTable, 9 + UserSessionsTable, 10 + UserUploadsTable, 11 + SourceAccountsTable, 12 + UserSourceFollowsTable, 13 + AtprotoMatchesTable, 14 + UserMatchStatusTable, 15 + NotificationQueueTable, 16 + PartnerApiKeysTable, 17 + } from './types/database';
+153
packages/shared/src/types/database.ts
··· 1 + /** 2 + * Database Schema Types 3 + * Shared across packages that need typed Kysely database access. 4 + * Generated from scripts/init-db.sql 5 + */ 6 + 7 + import type { ColumnType } from 'kysely'; 8 + 9 + /** 10 + * Timestamp columns that are auto-generated 11 + */ 12 + export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> 13 + ? ColumnType<S, I | undefined, U> 14 + : ColumnType<T, T | undefined, T>; 15 + 16 + export type Timestamp = ColumnType<Date, Date | string, Date | string>; 17 + 18 + /** 19 + * OAuth State Storage (transient) 20 + */ 21 + export interface OAuthStatesTable { 22 + state: string; 23 + data: Record<string, unknown>; 24 + created_at: Generated<Timestamp>; 25 + } 26 + 27 + /** 28 + * OAuth Sessions (transient) 29 + */ 30 + export interface OAuthSessionsTable { 31 + did: string; 32 + session_data: Record<string, unknown>; 33 + updated_at: Generated<Timestamp>; 34 + } 35 + 36 + /** 37 + * User Sessions (transient) 38 + */ 39 + export interface UserSessionsTable { 40 + session_id: string; 41 + did: string; 42 + fingerprint: string; 43 + created_at: Generated<Timestamp>; 44 + expires_at: Timestamp; 45 + } 46 + 47 + /** 48 + * User Uploads (persistent) 49 + */ 50 + export interface UserUploadsTable { 51 + upload_id: string; 52 + user_did: string; 53 + source_platform: string; 54 + created_at: Generated<Timestamp>; 55 + total_users: Generated<number>; 56 + matched_users: Generated<number>; 57 + unmatched_users: Generated<number>; 58 + } 59 + 60 + /** 61 + * Source Accounts (persistent) 62 + */ 63 + export interface SourceAccountsTable { 64 + id: Generated<number>; 65 + source_platform: string; 66 + original_username: string; 67 + normalized_username: string; 68 + date_on_source: Timestamp | null; 69 + created_at: Generated<Timestamp>; 70 + } 71 + 72 + /** 73 + * User-Source Follows (join table) 74 + */ 75 + export interface UserSourceFollowsTable { 76 + user_did: string; 77 + upload_id: string; 78 + source_account_id: number; 79 + found_at: Generated<Timestamp>; 80 + } 81 + 82 + /** 83 + * AT Protocol Matches (persistent) 84 + */ 85 + export interface AtprotoMatchesTable { 86 + id: Generated<number>; 87 + source_account_id: number; 88 + atproto_did: string; 89 + atproto_handle: string; 90 + display_name: string | null; 91 + match_score: number; 92 + post_count: number | null; 93 + follower_count: number | null; 94 + follow_status: Generated<Record<string, unknown>>; 95 + found_at: Generated<Timestamp>; 96 + } 97 + 98 + /** 99 + * User Match Status (persistent) 100 + */ 101 + export interface UserMatchStatusTable { 102 + user_did: string; 103 + match_id: number; 104 + viewed: Generated<boolean>; 105 + dismissed: Generated<boolean>; 106 + followed: Generated<boolean>; 107 + notified: Generated<boolean>; 108 + updated_at: Generated<Timestamp>; 109 + } 110 + 111 + /** 112 + * Notification Queue (transient - for Phase 2) 113 + */ 114 + export interface NotificationQueueTable { 115 + id: Generated<number>; 116 + user_did: string; 117 + match_id: number; 118 + notification_type: 'in_app' | 'bluesky_dm' | 'partner_api'; 119 + status: Generated<'pending' | 'sent' | 'failed'>; 120 + attempts: Generated<number>; 121 + last_attempt: Timestamp | null; 122 + error_message: string | null; 123 + created_at: Generated<Timestamp>; 124 + } 125 + 126 + /** 127 + * Partner API Keys (for Phase 2) 128 + */ 129 + export interface PartnerApiKeysTable { 130 + id: Generated<number>; 131 + partner_name: string; 132 + api_key_hash: string; 133 + created_at: Generated<Timestamp>; 134 + last_used: Timestamp | null; 135 + is_active: Generated<boolean>; 136 + } 137 + 138 + /** 139 + * Database schema interface 140 + * Used as the type parameter for Kysely<Database> 141 + */ 142 + export interface Database { 143 + oauth_states: OAuthStatesTable; 144 + oauth_sessions: OAuthSessionsTable; 145 + user_sessions: UserSessionsTable; 146 + user_uploads: UserUploadsTable; 147 + source_accounts: SourceAccountsTable; 148 + user_source_follows: UserSourceFollowsTable; 149 + atproto_matches: AtprotoMatchesTable; 150 + user_match_status: UserMatchStatusTable; 151 + notification_queue: NotificationQueueTable; 152 + partner_api_keys: PartnerApiKeysTable; 153 + }
+24 -1
pnpm-lock.yaml
··· 244 244 specifier: ^5.3.3 245 245 version: 5.9.3 246 246 247 - packages/shared: {} 247 + packages/shared: 248 + dependencies: 249 + kysely: 250 + specifier: ^0.28.10 251 + version: 0.28.10 248 252 249 253 packages/web: 250 254 dependencies: ··· 357 361 bullmq: 358 362 specifier: ^5.66.5 359 363 version: 5.66.5 364 + dotenv: 365 + specifier: ^17.2.3 366 + version: 17.2.3 360 367 ioredis: 361 368 specifier: ^5.9.2 362 369 version: 5.9.2 ··· 366 373 pg: 367 374 specifier: ^8.17.2 368 375 version: 8.17.2 376 + devDependencies: 377 + '@types/node': 378 + specifier: ^24.10.4 379 + version: 24.10.4 380 + '@types/pg': 381 + specifier: ^8.16.0 382 + version: 8.16.0 383 + tsx: 384 + specifier: ^4.21.0 385 + version: 4.21.0 386 + typescript: 387 + specifier: ^5.9.3 388 + version: 5.9.3 389 + vitest: 390 + specifier: ^3.2.4 391 + version: 3.2.4(@types/node@24.10.4) 369 392 370 393 packages: 371 394