@authhero/kysely-adapter 11.16.0 → 11.17.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.
@@ -6,5 +6,5 @@ export type CoalescedNumericField = {
6
6
  };
7
7
  export type FieldMapping = string | CoalescedNumericField;
8
8
  export declare function coalescedRef(field: CoalescedNumericField): import("kysely").RawBuilder<unknown>;
9
- export declare function sanitizeLuceneQuery(query: string, allowedFields: string[]): string;
9
+ export { sanitizeLuceneQuery } from "@authhero/adapter-interfaces";
10
10
  export declare function luceneFilter<DB, TB extends keyof DB, O>(db: Kysely<Database>, qb: SelectQueryBuilder<DB, TB, O>, query: string, searchableColumns: string[], likeFields?: string[], fieldMap?: Record<string, FieldMapping>): SelectQueryBuilder<DB, TB, O>;
@@ -20,6 +20,13 @@ export interface KeysetOptions {
20
20
  sortOrder: "asc" | "desc";
21
21
  /** Unique tiebreaker column; defaults to "id". */
22
22
  idColumn?: string;
23
+ /**
24
+ * Sort spec (e.g. `date:desc`) for endpoints that honor a caller-chosen sort
25
+ * in checkpoint mode. Minted into the cursor; a cursor presented under a
26
+ * different sort spec is rejected with a 400, because its keyset position is
27
+ * meaningless in the new order. Omit on fixed-sort endpoints.
28
+ */
29
+ sortKey?: string;
23
30
  }
