@breadstone/archipel-mcp 0.0.41 → 0.0.43
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/data/guides/implementing-ports.md +2 -0
- package/data/guides/payments-and-feature-gating.md +76 -45
- package/data/packages/platform-bootstrap/api/Function.useExpressServer.md +1 -1
- package/data/packages/platform-bootstrap/api/Interface.IExpressServerStepOptions.md +4 -4
- package/data/packages/platform-core/api/Class.ProblemDetailResponse.md +8 -8
- package/data/packages/platform-database/api/Class.DatabaseHealthIndicator.md +4 -4
- package/data/packages/platform-database/api/Class.DatabaseModule.md +3 -3
- package/data/packages/platform-database/api/Class.DatabaseService.md +12 -11
- package/data/packages/platform-database/api/Class.PrismaService.md +6 -5
- package/data/packages/platform-database/api/Class.RepositoryBase.md +23 -23
- package/data/packages/platform-database/api/Class.RepositoryBase2.md +7 -7
- package/data/packages/platform-database/api/Class.RepositoryExceptionFilter.md +2 -2
- package/data/packages/platform-database/api/Function.aggregate.md +1 -1
- package/data/packages/platform-database/api/Function.aggregateRaw.md +1 -1
- package/data/packages/platform-database/api/Function.count.md +1 -1
- package/data/packages/platform-database/api/Function.create.md +1 -1
- package/data/packages/platform-database/api/Function.createMany.md +1 -1
- package/data/packages/platform-database/api/Function.createManyAndReturn.md +1 -1
- package/data/packages/platform-database/api/Function.cursorPaginator.md +1 -1
- package/data/packages/platform-database/api/Function.findFirst.md +1 -1
- package/data/packages/platform-database/api/Function.findFirstOrThrow.md +1 -1
- package/data/packages/platform-database/api/Function.findMany.md +1 -1
- package/data/packages/platform-database/api/Function.findManyPaged.md +1 -1
- package/data/packages/platform-database/api/Function.findRaw.md +1 -1
- package/data/packages/platform-database/api/Function.findUnique.md +1 -1
- package/data/packages/platform-database/api/Function.findUniqueOrThrow.md +1 -1
- package/data/packages/platform-database/api/Function.groupBy.md +1 -1
- package/data/packages/platform-database/api/Function.pageable.md +1 -1
- package/data/packages/platform-database/api/Function.paginator.md +1 -1
- package/data/packages/platform-database/api/Function.pipe.md +1 -1
- package/data/packages/platform-database/api/Function.pipeAll.md +1 -1
- package/data/packages/platform-database/api/Function.query.md +1 -1
- package/data/packages/platform-database/api/Function.query2.md +1 -1
- package/data/packages/platform-database/api/Function.remove.md +1 -1
- package/data/packages/platform-database/api/Function.removeMany.md +1 -1
- package/data/packages/platform-database/api/Function.skip.md +1 -1
- package/data/packages/platform-database/api/Function.transactionalQuery.md +1 -1
- package/data/packages/platform-database/api/Function.update.md +1 -1
- package/data/packages/platform-database/api/Function.updateMany.md +1 -1
- package/data/packages/platform-database/api/Function.updateManyAndReturn.md +1 -1
- package/data/packages/platform-database/api/Function.upsert.md +1 -1
- package/data/packages/platform-database/api/Interface.ICursorPaginateOptions.md +4 -4
- package/data/packages/platform-database/api/Interface.ICursorPaginatedResult.md +3 -3
- package/data/packages/platform-database/api/Interface.IDatabaseModuleConfig.md +3 -3
- package/data/packages/platform-database/api/Interface.IPaginateOptions.md +3 -3
- package/data/packages/platform-database/api/Interface.IPaginatedResult.md +3 -3
- package/data/packages/platform-database/api/Interface.IPrismaServiceOptions.md +2 -2
- package/data/packages/platform-database/api/Interface.IRepositoryQuery.md +3 -3
- package/data/packages/platform-database/api/Interface.IRepositoryQuery2.md +3 -3
- package/data/packages/platform-database/api/Interface.ITransactionalRepositoryQuery.md +4 -4
- package/data/packages/platform-database/api/TypeAlias.CursorPaginateFunction.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.DelegateArgs.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.DelegateOperations.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.DelegateReturnTypes.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.PaginateFunction.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.QueryResultType.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.RepositoryOperationsAll.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.RepositoryOperationsBase.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.TransactionalQueryResultType.md +1 -1
- package/data/packages/platform-database/api/Variable.DATABASE_MODULE_CONFIG.md +1 -1
- package/data/packages/platform-database/api/Variable.DB_AUTO_CONNECTION.md +1 -1
- package/data/packages/platform-database/api/Variable.PLATFORM_DATABASE_CONFIG_ENTRIES.md +1 -1
- package/data/packages/platform-payments/api/Class.FeatureAccessPort.md +13 -5
- package/data/packages/platform-payments/api/Class.FeatureGuard.md +3 -3
- package/data/packages/platform-payments/api/Class.FeatureUsageInterceptor.md +3 -3
- package/data/packages/platform-payments/api/Function.RequiresFeature.md +1 -1
- package/data/packages/platform-payments/api/Interface.IFeatureAccessContext.md +46 -0
- package/data/packages/platform-payments/api/Variable.FEATURE_KEY_METADATA.md +1 -1
- package/data/packages/platform-payments/api/index.md +1 -0
- package/data/packages/platform-payments/index.md +33 -12
- package/data/patterns/guard-pattern.md +27 -6
- package/data/patterns/module-pattern.md +6 -2
- package/package.json +1 -1
|
@@ -304,6 +304,8 @@ When omitted, blob uploads and deletes work normally, but metadata isn't tracked
|
|
|
304
304
|
|
|
305
305
|
When omitted, `FeatureGuard` and `FeatureUsageInterceptor` have no access port and will deny or skip feature checks. When provided, they delegate quota enforcement and usage recording to your adapter.
|
|
306
306
|
|
|
307
|
+
`FeatureGuard` calls `checkAccess(userId, featureKey, context)`, while `FeatureUsageInterceptor` calls `recordUsage(userId, featureKey, context)` after a successful request. The `IFeatureAccessContext` contains the resolved `userId`, optional `tenantId`, and original authenticated subject, so adapters can enforce tenant-scoped plans without controller-specific billing logic.
|
|
308
|
+
|
|
307
309
|
---
|
|
308
310
|
|
|
309
311
|
## Common Mistakes
|
|
@@ -36,16 +36,15 @@ yarn add @breadstone/archipel-platform-payments
|
|
|
36
36
|
```typescript
|
|
37
37
|
import { Module } from '@nestjs/common';
|
|
38
38
|
import { PaymentModule } from '@breadstone/archipel-platform-payments';
|
|
39
|
-
import {
|
|
39
|
+
import { StripeClient, STRIPE_CONFIG_ENTRIES } from '@breadstone/archipel-platform-payments/stripe';
|
|
40
40
|
import { PrismaFeatureAccessAdapter } from './adapters/PrismaFeatureAccessAdapter';
|
|
41
|
-
import { STRIPE_CONFIG_ENTRIES } from './env';
|
|
42
41
|
|
|
43
42
|
@Module({
|
|
44
43
|
imports: [
|
|
45
44
|
PaymentModule.register({
|
|
46
|
-
paymentClient:
|
|
45
|
+
paymentClient: StripeClient,
|
|
47
46
|
featureAccess: PrismaFeatureAccessAdapter,
|
|
48
|
-
configEntries:
|
|
47
|
+
configEntries: STRIPE_CONFIG_ENTRIES,
|
|
49
48
|
}),
|
|
50
49
|
],
|
|
51
50
|
})
|
|
@@ -54,9 +53,9 @@ export class AppModule {}
|
|
|
54
53
|
|
|
55
54
|
---
|
|
56
55
|
|
|
57
|
-
##
|
|
56
|
+
## Using the Payment Client Port
|
|
58
57
|
|
|
59
|
-
The
|
|
58
|
+
The built-in provider clients implement `PaymentClientPort`. Inject the port in application services so checkout and webhook code stays provider-agnostic:
|
|
60
59
|
|
|
61
60
|
```typescript
|
|
62
61
|
import { Injectable } from '@nestjs/common';
|
|
@@ -64,23 +63,27 @@ import {
|
|
|
64
63
|
PaymentClientPort,
|
|
65
64
|
type INormalizedCheckoutSession,
|
|
66
65
|
type INormalizedSubscription,
|
|
67
|
-
type INormalizedWebhookEvent,
|
|
68
66
|
} from '@breadstone/archipel-platform-payments';
|
|
69
67
|
|
|
70
68
|
@Injectable()
|
|
71
|
-
export class
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
export class CheckoutService {
|
|
70
|
+
private readonly _paymentClient: PaymentClientPort;
|
|
71
|
+
|
|
72
|
+
public constructor(paymentClient: PaymentClientPort) {
|
|
73
|
+
this._paymentClient = paymentClient;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
public async
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
public async createCheckout(priceId: string, userId: string): Promise<INormalizedCheckoutSession> {
|
|
77
|
+
return this._paymentClient.createCheckoutSession(
|
|
78
|
+
priceId,
|
|
79
|
+
'https://app.example.com/billing/success',
|
|
80
|
+
'https://app.example.com/billing/cancel',
|
|
81
|
+
userId,
|
|
82
|
+
);
|
|
80
83
|
}
|
|
81
84
|
|
|
82
|
-
public async
|
|
83
|
-
|
|
85
|
+
public async getSubscription(subscriptionId: string): Promise<INormalizedSubscription | null> {
|
|
86
|
+
return this._paymentClient.fetchSubscription(subscriptionId);
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
```
|
|
@@ -97,7 +100,11 @@ The `FeatureAccessPort` lets you restrict functionality based on subscription ti
|
|
|
97
100
|
|
|
98
101
|
```typescript
|
|
99
102
|
import { Injectable } from '@nestjs/common';
|
|
100
|
-
import {
|
|
103
|
+
import {
|
|
104
|
+
FeatureAccessPort,
|
|
105
|
+
type IFeatureAccessContext,
|
|
106
|
+
type IFeatureAccessResult,
|
|
107
|
+
} from '@breadstone/archipel-platform-payments';
|
|
101
108
|
import { PrismaService } from '@breadstone/archipel-platform-database';
|
|
102
109
|
|
|
103
110
|
@Injectable()
|
|
@@ -109,53 +116,77 @@ export class PrismaFeatureAccessAdapter extends FeatureAccessPort {
|
|
|
109
116
|
this._prisma = prisma;
|
|
110
117
|
}
|
|
111
118
|
|
|
112
|
-
public async
|
|
119
|
+
public async checkAccess(
|
|
120
|
+
userId: string,
|
|
121
|
+
featureKey: string,
|
|
122
|
+
context?: IFeatureAccessContext,
|
|
123
|
+
): Promise<IFeatureAccessResult> {
|
|
113
124
|
const subscription = await this._prisma.subscription.findFirst({
|
|
114
|
-
where: { userId, status: 'active' },
|
|
115
|
-
include: { plan: true },
|
|
125
|
+
where: { userId, tenantId: context?.tenantId, status: 'active' },
|
|
126
|
+
include: { plan: { include: { features: true } } },
|
|
116
127
|
});
|
|
117
128
|
|
|
118
|
-
|
|
119
|
-
|
|
129
|
+
const feature = subscription?.plan.features.find((planFeature) => planFeature.key === featureKey);
|
|
130
|
+
if (!feature) {
|
|
131
|
+
return { allowed: false, used: 0, limit: 0, remaining: 0, resetAt: new Date() };
|
|
120
132
|
}
|
|
121
133
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
const used = await this._prisma.featureUsage.count({
|
|
135
|
+
where: {
|
|
136
|
+
userId,
|
|
137
|
+
tenantId: context?.tenantId,
|
|
138
|
+
featureKey,
|
|
139
|
+
usedAt: { gte: subscription.currentPeriodStart },
|
|
140
|
+
},
|
|
128
141
|
});
|
|
142
|
+
|
|
143
|
+
const limit = feature.limit;
|
|
144
|
+
const remaining = limit === -1 ? -1 : Math.max(0, limit - used);
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
allowed: limit === -1 || used < limit,
|
|
148
|
+
used,
|
|
149
|
+
limit,
|
|
150
|
+
remaining,
|
|
151
|
+
resetAt: subscription.currentPeriodEnd,
|
|
152
|
+
};
|
|
129
153
|
}
|
|
130
154
|
|
|
131
|
-
public async
|
|
132
|
-
|
|
133
|
-
|
|
155
|
+
public async recordUsage(userId: string, featureKey: string, context?: IFeatureAccessContext): Promise<void> {
|
|
156
|
+
const access = await this.checkAccess(userId, featureKey, context);
|
|
157
|
+
if (!access.allowed) {
|
|
158
|
+
throw new Error(`Feature quota exceeded for ${featureKey}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
await this._prisma.featureUsage.create({
|
|
162
|
+
data: { userId, tenantId: context?.tenantId, featureKey, usedAt: new Date() },
|
|
134
163
|
});
|
|
135
164
|
}
|
|
136
165
|
}
|
|
137
166
|
```
|
|
138
167
|
|
|
168
|
+
`FeatureGuard` and `FeatureUsageInterceptor` pass `IFeatureAccessContext` into this adapter. The context includes the resolved `userId`, an optional `tenantId` from `request.user.tenantId`, and the original authenticated subject.
|
|
169
|
+
|
|
139
170
|
### Step 2: Use the Feature Guard
|
|
140
171
|
|
|
141
|
-
|
|
172
|
+
Use `@RequiresFeature()` to mark endpoints and `FeatureGuard` to enforce access checks:
|
|
142
173
|
|
|
143
174
|
```typescript
|
|
144
175
|
import { Controller, Post, UseGuards } from '@nestjs/common';
|
|
145
176
|
import { JwtAuthGuard } from '@breadstone/archipel-platform-authentication';
|
|
146
|
-
import { FeatureGuard } from '@breadstone/archipel-platform-payments';
|
|
177
|
+
import { FeatureGuard, RequiresFeature } from '@breadstone/archipel-platform-payments';
|
|
147
178
|
|
|
148
179
|
@Controller('exports')
|
|
149
|
-
@UseGuards(JwtAuthGuard)
|
|
180
|
+
@UseGuards(JwtAuthGuard, FeatureGuard)
|
|
150
181
|
export class ExportController {
|
|
151
182
|
@Post('pdf')
|
|
152
|
-
@
|
|
183
|
+
@RequiresFeature('export:pdf')
|
|
153
184
|
public async exportPdf(): Promise<void> {
|
|
154
185
|
// Only accessible to users with 'export:pdf' feature
|
|
155
186
|
}
|
|
156
187
|
|
|
157
188
|
@Post('csv')
|
|
158
|
-
@
|
|
189
|
+
@RequiresFeature('export:csv')
|
|
159
190
|
public async exportCsv(): Promise<void> {
|
|
160
191
|
// Only accessible to users with 'export:csv' feature
|
|
161
192
|
}
|
|
@@ -169,14 +200,14 @@ export class ExportController {
|
|
|
169
200
|
```typescript
|
|
170
201
|
import { Controller, Post, UseGuards, UseInterceptors } from '@nestjs/common';
|
|
171
202
|
import { JwtAuthGuard } from '@breadstone/archipel-platform-authentication';
|
|
172
|
-
import { FeatureGuard, FeatureUsageInterceptor } from '@breadstone/archipel-platform-payments';
|
|
203
|
+
import { FeatureGuard, FeatureUsageInterceptor, RequiresFeature } from '@breadstone/archipel-platform-payments';
|
|
173
204
|
|
|
174
205
|
@Controller('ai')
|
|
175
|
-
@UseGuards(JwtAuthGuard)
|
|
206
|
+
@UseGuards(JwtAuthGuard, FeatureGuard)
|
|
207
|
+
@UseInterceptors(FeatureUsageInterceptor)
|
|
176
208
|
export class AiController {
|
|
177
209
|
@Post('generate')
|
|
178
|
-
@
|
|
179
|
-
@UseInterceptors(FeatureUsageInterceptor)
|
|
210
|
+
@RequiresFeature('ai:generate')
|
|
180
211
|
public async generate(): Promise<string> {
|
|
181
212
|
// Usage is recorded automatically after success
|
|
182
213
|
return 'generated content';
|
|
@@ -208,17 +239,16 @@ export class PaymentWebhookController {
|
|
|
208
239
|
@Req() request: RawBodyRequest<Request>,
|
|
209
240
|
@Headers('stripe-signature') signature: string,
|
|
210
241
|
): Promise<void> {
|
|
211
|
-
const event = await this._paymentClient.
|
|
242
|
+
const event = await this._paymentClient.constructWebhookEvent(request.rawBody!, signature);
|
|
212
243
|
|
|
213
244
|
switch (event.type) {
|
|
214
|
-
case 'subscription.created':
|
|
215
245
|
case 'subscription.updated':
|
|
216
246
|
// Update subscription in your database
|
|
217
247
|
break;
|
|
218
248
|
case 'subscription.deleted':
|
|
219
249
|
// Handle cancellation
|
|
220
250
|
break;
|
|
221
|
-
case '
|
|
251
|
+
case 'invoice.payment_failed':
|
|
222
252
|
// Notify user, retry logic
|
|
223
253
|
break;
|
|
224
254
|
}
|
|
@@ -234,7 +264,8 @@ export class PaymentWebhookController {
|
|
|
234
264
|
2. **Verify webhook signatures.** Always validate the webhook payload before processing.
|
|
235
265
|
3. **Use normalized models.** Don't leak provider-specific types into your business logic.
|
|
236
266
|
4. **Implement idempotent webhook handlers.** Webhooks can be delivered multiple times.
|
|
237
|
-
5. **
|
|
267
|
+
5. **Use access context for tenancy.** Read `context.tenantId` instead of coupling controllers to billing tables.
|
|
268
|
+
6. **Separate feature gating from billing logic.** The `FeatureAccessPort` should check access and record metered usage, not manage subscriptions.
|
|
238
269
|
|
|
239
270
|
## Error Handling
|
|
240
271
|
|
|
@@ -258,7 +289,7 @@ All payment clients throw `PaymentError` — a domain error that wraps the under
|
|
|
258
289
|
import { PaymentError } from '@breadstone/archipel-platform-payments';
|
|
259
290
|
|
|
260
291
|
try {
|
|
261
|
-
await this._paymentClient.createCheckoutSession(
|
|
292
|
+
await this._paymentClient.createCheckoutSession(priceId, successUrl, cancelUrl, userId);
|
|
262
293
|
} catch (error) {
|
|
263
294
|
if (error instanceof PaymentError) {
|
|
264
295
|
// error.provider → 'stripe', 'paddle', 'mollie', 'lemonsqueezy'
|
|
@@ -9,7 +9,7 @@ editUrl: false
|
|
|
9
9
|
function useExpressServer<TApplication>(options?): PlatformBootstrapStep<TApplication>;
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Defined in: server/express/useExpressServer.ts:14
|
|
12
|
+
Defined in: [server/express/useExpressServer.ts:14](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/server/express/useExpressServer.ts#L14)
|
|
13
13
|
|
|
14
14
|
Creates an Express-compatible server bootstrap step.
|
|
15
15
|
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Interface: IExpressServerStepOptions
|
|
7
7
|
|
|
8
|
-
Defined in: server/express/IExpressServerStepOptions.ts:9
|
|
8
|
+
Defined in: [server/express/IExpressServerStepOptions.ts:9](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/server/express/IExpressServerStepOptions.ts#L9)
|
|
9
9
|
|
|
10
10
|
Options for the Express-compatible server bootstrap step.
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ Options for the Express-compatible server bootstrap step.
|
|
|
17
17
|
readonly optional compression?: boolean | CompressionOptions;
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Defined in: server/express/IExpressServerStepOptions.ts:17
|
|
20
|
+
Defined in: [server/express/IExpressServerStepOptions.ts:17](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/server/express/IExpressServerStepOptions.ts#L17)
|
|
21
21
|
|
|
22
22
|
Compression middleware options, or `false` to skip compression.
|
|
23
23
|
|
|
@@ -29,7 +29,7 @@ Compression middleware options, or `false` to skip compression.
|
|
|
29
29
|
readonly optional json?: boolean | OptionsJson;
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Defined in: server/express/IExpressServerStepOptions.ts:11
|
|
32
|
+
Defined in: [server/express/IExpressServerStepOptions.ts:11](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/server/express/IExpressServerStepOptions.ts#L11)
|
|
33
33
|
|
|
34
34
|
JSON body parser options, or `false` to skip JSON body parsing.
|
|
35
35
|
|
|
@@ -41,6 +41,6 @@ JSON body parser options, or `false` to skip JSON body parsing.
|
|
|
41
41
|
readonly optional urlEncoded?: boolean | OptionsUrlencoded;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Defined in: server/express/IExpressServerStepOptions.ts:14
|
|
44
|
+
Defined in: [server/express/IExpressServerStepOptions.ts:14](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/server/express/IExpressServerStepOptions.ts#L14)
|
|
45
45
|
|
|
46
46
|
URL-encoded body parser options, or `false` to skip URL-encoded body parsing.
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: ProblemDetailResponse
|
|
7
7
|
|
|
8
|
-
Defined in: models/response/ProblemDetailResponse.ts:29
|
|
8
|
+
Defined in: [models/response/ProblemDetailResponse.ts:29](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L29)
|
|
9
9
|
|
|
10
10
|
OpenAPI schema class representing a Problem Detail response as per RFC 9457.
|
|
11
11
|
|
|
@@ -46,7 +46,7 @@ new ProblemDetailResponse(): ProblemDetailResponse;
|
|
|
46
46
|
optional code?: string;
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Defined in: models/response/ProblemDetailResponse.ts:81
|
|
49
|
+
Defined in: [models/response/ProblemDetailResponse.ts:81](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L81)
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
@@ -56,7 +56,7 @@ Defined in: models/response/ProblemDetailResponse.ts:81
|
|
|
56
56
|
detail: string;
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Defined in: models/response/ProblemDetailResponse.ts:69
|
|
59
|
+
Defined in: [models/response/ProblemDetailResponse.ts:69](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L69)
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
@@ -66,7 +66,7 @@ Defined in: models/response/ProblemDetailResponse.ts:69
|
|
|
66
66
|
optional instance?: string;
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Defined in: models/response/ProblemDetailResponse.ts:75
|
|
69
|
+
Defined in: [models/response/ProblemDetailResponse.ts:75](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L75)
|
|
70
70
|
|
|
71
71
|
***
|
|
72
72
|
|
|
@@ -76,7 +76,7 @@ Defined in: models/response/ProblemDetailResponse.ts:75
|
|
|
76
76
|
readonly static MEDIA_TYPE: "application/problem+json" = 'application/problem+json';
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Defined in: models/response/ProblemDetailResponse.ts:41
|
|
79
|
+
Defined in: [models/response/ProblemDetailResponse.ts:41](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L41)
|
|
80
80
|
|
|
81
81
|
The media type for Problem Detail responses as per RFC 9457.
|
|
82
82
|
|
|
@@ -92,7 +92,7 @@ response `type`.
|
|
|
92
92
|
status: number;
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
Defined in: models/response/ProblemDetailResponse.ts:63
|
|
95
|
+
Defined in: [models/response/ProblemDetailResponse.ts:63](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L63)
|
|
96
96
|
|
|
97
97
|
***
|
|
98
98
|
|
|
@@ -102,7 +102,7 @@ Defined in: models/response/ProblemDetailResponse.ts:63
|
|
|
102
102
|
title: string;
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
Defined in: models/response/ProblemDetailResponse.ts:57
|
|
105
|
+
Defined in: [models/response/ProblemDetailResponse.ts:57](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L57)
|
|
106
106
|
|
|
107
107
|
***
|
|
108
108
|
|
|
@@ -112,4 +112,4 @@ Defined in: models/response/ProblemDetailResponse.ts:57
|
|
|
112
112
|
type: string;
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
Defined in: models/response/ProblemDetailResponse.ts:51
|
|
115
|
+
Defined in: [models/response/ProblemDetailResponse.ts:51](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-core/src/models/response/ProblemDetailResponse.ts#L51)
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: DatabaseHealthIndicator
|
|
7
7
|
|
|
8
|
-
Defined in: [health/DatabaseHealthIndicator.ts:16](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L16)
|
|
8
|
+
Defined in: [libs/platform-database/src/health/DatabaseHealthIndicator.ts:16](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L16)
|
|
9
9
|
|
|
10
10
|
Health indicator for database connectivity.
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ Health indicator for database connectivity.
|
|
|
21
21
|
new DatabaseHealthIndicator(prismaHealthIndicator, databaseService): DatabaseHealthIndicator;
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Defined in: [health/DatabaseHealthIndicator.ts:26](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L26)
|
|
24
|
+
Defined in: [libs/platform-database/src/health/DatabaseHealthIndicator.ts:26](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L26)
|
|
25
25
|
|
|
26
26
|
#### Parameters
|
|
27
27
|
|
|
@@ -42,7 +42,7 @@ Defined in: [health/DatabaseHealthIndicator.ts:26](https://github.com/RueDeRenne
|
|
|
42
42
|
readonly key: string = 'database';
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Defined in: [health/DatabaseHealthIndicator.ts:35](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L35)
|
|
45
|
+
Defined in: [libs/platform-database/src/health/DatabaseHealthIndicator.ts:35](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L35)
|
|
46
46
|
|
|
47
47
|
Unique key identifying the indicator
|
|
48
48
|
|
|
@@ -60,7 +60,7 @@ IHealthIndicator.key
|
|
|
60
60
|
check(): Promise<HealthIndicatorResult<"database">>;
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Defined in: [health/DatabaseHealthIndicator.ts:47](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L47)
|
|
63
|
+
Defined in: [libs/platform-database/src/health/DatabaseHealthIndicator.ts:47](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/health/DatabaseHealthIndicator.ts#L47)
|
|
64
64
|
|
|
65
65
|
Checks database connectivity via a Prisma ping.
|
|
66
66
|
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: DatabaseModule
|
|
7
7
|
|
|
8
|
-
Defined in: [DatabaseModule.ts:53](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/DatabaseModule.ts#L53)
|
|
8
|
+
Defined in: [libs/platform-database/src/DatabaseModule.ts:53](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/DatabaseModule.ts#L53)
|
|
9
9
|
|
|
10
10
|
## Constructors
|
|
11
11
|
|
|
@@ -27,7 +27,7 @@ new DatabaseModule(): DatabaseModule;
|
|
|
27
27
|
static forRoot(config?): DynamicModule;
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
Defined in: [DatabaseModule.ts:62](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/DatabaseModule.ts#L62)
|
|
30
|
+
Defined in: [libs/platform-database/src/DatabaseModule.ts:62](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/DatabaseModule.ts#L62)
|
|
31
31
|
|
|
32
32
|
Registers the `DatabaseModule` with global middlewares.
|
|
33
33
|
|
|
@@ -51,7 +51,7 @@ A `DynamicModule` that can be imported globally
|
|
|
51
51
|
static register(config?): DynamicModule;
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Defined in: [DatabaseModule.ts:82](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/DatabaseModule.ts#L82)
|
|
54
|
+
Defined in: [libs/platform-database/src/DatabaseModule.ts:82](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/DatabaseModule.ts#L82)
|
|
55
55
|
|
|
56
56
|
Registers the `DatabaseModule` with dynamic middlewares.
|
|
57
57
|
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: DatabaseService
|
|
7
7
|
|
|
8
|
-
Defined in: [services/DatabaseService.ts:16](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L16)
|
|
8
|
+
Defined in: [libs/platform-database/src/services/DatabaseService.ts:16](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L16)
|
|
9
9
|
|
|
10
10
|
Represents the database service.
|
|
11
11
|
|
|
@@ -16,7 +16,8 @@ Represents the database service.
|
|
|
16
16
|
## Indexable
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
[
|
|
19
|
+
[K: symbol]: {
|
|
20
|
+
}
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
## Constructors
|
|
@@ -27,7 +28,7 @@ Represents the database service.
|
|
|
27
28
|
new DatabaseService(configService, options?): DatabaseService;
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
Defined in: [services/DatabaseService.ts:24](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L24)
|
|
31
|
+
Defined in: [libs/platform-database/src/services/DatabaseService.ts:24](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L24)
|
|
31
32
|
|
|
32
33
|
Constructs a new instance of the `DatabaseService` class.
|
|
33
34
|
|
|
@@ -54,7 +55,7 @@ Constructs a new instance of the `DatabaseService` class.
|
|
|
54
55
|
onModuleDestroy(): Promise<void>;
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Defined in: [services/PrismaService.ts:69](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L69)
|
|
58
|
+
Defined in: [libs/platform-database/src/services/PrismaService.ts:69](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L69)
|
|
58
59
|
|
|
59
60
|
#### Returns
|
|
60
61
|
|
|
@@ -72,7 +73,7 @@ Defined in: [services/PrismaService.ts:69](https://github.com/RueDeRennes/archip
|
|
|
72
73
|
onModuleInit(): Promise<void>;
|
|
73
74
|
```
|
|
74
75
|
|
|
75
|
-
Defined in: [services/PrismaService.ts:58](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L58)
|
|
76
|
+
Defined in: [libs/platform-database/src/services/PrismaService.ts:58](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L58)
|
|
76
77
|
|
|
77
78
|
#### Returns
|
|
78
79
|
|
|
@@ -87,10 +88,10 @@ Defined in: [services/PrismaService.ts:58](https://github.com/RueDeRennes/archip
|
|
|
87
88
|
### transaction()
|
|
88
89
|
|
|
89
90
|
```ts
|
|
90
|
-
transaction<P>(arg, options?):
|
|
91
|
+
transaction<P>(arg, options?): Promise<unknown>;
|
|
91
92
|
```
|
|
92
93
|
|
|
93
|
-
Defined in: [services/DatabaseService.ts:40](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L40)
|
|
94
|
+
Defined in: [libs/platform-database/src/services/DatabaseService.ts:40](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L40)
|
|
94
95
|
|
|
95
96
|
Creates a new transaction.
|
|
96
97
|
|
|
@@ -105,11 +106,11 @@ Creates a new transaction.
|
|
|
105
106
|
| Parameter | Type | Description |
|
|
106
107
|
| ------ | ------ | ------ |
|
|
107
108
|
| `arg` | \[`...P[]`\] | The argument. |
|
|
108
|
-
| `options?` |
|
|
109
|
+
| `options?` | \{ \} | The options. |
|
|
109
110
|
|
|
110
111
|
#### Returns
|
|
111
112
|
|
|
112
|
-
`
|
|
113
|
+
`Promise`\<`unknown`\>
|
|
113
114
|
|
|
114
115
|
Returns the result of the transaction.
|
|
115
116
|
|
|
@@ -121,7 +122,7 @@ Returns the result of the transaction.
|
|
|
121
122
|
transactionCallback<T>(fn, options?): Promise<T>;
|
|
122
123
|
```
|
|
123
124
|
|
|
124
|
-
Defined in: [services/DatabaseService.ts:55](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L55)
|
|
125
|
+
Defined in: [libs/platform-database/src/services/DatabaseService.ts:55](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/DatabaseService.ts#L55)
|
|
125
126
|
|
|
126
127
|
Executes a transactional callback (extended overload missing in base typing wrapper).
|
|
127
128
|
|
|
@@ -136,7 +137,7 @@ Executes a transactional callback (extended overload missing in base typing wrap
|
|
|
136
137
|
| Parameter | Type |
|
|
137
138
|
| ------ | ------ |
|
|
138
139
|
| `fn` | (`tx`) => `Promise`\<`T`\> |
|
|
139
|
-
| `options?` |
|
|
140
|
+
| `options?` | \{ \} |
|
|
140
141
|
|
|
141
142
|
#### Returns
|
|
142
143
|
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: PrismaService
|
|
7
7
|
|
|
8
|
-
Defined in: [services/PrismaService.ts:29](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L29)
|
|
8
|
+
Defined in: [libs/platform-database/src/services/PrismaService.ts:29](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L29)
|
|
9
9
|
|
|
10
10
|
Represents the prisma service.
|
|
11
11
|
|
|
@@ -25,7 +25,8 @@ Represents the prisma service.
|
|
|
25
25
|
## Indexable
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
|
-
[
|
|
28
|
+
[K: symbol]: {
|
|
29
|
+
}
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
## Constructors
|
|
@@ -36,7 +37,7 @@ Represents the prisma service.
|
|
|
36
37
|
new PrismaService(configService, options?): PrismaService;
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
Defined in: [services/PrismaService.ts:43](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L43)
|
|
40
|
+
Defined in: [libs/platform-database/src/services/PrismaService.ts:43](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L43)
|
|
40
41
|
|
|
41
42
|
Constructs a new instance of the `PrismaService` class.
|
|
42
43
|
|
|
@@ -65,7 +66,7 @@ PrismaClient.constructor
|
|
|
65
66
|
onModuleDestroy(): Promise<void>;
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
Defined in: [services/PrismaService.ts:69](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L69)
|
|
69
|
+
Defined in: [libs/platform-database/src/services/PrismaService.ts:69](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L69)
|
|
69
70
|
|
|
70
71
|
#### Returns
|
|
71
72
|
|
|
@@ -85,7 +86,7 @@ OnModuleDestroy.onModuleDestroy
|
|
|
85
86
|
onModuleInit(): Promise<void>;
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
Defined in: [services/PrismaService.ts:58](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L58)
|
|
89
|
+
Defined in: [libs/platform-database/src/services/PrismaService.ts:58](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-database/src/services/PrismaService.ts#L58)
|
|
89
90
|
|
|
90
91
|
#### Returns
|
|
91
92
|
|