@blamejs/blamejs-shop 0.5.19 → 0.5.21

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.
Files changed (194) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -0
  3. package/SECURITY.md +17 -0
  4. package/lib/addresses.js +2 -2
  5. package/lib/admin.js +49 -45
  6. package/lib/affiliates.js +7 -23
  7. package/lib/announcement-bar.js +5 -22
  8. package/lib/api-keys.js +4 -13
  9. package/lib/asset-manifest.json +1 -1
  10. package/lib/banner-ab-tests.js +5 -9
  11. package/lib/blog-articles.js +8 -26
  12. package/lib/captcha-gate.js +7 -17
  13. package/lib/carrier-accounts.js +3 -10
  14. package/lib/catalog-drafts.js +5 -12
  15. package/lib/category-navigation.js +4 -20
  16. package/lib/cms-blocks.js +4 -7
  17. package/lib/compliance-export.js +4 -11
  18. package/lib/consent-ledger.js +2 -4
  19. package/lib/cost-layers.js +56 -21
  20. package/lib/customer-import.js +2 -2
  21. package/lib/customer-notes.js +7 -23
  22. package/lib/customer-roles.js +3 -5
  23. package/lib/customer-segments.js +17 -14
  24. package/lib/customer-surveys.js +7 -14
  25. package/lib/customers.js +2 -4
  26. package/lib/dispute-resolution.js +5 -13
  27. package/lib/dropship-forwarding.js +3 -5
  28. package/lib/dunning.js +2 -7
  29. package/lib/email-ab-tests.js +4 -8
  30. package/lib/email-campaigns.js +25 -14
  31. package/lib/email-warmup.js +2 -7
  32. package/lib/experiments.js +6 -10
  33. package/lib/externaldb-d1.js +78 -44
  34. package/lib/geolocation.js +18 -28
  35. package/lib/gift-options.js +5 -23
  36. package/lib/knowledge-base.js +7 -22
  37. package/lib/line-gift-wrap.js +3 -17
  38. package/lib/live-chat.js +5 -18
  39. package/lib/metered-usage.js +3 -8
  40. package/lib/notifications.js +3 -7
  41. package/lib/operator-accounts.js +3 -5
  42. package/lib/operator-approvals.js +6 -8
  43. package/lib/operator-audit-log.js +2 -7
  44. package/lib/operator-help-center.js +5 -21
  45. package/lib/operator-inbox.js +4 -11
  46. package/lib/operator-roles.js +5 -7
  47. package/lib/order-escalation.js +2 -2
  48. package/lib/order-export.js +24 -20
  49. package/lib/order-notes.js +4 -14
  50. package/lib/order-ratings.js +4 -10
  51. package/lib/payment-methods.js +5 -13
  52. package/lib/payment-retries.js +2 -7
  53. package/lib/payment.js +103 -58
  54. package/lib/pixel-events.js +8 -23
  55. package/lib/plan-changes.js +2 -7
  56. package/lib/product-qa.js +4 -8
  57. package/lib/promo-banners.js +7 -15
  58. package/lib/purchase-orders.js +3 -6
  59. package/lib/push-notifications.js +7 -32
  60. package/lib/pwa-manifest.js +6 -11
  61. package/lib/quotes.js +5 -9
  62. package/lib/referrals.js +10 -6
  63. package/lib/reviews.js +4 -10
  64. package/lib/robots-config.js +6 -14
  65. package/lib/sales-tax-filings.js +2 -2
  66. package/lib/search-facets.js +5 -5
  67. package/lib/search-ranking.js +4 -7
  68. package/lib/search-synonyms.js +7 -21
  69. package/lib/security-middleware.js +125 -70
  70. package/lib/seller-signup.js +10 -26
  71. package/lib/sidebar-widgets.js +6 -15
  72. package/lib/site-redirects.js +49 -137
  73. package/lib/sitemap-generator.js +3 -7
  74. package/lib/sms-dispatcher.js +7 -23
  75. package/lib/stock-receipts.js +4 -10
  76. package/lib/storefront-dashboards.js +2 -10
  77. package/lib/storefront-forms.js +9 -22
  78. package/lib/storefront-pages.js +6 -20
  79. package/lib/storefront.js +21 -23
  80. package/lib/subscription-billing.js +3 -8
  81. package/lib/subscription-controls.js +2 -7
  82. package/lib/suggestion-box.js +9 -26
  83. package/lib/support-tickets.js +6 -24
  84. package/lib/tax-remittance.js +2 -2
  85. package/lib/tenants.js +2 -7
  86. package/lib/text-guard.js +137 -35
  87. package/lib/theme-assets.js +4 -16
  88. package/lib/translations.js +3 -6
  89. package/lib/trust-badges.js +4 -7
  90. package/lib/vendor/MANIFEST.json +107 -97
  91. package/lib/vendor/blamejs/CHANGELOG.md +180 -0
  92. package/lib/vendor/blamejs/NOTICE +14 -10
  93. package/lib/vendor/blamejs/README.md +17 -5
  94. package/lib/vendor/blamejs/index.js +2 -0
  95. package/lib/vendor/blamejs/lib/acme.js +9 -9
  96. package/lib/vendor/blamejs/lib/api-snapshot.js +35 -16
  97. package/lib/vendor/blamejs/lib/app-shutdown.js +1 -1
  98. package/lib/vendor/blamejs/lib/archive-adapters.js +1 -1
  99. package/lib/vendor/blamejs/lib/archive.js +13 -24
  100. package/lib/vendor/blamejs/lib/auth/access-lock.js +2 -1
  101. package/lib/vendor/blamejs/lib/auth/bot-challenge.js +3 -6
  102. package/lib/vendor/blamejs/lib/auth/ciba.js +32 -3
  103. package/lib/vendor/blamejs/lib/auth/oauth.js +65 -8
  104. package/lib/vendor/blamejs/lib/auth/password.js +1 -1
  105. package/lib/vendor/blamejs/lib/auth/saml.js +21 -3
  106. package/lib/vendor/blamejs/lib/auth-bot-challenge.js +3 -3
  107. package/lib/vendor/blamejs/lib/backup/index.js +5 -5
  108. package/lib/vendor/blamejs/lib/case-fold-classes.js +491 -0
  109. package/lib/vendor/blamejs/lib/codepoint-class.js +131 -0
  110. package/lib/vendor/blamejs/lib/constants.js +79 -0
  111. package/lib/vendor/blamejs/lib/db-declare-view.js +8 -2
  112. package/lib/vendor/blamejs/lib/error-page.js +20 -1
  113. package/lib/vendor/blamejs/lib/external-db.js +5 -1
  114. package/lib/vendor/blamejs/lib/flag-evaluation-context.js +24 -6
  115. package/lib/vendor/blamejs/lib/flag.js +28 -2
  116. package/lib/vendor/blamejs/lib/framework-schema.js +14 -3
  117. package/lib/vendor/blamejs/lib/guard-regex.js +2345 -89
  118. package/lib/vendor/blamejs/lib/http-client.js +217 -40
  119. package/lib/vendor/blamejs/lib/mail-bimi.js +1 -1
  120. package/lib/vendor/blamejs/lib/mail-crypto-pgp.js +3 -2
  121. package/lib/vendor/blamejs/lib/mail-dav.js +26 -26
  122. package/lib/vendor/blamejs/lib/mail-deploy.js +10 -10
  123. package/lib/vendor/blamejs/lib/mail-scan.js +3 -0
  124. package/lib/vendor/blamejs/lib/mail-store.js +7 -1
  125. package/lib/vendor/blamejs/lib/mail.js +5 -1
  126. package/lib/vendor/blamejs/lib/middleware/age-gate.js +3 -2
  127. package/lib/vendor/blamejs/lib/middleware/api-encrypt.js +1 -1
  128. package/lib/vendor/blamejs/lib/middleware/assetlinks.js +2 -1
  129. package/lib/vendor/blamejs/lib/middleware/asyncapi-serve.js +3 -2
  130. package/lib/vendor/blamejs/lib/middleware/bearer-auth.js +2 -1
  131. package/lib/vendor/blamejs/lib/middleware/compression.js +1 -1
  132. package/lib/vendor/blamejs/lib/middleware/cors.js +1 -1
  133. package/lib/vendor/blamejs/lib/middleware/csp-report.js +5 -5
  134. package/lib/vendor/blamejs/lib/middleware/csrf-protect.js +2 -1
  135. package/lib/vendor/blamejs/lib/middleware/daily-byte-quota.js +2 -2
  136. package/lib/vendor/blamejs/lib/middleware/deny-response.js +2 -1
  137. package/lib/vendor/blamejs/lib/middleware/dpop.js +2 -2
  138. package/lib/vendor/blamejs/lib/middleware/fetch-metadata.js +2 -1
  139. package/lib/vendor/blamejs/lib/middleware/flag-context.js +17 -0
  140. package/lib/vendor/blamejs/lib/middleware/idempotency-key.js +10 -8
  141. package/lib/vendor/blamejs/lib/middleware/openapi-serve.js +3 -2
  142. package/lib/vendor/blamejs/lib/middleware/require-aal.js +3 -2
  143. package/lib/vendor/blamejs/lib/middleware/require-auth.js +4 -3
  144. package/lib/vendor/blamejs/lib/middleware/require-bound-key.js +4 -3
  145. package/lib/vendor/blamejs/lib/middleware/require-content-type.js +3 -2
  146. package/lib/vendor/blamejs/lib/middleware/require-methods.js +3 -2
  147. package/lib/vendor/blamejs/lib/middleware/require-mtls.js +3 -2
  148. package/lib/vendor/blamejs/lib/middleware/security-txt.js +2 -1
  149. package/lib/vendor/blamejs/lib/middleware/web-app-manifest.js +2 -1
  150. package/lib/vendor/blamejs/lib/network-dns-resolver.js +1 -1
  151. package/lib/vendor/blamejs/lib/network-dns.js +3 -3
  152. package/lib/vendor/blamejs/lib/network-nts.js +35 -14
  153. package/lib/vendor/blamejs/lib/network-proxy.js +42 -4
  154. package/lib/vendor/blamejs/lib/network-smtp-policy.js +1 -1
  155. package/lib/vendor/blamejs/lib/network-tls.js +341 -11
  156. package/lib/vendor/blamejs/lib/nist-crosswalk.js +2 -2
  157. package/lib/vendor/blamejs/lib/ntp-check.js +30 -19
  158. package/lib/vendor/blamejs/lib/object-store/azure-blob.js +1 -1
  159. package/lib/vendor/blamejs/lib/object-store/gcs.js +1 -1
  160. package/lib/vendor/blamejs/lib/object-store/http-put.js +2 -1
  161. package/lib/vendor/blamejs/lib/object-store/sigv4-bucket-ops.js +5 -5
  162. package/lib/vendor/blamejs/lib/object-store/sigv4.js +2 -2
  163. package/lib/vendor/blamejs/lib/observability-otlp-exporter.js +4 -2
  164. package/lib/vendor/blamejs/lib/openapi.js +1 -1
  165. package/lib/vendor/blamejs/lib/pqc-agent.js +4 -7
  166. package/lib/vendor/blamejs/lib/problem-details.js +2 -1
  167. package/lib/vendor/blamejs/lib/redis-client.js +12 -1
  168. package/lib/vendor/blamejs/lib/regex-linear.js +1349 -0
  169. package/lib/vendor/blamejs/lib/render.js +531 -7
  170. package/lib/vendor/blamejs/lib/request-helpers.js +181 -5
  171. package/lib/vendor/blamejs/lib/router.js +37 -13
  172. package/lib/vendor/blamejs/lib/safe-async.js +142 -0
  173. package/lib/vendor/blamejs/lib/safe-icap.js +3 -0
  174. package/lib/vendor/blamejs/lib/safe-sql.js +15 -3
  175. package/lib/vendor/blamejs/lib/self-update.js +2 -2
  176. package/lib/vendor/blamejs/lib/testing.js +54 -7
  177. package/lib/vendor/blamejs/lib/validate-opts.js +56 -0
  178. package/lib/vendor/blamejs/lib/vendor/MANIFEST.json +62 -25
  179. package/lib/vendor/blamejs/lib/vendor/blamejs-pki.cjs +2004 -142
  180. package/lib/vendor/blamejs/lib/vendor/browser/noble-ciphers.mjs +727 -0
  181. package/lib/vendor/blamejs/lib/vendor/browser/noble-hashes.mjs +1070 -0
  182. package/lib/vendor/blamejs/lib/vendor/browser/noble-post-quantum.mjs +1090 -0
  183. package/lib/vendor/blamejs/lib/vendor/noble-post-quantum.cjs +510 -227
  184. package/lib/vendor/blamejs/lib/webhook-hmac.js +19 -2
  185. package/lib/vendor/blamejs/lib/webhook.js +1 -1
  186. package/lib/vendor/blamejs/lib/ws-client.js +24 -2
  187. package/lib/vendor/blamejs/package.json +1 -1
  188. package/lib/vendor/blamejs/sbom.cdx.json +6 -6
  189. package/lib/vendor-invoices.js +3 -6
  190. package/lib/vendors.js +5 -19
  191. package/lib/webhook-receiver.js +46 -83
  192. package/lib/webhook-subscriptions.js +3 -13
  193. package/lib/wishlist-sharing.js +5 -10
  194. package/package.json +1 -1
