@smck/pdm 0.3.0

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/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './tables';
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@smck/pdm",
3
+ "version": "0.3.0",
4
+ "description": "Physical data model for rpersonae",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "scripts": {
18
+ "tsc": "tsc",
19
+ "clean": "rm -rf dist",
20
+ "build": "npm run clean && npm run tsc",
21
+ "pub": "npm run build && npm publish"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^24.12.3",
25
+ "typescript": "^5.9.2"
26
+ },
27
+ "peerDependencies": {
28
+ "@fyuld/ldm": "^0.1.8",
29
+ "@smck/dm": "*",
30
+ "drizzle-orm": "^0.45.2"
31
+ }
32
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './tables'
@@ -0,0 +1,26 @@
1
+ import { pgTable, text, timestamp } from 'drizzle-orm/pg-core'
2
+ import type { AdditionalAuthFactor } from '@smck/dm'
3
+
4
+ export const additionalAuthFactorTable = pgTable(
5
+ 'additional_auth_factor',
6
+ {
7
+ id: text('id').primaryKey().$type<AdditionalAuthFactor['id']>(),
8
+ authCredentialsId: text('auth_credentials_id')
9
+ .notNull()
10
+ .$type<AdditionalAuthFactor['authCredentialsId']>(),
11
+ kind: text('kind')
12
+ .notNull()
13
+ .$type<AdditionalAuthFactor['kind']>(),
14
+ secret: text('secret'),
15
+ credentialId: text('credential_id'),
16
+ publicKey: text('public_key'),
17
+ phoneNumber: text('phone_number'),
18
+ email: text('email'),
19
+ enrolledAt: timestamp('enrolled_at', {
20
+ withTimezone: true,
21
+ })
22
+ .notNull()
23
+ .defaultNow()
24
+ .$type<Date>(),
25
+ }
26
+ )
@@ -0,0 +1,17 @@
1
+ import { pgTable, text, timestamp } from 'drizzle-orm/pg-core'
2
+ import type { AuthCredentials, UserKind } from '@smck/dm'
3
+
4
+ export const authCredentialsTable = pgTable('auth_credentials', {
5
+ id: text('id').primaryKey().$type<AuthCredentials['id']>(),
6
+ userKind: text('user_kind').notNull().$type<UserKind>(),
7
+ userId: text('user_id')
8
+ .notNull()
9
+ .$type<AuthCredentials['userId']>(),
10
+ kind: text('kind').notNull().$type<AuthCredentials['kind']>(),
11
+ passwordHash: text('password_hash'),
12
+ providerSub: text('provider_sub'),
13
+ createdAt: timestamp('created_at', { withTimezone: true })
14
+ .notNull()
15
+ .defaultNow()
16
+ .$type<Date>(),
17
+ })
@@ -0,0 +1,7 @@
1
+ export * from './waitlist-inquiry.js'
2
+ export * from './player-user.js'
3
+ export * from './auth-credentials.js'
4
+ export * from './additional-auth-factor.js'
5
+ export * from './magic-link-token.js'
6
+ export * from './player-user-session.js'
7
+ export * from './invite-code.js'
@@ -0,0 +1,27 @@
1
+ import {
2
+ pgTable,
3
+ text,
4
+ timestamp,
5
+ integer,
6
+ } from 'drizzle-orm/pg-core'
7
+ import type { InviteCode } from '@smck/dm'
8
+
9
+ export const inviteCodeTable = pgTable('invite_code', {
10
+ code: text('code').primaryKey().$type<InviteCode['code']>(),
11
+ ownerPlayerUserId: text('owner_player_user_id')
12
+ .notNull()
13
+ .$type<InviteCode['ownerPlayerUserId']>(),
14
+ usedByPlayerUserId: text('used_by_player_user_id').$type<
15
+ InviteCode['usedByPlayerUserId']
16
+ >(),
17
+ createdAt: timestamp('created_at', { withTimezone: true })
18
+ .notNull()
19
+ .defaultNow()
20
+ .$type<Date>(),
21
+ voidedAt: timestamp('voided_at', {
22
+ withTimezone: true,
23
+ }).$type<Date>(),
24
+ numChildInvites: integer('num_child_invites')
25
+ .notNull()
26
+ .$type<InviteCode['numChildInvites']>(),
27
+ })
@@ -0,0 +1,19 @@
1
+ import { pgTable, text, timestamp } from 'drizzle-orm/pg-core'
2
+ import type { MagicLinkToken } from '@smck/dm'
3
+
4
+ export const magicLinkTokenTable = pgTable('magic_link_token', {
5
+ token: text('token').primaryKey().$type<MagicLinkToken['token']>(),
6
+ authCredentialsId: text('auth_credentials_id')
7
+ .notNull()
8
+ .$type<MagicLinkToken['authCredentialsId']>(),
9
+ createdAt: timestamp('created_at', { withTimezone: true })
10
+ .notNull()
11
+ .defaultNow()
12
+ .$type<Date>(),
13
+ expiresAt: timestamp('expires_at', { withTimezone: true })
14
+ .notNull()
15
+ .$type<Date>(),
16
+ usedAt: timestamp('used_at', {
17
+ withTimezone: true,
18
+ }).$type<Date>(),
19
+ })
@@ -0,0 +1,25 @@
1
+ import { pgTable, text, timestamp, inet } from 'drizzle-orm/pg-core'
2
+ import type { PlayerUserSession } from '@smck/dm'
3
+
4
+ export const playerUserSessionTable = pgTable('player_user_session', {
5
+ id: text('id').primaryKey().$type<PlayerUserSession['id']>(),
6
+ playerUserId: text('player_user_id')
7
+ .notNull()
8
+ .$type<PlayerUserSession['playerUserId']>(),
9
+ createdAt: timestamp('created_at', { withTimezone: true })
10
+ .notNull()
11
+ .defaultNow()
12
+ .$type<Date>(),
13
+ expiresAt: timestamp('expires_at', { withTimezone: true })
14
+ .notNull()
15
+ .$type<Date>(),
16
+ lastUsedAt: timestamp('last_used_at', {
17
+ withTimezone: true,
18
+ })
19
+ .notNull()
20
+ .defaultNow()
21
+ .$type<Date>(),
22
+ ipAddress: inet('ip_address')
23
+ .notNull()
24
+ .$type<PlayerUserSession['ipAddress']>(),
25
+ })
@@ -0,0 +1,15 @@
1
+ import { pgTable, text, timestamp } from 'drizzle-orm/pg-core'
2
+ import type { PlayerUser } from '@smck/dm'
3
+
4
+ export const playerUserTable = pgTable('player_user', {
5
+ id: text('id').primaryKey().$type<PlayerUser['id']>(),
6
+ email: text('email')
7
+ .notNull()
8
+ .unique()
9
+ .$type<PlayerUser['email']>(),
10
+ displayName: text('display_name').$type<PlayerUser['displayName']>(),
11
+ createdAt: timestamp('created_at', { withTimezone: true })
12
+ .notNull()
13
+ .defaultNow()
14
+ .$type<Date>(),
15
+ })
@@ -0,0 +1,17 @@
1
+ import { pgTable, text, timestamp, inet } from 'drizzle-orm/pg-core'
2
+ import type { WaitlistInquiry } from '@smck/dm'
3
+
4
+ export const waitlistInquiryTable = pgTable('waitlist_inquiry', {
5
+ email: text('email').primaryKey().$type<WaitlistInquiry['email']>(),
6
+ name: text('name').notNull().$type<WaitlistInquiry['name']>(),
7
+ discordHandle: text('discord_handle')
8
+ .notNull()
9
+ .$type<WaitlistInquiry['discordHandle']>(),
10
+ ipAddress: inet('ip_address')
11
+ .notNull()
12
+ .$type<WaitlistInquiry['ipAddress']>(),
13
+ createdAt: timestamp('created_at', { withTimezone: true })
14
+ .notNull()
15
+ .defaultNow()
16
+ .$type<Date>(),
17
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "resolveJsonModule": true,
8
+ "isolatedModules": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "strict": true,
13
+ "noImplicitAny": true,
14
+ "strictNullChecks": true,
15
+ "strictFunctionTypes": true,
16
+ "strictBindCallApply": true,
17
+ "strictPropertyInitialization": true,
18
+ "noImplicitThis": true,
19
+ "alwaysStrict": true,
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "noImplicitReturns": true,
23
+ "noFallthroughCasesInSwitch": true,
24
+ "outDir": "dist",
25
+ "rootDir": "src",
26
+ "declaration": true
27
+ },
28
+ "include": ["src"],
29
+ "exclude": ["node_modules", "dist"]
30
+ }