@logto/schemas 1.41.0 → 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.
- package/alterations/1.42.0-1783916980-add-domain-verification-files.ts +20 -0
- package/alterations/1.42.0-1784619793-add-service-logs-created-at-index.ts +33 -0
- package/alterations/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.ts +38 -0
- package/alterations/utils/1704934999-tables.ts +22 -1
- package/alterations-js/1.42.0-1783916980-add-domain-verification-files.js +16 -0
- package/alterations-js/1.42.0-1784619793-add-service-logs-created-at-index.js +29 -0
- package/alterations-js/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.js +33 -0
- package/alterations-js/utils/1704934999-tables.js +19 -1
- package/lib/consts/experience.d.ts +1 -0
- package/lib/consts/experience.js +1 -0
- package/lib/db-entries/domain.d.ts +4 -2
- package/lib/db-entries/domain.js +5 -1
- package/lib/db-entries/index.d.ts +1 -0
- package/lib/db-entries/index.js +1 -0
- package/lib/db-entries/saml-sso-connector-signing-key.d.ts +32 -0
- package/lib/db-entries/saml-sso-connector-signing-key.js +49 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +57 -0
- package/lib/foundations/jsonb-types/custom-domain.js +51 -0
- package/lib/foundations/jsonb-types/custom-domain.test.d.ts +1 -0
- package/lib/foundations/jsonb-types/custom-domain.test.js +38 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +4 -4
- package/lib/foundations/jsonb-types/hooks.js +1 -0
- package/lib/foundations/jsonb-types/one-time-tokens.d.ts +5 -0
- package/lib/foundations/jsonb-types/one-time-tokens.js +2 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +16 -1
- package/lib/foundations/jsonb-types/sign-in-experience.js +1 -0
- package/lib/types/application.d.ts +131 -1
- package/lib/types/application.js +8 -0
- package/lib/types/custom-profile-fields.d.ts +1 -1
- package/lib/types/domain.d.ts +9 -0
- package/lib/types/hook.d.ts +9 -2
- package/lib/types/interaction-event.d.ts +11 -0
- package/lib/types/interaction-event.js +12 -0
- package/lib/types/interactions.d.ts +2 -11
- package/lib/types/interactions.js +2 -11
- package/lib/types/log/action.d.ts +7 -0
- package/lib/types/log/action.js +6 -0
- package/lib/types/log/index.d.ts +5 -2
- package/lib/types/log/index.js +1 -0
- package/lib/types/logto-config/action.d.ts +963 -0
- package/lib/types/logto-config/action.js +77 -0
- package/lib/types/logto-config/index.d.ts +32 -19
- package/lib/types/logto-config/index.js +7 -7
- package/lib/types/logto-config/index.test.js +9 -9
- package/lib/types/logto-config/jwt-customizer.d.ts +29 -0
- package/lib/types/organization.d.ts +136 -1
- package/lib/types/organization.js +3 -2
- package/lib/types/sign-in-experience.d.ts +2 -4
- package/lib/types/sign-in-experience.js +1 -1
- package/lib/types/sso-connector.d.ts +58 -0
- package/lib/types/sso-connector.js +12 -0
- package/lib/types/user-sessions.d.ts +78 -29
- package/lib/types/verification-records/one-time-token-verification.d.ts +5 -0
- package/package.json +5 -5
- package/tables/domains.sql +1 -0
- package/tables/saml_sso_connector_signing_keys.sql +21 -0
- package/tables/service_logs.sql +5 -0
- package/lib/types/logto-config/inline-hook.d.ts +0 -76
- package/lib/types/logto-config/inline-hook.js +0 -25
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsonGuard } from '@logto/connector-kit';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { InteractionEvent, interactionIdentifierGuard, } from '../interactions.js';
|
|
4
|
+
import { userInfoGuard } from '../user.js';
|
|
5
|
+
import { VerificationType } from '../verification-records/index.js';
|
|
6
|
+
/** Values map to config key names in `logto_configs`. */
|
|
7
|
+
export var LogtoActionKey;
|
|
8
|
+
(function (LogtoActionKey) {
|
|
9
|
+
LogtoActionKey["PostFirstFactorVerification"] = "action.postFirstFactorVerification";
|
|
10
|
+
LogtoActionKey["PostSignIn"] = "action.postSignIn";
|
|
11
|
+
})(LogtoActionKey || (LogtoActionKey = {}));
|
|
12
|
+
export const actionExecutionErrorPolicies = Object.freeze(['block', 'allow']);
|
|
13
|
+
export const logtoActionGuard = z
|
|
14
|
+
.object({
|
|
15
|
+
script: z.string(),
|
|
16
|
+
environmentVariables: z.record(z.string()).optional(),
|
|
17
|
+
contextSample: jsonGuard.optional(),
|
|
18
|
+
enabled: z.boolean().optional(),
|
|
19
|
+
onExecutionError: z.enum(actionExecutionErrorPolicies).optional(),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
/**
|
|
23
|
+
* Shared execution payload for production Actions and Management API dry runs.
|
|
24
|
+
* Cloud remote execution and the local VM runner both accept this shape.
|
|
25
|
+
*/
|
|
26
|
+
export const actionExecutionRequestBodyGuard = z
|
|
27
|
+
.object({
|
|
28
|
+
script: z.string(),
|
|
29
|
+
actionType: z.nativeEnum(LogtoActionKey),
|
|
30
|
+
event: jsonGuard,
|
|
31
|
+
environmentVariables: z.record(z.string()).optional(),
|
|
32
|
+
})
|
|
33
|
+
.strict();
|
|
34
|
+
export const actionUserPatchGuard = userInfoGuard
|
|
35
|
+
.pick({
|
|
36
|
+
username: true,
|
|
37
|
+
primaryEmail: true,
|
|
38
|
+
primaryPhone: true,
|
|
39
|
+
name: true,
|
|
40
|
+
avatar: true,
|
|
41
|
+
customData: true,
|
|
42
|
+
profile: true,
|
|
43
|
+
})
|
|
44
|
+
.partial();
|
|
45
|
+
// Nested `user` uses passthrough so password fields survive structural parsing.
|
|
46
|
+
export const postFirstFactorVerificationResultGuard = z.discriminatedUnion('action', [
|
|
47
|
+
z.object({
|
|
48
|
+
action: z.literal('createUser'),
|
|
49
|
+
user: actionUserPatchGuard.passthrough(),
|
|
50
|
+
passwordVerified: z.literal(true),
|
|
51
|
+
}),
|
|
52
|
+
z.object({
|
|
53
|
+
action: z.literal('updateUser'),
|
|
54
|
+
user: actionUserPatchGuard.passthrough(),
|
|
55
|
+
passwordVerified: z.literal(true),
|
|
56
|
+
}),
|
|
57
|
+
]);
|
|
58
|
+
// Nested `user` uses passthrough so password fields survive structural parsing.
|
|
59
|
+
export const postSignInResultGuard = z.discriminatedUnion('action', [
|
|
60
|
+
z.object({
|
|
61
|
+
action: z.literal('updateUser'),
|
|
62
|
+
user: actionUserPatchGuard.passthrough().optional(),
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
export const actionUserPatchFields = Object.freeze(actionUserPatchGuard.keyof().options);
|
|
66
|
+
export const loggablePostFirstFactorVerificationEventGuard = z.object({
|
|
67
|
+
key: z.literal(LogtoActionKey.PostFirstFactorVerification),
|
|
68
|
+
interactionEvent: z.literal(InteractionEvent.SignIn),
|
|
69
|
+
verificationType: z.literal(VerificationType.Password),
|
|
70
|
+
identifier: interactionIdentifierGuard,
|
|
71
|
+
user: z.object({ id: z.string() }).nullable(),
|
|
72
|
+
});
|
|
73
|
+
export const loggablePostSignInEventGuard = z.object({
|
|
74
|
+
key: z.literal(LogtoActionKey.PostSignIn),
|
|
75
|
+
interactionEvent: z.literal(InteractionEvent.SignIn),
|
|
76
|
+
user: z.object({ id: z.string() }),
|
|
77
|
+
});
|
|
@@ -3,11 +3,11 @@ import { type Nullable, type Optional } from '@silverhand/essentials';
|
|
|
3
3
|
import type { ZodType } from 'zod';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { type MessageRateLimitOverride } from '../../consts/message-rate-limit.js';
|
|
6
|
-
import { type
|
|
6
|
+
import { type LogtoAction, LogtoActionKey } from './action.js';
|
|
7
7
|
import { type AccessTokenJwtCustomizer, type ClientCredentialsJwtCustomizer } from './jwt-customizer.js';
|
|
8
8
|
export * from './oidc-provider.js';
|
|
9
9
|
export * from './jwt-customizer.js';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './action.js';
|
|
11
11
|
/**
|
|
12
12
|
* Logto OIDC signing key types, used mainly in REST API routes.
|
|
13
13
|
*/
|
|
@@ -94,12 +94,12 @@ export type JwtCustomizerType = {
|
|
|
94
94
|
export declare const jwtCustomizerConfigGuard: Readonly<{
|
|
95
95
|
[key in LogtoJwtTokenKey]: ZodType<JwtCustomizerType[key]>;
|
|
96
96
|
}>;
|
|
97
|
-
export type
|
|
98
|
-
[
|
|
99
|
-
[
|
|
97
|
+
export type ActionType = {
|
|
98
|
+
[LogtoActionKey.PostFirstFactorVerification]: LogtoAction;
|
|
99
|
+
[LogtoActionKey.PostSignIn]: LogtoAction;
|
|
100
100
|
};
|
|
101
|
-
export declare const
|
|
102
|
-
[key in
|
|
101
|
+
export declare const actionConfigGuard: Readonly<{
|
|
102
|
+
[key in LogtoActionKey]: ZodType<ActionType[key]>;
|
|
103
103
|
}>;
|
|
104
104
|
export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [z.ZodObject<{
|
|
105
105
|
key: z.ZodLiteral<LogtoJwtTokenKey.AccessToken>;
|
|
@@ -478,7 +478,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
478
478
|
subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
|
|
479
479
|
}>>;
|
|
480
480
|
interaction: z.ZodOptional<z.ZodObject<{
|
|
481
|
-
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../
|
|
481
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interaction-event.js").InteractionEvent>>;
|
|
482
482
|
userId: z.ZodOptional<z.ZodString>;
|
|
483
483
|
verificationRecords: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
484
484
|
id: z.ZodString;
|
|
@@ -954,10 +954,13 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
954
954
|
}>;
|
|
955
955
|
oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
|
|
956
956
|
jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
957
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interaction-event.js").InteractionEvent>>;
|
|
957
958
|
}, "strip", z.ZodTypeAny, {
|
|
958
959
|
jitOrganizationIds?: string[] | undefined;
|
|
960
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
959
961
|
}, {
|
|
960
962
|
jitOrganizationIds?: string[] | undefined;
|
|
963
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
961
964
|
}>>;
|
|
962
965
|
}, "strip", z.ZodTypeAny, {
|
|
963
966
|
type: import("../index.js").VerificationType.OneTimeToken;
|
|
@@ -969,6 +972,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
969
972
|
verified: boolean;
|
|
970
973
|
oneTimeTokenContext?: {
|
|
971
974
|
jitOrganizationIds?: string[] | undefined;
|
|
975
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
972
976
|
} | undefined;
|
|
973
977
|
}, {
|
|
974
978
|
type: import("../index.js").VerificationType.OneTimeToken;
|
|
@@ -980,6 +984,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
980
984
|
verified: boolean;
|
|
981
985
|
oneTimeTokenContext?: {
|
|
982
986
|
jitOrganizationIds?: string[] | undefined;
|
|
987
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
983
988
|
} | undefined;
|
|
984
989
|
}>, z.ZodObject<Omit<{
|
|
985
990
|
id: z.ZodString;
|
|
@@ -1014,7 +1019,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1014
1019
|
signInContext: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
1015
1020
|
}, "strip", z.ZodTypeAny, {
|
|
1016
1021
|
userId?: string | undefined;
|
|
1017
|
-
interactionEvent?: import("../
|
|
1022
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1018
1023
|
verificationRecords?: ({
|
|
1019
1024
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1020
1025
|
id: string;
|
|
@@ -1073,6 +1078,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1073
1078
|
verified: boolean;
|
|
1074
1079
|
oneTimeTokenContext?: {
|
|
1075
1080
|
jitOrganizationIds?: string[] | undefined;
|
|
1081
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1076
1082
|
} | undefined;
|
|
1077
1083
|
} | {
|
|
1078
1084
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1128,7 +1134,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1128
1134
|
signInContext?: Record<string, string> | undefined;
|
|
1129
1135
|
}, {
|
|
1130
1136
|
userId?: string | undefined;
|
|
1131
|
-
interactionEvent?: import("../
|
|
1137
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1132
1138
|
verificationRecords?: ({
|
|
1133
1139
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1134
1140
|
id: string;
|
|
@@ -1187,6 +1193,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1187
1193
|
verified: boolean;
|
|
1188
1194
|
oneTimeTokenContext?: {
|
|
1189
1195
|
jitOrganizationIds?: string[] | undefined;
|
|
1196
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1190
1197
|
} | undefined;
|
|
1191
1198
|
} | {
|
|
1192
1199
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1592,7 +1599,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1592
1599
|
} | undefined;
|
|
1593
1600
|
interaction?: {
|
|
1594
1601
|
userId?: string | undefined;
|
|
1595
|
-
interactionEvent?: import("../
|
|
1602
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1596
1603
|
verificationRecords?: ({
|
|
1597
1604
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1598
1605
|
id: string;
|
|
@@ -1651,6 +1658,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1651
1658
|
verified: boolean;
|
|
1652
1659
|
oneTimeTokenContext?: {
|
|
1653
1660
|
jitOrganizationIds?: string[] | undefined;
|
|
1661
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1654
1662
|
} | undefined;
|
|
1655
1663
|
} | {
|
|
1656
1664
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1840,7 +1848,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1840
1848
|
} | undefined;
|
|
1841
1849
|
interaction?: {
|
|
1842
1850
|
userId?: string | undefined;
|
|
1843
|
-
interactionEvent?: import("../
|
|
1851
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1844
1852
|
verificationRecords?: ({
|
|
1845
1853
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1846
1854
|
id: string;
|
|
@@ -1899,6 +1907,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1899
1907
|
verified: boolean;
|
|
1900
1908
|
oneTimeTokenContext?: {
|
|
1901
1909
|
jitOrganizationIds?: string[] | undefined;
|
|
1910
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1902
1911
|
} | undefined;
|
|
1903
1912
|
} | {
|
|
1904
1913
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2092,7 +2101,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2092
2101
|
} | undefined;
|
|
2093
2102
|
interaction?: {
|
|
2094
2103
|
userId?: string | undefined;
|
|
2095
|
-
interactionEvent?: import("../
|
|
2104
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2096
2105
|
verificationRecords?: ({
|
|
2097
2106
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2098
2107
|
id: string;
|
|
@@ -2151,6 +2160,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2151
2160
|
verified: boolean;
|
|
2152
2161
|
oneTimeTokenContext?: {
|
|
2153
2162
|
jitOrganizationIds?: string[] | undefined;
|
|
2163
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2154
2164
|
} | undefined;
|
|
2155
2165
|
} | {
|
|
2156
2166
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2358,7 +2368,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2358
2368
|
} | undefined;
|
|
2359
2369
|
interaction?: {
|
|
2360
2370
|
userId?: string | undefined;
|
|
2361
|
-
interactionEvent?: import("../
|
|
2371
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2362
2372
|
verificationRecords?: ({
|
|
2363
2373
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2364
2374
|
id: string;
|
|
@@ -2417,6 +2427,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2417
2427
|
verified: boolean;
|
|
2418
2428
|
oneTimeTokenContext?: {
|
|
2419
2429
|
jitOrganizationIds?: string[] | undefined;
|
|
2430
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2420
2431
|
} | undefined;
|
|
2421
2432
|
} | {
|
|
2422
2433
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2626,7 +2637,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2626
2637
|
} | undefined;
|
|
2627
2638
|
interaction?: {
|
|
2628
2639
|
userId?: string | undefined;
|
|
2629
|
-
interactionEvent?: import("../
|
|
2640
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2630
2641
|
verificationRecords?: ({
|
|
2631
2642
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2632
2643
|
id: string;
|
|
@@ -2685,6 +2696,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2685
2696
|
verified: boolean;
|
|
2686
2697
|
oneTimeTokenContext?: {
|
|
2687
2698
|
jitOrganizationIds?: string[] | undefined;
|
|
2699
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2688
2700
|
} | undefined;
|
|
2689
2701
|
} | {
|
|
2690
2702
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2895,7 +2907,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2895
2907
|
} | undefined;
|
|
2896
2908
|
interaction?: {
|
|
2897
2909
|
userId?: string | undefined;
|
|
2898
|
-
interactionEvent?: import("../
|
|
2910
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2899
2911
|
verificationRecords?: ({
|
|
2900
2912
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2901
2913
|
id: string;
|
|
@@ -2954,6 +2966,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2954
2966
|
verified: boolean;
|
|
2955
2967
|
oneTimeTokenContext?: {
|
|
2956
2968
|
jitOrganizationIds?: string[] | undefined;
|
|
2969
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2957
2970
|
} | undefined;
|
|
2958
2971
|
} | {
|
|
2959
2972
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -3766,9 +3779,9 @@ export type LogtoTenantConfigType = {
|
|
|
3766
3779
|
export declare const logtoTenantConfigGuard: Readonly<{
|
|
3767
3780
|
[key in LogtoTenantConfigKey]: ZodType<LogtoTenantConfigType[key]>;
|
|
3768
3781
|
}>;
|
|
3769
|
-
export type LogtoConfigKey = LogtoOidcConfigKey | LogtoJwtTokenKey |
|
|
3770
|
-
export type LogtoConfigType = LogtoOidcConfigType | JwtCustomizerType |
|
|
3771
|
-
export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof jwtCustomizerConfigGuard & typeof
|
|
3782
|
+
export type LogtoConfigKey = LogtoOidcConfigKey | LogtoJwtTokenKey | LogtoActionKey | LogtoTenantConfigKey;
|
|
3783
|
+
export type LogtoConfigType = LogtoOidcConfigType | JwtCustomizerType | ActionType | LogtoTenantConfigType;
|
|
3784
|
+
export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof jwtCustomizerConfigGuard & typeof actionConfigGuard & typeof logtoTenantConfigGuard;
|
|
3772
3785
|
export declare const logtoConfigKeys: readonly LogtoConfigKey[];
|
|
3773
3786
|
export declare const logtoConfigGuards: LogtoConfigGuard;
|
|
3774
3787
|
export declare const oidcConfigKeysResponseGuard: z.ZodObject<Omit<{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { extendedIdTokenClaims } from '@logto/core-kit';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { messageRateLimitOverrideGuard, } from '../../consts/message-rate-limit.js';
|
|
4
|
-
import {
|
|
4
|
+
import { LogtoActionKey, logtoActionGuard } from './action.js';
|
|
5
5
|
import { accessTokenJwtCustomizerGuard, clientCredentialsJwtCustomizerGuard, } from './jwt-customizer.js';
|
|
6
6
|
export * from './oidc-provider.js';
|
|
7
7
|
export * from './jwt-customizer.js';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './action.js';
|
|
9
9
|
/**
|
|
10
10
|
* Logto OIDC signing key types, used mainly in REST API routes.
|
|
11
11
|
*/
|
|
@@ -63,9 +63,9 @@ export const jwtCustomizerConfigGuard = Object.freeze({
|
|
|
63
63
|
[LogtoJwtTokenKey.AccessToken]: accessTokenJwtCustomizerGuard,
|
|
64
64
|
[LogtoJwtTokenKey.ClientCredentials]: clientCredentialsJwtCustomizerGuard,
|
|
65
65
|
});
|
|
66
|
-
export const
|
|
67
|
-
[
|
|
68
|
-
[
|
|
66
|
+
export const actionConfigGuard = Object.freeze({
|
|
67
|
+
[LogtoActionKey.PostFirstFactorVerification]: logtoActionGuard,
|
|
68
|
+
[LogtoActionKey.PostSignIn]: logtoActionGuard,
|
|
69
69
|
});
|
|
70
70
|
export const jwtCustomizerConfigsGuard = z.discriminatedUnion('key', [
|
|
71
71
|
z.object({
|
|
@@ -140,13 +140,13 @@ export const logtoTenantConfigGuard = Object.freeze({
|
|
|
140
140
|
export const logtoConfigKeys = Object.freeze([
|
|
141
141
|
...Object.values(LogtoOidcConfigKey),
|
|
142
142
|
...Object.values(LogtoJwtTokenKey),
|
|
143
|
-
...Object.values(
|
|
143
|
+
...Object.values(LogtoActionKey),
|
|
144
144
|
...Object.values(LogtoTenantConfigKey),
|
|
145
145
|
]);
|
|
146
146
|
export const logtoConfigGuards = Object.freeze({
|
|
147
147
|
...logtoOidcConfigGuard,
|
|
148
148
|
...jwtCustomizerConfigGuard,
|
|
149
|
-
...
|
|
149
|
+
...actionConfigGuard,
|
|
150
150
|
...logtoTenantConfigGuard,
|
|
151
151
|
});
|
|
152
152
|
export const oidcConfigKeysResponseGuard = oidcConfigKeyGuard.omit({ value: true }).merge(z.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import { LogtoActionKey, LogtoOidcConfigKey, LogtoTenantConfigKey, OidcSigningKeyStatus, actionConfigGuard, logtoOidcConfigGuard, logtoConfigGuards, logtoConfigKeys, logtoTenantConfigGuard, oidcConfigKeysResponseGuard, } from './index.js';
|
|
3
3
|
describe('logto config guards', () => {
|
|
4
4
|
it('accepts legacy private keys without status', () => {
|
|
5
5
|
const privateKeys = [
|
|
@@ -26,8 +26,8 @@ describe('logto config guards', () => {
|
|
|
26
26
|
});
|
|
27
27
|
expect(result.success).toBe(true);
|
|
28
28
|
});
|
|
29
|
-
it('accepts
|
|
30
|
-
const result =
|
|
29
|
+
it('accepts action configs', () => {
|
|
30
|
+
const result = actionConfigGuard[LogtoActionKey.PostFirstFactorVerification].safeParse({
|
|
31
31
|
script: 'export default async () => ({ action: "createUser" });',
|
|
32
32
|
environmentVariables: {
|
|
33
33
|
endpoint: 'https://example.com',
|
|
@@ -38,16 +38,16 @@ describe('logto config guards', () => {
|
|
|
38
38
|
});
|
|
39
39
|
expect(result.success).toBe(true);
|
|
40
40
|
});
|
|
41
|
-
it('rejects invalid
|
|
42
|
-
const result =
|
|
41
|
+
it('rejects invalid action execution error policy', () => {
|
|
42
|
+
const result = actionConfigGuard[LogtoActionKey.PostSignIn].safeParse({
|
|
43
43
|
script: 'export default async () => ({ action: "updateUser" });',
|
|
44
44
|
onExecutionError: 'ignore',
|
|
45
45
|
});
|
|
46
46
|
expect(result.success).toBe(false);
|
|
47
47
|
});
|
|
48
|
-
it('includes
|
|
49
|
-
expect(logtoConfigKeys).toContain(
|
|
50
|
-
expect(logtoConfigKeys).toContain(
|
|
51
|
-
expect(logtoConfigGuards[
|
|
48
|
+
it('includes action keys in the logto config summary guards', () => {
|
|
49
|
+
expect(logtoConfigKeys).toContain(LogtoActionKey.PostFirstFactorVerification);
|
|
50
|
+
expect(logtoConfigKeys).toContain(LogtoActionKey.PostSignIn);
|
|
51
|
+
expect(logtoConfigGuards[LogtoActionKey.PostSignIn]).toBe(actionConfigGuard[LogtoActionKey.PostSignIn]);
|
|
52
52
|
});
|
|
53
53
|
});
|
|
@@ -867,10 +867,13 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
|
|
|
867
867
|
}>;
|
|
868
868
|
oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
|
|
869
869
|
jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
870
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
|
|
870
871
|
}, "strip", z.ZodTypeAny, {
|
|
871
872
|
jitOrganizationIds?: string[] | undefined;
|
|
873
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
872
874
|
}, {
|
|
873
875
|
jitOrganizationIds?: string[] | undefined;
|
|
876
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
874
877
|
}>>;
|
|
875
878
|
}, "strip", z.ZodTypeAny, {
|
|
876
879
|
type: VerificationType.OneTimeToken;
|
|
@@ -882,6 +885,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
|
|
|
882
885
|
verified: boolean;
|
|
883
886
|
oneTimeTokenContext?: {
|
|
884
887
|
jitOrganizationIds?: string[] | undefined;
|
|
888
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
885
889
|
} | undefined;
|
|
886
890
|
}, {
|
|
887
891
|
type: VerificationType.OneTimeToken;
|
|
@@ -893,6 +897,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
|
|
|
893
897
|
verified: boolean;
|
|
894
898
|
oneTimeTokenContext?: {
|
|
895
899
|
jitOrganizationIds?: string[] | undefined;
|
|
900
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
896
901
|
} | undefined;
|
|
897
902
|
}>, z.ZodObject<Omit<{
|
|
898
903
|
id: z.ZodString;
|
|
@@ -986,6 +991,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
|
|
|
986
991
|
verified: boolean;
|
|
987
992
|
oneTimeTokenContext?: {
|
|
988
993
|
jitOrganizationIds?: string[] | undefined;
|
|
994
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
989
995
|
} | undefined;
|
|
990
996
|
} | {
|
|
991
997
|
type: VerificationType.Password;
|
|
@@ -1100,6 +1106,7 @@ export declare const jwtCustomizerUserInteractionContextGuard: z.ZodObject<{
|
|
|
1100
1106
|
verified: boolean;
|
|
1101
1107
|
oneTimeTokenContext?: {
|
|
1102
1108
|
jitOrganizationIds?: string[] | undefined;
|
|
1109
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
1103
1110
|
} | undefined;
|
|
1104
1111
|
} | {
|
|
1105
1112
|
type: VerificationType.Password;
|
|
@@ -2176,10 +2183,13 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
2176
2183
|
}>;
|
|
2177
2184
|
oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
|
|
2178
2185
|
jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2186
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
|
|
2179
2187
|
}, "strip", z.ZodTypeAny, {
|
|
2180
2188
|
jitOrganizationIds?: string[] | undefined;
|
|
2189
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2181
2190
|
}, {
|
|
2182
2191
|
jitOrganizationIds?: string[] | undefined;
|
|
2192
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2183
2193
|
}>>;
|
|
2184
2194
|
}, "strip", z.ZodTypeAny, {
|
|
2185
2195
|
type: VerificationType.OneTimeToken;
|
|
@@ -2191,6 +2201,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
2191
2201
|
verified: boolean;
|
|
2192
2202
|
oneTimeTokenContext?: {
|
|
2193
2203
|
jitOrganizationIds?: string[] | undefined;
|
|
2204
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2194
2205
|
} | undefined;
|
|
2195
2206
|
}, {
|
|
2196
2207
|
type: VerificationType.OneTimeToken;
|
|
@@ -2202,6 +2213,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
2202
2213
|
verified: boolean;
|
|
2203
2214
|
oneTimeTokenContext?: {
|
|
2204
2215
|
jitOrganizationIds?: string[] | undefined;
|
|
2216
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2205
2217
|
} | undefined;
|
|
2206
2218
|
}>, z.ZodObject<Omit<{
|
|
2207
2219
|
id: z.ZodString;
|
|
@@ -2295,6 +2307,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
2295
2307
|
verified: boolean;
|
|
2296
2308
|
oneTimeTokenContext?: {
|
|
2297
2309
|
jitOrganizationIds?: string[] | undefined;
|
|
2310
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2298
2311
|
} | undefined;
|
|
2299
2312
|
} | {
|
|
2300
2313
|
type: VerificationType.Password;
|
|
@@ -2409,6 +2422,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
2409
2422
|
verified: boolean;
|
|
2410
2423
|
oneTimeTokenContext?: {
|
|
2411
2424
|
jitOrganizationIds?: string[] | undefined;
|
|
2425
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2412
2426
|
} | undefined;
|
|
2413
2427
|
} | {
|
|
2414
2428
|
type: VerificationType.Password;
|
|
@@ -2873,6 +2887,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
2873
2887
|
verified: boolean;
|
|
2874
2888
|
oneTimeTokenContext?: {
|
|
2875
2889
|
jitOrganizationIds?: string[] | undefined;
|
|
2890
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
2876
2891
|
} | undefined;
|
|
2877
2892
|
} | {
|
|
2878
2893
|
type: VerificationType.Password;
|
|
@@ -3121,6 +3136,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
3121
3136
|
verified: boolean;
|
|
3122
3137
|
oneTimeTokenContext?: {
|
|
3123
3138
|
jitOrganizationIds?: string[] | undefined;
|
|
3139
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
3124
3140
|
} | undefined;
|
|
3125
3141
|
} | {
|
|
3126
3142
|
type: VerificationType.Password;
|
|
@@ -3373,6 +3389,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
3373
3389
|
verified: boolean;
|
|
3374
3390
|
oneTimeTokenContext?: {
|
|
3375
3391
|
jitOrganizationIds?: string[] | undefined;
|
|
3392
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
3376
3393
|
} | undefined;
|
|
3377
3394
|
} | {
|
|
3378
3395
|
type: VerificationType.Password;
|
|
@@ -3639,6 +3656,7 @@ export declare const accessTokenJwtCustomizerGuard: z.ZodObject<{
|
|
|
3639
3656
|
verified: boolean;
|
|
3640
3657
|
oneTimeTokenContext?: {
|
|
3641
3658
|
jitOrganizationIds?: string[] | undefined;
|
|
3659
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
3642
3660
|
} | undefined;
|
|
3643
3661
|
} | {
|
|
3644
3662
|
type: VerificationType.Password;
|
|
@@ -5036,10 +5054,13 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5036
5054
|
}>;
|
|
5037
5055
|
oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
|
|
5038
5056
|
jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5057
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
|
|
5039
5058
|
}, "strip", z.ZodTypeAny, {
|
|
5040
5059
|
jitOrganizationIds?: string[] | undefined;
|
|
5060
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5041
5061
|
}, {
|
|
5042
5062
|
jitOrganizationIds?: string[] | undefined;
|
|
5063
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5043
5064
|
}>>;
|
|
5044
5065
|
}, "strip", z.ZodTypeAny, {
|
|
5045
5066
|
type: VerificationType.OneTimeToken;
|
|
@@ -5051,6 +5072,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5051
5072
|
verified: boolean;
|
|
5052
5073
|
oneTimeTokenContext?: {
|
|
5053
5074
|
jitOrganizationIds?: string[] | undefined;
|
|
5075
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5054
5076
|
} | undefined;
|
|
5055
5077
|
}, {
|
|
5056
5078
|
type: VerificationType.OneTimeToken;
|
|
@@ -5062,6 +5084,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5062
5084
|
verified: boolean;
|
|
5063
5085
|
oneTimeTokenContext?: {
|
|
5064
5086
|
jitOrganizationIds?: string[] | undefined;
|
|
5087
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5065
5088
|
} | undefined;
|
|
5066
5089
|
}>, z.ZodObject<Omit<{
|
|
5067
5090
|
id: z.ZodString;
|
|
@@ -5155,6 +5178,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5155
5178
|
verified: boolean;
|
|
5156
5179
|
oneTimeTokenContext?: {
|
|
5157
5180
|
jitOrganizationIds?: string[] | undefined;
|
|
5181
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5158
5182
|
} | undefined;
|
|
5159
5183
|
} | {
|
|
5160
5184
|
type: VerificationType.Password;
|
|
@@ -5269,6 +5293,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5269
5293
|
verified: boolean;
|
|
5270
5294
|
oneTimeTokenContext?: {
|
|
5271
5295
|
jitOrganizationIds?: string[] | undefined;
|
|
5296
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5272
5297
|
} | undefined;
|
|
5273
5298
|
} | {
|
|
5274
5299
|
type: VerificationType.Password;
|
|
@@ -5733,6 +5758,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5733
5758
|
verified: boolean;
|
|
5734
5759
|
oneTimeTokenContext?: {
|
|
5735
5760
|
jitOrganizationIds?: string[] | undefined;
|
|
5761
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5736
5762
|
} | undefined;
|
|
5737
5763
|
} | {
|
|
5738
5764
|
type: VerificationType.Password;
|
|
@@ -5981,6 +6007,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
5981
6007
|
verified: boolean;
|
|
5982
6008
|
oneTimeTokenContext?: {
|
|
5983
6009
|
jitOrganizationIds?: string[] | undefined;
|
|
6010
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
5984
6011
|
} | undefined;
|
|
5985
6012
|
} | {
|
|
5986
6013
|
type: VerificationType.Password;
|
|
@@ -6247,6 +6274,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
6247
6274
|
verified: boolean;
|
|
6248
6275
|
oneTimeTokenContext?: {
|
|
6249
6276
|
jitOrganizationIds?: string[] | undefined;
|
|
6277
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
6250
6278
|
} | undefined;
|
|
6251
6279
|
} | {
|
|
6252
6280
|
type: VerificationType.Password;
|
|
@@ -6513,6 +6541,7 @@ export declare const jwtCustomizerTestRequestBodyGuard: z.ZodDiscriminatedUnion<
|
|
|
6513
6541
|
verified: boolean;
|
|
6514
6542
|
oneTimeTokenContext?: {
|
|
6515
6543
|
jitOrganizationIds?: string[] | undefined;
|
|
6544
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
6516
6545
|
} | undefined;
|
|
6517
6546
|
} | {
|
|
6518
6547
|
type: VerificationType.Password;
|