@authhero/drizzle 1.14.1 → 1.15.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,13 @@
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
88
95
  }
89
96
  ]
90
97
  }
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.15.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.22.0",
39
+ "@authhero/proxy": "0.11.8"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@hono/zod-openapi": "^1.4.0",
@@ -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,7 @@ 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 }),
5
6
  name: text("name", { length: 255 }),
6
7
  audience: text("audience", { length: 255 }),
7
8
  sender_email: text("sender_email", { length: 255 }),