@authhero/drizzle 1.0.0 → 1.2.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/drizzle-adapter.cjs +2 -2
- package/dist/drizzle-adapter.mjs +969 -757
- package/drizzle/0001_scim_inbound_provisioning.sql +34 -0
- package/drizzle/0002_user_blocked.sql +1 -0
- package/drizzle/0003_prompt_settings_last_used.sql +1 -0
- package/drizzle/0004_action_executions_created_at_index.sql +1 -0
- package/drizzle/meta/0001_snapshot.json +6563 -0
- package/drizzle/meta/0002_snapshot.json +6570 -0
- package/drizzle/meta/0003_snapshot.json +6578 -0
- package/drizzle/meta/0004_snapshot.json +6586 -0
- package/drizzle/meta/_journal.json +28 -0
- package/package.json +3 -3
- package/src/schema/sqlite/actions.ts +1 -0
- package/src/schema/sqlite/branding.ts +5 -0
- package/src/schema/sqlite/index.ts +3 -0
- package/src/schema/sqlite/scim.ts +79 -0
- package/src/schema/sqlite/users.ts +2 -0
|
@@ -8,6 +8,34 @@
|
|
|
8
8
|
"when": 1784301636273,
|
|
9
9
|
"tag": "0000_init",
|
|
10
10
|
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "6",
|
|
15
|
+
"when": 1786036597896,
|
|
16
|
+
"tag": "0001_scim_inbound_provisioning",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "6",
|
|
22
|
+
"when": 1786097448605,
|
|
23
|
+
"tag": "0002_user_blocked",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "6",
|
|
29
|
+
"when": 1786288345643,
|
|
30
|
+
"tag": "0003_prompt_settings_last_used",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "6",
|
|
36
|
+
"when": 1786377042191,
|
|
37
|
+
"tag": "0004_action_executions_created_at_index",
|
|
38
|
+
"breakpoints": true
|
|
11
39
|
}
|
|
12
40
|
]
|
|
13
41
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/markusahlstrand/authhero"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.2.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.
|
|
39
|
-
"@authhero/proxy": "0.10.
|
|
38
|
+
"@authhero/adapter-interfaces": "4.5.0",
|
|
39
|
+
"@authhero/proxy": "0.10.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@hono/zod-openapi": "^1.4.0",
|
|
@@ -225,6 +225,11 @@ export const promptSettings = sqliteTable("prompt_settings", {
|
|
|
225
225
|
})
|
|
226
226
|
.notNull()
|
|
227
227
|
.default(false),
|
|
228
|
+
show_last_used_connection: integer("show_last_used_connection", {
|
|
229
|
+
mode: "boolean",
|
|
230
|
+
})
|
|
231
|
+
.notNull()
|
|
232
|
+
.default(false),
|
|
228
233
|
});
|
|
229
234
|
|
|
230
235
|
export const emailProviders = sqliteTable("email_providers", {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sqliteTable,
|
|
3
|
+
text,
|
|
4
|
+
index,
|
|
5
|
+
uniqueIndex,
|
|
6
|
+
primaryKey,
|
|
7
|
+
} from "drizzle-orm/sqlite-core";
|
|
8
|
+
|
|
9
|
+
// One SCIM configuration per connection (SCIM inbound provisioning, #1191).
|
|
10
|
+
// Every key here leads with tenant_id: connection ids are only unique within a
|
|
11
|
+
// tenant, so a tenant-less key would let one tenant's connection block
|
|
12
|
+
// another's — and the composite PK doubles as the tenant-scoped uniqueness
|
|
13
|
+
// constraint the create path relies on.
|
|
14
|
+
export const scimConfigurations = sqliteTable(
|
|
15
|
+
"scim_configurations",
|
|
16
|
+
{
|
|
17
|
+
connection_id: text("connection_id", { length: 255 }).notNull(),
|
|
18
|
+
tenant_id: text("tenant_id", { length: 255 }).notNull(),
|
|
19
|
+
user_id_attribute: text("user_id_attribute", { length: 255 })
|
|
20
|
+
.notNull()
|
|
21
|
+
.default("externalId"),
|
|
22
|
+
mapping: text("mapping", { length: 16384 }).notNull().default("[]"),
|
|
23
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
24
|
+
updated_at: text("updated_at", { length: 35 }).notNull(),
|
|
25
|
+
},
|
|
26
|
+
(table) => [primaryKey({ columns: [table.tenant_id, table.connection_id] })],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Hashed long-lived bearer tokens used by IdPs to authenticate to /scim/v2.
|
|
30
|
+
export const scimTokens = sqliteTable(
|
|
31
|
+
"scim_tokens",
|
|
32
|
+
{
|
|
33
|
+
token_id: text("token_id", { length: 64 }).notNull(),
|
|
34
|
+
tenant_id: text("tenant_id", { length: 255 }).notNull(),
|
|
35
|
+
connection_id: text("connection_id", { length: 255 }).notNull(),
|
|
36
|
+
token_hash: text("token_hash", { length: 128 }).notNull(),
|
|
37
|
+
scopes: text("scopes", { length: 4096 }).notNull().default("[]"),
|
|
38
|
+
valid_until: text("valid_until", { length: 35 }),
|
|
39
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
40
|
+
last_used_at: text("last_used_at", { length: 35 }),
|
|
41
|
+
},
|
|
42
|
+
(table) => [
|
|
43
|
+
primaryKey({ columns: [table.tenant_id, table.token_id] }),
|
|
44
|
+
index("scim_tokens_tenant_connection_idx").on(
|
|
45
|
+
table.tenant_id,
|
|
46
|
+
table.connection_id,
|
|
47
|
+
),
|
|
48
|
+
// Authentication resolves a token by hash, and a hash must identify at
|
|
49
|
+
// most one token within the tenant.
|
|
50
|
+
uniqueIndex("scim_tokens_tenant_hash_idx").on(
|
|
51
|
+
table.tenant_id,
|
|
52
|
+
table.token_hash,
|
|
53
|
+
),
|
|
54
|
+
],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Maps an IdP-assigned externalId to an AuthHero user_id, scoped to a
|
|
58
|
+
// connection. Queried both by externalId (IdP lookup before create) and by
|
|
59
|
+
// user_id (to emit externalId on reads).
|
|
60
|
+
export const scimExternalIds = sqliteTable(
|
|
61
|
+
"scim_external_ids",
|
|
62
|
+
{
|
|
63
|
+
tenant_id: text("tenant_id", { length: 255 }).notNull(),
|
|
64
|
+
connection_id: text("connection_id", { length: 255 }).notNull(),
|
|
65
|
+
external_id: text("external_id", { length: 255 }).notNull(),
|
|
66
|
+
user_id: text("user_id", { length: 255 }).notNull(),
|
|
67
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
68
|
+
},
|
|
69
|
+
(table) => [
|
|
70
|
+
primaryKey({
|
|
71
|
+
columns: [table.tenant_id, table.connection_id, table.user_id],
|
|
72
|
+
}),
|
|
73
|
+
uniqueIndex("scim_external_ids_connection_external_idx").on(
|
|
74
|
+
table.tenant_id,
|
|
75
|
+
table.connection_id,
|
|
76
|
+
table.external_id,
|
|
77
|
+
),
|
|
78
|
+
],
|
|
79
|
+
);
|
|
@@ -37,6 +37,8 @@ export const users = sqliteTable(
|
|
|
37
37
|
connection: text("connection", { length: 255 }),
|
|
38
38
|
email_verified: integer("email_verified", { mode: "boolean" }).notNull(),
|
|
39
39
|
is_social: integer("is_social", { mode: "boolean" }).notNull(),
|
|
40
|
+
// Auth0-parity account block flag. Nullable; absent/0 means not blocked.
|
|
41
|
+
blocked: integer("blocked", { mode: "boolean" }),
|
|
40
42
|
app_metadata: text("app_metadata", { length: 4096 })
|
|
41
43
|
.notNull()
|
|
42
44
|
.default("{}"),
|