@authhero/proxy 0.10.5 → 0.10.7
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/README.md +7 -1
- package/dist/proxy.cjs +1 -1
- package/dist/proxy.d.ts +42 -3
- package/dist/proxy.mjs +395 -278
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/data-plane/cloudflare-ips.d.ts +11 -0
- package/dist/types/data-plane/compile.d.ts +33 -1
- package/dist/types/data-plane/handlers/forwarded-headers.d.ts +1 -0
- package/dist/types/index.d.ts +3 -1
- package/package.json +2 -2
package/dist/proxy.mjs
CHANGED
|
@@ -617,22 +617,22 @@ e.object({
|
|
|
617
617
|
});
|
|
618
618
|
var Ie = /* @__PURE__ */ function(e) {
|
|
619
619
|
return e.TOKEN = "token", e.ID_TOKEN = "id_token", e.TOKEN_ID_TOKEN = "id_token token", e.CODE = "code", e.CODE_ID_TOKEN = "code id_token", e.CODE_TOKEN = "code token", e.CODE_ID_TOKEN_TOKEN = "code id_token token", e;
|
|
620
|
-
}({}),
|
|
620
|
+
}({}), v = /* @__PURE__ */ function(e) {
|
|
621
621
|
return e.QUERY = "query", e.FRAGMENT = "fragment", e.FORM_POST = "form_post", e.WEB_MESSAGE = "web_message", e.SAML_POST = "saml_post", e;
|
|
622
|
-
}({}),
|
|
622
|
+
}({}), Le = /* @__PURE__ */ function(e) {
|
|
623
623
|
return e.S256 = "S256", e.Plain = "plain", e;
|
|
624
|
-
}({}),
|
|
624
|
+
}({}), y = e.union([e.null(), e.object({
|
|
625
625
|
essential: e.boolean().optional(),
|
|
626
626
|
value: e.unknown().optional(),
|
|
627
627
|
values: e.array(e.unknown()).optional()
|
|
628
|
-
})]).nullable(),
|
|
629
|
-
userinfo: e.record(e.string(),
|
|
630
|
-
id_token: e.record(e.string(),
|
|
631
|
-
}),
|
|
628
|
+
})]).nullable(), Re = e.object({
|
|
629
|
+
userinfo: e.record(e.string(), y).optional(),
|
|
630
|
+
id_token: e.record(e.string(), y).optional()
|
|
631
|
+
}), ze = e.object({
|
|
632
632
|
client_id: e.string(),
|
|
633
633
|
act_as: e.string().optional(),
|
|
634
634
|
response_type: e.nativeEnum(Ie).optional(),
|
|
635
|
-
response_mode: e.nativeEnum(
|
|
635
|
+
response_mode: e.nativeEnum(v).optional(),
|
|
636
636
|
redirect_uri: e.string().optional(),
|
|
637
637
|
audience: e.string().optional(),
|
|
638
638
|
organization: e.string().optional(),
|
|
@@ -640,13 +640,13 @@ var Ie = /* @__PURE__ */ function(e) {
|
|
|
640
640
|
nonce: e.string().optional(),
|
|
641
641
|
scope: e.string().optional(),
|
|
642
642
|
prompt: e.string().optional(),
|
|
643
|
-
code_challenge_method: e.nativeEnum(
|
|
643
|
+
code_challenge_method: e.nativeEnum(Le).optional(),
|
|
644
644
|
code_challenge: e.string().optional(),
|
|
645
645
|
username: e.string().optional(),
|
|
646
646
|
ui_locales: e.string().optional(),
|
|
647
647
|
max_age: e.number().optional(),
|
|
648
648
|
acr_values: e.string().optional(),
|
|
649
|
-
claims:
|
|
649
|
+
claims: Re.optional(),
|
|
650
650
|
vendor_id: e.string().optional()
|
|
651
651
|
});
|
|
652
652
|
e.object({
|
|
@@ -669,7 +669,7 @@ e.object({
|
|
|
669
669
|
"auto"
|
|
670
670
|
]).optional()
|
|
671
671
|
});
|
|
672
|
-
var
|
|
672
|
+
var Be = e.enum([
|
|
673
673
|
"password_reset",
|
|
674
674
|
"email_verification",
|
|
675
675
|
"otp",
|
|
@@ -682,7 +682,7 @@ e.object({
|
|
|
682
682
|
code_id: e.string().openapi({ description: "The code that will be used in for instance an email verification flow" }),
|
|
683
683
|
login_id: e.string().openapi({ description: "The id of the login session that the code is connected to" }),
|
|
684
684
|
connection_id: e.string().optional().openapi({ description: "The connection that the code is connected to" }),
|
|
685
|
-
code_type:
|
|
685
|
+
code_type: Be,
|
|
686
686
|
code_verifier: e.string().optional().openapi({ description: "The code verifier used in PKCE in outbound flows" }),
|
|
687
687
|
code_challenge: e.string().optional().openapi({ description: "The code challenge used in PKCE in outbound flows" }),
|
|
688
688
|
code_challenge_method: e.enum(["plain", "S256"]).optional().openapi({ description: "The code challenge method used in PKCE in outbound flows" }),
|
|
@@ -694,7 +694,7 @@ e.object({
|
|
|
694
694
|
used_at: e.string().optional(),
|
|
695
695
|
user_id: e.string().optional()
|
|
696
696
|
}).extend({ created_at: e.string() });
|
|
697
|
-
var
|
|
697
|
+
var Ve = e.object({
|
|
698
698
|
kid: e.string().optional(),
|
|
699
699
|
team_id: e.string().optional(),
|
|
700
700
|
realms: e.string().optional(),
|
|
@@ -814,26 +814,26 @@ var Ue = e.object({
|
|
|
814
814
|
"never_on_login"
|
|
815
815
|
]).optional()
|
|
816
816
|
});
|
|
817
|
-
function
|
|
817
|
+
function b(e) {
|
|
818
818
|
if (e !== null) {
|
|
819
|
-
if (Array.isArray(e)) return e.filter((e) => e !== null).map(
|
|
819
|
+
if (Array.isArray(e)) return e.filter((e) => e !== null).map(b);
|
|
820
820
|
if (e && typeof e == "object") {
|
|
821
821
|
let t = {};
|
|
822
|
-
for (let [n, r] of Object.entries(e)) r !== null && (t[n] =
|
|
822
|
+
for (let [n, r] of Object.entries(e)) r !== null && (t[n] = b(r));
|
|
823
823
|
return t;
|
|
824
824
|
}
|
|
825
825
|
return e;
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
|
-
var
|
|
828
|
+
var He = e.object({
|
|
829
829
|
id: e.string().optional(),
|
|
830
830
|
name: e.string(),
|
|
831
831
|
display_name: e.string().optional(),
|
|
832
832
|
strategy: e.string(),
|
|
833
|
-
options: e.preprocess((e) => e === null ? {} :
|
|
833
|
+
options: e.preprocess((e) => e === null ? {} : b(e), Ve).default({}),
|
|
834
834
|
enabled_clients: e.array(e.string()).default([]).optional(),
|
|
835
835
|
response_type: e.nativeEnum(Ie).optional(),
|
|
836
|
-
response_mode: e.nativeEnum(
|
|
836
|
+
response_mode: e.nativeEnum(v).optional(),
|
|
837
837
|
is_domain_connection: e.boolean().optional(),
|
|
838
838
|
show_as_button: e.boolean().optional(),
|
|
839
839
|
metadata: e.record(e.string(), e.any()).optional(),
|
|
@@ -843,8 +843,8 @@ e.object({
|
|
|
843
843
|
id: e.string(),
|
|
844
844
|
created_at: e.string().transform((e) => e === null ? "" : e),
|
|
845
845
|
updated_at: e.string().transform((e) => e === null ? "" : e)
|
|
846
|
-
}).extend(
|
|
847
|
-
var
|
|
846
|
+
}).extend(He.shape);
|
|
847
|
+
var Ue = e.object({
|
|
848
848
|
domain: e.string(),
|
|
849
849
|
custom_domain_id: e.string().optional(),
|
|
850
850
|
type: e.enum(["auth0_managed_certs", "self_managed_certs"]),
|
|
@@ -858,7 +858,7 @@ var Ge = e.object({
|
|
|
858
858
|
"null"
|
|
859
859
|
]).optional(),
|
|
860
860
|
domain_metadata: e.record(e.string(), e.string().max(255)).optional()
|
|
861
|
-
}),
|
|
861
|
+
}), We = e.discriminatedUnion("name", [e.object({
|
|
862
862
|
name: e.literal("txt"),
|
|
863
863
|
record: e.string(),
|
|
864
864
|
domain: e.string()
|
|
@@ -866,7 +866,7 @@ var Ge = e.object({
|
|
|
866
866
|
name: e.literal("http"),
|
|
867
867
|
http_body: e.string(),
|
|
868
868
|
http_url: e.string()
|
|
869
|
-
})]),
|
|
869
|
+
})]), Ge = Ue.extend({
|
|
870
870
|
custom_domain_id: e.string(),
|
|
871
871
|
primary: e.boolean(),
|
|
872
872
|
status: e.enum([
|
|
@@ -876,28 +876,28 @@ var Ge = e.object({
|
|
|
876
876
|
"ready"
|
|
877
877
|
]),
|
|
878
878
|
origin_domain_name: e.string().optional(),
|
|
879
|
-
verification: e.object({ methods: e.array(
|
|
879
|
+
verification: e.object({ methods: e.array(We) }).optional(),
|
|
880
880
|
tls_policy: e.string().optional()
|
|
881
881
|
});
|
|
882
|
-
|
|
882
|
+
Ue.pick({
|
|
883
883
|
tls_policy: !0,
|
|
884
884
|
custom_client_ip_header: !0,
|
|
885
885
|
domain_metadata: !0
|
|
886
|
-
}).strict(),
|
|
886
|
+
}).strict(), Ge.extend({ tenant_id: e.string() }), e.object({
|
|
887
887
|
certificate: e.string().regex(/^-----BEGIN CERTIFICATE-----[\s\S]+-----END CERTIFICATE-----\s*$/, "must be PEM-encoded; include the full certificate chain in leaf-first order"),
|
|
888
888
|
private_key: e.string().regex(/-----BEGIN (RSA |EC |ENCRYPTED )?PRIVATE KEY-----[\s\S]+-----END \1PRIVATE KEY-----\s*$/, "must be a PEM-encoded private key")
|
|
889
889
|
});
|
|
890
|
-
var
|
|
890
|
+
var x = e.object({
|
|
891
891
|
id: e.string(),
|
|
892
892
|
order: e.number().optional(),
|
|
893
893
|
visible: e.boolean().optional().default(!0)
|
|
894
|
-
}),
|
|
894
|
+
}), S = x.extend({ category: e.literal("BLOCK").optional() }), Ke = S.extend({
|
|
895
895
|
type: e.literal("DIVIDER"),
|
|
896
896
|
config: e.object({ text: e.string().optional() }).optional()
|
|
897
|
-
}),
|
|
897
|
+
}), qe = S.extend({
|
|
898
898
|
type: e.literal("HTML"),
|
|
899
899
|
config: e.object({ content: e.string().optional() }).optional()
|
|
900
|
-
}),
|
|
900
|
+
}), Je = S.extend({
|
|
901
901
|
type: e.literal("IMAGE"),
|
|
902
902
|
config: e.object({
|
|
903
903
|
src: e.string().optional(),
|
|
@@ -905,43 +905,43 @@ var y = e.object({
|
|
|
905
905
|
width: e.number().optional(),
|
|
906
906
|
height: e.number().optional()
|
|
907
907
|
}).optional()
|
|
908
|
-
}),
|
|
908
|
+
}), Ye = S.extend({
|
|
909
909
|
type: e.literal("JUMP_BUTTON"),
|
|
910
910
|
config: e.object({
|
|
911
911
|
text: e.string().optional(),
|
|
912
912
|
target_step: e.string().optional()
|
|
913
913
|
})
|
|
914
|
-
}),
|
|
914
|
+
}), Xe = S.extend({
|
|
915
915
|
type: e.literal("RESEND_BUTTON"),
|
|
916
916
|
config: e.object({
|
|
917
917
|
text: e.string().optional(),
|
|
918
918
|
resend_action: e.string().optional()
|
|
919
919
|
})
|
|
920
|
-
}),
|
|
920
|
+
}), Ze = S.extend({
|
|
921
921
|
type: e.literal("NEXT_BUTTON"),
|
|
922
922
|
config: e.object({ text: e.string().optional() })
|
|
923
|
-
}),
|
|
923
|
+
}), Qe = S.extend({
|
|
924
924
|
type: e.literal("PREVIOUS_BUTTON"),
|
|
925
925
|
config: e.object({ text: e.string().optional() })
|
|
926
|
-
}),
|
|
926
|
+
}), $e = S.extend({
|
|
927
927
|
type: e.literal("RICH_TEXT"),
|
|
928
928
|
config: e.object({ content: e.string().optional() }).optional()
|
|
929
|
-
}),
|
|
929
|
+
}), C = x.extend({
|
|
930
930
|
category: e.literal("WIDGET").optional(),
|
|
931
931
|
label: e.string().min(1).optional(),
|
|
932
932
|
hint: e.string().min(1).max(500).optional(),
|
|
933
933
|
required: e.boolean().optional(),
|
|
934
934
|
sensitive: e.boolean().optional()
|
|
935
|
-
}),
|
|
935
|
+
}), et = C.extend({
|
|
936
936
|
type: e.literal("AUTH0_VERIFIABLE_CREDENTIALS"),
|
|
937
937
|
config: e.object({ credential_type: e.string().optional() })
|
|
938
|
-
}),
|
|
938
|
+
}), tt = C.extend({
|
|
939
939
|
type: e.literal("GMAPS_ADDRESS"),
|
|
940
940
|
config: e.object({ api_key: e.string().optional() })
|
|
941
|
-
}),
|
|
941
|
+
}), nt = C.extend({
|
|
942
942
|
type: e.literal("RECAPTCHA"),
|
|
943
943
|
config: e.object({ site_key: e.string().optional() })
|
|
944
|
-
}),
|
|
944
|
+
}), w = x.extend({
|
|
945
945
|
category: e.literal("FIELD").optional(),
|
|
946
946
|
label: e.string().min(1).optional(),
|
|
947
947
|
hint: e.string().min(1).max(500).optional(),
|
|
@@ -957,10 +957,10 @@ var y = e.object({
|
|
|
957
957
|
})).optional(),
|
|
958
958
|
required: e.boolean().optional(),
|
|
959
959
|
sensitive: e.boolean().optional()
|
|
960
|
-
}),
|
|
960
|
+
}), rt = w.extend({
|
|
961
961
|
type: e.literal("BOOLEAN"),
|
|
962
962
|
config: e.object({ default_value: e.boolean().optional() }).optional()
|
|
963
|
-
}),
|
|
963
|
+
}), it = w.extend({
|
|
964
964
|
type: e.literal("CARDS"),
|
|
965
965
|
config: e.object({
|
|
966
966
|
options: e.array(e.object({
|
|
@@ -971,7 +971,7 @@ var y = e.object({
|
|
|
971
971
|
})).optional(),
|
|
972
972
|
multi_select: e.boolean().optional()
|
|
973
973
|
}).optional()
|
|
974
|
-
}),
|
|
974
|
+
}), at = w.extend({
|
|
975
975
|
type: e.literal("CHOICE"),
|
|
976
976
|
config: e.object({
|
|
977
977
|
options: e.array(e.object({
|
|
@@ -982,7 +982,7 @@ var y = e.object({
|
|
|
982
982
|
multiple: e.boolean().optional(),
|
|
983
983
|
default_value: e.union([e.string(), e.array(e.string())]).optional()
|
|
984
984
|
}).optional()
|
|
985
|
-
}),
|
|
985
|
+
}), ot = w.extend({
|
|
986
986
|
type: e.literal("CODE"),
|
|
987
987
|
config: e.object({
|
|
988
988
|
length: e.number().int().positive().max(100).optional(),
|
|
@@ -999,7 +999,7 @@ var y = e.object({
|
|
|
999
999
|
message: "default_value is longer than the configured length",
|
|
1000
1000
|
path: ["default_value"]
|
|
1001
1001
|
}).optional()
|
|
1002
|
-
}),
|
|
1002
|
+
}), st = w.extend({
|
|
1003
1003
|
type: e.literal("CUSTOM"),
|
|
1004
1004
|
config: e.object({
|
|
1005
1005
|
component: e.string().optional(),
|
|
@@ -1007,7 +1007,7 @@ var y = e.object({
|
|
|
1007
1007
|
schema: e.record(e.string(), e.any()).optional(),
|
|
1008
1008
|
code: e.string().optional()
|
|
1009
1009
|
})
|
|
1010
|
-
}),
|
|
1010
|
+
}), ct = w.extend({
|
|
1011
1011
|
type: e.literal("DATE"),
|
|
1012
1012
|
config: e.object({
|
|
1013
1013
|
format: e.string().optional(),
|
|
@@ -1015,7 +1015,7 @@ var y = e.object({
|
|
|
1015
1015
|
max: e.string().optional(),
|
|
1016
1016
|
default_value: e.string().optional()
|
|
1017
1017
|
}).optional()
|
|
1018
|
-
}),
|
|
1018
|
+
}), lt = w.extend({
|
|
1019
1019
|
type: e.literal("DROPDOWN"),
|
|
1020
1020
|
config: e.object({
|
|
1021
1021
|
options: e.array(e.object({
|
|
@@ -1027,7 +1027,7 @@ var y = e.object({
|
|
|
1027
1027
|
multiple: e.boolean().optional(),
|
|
1028
1028
|
default_value: e.union([e.string(), e.array(e.string())]).optional()
|
|
1029
1029
|
}).optional()
|
|
1030
|
-
}),
|
|
1030
|
+
}), ut = w.extend({
|
|
1031
1031
|
type: e.literal("EMAIL"),
|
|
1032
1032
|
config: e.object({
|
|
1033
1033
|
placeholder: e.string().optional(),
|
|
@@ -1035,20 +1035,20 @@ var y = e.object({
|
|
|
1035
1035
|
last_used: e.boolean().optional(),
|
|
1036
1036
|
last_used_label: e.string().optional()
|
|
1037
1037
|
}).optional()
|
|
1038
|
-
}),
|
|
1038
|
+
}), dt = w.extend({
|
|
1039
1039
|
type: e.literal("FILE"),
|
|
1040
1040
|
config: e.object({
|
|
1041
1041
|
accept: e.string().optional(),
|
|
1042
1042
|
max_size: e.number().optional(),
|
|
1043
1043
|
multiple: e.boolean().optional()
|
|
1044
1044
|
}).optional()
|
|
1045
|
-
}),
|
|
1045
|
+
}), ft = w.extend({
|
|
1046
1046
|
type: e.literal("LEGAL"),
|
|
1047
1047
|
config: e.object({
|
|
1048
1048
|
text: e.string(),
|
|
1049
1049
|
html: e.boolean().optional()
|
|
1050
1050
|
}).optional()
|
|
1051
|
-
}),
|
|
1051
|
+
}), pt = w.extend({
|
|
1052
1052
|
type: e.literal("NUMBER"),
|
|
1053
1053
|
config: e.object({
|
|
1054
1054
|
placeholder: e.string().optional(),
|
|
@@ -1057,7 +1057,7 @@ var y = e.object({
|
|
|
1057
1057
|
step: e.number().optional(),
|
|
1058
1058
|
default_value: e.string().optional()
|
|
1059
1059
|
}).optional()
|
|
1060
|
-
}),
|
|
1060
|
+
}), mt = w.extend({
|
|
1061
1061
|
type: e.literal("PASSWORD"),
|
|
1062
1062
|
config: e.object({
|
|
1063
1063
|
placeholder: e.string().optional(),
|
|
@@ -1066,13 +1066,13 @@ var y = e.object({
|
|
|
1066
1066
|
forgot_password_link: e.string().optional(),
|
|
1067
1067
|
default_value: e.string().optional()
|
|
1068
1068
|
}).optional()
|
|
1069
|
-
}),
|
|
1069
|
+
}), ht = w.extend({
|
|
1070
1070
|
type: e.literal("PAYMENT"),
|
|
1071
1071
|
config: e.object({
|
|
1072
1072
|
provider: e.string().optional(),
|
|
1073
1073
|
currency: e.string().optional()
|
|
1074
1074
|
}).optional()
|
|
1075
|
-
}),
|
|
1075
|
+
}), gt = w.extend({
|
|
1076
1076
|
type: e.literal("SOCIAL"),
|
|
1077
1077
|
config: e.object({
|
|
1078
1078
|
providers: e.array(e.string()).optional(),
|
|
@@ -1086,7 +1086,7 @@ var y = e.object({
|
|
|
1086
1086
|
last_used_label: e.string().optional()
|
|
1087
1087
|
})).optional()
|
|
1088
1088
|
}).optional()
|
|
1089
|
-
}),
|
|
1089
|
+
}), _t = w.extend({
|
|
1090
1090
|
type: e.literal("TEL"),
|
|
1091
1091
|
config: e.object({
|
|
1092
1092
|
placeholder: e.string().optional(),
|
|
@@ -1094,7 +1094,7 @@ var y = e.object({
|
|
|
1094
1094
|
default_value: e.string().optional(),
|
|
1095
1095
|
allow_email: e.boolean().optional()
|
|
1096
1096
|
}).optional()
|
|
1097
|
-
}),
|
|
1097
|
+
}), vt = w.extend({
|
|
1098
1098
|
type: e.literal("TEXT"),
|
|
1099
1099
|
config: e.object({
|
|
1100
1100
|
placeholder: e.string().optional(),
|
|
@@ -1104,37 +1104,39 @@ var y = e.object({
|
|
|
1104
1104
|
last_used: e.boolean().optional(),
|
|
1105
1105
|
last_used_label: e.string().optional()
|
|
1106
1106
|
}).optional()
|
|
1107
|
-
}),
|
|
1107
|
+
}), yt = w.extend({
|
|
1108
1108
|
type: e.literal("COUNTRY"),
|
|
1109
1109
|
config: e.object({
|
|
1110
1110
|
placeholder: e.string().optional(),
|
|
1111
1111
|
default_value: e.string().optional()
|
|
1112
1112
|
}).optional()
|
|
1113
|
-
}),
|
|
1113
|
+
}), bt = w.extend({
|
|
1114
1114
|
type: e.literal("URL"),
|
|
1115
1115
|
config: e.object({
|
|
1116
1116
|
placeholder: e.string().optional(),
|
|
1117
1117
|
default_value: e.string().optional()
|
|
1118
1118
|
}).optional()
|
|
1119
|
-
}),
|
|
1119
|
+
}), xt = e.discriminatedUnion("type", [
|
|
1120
|
+
Ke,
|
|
1121
|
+
qe,
|
|
1120
1122
|
Je,
|
|
1121
1123
|
Ye,
|
|
1122
1124
|
Xe,
|
|
1123
1125
|
Ze,
|
|
1124
1126
|
Qe,
|
|
1125
|
-
$e
|
|
1127
|
+
$e
|
|
1128
|
+
]), St = e.discriminatedUnion("type", [
|
|
1126
1129
|
et,
|
|
1127
|
-
tt
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
+
tt,
|
|
1131
|
+
nt
|
|
1132
|
+
]), Ct = e.discriminatedUnion("type", [
|
|
1130
1133
|
rt,
|
|
1131
|
-
it
|
|
1132
|
-
]), Tt = e.discriminatedUnion("type", [
|
|
1134
|
+
it,
|
|
1133
1135
|
at,
|
|
1134
1136
|
ot,
|
|
1137
|
+
yt,
|
|
1135
1138
|
st,
|
|
1136
1139
|
ct,
|
|
1137
|
-
xt,
|
|
1138
1140
|
lt,
|
|
1139
1141
|
ut,
|
|
1140
1142
|
dt,
|
|
@@ -1145,13 +1147,11 @@ var y = e.object({
|
|
|
1145
1147
|
gt,
|
|
1146
1148
|
_t,
|
|
1147
1149
|
vt,
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
Ct
|
|
1153
|
-
wt,
|
|
1154
|
-
Tt
|
|
1150
|
+
bt
|
|
1151
|
+
]), wt = e.union([
|
|
1152
|
+
xt,
|
|
1153
|
+
St,
|
|
1154
|
+
Ct
|
|
1155
1155
|
]);
|
|
1156
1156
|
new Set([
|
|
1157
1157
|
"BOOLEAN",
|
|
@@ -1178,22 +1178,22 @@ new Set([
|
|
|
1178
1178
|
visible: e.boolean().optional().default(!0),
|
|
1179
1179
|
customizations: e.record(e.string(), e.any()).optional()
|
|
1180
1180
|
});
|
|
1181
|
-
var
|
|
1181
|
+
var T = e.object({
|
|
1182
1182
|
x: e.number(),
|
|
1183
1183
|
y: e.number()
|
|
1184
|
-
}),
|
|
1184
|
+
}), Tt = e.object({
|
|
1185
1185
|
id: e.string(),
|
|
1186
1186
|
type: e.literal("FLOW"),
|
|
1187
|
-
coordinates:
|
|
1187
|
+
coordinates: T,
|
|
1188
1188
|
alias: e.string().min(1).max(150).optional(),
|
|
1189
1189
|
config: e.object({
|
|
1190
1190
|
flow_id: e.string().max(30),
|
|
1191
1191
|
next_node: e.string().optional()
|
|
1192
1192
|
})
|
|
1193
|
-
}),
|
|
1193
|
+
}), Et = e.object({
|
|
1194
1194
|
id: e.string(),
|
|
1195
1195
|
type: e.literal("ROUTER"),
|
|
1196
|
-
coordinates:
|
|
1196
|
+
coordinates: T,
|
|
1197
1197
|
alias: e.string().min(1).max(150),
|
|
1198
1198
|
config: e.object({
|
|
1199
1199
|
rules: e.array(e.object({
|
|
@@ -1204,20 +1204,20 @@ var w = e.object({
|
|
|
1204
1204
|
})),
|
|
1205
1205
|
fallback: e.string()
|
|
1206
1206
|
})
|
|
1207
|
-
}),
|
|
1207
|
+
}), Dt = e.object({
|
|
1208
1208
|
id: e.string(),
|
|
1209
1209
|
type: e.literal("STEP"),
|
|
1210
|
-
coordinates:
|
|
1210
|
+
coordinates: T,
|
|
1211
1211
|
alias: e.string().min(1).max(150).optional(),
|
|
1212
1212
|
config: e.object({
|
|
1213
|
-
components: e.array(
|
|
1213
|
+
components: e.array(wt),
|
|
1214
1214
|
next_node: e.string().optional()
|
|
1215
1215
|
})
|
|
1216
|
-
}),
|
|
1216
|
+
}), Ot = e.discriminatedUnion("type", [
|
|
1217
|
+
Tt,
|
|
1217
1218
|
Et,
|
|
1218
|
-
Dt
|
|
1219
|
-
|
|
1220
|
-
]), At = e.object({
|
|
1219
|
+
Dt
|
|
1220
|
+
]), kt = e.object({
|
|
1221
1221
|
name: e.string().openapi({ description: "The name of the form" }),
|
|
1222
1222
|
messages: e.object({
|
|
1223
1223
|
errors: e.record(e.string(), e.any()).optional(),
|
|
@@ -1228,14 +1228,14 @@ var w = e.object({
|
|
|
1228
1228
|
default: e.string().optional()
|
|
1229
1229
|
}).optional(),
|
|
1230
1230
|
translations: e.record(e.string(), e.any()).optional(),
|
|
1231
|
-
nodes: e.array(
|
|
1231
|
+
nodes: e.array(Ot).optional(),
|
|
1232
1232
|
start: e.object({
|
|
1233
1233
|
hidden_fields: e.array(e.object({
|
|
1234
1234
|
key: e.string(),
|
|
1235
1235
|
value: e.string()
|
|
1236
1236
|
})).optional(),
|
|
1237
1237
|
next_node: e.string().optional(),
|
|
1238
|
-
coordinates:
|
|
1238
|
+
coordinates: T.optional()
|
|
1239
1239
|
}).optional(),
|
|
1240
1240
|
ending: e.object({
|
|
1241
1241
|
redirection: e.object({
|
|
@@ -1243,7 +1243,7 @@ var w = e.object({
|
|
|
1243
1243
|
target: e.string().optional()
|
|
1244
1244
|
}).optional(),
|
|
1245
1245
|
after_submit: e.object({ flow_id: e.string().optional() }).optional(),
|
|
1246
|
-
coordinates:
|
|
1246
|
+
coordinates: T.optional(),
|
|
1247
1247
|
resume_flow: e.boolean().optional()
|
|
1248
1248
|
}).optional(),
|
|
1249
1249
|
style: e.object({ css: e.string().optional() }).optional(),
|
|
@@ -1252,8 +1252,8 @@ var w = e.object({
|
|
|
1252
1252
|
sdk_src: e.string().optional()
|
|
1253
1253
|
}).optional()
|
|
1254
1254
|
}).openapi({ description: "Schema for flow-based forms (matches Auth0 Forms structure)" });
|
|
1255
|
-
n.extend(
|
|
1256
|
-
var
|
|
1255
|
+
n.extend(kt.shape).extend({ id: e.string() });
|
|
1256
|
+
var At = e.object({
|
|
1257
1257
|
id: e.number().optional(),
|
|
1258
1258
|
text: e.string(),
|
|
1259
1259
|
type: e.enum([
|
|
@@ -1262,7 +1262,7 @@ var jt = e.object({
|
|
|
1262
1262
|
"success",
|
|
1263
1263
|
"warning"
|
|
1264
1264
|
])
|
|
1265
|
-
}),
|
|
1265
|
+
}), jt = e.object({
|
|
1266
1266
|
id: e.string().optional(),
|
|
1267
1267
|
text: e.string(),
|
|
1268
1268
|
href: e.string(),
|
|
@@ -1274,12 +1274,12 @@ e.object({
|
|
|
1274
1274
|
method: e.enum(["POST", "GET"]),
|
|
1275
1275
|
title: e.string().optional(),
|
|
1276
1276
|
description: e.string().optional(),
|
|
1277
|
-
components: e.array(
|
|
1278
|
-
messages: e.array(
|
|
1279
|
-
links: e.array(
|
|
1277
|
+
components: e.array(wt),
|
|
1278
|
+
messages: e.array(At).optional(),
|
|
1279
|
+
links: e.array(jt).optional(),
|
|
1280
1280
|
footer: e.string().optional()
|
|
1281
1281
|
});
|
|
1282
|
-
var
|
|
1282
|
+
var E = e.enum([
|
|
1283
1283
|
"pre-user-registration",
|
|
1284
1284
|
"post-user-registration",
|
|
1285
1285
|
"post-user-login",
|
|
@@ -1287,19 +1287,19 @@ var T = e.enum([
|
|
|
1287
1287
|
"validate-registration-username",
|
|
1288
1288
|
"pre-user-deletion",
|
|
1289
1289
|
"post-user-deletion"
|
|
1290
|
-
]),
|
|
1290
|
+
]), D = e.enum(["post-user-login"]), O = e.enum([
|
|
1291
1291
|
"post-user-login",
|
|
1292
1292
|
"post-user-registration",
|
|
1293
1293
|
"post-user-update",
|
|
1294
1294
|
"credentials-exchange"
|
|
1295
|
-
]),
|
|
1295
|
+
]), k = e.enum([
|
|
1296
1296
|
"post-user-login",
|
|
1297
1297
|
"credentials-exchange",
|
|
1298
1298
|
"pre-user-registration",
|
|
1299
1299
|
"post-user-registration"
|
|
1300
|
-
]),
|
|
1301
|
-
|
|
1302
|
-
var
|
|
1300
|
+
]), A = e.enum(["post-user-login"]);
|
|
1301
|
+
E.options, D.options, O.options, k.options, A.options;
|
|
1302
|
+
var Mt = e.enum(["impersonate"]), Nt = e.enum([
|
|
1303
1303
|
"ensure-username",
|
|
1304
1304
|
"set-preferred-username",
|
|
1305
1305
|
"account-linking"
|
|
@@ -1311,24 +1311,24 @@ var A = e.enum(["impersonate"]), Nt = e.enum([
|
|
|
1311
1311
|
metadata: e.record(e.string(), e.unknown()).optional()
|
|
1312
1312
|
}, Pt = e.object({
|
|
1313
1313
|
...j,
|
|
1314
|
-
trigger_id:
|
|
1314
|
+
trigger_id: E,
|
|
1315
1315
|
url: e.string()
|
|
1316
1316
|
}), Ft = e.object({
|
|
1317
1317
|
...j,
|
|
1318
|
-
trigger_id:
|
|
1318
|
+
trigger_id: D,
|
|
1319
1319
|
form_id: e.string()
|
|
1320
1320
|
}), It = e.object({
|
|
1321
1321
|
...j,
|
|
1322
|
-
trigger_id:
|
|
1322
|
+
trigger_id: O,
|
|
1323
1323
|
template_id: Nt
|
|
1324
1324
|
}), Lt = e.object({
|
|
1325
1325
|
...j,
|
|
1326
|
-
trigger_id:
|
|
1326
|
+
trigger_id: k,
|
|
1327
1327
|
code_id: e.string()
|
|
1328
1328
|
}), Rt = e.object({
|
|
1329
1329
|
...j,
|
|
1330
|
-
trigger_id:
|
|
1331
|
-
page_id:
|
|
1330
|
+
trigger_id: A,
|
|
1331
|
+
page_id: Mt,
|
|
1332
1332
|
permission_required: e.string().optional()
|
|
1333
1333
|
});
|
|
1334
1334
|
e.union([
|
|
@@ -1340,34 +1340,34 @@ e.union([
|
|
|
1340
1340
|
]);
|
|
1341
1341
|
var zt = e.object({
|
|
1342
1342
|
...j,
|
|
1343
|
-
trigger_id:
|
|
1343
|
+
trigger_id: E
|
|
1344
1344
|
}).extend(n.shape).extend({
|
|
1345
1345
|
hook_id: e.string(),
|
|
1346
1346
|
url: e.string()
|
|
1347
1347
|
}), Bt = e.object({
|
|
1348
1348
|
...j,
|
|
1349
|
-
trigger_id:
|
|
1349
|
+
trigger_id: D
|
|
1350
1350
|
}).extend(n.shape).extend({
|
|
1351
1351
|
hook_id: e.string(),
|
|
1352
1352
|
form_id: e.string()
|
|
1353
1353
|
}), Vt = e.object({
|
|
1354
1354
|
...j,
|
|
1355
|
-
trigger_id:
|
|
1355
|
+
trigger_id: O
|
|
1356
1356
|
}).extend(n.shape).extend({
|
|
1357
1357
|
hook_id: e.string(),
|
|
1358
1358
|
template_id: Nt
|
|
1359
1359
|
}), Ht = e.object({
|
|
1360
1360
|
...j,
|
|
1361
|
-
trigger_id:
|
|
1361
|
+
trigger_id: k
|
|
1362
1362
|
}).extend(n.shape).extend({
|
|
1363
1363
|
hook_id: e.string(),
|
|
1364
1364
|
code_id: e.string()
|
|
1365
1365
|
}), Ut = e.object({
|
|
1366
1366
|
...j,
|
|
1367
|
-
trigger_id:
|
|
1367
|
+
trigger_id: A
|
|
1368
1368
|
}).extend(n.shape).extend({
|
|
1369
1369
|
hook_id: e.string(),
|
|
1370
|
-
page_id:
|
|
1370
|
+
page_id: Mt,
|
|
1371
1371
|
permission_required: e.string().optional()
|
|
1372
1372
|
});
|
|
1373
1373
|
e.union([
|
|
@@ -1482,7 +1482,7 @@ var Jt = /* @__PURE__ */ function(e) {
|
|
|
1482
1482
|
e.object({
|
|
1483
1483
|
csrf_token: e.string(),
|
|
1484
1484
|
auth0Client: e.string().optional(),
|
|
1485
|
-
authParams:
|
|
1485
|
+
authParams: ze,
|
|
1486
1486
|
expires_at: e.string(),
|
|
1487
1487
|
deleted_at: e.string().optional(),
|
|
1488
1488
|
ip: e.string().optional(),
|
|
@@ -2642,7 +2642,7 @@ var Qn = e.enum([
|
|
|
2642
2642
|
friendly_name: e.string().optional(),
|
|
2643
2643
|
confirmed: e.boolean().default(!1)
|
|
2644
2644
|
});
|
|
2645
|
-
function
|
|
2645
|
+
function er(t, n) {
|
|
2646
2646
|
t.type === "phone" && !t.phone_number && n.addIssue({
|
|
2647
2647
|
code: e.ZodIssueCode.custom,
|
|
2648
2648
|
message: "phone_number is required when type is 'phone'",
|
|
@@ -2665,23 +2665,23 @@ function F(t, n) {
|
|
|
2665
2665
|
path: ["public_key"]
|
|
2666
2666
|
}));
|
|
2667
2667
|
}
|
|
2668
|
-
$n.superRefine(
|
|
2668
|
+
$n.superRefine(er), $n.extend({
|
|
2669
2669
|
id: e.string(),
|
|
2670
2670
|
created_at: e.string(),
|
|
2671
2671
|
updated_at: e.string()
|
|
2672
|
-
}).superRefine(
|
|
2672
|
+
}).superRefine(er), e.object({
|
|
2673
2673
|
id: e.string().optional(),
|
|
2674
2674
|
created_at: e.string().datetime({ offset: !0 }).optional(),
|
|
2675
2675
|
updated_at: e.string().datetime({ offset: !0 }).optional()
|
|
2676
2676
|
});
|
|
2677
2677
|
//#endregion
|
|
2678
2678
|
//#region src/data-plane/cache.ts
|
|
2679
|
-
var
|
|
2680
|
-
function
|
|
2679
|
+
var tr = 1e4;
|
|
2680
|
+
function F(e, t, n) {
|
|
2681
2681
|
let r = typeof t == "number" ? {
|
|
2682
2682
|
freshTtlMs: t,
|
|
2683
2683
|
maxEntries: n
|
|
2684
|
-
} : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ??
|
|
2684
|
+
} : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ?? tr, l = r.waitUntil, u = /* @__PURE__ */ new Map();
|
|
2685
2685
|
function d(e) {
|
|
2686
2686
|
for (let [t, n] of u) n.stale_if_error_until <= e && n.stale_until <= e && !n.refreshing && u.delete(t);
|
|
2687
2687
|
for (; u.size >= c;) {
|
|
@@ -2738,7 +2738,7 @@ function I(e, t, n) {
|
|
|
2738
2738
|
}
|
|
2739
2739
|
//#endregion
|
|
2740
2740
|
//#region src/data-plane/registry.ts
|
|
2741
|
-
var
|
|
2741
|
+
var I = class {
|
|
2742
2742
|
definitions = /* @__PURE__ */ new Map();
|
|
2743
2743
|
bindings;
|
|
2744
2744
|
constructor(e = {}) {
|
|
@@ -2758,38 +2758,38 @@ var L = class {
|
|
|
2758
2758
|
return n.build(r.data, { bindings: this.bindings });
|
|
2759
2759
|
}
|
|
2760
2760
|
};
|
|
2761
|
-
function
|
|
2761
|
+
function L(e) {
|
|
2762
2762
|
return e;
|
|
2763
2763
|
}
|
|
2764
2764
|
//#endregion
|
|
2765
2765
|
//#region src/data-plane/handlers/util.ts
|
|
2766
|
-
var
|
|
2767
|
-
function tr(e, t) {
|
|
2768
|
-
e.set(z, t);
|
|
2769
|
-
}
|
|
2770
|
-
function W(e) {
|
|
2771
|
-
return e.get(z) ?? e.req.raw;
|
|
2772
|
-
}
|
|
2766
|
+
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";
|
|
2773
2767
|
function nr(e, t) {
|
|
2774
|
-
e.set(
|
|
2768
|
+
e.set(R, t);
|
|
2775
2769
|
}
|
|
2776
|
-
function
|
|
2777
|
-
return e.get(
|
|
2770
|
+
function U(e) {
|
|
2771
|
+
return e.get(R) ?? e.req.raw;
|
|
2772
|
+
}
|
|
2773
|
+
function rr(e, t) {
|
|
2774
|
+
e.set(z, t.tenant_id), e.set(B, t.custom_domain_id), e.set(V, t.domain);
|
|
2778
2775
|
}
|
|
2779
2776
|
function ir(e) {
|
|
2780
|
-
return e.get(
|
|
2777
|
+
return e.get(z);
|
|
2781
2778
|
}
|
|
2782
2779
|
function ar(e) {
|
|
2783
|
-
return e.get(
|
|
2780
|
+
return e.get(B);
|
|
2784
2781
|
}
|
|
2785
|
-
function or(e
|
|
2786
|
-
|
|
2787
|
-
t(r), tr(e, new Request(n, { headers: r }));
|
|
2782
|
+
function or(e) {
|
|
2783
|
+
return e.get(V);
|
|
2788
2784
|
}
|
|
2789
|
-
function
|
|
2785
|
+
function sr(e, t) {
|
|
2786
|
+
let n = U(e), r = new Headers(n.headers);
|
|
2787
|
+
t(r), nr(e, new Request(n, { headers: r }));
|
|
2788
|
+
}
|
|
2789
|
+
function W(e) {
|
|
2790
2790
|
let t = e.res;
|
|
2791
2791
|
try {
|
|
2792
|
-
t.headers.append(
|
|
2792
|
+
t.headers.append(H, "1"), t.headers.delete(H);
|
|
2793
2793
|
return;
|
|
2794
2794
|
} catch {
|
|
2795
2795
|
e.res = new Response(t.body, {
|
|
@@ -2801,7 +2801,7 @@ function G(e) {
|
|
|
2801
2801
|
}
|
|
2802
2802
|
//#endregion
|
|
2803
2803
|
//#region src/data-plane/handlers/cors.ts
|
|
2804
|
-
var
|
|
2804
|
+
var cr = e.object({
|
|
2805
2805
|
origins: e.array(e.string()).optional(),
|
|
2806
2806
|
allow_credentials: e.boolean().optional(),
|
|
2807
2807
|
allow_headers: e.array(e.string()).optional(),
|
|
@@ -2809,44 +2809,44 @@ var sr = e.object({
|
|
|
2809
2809
|
expose_headers: e.array(e.string()).optional(),
|
|
2810
2810
|
max_age: e.number().int().optional()
|
|
2811
2811
|
}).refine((e) => !(e.allow_credentials && e.origins?.includes("*")), { message: "Cannot use wildcard origin (*) with allow_credentials" });
|
|
2812
|
-
function
|
|
2812
|
+
function lr(e, t) {
|
|
2813
2813
|
let n = new Headers(), r = e.origins ?? ["*"], i = r.includes("*");
|
|
2814
2814
|
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;
|
|
2815
2815
|
}
|
|
2816
|
-
var
|
|
2816
|
+
var ur = L({
|
|
2817
2817
|
type: "cors",
|
|
2818
|
-
optionsSchema:
|
|
2818
|
+
optionsSchema: cr,
|
|
2819
2819
|
build(e) {
|
|
2820
2820
|
return async (t, n) => {
|
|
2821
2821
|
let r = t.req.header("origin") ?? null;
|
|
2822
2822
|
if (t.req.method === "OPTIONS" && r !== null && t.req.header("access-control-request-method") !== void 0) {
|
|
2823
|
-
let t =
|
|
2823
|
+
let t = lr(e, r);
|
|
2824
2824
|
return new Response(null, {
|
|
2825
2825
|
status: 204,
|
|
2826
2826
|
headers: t
|
|
2827
2827
|
});
|
|
2828
2828
|
}
|
|
2829
2829
|
await n();
|
|
2830
|
-
let i =
|
|
2831
|
-
|
|
2830
|
+
let i = lr(e, r);
|
|
2831
|
+
W(t), i.forEach((e, n) => {
|
|
2832
2832
|
n.toLowerCase() === "vary" ? t.res.headers.append(n, e) : t.res.headers.set(n, e);
|
|
2833
2833
|
});
|
|
2834
2834
|
};
|
|
2835
2835
|
}
|
|
2836
|
-
}),
|
|
2836
|
+
}), dr = e.object({
|
|
2837
2837
|
username: e.string(),
|
|
2838
2838
|
password: e.string(),
|
|
2839
2839
|
realm: e.string().optional()
|
|
2840
2840
|
});
|
|
2841
|
-
function
|
|
2841
|
+
function fr(e, t) {
|
|
2842
2842
|
let n = `${e}:${t}`;
|
|
2843
2843
|
return typeof btoa == "function" ? btoa(n) : Buffer.from(n, "utf-8").toString("base64");
|
|
2844
2844
|
}
|
|
2845
|
-
var
|
|
2845
|
+
var pr = L({
|
|
2846
2846
|
type: "basic_auth",
|
|
2847
|
-
optionsSchema:
|
|
2847
|
+
optionsSchema: dr,
|
|
2848
2848
|
build(e) {
|
|
2849
|
-
let t =
|
|
2849
|
+
let t = fr(e.username, e.password), n = (e.realm ?? "Restricted").replace(/["\\\r\n]/g, "");
|
|
2850
2850
|
return async (e, r) => {
|
|
2851
2851
|
let i = e.req.header("authorization");
|
|
2852
2852
|
if (i) {
|
|
@@ -2862,7 +2862,7 @@ var fr = R({
|
|
|
2862
2862
|
});
|
|
2863
2863
|
};
|
|
2864
2864
|
}
|
|
2865
|
-
}),
|
|
2865
|
+
}), mr = L({
|
|
2866
2866
|
type: "headers",
|
|
2867
2867
|
optionsSchema: e.object({
|
|
2868
2868
|
request: e.record(e.string(), e.string()).optional(),
|
|
@@ -2872,66 +2872,173 @@ var fr = R({
|
|
|
2872
2872
|
}),
|
|
2873
2873
|
build(e) {
|
|
2874
2874
|
return async (t, n) => {
|
|
2875
|
-
if ((e.request || e.remove_request) &&
|
|
2875
|
+
if ((e.request || e.remove_request) && sr(t, (t) => {
|
|
2876
2876
|
if (e.remove_request?.forEach((e) => t.delete(e)), e.request) for (let [n, r] of Object.entries(e.request)) t.set(n, r);
|
|
2877
|
-
}), await n(), (e.response || e.remove_response) && (
|
|
2877
|
+
}), await n(), (e.response || e.remove_response) && (W(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);
|
|
2878
2878
|
};
|
|
2879
2879
|
}
|
|
2880
|
-
}),
|
|
2880
|
+
}), hr = L({
|
|
2881
2881
|
type: "cache",
|
|
2882
2882
|
optionsSchema: e.object({ ttl_seconds: e.number().int().positive() }),
|
|
2883
2883
|
build(e) {
|
|
2884
2884
|
return async (t, n) => {
|
|
2885
2885
|
if (await n(), !t.res.headers.has("Cache-Control")) {
|
|
2886
2886
|
let n = t.res.headers.has("set-cookie") ? "private" : "public";
|
|
2887
|
-
|
|
2887
|
+
W(t), t.res.headers.set("Cache-Control", `${n}, max-age=${e.ttl_seconds}`);
|
|
2888
2888
|
}
|
|
2889
2889
|
};
|
|
2890
2890
|
}
|
|
2891
|
-
}),
|
|
2891
|
+
}), gr = [
|
|
2892
|
+
"173.245.48.0/20",
|
|
2893
|
+
"103.21.244.0/22",
|
|
2894
|
+
"103.22.200.0/22",
|
|
2895
|
+
"103.31.4.0/22",
|
|
2896
|
+
"141.101.64.0/18",
|
|
2897
|
+
"108.162.192.0/18",
|
|
2898
|
+
"190.93.240.0/20",
|
|
2899
|
+
"188.114.96.0/20",
|
|
2900
|
+
"197.234.240.0/22",
|
|
2901
|
+
"198.41.128.0/17",
|
|
2902
|
+
"162.158.0.0/15",
|
|
2903
|
+
"104.16.0.0/13",
|
|
2904
|
+
"104.24.0.0/14",
|
|
2905
|
+
"172.64.0.0/13",
|
|
2906
|
+
"131.0.72.0/22",
|
|
2907
|
+
"2400:cb00::/32",
|
|
2908
|
+
"2606:4700::/32",
|
|
2909
|
+
"2803:f800::/32",
|
|
2910
|
+
"2405:b500::/32",
|
|
2911
|
+
"2405:8100::/32",
|
|
2912
|
+
"2a06:98c0::/29",
|
|
2913
|
+
"2c0f:f248::/32"
|
|
2914
|
+
];
|
|
2915
|
+
function _r(e) {
|
|
2916
|
+
let t = e.split(".");
|
|
2917
|
+
if (t.length !== 4) return null;
|
|
2918
|
+
let n = [];
|
|
2919
|
+
for (let e of t) {
|
|
2920
|
+
if (!/^\d{1,3}$/.test(e)) return null;
|
|
2921
|
+
let t = Number(e);
|
|
2922
|
+
if (t > 255) return null;
|
|
2923
|
+
n.push(t);
|
|
2924
|
+
}
|
|
2925
|
+
return n;
|
|
2926
|
+
}
|
|
2927
|
+
function vr(e) {
|
|
2928
|
+
if (e === "") return [];
|
|
2929
|
+
let t = e.split(":"), n = [];
|
|
2930
|
+
for (let e = 0; e < t.length; e++) {
|
|
2931
|
+
let r = t[e];
|
|
2932
|
+
if (r.includes(".")) {
|
|
2933
|
+
if (e !== t.length - 1) return null;
|
|
2934
|
+
let i = _r(r);
|
|
2935
|
+
if (!i) return null;
|
|
2936
|
+
n.push(i[0] << 8 | i[1], i[2] << 8 | i[3]);
|
|
2937
|
+
continue;
|
|
2938
|
+
}
|
|
2939
|
+
if (!/^[0-9a-f]{1,4}$/i.test(r)) return null;
|
|
2940
|
+
n.push(parseInt(r, 16));
|
|
2941
|
+
}
|
|
2942
|
+
return n;
|
|
2943
|
+
}
|
|
2944
|
+
function yr(e) {
|
|
2945
|
+
let t = e.split("::");
|
|
2946
|
+
if (t.length > 2) return null;
|
|
2947
|
+
let n = vr(t[0] ?? "");
|
|
2948
|
+
if (!n) return null;
|
|
2949
|
+
let r;
|
|
2950
|
+
if (t.length === 2) {
|
|
2951
|
+
let e = vr(t[1] ?? "");
|
|
2952
|
+
if (!e) return null;
|
|
2953
|
+
let i = 8 - n.length - e.length;
|
|
2954
|
+
if (i < 1) return null;
|
|
2955
|
+
r = [
|
|
2956
|
+
...n,
|
|
2957
|
+
...Array(i).fill(0),
|
|
2958
|
+
...e
|
|
2959
|
+
];
|
|
2960
|
+
} else r = n;
|
|
2961
|
+
if (r.length !== 8) return null;
|
|
2962
|
+
let i = [];
|
|
2963
|
+
for (let e of r) i.push(e >> 8 & 255, e & 255);
|
|
2964
|
+
return i;
|
|
2965
|
+
}
|
|
2966
|
+
function br(e) {
|
|
2967
|
+
let t = e.trim();
|
|
2968
|
+
t.startsWith("[") && t.endsWith("]") && (t = t.slice(1, -1));
|
|
2969
|
+
let n = t.indexOf("%");
|
|
2970
|
+
if (n !== -1 && (t = t.slice(0, n)), t === "") return null;
|
|
2971
|
+
if (!t.includes(":")) return _r(t);
|
|
2972
|
+
let r = yr(t);
|
|
2973
|
+
return r ? r.slice(0, 10).every((e) => e === 0) && r[10] === 255 && r[11] === 255 ? r.slice(12) : r : null;
|
|
2974
|
+
}
|
|
2975
|
+
function xr(e) {
|
|
2976
|
+
let [t, n] = e.split("/"), r = br(t ?? ""), i = Number(n);
|
|
2977
|
+
if (!r || !Number.isInteger(i)) throw Error(`Invalid Cloudflare CIDR: ${e}`);
|
|
2978
|
+
return {
|
|
2979
|
+
bytes: r,
|
|
2980
|
+
prefixBits: i
|
|
2981
|
+
};
|
|
2982
|
+
}
|
|
2983
|
+
var Sr = gr.map(xr);
|
|
2984
|
+
function Cr(e, t) {
|
|
2985
|
+
if (e.length !== t.bytes.length) return !1;
|
|
2986
|
+
let n = t.prefixBits >> 3;
|
|
2987
|
+
for (let r = 0; r < n; r++) if (e[r] !== t.bytes[r]) return !1;
|
|
2988
|
+
let r = t.prefixBits & 7;
|
|
2989
|
+
if (r === 0) return !0;
|
|
2990
|
+
let i = 255 << 8 - r & 255;
|
|
2991
|
+
return (e[n] & i) === (t.bytes[n] & i);
|
|
2992
|
+
}
|
|
2993
|
+
function wr(e) {
|
|
2994
|
+
let t = br(e);
|
|
2995
|
+
return t ? Sr.some((e) => Cr(t, e)) : !1;
|
|
2996
|
+
}
|
|
2997
|
+
var Tr = L({
|
|
2892
2998
|
type: "forwarded_headers",
|
|
2893
2999
|
optionsSchema: e.object({
|
|
2894
3000
|
client_ip_header: e.string().default("cf-connecting-ip"),
|
|
2895
3001
|
set_x_real_ip: e.boolean().default(!0),
|
|
2896
|
-
set_x_original_url: e.boolean().default(!0)
|
|
3002
|
+
set_x_original_url: e.boolean().default(!0),
|
|
3003
|
+
skip_cloudflare_client_ip: e.boolean().default(!0)
|
|
2897
3004
|
}),
|
|
2898
3005
|
build(e) {
|
|
2899
3006
|
return async (t, n) => {
|
|
2900
3007
|
let r = new URL(t.req.url);
|
|
2901
|
-
|
|
3008
|
+
sr(t, (n) => {
|
|
2902
3009
|
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);
|
|
2903
|
-
let i = n.get(e.client_ip_header), a = (n.get("x-forwarded-for") ?? "").split(",").map((e) => e.trim()).filter(Boolean),
|
|
2904
|
-
n.set("x-forwarded-for",
|
|
3010
|
+
let i = n.get(e.client_ip_header), a = i && e.skip_cloudflare_client_ip && wr(i) ? null : i, o = (n.get("x-forwarded-for") ?? "").split(",").map((e) => e.trim()).filter(Boolean), s = a ?? o[o.length - 1] ?? "127.0.0.1", c = o.length === 0 || o[o.length - 1] !== s, l = o.length ? c ? `${o.join(", ")}, ${s}` : o.join(", ") : s;
|
|
3011
|
+
n.set("x-forwarded-for", l), e.set_x_real_ip && n.set("x-real-ip", s);
|
|
2905
3012
|
}), await n();
|
|
2906
3013
|
};
|
|
2907
3014
|
}
|
|
2908
|
-
}),
|
|
2909
|
-
function
|
|
3015
|
+
}), Er = e.object({ upstream_host: e.string().optional() });
|
|
3016
|
+
function Dr(e) {
|
|
2910
3017
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2911
3018
|
}
|
|
2912
|
-
function
|
|
3019
|
+
function Or(e) {
|
|
2913
3020
|
if (typeof e.getSetCookie == "function") return e.getSetCookie();
|
|
2914
3021
|
let t = [];
|
|
2915
3022
|
return e.forEach((e, n) => {
|
|
2916
3023
|
n.toLowerCase() === "set-cookie" && t.push(e);
|
|
2917
3024
|
}), t;
|
|
2918
3025
|
}
|
|
2919
|
-
var
|
|
3026
|
+
var kr = L({
|
|
2920
3027
|
type: "rewrite_cookies",
|
|
2921
|
-
optionsSchema:
|
|
3028
|
+
optionsSchema: Er,
|
|
2922
3029
|
build(e) {
|
|
2923
3030
|
return async (t, n) => {
|
|
2924
3031
|
await n();
|
|
2925
3032
|
let r = new URL(t.req.url).hostname, i = e.upstream_host ?? t.get("__proxy_upstream_host__");
|
|
2926
3033
|
if (!i) return;
|
|
2927
|
-
let a =
|
|
3034
|
+
let a = Or(t.res.headers);
|
|
2928
3035
|
if (a.length === 0) return;
|
|
2929
|
-
let o =
|
|
2930
|
-
|
|
3036
|
+
let o = Dr(i), s = RegExp(`(?:^|;\\s*)Domain=\\.?${o}(?=;|$)`, "i");
|
|
3037
|
+
W(t), t.res.headers.delete("set-cookie");
|
|
2931
3038
|
for (let e of a) t.res.headers.append("set-cookie", e.replace(s, `Domain=${r}`));
|
|
2932
3039
|
};
|
|
2933
3040
|
}
|
|
2934
|
-
}),
|
|
3041
|
+
}), Ar = L({
|
|
2935
3042
|
type: "rewrite_location",
|
|
2936
3043
|
optionsSchema: e.object({ upstream_origin: e.string().optional() }),
|
|
2937
3044
|
build(e) {
|
|
@@ -2951,25 +3058,25 @@ var yr = R({
|
|
|
2951
3058
|
}
|
|
2952
3059
|
if (o.origin !== a) return;
|
|
2953
3060
|
let s = new URL(t.req.url), c = `${`${s.protocol}//${s.host}`}${o.pathname}${o.search}${o.hash}`;
|
|
2954
|
-
|
|
3061
|
+
W(t), t.res.headers.set("location", c);
|
|
2955
3062
|
};
|
|
2956
3063
|
}
|
|
2957
|
-
}),
|
|
3064
|
+
}), jr = class extends Error {
|
|
2958
3065
|
ms;
|
|
2959
3066
|
constructor(e, t) {
|
|
2960
3067
|
super(`${t ?? "Operation"} timed out after ${e}ms`), this.name = "TimeoutError", this.ms = e;
|
|
2961
3068
|
}
|
|
2962
3069
|
};
|
|
2963
|
-
function
|
|
2964
|
-
return e instanceof
|
|
3070
|
+
function G(e) {
|
|
3071
|
+
return e instanceof jr ? !0 : e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
|
|
2965
3072
|
}
|
|
2966
|
-
function
|
|
3073
|
+
function K(e, t) {
|
|
2967
3074
|
let n = new AbortController(), r = setTimeout(() => n.abort(), e);
|
|
2968
3075
|
return t(n.signal).finally(() => clearTimeout(r));
|
|
2969
3076
|
}
|
|
2970
|
-
function
|
|
3077
|
+
function q(e, t, n) {
|
|
2971
3078
|
let r, i = new Promise((e, i) => {
|
|
2972
|
-
r = setTimeout(() => i(new
|
|
3079
|
+
r = setTimeout(() => i(new jr(t, n)), t);
|
|
2973
3080
|
});
|
|
2974
3081
|
return Promise.race([e, i]).finally(() => {
|
|
2975
3082
|
r && clearTimeout(r);
|
|
@@ -2977,7 +3084,7 @@ function J(e, t, n) {
|
|
|
2977
3084
|
}
|
|
2978
3085
|
//#endregion
|
|
2979
3086
|
//#region src/data-plane/handlers/http.ts
|
|
2980
|
-
var
|
|
3087
|
+
var Mr = new Set([
|
|
2981
3088
|
"connection",
|
|
2982
3089
|
"keep-alive",
|
|
2983
3090
|
"proxy-authenticate",
|
|
@@ -2986,24 +3093,24 @@ var Sr = new Set([
|
|
|
2986
3093
|
"trailers",
|
|
2987
3094
|
"transfer-encoding",
|
|
2988
3095
|
"upgrade"
|
|
2989
|
-
]),
|
|
3096
|
+
]), Nr = 3e4, Pr = e.object({
|
|
2990
3097
|
upstream_url: e.string(),
|
|
2991
3098
|
preserve_host: e.boolean().default(!1),
|
|
2992
3099
|
timeout_ms: e.number().int().positive().optional()
|
|
2993
3100
|
});
|
|
2994
|
-
function
|
|
3101
|
+
function Fr(e, t) {
|
|
2995
3102
|
return e === "" || e === "/" ? t : `${e.endsWith("/") ? e.slice(0, -1) : e}${t.startsWith("/") ? t : `/${t}`}`;
|
|
2996
3103
|
}
|
|
2997
|
-
function
|
|
3104
|
+
function Ir(e) {
|
|
2998
3105
|
return e !== "GET" && e !== "HEAD";
|
|
2999
3106
|
}
|
|
3000
|
-
function
|
|
3107
|
+
function Lr(e, t) {
|
|
3001
3108
|
let n = new URL(t.url), r = new URL(e.upstream_url);
|
|
3002
|
-
r.pathname =
|
|
3109
|
+
r.pathname = Fr(r.pathname, n.pathname), r.search = n.search;
|
|
3003
3110
|
let i = new Headers(t.headers);
|
|
3004
|
-
for (let e of
|
|
3111
|
+
for (let e of Mr) i.delete(e);
|
|
3005
3112
|
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(":", ""));
|
|
3006
|
-
let a =
|
|
3113
|
+
let a = Ir(t.method) ? t.body : void 0, o = {
|
|
3007
3114
|
method: t.method,
|
|
3008
3115
|
headers: i,
|
|
3009
3116
|
body: a,
|
|
@@ -3014,85 +3121,85 @@ function Dr(e, t) {
|
|
|
3014
3121
|
init: o
|
|
3015
3122
|
};
|
|
3016
3123
|
}
|
|
3017
|
-
var
|
|
3124
|
+
var Rr = L({
|
|
3018
3125
|
type: "http",
|
|
3019
|
-
optionsSchema:
|
|
3126
|
+
optionsSchema: Pr,
|
|
3020
3127
|
build(e) {
|
|
3021
|
-
let t = e.timeout_ms ??
|
|
3128
|
+
let t = e.timeout_ms ?? Nr;
|
|
3022
3129
|
return async (n) => {
|
|
3023
|
-
let { target: r, init: i } =
|
|
3130
|
+
let { target: r, init: i } = Lr(e, U(n));
|
|
3024
3131
|
n.set("__proxy_upstream_host__", r.hostname), n.set("__proxy_upstream_origin__", `${r.protocol}//${r.host}`);
|
|
3025
3132
|
try {
|
|
3026
|
-
return await
|
|
3133
|
+
return await K(t, (e) => fetch(r.toString(), {
|
|
3027
3134
|
...i,
|
|
3028
3135
|
signal: e
|
|
3029
3136
|
}));
|
|
3030
3137
|
} catch (e) {
|
|
3031
|
-
return
|
|
3138
|
+
return G(e) ? n.text("Upstream timeout", 504, { "x-authhero-proxy-error": "http_timeout" }) : n.text("Bad gateway", 502, { "x-authhero-proxy-error": "http_failed" });
|
|
3032
3139
|
}
|
|
3033
3140
|
};
|
|
3034
3141
|
}
|
|
3035
|
-
}),
|
|
3142
|
+
}), zr = 3e4, Br = e.object({
|
|
3036
3143
|
binding: e.string(),
|
|
3037
3144
|
upstream_url: e.string().optional(),
|
|
3038
3145
|
preserve_host: e.boolean().default(!0),
|
|
3039
3146
|
timeout_ms: e.number().int().positive().optional()
|
|
3040
3147
|
});
|
|
3041
|
-
function
|
|
3148
|
+
function Vr(e) {
|
|
3042
3149
|
return typeof e == "object" && !!e && typeof e.fetch == "function";
|
|
3043
3150
|
}
|
|
3044
|
-
var
|
|
3151
|
+
var Hr = L({
|
|
3045
3152
|
type: "service_binding",
|
|
3046
|
-
optionsSchema:
|
|
3153
|
+
optionsSchema: Br,
|
|
3047
3154
|
build(e, t) {
|
|
3048
3155
|
let n = t.bindings[e.binding];
|
|
3049
|
-
if (!
|
|
3050
|
-
let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ??
|
|
3156
|
+
if (!Vr(n)) throw Error(`Service binding "${e.binding}" is not configured or is not a Fetcher`);
|
|
3157
|
+
let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ?? zr;
|
|
3051
3158
|
return async (t) => {
|
|
3052
|
-
let a =
|
|
3159
|
+
let a = U(t), { target: o, init: s } = Lr({
|
|
3053
3160
|
upstream_url: r,
|
|
3054
3161
|
preserve_host: e.preserve_host
|
|
3055
3162
|
}, a);
|
|
3056
3163
|
t.set("__proxy_upstream_host__", o.hostname), t.set("__proxy_upstream_origin__", `${o.protocol}//${o.host}`);
|
|
3057
3164
|
try {
|
|
3058
|
-
return await
|
|
3165
|
+
return await K(i, async (e) => n.fetch(new Request(o.toString(), {
|
|
3059
3166
|
...s,
|
|
3060
3167
|
signal: e
|
|
3061
3168
|
})));
|
|
3062
3169
|
} catch (e) {
|
|
3063
|
-
return
|
|
3170
|
+
return G(e) ? t.text(`service_binding timed out after ${i}ms`, 504, { "x-authhero-proxy-error": "service_binding_timeout" }) : t.text("Bad gateway", 502, { "x-authhero-proxy-error": "service_binding_failed" });
|
|
3064
3171
|
}
|
|
3065
3172
|
};
|
|
3066
3173
|
}
|
|
3067
|
-
}),
|
|
3174
|
+
}), Ur = 3e4, Wr = e.object({
|
|
3068
3175
|
binding: e.string(),
|
|
3069
3176
|
script_name: e.string(),
|
|
3070
3177
|
cpu_ms: e.number().int().positive().optional(),
|
|
3071
3178
|
subrequests: e.number().int().positive().optional(),
|
|
3072
3179
|
timeout_ms: e.number().int().positive().optional()
|
|
3073
3180
|
});
|
|
3074
|
-
function
|
|
3181
|
+
function Gr(e) {
|
|
3075
3182
|
return typeof e == "object" && !!e && typeof e.get == "function";
|
|
3076
3183
|
}
|
|
3077
|
-
var
|
|
3078
|
-
function
|
|
3079
|
-
return
|
|
3184
|
+
var J = /\{(tenant_id|custom_domain_id|domain|host)\}/g;
|
|
3185
|
+
function Kr(e) {
|
|
3186
|
+
return J.lastIndex = 0, J.test(e);
|
|
3080
3187
|
}
|
|
3081
|
-
var
|
|
3188
|
+
var qr = L({
|
|
3082
3189
|
type: "dispatch_namespace",
|
|
3083
|
-
optionsSchema:
|
|
3190
|
+
optionsSchema: Wr,
|
|
3084
3191
|
build(e, t) {
|
|
3085
3192
|
let n = t.bindings[e.binding];
|
|
3086
|
-
if (!
|
|
3087
|
-
let r =
|
|
3193
|
+
if (!Gr(n)) throw Error(`Dispatch namespace binding "${e.binding}" is not configured or does not expose .get()`);
|
|
3194
|
+
let r = Kr(e.script_name), i = e.timeout_ms ?? Ur, a = e.cpu_ms || e.subrequests ? { limits: {
|
|
3088
3195
|
...e.cpu_ms ? { cpuMs: e.cpu_ms } : {},
|
|
3089
3196
|
...e.subrequests ? { subrequests: e.subrequests } : {}
|
|
3090
3197
|
} } : void 0;
|
|
3091
3198
|
return async (t) => {
|
|
3092
3199
|
let o = e.script_name;
|
|
3093
3200
|
if (r) {
|
|
3094
|
-
let n =
|
|
3095
|
-
if (o = o.replace(
|
|
3201
|
+
let n = ir(t), r = ar(t), i = or(t), a = t.req.header("host") ?? t.req.header("x-forwarded-host") ?? "";
|
|
3202
|
+
if (o = o.replace(J, (e, t) => {
|
|
3096
3203
|
switch (t) {
|
|
3097
3204
|
case "tenant_id": return n ?? "";
|
|
3098
3205
|
case "custom_domain_id": return r ?? "";
|
|
@@ -3102,19 +3209,19 @@ var Lr = R({
|
|
|
3102
3209
|
}
|
|
3103
3210
|
}), o.includes("{") || o === "") return t.text(`dispatch_namespace: could not resolve script name from template "${e.script_name}"`, 500);
|
|
3104
3211
|
}
|
|
3105
|
-
let s =
|
|
3212
|
+
let s = U(t);
|
|
3106
3213
|
try {
|
|
3107
3214
|
let e = n.get(o, void 0, a);
|
|
3108
|
-
return await
|
|
3215
|
+
return await K(i, async (t) => {
|
|
3109
3216
|
let n = new Request(s, { signal: t });
|
|
3110
3217
|
return e.fetch(n);
|
|
3111
3218
|
});
|
|
3112
3219
|
} catch (e) {
|
|
3113
|
-
return
|
|
3220
|
+
return G(e) ? t.text(`dispatch_namespace timed out after ${i}ms`, 504, { "x-authhero-proxy-error": "dispatch_namespace_timeout" }) : t.text("Bad gateway", 502, { "x-authhero-proxy-error": "dispatch_namespace_failed" });
|
|
3114
3221
|
}
|
|
3115
3222
|
};
|
|
3116
3223
|
}
|
|
3117
|
-
}),
|
|
3224
|
+
}), Jr = L({
|
|
3118
3225
|
type: "redirect",
|
|
3119
3226
|
optionsSchema: e.object({
|
|
3120
3227
|
upstream_url: e.string().refine((e) => {
|
|
@@ -3143,7 +3250,7 @@ var Lr = R({
|
|
|
3143
3250
|
});
|
|
3144
3251
|
};
|
|
3145
3252
|
}
|
|
3146
|
-
}),
|
|
3253
|
+
}), Yr = L({
|
|
3147
3254
|
type: "static",
|
|
3148
3255
|
optionsSchema: e.object({
|
|
3149
3256
|
status: e.number().int().default(200),
|
|
@@ -3163,15 +3270,15 @@ var Lr = R({
|
|
|
3163
3270
|
});
|
|
3164
3271
|
//#endregion
|
|
3165
3272
|
//#region src/data-plane/handlers/index.ts
|
|
3166
|
-
function
|
|
3167
|
-
e.add(
|
|
3273
|
+
function Xr(e) {
|
|
3274
|
+
e.add(ur).add(pr).add(mr).add(hr).add(Tr).add(kr).add(Ar).add(Rr).add(Hr).add(qr).add(Jr).add(Yr);
|
|
3168
3275
|
}
|
|
3169
3276
|
//#endregion
|
|
3170
3277
|
//#region src/data-plane/matcher.ts
|
|
3171
|
-
function
|
|
3278
|
+
function Zr(e) {
|
|
3172
3279
|
return [...e].sort((e, t) => e.priority === t.priority ? e.created_at.localeCompare(t.created_at) : e.priority - t.priority);
|
|
3173
3280
|
}
|
|
3174
|
-
function
|
|
3281
|
+
function Qr(e, t) {
|
|
3175
3282
|
let n = e.toLowerCase(), r = t.toLowerCase();
|
|
3176
3283
|
if (n === r) return !0;
|
|
3177
3284
|
if (n.startsWith("*.")) {
|
|
@@ -3180,13 +3287,13 @@ function Hr(e, t) {
|
|
|
3180
3287
|
}
|
|
3181
3288
|
return !1;
|
|
3182
3289
|
}
|
|
3183
|
-
function
|
|
3184
|
-
return !e || e.length === 0 ? !0 : e.some((e) =>
|
|
3290
|
+
function $r(e, t) {
|
|
3291
|
+
return !e || e.length === 0 ? !0 : e.some((e) => Qr(e, t));
|
|
3185
3292
|
}
|
|
3186
|
-
function
|
|
3293
|
+
function ei(e) {
|
|
3187
3294
|
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;
|
|
3188
3295
|
return async (e, i) => {
|
|
3189
|
-
if (r &&
|
|
3296
|
+
if (r && !$r(r, e.req.header("host") ?? "")) return new Response("No matching route", { status: 404 });
|
|
3190
3297
|
for (let [n, r] of t) {
|
|
3191
3298
|
let t = e.req.header(n);
|
|
3192
3299
|
if (t === void 0 || !r.test(t)) return new Response("No matching route", { status: 404 });
|
|
@@ -3203,7 +3310,17 @@ function X(e) {
|
|
|
3203
3310
|
}
|
|
3204
3311
|
//#endregion
|
|
3205
3312
|
//#region src/data-plane/compile.ts
|
|
3206
|
-
var
|
|
3313
|
+
var ti = "forwarded_headers";
|
|
3314
|
+
function ni(e) {
|
|
3315
|
+
return e.some((e) => e.type === "forwarded_headers") ? [...e] : [{
|
|
3316
|
+
type: ti,
|
|
3317
|
+
options: {}
|
|
3318
|
+
}, ...e];
|
|
3319
|
+
}
|
|
3320
|
+
function Y(e, t) {
|
|
3321
|
+
return e.has("forwarded_headers") ? ni(t) : [...t];
|
|
3322
|
+
}
|
|
3323
|
+
var X = [
|
|
3207
3324
|
"GET",
|
|
3208
3325
|
"POST",
|
|
3209
3326
|
"PUT",
|
|
@@ -3215,39 +3332,39 @@ var Wr = [
|
|
|
3215
3332
|
function Z(e, n, r, i) {
|
|
3216
3333
|
let a = new t();
|
|
3217
3334
|
r && a.use("*", async (e, t) => {
|
|
3218
|
-
|
|
3335
|
+
rr(e, r), await t();
|
|
3219
3336
|
});
|
|
3220
|
-
let o =
|
|
3337
|
+
let o = Zr(e);
|
|
3221
3338
|
for (let e of o) {
|
|
3222
3339
|
let t = [];
|
|
3223
|
-
t.push(
|
|
3224
|
-
for (let r of e.handlers) t.push(n.build(r.type, r.options));
|
|
3225
|
-
let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) :
|
|
3340
|
+
t.push(ei(e.match));
|
|
3341
|
+
for (let r of Y(n, e.handlers)) t.push(n.build(r.type, r.options));
|
|
3342
|
+
let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) : X, i = e.match.path || "/*";
|
|
3226
3343
|
a.on(r, [i], ...t);
|
|
3227
3344
|
}
|
|
3228
|
-
return i && i.length > 0 ? a.on(
|
|
3229
|
-
let n =
|
|
3345
|
+
return i && i.length > 0 ? a.on(X, ["*"], ...i) : a.all("*", (e) => e.text("No matching route", 404)), a.onError((e, t) => {
|
|
3346
|
+
let n = G(e);
|
|
3230
3347
|
return t.text(n ? "Upstream timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "handler_timeout" : "handler_failed" });
|
|
3231
3348
|
}), a;
|
|
3232
3349
|
}
|
|
3233
3350
|
//#endregion
|
|
3234
3351
|
//#region src/data-plane/router.ts
|
|
3235
|
-
var
|
|
3236
|
-
function
|
|
3237
|
-
return e.resolver ? e.resolver : e.cache ?
|
|
3352
|
+
var ri = 1e4;
|
|
3353
|
+
function ii(e) {
|
|
3354
|
+
return e.resolver ? e.resolver : e.cache ? F(e.data, e.cache) : F(e.data, e.cacheTtlMs ?? 3e4);
|
|
3238
3355
|
}
|
|
3239
|
-
function
|
|
3356
|
+
function ai(e) {
|
|
3240
3357
|
if (e.registry) return e.registry;
|
|
3241
|
-
let t = new
|
|
3242
|
-
return
|
|
3358
|
+
let t = new I(e.bindings ?? {});
|
|
3359
|
+
return Xr(t), t;
|
|
3243
3360
|
}
|
|
3244
3361
|
function Q(e) {
|
|
3245
|
-
let t =
|
|
3362
|
+
let t = ii(e), n = ai(e), r = /* @__PURE__ */ new WeakMap(), i = e.resolveHostTimeoutMs ?? ri, a = e.defaultHandlers && e.defaultHandlers.length > 0 ? Y(n, e.defaultHandlers).map((e) => n.build(e.type, e.options)) : void 0, o = a ? Z([], n, void 0, a) : void 0;
|
|
3246
3363
|
return async (e) => {
|
|
3247
3364
|
let s = e.req.header("host") ?? e.req.header("x-forwarded-host");
|
|
3248
3365
|
if (!s) return e.text("Missing host", 400);
|
|
3249
3366
|
try {
|
|
3250
|
-
let c = await
|
|
3367
|
+
let c = await q(t.resolveHost(s), i, "resolveHost");
|
|
3251
3368
|
if (!c) return o ? await o.fetch(e.req.raw) : e.text("Unknown host", 404);
|
|
3252
3369
|
let l = r.get(c);
|
|
3253
3370
|
return l || (l = Z(c.routes, n, {
|
|
@@ -3256,17 +3373,17 @@ function Q(e) {
|
|
|
3256
3373
|
domain: c.domain
|
|
3257
3374
|
}, a), r.set(c, l)), await l.fetch(e.req.raw);
|
|
3258
3375
|
} catch (t) {
|
|
3259
|
-
return o ? await o.fetch(e.req.raw) :
|
|
3376
|
+
return o ? await o.fetch(e.req.raw) : G(t) ? e.text(`Resolve host timed out after ${i}ms`, 504, { "x-authhero-proxy-error": "resolve_host_timeout" }) : e.text("Bad gateway", 502, { "x-authhero-proxy-error": "data_plane_error" });
|
|
3260
3377
|
}
|
|
3261
3378
|
};
|
|
3262
3379
|
}
|
|
3263
|
-
function
|
|
3380
|
+
function oi(e) {
|
|
3264
3381
|
let n = new t();
|
|
3265
3382
|
return n.all("*", Q(e)), n;
|
|
3266
3383
|
}
|
|
3267
3384
|
//#endregion
|
|
3268
3385
|
//#region src/app.ts
|
|
3269
|
-
function
|
|
3386
|
+
function si(e) {
|
|
3270
3387
|
let n = new t();
|
|
3271
3388
|
return n.all("*", Q({
|
|
3272
3389
|
data: e.data,
|
|
@@ -3278,62 +3395,62 @@ function Yr(e) {
|
|
|
3278
3395
|
resolveHostTimeoutMs: e.resolveHostTimeoutMs,
|
|
3279
3396
|
defaultHandlers: e.defaultHandlers
|
|
3280
3397
|
})), n.onError((e, t) => {
|
|
3281
|
-
let n =
|
|
3398
|
+
let n = G(e);
|
|
3282
3399
|
return t.text(n ? "Proxy timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "proxy_timeout" : "proxy_error" });
|
|
3283
3400
|
}), n;
|
|
3284
3401
|
}
|
|
3285
3402
|
//#endregion
|
|
3286
3403
|
//#region src/data-plane/cache-api-cache.ts
|
|
3287
|
-
var
|
|
3288
|
-
function
|
|
3404
|
+
var ci = 1e3, li = 1e3;
|
|
3405
|
+
function ui(e, t) {
|
|
3289
3406
|
return new Request(`https://proxy-cache.internal/${encodeURIComponent(e)}/hosts/${encodeURIComponent(t.toLowerCase())}`, { method: "GET" });
|
|
3290
3407
|
}
|
|
3291
|
-
function
|
|
3408
|
+
function di() {
|
|
3292
3409
|
return globalThis.caches?.default;
|
|
3293
3410
|
}
|
|
3294
|
-
function
|
|
3295
|
-
let t = e.cache ??
|
|
3411
|
+
function fi(e) {
|
|
3412
|
+
let t = e.cache ?? di();
|
|
3296
3413
|
if (!t) return e.upstream;
|
|
3297
|
-
let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ??
|
|
3414
|
+
let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ?? ci, c = e.cacheWriteTimeoutMs ?? li;
|
|
3298
3415
|
async function l(e) {
|
|
3299
3416
|
try {
|
|
3300
|
-
return await
|
|
3417
|
+
return await q(Promise.resolve(n.match(e)), s, "cache.match");
|
|
3301
3418
|
} catch {
|
|
3302
3419
|
return;
|
|
3303
3420
|
}
|
|
3304
3421
|
}
|
|
3305
3422
|
return { async resolveHost(t) {
|
|
3306
|
-
let s =
|
|
3423
|
+
let s = ui(r, t), u = await l(s);
|
|
3307
3424
|
if (u) try {
|
|
3308
3425
|
return (await u.json()).value;
|
|
3309
3426
|
} catch {}
|
|
3310
3427
|
let d = await e.upstream.resolveHost(t), f = d === null ? a : i, p = new Response(JSON.stringify({ value: d }), { headers: {
|
|
3311
3428
|
"content-type": "application/json",
|
|
3312
3429
|
"cache-control": `public, max-age=${f}`
|
|
3313
|
-
} }), m =
|
|
3430
|
+
} }), m = q(Promise.resolve(n.put(s, p)), c, "cache.put").catch(() => void 0);
|
|
3314
3431
|
return o ? o(m) : await m, d;
|
|
3315
3432
|
} };
|
|
3316
3433
|
}
|
|
3317
|
-
function
|
|
3318
|
-
return
|
|
3434
|
+
function pi(e, t) {
|
|
3435
|
+
return ui(e, t);
|
|
3319
3436
|
}
|
|
3320
3437
|
//#endregion
|
|
3321
3438
|
//#region src/data-plane/cache-adapter-cache.ts
|
|
3322
|
-
var
|
|
3323
|
-
function
|
|
3324
|
-
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 =
|
|
3439
|
+
var mi = 1e3, hi = 1e3;
|
|
3440
|
+
function gi(e) {
|
|
3441
|
+
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 = mi, cacheWriteTimeoutMs: u = hi } = e, d = /* @__PURE__ */ new Map();
|
|
3325
3442
|
function f(e) {
|
|
3326
3443
|
return `${s}:${e.toLowerCase()}`;
|
|
3327
3444
|
}
|
|
3328
3445
|
async function p(e) {
|
|
3329
3446
|
try {
|
|
3330
|
-
return await
|
|
3447
|
+
return await q(n.get(e), l, "cache.get") ?? null;
|
|
3331
3448
|
} catch {
|
|
3332
3449
|
return null;
|
|
3333
3450
|
}
|
|
3334
3451
|
}
|
|
3335
3452
|
function m(e, t, r) {
|
|
3336
|
-
let i =
|
|
3453
|
+
let i = q(Promise.resolve().then(() => n.set(e, t, r)), u, "cache.set").catch(() => void 0);
|
|
3337
3454
|
return c ? (c(i), Promise.resolve()) : i;
|
|
3338
3455
|
}
|
|
3339
3456
|
async function h(e) {
|
|
@@ -3374,7 +3491,7 @@ function ii(e) {
|
|
|
3374
3491
|
}
|
|
3375
3492
|
} };
|
|
3376
3493
|
}
|
|
3377
|
-
function
|
|
3494
|
+
function _i(e, t) {
|
|
3378
3495
|
return `${e}:${t.toLowerCase()}`;
|
|
3379
3496
|
}
|
|
3380
3497
|
//#endregion
|
|
@@ -3382,7 +3499,7 @@ function ai(e, t) {
|
|
|
3382
3499
|
function $() {
|
|
3383
3500
|
throw Error("Static proxy adapter is read-only; configure routes at init time");
|
|
3384
3501
|
}
|
|
3385
|
-
function
|
|
3502
|
+
function vi(e, t, n, r, i, a) {
|
|
3386
3503
|
return {
|
|
3387
3504
|
id: e.id ?? `${n}:${t}`,
|
|
3388
3505
|
tenant_id: r,
|
|
@@ -3397,10 +3514,10 @@ function oi(e, t, n, r, i, a) {
|
|
|
3397
3514
|
updated_at: e.updated_at ?? a
|
|
3398
3515
|
};
|
|
3399
3516
|
}
|
|
3400
|
-
function
|
|
3517
|
+
function yi(e) {
|
|
3401
3518
|
let t = (/* @__PURE__ */ new Date()).toISOString(), n = e.defaultTenantId ?? "static", r = /* @__PURE__ */ new Map();
|
|
3402
3519
|
for (let [i, a] of Object.entries(e.hosts)) {
|
|
3403
|
-
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) =>
|
|
3520
|
+
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) => vi(n, r, e, s, c, t)).sort((e, t) => e.priority - t.priority);
|
|
3404
3521
|
r.set(e, {
|
|
3405
3522
|
tenant_id: s,
|
|
3406
3523
|
custom_domain_id: c,
|
|
@@ -3444,7 +3561,7 @@ function si(e) {
|
|
|
3444
3561
|
}
|
|
3445
3562
|
};
|
|
3446
3563
|
}
|
|
3447
|
-
function
|
|
3564
|
+
function bi(e, t = {}) {
|
|
3448
3565
|
return {
|
|
3449
3566
|
priority: t.priority,
|
|
3450
3567
|
match: { path: t.path ?? "/*" },
|
|
@@ -3459,10 +3576,10 @@ function ci(e, t = {}) {
|
|
|
3459
3576
|
}
|
|
3460
3577
|
//#endregion
|
|
3461
3578
|
//#region src/constants.ts
|
|
3462
|
-
var
|
|
3579
|
+
var xi = "proxy:resolve_host";
|
|
3463
3580
|
//#endregion
|
|
3464
3581
|
//#region src/http-adapter/index.ts
|
|
3465
|
-
function
|
|
3582
|
+
function Si() {
|
|
3466
3583
|
let e = () => {
|
|
3467
3584
|
throw Error("HTTP proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
|
|
3468
3585
|
};
|
|
@@ -3484,7 +3601,7 @@ function ui() {
|
|
|
3484
3601
|
}
|
|
3485
3602
|
};
|
|
3486
3603
|
}
|
|
3487
|
-
function
|
|
3604
|
+
function Ci(e) {
|
|
3488
3605
|
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;
|
|
3489
3606
|
function c(e) {
|
|
3490
3607
|
let t = new AbortController(), n = setTimeout(() => t.abort(), s);
|
|
@@ -3517,7 +3634,7 @@ function di(e) {
|
|
|
3517
3634
|
}), u);
|
|
3518
3635
|
}
|
|
3519
3636
|
return {
|
|
3520
|
-
proxyRoutes:
|
|
3637
|
+
proxyRoutes: Si(),
|
|
3521
3638
|
async resolveHost(e) {
|
|
3522
3639
|
let i = await f(), a = `${n}${r}${encodeURIComponent(e.toLowerCase())}`, o = await c((e) => t(a, {
|
|
3523
3640
|
headers: { authorization: `Bearer ${i}` },
|
|
@@ -3531,7 +3648,7 @@ function di(e) {
|
|
|
3531
3648
|
}
|
|
3532
3649
|
//#endregion
|
|
3533
3650
|
//#region src/http-adapter/service-binding-fetch.ts
|
|
3534
|
-
function
|
|
3651
|
+
function wi(e) {
|
|
3535
3652
|
return (t, n) => {
|
|
3536
3653
|
let r = t instanceof Request && n === void 0 ? t : new Request(t, n);
|
|
3537
3654
|
return e.fetch(r);
|
|
@@ -3539,11 +3656,11 @@ function fi(e) {
|
|
|
3539
3656
|
}
|
|
3540
3657
|
//#endregion
|
|
3541
3658
|
//#region src/kv-adapter/index.ts
|
|
3542
|
-
var
|
|
3543
|
-
function
|
|
3659
|
+
var Ti = "authhero-proxy-host:";
|
|
3660
|
+
function Ei(e, t) {
|
|
3544
3661
|
return `${e}${t.toLowerCase()}`;
|
|
3545
3662
|
}
|
|
3546
|
-
function
|
|
3663
|
+
function Di() {
|
|
3547
3664
|
let e = () => {
|
|
3548
3665
|
throw Error("KV proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
|
|
3549
3666
|
};
|
|
@@ -3565,15 +3682,15 @@ function hi() {
|
|
|
3565
3682
|
}
|
|
3566
3683
|
};
|
|
3567
3684
|
}
|
|
3568
|
-
function
|
|
3569
|
-
let { kv: t, keyPrefix: n =
|
|
3685
|
+
function Oi(e) {
|
|
3686
|
+
let { kv: t, keyPrefix: n = Ti, timeoutMs: r } = e;
|
|
3570
3687
|
return {
|
|
3571
|
-
proxyRoutes:
|
|
3688
|
+
proxyRoutes: Di(),
|
|
3572
3689
|
async resolveHost(e) {
|
|
3573
|
-
let i =
|
|
3574
|
-
return (r && r > 0 ? await
|
|
3690
|
+
let i = Ei(n, e), a = t.get(i, "json");
|
|
3691
|
+
return (r && r > 0 ? await q(a, r, "kv.get") : await a) ?? null;
|
|
3575
3692
|
}
|
|
3576
3693
|
};
|
|
3577
3694
|
}
|
|
3578
3695
|
//#endregion
|
|
3579
|
-
export {
|
|
3696
|
+
export { Ti as DEFAULT_KV_HOST_KEY_PREFIX, ti as FORWARDED_HEADERS_HANDLER_TYPE, I as HandlerRegistry, xi as PROXY_RESOLVE_HOST_SCOPE, pr as basicAuthHandler, _i as buildCacheAdapterKey, pi as buildCacheApiKey, Ei as buildKvHostKey, ei as buildMatchFilter, hr as cacheHandler, Z as compileHostApp, ur as corsHandler, gi as createCacheAdapterHostCache, fi as createCacheApiHostCache, Ci as createHttpProxyAdapter, F as createInMemoryHostCache, Oi as createKvProxyAdapter, si as createProxyApp, Q as createProxyDataPlaneHandler, oi as createProxyDataPlaneRouter, wi as createServiceBindingFetch, yi as createStaticProxyAdapter, L as defineHandler, qr as dispatchNamespaceHandler, Tr as forwardedHeadersHandler, En as handlerConfigSchema, mr as headersHandler, Rr as httpHandler, bi as httpRoute, wr as isCloudflareIp, Tn as matchSchema, $r as matchesAnyHost, Qr as matchesHost, P as proxyRouteInsertSchema, Dn as proxyRouteSchema, On as proxyRouteUpdateSchema, Jr as redirectHandler, Xr as registerBuiltinHandlers, kr as rewriteCookiesHandler, Ar as rewriteLocationHandler, Hr as serviceBindingHandler, Zr as sortRoutes, Yr as staticHandler, ni as withForwardedHeaders, Y as withForwardedHeadersFor };
|