@logto/schemas 1.40.1 → 1.42.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.
Files changed (111) hide show
  1. package/alterations/1.41.0-1779864280-add-password-expiration-policy.ts +23 -0
  2. package/alterations/1.41.0-1779864281-add-is-password-expired-to-users.ts +18 -0
  3. package/alterations/1.41.0-1780358400-drop-oidc-model-instances-legacy-grant-id-index.ts +25 -0
  4. package/alterations/1.41.0-1780381219-add-username-policy.ts +41 -0
  5. package/alterations/1.41.0-1780643665-set-sign-up-profile-fields-default.ts +20 -0
  6. package/alterations/1.41.0-1780906060-add-verification-code-policy.ts +19 -0
  7. package/alterations/1.41.0-1781689400-add-sentinel-activities-created-at-index.ts +25 -0
  8. package/alterations/1.41.0-1782354362-set-admin-account-center-profile-fields.ts +28 -0
  9. package/alterations/1.41.0-1782375106-cover-service-logs-tenant-type-index-with-created-at.ts +36 -0
  10. package/alterations/1.42.0-1783916980-add-domain-verification-files.ts +20 -0
  11. package/alterations/1.42.0-1784619793-add-service-logs-created-at-index.ts +33 -0
  12. package/alterations/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.ts +38 -0
  13. package/alterations/utils/1704934999-tables.ts +22 -1
  14. package/alterations-js/1.41.0-1779864280-add-password-expiration-policy.js +19 -0
  15. package/alterations-js/1.41.0-1779864281-add-is-password-expired-to-users.js +14 -0
  16. package/alterations-js/1.41.0-1780358400-drop-oidc-model-instances-legacy-grant-id-index.js +21 -0
  17. package/alterations-js/1.41.0-1780381219-add-username-policy.js +37 -0
  18. package/alterations-js/1.41.0-1780643665-set-sign-up-profile-fields-default.js +16 -0
  19. package/alterations-js/1.41.0-1780906060-add-verification-code-policy.js +15 -0
  20. package/alterations-js/1.41.0-1781689400-add-sentinel-activities-created-at-index.js +21 -0
  21. package/alterations-js/1.41.0-1782354362-set-admin-account-center-profile-fields.js +23 -0
  22. package/alterations-js/1.41.0-1782375106-cover-service-logs-tenant-type-index-with-created-at.js +32 -0
  23. package/alterations-js/1.42.0-1783916980-add-domain-verification-files.js +16 -0
  24. package/alterations-js/1.42.0-1784619793-add-service-logs-created-at-index.js +29 -0
  25. package/alterations-js/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.js +33 -0
  26. package/alterations-js/utils/1704934999-tables.js +19 -1
  27. package/lib/consts/experience.d.ts +3 -0
  28. package/lib/consts/experience.js +3 -0
  29. package/lib/consts/index.d.ts +2 -0
  30. package/lib/consts/index.js +2 -0
  31. package/lib/consts/message-rate-limit.d.ts +65 -0
  32. package/lib/consts/message-rate-limit.js +29 -0
  33. package/lib/consts/message-rate-limit.test.d.ts +1 -0
  34. package/lib/consts/message-rate-limit.test.js +20 -0
  35. package/lib/consts/verification-code.d.ts +10 -0
  36. package/lib/consts/verification-code.js +10 -0
  37. package/lib/db-entries/domain.d.ts +4 -2
  38. package/lib/db-entries/domain.js +5 -1
  39. package/lib/db-entries/index.d.ts +1 -0
  40. package/lib/db-entries/index.js +1 -0
  41. package/lib/db-entries/saml-sso-connector-signing-key.d.ts +32 -0
  42. package/lib/db-entries/saml-sso-connector-signing-key.js +49 -0
  43. package/lib/db-entries/sign-in-experience.d.ts +10 -4
  44. package/lib/db-entries/sign-in-experience.js +13 -1
  45. package/lib/db-entries/user.d.ts +5 -1
  46. package/lib/db-entries/user.js +8 -0
  47. package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
  48. package/lib/foundations/jsonb-types/account-centers.js +1 -0
  49. package/lib/foundations/jsonb-types/custom-domain.d.ts +57 -0
  50. package/lib/foundations/jsonb-types/custom-domain.js +51 -0
  51. package/lib/foundations/jsonb-types/custom-domain.test.d.ts +1 -0
  52. package/lib/foundations/jsonb-types/custom-domain.test.js +38 -0
  53. package/lib/foundations/jsonb-types/hooks.d.ts +4 -4
  54. package/lib/foundations/jsonb-types/hooks.js +2 -0
  55. package/lib/foundations/jsonb-types/one-time-tokens.d.ts +5 -0
  56. package/lib/foundations/jsonb-types/one-time-tokens.js +2 -0
  57. package/lib/foundations/jsonb-types/sentinel.d.ts +16 -1
  58. package/lib/foundations/jsonb-types/sentinel.js +15 -0
  59. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +90 -3
  60. package/lib/foundations/jsonb-types/sign-in-experience.js +20 -0
  61. package/lib/foundations/jsonb-types/sign-in-experience.test.js +49 -1
  62. package/lib/foundations/jsonb-types/users.d.ts +9 -0
  63. package/lib/foundations/jsonb-types/users.js +1 -0
  64. package/lib/seeds/account-center.js +1 -0
  65. package/lib/seeds/sign-in-experience.js +1 -0
  66. package/lib/seeds/sign-in-experience.test.js +5 -1
  67. package/lib/types/application.d.ts +131 -1
  68. package/lib/types/application.js +8 -0
  69. package/lib/types/consent.d.ts +8 -0
  70. package/lib/types/custom-profile-fields.d.ts +5 -1
  71. package/lib/types/domain.d.ts +9 -0
  72. package/lib/types/hook.d.ts +9 -2
  73. package/lib/types/interaction-event.d.ts +11 -0
  74. package/lib/types/interaction-event.js +12 -0
  75. package/lib/types/interactions.d.ts +2 -11
  76. package/lib/types/interactions.js +5 -12
  77. package/lib/types/log/action.d.ts +7 -0
  78. package/lib/types/log/action.js +6 -0
  79. package/lib/types/log/index.d.ts +5 -2
  80. package/lib/types/log/index.js +1 -0
  81. package/lib/types/logto-config/action.d.ts +963 -0
  82. package/lib/types/logto-config/action.js +77 -0
  83. package/lib/types/logto-config/index.d.ts +91 -13
  84. package/lib/types/logto-config/index.js +12 -0
  85. package/lib/types/logto-config/index.test.js +25 -1
  86. package/lib/types/logto-config/jwt-customizer.d.ts +162 -1
  87. package/lib/types/logto-config/jwt-customizer.js +14 -0
  88. package/lib/types/organization.d.ts +136 -1
  89. package/lib/types/organization.js +3 -2
  90. package/lib/types/saml-application.d.ts +3 -0
  91. package/lib/types/saml-application.js +3 -0
  92. package/lib/types/sign-in-experience.d.ts +11 -4
  93. package/lib/types/sign-in-experience.js +1 -1
  94. package/lib/types/sso-connector.d.ts +58 -0
  95. package/lib/types/sso-connector.js +12 -0
  96. package/lib/types/ssr.d.ts +11 -0
  97. package/lib/types/user-assets.d.ts +10 -0
  98. package/lib/types/user-assets.js +17 -0
  99. package/lib/types/user-sessions.d.ts +309 -34
  100. package/lib/types/user-sessions.js +5 -0
  101. package/lib/types/user.d.ts +15 -0
  102. package/lib/types/user.js +1 -0
  103. package/lib/types/verification-records/one-time-token-verification.d.ts +5 -0
  104. package/package.json +8 -8
  105. package/tables/domains.sql +1 -0
  106. package/tables/oidc_model_instances.sql +0 -8
  107. package/tables/saml_sso_connector_signing_keys.sql +21 -0
  108. package/tables/sentinel_activities.sql +4 -0
  109. package/tables/service_logs.sql +7 -2
  110. package/tables/sign_in_experiences.sql +15 -2
  111. package/tables/users.sql +7 -0
