@authhero/drizzle 1.15.0 → 1.17.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.
@@ -92,6 +92,34 @@
92
92
  "when": 1792582732883,
93
93
  "tag": "0012_config_inheritance",
94
94
  "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "6",
99
+ "when": 1792995618082,
100
+ "tag": "0013_config_sync_hash",
101
+ "breakpoints": true
102
+ },
103
+ {
104
+ "idx": 14,
105
+ "version": "6",
106
+ "when": 1792998118057,
107
+ "tag": "0014_config_sync_mode",
108
+ "breakpoints": true
109
+ },
110
+ {
111
+ "idx": 15,
112
+ "version": "6",
113
+ "when": 1793097798972,
114
+ "tag": "0015_device_codes",
115
+ "breakpoints": true
116
+ },
117
+ {
118
+ "idx": 16,
119
+ "version": "6",
120
+ "when": 1793196589959,
121
+ "tag": "0016_tenant_member_requests",
122
+ "breakpoints": true
95
123
  }
96
124
  ]
97
125
  }
@@ -0,0 +1,2 @@
1
+ ALTER TABLE `rollouts` ADD `config` text;--> statement-breakpoint
2
+ ALTER TABLE `rollouts` ADD `paused_reason` text;
@@ -0,0 +1,487 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "db99d1dd-5fd4-477b-a09b-ad1d3e31e27d",
5
+ "prevId": "79f44de1-fa03-4d42-a841-a47b24e06154",
6
+ "tables": {
7
+ "tenant_operation_events": {
8
+ "name": "tenant_operation_events",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text(255)",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "operation_id": {
18
+ "name": "operation_id",
19
+ "type": "text(255)",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "step": {
25
+ "name": "step",
26
+ "type": "text(255)",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "outcome": {
32
+ "name": "outcome",
33
+ "type": "text(32)",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "detail": {
39
+ "name": "detail",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "attempt": {
46
+ "name": "attempt",
47
+ "type": "integer",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false,
51
+ "default": 1
52
+ },
53
+ "created_at": {
54
+ "name": "created_at",
55
+ "type": "text(35)",
56
+ "primaryKey": false,
57
+ "notNull": true,
58
+ "autoincrement": false
59
+ }
60
+ },
61
+ "indexes": {
62
+ "tenant_operation_events_operation_id_created_at_idx": {
63
+ "name": "tenant_operation_events_operation_id_created_at_idx",
64
+ "columns": [
65
+ "operation_id",
66
+ "created_at"
67
+ ],
68
+ "isUnique": false
69
+ }
70
+ },
71
+ "foreignKeys": {
72
+ "tenant_operation_events_operation_id_constraint": {
73
+ "name": "tenant_operation_events_operation_id_constraint",
74
+ "tableFrom": "tenant_operation_events",
75
+ "tableTo": "tenant_operations",
76
+ "columnsFrom": [
77
+ "operation_id"
78
+ ],
79
+ "columnsTo": [
80
+ "id"
81
+ ],
82
+ "onDelete": "cascade",
83
+ "onUpdate": "no action"
84
+ }
85
+ },
86
+ "compositePrimaryKeys": {},
87
+ "uniqueConstraints": {},
88
+ "checkConstraints": {}
89
+ },
90
+ "tenant_operation_rows": {
91
+ "name": "tenant_operation_rows",
92
+ "columns": {
93
+ "operation_id": {
94
+ "name": "operation_id",
95
+ "type": "text(255)",
96
+ "primaryKey": false,
97
+ "notNull": true,
98
+ "autoincrement": false
99
+ },
100
+ "seq": {
101
+ "name": "seq",
102
+ "type": "integer",
103
+ "primaryKey": false,
104
+ "notNull": true,
105
+ "autoincrement": false
106
+ },
107
+ "payload": {
108
+ "name": "payload",
109
+ "type": "text",
110
+ "primaryKey": false,
111
+ "notNull": true,
112
+ "autoincrement": false
113
+ },
114
+ "status": {
115
+ "name": "status",
116
+ "type": "text(32)",
117
+ "primaryKey": false,
118
+ "notNull": true,
119
+ "autoincrement": false
120
+ },
121
+ "error_code": {
122
+ "name": "error_code",
123
+ "type": "text(64)",
124
+ "primaryKey": false,
125
+ "notNull": false,
126
+ "autoincrement": false
127
+ },
128
+ "error_message": {
129
+ "name": "error_message",
130
+ "type": "text",
131
+ "primaryKey": false,
132
+ "notNull": false,
133
+ "autoincrement": false
134
+ },
135
+ "error_path": {
136
+ "name": "error_path",
137
+ "type": "text(255)",
138
+ "primaryKey": false,
139
+ "notNull": false,
140
+ "autoincrement": false
141
+ },
142
+ "entity_id": {
143
+ "name": "entity_id",
144
+ "type": "text(255)",
145
+ "primaryKey": false,
146
+ "notNull": false,
147
+ "autoincrement": false
148
+ },
149
+ "created_at": {
150
+ "name": "created_at",
151
+ "type": "text(35)",
152
+ "primaryKey": false,
153
+ "notNull": true,
154
+ "autoincrement": false
155
+ },
156
+ "updated_at": {
157
+ "name": "updated_at",
158
+ "type": "text(35)",
159
+ "primaryKey": false,
160
+ "notNull": true,
161
+ "autoincrement": false
162
+ }
163
+ },
164
+ "indexes": {
165
+ "tenant_operation_rows_operation_id_status_idx": {
166
+ "name": "tenant_operation_rows_operation_id_status_idx",
167
+ "columns": [
168
+ "operation_id",
169
+ "status"
170
+ ],
171
+ "isUnique": false
172
+ }
173
+ },
174
+ "foreignKeys": {
175
+ "tenant_operation_rows_operation_id_constraint": {
176
+ "name": "tenant_operation_rows_operation_id_constraint",
177
+ "tableFrom": "tenant_operation_rows",
178
+ "tableTo": "tenant_operations",
179
+ "columnsFrom": [
180
+ "operation_id"
181
+ ],
182
+ "columnsTo": [
183
+ "id"
184
+ ],
185
+ "onDelete": "cascade",
186
+ "onUpdate": "no action"
187
+ }
188
+ },
189
+ "compositePrimaryKeys": {
190
+ "tenant_operation_rows_operation_id_seq_pk": {
191
+ "columns": [
192
+ "operation_id",
193
+ "seq"
194
+ ],
195
+ "name": "tenant_operation_rows_operation_id_seq_pk"
196
+ }
197
+ },
198
+ "uniqueConstraints": {},
199
+ "checkConstraints": {}
200
+ },
201
+ "tenant_operations": {
202
+ "name": "tenant_operations",
203
+ "columns": {
204
+ "id": {
205
+ "name": "id",
206
+ "type": "text(255)",
207
+ "primaryKey": true,
208
+ "notNull": true,
209
+ "autoincrement": false
210
+ },
211
+ "tenant_id": {
212
+ "name": "tenant_id",
213
+ "type": "text(255)",
214
+ "primaryKey": false,
215
+ "notNull": false,
216
+ "autoincrement": false
217
+ },
218
+ "rollout_id": {
219
+ "name": "rollout_id",
220
+ "type": "text(255)",
221
+ "primaryKey": false,
222
+ "notNull": false,
223
+ "autoincrement": false
224
+ },
225
+ "kind": {
226
+ "name": "kind",
227
+ "type": "text(32)",
228
+ "primaryKey": false,
229
+ "notNull": true,
230
+ "autoincrement": false
231
+ },
232
+ "status": {
233
+ "name": "status",
234
+ "type": "text(32)",
235
+ "primaryKey": false,
236
+ "notNull": true,
237
+ "autoincrement": false
238
+ },
239
+ "current_step": {
240
+ "name": "current_step",
241
+ "type": "text(255)",
242
+ "primaryKey": false,
243
+ "notNull": false,
244
+ "autoincrement": false
245
+ },
246
+ "engine": {
247
+ "name": "engine",
248
+ "type": "text(64)",
249
+ "primaryKey": false,
250
+ "notNull": true,
251
+ "autoincrement": false
252
+ },
253
+ "engine_instance_id": {
254
+ "name": "engine_instance_id",
255
+ "type": "text(100)",
256
+ "primaryKey": false,
257
+ "notNull": false,
258
+ "autoincrement": false
259
+ },
260
+ "target_worker_version": {
261
+ "name": "target_worker_version",
262
+ "type": "text(255)",
263
+ "primaryKey": false,
264
+ "notNull": false,
265
+ "autoincrement": false
266
+ },
267
+ "target_database_version": {
268
+ "name": "target_database_version",
269
+ "type": "text(255)",
270
+ "primaryKey": false,
271
+ "notNull": false,
272
+ "autoincrement": false
273
+ },
274
+ "error": {
275
+ "name": "error",
276
+ "type": "text",
277
+ "primaryKey": false,
278
+ "notNull": false,
279
+ "autoincrement": false
280
+ },
281
+ "initiated_by": {
282
+ "name": "initiated_by",
283
+ "type": "text(255)",
284
+ "primaryKey": false,
285
+ "notNull": false,
286
+ "autoincrement": false
287
+ },
288
+ "input": {
289
+ "name": "input",
290
+ "type": "text",
291
+ "primaryKey": false,
292
+ "notNull": false,
293
+ "autoincrement": false
294
+ },
295
+ "result": {
296
+ "name": "result",
297
+ "type": "text",
298
+ "primaryKey": false,
299
+ "notNull": false,
300
+ "autoincrement": false
301
+ },
302
+ "claimed_by": {
303
+ "name": "claimed_by",
304
+ "type": "text(255)",
305
+ "primaryKey": false,
306
+ "notNull": false,
307
+ "autoincrement": false
308
+ },
309
+ "claim_expires_at": {
310
+ "name": "claim_expires_at",
311
+ "type": "text(35)",
312
+ "primaryKey": false,
313
+ "notNull": false,
314
+ "autoincrement": false
315
+ },
316
+ "created_at": {
317
+ "name": "created_at",
318
+ "type": "text(35)",
319
+ "primaryKey": false,
320
+ "notNull": true,
321
+ "autoincrement": false
322
+ },
323
+ "updated_at": {
324
+ "name": "updated_at",
325
+ "type": "text(35)",
326
+ "primaryKey": false,
327
+ "notNull": true,
328
+ "autoincrement": false
329
+ },
330
+ "finished_at": {
331
+ "name": "finished_at",
332
+ "type": "text(35)",
333
+ "primaryKey": false,
334
+ "notNull": false,
335
+ "autoincrement": false
336
+ }
337
+ },
338
+ "indexes": {
339
+ "tenant_operations_tenant_id_created_at_idx": {
340
+ "name": "tenant_operations_tenant_id_created_at_idx",
341
+ "columns": [
342
+ "tenant_id",
343
+ "created_at"
344
+ ],
345
+ "isUnique": false
346
+ },
347
+ "tenant_operations_rollout_id_idx": {
348
+ "name": "tenant_operations_rollout_id_idx",
349
+ "columns": [
350
+ "rollout_id"
351
+ ],
352
+ "isUnique": false
353
+ },
354
+ "tenant_operations_status_idx": {
355
+ "name": "tenant_operations_status_idx",
356
+ "columns": [
357
+ "status"
358
+ ],
359
+ "isUnique": false
360
+ }
361
+ },
362
+ "foreignKeys": {},
363
+ "compositePrimaryKeys": {},
364
+ "uniqueConstraints": {},
365
+ "checkConstraints": {}
366
+ },
367
+ "rollouts": {
368
+ "name": "rollouts",
369
+ "columns": {
370
+ "id": {
371
+ "name": "id",
372
+ "type": "text(255)",
373
+ "primaryKey": true,
374
+ "notNull": true,
375
+ "autoincrement": false
376
+ },
377
+ "kind": {
378
+ "name": "kind",
379
+ "type": "text(32)",
380
+ "primaryKey": false,
381
+ "notNull": true,
382
+ "autoincrement": false
383
+ },
384
+ "status": {
385
+ "name": "status",
386
+ "type": "text(32)",
387
+ "primaryKey": false,
388
+ "notNull": true,
389
+ "autoincrement": false
390
+ },
391
+ "target_worker_version": {
392
+ "name": "target_worker_version",
393
+ "type": "text(255)",
394
+ "primaryKey": false,
395
+ "notNull": false,
396
+ "autoincrement": false
397
+ },
398
+ "target_database_version": {
399
+ "name": "target_database_version",
400
+ "type": "text(255)",
401
+ "primaryKey": false,
402
+ "notNull": false,
403
+ "autoincrement": false
404
+ },
405
+ "wave_size": {
406
+ "name": "wave_size",
407
+ "type": "integer",
408
+ "primaryKey": false,
409
+ "notNull": true,
410
+ "autoincrement": false,
411
+ "default": 10
412
+ },
413
+ "canary_tenant_ids": {
414
+ "name": "canary_tenant_ids",
415
+ "type": "text",
416
+ "primaryKey": false,
417
+ "notNull": false,
418
+ "autoincrement": false
419
+ },
420
+ "filter": {
421
+ "name": "filter",
422
+ "type": "text",
423
+ "primaryKey": false,
424
+ "notNull": false,
425
+ "autoincrement": false
426
+ },
427
+ "initiated_by": {
428
+ "name": "initiated_by",
429
+ "type": "text(255)",
430
+ "primaryKey": false,
431
+ "notNull": false,
432
+ "autoincrement": false
433
+ },
434
+ "config": {
435
+ "name": "config",
436
+ "type": "text",
437
+ "primaryKey": false,
438
+ "notNull": false,
439
+ "autoincrement": false
440
+ },
441
+ "paused_reason": {
442
+ "name": "paused_reason",
443
+ "type": "text",
444
+ "primaryKey": false,
445
+ "notNull": false,
446
+ "autoincrement": false
447
+ },
448
+ "created_at": {
449
+ "name": "created_at",
450
+ "type": "text(35)",
451
+ "primaryKey": false,
452
+ "notNull": true,
453
+ "autoincrement": false
454
+ },
455
+ "updated_at": {
456
+ "name": "updated_at",
457
+ "type": "text(35)",
458
+ "primaryKey": false,
459
+ "notNull": true,
460
+ "autoincrement": false
461
+ },
462
+ "finished_at": {
463
+ "name": "finished_at",
464
+ "type": "text(35)",
465
+ "primaryKey": false,
466
+ "notNull": false,
467
+ "autoincrement": false
468
+ }
469
+ },
470
+ "indexes": {},
471
+ "foreignKeys": {},
472
+ "compositePrimaryKeys": {},
473
+ "uniqueConstraints": {},
474
+ "checkConstraints": {}
475
+ }
476
+ },
477
+ "views": {},
478
+ "enums": {},
479
+ "_meta": {
480
+ "schemas": {},
481
+ "tables": {},
482
+ "columns": {}
483
+ },
484
+ "internal": {
485
+ "indexes": {}
486
+ }
487
+ }
@@ -15,6 +15,13 @@
15
15
  "when": 1788244239451,
16
16
  "tag": "0001_tenant_operation_rows",
17
17
  "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "6",
22
+ "when": 1793009180157,
23
+ "tag": "0002_rollout_config",
24
+ "breakpoints": true
18
25
  }
