tempest.games 0.1.2 → 0.1.4

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.
@@ -0,0 +1,465 @@
1
+ {
2
+ "id": "fe877447-68d1-4775-b9c2-a663acce2a16",
3
+ "prevId": "7990d0f5-d388-4717-a458-73721c5690c0",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.banishedIps": {
8
+ "name": "banishedIps",
9
+ "schema": "",
10
+ "columns": {
11
+ "ip": {
12
+ "name": "ip",
13
+ "type": "varchar(45)",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "reason": {
18
+ "name": "reason",
19
+ "type": "varchar(2048)",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "banishedAt": {
24
+ "name": "banishedAt",
25
+ "type": "timestamp with time zone",
26
+ "primaryKey": false,
27
+ "notNull": true,
28
+ "default": "now()"
29
+ },
30
+ "banishedUntil": {
31
+ "name": "banishedUntil",
32
+ "type": "timestamp with time zone",
33
+ "primaryKey": false,
34
+ "notNull": false
35
+ }
36
+ },
37
+ "indexes": {},
38
+ "foreignKeys": {},
39
+ "compositePrimaryKeys": {},
40
+ "uniqueConstraints": {}
41
+ },
42
+ "public.games": {
43
+ "name": "games",
44
+ "schema": "",
45
+ "columns": {
46
+ "id": {
47
+ "name": "id",
48
+ "type": "uuid",
49
+ "primaryKey": true,
50
+ "notNull": true,
51
+ "default": "gen_random_uuid()"
52
+ }
53
+ },
54
+ "indexes": {},
55
+ "foreignKeys": {},
56
+ "compositePrimaryKeys": {},
57
+ "uniqueConstraints": {}
58
+ },
59
+ "public.loginHistory": {
60
+ "name": "loginHistory",
61
+ "schema": "",
62
+ "columns": {
63
+ "id": {
64
+ "name": "id",
65
+ "type": "uuid",
66
+ "primaryKey": true,
67
+ "notNull": true,
68
+ "default": "gen_random_uuid()"
69
+ },
70
+ "userId": {
71
+ "name": "userId",
72
+ "type": "uuid",
73
+ "primaryKey": false,
74
+ "notNull": false
75
+ },
76
+ "loginTime": {
77
+ "name": "loginTime",
78
+ "type": "timestamp with time zone",
79
+ "primaryKey": false,
80
+ "notNull": true,
81
+ "default": "now()"
82
+ },
83
+ "ipAddress": {
84
+ "name": "ipAddress",
85
+ "type": "varchar(45)",
86
+ "primaryKey": false,
87
+ "notNull": true
88
+ },
89
+ "userAgent": {
90
+ "name": "userAgent",
91
+ "type": "varchar(1024)",
92
+ "primaryKey": false,
93
+ "notNull": false
94
+ },
95
+ "successful": {
96
+ "name": "successful",
97
+ "type": "boolean",
98
+ "primaryKey": false,
99
+ "notNull": true,
100
+ "default": false
101
+ }
102
+ },
103
+ "indexes": {},
104
+ "foreignKeys": {
105
+ "loginHistory_userId_users_id_fk": {
106
+ "name": "loginHistory_userId_users_id_fk",
107
+ "tableFrom": "loginHistory",
108
+ "tableTo": "users",
109
+ "columnsFrom": [
110
+ "userId"
111
+ ],
112
+ "columnsTo": [
113
+ "id"
114
+ ],
115
+ "onDelete": "no action",
116
+ "onUpdate": "no action"
117
+ }
118
+ },
119
+ "compositePrimaryKeys": {},
120
+ "uniqueConstraints": {}
121
+ },
122
+ "public.passwordResetAttempts": {
123
+ "name": "passwordResetAttempts",
124
+ "schema": "",
125
+ "columns": {
126
+ "id": {
127
+ "name": "id",
128
+ "type": "uuid",
129
+ "primaryKey": true,
130
+ "notNull": true,
131
+ "default": "gen_random_uuid()"
132
+ },
133
+ "userId": {
134
+ "name": "userId",
135
+ "type": "uuid",
136
+ "primaryKey": false,
137
+ "notNull": true
138
+ },
139
+ "requestedIp": {
140
+ "name": "requestedIp",
141
+ "type": "varchar(45)",
142
+ "primaryKey": false,
143
+ "notNull": true
144
+ },
145
+ "requestedAt": {
146
+ "name": "requestedAt",
147
+ "type": "timestamp with time zone",
148
+ "primaryKey": false,
149
+ "notNull": true,
150
+ "default": "now()"
151
+ },
152
+ "succeededIp": {
153
+ "name": "succeededIp",
154
+ "type": "varchar(45)",
155
+ "primaryKey": false,
156
+ "notNull": false
157
+ },
158
+ "succeededAt": {
159
+ "name": "succeededAt",
160
+ "type": "timestamp with time zone",
161
+ "primaryKey": false,
162
+ "notNull": false
163
+ },
164
+ "verificationMethod": {
165
+ "name": "verificationMethod",
166
+ "type": "twoFactorMethod",
167
+ "typeSchema": "public",
168
+ "primaryKey": false,
169
+ "notNull": true
170
+ }
171
+ },
172
+ "indexes": {},
173
+ "foreignKeys": {
174
+ "passwordResetAttempts_userId_users_id_fk": {
175
+ "name": "passwordResetAttempts_userId_users_id_fk",
176
+ "tableFrom": "passwordResetAttempts",
177
+ "tableTo": "users",
178
+ "columnsFrom": [
179
+ "userId"
180
+ ],
181
+ "columnsTo": [
182
+ "id"
183
+ ],
184
+ "onDelete": "no action",
185
+ "onUpdate": "no action"
186
+ }
187
+ },
188
+ "compositePrimaryKeys": {},
189
+ "uniqueConstraints": {}
190
+ },
191
+ "public.players": {
192
+ "name": "players",
193
+ "schema": "",
194
+ "columns": {
195
+ "userId": {
196
+ "name": "userId",
197
+ "type": "uuid",
198
+ "primaryKey": false,
199
+ "notNull": true
200
+ },
201
+ "gameId": {
202
+ "name": "gameId",
203
+ "type": "uuid",
204
+ "primaryKey": false,
205
+ "notNull": true
206
+ },
207
+ "score": {
208
+ "name": "score",
209
+ "type": "integer",
210
+ "primaryKey": false,
211
+ "notNull": true
212
+ }
213
+ },
214
+ "indexes": {},
215
+ "foreignKeys": {
216
+ "players_userId_users_id_fk": {
217
+ "name": "players_userId_users_id_fk",
218
+ "tableFrom": "players",
219
+ "tableTo": "users",
220
+ "columnsFrom": [
221
+ "userId"
222
+ ],
223
+ "columnsTo": [
224
+ "id"
225
+ ],
226
+ "onDelete": "no action",
227
+ "onUpdate": "no action"
228
+ },
229
+ "players_gameId_games_id_fk": {
230
+ "name": "players_gameId_games_id_fk",
231
+ "tableFrom": "players",
232
+ "tableTo": "games",
233
+ "columnsFrom": [
234
+ "gameId"
235
+ ],
236
+ "columnsTo": [
237
+ "id"
238
+ ],
239
+ "onDelete": "no action",
240
+ "onUpdate": "no action"
241
+ }
242
+ },
243
+ "compositePrimaryKeys": {
244
+ "players_userId_gameId_pk": {
245
+ "name": "players_userId_gameId_pk",
246
+ "columns": [
247
+ "userId",
248
+ "gameId"
249
+ ]
250
+ }
251
+ },
252
+ "uniqueConstraints": {}
253
+ },
254
+ "public.userChanges": {
255
+ "name": "userChanges",
256
+ "schema": "",
257
+ "columns": {
258
+ "id": {
259
+ "name": "id",
260
+ "type": "uuid",
261
+ "primaryKey": true,
262
+ "notNull": true,
263
+ "default": "gen_random_uuid()"
264
+ },
265
+ "userId": {
266
+ "name": "userId",
267
+ "type": "uuid",
268
+ "primaryKey": false,
269
+ "notNull": true
270
+ },
271
+ "changedAt": {
272
+ "name": "changedAt",
273
+ "type": "timestamp with time zone",
274
+ "primaryKey": false,
275
+ "notNull": true,
276
+ "default": "now()"
277
+ },
278
+ "changedIp": {
279
+ "name": "changedIp",
280
+ "type": "varchar(45)",
281
+ "primaryKey": false,
282
+ "notNull": true
283
+ },
284
+ "changedColumn": {
285
+ "name": "changedColumn",
286
+ "type": "trackedUserColumnName",
287
+ "typeSchema": "public",
288
+ "primaryKey": false,
289
+ "notNull": true
290
+ },
291
+ "oldValue": {
292
+ "name": "oldValue",
293
+ "type": "varchar(255)",
294
+ "primaryKey": false,
295
+ "notNull": false
296
+ },
297
+ "newValue": {
298
+ "name": "newValue",
299
+ "type": "varchar(255)",
300
+ "primaryKey": false,
301
+ "notNull": false
302
+ }
303
+ },
304
+ "indexes": {},
305
+ "foreignKeys": {
306
+ "userChanges_userId_users_id_fk": {
307
+ "name": "userChanges_userId_users_id_fk",
308
+ "tableFrom": "userChanges",
309
+ "tableTo": "users",
310
+ "columnsFrom": [
311
+ "userId"
312
+ ],
313
+ "columnsTo": [
314
+ "id"
315
+ ],
316
+ "onDelete": "no action",
317
+ "onUpdate": "no action"
318
+ }
319
+ },
320
+ "compositePrimaryKeys": {},
321
+ "uniqueConstraints": {}
322
+ },
323
+ "public.users": {
324
+ "name": "users",
325
+ "schema": "",
326
+ "columns": {
327
+ "id": {
328
+ "name": "id",
329
+ "type": "uuid",
330
+ "primaryKey": true,
331
+ "notNull": true,
332
+ "default": "gen_random_uuid()"
333
+ },
334
+ "username": {
335
+ "name": "username",
336
+ "type": "varchar(16)",
337
+ "primaryKey": false,
338
+ "notNull": true
339
+ },
340
+ "email": {
341
+ "name": "email",
342
+ "type": "varchar(254)",
343
+ "primaryKey": false,
344
+ "notNull": true
345
+ },
346
+ "hash": {
347
+ "name": "hash",
348
+ "type": "varchar(64)",
349
+ "primaryKey": false,
350
+ "notNull": true
351
+ },
352
+ "salt": {
353
+ "name": "salt",
354
+ "type": "varchar(36)",
355
+ "primaryKey": false,
356
+ "notNull": true
357
+ },
358
+ "createdAt": {
359
+ "name": "createdAt",
360
+ "type": "timestamp with time zone",
361
+ "primaryKey": false,
362
+ "notNull": true,
363
+ "default": "now()"
364
+ },
365
+ "createdIp": {
366
+ "name": "createdIp",
367
+ "type": "varchar(45)",
368
+ "primaryKey": false,
369
+ "notNull": true
370
+ },
371
+ "isActive": {
372
+ "name": "isActive",
373
+ "type": "boolean",
374
+ "primaryKey": false,
375
+ "notNull": true,
376
+ "default": false
377
+ },
378
+ "verifiedAt": {
379
+ "name": "verifiedAt",
380
+ "type": "timestamp with time zone",
381
+ "primaryKey": false,
382
+ "notNull": false
383
+ },
384
+ "userRole": {
385
+ "name": "userRole",
386
+ "type": "role",
387
+ "typeSchema": "public",
388
+ "primaryKey": false,
389
+ "notNull": false,
390
+ "default": "'user'"
391
+ }
392
+ },
393
+ "indexes": {
394
+ "users_username_index": {
395
+ "name": "users_username_index",
396
+ "columns": [
397
+ {
398
+ "expression": "username",
399
+ "isExpression": false,
400
+ "asc": true,
401
+ "nulls": "last"
402
+ }
403
+ ],
404
+ "isUnique": true,
405
+ "concurrently": false,
406
+ "method": "btree",
407
+ "with": {}
408
+ },
409
+ "users_email_index": {
410
+ "name": "users_email_index",
411
+ "columns": [
412
+ {
413
+ "expression": "email",
414
+ "isExpression": false,
415
+ "asc": true,
416
+ "nulls": "last"
417
+ }
418
+ ],
419
+ "isUnique": true,
420
+ "concurrently": false,
421
+ "method": "btree",
422
+ "with": {}
423
+ }
424
+ },
425
+ "foreignKeys": {},
426
+ "compositePrimaryKeys": {},
427
+ "uniqueConstraints": {}
428
+ }
429
+ },
430
+ "enums": {
431
+ "public.role": {
432
+ "name": "role",
433
+ "schema": "public",
434
+ "values": [
435
+ "admin",
436
+ "user"
437
+ ]
438
+ },
439
+ "public.trackedUserColumnName": {
440
+ "name": "trackedUserColumnName",
441
+ "schema": "public",
442
+ "values": [
443
+ "username",
444
+ "email",
445
+ "hash",
446
+ "userRole"
447
+ ]
448
+ },
449
+ "public.twoFactorMethod": {
450
+ "name": "twoFactorMethod",
451
+ "schema": "public",
452
+ "values": [
453
+ "email",
454
+ "phone"
455
+ ]
456
+ }
457
+ },
458
+ "schemas": {},
459
+ "sequences": {},
460
+ "_meta": {
461
+ "columns": {},
462
+ "schemas": {},
463
+ "tables": {}
464
+ }
465
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1727687028546,
9
+ "tag": "0000_fine_hardball",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1728507299210,
16
+ "tag": "0001_public_greymalkin",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1728509662761,
23
+ "tag": "0002_loud_stature",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1728515802620,
30
+ "tag": "0003_lyrical_malice",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1728519212883,
37
+ "tag": "0004_funny_tana_nile",
38
+ "breakpoints": true
39
+ },
40
+ {
41
+ "idx": 5,
42
+ "version": "7",
43
+ "when": 1728522394016,
44
+ "tag": "0005_reflective_warstar",
45
+ "breakpoints": true
46
+ },
47
+ {
48
+ "idx": 6,
49
+ "version": "7",
50
+ "when": 1728529865579,
51
+ "tag": "0006_mushy_young_avengers",
52
+ "breakpoints": true
53
+ },
54
+ {
55
+ "idx": 7,
56
+ "version": "7",
57
+ "when": 1728541189904,
58
+ "tag": "0007_charming_strong_guy",
59
+ "breakpoints": true
60
+ }
61
+ ]
62
+ }
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "tempest.games",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "type": "module",
8
8
  "bin": {
9
9
  "frontend": "./bin/frontend.bun.js",
10
- "backend": "./bin/backend.bun.js"
10
+ "backend": "./bin/backend.bun.js",
11
+ "setup-db": "./bin/setup-db.bun.js"
11
12
  },