@@ -0,0 +1,491 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (c) blamejs contributors
3
+ "use strict";
4
+ // GENERATED by scripts/gen-case-fold-classes.js — do not edit by hand.
5
+ //
6
+ // Characters that a regular expression treats as the same under `i` but that
7
+ // upper- and lower-casing does not lead from one to the other: a micro sign
8
+ // and a Greek mu, a final sigma and an ordinary one, the title-case digraphs,
9
+ // and — under `u` only — a Kelvin sign and a `k`, a long s and an `s`.
10
+ //
11
+ // Every other equal pair is found by casing and is not listed. Keyed by code
12
+ // point, giving the partners that casing alone would miss.
13
+
14
+ var PLAIN = {
15
+ 452: [453],
16
+ 454: [453],
17
+ 455: [456],
18
+ 457: [456],
19
+ 458: [459],
20
+ 460: [459],
21
+ 497: [498],
22
+ 499: [498],
23
+ 837: [8126],
24
+ 914: [976],
25
+ 917: [1013],
26
+ 920: [977],
27
+ 921: [837, 8126],
28
+ 922: [1008],
29
+ 924: [181],
30
+ 928: [982],
31
+ 929: [1009],
32
+ 931: [962],
33
+ 934: [981],
34
+ 946: [976],
35
+ 949: [1013],
36
+ 952: [977],
37
+ 953: [837, 8126],
38
+ 954: [1008],
39
+ 956: [181],
40
+ 960: [982],
41
+ 961: [1009],
42
+ 963: [962],
43
+ 966: [981],
44
+ 1042: [7296],
45
+ 1044: [7297],
46
+ 1054: [7298],
47
+ 1057: [7299],
48
+ 1058: [7300, 7301],
49
+ 1066: [7302],
50
+ 1074: [7296],
51
+ 1076: [7297],
52
+ 1086: [7298],
53
+ 1089: [7299],
54
+ 1090: [7300, 7301],
55
+ 1098: [7302],
56
+ 1122: [7303],
57
+ 1123: [7303],
58
+ 7300: [7301],
59
+ 7301: [7300],
60
+ 7776: [7835],
61
+ 7777: [7835],
62
+ 8126: [837],
63
+ 42570: [7304],
64
+ 42571: [7304],
65
+ };
66
+
67
+ var UNICODE = {
68
+ 75: [8490],
69
+ 83: [383],
70
+ 107: [8490],
71
+ 115: [383],
72
+ 197: [8491],
73
+ 223: [7838],
74
+ 229: [8491],
75
+ 452: [453],
76
+ 454: [453],
77
+ 455: [456],
78
+ 457: [456],
79
+ 458: [459],
80
+ 460: [459],
81
+ 497: [498],
82
+ 499: [498],
83
+ 837: [8126],
84
+ 912: [8147],
85
+ 914: [976],
86
+ 917: [1013],
87
+ 920: [977, 1012],
88
+ 921: [837, 8126],
89
+ 922: [1008],
90
+ 924: [181],
91
+ 928: [982],
92
+ 929: [1009],
93
+ 931: [962],
94
+ 934: [981],
95
+ 937: [8486],
96
+ 944: [8163],
97
+ 946: [976],
98
+ 949: [1013],
99
+ 952: [977, 1012],
100
+ 953: [837, 8126],
101
+ 954: [1008],
102
+ 956: [181],
103
+ 960: [982],
104
+ 961: [1009],
105
+ 963: [962],
106
+ 966: [981],
107
+ 969: [8486],
108
+ 977: [1012],
109
+ 1012: [920, 977],
110
+ 1042: [7296],
111
+ 1044: [7297],
112
+ 1054: [7298],
113
+ 1057: [7299],
114
+ 1058: [7300, 7301],
115
+ 1066: [7302],
116
+ 1074: [7296],
117
+ 1076: [7297],
118
+ 1086: [7298],
119
+ 1089: [7299],
120
+ 1090: [7300, 7301],
121
+ 1098: [7302],
122
+ 1122: [7303],
123
+ 1123: [7303],
124
+ 7300: [7301],
125
+ 7301: [7300],
126
+ 7776: [7835],
127
+ 7777: [7835],
128
+ 8064: [8072],
129
+ 8065: [8073],
130
+ 8066: [8074],
131
+ 8067: [8075],
132
+ 8068: [8076],
133
+ 8069: [8077],
134
+ 8070: [8078],
135
+ 8071: [8079],
136
+ 8080: [8088],
137
+ 8081: [8089],
138
+ 8082: [8090],
139
+ 8083: [8091],
140
+ 8084: [8092],
141
+ 8085: [8093],
142
+ 8086: [8094],
143
+ 8087: [8095],
144
+ 8096: [8104],
145
+ 8097: [8105],
146
+ 8098: [8106],
147
+ 8099: [8107],
148
+ 8100: [8108],
149
+ 8101: [8109],
150
+ 8102: [8110],
151
+ 8103: [8111],
152
+ 8115: [8124],
153
+ 8126: [837],
154
+ 8131: [8140],
155
+ 8147: [912],
156
+ 8163: [944],
157
+ 8179: [8188],
158
+ 8486: [937],
159
+ 8490: [75],
160
+ 8491: [197],
161
+ 42570: [7304],
162
+ 42571: [7304],
163
+ 64261: [64262],
164
+ 64262: [64261],
165
+ };
166
+
167
+ // Where folding through upper case lands a character in the wrong company.
168
+ // A dotless i upper-cases to `I`, which lower-cases to `i` — and Unicode
169
+ // still does not call them the same character. These say which company the
170
+ // character actually keeps.
171
+ var PLAIN_CANONICAL = {
172
+ 66600: 66600,
173
+ 66601: 66601,
174
+ 66602: 66602,
175
+ 66603: 66603,
176
+ 66604: 66604,
177
+ 66605: 66605,
178
+ 66606: 66606,
179
+ 66607: 66607,
180
+ 66608: 66608,
181
+ 66609: 66609,
182
+ 66610: 66610,
183
+ 66611: 66611,
184
+ 66612: 66612,
185
+ 66613: 66613,
186
+ 66614: 66614,
187
+ 66615: 66615,
188
+ 66616: 66616,
189
+ 66617: 66617,
190
+ 66618: 66618,
191
+ 66619: 66619,
192
+ 66620: 66620,
193
+ 66621: 66621,
194
+ 66622: 66622,
195
+ 66623: 66623,
196
+ 66624: 66624,
197
+ 66625: 66625,
198
+ 66626: 66626,
199
+ 66627: 66627,
200
+ 66628: 66628,
201
+ 66629: 66629,
202
+ 66630: 66630,
203
+ 66631: 66631,
204
+ 66632: 66632,
205
+ 66633: 66633,
206
+ 66634: 66634,
207
+ 66635: 66635,
208
+ 66636: 66636,
209
+ 66637: 66637,
210
+ 66638: 66638,
211
+ 66639: 66639,
212
+ 66776: 66776,
213
+ 66777: 66777,
214
+ 66778: 66778,
215
+ 66779: 66779,
216
+ 66780: 66780,
217
+ 66781: 66781,
218
+ 66782: 66782,
219
+ 66783: 66783,
220
+ 66784: 66784,
221
+ 66785: 66785,
222
+ 66786: 66786,
223
+ 66787: 66787,
224
+ 66788: 66788,
225
+ 66789: 66789,
226
+ 66790: 66790,
227
+ 66791: 66791,
228
+ 66792: 66792,
229
+ 66793: 66793,
230
+ 66794: 66794,
231
+ 66795: 66795,
232
+ 66796: 66796,
233
+ 66797: 66797,
234
+ 66798: 66798,
235
+ 66799: 66799,
236
+ 66800: 66800,
237
+ 66801: 66801,
238
+ 66802: 66802,
239
+ 66803: 66803,
240
+ 66804: 66804,
241
+ 66805: 66805,
242
+ 66806: 66806,
243
+ 66807: 66807,
244
+ 66808: 66808,
245
+ 66809: 66809,
246
+ 66810: 66810,
247
+ 66811: 66811,
248
+ 66967: 66967,
249
+ 66968: 66968,
250
+ 66969: 66969,
251
+ 66970: 66970,
252
+ 66971: 66971,
253
+ 66972: 66972,
254
+ 66973: 66973,
255
+ 66974: 66974,
256
+ 66975: 66975,
257
+ 66976: 66976,
258
+ 66977: 66977,
259
+ 66979: 66979,
260
+ 66980: 66980,
261
+ 66981: 66981,
262
+ 66982: 66982,
263
+ 66983: 66983,
264
+ 66984: 66984,
265
+ 66985: 66985,
266
+ 66986: 66986,
267
+ 66987: 66987,
268
+ 66988: 66988,
269
+ 66989: 66989,
270
+ 66990: 66990,
271
+ 66991: 66991,
272
+ 66992: 66992,
273
+ 66993: 66993,
274
+ 66995: 66995,
275
+ 66996: 66996,
276
+ 66997: 66997,
277
+ 66998: 66998,
278
+ 66999: 66999,
279
+ 67000: 67000,
280
+ 67001: 67001,
281
+ 67003: 67003,
282
+ 67004: 67004,
283
+ 68800: 68800,
284
+ 68801: 68801,
285
+ 68802: 68802,
286
+ 68803: 68803,
287
+ 68804: 68804,
288
+ 68805: 68805,
289
+ 68806: 68806,
290
+ 68807: 68807,
291
+ 68808: 68808,
292
+ 68809: 68809,
293
+ 68810: 68810,
294
+ 68811: 68811,
295
+ 68812: 68812,
296
+ 68813: 68813,
297
+ 68814: 68814,
298
+ 68815: 68815,
299
+ 68816: 68816,
300
+ 68817: 68817,
301
+ 68818: 68818,
302
+ 68819: 68819,
303
+ 68820: 68820,
304
+ 68821: 68821,
305
+ 68822: 68822,
306
+ 68823: 68823,
307
+ 68824: 68824,
308
+ 68825: 68825,
309
+ 68826: 68826,
310
+ 68827: 68827,
311
+ 68828: 68828,
312
+ 68829: 68829,
313
+ 68830: 68830,
314
+ 68831: 68831,
315
+ 68832: 68832,
316
+ 68833: 68833,
317
+ 68834: 68834,
318
+ 68835: 68835,
319
+ 68836: 68836,
320
+ 68837: 68837,
321
+ 68838: 68838,
322
+ 68839: 68839,
323
+ 68840: 68840,
324
+ 68841: 68841,
325
+ 68842: 68842,
326
+ 68843: 68843,
327
+ 68844: 68844,
328
+ 68845: 68845,
329
+ 68846: 68846,
330
+ 68847: 68847,
331
+ 68848: 68848,
332
+ 68849: 68849,
333
+ 68850: 68850,
334
+ 68976: 68976,
335
+ 68977: 68977,
336
+ 68978: 68978,
337
+ 68979: 68979,
338
+ 68980: 68980,
339
+ 68981: 68981,
340
+ 68982: 68982,
341
+ 68983: 68983,
342
+ 68984: 68984,
343
+ 68985: 68985,
344
+ 68986: 68986,
345
+ 68987: 68987,
346
+ 68988: 68988,
347
+ 68989: 68989,
348
+ 68990: 68990,
349
+ 68991: 68991,
350
+ 68992: 68992,
351
+ 68993: 68993,
352
+ 68994: 68994,
353
+ 68995: 68995,
354
+ 68996: 68996,
355
+ 68997: 68997,
356
+ 71872: 71872,
357
+ 71873: 71873,
358
+ 71874: 71874,
359
+ 71875: 71875,
360
+ 71876: 71876,
361
+ 71877: 71877,
362
+ 71878: 71878,
363
+ 71879: 71879,
364
+ 71880: 71880,
365
+ 71881: 71881,
366
+ 71882: 71882,
367
+ 71883: 71883,
368
+ 71884: 71884,
369
+ 71885: 71885,
370
+ 71886: 71886,
371
+ 71887: 71887,
372
+ 71888: 71888,
373
+ 71889: 71889,
374
+ 71890: 71890,
375
+ 71891: 71891,
376
+ 71892: 71892,
377
+ 71893: 71893,
378
+ 71894: 71894,
379
+ 71895: 71895,
380
+ 71896: 71896,
381
+ 71897: 71897,
382
+ 71898: 71898,
383
+ 71899: 71899,
384
+ 71900: 71900,
385
+ 71901: 71901,
386
+ 71902: 71902,
387
+ 71903: 71903,
388
+ 93792: 93792,
389
+ 93793: 93793,
390
+ 93794: 93794,
391
+ 93795: 93795,
392
+ 93796: 93796,
393
+ 93797: 93797,
394
+ 93798: 93798,
395
+ 93799: 93799,
396
+ 93800: 93800,
397
+ 93801: 93801,
398
+ 93802: 93802,
399
+ 93803: 93803,
400
+ 93804: 93804,
401
+ 93805: 93805,
402
+ 93806: 93806,
403
+ 93807: 93807,
404
+ 93808: 93808,
405
+ 93809: 93809,
406
+ 93810: 93810,
407
+ 93811: 93811,
408
+ 93812: 93812,
409
+ 93813: 93813,
410
+ 93814: 93814,
411
+ 93815: 93815,
412
+ 93816: 93816,
413
+ 93817: 93817,
414
+ 93818: 93818,
415
+ 93819: 93819,
416
+ 93820: 93820,
417
+ 93821: 93821,
418
+ 93822: 93822,
419
+ 93823: 93823,
420
+ 93883: 93883,
421
+ 93884: 93884,
422
+ 93885: 93885,
423
+ 93886: 93886,
424
+ 93887: 93887,
425
+ 93888: 93888,
426
+ 93889: 93889,
427
+ 93890: 93890,
428
+ 93891: 93891,
429
+ 93892: 93892,
430
+ 93893: 93893,
431
+ 93894: 93894,
432
+ 93895: 93895,
433
+ 93896: 93896,
434
+ 93897: 93897,
435
+ 93898: 93898,
436
+ 93899: 93899,
437
+ 93900: 93900,
438
+ 93901: 93901,
439
+ 93902: 93902,
440
+ 93903: 93903,
441
+ 93904: 93904,
442
+ 93905: 93905,
443
+ 93906: 93906,
444
+ 93907: 93907,
445
+ 125218: 125218,
446
+ 125219: 125219,
447
+ 125220: 125220,
448
+ 125221: 125221,
449
+ 125222: 125222,
450
+ 125223: 125223,
451
+ 125224: 125224,
452
+ 125225: 125225,
453
+ 125226: 125226,
454
+ 125227: 125227,
455
+ 125228: 125228,
456
+ 125229: 125229,
457
+ 125230: 125230,
458
+ 125231: 125231,
459
+ 125232: 125232,
460
+ 125233: 125233,
461
+ 125234: 125234,
462
+ 125235: 125235,
463
+ 125236: 125236,
464
+ 125237: 125237,
465
+ 125238: 125238,
466
+ 125239: 125239,
467
+ 125240: 125240,
468
+ 125241: 125241,
469
+ 125242: 125242,
470
+ 125243: 125243,
471
+ 125244: 125244,
472
+ 125245: 125245,
473
+ 125246: 125246,
474
+ 125247: 125247,
475
+ 125248: 125248,
476
+ 125249: 125249,
477
+ 125250: 125250,
478
+ 125251: 125251,
479
+ };
480
+
481
+ var UNICODE_CANONICAL = {
482
+ 305: 305,
483
+ 8147: 912,
484
+ 8163: 944,
485
+ 64262: 64261,
486
+ };
487
+
488
+ module.exports = {
489
+ PLAIN: PLAIN, UNICODE: UNICODE,
490
+ PLAIN_CANONICAL: PLAIN_CANONICAL, UNICODE_CANONICAL: UNICODE_CANONICAL,
491
+ };
@@ -72,6 +72,8 @@
72
72
  * so you can build a custom free-text screen without re-rolling the regexes.