19
26
  ]
20
27
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/sesamyab/authhero"
13
13
  },
14
- "version": "1.15.0",
14
+ "version": "1.17.0",
15
15
  "files": [
16
16
  "dist",
17
17
  "src/schema",
@@ -35,8 +35,8 @@
35
35
  "dependencies": {
36
36
  "drizzle-orm": "^0.45.2",
37
37
  "nanoid": "^5.1.11",
38
- "@authhero/adapter-interfaces": "4.22.0",
39
- "@authhero/proxy": "0.11.8"
38
+ "@authhero/adapter-interfaces": "4.24.0",
39
+ "@authhero/proxy": "0.11.10"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@hono/zod-openapi": "^1.4.0",
@@ -15,6 +15,8 @@ export const rollouts = sqliteTable("rollouts", {
15
15
  canary_tenant_ids: text("canary_tenant_ids"), // JSON array of tenant ids
16
16
  filter: text("filter"), // JSON tenant filter
17
17
  initiated_by: text("initiated_by", { length: 255 }),
18
+ config: text("config"), // JSON kind-specific settings
19
+ paused_reason: text("paused_reason"),
18
20
  created_at: text("created_at", { length: 35 }).notNull(),
19
21
  updated_at: text("updated_at", { length: 35 }).notNull(),
20
22
  finished_at: text("finished_at", { length: 35 }),
@@ -0,0 +1,46 @@
1
+ import {
2
+ sqliteTable,
3
+ text,
4
+ integer,
5
+ primaryKey,
6
+ uniqueIndex,
7
+ index,
8
+ } from "drizzle-orm/sqlite-core";
9
+
10
+ export const deviceCodes = sqliteTable(
11
+ "device_codes",
12
+ {
13
+ tenant_id: text("tenant_id").notNull(),
14
+ device_code_hash: text("device_code_hash").notNull(),
15
+ user_code_hash: text("user_code_hash").notNull(),
16
+ client_id: text("client_id").notNull(),
17
+ scope: text("scope"),
18
+ audience: text("audience"),
19
+ status: text("status").notNull(),
20
+ login_id: text("login_id"),
21
+ expires_at: text("expires_at").notNull(),
22
+ created_at: text("created_at").notNull(),
23
+ last_polled_at: text("last_polled_at"),
24
+ interval: integer("interval").notNull(),
25
+ version: integer("version").notNull(),
26
+ },
27
+ (t) => [
28
+ primaryKey({ columns: [t.tenant_id, t.device_code_hash] }),
29
+ uniqueIndex("device_codes_user_code_idx").on(t.tenant_id, t.user_code_hash),
30
+ index("device_codes_expiry_idx").on(t.expires_at),
31
+ ],
32
+ );
33
+
34
+ export const deviceFlowLimits = sqliteTable(
35
+ "device_flow_limits",
36
+ {
37
+ tenant_id: text("tenant_id").notNull(),
38
+ key: text("key").notNull(),
39
+ attempts: integer("attempts").notNull(),
40
+ expires_at: text("expires_at").notNull(),
41
+ },
42
+ (t) => [
43
+ primaryKey({ columns: [t.tenant_id, t.key] }),
44
+ index("device_flow_limits_expiry_idx").on(t.expires_at),
45
+ ],
46
+ );
@@ -58,3 +58,6 @@ export * from "./logStreams";
58
58
 
59
59
  // Lazy refresh-token migration sources
60
60
  export * from "./migrationSources";
61
+
62
+ export * from "./deviceCodes";
63
+ export * from "./tenantMemberRequests";
@@ -0,0 +1,28 @@
1
+ import { sqliteTable, text, primaryKey, index } from "drizzle-orm/sqlite-core";
2
+
3
+ export const tenantMemberRequests = sqliteTable(
4
+ "tenant_member_requests",
5
+ {
6
+ tenant_id: text("tenant_id").notNull(),
7
+ id: text("id").notNull(),
8
+ kind: text("kind").notNull(),
9
+ status: text("status").notNull(),
10
+ requested_by: text("requested_by").notNull(),
11
+ payload: text("payload").notNull(),
12
+ result: text("result"),
13
+ error: text("error"),
14
+ notified_at: text("notified_at"),
15
+ created_at: text("created_at").notNull(),
16
+ updated_at: text("updated_at").notNull(),
17
+ finished_at: text("finished_at"),
18
+ },
19
+ (t) => [
20
+ primaryKey({ columns: [t.tenant_id, t.id] }),
21
+ index("tenant_member_requests_status_idx").on(
22
+ t.tenant_id,
23
+ t.status,
24
+ t.created_at,
25
+ ),
26
+ index("tenant_member_requests_finished_idx").on(t.finished_at),
27
+ ],
28
+ );
@@ -3,6 +3,9 @@ import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
3
3
  export const tenants = sqliteTable("tenants", {
4
4
  id: text("id", { length: 191 }).primaryKey(),
5
5
  parent_tenant_id: text("parent_tenant_id", { length: 191 }),
6
+ config_sync: text("config_sync", { length: 16 }),
7
+ config_sync_hash: text("config_sync_hash", { length: 64 }),
8
+ config_synced_at: text("config_synced_at", { length: 35 }),
6
9
  name: text("name", { length: 255 }),
7
10
  audience: text("audience", { length: 255 }),
8
11
  sender_email: text("sender_email", { length: 255 }),