@slotform/auth 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +26 -2
- package/dist/ability/index.d.ts +31 -0
- package/dist/ability/index.d.ts.map +1 -0
- package/dist/ability/index.js +64 -0
- package/dist/ability/index.js.map +1 -0
- package/dist/access.d.ts +19 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +33 -0
- package/dist/access.js.map +1 -0
- package/dist/callback-stubs.d.ts +15 -0
- package/dist/callback-stubs.d.ts.map +1 -0
- package/dist/callback-stubs.js +28 -0
- package/dist/callback-stubs.js.map +1 -0
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +37 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +190 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +451 -0
- package/dist/index.js.map +1 -0
- package/dist/infer.d.ts +31 -0
- package/dist/infer.d.ts.map +1 -0
- package/dist/infer.js +2 -0
- package/dist/infer.js.map +1 -0
- package/dist/schema/devices.d.ts +404 -0
- package/dist/schema/devices.d.ts.map +1 -0
- package/dist/schema/devices.js +45 -0
- package/dist/schema/devices.js.map +1 -0
- package/dist/schema/index.d.ts +679 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +94 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/oauth.d.ts +2062 -0
- package/dist/schema/oauth.d.ts.map +1 -0
- package/dist/schema/oauth.js +245 -0
- package/dist/schema/oauth.js.map +1 -0
- package/dist/schema/organization.d.ts +388 -0
- package/dist/schema/organization.d.ts.map +1 -0
- package/dist/schema/organization.js +75 -0
- package/dist/schema/organization.js.map +1 -0
- package/dist/schema/passkey.d.ts +215 -0
- package/dist/schema/passkey.d.ts.map +1 -0
- package/dist/schema/passkey.js +29 -0
- package/dist/schema/passkey.js.map +1 -0
- package/dist/schema/sets.d.ts +3715 -0
- package/dist/schema/sets.d.ts.map +1 -0
- package/dist/schema/sets.js +48 -0
- package/dist/schema/sets.js.map +1 -0
- package/dist/scope.d.ts +36 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +59 -0
- package/dist/scope.js.map +1 -0
- package/dist/screens-fixtures.d.ts +148 -0
- package/dist/screens-fixtures.d.ts.map +1 -0
- package/dist/screens-fixtures.js +122 -0
- package/dist/screens-fixtures.js.map +1 -0
- package/dist/screens-session.d.ts +4 -0
- package/dist/screens-session.d.ts.map +1 -0
- package/dist/screens-session.js +24 -0
- package/dist/screens-session.js.map +1 -0
- package/dist/screens.d.ts +3 -0
- package/dist/screens.d.ts.map +1 -0
- package/dist/screens.js +8 -0
- package/dist/screens.js.map +1 -0
- package/dist/serve.d.ts +3 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +44 -0
- package/dist/serve.js.map +1 -0
- package/dist/types.d.ts +152 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +215 -0
- package/dist/types.js.map +1 -0
- package/dist/worker/callback-url.d.ts +6 -0
- package/dist/worker/callback-url.d.ts.map +1 -0
- package/dist/worker/callback-url.js +57 -0
- package/dist/worker/callback-url.js.map +1 -0
- package/dist/worker/cimd-transport.d.ts +2 -0
- package/dist/worker/cimd-transport.d.ts.map +1 -0
- package/dist/worker/cimd-transport.js +86 -0
- package/dist/worker/cimd-transport.js.map +1 -0
- package/dist/worker/devices.d.ts +6 -0
- package/dist/worker/devices.d.ts.map +1 -0
- package/dist/worker/devices.js +70 -0
- package/dist/worker/devices.js.map +1 -0
- package/dist/worker/email-key.d.ts +2 -0
- package/dist/worker/email-key.d.ts.map +1 -0
- package/dist/worker/email-key.js +20 -0
- package/dist/worker/email-key.js.map +1 -0
- package/dist/worker/index.d.ts +156 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +507 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/listener.d.ts +12 -0
- package/dist/worker/listener.d.ts.map +1 -0
- package/dist/worker/listener.js +37 -0
- package/dist/worker/listener.js.map +1 -0
- package/dist/worker/oauth.d.ts +95 -0
- package/dist/worker/oauth.d.ts.map +1 -0
- package/dist/worker/oauth.js +456 -0
- package/dist/worker/oauth.js.map +1 -0
- package/dist/worker/outputs.d.ts +75 -0
- package/dist/worker/outputs.d.ts.map +1 -0
- package/dist/worker/outputs.js +7 -0
- package/dist/worker/outputs.js.map +1 -0
- package/dist/worker/procedures.d.ts +360 -0
- package/dist/worker/procedures.d.ts.map +1 -0
- package/dist/worker/procedures.js +464 -0
- package/dist/worker/procedures.js.map +1 -0
- package/dist/worker/rate-limit.d.ts +7 -0
- package/dist/worker/rate-limit.d.ts.map +1 -0
- package/dist/worker/rate-limit.js +49 -0
- package/dist/worker/rate-limit.js.map +1 -0
- package/dist/worker/reserved-slugs.d.ts +4 -0
- package/dist/worker/reserved-slugs.d.ts.map +1 -0
- package/dist/worker/reserved-slugs.js +30 -0
- package/dist/worker/reserved-slugs.js.map +1 -0
- package/dist/worker/session-ended.d.ts +6 -0
- package/dist/worker/session-ended.d.ts.map +1 -0
- package/dist/worker/session-ended.js +10 -0
- package/dist/worker/session-ended.js.map +1 -0
- package/dist/worker/sign-up-policy.d.ts +20 -0
- package/dist/worker/sign-up-policy.d.ts.map +1 -0
- package/dist/worker/sign-up-policy.js +65 -0
- package/dist/worker/sign-up-policy.js.map +1 -0
- package/dist/worker/tenancy.d.ts +23 -0
- package/dist/worker/tenancy.d.ts.map +1 -0
- package/dist/worker/tenancy.js +133 -0
- package/dist/worker/tenancy.js.map +1 -0
- package/guide/abilities.md +55 -0
- package/guide/add-a-role.md +33 -0
- package/guide/callbacks.md +97 -0
- package/guide/config.md +84 -0
- package/guide/devices.md +85 -0
- package/guide/mcp-oauth.md +97 -0
- package/guide/organizations.md +114 -0
- package/guide/protect-by-scope.md +29 -0
- package/guide/scopes.md +87 -0
- package/guide/sign-in.md +127 -0
- package/package.json +155 -3
- package/src/ability/index.ts +174 -0
- package/src/access.ts +45 -0
- package/src/callback-stubs.ts +45 -0
- package/src/client.ts +119 -0
- package/src/expo.tsx +275 -0
- package/src/index.ts +574 -0
- package/src/infer.ts +44 -0
- package/src/schema/devices.ts +54 -0
- package/src/schema/index.ts +128 -0
- package/src/schema/oauth.ts +320 -0
- package/src/schema/organization.ts +104 -0
- package/src/schema/passkey.ts +38 -0
- package/src/schema/sets.ts +73 -0
- package/src/scope.ts +135 -0
- package/src/screens-fixtures.ts +149 -0
- package/src/screens-session.ts +26 -0
- package/src/screens.ts +10 -0
- package/src/serve.ts +49 -0
- package/src/types.ts +313 -0
- package/src/worker/callback-url.ts +65 -0
- package/src/worker/cimd-transport.ts +115 -0
- package/src/worker/devices.ts +83 -0
- package/src/worker/email-key.ts +21 -0
- package/src/worker/index.ts +941 -0
- package/src/worker/listener.ts +55 -0
- package/src/worker/oauth.ts +709 -0
- package/src/worker/outputs.ts +102 -0
- package/src/worker/procedures.ts +758 -0
- package/src/worker/rate-limit.ts +64 -0
- package/src/worker/reserved-slugs.ts +39 -0
- package/src/worker/session-ended.ts +14 -0
- package/src/worker/sign-up-policy.ts +88 -0
- package/src/worker/tenancy.ts +229 -0
- package/templates/callbacks.ts +40 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Better Auth's organization-plugin tables (`organization` / `member` / `invitation`), as Drizzle SQLite tables.
|
|
2
|
+
// Schema tables: docs/architecture/plugins/auth.md, "Schema tables".
|
|
3
|
+
import { index, integer, relations, sql, sqliteTable, text, } from "@slotform/db/orm";
|
|
4
|
+
import { user } from "./index.js";
|
|
5
|
+
export const organization = sqliteTable("organization", {
|
|
6
|
+
id: text("id").primaryKey(),
|
|
7
|
+
name: text("name").notNull(),
|
|
8
|
+
slug: text("slug").notNull().unique(),
|
|
9
|
+
logo: text("logo"),
|
|
10
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" })
|
|
11
|
+
.default(sql `(cast(unixepoch('subsecond') * 1000 as integer))`)
|
|
12
|
+
.notNull(),
|
|
13
|
+
// JSON-encoded consumer metadata; better-auth reads/writes it as a string.
|
|
14
|
+
metadata: text("metadata"),
|
|
15
|
+
});
|
|
16
|
+
export const member = sqliteTable("member", {
|
|
17
|
+
id: text("id").primaryKey(),
|
|
18
|
+
organizationId: text("organization_id")
|
|
19
|
+
.notNull()
|
|
20
|
+
.references(() => organization.id),
|
|
21
|
+
userId: text("user_id")
|
|
22
|
+
.notNull()
|
|
23
|
+
.references(() => user.id),
|
|
24
|
+
role: text("role").notNull().default("member"),
|
|
25
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" })
|
|
26
|
+
.default(sql `(cast(unixepoch('subsecond') * 1000 as integer))`)
|
|
27
|
+
.notNull(),
|
|
28
|
+
}, (table) => [
|
|
29
|
+
index("member_organizationId_idx").on(table.organizationId),
|
|
30
|
+
index("member_userId_idx").on(table.userId),
|
|
31
|
+
]);
|
|
32
|
+
export const invitation = sqliteTable("invitation", {
|
|
33
|
+
id: text("id").primaryKey(),
|
|
34
|
+
organizationId: text("organization_id")
|
|
35
|
+
.notNull()
|
|
36
|
+
.references(() => organization.id),
|
|
37
|
+
email: text("email").notNull(),
|
|
38
|
+
role: text("role"),
|
|
39
|
+
status: text("status").notNull().default("pending"),
|
|
40
|
+
expiresAt: integer("expires_at", { mode: "timestamp_ms" }).notNull(),
|
|
41
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" })
|
|
42
|
+
.default(sql `(cast(unixepoch('subsecond') * 1000 as integer))`)
|
|
43
|
+
.notNull(),
|
|
44
|
+
inviterId: text("inviter_id")
|
|
45
|
+
.notNull()
|
|
46
|
+
.references(() => user.id),
|
|
47
|
+
}, (table) => [
|
|
48
|
+
index("invitation_organizationId_idx").on(table.organizationId),
|
|
49
|
+
index("invitation_email_idx").on(table.email),
|
|
50
|
+
]);
|
|
51
|
+
export const organizationRelations = relations(organization, ({ many }) => ({
|
|
52
|
+
members: many(member),
|
|
53
|
+
invitations: many(invitation),
|
|
54
|
+
}));
|
|
55
|
+
export const memberRelations = relations(member, ({ one }) => ({
|
|
56
|
+
organization: one(organization, {
|
|
57
|
+
fields: [member.organizationId],
|
|
58
|
+
references: [organization.id],
|
|
59
|
+
}),
|
|
60
|
+
user: one(user, {
|
|
61
|
+
fields: [member.userId],
|
|
62
|
+
references: [user.id],
|
|
63
|
+
}),
|
|
64
|
+
}));
|
|
65
|
+
export const invitationRelations = relations(invitation, ({ one }) => ({
|
|
66
|
+
organization: one(organization, {
|
|
67
|
+
fields: [invitation.organizationId],
|
|
68
|
+
references: [organization.id],
|
|
69
|
+
}),
|
|
70
|
+
inviter: one(user, {
|
|
71
|
+
fields: [invitation.inviterId],
|
|
72
|
+
references: [user.id],
|
|
73
|
+
}),
|
|
74
|
+
}));
|
|
75
|
+
//# sourceMappingURL=organization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../src/schema/organization.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,qEAAqE;AAUrE,OAAO,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,GAAG,EACH,WAAW,EACX,IAAI,GACJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,cAAc,EAAE;IACvD,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE;IACrC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;SACxD,OAAO,CAAC,GAAG,CAAA,kDAAkD,CAAC;SAC9D,OAAO,EAAE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,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB,CAAC;CACF,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE;QAC/B,MAAM,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;QACnC,UAAU,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;KAC7B,CAAC;IACF,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE;QAClB,MAAM,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;QAC9B,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB,CAAC;CACF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { One, Relations, SQLiteTableWithColumns } from "@slotform/db/orm";
|
|
2
|
+
export declare const passkey: SQLiteTableWithColumns<{
|
|
3
|
+
name: "passkey";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
id: import("@slotform/db/orm").SQLiteColumn<{
|
|
7
|
+
name: "id";
|
|
8
|
+
tableName: "passkey";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "SQLiteText";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: false;
|
|
15
|
+
isPrimaryKey: true;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: false;
|
|
18
|
+
enumValues: [string, ...string[]];
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {
|
|
23
|
+
length: number | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
name: import("@slotform/db/orm").SQLiteColumn<{
|
|
26
|
+
name: "name";
|
|
27
|
+
tableName: "passkey";
|
|
28
|
+
dataType: "string";
|
|
29
|
+
columnType: "SQLiteText";
|
|
30
|
+
data: string;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
notNull: false;
|
|
33
|
+
hasDefault: false;
|
|
34
|
+
isPrimaryKey: false;
|
|
35
|
+
isAutoincrement: false;
|
|
36
|
+
hasRuntimeDefault: false;
|
|
37
|
+
enumValues: [string, ...string[]];
|
|
38
|
+
baseColumn: never;
|
|
39
|
+
identity: undefined;
|
|
40
|
+
generated: undefined;
|
|
41
|
+
}, {}, {
|
|
42
|
+
length: number | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
publicKey: import("@slotform/db/orm").SQLiteColumn<{
|
|
45
|
+
name: "public_key";
|
|
46
|
+
tableName: "passkey";
|
|
47
|
+
dataType: "string";
|
|
48
|
+
columnType: "SQLiteText";
|
|
49
|
+
data: string;
|
|
50
|
+
driverParam: string;
|
|
51
|
+
notNull: true;
|
|
52
|
+
hasDefault: false;
|
|
53
|
+
isPrimaryKey: false;
|
|
54
|
+
isAutoincrement: false;
|
|
55
|
+
hasRuntimeDefault: false;
|
|
56
|
+
enumValues: [string, ...string[]];
|
|
57
|
+
baseColumn: never;
|
|
58
|
+
identity: undefined;
|
|
59
|
+
generated: undefined;
|
|
60
|
+
}, {}, {
|
|
61
|
+
length: number | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
userId: import("@slotform/db/orm").SQLiteColumn<{
|
|
64
|
+
name: "user_id";
|
|
65
|
+
tableName: "passkey";
|
|
66
|
+
dataType: "string";
|
|
67
|
+
columnType: "SQLiteText";
|
|
68
|
+
data: string;
|
|
69
|
+
driverParam: string;
|
|
70
|
+
notNull: true;
|
|
71
|
+
hasDefault: false;
|
|
72
|
+
isPrimaryKey: false;
|
|
73
|
+
isAutoincrement: false;
|
|
74
|
+
hasRuntimeDefault: false;
|
|
75
|
+
enumValues: [string, ...string[]];
|
|
76
|
+
baseColumn: never;
|
|
77
|
+
identity: undefined;
|
|
78
|
+
generated: undefined;
|
|
79
|
+
}, {}, {
|
|
80
|
+
length: number | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
credentialID: import("@slotform/db/orm").SQLiteColumn<{
|
|
83
|
+
name: "credential_id";
|
|
84
|
+
tableName: "passkey";
|
|
85
|
+
dataType: "string";
|
|
86
|
+
columnType: "SQLiteText";
|
|
87
|
+
data: string;
|
|
88
|
+
driverParam: string;
|
|
89
|
+
notNull: true;
|
|
90
|
+
hasDefault: false;
|
|
91
|
+
isPrimaryKey: false;
|
|
92
|
+
isAutoincrement: false;
|
|
93
|
+
hasRuntimeDefault: false;
|
|
94
|
+
enumValues: [string, ...string[]];
|
|
95
|
+
baseColumn: never;
|
|
96
|
+
identity: undefined;
|
|
97
|
+
generated: undefined;
|
|
98
|
+
}, {}, {
|
|
99
|
+
length: number | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
counter: import("@slotform/db/orm").SQLiteColumn<{
|
|
102
|
+
name: "counter";
|
|
103
|
+
tableName: "passkey";
|
|
104
|
+
dataType: "number";
|
|
105
|
+
columnType: "SQLiteInteger";
|
|
106
|
+
data: number;
|
|
107
|
+
driverParam: number;
|
|
108
|
+
notNull: true;
|
|
109
|
+
hasDefault: false;
|
|
110
|
+
isPrimaryKey: false;
|
|
111
|
+
isAutoincrement: false;
|
|
112
|
+
hasRuntimeDefault: false;
|
|
113
|
+
enumValues: undefined;
|
|
114
|
+
baseColumn: never;
|
|
115
|
+
identity: undefined;
|
|
116
|
+
generated: undefined;
|
|
117
|
+
}, {}, {}>;
|
|
118
|
+
deviceType: import("@slotform/db/orm").SQLiteColumn<{
|
|
119
|
+
name: "device_type";
|
|
120
|
+
tableName: "passkey";
|
|
121
|
+
dataType: "string";
|
|
122
|
+
columnType: "SQLiteText";
|
|
123
|
+
data: string;
|
|
124
|
+
driverParam: string;
|
|
125
|
+
notNull: true;
|
|
126
|
+
hasDefault: false;
|
|
127
|
+
isPrimaryKey: false;
|
|
128
|
+
isAutoincrement: false;
|
|
129
|
+
hasRuntimeDefault: false;
|
|
130
|
+
enumValues: [string, ...string[]];
|
|
131
|
+
baseColumn: never;
|
|
132
|
+
identity: undefined;
|
|
133
|
+
generated: undefined;
|
|
134
|
+
}, {}, {
|
|
135
|
+
length: number | undefined;
|
|
136
|
+
}>;
|
|
137
|
+
backedUp: import("@slotform/db/orm").SQLiteColumn<{
|
|
138
|
+
name: "backed_up";
|
|
139
|
+
tableName: "passkey";
|
|
140
|
+
dataType: "boolean";
|
|
141
|
+
columnType: "SQLiteBoolean";
|
|
142
|
+
data: boolean;
|
|
143
|
+
driverParam: number;
|
|
144
|
+
notNull: true;
|
|
145
|
+
hasDefault: false;
|
|
146
|
+
isPrimaryKey: false;
|
|
147
|
+
isAutoincrement: false;
|
|
148
|
+
hasRuntimeDefault: false;
|
|
149
|
+
enumValues: undefined;
|
|
150
|
+
baseColumn: never;
|
|
151
|
+
identity: undefined;
|
|
152
|
+
generated: undefined;
|
|
153
|
+
}, {}, {}>;
|
|
154
|
+
transports: import("@slotform/db/orm").SQLiteColumn<{
|
|
155
|
+
name: "transports";
|
|
156
|
+
tableName: "passkey";
|
|
157
|
+
dataType: "string";
|
|
158
|
+
columnType: "SQLiteText";
|
|
159
|
+
data: string;
|
|
160
|
+
driverParam: string;
|
|
161
|
+
notNull: false;
|
|
162
|
+
hasDefault: false;
|
|
163
|
+
isPrimaryKey: false;
|
|
164
|
+
isAutoincrement: false;
|
|
165
|
+
hasRuntimeDefault: false;
|
|
166
|
+
enumValues: [string, ...string[]];
|
|
167
|
+
baseColumn: never;
|
|
168
|
+
identity: undefined;
|
|
169
|
+
generated: undefined;
|
|
170
|
+
}, {}, {
|
|
171
|
+
length: number | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
createdAt: import("@slotform/db/orm").SQLiteColumn<{
|
|
174
|
+
name: "created_at";
|
|
175
|
+
tableName: "passkey";
|
|
176
|
+
dataType: "date";
|
|
177
|
+
columnType: "SQLiteTimestamp";
|
|
178
|
+
data: Date;
|
|
179
|
+
driverParam: number;
|
|
180
|
+
notNull: false;
|
|
181
|
+
hasDefault: false;
|
|
182
|
+
isPrimaryKey: false;
|
|
183
|
+
isAutoincrement: false;
|
|
184
|
+
hasRuntimeDefault: false;
|
|
185
|
+
enumValues: undefined;
|
|
186
|
+
baseColumn: never;
|
|
187
|
+
identity: undefined;
|
|
188
|
+
generated: undefined;
|
|
189
|
+
}, {}, {}>;
|
|
190
|
+
aaguid: import("@slotform/db/orm").SQLiteColumn<{
|
|
191
|
+
name: "aaguid";
|
|
192
|
+
tableName: "passkey";
|
|
193
|
+
dataType: "string";
|
|
194
|
+
columnType: "SQLiteText";
|
|
195
|
+
data: string;
|
|
196
|
+
driverParam: string;
|
|
197
|
+
notNull: false;
|
|
198
|
+
hasDefault: false;
|
|
199
|
+
isPrimaryKey: false;
|
|
200
|
+
isAutoincrement: false;
|
|
201
|
+
hasRuntimeDefault: false;
|
|
202
|
+
enumValues: [string, ...string[]];
|
|
203
|
+
baseColumn: never;
|
|
204
|
+
identity: undefined;
|
|
205
|
+
generated: undefined;
|
|
206
|
+
}, {}, {
|
|
207
|
+
length: number | undefined;
|
|
208
|
+
}>;
|
|
209
|
+
};
|
|
210
|
+
dialect: 'sqlite';
|
|
211
|
+
}>;
|
|
212
|
+
export declare const passkeyRelations: Relations<"passkey", {
|
|
213
|
+
user: One<"user", true>;
|
|
214
|
+
}>;
|
|
215
|
+
//# sourceMappingURL=passkey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../src/schema/passkey.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI/E,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBnB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;EAK1B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The passkey plugin's table (`passkey`), as a Drizzle SQLite table.
|
|
2
|
+
// Schema tables: docs/architecture/plugins/auth.md, "Schema tables".
|
|
3
|
+
import { index, integer, relations, sqliteTable, text } from "@slotform/db/orm";
|
|
4
|
+
import { user } from "./index.js";
|
|
5
|
+
export const passkey = sqliteTable("passkey", {
|
|
6
|
+
id: text("id").primaryKey(),
|
|
7
|
+
name: text("name"),
|
|
8
|
+
publicKey: text("public_key").notNull(),
|
|
9
|
+
userId: text("user_id")
|
|
10
|
+
.notNull()
|
|
11
|
+
.references(() => user.id, { onDelete: "cascade" }),
|
|
12
|
+
credentialID: text("credential_id").notNull(),
|
|
13
|
+
counter: integer("counter").notNull(),
|
|
14
|
+
deviceType: text("device_type").notNull(),
|
|
15
|
+
backedUp: integer("backed_up", { mode: "boolean" }).notNull(),
|
|
16
|
+
transports: text("transports"),
|
|
17
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }),
|
|
18
|
+
aaguid: text("aaguid"),
|
|
19
|
+
}, (table) => [
|
|
20
|
+
index("passkey_userId_idx").on(table.userId),
|
|
21
|
+
index("passkey_credentialID_idx").on(table.credentialID),
|
|
22
|
+
]);
|
|
23
|
+
export const passkeyRelations = relations(passkey, ({ one }) => ({
|
|
24
|
+
user: one(user, {
|
|
25
|
+
fields: [passkey.userId],
|
|
26
|
+
references: [user.id],
|
|
27
|
+
}),
|
|
28
|
+
}));
|
|
29
|
+
//# sourceMappingURL=passkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/schema/passkey.ts"],"names":[],"mappings":"AAAA,q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