12
13
  "files": [
13
- "__scripts__",
14
14
  "app",
15
15
  "bin",
16
16
  "CHANGELOG.md",
17
+ "drizzle",
17
18
  "index.html"
18
19
  ],
19
20
  "dependencies": {
@@ -29,11 +30,12 @@
29
30
  "socket.io-client": "4.8.0",
30
31
  "zod": "3.23.8",
31
32
  "zod-to-json-schema": "3.23.3",
32
- "atom.io": "0.30.0"
33
+ "atom.io": "0.30.0",
34
+ "treetrunks": "0.0.1"
33
35
  },
34
36
  "devDependencies": {
35
37
  "@eslint/js": "9.12.0",
36
- "@types/node": "22.7.5",
38
+ "@types/node": "22.7.6",
37
39
  "@types/react": "18.3.11",
38
40
  "@types/react-dom": "18.3.1",
39
41
  "@vitejs/plugin-react-swc": "3.7.1",
@@ -41,12 +43,13 @@
41
43
  "concurrently": "9.0.1",
42
44
  "cross-env": "7.0.3",
43
45
  "dotenv": "16.4.5",
46
+ "dotenv-cli": "7.4.2",
44
47
  "drizzle-kit": "0.26.2",
45
48
  "eslint": "9.12.0",
46
49
  "eslint-plugin-react-refresh": "0.4.12",
47
50
  "globals": "15.11.0",
48
51
  "rimraf": "6.0.1",
49
- "sass-embedded": "1.79.5",
52
+ "sass-embedded": "1.80.0",
50
53
  "tsx": "4.19.1",
51
54
  "typescript": "5.6.3",
52
55
  "typescript-eslint": "8.9.0",
@@ -60,10 +63,8 @@
60
63
  "dev:vite": "vite --port 3333",
61
64
  "dev:backend": "cross-env RUN_WORKERS_FROM_SOURCE=true PORT=4444 bun --hot ./src/backend.bun.ts",
62
65
  "build": "rimraf ./bin && concurrently \"bun:build:*\"",
63
- "build:vite": "vite build --outDir ./app",
64
- "build:frontend": "bun build ./src/frontend.bun.ts --outdir ./bin --bundle --minify --target bun",
65
- "build:backend": "bun build ./src/backend.bun.ts --outdir ./bin --bundle --minify --target bun",
66
- "build:backend:game": "bun build ./src/backend.worker.game.bun.ts --outdir ./bin --bundle --minify --target bun",
66
+ "build:vite": "vite build",
67
+ "build:bun": "./build.bun.ts",
67
68
  "preview": "nr build && concurrently \"bun:preview:*\"",
68
69
  "preview:frontend": "./bin/frontend.bun.js",
69
70
  "preview:backend": "./bin/backend.bun.js",
@@ -79,6 +80,6 @@
79
80
  "db:dev": "drizzle-kit studio",
80
81
  "db:gen": "drizzle-kit generate",
81
82
  "db:nuke": "./__scripts__/destroy-db.bun.ts",
82
- "db:up": "./__scripts__/setup-db.bun.ts && drizzle-kit migrate"
83
+ "db:setup": "./__scripts__/setup-db.bun.ts"
83
84
  }
