@authhero/proxy 0.10.4 → 0.10.6

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.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
- }({}), Le = /* @__PURE__ */ function(e) {
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
- }({}), Re = /* @__PURE__ */ function(e) {
622
+ }({}), Le = /* @__PURE__ */ function(e) {
623
623
  return e.S256 = "S256", e.Plain = "plain", e;
624
- }({}), ze = e.union([e.null(), e.object({
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(), Be = e.object({
629
- userinfo: e.record(e.string(), ze).optional(),
630
- id_token: e.record(e.string(), ze).optional()
631
- }), Ve = e.object({
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(Le).optional(),
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(Re).optional(),
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: Be.optional(),
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 He = e.enum([
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: He,
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 Ue = e.object({
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 v(e) {
817
+ function b(e) {
818
818
  if (e !== null) {
819
- if (Array.isArray(e)) return e.filter((e) => e !== null).map(v);
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] = v(r));
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 We = e.object({
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 ? {} : v(e), Ue).default({}),
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(Le).optional(),
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(We.shape);
847
- var Ge = e.object({
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
- }), Ke = e.discriminatedUnion("name", [e.object({
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
- })]), qe = Ge.extend({
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(Ke) }).optional(),
879
+ verification: e.object({ methods: e.array(We) }).optional(),
880
880
  tls_policy: e.string().optional()
881
881
  });
882
- Ge.pick({
882
+ Ue.pick({
883
883
  tls_policy: !0,
884
884
  custom_client_ip_header: !0,
885
885
  domain_metadata: !0
886
- }).strict(), qe.extend({ tenant_id: e.string() }), e.object({
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 y = e.object({
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
- }), b = y.extend({ category: e.literal("BLOCK").optional() }), Je = b.extend({
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
- }), Ye = b.extend({
897
+ }), qe = S.extend({
898
898
  type: e.literal("HTML"),
899
899
  config: e.object({ content: e.string().optional() }).optional()
900
- }), Xe = b.extend({
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
- }), Ze = b.extend({
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
- }), Qe = b.extend({
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
- }), $e = b.extend({
920
+ }), Ze = S.extend({
921
921
  type: e.literal("NEXT_BUTTON"),
922
922
  config: e.object({ text: e.string().optional() })
923
- }), et = b.extend({
923
+ }), Qe = S.extend({
924
924
  type: e.literal("PREVIOUS_BUTTON"),
925
925
  config: e.object({ text: e.string().optional() })
926
- }), tt = b.extend({
926
+ }), $e = S.extend({
927
927
  type: e.literal("RICH_TEXT"),
928
928
  config: e.object({ content: e.string().optional() }).optional()
929
- }), x = y.extend({
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
- }), nt = x.extend({
935
+ }), et = C.extend({
936
936
  type: e.literal("AUTH0_VERIFIABLE_CREDENTIALS"),
937
937
  config: e.object({ credential_type: e.string().optional() })
938
- }), rt = x.extend({
938
+ }), tt = C.extend({
939
939
  type: e.literal("GMAPS_ADDRESS"),
940
940
  config: e.object({ api_key: e.string().optional() })
941
- }), it = x.extend({
941
+ }), nt = C.extend({
942
942
  type: e.literal("RECAPTCHA"),
943
943
  config: e.object({ site_key: e.string().optional() })
944
- }), S = y.extend({
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
- }), at = S.extend({
960
+ }), rt = w.extend({
961
961
  type: e.literal("BOOLEAN"),
962
962
  config: e.object({ default_value: e.boolean().optional() }).optional()
963
- }), ot = S.extend({
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
- }), st = S.extend({
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
- }), ct = S.extend({
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
- }), lt = S.extend({
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
- }), ut = S.extend({
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
- }), dt = S.extend({
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
- }), ft = S.extend({
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
- }), pt = S.extend({
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
- }), mt = S.extend({
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
- }), ht = S.extend({
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
- }), gt = S.extend({
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
- }), _t = S.extend({
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
- }), vt = S.extend({
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
- }), yt = S.extend({
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
- }), bt = S.extend({
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
- }), xt = S.extend({
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
- }), St = S.extend({
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
- }), Ct = e.discriminatedUnion("type", [
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
- ]), wt = e.discriminatedUnion("type", [
1129
- nt,
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
- yt,
1149
- bt,
1150
- St
1151
- ]), C = e.union([
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 w = e.object({
1181
+ var T = e.object({
1182
1182
  x: e.number(),
1183
1183
  y: e.number()
1184
- }), Et = e.object({
1184
+ }), Tt = e.object({
1185
1185
  id: e.string(),
1186
1186
  type: e.literal("FLOW"),
1187
- coordinates: w,
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
- }), Dt = e.object({
1193
+ }), Et = e.object({
1194
1194
  id: e.string(),
1195
1195
  type: e.literal("ROUTER"),
1196
- coordinates: w,
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
- }), Ot = e.object({
1207
+ }), Dt = e.object({
1208
1208
  id: e.string(),
1209
1209
  type: e.literal("STEP"),
1210
- coordinates: w,
1210
+ coordinates: T,
1211
1211
  alias: e.string().min(1).max(150).optional(),
1212
1212
  config: e.object({
1213
- components: e.array(C),
1213
+ components: e.array(wt),
1214
1214
  next_node: e.string().optional()
1215
1215
  })
1216
- }), kt = e.discriminatedUnion("type", [
1216
+ }), Ot = e.discriminatedUnion("type", [
1217
+ Tt,
1217
1218
  Et,
1218
- Dt,
1219
- Ot
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(kt).optional(),
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: w.optional()
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: w.optional(),
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(At.shape).extend({ id: e.string() });
1256
- var jt = e.object({
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
- }), Mt = e.object({
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(C),
1278
- messages: e.array(jt).optional(),
1279
- links: e.array(Mt).optional(),
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 T = e.enum([
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
- ]), E = e.enum(["post-user-login"]), D = e.enum([
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
- ]), O = e.enum([
1295
+ ]), k = e.enum([
1296
1296
  "post-user-login",
1297
1297
  "credentials-exchange",
1298
1298
  "pre-user-registration",
1299
1299
  "post-user-registration"
1300
- ]), k = e.enum(["post-user-login"]);
1301
- T.options, E.options, D.options, O.options, k.options;
1302
- var A = e.enum(["impersonate"]), Nt = e.enum([
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: T,
1314
+ trigger_id: E,
1315
1315
  url: e.string()
1316
1316
  }), Ft = e.object({
1317
1317
  ...j,
1318
- trigger_id: E,
1318
+ trigger_id: D,
1319
1319
  form_id: e.string()
1320
1320
  }), It = e.object({
1321
1321
  ...j,
1322
- trigger_id: D,
1322
+ trigger_id: O,
1323
1323
  template_id: Nt
1324
1324
  }), Lt = e.object({
1325
1325
  ...j,
1326
- trigger_id: O,
1326
+ trigger_id: k,
1327
1327
  code_id: e.string()
1328
1328
  }), Rt = e.object({
1329
1329
  ...j,
1330
- trigger_id: k,
1331
- page_id: A,
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: T
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: E
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: D
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: O
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: k
1367
+ trigger_id: A
1368
1368
  }).extend(n.shape).extend({
1369
1369
  hook_id: e.string(),
1370
- page_id: A,
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: Ve,
1485
+ authParams: ze,
1486
1486
  expires_at: e.string(),
1487
1487
  deleted_at: e.string().optional(),
1488
1488
  ip: e.string().optional(),
@@ -2584,21 +2584,32 @@ e.object({
2584
2584
  cohorts: e.array(Kn)
2585
2585
  });
2586
2586
  var qn = e.object({
2587
+ cohort: e.string(),
2588
+ tokens: e.number(),
2589
+ active: e.array(e.number())
2590
+ });
2591
+ e.object({
2592
+ interval: e.literal("week"),
2593
+ from: e.string(),
2594
+ to: e.string(),
2595
+ cohorts: e.array(qn)
2596
+ });
2597
+ var Jn = e.object({
2587
2598
  name: e.string(),
2588
2599
  type: e.string()
2589
- }), Jn = e.object({
2600
+ }), Yn = e.object({
2590
2601
  elapsed: e.number(),
2591
2602
  rows_read: e.number().optional(),
2592
2603
  bytes_read: e.number().optional()
2593
2604
  });
2594
2605
  e.object({
2595
- meta: e.array(qn),
2606
+ meta: e.array(Jn),
2596
2607
  data: e.array(e.record(e.string(), e.any())),
2597
2608
  rows: e.number(),
2598
2609
  rows_before_limit_at_least: e.number().optional(),
2599
- statistics: Jn.optional()
2610
+ statistics: Yn.optional()
2600
2611
  });
2601
- var Yn = 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(".")), Xn = e.record(e.string(), e.record(e.string(), e.string())).openapi({
2612
+ var Xn = 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(".")), Zn = e.record(e.string(), e.record(e.string(), e.string())).openapi({
2602
2613
  type: "object",
2603
2614
  additionalProperties: {
2604
2615
  type: "object",
@@ -2606,11 +2617,11 @@ var Yn = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.
2606
2617
  }
2607
2618
  });
2608
2619
  e.object({
2609
- prompt: Yn,
2620
+ prompt: Xn,
2610
2621
  language: e.string(),
2611
- custom_text: Xn
2622
+ custom_text: Zn
2612
2623
  });
2613
- var Zn = e.enum([
2624
+ var Qn = e.enum([
2614
2625
  "phone",
2615
2626
  "totp",
2616
2627
  "email",
@@ -2618,9 +2629,9 @@ var Zn = e.enum([
2618
2629
  "webauthn-roaming",
2619
2630
  "webauthn-platform",
2620
2631
  "passkey"
2621
- ]), Qn = e.object({
2632
+ ]), $n = e.object({
2622
2633
  user_id: e.string(),
2623
- type: Zn,
2634
+ type: Qn,
2624
2635
  phone_number: e.string().optional(),
2625
2636
  totp_secret: e.string().optional(),
2626
2637
  credential_id: e.string().optional(),
@@ -2631,7 +2642,7 @@ var Zn = e.enum([
2631
2642
  friendly_name: e.string().optional(),
2632
2643
  confirmed: e.boolean().default(!1)
2633
2644
  });
2634
- function F(t, n) {
2645
+ function er(t, n) {
2635
2646
  t.type === "phone" && !t.phone_number && n.addIssue({
2636
2647
  code: e.ZodIssueCode.custom,
2637
2648
  message: "phone_number is required when type is 'phone'",
@@ -2654,23 +2665,23 @@ function F(t, n) {
2654
2665
  path: ["public_key"]
2655
2666
  }));
2656
2667
  }
2657
- Qn.superRefine(F), Qn.extend({
2668
+ $n.superRefine(er), $n.extend({
2658
2669
  id: e.string(),
2659
2670
  created_at: e.string(),
2660
2671
  updated_at: e.string()
2661
- }).superRefine(F), e.object({
2672
+ }).superRefine(er), e.object({
2662
2673
  id: e.string().optional(),
2663
2674
  created_at: e.string().datetime({ offset: !0 }).optional(),
2664
2675
  updated_at: e.string().datetime({ offset: !0 }).optional()
2665
2676
  });
2666
2677
  //#endregion
2667
2678
  //#region src/data-plane/cache.ts
2668
- var $n = 1e4;
2669
- function I(e, t, n) {
2679
+ var tr = 1e4;
2680
+ function F(e, t, n) {
2670
2681
  let r = typeof t == "number" ? {
2671
2682
  freshTtlMs: t,
2672
2683
  maxEntries: n
2673
- } : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ?? $n, l = r.waitUntil, u = /* @__PURE__ */ new Map();
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();
2674
2685
  function d(e) {
2675
2686
  for (let [t, n] of u) n.stale_if_error_until <= e && n.stale_until <= e && !n.refreshing && u.delete(t);
2676
2687
  for (; u.size >= c;) {
@@ -2727,7 +2738,7 @@ function I(e, t, n) {
2727
2738
  }
2728
2739
  //#endregion
2729
2740
  //#region src/data-plane/registry.ts
2730
- var L = class {
2741
+ var I = class {
2731
2742
  definitions = /* @__PURE__ */ new Map();
2732
2743
  bindings;
2733
2744
  constructor(e = {}) {
@@ -2747,38 +2758,38 @@ var L = class {
2747
2758
  return n.build(r.data, { bindings: this.bindings });
2748
2759
  }
2749
2760
  };
2750
- function R(e) {
2761
+ function L(e) {
2751
2762
  return e;
2752
2763
  }
2753
2764
  //#endregion
2754
2765
  //#region src/data-plane/handlers/util.ts
2755
- var z = "__authhero_proxy_request__", B = "__authhero_proxy_tenant_id__", V = "__authhero_proxy_custom_domain_id__", H = "__authhero_proxy_domain__", U = "x-authhero-proxy-mutability-probe";
2756
- function er(e, t) {
2757
- e.set(z, t);
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";
2767
+ function nr(e, t) {
2768
+ e.set(R, t);
2758
2769
  }
2759
- function W(e) {
2760
- return e.get(z) ?? e.req.raw;
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);
2761
2775
  }
2762
- function tr(e, t) {
2763
- e.set(B, t.tenant_id), e.set(V, t.custom_domain_id), e.set(H, t.domain);
2776
+ function ir(e) {
2777
+ return e.get(z);
2764
2778
  }
2765
- function nr(e) {
2779
+ function ar(e) {
2766
2780
  return e.get(B);
2767
2781
  }
2768
- function rr(e) {
2782
+ function or(e) {
2769
2783
  return e.get(V);
2770
2784
  }
2771
- function ir(e) {
2772
- return e.get(H);
2773
- }
2774
- function ar(e, t) {
2775
- let n = W(e), r = new Headers(n.headers);
2776
- t(r), er(e, new Request(n, { headers: r }));
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 }));
2777
2788
  }
2778
- function G(e) {
2789
+ function W(e) {
2779
2790
  let t = e.res;
2780
2791
  try {
2781
- t.headers.append(U, "1"), t.headers.delete(U);
2792
+ t.headers.append(H, "1"), t.headers.delete(H);
2782
2793
  return;
2783
2794
  } catch {
2784
2795
  e.res = new Response(t.body, {
@@ -2790,7 +2801,7 @@ function G(e) {
2790
2801
  }
2791
2802
  //#endregion
2792
2803
  //#region src/data-plane/handlers/cors.ts
2793
- var or = e.object({
2804
+ var cr = e.object({
2794
2805
  origins: e.array(e.string()).optional(),
2795
2806
  allow_credentials: e.boolean().optional(),
2796
2807
  allow_headers: e.array(e.string()).optional(),
@@ -2798,44 +2809,44 @@ var or = e.object({
2798
2809
  expose_headers: e.array(e.string()).optional(),
2799
2810
  max_age: e.number().int().optional()
2800
2811
  }).refine((e) => !(e.allow_credentials && e.origins?.includes("*")), { message: "Cannot use wildcard origin (*) with allow_credentials" });
2801
- function sr(e, t) {
2812
+ function lr(e, t) {
2802
2813
  let n = new Headers(), r = e.origins ?? ["*"], i = r.includes("*");
2803
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;
2804
2815
  }
2805
- var cr = R({
2816
+ var ur = L({
2806
2817
  type: "cors",
2807
- optionsSchema: or,
2818
+ optionsSchema: cr,
2808
2819
  build(e) {
2809
2820
  return async (t, n) => {
2810
2821
  let r = t.req.header("origin") ?? null;
2811
2822
  if (t.req.method === "OPTIONS" && r !== null && t.req.header("access-control-request-method") !== void 0) {
2812
- let t = sr(e, r);
2823
+ let t = lr(e, r);
2813
2824
  return new Response(null, {
2814
2825
  status: 204,
2815
2826
  headers: t
2816
2827
  });
2817
2828
  }
2818
2829
  await n();
2819
- let i = sr(e, r);
2820
- G(t), i.forEach((e, n) => {
2830
+ let i = lr(e, r);
2831
+ W(t), i.forEach((e, n) => {
2821
2832
  n.toLowerCase() === "vary" ? t.res.headers.append(n, e) : t.res.headers.set(n, e);
2822
2833
  });
2823
2834
  };
2824
2835
  }
2825
- }), lr = e.object({
2836
+ }), dr = e.object({
2826
2837
  username: e.string(),
2827
2838
  password: e.string(),
2828
2839
  realm: e.string().optional()
2829
2840
  });
2830
- function ur(e, t) {
2841
+ function fr(e, t) {
2831
2842
  let n = `${e}:${t}`;
2832
2843
  return typeof btoa == "function" ? btoa(n) : Buffer.from(n, "utf-8").toString("base64");
2833
2844
  }
2834
- var dr = R({
2845
+ var pr = L({
2835
2846
  type: "basic_auth",
2836
- optionsSchema: lr,
2847
+ optionsSchema: dr,
2837
2848
  build(e) {
2838
- let t = ur(e.username, e.password), n = (e.realm ?? "Restricted").replace(/["\\\r\n]/g, "");
2849
+ let t = fr(e.username, e.password), n = (e.realm ?? "Restricted").replace(/["\\\r\n]/g, "");
2839
2850
  return async (e, r) => {
2840
2851
  let i = e.req.header("authorization");
2841
2852
  if (i) {
@@ -2851,7 +2862,7 @@ var dr = R({
2851
2862
  });
2852
2863
  };
2853
2864
  }
2854
- }), fr = R({
2865
+ }), mr = L({
2855
2866
  type: "headers",
2856
2867
  optionsSchema: e.object({
2857
2868
  request: e.record(e.string(), e.string()).optional(),
@@ -2861,66 +2872,173 @@ var dr = R({
2861
2872
  }),
2862
2873
  build(e) {
2863
2874
  return async (t, n) => {
2864
- if ((e.request || e.remove_request) && ar(t, (t) => {
2875
+ if ((e.request || e.remove_request) && sr(t, (t) => {
2865
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);
2866
- }), 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);
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);
2867
2878
  };
2868
2879
  }
2869
- }), pr = R({
2880
+ }), hr = L({
2870
2881
  type: "cache",
2871
2882
  optionsSchema: e.object({ ttl_seconds: e.number().int().positive() }),
2872
2883
  build(e) {
2873
2884
  return async (t, n) => {
2874
2885
  if (await n(), !t.res.headers.has("Cache-Control")) {
2875
2886
  let n = t.res.headers.has("set-cookie") ? "private" : "public";
2876
- G(t), t.res.headers.set("Cache-Control", `${n}, max-age=${e.ttl_seconds}`);
2887
+ W(t), t.res.headers.set("Cache-Control", `${n}, max-age=${e.ttl_seconds}`);
2877
2888
  }
2878
2889
  };
2879
2890
  }
2880
- }), mr = R({
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({
2881
2998
  type: "forwarded_headers",
2882
2999
  optionsSchema: e.object({
2883
3000
  client_ip_header: e.string().default("cf-connecting-ip"),
2884
3001
  set_x_real_ip: e.boolean().default(!0),
2885
- 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)
2886
3004
  }),
2887
3005
  build(e) {
2888
3006
  return async (t, n) => {
2889
3007
  let r = new URL(t.req.url);
2890
- ar(t, (n) => {
3008
+ sr(t, (n) => {
2891
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);
2892
- 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;
2893
- n.set("x-forwarded-for", c), e.set_x_real_ip && n.set("x-real-ip", o);
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);
2894
3012
  }), await n();
2895
3013
  };
2896
3014
  }
2897
- }), hr = e.object({ upstream_host: e.string().optional() });
2898
- function gr(e) {
3015
+ }), Er = e.object({ upstream_host: e.string().optional() });
3016
+ function Dr(e) {
2899
3017
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2900
3018
  }
2901
- function _r(e) {
3019
+ function Or(e) {
2902
3020
  if (typeof e.getSetCookie == "function") return e.getSetCookie();
2903
3021
  let t = [];
2904
3022
  return e.forEach((e, n) => {
2905
3023
  n.toLowerCase() === "set-cookie" && t.push(e);
2906
3024
  }), t;
2907
3025
  }
2908
- var vr = R({
3026
+ var kr = L({
2909
3027
  type: "rewrite_cookies",
2910
- optionsSchema: hr,
3028
+ optionsSchema: Er,
2911
3029
  build(e) {
2912
3030
  return async (t, n) => {
2913
3031
  await n();
2914
3032
  let r = new URL(t.req.url).hostname, i = e.upstream_host ?? t.get("__proxy_upstream_host__");
2915
3033
  if (!i) return;
2916
- let a = _r(t.res.headers);
3034
+ let a = Or(t.res.headers);
2917
3035
  if (a.length === 0) return;
2918
- let o = gr(i), s = RegExp(`(?:^|;\\s*)Domain=\\.?${o}(?=;|$)`, "i");
2919
- G(t), t.res.headers.delete("set-cookie");
3036
+ let o = Dr(i), s = RegExp(`(?:^|;\\s*)Domain=\\.?${o}(?=;|$)`, "i");
3037
+ W(t), t.res.headers.delete("set-cookie");
2920
3038
  for (let e of a) t.res.headers.append("set-cookie", e.replace(s, `Domain=${r}`));
2921
3039
  };
2922
3040
  }
2923
- }), yr = R({
3041
+ }), Ar = L({
2924
3042
  type: "rewrite_location",
2925
3043
  optionsSchema: e.object({ upstream_origin: e.string().optional() }),
2926
3044
  build(e) {
@@ -2940,25 +3058,25 @@ var vr = R({
2940
3058
  }
2941
3059
  if (o.origin !== a) return;
2942
3060
  let s = new URL(t.req.url), c = `${`${s.protocol}//${s.host}`}${o.pathname}${o.search}${o.hash}`;
2943
- G(t), t.res.headers.set("location", c);
3061
+ W(t), t.res.headers.set("location", c);
2944
3062
  };
2945
3063
  }
2946
- }), br = class extends Error {
3064
+ }), jr = class extends Error {
2947
3065
  ms;
2948
3066
  constructor(e, t) {
2949
3067
  super(`${t ?? "Operation"} timed out after ${e}ms`), this.name = "TimeoutError", this.ms = e;
2950
3068
  }
2951
3069
  };
2952
- function K(e) {
2953
- return e instanceof br ? !0 : e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
3070
+ function G(e) {
3071
+ return e instanceof jr ? !0 : e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
2954
3072
  }
2955
- function q(e, t) {
3073
+ function K(e, t) {
2956
3074
  let n = new AbortController(), r = setTimeout(() => n.abort(), e);
2957
3075
  return t(n.signal).finally(() => clearTimeout(r));
2958
3076
  }
2959
- function J(e, t, n) {
3077
+ function q(e, t, n) {
2960
3078
  let r, i = new Promise((e, i) => {
2961
- r = setTimeout(() => i(new br(t, n)), t);
3079
+ r = setTimeout(() => i(new jr(t, n)), t);
2962
3080
  });
2963
3081
  return Promise.race([e, i]).finally(() => {
2964
3082
  r && clearTimeout(r);
@@ -2966,7 +3084,7 @@ function J(e, t, n) {
2966
3084
  }
2967
3085
  //#endregion
2968
3086
  //#region src/data-plane/handlers/http.ts
2969
- var xr = new Set([
3087
+ var Mr = new Set([
2970
3088
  "connection",
2971
3089
  "keep-alive",
2972
3090
  "proxy-authenticate",
@@ -2975,24 +3093,24 @@ var xr = new Set([
2975
3093
  "trailers",
2976
3094
  "transfer-encoding",
2977
3095
  "upgrade"
2978
- ]), Sr = 3e4, Cr = e.object({
3096
+ ]), Nr = 3e4, Pr = e.object({
2979
3097
  upstream_url: e.string(),
2980
3098
  preserve_host: e.boolean().default(!1),
2981
3099
  timeout_ms: e.number().int().positive().optional()
2982
3100
  });
2983
- function wr(e, t) {
3101
+ function Fr(e, t) {
2984
3102
  return e === "" || e === "/" ? t : `${e.endsWith("/") ? e.slice(0, -1) : e}${t.startsWith("/") ? t : `/${t}`}`;
2985
3103
  }
2986
- function Tr(e) {
3104
+ function Ir(e) {
2987
3105
  return e !== "GET" && e !== "HEAD";
2988
3106
  }
2989
- function Er(e, t) {
3107
+ function Lr(e, t) {
2990
3108
  let n = new URL(t.url), r = new URL(e.upstream_url);
2991
- r.pathname = wr(r.pathname, n.pathname), r.search = n.search;
3109
+ r.pathname = Fr(r.pathname, n.pathname), r.search = n.search;
2992
3110
  let i = new Headers(t.headers);
2993
- for (let e of xr) i.delete(e);
3111
+ for (let e of Mr) i.delete(e);
2994
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(":", ""));
2995
- let a = Tr(t.method) ? t.body : void 0, o = {
3113
+ let a = Ir(t.method) ? t.body : void 0, o = {
2996
3114
  method: t.method,
2997
3115
  headers: i,
2998
3116
  body: a,
@@ -3003,85 +3121,85 @@ function Er(e, t) {
3003
3121
  init: o
3004
3122
  };
3005
3123
  }
3006
- var Dr = R({
3124
+ var Rr = L({
3007
3125
  type: "http",
3008
- optionsSchema: Cr,
3126
+ optionsSchema: Pr,
3009
3127
  build(e) {
3010
- let t = e.timeout_ms ?? Sr;
3128
+ let t = e.timeout_ms ?? Nr;
3011
3129
  return async (n) => {
3012
- let { target: r, init: i } = Er(e, W(n));
3130
+ let { target: r, init: i } = Lr(e, U(n));
3013
3131
  n.set("__proxy_upstream_host__", r.hostname), n.set("__proxy_upstream_origin__", `${r.protocol}//${r.host}`);
3014
3132
  try {
3015
- return await q(t, (e) => fetch(r.toString(), {
3133
+ return await K(t, (e) => fetch(r.toString(), {
3016
3134
  ...i,
3017
3135
  signal: e
3018
3136
  }));
3019
3137
  } catch (e) {
3020
- return K(e) ? n.text("Upstream timeout", 504, { "x-authhero-proxy-error": "http_timeout" }) : n.text("Bad gateway", 502, { "x-authhero-proxy-error": "http_failed" });
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" });
3021
3139
  }
3022
3140
  };
3023
3141
  }
3024
- }), Or = 3e4, kr = e.object({
3142
+ }), zr = 3e4, Br = e.object({
3025
3143
  binding: e.string(),
3026
3144
  upstream_url: e.string().optional(),
3027
3145
  preserve_host: e.boolean().default(!0),
3028
3146
  timeout_ms: e.number().int().positive().optional()
3029
3147
  });
3030
- function Ar(e) {
3148
+ function Vr(e) {
3031
3149
  return typeof e == "object" && !!e && typeof e.fetch == "function";
3032
3150
  }
3033
- var jr = R({
3151
+ var Hr = L({
3034
3152
  type: "service_binding",
3035
- optionsSchema: kr,
3153
+ optionsSchema: Br,
3036
3154
  build(e, t) {
3037
3155
  let n = t.bindings[e.binding];
3038
- if (!Ar(n)) throw Error(`Service binding "${e.binding}" is not configured or is not a Fetcher`);
3039
- let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ?? Or;
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;
3040
3158
  return async (t) => {
3041
- let a = W(t), { target: o, init: s } = Er({
3159
+ let a = U(t), { target: o, init: s } = Lr({
3042
3160
  upstream_url: r,
3043
3161
  preserve_host: e.preserve_host
3044
3162
  }, a);
3045
3163
  t.set("__proxy_upstream_host__", o.hostname), t.set("__proxy_upstream_origin__", `${o.protocol}//${o.host}`);
3046
3164
  try {
3047
- return await q(i, async (e) => n.fetch(new Request(o.toString(), {
3165
+ return await K(i, async (e) => n.fetch(new Request(o.toString(), {
3048
3166
  ...s,
3049
3167
  signal: e
3050
3168
  })));
3051
3169
  } catch (e) {
3052
- return K(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" });
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" });
3053
3171
  }
3054
3172
  };
3055
3173
  }
3056
- }), Mr = 3e4, Nr = e.object({
3174
+ }), Ur = 3e4, Wr = e.object({
3057
3175
  binding: e.string(),
3058
3176
  script_name: e.string(),
3059
3177
  cpu_ms: e.number().int().positive().optional(),
3060
3178
  subrequests: e.number().int().positive().optional(),
3061
3179
  timeout_ms: e.number().int().positive().optional()
3062
3180
  });
3063
- function Pr(e) {
3181
+ function Gr(e) {
3064
3182
  return typeof e == "object" && !!e && typeof e.get == "function";
3065
3183
  }
3066
- var Y = /\{(tenant_id|custom_domain_id|domain|host)\}/g;
3067
- function Fr(e) {
3068
- return Y.lastIndex = 0, Y.test(e);
3184
+ var J = /\{(tenant_id|custom_domain_id|domain|host)\}/g;
3185
+ function Kr(e) {
3186
+ return J.lastIndex = 0, J.test(e);
3069
3187
  }
3070
- var Ir = R({
3188
+ var qr = L({
3071
3189
  type: "dispatch_namespace",
3072
- optionsSchema: Nr,
3190
+ optionsSchema: Wr,
3073
3191
  build(e, t) {
3074
3192
  let n = t.bindings[e.binding];
3075
- if (!Pr(n)) throw Error(`Dispatch namespace binding "${e.binding}" is not configured or does not expose .get()`);
3076
- let r = Fr(e.script_name), i = e.timeout_ms ?? Mr, a = e.cpu_ms || e.subrequests ? { limits: {
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: {
3077
3195
  ...e.cpu_ms ? { cpuMs: e.cpu_ms } : {},
3078
3196
  ...e.subrequests ? { subrequests: e.subrequests } : {}
3079
3197
  } } : void 0;
3080
3198
  return async (t) => {
3081
3199
  let o = e.script_name;
3082
3200
  if (r) {
3083
- let n = nr(t), r = rr(t), i = ir(t), a = t.req.header("host") ?? t.req.header("x-forwarded-host") ?? "";
3084
- if (o = o.replace(Y, (e, t) => {
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) => {
3085
3203
  switch (t) {
3086
3204
  case "tenant_id": return n ?? "";
3087
3205
  case "custom_domain_id": return r ?? "";
@@ -3091,19 +3209,19 @@ var Ir = R({
3091
3209
  }
3092
3210
  }), o.includes("{") || o === "") return t.text(`dispatch_namespace: could not resolve script name from template "${e.script_name}"`, 500);
3093
3211
  }
3094
- let s = W(t);
3212
+ let s = U(t);
3095
3213
  try {
3096
3214
  let e = n.get(o, void 0, a);
3097
- return await q(i, async (t) => {
3215
+ return await K(i, async (t) => {
3098
3216
  let n = new Request(s, { signal: t });
3099
3217
  return e.fetch(n);
3100
3218
  });
3101
3219
  } catch (e) {
3102
- return K(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" });
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" });
3103
3221
  }
3104
3222
  };
3105
3223
  }
3106
- }), Lr = R({
3224
+ }), Jr = L({
3107
3225
  type: "redirect",
3108
3226
  optionsSchema: e.object({
3109
3227
  upstream_url: e.string().refine((e) => {
@@ -3132,7 +3250,7 @@ var Ir = R({
3132
3250
  });
3133
3251
  };
3134
3252
  }
3135
- }), Rr = R({
3253
+ }), Yr = L({
3136
3254
  type: "static",
3137
3255
  optionsSchema: e.object({
3138
3256
  status: e.number().int().default(200),
@@ -3152,15 +3270,15 @@ var Ir = R({
3152
3270
  });
3153
3271
  //#endregion
3154
3272
  //#region src/data-plane/handlers/index.ts
3155
- function zr(e) {
3156
- e.add(cr).add(dr).add(fr).add(pr).add(mr).add(vr).add(yr).add(Dr).add(jr).add(Ir).add(Lr).add(Rr);
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);
3157
3275
  }
3158
3276
  //#endregion
3159
3277
  //#region src/data-plane/matcher.ts
3160
- function Br(e) {
3278
+ function Zr(e) {
3161
3279
  return [...e].sort((e, t) => e.priority === t.priority ? e.created_at.localeCompare(t.created_at) : e.priority - t.priority);
3162
3280
  }
3163
- function Vr(e, t) {
3281
+ function Qr(e, t) {
3164
3282
  let n = e.toLowerCase(), r = t.toLowerCase();
3165
3283
  if (n === r) return !0;
3166
3284
  if (n.startsWith("*.")) {
@@ -3169,13 +3287,13 @@ function Vr(e, t) {
3169
3287
  }
3170
3288
  return !1;
3171
3289
  }
3172
- function Hr(e, t) {
3173
- return !e || e.length === 0 ? !0 : e.some((e) => Vr(e, t));
3290
+ function $r(e, t) {
3291
+ return !e || e.length === 0 ? !0 : e.some((e) => Qr(e, t));
3174
3292
  }
3175
- function X(e) {
3293
+ function ei(e) {
3176
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;
3177
3295
  return async (e, i) => {
3178
- if (r && !Hr(r, e.req.header("host") ?? "")) return new Response("No matching route", { status: 404 });
3296
+ if (r && !$r(r, e.req.header("host") ?? "")) return new Response("No matching route", { status: 404 });
3179
3297
  for (let [n, r] of t) {
3180
3298
  let t = e.req.header(n);
3181
3299
  if (t === void 0 || !r.test(t)) return new Response("No matching route", { status: 404 });
@@ -3192,7 +3310,17 @@ function X(e) {
3192
3310
  }
3193
3311
  //#endregion
3194
3312
  //#region src/data-plane/compile.ts
3195
- var Ur = [
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 = [
3196
3324
  "GET",
3197
3325
  "POST",
3198
3326
  "PUT",
@@ -3204,39 +3332,39 @@ var Ur = [
3204
3332
  function Z(e, n, r, i) {
3205
3333
  let a = new t();
3206
3334
  r && a.use("*", async (e, t) => {
3207
- tr(e, r), await t();
3335
+ rr(e, r), await t();
3208
3336
  });
3209
- let o = Br(e);
3337
+ let o = Zr(e);
3210
3338
  for (let e of o) {
3211
3339
  let t = [];
3212
- t.push(X(e.match));
3213
- for (let r of e.handlers) t.push(n.build(r.type, r.options));
3214
- let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) : Ur, i = e.match.path || "/*";
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 || "/*";
3215
3343
  a.on(r, [i], ...t);
3216
3344
  }
3217
- return i && i.length > 0 ? a.on(Ur, ["*"], ...i) : a.all("*", (e) => e.text("No matching route", 404)), a.onError((e, t) => {
3218
- let n = K(e);
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);
3219
3347
  return t.text(n ? "Upstream timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "handler_timeout" : "handler_failed" });
3220
3348
  }), a;
3221
3349
  }
3222
3350
  //#endregion
3223
3351
  //#region src/data-plane/router.ts
3224
- var Wr = 1e4;
3225
- function Gr(e) {
3226
- return e.resolver ? e.resolver : e.cache ? I(e.data, e.cache) : I(e.data, e.cacheTtlMs ?? 3e4);
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);
3227
3355
  }
3228
- function Kr(e) {
3356
+ function ai(e) {
3229
3357
  if (e.registry) return e.registry;
3230
- let t = new L(e.bindings ?? {});
3231
- return zr(t), t;
3358
+ let t = new I(e.bindings ?? {});
3359
+ return Xr(t), t;
3232
3360
  }
3233
3361
  function Q(e) {
3234
- let t = Gr(e), n = Kr(e), r = /* @__PURE__ */ new WeakMap(), i = e.resolveHostTimeoutMs ?? Wr, 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;
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;
3235
3363
  return async (e) => {
3236
3364
  let s = e.req.header("host") ?? e.req.header("x-forwarded-host");
3237
3365
  if (!s) return e.text("Missing host", 400);
3238
3366
  try {
3239
- let c = await J(t.resolveHost(s), i, "resolveHost");
3367
+ let c = await q(t.resolveHost(s), i, "resolveHost");
3240
3368
  if (!c) return o ? await o.fetch(e.req.raw) : e.text("Unknown host", 404);
3241
3369
  let l = r.get(c);
3242
3370
  return l || (l = Z(c.routes, n, {
@@ -3245,17 +3373,17 @@ function Q(e) {
3245
3373
  domain: c.domain
3246
3374
  }, a), r.set(c, l)), await l.fetch(e.req.raw);
3247
3375
  } catch (t) {
3248
- return o ? await o.fetch(e.req.raw) : K(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" });
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" });
3249
3377
  }
3250
3378
  };
3251
3379
  }
3252
- function qr(e) {
3380
+ function oi(e) {
3253
3381
  let n = new t();
3254
3382
  return n.all("*", Q(e)), n;
3255
3383
  }
3256
3384
  //#endregion
3257
3385
  //#region src/app.ts
3258
- function Jr(e) {
3386
+ function si(e) {
3259
3387
  let n = new t();
3260
3388
  return n.all("*", Q({
3261
3389
  data: e.data,
@@ -3267,62 +3395,62 @@ function Jr(e) {
3267
3395
  resolveHostTimeoutMs: e.resolveHostTimeoutMs,
3268
3396
  defaultHandlers: e.defaultHandlers
3269
3397
  })), n.onError((e, t) => {
3270
- let n = K(e);
3398
+ let n = G(e);
3271
3399
  return t.text(n ? "Proxy timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "proxy_timeout" : "proxy_error" });
3272
3400
  }), n;
3273
3401
  }
3274
3402
  //#endregion
3275
3403
  //#region src/data-plane/cache-api-cache.ts
3276
- var Yr = 1e3, Xr = 1e3;
3277
- function Zr(e, t) {
3404
+ var ci = 1e3, li = 1e3;
3405
+ function ui(e, t) {
3278
3406
  return new Request(`https://proxy-cache.internal/${encodeURIComponent(e)}/hosts/${encodeURIComponent(t.toLowerCase())}`, { method: "GET" });
3279
3407
  }
3280
- function Qr() {
3408
+ function di() {
3281
3409
  return globalThis.caches?.default;
3282
3410
  }
3283
- function $r(e) {
3284
- let t = e.cache ?? Qr();
3411
+ function fi(e) {
3412
+ let t = e.cache ?? di();
3285
3413
  if (!t) return e.upstream;
3286
- let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ?? Yr, c = e.cacheWriteTimeoutMs ?? Xr;
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;
3287
3415
  async function l(e) {
3288
3416
  try {
3289
- return await J(Promise.resolve(n.match(e)), s, "cache.match");
3417
+ return await q(Promise.resolve(n.match(e)), s, "cache.match");
3290
3418
  } catch {
3291
3419
  return;
3292
3420
  }
3293
3421
  }
3294
3422
  return { async resolveHost(t) {
3295
- let s = Zr(r, t), u = await l(s);
3423
+ let s = ui(r, t), u = await l(s);
3296
3424
  if (u) try {
3297
3425
  return (await u.json()).value;
3298
3426
  } catch {}
3299
3427
  let d = await e.upstream.resolveHost(t), f = d === null ? a : i, p = new Response(JSON.stringify({ value: d }), { headers: {
3300
3428
  "content-type": "application/json",
3301
3429
  "cache-control": `public, max-age=${f}`
3302
- } }), m = J(Promise.resolve(n.put(s, p)), c, "cache.put").catch(() => void 0);
3430
+ } }), m = q(Promise.resolve(n.put(s, p)), c, "cache.put").catch(() => void 0);
3303
3431
  return o ? o(m) : await m, d;
3304
3432
  } };
3305
3433
  }
3306
- function ei(e, t) {
3307
- return Zr(e, t);
3434
+ function pi(e, t) {
3435
+ return ui(e, t);
3308
3436
  }
3309
3437
  //#endregion
3310
3438
  //#region src/data-plane/cache-adapter-cache.ts
3311
- var ti = 1e3, ni = 1e3;
3312
- function ri(e) {
3313
- 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 = ti, cacheWriteTimeoutMs: u = ni } = e, d = /* @__PURE__ */ new Map();
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();
3314
3442
  function f(e) {
3315
3443
  return `${s}:${e.toLowerCase()}`;
3316
3444
  }
3317
3445
  async function p(e) {
3318
3446
  try {
3319
- return await J(n.get(e), l, "cache.get") ?? null;
3447
+ return await q(n.get(e), l, "cache.get") ?? null;
3320
3448
  } catch {
3321
3449
  return null;
3322
3450
  }
3323
3451
  }
3324
3452
  function m(e, t, r) {
3325
- let i = J(Promise.resolve().then(() => n.set(e, t, r)), u, "cache.set").catch(() => void 0);
3453
+ let i = q(Promise.resolve().then(() => n.set(e, t, r)), u, "cache.set").catch(() => void 0);
3326
3454
  return c ? (c(i), Promise.resolve()) : i;
3327
3455
  }
3328
3456
  async function h(e) {
@@ -3363,7 +3491,7 @@ function ri(e) {
3363
3491
  }
3364
3492
  } };
3365
3493
  }
3366
- function ii(e, t) {
3494
+ function _i(e, t) {
3367
3495
  return `${e}:${t.toLowerCase()}`;
3368
3496
  }
3369
3497
  //#endregion
@@ -3371,7 +3499,7 @@ function ii(e, t) {
3371
3499
  function $() {
3372
3500
  throw Error("Static proxy adapter is read-only; configure routes at init time");
3373
3501
  }
3374
- function ai(e, t, n, r, i, a) {
3502
+ function vi(e, t, n, r, i, a) {
3375
3503
  return {
3376
3504
  id: e.id ?? `${n}:${t}`,
3377
3505
  tenant_id: r,
@@ -3386,10 +3514,10 @@ function ai(e, t, n, r, i, a) {
3386
3514
  updated_at: e.updated_at ?? a
3387
3515
  };
3388
3516
  }
3389
- function oi(e) {
3517
+ function yi(e) {
3390
3518
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = e.defaultTenantId ?? "static", r = /* @__PURE__ */ new Map();
3391
3519
  for (let [i, a] of Object.entries(e.hosts)) {
3392
- 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) => ai(n, r, e, s, c, t)).sort((e, t) => e.priority - t.priority);
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);
3393
3521
  r.set(e, {
3394
3522
  tenant_id: s,
3395
3523
  custom_domain_id: c,
@@ -3433,7 +3561,7 @@ function oi(e) {
3433
3561
  }
3434
3562
  };
3435
3563
  }
3436
- function si(e, t = {}) {
3564
+ function bi(e, t = {}) {
3437
3565
  return {
3438
3566
  priority: t.priority,
3439
3567
  match: { path: t.path ?? "/*" },
@@ -3448,10 +3576,10 @@ function si(e, t = {}) {
3448
3576
  }
3449
3577
  //#endregion
3450
3578
  //#region src/constants.ts
3451
- var ci = "proxy:resolve_host";
3579
+ var xi = "proxy:resolve_host";
3452
3580
  //#endregion
3453
3581
  //#region src/http-adapter/index.ts
3454
- function li() {
3582
+ function Si() {
3455
3583
  let e = () => {
3456
3584
  throw Error("HTTP proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
3457
3585
  };
@@ -3473,7 +3601,7 @@ function li() {
3473
3601
  }
3474
3602
  };
3475
3603
  }
3476
- function ui(e) {
3604
+ function Ci(e) {
3477
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;
3478
3606
  function c(e) {
3479
3607
  let t = new AbortController(), n = setTimeout(() => t.abort(), s);
@@ -3506,7 +3634,7 @@ function ui(e) {
3506
3634
  }), u);
3507
3635
  }
3508
3636
  return {
3509
- proxyRoutes: li(),
3637
+ proxyRoutes: Si(),
3510
3638
  async resolveHost(e) {
3511
3639
  let i = await f(), a = `${n}${r}${encodeURIComponent(e.toLowerCase())}`, o = await c((e) => t(a, {
3512
3640
  headers: { authorization: `Bearer ${i}` },
@@ -3520,7 +3648,7 @@ function ui(e) {
3520
3648
  }
3521
3649
  //#endregion
3522
3650
  //#region src/http-adapter/service-binding-fetch.ts
3523
- function di(e) {
3651
+ function wi(e) {
3524
3652
  return (t, n) => {
3525
3653
  let r = t instanceof Request && n === void 0 ? t : new Request(t, n);
3526
3654
  return e.fetch(r);
@@ -3528,11 +3656,11 @@ function di(e) {
3528
3656
  }
3529
3657
  //#endregion
3530
3658
  //#region src/kv-adapter/index.ts
3531
- var fi = "authhero-proxy-host:";
3532
- function pi(e, t) {
3659
+ var Ti = "authhero-proxy-host:";
3660
+ function Ei(e, t) {
3533
3661
  return `${e}${t.toLowerCase()}`;
3534
3662
  }
3535
- function mi() {
3663
+ function Di() {
3536
3664
  let e = () => {
3537
3665
  throw Error("KV proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
3538
3666
  };
@@ -3554,15 +3682,15 @@ function mi() {
3554
3682
  }
3555
3683
  };
3556
3684
  }
3557
- function hi(e) {
3558
- let { kv: t, keyPrefix: n = fi, timeoutMs: r } = e;
3685
+ function Oi(e) {
3686
+ let { kv: t, keyPrefix: n = Ti, timeoutMs: r } = e;
3559
3687
  return {
3560
- proxyRoutes: mi(),
3688
+ proxyRoutes: Di(),
3561
3689
  async resolveHost(e) {
3562
- let i = pi(n, e), a = t.get(i, "json");
3563
- return (r && r > 0 ? await J(a, r, "kv.get") : await a) ?? null;
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;
3564
3692
  }
3565
3693
  };
3566
3694
  }
3567
3695
  //#endregion
3568
- export { fi as DEFAULT_KV_HOST_KEY_PREFIX, L as HandlerRegistry, ci as PROXY_RESOLVE_HOST_SCOPE, dr as basicAuthHandler, ii as buildCacheAdapterKey, ei as buildCacheApiKey, pi as buildKvHostKey, X as buildMatchFilter, pr as cacheHandler, Z as compileHostApp, cr as corsHandler, ri as createCacheAdapterHostCache, $r as createCacheApiHostCache, ui as createHttpProxyAdapter, I as createInMemoryHostCache, hi as createKvProxyAdapter, Jr as createProxyApp, Q as createProxyDataPlaneHandler, qr as createProxyDataPlaneRouter, di as createServiceBindingFetch, oi as createStaticProxyAdapter, R as defineHandler, Ir as dispatchNamespaceHandler, mr as forwardedHeadersHandler, En as handlerConfigSchema, fr as headersHandler, Dr as httpHandler, si as httpRoute, Tn as matchSchema, Hr as matchesAnyHost, Vr as matchesHost, P as proxyRouteInsertSchema, Dn as proxyRouteSchema, On as proxyRouteUpdateSchema, Lr as redirectHandler, zr as registerBuiltinHandlers, vr as rewriteCookiesHandler, yr as rewriteLocationHandler, jr as serviceBindingHandler, Br as sortRoutes, Rr as staticHandler };
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 };