@nathapp/nestjs-oauth-prisma 1.0.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/README.md +249 -0
- package/dist/abstract-prisma-public-client.repository.d.ts +20 -0
- package/dist/abstract-prisma-public-client.repository.js +54 -0
- package/dist/abstract-prisma-public-client.repository.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth-prisma.module.d.ts +7 -0
- package/dist/oauth-prisma.module.js +75 -0
- package/dist/oauth-prisma.module.js.map +1 -0
- package/dist/oauth-prisma.types.d.ts +189 -0
- package/dist/oauth-prisma.types.js +43 -0
- package/dist/oauth-prisma.types.js.map +1 -0
- package/dist/prisma-consent-logout-target.resolver.d.ts +12 -0
- package/dist/prisma-consent-logout-target.resolver.js +43 -0
- package/dist/prisma-consent-logout-target.resolver.js.map +1 -0
- package/dist/prisma-oauth-access-token.repository.d.ts +41 -0
- package/dist/prisma-oauth-access-token.repository.js +124 -0
- package/dist/prisma-oauth-access-token.repository.js.map +1 -0
- package/dist/prisma-oauth-authorization-code.repository.d.ts +41 -0
- package/dist/prisma-oauth-authorization-code.repository.js +118 -0
- package/dist/prisma-oauth-authorization-code.repository.js.map +1 -0
- package/dist/prisma-oauth-client.repository.d.ts +50 -0
- package/dist/prisma-oauth-client.repository.js +193 -0
- package/dist/prisma-oauth-client.repository.js.map +1 -0
- package/dist/prisma-oauth-consent.repository.d.ts +36 -0
- package/dist/prisma-oauth-consent.repository.js +95 -0
- package/dist/prisma-oauth-consent.repository.js.map +1 -0
- package/dist/prisma-oauth-device-code.repository.d.ts +36 -0
- package/dist/prisma-oauth-device-code.repository.js +124 -0
- package/dist/prisma-oauth-device-code.repository.js.map +1 -0
- package/dist/prisma-oauth-pushed-request.repository.d.ts +16 -0
- package/dist/prisma-oauth-pushed-request.repository.js +104 -0
- package/dist/prisma-oauth-pushed-request.repository.js.map +1 -0
- package/dist/prisma-oauth-refresh-token.repository.d.ts +28 -0
- package/dist/prisma-oauth-refresh-token.repository.js +100 -0
- package/dist/prisma-oauth-refresh-token.repository.js.map +1 -0
- package/dist/prisma-oauth-scope.repository.d.ts +25 -0
- package/dist/prisma-oauth-scope.repository.js +87 -0
- package/dist/prisma-oauth-scope.repository.js.map +1 -0
- package/dist/prisma-oauth-signing-key.repository.d.ts +24 -0
- package/dist/prisma-oauth-signing-key.repository.js +110 -0
- package/dist/prisma-oauth-signing-key.repository.js.map +1 -0
- package/dist/prisma-signing-key.provider.d.ts +22 -0
- package/dist/prisma-signing-key.provider.js +133 -0
- package/dist/prisma-signing-key.provider.js.map +1 -0
- package/package.json +45 -0
- package/prisma/migrations/20260608_oauth_signing_keys_one_active/migration.mysql.sql +8 -0
- package/prisma/migrations/20260608_oauth_signing_keys_one_active/migration.sql +3 -0
- package/prisma/migrations/20260724_oauth_client_advanced_auth_fields/migration.mysql.sql +10 -0
- package/prisma/migrations/20260724_oauth_client_advanced_auth_fields/migration.sql +9 -0
- package/prisma/migrations/20260725_oauth_resource_indicator/migration.mysql.sql +10 -0
- package/prisma/migrations/20260725_oauth_resource_indicator/migration.sql +15 -0
- package/prisma/migrations/20260725_oauth_token_exchange_actor/migration.mysql.sql +2 -0
- package/prisma/migrations/20260725_oauth_token_exchange_actor/migration.sql +2 -0
- package/prisma/migrations/20261003_oauth_access_token_mtls_binding/migration.mysql.sql +2 -0
- package/prisma/migrations/20261003_oauth_access_token_mtls_binding/migration.sql +2 -0
- package/prisma/migrations/20261004_oauth_signing_keys_one_active_per_tenant/migration.mysql.sql +13 -0
- package/prisma/migrations/20261004_oauth_signing_keys_one_active_per_tenant/migration.sql +14 -0
- package/prisma/oauth.prisma +287 -0
- package/prisma/sql/long-text-columns.mysql.sql +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# @nathapp/nestjs-oauth-prisma
|
|
2
|
+
|
|
3
|
+
Prisma adapter for `@nathapp/nestjs-oauth`. Binds the core package's repository
|
|
4
|
+
tokens to `AbstractPrismaRepository`-based implementations, plus the default
|
|
5
|
+
`SIGNING_KEY_PROVIDER`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm i @nathapp/nestjs-oauth-prisma
|
|
11
|
+
npm i -D prisma && npx prisma init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Schema
|
|
15
|
+
|
|
16
|
+
Append the 13 models from the packaged fragment
|
|
17
|
+
`node_modules/@nathapp/nestjs-oauth-prisma/prisma/oauth.prisma` to your app's
|
|
18
|
+
`schema.prisma`. The fragment carries no `datasource` or `generator` block — it
|
|
19
|
+
is models only. Every `DateTime` in it uses `@db.Timestamptz(6)` (PostgreSQL
|
|
20
|
+
`timestamptz`); bare `DateTime` is not supported — token
|
|
21
|
+
expiry comparisons misfire when the database server timezone is not UTC.
|
|
22
|
+
|
|
23
|
+
**PostgreSQL and MySQL.** The fragment is authored for PostgreSQL 16 and also
|
|
24
|
+
supports MySQL 8.0. For MySQL, assemble it with `@db.Timestamptz(6)` rewritten
|
|
25
|
+
to `@db.DateTime(6)` (the only change; see the `@nathapp/nestjs-iam-prisma`
|
|
26
|
+
README, "Schema assembly and database support") and keep the MySQL server and
|
|
27
|
+
sessions on UTC (`time_zone = '+00:00'`), because `DATETIME(6)` stores no
|
|
28
|
+
timezone. Upgrading a MySQL database built from an earlier fragment: apply
|
|
29
|
+
`prisma/sql/long-text-columns.mysql.sql` first (PostgreSQL needs nothing); on
|
|
30
|
+
MySQL the signing-key PEM columns did not fit before it, so no key could be
|
|
31
|
+
created. Each packaged migration has a `migration.mysql.sql` twin next to its
|
|
32
|
+
`migration.sql`; on MySQL the one-active-signing-key guard is a functional unique
|
|
33
|
+
index. Signing keys are per tenant (`tenant_id` NULL is the global key), so the
|
|
34
|
+
guard is one active key per tenant: apply
|
|
35
|
+
`20261004_oauth_signing_keys_one_active_per_tenant`, which replaces the global
|
|
36
|
+
index from `20260608_oauth_signing_keys_one_active`. On a multi-tenant database
|
|
37
|
+
with the old global index only one tenant could ever hold an active key. `oauth_scopes.code` compares case-insensitively under MySQL's default
|
|
38
|
+
collation, so `Read` and `read` collide there; keep scope codes lower-case.
|
|
39
|
+
|
|
40
|
+
`prisma/migrations/` in this package holds six incremental patches
|
|
41
|
+
(`oauth_signing_keys_one_active`, `oauth_client_advanced_auth_fields`,
|
|
42
|
+
`oauth_resource_indicator`, `oauth_token_exchange_actor`, `oauth_access_token_mtls_binding`,
|
|
43
|
+
`oauth_signing_keys_one_active_per_tenant`). They are deltas
|
|
44
|
+
against a database already built from the fragment, not a complete initial
|
|
45
|
+
migration set, and Prisma will not apply them for you — the consumer's migration
|
|
46
|
+
history lives in the consumer's own project. Apply them by hand when upgrading
|
|
47
|
+
an existing database, after `prisma migrate dev` has produced your own migration
|
|
48
|
+
from the fragment.
|
|
49
|
+
|
|
50
|
+
## Register
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { Module } from '@nestjs/common';
|
|
54
|
+
import { PrismaClient } from '@prisma/client';
|
|
55
|
+
import { ClockModule, IdGeneratorModule } from '@nathapp/nestjs-common';
|
|
56
|
+
import { PrismaModule } from '@nathapp/nestjs-prisma';
|
|
57
|
+
import { OAuthPrismaModule } from '@nathapp/nestjs-oauth-prisma';
|
|
58
|
+
|
|
59
|
+
@Module({
|
|
60
|
+
imports: [
|
|
61
|
+
PrismaModule.forRoot({ client: PrismaClient, transaction: true }),
|
|
62
|
+
ClockModule.register(), // provides CLOCK, required by PrismaSigningKeyProvider
|
|
63
|
+
IdGeneratorModule.register(), // provides ID_GENERATOR, same requirement
|
|
64
|
+
OAuthPrismaModule.register(),
|
|
65
|
+
],
|
|
66
|
+
})
|
|
67
|
+
export class AppModule {}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`ClockModule.register()` and `IdGeneratorModule.register()` are not optional for
|
|
71
|
+
this adapter. `PrismaSigningKeyProvider` injects `CLOCK` and `ID_GENERATOR`
|
|
72
|
+
non-optionally, and the `{ provide: SIGNING_KEY_PROVIDER, useExisting:
|
|
73
|
+
PrismaSigningKeyProvider }` binding that pulls it in is unconditional — not behind
|
|
74
|
+
any option flag. Omit either module and Nest reports `Nest can't resolve
|
|
75
|
+
dependencies of the PrismaSigningKeyProvider (Symbol(OAUTH_SIGNING_KEY_REPOSITORY),
|
|
76
|
+
Symbol(TRANSACTION_MANAGER), ?, Symbol(CLOCK))`. Please make sure that the argument
|
|
77
|
+
Symbol(ID_GENERATOR) at index [2] is available in the OAuthPrismaModule module.
|
|
78
|
+
This applies to the bare-class import form too: `imports: [OAuthPrismaModule]`
|
|
79
|
+
constructs the same provider and needs both modules.
|
|
80
|
+
|
|
81
|
+
`register()` takes an optional options object:
|
|
82
|
+
|
|
83
|
+
| Option | Type | Default | Meaning |
|
|
84
|
+
|---|---|---|---|
|
|
85
|
+
| `global` | `boolean` | `true` | Register as a global module so the repository tokens resolve anywhere. |
|
|
86
|
+
|
|
87
|
+
`register()` was added alongside the bare-class form, not in place of it. There is no
|
|
88
|
+
`registerAsync`.
|
|
89
|
+
|
|
90
|
+
### Both import forms
|
|
91
|
+
|
|
92
|
+
This adapter is unusual: unlike the other four Prisma adapters, it supports two
|
|
93
|
+
import forms.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
imports: [OAuthPrismaModule] // still supported, non-global
|
|
97
|
+
imports: [OAuthPrismaModule.register()] // global by default
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`OAuthPrismaModule` carries a `@Module({ providers, exports })` decorator as well
|
|
101
|
+
as the `register()` factory, so the bare class is a valid import. It was
|
|
102
|
+
historically the only form, and existing consumers and tests use it that way.
|
|
103
|
+
The bare class is **not** global: modules that inject these tokens must import it
|
|
104
|
+
themselves.
|
|
105
|
+
|
|
106
|
+
Prefer `OAuthPrismaModule.register()`. It is global by default, so the OAuth
|
|
107
|
+
tokens resolve anywhere without a per-module import, and it leaves room for the
|
|
108
|
+
`global` option. Migrating from the bare class to `register()` is a one-line
|
|
109
|
+
change per module and does not require touching token wiring.
|
|
110
|
+
|
|
111
|
+
> **Do not use both forms in one `imports` array.**
|
|
112
|
+
>
|
|
113
|
+
> ```ts
|
|
114
|
+
> imports: [OAuthPrismaModule, OAuthPrismaModule.register()] // two instances
|
|
115
|
+
> ```
|
|
116
|
+
>
|
|
117
|
+
> The dynamic-module token hash differs from the static class token, so Nest
|
|
118
|
+
> treats them as two separate modules and every repository is instantiated
|
|
119
|
+
> twice. Nothing warns about it. Pick one form per application.
|
|
120
|
+
|
|
121
|
+
### If you already wrap this adapter in `@Global()`
|
|
122
|
+
|
|
123
|
+
Pass `global: false`. Otherwise the adapter's own global exports are injected
|
|
124
|
+
**in addition to** your override, and last-registration-wins silently decides
|
|
125
|
+
which implementation is used:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { Global, Module } from '@nestjs/common';
|
|
129
|
+
import { ClockModule, IdGeneratorModule } from '@nathapp/nestjs-common';
|
|
130
|
+
import { OAUTH_CLIENT_REPOSITORY } from '@nathapp/nestjs-oauth';
|
|
131
|
+
import { OAuthPrismaModule } from '@nathapp/nestjs-oauth-prisma';
|
|
132
|
+
import { AuditedOAuthClientRepository } from './audited-oauth-client.repository';
|
|
133
|
+
|
|
134
|
+
@Global()
|
|
135
|
+
@Module({
|
|
136
|
+
imports: [
|
|
137
|
+
ClockModule.register(), // required by PrismaSigningKeyProvider
|
|
138
|
+
IdGeneratorModule.register(), // required by PrismaSigningKeyProvider
|
|
139
|
+
OAuthPrismaModule.register({ global: false }),
|
|
140
|
+
],
|
|
141
|
+
providers: [{ provide: OAUTH_CLIENT_REPOSITORY, useClass: AuditedOAuthClientRepository }],
|
|
142
|
+
exports: [OAUTH_CLIENT_REPOSITORY],
|
|
143
|
+
})
|
|
144
|
+
export class PrismaOverridesModule {}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`global: false` only helps if the adapter is registered once. A second, global
|
|
148
|
+
`register()` elsewhere in the app keeps its global exports, and `global: false`
|
|
149
|
+
here does not remove them — so the collision this section exists to prevent is
|
|
150
|
+
still there. Register the adapter in exactly one place.
|
|
151
|
+
|
|
152
|
+
The `global` option carries no documentation in the published type definitions
|
|
153
|
+
(`removeComments: true` strips the JSDoc from the emitted `.d.ts`), so this README
|
|
154
|
+
is where it is described. The options object is typed as `PrismaAdapterModuleOptions`,
|
|
155
|
+
which is exported from this package if you need to name the type.
|
|
156
|
+
|
|
157
|
+
## Transactions
|
|
158
|
+
|
|
159
|
+
Multi-write flows need `PrismaModule.forRoot({ client: PrismaClient, transaction: true })`.
|
|
160
|
+
Every repository resolves its client per operation from the `TRANSACTION_MANAGER`
|
|
161
|
+
token, and the two `PrismaModule` registration paths fail differently when
|
|
162
|
+
`transaction` is omitted:
|
|
163
|
+
|
|
164
|
+
- `PrismaModule.forRoot()` binds `TRANSACTION_MANAGER` only when `transaction: true`
|
|
165
|
+
is set. Without it nothing is bound, the repositories cannot resolve their
|
|
166
|
+
dependency, and Nest fails at boot.
|
|
167
|
+
- `PrismaModule.forRootAsync()` always binds the token, but with a manager whose
|
|
168
|
+
`run()` and `getClient()` throw and whose `isInTransaction()` returns `false`, so
|
|
169
|
+
the app boots and fails on first use instead.
|
|
170
|
+
|
|
171
|
+
Neither path is a silent passthrough: a real transaction manager either joins the
|
|
172
|
+
transaction already in scope or opens a Prisma interactive transaction.
|
|
173
|
+
|
|
174
|
+
Both of those are `PrismaModule` from `@nathapp/nestjs-prisma`. These adapters
|
|
175
|
+
expose only the synchronous `register()`; they have no `registerAsync`.
|
|
176
|
+
|
|
177
|
+
The refresh grant is the case that matters most: it revokes the old refresh token,
|
|
178
|
+
issues a replacement, and issues an access token inside a single `run()`. If that
|
|
179
|
+
is not one real transaction, a failure midway leaves the client with no usable
|
|
180
|
+
token and a revoked grant.
|
|
181
|
+
|
|
182
|
+
## Tokens bound
|
|
183
|
+
|
|
184
|
+
This package does **not** re-export `@nathapp/nestjs-oauth`. Import the tokens
|
|
185
|
+
themselves from `@nathapp/nestjs-oauth`, and only the implementations and the
|
|
186
|
+
module from this package.
|
|
187
|
+
|
|
188
|
+
| Token | Implementation |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `OAUTH_CLIENT_REPOSITORY` | `PrismaOAuthClientRepository` |
|
|
191
|
+
| `OAUTH_SCOPE_REPOSITORY` | `PrismaOAuthScopeRepository` |
|
|
192
|
+
| `OAUTH_AUTH_CODE_REPOSITORY` | `PrismaOAuthAuthorizationCodeRepository` |
|
|
193
|
+
| `OAUTH_ACCESS_TOKEN_REPOSITORY` | `PrismaOAuthAccessTokenRepository` |
|
|
194
|
+
| `OAUTH_REFRESH_TOKEN_REPOSITORY` | `PrismaOAuthRefreshTokenRepository` |
|
|
195
|
+
| `OAUTH_CONSENT_REPOSITORY` | `PrismaOAuthConsentRepository` |
|
|
196
|
+
| `OAUTH_SIGNING_KEY_REPOSITORY` | `PrismaOAuthSigningKeyRepository` |
|
|
197
|
+
| `OAUTH_DEVICE_CODE_REPOSITORY` | `PrismaOAuthDeviceCodeRepository` |
|
|
198
|
+
| `OAUTH_PUSHED_REQUEST_REPOSITORY` | `PrismaOAuthPushedRequestRepository` |
|
|
199
|
+
| `SIGNING_KEY_PROVIDER` | `PrismaSigningKeyProvider` |
|
|
200
|
+
|
|
201
|
+
`PrismaSigningKeyProvider` reads the active `OAuthSigningKey` row on every call —
|
|
202
|
+
it holds no cache. `rotate()` marks the current key `retiring` with a 7-day grace
|
|
203
|
+
window and mints a new RSA/RS256 keypair in one `run()`; `getVerificationKeys()`
|
|
204
|
+
publishes the `active` and `retiring` keys in the JWKS. An initial key is minted
|
|
205
|
+
lazily on first use, so pre-seed a key or call `rotate()` at deploy to avoid a race
|
|
206
|
+
between concurrent first calls. Private keys are stored as PEM: override
|
|
207
|
+
`encryptPrivateKey()` / `decryptPrivateKey()` for KMS or Vault. The defaults
|
|
208
|
+
refuse plaintext storage in production unless
|
|
209
|
+
`OAUTH_ALLOW_PLAINTEXT_SIGNING_KEYS=true` is set.
|
|
210
|
+
|
|
211
|
+
The module also provides and exports the class
|
|
212
|
+
`PrismaConsentLogoutTargetResolver`, without binding it to anything. To use it as
|
|
213
|
+
your `LOGOUT_TARGET_RESOLVER`, bind the token yourself:
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
import { Module } from '@nestjs/common';
|
|
217
|
+
import { ClockModule, IdGeneratorModule } from '@nathapp/nestjs-common';
|
|
218
|
+
import { LOGOUT_TARGET_RESOLVER } from '@nathapp/nestjs-oauth';
|
|
219
|
+
import { OAuthPrismaModule, PrismaConsentLogoutTargetResolver } from '@nathapp/nestjs-oauth-prisma';
|
|
220
|
+
|
|
221
|
+
@Module({
|
|
222
|
+
imports: [
|
|
223
|
+
ClockModule.register(), // required by PrismaSigningKeyProvider
|
|
224
|
+
IdGeneratorModule.register(), // required by PrismaSigningKeyProvider
|
|
225
|
+
OAuthPrismaModule.register(),
|
|
226
|
+
],
|
|
227
|
+
providers: [{ provide: LOGOUT_TARGET_RESOLVER, useExisting: PrismaConsentLogoutTargetResolver }],
|
|
228
|
+
})
|
|
229
|
+
export class LogoutTargetModule {}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Upgrade: mTLS access token bindings
|
|
233
|
+
|
|
234
|
+
Add `OAuthAccessToken.cnfX5tS256` from the schema fragment to your app's schema.
|
|
235
|
+
The packaged SQL patch
|
|
236
|
+
`prisma/migrations/20261003_oauth_access_token_mtls_binding/migration.sql`
|
|
237
|
+
adds the nullable `oauth_access_tokens.cnf_x5t_s256` column. Incorporate this
|
|
238
|
+
change into your own migration history, apply it before deploying the updated
|
|
239
|
+
adapter, and regenerate your Prisma client.
|
|
240
|
+
|
|
241
|
+
Earlier adapters discarded the certificate thumbprint when writing access
|
|
242
|
+
tokens, so existing rows cannot be backfilled reliably. Revoke existing access
|
|
243
|
+
tokens belonging to mTLS clients and require fresh issuance at cutover.
|
|
244
|
+
A null column remains valid for clients that do not use certificate binding.
|
|
245
|
+
|
|
246
|
+
Consent, device-code and pushed-request domain models continue to expose the
|
|
247
|
+
public OAuth `clientId`; the adapter resolves that identifier through the client
|
|
248
|
+
relation when writing the internal database foreign key. Access/refresh tokens
|
|
249
|
+
and authorization codes continue to use the internal client row id.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AbstractPrismaRepository } from '@nathapp/nestjs-prisma';
|
|
2
|
+
import { type IPageOption } from '@nathapp/nestjs-common';
|
|
3
|
+
import type { IPageResult } from '@nathapp/nestjs-data';
|
|
4
|
+
import type { PrismaClientLike } from '@nathapp/nestjs-prisma';
|
|
5
|
+
import { type OAuthPrismaDelegate } from './oauth-prisma.types';
|
|
6
|
+
export declare abstract class AbstractPrismaPublicClientRepository<T extends {
|
|
7
|
+
clientId: string;
|
|
8
|
+
}, TModel extends object> extends AbstractPrismaRepository<T, TModel, string> {
|
|
9
|
+
protected abstract readonly prismaModelName: string;
|
|
10
|
+
protected abstract modelDelegate(client: PrismaClientLike): OAuthPrismaDelegate<TModel>;
|
|
11
|
+
protected get oauthModel(): OAuthPrismaDelegate<TModel>;
|
|
12
|
+
protected get relationIncludes(): Record<string, unknown>;
|
|
13
|
+
protected toPersistenceCriteria(criteria: Partial<T>): Record<string, unknown>;
|
|
14
|
+
create(input: T): Promise<T>;
|
|
15
|
+
findById(id: string): Promise<T | null>;
|
|
16
|
+
findOne(criteria: Partial<T>): Promise<T | null>;
|
|
17
|
+
findAll(page: IPageOption): Promise<IPageResult<T>>;
|
|
18
|
+
count(criteria?: Partial<T>): Promise<number>;
|
|
19
|
+
update(id: string, patch: Partial<T>): Promise<T>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractPrismaPublicClientRepository = void 0;
|
|
4
|
+
const nestjs_prisma_1 = require("@nathapp/nestjs-prisma");
|
|
5
|
+
const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
6
|
+
class AbstractPrismaPublicClientRepository extends nestjs_prisma_1.AbstractPrismaRepository {
|
|
7
|
+
get oauthModel() {
|
|
8
|
+
return this.modelDelegate(this.tx.getClient());
|
|
9
|
+
}
|
|
10
|
+
get relationIncludes() {
|
|
11
|
+
return { client: { select: { clientId: true } } };
|
|
12
|
+
}
|
|
13
|
+
toPersistenceCriteria(criteria) {
|
|
14
|
+
return {
|
|
15
|
+
...this.toPersistenceUpdate(criteria),
|
|
16
|
+
...(criteria.clientId !== undefined ? { client: { clientId: criteria.clientId } } : {}),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async create(input) {
|
|
20
|
+
const row = await this.oauthModel.create({
|
|
21
|
+
data: this.toPersistenceCreate(input), include: this.relationIncludes,
|
|
22
|
+
});
|
|
23
|
+
return this.toDomain(row);
|
|
24
|
+
}
|
|
25
|
+
async findById(id) {
|
|
26
|
+
const row = await this.oauthModel.findUnique({ where: { id }, include: this.relationIncludes });
|
|
27
|
+
return row ? this.toDomain(row) : null;
|
|
28
|
+
}
|
|
29
|
+
async findOne(criteria) {
|
|
30
|
+
const row = await this.oauthModel.findFirst({
|
|
31
|
+
where: this.toPersistenceCriteria(criteria), include: this.relationIncludes,
|
|
32
|
+
});
|
|
33
|
+
return row ? this.toDomain(row) : null;
|
|
34
|
+
}
|
|
35
|
+
async findAll(page) {
|
|
36
|
+
const { skip, take } = (0, nestjs_common_1.resolvePageOption)(page);
|
|
37
|
+
const [rows, total] = await Promise.all([
|
|
38
|
+
this.oauthModel.findMany({ skip, take, include: this.relationIncludes }),
|
|
39
|
+
this.oauthModel.count({ where: undefined }),
|
|
40
|
+
]);
|
|
41
|
+
return new nestjs_common_1.Page(page, total, rows.map((row) => this.toDomain(row)));
|
|
42
|
+
}
|
|
43
|
+
async count(criteria) {
|
|
44
|
+
return this.oauthModel.count(criteria ? { where: this.toPersistenceCriteria(criteria) } : {});
|
|
45
|
+
}
|
|
46
|
+
async update(id, patch) {
|
|
47
|
+
const row = await this.oauthModel.update({
|
|
48
|
+
where: { id }, data: this.toPersistenceUpdate(patch), include: this.relationIncludes,
|
|
49
|
+
});
|
|
50
|
+
return this.toDomain(row);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.AbstractPrismaPublicClientRepository = AbstractPrismaPublicClientRepository;
|
|
54
|
+
//# sourceMappingURL=abstract-prisma-public-client.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-prisma-public-client.repository.js","sourceRoot":"","sources":["../lib/abstract-prisma-public-client.repository.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './prisma-oauth-client.repository';
|
|
2
|
+
export * from './prisma-oauth-scope.repository';
|
|
3
|
+
export * from './prisma-oauth-authorization-code.repository';
|
|
4
|
+
export * from './prisma-oauth-access-token.repository';
|
|
5
|
+
export * from './prisma-oauth-refresh-token.repository';
|
|
6
|
+
export * from './prisma-oauth-consent.repository';
|
|
7
|
+
export * from './prisma-oauth-signing-key.repository';
|
|
8
|
+
export * from './prisma-oauth-device-code.repository';
|
|
9
|
+
export * from './prisma-oauth-pushed-request.repository';
|
|
10
|
+
export * from './prisma-consent-logout-target.resolver';
|
|
11
|
+
export * from './prisma-signing-key.provider';
|
|
12
|
+
export * from './oauth-prisma.module';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./prisma-oauth-client.repository"), exports);
|
|
18
|
+
__exportStar(require("./prisma-oauth-scope.repository"), exports);
|
|
19
|
+
__exportStar(require("./prisma-oauth-authorization-code.repository"), exports);
|
|
20
|
+
__exportStar(require("./prisma-oauth-access-token.repository"), exports);
|
|
21
|
+
__exportStar(require("./prisma-oauth-refresh-token.repository"), exports);
|
|
22
|
+
__exportStar(require("./prisma-oauth-consent.repository"), exports);
|
|
23
|
+
__exportStar(require("./prisma-oauth-signing-key.repository"), exports);
|
|
24
|
+
__exportStar(require("./prisma-oauth-device-code.repository"), exports);
|
|
25
|
+
__exportStar(require("./prisma-oauth-pushed-request.repository"), exports);
|
|
26
|
+
__exportStar(require("./prisma-consent-logout-target.resolver"), exports);
|
|
27
|
+
__exportStar(require("./prisma-signing-key.provider"), exports);
|
|
28
|
+
__exportStar(require("./oauth-prisma.module"), exports);
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,kEAAgD;AAChD,+EAA6D;AAC7D,yEAAuD;AACvD,0EAAwD;AACxD,oEAAkD;AAClD,wEAAsD;AACtD,wEAAsD;AACtD,2EAAyD;AACzD,0EAAwD;AACxD,gEAA8C;AAC9C,wDAAsC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var OAuthPrismaModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.OAuthPrismaModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const nestjs_oauth_1 = require("@nathapp/nestjs-oauth");
|
|
13
|
+
const prisma_oauth_client_repository_1 = require("./prisma-oauth-client.repository");
|
|
14
|
+
const prisma_oauth_scope_repository_1 = require("./prisma-oauth-scope.repository");
|
|
15
|
+
const prisma_oauth_authorization_code_repository_1 = require("./prisma-oauth-authorization-code.repository");
|
|
16
|
+
const prisma_oauth_access_token_repository_1 = require("./prisma-oauth-access-token.repository");
|
|
17
|
+
const prisma_oauth_refresh_token_repository_1 = require("./prisma-oauth-refresh-token.repository");
|
|
18
|
+
const prisma_oauth_consent_repository_1 = require("./prisma-oauth-consent.repository");
|
|
19
|
+
const prisma_oauth_signing_key_repository_1 = require("./prisma-oauth-signing-key.repository");
|
|
20
|
+
const prisma_oauth_device_code_repository_1 = require("./prisma-oauth-device-code.repository");
|
|
21
|
+
const prisma_oauth_pushed_request_repository_1 = require("./prisma-oauth-pushed-request.repository");
|
|
22
|
+
const prisma_consent_logout_target_resolver_1 = require("./prisma-consent-logout-target.resolver");
|
|
23
|
+
const prisma_signing_key_provider_1 = require("./prisma-signing-key.provider");
|
|
24
|
+
const OAUTH_PRISMA_PROVIDERS = [
|
|
25
|
+
prisma_oauth_client_repository_1.PrismaOAuthClientRepository,
|
|
26
|
+
{ provide: nestjs_oauth_1.OAUTH_CLIENT_REPOSITORY, useExisting: prisma_oauth_client_repository_1.PrismaOAuthClientRepository },
|
|
27
|
+
prisma_oauth_scope_repository_1.PrismaOAuthScopeRepository,
|
|
28
|
+
{ provide: nestjs_oauth_1.OAUTH_SCOPE_REPOSITORY, useExisting: prisma_oauth_scope_repository_1.PrismaOAuthScopeRepository },
|
|
29
|
+
prisma_oauth_authorization_code_repository_1.PrismaOAuthAuthorizationCodeRepository,
|
|
30
|
+
{ provide: nestjs_oauth_1.OAUTH_AUTH_CODE_REPOSITORY, useExisting: prisma_oauth_authorization_code_repository_1.PrismaOAuthAuthorizationCodeRepository },
|
|
31
|
+
prisma_oauth_access_token_repository_1.PrismaOAuthAccessTokenRepository,
|
|
32
|
+
{ provide: nestjs_oauth_1.OAUTH_ACCESS_TOKEN_REPOSITORY, useExisting: prisma_oauth_access_token_repository_1.PrismaOAuthAccessTokenRepository },
|
|
33
|
+
prisma_oauth_refresh_token_repository_1.PrismaOAuthRefreshTokenRepository,
|
|
34
|
+
{ provide: nestjs_oauth_1.OAUTH_REFRESH_TOKEN_REPOSITORY, useExisting: prisma_oauth_refresh_token_repository_1.PrismaOAuthRefreshTokenRepository },
|
|
35
|
+
prisma_oauth_consent_repository_1.PrismaOAuthConsentRepository,
|
|
36
|
+
{ provide: nestjs_oauth_1.OAUTH_CONSENT_REPOSITORY, useExisting: prisma_oauth_consent_repository_1.PrismaOAuthConsentRepository },
|
|
37
|
+
prisma_oauth_signing_key_repository_1.PrismaOAuthSigningKeyRepository,
|
|
38
|
+
{ provide: nestjs_oauth_1.OAUTH_SIGNING_KEY_REPOSITORY, useExisting: prisma_oauth_signing_key_repository_1.PrismaOAuthSigningKeyRepository },
|
|
39
|
+
prisma_oauth_device_code_repository_1.PrismaOAuthDeviceCodeRepository,
|
|
40
|
+
{ provide: nestjs_oauth_1.OAUTH_DEVICE_CODE_REPOSITORY, useExisting: prisma_oauth_device_code_repository_1.PrismaOAuthDeviceCodeRepository },
|
|
41
|
+
prisma_oauth_pushed_request_repository_1.PrismaOAuthPushedRequestRepository,
|
|
42
|
+
{ provide: nestjs_oauth_1.OAUTH_PUSHED_REQUEST_REPOSITORY, useExisting: prisma_oauth_pushed_request_repository_1.PrismaOAuthPushedRequestRepository },
|
|
43
|
+
prisma_signing_key_provider_1.PrismaSigningKeyProvider,
|
|
44
|
+
{ provide: nestjs_oauth_1.SIGNING_KEY_PROVIDER, useExisting: prisma_signing_key_provider_1.PrismaSigningKeyProvider },
|
|
45
|
+
prisma_consent_logout_target_resolver_1.PrismaConsentLogoutTargetResolver,
|
|
46
|
+
];
|
|
47
|
+
const OAUTH_PRISMA_EXPORTS = [
|
|
48
|
+
nestjs_oauth_1.OAUTH_CLIENT_REPOSITORY,
|
|
49
|
+
nestjs_oauth_1.OAUTH_SCOPE_REPOSITORY,
|
|
50
|
+
nestjs_oauth_1.OAUTH_AUTH_CODE_REPOSITORY,
|
|
51
|
+
nestjs_oauth_1.OAUTH_ACCESS_TOKEN_REPOSITORY,
|
|
52
|
+
nestjs_oauth_1.OAUTH_REFRESH_TOKEN_REPOSITORY,
|
|
53
|
+
nestjs_oauth_1.OAUTH_CONSENT_REPOSITORY,
|
|
54
|
+
nestjs_oauth_1.OAUTH_SIGNING_KEY_REPOSITORY,
|
|
55
|
+
nestjs_oauth_1.OAUTH_DEVICE_CODE_REPOSITORY,
|
|
56
|
+
nestjs_oauth_1.OAUTH_PUSHED_REQUEST_REPOSITORY,
|
|
57
|
+
nestjs_oauth_1.SIGNING_KEY_PROVIDER,
|
|
58
|
+
prisma_consent_logout_target_resolver_1.PrismaConsentLogoutTargetResolver,
|
|
59
|
+
];
|
|
60
|
+
let OAuthPrismaModule = OAuthPrismaModule_1 = class OAuthPrismaModule {
|
|
61
|
+
static register(options) {
|
|
62
|
+
var _a;
|
|
63
|
+
return {
|
|
64
|
+
module: OAuthPrismaModule_1,
|
|
65
|
+
global: (_a = options === null || options === void 0 ? void 0 : options.global) !== null && _a !== void 0 ? _a : true,
|
|
66
|
+
providers: OAUTH_PRISMA_PROVIDERS,
|
|
67
|
+
exports: OAUTH_PRISMA_EXPORTS,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.OAuthPrismaModule = OAuthPrismaModule;
|
|
72
|
+
exports.OAuthPrismaModule = OAuthPrismaModule = OAuthPrismaModule_1 = __decorate([
|
|
73
|
+
(0, common_1.Module)({ providers: OAUTH_PRISMA_PROVIDERS, exports: OAUTH_PRISMA_EXPORTS })
|
|
74
|
+
], OAuthPrismaModule);
|
|
75
|
+
//# sourceMappingURL=oauth-prisma.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-prisma.module.js","sourceRoot":"","sources":["../lib/oauth-prisma.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuE;AACvE,wDAW+B;AAC/B,qFAA+E;AAC/E,mFAA6E;AAC7E,6GAAsG;AACtG,iGAA0F;AAC1F,mGAA4F;AAC5F,uFAAiF;AACjF,+FAAwF;AACxF,+FAAwF;AACxF,qGAA8F;AAC9F,mGAA4F;AAC5F,+EAAyE;AAczE,MAAM,sBAAsB,GAAe;IACzC,4DAA2B;IAC3B,EAAE,OAAO,EAAE,sCAAuB,EAAE,WAAW,EAAE,4DAA2B,EAAE;IAC9E,0DAA0B;IAC1B,EAAE,OAAO,EAAE,qCAAsB,EAAE,WAAW,EAAE,0DAA0B,EAAE;IAC5E,mFAAsC;IACtC,EAAE,OAAO,EAAE,yCAA0B,EAAE,WAAW,EAAE,mFAAsC,EAAE;IAC5F,uEAAgC;IAChC,EAAE,OAAO,EAAE,4CAA6B,EAAE,WAAW,EAAE,uEAAgC,EAAE;IACzF,yEAAiC;IACjC,EAAE,OAAO,EAAE,6CAA8B,EAAE,WAAW,EAAE,yEAAiC,EAAE;IAC3F,8DAA4B;IAC5B,EAAE,OAAO,EAAE,uCAAwB,EAAE,WAAW,EAAE,8DAA4B,EAAE;IAChF,qEAA+B;IAC/B,EAAE,OAAO,EAAE,2CAA4B,EAAE,WAAW,EAAE,qEAA+B,EAAE;IACvF,qEAA+B;IAC/B,EAAE,OAAO,EAAE,2CAA4B,EAAE,WAAW,EAAE,qEAA+B,EAAE;IACvF,2EAAkC;IAClC,EAAE,OAAO,EAAE,8CAA+B,EAAE,WAAW,EAAE,2EAAkC,EAAE;IAC7F,sDAAwB;IACxB,EAAE,OAAO,EAAE,mCAAoB,EAAE,WAAW,EAAE,sDAAwB,EAAE;IACxE,yEAAiC;CAClC,CAAC;AAEF,MAAM,oBAAoB,GAAyB;IACjD,sCAAuB;IACvB,qCAAsB;IACtB,yCAA0B;IAC1B,4CAA6B;IAC7B,6CAA8B;IAC9B,uCAAwB;IACxB,2CAA4B;IAC5B,2CAA4B;IAC5B,8CAA+B;IAC/B,mCAAoB;IACpB,yEAAiC;CAClC,CAAC;AASK,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAoC;;QAClD,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,MAAM,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,IAAI;YAC/B,SAAS,EAAE,sBAAsB;YACjC,OAAO,EAAE,oBAAoB;SAC9B,CAAC;IACJ,CAAC;CACF,CAAA;AATY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;GAChE,iBAAiB,CAS7B"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { PrismaClientLike, PrismaModelDelegate } from '@nathapp/nestjs-prisma';
|
|
2
|
+
export interface OAuthClientRow {
|
|
3
|
+
id: string;
|
|
4
|
+
tenantId: string | null;
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecretHash: string | null;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string | null;
|
|
9
|
+
clientType: string;
|
|
10
|
+
redirectUris: string[];
|
|
11
|
+
postLogoutRedirectUris: string[];
|
|
12
|
+
grantTypes: string[];
|
|
13
|
+
responseTypes: string[];
|
|
14
|
+
accessTokenTtl: number;
|
|
15
|
+
refreshTokenTtl: number;
|
|
16
|
+
authCodeTtl: number;
|
|
17
|
+
pkceRequired: string;
|
|
18
|
+
requireConsent: boolean;
|
|
19
|
+
dpopBoundAccessTokens: boolean;
|
|
20
|
+
backchannelLogoutUri: string | null;
|
|
21
|
+
backchannelLogoutSessionRequired: boolean | null;
|
|
22
|
+
frontchannelLogoutUri: string | null;
|
|
23
|
+
frontchannelLogoutSessionRequired: boolean | null;
|
|
24
|
+
tokenEndpointAuthMethod: string | null;
|
|
25
|
+
jwks: unknown;
|
|
26
|
+
jwksUri: string | null;
|
|
27
|
+
tlsClientAuthSubjectDn: string | null;
|
|
28
|
+
tlsClientAuthSanDns: string[] | null;
|
|
29
|
+
tlsClientAuthSelfSignedThumbprint: string | null;
|
|
30
|
+
clientSecretHashPrevious: string | null;
|
|
31
|
+
previousSecretExpiresAt: Date | null;
|
|
32
|
+
allowedResources: string[];
|
|
33
|
+
requireResource: boolean;
|
|
34
|
+
status: number;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
}
|
|
38
|
+
export interface OAuthScopeRelation {
|
|
39
|
+
scope: {
|
|
40
|
+
code: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface OAuthClientRelation {
|
|
44
|
+
client: {
|
|
45
|
+
clientId: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface OAuthScopesRelation {
|
|
49
|
+
scopes: OAuthScopeRelation[];
|
|
50
|
+
}
|
|
51
|
+
export interface OAuthAuthorizationCodeRow extends OAuthScopesRelation {
|
|
52
|
+
id: string;
|
|
53
|
+
tenantId: string | null;
|
|
54
|
+
code: string;
|
|
55
|
+
clientId: string;
|
|
56
|
+
userId: string;
|
|
57
|
+
codeChallenge: string | null;
|
|
58
|
+
codeChallengeMethod: string | null;
|
|
59
|
+
redirectUri: string;
|
|
60
|
+
state: string | null;
|
|
61
|
+
nonce: string | null;
|
|
62
|
+
expiresAt: Date;
|
|
63
|
+
usedAt: Date | null;
|
|
64
|
+
authTime: Date | null;
|
|
65
|
+
sid: string | null;
|
|
66
|
+
resource: string | null;
|
|
67
|
+
createdAt: Date;
|
|
68
|
+
}
|
|
69
|
+
export interface OAuthAccessTokenRow extends OAuthScopesRelation {
|
|
70
|
+
id: string;
|
|
71
|
+
tenantId: string | null;
|
|
72
|
+
tokenHash: string;
|
|
73
|
+
clientId: string;
|
|
74
|
+
userId: string | null;
|
|
75
|
+
refreshTokenId: string | null;
|
|
76
|
+
tokenType: string;
|
|
77
|
+
expiresAt: Date;
|
|
78
|
+
revokedAt: Date | null;
|
|
79
|
+
cnfJkt: string | null;
|
|
80
|
+
cnfX5tS256: string | null;
|
|
81
|
+
resource: string | null;
|
|
82
|
+
actorClientId: string | null;
|
|
83
|
+
createdAt: Date;
|
|
84
|
+
}
|
|
85
|
+
export interface OAuthRefreshTokenRow {
|
|
86
|
+
id: string;
|
|
87
|
+
tenantId: string | null;
|
|
88
|
+
tokenHash: string;
|
|
89
|
+
clientId: string;
|
|
90
|
+
userId: string;
|
|
91
|
+
scope: string | null;
|
|
92
|
+
previousTokenHash: string | null;
|
|
93
|
+
expiresAt: Date;
|
|
94
|
+
revokedAt: Date | null;
|
|
95
|
+
cnfJkt: string | null;
|
|
96
|
+
lastUsedAt: Date | null;
|
|
97
|
+
resource: string | null;
|
|
98
|
+
createdAt: Date;
|
|
99
|
+
}
|
|
100
|
+
export interface OAuthConsentRow extends OAuthClientRelation, OAuthScopesRelation {
|
|
101
|
+
id: string;
|
|
102
|
+
tenantId: string | null;
|
|
103
|
+
userId: string;
|
|
104
|
+
grantedAt: Date;
|
|
105
|
+
revokedAt: Date | null;
|
|
106
|
+
}
|
|
107
|
+
export interface OAuthDeviceCodeRow extends OAuthClientRelation {
|
|
108
|
+
id: string;
|
|
109
|
+
tenantId: string | null;
|
|
110
|
+
deviceCodeHash: string;
|
|
111
|
+
userCodeHash: string;
|
|
112
|
+
clientId: string;
|
|
113
|
+
scope: string | null;
|
|
114
|
+
status: string;
|
|
115
|
+
userId: string | null;
|
|
116
|
+
authTime: Date | null;
|
|
117
|
+
interval: number;
|
|
118
|
+
lastPolledAt: Date | null;
|
|
119
|
+
approvedAt: Date | null;
|
|
120
|
+
consumedAt: Date | null;
|
|
121
|
+
expiresAt: Date;
|
|
122
|
+
createdAt: Date;
|
|
123
|
+
}
|
|
124
|
+
export interface OAuthPushedRequestRow extends OAuthClientRelation {
|
|
125
|
+
id: string;
|
|
126
|
+
tenantId: string | null;
|
|
127
|
+
requestUriHash: string;
|
|
128
|
+
clientId: string;
|
|
129
|
+
responseType: string;
|
|
130
|
+
redirectUri: string;
|
|
131
|
+
scope: string | null;
|
|
132
|
+
state: string | null;
|
|
133
|
+
codeChallenge: string | null;
|
|
134
|
+
codeChallengeMethod: string | null;
|
|
135
|
+
nonce: string | null;
|
|
136
|
+
prompt: string | null;
|
|
137
|
+
maxAge: string | null;
|
|
138
|
+
consumedAt: Date | null;
|
|
139
|
+
resource: string | null;
|
|
140
|
+
expiresAt: Date;
|
|
141
|
+
createdAt: Date;
|
|
142
|
+
}
|
|
143
|
+
export interface OAuthScopeRow {
|
|
144
|
+
id: string;
|
|
145
|
+
code: string;
|
|
146
|
+
name: string;
|
|
147
|
+
description: string | null;
|
|
148
|
+
claims: unknown;
|
|
149
|
+
isSystem: boolean;
|
|
150
|
+
status: number;
|
|
151
|
+
createdAt: Date;
|
|
152
|
+
updatedAt: Date;
|
|
153
|
+
}
|
|
154
|
+
export interface OAuthClientScopeRow {
|
|
155
|
+
clientId: string;
|
|
156
|
+
scopeId: string;
|
|
157
|
+
isDefault: boolean;
|
|
158
|
+
scope: OAuthScopeRow;
|
|
159
|
+
}
|
|
160
|
+
export interface OAuthSigningKeyRow {
|
|
161
|
+
id: string;
|
|
162
|
+
kid: string;
|
|
163
|
+
alg: string;
|
|
164
|
+
privateKeyPem: string;
|
|
165
|
+
publicKeyPem: string;
|
|
166
|
+
status: string;
|
|
167
|
+
createdAt: Date;
|
|
168
|
+
expiresAt: Date | null;
|
|
169
|
+
tenantId: string | null;
|
|
170
|
+
}
|
|
171
|
+
export type OAuthQuery = Record<string, unknown>;
|
|
172
|
+
export interface OAuthPrismaDelegate<Row extends object> extends PrismaModelDelegate<Row, string> {
|
|
173
|
+
findUnique(args: OAuthQuery): Promise<Row | null>;
|
|
174
|
+
findFirst(args: OAuthQuery): Promise<Row | null>;
|
|
175
|
+
findMany<TResult extends object = Row>(args: OAuthQuery): Promise<TResult[]>;
|
|
176
|
+
create(args: OAuthQuery): Promise<Row>;
|
|
177
|
+
update(args: OAuthQuery): Promise<Row>;
|
|
178
|
+
updateMany(args: OAuthQuery): Promise<{
|
|
179
|
+
count: number;
|
|
180
|
+
}>;
|
|
181
|
+
deleteMany(args: OAuthQuery): Promise<{
|
|
182
|
+
count: number;
|
|
183
|
+
}>;
|
|
184
|
+
createMany(args: OAuthQuery): Promise<{
|
|
185
|
+
count: number;
|
|
186
|
+
}>;
|
|
187
|
+
}
|
|
188
|
+
export declare function asJsonObject(value: unknown): Record<string, unknown> | undefined;
|
|
189
|
+
export declare function getOAuthPrismaDelegate<Row extends object>(client: PrismaClientLike, modelName: string): OAuthPrismaDelegate<Row>;
|