@@ -106,6 +106,7 @@ export declare const jwtCustomizerUserContextGuard: z.ZodObject<Pick<{
106
106
  id: string;
107
107
  key: string;
108
108
  createdAt: string;
109
+ lastUsedTimeStep?: number | undefined;
109
110
  lastUsedAt?: string | undefined;
110
111
  } | {
111
112
  type: import("../../foundations/index.js").MfaFactor.WebAuthn;
@@ -133,6 +134,7 @@ export declare const jwtCustomizerUserContextGuard: z.ZodObject<Pick<{
133
134
  id: string;
134
135
  key: string;
135
136
  createdAt: string;
137
+ lastUsedTimeStep?: number | undefined;
136
138
  lastUsedAt?: string | undefined;
137
139
  } | {
138
140
  type: import("../../foundations/index.js").MfaFactor.WebAuthn;
@@ -157,7 +159,9 @@ export declare const jwtCustomizerUserContextGuard: z.ZodObject<Pick<{
157
159
  lastUsedAt?: string | undefined;
158
160
  })[]>;
159
161
  isSuspended: ZodType<boolean, z.ZodTypeDef, boolean>;
162
+ isPasswordExpired: ZodType<boolean, z.ZodTypeDef, boolean>;
160
163
  lastSignInAt: ZodType<number | null, z.ZodTypeDef, number | null>;
164
+ passwordUpdatedAt: ZodType<number | null, z.ZodTypeDef, number | null>;
161
165
  createdAt: ZodType<number, z.ZodTypeDef, number>;
162
166
  updatedAt: ZodType<number, z.ZodTypeDef, number>;
163
167
  }, "name" | "id" | "applicationId" | "username" | "createdAt" | "profile" | "avatar" | "customData" | "identities" | "updatedAt" | "lastSignInAt" | "primaryEmail" | "primaryPhone" | "isSuspended"> & {
@@ -863,10 +867,13 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
863
867
  }>;
864
868
  oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
865
869
  jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
870
+ interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
866
871
  }, "strip", z.ZodTypeAny, {
867
872
  jitOrganizationIds?: string[] | undefined;
873
+ interactionEvent?: InteractionEvent | undefined;
868
874
  }, {
869
875
  jitOrganizationIds?: string[] | undefined;
876
+ interactionEvent?: InteractionEvent | undefined;
870
877
  }>>;