84
85
  }
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import * as os from "node:os"
4
-
5
- import postgres from "postgres"
6
-
7
- import { env } from "../src/library/env.ts"
8
-
9
- const PRETTY_PLEASE = process.env.PRETTY_PLEASE
10
-
11
- if (!PRETTY_PLEASE) {
12
- console.warn(`🚨 this is a dangerous script, please ask nicely`)
13
- process.exit(1)
14
- }
15
-
16
- const osUser = os.userInfo().username
17
- const user = osUser === `unknown` ? `postgres` : osUser
18
-
19
- const sql = postgres({
20
- user,
21
- password: env.POSTGRES_PASSWORD,
22
- database: `postgres`,
23
- host: env.POSTGRES_HOST,
24
- port: env.POSTGRES_PORT,
25
- })
26
-
27
- await sql.unsafe(`DROP DATABASE ${env.POSTGRES_DATABASE};`)
28
-
29
- await sql.end()
@@ -1,57 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import * as os from "node:os"
4
-
5
- import postgres from "postgres"
6
-
7
- import { env } from "../src/library/env.ts"
8
-
9
- const osUser = os.userInfo().username
10
- const user = osUser === `unknown` ? `postgres` : osUser
11
-
12
- const sql = postgres({
13
- user,
14
- password: env.POSTGRES_PASSWORD,
15
- database: `postgres`,
16
- host: env.POSTGRES_HOST,
17
- port: env.POSTGRES_PORT,
18
- })
19
-
20
- try {
21
- process.stdout.write(`🚀 Creating database ${env.POSTGRES_DATABASE}... `)
22
- await sql`CREATE DATABASE ${sql(env.POSTGRES_DATABASE)}`
23
- console.log(`Done!`)
24
- } catch (thrown) {
25
- if (thrown instanceof Error) {
26
- console.error(`💥 Failed:`, thrown.message)
27
- }
28
- }
29
-
30
- try {
31
- process.stdout.write(`🚀 Creating user ${env.POSTGRES_USER}... `)
32
- await sql.unsafe(
33
- `CREATE USER ${env.POSTGRES_USER} WITH PASSWORD '${env.POSTGRES_PASSWORD}'`,
34
- )
35
- console.log(`Done!`)
36
- } catch (thrown) {
37
- if (thrown instanceof Error) {
38
- console.error(`💥 Failed:`, thrown.message)
39
- }
40
- }
41
-
42
- try {
43
- process.stdout.write(
44
- `🚀 Granting privileges to ${env.POSTGRES_USER} on ${env.POSTGRES_DATABASE}... `,
45
- )
46
- await sql`GRANT ALL PRIVILEGES ON DATABASE ${sql(env.POSTGRES_DATABASE)} TO ${sql(
47
- env.POSTGRES_USER,
48
- )}`
49
- console.log(`Done!`)
50
- } catch (thrown) {
51
- if (thrown instanceof Error) {
52
- console.error(`💥 Failed:`, thrown.message)
53
- }
54
- }
55
-
56
- await sql.end()
57
- console.log(`🚀 Database connection closed`)
@@ -1,5 +0,0 @@
1
- import { execSync } from "node:child_process"
2
-
3
- export default (): void => {
4
- execSync(`pnpm db:up`)
5
- }