24
31
  export interface KeysetResult<Row> {
25
32
  rows: Row[];
@@ -1 +1 @@
1
- export declare function removeNullProperties<T = any>(obj: unknown): T;
1
+ export { removeNullProperties } from "@authhero/adapter-interfaces/sql";
@@ -1,40 +1 @@
1
- /**
2
- * Stringify a value to JSON if it's defined, otherwise return undefined.
3
- * This is useful for converting objects to JSON strings for database storage.
4
- */
5
- export declare function stringifyIfDefined<T>(value: T | undefined): string | undefined;
6
- /**
7
- * Stringify multiple properties of an object to JSON strings.
8
- * Only properties that are defined will be stringified.
9
- *
10
- * @param obj - The source object containing properties to stringify
11
- * @param properties - Array of property names to stringify
12
- * @param target - The target object to write stringified values to (defaults to a new object based on obj)
13
- * @returns The target object with stringified properties
14
- *
15
- * @example
16
- * const source = { flags: { enabled: true }, sessions: { timeout: 300 }, name: "Test" };
17
- * const result = stringifyProperties(source, ['flags', 'sessions']);
18
- * // result = { flags: '{"enabled":true}', sessions: '{"timeout":300}', name: "Test" }
19
- */
20
- export declare function stringifyProperties<T extends Record<string, any>>(obj: T, properties: (keyof T)[], target?: any): any;
21
- /**
22
- * Convert boolean properties to integers (1 for true, 0 for false).
23
- * Only properties that are defined will be converted.
24
- *
25
- * @param source - The source object containing boolean properties to convert
26
- * @param properties - Array of property names to convert
27
- * @param target - The target object to write integer values to (defaults to source)
28
- *
29
- * @example
30
- * const source = { enabled: true, active: false, name: "Test" };
31
- * const result = {};
32
- * booleanToInt(source, ['enabled', 'active'], result);
33
- * // result = { enabled: 1, active: 0 }
34
- */
35
- export declare function booleanToInt<T extends Record<string, any>>(source: Partial<T>, properties: (keyof T)[], target?: any): void;
36
- /**
37
- * Remove undefined and null properties from an object.
38
- * This keeps the SQL payload clean by only including defined values.
39
- */
40
- export declare function removeUndefinedAndNull<T extends Record<string, any>>(obj: T): Partial<T>;
1
+ export { stringifyIfDefined, stringifyProperties, booleanToInt, removeUndefinedAndNull, } from "@authhero/adapter-interfaces/sql";
@@ -41,4 +41,46 @@ export declare function listLogs(db: Kysely<Database>): (tenant_id: string, para
41
41
  start: number;
42
42
  limit: number;
43
43
  length: number;
44
+ next: string | undefined;
45
+ } | {
46
+ logs: {
47
+ type: "fn" | "acls_summary" | "actions_execution_failed" | "api_limit" | "api_limit_warning" | "appi" | "ciba_exchange_failed" | "ciba_exchange_succeeded" | "ciba_start_failed" | "ciba_start_succeeded" | "cls" | "cs" | "depnote" | "f" | "fc" | "fce" | "fco" | "fcoa" | "fcp" | "fcph" | "fcpn" | "fcpr" | "fcpro" | "fcu" | "fd" | "fdeac" | "fdeaz" | "fdecc" | "fdu" | "feacft" | "feccft" | "fecte" | "fede" | "federated_logout_failed" | "fens" | "feoobft" | "feotpft" | "fepft" | "fepotpft" | "fercft" | "ferrt" | "fertft" | "festft" | "fh" | "fimp" | "fi" | "flo" | "flows_execution_completed" | "flows_execution_failed" | "forms_submission_failed" | "forms_submission_succeeded" | "fp" | "fpar" | "fpurh" | "fs" | "fsa" | "fu" | "fui" | "fv" | "fvr" | "gd_auth_email_verification" | "gd_auth_fail_email_verification" | "gd_auth_failed" | "gd_auth_rejected" | "gd_auth_succeed" | "gd_enrollment_complete" | "gd_otp_rate_limit_exceed" | "gd_recovery_failed" | "gd_recovery_rate_limit_exceed" | "gd_recovery_succeed" | "gd_send_email" | "gd_send_email_verification" | "gd_send_email_verification_failure" | "gd_send_pn" | "gd_send_pn_failure" | "gd_send_sms" | "gd_send_sms_failure" | "gd_send_voice" | "gd_send_voice_failure" | "gd_start_auth" | "gd_start_enroll" | "gd_start_enroll_failed" | "gd_tenant_update" | "gd_unenroll" | "gd_update_device_account" | "gd_webauthn_challenge_failed" | "gd_webauthn_enrollment_failed" | "kms_key_management_failure" | "kms_key_management_success" | "kms_key_state_changed" | "limit_delegation" | "limit_mu" | "limit_sul" | "limit_wc" | "i" | "mfar" | "mgmt_api_read" | "my_account_authentication_method_failed" | "my_account_authentication_method_succeeded" | "oidc_backchannel_logout_failed" | "oidc_backchannel_logout_succeeded" | "organization_member_added" | "passkey_challenge_failed" | "passkey_challenge_started" | "pla" | "pwd_leak" | "reset_pwd_leak" | "resource_cleanup" | "rich_consents_access_error" | "s" | "sapi" | "fapi" | "sce" | "scoa" | "scp" | "scpn" | "scpr" | "scu" | "scv" | "sd" | "sdu" | "seacft" | "seccft" | "secte" | "sede" | "sens" | "seoobft" | "seotpft" | "sepotpft" | "sepft" | "sepkoobft" | "sepkotpft" | "sepkrcft" | "sercft" | "sertft" | "sestft" | "simp" | "si" | "signup_pwd_leak" | "slo" | "sh" | "spm" | "srrt" | "ss" | "ss_sso_failure" | "ss_sso_info" | "ss_sso_success" | "ssa" | "sscim" | "sui" | "sv" | "svr" | "too_many_records" | "ublkdu" | "universal_logout_failed" | "universal_logout_succeeded" | "w" | "wn" | "wum";
48
+ date: string;
49
+ isMobile: boolean;
50
+ log_id: string;
51
+ description?: string | undefined;
52
+ ip?: string | undefined;
53
+ user_agent?: string | undefined;
54
+ details?: any;
55
+ user_id?: string | undefined;
56
+ user_name?: string | undefined;
57
+ connection?: string | undefined;
58
+ connection_id?: string | undefined;
59
+ client_id?: string | undefined;
60
+ client_name?: string | undefined;
61
+ audience?: string | undefined;
62
+ scope?: string | undefined;
63
+ strategy?: string | undefined;
64
+ strategy_type?: string | undefined;
65
+ hostname?: string | undefined;
66
+ auth0_client?: {
67
+ name: string;
68
+ version: string;
69
+ env?: {
70
+ node?: string | undefined;
71
+ } | undefined;
72
+ } | undefined;
73
+ location_info?: {
74
+ country_code: string;
75
+ city_name: string;
76
+ latitude: string;
77
+ longitude: string;
78
+ time_zone: string;
79
+ continent_code: string;
80
+ } | undefined;
81
+ }[];
82
+ start: number;
83
+ limit: number;
84
+ length: number;
85
+ next?: undefined;
44
86
  }>;
@@ -1,46 +1 @@
1
- /**
2
- * Date conversion utilities for adapters that support BOTH formats during migration:
3
- * - Old format: varchar(35) ISO 8601 strings (e.g., "2024-01-15T10:30:00.000Z")
4
- * - New format: bigint Unix timestamps in milliseconds (e.g., 1705315800000)
5
- *
6
- * The adapter interface always uses ISO strings, so we convert:
7
- * - On READ: Detect format and convert to ISO string
8
- * - On WRITE: Write as bigint timestamp (new format)
9
- *
10
- * This allows zero-downtime migration where:
11
- * 1. Deploy code that reads both formats, writes new format
12
- * 2. Run migration to convert existing data
13
- * 3. (Optional) Remove old format support after migration completes
14
- */
15
- /**
16
- * Type for a date field that could be either format from the database
17
- */
18
- export type DbDateField = string | number | null | undefined;
19
- /**
20
- * Convert a database date field (either format) to an ISO string for the adapter interface
21
- * Returns undefined if the value is null/undefined/empty
22
- */
23
- export declare function dbDateToIso(value: DbDateField): string | undefined;
24
- /**
25
- * Convert a database date field to ISO string, with a required fallback
26
- * Use this for non-nullable date fields like created_at
27
- */
28
- export declare function dbDateToIsoRequired(value: DbDateField, fallback?: string): string;
29
- /**
30
- * Convert an ISO string from the adapter interface to the NEW format (bigint timestamp)
31
- * for writing to the database
32
- */
33
- export declare function isoToDbDate(isoString: string | null | undefined): number | null;
34
- /**
35
- * Get current timestamp as ISO string (for adapter interface)
36
- */
37
- export declare function nowIso(): string;
38
- /**
39
- * Convert date fields from DB format to adapter format (ISO strings)
40
- * Strips the _ts suffix from column names (e.g., created_at_ts -> created_at)
41
- * @param row - The database row object
42
- * @param requiredColumns - Columns that must have a value (will use fallback if null)
43
- * @param optionalColumns - Columns that can be undefined
44
- * @returns Object with converted date fields (with _ts suffix stripped)
45
- */
46
- export declare function convertDatesToAdapter<T extends Record<string, DbDateField>, R extends keyof T, O extends keyof T = never>(row: T, requiredColumns: R[], optionalColumns?: O[]): Record<string, string | undefined>;
1
+ export { type DbDateField, dbDateToIso, dbDateToIsoRequired, isoToDbDate, nowIso, convertDatesToAdapter, } from "@authhero/adapter-interfaces/sql";
@@ -1 +1 @@
1
- export default function getCountAsInt(count: string | number | bigint): number;
1
+ export { getCountAsInt as default } from "@authhero/adapter-interfaces/sql";