871
878
  }, "strip", z.ZodTypeAny, {
872
879
  type: VerificationType.OneTimeToken;
@@ -878,6 +885,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
878
885
  verified: boolean;
879
886
  oneTimeTokenContext?: {
880
887
  jitOrganizationIds?: string[] | undefined;
888
+ interactionEvent?: InteractionEvent | undefined;
881
889
  } | undefined;
882
890
  }, {
883
891
  type: VerificationType.OneTimeToken;
@@ -889,6 +897,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
889
897
  verified: boolean;
890
898
  oneTimeTokenContext?: {
891
899
  jitOrganizationIds?: string[] | undefined;
900
+ interactionEvent?: InteractionEvent | undefined;
892
901
  } | undefined;
893
902
  }>, z.ZodObject<Omit<{
894
903
  id: z.ZodString;
@@ -982,6 +991,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
982
991
  verified: boolean;
983
992
  oneTimeTokenContext?: {
984
993
  jitOrganizationIds?: string[] | undefined;
994
+ interactionEvent?: InteractionEvent | undefined;
985
995
  } | undefined;
986
996
  } | {
987
997
  type: VerificationType.Password;
@@ -1096,6 +1106,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
1096
1106
  verified: boolean;
1097
1107
  oneTimeTokenContext?: {
1098
1108
  jitOrganizationIds?: string[] | undefined;
1109
+ interactionEvent?: InteractionEvent | undefined;
1099
1110
  } | undefined;
1100
1111
  } | {
1101
1112
  type: VerificationType.Password;
@@ -1273,6 +1284,54 @@ export declare const jwtCustomizerApplicationContextGuard: z.ZodObject<Omit<{
1273
1284
  isThirdParty: boolean;
1274
1285
  appLevelAccessControlEnabled: boolean;
1275
1286
  }>;
1287
+ /**
1288
+ * The target organization context for organization (API resource) access tokens.
1289
+ *
1290
+ * Only populated when the token is being issued for a specific organization (i.e. the
1291
+ * `organization_id` request parameter is present), letting the customizer attach per-org
1292
+ * claims without embedding every organization the user belongs to.
1293
+ */
1294
+ export declare const jwtCustomizerOrganizationContextGuard: z.ZodObject<Pick<{
1295
+ tenantId: ZodType<string, z.ZodTypeDef, string>;
1296
+ id: ZodType<string, z.ZodTypeDef, string>;
1297
+ name: ZodType<string, z.ZodTypeDef, string>;
1298
+ description: ZodType<string | null, z.ZodTypeDef, string | null>;
1299
+ customData: ZodType<import("@withtyped/server/lib/types.js").JsonObject, z.ZodTypeDef, import("@withtyped/server/lib/types.js").JsonObject>;
1300
+ isMfaRequired: ZodType<boolean, z.ZodTypeDef, boolean>;
1301
+ color: ZodType<Partial<{
1302
+ primaryColor: string;
1303
+ isDarkModeEnabled: boolean;
1304
+ darkPrimaryColor: string;
1305
+ }>, z.ZodTypeDef, Partial<{
1306
+ primaryColor: string;
1307
+ isDarkModeEnabled: boolean;
1308
+ darkPrimaryColor: string;
1309
+ }>>;
1310
+ branding: ZodType<{
1311
+ logoUrl?: string | undefined;
1312
+ darkLogoUrl?: string | undefined;
1313
+ favicon?: string | undefined;
1314
+ darkFavicon?: string | undefined;
1315
+ }, z.ZodTypeDef, {
1316
+ logoUrl?: string | undefined;
1317
+ darkLogoUrl?: string | undefined;
1318
+ favicon?: string | undefined;
1319
+ darkFavicon?: string | undefined;
1320
+ }>;
1321
+ customCss: ZodType<string | null, z.ZodTypeDef, string | null>;
1322
+ createdAt: ZodType<number, z.ZodTypeDef, number>;
1323
+ }, "name" | "id" | "customData" | "description">, "strip", z.ZodTypeAny, {
1324
+ name: string;
1325
+ id: string;
1326
+ customData: import("@withtyped/server/lib/types.js").JsonObject;
1327
+ description: string | null;
1328
+ }, {
1329
+ name: string;
1330
+ id: string;
1331
+ customData: import("@withtyped/server/lib/types.js").JsonObject;
1332
+ description: string | null;
1333
+ }>;
1334
+ export type JwtCustomizerOrganizationContext = z.infer<typeof jwtCustomizerOrganizationContextGuard>;
1276
1335
  export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
1277
1336
  script: z.ZodString;
1278
1337
  environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -2124,10 +2183,13 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2124
2183
  }>;
2125
2184
  oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
2126
2185
  jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2186
+ interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
2127
2187
  }, "strip", z.ZodTypeAny, {
2128
2188
  jitOrganizationIds?: string[] | undefined;
2189
+ interactionEvent?: InteractionEvent | undefined;
2129
2190
  }, {
2130
2191
  jitOrganizationIds?: string[] | undefined;
2192
+ interactionEvent?: InteractionEvent | undefined;
2131
2193
  }>>;
