@authhero/kysely-adapter 11.0.0 → 11.1.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.
@@ -17508,6 +17508,129 @@ declare const logStreamSchema: z.ZodObject<{
17508
17508
  isPriority?: boolean | undefined;
17509
17509
  }>;
17510
17510
  export type LogStream = z.infer<typeof logStreamSchema>;
17511
+ declare const migrationSourceInsertSchema: z.ZodObject<{
17512
+ id: z.ZodOptional<z.ZodString>;
17513
+ name: z.ZodString;
17514
+ provider: z.ZodEnum<[
17515
+ "auth0",
17516
+ "cognito",
17517
+ "okta",
17518
+ "oidc"
17519
+ ]>;
17520
+ connection: z.ZodString;
17521
+ enabled: z.ZodDefault<z.ZodBoolean>;
17522
+ credentials: z.ZodObject<{
17523
+ domain: z.ZodString;
17524
+ client_id: z.ZodString;
17525
+ client_secret: z.ZodString;
17526
+ audience: z.ZodOptional<z.ZodString>;
17527
+ scope: z.ZodOptional<z.ZodString>;
17528
+ }, "strip", z.ZodTypeAny, {
17529
+ client_id: string;
17530
+ client_secret: string;
17531
+ domain: string;
17532
+ audience?: string | undefined;
17533
+ scope?: string | undefined;
17534
+ }, {
17535
+ client_id: string;
17536
+ client_secret: string;
17537
+ domain: string;
17538
+ audience?: string | undefined;
17539
+ scope?: string | undefined;
17540
+ }>;
17541
+ }, "strip", z.ZodTypeAny, {
17542
+ name: string;
17543
+ connection: string;
17544
+ provider: "auth0" | "cognito" | "okta" | "oidc";
17545
+ enabled: boolean;
17546
+ credentials: {
17547
+ client_id: string;
17548
+ client_secret: string;
17549
+ domain: string;
17550
+ audience?: string | undefined;
17551
+ scope?: string | undefined;
17552
+ };
17553
+ id?: string | undefined;
17554
+ }, {
17555
+ name: string;
17556
+ connection: string;
17557
+ provider: "auth0" | "cognito" | "okta" | "oidc";
17558
+ credentials: {
17559
+ client_id: string;
17560
+ client_secret: string;
17561
+ domain: string;
17562
+ audience?: string | undefined;
17563
+ scope?: string | undefined;
17564
+ };
17565
+ id?: string | undefined;
17566
+ enabled?: boolean | undefined;
17567
+ }>;
17568
+ export type MigrationSourceInsert = z.infer<typeof migrationSourceInsertSchema>;
17569
+ declare const migrationSourceSchema: z.ZodObject<{
17570
+ created_at: z.ZodString;
17571
+ updated_at: z.ZodString;
17572
+ } & {
17573
+ id: z.ZodOptional<z.ZodString>;
17574
+ name: z.ZodString;
17575
+ provider: z.ZodEnum<[
17576
+ "auth0",
17577
+ "cognito",
17578
+ "okta",
17579
+ "oidc"
17580
+ ]>;
17581
+ connection: z.ZodString;
17582
+ enabled: z.ZodDefault<z.ZodBoolean>;
17583
+ credentials: z.ZodObject<{
17584
+ domain: z.ZodString;
17585
+ client_id: z.ZodString;
17586
+ client_secret: z.ZodString;
17587
+ audience: z.ZodOptional<z.ZodString>;
17588
+ scope: z.ZodOptional<z.ZodString>;
17589
+ }, "strip", z.ZodTypeAny, {
17590
+ client_id: string;
17591
+ client_secret: string;
17592
+ domain: string;
17593
+ audience?: string | undefined;
17594
+ scope?: string | undefined;
17595
+ }, {
17596
+ client_id: string;
17597
+ client_secret: string;
17598
+ domain: string;
17599
+ audience?: string | undefined;
17600
+ scope?: string | undefined;
17601
+ }>;
17602
+ }, "strip", z.ZodTypeAny, {
17603
+ created_at: string;
17604
+ updated_at: string;
17605
+ name: string;
17606
+ connection: string;
17607
+ provider: "auth0" | "cognito" | "okta" | "oidc";
17608
+ enabled: boolean;
17609
+ credentials: {
17610
+ client_id: string;
17611
+ client_secret: string;
17612
+ domain: string;
17613
+ audience?: string | undefined;
17614
+ scope?: string | undefined;
17615
+ };
17616
+ id?: string | undefined;
17617
+ }, {
17618
+ created_at: string;
17619
+ updated_at: string;
17620
+ name: string;
17621
+ connection: string;
17622
+ provider: "auth0" | "cognito" | "okta" | "oidc";
17623
+ credentials: {
17624
+ client_id: string;
17625
+ client_secret: string;
17626
+ domain: string;
17627
+ audience?: string | undefined;
17628
+ scope?: string | undefined;
17629
+ };
17630
+ id?: string | undefined;
17631
+ enabled?: boolean | undefined;
17632
+ }>;
17633
+ export type MigrationSource = z.infer<typeof migrationSourceSchema>;
17511
17634
  declare const passwordInsertSchema: z.ZodObject<{
17512
17635
  id: z.ZodOptional<z.ZodString>;
17513
17636
  user_id: z.ZodString;
@@ -20631,6 +20754,73 @@ declare const dailyStatsSchema: z.ZodObject<{
20631
20754
  leaked_passwords: number;
20632
20755
  }>;
20633
20756
  export type DailyStats = z.infer<typeof dailyStatsSchema>;
20757
+ declare const analyticsResourceSchema: z.ZodEnum<[
20758
+ "active-users",
20759
+ "logins",
20760
+ "signups",
20761
+ "refresh-tokens",
20762
+ "sessions"
20763
+ ]>;
20764
+ export type AnalyticsResource = z.infer<typeof analyticsResourceSchema>;
20765
+ declare const analyticsIntervalSchema: z.ZodEnum<[
20766
+ "hour",
20767
+ "day",
20768
+ "week",
20769
+ "month"
20770
+ ]>;
20771
+ export type AnalyticsInterval = z.infer<typeof analyticsIntervalSchema>;
20772
+ declare const analyticsGroupBySchema: z.ZodEnum<[
20773
+ "time",
20774
+ "connection",
20775
+ "client_id",
20776
+ "user_type",
20777
+ "event"
20778
+ ]>;
20779
+ export type AnalyticsGroupBy = z.infer<typeof analyticsGroupBySchema>;
20780
+ declare const analyticsUserTypeSchema: z.ZodEnum<[
20781
+ "password",
20782
+ "social",
20783
+ "passwordless",
20784
+ "enterprise"
20785
+ ]>;
20786
+ export type AnalyticsUserType = z.infer<typeof analyticsUserTypeSchema>;
20787
+ export interface AnalyticsFilters {
20788
+ connection?: string[];
20789
+ client_id?: string[];
20790
+ user_type?: AnalyticsUserType[];
20791
+ user_id?: string[];
20792
+ }
20793
+ export interface AnalyticsQueryParams {
20794
+ /** Inclusive lower bound, ISO 8601 datetime in UTC */
20795
+ from: string;
20796
+ /** Exclusive upper bound, ISO 8601 datetime in UTC */
20797
+ to: string;
20798
+ interval: AnalyticsInterval;
20799
+ /** IANA timezone for bucket boundaries */
20800
+ tz: string;
20801
+ filters: AnalyticsFilters;
20802
+ group_by: AnalyticsGroupBy[];
20803
+ limit: number;
20804
+ offset: number;
20805
+ /** Column name, prefix with `-` for descending */
20806
+ order_by?: string;
20807
+ }
20808
+ export interface AnalyticsColumnMeta {
20809
+ name: string;
20810
+ /** ClickHouse-style type label (e.g. "Date", "String", "UInt64", "DateTime") */
20811
+ type: string;
20812
+ }
20813
+ export interface AnalyticsQueryResponse {
20814
+ meta: AnalyticsColumnMeta[];
20815
+ data: Array<Record<string, unknown>>;
20816
+ rows: number;
20817
+ rows_before_limit_at_least?: number;
20818
+ statistics?: {
20819
+ elapsed: number;
20820
+ rows_read?: number;
20821
+ bytes_read?: number;
20822
+ };
20823
+ }
20634
20824
  declare const promptScreenSchema: z.ZodEnum<[
20635
20825
  "login",
20636
20826
  "login-id",
@@ -21044,6 +21234,13 @@ export interface LogStreamsAdapter {
21044
21234
  update(tenant_id: string, id: string, params: Partial<LogStream>): Promise<boolean>;
21045
21235
  remove(tenant_id: string, id: string): Promise<boolean>;
21046
21236
  }
21237
+ export interface MigrationSourcesAdapter {
21238
+ create: (tenant_id: string, migration_source: MigrationSourceInsert) => Promise<MigrationSource>;
21239
+ get: (tenant_id: string, id: string) => Promise<MigrationSource | null>;
21240
+ list: (tenant_id: string) => Promise<MigrationSource[]>;
21241
+ remove: (tenant_id: string, id: string) => Promise<boolean>;
21242
+ update: (tenant_id: string, id: string, migration_source: Partial<MigrationSourceInsert>) => Promise<boolean>;
21243
+ }
21047
21244
  export interface ListConnectionsResponse extends Totals {
21048
21245
  connections: Connection[];
21049
21246
  }
@@ -21287,6 +21484,14 @@ export interface StatsAdapter {
21287
21484
  */
21288
21485
  getActiveUsers(tenantId: string): Promise<number>;
21289
21486
  }
21487
+ export interface AnalyticsAdapter {
21488
+ /**
21489
+ * Run an analytics query for a tenant. The adapter is responsible for
21490
+ * injecting the tenant_id predicate; the route handler never trusts a
21491
+ * tenant value from a client-controlled source.
21492
+ */
21493
+ query(tenantId: string, resource: AnalyticsResource, params: AnalyticsQueryParams): Promise<AnalyticsQueryResponse>;
21494
+ }
21290
21495
  export interface UniversalLoginTemplate {
21291
21496
  body: string;
21292
21497
  }
@@ -21458,6 +21663,12 @@ export interface DataAdapters {
21458
21663
  loginSessions: LoginSessionsAdapter;
21459
21664
  logs: LogsDataAdapter;
21460
21665
  logStreams?: LogStreamsAdapter;
21666
+ /**
21667
+ * Optional tenant-level migration sources for lazy refresh-token re-mint
21668
+ * against upstream IdPs (Auth0, Cognito, Okta, generic OIDC). When unset,
21669
+ * unrecognized refresh tokens fail with `invalid_grant` as usual.
21670
+ */
21671
+ migrationSources?: MigrationSourcesAdapter;
21461
21672
  passwords: PasswordsAdapter;
21462
21673
  promptSettings: PromptSettingsAdapter;
21463
21674
  refreshTokens: RefreshTokensAdapter;
@@ -21467,6 +21678,12 @@ export interface DataAdapters {
21467
21678
  roles: RolesAdapter;
21468
21679
  sessions: SessionsAdapter;
21469
21680
  stats?: StatsAdapter;
21681
+ /**
21682
+ * Optional richer analytics surface, exposed via `/api/v2/analytics/*`.
21683
+ * Returns ClickHouse-style `{ meta, data }` responses with filtering and
21684
+ * grouping. Unlike `stats`, this is not Auth0 wire-compatible.
21685
+ */
21686
+ analytics?: AnalyticsAdapter;
21470
21687
  tenants: TenantsDataAdapter;
21471
21688
  themes: ThemesAdapter;
21472
21689
  universalLoginTemplates: UniversalLoginTemplatesAdapter;
@@ -24336,6 +24553,17 @@ export interface Database {
24336
24553
  created_at: string;
24337
24554
  updated_at: string;
24338
24555
  };
24556
+ migration_sources: {
24557
+ id: string;
24558
+ tenant_id: string;
24559
+ name: string;
24560
+ provider: string;
24561
+ connection: string;
24562
+ enabled: number;
24563
+ credentials: string;
24564
+ created_at: string;
24565
+ updated_at: string;
24566
+ };
24339
24567
  outbox_events: {
24340
24568
  id: string;
24341
24569
  tenant_id: string;