@authhero/adapter-interfaces 3.2.0 → 3.3.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.
@@ -4,9 +4,26 @@ export interface ListSesssionsResponse extends Totals {
4
4
  sessions: Session[];
5
5
  }
6
6
  export interface SessionsAdapter {
7
+ /**
8
+ * ADAPTER RESPONSIBILITY (footgun): when a session is created with an
9
+ * `expires_at`/`idle_expires_at`, the adapter MUST extend the parent
10
+ * `login_session` (referenced by `login_session_id`) so it lives at least as
11
+ * long as the session — never shortening it (only bump when the session's
12
+ * expiry is further out than the login_session's current expiry).
13
+ *
14
+ * If an adapter skips this, a long-lived session outlives its login_session
15
+ * and gets orphaned when cleanup reaps the login_session. The bump must be
16
+ * atomic with the insert. See `refreshTokens` for the equivalent contract.
17
+ */
7
18
  create: (tenant_id: string, session: SessionInsert) => Promise<Session>;
8
19
  get: (tenant_id: string, id: string) => Promise<Session | null>;
9
20
  list(tenantId: string, params?: ListParams): Promise<ListSesssionsResponse>;
21
+ /**
22
+ * ADAPTER RESPONSIBILITY (footgun): when an update moves `expires_at`/
23
+ * `idle_expires_at` forward (session renewal), the adapter MUST extend the
24
+ * parent `login_session` the same way `create` does (never shortening). See
25
+ * the note on `create` above.
26
+ */
10
27
  update: (tenant_id: string, id: string, session: Partial<Session>) => Promise<boolean>;
11
28
  remove: (tenant_id: string, id: string) => Promise<boolean>;
12
29
  }
@@ -14,6 +14,7 @@ export interface CreateTenantParams {
14
14
  provisioning_state_changed_at?: string;
15
15
  bundle_configuration?: string;
16
16
  worker_version?: string;
17
+ database_version?: string;
17
18
  worker_script_name?: string;
18
19
  storage_kind?: "own_d1" | "existing_d1" | "shared_planetscale";
19
20
  d1_database_id?: string;
@@ -123,6 +123,7 @@ export declare const tenantInsertSchema: z.ZodObject<{
123
123
  provisioning_state_changed_at: z.ZodOptional<z.ZodString>;
124
124
  bundle_configuration: z.ZodOptional<z.ZodString>;
125
125
  worker_version: z.ZodOptional<z.ZodString>;
126
+ database_version: z.ZodOptional<z.ZodString>;
126
127
  worker_script_name: z.ZodOptional<z.ZodString>;
127
128
  storage_kind: z.ZodOptional<z.ZodEnum<{
128
129
  own_d1: "own_d1";
@@ -327,6 +328,7 @@ export declare const tenantSchema: z.ZodObject<{
327
328
  provisioning_state_changed_at: z.ZodOptional<z.ZodString>;
328
329
  bundle_configuration: z.ZodOptional<z.ZodString>;
329
330
  worker_version: z.ZodOptional<z.ZodString>;
331
+ database_version: z.ZodOptional<z.ZodString>;
330
332
  worker_script_name: z.ZodOptional<z.ZodString>;
331
333
  storage_kind: z.ZodOptional<z.ZodEnum<{
332
334
  own_d1: "own_d1";
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.2.0",
14
+ "version": "3.3.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],