@authhero/proxy 0.10.0 → 0.10.2
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/dist/proxy.cjs +1 -1
- package/dist/proxy.mjs +309 -274
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/proxy.mjs
CHANGED
|
@@ -309,6 +309,7 @@ pe.extend({
|
|
|
309
309
|
provider: e.string().optional(),
|
|
310
310
|
connection: e.string(),
|
|
311
311
|
is_social: e.boolean().optional(),
|
|
312
|
+
blocked: e.boolean().optional(),
|
|
312
313
|
registration_completed_at: e.string().optional(),
|
|
313
314
|
password: e.object({
|
|
314
315
|
hash: e.string(),
|
|
@@ -827,8 +828,8 @@ var We = e.object({
|
|
|
827
828
|
strategy: e.string(),
|
|
828
829
|
options: e.preprocess((e) => e === null ? {} : v(e), Ue).default({}),
|
|
829
830
|
enabled_clients: e.array(e.string()).default([]).optional(),
|
|
830
|
-
response_type: e.
|
|
831
|
-
response_mode: e.
|
|
831
|
+
response_type: e.nativeEnum(Ie).optional(),
|
|
832
|
+
response_mode: e.nativeEnum(Le).optional(),
|
|
832
833
|
is_domain_connection: e.boolean().optional(),
|
|
833
834
|
show_as_button: e.boolean().optional(),
|
|
834
835
|
metadata: e.record(e.string(), e.any()).optional(),
|
|
@@ -839,7 +840,7 @@ e.object({
|
|
|
839
840
|
created_at: e.string().transform((e) => e === null ? "" : e),
|
|
840
841
|
updated_at: e.string().transform((e) => e === null ? "" : e)
|
|
841
842
|
}).extend(We.shape);
|
|
842
|
-
var
|
|
843
|
+
var y = e.object({
|
|
843
844
|
domain: e.string(),
|
|
844
845
|
custom_domain_id: e.string().optional(),
|
|
845
846
|
type: e.enum(["auth0_managed_certs", "self_managed_certs"]),
|
|
@@ -853,7 +854,7 @@ var Ge = e.object({
|
|
|
853
854
|
"null"
|
|
854
855
|
]).optional(),
|
|
855
856
|
domain_metadata: e.record(e.string(), e.string().max(255)).optional()
|
|
856
|
-
}),
|
|
857
|
+
}), Ge = e.discriminatedUnion("name", [e.object({
|
|
857
858
|
name: e.literal("txt"),
|
|
858
859
|
record: e.string(),
|
|
859
860
|
domain: e.string()
|
|
@@ -861,7 +862,7 @@ var Ge = e.object({
|
|
|
861
862
|
name: e.literal("http"),
|
|
862
863
|
http_body: e.string(),
|
|
863
864
|
http_url: e.string()
|
|
864
|
-
})]),
|
|
865
|
+
})]), Ke = y.extend({
|
|
865
866
|
custom_domain_id: e.string(),
|
|
866
867
|
primary: e.boolean(),
|
|
867
868
|
status: e.enum([
|
|
@@ -871,28 +872,28 @@ var Ge = e.object({
|
|
|
871
872
|
"ready"
|
|
872
873
|
]),
|
|
873
874
|
origin_domain_name: e.string().optional(),
|
|
874
|
-
verification: e.object({ methods: e.array(
|
|
875
|
+
verification: e.object({ methods: e.array(Ge) }).optional(),
|
|
875
876
|
tls_policy: e.string().optional()
|
|
876
877
|
});
|
|
877
|
-
|
|
878
|
+
y.pick({
|
|
878
879
|
tls_policy: !0,
|
|
879
880
|
custom_client_ip_header: !0,
|
|
880
881
|
domain_metadata: !0
|
|
881
|
-
}).strict(),
|
|
882
|
+
}).strict(), Ke.extend({ tenant_id: e.string() }), e.object({
|
|
882
883
|
certificate: e.string().regex(/^-----BEGIN CERTIFICATE-----[\s\S]+-----END CERTIFICATE-----\s*$/, "must be PEM-encoded; include the full certificate chain in leaf-first order"),
|
|
883
884
|
private_key: e.string().regex(/-----BEGIN (RSA |EC |ENCRYPTED )?PRIVATE KEY-----[\s\S]+-----END \1PRIVATE KEY-----\s*$/, "must be a PEM-encoded private key")
|
|
884
885
|
});
|
|
885
|
-
var
|
|
886
|
+
var b = e.object({
|
|
886
887
|
id: e.string(),
|
|
887
888
|
order: e.number().optional(),
|
|
888
889
|
visible: e.boolean().optional().default(!0)
|
|
889
|
-
}),
|
|
890
|
+
}), x = b.extend({ category: e.literal("BLOCK").optional() }), qe = x.extend({
|
|
890
891
|
type: e.literal("DIVIDER"),
|
|
891
892
|
config: e.object({ text: e.string().optional() }).optional()
|
|
892
|
-
}),
|
|
893
|
+
}), Je = x.extend({
|
|
893
894
|
type: e.literal("HTML"),
|
|
894
895
|
config: e.object({ content: e.string().optional() }).optional()
|
|
895
|
-
}),
|
|
896
|
+
}), Ye = x.extend({
|
|
896
897
|
type: e.literal("IMAGE"),
|
|
897
898
|
config: e.object({
|
|
898
899
|
src: e.string().optional(),
|
|
@@ -900,43 +901,43 @@ var y = e.object({
|
|
|
900
901
|
width: e.number().optional(),
|
|
901
902
|
height: e.number().optional()
|
|
902
903
|
}).optional()
|
|
903
|
-
}),
|
|
904
|
+
}), Xe = x.extend({
|
|
904
905
|
type: e.literal("JUMP_BUTTON"),
|
|
905
906
|
config: e.object({
|
|
906
907
|
text: e.string().optional(),
|
|
907
908
|
target_step: e.string().optional()
|
|
908
909
|
})
|
|
909
|
-
}),
|
|
910
|
+
}), Ze = x.extend({
|
|
910
911
|
type: e.literal("RESEND_BUTTON"),
|
|
911
912
|
config: e.object({
|
|
912
913
|
text: e.string().optional(),
|
|
913
914
|
resend_action: e.string().optional()
|
|
914
915
|
})
|
|
915
|
-
}),
|
|
916
|
+
}), Qe = x.extend({
|
|
916
917
|
type: e.literal("NEXT_BUTTON"),
|
|
917
918
|
config: e.object({ text: e.string().optional() })
|
|
918
|
-
}),
|
|
919
|
+
}), $e = x.extend({
|
|
919
920
|
type: e.literal("PREVIOUS_BUTTON"),
|
|
920
921
|
config: e.object({ text: e.string().optional() })
|
|
921
|
-
}),
|
|
922
|
+
}), et = x.extend({
|
|
922
923
|
type: e.literal("RICH_TEXT"),
|
|
923
924
|
config: e.object({ content: e.string().optional() }).optional()
|
|
924
|
-
}),
|
|
925
|
+
}), S = b.extend({
|
|
925
926
|
category: e.literal("WIDGET").optional(),
|
|
926
927
|
label: e.string().min(1).optional(),
|
|
927
928
|
hint: e.string().min(1).max(500).optional(),
|
|
928
929
|
required: e.boolean().optional(),
|
|
929
930
|
sensitive: e.boolean().optional()
|
|
930
|
-
}),
|
|
931
|
+
}), tt = S.extend({
|
|
931
932
|
type: e.literal("AUTH0_VERIFIABLE_CREDENTIALS"),
|
|
932
933
|
config: e.object({ credential_type: e.string().optional() })
|
|
933
|
-
}),
|
|
934
|
+
}), nt = S.extend({
|
|
934
935
|
type: e.literal("GMAPS_ADDRESS"),
|
|
935
936
|
config: e.object({ api_key: e.string().optional() })
|
|
936
|
-
}),
|
|
937
|
+
}), rt = S.extend({
|
|
937
938
|
type: e.literal("RECAPTCHA"),
|
|
938
939
|
config: e.object({ site_key: e.string().optional() })
|
|
939
|
-
}),
|
|
940
|
+
}), C = b.extend({
|
|
940
941
|
category: e.literal("FIELD").optional(),
|
|
941
942
|
label: e.string().min(1).optional(),
|
|
942
943
|
hint: e.string().min(1).max(500).optional(),
|
|
@@ -952,10 +953,10 @@ var y = e.object({
|
|
|
952
953
|
})).optional(),
|
|
953
954
|
required: e.boolean().optional(),
|
|
954
955
|
sensitive: e.boolean().optional()
|
|
955
|
-
}),
|
|
956
|
+
}), it = C.extend({
|
|
956
957
|
type: e.literal("BOOLEAN"),
|
|
957
958
|
config: e.object({ default_value: e.boolean().optional() }).optional()
|
|
958
|
-
}),
|
|
959
|
+
}), at = C.extend({
|
|
959
960
|
type: e.literal("CARDS"),
|
|
960
961
|
config: e.object({
|
|
961
962
|
options: e.array(e.object({
|
|
@@ -966,7 +967,7 @@ var y = e.object({
|
|
|
966
967
|
})).optional(),
|
|
967
968
|
multi_select: e.boolean().optional()
|
|
968
969
|
}).optional()
|
|
969
|
-
}),
|
|
970
|
+
}), ot = C.extend({
|
|
970
971
|
type: e.literal("CHOICE"),
|
|
971
972
|
config: e.object({
|
|
972
973
|
options: e.array(e.object({
|
|
@@ -977,7 +978,7 @@ var y = e.object({
|
|
|
977
978
|
multiple: e.boolean().optional(),
|
|
978
979
|
default_value: e.union([e.string(), e.array(e.string())]).optional()
|
|
979
980
|
}).optional()
|
|
980
|
-
}),
|
|
981
|
+
}), st = C.extend({
|
|
981
982
|
type: e.literal("CODE"),
|
|
982
983
|
config: e.object({
|
|
983
984
|
length: e.number().int().positive().max(100).optional(),
|
|
@@ -994,7 +995,7 @@ var y = e.object({
|
|
|
994
995
|
message: "default_value is longer than the configured length",
|
|
995
996
|
path: ["default_value"]
|
|
996
997
|
}).optional()
|
|
997
|
-
}),
|
|
998
|
+
}), ct = C.extend({
|
|
998
999
|
type: e.literal("CUSTOM"),
|
|
999
1000
|
config: e.object({
|
|
1000
1001
|
component: e.string().optional(),
|
|
@@ -1002,7 +1003,7 @@ var y = e.object({
|
|
|
1002
1003
|
schema: e.record(e.string(), e.any()).optional(),
|
|
1003
1004
|
code: e.string().optional()
|
|
1004
1005
|
})
|
|
1005
|
-
}),
|
|
1006
|
+
}), lt = C.extend({
|
|
1006
1007
|
type: e.literal("DATE"),
|
|
1007
1008
|
config: e.object({
|
|
1008
1009
|
format: e.string().optional(),
|
|
@@ -1010,7 +1011,7 @@ var y = e.object({
|
|
|
1010
1011
|
max: e.string().optional(),
|
|
1011
1012
|
default_value: e.string().optional()
|
|
1012
1013
|
}).optional()
|
|
1013
|
-
}),
|
|
1014
|
+
}), ut = C.extend({
|
|
1014
1015
|
type: e.literal("DROPDOWN"),
|
|
1015
1016
|
config: e.object({
|
|
1016
1017
|
options: e.array(e.object({
|
|
@@ -1022,26 +1023,28 @@ var y = e.object({
|
|
|
1022
1023
|
multiple: e.boolean().optional(),
|
|
1023
1024
|
default_value: e.union([e.string(), e.array(e.string())]).optional()
|
|
1024
1025
|
}).optional()
|
|
1025
|
-
}),
|
|
1026
|
+
}), dt = C.extend({
|
|
1026
1027
|
type: e.literal("EMAIL"),
|
|
1027
1028
|
config: e.object({
|
|
1028
1029
|
placeholder: e.string().optional(),
|
|
1029
|
-
default_value: e.string().optional()
|
|
1030
|
+
default_value: e.string().optional(),
|
|
1031
|
+
last_used: e.boolean().optional(),
|
|
1032
|
+
last_used_label: e.string().optional()
|
|
1030
1033
|
}).optional()
|
|
1031
|
-
}),
|
|
1034
|
+
}), ft = C.extend({
|
|
1032
1035
|
type: e.literal("FILE"),
|
|
1033
1036
|
config: e.object({
|
|
1034
1037
|
accept: e.string().optional(),
|
|
1035
1038
|
max_size: e.number().optional(),
|
|
1036
1039
|
multiple: e.boolean().optional()
|
|
1037
1040
|
}).optional()
|
|
1038
|
-
}),
|
|
1041
|
+
}), pt = C.extend({
|
|
1039
1042
|
type: e.literal("LEGAL"),
|
|
1040
1043
|
config: e.object({
|
|
1041
1044
|
text: e.string(),
|
|
1042
1045
|
html: e.boolean().optional()
|
|
1043
1046
|
}).optional()
|
|
1044
|
-
}),
|
|
1047
|
+
}), mt = C.extend({
|
|
1045
1048
|
type: e.literal("NUMBER"),
|
|
1046
1049
|
config: e.object({
|
|
1047
1050
|
placeholder: e.string().optional(),
|
|
@@ -1050,7 +1053,7 @@ var y = e.object({
|
|
|
1050
1053
|
step: e.number().optional(),
|
|
1051
1054
|
default_value: e.string().optional()
|
|
1052
1055
|
}).optional()
|
|
1053
|
-
}),
|
|
1056
|
+
}), ht = C.extend({
|
|
1054
1057
|
type: e.literal("PASSWORD"),
|
|
1055
1058
|
config: e.object({
|
|
1056
1059
|
placeholder: e.string().optional(),
|
|
@@ -1059,13 +1062,13 @@ var y = e.object({
|
|
|
1059
1062
|
forgot_password_link: e.string().optional(),
|
|
1060
1063
|
default_value: e.string().optional()
|
|
1061
1064
|
}).optional()
|
|
1062
|
-
}),
|
|
1065
|
+
}), gt = C.extend({
|
|
1063
1066
|
type: e.literal("PAYMENT"),
|
|
1064
1067
|
config: e.object({
|
|
1065
1068
|
provider: e.string().optional(),
|
|
1066
1069
|
currency: e.string().optional()
|
|
1067
1070
|
}).optional()
|
|
1068
|
-
}),
|
|
1071
|
+
}), _t = C.extend({
|
|
1069
1072
|
type: e.literal("SOCIAL"),
|
|
1070
1073
|
config: e.object({
|
|
1071
1074
|
providers: e.array(e.string()).optional(),
|
|
@@ -1074,10 +1077,12 @@ var y = e.object({
|
|
|
1074
1077
|
strategy: e.string().optional(),
|
|
1075
1078
|
display_name: e.string().optional(),
|
|
1076
1079
|
icon_url: e.string().optional(),
|
|
1077
|
-
href: e.string().optional()
|
|
1080
|
+
href: e.string().optional(),
|
|
1081
|
+
last_used: e.boolean().optional(),
|
|
1082
|
+
last_used_label: e.string().optional()
|
|
1078
1083
|
})).optional()
|
|
1079
1084
|
}).optional()
|
|
1080
|
-
}),
|
|
1085
|
+
}), vt = C.extend({
|
|
1081
1086
|
type: e.literal("TEL"),
|
|
1082
1087
|
config: e.object({
|
|
1083
1088
|
placeholder: e.string().optional(),
|
|
@@ -1085,45 +1090,48 @@ var y = e.object({
|
|
|
1085
1090
|
default_value: e.string().optional(),
|
|
1086
1091
|
allow_email: e.boolean().optional()
|
|
1087
1092
|
}).optional()
|
|
1088
|
-
}),
|
|
1093
|
+
}), yt = C.extend({
|
|
1089
1094
|
type: e.literal("TEXT"),
|
|
1090
1095
|
config: e.object({
|
|
1091
1096
|
placeholder: e.string().optional(),
|
|
1092
1097
|
multiline: e.boolean().optional(),
|
|
1093
1098
|
max_length: e.number().optional(),
|
|
1094
|
-
default_value: e.string().optional()
|
|
1099
|
+
default_value: e.string().optional(),
|
|
1100
|
+
last_used: e.boolean().optional(),
|
|
1101
|
+
last_used_label: e.string().optional()
|
|
1095
1102
|
}).optional()
|
|
1096
|
-
}),
|
|
1103
|
+
}), bt = C.extend({
|
|
1097
1104
|
type: e.literal("COUNTRY"),
|
|
1098
1105
|
config: e.object({
|
|
1099
1106
|
placeholder: e.string().optional(),
|
|
1100
1107
|
default_value: e.string().optional()
|
|
1101
1108
|
}).optional()
|
|
1102
|
-
}),
|
|
1109
|
+
}), xt = C.extend({
|
|
1103
1110
|
type: e.literal("URL"),
|
|
1104
1111
|
config: e.object({
|
|
1105
1112
|
placeholder: e.string().optional(),
|
|
1106
1113
|
default_value: e.string().optional()
|
|
1107
1114
|
}).optional()
|
|
1108
|
-
}),
|
|
1115
|
+
}), St = e.discriminatedUnion("type", [
|
|
1116
|
+
qe,
|
|
1109
1117
|
Je,
|
|
1110
1118
|
Ye,
|
|
1111
1119
|
Xe,
|
|
1112
1120
|
Ze,
|
|
1113
1121
|
Qe,
|
|
1114
1122
|
$e,
|
|
1115
|
-
et
|
|
1116
|
-
|
|
1117
|
-
|
|
1123
|
+
et
|
|
1124
|
+
]), Ct = e.discriminatedUnion("type", [
|
|
1125
|
+
tt,
|
|
1118
1126
|
nt,
|
|
1119
|
-
rt
|
|
1120
|
-
|
|
1121
|
-
|
|
1127
|
+
rt
|
|
1128
|
+
]), wt = e.discriminatedUnion("type", [
|
|
1129
|
+
it,
|
|
1122
1130
|
at,
|
|
1123
1131
|
ot,
|
|
1124
1132
|
st,
|
|
1133
|
+
bt,
|
|
1125
1134
|
ct,
|
|
1126
|
-
xt,
|
|
1127
1135
|
lt,
|
|
1128
1136
|
ut,
|
|
1129
1137
|
dt,
|
|
@@ -1135,12 +1143,11 @@ var y = e.object({
|
|
|
1135
1143
|
_t,
|
|
1136
1144
|
vt,
|
|
1137
1145
|
yt,
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1146
|
+
xt
|
|
1147
|
+
]), w = e.union([
|
|
1148
|
+
St,
|
|
1141
1149
|
Ct,
|
|
1142
|
-
wt
|
|
1143
|
-
Tt
|
|
1150
|
+
wt
|
|
1144
1151
|
]);
|
|
1145
1152
|
new Set([
|
|
1146
1153
|
"BOOLEAN",
|
|
@@ -1167,22 +1174,22 @@ new Set([
|
|
|
1167
1174
|
visible: e.boolean().optional().default(!0),
|
|
1168
1175
|
customizations: e.record(e.string(), e.any()).optional()
|
|
1169
1176
|
});
|
|
1170
|
-
var
|
|
1177
|
+
var T = e.object({
|
|
1171
1178
|
x: e.number(),
|
|
1172
1179
|
y: e.number()
|
|
1173
|
-
}),
|
|
1180
|
+
}), Tt = e.object({
|
|
1174
1181
|
id: e.string(),
|
|
1175
1182
|
type: e.literal("FLOW"),
|
|
1176
|
-
coordinates:
|
|
1183
|
+
coordinates: T,
|
|
1177
1184
|
alias: e.string().min(1).max(150).optional(),
|
|
1178
1185
|
config: e.object({
|
|
1179
1186
|
flow_id: e.string().max(30),
|
|
1180
1187
|
next_node: e.string().optional()
|
|
1181
1188
|
})
|
|
1182
|
-
}),
|
|
1189
|
+
}), Et = e.object({
|
|
1183
1190
|
id: e.string(),
|
|
1184
1191
|
type: e.literal("ROUTER"),
|
|
1185
|
-
coordinates:
|
|
1192
|
+
coordinates: T,
|
|
1186
1193
|
alias: e.string().min(1).max(150),
|
|
1187
1194
|
config: e.object({
|
|
1188
1195
|
rules: e.array(e.object({
|
|
@@ -1193,20 +1200,20 @@ var C = e.object({
|
|
|
1193
1200
|
})),
|
|
1194
1201
|
fallback: e.string()
|
|
1195
1202
|
})
|
|
1196
|
-
}),
|
|
1203
|
+
}), Dt = e.object({
|
|
1197
1204
|
id: e.string(),
|
|
1198
1205
|
type: e.literal("STEP"),
|
|
1199
|
-
coordinates:
|
|
1206
|
+
coordinates: T,
|
|
1200
1207
|
alias: e.string().min(1).max(150).optional(),
|
|
1201
1208
|
config: e.object({
|
|
1202
|
-
components: e.array(
|
|
1209
|
+
components: e.array(w),
|
|
1203
1210
|
next_node: e.string().optional()
|
|
1204
1211
|
})
|
|
1205
|
-
}),
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
]),
|
|
1212
|
+
}), Ot = e.discriminatedUnion("type", [
|
|
1213
|
+
Tt,
|
|
1214
|
+
Et,
|
|
1215
|
+
Dt
|
|
1216
|
+
]), kt = e.object({
|
|
1210
1217
|
name: e.string().openapi({ description: "The name of the form" }),
|
|
1211
1218
|
messages: e.object({
|
|
1212
1219
|
errors: e.record(e.string(), e.any()).optional(),
|
|
@@ -1217,14 +1224,14 @@ var C = e.object({
|
|
|
1217
1224
|
default: e.string().optional()
|
|
1218
1225
|
}).optional(),
|
|
1219
1226
|
translations: e.record(e.string(), e.any()).optional(),
|
|
1220
|
-
nodes: e.array(
|
|
1227
|
+
nodes: e.array(Ot).optional(),
|
|
1221
1228
|
start: e.object({
|
|
1222
1229
|
hidden_fields: e.array(e.object({
|
|
1223
1230
|
key: e.string(),
|
|
1224
1231
|
value: e.string()
|
|
1225
1232
|
})).optional(),
|
|
1226
1233
|
next_node: e.string().optional(),
|
|
1227
|
-
coordinates:
|
|
1234
|
+
coordinates: T.optional()
|
|
1228
1235
|
}).optional(),
|
|
1229
1236
|
ending: e.object({
|
|
1230
1237
|
redirection: e.object({
|
|
@@ -1232,7 +1239,7 @@ var C = e.object({
|
|
|
1232
1239
|
target: e.string().optional()
|
|
1233
1240
|
}).optional(),
|
|
1234
1241
|
after_submit: e.object({ flow_id: e.string().optional() }).optional(),
|
|
1235
|
-
coordinates:
|
|
1242
|
+
coordinates: T.optional(),
|
|
1236
1243
|
resume_flow: e.boolean().optional()
|
|
1237
1244
|
}).optional(),
|
|
1238
1245
|
style: e.object({ css: e.string().optional() }).optional(),
|
|
@@ -1241,8 +1248,8 @@ var C = e.object({
|
|
|
1241
1248
|
sdk_src: e.string().optional()
|
|
1242
1249
|
}).optional()
|
|
1243
1250
|
}).openapi({ description: "Schema for flow-based forms (matches Auth0 Forms structure)" });
|
|
1244
|
-
n.extend(
|
|
1245
|
-
var
|
|
1251
|
+
n.extend(kt.shape).extend({ id: e.string() });
|
|
1252
|
+
var At = e.object({
|
|
1246
1253
|
id: e.number().optional(),
|
|
1247
1254
|
text: e.string(),
|
|
1248
1255
|
type: e.enum([
|
|
@@ -1251,7 +1258,7 @@ var Mt = e.object({
|
|
|
1251
1258
|
"success",
|
|
1252
1259
|
"warning"
|
|
1253
1260
|
])
|
|
1254
|
-
}),
|
|
1261
|
+
}), jt = e.object({
|
|
1255
1262
|
id: e.string().optional(),
|
|
1256
1263
|
text: e.string(),
|
|
1257
1264
|
href: e.string(),
|
|
@@ -1263,12 +1270,12 @@ e.object({
|
|
|
1263
1270
|
method: e.enum(["POST", "GET"]),
|
|
1264
1271
|
title: e.string().optional(),
|
|
1265
1272
|
description: e.string().optional(),
|
|
1266
|
-
components: e.array(
|
|
1267
|
-
messages: e.array(
|
|
1268
|
-
links: e.array(
|
|
1273
|
+
components: e.array(w),
|
|
1274
|
+
messages: e.array(At).optional(),
|
|
1275
|
+
links: e.array(jt).optional(),
|
|
1269
1276
|
footer: e.string().optional()
|
|
1270
1277
|
});
|
|
1271
|
-
var
|
|
1278
|
+
var E = e.enum([
|
|
1272
1279
|
"pre-user-registration",
|
|
1273
1280
|
"post-user-registration",
|
|
1274
1281
|
"post-user-login",
|
|
@@ -1276,24 +1283,24 @@ var Pt = e.enum([
|
|
|
1276
1283
|
"validate-registration-username",
|
|
1277
1284
|
"pre-user-deletion",
|
|
1278
1285
|
"post-user-deletion"
|
|
1279
|
-
]),
|
|
1286
|
+
]), D = e.enum([
|
|
1280
1287
|
"pre-user-registration",
|
|
1281
1288
|
"post-user-registration",
|
|
1282
1289
|
"post-user-login",
|
|
1283
1290
|
"validate-registration-username",
|
|
1284
1291
|
"pre-user-deletion",
|
|
1285
1292
|
"post-user-deletion"
|
|
1286
|
-
]),
|
|
1293
|
+
]), Mt = e.enum([
|
|
1287
1294
|
"post-user-login",
|
|
1288
1295
|
"post-user-registration",
|
|
1289
1296
|
"post-user-update",
|
|
1290
1297
|
"credentials-exchange"
|
|
1291
|
-
]),
|
|
1298
|
+
]), Nt = e.enum([
|
|
1292
1299
|
"post-user-login",
|
|
1293
1300
|
"credentials-exchange",
|
|
1294
1301
|
"pre-user-registration",
|
|
1295
1302
|
"post-user-registration"
|
|
1296
|
-
]),
|
|
1303
|
+
]), Pt = e.enum([
|
|
1297
1304
|
"ensure-username",
|
|
1298
1305
|
"set-preferred-username",
|
|
1299
1306
|
"account-linking"
|
|
@@ -1305,19 +1312,19 @@ var Pt = e.enum([
|
|
|
1305
1312
|
metadata: e.record(e.string(), e.unknown()).optional()
|
|
1306
1313
|
}, Ft = e.object({
|
|
1307
1314
|
...O,
|
|
1308
|
-
trigger_id:
|
|
1315
|
+
trigger_id: E,
|
|
1309
1316
|
url: e.string()
|
|
1310
1317
|
}), It = e.object({
|
|
1311
1318
|
...O,
|
|
1312
|
-
trigger_id:
|
|
1319
|
+
trigger_id: D,
|
|
1313
1320
|
form_id: e.string()
|
|
1314
1321
|
}), Lt = e.object({
|
|
1315
1322
|
...O,
|
|
1316
|
-
trigger_id:
|
|
1317
|
-
template_id:
|
|
1323
|
+
trigger_id: Mt,
|
|
1324
|
+
template_id: Pt
|
|
1318
1325
|
}), Rt = e.object({
|
|
1319
1326
|
...O,
|
|
1320
|
-
trigger_id:
|
|
1327
|
+
trigger_id: Nt,
|
|
1321
1328
|
code_id: e.string()
|
|
1322
1329
|
});
|
|
1323
1330
|
e.union([
|
|
@@ -1328,25 +1335,25 @@ e.union([
|
|
|
1328
1335
|
]);
|
|
1329
1336
|
var zt = e.object({
|
|
1330
1337
|
...O,
|
|
1331
|
-
trigger_id:
|
|
1338
|
+
trigger_id: E
|
|
1332
1339
|
}).extend(n.shape).extend({
|
|
1333
1340
|
hook_id: e.string(),
|
|
1334
1341
|
url: e.string()
|
|
1335
1342
|
}), Bt = e.object({
|
|
1336
1343
|
...O,
|
|
1337
|
-
trigger_id:
|
|
1344
|
+
trigger_id: D
|
|
1338
1345
|
}).extend(n.shape).extend({
|
|
1339
1346
|
hook_id: e.string(),
|
|
1340
1347
|
form_id: e.string()
|
|
1341
1348
|
}), Vt = e.object({
|
|
1342
1349
|
...O,
|
|
1343
|
-
trigger_id:
|
|
1350
|
+
trigger_id: Mt
|
|
1344
1351
|
}).extend(n.shape).extend({
|
|
1345
1352
|
hook_id: e.string(),
|
|
1346
|
-
template_id:
|
|
1353
|
+
template_id: Pt
|
|
1347
1354
|
}), Ht = e.object({
|
|
1348
1355
|
...O,
|
|
1349
|
-
trigger_id:
|
|
1356
|
+
trigger_id: Nt
|
|
1350
1357
|
}).extend(n.shape).extend({
|
|
1351
1358
|
hook_id: e.string(),
|
|
1352
1359
|
code_id: e.string()
|
|
@@ -2168,6 +2175,7 @@ e.object({
|
|
|
2168
2175
|
universal_login_experience: e.enum(["new", "classic"]).default("new"),
|
|
2169
2176
|
identifier_first: e.boolean().default(!0),
|
|
2170
2177
|
password_first: e.boolean().default(!1),
|
|
2178
|
+
show_last_used_connection: e.boolean().default(!1),
|
|
2171
2179
|
webauthn_platform_first_factor: e.boolean()
|
|
2172
2180
|
});
|
|
2173
2181
|
var wn = e.object({
|
|
@@ -2176,32 +2184,59 @@ var wn = e.object({
|
|
|
2176
2184
|
path: e.string().default("/*"),
|
|
2177
2185
|
headers: e.record(e.string(), e.string()).optional(),
|
|
2178
2186
|
query: e.record(e.string(), e.string()).optional()
|
|
2179
|
-
}),
|
|
2187
|
+
}), j = e.object({
|
|
2180
2188
|
type: e.string(),
|
|
2181
2189
|
options: e.record(e.string(), e.unknown()).default({})
|
|
2182
|
-
}),
|
|
2190
|
+
}), M = e.object({
|
|
2183
2191
|
id: e.string().optional(),
|
|
2184
2192
|
custom_domain_id: e.string(),
|
|
2185
2193
|
priority: e.number().int().default(100),
|
|
2186
2194
|
match: wn,
|
|
2187
|
-
handlers: e.array(
|
|
2188
|
-
}),
|
|
2195
|
+
handlers: e.array(j).min(1)
|
|
2196
|
+
}), Tn = M.extend({
|
|
2189
2197
|
id: e.string(),
|
|
2190
2198
|
tenant_id: e.string(),
|
|
2191
2199
|
created_at: e.string(),
|
|
2192
2200
|
updated_at: e.string()
|
|
2193
|
-
}),
|
|
2201
|
+
}), En = M.partial().omit({
|
|
2194
2202
|
id: !0,
|
|
2195
2203
|
custom_domain_id: !0
|
|
2204
|
+
}), Dn = e.object({
|
|
2205
|
+
scim: e.string(),
|
|
2206
|
+
auth0: e.string()
|
|
2207
|
+
}), On = e.object({
|
|
2208
|
+
connection_id: e.string(),
|
|
2209
|
+
user_id_attribute: e.string().default("externalId"),
|
|
2210
|
+
mapping: e.array(Dn).default([])
|
|
2196
2211
|
});
|
|
2197
2212
|
e.object({
|
|
2213
|
+
created_at: e.string(),
|
|
2214
|
+
updated_at: e.string()
|
|
2215
|
+
}).extend(On.shape);
|
|
2216
|
+
var kn = e.object({
|
|
2217
|
+
token_id: e.string(),
|
|
2218
|
+
connection_id: e.string(),
|
|
2219
|
+
token_hash: e.string(),
|
|
2220
|
+
scopes: e.array(e.string()).default([]),
|
|
2221
|
+
valid_until: e.string().optional()
|
|
2222
|
+
});
|
|
2223
|
+
e.object({
|
|
2224
|
+
created_at: e.string(),
|
|
2225
|
+
last_used_at: e.string().optional()
|
|
2226
|
+
}).extend(kn.shape);
|
|
2227
|
+
var An = e.object({
|
|
2228
|
+
connection_id: e.string(),
|
|
2229
|
+
external_id: e.string(),
|
|
2230
|
+
user_id: e.string()
|
|
2231
|
+
});
|
|
2232
|
+
e.object({ created_at: e.string() }).extend(An.shape), e.object({
|
|
2198
2233
|
name: e.string(),
|
|
2199
2234
|
enabled: e.boolean().optional().default(!0),
|
|
2200
2235
|
default_from_address: e.string().optional(),
|
|
2201
2236
|
credentials: e.record(e.string(), e.unknown()),
|
|
2202
2237
|
settings: e.object({}).optional()
|
|
2203
2238
|
});
|
|
2204
|
-
var
|
|
2239
|
+
var jn = e.enum([
|
|
2205
2240
|
"verify_email",
|
|
2206
2241
|
"verify_email_by_code",
|
|
2207
2242
|
"reset_email",
|
|
@@ -2216,7 +2251,7 @@ var On = e.enum([
|
|
|
2216
2251
|
"user_invitation"
|
|
2217
2252
|
]);
|
|
2218
2253
|
e.object({
|
|
2219
|
-
template:
|
|
2254
|
+
template: jn,
|
|
2220
2255
|
body: e.string(),
|
|
2221
2256
|
from: e.string(),
|
|
2222
2257
|
subject: e.string(),
|
|
@@ -2254,10 +2289,10 @@ e.object({
|
|
|
2254
2289
|
name: e.string(),
|
|
2255
2290
|
options: e.object({})
|
|
2256
2291
|
});
|
|
2257
|
-
var
|
|
2292
|
+
var Mn = e.object({
|
|
2258
2293
|
value: e.string(),
|
|
2259
2294
|
description: e.string().optional()
|
|
2260
|
-
}),
|
|
2295
|
+
}), Nn = e.object({
|
|
2261
2296
|
token_dialect: e.enum(["access_token", "access_token_authz"]).optional(),
|
|
2262
2297
|
enforce_policies: e.boolean().optional(),
|
|
2263
2298
|
allow_skipping_userinfo: e.boolean().optional(),
|
|
@@ -2265,11 +2300,11 @@ var kn = e.object({
|
|
|
2265
2300
|
persist_client_authorization: e.boolean().optional(),
|
|
2266
2301
|
enable_introspection_endpoint: e.boolean().optional(),
|
|
2267
2302
|
mtls: e.object({ bound_access_tokens: e.boolean().optional() }).optional()
|
|
2268
|
-
}),
|
|
2303
|
+
}), Pn = e.object({
|
|
2269
2304
|
id: e.string().optional(),
|
|
2270
2305
|
name: e.string(),
|
|
2271
2306
|
identifier: e.string(),
|
|
2272
|
-
scopes: e.array(
|
|
2307
|
+
scopes: e.array(Mn).optional(),
|
|
2273
2308
|
signing_alg: e.string().optional(),
|
|
2274
2309
|
signing_secret: e.string().optional(),
|
|
2275
2310
|
token_lifetime: e.number().default(86400),
|
|
@@ -2277,20 +2312,20 @@ var kn = e.object({
|
|
|
2277
2312
|
skip_consent_for_verifiable_first_party_clients: e.boolean().optional(),
|
|
2278
2313
|
allow_offline_access: e.boolean().optional(),
|
|
2279
2314
|
verificationKey: e.string().optional(),
|
|
2280
|
-
options:
|
|
2315
|
+
options: Nn.optional(),
|
|
2281
2316
|
is_system: e.boolean().optional(),
|
|
2282
2317
|
metadata: e.record(e.string(), e.any()).optional()
|
|
2283
2318
|
}).extend({
|
|
2284
2319
|
created_at: e.string().optional(),
|
|
2285
2320
|
updated_at: e.string().optional()
|
|
2286
2321
|
});
|
|
2287
|
-
e.array(
|
|
2288
|
-
var
|
|
2322
|
+
e.array(Pn);
|
|
2323
|
+
var Fn = e.object({
|
|
2289
2324
|
role_id: e.string(),
|
|
2290
2325
|
resource_server_identifier: e.string(),
|
|
2291
2326
|
permission_name: e.string()
|
|
2292
2327
|
}).extend({ created_at: e.string() });
|
|
2293
|
-
e.array(
|
|
2328
|
+
e.array(Fn), e.object({
|
|
2294
2329
|
user_id: e.string().openapi({ description: "The id of the user that granted the consent" }),
|
|
2295
2330
|
clientID: e.string().openapi({ description: "The id of the client the grant was issued to" }),
|
|
2296
2331
|
audience: e.string().optional().openapi({ description: "The audience the grant applies to" }),
|
|
@@ -2303,7 +2338,7 @@ e.array(Mn), e.object({
|
|
|
2303
2338
|
failed_logins: e.array(e.string()).optional(),
|
|
2304
2339
|
last_password_reset: e.string().optional()
|
|
2305
2340
|
});
|
|
2306
|
-
var
|
|
2341
|
+
var In = e.object({
|
|
2307
2342
|
user_id: e.string(),
|
|
2308
2343
|
resource_server_identifier: e.string(),
|
|
2309
2344
|
permission_name: e.string(),
|
|
@@ -2312,8 +2347,8 @@ var Nn = e.object({
|
|
|
2312
2347
|
tenant_id: e.string(),
|
|
2313
2348
|
created_at: e.string().optional()
|
|
2314
2349
|
});
|
|
2315
|
-
e.array(
|
|
2316
|
-
var
|
|
2350
|
+
e.array(In);
|
|
2351
|
+
var Ln = e.object({
|
|
2317
2352
|
user_id: e.string(),
|
|
2318
2353
|
resource_server_identifier: e.string(),
|
|
2319
2354
|
resource_server_name: e.string(),
|
|
@@ -2322,8 +2357,8 @@ var Pn = e.object({
|
|
|
2322
2357
|
created_at: e.string().optional(),
|
|
2323
2358
|
organization_id: e.string().optional()
|
|
2324
2359
|
});
|
|
2325
|
-
e.array(
|
|
2326
|
-
var
|
|
2360
|
+
e.array(Ln);
|
|
2361
|
+
var Rn = e.object({
|
|
2327
2362
|
user_id: e.string(),
|
|
2328
2363
|
role_id: e.string(),
|
|
2329
2364
|
organization_id: e.string().optional()
|
|
@@ -2331,8 +2366,8 @@ var Fn = e.object({
|
|
|
2331
2366
|
tenant_id: e.string(),
|
|
2332
2367
|
created_at: e.string().optional()
|
|
2333
2368
|
});
|
|
2334
|
-
e.array(
|
|
2335
|
-
var
|
|
2369
|
+
e.array(Rn);
|
|
2370
|
+
var zn = e.object({
|
|
2336
2371
|
id: e.string().optional().openapi({ description: "The unique identifier of the role. If not provided, one will be generated." }),
|
|
2337
2372
|
name: e.string().min(1).max(50).openapi({ description: "The name of the role. Cannot include '<' or '>'" }),
|
|
2338
2373
|
description: e.string().max(255).optional().openapi({ description: "The description of the role" }),
|
|
@@ -2343,19 +2378,19 @@ var In = e.object({
|
|
|
2343
2378
|
created_at: e.string().optional(),
|
|
2344
2379
|
updated_at: e.string().optional()
|
|
2345
2380
|
});
|
|
2346
|
-
e.array(
|
|
2347
|
-
var
|
|
2381
|
+
e.array(zn);
|
|
2382
|
+
var Bn = e.object({
|
|
2348
2383
|
logo_url: e.string().optional().openapi({ description: "URL of the organization's logo" }),
|
|
2349
2384
|
colors: e.object({
|
|
2350
2385
|
primary: e.string().optional().openapi({ description: "Primary color in hex format (e.g., #FF0000)" }),
|
|
2351
2386
|
page_background: e.string().optional().openapi({ description: "Page background color in hex format (e.g., #FFFFFF)" })
|
|
2352
2387
|
}).optional()
|
|
2353
|
-
}).optional(),
|
|
2388
|
+
}).optional(), Vn = e.object({
|
|
2354
2389
|
connection_id: e.string().openapi({ description: "ID of the connection" }),
|
|
2355
2390
|
assign_membership_on_login: e.boolean().default(!1).openapi({ description: "Whether to assign membership to the organization on login" }),
|
|
2356
2391
|
show_as_button: e.boolean().default(!0).openapi({ description: "Whether to show this connection as a button in the login screen" }),
|
|
2357
2392
|
is_signup_enabled: e.boolean().default(!0).openapi({ description: "Whether signup is enabled for this connection" })
|
|
2358
|
-
}),
|
|
2393
|
+
}), Hn = e.object({ client_credentials: e.object({
|
|
2359
2394
|
enforce: e.boolean().default(!1).openapi({ description: "Whether to enforce token quota limits" }),
|
|
2360
2395
|
per_day: e.number().min(0).default(0).openapi({ description: "Maximum tokens per day (0 = unlimited)" }),
|
|
2361
2396
|
per_hour: e.number().min(0).default(0).openapi({ description: "Maximum tokens per hour (0 = unlimited)" })
|
|
@@ -2364,15 +2399,15 @@ e.object({
|
|
|
2364
2399
|
id: e.string().optional(),
|
|
2365
2400
|
name: e.string().min(1).regex(/^[a-z0-9_-]+$/, { message: "Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores" }).openapi({ description: "The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores." }),
|
|
2366
2401
|
display_name: e.string().optional().openapi({ description: "The display name of the organization" }),
|
|
2367
|
-
branding:
|
|
2402
|
+
branding: Bn,
|
|
2368
2403
|
metadata: e.record(e.string(), e.any()).default({}).optional().openapi({ description: "Custom metadata for the organization" }),
|
|
2369
|
-
enabled_connections: e.array(
|
|
2370
|
-
token_quota:
|
|
2404
|
+
enabled_connections: e.array(Vn).default([]).optional().openapi({ description: "List of enabled connections for the organization" }),
|
|
2405
|
+
token_quota: Hn
|
|
2371
2406
|
}).extend(n.shape).extend({
|
|
2372
2407
|
id: e.string(),
|
|
2373
2408
|
name: e.string().min(1).openapi({ description: "The name of the organization" })
|
|
2374
2409
|
});
|
|
2375
|
-
var
|
|
2410
|
+
var Un = e.object({
|
|
2376
2411
|
connection_id: e.string().openapi({ description: "ID of the tenant-level connection to enable for the org." }),
|
|
2377
2412
|
assign_membership_on_login: e.boolean().optional().default(!1),
|
|
2378
2413
|
show_as_button: e.boolean().optional().default(!0),
|
|
@@ -2385,7 +2420,7 @@ var Bn = e.object({
|
|
|
2385
2420
|
created_at: e.string().optional(),
|
|
2386
2421
|
updated_at: e.string().optional()
|
|
2387
2422
|
});
|
|
2388
|
-
e.array(
|
|
2423
|
+
e.array(Un), e.object({
|
|
2389
2424
|
user_id: e.string().openapi({ description: "ID of the user" }),
|
|
2390
2425
|
organization_id: e.string().openapi({ description: "ID of the organization" })
|
|
2391
2426
|
}).extend(n.shape).extend({ id: e.string() }), e.object({
|
|
@@ -2524,22 +2559,22 @@ e.array(Bn), e.object({
|
|
|
2524
2559
|
"passwordless",
|
|
2525
2560
|
"enterprise"
|
|
2526
2561
|
]);
|
|
2527
|
-
var
|
|
2562
|
+
var Wn = e.object({
|
|
2528
2563
|
name: e.string(),
|
|
2529
2564
|
type: e.string()
|
|
2530
|
-
}),
|
|
2565
|
+
}), Gn = e.object({
|
|
2531
2566
|
elapsed: e.number(),
|
|
2532
2567
|
rows_read: e.number().optional(),
|
|
2533
2568
|
bytes_read: e.number().optional()
|
|
2534
2569
|
});
|
|
2535
2570
|
e.object({
|
|
2536
|
-
meta: e.array(
|
|
2571
|
+
meta: e.array(Wn),
|
|
2537
2572
|
data: e.array(e.record(e.string(), e.any())),
|
|
2538
2573
|
rows: e.number(),
|
|
2539
2574
|
rows_before_limit_at_least: e.number().optional(),
|
|
2540
|
-
statistics:
|
|
2575
|
+
statistics: Gn.optional()
|
|
2541
2576
|
});
|
|
2542
|
-
var
|
|
2577
|
+
var Kn = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.signup-password.reset-password.consent.mfa.mfa-push.mfa-otp.mfa-voice.mfa-phone.mfa-webauthn.mfa-email.mfa-recovery-code.status.device-flow.email-verification.email-otp-challenge.organizations.invitation.common.passkeys.captcha.custom-form.login-passwordless.mfa-login-options".split(".")), qn = e.record(e.string(), e.record(e.string(), e.string())).openapi({
|
|
2543
2578
|
type: "object",
|
|
2544
2579
|
additionalProperties: {
|
|
2545
2580
|
type: "object",
|
|
@@ -2547,11 +2582,11 @@ var Un = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.
|
|
|
2547
2582
|
}
|
|
2548
2583
|
});
|
|
2549
2584
|
e.object({
|
|
2550
|
-
prompt:
|
|
2585
|
+
prompt: Kn,
|
|
2551
2586
|
language: e.string(),
|
|
2552
|
-
custom_text:
|
|
2587
|
+
custom_text: qn
|
|
2553
2588
|
});
|
|
2554
|
-
var
|
|
2589
|
+
var Jn = e.enum([
|
|
2555
2590
|
"phone",
|
|
2556
2591
|
"totp",
|
|
2557
2592
|
"email",
|
|
@@ -2559,9 +2594,9 @@ var Gn = e.enum([
|
|
|
2559
2594
|
"webauthn-roaming",
|
|
2560
2595
|
"webauthn-platform",
|
|
2561
2596
|
"passkey"
|
|
2562
|
-
]),
|
|
2597
|
+
]), N = e.object({
|
|
2563
2598
|
user_id: e.string(),
|
|
2564
|
-
type:
|
|
2599
|
+
type: Jn,
|
|
2565
2600
|
phone_number: e.string().optional(),
|
|
2566
2601
|
totp_secret: e.string().optional(),
|
|
2567
2602
|
credential_id: e.string().optional(),
|
|
@@ -2572,7 +2607,7 @@ var Gn = e.enum([
|
|
|
2572
2607
|
friendly_name: e.string().optional(),
|
|
2573
2608
|
confirmed: e.boolean().default(!1)
|
|
2574
2609
|
});
|
|
2575
|
-
function
|
|
2610
|
+
function P(t, n) {
|
|
2576
2611
|
t.type === "phone" && !t.phone_number && n.addIssue({
|
|
2577
2612
|
code: e.ZodIssueCode.custom,
|
|
2578
2613
|
message: "phone_number is required when type is 'phone'",
|
|
@@ -2595,23 +2630,23 @@ function N(t, n) {
|
|
|
2595
2630
|
path: ["public_key"]
|
|
2596
2631
|
}));
|
|
2597
2632
|
}
|
|
2598
|
-
|
|
2633
|
+
N.superRefine(P), N.extend({
|
|
2599
2634
|
id: e.string(),
|
|
2600
2635
|
created_at: e.string(),
|
|
2601
2636
|
updated_at: e.string()
|
|
2602
|
-
}).superRefine(
|
|
2637
|
+
}).superRefine(P), e.object({
|
|
2603
2638
|
id: e.string().optional(),
|
|
2604
2639
|
created_at: e.string().datetime({ offset: !0 }).optional(),
|
|
2605
2640
|
updated_at: e.string().datetime({ offset: !0 }).optional()
|
|
2606
2641
|
});
|
|
2607
2642
|
//#endregion
|
|
2608
2643
|
//#region src/data-plane/cache.ts
|
|
2609
|
-
var
|
|
2610
|
-
function
|
|
2644
|
+
var Yn = 1e4;
|
|
2645
|
+
function F(e, t, n) {
|
|
2611
2646
|
let r = typeof t == "number" ? {
|
|
2612
2647
|
freshTtlMs: t,
|
|
2613
2648
|
maxEntries: n
|
|
2614
|
-
} : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ??
|
|
2649
|
+
} : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ?? Yn, l = r.waitUntil, u = /* @__PURE__ */ new Map();
|
|
2615
2650
|
function d(e) {
|
|
2616
2651
|
for (let [t, n] of u) n.stale_if_error_until <= e && n.stale_until <= e && !n.refreshing && u.delete(t);
|
|
2617
2652
|
for (; u.size >= c;) {
|
|
@@ -2668,7 +2703,7 @@ function P(e, t, n) {
|
|
|
2668
2703
|
}
|
|
2669
2704
|
//#endregion
|
|
2670
2705
|
//#region src/data-plane/registry.ts
|
|
2671
|
-
var
|
|
2706
|
+
var I = class {
|
|
2672
2707
|
definitions = /* @__PURE__ */ new Map();
|
|
2673
2708
|
bindings;
|
|
2674
2709
|
constructor(e = {}) {
|
|
@@ -2688,38 +2723,38 @@ var F = class {
|
|
|
2688
2723
|
return n.build(r.data, { bindings: this.bindings });
|
|
2689
2724
|
}
|
|
2690
2725
|
};
|
|
2691
|
-
function
|
|
2726
|
+
function L(e) {
|
|
2692
2727
|
return e;
|
|
2693
2728
|
}
|
|
2694
2729
|
//#endregion
|
|
2695
2730
|
//#region src/data-plane/handlers/util.ts
|
|
2696
|
-
var
|
|
2697
|
-
function
|
|
2698
|
-
e.set(
|
|
2699
|
-
}
|
|
2700
|
-
function H(e) {
|
|
2701
|
-
return e.get(L) ?? e.req.raw;
|
|
2731
|
+
var R = "__authhero_proxy_request__", z = "__authhero_proxy_tenant_id__", B = "__authhero_proxy_custom_domain_id__", V = "__authhero_proxy_domain__", H = "x-authhero-proxy-mutability-probe";
|
|
2732
|
+
function Xn(e, t) {
|
|
2733
|
+
e.set(R, t);
|
|
2702
2734
|
}
|
|
2703
|
-
function
|
|
2704
|
-
e.
|
|
2735
|
+
function U(e) {
|
|
2736
|
+
return e.get(R) ?? e.req.raw;
|
|
2705
2737
|
}
|
|
2706
|
-
function
|
|
2707
|
-
|
|
2738
|
+
function Zn(e, t) {
|
|
2739
|
+
e.set(z, t.tenant_id), e.set(B, t.custom_domain_id), e.set(V, t.domain);
|
|
2708
2740
|
}
|
|
2709
|
-
function
|
|
2741
|
+
function Qn(e) {
|
|
2710
2742
|
return e.get(z);
|
|
2711
2743
|
}
|
|
2712
|
-
function
|
|
2744
|
+
function $n(e) {
|
|
2713
2745
|
return e.get(B);
|
|
2714
2746
|
}
|
|
2715
|
-
function
|
|
2716
|
-
|
|
2717
|
-
t(r), qn(e, new Request(n, { headers: r }));
|
|
2747
|
+
function er(e) {
|
|
2748
|
+
return e.get(V);
|
|
2718
2749
|
}
|
|
2719
|
-
function W(e) {
|
|
2750
|
+
function W(e, t) {
|
|
2751
|
+
let n = U(e), r = new Headers(n.headers);
|
|
2752
|
+
t(r), Xn(e, new Request(n, { headers: r }));
|
|
2753
|
+
}
|
|
2754
|
+
function G(e) {
|
|
2720
2755
|
let t = e.res;
|
|
2721
2756
|
try {
|
|
2722
|
-
t.headers.append(
|
|
2757
|
+
t.headers.append(H, "1"), t.headers.delete(H);
|
|
2723
2758
|
return;
|
|
2724
2759
|
} catch {
|
|
2725
2760
|
e.res = new Response(t.body, {
|
|
@@ -2731,7 +2766,7 @@ function W(e) {
|
|
|
2731
2766
|
}
|
|
2732
2767
|
//#endregion
|
|
2733
2768
|
//#region src/data-plane/handlers/cors.ts
|
|
2734
|
-
var
|
|
2769
|
+
var tr = e.object({
|
|
2735
2770
|
origins: e.array(e.string()).optional(),
|
|
2736
2771
|
allow_credentials: e.boolean().optional(),
|
|
2737
2772
|
allow_headers: e.array(e.string()).optional(),
|
|
@@ -2739,44 +2774,44 @@ var Qn = e.object({
|
|
|
2739
2774
|
expose_headers: e.array(e.string()).optional(),
|
|
2740
2775
|
max_age: e.number().int().optional()
|
|
2741
2776
|
}).refine((e) => !(e.allow_credentials && e.origins?.includes("*")), { message: "Cannot use wildcard origin (*) with allow_credentials" });
|
|
2742
|
-
function
|
|
2777
|
+
function nr(e, t) {
|
|
2743
2778
|
let n = new Headers(), r = e.origins ?? ["*"], i = r.includes("*");
|
|
2744
2779
|
return i && !e.allow_credentials ? n.set("Access-Control-Allow-Origin", "*") : t && (i || r.includes(t)) && (n.set("Access-Control-Allow-Origin", t), n.append("Vary", "Origin")), e.allow_credentials && n.set("Access-Control-Allow-Credentials", "true"), e.allow_methods?.length && n.set("Access-Control-Allow-Methods", e.allow_methods.join(", ")), e.allow_headers?.length && n.set("Access-Control-Allow-Headers", e.allow_headers.join(", ")), e.expose_headers?.length && n.set("Access-Control-Expose-Headers", e.expose_headers.join(", ")), e.max_age !== void 0 && n.set("Access-Control-Max-Age", String(e.max_age)), n;
|
|
2745
2780
|
}
|
|
2746
|
-
var
|
|
2781
|
+
var rr = L({
|
|
2747
2782
|
type: "cors",
|
|
2748
|
-
optionsSchema:
|
|
2783
|
+
optionsSchema: tr,
|
|
2749
2784
|
build(e) {
|
|
2750
2785
|
return async (t, n) => {
|
|
2751
2786
|
let r = t.req.header("origin") ?? null;
|
|
2752
2787
|
if (t.req.method === "OPTIONS" && r !== null && t.req.header("access-control-request-method") !== void 0) {
|
|
2753
|
-
let t =
|
|
2788
|
+
let t = nr(e, r);
|
|
2754
2789
|
return new Response(null, {
|
|
2755
2790
|
status: 204,
|
|
2756
2791
|
headers: t
|
|
2757
2792
|
});
|
|
2758
2793
|
}
|
|
2759
2794
|
await n();
|
|
2760
|
-
let i =
|
|
2761
|
-
|
|
2795
|
+
let i = nr(e, r);
|
|
2796
|
+
G(t), i.forEach((e, n) => {
|
|
2762
2797
|
n.toLowerCase() === "vary" ? t.res.headers.append(n, e) : t.res.headers.set(n, e);
|
|
2763
2798
|
});
|
|
2764
2799
|
};
|
|
2765
2800
|
}
|
|
2766
|
-
}),
|
|
2801
|
+
}), ir = e.object({
|
|
2767
2802
|
username: e.string(),
|
|
2768
2803
|
password: e.string(),
|
|
2769
2804
|
realm: e.string().optional()
|
|
2770
2805
|
});
|
|
2771
|
-
function
|
|
2806
|
+
function ar(e, t) {
|
|
2772
2807
|
let n = `${e}:${t}`;
|
|
2773
2808
|
return typeof btoa == "function" ? btoa(n) : Buffer.from(n, "utf-8").toString("base64");
|
|
2774
2809
|
}
|
|
2775
|
-
var
|
|
2810
|
+
var or = L({
|
|
2776
2811
|
type: "basic_auth",
|
|
2777
|
-
optionsSchema:
|
|
2812
|
+
optionsSchema: ir,
|
|
2778
2813
|
build(e) {
|
|
2779
|
-
let t =
|
|
2814
|
+
let t = ar(e.username, e.password), n = (e.realm ?? "Restricted").replace(/["\\\r\n]/g, "");
|
|
2780
2815
|
return async (e, r) => {
|
|
2781
2816
|
let i = e.req.header("authorization");
|
|
2782
2817
|
if (i) {
|
|
@@ -2792,7 +2827,7 @@ var nr = I({
|
|
|
2792
2827
|
});
|
|
2793
2828
|
};
|
|
2794
2829
|
}
|
|
2795
|
-
}),
|
|
2830
|
+
}), sr = L({
|
|
2796
2831
|
type: "headers",
|
|
2797
2832
|
optionsSchema: e.object({
|
|
2798
2833
|
request: e.record(e.string(), e.string()).optional(),
|
|
@@ -2802,23 +2837,23 @@ var nr = I({
|
|
|
2802
2837
|
}),
|
|
2803
2838
|
build(e) {
|
|
2804
2839
|
return async (t, n) => {
|
|
2805
|
-
if ((e.request || e.remove_request) &&
|
|
2840
|
+
if ((e.request || e.remove_request) && W(t, (t) => {
|
|
2806
2841
|
if (e.remove_request?.forEach((e) => t.delete(e)), e.request) for (let [n, r] of Object.entries(e.request)) t.set(n, r);
|
|
2807
|
-
}), await n(), (e.response || e.remove_response) && (
|
|
2842
|
+
}), await n(), (e.response || e.remove_response) && (G(t), e.remove_response?.forEach((e) => t.res.headers.delete(e)), e.response)) for (let [n, r] of Object.entries(e.response)) t.res.headers.set(n, r);
|
|
2808
2843
|
};
|
|
2809
2844
|
}
|
|
2810
|
-
}),
|
|
2845
|
+
}), cr = L({
|
|
2811
2846
|
type: "cache",
|
|
2812
2847
|
optionsSchema: e.object({ ttl_seconds: e.number().int().positive() }),
|
|
2813
2848
|
build(e) {
|
|
2814
2849
|
return async (t, n) => {
|
|
2815
2850
|
if (await n(), !t.res.headers.has("Cache-Control")) {
|
|
2816
2851
|
let n = t.res.headers.has("set-cookie") ? "private" : "public";
|
|
2817
|
-
|
|
2852
|
+
G(t), t.res.headers.set("Cache-Control", `${n}, max-age=${e.ttl_seconds}`);
|
|
2818
2853
|
}
|
|
2819
2854
|
};
|
|
2820
2855
|
}
|
|
2821
|
-
}),
|
|
2856
|
+
}), lr = L({
|
|
2822
2857
|
type: "forwarded_headers",
|
|
2823
2858
|
optionsSchema: e.object({
|
|
2824
2859
|
client_ip_header: e.string().default("cf-connecting-ip"),
|
|
@@ -2828,40 +2863,40 @@ var nr = I({
|
|
|
2828
2863
|
build(e) {
|
|
2829
2864
|
return async (t, n) => {
|
|
2830
2865
|
let r = new URL(t.req.url);
|
|
2831
|
-
|
|
2866
|
+
W(t, (n) => {
|
|
2832
2867
|
n.set("x-forwarded-host", r.host), n.set("x-forwarded-proto", r.protocol.replace(":", "")), e.set_x_original_url && n.set("x-original-url", t.req.url);
|
|
2833
2868
|
let i = n.get(e.client_ip_header), a = (n.get("x-forwarded-for") ?? "").split(",").map((e) => e.trim()).filter(Boolean), o = i ?? a[a.length - 1] ?? "127.0.0.1", s = a.length === 0 || a[a.length - 1] !== o, c = a.length ? s ? `${a.join(", ")}, ${o}` : a.join(", ") : o;
|
|
2834
2869
|
n.set("x-forwarded-for", c), e.set_x_real_ip && n.set("x-real-ip", o);
|
|
2835
2870
|
}), await n();
|
|
2836
2871
|
};
|
|
2837
2872
|
}
|
|
2838
|
-
}),
|
|
2839
|
-
function
|
|
2873
|
+
}), ur = e.object({ upstream_host: e.string().optional() });
|
|
2874
|
+
function dr(e) {
|
|
2840
2875
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2841
2876
|
}
|
|
2842
|
-
function
|
|
2877
|
+
function fr(e) {
|
|
2843
2878
|
if (typeof e.getSetCookie == "function") return e.getSetCookie();
|
|
2844
2879
|
let t = [];
|
|
2845
2880
|
return e.forEach((e, n) => {
|
|
2846
2881
|
n.toLowerCase() === "set-cookie" && t.push(e);
|
|
2847
2882
|
}), t;
|
|
2848
2883
|
}
|
|
2849
|
-
var
|
|
2884
|
+
var pr = L({
|
|
2850
2885
|
type: "rewrite_cookies",
|
|
2851
|
-
optionsSchema:
|
|
2886
|
+
optionsSchema: ur,
|
|
2852
2887
|
build(e) {
|
|
2853
2888
|
return async (t, n) => {
|
|
2854
2889
|
await n();
|
|
2855
2890
|
let r = new URL(t.req.url).hostname, i = e.upstream_host ?? t.get("__proxy_upstream_host__");
|
|
2856
2891
|
if (!i) return;
|
|
2857
|
-
let a =
|
|
2892
|
+
let a = fr(t.res.headers);
|
|
2858
2893
|
if (a.length === 0) return;
|
|
2859
|
-
let o =
|
|
2860
|
-
|
|
2894
|
+
let o = dr(i), s = RegExp(`(?:^|;\\s*)Domain=\\.?${o}(?=;|$)`, "i");
|
|
2895
|
+
G(t), t.res.headers.delete("set-cookie");
|
|
2861
2896
|
for (let e of a) t.res.headers.append("set-cookie", e.replace(s, `Domain=${r}`));
|
|
2862
2897
|
};
|
|
2863
2898
|
}
|
|
2864
|
-
}),
|
|
2899
|
+
}), mr = L({
|
|
2865
2900
|
type: "rewrite_location",
|
|
2866
2901
|
optionsSchema: e.object({ upstream_origin: e.string().optional() }),
|
|
2867
2902
|
build(e) {
|
|
@@ -2881,17 +2916,17 @@ var lr = I({
|
|
|
2881
2916
|
}
|
|
2882
2917
|
if (o.origin !== a) return;
|
|
2883
2918
|
let s = new URL(t.req.url), c = `${`${s.protocol}//${s.host}`}${o.pathname}${o.search}${o.hash}`;
|
|
2884
|
-
|
|
2919
|
+
G(t), t.res.headers.set("location", c);
|
|
2885
2920
|
};
|
|
2886
2921
|
}
|
|
2887
|
-
}),
|
|
2922
|
+
}), hr = class extends Error {
|
|
2888
2923
|
ms;
|
|
2889
2924
|
constructor(e, t) {
|
|
2890
2925
|
super(`${t ?? "Operation"} timed out after ${e}ms`), this.name = "TimeoutError", this.ms = e;
|
|
2891
2926
|
}
|
|
2892
2927
|
};
|
|
2893
2928
|
function K(e) {
|
|
2894
|
-
return e instanceof
|
|
2929
|
+
return e instanceof hr ? !0 : e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
|
|
2895
2930
|
}
|
|
2896
2931
|
function q(e, t) {
|
|
2897
2932
|
let n = new AbortController(), r = setTimeout(() => n.abort(), e);
|
|
@@ -2899,7 +2934,7 @@ function q(e, t) {
|
|
|
2899
2934
|
}
|
|
2900
2935
|
function J(e, t, n) {
|
|
2901
2936
|
let r, i = new Promise((e, i) => {
|
|
2902
|
-
r = setTimeout(() => i(new
|
|
2937
|
+
r = setTimeout(() => i(new hr(t, n)), t);
|
|
2903
2938
|
});
|
|
2904
2939
|
return Promise.race([e, i]).finally(() => {
|
|
2905
2940
|
r && clearTimeout(r);
|
|
@@ -2907,7 +2942,7 @@ function J(e, t, n) {
|
|
|
2907
2942
|
}
|
|
2908
2943
|
//#endregion
|
|
2909
2944
|
//#region src/data-plane/handlers/http.ts
|
|
2910
|
-
var
|
|
2945
|
+
var gr = new Set([
|
|
2911
2946
|
"connection",
|
|
2912
2947
|
"keep-alive",
|
|
2913
2948
|
"proxy-authenticate",
|
|
@@ -2916,24 +2951,24 @@ var fr = new Set([
|
|
|
2916
2951
|
"trailers",
|
|
2917
2952
|
"transfer-encoding",
|
|
2918
2953
|
"upgrade"
|
|
2919
|
-
]),
|
|
2954
|
+
]), _r = 3e4, vr = e.object({
|
|
2920
2955
|
upstream_url: e.string(),
|
|
2921
2956
|
preserve_host: e.boolean().default(!1),
|
|
2922
2957
|
timeout_ms: e.number().int().positive().optional()
|
|
2923
2958
|
});
|
|
2924
|
-
function
|
|
2959
|
+
function yr(e, t) {
|
|
2925
2960
|
return e === "" || e === "/" ? t : `${e.endsWith("/") ? e.slice(0, -1) : e}${t.startsWith("/") ? t : `/${t}`}`;
|
|
2926
2961
|
}
|
|
2927
|
-
function
|
|
2962
|
+
function br(e) {
|
|
2928
2963
|
return e !== "GET" && e !== "HEAD";
|
|
2929
2964
|
}
|
|
2930
|
-
function
|
|
2965
|
+
function xr(e, t) {
|
|
2931
2966
|
let n = new URL(t.url), r = new URL(e.upstream_url);
|
|
2932
|
-
r.pathname =
|
|
2967
|
+
r.pathname = yr(r.pathname, n.pathname), r.search = n.search;
|
|
2933
2968
|
let i = new Headers(t.headers);
|
|
2934
|
-
for (let e of
|
|
2969
|
+
for (let e of gr) i.delete(e);
|
|
2935
2970
|
e.preserve_host || i.set("host", r.host), i.has("x-forwarded-host") || i.set("x-forwarded-host", n.host), i.has("x-forwarded-proto") || i.set("x-forwarded-proto", n.protocol.replace(":", ""));
|
|
2936
|
-
let a =
|
|
2971
|
+
let a = br(t.method) ? t.body : void 0, o = {
|
|
2937
2972
|
method: t.method,
|
|
2938
2973
|
headers: i,
|
|
2939
2974
|
body: a,
|
|
@@ -2944,13 +2979,13 @@ function _r(e, t) {
|
|
|
2944
2979
|
init: o
|
|
2945
2980
|
};
|
|
2946
2981
|
}
|
|
2947
|
-
var
|
|
2982
|
+
var Sr = L({
|
|
2948
2983
|
type: "http",
|
|
2949
|
-
optionsSchema:
|
|
2984
|
+
optionsSchema: vr,
|
|
2950
2985
|
build(e) {
|
|
2951
|
-
let t = e.timeout_ms ??
|
|
2986
|
+
let t = e.timeout_ms ?? _r;
|
|
2952
2987
|
return async (n) => {
|
|
2953
|
-
let { target: r, init: i } =
|
|
2988
|
+
let { target: r, init: i } = xr(e, U(n));
|
|
2954
2989
|
n.set("__proxy_upstream_host__", r.hostname), n.set("__proxy_upstream_origin__", `${r.protocol}//${r.host}`);
|
|
2955
2990
|
try {
|
|
2956
2991
|
return await q(t, (e) => fetch(r.toString(), {
|
|
@@ -2962,24 +2997,24 @@ var vr = I({
|
|
|
2962
2997
|
}
|
|
2963
2998
|
};
|
|
2964
2999
|
}
|
|
2965
|
-
}),
|
|
3000
|
+
}), Cr = 3e4, wr = e.object({
|
|
2966
3001
|
binding: e.string(),
|
|
2967
3002
|
upstream_url: e.string().optional(),
|
|
2968
3003
|
preserve_host: e.boolean().default(!0),
|
|
2969
3004
|
timeout_ms: e.number().int().positive().optional()
|
|
2970
3005
|
});
|
|
2971
|
-
function
|
|
3006
|
+
function Tr(e) {
|
|
2972
3007
|
return typeof e == "object" && !!e && typeof e.fetch == "function";
|
|
2973
3008
|
}
|
|
2974
|
-
var
|
|
3009
|
+
var Er = L({
|
|
2975
3010
|
type: "service_binding",
|
|
2976
|
-
optionsSchema:
|
|
3011
|
+
optionsSchema: wr,
|
|
2977
3012
|
build(e, t) {
|
|
2978
3013
|
let n = t.bindings[e.binding];
|
|
2979
|
-
if (!
|
|
2980
|
-
let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ??
|
|
3014
|
+
if (!Tr(n)) throw Error(`Service binding "${e.binding}" is not configured or is not a Fetcher`);
|
|
3015
|
+
let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ?? Cr;
|
|
2981
3016
|
return async (t) => {
|
|
2982
|
-
let a =
|
|
3017
|
+
let a = U(t), { target: o, init: s } = xr({
|
|
2983
3018
|
upstream_url: r,
|
|
2984
3019
|
preserve_host: e.preserve_host
|
|
2985
3020
|
}, a);
|
|
@@ -2994,34 +3029,34 @@ var Sr = I({
|
|
|
2994
3029
|
}
|
|
2995
3030
|
};
|
|
2996
3031
|
}
|
|
2997
|
-
}),
|
|
3032
|
+
}), Dr = 3e4, Or = e.object({
|
|
2998
3033
|
binding: e.string(),
|
|
2999
3034
|
script_name: e.string(),
|
|
3000
3035
|
cpu_ms: e.number().int().positive().optional(),
|
|
3001
3036
|
subrequests: e.number().int().positive().optional(),
|
|
3002
3037
|
timeout_ms: e.number().int().positive().optional()
|
|
3003
3038
|
});
|
|
3004
|
-
function
|
|
3039
|
+
function kr(e) {
|
|
3005
3040
|
return typeof e == "object" && !!e && typeof e.get == "function";
|
|
3006
3041
|
}
|
|
3007
3042
|
var Y = /\{(tenant_id|custom_domain_id|domain|host)\}/g;
|
|
3008
|
-
function
|
|
3043
|
+
function Ar(e) {
|
|
3009
3044
|
return Y.lastIndex = 0, Y.test(e);
|
|
3010
3045
|
}
|
|
3011
|
-
var
|
|
3046
|
+
var jr = L({
|
|
3012
3047
|
type: "dispatch_namespace",
|
|
3013
|
-
optionsSchema:
|
|
3048
|
+
optionsSchema: Or,
|
|
3014
3049
|
build(e, t) {
|
|
3015
3050
|
let n = t.bindings[e.binding];
|
|
3016
|
-
if (!
|
|
3017
|
-
let r =
|
|
3051
|
+
if (!kr(n)) throw Error(`Dispatch namespace binding "${e.binding}" is not configured or does not expose .get()`);
|
|
3052
|
+
let r = Ar(e.script_name), i = e.timeout_ms ?? Dr, a = e.cpu_ms || e.subrequests ? { limits: {
|
|
3018
3053
|
...e.cpu_ms ? { cpuMs: e.cpu_ms } : {},
|
|
3019
3054
|
...e.subrequests ? { subrequests: e.subrequests } : {}
|
|
3020
3055
|
} } : void 0;
|
|
3021
3056
|
return async (t) => {
|
|
3022
3057
|
let o = e.script_name;
|
|
3023
3058
|
if (r) {
|
|
3024
|
-
let n =
|
|
3059
|
+
let n = Qn(t), r = $n(t), i = er(t), a = t.req.header("host") ?? t.req.header("x-forwarded-host") ?? "";
|
|
3025
3060
|
if (o = o.replace(Y, (e, t) => {
|
|
3026
3061
|
switch (t) {
|
|
3027
3062
|
case "tenant_id": return n ?? "";
|
|
@@ -3032,7 +3067,7 @@ var Dr = I({
|
|
|
3032
3067
|
}
|
|
3033
3068
|
}), o.includes("{") || o === "") return t.text(`dispatch_namespace: could not resolve script name from template "${e.script_name}"`, 500);
|
|
3034
3069
|
}
|
|
3035
|
-
let s =
|
|
3070
|
+
let s = U(t);
|
|
3036
3071
|
try {
|
|
3037
3072
|
let e = n.get(o, void 0, a);
|
|
3038
3073
|
return await q(i, async (t) => {
|
|
@@ -3044,7 +3079,7 @@ var Dr = I({
|
|
|
3044
3079
|
}
|
|
3045
3080
|
};
|
|
3046
3081
|
}
|
|
3047
|
-
}),
|
|
3082
|
+
}), Mr = L({
|
|
3048
3083
|
type: "redirect",
|
|
3049
3084
|
optionsSchema: e.object({
|
|
3050
3085
|
upstream_url: e.string().refine((e) => {
|
|
@@ -3073,7 +3108,7 @@ var Dr = I({
|
|
|
3073
3108
|
});
|
|
3074
3109
|
};
|
|
3075
3110
|
}
|
|
3076
|
-
}),
|
|
3111
|
+
}), X = L({
|
|
3077
3112
|
type: "static",
|
|
3078
3113
|
optionsSchema: e.object({
|
|
3079
3114
|
status: e.number().int().default(200),
|
|
@@ -3093,15 +3128,15 @@ var Dr = I({
|
|
|
3093
3128
|
});
|
|
3094
3129
|
//#endregion
|
|
3095
3130
|
//#region src/data-plane/handlers/index.ts
|
|
3096
|
-
function
|
|
3097
|
-
e.add(
|
|
3131
|
+
function Nr(e) {
|
|
3132
|
+
e.add(rr).add(or).add(sr).add(cr).add(lr).add(pr).add(mr).add(Sr).add(Er).add(jr).add(Mr).add(X);
|
|
3098
3133
|
}
|
|
3099
3134
|
//#endregion
|
|
3100
3135
|
//#region src/data-plane/matcher.ts
|
|
3101
|
-
function
|
|
3136
|
+
function Pr(e) {
|
|
3102
3137
|
return [...e].sort((e, t) => e.priority === t.priority ? e.created_at.localeCompare(t.created_at) : e.priority - t.priority);
|
|
3103
3138
|
}
|
|
3104
|
-
function
|
|
3139
|
+
function Fr(e, t) {
|
|
3105
3140
|
let n = e.toLowerCase(), r = t.toLowerCase();
|
|
3106
3141
|
if (n === r) return !0;
|
|
3107
3142
|
if (n.startsWith("*.")) {
|
|
@@ -3110,13 +3145,13 @@ function jr(e, t) {
|
|
|
3110
3145
|
}
|
|
3111
3146
|
return !1;
|
|
3112
3147
|
}
|
|
3113
|
-
function
|
|
3114
|
-
return !e || e.length === 0 ? !0 : e.some((e) =>
|
|
3148
|
+
function Ir(e, t) {
|
|
3149
|
+
return !e || e.length === 0 ? !0 : e.some((e) => Fr(e, t));
|
|
3115
3150
|
}
|
|
3116
|
-
function
|
|
3151
|
+
function Lr(e) {
|
|
3117
3152
|
let t = (e.headers ? Object.entries(e.headers) : []).map(([e, t]) => [e.toLowerCase(), new RegExp(t)]), n = (e.query ? Object.entries(e.query) : []).map(([e, t]) => [e, new RegExp(t)]), r = e.hosts;
|
|
3118
3153
|
return async (e, i) => {
|
|
3119
|
-
if (r && !
|
|
3154
|
+
if (r && !Ir(r, e.req.header("host") ?? "")) return new Response("No matching route", { status: 404 });
|
|
3120
3155
|
for (let [n, r] of t) {
|
|
3121
3156
|
let t = e.req.header(n);
|
|
3122
3157
|
if (t === void 0 || !r.test(t)) return new Response("No matching route", { status: 404 });
|
|
@@ -3133,7 +3168,7 @@ function Nr(e) {
|
|
|
3133
3168
|
}
|
|
3134
3169
|
//#endregion
|
|
3135
3170
|
//#region src/data-plane/compile.ts
|
|
3136
|
-
var
|
|
3171
|
+
var Rr = [
|
|
3137
3172
|
"GET",
|
|
3138
3173
|
"POST",
|
|
3139
3174
|
"PUT",
|
|
@@ -3145,34 +3180,34 @@ var Pr = [
|
|
|
3145
3180
|
function Z(e, n, r, i) {
|
|
3146
3181
|
let a = new t();
|
|
3147
3182
|
r && a.use("*", async (e, t) => {
|
|
3148
|
-
|
|
3183
|
+
Zn(e, r), await t();
|
|
3149
3184
|
});
|
|
3150
|
-
let o =
|
|
3185
|
+
let o = Pr(e);
|
|
3151
3186
|
for (let e of o) {
|
|
3152
3187
|
let t = [];
|
|
3153
|
-
t.push(
|
|
3188
|
+
t.push(Lr(e.match));
|
|
3154
3189
|
for (let r of e.handlers) t.push(n.build(r.type, r.options));
|
|
3155
|
-
let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) :
|
|
3190
|
+
let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) : Rr, i = e.match.path || "/*";
|
|
3156
3191
|
a.on(r, [i], ...t);
|
|
3157
3192
|
}
|
|
3158
|
-
return i && i.length > 0 ? a.on(
|
|
3193
|
+
return i && i.length > 0 ? a.on(Rr, ["*"], ...i) : a.all("*", (e) => e.text("No matching route", 404)), a.onError((e, t) => {
|
|
3159
3194
|
let n = K(e);
|
|
3160
3195
|
return t.text(n ? "Upstream timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "handler_timeout" : "handler_failed" });
|
|
3161
3196
|
}), a;
|
|
3162
3197
|
}
|
|
3163
3198
|
//#endregion
|
|
3164
3199
|
//#region src/data-plane/router.ts
|
|
3165
|
-
var
|
|
3166
|
-
function
|
|
3167
|
-
return e.resolver ? e.resolver : e.cache ?
|
|
3200
|
+
var zr = 1e4;
|
|
3201
|
+
function Br(e) {
|
|
3202
|
+
return e.resolver ? e.resolver : e.cache ? F(e.data, e.cache) : F(e.data, e.cacheTtlMs ?? 3e4);
|
|
3168
3203
|
}
|
|
3169
|
-
function
|
|
3204
|
+
function Vr(e) {
|
|
3170
3205
|
if (e.registry) return e.registry;
|
|
3171
|
-
let t = new
|
|
3172
|
-
return
|
|
3206
|
+
let t = new I(e.bindings ?? {});
|
|
3207
|
+
return Nr(t), t;
|
|
3173
3208
|
}
|
|
3174
3209
|
function Q(e) {
|
|
3175
|
-
let t =
|
|
3210
|
+
let t = Br(e), n = Vr(e), r = /* @__PURE__ */ new WeakMap(), i = e.resolveHostTimeoutMs ?? zr, a = e.defaultHandlers && e.defaultHandlers.length > 0 ? e.defaultHandlers.map((e) => n.build(e.type, e.options)) : void 0, o = a ? Z([], n, void 0, a) : void 0;
|
|
3176
3211
|
return async (e) => {
|
|
3177
3212
|
let s = e.req.header("host") ?? e.req.header("x-forwarded-host");
|
|
3178
3213
|
if (!s) return e.text("Missing host", 400);
|
|
@@ -3190,13 +3225,13 @@ function Q(e) {
|
|
|
3190
3225
|
}
|
|
3191
3226
|
};
|
|
3192
3227
|
}
|
|
3193
|
-
function
|
|
3228
|
+
function Hr(e) {
|
|
3194
3229
|
let n = new t();
|
|
3195
3230
|
return n.all("*", Q(e)), n;
|
|
3196
3231
|
}
|
|
3197
3232
|
//#endregion
|
|
3198
3233
|
//#region src/app.ts
|
|
3199
|
-
function
|
|
3234
|
+
function Ur(e) {
|
|
3200
3235
|
let n = new t();
|
|
3201
3236
|
return n.all("*", Q({
|
|
3202
3237
|
data: e.data,
|
|
@@ -3214,17 +3249,17 @@ function zr(e) {
|
|
|
3214
3249
|
}
|
|
3215
3250
|
//#endregion
|
|
3216
3251
|
//#region src/data-plane/cache-api-cache.ts
|
|
3217
|
-
var
|
|
3218
|
-
function
|
|
3252
|
+
var Wr = 1e3, Gr = 1e3;
|
|
3253
|
+
function Kr(e, t) {
|
|
3219
3254
|
return new Request(`https://proxy-cache.internal/${encodeURIComponent(e)}/hosts/${encodeURIComponent(t.toLowerCase())}`, { method: "GET" });
|
|
3220
3255
|
}
|
|
3221
|
-
function
|
|
3256
|
+
function qr() {
|
|
3222
3257
|
return globalThis.caches?.default;
|
|
3223
3258
|
}
|
|
3224
|
-
function
|
|
3225
|
-
let t = e.cache ??
|
|
3259
|
+
function Jr(e) {
|
|
3260
|
+
let t = e.cache ?? qr();
|
|
3226
3261
|
if (!t) return e.upstream;
|
|
3227
|
-
let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ??
|
|
3262
|
+
let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ?? Wr, c = e.cacheWriteTimeoutMs ?? Gr;
|
|
3228
3263
|
async function l(e) {
|
|
3229
3264
|
try {
|
|
3230
3265
|
return await J(Promise.resolve(n.match(e)), s, "cache.match");
|
|
@@ -3233,7 +3268,7 @@ function Wr(e) {
|
|
|
3233
3268
|
}
|
|
3234
3269
|
}
|
|
3235
3270
|
return { async resolveHost(t) {
|
|
3236
|
-
let s =
|
|
3271
|
+
let s = Kr(r, t), u = await l(s);
|
|
3237
3272
|
if (u) try {
|
|
3238
3273
|
return (await u.json()).value;
|
|
3239
3274
|
} catch {}
|
|
@@ -3244,14 +3279,14 @@ function Wr(e) {
|
|
|
3244
3279
|
return o ? o(m) : await m, d;
|
|
3245
3280
|
} };
|
|
3246
3281
|
}
|
|
3247
|
-
function
|
|
3248
|
-
return
|
|
3282
|
+
function Yr(e, t) {
|
|
3283
|
+
return Kr(e, t);
|
|
3249
3284
|
}
|
|
3250
3285
|
//#endregion
|
|
3251
3286
|
//#region src/data-plane/cache-adapter-cache.ts
|
|
3252
|
-
var
|
|
3253
|
-
function
|
|
3254
|
-
let { upstream: t, cache: n, freshTtlMs: r, staleTtlMs: i = 0, staleIfErrorTtlMs: a = 0, negativeTtlMs: o = r, keyPrefix: s = "authhero-proxy-host", waitUntil: c, cacheReadTimeoutMs: l =
|
|
3287
|
+
var Xr = 1e3, Zr = 1e3;
|
|
3288
|
+
function Qr(e) {
|
|
3289
|
+
let { upstream: t, cache: n, freshTtlMs: r, staleTtlMs: i = 0, staleIfErrorTtlMs: a = 0, negativeTtlMs: o = r, keyPrefix: s = "authhero-proxy-host", waitUntil: c, cacheReadTimeoutMs: l = Xr, cacheWriteTimeoutMs: u = Zr } = e, d = /* @__PURE__ */ new Map();
|
|
3255
3290
|
function f(e) {
|
|
3256
3291
|
return `${s}:${e.toLowerCase()}`;
|
|
3257
3292
|
}
|
|
@@ -3304,7 +3339,7 @@ function Jr(e) {
|
|
|
3304
3339
|
}
|
|
3305
3340
|
} };
|
|
3306
3341
|
}
|
|
3307
|
-
function
|
|
3342
|
+
function $r(e, t) {
|
|
3308
3343
|
return `${e}:${t.toLowerCase()}`;
|
|
3309
3344
|
}
|
|
3310
3345
|
//#endregion
|
|
@@ -3312,7 +3347,7 @@ function Yr(e, t) {
|
|
|
3312
3347
|
function $() {
|
|
3313
3348
|
throw Error("Static proxy adapter is read-only; configure routes at init time");
|
|
3314
3349
|
}
|
|
3315
|
-
function
|
|
3350
|
+
function ei(e, t, n, r, i, a) {
|
|
3316
3351
|
return {
|
|
3317
3352
|
id: e.id ?? `${n}:${t}`,
|
|
3318
3353
|
tenant_id: r,
|
|
@@ -3327,10 +3362,10 @@ function Xr(e, t, n, r, i, a) {
|
|
|
3327
3362
|
updated_at: e.updated_at ?? a
|
|
3328
3363
|
};
|
|
3329
3364
|
}
|
|
3330
|
-
function
|
|
3365
|
+
function ti(e) {
|
|
3331
3366
|
let t = (/* @__PURE__ */ new Date()).toISOString(), n = e.defaultTenantId ?? "static", r = /* @__PURE__ */ new Map();
|
|
3332
3367
|
for (let [i, a] of Object.entries(e.hosts)) {
|
|
3333
|
-
let e = i.toLowerCase(), o = Array.isArray(a) ? { routes: a } : a, s = o.tenant_id ?? n, c = o.custom_domain_id ?? e, l = o.routes.map((n, r) =>
|
|
3368
|
+
let e = i.toLowerCase(), o = Array.isArray(a) ? { routes: a } : a, s = o.tenant_id ?? n, c = o.custom_domain_id ?? e, l = o.routes.map((n, r) => ei(n, r, e, s, c, t)).sort((e, t) => e.priority - t.priority);
|
|
3334
3369
|
r.set(e, {
|
|
3335
3370
|
tenant_id: s,
|
|
3336
3371
|
custom_domain_id: c,
|
|
@@ -3374,7 +3409,7 @@ function Zr(e) {
|
|
|
3374
3409
|
}
|
|
3375
3410
|
};
|
|
3376
3411
|
}
|
|
3377
|
-
function
|
|
3412
|
+
function ni(e, t = {}) {
|
|
3378
3413
|
return {
|
|
3379
3414
|
priority: t.priority,
|
|
3380
3415
|
match: { path: t.path ?? "/*" },
|
|
@@ -3389,10 +3424,10 @@ function Qr(e, t = {}) {
|
|
|
3389
3424
|
}
|
|
3390
3425
|
//#endregion
|
|
3391
3426
|
//#region src/constants.ts
|
|
3392
|
-
var
|
|
3427
|
+
var ri = "proxy:resolve_host";
|
|
3393
3428
|
//#endregion
|
|
3394
3429
|
//#region src/http-adapter/index.ts
|
|
3395
|
-
function
|
|
3430
|
+
function ii() {
|
|
3396
3431
|
let e = () => {
|
|
3397
3432
|
throw Error("HTTP proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
|
|
3398
3433
|
};
|
|
@@ -3414,7 +3449,7 @@ function ei() {
|
|
|
3414
3449
|
}
|
|
3415
3450
|
};
|
|
3416
3451
|
}
|
|
3417
|
-
function
|
|
3452
|
+
function ai(e) {
|
|
3418
3453
|
let t = e.fetch ?? fetch, n = e.baseUrl.replace(/\/+$/, ""), r = e.resolveHostPath ?? "/api/v2/proxy/control-plane/hosts/", i = e.audience ?? `${n}/api/v2/`, a = e.scope ?? "proxy:resolve_host", o = e.tokenRefreshSkewSeconds ?? 60, s = e.timeoutMs ?? 2500;
|
|
3419
3454
|
function c(e) {
|
|
3420
3455
|
let t = new AbortController(), n = setTimeout(() => t.abort(), s);
|
|
@@ -3447,7 +3482,7 @@ function ti(e) {
|
|
|
3447
3482
|
}), u);
|
|
3448
3483
|
}
|
|
3449
3484
|
return {
|
|
3450
|
-
proxyRoutes:
|
|
3485
|
+
proxyRoutes: ii(),
|
|
3451
3486
|
async resolveHost(e) {
|
|
3452
3487
|
let i = await f(), a = `${n}${r}${encodeURIComponent(e.toLowerCase())}`, o = await c((e) => t(a, {
|
|
3453
3488
|
headers: { authorization: `Bearer ${i}` },
|
|
@@ -3461,7 +3496,7 @@ function ti(e) {
|
|
|
3461
3496
|
}
|
|
3462
3497
|
//#endregion
|
|
3463
3498
|
//#region src/http-adapter/service-binding-fetch.ts
|
|
3464
|
-
function
|
|
3499
|
+
function oi(e) {
|
|
3465
3500
|
return (t, n) => {
|
|
3466
3501
|
let r = t instanceof Request && n === void 0 ? t : new Request(t, n);
|
|
3467
3502
|
return e.fetch(r);
|
|
@@ -3469,11 +3504,11 @@ function ni(e) {
|
|
|
3469
3504
|
}
|
|
3470
3505
|
//#endregion
|
|
3471
3506
|
//#region src/kv-adapter/index.ts
|
|
3472
|
-
var
|
|
3473
|
-
function
|
|
3507
|
+
var si = "authhero-proxy-host:";
|
|
3508
|
+
function ci(e, t) {
|
|
3474
3509
|
return `${e}${t.toLowerCase()}`;
|
|
3475
3510
|
}
|
|
3476
|
-
function
|
|
3511
|
+
function li() {
|
|
3477
3512
|
let e = () => {
|
|
3478
3513
|
throw Error("KV proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
|
|
3479
3514
|
};
|
|
@@ -3495,15 +3530,15 @@ function ai() {
|
|
|
3495
3530
|
}
|
|
3496
3531
|
};
|
|
3497
3532
|
}
|
|
3498
|
-
function
|
|
3499
|
-
let { kv: t, keyPrefix: n =
|
|
3533
|
+
function ui(e) {
|
|
3534
|
+
let { kv: t, keyPrefix: n = si, timeoutMs: r } = e;
|
|
3500
3535
|
return {
|
|
3501
|
-
proxyRoutes:
|
|
3536
|
+
proxyRoutes: li(),
|
|
3502
3537
|
async resolveHost(e) {
|
|
3503
|
-
let i =
|
|
3538
|
+
let i = ci(n, e), a = t.get(i, "json");
|
|
3504
3539
|
return (r && r > 0 ? await J(a, r, "kv.get") : await a) ?? null;
|
|
3505
3540
|
}
|
|
3506
3541
|
};
|
|
3507
3542
|
}
|
|
3508
3543
|
//#endregion
|
|
3509
|
-
export {
|
|
3544
|
+
export { si as DEFAULT_KV_HOST_KEY_PREFIX, I as HandlerRegistry, ri as PROXY_RESOLVE_HOST_SCOPE, or as basicAuthHandler, $r as buildCacheAdapterKey, Yr as buildCacheApiKey, ci as buildKvHostKey, Lr as buildMatchFilter, cr as cacheHandler, Z as compileHostApp, rr as corsHandler, Qr as createCacheAdapterHostCache, Jr as createCacheApiHostCache, ai as createHttpProxyAdapter, F as createInMemoryHostCache, ui as createKvProxyAdapter, Ur as createProxyApp, Q as createProxyDataPlaneHandler, Hr as createProxyDataPlaneRouter, oi as createServiceBindingFetch, ti as createStaticProxyAdapter, L as defineHandler, jr as dispatchNamespaceHandler, lr as forwardedHeadersHandler, j as handlerConfigSchema, sr as headersHandler, Sr as httpHandler, ni as httpRoute, wn as matchSchema, Ir as matchesAnyHost, Fr as matchesHost, M as proxyRouteInsertSchema, Tn as proxyRouteSchema, En as proxyRouteUpdateSchema, Mr as redirectHandler, Nr as registerBuiltinHandlers, pr as rewriteCookiesHandler, mr as rewriteLocationHandler, Er as serviceBindingHandler, Pr as sortRoutes, X as staticHandler };
|