authhero 5.0.0 → 5.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.
@@ -45453,6 +45453,156 @@ export declare const logStreamSchema: z.ZodObject<{
45453
45453
  isPriority?: boolean | undefined;
45454
45454
  }>;
45455
45455
  export type LogStream = z.infer<typeof logStreamSchema>;
45456
+ export declare const migrationProviderTypeSchema: z.ZodEnum<[
45457
+ "auth0",
45458
+ "cognito",
45459
+ "okta",
45460
+ "oidc"
45461
+ ]>;
45462
+ export type MigrationProviderType = z.infer<typeof migrationProviderTypeSchema>;
45463
+ export declare const migrationSourceCredentialsSchema: z.ZodObject<{
45464
+ domain: z.ZodString;
45465
+ client_id: z.ZodString;
45466
+ client_secret: z.ZodString;
45467
+ audience: z.ZodOptional<z.ZodString>;
45468
+ scope: z.ZodOptional<z.ZodString>;
45469
+ }, "strip", z.ZodTypeAny, {
45470
+ client_id: string;
45471
+ client_secret: string;
45472
+ domain: string;
45473
+ audience?: string | undefined;
45474
+ scope?: string | undefined;
45475
+ }, {
45476
+ client_id: string;
45477
+ client_secret: string;
45478
+ domain: string;
45479
+ audience?: string | undefined;
45480
+ scope?: string | undefined;
45481
+ }>;
45482
+ export type MigrationSourceCredentials = z.infer<typeof migrationSourceCredentialsSchema>;
45483
+ export declare const migrationSourceInsertSchema: z.ZodObject<{
45484
+ id: z.ZodOptional<z.ZodString>;
45485
+ name: z.ZodString;
45486
+ provider: z.ZodEnum<[
45487
+ "auth0",
45488
+ "cognito",
45489
+ "okta",
45490
+ "oidc"
45491
+ ]>;
45492
+ connection: z.ZodString;
45493
+ enabled: z.ZodDefault<z.ZodBoolean>;
45494
+ credentials: z.ZodObject<{
45495
+ domain: z.ZodString;
45496
+ client_id: z.ZodString;
45497
+ client_secret: z.ZodString;
45498
+ audience: z.ZodOptional<z.ZodString>;
45499
+ scope: z.ZodOptional<z.ZodString>;
45500
+ }, "strip", z.ZodTypeAny, {
45501
+ client_id: string;
45502
+ client_secret: string;
45503
+ domain: string;
45504
+ audience?: string | undefined;
45505
+ scope?: string | undefined;
45506
+ }, {
45507
+ client_id: string;
45508
+ client_secret: string;
45509
+ domain: string;
45510
+ audience?: string | undefined;
45511
+ scope?: string | undefined;
45512
+ }>;
45513
+ }, "strip", z.ZodTypeAny, {
45514
+ name: string;
45515
+ connection: string;
45516
+ provider: "auth0" | "cognito" | "okta" | "oidc";
45517
+ enabled: boolean;
45518
+ credentials: {
45519
+ client_id: string;
45520
+ client_secret: string;
45521
+ domain: string;
45522
+ audience?: string | undefined;
45523
+ scope?: string | undefined;
45524
+ };
45525
+ id?: string | undefined;
45526
+ }, {
45527
+ name: string;
45528
+ connection: string;
45529
+ provider: "auth0" | "cognito" | "okta" | "oidc";
45530
+ credentials: {
45531
+ client_id: string;
45532
+ client_secret: string;
45533
+ domain: string;
45534
+ audience?: string | undefined;
45535
+ scope?: string | undefined;
45536
+ };
45537
+ id?: string | undefined;
45538
+ enabled?: boolean | undefined;
45539
+ }>;
45540
+ export type MigrationSourceInsert = z.infer<typeof migrationSourceInsertSchema>;
45541
+ export declare const migrationSourceSchema: z.ZodObject<{
45542
+ created_at: z.ZodString;
45543
+ updated_at: z.ZodString;
45544
+ } & {
45545
+ id: z.ZodOptional<z.ZodString>;
45546
+ name: z.ZodString;
45547
+ provider: z.ZodEnum<[
45548
+ "auth0",
45549
+ "cognito",
45550
+ "okta",
45551
+ "oidc"
45552
+ ]>;
45553
+ connection: z.ZodString;
45554
+ enabled: z.ZodDefault<z.ZodBoolean>;
45555
+ credentials: z.ZodObject<{
45556
+ domain: z.ZodString;
45557
+ client_id: z.ZodString;
45558
+ client_secret: z.ZodString;
45559
+ audience: z.ZodOptional<z.ZodString>;
45560
+ scope: z.ZodOptional<z.ZodString>;
45561
+ }, "strip", z.ZodTypeAny, {
45562
+ client_id: string;
45563
+ client_secret: string;
45564
+ domain: string;
45565
+ audience?: string | undefined;
45566
+ scope?: string | undefined;
45567
+ }, {
45568
+ client_id: string;
45569
+ client_secret: string;
45570
+ domain: string;
45571
+ audience?: string | undefined;
45572
+ scope?: string | undefined;
45573
+ }>;
45574
+ }, "strip", z.ZodTypeAny, {
45575
+ created_at: string;
45576
+ updated_at: string;
45577
+ name: string;
45578
+ connection: string;
45579
+ provider: "auth0" | "cognito" | "okta" | "oidc";
45580
+ enabled: boolean;
45581
+ credentials: {
45582
+ client_id: string;
45583
+ client_secret: string;
45584
+ domain: string;
45585
+ audience?: string | undefined;
45586
+ scope?: string | undefined;
45587
+ };
45588
+ id?: string | undefined;
45589
+ }, {
45590
+ created_at: string;
45591
+ updated_at: string;
45592
+ name: string;
45593
+ connection: string;
45594
+ provider: "auth0" | "cognito" | "okta" | "oidc";
45595
+ credentials: {
45596
+ client_id: string;
45597
+ client_secret: string;
45598
+ domain: string;
45599
+ audience?: string | undefined;
45600
+ scope?: string | undefined;
45601
+ };
45602
+ id?: string | undefined;
45603
+ enabled?: boolean | undefined;
45604
+ }>;
45605
+ export type MigrationSource = z.infer<typeof migrationSourceSchema>;
45456
45606
  export declare const breachedPasswordDetectionSchema: z.ZodObject<{
45457
45607
  enabled: z.ZodOptional<z.ZodBoolean>;
45458
45608
  shields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -51130,6 +51280,150 @@ export declare const dailyStatsSchema: z.ZodObject<{
51130
51280
  export type DailyStats = z.infer<typeof dailyStatsSchema>;
51131
51281
  export declare const activeUsersResponseSchema: z.ZodNumber;
51132
51282
  export type ActiveUsersResponse = z.infer<typeof activeUsersResponseSchema>;
51283
+ export declare const analyticsResourceSchema: z.ZodEnum<[
51284
+ "active-users",
51285
+ "logins",
51286
+ "signups",
51287
+ "refresh-tokens",
51288
+ "sessions"
51289
+ ]>;
51290
+ export type AnalyticsResource = z.infer<typeof analyticsResourceSchema>;
51291
+ export declare const analyticsIntervalSchema: z.ZodEnum<[
51292
+ "hour",
51293
+ "day",
51294
+ "week",
51295
+ "month"
51296
+ ]>;
51297
+ export type AnalyticsInterval = z.infer<typeof analyticsIntervalSchema>;
51298
+ export declare const analyticsGroupBySchema: z.ZodEnum<[
51299
+ "time",
51300
+ "connection",
51301
+ "client_id",
51302
+ "user_type",
51303
+ "event"
51304
+ ]>;
51305
+ export type AnalyticsGroupBy = z.infer<typeof analyticsGroupBySchema>;
51306
+ export declare const analyticsUserTypeSchema: z.ZodEnum<[
51307
+ "password",
51308
+ "social",
51309
+ "passwordless",
51310
+ "enterprise"
51311
+ ]>;
51312
+ export type AnalyticsUserType = z.infer<typeof analyticsUserTypeSchema>;
51313
+ export interface AnalyticsFilters {
51314
+ connection?: string[];
51315
+ client_id?: string[];
51316
+ user_type?: AnalyticsUserType[];
51317
+ user_id?: string[];
51318
+ }
51319
+ export interface AnalyticsQueryParams {
51320
+ /** Inclusive lower bound, ISO 8601 datetime in UTC */
51321
+ from: string;
51322
+ /** Exclusive upper bound, ISO 8601 datetime in UTC */
51323
+ to: string;
51324
+ interval: AnalyticsInterval;
51325
+ /** IANA timezone for bucket boundaries */
51326
+ tz: string;
51327
+ filters: AnalyticsFilters;
51328
+ group_by: AnalyticsGroupBy[];
51329
+ limit: number;
51330
+ offset: number;
51331
+ /** Column name, prefix with `-` for descending */
51332
+ order_by?: string;
51333
+ }
51334
+ export interface AnalyticsColumnMeta {
51335
+ name: string;
51336
+ /** ClickHouse-style type label (e.g. "Date", "String", "UInt64", "DateTime") */
51337
+ type: string;
51338
+ }
51339
+ export interface AnalyticsQueryResponse {
51340
+ meta: AnalyticsColumnMeta[];
51341
+ data: Array<Record<string, unknown>>;
51342
+ rows: number;
51343
+ rows_before_limit_at_least?: number;
51344
+ statistics?: {
51345
+ elapsed: number;
51346
+ rows_read?: number;
51347
+ bytes_read?: number;
51348
+ };
51349
+ }
51350
+ export declare const analyticsColumnMetaSchema: z.ZodObject<{
51351
+ name: z.ZodString;
51352
+ type: z.ZodString;
51353
+ }, "strip", z.ZodTypeAny, {
51354
+ type: string;
51355
+ name: string;
51356
+ }, {
51357
+ type: string;
51358
+ name: string;
51359
+ }>;
51360
+ export declare const analyticsStatisticsSchema: z.ZodObject<{
51361
+ elapsed: z.ZodNumber;
51362
+ rows_read: z.ZodOptional<z.ZodNumber>;
51363
+ bytes_read: z.ZodOptional<z.ZodNumber>;
51364
+ }, "strip", z.ZodTypeAny, {
51365
+ elapsed: number;
51366
+ rows_read?: number | undefined;
51367
+ bytes_read?: number | undefined;
51368
+ }, {
51369
+ elapsed: number;
51370
+ rows_read?: number | undefined;
51371
+ bytes_read?: number | undefined;
51372
+ }>;
51373
+ export declare const analyticsQueryResponseSchema: z.ZodObject<{
51374
+ meta: z.ZodArray<z.ZodObject<{
51375
+ name: z.ZodString;
51376
+ type: z.ZodString;
51377
+ }, "strip", z.ZodTypeAny, {
51378
+ type: string;
51379
+ name: string;
51380
+ }, {
51381
+ type: string;
51382
+ name: string;
51383
+ }>, "many">;
51384
+ data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>, "many">;
51385
+ rows: z.ZodNumber;
51386
+ rows_before_limit_at_least: z.ZodOptional<z.ZodNumber>;
51387
+ statistics: z.ZodOptional<z.ZodObject<{
51388
+ elapsed: z.ZodNumber;
51389
+ rows_read: z.ZodOptional<z.ZodNumber>;
51390
+ bytes_read: z.ZodOptional<z.ZodNumber>;
51391
+ }, "strip", z.ZodTypeAny, {
51392
+ elapsed: number;
51393
+ rows_read?: number | undefined;
51394
+ bytes_read?: number | undefined;
51395
+ }, {
51396
+ elapsed: number;
51397
+ rows_read?: number | undefined;
51398
+ bytes_read?: number | undefined;
51399
+ }>>;
51400
+ }, "strip", z.ZodTypeAny, {
51401
+ meta: {
51402
+ type: string;
51403
+ name: string;
51404
+ }[];
51405
+ data: Record<string, any>[];
51406
+ rows: number;
51407
+ rows_before_limit_at_least?: number | undefined;
51408
+ statistics?: {
51409
+ elapsed: number;
51410
+ rows_read?: number | undefined;
51411
+ bytes_read?: number | undefined;
51412
+ } | undefined;
51413
+ }, {
51414
+ meta: {
51415
+ type: string;
51416
+ name: string;
51417
+ }[];
51418
+ data: Record<string, any>[];
51419
+ rows: number;
51420
+ rows_before_limit_at_least?: number | undefined;
51421
+ statistics?: {
51422
+ elapsed: number;
51423
+ rows_read?: number | undefined;
51424
+ bytes_read?: number | undefined;
51425
+ } | undefined;
51426
+ }>;
51133
51427
  /**
51134
51428
  * Available prompt screens that can be customized
51135
51429
  * Based on Auth0's prompt customization options
@@ -51772,6 +52066,13 @@ export interface LogStreamsAdapter {
51772
52066
  update(tenant_id: string, id: string, params: Partial<LogStream>): Promise<boolean>;
51773
52067
  remove(tenant_id: string, id: string): Promise<boolean>;
51774
52068
  }
52069
+ export interface MigrationSourcesAdapter {
52070
+ create: (tenant_id: string, migration_source: MigrationSourceInsert) => Promise<MigrationSource>;
52071
+ get: (tenant_id: string, id: string) => Promise<MigrationSource | null>;
52072
+ list: (tenant_id: string) => Promise<MigrationSource[]>;
52073
+ remove: (tenant_id: string, id: string) => Promise<boolean>;
52074
+ update: (tenant_id: string, id: string, migration_source: Partial<MigrationSourceInsert>) => Promise<boolean>;
52075
+ }
51775
52076
  export interface ListConnectionsResponse extends Totals {
51776
52077
  connections: Connection[];
51777
52078
  }
@@ -52021,6 +52322,14 @@ export interface StatsAdapter {
52021
52322
  */
52022
52323
  getActiveUsers(tenantId: string): Promise<number>;
52023
52324
  }
52325
+ export interface AnalyticsAdapter {
52326
+ /**
52327
+ * Run an analytics query for a tenant. The adapter is responsible for
52328
+ * injecting the tenant_id predicate; the route handler never trusts a
52329
+ * tenant value from a client-controlled source.
52330
+ */
52331
+ query(tenantId: string, resource: AnalyticsResource, params: AnalyticsQueryParams): Promise<AnalyticsQueryResponse>;
52332
+ }
52024
52333
  export interface UniversalLoginTemplate {
52025
52334
  body: string;
52026
52335
  }
@@ -52239,6 +52548,12 @@ export interface DataAdapters {
52239
52548
  loginSessions: LoginSessionsAdapter;
52240
52549
  logs: LogsDataAdapter;
52241
52550
  logStreams?: LogStreamsAdapter;
52551
+ /**
52552
+ * Optional tenant-level migration sources for lazy refresh-token re-mint
52553
+ * against upstream IdPs (Auth0, Cognito, Okta, generic OIDC). When unset,
52554
+ * unrecognized refresh tokens fail with `invalid_grant` as usual.
52555
+ */
52556
+ migrationSources?: MigrationSourcesAdapter;
52242
52557
  passwords: PasswordsAdapter;
52243
52558
  promptSettings: PromptSettingsAdapter;
52244
52559
  refreshTokens: RefreshTokensAdapter;
@@ -52248,6 +52563,12 @@ export interface DataAdapters {
52248
52563
  roles: RolesAdapter;
52249
52564
  sessions: SessionsAdapter;
52250
52565
  stats?: StatsAdapter;
52566
+ /**
52567
+ * Optional richer analytics surface, exposed via `/api/v2/analytics/*`.
52568
+ * Returns ClickHouse-style `{ meta, data }` responses with filtering and
52569
+ * grouping. Unlike `stats`, this is not Auth0 wire-compatible.
52570
+ */
52571
+ analytics?: AnalyticsAdapter;
52251
52572
  tenants: TenantsDataAdapter;
52252
52573
  themes: ThemesAdapter;
52253
52574
  universalLoginTemplates: UniversalLoginTemplatesAdapter;
@@ -56905,7 +57226,7 @@ export declare function init(config: AuthHeroConfig): {
56905
57226
  status: 200;
56906
57227
  };
56907
57228
  };
56908
- }, "/guardian"> & import("hono/types").MergeSchemaPath<{
57229
+ }, "/guardian"> & import("hono/types").MergeSchemaPath<{}, "/analytics"> & import("hono/types").MergeSchemaPath<{
56909
57230
  "/daily": {
56910
57231
  $get: {
56911
57232
  input: {
@@ -64842,6 +65163,173 @@ export declare function init(config: AuthHeroConfig): {
64842
65163
  };
64843
65164
  };
64844
65165
  }, "/attack-protection"> & import("hono/types").MergeSchemaPath<{
65166
+ "/": {
65167
+ $get: {
65168
+ input: {
65169
+ header: {
65170
+ "tenant-id"?: string | undefined;
65171
+ };
65172
+ };
65173
+ output: {
65174
+ name: string;
65175
+ created_at: string;
65176
+ updated_at: string;
65177
+ connection: string;
65178
+ credentials: {
65179
+ client_id: string;
65180
+ client_secret: string;
65181
+ domain: string;
65182
+ scope?: string | undefined;
65183
+ audience?: string | undefined;
65184
+ };
65185
+ provider: "auth0" | "oidc" | "cognito" | "okta";
65186
+ enabled: boolean;
65187
+ id?: string | undefined;
65188
+ }[];
65189
+ outputFormat: "json";
65190
+ status: 200;
65191
+ };
65192
+ };
65193
+ } & {
65194
+ "/:id": {
65195
+ $get: {
65196
+ input: {
65197
+ param: {
65198
+ id: string;
65199
+ };
65200
+ } & {
65201
+ header: {
65202
+ "tenant-id"?: string | undefined;
65203
+ };
65204
+ };
65205
+ output: {
65206
+ name: string;
65207
+ created_at: string;
65208
+ updated_at: string;
65209
+ connection: string;
65210
+ credentials: {
65211
+ client_id: string;
65212
+ client_secret: string;
65213
+ domain: string;
65214
+ scope?: string | undefined;
65215
+ audience?: string | undefined;
65216
+ };
65217
+ provider: "auth0" | "oidc" | "cognito" | "okta";
65218
+ enabled: boolean;
65219
+ id?: string | undefined;
65220
+ };
65221
+ outputFormat: "json";
65222
+ status: 200;
65223
+ };
65224
+ };
65225
+ } & {
65226
+ "/": {
65227
+ $post: {
65228
+ input: {
65229
+ header: {
65230
+ "tenant-id"?: string | undefined;
65231
+ };
65232
+ } & {
65233
+ json: {
65234
+ name: string;
65235
+ connection: string;
65236
+ credentials: {
65237
+ client_id: string;
65238
+ client_secret: string;
65239
+ domain: string;
65240
+ audience?: string | undefined;
65241
+ scope?: string | undefined;
65242
+ };
65243
+ provider: "auth0" | "oidc" | "cognito" | "okta";
65244
+ id?: string | undefined;
65245
+ enabled?: boolean | undefined;
65246
+ };
65247
+ };
65248
+ output: {
65249
+ name: string;
65250
+ created_at: string;
65251
+ updated_at: string;
65252
+ connection: string;
65253
+ credentials: {
65254
+ client_id: string;
65255
+ client_secret: string;
65256
+ domain: string;
65257
+ scope?: string | undefined;
65258
+ audience?: string | undefined;
65259
+ };
65260
+ provider: "auth0" | "oidc" | "cognito" | "okta";
65261
+ enabled: boolean;
65262
+ id?: string | undefined;
65263
+ };
65264
+ outputFormat: "json";
65265
+ status: 201;
65266
+ };
65267
+ };
65268
+ } & {
65269
+ "/:id": {
65270
+ $patch: {
65271
+ input: {
65272
+ param: {
65273
+ id: string;
65274
+ };
65275
+ } & {
65276
+ header: {
65277
+ "tenant-id"?: string | undefined;
65278
+ };
65279
+ } & {
65280
+ json: {
65281
+ name?: string | undefined;
65282
+ connection?: string | undefined;
65283
+ credentials?: {
65284
+ client_id: string;
65285
+ client_secret: string;
65286
+ domain: string;
65287
+ audience?: string | undefined;
65288
+ scope?: string | undefined;
65289
+ } | undefined;
65290
+ id?: string | undefined;
65291
+ provider?: "auth0" | "oidc" | "cognito" | "okta" | undefined;
65292
+ enabled?: boolean | undefined;
65293
+ };
65294
+ };
65295
+ output: {
65296
+ name: string;
65297
+ created_at: string;
65298
+ updated_at: string;
65299
+ connection: string;
65300
+ credentials: {
65301
+ client_id: string;
65302
+ client_secret: string;
65303
+ domain: string;
65304
+ scope?: string | undefined;
65305
+ audience?: string | undefined;
65306
+ };
65307
+ provider: "auth0" | "oidc" | "cognito" | "okta";
65308
+ enabled: boolean;
65309
+ id?: string | undefined;
65310
+ };
65311
+ outputFormat: "json";
65312
+ status: 200;
65313
+ };
65314
+ };
65315
+ } & {
65316
+ "/:id": {
65317
+ $delete: {
65318
+ input: {
65319
+ param: {
65320
+ id: string;
65321
+ };
65322
+ } & {
65323
+ header: {
65324
+ "tenant-id"?: string | undefined;
65325
+ };
65326
+ };
65327
+ output: {};
65328
+ outputFormat: string;
65329
+ status: 204;
65330
+ };
65331
+ };
65332
+ }, "/migration-sources"> & import("hono/types").MergeSchemaPath<{
64845
65333
  "/": {
64846
65334
  $get: {
64847
65335
  input: {