2132
2194
  }, "strip", z.ZodTypeAny, {
2133
2195
  type: VerificationType.OneTimeToken;
@@ -2139,6 +2201,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2139
2201
  verified: boolean;
2140
2202
  oneTimeTokenContext?: {
2141
2203
  jitOrganizationIds?: string[] | undefined;
2204
+ interactionEvent?: InteractionEvent | undefined;
2142
2205
  } | undefined;
2143
2206
  }, {
2144
2207
  type: VerificationType.OneTimeToken;
@@ -2150,6 +2213,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2150
2213
  verified: boolean;
2151
2214
  oneTimeTokenContext?: {
2152
2215
  jitOrganizationIds?: string[] | undefined;
2216
+ interactionEvent?: InteractionEvent | undefined;
2153
2217
  } | undefined;
2154
2218
  }>, z.ZodObject<Omit<{
2155
2219
  id: z.ZodString;
@@ -2243,6 +2307,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2243
2307
  verified: boolean;
2244
2308
  oneTimeTokenContext?: {
2245
2309
  jitOrganizationIds?: string[] | undefined;
2310
+ interactionEvent?: InteractionEvent | undefined;
2246
2311
  } | undefined;
2247
2312
  } | {
2248
2313
  type: VerificationType.Password;
@@ -2357,6 +2422,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2357
2422
  verified: boolean;
2358
2423
  oneTimeTokenContext?: {
2359
2424
  jitOrganizationIds?: string[] | undefined;
2425
+ interactionEvent?: InteractionEvent | undefined;
2360
2426
  } | undefined;
2361
2427
  } | {
2362
2428
  type: VerificationType.Password;
@@ -2611,6 +2677,22 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2611
2677
  isThirdParty?: boolean | undefined;
2612
2678
  appLevelAccessControlEnabled?: boolean | undefined;
2613
2679
  }>>;
2680
+ organization: z.ZodOptional<z.ZodObject<{
2681
+ name: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
2682
+ id: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
2683
+ customData: z.ZodOptional<ZodType<import("@withtyped/server/lib/types.js").JsonObject, z.ZodTypeDef, import("@withtyped/server/lib/types.js").JsonObject>>;
2684
+ description: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
2685
+ }, "strip", z.ZodTypeAny, {
2686
+ name?: string | undefined;
2687
+ id?: string | undefined;
2688
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
2689
+ description?: string | null | undefined;
2690
+ }, {
2691
+ name?: string | undefined;
2692
+ id?: string | undefined;
2693
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
2694
+ description?: string | null | undefined;
2695
+ }>>;
2614
2696
  }, "strip", z.ZodTypeAny, {
2615
2697
  user: {
2616
2698
  name?: string | null | undefined;
@@ -2734,6 +2816,12 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2734
2816
  isThirdParty?: boolean | undefined;
2735
2817
  appLevelAccessControlEnabled?: boolean | undefined;
2736
2818
  } | undefined;
2819
+ organization?: {
2820
+ name?: string | undefined;
2821
+ id?: string | undefined;
2822
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
2823
+ description?: string | null | undefined;
2824
+ } | undefined;
2737
2825
  grant?: {
2738
2826
  type?: GrantType.TokenExchange | undefined;
2739
2827
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -2799,6 +2887,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2799
2887
  verified: boolean;
2800
2888
  oneTimeTokenContext?: {
2801
2889
  jitOrganizationIds?: string[] | undefined;
2890
+ interactionEvent?: InteractionEvent | undefined;
2802
2891
  } | undefined;
2803
2892
  } | {
2804
2893
  type: VerificationType.Password;
@@ -2976,6 +3065,12 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
2976
3065
  isThirdParty?: boolean | undefined;
2977
3066
  appLevelAccessControlEnabled?: boolean | undefined;
2978
3067
  } | undefined;
3068
+ organization?: {
3069
+ name?: string | undefined;
3070
+ id?: string | undefined;
3071
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
3072
+ description?: string | null | undefined;
3073
+ } | undefined;
2979
3074
  grant?: {
2980
3075
  type?: GrantType.TokenExchange | undefined;
2981
3076
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -3041,6 +3136,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
3041
3136
  verified: boolean;
3042
3137
  oneTimeTokenContext?: {
3043
3138
  jitOrganizationIds?: string[] | undefined;
3139
+ interactionEvent?: InteractionEvent | undefined;
3044
3140
  } | undefined;
3045
3141
  } | {
3046
3142
  type: VerificationType.Password;
@@ -3222,6 +3318,12 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
3222
3318
  isThirdParty?: boolean | undefined;
3223
3319
  appLevelAccessControlEnabled?: boolean | undefined;
3224
3320
  } | undefined;
3321
+ organization?: {
3322
+ name?: string | undefined;
3323
+ id?: string | undefined;
3324
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
3325
+ description?: string | null | undefined;
3326
+ } | undefined;
3225
3327
  grant?: {
3226
3328
  type?: GrantType.TokenExchange | undefined;
3227
3329
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -3287,6 +3389,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
3287
3389
  verified: boolean;
3288
3390
  oneTimeTokenContext?: {
3289
3391
  jitOrganizationIds?: string[] | undefined;
3392
+ interactionEvent?: InteractionEvent | undefined;
3290
3393
  } | undefined;
3291
3394
  } | {
3292
3395
  type: VerificationType.Password;
@@ -3482,6 +3585,12 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
3482
3585
  isThirdParty?: boolean | undefined;
3483
3586
  appLevelAccessControlEnabled?: boolean | undefined;
3484
3587
  } | undefined;
3588
+ organization?: {
3589
+ name?: string | undefined;
3590
+ id?: string | undefined;
3591
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
3592
+ description?: string | null | undefined;
3593
+ } | undefined;
3485
3594
  grant?: {
3486
3595
  type?: GrantType.TokenExchange | undefined;
3487
3596
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -3547,6 +3656,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
3547
3656
  verified: boolean;
3548
3657
  oneTimeTokenContext?: {
3549
3658
  jitOrganizationIds?: string[] | undefined;
3659
+ interactionEvent?: InteractionEvent | undefined;
3550
3660
  } | undefined;
3551
3661
  } | {
3552
3662
  type: VerificationType.Password;
@@ -4944,10 +5054,13 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
4944
5054
  }>;
4945
5055
  oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
4946
5056
  jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5057
+ interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
4947
5058
  }, "strip", z.ZodTypeAny, {
4948
5059
  jitOrganizationIds?: string[] | undefined;
5060
+ interactionEvent?: InteractionEvent | undefined;
4949
5061
  }, {
4950
5062
  jitOrganizationIds?: string[] | undefined;
5063
+ interactionEvent?: InteractionEvent | undefined;
4951
5064
  }>>;
