@authhero/proxy 0.11.9 → 0.11.10

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
@@ -653,14 +653,14 @@ var ze = /* @__PURE__ */ function(e) {
653
653
  return e.QUERY = "query", e.FRAGMENT = "fragment", e.FORM_POST = "form_post", e.WEB_MESSAGE = "web_message", e.SAML_POST = "saml_post", e;
654
654
  }({}), Ve = /* @__PURE__ */ function(e) {
655
655
  return e.S256 = "S256", e.Plain = "plain", e;
656
- }({}), x = e.union([e.null(), e.object({
656
+ }({}), He = e.union([e.null(), e.object({
657
657
  essential: e.boolean().optional(),
658
658
  value: e.unknown().optional(),
659
659
  values: e.array(e.unknown()).optional()
660
- })]).nullable(), He = e.object({
661
- userinfo: e.record(e.string(), x).optional(),
662
- id_token: e.record(e.string(), x).optional()
663
- }), Ue = e.object({
660
+ })]).nullable(), Ue = e.object({
661
+ userinfo: e.record(e.string(), He).optional(),
662
+ id_token: e.record(e.string(), He).optional()
663
+ }), We = e.object({
664
664
  client_id: e.string(),
665
665
  act_as: e.string().optional(),
666
666
  response_type: e.nativeEnum(ze).optional(),
@@ -678,7 +678,7 @@ var ze = /* @__PURE__ */ function(e) {
678
678
  ui_locales: e.string().optional(),
679
679
  max_age: e.number().optional(),
680
680
  acr_values: e.string().optional(),
681
- claims: He.optional(),
681
+ claims: Ue.optional(),
682
682
  vendor_id: e.string().optional()
683
683
  });
684
684
  e.object({
@@ -702,7 +702,7 @@ e.object({
702
702
  "auto"
703
703
  ]).optional()
704
704
  });
705
- var We = e.enum([
705
+ var Ge = e.enum([
706
706
  "password_reset",
707
707
  "email_verification",
708
708
  "otp",
@@ -717,7 +717,7 @@ e.object({
717
717
  code_id: e.string().openapi({ description: "The code that will be used in for instance an email verification flow" }),
718
718
  login_id: e.string().optional().openapi({ description: "The id of the login session that the code is connected to" }),
719
719
  connection_id: e.string().optional().openapi({ description: "The connection that the code is connected to" }),
720
- code_type: We,
720
+ code_type: Ge,
721
721
  code_verifier: e.string().optional().openapi({ description: "The code verifier used in PKCE in outbound flows" }),
722
722
  code_challenge: e.string().optional().openapi({ description: "The code challenge used in PKCE in outbound flows" }),
723
723
  code_challenge_method: e.enum(["plain", "S256"]).optional().openapi({ description: "The code challenge method used in PKCE in outbound flows" }),
@@ -728,8 +728,26 @@ e.object({
728
728
  expires_at: e.string(),
729
729
  used_at: e.string().optional(),
730
730
  user_id: e.string().optional()
731
- }).extend({ created_at: e.string() });
732
- var Ge = e.object({
731
+ }).extend({ created_at: e.string() }), e.object({
732
+ device_code_hash: e.string(),
733
+ user_code_hash: e.string(),
734
+ client_id: e.string(),
735
+ scope: e.string().optional(),
736
+ audience: e.string().optional(),
737
+ status: e.enum([
738
+ "pending",
739
+ "approved",
740
+ "denied",
741
+ "consumed"
742
+ ]),
743
+ login_id: e.string().optional(),
744
+ expires_at: e.string(),
745
+ created_at: e.string(),
746
+ last_polled_at: e.string().optional(),
747
+ interval: e.number().int().positive(),
748
+ version: e.number().int().nonnegative()
749
+ });
750
+ var Ke = e.object({
733
751
  kid: e.string().optional(),
734
752
  team_id: e.string().optional(),
735
753
  realms: e.string().optional(),
@@ -849,23 +867,23 @@ var Ge = e.object({
849
867
  "never_on_login"
850
868
  ]).optional()
851
869
  });
852
- function S(e) {
870
+ function x(e) {
853
871
  if (e !== null) {
854
- if (Array.isArray(e)) return e.filter((e) => e !== null).map(S);
872
+ if (Array.isArray(e)) return e.filter((e) => e !== null).map(x);
855
873
  if (e && typeof e == "object") {
856
874
  let t = {};
857
- for (let [n, r] of Object.entries(e)) r !== null && (t[n] = S(r));
875
+ for (let [n, r] of Object.entries(e)) r !== null && (t[n] = x(r));
858
876
  return t;
859
877
  }
860
878
  return e;
861
879
  }
862
880
  }
863
- var Ke = e.object({
881
+ var qe = e.object({
864
882
  id: e.string().optional(),
865
883
  name: e.string(),
866
884
  display_name: e.string().optional(),
867
885
  strategy: e.string(),
868
- options: e.preprocess((e) => e === null ? {} : S(e), Ge).default({}),
886
+ options: e.preprocess((e) => e === null ? {} : x(e), Ke).default({}),
869
887
  enabled_clients: e.array(e.string()).default([]).optional(),
870
888
  response_type: e.nativeEnum(ze).optional(),
871
889
  response_mode: e.nativeEnum(Be).optional(),
@@ -879,8 +897,8 @@ e.object({
879
897
  id: e.string(),
880
898
  created_at: e.string().transform((e) => e === null ? "" : e),
881
899
  updated_at: e.string().transform((e) => e === null ? "" : e)
882
- }).extend(Ke.shape);
883
- var qe = e.object({
900
+ }).extend(qe.shape);
901
+ var Je = e.object({
884
902
  domain: e.string(),
885
903
  custom_domain_id: e.string().optional(),
886
904
  type: e.enum(["auth0_managed_certs", "self_managed_certs"]),
@@ -894,7 +912,7 @@ var qe = e.object({
894
912
  "null"
895
913
  ]).optional(),
896
914
  domain_metadata: e.record(e.string(), e.string().max(255)).optional()
897
- }), Je = e.discriminatedUnion("name", [e.object({
915
+ }), Ye = e.discriminatedUnion("name", [e.object({
898
916
  name: e.literal("txt"),
899
917
  record: e.string(),
900
918
  domain: e.string()
@@ -902,7 +920,7 @@ var qe = e.object({
902
920
  name: e.literal("http"),
903
921
  http_body: e.string(),
904
922
  http_url: e.string()
905
- })]), Ye = qe.extend({
923
+ })]), Xe = Je.extend({
906
924
  custom_domain_id: e.string(),
907
925
  primary: e.boolean(),
908
926
  status: e.enum([
@@ -912,28 +930,28 @@ var qe = e.object({
912
930
  "ready"
913
931
  ]),
914
932
  origin_domain_name: e.string().optional(),
915
- verification: e.object({ methods: e.array(Je) }).optional(),
933
+ verification: e.object({ methods: e.array(Ye) }).optional(),
916
934
  tls_policy: e.string().optional()
917
935
  });
918
- qe.pick({
936
+ Je.pick({
919
937
  tls_policy: !0,
920
938
  custom_client_ip_header: !0,
921
939
  domain_metadata: !0
922
- }).strict(), Ye.extend({ tenant_id: e.string() }), e.object({
940
+ }).strict(), Xe.extend({ tenant_id: e.string() }), e.object({
923
941
  certificate: e.string().regex(/^-----BEGIN CERTIFICATE-----[\s\S]+-----END CERTIFICATE-----\s*$/, "must be PEM-encoded; include the full certificate chain in leaf-first order"),
924
942
  private_key: e.string().regex(/-----BEGIN (RSA |EC |ENCRYPTED )?PRIVATE KEY-----[\s\S]+-----END \1PRIVATE KEY-----\s*$/, "must be a PEM-encoded private key")
925
943
  });
926
- var C = e.object({
944
+ var S = e.object({
927
945
  id: e.string(),
928
946
  order: e.number().optional(),
929
947
  visible: e.boolean().optional().default(!0)
930
- }), w = C.extend({ category: e.literal("BLOCK").optional() }), Xe = w.extend({
948
+ }), C = S.extend({ category: e.literal("BLOCK").optional() }), Ze = C.extend({
931
949
  type: e.literal("DIVIDER"),
932
950
  config: e.object({ text: e.string().optional() }).optional()
933
- }), Ze = w.extend({
951
+ }), Qe = C.extend({
934
952
  type: e.literal("HTML"),
935
953
  config: e.object({ content: e.string().optional() }).optional()
936
- }), Qe = w.extend({
954
+ }), $e = C.extend({
937
955
  type: e.literal("IMAGE"),
938
956
  config: e.object({
939
957
  src: e.string().optional(),
@@ -941,47 +959,47 @@ var C = e.object({
941
959
  width: e.number().optional(),
942
960
  height: e.number().optional()
943
961
  }).optional()
944
- }), $e = w.extend({
962
+ }), et = C.extend({
945
963
  type: e.literal("JUMP_BUTTON"),
946
964
  config: e.object({
947
965
  text: e.string().optional(),
948
966
  target_step: e.string().optional()
949
967
  })
950
- }), et = w.extend({
968
+ }), tt = C.extend({
951
969
  type: e.literal("RESEND_BUTTON"),
952
970
  config: e.object({
953
971
  text: e.string().optional(),
954
972
  resend_action: e.string().optional()
955
973
  })
956
- }), tt = w.extend({
974
+ }), nt = C.extend({
957
975
  type: e.literal("NEXT_BUTTON"),
958
976
  config: e.object({
959
977
  text: e.string().optional(),
960
978
  variant: e.enum(["primary", "secondary"]).optional(),
961
979
  skip_validation: e.boolean().optional()
962
980
  })
963
- }), nt = w.extend({
981
+ }), rt = C.extend({
964
982
  type: e.literal("PREVIOUS_BUTTON"),
965
983
  config: e.object({ text: e.string().optional() })
966
- }), rt = w.extend({
984
+ }), it = C.extend({
967
985
  type: e.literal("RICH_TEXT"),
968
986
  config: e.object({ content: e.string().optional() }).optional()
969
- }), T = C.extend({
987
+ }), w = S.extend({
970
988
  category: e.literal("WIDGET").optional(),
971
989
  label: e.string().min(1).optional(),
972
990
  hint: e.string().min(1).max(500).optional(),
973
991
  required: e.boolean().optional(),
974
992
  sensitive: e.boolean().optional()
975
- }), it = T.extend({
993
+ }), at = w.extend({
976
994
  type: e.literal("AUTH0_VERIFIABLE_CREDENTIALS"),
977
995
  config: e.object({ credential_type: e.string().optional() })
978
- }), at = T.extend({
996
+ }), ot = w.extend({
979
997
  type: e.literal("GMAPS_ADDRESS"),
980
998
  config: e.object({ api_key: e.string().optional() })
981
- }), ot = T.extend({
999
+ }), st = w.extend({
982
1000
  type: e.literal("RECAPTCHA"),
983
1001
  config: e.object({ site_key: e.string().optional() })
984
- }), E = C.extend({
1002
+ }), T = S.extend({
985
1003
  category: e.literal("FIELD").optional(),
986
1004
  label: e.string().min(1).optional(),
987
1005
  hint: e.string().min(1).max(500).optional(),
@@ -997,10 +1015,10 @@ var C = e.object({
997
1015
  })).optional(),
998
1016
  required: e.boolean().optional(),
999
1017
  sensitive: e.boolean().optional()
1000
- }), st = E.extend({
1018
+ }), ct = T.extend({
1001
1019
  type: e.literal("BOOLEAN"),
1002
1020
  config: e.object({ default_value: e.boolean().optional() }).optional()
1003
- }), ct = E.extend({
1021
+ }), lt = T.extend({
1004
1022
  type: e.literal("CARDS"),
1005
1023
  config: e.object({
1006
1024
  options: e.array(e.object({
@@ -1011,7 +1029,7 @@ var C = e.object({
1011
1029
  })).optional(),
1012
1030
  multi_select: e.boolean().optional()
1013
1031
  }).optional()
1014
- }), lt = E.extend({
1032
+ }), ut = T.extend({
1015
1033
  type: e.literal("CHOICE"),
1016
1034
  config: e.object({
1017
1035
  options: e.array(e.object({
@@ -1022,7 +1040,7 @@ var C = e.object({
1022
1040
  multiple: e.boolean().optional(),
1023
1041
  default_value: e.union([e.string(), e.array(e.string())]).optional()
1024
1042
  }).optional()
1025
- }), ut = E.extend({
1043
+ }), dt = T.extend({
1026
1044
  type: e.literal("CODE"),
1027
1045
  config: e.object({
1028
1046
  length: e.number().int().positive().max(100).optional(),
@@ -1039,7 +1057,7 @@ var C = e.object({
1039
1057
  message: "default_value is longer than the configured length",
1040
1058
  path: ["default_value"]
1041
1059
  }).optional()
1042
- }), dt = E.extend({
1060
+ }), ft = T.extend({
1043
1061
  type: e.literal("CUSTOM"),
1044
1062
  config: e.object({
1045
1063
  component: e.string().optional(),
@@ -1047,7 +1065,7 @@ var C = e.object({
1047
1065
  schema: e.record(e.string(), e.any()).optional(),
1048
1066
  code: e.string().optional()
1049
1067
  })
1050
- }), ft = E.extend({
1068
+ }), pt = T.extend({
1051
1069
  type: e.literal("DATE"),
1052
1070
  config: e.object({
1053
1071
  format: e.string().optional(),
@@ -1055,7 +1073,7 @@ var C = e.object({
1055
1073
  max: e.string().optional(),
1056
1074
  default_value: e.string().optional()
1057
1075
  }).optional()
1058
- }), pt = E.extend({
1076
+ }), mt = T.extend({
1059
1077
  type: e.literal("DROPDOWN"),
1060
1078
  config: e.object({
1061
1079
  options: e.array(e.object({
@@ -1067,7 +1085,7 @@ var C = e.object({
1067
1085
  multiple: e.boolean().optional(),
1068
1086
  default_value: e.union([e.string(), e.array(e.string())]).optional()
1069
1087
  }).optional()
1070
- }), mt = E.extend({
1088
+ }), ht = T.extend({
1071
1089
  type: e.literal("EMAIL"),
1072
1090
  config: e.object({
1073
1091
  placeholder: e.string().optional(),
@@ -1075,20 +1093,20 @@ var C = e.object({
1075
1093
  last_used: e.boolean().optional(),
1076
1094
  last_used_label: e.string().optional()
1077
1095
  }).optional()
1078
- }), ht = E.extend({
1096
+ }), gt = T.extend({
1079
1097
  type: e.literal("FILE"),
1080
1098
  config: e.object({
1081
1099
  accept: e.string().optional(),
1082
1100
  max_size: e.number().optional(),
1083
1101
  multiple: e.boolean().optional()
1084
1102
  }).optional()
1085
- }), gt = E.extend({
1103
+ }), _t = T.extend({
1086
1104
  type: e.literal("LEGAL"),
1087
1105
  config: e.object({
1088
1106
  text: e.string(),
1089
1107
  html: e.boolean().optional()
1090
1108
  }).optional()
1091
- }), _t = E.extend({
1109
+ }), vt = T.extend({
1092
1110
  type: e.literal("NUMBER"),
1093
1111
  config: e.object({
1094
1112
  placeholder: e.string().optional(),
@@ -1097,7 +1115,7 @@ var C = e.object({
1097
1115
  step: e.number().optional(),
1098
1116
  default_value: e.string().optional()
1099
1117
  }).optional()
1100
- }), vt = E.extend({
1118
+ }), yt = T.extend({
1101
1119
  type: e.literal("PASSWORD"),
1102
1120
  config: e.object({
1103
1121
  placeholder: e.string().optional(),
@@ -1106,13 +1124,13 @@ var C = e.object({
1106
1124
  forgot_password_link: e.string().optional(),
1107
1125
  default_value: e.string().optional()
1108
1126
  }).optional()
1109
- }), yt = E.extend({
1127
+ }), bt = T.extend({
1110
1128
  type: e.literal("PAYMENT"),
1111
1129
  config: e.object({
1112
1130
  provider: e.string().optional(),
1113
1131
  currency: e.string().optional()
1114
1132
  }).optional()
1115
- }), bt = E.extend({
1133
+ }), xt = T.extend({
1116
1134
  type: e.literal("SOCIAL"),
1117
1135
  config: e.object({
1118
1136
  providers: e.array(e.string()).optional(),
@@ -1127,7 +1145,7 @@ var C = e.object({
1127
1145
  last_used_label: e.string().optional()
1128
1146
  })).optional()
1129
1147
  }).optional()
1130
- }), xt = E.extend({
1148
+ }), St = T.extend({
1131
1149
  type: e.literal("TEL"),
1132
1150
  config: e.object({
1133
1151
  placeholder: e.string().optional(),
@@ -1135,7 +1153,7 @@ var C = e.object({
1135
1153
  default_value: e.string().optional(),
1136
1154
  allow_email: e.boolean().optional()
1137
1155
  }).optional()
1138
- }), St = E.extend({
1156
+ }), Ct = T.extend({
1139
1157
  type: e.literal("TEXT"),
1140
1158
  config: e.object({
1141
1159
  placeholder: e.string().optional(),
@@ -1145,38 +1163,37 @@ var C = e.object({
1145
1163
  last_used: e.boolean().optional(),
1146
1164
  last_used_label: e.string().optional()
1147
1165
  }).optional()
1148
- }), Ct = E.extend({
1166
+ }), wt = T.extend({
1149
1167
  type: e.literal("COUNTRY"),
1150
1168
  config: e.object({
1151
1169
  placeholder: e.string().optional(),
1152
1170
  default_value: e.string().optional()
1153
1171
  }).optional()
1154
- }), wt = E.extend({
1172
+ }), Tt = T.extend({
1155
1173
  type: e.literal("URL"),
1156
1174
  config: e.object({
1157
1175
  placeholder: e.string().optional(),
1158
1176
  default_value: e.string().optional()
1159
1177
  }).optional()
1160
- }), Tt = e.discriminatedUnion("type", [
1161
- Xe,
1178
+ }), Et = e.discriminatedUnion("type", [
1162
1179
  Ze,
1163
1180
  Qe,
1164
1181
  $e,
1165
1182
  et,
1166
1183
  tt,
1167
1184
  nt,
1168
- rt
1169
- ]), Et = e.discriminatedUnion("type", [
1170
- it,
1171
- at,
1172
- ot
1185
+ rt,
1186
+ it
1173
1187
  ]), Dt = e.discriminatedUnion("type", [
1174
- st,
1188
+ at,
1189
+ ot,
1190
+ st
1191
+ ]), Ot = e.discriminatedUnion("type", [
1175
1192
  ct,
1176
1193
  lt,
1177
1194
  ut,
1178
- Ct,
1179
1195
  dt,
1196
+ wt,
1180
1197
  ft,
1181
1198
  pt,
1182
1199
  mt,
@@ -1188,11 +1205,12 @@ var C = e.object({
1188
1205
  bt,
1189
1206
  xt,
1190
1207
  St,
1191
- wt
1192
- ]), Ot = e.union([
1193
- Tt,
1208
+ Ct,
1209
+ Tt
1210
+ ]), E = e.union([
1194
1211
  Et,
1195
- Dt
1212
+ Dt,
1213
+ Ot
1196
1214
  ]);
1197
1215
  new Set([
1198
1216
  "BOOLEAN",
@@ -1251,7 +1269,7 @@ var D = e.object({
1251
1269
  coordinates: D,
1252
1270
  alias: e.string().min(1).max(150).optional(),
1253
1271
  config: e.object({
1254
- components: e.array(Ot),
1272
+ components: e.array(E),
1255
1273
  next_node: e.string().optional()
1256
1274
  })
1257
1275
  }), Mt = e.discriminatedUnion("type", [
@@ -1322,7 +1340,7 @@ e.object({
1322
1340
  method: e.enum(["POST", "GET"]),
1323
1341
  title: e.string().optional(),
1324
1342
  description: e.string().optional(),
1325
- components: e.array(Ot),
1343
+ components: e.array(E),
1326
1344
  messages: e.array(Pt).optional(),
1327
1345
  links: e.array(Ft).optional(),
1328
1346
  partials: It.optional(),
@@ -1342,10 +1360,15 @@ var O = e.enum([
1342
1360
  "post-user-update",
1343
1361
  "credentials-exchange"
1344
1362
  ]), j = e.enum([
1363
+ "validate-registration-username",
1345
1364
  "post-user-login",
1346
1365
  "credentials-exchange",
1347
1366
  "pre-user-registration",
1348
- "post-user-registration"
1367
+ "post-user-registration",
1368
+ "pre-user-update",
1369
+ "post-user-update",
1370
+ "pre-user-deletion",
1371
+ "post-user-deletion"
1349
1372
  ]), M = e.enum(["post-user-login"]);
1350
1373
  O.options, k.options, A.options, j.options, M.options;
1351
1374
  var Lt = e.enum(["impersonate"]), Rt = e.enum([
@@ -1501,6 +1524,7 @@ e.object({
1501
1524
  issuer: e.string(),
1502
1525
  authorization_endpoint: e.string(),
1503
1526
  token_endpoint: e.string(),
1527
+ device_authorization_endpoint: e.string().optional(),
1504
1528
  userinfo_endpoint: e.string(),
1505
1529
  jwks_uri: e.string(),
1506
1530
  registration_endpoint: e.string().optional(),
@@ -1533,7 +1557,7 @@ var en = /* @__PURE__ */ function(e) {
1533
1557
  e.object({
1534
1558
  csrf_token: e.string(),
1535
1559
  auth0Client: e.string().optional(),
1536
- authParams: Ue,
1560
+ authParams: We,
1537
1561
  expires_at: e.string(),
1538
1562
  deleted_at: e.string().optional(),
1539
1563
  ip: e.string().optional(),
@@ -1895,7 +1919,11 @@ e.object({
1895
1919
  var yn = e.object({
1896
1920
  id: e.string().optional(),
1897
1921
  parent_tenant_id: e.string().nullish(),
1898
- config_sync: e.enum(["inherit-on-read", "synced"]).nullish(),
1922
+ config_sync: e.enum([
1923
+ "inherit-on-read",
1924
+ "synced",
1925
+ "detached"
1926
+ ]).nullish(),
1899
1927
  config_sync_hash: e.string().nullish(),
1900
1928
  config_synced_at: e.string().nullish(),
1901
1929
  audience: e.string().optional(),
@@ -2047,7 +2075,8 @@ e.object({
2047
2075
  updated_at: e.string().nullable().transform((e) => e ?? "")
2048
2076
  }).extend(yn.shape).extend({
2049
2077
  id: e.string(),
2050
- is_control_plane: e.boolean().optional()
2078
+ is_control_plane: e.boolean().optional(),
2079
+ has_children: e.boolean().optional()
2051
2080
  });
2052
2081
  var bn = e.enum([
2053
2082
  "provision",
@@ -2056,7 +2085,9 @@ var bn = e.enum([
2056
2085
  "backup",
2057
2086
  "deprovision",
2058
2087
  "users_import",
2059
- "sync-defaults"
2088
+ "sync-defaults",
2089
+ "detach",
2090
+ "tenant-members-request"
2060
2091
  ]), xn = e.enum([
2061
2092
  "pending",
2062
2093
  "running",
@@ -2180,7 +2211,40 @@ e.object({
2180
2211
  config: !0,
2181
2212
  paused_reason: !0,
2182
2213
  finished_at: !0
2183
- }).partial(), e.object({
2214
+ }).partial();
2215
+ var En = e.enum([
2216
+ "invite",
2217
+ "add_members",
2218
+ "remove_members",
2219
+ "assign_roles",
2220
+ "remove_roles",
2221
+ "revoke_invitation"
2222
+ ]), Dn = e.enum([
2223
+ "pending",
2224
+ "succeeded",
2225
+ "failed"
2226
+ ]);
2227
+ e.object({
2228
+ kind: En,
2229
+ requested_by: e.string().min(1).max(255),
2230
+ payload: e.record(e.string(), e.unknown())
2231
+ }).extend({
2232
+ id: e.string(),
2233
+ tenant_id: e.string(),
2234
+ status: Dn,
2235
+ result: e.record(e.string(), e.unknown()).nullable().optional(),
2236
+ error: e.string().nullable().optional(),
2237
+ notified_at: e.string().nullable().optional(),
2238
+ created_at: e.string(),
2239
+ updated_at: e.string(),
2240
+ finished_at: e.string().nullable().optional()
2241
+ }), e.object({
2242
+ status: Dn.optional(),
2243
+ result: e.record(e.string(), e.unknown()).nullable().optional(),
2244
+ error: e.string().nullable().optional(),
2245
+ notified_at: e.string().nullable().optional(),
2246
+ finished_at: e.string().nullable().optional()
2247
+ }), e.object({
2184
2248
  access_token: e.string(),
2185
2249
  id_token: e.string().optional(),
2186
2250
  scope: e.string().optional(),
@@ -2192,7 +2256,7 @@ e.object({
2192
2256
  code: e.string(),
2193
2257
  state: e.string().optional()
2194
2258
  });
2195
- var En = e.object({
2259
+ var On = e.object({
2196
2260
  button_border_radius: e.number(),
2197
2261
  button_border_weight: e.number(),
2198
2262
  buttons_style: e.enum([
@@ -2210,7 +2274,7 @@ var En = e.object({
2210
2274
  show_widget_shadow: e.boolean(),
2211
2275
  widget_border_weight: e.number(),
2212
2276
  widget_corner_radius: e.number()
2213
- }), Dn = e.object({
2277
+ }), kn = e.object({
2214
2278
  base_focus_color: e.string(),
2215
2279
  base_hover_color: e.string(),
2216
2280
  body_text: e.string(),
@@ -2237,7 +2301,7 @@ var En = e.object({
2237
2301
  }), I = e.object({
2238
2302
  bold: e.boolean(),
2239
2303
  size: e.number()
2240
- }), On = e.object({
2304
+ }), An = e.object({
2241
2305
  body_text: I,
2242
2306
  buttons_text: I,
2243
2307
  font_url: e.string(),
@@ -2247,7 +2311,7 @@ var En = e.object({
2247
2311
  reference_text_size: e.number(),
2248
2312
  subtitle: I,
2249
2313
  title: I
2250
- }), kn = e.object({
2314
+ }), jn = e.object({
2251
2315
  background_color: e.string(),
2252
2316
  background_image_url: e.string(),
2253
2317
  page_layout: e.enum([
@@ -2260,7 +2324,7 @@ var En = e.object({
2260
2324
  "chip",
2261
2325
  "none"
2262
2326
  ]).optional()
2263
- }), An = e.object({
2327
+ }), Mn = e.object({
2264
2328
  header_text_alignment: e.enum([
2265
2329
  "center",
2266
2330
  "left",
@@ -2277,12 +2341,12 @@ var En = e.object({
2277
2341
  social_buttons_layout: e.enum(["bottom", "top"])
2278
2342
  });
2279
2343
  e.object({
2280
- borders: En,
2281
- colors: Dn,
2344
+ borders: On,
2345
+ colors: kn,
2282
2346
  displayName: e.string(),
2283
- fonts: On,
2284
- page_background: kn,
2285
- widget: An
2347
+ fonts: An,
2348
+ page_background: jn,
2349
+ widget: Mn
2286
2350
  }).extend({ themeId: e.string() }), e.object({
2287
2351
  ...a,
2288
2352
  universal_login_experience: e.enum(["new", "classic"]).default("new"),
@@ -2291,30 +2355,30 @@ e.object({
2291
2355
  show_last_used_connection: e.boolean().default(!1),
2292
2356
  webauthn_platform_first_factor: e.boolean()
2293
2357
  });
2294
- var jn = e.object({
2358
+ var Nn = e.object({
2295
2359
  hosts: e.array(e.string()).optional(),
2296
2360
  methods: e.array(e.string()).optional(),
2297
2361
  path: e.string().default("/*"),
2298
2362
  headers: e.record(e.string(), e.string()).optional(),
2299
2363
  query: e.record(e.string(), e.string()).optional()
2300
- }), Mn = e.object({
2364
+ }), Pn = e.object({
2301
2365
  type: e.string(),
2302
2366
  options: e.record(e.string(), e.unknown()).default({})
2303
2367
  }), L = e.object({
2304
2368
  id: e.string().optional(),
2305
2369
  custom_domain_id: e.string(),
2306
2370
  priority: e.number().int().default(100),
2307
- match: jn,
2308
- handlers: e.array(Mn).min(1)
2309
- }), Nn = L.extend({
2371
+ match: Nn,
2372
+ handlers: e.array(Pn).min(1)
2373
+ }), Fn = L.extend({
2310
2374
  id: e.string(),
2311
2375
  tenant_id: e.string(),
2312
2376
  created_at: e.string(),
2313
2377
  updated_at: e.string()
2314
- }), Pn = L.partial().omit({
2378
+ }), In = L.partial().omit({
2315
2379
  id: !0,
2316
2380
  custom_domain_id: !0
2317
- }), Fn = "custom_authentication", In = [
2381
+ }), Ln = "custom_authentication", Rn = [
2318
2382
  "urn:ietf:params:oauth:",
2319
2383
  "urn:auth0",
2320
2384
  "urn:okta",
@@ -2322,56 +2386,56 @@ var jn = e.object({
2322
2386
  "https://auth0.com",
2323
2387
  "http://okta.com",
2324
2388
  "https://okta.com"
2325
- ], Ln = e.string().min(1).max(200).refine((e) => e.startsWith("https://") || e.startsWith("urn:"), { message: "subject_token_type must be a URI starting with https:// or urn:" }).refine((e) => !In.some((t) => e.toLowerCase().startsWith(t)), { message: "subject_token_type uses a reserved namespace" }), Rn = e.enum([
2389
+ ], zn = e.string().min(1).max(200).refine((e) => e.startsWith("https://") || e.startsWith("urn:"), { message: "subject_token_type must be a URI starting with https:// or urn:" }).refine((e) => !Rn.some((t) => e.toLowerCase().startsWith(t)), { message: "subject_token_type uses a reserved namespace" }), Bn = e.enum([
2326
2390
  "RS256",
2327
2391
  "RS384",
2328
2392
  "RS512",
2329
2393
  "ES256",
2330
2394
  "ES384",
2331
2395
  "ES512"
2332
- ]), zn = e.discriminatedUnion("type", [e.object({
2396
+ ]), Vn = e.discriminatedUnion("type", [e.object({
2333
2397
  type: e.literal("connection"),
2334
2398
  connection: e.string().min(1),
2335
2399
  create_if_not_exists: e.boolean().default(!0),
2336
2400
  trust_email_verified: e.boolean().default(!1)
2337
- }), e.object({ type: e.literal("user_id") })]), Bn = e.object({
2401
+ }), e.object({ type: e.literal("user_id") })]), Hn = e.object({
2338
2402
  issuer: e.string().min(1).max(2048),
2339
2403
  jwks: $t.optional(),
2340
2404
  jwks_uri: e.string().url().optional(),
2341
2405
  audience: e.array(e.string().min(1)).min(1).optional(),
2342
- algorithms: e.array(Rn).min(1).optional(),
2406
+ algorithms: e.array(Bn).min(1).optional(),
2343
2407
  max_lifetime_seconds: e.number().int().min(1).max(3600).default(300),
2344
2408
  require_jti: e.boolean().default(!0),
2345
- user_mapping: zn
2409
+ user_mapping: Vn
2346
2410
  });
2347
2411
  e.object({
2348
2412
  name: e.string().min(1).max(255),
2349
- subject_token_type: Ln,
2413
+ subject_token_type: zn,
2350
2414
  action_id: e.string().min(1).optional(),
2351
- type: e.literal(Fn),
2352
- jwt_verification: Bn.optional()
2415
+ type: e.literal(Ln),
2416
+ jwt_verification: Hn.optional()
2353
2417
  }).extend({
2354
2418
  id: e.string(),
2355
2419
  created_at: e.string(),
2356
2420
  updated_at: e.string()
2357
2421
  }), e.object({
2358
2422
  name: e.string().min(1).max(255).optional(),
2359
- subject_token_type: Ln.optional(),
2360
- jwt_verification: Bn.optional()
2423
+ subject_token_type: zn.optional(),
2424
+ jwt_verification: Hn.optional()
2361
2425
  });
2362
- var Vn = e.object({
2426
+ var Un = e.object({
2363
2427
  scim: e.string(),
2364
2428
  auth0: e.string()
2365
- }), Hn = e.object({
2429
+ }), Wn = e.object({
2366
2430
  connection_id: e.string(),
2367
2431
  user_id_attribute: e.string().default("externalId"),
2368
- mapping: e.array(Vn).default([])
2432
+ mapping: e.array(Un).default([])
2369
2433
  });
2370
2434
  e.object({
2371
2435
  created_at: e.string(),
2372
2436
  updated_at: e.string()
2373
- }).extend(Hn.shape);
2374
- var Un = e.object({
2437
+ }).extend(Wn.shape);
2438
+ var Gn = e.object({
2375
2439
  token_id: e.string(),
2376
2440
  connection_id: e.string(),
2377
2441
  token_hash: e.string(),
@@ -2381,13 +2445,13 @@ var Un = e.object({
2381
2445
  e.object({
2382
2446
  created_at: e.string(),
2383
2447
  last_used_at: e.string().optional()
2384
- }).extend(Un.shape);
2385
- var Wn = e.object({
2448
+ }).extend(Gn.shape);
2449
+ var Kn = e.object({
2386
2450
  connection_id: e.string(),
2387
2451
  external_id: e.string(),
2388
2452
  user_id: e.string()
2389
2453
  });
2390
- e.object({ created_at: e.string() }).extend(Wn.shape), e.object({
2454
+ e.object({ created_at: e.string() }).extend(Kn.shape), e.object({
2391
2455
  ...a,
2392
2456
  name: e.string(),
2393
2457
  enabled: e.boolean().optional().default(!0),
@@ -2395,7 +2459,7 @@ e.object({ created_at: e.string() }).extend(Wn.shape), e.object({
2395
2459
  credentials: e.record(e.string(), e.unknown()),
2396
2460
  settings: e.object({}).optional()
2397
2461
  });
2398
- var Gn = e.enum([
2462
+ var qn = e.enum([
2399
2463
  "verify_email",
2400
2464
  "verify_email_by_code",
2401
2465
  "reset_email",
@@ -2410,7 +2474,7 @@ var Gn = e.enum([
2410
2474
  "user_invitation"
2411
2475
  ]);
2412
2476
  e.object({
2413
- template: Gn,
2477
+ template: qn,
2414
2478
  body: e.string(),
2415
2479
  from: e.string(),
2416
2480
  subject: e.string(),
@@ -2452,10 +2516,10 @@ e.object({
2452
2516
  name: e.string(),
2453
2517
  options: e.object({})
2454
2518
  });
2455
- var Kn = e.object({
2519
+ var Jn = e.object({
2456
2520
  value: e.string(),
2457
2521
  description: e.string().optional()
2458
- }), qn = e.object({
2522
+ }), Yn = e.object({
2459
2523
  token_dialect: e.enum(["access_token", "access_token_authz"]).optional(),
2460
2524
  enforce_policies: e.boolean().optional(),
2461
2525
  allow_skipping_userinfo: e.boolean().optional(),
@@ -2463,11 +2527,11 @@ var Kn = e.object({
2463
2527
  persist_client_authorization: e.boolean().optional(),
2464
2528
  enable_introspection_endpoint: e.boolean().optional(),
2465
2529
  mtls: e.object({ bound_access_tokens: e.boolean().optional() }).optional()
2466
- }), Jn = e.object({
2530
+ }), Xn = e.object({
2467
2531
  id: e.string().optional(),
2468
2532
  name: e.string(),
2469
2533
  identifier: e.string(),
2470
- scopes: e.array(Kn).optional(),
2534
+ scopes: e.array(Jn).optional(),
2471
2535
  signing_alg: e.string().optional(),
2472
2536
  signing_secret: e.string().optional(),
2473
2537
  token_lifetime: e.number().default(86400),
@@ -2475,7 +2539,7 @@ var Kn = e.object({
2475
2539
  skip_consent_for_verifiable_first_party_clients: e.boolean().optional(),
2476
2540
  allow_offline_access: e.boolean().optional(),
2477
2541
  verificationKey: e.string().optional(),
2478
- options: qn.optional(),
2542
+ options: Yn.optional(),
2479
2543
  is_system: e.boolean().optional(),
2480
2544
  ...a,
2481
2545
  metadata: e.record(e.string(), e.any()).optional()
@@ -2483,13 +2547,13 @@ var Kn = e.object({
2483
2547
  created_at: e.string().optional(),
2484
2548
  updated_at: e.string().optional()
2485
2549
  });
2486
- e.array(Jn);
2487
- var Yn = e.object({
2550
+ e.array(Xn);
2551
+ var Zn = e.object({
2488
2552
  role_id: e.string(),
2489
2553
  resource_server_identifier: e.string(),
2490
2554
  permission_name: e.string()
2491
2555
  }).extend({ created_at: e.string() });
2492
- e.array(Yn), e.object({
2556
+ e.array(Zn), e.object({
2493
2557
  user_id: e.string().openapi({ description: "The id of the user that granted the consent" }),
2494
2558
  clientID: e.string().openapi({ description: "The id of the client the grant was issued to" }),
2495
2559
  audience: e.string().optional().openapi({ description: "The audience the grant applies to" }),
@@ -2502,7 +2566,7 @@ e.array(Yn), e.object({
2502
2566
  failed_logins: e.array(e.string()).optional(),
2503
2567
  last_password_reset: e.string().optional()
2504
2568
  });
2505
- var Xn = e.object({
2569
+ var Qn = e.object({
2506
2570
  user_id: e.string(),
2507
2571
  resource_server_identifier: e.string(),
2508
2572
  permission_name: e.string(),
@@ -2511,8 +2575,8 @@ var Xn = e.object({
2511
2575
  tenant_id: e.string(),
2512
2576
  created_at: e.string().optional()
2513
2577
  });
2514
- e.array(Xn);
2515
- var Zn = e.object({
2578
+ e.array(Qn);
2579
+ var $n = e.object({
2516
2580
  user_id: e.string(),
2517
2581
  resource_server_identifier: e.string(),
2518
2582
  resource_server_name: e.string(),
@@ -2521,8 +2585,8 @@ var Zn = e.object({
2521
2585
  created_at: e.string().optional(),
2522
2586
  organization_id: e.string().optional()
2523
2587
  });
2524
- e.array(Zn);
2525
- var Qn = e.object({
2588
+ e.array($n);
2589
+ var er = e.object({
2526
2590
  user_id: e.string(),
2527
2591
  role_id: e.string(),
2528
2592
  organization_id: e.string().optional()
@@ -2530,8 +2594,8 @@ var Qn = e.object({
2530
2594
  tenant_id: e.string(),
2531
2595
  created_at: e.string().optional()
2532
2596
  });
2533
- e.array(Qn);
2534
- var $n = e.object({
2597
+ e.array(er);
2598
+ var tr = e.object({
2535
2599
  id: e.string().optional().openapi({ description: "The unique identifier of the role. If not provided, one will be generated." }),
2536
2600
  name: e.string().min(1).max(50).openapi({ description: "The name of the role. Cannot include '<' or '>'" }),
2537
2601
  description: e.string().max(255).optional().openapi({ description: "The description of the role" }),
@@ -2542,19 +2606,19 @@ var $n = e.object({
2542
2606
  created_at: e.string().optional(),
2543
2607
  updated_at: e.string().optional()
2544
2608
  });
2545
- e.array($n);
2546
- var er = e.object({
2609
+ e.array(tr);
2610
+ var nr = e.object({
2547
2611
  logo_url: e.string().optional().openapi({ description: "URL of the organization's logo" }),
2548
2612
  colors: e.object({
2549
2613
  primary: e.string().optional().openapi({ description: "Primary color in hex format (e.g., #FF0000)" }),
2550
2614
  page_background: e.string().optional().openapi({ description: "Page background color in hex format (e.g., #FFFFFF)" })
2551
2615
  }).optional()
2552
- }).optional(), tr = e.object({
2616
+ }).optional(), rr = e.object({
2553
2617
  connection_id: e.string().openapi({ description: "ID of the connection" }),
2554
2618
  assign_membership_on_login: e.boolean().default(!1).openapi({ description: "Whether to assign membership to the organization on login" }),
2555
2619
  show_as_button: e.boolean().default(!0).openapi({ description: "Whether to show this connection as a button in the login screen" }),
2556
2620
  is_signup_enabled: e.boolean().default(!0).openapi({ description: "Whether signup is enabled for this connection" })
2557
- }), nr = e.object({ client_credentials: e.object({
2621
+ }), ir = e.object({ client_credentials: e.object({
2558
2622
  enforce: e.boolean().default(!1).openapi({ description: "Whether to enforce token quota limits" }),
2559
2623
  per_day: e.number().min(0).default(0).openapi({ description: "Maximum tokens per day (0 = unlimited)" }),
2560
2624
  per_hour: e.number().min(0).default(0).openapi({ description: "Maximum tokens per hour (0 = unlimited)" })
@@ -2563,15 +2627,15 @@ e.object({
2563
2627
  id: e.string().optional(),
2564
2628
  name: e.string().min(1).regex(/^[a-z0-9_-]+$/, { message: "Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores" }).openapi({ description: "The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores." }),
2565
2629
  display_name: e.string().optional().openapi({ description: "The display name of the organization" }),
2566
- branding: er,
2630
+ branding: nr,
2567
2631
  metadata: e.record(e.string(), e.any()).default({}).optional().openapi({ description: "Custom metadata for the organization" }),
2568
- enabled_connections: e.array(tr).default([]).optional().openapi({ description: "List of enabled connections for the organization" }),
2569
- token_quota: nr
2632
+ enabled_connections: e.array(rr).default([]).optional().openapi({ description: "List of enabled connections for the organization" }),
2633
+ token_quota: ir
2570
2634
  }).extend(n.shape).extend({
2571
2635
  id: e.string(),
2572
2636
  name: e.string().min(1).openapi({ description: "The name of the organization" })
2573
2637
  });
2574
- var rr = e.object({
2638
+ var ar = e.object({
2575
2639
  connection_id: e.string().openapi({ description: "ID of the tenant-level connection to enable for the org." }),
2576
2640
  assign_membership_on_login: e.boolean().optional().default(!1),
2577
2641
  show_as_button: e.boolean().optional().default(!0),
@@ -2584,7 +2648,7 @@ var rr = e.object({
2584
2648
  created_at: e.string().optional(),
2585
2649
  updated_at: e.string().optional()
2586
2650
  });
2587
- e.array(rr), e.object({
2651
+ e.array(ar), e.object({
2588
2652
  user_id: e.string().openapi({ description: "ID of the user" }),
2589
2653
  organization_id: e.string().openapi({ description: "ID of the organization" })
2590
2654
  }).extend(n.shape).extend({ id: e.string() }), e.object({
@@ -2723,7 +2787,7 @@ e.array(rr), e.object({
2723
2787
  "passwordless",
2724
2788
  "enterprise"
2725
2789
  ]);
2726
- var ir = e.object({
2790
+ var or = e.object({
2727
2791
  cohort: e.string(),
2728
2792
  sessions: e.number(),
2729
2793
  active: e.array(e.number())
@@ -2732,9 +2796,9 @@ e.object({
2732
2796
  interval: e.literal("week"),
2733
2797
  from: e.string(),
2734
2798
  to: e.string(),
2735
- cohorts: e.array(ir)
2799
+ cohorts: e.array(or)
2736
2800
  });
2737
- var ar = e.object({
2801
+ var sr = e.object({
2738
2802
  cohort: e.string(),
2739
2803
  tokens: e.number(),
2740
2804
  active: e.array(e.number())
@@ -2743,24 +2807,24 @@ e.object({
2743
2807
  interval: e.literal("week"),
2744
2808
  from: e.string(),
2745
2809
  to: e.string(),
2746
- cohorts: e.array(ar)
2810
+ cohorts: e.array(sr)
2747
2811
  });
2748
- var or = e.object({
2812
+ var cr = e.object({
2749
2813
  name: e.string(),
2750
2814
  type: e.string()
2751
- }), sr = e.object({
2815
+ }), lr = e.object({
2752
2816
  elapsed: e.number(),
2753
2817
  rows_read: e.number().optional(),
2754
2818
  bytes_read: e.number().optional()
2755
2819
  });
2756
2820
  e.object({
2757
- meta: e.array(or),
2821
+ meta: e.array(cr),
2758
2822
  data: e.array(e.record(e.string(), e.any())),
2759
2823
  rows: e.number(),
2760
2824
  rows_before_limit_at_least: e.number().optional(),
2761
- statistics: sr.optional()
2825
+ statistics: lr.optional()
2762
2826
  });
2763
- var cr = 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(".")), lr = e.record(e.string(), e.record(e.string(), e.string())).openapi({
2827
+ var ur = 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(".")), dr = e.record(e.string(), e.record(e.string(), e.string())).openapi({
2764
2828
  type: "object",
2765
2829
  additionalProperties: {
2766
2830
  type: "object",
@@ -2768,23 +2832,23 @@ var cr = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.
2768
2832
  }
2769
2833
  });
2770
2834
  e.object({
2771
- prompt: cr,
2835
+ prompt: ur,
2772
2836
  language: e.string(),
2773
- custom_text: lr
2837
+ custom_text: dr
2774
2838
  });
2775
- var ur = e.object({
2839
+ var fr = e.object({
2776
2840
  "form-content-start": e.string().optional(),
2777
2841
  "form-content-end": e.string().optional(),
2778
2842
  "form-footer-start": e.string().optional(),
2779
2843
  "form-footer-end": e.string().optional(),
2780
2844
  "secondary-actions-start": e.string().optional(),
2781
2845
  "secondary-actions-end": e.string().optional()
2782
- }).strict(), dr = e.record(e.string(), ur);
2846
+ }).strict(), pr = e.record(e.string(), fr);
2783
2847
  e.object({
2784
2848
  prompt: e.string(),
2785
- partials: dr
2849
+ partials: pr
2786
2850
  });
2787
- var fr = e.enum([
2851
+ var mr = e.enum([
2788
2852
  "phone",
2789
2853
  "totp",
2790
2854
  "email",
@@ -2792,9 +2856,9 @@ var fr = e.enum([
2792
2856
  "webauthn-roaming",
2793
2857
  "webauthn-platform",
2794
2858
  "passkey"
2795
- ]), pr = e.object({
2859
+ ]), R = e.object({
2796
2860
  user_id: e.string(),
2797
- type: fr,
2861
+ type: mr,
2798
2862
  phone_number: e.string().optional(),
2799
2863
  totp_secret: e.string().optional(),
2800
2864
  credential_id: e.string().optional(),
@@ -2805,7 +2869,7 @@ var fr = e.enum([
2805
2869
  friendly_name: e.string().optional(),
2806
2870
  confirmed: e.boolean().default(!1)
2807
2871
  });
2808
- function R(t, n) {
2872
+ function z(t, n) {
2809
2873
  t.type === "phone" && !t.phone_number && n.addIssue({
2810
2874
  code: e.ZodIssueCode.custom,
2811
2875
  message: "phone_number is required when type is 'phone'",
@@ -2828,29 +2892,29 @@ function R(t, n) {
2828
2892
  path: ["public_key"]
2829
2893
  }));
2830
2894
  }
2831
- pr.superRefine(R), pr.extend({
2895
+ R.superRefine(z), R.extend({
2832
2896
  id: e.string(),
2833
2897
  created_at: e.string(),
2834
2898
  updated_at: e.string()
2835
- }).superRefine(R), e.object({
2899
+ }).superRefine(z), e.object({
2836
2900
  id: e.string().optional(),
2837
2901
  created_at: e.string().datetime({ offset: !0 }).optional(),
2838
2902
  updated_at: e.string().datetime({ offset: !0 }).optional()
2839
2903
  });
2840
- var mr = "x-authhero-preserve-location", z = class extends Error {
2904
+ var hr = "x-authhero-preserve-location", B = class extends Error {
2841
2905
  ms;
2842
2906
  constructor(e, t) {
2843
2907
  super(`${t ?? "Operation"} timed out after ${e}ms`), this.name = "TimeoutError", this.ms = e;
2844
2908
  }
2845
2909
  };
2846
- function B(e) {
2847
- return e instanceof z ? !0 : e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
2910
+ function V(e) {
2911
+ return e instanceof B ? !0 : e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
2848
2912
  }
2849
- function V(e, t) {
2913
+ function H(e, t) {
2850
2914
  let n = new AbortController(), r = setTimeout(() => n.abort(), e);
2851
2915
  return t(n.signal).finally(() => clearTimeout(r));
2852
2916
  }
2853
- function hr(e) {
2917
+ function gr(e) {
2854
2918
  let t = e.filter((e) => e !== void 0);
2855
2919
  if (t.length <= 1) return t[0];
2856
2920
  if (typeof AbortSignal.any == "function") return AbortSignal.any(t);
@@ -2863,18 +2927,18 @@ function hr(e) {
2863
2927
  for (let e of t) e.addEventListener("abort", i);
2864
2928
  return n.signal;
2865
2929
  }
2866
- function H(e, t, n, r) {
2867
- let i = new AbortController(), a = hr([n, i.signal]) ?? i.signal, o, s = new Promise((n, r) => {
2930
+ function U(e, t, n, r) {
2931
+ let i = new AbortController(), a = gr([n, i.signal]) ?? i.signal, o, s = new Promise((n, r) => {
2868
2932
  o = setTimeout(() => {
2869
- let n = new z(e, t);
2933
+ let n = new B(e, t);
2870
2934
  i.abort(n), r(n);
2871
2935
  }, e);
2872
2936
  });
2873
2937
  return Promise.race([Promise.resolve().then(() => r(a)), s]).finally(() => clearTimeout(o));
2874
2938
  }
2875
- function U(e, t, n) {
2939
+ function W(e, t, n) {
2876
2940
  let r, i = new Promise((e, i) => {
2877
- r = setTimeout(() => i(new z(t, n)), t);
2941
+ r = setTimeout(() => i(new B(t, n)), t);
2878
2942
  });
2879
2943
  return Promise.race([e, i]).finally(() => {
2880
2944
  r && clearTimeout(r);
@@ -2882,12 +2946,12 @@ function U(e, t, n) {
2882
2946
  }
2883
2947
  //#endregion
2884
2948
  //#region src/data-plane/cache.ts
2885
- var gr = 1e4, _r = 8e3;
2886
- function W(e, t, n) {
2949
+ var _r = 1e4, vr = 8e3;
2950
+ function G(e, t, n) {
2887
2951
  let r = typeof t == "number" ? {
2888
2952
  freshTtlMs: t,
2889
2953
  maxEntries: n
2890
- } : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ?? gr, l = r.waitUntil, u = r.upstreamTimeoutMs ?? _r, d = u > 0 ? u : 1e4, f = /* @__PURE__ */ new Map();
2954
+ } : t, i = r.freshTtlMs, a = r.staleTtlMs ?? 0, o = r.staleIfErrorTtlMs ?? 0, s = r.negativeTtlMs ?? i, c = r.maxEntries ?? _r, l = r.waitUntil, u = r.upstreamTimeoutMs ?? vr, d = u > 0 ? u : 1e4, f = /* @__PURE__ */ new Map();
2891
2955
  function p(e) {
2892
2956
  for (let [t, n] of f) n.stale_if_error_until <= e && n.stale_until <= e && f.delete(t);
2893
2957
  for (; f.size >= c;) {
@@ -2909,7 +2973,7 @@ function W(e, t, n) {
2909
2973
  return e.refresh_started_at === void 0 ? !1 : t - e.refresh_started_at < d ? !0 : (e.refresh_started_at = void 0, !1);
2910
2974
  }
2911
2975
  function g(t, n) {
2912
- return u > 0 ? H(u, "resolveHost", n, (n) => e.resolveHost(t, { signal: n })) : e.resolveHost(t, { signal: n });
2976
+ return u > 0 ? U(u, "resolveHost", n, (n) => e.resolveHost(t, { signal: n })) : e.resolveHost(t, { signal: n });
2913
2977
  }
2914
2978
  async function _(e, t) {
2915
2979
  let n = f.get(e);
@@ -2942,7 +3006,7 @@ function W(e, t, n) {
2942
3006
  }
2943
3007
  //#endregion
2944
3008
  //#region src/data-plane/registry.ts
2945
- var vr = class {
3009
+ var yr = class {
2946
3010
  definitions = /* @__PURE__ */ new Map();
2947
3011
  bindings;
2948
3012
  constructor(e = {}) {
@@ -2962,23 +3026,20 @@ var vr = class {
2962
3026
  return n.build(r.data, { bindings: this.bindings });
2963
3027
  }
2964
3028
  };
2965
- function G(e) {
3029
+ function K(e) {
2966
3030
  return e;
2967
3031
  }
2968
3032
  //#endregion
2969
3033
  //#region src/data-plane/handlers/util.ts
2970
- var yr = "__authhero_proxy_request__", br = "__authhero_proxy_tenant_id__", xr = "__authhero_proxy_custom_domain_id__", Sr = "__authhero_proxy_domain__", Cr = "x-authhero-proxy-mutability-probe";
2971
- function wr(e, t) {
2972
- e.set(yr, t);
2973
- }
2974
- function K(e) {
2975
- return e.get(yr) ?? e.req.raw;
2976
- }
3034
+ var br = "__authhero_proxy_request__", xr = "__authhero_proxy_tenant_id__", Sr = "__authhero_proxy_custom_domain_id__", Cr = "__authhero_proxy_domain__", wr = "x-authhero-proxy-mutability-probe";
2977
3035
  function Tr(e, t) {
2978
- e.set(br, t.tenant_id), e.set(xr, t.custom_domain_id), e.set(Sr, t.domain);
3036
+ e.set(br, t);
2979
3037
  }
2980
- function Er(e) {
2981
- return e.get(br);
3038
+ function q(e) {
3039
+ return e.get(br) ?? e.req.raw;
3040
+ }
3041
+ function Er(e, t) {
3042
+ e.set(xr, t.tenant_id), e.set(Sr, t.custom_domain_id), e.set(Cr, t.domain);
2982
3043
  }
2983
3044
  function Dr(e) {
2984
3045
  return e.get(xr);
@@ -2986,14 +3047,17 @@ function Dr(e) {
2986
3047
  function Or(e) {
2987
3048
  return e.get(Sr);
2988
3049
  }
2989
- function kr(e, t) {
2990
- let n = K(e), r = new Headers(n.headers);
2991
- t(r), wr(e, new Request(n, { headers: r }));
3050
+ function kr(e) {
3051
+ return e.get(Cr);
2992
3052
  }
2993
- function q(e) {
3053
+ function Ar(e, t) {
3054
+ let n = q(e), r = new Headers(n.headers);
3055
+ t(r), Tr(e, new Request(n, { headers: r }));
3056
+ }
3057
+ function J(e) {
2994
3058
  let t = e.res;
2995
3059
  try {
2996
- t.headers.append(Cr, "1"), t.headers.delete(Cr);
3060
+ t.headers.append(wr, "1"), t.headers.delete(wr);
2997
3061
  return;
2998
3062
  } catch {
2999
3063
  e.res = new Response(t.body, {
@@ -3005,7 +3069,7 @@ function q(e) {
3005
3069
  }
3006
3070
  //#endregion
3007
3071
  //#region src/data-plane/handlers/cors.ts
3008
- var Ar = e.object({
3072
+ var jr = e.object({
3009
3073
  origins: e.array(e.string()).optional(),
3010
3074
  allow_credentials: e.boolean().optional(),
3011
3075
  allow_headers: e.array(e.string()).optional(),
@@ -3013,44 +3077,44 @@ var Ar = e.object({
3013
3077
  expose_headers: e.array(e.string()).optional(),
3014
3078
  max_age: e.number().int().optional()
3015
3079
  }).refine((e) => !(e.allow_credentials && e.origins?.includes("*")), { message: "Cannot use wildcard origin (*) with allow_credentials" });
3016
- function jr(e, t) {
3080
+ function Mr(e, t) {
3017
3081
  let n = new Headers(), r = e.origins ?? ["*"], i = r.includes("*");
3018
3082
  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;
3019
3083
  }
3020
- var Mr = G({
3084
+ var Nr = K({
3021
3085
  type: "cors",
3022
- optionsSchema: Ar,
3086
+ optionsSchema: jr,
3023
3087
  build(e) {
3024
3088
  return async (t, n) => {
3025
3089
  let r = t.req.header("origin") ?? null;
3026
3090
  if (t.req.method === "OPTIONS" && r !== null && t.req.header("access-control-request-method") !== void 0) {
3027
- let t = jr(e, r);
3091
+ let t = Mr(e, r);
3028
3092
  return new Response(null, {
3029
3093
  status: 204,
3030
3094
  headers: t
3031
3095
  });
3032
3096
  }
3033
3097
  await n();
3034
- let i = jr(e, r);
3035
- q(t), i.forEach((e, n) => {
3098
+ let i = Mr(e, r);
3099
+ J(t), i.forEach((e, n) => {
3036
3100
  n.toLowerCase() === "vary" ? t.res.headers.append(n, e) : t.res.headers.set(n, e);
3037
3101
  });
3038
3102
  };
3039
3103
  }
3040
- }), Nr = e.object({
3104
+ }), Pr = e.object({
3041
3105
  username: e.string(),
3042
3106
  password: e.string(),
3043
3107
  realm: e.string().optional()
3044
3108
  });
3045
- function Pr(e, t) {
3109
+ function Fr(e, t) {
3046
3110
  let n = `${e}:${t}`;
3047
3111
  return typeof btoa == "function" ? btoa(n) : Buffer.from(n, "utf-8").toString("base64");
3048
3112
  }
3049
- var Fr = G({
3113
+ var Ir = K({
3050
3114
  type: "basic_auth",
3051
- optionsSchema: Nr,
3115
+ optionsSchema: Pr,
3052
3116
  build(e) {
3053
- let t = Pr(e.username, e.password), n = (e.realm ?? "Restricted").replace(/["\\\r\n]/g, "");
3117
+ let t = Fr(e.username, e.password), n = (e.realm ?? "Restricted").replace(/["\\\r\n]/g, "");
3054
3118
  return async (e, r) => {
3055
3119
  let i = e.req.header("authorization");
3056
3120
  if (i) {
@@ -3066,7 +3130,7 @@ var Fr = G({
3066
3130
  });
3067
3131
  };
3068
3132
  }
3069
- }), Ir = G({
3133
+ }), Lr = K({
3070
3134
  type: "headers",
3071
3135
  optionsSchema: e.object({
3072
3136
  request: e.record(e.string(), e.string()).optional(),
@@ -3076,23 +3140,23 @@ var Fr = G({
3076
3140
  }),
3077
3141
  build(e) {
3078
3142
  return async (t, n) => {
3079
- if ((e.request || e.remove_request) && kr(t, (t) => {
3143
+ if ((e.request || e.remove_request) && Ar(t, (t) => {
3080
3144
  if (e.remove_request?.forEach((e) => t.delete(e)), e.request) for (let [n, r] of Object.entries(e.request)) t.set(n, r);
3081
- }), await n(), (e.response || e.remove_response) && (q(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);
3145
+ }), await n(), (e.response || e.remove_response) && (J(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);
3082
3146
  };
3083
3147
  }
3084
- }), Lr = G({
3148
+ }), Rr = K({
3085
3149
  type: "cache",
3086
3150
  optionsSchema: e.object({ ttl_seconds: e.number().int().positive() }),
3087
3151
  build(e) {
3088
3152
  return async (t, n) => {
3089
3153
  if (await n(), !t.res.headers.has("Cache-Control")) {
3090
3154
  let n = t.res.headers.has("set-cookie") ? "private" : "public";
3091
- q(t), t.res.headers.set("Cache-Control", `${n}, max-age=${e.ttl_seconds}`);
3155
+ J(t), t.res.headers.set("Cache-Control", `${n}, max-age=${e.ttl_seconds}`);
3092
3156
  }
3093
3157
  };
3094
3158
  }
3095
- }), Rr = [
3159
+ }), zr = [
3096
3160
  "173.245.48.0/20",
3097
3161
  "103.21.244.0/22",
3098
3162
  "103.22.200.0/22",
@@ -3116,7 +3180,7 @@ var Fr = G({
3116
3180
  "2a06:98c0::/29",
3117
3181
  "2c0f:f248::/32"
3118
3182
  ];
3119
- function zr(e) {
3183
+ function Br(e) {
3120
3184
  let t = e.split(".");
3121
3185
  if (t.length !== 4) return null;
3122
3186
  let n = [];
@@ -3128,14 +3192,14 @@ function zr(e) {
3128
3192
  }
3129
3193
  return n;
3130
3194
  }
3131
- function Br(e) {
3195
+ function Vr(e) {
3132
3196
  if (e === "") return [];
3133
3197
  let t = e.split(":"), n = [];
3134
3198
  for (let e = 0; e < t.length; e++) {
3135
3199
  let r = t[e];
3136
3200
  if (r.includes(".")) {
3137
3201
  if (e !== t.length - 1) return null;
3138
- let i = zr(r);
3202
+ let i = Br(r);
3139
3203
  if (!i) return null;
3140
3204
  n.push(i[0] << 8 | i[1], i[2] << 8 | i[3]);
3141
3205
  continue;
@@ -3145,14 +3209,14 @@ function Br(e) {
3145
3209
  }
3146
3210
  return n;
3147
3211
  }
3148
- function Vr(e) {
3212
+ function Hr(e) {
3149
3213
  let t = e.split("::");
3150
3214
  if (t.length > 2) return null;
3151
- let n = Br(t[0] ?? "");
3215
+ let n = Vr(t[0] ?? "");
3152
3216
  if (!n) return null;
3153
3217
  let r;
3154
3218
  if (t.length === 2) {
3155
- let e = Br(t[1] ?? "");
3219
+ let e = Vr(t[1] ?? "");
3156
3220
  if (!e) return null;
3157
3221
  let i = 8 - n.length - e.length;
3158
3222
  if (i < 1) return null;
@@ -3167,25 +3231,25 @@ function Vr(e) {
3167
3231
  for (let e of r) i.push(e >> 8 & 255, e & 255);
3168
3232
  return i;
3169
3233
  }
3170
- function Hr(e) {
3234
+ function Ur(e) {
3171
3235
  let t = e.trim();
3172
3236
  t.startsWith("[") && t.endsWith("]") && (t = t.slice(1, -1));
3173
3237
  let n = t.indexOf("%");
3174
3238
  if (n !== -1 && (t = t.slice(0, n)), t === "") return null;
3175
- if (!t.includes(":")) return zr(t);
3176
- let r = Vr(t);
3239
+ if (!t.includes(":")) return Br(t);
3240
+ let r = Hr(t);
3177
3241
  return r ? r.slice(0, 10).every((e) => e === 0) && r[10] === 255 && r[11] === 255 ? r.slice(12) : r : null;
3178
3242
  }
3179
- function Ur(e) {
3180
- let [t, n] = e.split("/"), r = Hr(t ?? ""), i = Number(n);
3243
+ function Wr(e) {
3244
+ let [t, n] = e.split("/"), r = Ur(t ?? ""), i = Number(n);
3181
3245
  if (!r || !Number.isInteger(i)) throw Error(`Invalid Cloudflare CIDR: ${e}`);
3182
3246
  return {
3183
3247
  bytes: r,
3184
3248
  prefixBits: i
3185
3249
  };
3186
3250
  }
3187
- var Wr = Rr.map(Ur);
3188
- function Gr(e, t) {
3251
+ var Gr = zr.map(Wr);
3252
+ function Kr(e, t) {
3189
3253
  if (e.length !== t.bytes.length) return !1;
3190
3254
  let n = t.prefixBits >> 3;
3191
3255
  for (let r = 0; r < n; r++) if (e[r] !== t.bytes[r]) return !1;
@@ -3194,11 +3258,11 @@ function Gr(e, t) {
3194
3258
  let i = 255 << 8 - r & 255;
3195
3259
  return (e[n] & i) === (t.bytes[n] & i);
3196
3260
  }
3197
- function Kr(e) {
3198
- let t = Hr(e);
3199
- return t ? Wr.some((e) => Gr(t, e)) : !1;
3261
+ function qr(e) {
3262
+ let t = Ur(e);
3263
+ return t ? Gr.some((e) => Kr(t, e)) : !1;
3200
3264
  }
3201
- var qr = G({
3265
+ var Jr = K({
3202
3266
  type: "forwarded_headers",
3203
3267
  optionsSchema: e.object({
3204
3268
  client_ip_header: e.string().default("cf-connecting-ip"),
@@ -3209,46 +3273,46 @@ var qr = G({
3209
3273
  build(e) {
3210
3274
  return async (t, n) => {
3211
3275
  let r = new URL(t.req.url);
3212
- kr(t, (n) => {
3276
+ Ar(t, (n) => {
3213
3277
  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);
3214
- let i = n.get(e.client_ip_header), a = i && e.skip_cloudflare_client_ip && Kr(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;
3278
+ let i = n.get(e.client_ip_header), a = i && e.skip_cloudflare_client_ip && qr(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;
3215
3279
  n.set("x-forwarded-for", l), e.set_x_real_ip && n.set("x-real-ip", s);
3216
3280
  }), await n();
3217
3281
  };
3218
3282
  }
3219
- }), Jr = e.object({ upstream_host: e.string().optional() });
3220
- function Yr(e) {
3283
+ }), Yr = e.object({ upstream_host: e.string().optional() });
3284
+ function Xr(e) {
3221
3285
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3222
3286
  }
3223
- function Xr(e) {
3287
+ function Zr(e) {
3224
3288
  if (typeof e.getSetCookie == "function") return e.getSetCookie();
3225
3289
  let t = [];
3226
3290
  return e.forEach((e, n) => {
3227
3291
  n.toLowerCase() === "set-cookie" && t.push(e);
3228
3292
  }), t;
3229
3293
  }
3230
- var Zr = G({
3294
+ var Qr = K({
3231
3295
  type: "rewrite_cookies",
3232
- optionsSchema: Jr,
3296
+ optionsSchema: Yr,
3233
3297
  build(e) {
3234
3298
  return async (t, n) => {
3235
3299
  await n();
3236
3300
  let r = new URL(t.req.url).hostname, i = e.upstream_host ?? t.get("__proxy_upstream_host__");
3237
3301
  if (!i) return;
3238
- let a = Xr(t.res.headers);
3302
+ let a = Zr(t.res.headers);
3239
3303
  if (a.length === 0) return;
3240
- let o = Yr(i), s = RegExp(`(?:^|;\\s*)Domain=\\.?${o}(?=;|$)`, "i");
3241
- q(t), t.res.headers.delete("set-cookie");
3304
+ let o = Xr(i), s = RegExp(`(?:^|;\\s*)Domain=\\.?${o}(?=;|$)`, "i");
3305
+ J(t), t.res.headers.delete("set-cookie");
3242
3306
  for (let e of a) t.res.headers.append("set-cookie", e.replace(s, `Domain=${r}`));
3243
3307
  };
3244
3308
  }
3245
- }), Qr = G({
3309
+ }), $r = K({
3246
3310
  type: "rewrite_location",
3247
3311
  optionsSchema: e.object({ upstream_origin: e.string().optional() }),
3248
3312
  build(e) {
3249
3313
  return async (t, n) => {
3250
3314
  if (await n(), t.res.headers.has("x-authhero-preserve-location")) {
3251
- q(t), t.res.headers.delete(mr);
3315
+ J(t), t.res.headers.delete(hr);
3252
3316
  return;
3253
3317
  }
3254
3318
  let r = t.res.status;
@@ -3265,10 +3329,10 @@ var Zr = G({
3265
3329
  }
3266
3330
  if (o.origin !== a) return;
3267
3331
  let s = new URL(t.req.url), c = `${`${s.protocol}//${s.host}`}${o.pathname}${o.search}${o.hash}`;
3268
- q(t), t.res.headers.set("location", c);
3332
+ J(t), t.res.headers.set("location", c);
3269
3333
  };
3270
3334
  }
3271
- }), $r = new Set([
3335
+ }), ei = new Set([
3272
3336
  "connection",
3273
3337
  "keep-alive",
3274
3338
  "proxy-authenticate",
@@ -3277,32 +3341,32 @@ var Zr = G({
3277
3341
  "trailers",
3278
3342
  "transfer-encoding",
3279
3343
  "upgrade"
3280
- ]), ei = 3e4, ti = e.object({
3344
+ ]), ti = 3e4, ni = e.object({
3281
3345
  upstream_url: e.string(),
3282
3346
  preserve_host: e.boolean().default(!1),
3283
3347
  timeout_ms: e.number().int().positive().optional()
3284
3348
  });
3285
- function ni(e, t) {
3349
+ function ri(e, t) {
3286
3350
  return e === "" || e === "/" ? t : `${e.endsWith("/") ? e.slice(0, -1) : e}${t.startsWith("/") ? t : `/${t}`}`;
3287
3351
  }
3288
- function ri(e) {
3352
+ function ii(e) {
3289
3353
  return e !== "GET" && e !== "HEAD";
3290
3354
  }
3291
- var ii = 128 * 1024;
3292
- function ai(e) {
3355
+ var ai = 128 * 1024;
3356
+ function oi(e) {
3293
3357
  let t = e.headers.get("content-length");
3294
3358
  if (t === null) return null;
3295
3359
  let n = Number(t);
3296
3360
  return Number.isInteger(n) && n >= 0 ? n : null;
3297
3361
  }
3298
- async function oi(e, t) {
3362
+ async function si(e, t) {
3299
3363
  let n = e.getReader(), r = !1, i = setTimeout(() => {
3300
3364
  r = !0, n.cancel().catch(() => {});
3301
3365
  }, t), a = [], o = 0;
3302
3366
  try {
3303
3367
  for (;;) {
3304
3368
  let { done: e, value: i } = await n.read();
3305
- if (r) throw new z(t, "Request body read");
3369
+ if (r) throw new B(t, "Request body read");
3306
3370
  if (e) break;
3307
3371
  a.push(i), o += i.byteLength;
3308
3372
  }
@@ -3313,8 +3377,8 @@ async function oi(e, t) {
3313
3377
  for (let e of a) s.set(e, c), c += e.byteLength;
3314
3378
  return s.buffer;
3315
3379
  }
3316
- function si(e) {
3317
- return B(e) ? new Response("Request body timeout", {
3380
+ function ci(e) {
3381
+ return V(e) ? new Response("Request body timeout", {
3318
3382
  status: 408,
3319
3383
  headers: { "x-authhero-proxy-error": "request_body_timeout" }
3320
3384
  }) : new Response("Bad request", {
@@ -3322,20 +3386,20 @@ function si(e) {
3322
3386
  headers: { "x-authhero-proxy-error": "request_body_failed" }
3323
3387
  });
3324
3388
  }
3325
- async function ci(e, t, n) {
3326
- if (!ri(e.method) || !e.body) return;
3327
- let r = ai(e);
3328
- if (r === null || r > ii) return e.body;
3329
- let i = await oi(e.body, n);
3389
+ async function li(e, t, n) {
3390
+ if (!ii(e.method) || !e.body) return;
3391
+ let r = oi(e);
3392
+ if (r === null || r > ai) return e.body;
3393
+ let i = await si(e.body, n);
3330
3394
  return t.set("content-length", String(i.byteLength)), i;
3331
3395
  }
3332
- async function li(e, t, n) {
3396
+ async function ui(e, t, n) {
3333
3397
  let r = new URL(t.url), i = new URL(e.upstream_url);
3334
- i.pathname = ni(i.pathname, r.pathname), i.search = r.search;
3398
+ i.pathname = ri(i.pathname, r.pathname), i.search = r.search;
3335
3399
  let a = new Headers(t.headers);
3336
- for (let e of $r) a.delete(e);
3400
+ for (let e of ei) a.delete(e);
3337
3401
  e.preserve_host || a.set("host", i.host), a.has("x-forwarded-host") || a.set("x-forwarded-host", r.host), a.has("x-forwarded-proto") || a.set("x-forwarded-proto", r.protocol.replace(":", ""));
3338
- let o = await ci(t, a, n), s = {
3402
+ let o = await li(t, a, n), s = {
3339
3403
  method: t.method,
3340
3404
  headers: a,
3341
3405
  body: o,
@@ -3346,97 +3410,97 @@ async function li(e, t, n) {
3346
3410
  init: s
3347
3411
  };
3348
3412
  }
3349
- var ui = G({
3413
+ var di = K({
3350
3414
  type: "http",
3351
- optionsSchema: ti,
3415
+ optionsSchema: ni,
3352
3416
  build(e) {
3353
- let t = e.timeout_ms ?? ei;
3417
+ let t = e.timeout_ms ?? ti;
3354
3418
  return async (n) => {
3355
- let r = K(n), i;
3419
+ let r = q(n), i;
3356
3420
  try {
3357
- i = await li(e, r, t);
3421
+ i = await ui(e, r, t);
3358
3422
  } catch (e) {
3359
- return si(e);
3423
+ return ci(e);
3360
3424
  }
3361
3425
  let { target: a, init: o } = i;
3362
3426
  n.set("__proxy_upstream_host__", a.hostname), n.set("__proxy_upstream_origin__", `${a.protocol}//${a.host}`);
3363
3427
  try {
3364
- return await V(t, (e) => fetch(a.toString(), {
3428
+ return await H(t, (e) => fetch(a.toString(), {
3365
3429
  ...o,
3366
3430
  signal: e
3367
3431
  }));
3368
3432
  } catch (e) {
3369
- return B(e) ? n.text("Upstream timeout", 504, { "x-authhero-proxy-error": "http_timeout" }) : n.text("Bad gateway", 502, { "x-authhero-proxy-error": "http_failed" });
3433
+ return V(e) ? n.text("Upstream timeout", 504, { "x-authhero-proxy-error": "http_timeout" }) : n.text("Bad gateway", 502, { "x-authhero-proxy-error": "http_failed" });
3370
3434
  }
3371
3435
  };
3372
3436
  }
3373
- }), di = 3e4, fi = e.object({
3437
+ }), fi = 3e4, pi = e.object({
3374
3438
  binding: e.string(),
3375
3439
  upstream_url: e.string().optional(),
3376
3440
  preserve_host: e.boolean().default(!0),
3377
3441
  timeout_ms: e.number().int().positive().optional()
3378
3442
  });
3379
- function pi(e) {
3443
+ function mi(e) {
3380
3444
  return typeof e == "object" && !!e && typeof e.fetch == "function";
3381
3445
  }
3382
- var mi = G({
3446
+ var hi = K({
3383
3447
  type: "service_binding",
3384
- optionsSchema: fi,
3448
+ optionsSchema: pi,
3385
3449
  build(e, t) {
3386
3450
  let n = t.bindings[e.binding];
3387
- if (!pi(n)) throw Error(`Service binding "${e.binding}" is not configured or is not a Fetcher`);
3388
- let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ?? di;
3451
+ if (!mi(n)) throw Error(`Service binding "${e.binding}" is not configured or is not a Fetcher`);
3452
+ let r = e.upstream_url ?? `https://${e.binding}.binding.invalid/`, i = e.timeout_ms ?? fi;
3389
3453
  return async (t) => {
3390
- let a = K(t), o;
3454
+ let a = q(t), o;
3391
3455
  try {
3392
- o = await li({
3456
+ o = await ui({
3393
3457
  upstream_url: r,
3394
3458
  preserve_host: e.preserve_host
3395
3459
  }, a, i);
3396
3460
  } catch (e) {
3397
- return si(e);
3461
+ return ci(e);
3398
3462
  }
3399
3463
  let { target: s, init: c } = o;
3400
3464
  t.set("__proxy_upstream_host__", s.hostname), t.set("__proxy_upstream_origin__", `${s.protocol}//${s.host}`);
3401
3465
  try {
3402
- return await V(i, async (e) => n.fetch(new Request(s.toString(), {
3466
+ return await H(i, async (e) => n.fetch(new Request(s.toString(), {
3403
3467
  ...c,
3404
3468
  signal: e
3405
3469
  })));
3406
3470
  } catch (e) {
3407
- return B(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" });
3471
+ return V(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" });
3408
3472
  }
3409
3473
  };
3410
3474
  }
3411
- }), hi = 3e4, gi = e.object({
3475
+ }), gi = 3e4, _i = e.object({
3412
3476
  binding: e.string(),
3413
3477
  script_name: e.string(),
3414
3478
  cpu_ms: e.number().int().positive().optional(),
3415
3479
  subrequests: e.number().int().positive().optional(),
3416
3480
  timeout_ms: e.number().int().positive().optional()
3417
3481
  });
3418
- function _i(e) {
3482
+ function vi(e) {
3419
3483
  return typeof e == "object" && !!e && typeof e.get == "function";
3420
3484
  }
3421
- var J = /\{(tenant_id|custom_domain_id|domain|host)\}/g;
3422
- function vi(e) {
3423
- return J.lastIndex = 0, J.test(e);
3485
+ var Y = /\{(tenant_id|custom_domain_id|domain|host)\}/g;
3486
+ function yi(e) {
3487
+ return Y.lastIndex = 0, Y.test(e);
3424
3488
  }
3425
- var yi = G({
3489
+ var bi = K({
3426
3490
  type: "dispatch_namespace",
3427
- optionsSchema: gi,
3491
+ optionsSchema: _i,
3428
3492
  build(e, t) {
3429
3493
  let n = t.bindings[e.binding];
3430
- if (!_i(n)) throw Error(`Dispatch namespace binding "${e.binding}" is not configured or does not expose .get()`);
3431
- let r = vi(e.script_name), i = e.timeout_ms ?? hi, a = e.cpu_ms || e.subrequests ? { limits: {
3494
+ if (!vi(n)) throw Error(`Dispatch namespace binding "${e.binding}" is not configured or does not expose .get()`);
3495
+ let r = yi(e.script_name), i = e.timeout_ms ?? gi, a = e.cpu_ms || e.subrequests ? { limits: {
3432
3496
  ...e.cpu_ms ? { cpuMs: e.cpu_ms } : {},
3433
3497
  ...e.subrequests ? { subrequests: e.subrequests } : {}
3434
3498
  } } : void 0;
3435
3499
  return async (t) => {
3436
3500
  let o = e.script_name;
3437
3501
  if (r) {
3438
- let n = Er(t), r = Dr(t), i = Or(t), a = t.req.header("host") ?? t.req.header("x-forwarded-host") ?? "";
3439
- if (o = o.replace(J, (e, t) => {
3502
+ let n = Dr(t), r = Or(t), i = kr(t), a = t.req.header("host") ?? t.req.header("x-forwarded-host") ?? "";
3503
+ if (o = o.replace(Y, (e, t) => {
3440
3504
  switch (t) {
3441
3505
  case "tenant_id": return n ?? "";
3442
3506
  case "custom_domain_id": return r ?? "";
@@ -3446,19 +3510,19 @@ var yi = G({
3446
3510
  }
3447
3511
  }), o.includes("{") || o === "") return t.text(`dispatch_namespace: could not resolve script name from template "${e.script_name}"`, 500);
3448
3512
  }
3449
- let s = K(t);
3513
+ let s = q(t);
3450
3514
  try {
3451
3515
  let e = n.get(o, void 0, a);
3452
- return await V(i, async (t) => {
3516
+ return await H(i, async (t) => {
3453
3517
  let n = new Request(s, { signal: t });
3454
3518
  return e.fetch(n);
3455
3519
  });
3456
3520
  } catch (e) {
3457
- return B(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" });
3521
+ return V(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" });
3458
3522
  }
3459
3523
  };
3460
3524
  }
3461
- }), bi = G({
3525
+ }), xi = K({
3462
3526
  type: "redirect",
3463
3527
  optionsSchema: e.object({
3464
3528
  upstream_url: e.string().refine((e) => {
@@ -3487,7 +3551,7 @@ var yi = G({
3487
3551
  });
3488
3552
  };
3489
3553
  }
3490
- }), xi = G({
3554
+ }), Si = K({
3491
3555
  type: "static",
3492
3556
  optionsSchema: e.object({
3493
3557
  status: e.number().int().default(200),
@@ -3507,15 +3571,15 @@ var yi = G({
3507
3571
  });
3508
3572
  //#endregion
3509
3573
  //#region src/data-plane/handlers/index.ts
3510
- function Si(e) {
3511
- e.add(Mr).add(Fr).add(Ir).add(Lr).add(qr).add(Zr).add(Qr).add(ui).add(mi).add(yi).add(bi).add(xi);
3574
+ function Ci(e) {
3575
+ e.add(Nr).add(Ir).add(Lr).add(Rr).add(Jr).add(Qr).add($r).add(di).add(hi).add(bi).add(xi).add(Si);
3512
3576
  }
3513
3577
  //#endregion
3514
3578
  //#region src/data-plane/matcher.ts
3515
- function Ci(e) {
3579
+ function wi(e) {
3516
3580
  return [...e].sort((e, t) => e.priority === t.priority ? e.created_at.localeCompare(t.created_at) : e.priority - t.priority);
3517
3581
  }
3518
- function wi(e, t) {
3582
+ function Ti(e, t) {
3519
3583
  let n = e.toLowerCase(), r = t.toLowerCase();
3520
3584
  if (n === r) return !0;
3521
3585
  if (n.startsWith("*.")) {
@@ -3524,13 +3588,13 @@ function wi(e, t) {
3524
3588
  }
3525
3589
  return !1;
3526
3590
  }
3527
- function Ti(e, t) {
3528
- return !e || e.length === 0 ? !0 : e.some((e) => wi(e, t));
3591
+ function Ei(e, t) {
3592
+ return !e || e.length === 0 ? !0 : e.some((e) => Ti(e, t));
3529
3593
  }
3530
- function Ei(e) {
3594
+ function Di(e) {
3531
3595
  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;
3532
3596
  return async (e, i) => {
3533
- if (r && !Ti(r, e.req.header("host") ?? "")) return new Response("No matching route", { status: 404 });
3597
+ if (r && !Ei(r, e.req.header("host") ?? "")) return new Response("No matching route", { status: 404 });
3534
3598
  for (let [n, r] of t) {
3535
3599
  let t = e.req.header(n);
3536
3600
  if (t === void 0 || !r.test(t)) return new Response("No matching route", { status: 404 });
@@ -3547,17 +3611,17 @@ function Ei(e) {
3547
3611
  }
3548
3612
  //#endregion
3549
3613
  //#region src/data-plane/compile.ts
3550
- var Di = "forwarded_headers";
3551
- function Oi(e) {
3614
+ var Oi = "forwarded_headers";
3615
+ function ki(e) {
3552
3616
  return e.some((e) => e.type === "forwarded_headers") ? [...e] : [{
3553
- type: Di,
3617
+ type: Oi,
3554
3618
  options: {}
3555
3619
  }, ...e];
3556
3620
  }
3557
- function Y(e, t) {
3558
- return e.has("forwarded_headers") ? Oi(t) : [...t];
3621
+ function X(e, t) {
3622
+ return e.has("forwarded_headers") ? ki(t) : [...t];
3559
3623
  }
3560
- var X = [
3624
+ var Ai = [
3561
3625
  "GET",
3562
3626
  "POST",
3563
3627
  "PUT",
@@ -3569,39 +3633,39 @@ var X = [
3569
3633
  function Z(e, n, r, i) {
3570
3634
  let a = new t();
3571
3635
  r && a.use("*", async (e, t) => {
3572
- Tr(e, r), await t();
3636
+ Er(e, r), await t();
3573
3637
  });
3574
- let o = Ci(e);
3638
+ let o = wi(e);
3575
3639
  for (let e of o) {
3576
3640
  let t = [];
3577
- t.push(Ei(e.match));
3578
- for (let r of Y(n, e.handlers)) t.push(n.build(r.type, r.options));
3579
- let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) : X, i = e.match.path || "/*";
3641
+ t.push(Di(e.match));
3642
+ for (let r of X(n, e.handlers)) t.push(n.build(r.type, r.options));
3643
+ let r = e.match.methods?.length ? e.match.methods.map((e) => e.toUpperCase()) : Ai, i = e.match.path || "/*";
3580
3644
  a.on(r, [i], ...t);
3581
3645
  }
3582
- return i && i.length > 0 ? a.on(X, ["*"], ...i) : a.all("*", (e) => e.text("No matching route", 404)), a.onError((e, t) => {
3583
- let n = B(e);
3646
+ return i && i.length > 0 ? a.on(Ai, ["*"], ...i) : a.all("*", (e) => e.text("No matching route", 404)), a.onError((e, t) => {
3647
+ let n = V(e);
3584
3648
  return t.text(n ? "Upstream timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "handler_timeout" : "handler_failed" });
3585
3649
  }), a;
3586
3650
  }
3587
3651
  //#endregion
3588
3652
  //#region src/data-plane/router.ts
3589
- var ki = 1e4;
3590
- function Ai(e) {
3591
- return e.resolver ? e.resolver : e.cache ? W(e.data, e.cache) : W(e.data, e.cacheTtlMs ?? 3e4);
3653
+ var ji = 1e4;
3654
+ function Mi(e) {
3655
+ return e.resolver ? e.resolver : e.cache ? G(e.data, e.cache) : G(e.data, e.cacheTtlMs ?? 3e4);
3592
3656
  }
3593
- function ji(e) {
3657
+ function Ni(e) {
3594
3658
  if (e.registry) return e.registry;
3595
- let t = new vr(e.bindings ?? {});
3596
- return Si(t), t;
3659
+ let t = new yr(e.bindings ?? {});
3660
+ return Ci(t), t;
3597
3661
  }
3598
3662
  function Q(e) {
3599
- let t = Ai(e), n = ji(e), r = /* @__PURE__ */ new WeakMap(), i = e.resolveHostTimeoutMs ?? ki, 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;
3663
+ let t = Mi(e), n = Ni(e), r = /* @__PURE__ */ new WeakMap(), i = e.resolveHostTimeoutMs ?? ji, a = e.defaultHandlers && e.defaultHandlers.length > 0 ? X(n, e.defaultHandlers).map((e) => n.build(e.type, e.options)) : void 0, o = a ? Z([], n, void 0, a) : void 0;
3600
3664
  return async (e) => {
3601
3665
  let s = e.req.header("host") ?? e.req.header("x-forwarded-host");
3602
3666
  if (!s) return e.text("Missing host", 400);
3603
3667
  try {
3604
- let c = await H(i, "resolveHost", void 0, (e) => t.resolveHost(s, { signal: e }));
3668
+ let c = await U(i, "resolveHost", void 0, (e) => t.resolveHost(s, { signal: e }));
3605
3669
  if (!c) return o ? await o.fetch(e.req.raw) : e.text("Unknown host", 404);
3606
3670
  let l = r.get(c);
3607
3671
  return l || (l = Z(c.routes, n, {
@@ -3610,17 +3674,17 @@ function Q(e) {
3610
3674
  domain: c.domain
3611
3675
  }, a), r.set(c, l)), await l.fetch(e.req.raw);
3612
3676
  } catch (t) {
3613
- return o ? await o.fetch(e.req.raw) : B(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" });
3677
+ return o ? await o.fetch(e.req.raw) : V(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" });
3614
3678
  }
3615
3679
  };
3616
3680
  }
3617
- function Mi(e) {
3681
+ function Pi(e) {
3618
3682
  let n = new t();
3619
3683
  return n.all("*", Q(e)), n;
3620
3684
  }
3621
3685
  //#endregion
3622
3686
  //#region src/app.ts
3623
- function Ni(e) {
3687
+ function Fi(e) {
3624
3688
  let n = new t();
3625
3689
  return n.all("*", Q({
3626
3690
  data: e.data,
@@ -3632,62 +3696,62 @@ function Ni(e) {
3632
3696
  resolveHostTimeoutMs: e.resolveHostTimeoutMs,
3633
3697
  defaultHandlers: e.defaultHandlers
3634
3698
  })), n.onError((e, t) => {
3635
- let n = B(e);
3699
+ let n = V(e);
3636
3700
  return t.text(n ? "Proxy timeout" : "Bad gateway", n ? 504 : 502, { "x-authhero-proxy-error": n ? "proxy_timeout" : "proxy_error" });
3637
3701
  }), n;
3638
3702
  }
3639
3703
  //#endregion
3640
3704
  //#region src/data-plane/cache-api-cache.ts
3641
- var Pi = 1e3, Fi = 1e3;
3642
- function Ii(e, t) {
3705
+ var Ii = 1e3, Li = 1e3;
3706
+ function Ri(e, t) {
3643
3707
  return new Request(`https://proxy-cache.internal/${encodeURIComponent(e)}/hosts/${encodeURIComponent(t.toLowerCase())}`, { method: "GET" });
3644
3708
  }
3645
- function Li() {
3709
+ function zi() {
3646
3710
  return globalThis.caches?.default;
3647
3711
  }
3648
- function Ri(e) {
3649
- let t = e.cache ?? Li();
3712
+ function Bi(e) {
3713
+ let t = e.cache ?? zi();
3650
3714
  if (!t) return e.upstream;
3651
- let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ?? Pi, c = e.cacheWriteTimeoutMs ?? Fi;
3715
+ let n = t, r = e.namespace ?? "authhero-proxy", i = e.cacheTtlSeconds ?? 60, a = e.negativeCacheTtlSeconds ?? 10, o = e.waitUntil, s = e.cacheReadTimeoutMs ?? Ii, c = e.cacheWriteTimeoutMs ?? Li;
3652
3716
  async function l(e) {
3653
3717
  try {
3654
- return await U(Promise.resolve(n.match(e)), s, "cache.match");
3718
+ return await W(Promise.resolve(n.match(e)), s, "cache.match");
3655
3719
  } catch {
3656
3720
  return;
3657
3721
  }
3658
3722
  }
3659
3723
  return { async resolveHost(t, s) {
3660
- let u = Ii(r, t), d = await l(u);
3724
+ let u = Ri(r, t), d = await l(u);
3661
3725
  if (d) try {
3662
3726
  return (await d.json()).value;
3663
3727
  } catch {}
3664
3728
  let f = await e.upstream.resolveHost(t, s), p = f === null ? a : i, m = new Response(JSON.stringify({ value: f }), { headers: {
3665
3729
  "content-type": "application/json",
3666
3730
  "cache-control": `public, max-age=${p}`
3667
- } }), h = U(Promise.resolve(n.put(u, m)), c, "cache.put").catch(() => void 0);
3731
+ } }), h = W(Promise.resolve(n.put(u, m)), c, "cache.put").catch(() => void 0);
3668
3732
  return o ? o(h) : await h, f;
3669
3733
  } };
3670
3734
  }
3671
- function zi(e, t) {
3672
- return Ii(e, t);
3735
+ function Vi(e, t) {
3736
+ return Ri(e, t);
3673
3737
  }
3674
3738
  //#endregion
3675
3739
  //#region src/data-plane/cache-adapter-cache.ts
3676
- var Bi = 1e3, Vi = 1e3, Hi = 5e3;
3677
- function Ui(e) {
3678
- 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 = Bi, cacheWriteTimeoutMs: u = Vi, upstreamTimeoutMs: d = Hi } = e, f = d > 0 ? d : 1e4, p = /* @__PURE__ */ new Map();
3740
+ var Hi = 1e3, Ui = 1e3, Wi = 5e3;
3741
+ function Gi(e) {
3742
+ 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 = Hi, cacheWriteTimeoutMs: u = Ui, upstreamTimeoutMs: d = Wi } = e, f = d > 0 ? d : 1e4, p = /* @__PURE__ */ new Map();
3679
3743
  function m(e) {
3680
3744
  return `${s}:${e.toLowerCase()}`;
3681
3745
  }
3682
3746
  async function h(e) {
3683
3747
  try {
3684
- return await U(n.get(e), l, "cache.get") ?? null;
3748
+ return await W(n.get(e), l, "cache.get") ?? null;
3685
3749
  } catch {
3686
3750
  return null;
3687
3751
  }
3688
3752
  }
3689
3753
  function g(e, t, r) {
3690
- let i = U(Promise.resolve().then(() => n.set(e, t, r)), u, "cache.set").catch(() => void 0);
3754
+ let i = W(Promise.resolve().then(() => n.set(e, t, r)), u, "cache.set").catch(() => void 0);
3691
3755
  return c ? (c(i), Promise.resolve()) : i;
3692
3756
  }
3693
3757
  function _(e, t) {
@@ -3695,7 +3759,7 @@ function Ui(e) {
3695
3759
  return n === void 0 ? !1 : t - n < f ? !0 : (p.delete(e), !1);
3696
3760
  }
3697
3761
  function ee(e, n) {
3698
- return d > 0 ? H(d, "resolveHost", n, (n) => t.resolveHost(e, { signal: n })) : t.resolveHost(e, { signal: n });
3762
+ return d > 0 ? U(d, "resolveHost", n, (n) => t.resolveHost(e, { signal: n })) : t.resolveHost(e, { signal: n });
3699
3763
  }
3700
3764
  async function v(e, t) {
3701
3765
  return p.set(e, Date.now()), (async () => {
@@ -3732,7 +3796,7 @@ function Ui(e) {
3732
3796
  }
3733
3797
  } };
3734
3798
  }
3735
- function Wi(e, t) {
3799
+ function Ki(e, t) {
3736
3800
  return `${e}:${t.toLowerCase()}`;
3737
3801
  }
3738
3802
  //#endregion
@@ -3740,7 +3804,7 @@ function Wi(e, t) {
3740
3804
  function $() {
3741
3805
  throw Error("Static proxy adapter is read-only; configure routes at init time");
3742
3806
  }
3743
- function Gi(e, t, n, r, i, a) {
3807
+ function qi(e, t, n, r, i, a) {
3744
3808
  return {
3745
3809
  id: e.id ?? `${n}:${t}`,
3746
3810
  tenant_id: r,
@@ -3755,10 +3819,10 @@ function Gi(e, t, n, r, i, a) {
3755
3819
  updated_at: e.updated_at ?? a
3756
3820
  };
3757
3821
  }
3758
- function Ki(e) {
3822
+ function Ji(e) {
3759
3823
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = e.defaultTenantId ?? "static", r = /* @__PURE__ */ new Map();
3760
3824
  for (let [i, a] of Object.entries(e.hosts)) {
3761
- 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) => Gi(n, r, e, s, c, t)).sort((e, t) => e.priority - t.priority);
3825
+ 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) => qi(n, r, e, s, c, t)).sort((e, t) => e.priority - t.priority);
3762
3826
  r.set(e, {
3763
3827
  tenant_id: s,
3764
3828
  custom_domain_id: c,
@@ -3802,7 +3866,7 @@ function Ki(e) {
3802
3866
  }
3803
3867
  };
3804
3868
  }
3805
- function qi(e, t = {}) {
3869
+ function Yi(e, t = {}) {
3806
3870
  return {
3807
3871
  priority: t.priority,
3808
3872
  match: { path: t.path ?? "/*" },
@@ -3817,10 +3881,10 @@ function qi(e, t = {}) {
3817
3881
  }
3818
3882
  //#endregion
3819
3883
  //#region src/constants.ts
3820
- var Ji = "proxy:resolve_host";
3884
+ var Xi = "proxy:resolve_host";
3821
3885
  //#endregion
3822
3886
  //#region src/http-adapter/index.ts
3823
- function Yi() {
3887
+ function Zi() {
3824
3888
  let e = () => {
3825
3889
  throw Error("HTTP proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
3826
3890
  };
@@ -3842,12 +3906,12 @@ function Yi() {
3842
3906
  }
3843
3907
  };
3844
3908
  }
3845
- function Xi(e) {
3909
+ function Qi(e) {
3846
3910
  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;
3847
3911
  function c(e, t) {
3848
- let n = new AbortController(), r = hr([e, n.signal]) ?? n.signal, i, a = new Promise((e, t) => {
3912
+ let n = new AbortController(), r = gr([e, n.signal]) ?? n.signal, i, a = new Promise((e, t) => {
3849
3913
  i = setTimeout(() => {
3850
- n.abort(), t(new z(s, "control plane"));
3914
+ n.abort(), t(new B(s, "control plane"));
3851
3915
  }, s);
3852
3916
  });
3853
3917
  return Promise.race([t(r), a]).finally(() => clearTimeout(i));
@@ -3879,7 +3943,7 @@ function Xi(e) {
3879
3943
  return l && l.expires_at > Date.now() ? l.value : u(e);
3880
3944
  }
3881
3945
  return {
3882
- proxyRoutes: Yi(),
3946
+ proxyRoutes: Zi(),
3883
3947
  async resolveHost(e, i) {
3884
3948
  let a = i?.signal, o = await d(a), s = `${n}${r}${encodeURIComponent(e.toLowerCase())}`;
3885
3949
  return c(a, async (e) => {
@@ -3896,7 +3960,7 @@ function Xi(e) {
3896
3960
  }
3897
3961
  //#endregion
3898
3962
  //#region src/http-adapter/service-binding-fetch.ts
3899
- function Zi(e) {
3963
+ function $i(e) {
3900
3964
  return (t, n) => {
3901
3965
  let r = t instanceof Request && n === void 0 ? t : new Request(t, n);
3902
3966
  return e.fetch(r);
@@ -3904,11 +3968,11 @@ function Zi(e) {
3904
3968
  }
3905
3969
  //#endregion
3906
3970
  //#region src/kv-adapter/index.ts
3907
- var Qi = "authhero-proxy-host:";
3908
- function $i(e, t) {
3971
+ var ea = "authhero-proxy-host:";
3972
+ function ta(e, t) {
3909
3973
  return `${e}${t.toLowerCase()}`;
3910
3974
  }
3911
- function ea() {
3975
+ function na() {
3912
3976
  let e = () => {
3913
3977
  throw Error("KV proxy adapter does not expose write access to proxy_routes; mutate via the control-plane management API");
3914
3978
  };
@@ -3930,15 +3994,15 @@ function ea() {
3930
3994
  }
3931
3995
  };
3932
3996
  }
3933
- function ta(e) {
3934
- let { kv: t, keyPrefix: n = Qi, timeoutMs: r } = e;
3997
+ function ra(e) {
3998
+ let { kv: t, keyPrefix: n = ea, timeoutMs: r } = e;
3935
3999
  return {
3936
- proxyRoutes: ea(),
4000
+ proxyRoutes: na(),
3937
4001
  async resolveHost(e) {
3938
- let i = $i(n, e), a = t.get(i, "json");
3939
- return (r && r > 0 ? await U(a, r, "kv.get") : await a) ?? null;
4002
+ let i = ta(n, e), a = t.get(i, "json");
4003
+ return (r && r > 0 ? await W(a, r, "kv.get") : await a) ?? null;
3940
4004
  }
3941
4005
  };
3942
4006
  }
3943
4007
  //#endregion
3944
- export { Qi as DEFAULT_KV_HOST_KEY_PREFIX, Di as FORWARDED_HEADERS_HANDLER_TYPE, vr as HandlerRegistry, Ji as PROXY_RESOLVE_HOST_SCOPE, Fr as basicAuthHandler, Wi as buildCacheAdapterKey, zi as buildCacheApiKey, $i as buildKvHostKey, Ei as buildMatchFilter, Lr as cacheHandler, Z as compileHostApp, Mr as corsHandler, Ui as createCacheAdapterHostCache, Ri as createCacheApiHostCache, Xi as createHttpProxyAdapter, W as createInMemoryHostCache, ta as createKvProxyAdapter, Ni as createProxyApp, Q as createProxyDataPlaneHandler, Mi as createProxyDataPlaneRouter, Zi as createServiceBindingFetch, Ki as createStaticProxyAdapter, G as defineHandler, yi as dispatchNamespaceHandler, qr as forwardedHeadersHandler, Mn as handlerConfigSchema, Ir as headersHandler, ui as httpHandler, qi as httpRoute, Kr as isCloudflareIp, jn as matchSchema, Ti as matchesAnyHost, wi as matchesHost, L as proxyRouteInsertSchema, Nn as proxyRouteSchema, Pn as proxyRouteUpdateSchema, bi as redirectHandler, Si as registerBuiltinHandlers, Zr as rewriteCookiesHandler, Qr as rewriteLocationHandler, mi as serviceBindingHandler, Ci as sortRoutes, xi as staticHandler, Oi as withForwardedHeaders, Y as withForwardedHeadersFor };
4008
+ export { ea as DEFAULT_KV_HOST_KEY_PREFIX, Oi as FORWARDED_HEADERS_HANDLER_TYPE, yr as HandlerRegistry, Xi as PROXY_RESOLVE_HOST_SCOPE, Ir as basicAuthHandler, Ki as buildCacheAdapterKey, Vi as buildCacheApiKey, ta as buildKvHostKey, Di as buildMatchFilter, Rr as cacheHandler, Z as compileHostApp, Nr as corsHandler, Gi as createCacheAdapterHostCache, Bi as createCacheApiHostCache, Qi as createHttpProxyAdapter, G as createInMemoryHostCache, ra as createKvProxyAdapter, Fi as createProxyApp, Q as createProxyDataPlaneHandler, Pi as createProxyDataPlaneRouter, $i as createServiceBindingFetch, Ji as createStaticProxyAdapter, K as defineHandler, bi as dispatchNamespaceHandler, Jr as forwardedHeadersHandler, Pn as handlerConfigSchema, Lr as headersHandler, di as httpHandler, Yi as httpRoute, qr as isCloudflareIp, Nn as matchSchema, Ei as matchesAnyHost, Ti as matchesHost, L as proxyRouteInsertSchema, Fn as proxyRouteSchema, In as proxyRouteUpdateSchema, xi as redirectHandler, Ci as registerBuiltinHandlers, Qr as rewriteCookiesHandler, $r as rewriteLocationHandler, hi as serviceBindingHandler, wi as sortRoutes, Si as staticHandler, ki as withForwardedHeaders, X as withForwardedHeadersFor };