@authhero/drizzle 1.14.1 → 1.16.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.
@@ -85,6 +85,27 @@
85
85
  "when": 1792056769015,
86
86
  "tag": "0011_org_connections_log_streams_migration_sources",
87
87
  "breakpoints": true
88
+ },
89
+ {
90
+ "idx": 12,
91
+ "version": "6",
92
+ "when": 1792582732883,
93
+ "tag": "0012_config_inheritance",
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
88
109
  }
89
110
  ]
90
111
  }
@@ -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.14.1",
14
+ "version": "1.16.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.21.0",
39
- "@authhero/proxy": "0.11.7"
38
+ "@authhero/adapter-interfaces": "4.23.0",
39
+ "@authhero/proxy": "0.11.9"
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 }),
@@ -7,6 +7,7 @@ import {
7
7
  uniqueIndex,
8
8
  } from "drizzle-orm/sqlite-core";
9
9
  import { tenants } from "./tenants";
10
+ import { configInheritanceColumns } from "./configInheritance";
10
11
 
11
12
  // Mirrors the kysely `actions` table. Dates are stored as epoch-millisecond
12
13
  // integers (`_ts` suffix) and surfaced as ISO strings by the adapter, matching
@@ -29,6 +30,7 @@ export const actions = sqliteTable(
29
30
  deployed_at_ts: integer("deployed_at_ts"),
30
31
  is_system: integer("is_system"),
31
32
  inherit: integer("inherit"),
33
+ ...configInheritanceColumns(),
32
34
  created_at_ts: integer("created_at_ts").notNull(),
33
35
  updated_at_ts: integer("updated_at_ts").notNull(),
34
36
  },
@@ -7,11 +7,13 @@ import {
7
7
  } from "drizzle-orm/sqlite-core";
8
8
  import { tenants } from "./tenants";
9
9
  import { connections } from "./connections";
10
+ import { configInheritanceColumns } from "./configInheritance";
10
11
 
11
12
  export const branding = sqliteTable("branding", {
12
13
  tenant_id: text("tenant_id", { length: 191 })
13
14
  .primaryKey()
14
15
  .references(() => tenants.id, { onDelete: "cascade" }),
16
+ ...configInheritanceColumns(),
15
17
  logo_url: text("logo_url", { length: 512 }),
16
18
  favicon_url: text("favicon_url", { length: 512 }),
17
19
  font_url: text("font_url", { length: 512 }),
@@ -211,6 +213,7 @@ export const flows = sqliteTable(
211
213
 
212
214
  export const promptSettings = sqliteTable("prompt_settings", {
213
215
  tenant_id: text("tenant_id", { length: 191 }).primaryKey(),
216
+ ...configInheritanceColumns(),
214
217
  universal_login_experience: text("universal_login_experience", { length: 16 })
215
218
  .notNull()
216
219
  .default("new"),
@@ -234,6 +237,7 @@ export const promptSettings = sqliteTable("prompt_settings", {
234
237
 
235
238
  export const emailProviders = sqliteTable("email_providers", {
236
239
  tenant_id: text("tenant_id", { length: 191 }).primaryKey(),
240
+ ...configInheritanceColumns(),
237
241
  name: text("name", { length: 255 }).notNull(),
238
242
  enabled: integer("enabled", { mode: "boolean" }).notNull(),
239
243
  default_from_address: text("default_from_address", { length: 255 }),
@@ -290,6 +294,7 @@ export const hooks = sqliteTable(
290
294
  page_id: text("page_id", { length: 64 }), // only required for page type hooks
291
295
  permission_required: text("permission_required", { length: 255 }), // optional gate for page type hooks
292
296
  metadata: text("metadata"), // JSON property bag (inheritable flag, template options)
297
+ ...configInheritanceColumns(),
293
298
  },
294
299
  (table) => [index("hooks_tenant_id_idx").on(table.tenant_id)],
295
300
  );
@@ -0,0 +1,18 @@
1
+ import { integer, text } from "drizzle-orm/sqlite-core";
2
+
3
+ /**
4
+ * Publishing properties for tenant config inheritance
5
+ * (docs/design/tenant-config-inheritance.md, section 3.2). All nullable: unset
6
+ * reads as scope `local`, override `none`, enforce false.
7
+ *
8
+ * A function, not a constant, because column builders are stateful and must
9
+ * not be shared between tables.
10
+ */
11
+ export const configInheritanceColumns = () => ({
12
+ scope: text("scope", { length: 16, enum: ["local", "shared", "platform"] }),
13
+ override: text("override", {
14
+ length: 16,
15
+ enum: ["none", "secrets", "fields"],
16
+ }),
17
+ enforce: integer("enforce", { mode: "boolean" }),
18
+ });
@@ -7,6 +7,7 @@ import {
7
7
  uniqueIndex,
8
8
  } from "drizzle-orm/sqlite-core";
9
9
  import { tenants } from "./tenants";
10
+ import { configInheritanceColumns } from "./configInheritance";
10
11
 
11
12
  export const connections = sqliteTable(
12
13
  "connections",
@@ -26,6 +27,7 @@ export const connections = sqliteTable(
26
27
  is_domain_connection: integer("is_domain_connection"),
27
28
  show_as_button: integer("show_as_button"),
28
29
  is_system: integer("is_system").notNull().default(0),
30
+ ...configInheritanceColumns(),
29
31
  metadata: text("metadata", { length: 4096 }),
30
32
  },
31
33
  (table) => [
@@ -5,6 +5,7 @@ import {
5
5
  primaryKey,
6
6
  index,
7
7
  } from "drizzle-orm/sqlite-core";
8
+ import { configInheritanceColumns } from "./configInheritance";
8
9
 
9
10
  export const roles = sqliteTable(
10
11
  "roles",
@@ -134,6 +135,7 @@ export const resourceServers = sqliteTable(
134
135
  verification_key: text("verification_key", { length: 4096 }),
135
136
  options: text("options", { length: 4096 }),
136
137
  is_system: integer("is_system").notNull().default(0),
138
+ ...configInheritanceColumns(),
137
139
  metadata: text("metadata", { length: 4096 }),
138
140
  created_at: text("created_at", { length: 35 }).notNull(),
139
141
  updated_at: text("updated_at", { length: 35 }).notNull(),
@@ -2,6 +2,10 @@ import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
2
2
 
3
3
  export const tenants = sqliteTable("tenants", {
4
4
  id: text("id", { length: 191 }).primaryKey(),
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 }),
5
9
  name: text("name", { length: 255 }),
6
10
  audience: text("audience", { length: 255 }),
7
11
  sender_email: text("sender_email", { length: 255 }),