4952
5065
  }, "strip", z.ZodTypeAny, {
4953
5066
  type: VerificationType.OneTimeToken;
@@ -4959,6 +5072,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
4959
5072
  verified: boolean;
4960
5073
  oneTimeTokenContext?: {
4961
5074
  jitOrganizationIds?: string[] | undefined;
5075
+ interactionEvent?: InteractionEvent | undefined;
4962
5076
  } | undefined;
4963
5077
  }, {
4964
5078
  type: VerificationType.OneTimeToken;
@@ -4970,6 +5084,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
4970
5084
  verified: boolean;
4971
5085
  oneTimeTokenContext?: {
4972
5086
  jitOrganizationIds?: string[] | undefined;
5087
+ interactionEvent?: InteractionEvent | undefined;
4973
5088
  } | undefined;
4974
5089
  }>, z.ZodObject<Omit<{
4975
5090
  id: z.ZodString;
@@ -5063,6 +5178,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5063
5178
  verified: boolean;
5064
5179
  oneTimeTokenContext?: {
5065
5180
  jitOrganizationIds?: string[] | undefined;
5181
+ interactionEvent?: InteractionEvent | undefined;
5066
5182
  } | undefined;
5067
5183
  } | {
5068
5184
  type: VerificationType.Password;
@@ -5177,6 +5293,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5177
5293
  verified: boolean;
5178
5294
  oneTimeTokenContext?: {
5179
5295
  jitOrganizationIds?: string[] | undefined;
5296
+ interactionEvent?: InteractionEvent | undefined;
5180
5297
  } | undefined;
5181
5298
  } | {
5182
5299
  type: VerificationType.Password;
@@ -5431,6 +5548,22 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5431
5548
  isThirdParty?: boolean | undefined;
5432
5549
  appLevelAccessControlEnabled?: boolean | undefined;
5433
5550
  }>>;