73
73
  */
74
74
 
75
+ var caseFoldClasses = require("./case-fold-classes");
76
+
75
77
  var HEX_RADIX = 16; // base-16 radix, not byte size
76
78
 
77
79
  /**
@@ -663,7 +665,136 @@ function stripUrlSchemeWhitespace(s) {
663
665
  .replace(URL_C0_SPACE_TRIM_RE, "");
664
666
  }
665
667
 
668
+ /**
669
+ * @primitive b.codepointClass.canonicalizeForCase
670
+ * @signature b.codepointClass.canonicalizeForCase(codePoint, unicode)
671
+ * @since 0.18.19
672
+ * @status stable
673
+ * @related b.regexLinear.compile, b.guardRegex.assertSafe
674
+ *
675
+ * The character a regular-expression engine compares when `i` is in force,
676
+ * given a code point and whether the `u` (or `v`) flag applies.
677
+ *
678
+ * It is not "the upper case" and it is not "the lower case". Without `u` the
679
+ * language folds through upper case, keeps a character whose upper case runs to
680
+ * more than one character, and refuses to fold a non-ASCII character onto an
681
+ * ASCII one — the last of which is why `/k/i` does not match a Kelvin sign, and
682
+ * why converting both characters and comparing gets the wrong answer.
683
+ *
684
+ * Under `u` the rule changes to case FOLDING: the ASCII guard drops, so a long
685
+ * s folds onto an `s`, and an expanding upper case no longer stops the fold —
686
+ * a Greek eta with a iota subscript and its capital form both upper-case to two
687
+ * characters and are still the same character there.
688
+ *
689
+ * Two characters are the same under `i` exactly when this returns the same code
690
+ * point for both.
691
+ *
692
+ * @example
693
+ * var same = b.codepointClass.canonicalizeForCase;
694
+ * same("k".codePointAt(0), false) === same("K".codePointAt(0), false); // → true
695
+ * same("k".codePointAt(0), false) === same(0x212a, false); // → false (Kelvin)
696
+ * same("s".codePointAt(0), true) === same(0x17f, true); // → true (long s, under u)
697
+ */
698
+ function canonicalizeForCase(cp, unicode) {
699
+ var ch = String.fromCodePoint(cp);
700
+ var upper = ch.toUpperCase();
701
+ // Tolerates a table that predates this field, so the generator that WRITES
702
+ // the table can load this module to build it.
703
+ var corrections = (unicode ? caseFoldClasses.UNICODE_CANONICAL
704
+ : caseFoldClasses.PLAIN_CANONICAL) || {};
705
+ var corrected = corrections[cp];
706
+ if (corrected !== undefined) return corrected; // folding lands it wrongly
707
+ if (unicode) {
708
+ // Under `u` the rule is FOLDING, and "the upper case is more than one
709
+ // character" is not part of it. Where the upper case does expand there is
710
+ // nothing to fold through, but the character can still share a simple lower
711
+ // case with its class: a Greek eta with a iota subscript and its capital
712
+ // form both upper-case to two characters and both lower-case to the same
713
+ // one, so stopping at the expansion left them strangers.
714
+ if (_oneCodePoint(upper)) {
715
+ var folded = upper.toLowerCase();
716
+ if (_oneCodePoint(folded)) return folded.codePointAt(0);
717
+ }
718
+ var lowered = ch.toLowerCase();
719
+ return _oneCodePoint(lowered) ? lowered.codePointAt(0) : cp;
720
+ }
721
+ // Without `u` the rule IS upper case, and a character whose upper case runs
722
+ // to more than one keeps itself — which is why `/eta-with-subscript/i` does
723
+ // not match its own capital form although `/…/iu` does. "More than one" is
724
+ // counted in CODE POINTS: counting UTF-16 units would call every astral
725
+ // letter a multi-character mapping and leave Deseret unfolded.
726
+ if (_oneCodePoint(upper) === false) return cp;
727
+ var canon = upper.codePointAt(0);
728
+ if (cp >= 128 && canon < 128) return cp;
729
+ return canon;
730
+ }
731
+
732
+ function _oneCodePoint(s) {
733
+ if (s.length === 1) return true;
734
+ return s.length === 2 && s.codePointAt(0) > 0xFFFF;
735
+ }
736
+
737
+ /**
738
+ * @primitive b.codepointClass.caseFoldPartners
739
+ * @signature b.codepointClass.caseFoldPartners(codePoint, unicode)
740
+ * @since 0.18.19
741
+ * @related b.codepointClass.canonicalizeForCase, b.regexLinear.compile
742
+ *
743
+ * Every OTHER code point a regular expression treats as the same character as
744
+ * this one under `i`, given whether the `u` (or `v`) flag applies.
745
+ *
746
+ * Use it where the characters to compare against are not a list you can walk —
747
+ * matching a character against a class of ranges, say. Where you hold both
748
+ * characters already, `canonicalizeForCase` answers directly and this is not
749
+ * needed.
750
+ *
751
+ * Most partners are the character's own upper and lower forms. Several hundred
752
+ * are not reachable that way — a micro sign and a Greek mu, a final sigma and an
753
+ * ordinary one, the title-case digraphs, under `u` a Kelvin sign and a `k`, the
754
+ * Greek letters carrying a iota subscript beside their capital forms, and two
755
+ * ligatures that share only the "ST" they upper-case to — and those come from a
756
+ * table derived from the running platform's own case mappings rather than
757
+ * transcribed from a Unicode revision.
758
+ *
759
+ * @example
760
+ * var partners = b.codepointClass.caseFoldPartners;
761
+ * partners("σ".codePointAt(0), true); // sigma → includes the final sigma
762
+ * partners("k".codePointAt(0), false); // → [ "K" ] — not the Kelvin sign
763
+ */
764
+ function caseFoldPartners(cp, unicode) {
765
+ var ch = String.fromCodePoint(cp);
766
+ var target = canonicalizeForCase(cp, unicode);
767
+ var out = [];
768
+ var seen = Object.create(null);
769
+ // Casing REACHES more than it equals. A Kelvin sign lower-cases to a `k` and
770
+ // is still not a `k` without the `u` flag, so each candidate has to canonicalize
771
+ // with the character before it counts as the same one.
772
+ function offer(candidate) {
773
+ if (!_oneCodePoint(candidate)) return;
774
+ var other = candidate.codePointAt(0);
775
+ if (other === cp || seen[other]) return;
776
+ if (canonicalizeForCase(other, unicode) !== target) return;
777
+ seen[other] = true;
778
+ out.push(other);
779
+ }
780
+ offer(ch.toLowerCase());
781
+ offer(ch.toUpperCase());
782
+ offer(ch.toUpperCase().toLowerCase());
783
+ var table = unicode ? caseFoldClasses.UNICODE : caseFoldClasses.PLAIN;
784
+ var extra = table[cp];
785
+ if (extra !== undefined) {
786
+ for (var i = 0; i < extra.length; i += 1) {
787
+ if (extra[i] === cp || seen[extra[i]]) continue;
788
+ seen[extra[i]] = true;
789
+ out.push(extra[i]);
790
+ }
791
+ }
792
+ return out;
793
+ }
794
+
666
795
  module.exports = {
796
+ canonicalizeForCase: canonicalizeForCase,
797
+ caseFoldPartners: caseFoldPartners,
667
798
  isForbiddenControlChar: isForbiddenControlChar,
668
799
  firstControlCharOffset: firstControlCharOffset,
669
800
  decodeNumericEntities: decodeNumericEntities,
@@ -63,6 +63,84 @@ var BYTES = Object.freeze({
63
63
  gib: function (n) { _validateBytes("gib", n); return n * 1024 * 1024 * 1024; },
64
64
  });
65
65
 
66
+ // ---- HTTP status codes ----
67
+ //
68
+ // The registry, named, so a response class is written as what it means rather
69
+ // than as a number a reader has to recognise. Every code RFC 9110 defines, plus
70
+ // the registered ones from the RFCs that extend it (WebDAV 207/208/422-424,
71
+ // early hints 103, 418, 425, 428/429/431 and 451, and 511) — an operator
72
+ // reading a status here should find it whatever RFC put it there.
73
+ //
74
+ // The predicates carry the reasoning the numbers do not. Which statuses may
75
+ // carry a body is a rule stated across RFC 9110 §6.4.1 and §15, and getting it
76
+ // wrong is not cosmetic: destroying a bodiless response to signal a truncation
77
+ // throws away a response that was already complete.
78
+ var STATUS = Object.freeze({
79
+ CONTINUE: 100, SWITCHING_PROTOCOLS: 101, PROCESSING: 102, EARLY_HINTS: 103,
80
+
81
+ OK: 200, CREATED: 201, ACCEPTED: 202, NON_AUTHORITATIVE_INFORMATION: 203,
82
+ NO_CONTENT: 204, RESET_CONTENT: 205, PARTIAL_CONTENT: 206, MULTI_STATUS: 207,
83
+ ALREADY_REPORTED: 208, IM_USED: 226,
84
+
85
+ MULTIPLE_CHOICES: 300, MOVED_PERMANENTLY: 301, FOUND: 302, SEE_OTHER: 303,
86
+ NOT_MODIFIED: 304, USE_PROXY: 305, TEMPORARY_REDIRECT: 307,
87
+ PERMANENT_REDIRECT: 308,
88
+
89
+ BAD_REQUEST: 400, UNAUTHORIZED: 401, PAYMENT_REQUIRED: 402, FORBIDDEN: 403,
90
+ NOT_FOUND: 404, METHOD_NOT_ALLOWED: 405, NOT_ACCEPTABLE: 406,
91
+ PROXY_AUTHENTICATION_REQUIRED: 407, REQUEST_TIMEOUT: 408, CONFLICT: 409,
92
+ GONE: 410, LENGTH_REQUIRED: 411, PRECONDITION_FAILED: 412,
93
+ CONTENT_TOO_LARGE: 413, URI_TOO_LONG: 414, UNSUPPORTED_MEDIA_TYPE: 415,
94
+ RANGE_NOT_SATISFIABLE: 416, EXPECTATION_FAILED: 417, IM_A_TEAPOT: 418,
95
+ MISDIRECTED_REQUEST: 421, UNPROCESSABLE_CONTENT: 422, LOCKED: 423,
96
+ FAILED_DEPENDENCY: 424, TOO_EARLY: 425, UPGRADE_REQUIRED: 426,
97
+ PRECONDITION_REQUIRED: 428, TOO_MANY_REQUESTS: 429,
98
+ REQUEST_HEADER_FIELDS_TOO_LARGE: 431, UNAVAILABLE_FOR_LEGAL_REASONS: 451,
99
+
100
+ INTERNAL_SERVER_ERROR: 500, NOT_IMPLEMENTED: 501, BAD_GATEWAY: 502,
101
+ SERVICE_UNAVAILABLE: 503, GATEWAY_TIMEOUT: 504,
102
+ HTTP_VERSION_NOT_SUPPORTED: 505, VARIANT_ALSO_NEGOTIATES: 506,
103
+ INSUFFICIENT_STORAGE: 507, LOOP_DETECTED: 508, NOT_EXTENDED: 510,
104
+ NETWORK_AUTHENTICATION_REQUIRED: 511,
105
+ });
106
+
107
+ // A fraction is not a status even when it lands inside a band: `200.5` is not a
108
+ // success, and saying it is lets a number arrived at by arithmetic or read from
109
+ // configuration pass here and be refused later by the socket, with the handler
110
+ // already run.
111
+ //
112
+ // Being OUTSIDE 100-599 is answered rather than refused, because callers reach
113
+ // these with a status they did not choose. `b.webhook` reports on a delivery
114
+ // whose transport failed with `statusCode` defaulted to 0 and asks whether that
115
+ // was a success; the truthful answer is no, and throwing there would turn a
116
+ // failed delivery into a crash.
117
+ function _validateStatus(name, n) {
118
+ if (typeof n !== "number" || !isFinite(n) || Math.floor(n) !== n) {
119
+ throw new TypeError("C.HTTP." + name + ": status must be a whole number, got " +
120
+ (typeof n) + " " + JSON.stringify(n));
121
+ }
122
+ }
123
+
124
+ var HTTP = Object.freeze({
125
+ STATUS: STATUS,
126
+
127
+ informational: function (n) { _validateStatus("informational", n); return n >= 100 && n < 200; },
128
+ success: function (n) { _validateStatus("success", n); return n >= 200 && n < 300; },
129
+ redirect: function (n) { _validateStatus("redirect", n); return n >= 300 && n < 400; },
130
+ clientError: function (n) { _validateStatus("clientError", n); return n >= 400 && n < 500; },
131
+ serverError: function (n) { _validateStatus("serverError", n); return n >= 500 && n < 600; },
132
+
133
+ // Carries no body, whatever the handler writes: every 1xx, and 204, 205 and
134
+ // 304. RFC 9110 §15.3.5 / §15.3.6 / §15.4.5. A response to HEAD is bodiless
135
+ // too, but that is a property of the request rather than the status, so the
136
+ // caller answers for it.
137
+ bodiless: function (n) {
138
+ _validateStatus("bodiless", n);
139
+ return (n >= 100 && n < 200) || n === STATUS.NO_CONTENT ||
140
+ n === STATUS.RESET_CONTENT || n === STATUS.NOT_MODIFIED;
141
+ },
142
+ });
143
+
66
144
  // ---- Crypto envelope versioning ----
67
145
  // Every encrypted blob starts with a 4-byte header that identifies the
68
146
  // algorithms used. This enables algorithm agility — any component can
@@ -266,6 +344,7 @@ module.exports = {
266
344
  version: pkg.version,
267
345
  TIME: TIME,
268
346
  BYTES: BYTES,
347
+ HTTP: HTTP,
269
348
  ENVELOPE_MAGIC: ENVELOPE_MAGIC,
270
349
  ENVELOPE_FIXED_INFO_LABEL: ENVELOPE_FIXED_INFO_LABEL,
271
350
  CREDENTIAL_MAGIC: CREDENTIAL_MAGIC,