@stacksjs/database 0.75.14 → 0.75.16
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/auth-tables.d.ts +18 -0
- package/dist/auth-tables.js +77 -8
- package/package.json +16 -16
package/dist/auth-tables.d.ts
CHANGED
|
@@ -42,6 +42,13 @@ export declare function usersTwoFactorColumnsSql(sql: SqlHelpers): string[];
|
|
|
42
42
|
* stacksjs/status#1 Phase 9).
|
|
43
43
|
*/
|
|
44
44
|
export declare function usersStripeIdSql(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Authorization-server registration policy stored on provider clients.
|
|
47
|
+
*
|
|
48
|
+
* Nullable upgrades preserve legacy personal/password clients. Provider
|
|
49
|
+
* registration requires the complete set and treats a partial row as invalid.
|
|
50
|
+
*/
|
|
51
|
+
export declare function oauthClientProviderColumnsSql(): string[];
|
|
45
52
|
/**
|
|
46
53
|
* The polymorphic owner columns on `oauth_access_tokens`.
|
|
47
54
|
*
|
|
@@ -95,6 +102,17 @@ export declare function oauthAccessTokenTokenableBackfillSql(usersTable?: string
|
|
|
95
102
|
* both schema paths have to be able to add to it idempotently.
|
|
96
103
|
*/
|
|
97
104
|
export declare function oauthAccessTokenDeviceColumnsSql(): string[];
|
|
105
|
+
/**
|
|
106
|
+
* Nullable delegation metadata for OAuth-provider access tokens.
|
|
107
|
+
*
|
|
108
|
+
* Personal access tokens deliberately leave every column null. A provider
|
|
109
|
+
* token fills all four from the immutable consent grant, which lets resource
|
|
110
|
+
* authorization distinguish delegated access from a first-party session
|
|
111
|
+
* without overloading token scopes or the polymorphic owner columns.
|
|
112
|
+
*/
|
|
113
|
+
export declare function oauthAccessTokenDelegationColumnsSql(): string[];
|
|
114
|
+
/** Nullable rotation-family metadata used only by delegated refresh tokens. */
|
|
115
|
+
export declare function oauthRefreshTokenDelegationColumnsSql(): string[];
|
|
98
116
|
/**
|
|
99
117
|
* Defensive ALTER guaranteeing `password_resets.expires_at`.
|
|
100
118
|
*
|
package/dist/auth-tables.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{randomBytes}from"node:crypto";import{log}from"@stacksjs/logging";import{env as envVars}from"@stacksjs/env";import{makeHash}from"@stacksjs/security";import{db}from"./utils";import{sqlHelpers}from"./sql-helpers";import{indexSqlForDialect,isDuplicateColumnError,isDuplicateIndexError}from"./dialect";function getDbDriver(){return envVars.DB_CONNECTION||"sqlite"}export const AUTH_TABLES=["oauth_clients","oauth_access_tokens","oauth_refresh_tokens","password_resets","email_verifications","passkeys","webauthn_challenges","two_factor_challenges","two_factor_pending_secrets"];export function usersEmailVerifiedAtSql(sql){return`ALTER TABLE users ADD COLUMN email_verified_at ${sql.nullableTimestamp}`}export function usersPasswordChangedAtSql(sql){return`ALTER TABLE users ADD COLUMN password_changed_at ${sql.nullableTimestamp}`}export function usersTwoFactorColumnsSql(sql){return["ALTER TABLE users ADD COLUMN two_factor_secret VARCHAR(255)",`ALTER TABLE users ADD COLUMN two_factor_enabled BOOLEAN NOT NULL DEFAULT ${sql.boolFalse}`,"ALTER TABLE users ADD COLUMN two_factor_last_used_step BIGINT"]}export function usersStripeIdSql(){return"ALTER TABLE users ADD COLUMN stripe_id VARCHAR(255)"}export function oauthAccessTokenTokenableColumnsSql(){return["ALTER TABLE oauth_access_tokens ADD COLUMN tokenable_type VARCHAR(255)","ALTER TABLE oauth_access_tokens ADD COLUMN tokenable_id INTEGER"]}export function oauthAccessTokenTokenableBackfillSql(usersTable="users"){return[`UPDATE oauth_access_tokens SET tokenable_type = '${usersTable}', tokenable_id = user_id WHERE tokenable_id IS NULL`]}export function oauthAccessTokenDeviceColumnsSql(){return["ALTER TABLE oauth_access_tokens ADD COLUMN user_agent VARCHAR(255)","ALTER TABLE oauth_access_tokens ADD COLUMN ip_address VARCHAR(45)"]}export function passwordResetsExpiresAtSql(){return["ALTER TABLE password_resets ADD COLUMN expires_at TIMESTAMP"]}export async function ensureUsersAuthColumns(sql,options={}){const alters=[usersEmailVerifiedAtSql(sql),usersPasswordChangedAtSql(sql),...usersTwoFactorColumnsSql(sql),usersStripeIdSql()];for(const alterSql of alters)try{await db.unsafe(alterSql).execute()}catch{if(options.verbose)log.debug(`[auth-tables] Skipped (already applied or users missing): ${alterSql}`)}try{await db.unsafe(indexSqlForDialect("CREATE UNIQUE INDEX IF NOT EXISTS idx_users_stripe_id ON users(stripe_id)",getDbDriver())).execute()}catch{if(options.verbose)log.debug("[auth-tables] Skipped users.stripe_id unique index (already applied or users missing)")}}export async function migrateAuthTables(options={}){const dbDriver=getDbDriver(),sql=sqlHelpers(dbDriver),{isPostgres,boolTrue,now,pkColumn,nullableTimestamp,datetime,utcNow}=sql;if(options.verbose)log.info(`Creating auth tables for ${dbDriver}...`);try{if(options.verbose)log.info("Creating oauth_clients table...");await db.unsafe(`
|
|
1
|
+
import{randomBytes}from"node:crypto";import{log}from"@stacksjs/logging";import{env as envVars}from"@stacksjs/env";import{makeHash}from"@stacksjs/security";import{db}from"./utils";import{sqlHelpers}from"./sql-helpers";import{indexSqlForDialect,isDuplicateColumnError,isDuplicateIndexError}from"./dialect";function getDbDriver(){return envVars.DB_CONNECTION||"sqlite"}export const AUTH_TABLES=["oauth_clients","oauth_grants","oauth_auth_codes","oauth_authorization_requests","oauth_access_tokens","oauth_refresh_tokens","password_resets","email_verifications","passkeys","webauthn_challenges","two_factor_challenges","two_factor_pending_secrets"];export function usersEmailVerifiedAtSql(sql){return`ALTER TABLE users ADD COLUMN email_verified_at ${sql.nullableTimestamp}`}export function usersPasswordChangedAtSql(sql){return`ALTER TABLE users ADD COLUMN password_changed_at ${sql.nullableTimestamp}`}export function usersTwoFactorColumnsSql(sql){return["ALTER TABLE users ADD COLUMN two_factor_secret VARCHAR(255)",`ALTER TABLE users ADD COLUMN two_factor_enabled BOOLEAN NOT NULL DEFAULT ${sql.boolFalse}`,"ALTER TABLE users ADD COLUMN two_factor_last_used_step BIGINT"]}export function usersStripeIdSql(){return"ALTER TABLE users ADD COLUMN stripe_id VARCHAR(255)"}export function oauthClientProviderColumnsSql(){return["ALTER TABLE oauth_clients ADD COLUMN client_type VARCHAR(20)","ALTER TABLE oauth_clients ADD COLUMN redirect_uris TEXT","ALTER TABLE oauth_clients ADD COLUMN grant_types TEXT","ALTER TABLE oauth_clients ADD COLUMN token_endpoint_auth_method VARCHAR(32)","ALTER TABLE oauth_clients ADD COLUMN allowed_scopes TEXT","ALTER TABLE oauth_clients ADD COLUMN allowed_resources TEXT"]}export function oauthAccessTokenTokenableColumnsSql(){return["ALTER TABLE oauth_access_tokens ADD COLUMN tokenable_type VARCHAR(255)","ALTER TABLE oauth_access_tokens ADD COLUMN tokenable_id INTEGER"]}export function oauthAccessTokenTokenableBackfillSql(usersTable="users"){return[`UPDATE oauth_access_tokens SET tokenable_type = '${usersTable}', tokenable_id = user_id WHERE tokenable_id IS NULL`]}export function oauthAccessTokenDeviceColumnsSql(){return["ALTER TABLE oauth_access_tokens ADD COLUMN user_agent VARCHAR(255)","ALTER TABLE oauth_access_tokens ADD COLUMN ip_address VARCHAR(45)"]}export function oauthAccessTokenDelegationColumnsSql(){return["ALTER TABLE oauth_access_tokens ADD COLUMN oauth_grant_id VARCHAR(32)","ALTER TABLE oauth_access_tokens ADD COLUMN resources TEXT","ALTER TABLE oauth_access_tokens ADD COLUMN audiences TEXT","ALTER TABLE oauth_access_tokens ADD COLUMN workspace_id VARCHAR(255)"]}export function oauthRefreshTokenDelegationColumnsSql(){return["ALTER TABLE oauth_refresh_tokens ADD COLUMN family_id VARCHAR(64)","ALTER TABLE oauth_refresh_tokens ADD COLUMN parent_id BIGINT"]}export function passwordResetsExpiresAtSql(){return["ALTER TABLE password_resets ADD COLUMN expires_at TIMESTAMP"]}export async function ensureUsersAuthColumns(sql,options={}){const alters=[usersEmailVerifiedAtSql(sql),usersPasswordChangedAtSql(sql),...usersTwoFactorColumnsSql(sql),usersStripeIdSql()];for(const alterSql of alters)try{await db.unsafe(alterSql).execute()}catch{if(options.verbose)log.debug(`[auth-tables] Skipped (already applied or users missing): ${alterSql}`)}try{await db.unsafe(indexSqlForDialect("CREATE UNIQUE INDEX IF NOT EXISTS idx_users_stripe_id ON users(stripe_id)",getDbDriver())).execute()}catch{if(options.verbose)log.debug("[auth-tables] Skipped users.stripe_id unique index (already applied or users missing)")}}export async function migrateAuthTables(options={}){const dbDriver=getDbDriver(),sql=sqlHelpers(dbDriver),{isPostgres,boolTrue,now,pkColumn,nullableTimestamp,datetime,utcNow}=sql;if(options.verbose)log.info(`Creating auth tables for ${dbDriver}...`);try{if(options.verbose)log.info("Creating oauth_clients table...");await db.unsafe(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS oauth_clients (
|
|
3
3
|
${pkColumn},
|
|
4
4
|
user_id BIGINT,
|
|
@@ -6,13 +6,68 @@ import{randomBytes}from"node:crypto";import{log}from"@stacksjs/logging";import{e
|
|
|
6
6
|
secret VARCHAR(100),
|
|
7
7
|
provider VARCHAR(255),
|
|
8
8
|
redirect VARCHAR(2000) NOT NULL,
|
|
9
|
+
client_type VARCHAR(20),
|
|
10
|
+
redirect_uris TEXT,
|
|
11
|
+
grant_types TEXT,
|
|
12
|
+
token_endpoint_auth_method VARCHAR(32),
|
|
13
|
+
allowed_scopes TEXT,
|
|
14
|
+
allowed_resources TEXT,
|
|
9
15
|
personal_access_client BOOLEAN NOT NULL DEFAULT ${sql.boolFalse},
|
|
10
16
|
password_client BOOLEAN NOT NULL DEFAULT ${sql.boolFalse},
|
|
11
17
|
revoked BOOLEAN NOT NULL DEFAULT ${sql.boolFalse},
|
|
12
18
|
created_at ${datetime} DEFAULT ${utcNow},
|
|
13
19
|
updated_at ${nullableTimestamp}
|
|
14
20
|
)
|
|
15
|
-
`).execute();try{await db.unsafe("ALTER TABLE oauth_clients ADD COLUMN user_id BIGINT").execute()}catch(error){if(!isDuplicateColumnError(error))throw error}if(options.verbose)log.info("Creating
|
|
21
|
+
`).execute();try{await db.unsafe("ALTER TABLE oauth_clients ADD COLUMN user_id BIGINT").execute()}catch(error){if(!isDuplicateColumnError(error))throw error}for(const alterSql of oauthClientProviderColumnsSql())try{await db.unsafe(alterSql).execute()}catch(error){if(!isDuplicateColumnError(error))throw error}if(options.verbose)log.info("Creating oauth_grants table...");await db.unsafe(`
|
|
22
|
+
CREATE TABLE IF NOT EXISTS oauth_grants (
|
|
23
|
+
id VARCHAR(32) PRIMARY KEY,
|
|
24
|
+
client_id BIGINT NOT NULL,
|
|
25
|
+
subject_type VARCHAR(255) NOT NULL,
|
|
26
|
+
subject_id BIGINT NOT NULL,
|
|
27
|
+
scopes TEXT NOT NULL,
|
|
28
|
+
resources TEXT NOT NULL,
|
|
29
|
+
audiences TEXT NOT NULL,
|
|
30
|
+
workspace_id VARCHAR(255),
|
|
31
|
+
revoked_at ${nullableTimestamp},
|
|
32
|
+
created_at ${datetime} DEFAULT ${utcNow},
|
|
33
|
+
updated_at ${nullableTimestamp}
|
|
34
|
+
)
|
|
35
|
+
`).execute();try{await db.unsafe(indexSqlForDialect("CREATE INDEX IF NOT EXISTS idx_oauth_grants_subject ON oauth_grants(client_id, subject_type, subject_id)",dbDriver)).execute()}catch(error){if(!isDuplicateIndexError(error))throw error}if(options.verbose)log.info("Creating oauth_auth_codes table...");await db.unsafe(`
|
|
36
|
+
CREATE TABLE IF NOT EXISTS oauth_auth_codes (
|
|
37
|
+
code_hash VARCHAR(64) PRIMARY KEY,
|
|
38
|
+
grant_id VARCHAR(32) NOT NULL,
|
|
39
|
+
client_id BIGINT NOT NULL,
|
|
40
|
+
subject_type VARCHAR(255) NOT NULL,
|
|
41
|
+
subject_id BIGINT NOT NULL,
|
|
42
|
+
redirect_uri VARCHAR(2000) NOT NULL,
|
|
43
|
+
scopes TEXT NOT NULL,
|
|
44
|
+
resources TEXT NOT NULL,
|
|
45
|
+
audiences TEXT NOT NULL,
|
|
46
|
+
workspace_id VARCHAR(255),
|
|
47
|
+
code_challenge VARCHAR(43) NOT NULL,
|
|
48
|
+
code_challenge_method VARCHAR(10) NOT NULL,
|
|
49
|
+
expires_at ${datetime} NOT NULL,
|
|
50
|
+
consumed_at ${nullableTimestamp},
|
|
51
|
+
created_at ${datetime} DEFAULT ${utcNow}
|
|
52
|
+
)
|
|
53
|
+
`).execute();try{await db.unsafe("ALTER TABLE oauth_auth_codes ADD COLUMN grant_id VARCHAR(32)").execute()}catch(error){if(!isDuplicateColumnError(error))throw error}for(const statement of["CREATE INDEX IF NOT EXISTS idx_oauth_auth_codes_client_id ON oauth_auth_codes(client_id)","CREATE INDEX IF NOT EXISTS idx_oauth_auth_codes_grant_id ON oauth_auth_codes(grant_id)","CREATE INDEX IF NOT EXISTS idx_oauth_auth_codes_expires_at ON oauth_auth_codes(expires_at)"])try{await db.unsafe(indexSqlForDialect(statement,dbDriver)).execute()}catch(error){if(!isDuplicateIndexError(error))throw error}if(options.verbose)log.info("Creating oauth_authorization_requests table...");await db.unsafe(`
|
|
54
|
+
CREATE TABLE IF NOT EXISTS oauth_authorization_requests (
|
|
55
|
+
request_hash VARCHAR(64) PRIMARY KEY,
|
|
56
|
+
browser_session_hash VARCHAR(64) NOT NULL,
|
|
57
|
+
client_id BIGINT NOT NULL,
|
|
58
|
+
client_type VARCHAR(20) NOT NULL,
|
|
59
|
+
redirect_uri VARCHAR(2000) NOT NULL,
|
|
60
|
+
scopes TEXT NOT NULL,
|
|
61
|
+
resources TEXT NOT NULL,
|
|
62
|
+
audiences TEXT NOT NULL,
|
|
63
|
+
state TEXT,
|
|
64
|
+
code_challenge VARCHAR(43) NOT NULL,
|
|
65
|
+
code_challenge_method VARCHAR(10) NOT NULL,
|
|
66
|
+
expires_at ${datetime} NOT NULL,
|
|
67
|
+
consumed_at ${nullableTimestamp},
|
|
68
|
+
created_at ${datetime} DEFAULT ${utcNow}
|
|
69
|
+
)
|
|
70
|
+
`).execute();for(const statement of["CREATE INDEX IF NOT EXISTS idx_oauth_authorization_requests_client_id ON oauth_authorization_requests(client_id)","CREATE INDEX IF NOT EXISTS idx_oauth_authorization_requests_expires_at ON oauth_authorization_requests(expires_at)"])try{await db.unsafe(indexSqlForDialect(statement,dbDriver)).execute()}catch(error){if(!isDuplicateIndexError(error))throw error}if(options.verbose)log.info("Creating oauth_access_tokens table...");await db.unsafe(`
|
|
16
71
|
CREATE TABLE IF NOT EXISTS oauth_access_tokens (
|
|
17
72
|
${pkColumn},
|
|
18
73
|
-- The owner, polymorphically: users, authors, any table whose model
|
|
@@ -30,6 +85,10 @@ import{randomBytes}from"node:crypto";import{log}from"@stacksjs/logging";import{e
|
|
|
30
85
|
token TEXT NOT NULL,
|
|
31
86
|
name VARCHAR(255),
|
|
32
87
|
scopes TEXT,
|
|
88
|
+
oauth_grant_id VARCHAR(32),
|
|
89
|
+
resources TEXT,
|
|
90
|
+
audiences TEXT,
|
|
91
|
+
workspace_id VARCHAR(255),
|
|
33
92
|
revoked BOOLEAN NOT NULL DEFAULT ${sql.boolFalse},
|
|
34
93
|
expires_at ${nullableTimestamp},
|
|
35
94
|
-- What the browser called itself and where it came from, so a person
|
|
@@ -40,16 +99,18 @@ import{randomBytes}from"node:crypto";import{log}from"@stacksjs/logging";import{e
|
|
|
40
99
|
created_at ${datetime} DEFAULT ${utcNow},
|
|
41
100
|
updated_at ${nullableTimestamp}
|
|
42
101
|
)
|
|
43
|
-
`).execute();await createTokenIndex("idx_oauth_access_tokens_token","oauth_access_tokens","token");for(const alterSql of oauthAccessTokenDeviceColumnsSql())try{await db.unsafe(alterSql).execute()}catch{if(options.verbose)log.debug(`[auth-tables] Skipped (already applied): ${alterSql}`)}for(const alterSql of oauthAccessTokenTokenableColumnsSql())try{await db.unsafe(alterSql).execute()}catch{if(options.verbose)log.debug(`[auth-tables] Skipped (already applied): ${alterSql}`)}for(const backfillSql of oauthAccessTokenTokenableBackfillSql())await db.unsafe(backfillSql).execute();if(options.verbose)log.info("Creating oauth_refresh_tokens table...");await db.unsafe(`
|
|
102
|
+
`).execute();await createTokenIndex("idx_oauth_access_tokens_token","oauth_access_tokens","token");for(const alterSql of oauthAccessTokenDeviceColumnsSql())try{await db.unsafe(alterSql).execute()}catch{if(options.verbose)log.debug(`[auth-tables] Skipped (already applied): ${alterSql}`)}for(const alterSql of oauthAccessTokenDelegationColumnsSql())try{await db.unsafe(alterSql).execute()}catch(error){if(!isDuplicateColumnError(error))throw error}for(const alterSql of oauthAccessTokenTokenableColumnsSql())try{await db.unsafe(alterSql).execute()}catch{if(options.verbose)log.debug(`[auth-tables] Skipped (already applied): ${alterSql}`)}for(const backfillSql of oauthAccessTokenTokenableBackfillSql())await db.unsafe(backfillSql).execute();if(options.verbose)log.info("Creating oauth_refresh_tokens table...");await db.unsafe(`
|
|
44
103
|
CREATE TABLE IF NOT EXISTS oauth_refresh_tokens (
|
|
45
104
|
${pkColumn},
|
|
46
105
|
access_token_id INTEGER NOT NULL,
|
|
47
106
|
token TEXT NOT NULL,
|
|
107
|
+
family_id VARCHAR(64),
|
|
108
|
+
parent_id BIGINT,
|
|
48
109
|
revoked BOOLEAN NOT NULL DEFAULT ${sql.boolFalse},
|
|
49
110
|
expires_at ${nullableTimestamp},
|
|
50
111
|
created_at ${datetime} DEFAULT ${utcNow}
|
|
51
112
|
)
|
|
52
|
-
`).execute();await createTokenIndex("idx_oauth_refresh_tokens_token","oauth_refresh_tokens","token");for(const statement of["CREATE INDEX IF NOT EXISTS idx_oauth_access_tokens_owner ON oauth_access_tokens(tokenable_type, tokenable_id)","CREATE INDEX IF NOT EXISTS idx_oauth_refresh_tokens_access_token_id ON oauth_refresh_tokens(access_token_id)"])try{await db.unsafe(indexSqlForDialect(statement,dbDriver)).execute()}catch(error){if(!isDuplicateIndexError(error))throw error}if(options.verbose)log.info("Creating password_resets table...");await db.unsafe(`
|
|
113
|
+
`).execute();for(const alterSql of oauthRefreshTokenDelegationColumnsSql())try{await db.unsafe(alterSql).execute()}catch(error){if(!isDuplicateColumnError(error))throw error}await createTokenIndex("idx_oauth_refresh_tokens_token","oauth_refresh_tokens","token");for(const statement of["CREATE INDEX IF NOT EXISTS idx_oauth_access_tokens_owner ON oauth_access_tokens(tokenable_type, tokenable_id)","CREATE INDEX IF NOT EXISTS idx_oauth_access_tokens_grant_id ON oauth_access_tokens(oauth_grant_id)","CREATE INDEX IF NOT EXISTS idx_oauth_refresh_tokens_access_token_id ON oauth_refresh_tokens(access_token_id)","CREATE INDEX IF NOT EXISTS idx_oauth_refresh_tokens_family_id ON oauth_refresh_tokens(family_id)"])try{await db.unsafe(indexSqlForDialect(statement,dbDriver)).execute()}catch(error){if(!isDuplicateIndexError(error))throw error}if(options.verbose)log.info("Creating password_resets table...");await db.unsafe(`
|
|
53
114
|
CREATE TABLE IF NOT EXISTS password_resets (
|
|
54
115
|
${pkColumn},
|
|
55
116
|
email VARCHAR(255) NOT NULL,
|
|
@@ -107,10 +168,18 @@ import{randomBytes}from"node:crypto";import{log}from"@stacksjs/logging";import{e
|
|
|
107
168
|
expires_at ${datetime} NOT NULL,
|
|
108
169
|
created_at ${datetime} DEFAULT ${utcNow}
|
|
109
170
|
)
|
|
110
|
-
`).execute();if(options.verbose)log.info("Ensuring users auth columns exist (users may not exist yet on a fresh install - see ensureUsersAuthColumns)...");await ensureUsersAuthColumns(sql,options);await db.unsafe(`SELECT id, user_id, name, secret, provider, redirect,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
FROM
|
|
171
|
+
`).execute();if(options.verbose)log.info("Ensuring users auth columns exist (users may not exist yet on a fresh install - see ensureUsersAuthColumns)...");await ensureUsersAuthColumns(sql,options);await db.unsafe(`SELECT id, user_id, name, secret, provider, redirect, client_type, redirect_uris,
|
|
172
|
+
grant_types, token_endpoint_auth_method, allowed_scopes, allowed_resources,
|
|
173
|
+
personal_access_client, password_client, revoked, created_at, updated_at
|
|
174
|
+
FROM oauth_clients LIMIT 0`).execute();await db.unsafe(`SELECT id, client_id, subject_type, subject_id, scopes, resources, audiences,
|
|
175
|
+
workspace_id, revoked_at, created_at, updated_at FROM oauth_grants LIMIT 0`).execute();await db.unsafe(`SELECT code_hash, grant_id, client_id, subject_type, subject_id, redirect_uri, scopes,
|
|
176
|
+
resources, audiences, workspace_id, code_challenge, code_challenge_method, expires_at,
|
|
177
|
+
consumed_at, created_at FROM oauth_auth_codes LIMIT 0`).execute();await db.unsafe(`SELECT request_hash, browser_session_hash, client_id, client_type, redirect_uri,
|
|
178
|
+
scopes, resources, audiences, state, code_challenge, code_challenge_method,
|
|
179
|
+
expires_at, consumed_at, created_at FROM oauth_authorization_requests LIMIT 0`).execute();await db.unsafe(`SELECT id, tokenable_type, tokenable_id, user_id, oauth_client_id,
|
|
180
|
+
token, name, scopes, oauth_grant_id, resources, audiences, workspace_id, revoked, expires_at,
|
|
181
|
+
user_agent, ip_address, created_at, updated_at
|
|
182
|
+
FROM oauth_access_tokens LIMIT 0`).execute();await db.unsafe(`SELECT id, access_token_id, token, family_id, parent_id, revoked, expires_at, created_at
|
|
114
183
|
FROM oauth_refresh_tokens LIMIT 0`).execute();if(options.verbose)log.info("Ensuring personal access client exists...");if((await db.unsafe(`
|
|
115
184
|
SELECT id FROM oauth_clients
|
|
116
185
|
WHERE personal_access_client = ${boolTrue} AND revoked = ${sql.boolFalse} LIMIT 1
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/database",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.16",
|
|
6
6
|
"description": "The Stacks database integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -66,26 +66,26 @@
|
|
|
66
66
|
"prepublishOnly": "bun run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@stacksjs/config": "0.75.
|
|
70
|
-
"@stacksjs/env": "0.75.
|
|
71
|
-
"@stacksjs/error-handling": "0.75.
|
|
72
|
-
"@stacksjs/faker": "^0.75.
|
|
73
|
-
"@stacksjs/features": "0.75.
|
|
74
|
-
"@stacksjs/logging": "0.75.
|
|
75
|
-
"@stacksjs/model-meta": "0.75.
|
|
76
|
-
"@stacksjs/path": "0.75.
|
|
77
|
-
"@stacksjs/query-builder": "^0.75.
|
|
78
|
-
"@stacksjs/security": "0.75.
|
|
79
|
-
"@stacksjs/storage": "0.75.
|
|
80
|
-
"@stacksjs/strings": "0.75.
|
|
69
|
+
"@stacksjs/config": "0.75.16",
|
|
70
|
+
"@stacksjs/env": "0.75.16",
|
|
71
|
+
"@stacksjs/error-handling": "0.75.16",
|
|
72
|
+
"@stacksjs/faker": "^0.75.16",
|
|
73
|
+
"@stacksjs/features": "0.75.16",
|
|
74
|
+
"@stacksjs/logging": "0.75.16",
|
|
75
|
+
"@stacksjs/model-meta": "0.75.16",
|
|
76
|
+
"@stacksjs/path": "0.75.16",
|
|
77
|
+
"@stacksjs/query-builder": "^0.75.16",
|
|
78
|
+
"@stacksjs/security": "0.75.16",
|
|
79
|
+
"@stacksjs/storage": "0.75.16",
|
|
80
|
+
"@stacksjs/strings": "0.75.16",
|
|
81
81
|
"@stacksjs/ts-validation": "^0.5.6",
|
|
82
82
|
"bun-query-builder": "^0.3.0",
|
|
83
83
|
"dynamodb-tooling": "^0.3.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@stacksjs/cli": "0.75.
|
|
87
|
-
"@stacksjs/router": "0.75.
|
|
88
|
-
"@stacksjs/utils": "0.75.
|
|
86
|
+
"@stacksjs/cli": "0.75.16",
|
|
87
|
+
"@stacksjs/router": "0.75.16",
|
|
88
|
+
"@stacksjs/utils": "0.75.16",
|
|
89
89
|
"better-dx": "^0.2.24"
|
|
90
90
|
}
|
|
91
91
|
}
|