5551
+ organization: z.ZodOptional<z.ZodObject<{
5552
+ name: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
5553
+ id: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
5554
+ customData: z.ZodOptional<ZodType<import("@withtyped/server/lib/types.js").JsonObject, z.ZodTypeDef, import("@withtyped/server/lib/types.js").JsonObject>>;
5555
+ description: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
5556
+ }, "strip", z.ZodTypeAny, {
5557
+ name?: string | undefined;
5558
+ id?: string | undefined;
5559
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
5560
+ description?: string | null | undefined;
5561
+ }, {
5562
+ name?: string | undefined;
5563
+ id?: string | undefined;
5564
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
5565
+ description?: string | null | undefined;
5566
+ }>>;
5434
5567
  }, "strip", z.ZodTypeAny, {
5435
5568
  user: {
5436
5569
  name?: string | null | undefined;
@@ -5554,6 +5687,12 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5554
5687
  isThirdParty?: boolean | undefined;
5555
5688
  appLevelAccessControlEnabled?: boolean | undefined;
5556
5689
  } | undefined;
5690
+ organization?: {
5691
+ name?: string | undefined;
5692
+ id?: string | undefined;
5693
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
5694
+ description?: string | null | undefined;
5695
+ } | undefined;
5557
5696
  grant?: {
5558
5697
  type?: GrantType.TokenExchange | undefined;
5559
5698
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -5619,6 +5758,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5619
5758
  verified: boolean;
5620
5759
  oneTimeTokenContext?: {
5621
5760
  jitOrganizationIds?: string[] | undefined;
5761
+ interactionEvent?: InteractionEvent | undefined;
5622
5762
  } | undefined;
5623
5763
  } | {
5624
5764
  type: VerificationType.Password;
@@ -5796,6 +5936,12 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5796
5936
  isThirdParty?: boolean | undefined;
5797
5937
  appLevelAccessControlEnabled?: boolean | undefined;
5798
5938
  } | undefined;
5939
+ organization?: {
5940
+ name?: string | undefined;
5941
+ id?: string | undefined;
5942
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
5943
+ description?: string | null | undefined;
5944
+ } | undefined;
5799
5945
  grant?: {
5800
5946
  type?: GrantType.TokenExchange | undefined;
5801
5947
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -5861,6 +6007,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
5861
6007
  verified: boolean;
5862
6008
  oneTimeTokenContext?: {
5863
6009
  jitOrganizationIds?: string[] | undefined;
6010
+ interactionEvent?: InteractionEvent | undefined;
5864
6011
  } | undefined;
5865
6012
  } | {
5866
6013
  type: VerificationType.Password;
@@ -6056,6 +6203,12 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
6056
6203
  isThirdParty?: boolean | undefined;
6057
6204
  appLevelAccessControlEnabled?: boolean | undefined;
6058
6205
  } | undefined;
6206
+ organization?: {
6207
+ name?: string | undefined;
6208
+ id?: string | undefined;
6209
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
6210
+ description?: string | null | undefined;
6211
+ } | undefined;
6059
6212
  grant?: {
6060
6213
  type?: GrantType.TokenExchange | undefined;
6061
6214
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -6121,6 +6274,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
6121
6274
  verified: boolean;
6122
6275
  oneTimeTokenContext?: {
6123
6276
  jitOrganizationIds?: string[] | undefined;
6277
+ interactionEvent?: InteractionEvent | undefined;
6124
6278
  } | undefined;
6125
6279
  } | {
6126
6280
  type: VerificationType.Password;
@@ -6316,6 +6470,12 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
6316
6470
  isThirdParty?: boolean | undefined;
6317
6471
  appLevelAccessControlEnabled?: boolean | undefined;
6318
6472
  } | undefined;
6473
+ organization?: {
6474
+ name?: string | undefined;
6475
+ id?: string | undefined;
6476
+ customData?: import("@withtyped/server/lib/types.js").JsonObject | undefined;
6477
+ description?: string | null | undefined;
6478
+ } | undefined;
6319
6479
  grant?: {
6320
6480
  type?: GrantType.TokenExchange | undefined;
6321
6481
  subjectTokenContext?: Record<string, import("@withtyped/server/lib/types.js").Json> | undefined;
@@ -6381,6 +6541,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
6381
6541
  verified: boolean;
6382
6542
  oneTimeTokenContext?: {
6383
6543
  jitOrganizationIds?: string[] | undefined;
6544
+ interactionEvent?: InteractionEvent | undefined;
6384
6545
  } | undefined;
6385
6546
  } | {
6386
6547
  type: VerificationType.Password;
@@ -6977,7 +7138,7 @@ export declare const customJwtErrorBodyGuard: z.ZodObject<{
6977
7138
  export type CustomJwtErrorBody = z.infer<typeof customJwtErrorBodyGuard>;
6978
7139
  export type CustomJwtApiContext = {
6979
7140
  /**
6980
- * Reject the the current token request.
7141
+ * Reject the current token request.
6981
7142
  *
6982
7143
  * @remarks
6983
7144
  * By calling this function, the current token request will be rejected,
@@ -111,6 +111,19 @@ export const jwtCustomizerUserInteractionContextGuard = z.object({
111
111
  export const jwtCustomizerApplicationContextGuard = Applications.guard.omit({
112
112
  secret: true,
113
113
  });
114
+ /**
115
+ * The target organization context for organization (API resource) access tokens.
116
+ *
117
+ * Only populated when the token is being issued for a specific organization (i.e. the
118
+ * `organization_id` request parameter is present), letting the customizer attach per-org
119
+ * claims without embedding every organization the user belongs to.
120
+ */
121
+ export const jwtCustomizerOrganizationContextGuard = Organizations.guard.pick({
122
+ id: true,
123
+ name: true,
124
+ description: true,
125
+ customData: true,
126
+ });
114
127
  export const accessTokenJwtCustomizerGuard = jwtCustomizerGuard
115
128
  .extend({
116
129
  // Use partial token guard since users customization may not rely on all fields.
@@ -121,6 +134,7 @@ export const accessTokenJwtCustomizerGuard = jwtCustomizerGuard
121
134
  grant: jwtCustomizerGrantContextGuard.partial().optional(),
122
135
  interaction: jwtCustomizerUserInteractionContextGuard.partial().optional(),
123
136
  application: jwtCustomizerApplicationContextGuard.partial().optional(),
137
+ organization: jwtCustomizerOrganizationContextGuard.partial().optional(),
124
138
  })
125
139
  .optional(),
126
140
  })
@@ -1,3 +1,4 @@
1
+ import { z } from 'zod';
1
2
  import { type OrganizationRole, type Organization, type OrganizationInvitation, type Application } from '../db-entries/index.js';
2
3
  import { type ToZodObject } from '../utils/zod.js';
3
4
  import { type UserInfo, type FeaturedUser } from './user.js';
@@ -66,7 +67,141 @@ export type ApplicationWithOrganizationRoles = Application & {
66
67
  /** The roles of the application in the organization. */
67
68
  organizationRoles: OrganizationRoleEntity[];
68
69
  };
69
- export declare const applicationWithOrganizationRolesGuard: ToZodObject<ApplicationWithOrganizationRoles>;
70
+ export declare const applicationWithOrganizationRolesGuard: z.ZodObject<{
71
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
72
+ id: z.ZodType<string, z.ZodTypeDef, string>;
73
+ name: z.ZodType<string, z.ZodTypeDef, string>;
74
+ description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
75
+ type: z.ZodType<import("../db-entries/custom-types.js").ApplicationType, z.ZodTypeDef, import("../db-entries/custom-types.js").ApplicationType>;
76
+ oidcClientMetadata: z.ZodType<import("../index.js").OidcClientMetadata, z.ZodTypeDef, import("../index.js").OidcClientMetadata>;
77
+ customClientMetadata: z.ZodType<{
78
+ corsAllowedOrigins?: string[] | undefined;
79
+ idTokenTtl?: number | undefined;
80
+ refreshTokenTtl?: number | undefined;
81
+ refreshTokenTtlInDays?: number | undefined;
82
+ tenantId?: string | undefined;
83
+ alwaysIssueRefreshToken?: boolean | undefined;
84
+ rotateRefreshToken?: boolean | undefined;
85
+ allowTokenExchange?: boolean | undefined;
86
+ isDeviceFlow?: boolean | undefined;
87
+ maxAllowedGrants?: number | undefined;
88
+ }, z.ZodTypeDef, {
89
+ corsAllowedOrigins?: string[] | undefined;
90
+ idTokenTtl?: number | undefined;
91
+ refreshTokenTtl?: number | undefined;
92
+ refreshTokenTtlInDays?: number | undefined;
93
+ tenantId?: string | undefined;
94
+ alwaysIssueRefreshToken?: boolean | undefined;
95
+ rotateRefreshToken?: boolean | undefined;
96
+ allowTokenExchange?: boolean | undefined;
97
+ isDeviceFlow?: boolean | undefined;
98
+ maxAllowedGrants?: number | undefined;
99
+ }>;
100
+ protectedAppMetadata: z.ZodType<{
101
+ host: string;
102
+ origin: string;
103
+ sessionDuration: number;
104
+ pageRules: {
105
+ path: string;
106
+ }[];
107
+ additionalScopes?: (import("@logto/core-kit").UserScope.CustomData | import("@logto/core-kit").UserScope.Identities | import("@logto/core-kit").UserScope.Roles | import("@logto/core-kit").UserScope.Organizations | import("@logto/core-kit").UserScope.OrganizationRoles)[] | undefined;
108
+ customDomains?: {
109
+ status: import("../index.js").DomainStatus;
110
+ domain: string;
111
+ errorMessage: string | null;
112
+ dnsRecords: {
113
+ value: string;
114
+ type: string;
115
+ name: string;
116
+ }[];
117
+ cloudflareData: {
118
+ status: string;
119
+ id: string;
120
+ ssl: {
121
+ status: string;
122
+ validation_errors?: {
123
+ message: string;
124
+ }[] | undefined;
125
+ };
126
+ verification_errors?: string[] | undefined;
127
+ } | null;
128
+ }[] | undefined;
129
+ } | null, z.ZodTypeDef, {
130
+ host: string;
131
+ origin: string;
132
+ sessionDuration: number;
133
+ pageRules: {
134
+ path: string;
135
+ }[];
136
+ additionalScopes?: (import("@logto/core-kit").UserScope.CustomData | import("@logto/core-kit").UserScope.Identities | import("@logto/core-kit").UserScope.Roles | import("@logto/core-kit").UserScope.Organizations | import("@logto/core-kit").UserScope.OrganizationRoles)[] | undefined;
137
+ customDomains?: {
138
+ status: import("../index.js").DomainStatus;
139
+ domain: string;
140
+ errorMessage: string | null;
141
+ dnsRecords: {
142
+ value: string;
143
+ type: string;
144
+ name: string;
145
+ }[];
146
+ cloudflareData: {
147
+ status: string;
148
+ id: string;
149
+ ssl: {
150
+ status: string;
151
+ validation_errors?: {
152
+ message: string;
153
+ }[] | undefined;
154
+ };
155
+ verification_errors?: string[] | undefined;
156
+ } | null;
157
+ }[] | undefined;
158
+ } | null>;
159
+ customData: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
160
+ isThirdParty: z.ZodType<boolean, z.ZodTypeDef, boolean>;
161
+ appLevelAccessControlEnabled: z.ZodType<boolean, z.ZodTypeDef, boolean>;
162
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
163
+ } & {
164
+ secret: z.ZodOptional<z.ZodType<string, z.ZodTypeDef, string>>;
165
+ } & {
166
+ organizationRoles: z.ZodArray<ToZodObject<OrganizationRoleEntity>, "many">;
167
+ }, "strip", z.ZodTypeAny, {
168
+ type: import("../db-entries/custom-types.js").ApplicationType;
169
+ name: string;
170
+ id: string;
171
+ tenantId: string;
172
+ createdAt: number;
173
+ customData: import("@withtyped/server").JsonObject;
174
+ description: string | null;
175
+ oidcClientMetadata: import("../index.js").OidcClientMetadata;
176
+ customClientMetadata: import("../index.js").CustomClientMetadata;
177
+ protectedAppMetadata: import("../index.js").ProtectedAppMetadata | null;
178
+ isThirdParty: boolean;
179
+ appLevelAccessControlEnabled: boolean;
180
+ organizationRoles: {
181
+ name: string;
182
+ id: string;
183
+ }[];
184
+ secret?: string | undefined;
185
+ }, {
186
+ type: import("../db-entries/custom-types.js").ApplicationType;
187
+ name: string;
188
+ id: string;
189
+ tenantId: string;
190
+ createdAt: number;
191
+ customData: import("@withtyped/server").JsonObject;
192
+ description: string | null;
193
+ oidcClientMetadata: import("../index.js").OidcClientMetadata;
194
+ customClientMetadata: import("../index.js").CustomClientMetadata;
195
+ protectedAppMetadata: import("../index.js").ProtectedAppMetadata | null;
196
+ isThirdParty: boolean;
197
+ appLevelAccessControlEnabled: boolean;
198
+ organizationRoles: {
199
+ name: string;
200
+ id: string;
201
+ }[];
202
+ secret?: string | undefined;
203
+ }>;
204
+ export type ApplicationWithOrganizationRolesResponse = z.infer<typeof applicationWithOrganizationRolesGuard>;
70
205
  /**
71
206
  * The organization invitation with additional fields:
72
207
  *
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { OrganizationRoles, Organizations, OrganizationInvitations, Applications, } from '../db-entries/index.js';
2
+ import { OrganizationRoles, Organizations, OrganizationInvitations, } from '../db-entries/index.js';
3
+ import { applicationResponseGuard } from './application.js';
3
4
  import { userInfoGuard } from './user.js';
4
5
  export const organizationRoleWithScopesGuard = OrganizationRoles.guard.extend({
5
6
  scopes: z
@@ -29,7 +30,7 @@ export const organizationWithOrganizationRolesGuard = Organizations.guard.extend
29
30
  export const userWithOrganizationRolesGuard = userInfoGuard.extend({
30
31
  organizationRoles: organizationRoleEntityGuard.array(),
31
32
  });
32
- export const applicationWithOrganizationRolesGuard = Applications.guard.extend({
33
+ export const applicationWithOrganizationRolesGuard = applicationResponseGuard.extend({
33
34
  organizationRoles: organizationRoleEntityGuard.array(),
34
35
  });
35
36
  export const organizationInvitationEntityGuard = OrganizationInvitations.guard.extend({
@@ -50,6 +50,7 @@ export declare const samlApplicationPatchGuard: z.ZodObject<{
50
50
  name: z.ZodOptional<z.ZodType<string, z.ZodTypeDef, string>>;
51
51
  customData: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodType<import("@withtyped/server/lib/types.js").JsonObject, z.ZodTypeDef, import("@withtyped/server/lib/types.js").JsonObject>>>>;
52
52
  description: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodType<string | null, z.ZodTypeDef, string | null>>>>;
53
+ appLevelAccessControlEnabled: z.ZodOptional<z.ZodType<boolean, z.ZodTypeDef, boolean>>;
53
54
  attributeMapping: z.ZodOptional<z.ZodType<Partial<Record<"name" | "username" | "email" | "sub" | "nickname" | "profile" | "website" | "gender" | "birthdate" | "zoneinfo" | "locale" | "address" | "given_name" | "family_name" | "middle_name" | "preferred_username" | "picture" | "email_verified" | "phone_number" | "phone_number_verified" | "updated_at" | "created_at" | "custom_data" | "identities" | "sso_identities" | "roles" | "organizations" | "organization_data" | "organization_roles", string>>, z.ZodTypeDef, Partial<Record<"name" | "username" | "email" | "sub" | "nickname" | "profile" | "website" | "gender" | "birthdate" | "zoneinfo" | "locale" | "address" | "given_name" | "family_name" | "middle_name" | "preferred_username" | "picture" | "email_verified" | "phone_number" | "phone_number_verified" | "updated_at" | "created_at" | "custom_data" | "identities" | "sso_identities" | "roles" | "organizations" | "organization_data" | "organization_roles", string>>>>;
54
55
  entityId: z.ZodOptional<z.ZodType<string | null, z.ZodTypeDef, string | null>>;
55
56
  acsUrl: z.ZodOptional<z.ZodType<import("../foundations/index.js").SamlAcsUrl | null, z.ZodTypeDef, import("../foundations/index.js").SamlAcsUrl | null>>;
@@ -68,6 +69,7 @@ export declare const samlApplicationPatchGuard: z.ZodObject<{
68
69
  name?: string | undefined;
69
70
  customData?: import("@withtyped/server/lib/types.js").JsonObject;
70
71
  description?: string | null;
72
+ appLevelAccessControlEnabled?: boolean;
71
73
  attributeMapping?: Partial<Record<"name" | "username" | "email" | "sub" | "nickname" | "profile" | "website" | "gender" | "birthdate" | "zoneinfo" | "locale" | "address" | "given_name" | "family_name" | "middle_name" | "preferred_username" | "picture" | "email_verified" | "phone_number" | "phone_number_verified" | "updated_at" | "created_at" | "custom_data" | "identities" | "sso_identities" | "roles" | "organizations" | "organization_data" | "organization_roles", string>> | undefined;
72
74
  entityId?: string | null | undefined;
73
75
  acsUrl?: import("../foundations/index.js").SamlAcsUrl | null | undefined;
@@ -81,6 +83,7 @@ export declare const samlApplicationPatchGuard: z.ZodObject<{
81
83
  name?: string | undefined;
82
84
  customData?: import("@withtyped/server/lib/types.js").JsonObject;
83
85
  description?: string | null;
86
+ appLevelAccessControlEnabled?: boolean;
84
87
  attributeMapping?: Partial<Record<"name" | "username" | "email" | "sub" | "nickname" | "profile" | "website" | "gender" | "birthdate" | "zoneinfo" | "locale" | "address" | "given_name" | "family_name" | "middle_name" | "preferred_username" | "picture" | "email_verified" | "phone_number" | "phone_number_verified" | "updated_at" | "created_at" | "custom_data" | "identities" | "sso_identities" | "roles" | "organizations" | "organization_data" | "organization_roles", string>> | undefined;
85
88
  entityId?: string | null | undefined;
86
89
  acsUrl?: import("../foundations/index.js").SamlAcsUrl | null | undefined;
@@ -26,6 +26,9 @@ export const samlApplicationPatchGuard = applicationPatchGuard
26
26
  description: true,
27
27
  customData: true,
28
28
  })
29
+ .merge(Applications.createGuard.pick({
30
+ appLevelAccessControlEnabled: true,
31
+ }))
29
32
  // The reason for encapsulating attributeMapping and spMetadata into an object within the config field is that you cannot provide only one of `attributeMapping` or `spMetadata`. Due to the structure of the `saml_application_configs` table, both must be not null.
30
33
  .merge(samlAppConfigGuard.partial())
31
34
  .extend({ nameIdFormat: nameIdFormatGuard.optional() });