@pattern-stack/codegen 0.6.6 → 0.6.7

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.
@@ -0,0 +1,21 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { IntegrationService } from '../../integration.service';
3
+ import type { Integration } from '../../integration.entity';
4
+
5
+ /**
6
+ * Lists a user's integrations newest-first. Used by the settings page
7
+ * (`GET /integrations`) and any "which providers are connected?" UI.
8
+ *
9
+ * Returns rows with ciphertexts intact — callers should NOT pass these
10
+ * to the frontend. Use `IntegrationsService.listByUser` if you need
11
+ * the consumer-facing facade behavior (which strips ciphertexts before
12
+ * returning).
13
+ */
14
+ @Injectable()
15
+ export class ListUserIntegrationsUseCase {
16
+ constructor(private readonly integrations: IntegrationService) {}
17
+
18
+ async execute(userId: string): Promise<Integration[]> {
19
+ return this.integrations.findByUserId(userId);
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { IntegrationService } from '../../integration.service';
3
+ import type { Integration } from '../../integration.entity';
4
+
5
+ /**
6
+ * Flips an integration's status to `requires_reauth`. Called when the
7
+ * refresh path raises `IntegrationBrokenError` (refresh token rejected,
8
+ * scopes revoked, etc.) — see `OAuth2RefreshStrategy` + `withAuthRetry`.
9
+ *
10
+ * Idempotent: calling on an already-broken row is a no-op write.
11
+ */
12
+ @Injectable()
13
+ export class MarkIntegrationRequiresReauthUseCase {
14
+ constructor(private readonly integrations: IntegrationService) {}
15
+
16
+ async execute(integrationId: string): Promise<Integration> {
17
+ return this.integrations.update(integrationId, {
18
+ status: 'requires_reauth',
19
+ });
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pattern-stack/codegen",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Entity-driven code generation for full-stack TypeScript applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,6 +40,7 @@
40
40
  "dist",
41
41
  "runtime",
42
42
  "templates",
43
+ "examples/auth-integrations/**",
43
44
  "src/config/*.mjs",
44
45
  "src/schema/naming-config.schema.mjs",
45
46
  "src/patterns/registry.ts",