@authhero/adapter-interfaces 3.7.0 → 3.9.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.
@@ -10,6 +10,5 @@ export interface ThemesAdapter {
10
10
  create: (tenant_id: string, theme: ThemeInsert, themeId?: string, options?: CreateOptions) => Promise<Theme>;
11
11
  remove: (tenant_id: string, themeId: string) => Promise<boolean>;
12
12
  get: (tenant_id: string, themeId: string) => Promise<Theme | null>;
13
- list: (tenant_id: string) => Promise<Theme[]>;
14
13
  update: (tenant_id: string, themeId: any, theme: Partial<ThemeInsert>) => Promise<boolean>;
15
14
  }
@@ -1,9 +1,28 @@
1
1
  import { User, Totals, UserInsert } from "../types";
2
+ import { AuditEventInsert } from "../types/AuditEvent";
2
3
  import { ListParams } from "../types/ListParams";
3
4
  import { CreateOptions } from "../types/ImportMetadata";
4
5
  export interface ListUsersResponse extends Totals {
5
6
  users: User[];
6
7
  }
8
+ /**
9
+ * An outbox event to persist atomically with a business write. It carries a
10
+ * caller-assigned `id` so the enqueuer can relay it (push it onto the request's
11
+ * outbox-event list for delivery) without a return round-trip from the adapter.
12
+ */
13
+ export type OutboxEventInsert = AuditEventInsert & {
14
+ id: string;
15
+ };
16
+ /**
17
+ * Options common to the event-emitting user writes. When `outboxEvents` are
18
+ * supplied, the adapter MUST persist them in the same atomic unit as the
19
+ * business write — a single `db.batch()` on D1, one transaction on
20
+ * kysely/better-sqlite3 — so the business row and its event row commit together
21
+ * or not at all (the defining guarantee of the transactional outbox pattern).
22
+ */
23
+ export interface WriteOptions {
24
+ outboxEvents?: OutboxEventInsert[];
25
+ }
7
26
  export interface UserDataAdapter {
8
27
  get(tenant_id: string, id: string): Promise<User | null>;
9
28
  create(tenantId: string, user: UserInsert, options?: CreateOptions): Promise<User>;
@@ -12,10 +31,13 @@ export interface UserDataAdapter {
12
31
  * registration hooks, linking, webhooks, etc.). Intended to be called from
13
32
  * inside a registration pipeline that owns hook orchestration and transaction
14
33
  * boundaries itself. The DB-level behavior is identical to `create`.
34
+ *
35
+ * Pass `options.outboxEvents` to persist post-registration outbox events in
36
+ * the same atomic unit as the user row.
15
37
  */
16
- rawCreate(tenantId: string, user: UserInsert): Promise<User>;
17
- remove(tenantId: string, id: string): Promise<boolean>;
38
+ rawCreate(tenantId: string, user: UserInsert, options?: WriteOptions): Promise<User>;
39
+ remove(tenantId: string, id: string, options?: WriteOptions): Promise<boolean>;
18
40
  list(tenantId: string, params?: ListParams): Promise<ListUsersResponse>;
19
- update(tenantId: string, id: string, user: Partial<User>): Promise<boolean>;
41
+ update(tenantId: string, id: string, user: Partial<User>, options?: WriteOptions): Promise<boolean>;
20
42
  unlink(tenantId: string, id: string, provider: string, linked_user_id: string): Promise<boolean>;
21
43
  }
@@ -111,6 +111,8 @@ export declare const auditEventInsertSchema: z.ZodObject<{
111
111
  body: z.ZodOptional<z.ZodUnknown>;
112
112
  }, z.core.$strip>>;
113
113
  connection: z.ZodOptional<z.ZodString>;
114
+ connection_id: z.ZodOptional<z.ZodString>;
115
+ client_name: z.ZodOptional<z.ZodString>;
114
116
  strategy: z.ZodOptional<z.ZodString>;
115
117
  strategy_type: z.ZodOptional<z.ZodString>;
116
118
  audience: z.ZodOptional<z.ZodString>;
@@ -183,6 +185,8 @@ export declare const auditEventSchema: z.ZodObject<{
183
185
  body: z.ZodOptional<z.ZodUnknown>;
184
186
  }, z.core.$strip>>;
185
187
  connection: z.ZodOptional<z.ZodString>;
188
+ connection_id: z.ZodOptional<z.ZodString>;
189
+ client_name: z.ZodOptional<z.ZodString>;
186
190
  strategy: z.ZodOptional<z.ZodString>;
187
191
  strategy_type: z.ZodOptional<z.ZodString>;
188
192
  audience: z.ZodOptional<z.ZodString>;
@@ -20,3 +20,20 @@ export declare const StrategyType: {
20
20
  readonly SOCIAL: "social";
21
21
  readonly PASSWORDLESS: "passwordless";
22
22
  };
23
+ /**
24
+ * The strategy value Auth0 stores on database connections. The canonical
25
+ * target for new connection rows; see isDatabaseConnectionStrategy for
26
+ * the legacy spellings still present in existing data.
27
+ */
28
+ export declare const DATABASE_CONNECTION_STRATEGY = "auth0";
29
+ /**
30
+ * True when a connection's `strategy` field marks it as a native database
31
+ * (username/password) connection.
32
+ *
33
+ * Auth0 stores database connections with `strategy: "auth0"`. Existing
34
+ * AuthHero data also contains two legacy spellings: the connection NAME
35
+ * ("Username-Password-Authentication") reused as the strategy, and the
36
+ * legacy provider literal ("auth2"). All readers must accept all three
37
+ * until connection rows are backfilled to "auth0".
38
+ */
39
+ export declare function isDatabaseConnectionStrategy(strategy: string | undefined | null): boolean;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "3.7.0",
14
+ "version": "3.9.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],