@rudderjs/auth 0.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/LICENSE +21 -0
- package/README.md +109 -0
- package/boost/guidelines.md +137 -0
- package/dist/auth-manager.d.ts +40 -0
- package/dist/auth-manager.d.ts.map +1 -0
- package/dist/auth-manager.js +85 -0
- package/dist/auth-manager.js.map +1 -0
- package/dist/contracts.d.ts +27 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +3 -0
- package/dist/contracts.js.map +1 -0
- package/dist/gate.d.ts +49 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +181 -0
- package/dist/gate.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/password-reset.d.ts +56 -0
- package/dist/password-reset.d.ts.map +1 -0
- package/dist/password-reset.js +101 -0
- package/dist/password-reset.js.map +1 -0
- package/dist/providers.d.ts +20 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +41 -0
- package/dist/providers.js.map +1 -0
- package/dist/session-guard.d.ts +21 -0
- package/dist/session-guard.d.ts.map +1 -0
- package/dist/session-guard.js +52 -0
- package/dist/session-guard.js.map +1 -0
- package/dist/verification.d.ts +58 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +93 -0
- package/dist/verification.js.map +1 -0
- package/package.json +57 -0
- package/pages/react/forgot-password/+Page.tsx +64 -0
- package/pages/react/login/+Page.tsx +70 -0
- package/pages/react/login/+guard.ts +15 -0
- package/pages/react/register/+Page.tsx +78 -0
- package/pages/react/register/+guard.ts +15 -0
- package/pages/react/reset-password/+Page.tsx +118 -0
- package/pages/solid/forgot-password/+Page.tsx +62 -0
- package/pages/solid/login/+Page.tsx +66 -0
- package/pages/solid/login/+guard.ts +15 -0
- package/pages/solid/register/+Page.tsx +72 -0
- package/pages/solid/register/+guard.ts +15 -0
- package/pages/solid/reset-password/+Page.tsx +94 -0
- package/pages/vue/forgot-password/+Page.vue +60 -0
- package/pages/vue/login/+Page.vue +63 -0
- package/pages/vue/login/+guard.ts +15 -0
- package/pages/vue/register/+Page.vue +68 -0
- package/pages/vue/register/+guard.ts +15 -0
- package/pages/vue/reset-password/+Page.vue +93 -0
- package/schema/auth.drizzle.mysql.ts +48 -0
- package/schema/auth.drizzle.pg.ts +48 -0
- package/schema/auth.drizzle.sqlite.ts +48 -0
- package/schema/auth.prisma +50 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { mysqlTable, varchar, boolean, datetime, text } from 'drizzle-orm/mysql-core'
|
|
2
|
+
|
|
3
|
+
export const user = mysqlTable('user', {
|
|
4
|
+
id: varchar('id', { length: 36 }).primaryKey(),
|
|
5
|
+
name: varchar('name', { length: 255 }).notNull(),
|
|
6
|
+
email: varchar('email', { length: 255 }).notNull().unique(),
|
|
7
|
+
emailVerified: boolean('emailVerified').notNull().default(false),
|
|
8
|
+
image: text('image'),
|
|
9
|
+
role: varchar('role', { length: 50 }).notNull().default('user'),
|
|
10
|
+
createdAt: datetime('createdAt').notNull().$defaultFn(() => new Date()),
|
|
11
|
+
updatedAt: datetime('updatedAt').notNull().$defaultFn(() => new Date()),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const session = mysqlTable('session', {
|
|
15
|
+
id: varchar('id', { length: 36 }).primaryKey(),
|
|
16
|
+
expiresAt: datetime('expiresAt').notNull(),
|
|
17
|
+
token: varchar('token', { length: 255 }).notNull().unique(),
|
|
18
|
+
createdAt: datetime('createdAt').notNull(),
|
|
19
|
+
updatedAt: datetime('updatedAt').notNull(),
|
|
20
|
+
ipAddress: varchar('ipAddress', { length: 255 }),
|
|
21
|
+
userAgent: text('userAgent'),
|
|
22
|
+
userId: varchar('userId', { length: 36 }).notNull().references(() => user.id, { onDelete: 'cascade' }),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const account = mysqlTable('account', {
|
|
26
|
+
id: varchar('id', { length: 36 }).primaryKey(),
|
|
27
|
+
accountId: varchar('accountId', { length: 255 }).notNull(),
|
|
28
|
+
providerId: varchar('providerId', { length: 255 }).notNull(),
|
|
29
|
+
userId: varchar('userId', { length: 36 }).notNull().references(() => user.id, { onDelete: 'cascade' }),
|
|
30
|
+
accessToken: text('accessToken'),
|
|
31
|
+
refreshToken: text('refreshToken'),
|
|
32
|
+
idToken: text('idToken'),
|
|
33
|
+
accessTokenExpiresAt: datetime('accessTokenExpiresAt'),
|
|
34
|
+
refreshTokenExpiresAt: datetime('refreshTokenExpiresAt'),
|
|
35
|
+
scope: text('scope'),
|
|
36
|
+
password: text('password'),
|
|
37
|
+
createdAt: datetime('createdAt').notNull(),
|
|
38
|
+
updatedAt: datetime('updatedAt').notNull(),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export const verification = mysqlTable('verification', {
|
|
42
|
+
id: varchar('id', { length: 36 }).primaryKey(),
|
|
43
|
+
identifier: varchar('identifier', { length: 255 }).notNull(),
|
|
44
|
+
value: text('value').notNull(),
|
|
45
|
+
expiresAt: datetime('expiresAt').notNull(),
|
|
46
|
+
createdAt: datetime('createdAt'),
|
|
47
|
+
updatedAt: datetime('updatedAt'),
|
|
48
|
+
})
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { pgTable, text, boolean, timestamp } from 'drizzle-orm/pg-core'
|
|
2
|
+
|
|
3
|
+
export const user = pgTable('user', {
|
|
4
|
+
id: text('id').primaryKey(),
|
|
5
|
+
name: text('name').notNull(),
|
|
6
|
+
email: text('email').notNull().unique(),
|
|
7
|
+
emailVerified: boolean('emailVerified').notNull().default(false),
|
|
8
|
+
image: text('image'),
|
|
9
|
+
role: text('role').notNull().default('user'),
|
|
10
|
+
createdAt: timestamp('createdAt').notNull().defaultNow(),
|
|
11
|
+
updatedAt: timestamp('updatedAt').notNull().defaultNow(),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const session = pgTable('session', {
|
|
15
|
+
id: text('id').primaryKey(),
|
|
16
|
+
expiresAt: timestamp('expiresAt').notNull(),
|
|
17
|
+
token: text('token').notNull().unique(),
|
|
18
|
+
createdAt: timestamp('createdAt').notNull(),
|
|
19
|
+
updatedAt: timestamp('updatedAt').notNull(),
|
|
20
|
+
ipAddress: text('ipAddress'),
|
|
21
|
+
userAgent: text('userAgent'),
|
|
22
|
+
userId: text('userId').notNull().references(() => user.id, { onDelete: 'cascade' }),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const account = pgTable('account', {
|
|
26
|
+
id: text('id').primaryKey(),
|
|
27
|
+
accountId: text('accountId').notNull(),
|
|
28
|
+
providerId: text('providerId').notNull(),
|
|
29
|
+
userId: text('userId').notNull().references(() => user.id, { onDelete: 'cascade' }),
|
|
30
|
+
accessToken: text('accessToken'),
|
|
31
|
+
refreshToken: text('refreshToken'),
|
|
32
|
+
idToken: text('idToken'),
|
|
33
|
+
accessTokenExpiresAt: timestamp('accessTokenExpiresAt'),
|
|
34
|
+
refreshTokenExpiresAt: timestamp('refreshTokenExpiresAt'),
|
|
35
|
+
scope: text('scope'),
|
|
36
|
+
password: text('password'),
|
|
37
|
+
createdAt: timestamp('createdAt').notNull(),
|
|
38
|
+
updatedAt: timestamp('updatedAt').notNull(),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export const verification = pgTable('verification', {
|
|
42
|
+
id: text('id').primaryKey(),
|
|
43
|
+
identifier: text('identifier').notNull(),
|
|
44
|
+
value: text('value').notNull(),
|
|
45
|
+
expiresAt: timestamp('expiresAt').notNull(),
|
|
46
|
+
createdAt: timestamp('createdAt'),
|
|
47
|
+
updatedAt: timestamp('updatedAt'),
|
|
48
|
+
})
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
|
|
3
|
+
export const user = sqliteTable('user', {
|
|
4
|
+
id: text('id').primaryKey(),
|
|
5
|
+
name: text('name').notNull(),
|
|
6
|
+
email: text('email').notNull().unique(),
|
|
7
|
+
emailVerified: integer('emailVerified', { mode: 'boolean' }).notNull().default(false),
|
|
8
|
+
image: text('image'),
|
|
9
|
+
role: text('role').notNull().default('user'),
|
|
10
|
+
createdAt: integer('createdAt', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
|
11
|
+
updatedAt: integer('updatedAt', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const session = sqliteTable('session', {
|
|
15
|
+
id: text('id').primaryKey(),
|
|
16
|
+
expiresAt: integer('expiresAt', { mode: 'timestamp' }).notNull(),
|
|
17
|
+
token: text('token').notNull().unique(),
|
|
18
|
+
createdAt: integer('createdAt', { mode: 'timestamp' }).notNull(),
|
|
19
|
+
updatedAt: integer('updatedAt', { mode: 'timestamp' }).notNull(),
|
|
20
|
+
ipAddress: text('ipAddress'),
|
|
21
|
+
userAgent: text('userAgent'),
|
|
22
|
+
userId: text('userId').notNull().references(() => user.id, { onDelete: 'cascade' }),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const account = sqliteTable('account', {
|
|
26
|
+
id: text('id').primaryKey(),
|
|
27
|
+
accountId: text('accountId').notNull(),
|
|
28
|
+
providerId: text('providerId').notNull(),
|
|
29
|
+
userId: text('userId').notNull().references(() => user.id, { onDelete: 'cascade' }),
|
|
30
|
+
accessToken: text('accessToken'),
|
|
31
|
+
refreshToken: text('refreshToken'),
|
|
32
|
+
idToken: text('idToken'),
|
|
33
|
+
accessTokenExpiresAt: integer('accessTokenExpiresAt', { mode: 'timestamp' }),
|
|
34
|
+
refreshTokenExpiresAt: integer('refreshTokenExpiresAt', { mode: 'timestamp' }),
|
|
35
|
+
scope: text('scope'),
|
|
36
|
+
password: text('password'),
|
|
37
|
+
createdAt: integer('createdAt', { mode: 'timestamp' }).notNull(),
|
|
38
|
+
updatedAt: integer('updatedAt', { mode: 'timestamp' }).notNull(),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export const verification = sqliteTable('verification', {
|
|
42
|
+
id: text('id').primaryKey(),
|
|
43
|
+
identifier: text('identifier').notNull(),
|
|
44
|
+
value: text('value').notNull(),
|
|
45
|
+
expiresAt: integer('expiresAt', { mode: 'timestamp' }).notNull(),
|
|
46
|
+
createdAt: integer('createdAt', { mode: 'timestamp' }),
|
|
47
|
+
updatedAt: integer('updatedAt', { mode: 'timestamp' }),
|
|
48
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
model User {
|
|
2
|
+
id String @id @default(cuid())
|
|
3
|
+
name String
|
|
4
|
+
email String @unique
|
|
5
|
+
emailVerified Boolean @default(false)
|
|
6
|
+
image String?
|
|
7
|
+
role String @default("user")
|
|
8
|
+
createdAt DateTime @default(now())
|
|
9
|
+
updatedAt DateTime @updatedAt
|
|
10
|
+
sessions Session[]
|
|
11
|
+
accounts Account[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
model Session {
|
|
15
|
+
id String @id
|
|
16
|
+
expiresAt DateTime
|
|
17
|
+
token String @unique
|
|
18
|
+
createdAt DateTime
|
|
19
|
+
updatedAt DateTime
|
|
20
|
+
ipAddress String?
|
|
21
|
+
userAgent String?
|
|
22
|
+
userId String
|
|
23
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
model Account {
|
|
27
|
+
id String @id
|
|
28
|
+
accountId String
|
|
29
|
+
providerId String
|
|
30
|
+
userId String
|
|
31
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
32
|
+
accessToken String?
|
|
33
|
+
refreshToken String?
|
|
34
|
+
idToken String?
|
|
35
|
+
accessTokenExpiresAt DateTime?
|
|
36
|
+
refreshTokenExpiresAt DateTime?
|
|
37
|
+
scope String?
|
|
38
|
+
password String?
|
|
39
|
+
createdAt DateTime
|
|
40
|
+
updatedAt DateTime
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
model Verification {
|
|
44
|
+
id String @id
|
|
45
|
+
identifier String
|
|
46
|
+
value String
|
|
47
|
+
expiresAt DateTime
|
|
48
|
+
createdAt DateTime?
|
|
49
|
+
updatedAt DateTime?
|
|
50
|
+
}
|