@stackframe/stack-shared 2.8.7 → 2.8.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/CHANGELOG.md +10 -0
- package/dist/config/format.d.cts +39 -0
- package/dist/config/format.d.ts +14 -13
- package/dist/config/format.js +147 -206
- package/dist/config/format.js.map +1 -0
- package/dist/config/schema.d.cts +724 -0
- package/dist/config/schema.d.ts +51 -48
- package/dist/config/schema.js +230 -172
- package/dist/config/schema.js.map +1 -0
- package/dist/crud.d.cts +102 -0
- package/dist/crud.d.ts +15 -13
- package/dist/crud.js +83 -128
- package/dist/crud.js.map +1 -0
- package/dist/esm/config/format.js +135 -0
- package/dist/esm/config/format.js.map +1 -0
- package/dist/esm/config/schema.js +199 -0
- package/dist/esm/config/schema.js.map +1 -0
- package/dist/esm/crud.js +60 -0
- package/dist/esm/crud.js.map +1 -0
- package/dist/esm/global.d.js +1 -0
- package/dist/esm/global.d.js.map +1 -0
- package/dist/esm/helpers/password.js +17 -0
- package/dist/esm/helpers/password.js.map +1 -0
- package/dist/esm/helpers/production-mode.js +50 -0
- package/dist/esm/helpers/production-mode.js.map +1 -0
- package/dist/esm/hooks/use-async-callback.js +38 -0
- package/dist/esm/hooks/use-async-callback.js.map +1 -0
- package/dist/esm/hooks/use-async-external-store.js +23 -0
- package/dist/esm/hooks/use-async-external-store.js.map +1 -0
- package/dist/esm/hooks/use-hash.js +17 -0
- package/dist/esm/hooks/use-hash.js.map +1 -0
- package/dist/esm/hooks/use-strict-memo.js +61 -0
- package/dist/esm/hooks/use-strict-memo.js.map +1 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interface/adminInterface.js +244 -0
- package/dist/esm/interface/adminInterface.js.map +1 -0
- package/dist/esm/interface/clientInterface.js +2041 -0
- package/dist/esm/interface/clientInterface.js.map +1 -0
- package/dist/esm/interface/crud/contact-channels.js +77 -0
- package/dist/esm/interface/crud/contact-channels.js.map +1 -0
- package/dist/esm/interface/crud/current-user.js +65 -0
- package/dist/esm/interface/crud/current-user.js.map +1 -0
- package/dist/esm/interface/crud/email-templates.js +52 -0
- package/dist/esm/interface/crud/email-templates.js.map +1 -0
- package/dist/esm/interface/crud/emails.js +20 -0
- package/dist/esm/interface/crud/emails.js.map +1 -0
- package/dist/esm/interface/crud/internal-api-keys.js +69 -0
- package/dist/esm/interface/crud/internal-api-keys.js.map +1 -0
- package/dist/esm/interface/crud/oauth.js +24 -0
- package/dist/esm/interface/crud/oauth.js.map +1 -0
- package/dist/esm/interface/crud/project-api-keys.js +93 -0
- package/dist/esm/interface/crud/project-api-keys.js.map +1 -0
- package/dist/esm/interface/crud/project-permissions.js +113 -0
- package/dist/esm/interface/crud/project-permissions.js.map +1 -0
- package/dist/esm/interface/crud/projects.js +188 -0
- package/dist/esm/interface/crud/projects.js.map +1 -0
- package/dist/esm/interface/crud/sessions.js +62 -0
- package/dist/esm/interface/crud/sessions.js.map +1 -0
- package/dist/esm/interface/crud/svix-token.js +22 -0
- package/dist/esm/interface/crud/svix-token.js.map +1 -0
- package/dist/esm/interface/crud/team-invitation-details.js +23 -0
- package/dist/esm/interface/crud/team-invitation-details.js.map +1 -0
- package/dist/esm/interface/crud/team-invitation.js +36 -0
- package/dist/esm/interface/crud/team-invitation.js.map +1 -0
- package/dist/esm/interface/crud/team-member-profiles.js +62 -0
- package/dist/esm/interface/crud/team-member-profiles.js.map +1 -0
- package/dist/esm/interface/crud/team-memberships.js +60 -0
- package/dist/esm/interface/crud/team-memberships.js.map +1 -0
- package/dist/esm/interface/crud/team-permissions.js +114 -0
- package/dist/esm/interface/crud/team-permissions.js.map +1 -0
- package/dist/esm/interface/crud/teams.js +143 -0
- package/dist/esm/interface/crud/teams.js.map +1 -0
- package/dist/esm/interface/crud/users.js +139 -0
- package/dist/esm/interface/crud/users.js.map +1 -0
- package/dist/esm/interface/serverInterface.js +485 -0
- package/dist/esm/interface/serverInterface.js.map +1 -0
- package/dist/esm/interface/webhooks.js +21 -0
- package/dist/esm/interface/webhooks.js.map +1 -0
- package/dist/esm/known-errors.js +1223 -0
- package/dist/esm/known-errors.js.map +1 -0
- package/dist/esm/schema-fields.js +484 -0
- package/dist/esm/schema-fields.js.map +1 -0
- package/dist/esm/sessions.js +168 -0
- package/dist/esm/sessions.js.map +1 -0
- package/dist/esm/utils/api-keys.js +79 -0
- package/dist/esm/utils/api-keys.js.map +1 -0
- package/dist/esm/utils/arrays.js +78 -0
- package/dist/esm/utils/arrays.js.map +1 -0
- package/dist/esm/utils/base64.js +18 -0
- package/dist/esm/utils/base64.js.map +1 -0
- package/dist/esm/utils/booleans.js +12 -0
- package/dist/esm/utils/booleans.js.map +1 -0
- package/dist/esm/utils/browser-compat.js +21 -0
- package/dist/esm/utils/browser-compat.js.map +1 -0
- package/dist/esm/utils/bytes.js +160 -0
- package/dist/esm/utils/bytes.js.map +1 -0
- package/dist/esm/utils/caches.js +167 -0
- package/dist/esm/utils/caches.js.map +1 -0
- package/dist/esm/utils/compile-time.js +11 -0
- package/dist/esm/utils/compile-time.js.map +1 -0
- package/dist/esm/utils/crypto.js +25 -0
- package/dist/esm/utils/crypto.js.map +1 -0
- package/dist/esm/utils/dates.js +64 -0
- package/dist/esm/utils/dates.js.map +1 -0
- package/dist/esm/utils/dom.js +11 -0
- package/dist/esm/utils/dom.js.map +1 -0
- package/dist/esm/utils/env.js +58 -0
- package/dist/esm/utils/env.js.map +1 -0
- package/dist/esm/utils/errors.js +174 -0
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/esm/utils/fs.js +37 -0
- package/dist/esm/utils/fs.js.map +1 -0
- package/dist/esm/utils/functions.js +12 -0
- package/dist/esm/utils/functions.js.map +1 -0
- package/dist/esm/utils/geo.js +15 -0
- package/dist/esm/utils/geo.js.map +1 -0
- package/dist/esm/utils/globals.js +18 -0
- package/dist/esm/utils/globals.js.map +1 -0
- package/dist/esm/utils/hashes.js +55 -0
- package/dist/esm/utils/hashes.js.map +1 -0
- package/dist/esm/utils/html.js +13 -0
- package/dist/esm/utils/html.js.map +1 -0
- package/dist/esm/utils/http.js +60 -0
- package/dist/esm/utils/http.js.map +1 -0
- package/dist/esm/utils/ips.js +15 -0
- package/dist/esm/utils/ips.js.map +1 -0
- package/dist/esm/utils/json.js +31 -0
- package/dist/esm/utils/json.js.map +1 -0
- package/dist/esm/utils/jwt.js +87 -0
- package/dist/esm/utils/jwt.js.map +1 -0
- package/dist/esm/utils/locks.js +57 -0
- package/dist/esm/utils/locks.js.map +1 -0
- package/dist/esm/utils/maps.js +181 -0
- package/dist/esm/utils/maps.js.map +1 -0
- package/dist/esm/utils/math.js +8 -0
- package/dist/esm/utils/math.js.map +1 -0
- package/dist/esm/utils/node-http.js +42 -0
- package/dist/esm/utils/node-http.js.map +1 -0
- package/dist/esm/utils/numbers.js +32 -0
- package/dist/esm/utils/numbers.js.map +1 -0
- package/dist/esm/utils/oauth.js +10 -0
- package/dist/esm/utils/oauth.js.map +1 -0
- package/dist/esm/utils/objects.js +153 -0
- package/dist/esm/utils/objects.js.map +1 -0
- package/dist/esm/utils/passkey.js +1 -0
- package/dist/esm/utils/passkey.js.map +1 -0
- package/dist/esm/utils/promises.js +233 -0
- package/dist/esm/utils/promises.js.map +1 -0
- package/dist/esm/utils/proxies.js +128 -0
- package/dist/esm/utils/proxies.js.map +1 -0
- package/dist/esm/utils/react.js +78 -0
- package/dist/esm/utils/react.js.map +1 -0
- package/dist/esm/utils/results.js +141 -0
- package/dist/esm/utils/results.js.map +1 -0
- package/dist/esm/utils/sentry.js +20 -0
- package/dist/esm/utils/sentry.js.map +1 -0
- package/dist/esm/utils/stores.js +195 -0
- package/dist/esm/utils/stores.js.map +1 -0
- package/dist/esm/utils/strings.js +294 -0
- package/dist/esm/utils/strings.js.map +1 -0
- package/dist/esm/utils/strings.nicify.test.js +222 -0
- package/dist/esm/utils/strings.nicify.test.js.map +1 -0
- package/dist/esm/utils/types.js +1 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/utils/unicode.js +11 -0
- package/dist/esm/utils/unicode.js.map +1 -0
- package/dist/esm/utils/urls.js +53 -0
- package/dist/esm/utils/urls.js.map +1 -0
- package/dist/esm/utils/uuids.js +16 -0
- package/dist/esm/utils/uuids.js.map +1 -0
- package/dist/global.d.d.cts +1 -0
- package/dist/global.d.d.ts +1 -0
- package/dist/global.d.js +2 -0
- package/dist/global.d.js.map +1 -0
- package/dist/helpers/password.d.cts +11 -0
- package/dist/helpers/password.d.ts +11 -2
- package/dist/helpers/password.js +41 -11
- package/dist/helpers/password.js.map +1 -0
- package/dist/helpers/production-mode.d.cts +12 -0
- package/dist/helpers/production-mode.d.ts +9 -3
- package/dist/helpers/production-mode.js +72 -45
- package/dist/helpers/production-mode.js.map +1 -0
- package/dist/hooks/use-async-callback.d.cts +6 -0
- package/dist/hooks/use-async-callback.d.ts +6 -3
- package/dist/hooks/use-async-callback.js +72 -30
- package/dist/hooks/use-async-callback.js.map +1 -0
- package/dist/hooks/use-async-external-store.d.cts +7 -0
- package/dist/hooks/use-async-external-store.d.ts +5 -2
- package/dist/hooks/use-async-external-store.js +47 -19
- package/dist/hooks/use-async-external-store.js.map +1 -0
- package/dist/hooks/use-hash.d.cts +3 -0
- package/dist/hooks/use-hash.d.ts +3 -1
- package/dist/hooks/use-hash.js +41 -8
- package/dist/hooks/use-hash.js.map +1 -0
- package/dist/hooks/use-strict-memo.d.cts +8 -0
- package/dist/hooks/use-strict-memo.d.ts +3 -1
- package/dist/hooks/use-strict-memo.js +78 -131
- package/dist/hooks/use-strict-memo.js.map +1 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.js +42 -4
- package/dist/index.js.map +1 -0
- package/dist/interface/adminInterface.d.cts +94 -0
- package/dist/interface/adminInterface.d.ts +38 -15
- package/dist/interface/adminInterface.js +269 -174
- package/dist/interface/adminInterface.js.map +1 -0
- package/dist/interface/clientInterface.d.cts +260 -0
- package/dist/interface/clientInterface.d.ts +25 -18
- package/dist/interface/clientInterface.js +2054 -995
- package/dist/interface/clientInterface.js.map +1 -0
- package/dist/interface/crud/contact-channels.d.cts +180 -0
- package/dist/interface/crud/contact-channels.d.ts +30 -25
- package/dist/interface/crud/contact-channels.js +101 -59
- package/dist/interface/crud/contact-channels.js.map +1 -0
- package/dist/interface/crud/current-user.d.cts +205 -0
- package/dist/interface/crud/current-user.d.ts +17 -12
- package/dist/interface/crud/current-user.js +86 -56
- package/dist/interface/crud/current-user.js.map +1 -0
- package/dist/interface/crud/email-templates.d.cts +84 -0
- package/dist/interface/crud/email-templates.d.ts +24 -19
- package/dist/interface/crud/email-templates.js +77 -37
- package/dist/interface/crud/email-templates.js.map +1 -0
- package/dist/interface/crud/emails.d.cts +69 -0
- package/dist/interface/crud/emails.d.ts +12 -7
- package/dist/interface/crud/emails.js +54 -12
- package/dist/interface/crud/emails.js.map +1 -0
- package/dist/interface/crud/internal-api-keys.d.cts +139 -0
- package/dist/interface/crud/internal-api-keys.d.ts +22 -17
- package/dist/interface/crud/internal-api-keys.js +92 -54
- package/dist/interface/crud/internal-api-keys.js.map +1 -0
- package/dist/interface/crud/oauth.d.cts +34 -0
- package/dist/interface/crud/oauth.d.ts +16 -11
- package/dist/interface/crud/oauth.js +48 -14
- package/dist/interface/crud/oauth.js.map +1 -0
- package/dist/interface/crud/project-api-keys.d.cts +196 -0
- package/dist/interface/crud/project-api-keys.d.ts +18 -10
- package/dist/interface/crud/project-api-keys.js +121 -74
- package/dist/interface/crud/project-api-keys.js.map +1 -0
- package/dist/interface/crud/project-permissions.d.cts +160 -0
- package/dist/interface/crud/project-permissions.d.ts +38 -33
- package/dist/interface/crud/project-permissions.js +148 -90
- package/dist/interface/crud/project-permissions.js.map +1 -0
- package/dist/interface/crud/projects.d.cts +640 -0
- package/dist/interface/crud/projects.d.ts +36 -31
- package/dist/interface/crud/projects.js +218 -156
- package/dist/interface/crud/projects.js.map +1 -0
- package/dist/interface/crud/sessions.d.cts +149 -0
- package/dist/interface/crud/sessions.d.ts +21 -16
- package/dist/interface/crud/sessions.js +86 -50
- package/dist/interface/crud/sessions.js.map +1 -0
- package/dist/interface/crud/svix-token.d.cts +26 -0
- package/dist/interface/crud/svix-token.d.ts +14 -9
- package/dist/interface/crud/svix-token.js +46 -12
- package/dist/interface/crud/svix-token.js.map +1 -0
- package/dist/interface/crud/team-invitation-details.d.cts +30 -0
- package/dist/interface/crud/team-invitation-details.d.ts +12 -7
- package/dist/interface/crud/team-invitation-details.js +57 -15
- package/dist/interface/crud/team-invitation-details.js.map +1 -0
- package/dist/interface/crud/team-invitation.d.cts +49 -0
- package/dist/interface/crud/team-invitation.d.ts +13 -8
- package/dist/interface/crud/team-invitation.js +69 -27
- package/dist/interface/crud/team-invitation.js.map +1 -0
- package/dist/interface/crud/team-member-profiles.d.cts +229 -0
- package/dist/interface/crud/team-member-profiles.d.ts +20 -15
- package/dist/interface/crud/team-member-profiles.js +95 -49
- package/dist/interface/crud/team-member-profiles.js.map +1 -0
- package/dist/interface/crud/team-memberships.d.cts +74 -0
- package/dist/interface/crud/team-memberships.d.ts +22 -17
- package/dist/interface/crud/team-memberships.js +85 -45
- package/dist/interface/crud/team-memberships.js.map +1 -0
- package/dist/interface/crud/team-permissions.d.cts +168 -0
- package/dist/interface/crud/team-permissions.d.ts +38 -33
- package/dist/interface/crud/team-permissions.js +149 -91
- package/dist/interface/crud/team-permissions.js.map +1 -0
- package/dist/interface/crud/teams.d.cts +298 -0
- package/dist/interface/crud/teams.d.ts +45 -40
- package/dist/interface/crud/teams.js +177 -119
- package/dist/interface/crud/teams.js.map +1 -0
- package/dist/interface/crud/users.d.cts +469 -0
- package/dist/interface/crud/users.d.ts +31 -26
- package/dist/interface/crud/users.js +172 -118
- package/dist/interface/crud/users.js.map +1 -0
- package/dist/interface/serverInterface.d.cts +128 -0
- package/dist/interface/serverInterface.d.ts +29 -17
- package/dist/interface/serverInterface.js +506 -339
- package/dist/interface/serverInterface.js.map +1 -0
- package/dist/interface/webhooks.d.cts +292 -0
- package/dist/interface/webhooks.d.ts +6 -3
- package/dist/interface/webhooks.js +45 -15
- package/dist/interface/webhooks.js.map +1 -0
- package/dist/known-errors.d.cts +444 -0
- package/dist/known-errors.d.ts +12 -9
- package/dist/known-errors.js +1088 -561
- package/dist/known-errors.js.map +1 -0
- package/dist/schema-fields.d.cts +163 -0
- package/dist/schema-fields.d.ts +116 -114
- package/dist/schema-fields.js +593 -427
- package/dist/schema-fields.js.map +1 -0
- package/dist/sessions.d.cts +109 -0
- package/dist/sessions.d.ts +6 -3
- package/dist/sessions.js +201 -172
- package/dist/sessions.js.map +1 -0
- package/dist/utils/api-keys.d.cts +24 -0
- package/dist/utils/api-keys.d.ts +5 -4
- package/dist/utils/api-keys.js +106 -66
- package/dist/utils/api-keys.js.map +1 -0
- package/dist/utils/arrays.d.cts +18 -0
- package/dist/utils/arrays.d.ts +15 -13
- package/dist/utils/arrays.js +101 -168
- package/dist/utils/arrays.js.map +1 -0
- package/dist/utils/base64.d.cts +4 -0
- package/dist/utils/base64.d.ts +4 -2
- package/dist/utils/base64.js +41 -20
- package/dist/utils/base64.js.map +1 -0
- package/dist/utils/booleans.d.cts +6 -0
- package/dist/utils/booleans.d.ts +6 -4
- package/dist/utils/booleans.js +35 -27
- package/dist/utils/booleans.js.map +1 -0
- package/dist/utils/browser-compat.d.cts +8 -0
- package/dist/utils/browser-compat.d.ts +3 -1
- package/dist/utils/browser-compat.js +45 -16
- package/dist/utils/browser-compat.js.map +1 -0
- package/dist/utils/bytes.d.cts +15 -0
- package/dist/utils/bytes.d.ts +15 -13
- package/dist/utils/bytes.js +182 -270
- package/dist/utils/bytes.js.map +1 -0
- package/dist/utils/caches.d.cts +98 -0
- package/dist/utils/caches.d.ts +17 -14
- package/dist/utils/caches.js +188 -193
- package/dist/utils/caches.js.map +1 -0
- package/dist/utils/compile-time.d.cts +8 -0
- package/dist/utils/compile-time.d.ts +3 -1
- package/dist/utils/compile-time.js +35 -10
- package/dist/utils/compile-time.js.map +1 -0
- package/dist/utils/crypto.d.cts +8 -0
- package/dist/utils/crypto.d.ts +4 -2
- package/dist/utils/crypto.js +49 -21
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/dates.d.cts +15 -0
- package/dist/utils/dates.d.ts +6 -4
- package/dist/utils/dates.js +83 -105
- package/dist/utils/dates.js.map +1 -0
- package/dist/utils/dom.d.cts +3 -0
- package/dist/utils/dom.d.ts +3 -1
- package/dist/utils/dom.js +35 -7
- package/dist/utils/dom.js.map +1 -0
- package/dist/utils/env.d.cts +9 -0
- package/dist/utils/env.d.ts +6 -4
- package/dist/utils/env.js +70 -43
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/errors.d.cts +223 -0
- package/dist/utils/errors.d.ts +14 -11
- package/dist/utils/errors.js +148 -126
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/fs.d.cts +7 -0
- package/dist/utils/fs.d.ts +5 -3
- package/dist/utils/fs.js +70 -27
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/functions.d.cts +4 -0
- package/dist/utils/functions.d.ts +4 -2
- package/dist/utils/functions.js +35 -18
- package/dist/utils/functions.js.map +1 -0
- package/dist/utils/geo.d.cts +22 -0
- package/dist/utils/geo.d.ts +6 -3
- package/dist/utils/geo.js +39 -9
- package/dist/utils/geo.js.map +1 -0
- package/dist/utils/globals.d.cts +5 -0
- package/dist/utils/globals.d.ts +4 -2
- package/dist/utils/globals.js +41 -14
- package/dist/utils/globals.js.map +1 -0
- package/dist/utils/hashes.d.cts +7 -0
- package/dist/utils/hashes.d.ts +7 -5
- package/dist/utils/hashes.js +87 -41
- package/dist/utils/hashes.js.map +1 -0
- package/dist/utils/html.d.cts +4 -0
- package/dist/utils/html.d.ts +4 -2
- package/dist/utils/html.js +36 -37
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/http.d.cts +43 -0
- package/dist/utils/http.d.ts +6 -4
- package/dist/utils/http.js +83 -83
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/ips.d.cts +6 -0
- package/dist/utils/ips.d.ts +6 -4
- package/dist/utils/ips.js +48 -35
- package/dist/utils/ips.js.map +1 -0
- package/dist/utils/json.d.cts +13 -0
- package/dist/utils/json.d.ts +9 -6
- package/dist/utils/json.js +54 -157
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/jwt.d.cts +44 -0
- package/dist/utils/jwt.d.ts +14 -11
- package/dist/utils/jwt.js +119 -84
- package/dist/utils/jwt.js.map +1 -0
- package/dist/utils/locks.d.cts +15 -0
- package/dist/utils/locks.d.ts +3 -2
- package/dist/utils/locks.js +76 -56
- package/dist/utils/locks.js.map +1 -0
- package/dist/utils/maps.d.cts +59 -0
- package/dist/utils/maps.d.ts +6 -4
- package/dist/utils/maps.js +207 -343
- package/dist/utils/maps.js.map +1 -0
- package/dist/utils/math.d.cts +6 -0
- package/dist/utils/math.d.ts +3 -1
- package/dist/utils/math.js +31 -16
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/node-http.d.cts +15 -0
- package/dist/utils/node-http.d.ts +5 -5
- package/dist/utils/node-http.js +65 -36
- package/dist/utils/node-http.js.map +1 -0
- package/dist/utils/numbers.d.cts +5 -0
- package/dist/utils/numbers.d.ts +5 -3
- package/dist/utils/numbers.js +53 -66
- package/dist/utils/numbers.js.map +1 -0
- package/dist/utils/oauth.d.cts +8 -0
- package/dist/utils/oauth.d.ts +8 -6
- package/dist/utils/oauth.js +37 -4
- package/dist/utils/oauth.js.map +1 -0
- package/dist/utils/objects.d.cts +65 -0
- package/dist/utils/objects.d.ts +31 -30
- package/dist/utils/objects.js +196 -374
- package/dist/utils/objects.js.map +1 -0
- package/dist/utils/passkey.d.cts +1 -0
- package/dist/utils/passkey.d.ts +1 -1
- package/dist/utils/passkey.js +19 -1
- package/dist/utils/passkey.js.map +1 -0
- package/dist/utils/promises.d.cts +74 -0
- package/dist/utils/promises.d.ts +20 -18
- package/dist/utils/promises.js +252 -393
- package/dist/utils/promises.js.map +1 -0
- package/dist/utils/proxies.d.cts +4 -0
- package/dist/utils/proxies.d.ts +4 -2
- package/dist/utils/proxies.js +150 -161
- package/dist/utils/proxies.js.map +1 -0
- package/dist/utils/react.d.cts +25 -0
- package/dist/utils/react.d.ts +9 -6
- package/dist/utils/react.js +88 -134
- package/dist/utils/react.js.map +1 -0
- package/dist/utils/results.d.cts +78 -0
- package/dist/utils/results.d.ts +10 -9
- package/dist/utils/results.js +143 -324
- package/dist/utils/results.js.map +1 -0
- package/dist/utils/sentry.d.cts +5 -0
- package/dist/utils/sentry.d.ts +5 -2
- package/dist/utils/sentry.js +44 -14
- package/dist/utils/sentry.js.map +1 -0
- package/dist/utils/stores.d.cts +102 -0
- package/dist/utils/stores.d.ts +12 -9
- package/dist/utils/stores.js +219 -189
- package/dist/utils/stores.js.map +1 -0
- package/dist/utils/strings.d.cts +72 -0
- package/dist/utils/strings.d.ts +22 -20
- package/dist/utils/strings.js +299 -580
- package/dist/utils/strings.js.map +1 -0
- package/dist/utils/strings.nicify.test.d.cts +2 -0
- package/dist/utils/strings.nicify.test.d.ts +2 -1
- package/dist/utils/strings.nicify.test.js +168 -158
- package/dist/utils/strings.nicify.test.js.map +1 -0
- package/dist/utils/types.d.cts +23 -0
- package/dist/utils/types.d.ts +8 -6
- package/dist/utils/types.js +19 -1
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/unicode.d.cts +3 -0
- package/dist/utils/unicode.d.ts +3 -1
- package/dist/utils/unicode.js +34 -21
- package/dist/utils/unicode.js.map +1 -0
- package/dist/utils/urls.d.cts +20 -0
- package/dist/utils/urls.d.ts +10 -8
- package/dist/utils/urls.js +76 -165
- package/dist/utils/urls.js.map +1 -0
- package/dist/utils/uuids.d.cts +4 -0
- package/dist/utils/uuids.d.ts +4 -2
- package/dist/utils/uuids.js +39 -35
- package/dist/utils/uuids.js.map +1 -0
- package/package.json +5 -5
package/dist/utils/results.js
CHANGED
|
@@ -1,348 +1,167 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
status: "ok",
|
|
10
|
-
data,
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
error(error) {
|
|
14
|
-
return {
|
|
15
|
-
status: "error",
|
|
16
|
-
error,
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
map: mapResult,
|
|
20
|
-
or: (result, fallback) => {
|
|
21
|
-
return result.status === "ok" ? result.data : fallback;
|
|
22
|
-
},
|
|
23
|
-
orThrow: (result) => {
|
|
24
|
-
if (result.status === "error") {
|
|
25
|
-
throw result.error;
|
|
26
|
-
}
|
|
27
|
-
return result.data;
|
|
28
|
-
},
|
|
29
|
-
orThrowAsync: async (result) => {
|
|
30
|
-
return Result.orThrow(await result);
|
|
31
|
-
},
|
|
32
|
-
retry,
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const errorResult = Result.error(error);
|
|
42
|
-
expect(errorResult.status).toBe("error");
|
|
43
|
-
expect(errorResult.error).toBe(error);
|
|
44
|
-
});
|
|
45
|
-
import.meta.vitest?.test("Result.or", ({ expect }) => {
|
|
46
|
-
// Test with ok result
|
|
47
|
-
const okResult = { status: "ok", data: 42 };
|
|
48
|
-
expect(Result.or(okResult, 0)).toBe(42);
|
|
49
|
-
// Test with error result
|
|
50
|
-
const errorResult = { status: "error", error: "error message" };
|
|
51
|
-
expect(Result.or(errorResult, 0)).toBe(0);
|
|
52
|
-
});
|
|
53
|
-
import.meta.vitest?.test("Result.orThrow", ({ expect }) => {
|
|
54
|
-
// Test with ok result
|
|
55
|
-
const okResult = { status: "ok", data: 42 };
|
|
56
|
-
expect(Result.orThrow(okResult)).toBe(42);
|
|
57
|
-
// Test with error result
|
|
58
|
-
const error = new Error("Test error");
|
|
59
|
-
const errorResult = { status: "error", error };
|
|
60
|
-
expect(() => Result.orThrow(errorResult)).toThrow(error);
|
|
61
|
-
});
|
|
62
|
-
import.meta.vitest?.test("Result.orThrowAsync", async ({ expect }) => {
|
|
63
|
-
// Test with ok result
|
|
64
|
-
const okPromise = Promise.resolve({ status: "ok", data: 42 });
|
|
65
|
-
expect(await Result.orThrowAsync(okPromise)).toBe(42);
|
|
66
|
-
// Test with error result
|
|
67
|
-
const error = new Error("Test error");
|
|
68
|
-
const errorPromise = Promise.resolve({ status: "error", error });
|
|
69
|
-
await expect(Result.orThrowAsync(errorPromise)).rejects.toThrow(error);
|
|
70
|
-
});
|
|
71
|
-
export const AsyncResult = {
|
|
72
|
-
fromThrowing,
|
|
73
|
-
fromPromise: promiseToResult,
|
|
74
|
-
ok: Result.ok,
|
|
75
|
-
error: Result.error,
|
|
76
|
-
pending,
|
|
77
|
-
map: mapResult,
|
|
78
|
-
or: (result, fallback) => {
|
|
79
|
-
if (result.status === "pending") {
|
|
80
|
-
return fallback;
|
|
81
|
-
}
|
|
82
|
-
return Result.or(result, fallback);
|
|
83
|
-
},
|
|
84
|
-
orThrow: (result) => {
|
|
85
|
-
if (result.status === "pending") {
|
|
86
|
-
throw new Error("Result still pending");
|
|
87
|
-
}
|
|
88
|
-
return Result.orThrow(result);
|
|
89
|
-
},
|
|
90
|
-
retry,
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
91
17
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// Test with pending result
|
|
100
|
-
const pendingResult = { status: "pending", progress: undefined };
|
|
101
|
-
expect(AsyncResult.or(pendingResult, 0)).toBe(0);
|
|
102
|
-
});
|
|
103
|
-
import.meta.vitest?.test("AsyncResult.orThrow", ({ expect }) => {
|
|
104
|
-
// Test with ok result
|
|
105
|
-
const okResult = { status: "ok", data: 42 };
|
|
106
|
-
expect(AsyncResult.orThrow(okResult)).toBe(42);
|
|
107
|
-
// Test with error result
|
|
108
|
-
const error = new Error("Test error");
|
|
109
|
-
const errorResult = { status: "error", error };
|
|
110
|
-
expect(() => AsyncResult.orThrow(errorResult)).toThrow(error);
|
|
111
|
-
// Test with pending result
|
|
112
|
-
const pendingResult = { status: "pending", progress: undefined };
|
|
113
|
-
expect(() => AsyncResult.orThrow(pendingResult)).toThrow("Result still pending");
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/results.tsx
|
|
21
|
+
var results_exports = {};
|
|
22
|
+
__export(results_exports, {
|
|
23
|
+
AsyncResult: () => AsyncResult,
|
|
24
|
+
Result: () => Result
|
|
114
25
|
});
|
|
115
|
-
|
|
26
|
+
module.exports = __toCommonJS(results_exports);
|
|
27
|
+
var import_promises = require("./promises");
|
|
28
|
+
var import_strings = require("./strings");
|
|
29
|
+
var Result = {
|
|
30
|
+
fromThrowing,
|
|
31
|
+
fromThrowingAsync,
|
|
32
|
+
fromPromise: promiseToResult,
|
|
33
|
+
ok(data) {
|
|
116
34
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
35
|
+
status: "ok",
|
|
36
|
+
data
|
|
119
37
|
};
|
|
38
|
+
},
|
|
39
|
+
error(error) {
|
|
40
|
+
return {
|
|
41
|
+
status: "error",
|
|
42
|
+
error
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
map: mapResult,
|
|
46
|
+
or: (result, fallback) => {
|
|
47
|
+
return result.status === "ok" ? result.data : fallback;
|
|
48
|
+
},
|
|
49
|
+
orThrow: (result) => {
|
|
50
|
+
if (result.status === "error") {
|
|
51
|
+
throw result.error;
|
|
52
|
+
}
|
|
53
|
+
return result.data;
|
|
54
|
+
},
|
|
55
|
+
orThrowAsync: async (result) => {
|
|
56
|
+
return Result.orThrow(await result);
|
|
57
|
+
},
|
|
58
|
+
retry
|
|
59
|
+
};
|
|
60
|
+
var AsyncResult = {
|
|
61
|
+
fromThrowing,
|
|
62
|
+
fromPromise: promiseToResult,
|
|
63
|
+
ok: Result.ok,
|
|
64
|
+
error: Result.error,
|
|
65
|
+
pending,
|
|
66
|
+
map: mapResult,
|
|
67
|
+
or: (result, fallback) => {
|
|
68
|
+
if (result.status === "pending") {
|
|
69
|
+
return fallback;
|
|
70
|
+
}
|
|
71
|
+
return Result.or(result, fallback);
|
|
72
|
+
},
|
|
73
|
+
orThrow: (result) => {
|
|
74
|
+
if (result.status === "pending") {
|
|
75
|
+
throw new Error("Result still pending");
|
|
76
|
+
}
|
|
77
|
+
return Result.orThrow(result);
|
|
78
|
+
},
|
|
79
|
+
retry
|
|
80
|
+
};
|
|
81
|
+
function pending(progress) {
|
|
82
|
+
return {
|
|
83
|
+
status: "pending",
|
|
84
|
+
progress
|
|
85
|
+
};
|
|
120
86
|
}
|
|
121
|
-
import.meta.vitest?.test("pending", ({ expect }) => {
|
|
122
|
-
// Test without progress
|
|
123
|
-
const pendingResult = pending();
|
|
124
|
-
expect(pendingResult.status).toBe("pending");
|
|
125
|
-
expect(pendingResult.progress).toBe(undefined);
|
|
126
|
-
// Test with progress
|
|
127
|
-
const progressValue = { loaded: 50, total: 100 };
|
|
128
|
-
const pendingWithProgress = pending(progressValue);
|
|
129
|
-
expect(pendingWithProgress.status).toBe("pending");
|
|
130
|
-
expect(pendingWithProgress.progress).toBe(progressValue);
|
|
131
|
-
});
|
|
132
87
|
async function promiseToResult(promise) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
88
|
+
try {
|
|
89
|
+
const value = await promise;
|
|
90
|
+
return Result.ok(value);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return Result.error(error);
|
|
93
|
+
}
|
|
140
94
|
}
|
|
141
|
-
import.meta.vitest?.test("promiseToResult", async ({ expect }) => {
|
|
142
|
-
// Test with resolved promise
|
|
143
|
-
const resolvedPromise = Promise.resolve(42);
|
|
144
|
-
const resolvedResult = await promiseToResult(resolvedPromise);
|
|
145
|
-
expect(resolvedResult.status).toBe("ok");
|
|
146
|
-
if (resolvedResult.status === "ok") {
|
|
147
|
-
expect(resolvedResult.data).toBe(42);
|
|
148
|
-
}
|
|
149
|
-
// Test with rejected promise
|
|
150
|
-
const error = new Error("Test error");
|
|
151
|
-
const rejectedPromise = Promise.reject(error);
|
|
152
|
-
const rejectedResult = await promiseToResult(rejectedPromise);
|
|
153
|
-
expect(rejectedResult.status).toBe("error");
|
|
154
|
-
if (rejectedResult.status === "error") {
|
|
155
|
-
expect(rejectedResult.error).toBe(error);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
95
|
function fromThrowing(fn) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
96
|
+
try {
|
|
97
|
+
return Result.ok(fn());
|
|
98
|
+
} catch (error) {
|
|
99
|
+
return Result.error(error);
|
|
100
|
+
}
|
|
165
101
|
}
|
|
166
|
-
import.meta.vitest?.test("fromThrowing", ({ expect }) => {
|
|
167
|
-
// Test with function that succeeds
|
|
168
|
-
const successFn = () => 42;
|
|
169
|
-
const successResult = fromThrowing(successFn);
|
|
170
|
-
expect(successResult.status).toBe("ok");
|
|
171
|
-
if (successResult.status === "ok") {
|
|
172
|
-
expect(successResult.data).toBe(42);
|
|
173
|
-
}
|
|
174
|
-
// Test with function that throws
|
|
175
|
-
const error = new Error("Test error");
|
|
176
|
-
const errorFn = () => {
|
|
177
|
-
throw error;
|
|
178
|
-
};
|
|
179
|
-
const errorResult = fromThrowing(errorFn);
|
|
180
|
-
expect(errorResult.status).toBe("error");
|
|
181
|
-
if (errorResult.status === "error") {
|
|
182
|
-
expect(errorResult.error).toBe(error);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
102
|
async function fromThrowingAsync(fn) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
103
|
+
try {
|
|
104
|
+
return Result.ok(await fn());
|
|
105
|
+
} catch (error) {
|
|
106
|
+
return Result.error(error);
|
|
107
|
+
}
|
|
192
108
|
}
|
|
193
|
-
import.meta.vitest?.test("fromThrowingAsync", async ({ expect }) => {
|
|
194
|
-
// Test with async function that succeeds
|
|
195
|
-
const successFn = async () => 42;
|
|
196
|
-
const successResult = await fromThrowingAsync(successFn);
|
|
197
|
-
expect(successResult.status).toBe("ok");
|
|
198
|
-
if (successResult.status === "ok") {
|
|
199
|
-
expect(successResult.data).toBe(42);
|
|
200
|
-
}
|
|
201
|
-
// Test with async function that throws
|
|
202
|
-
const error = new Error("Test error");
|
|
203
|
-
const errorFn = async () => {
|
|
204
|
-
throw error;
|
|
205
|
-
};
|
|
206
|
-
const errorResult = await fromThrowingAsync(errorFn);
|
|
207
|
-
expect(errorResult.status).toBe("error");
|
|
208
|
-
if (errorResult.status === "error") {
|
|
209
|
-
expect(errorResult.error).toBe(error);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
109
|
function mapResult(result, fn) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
};
|
|
223
|
-
return Result.ok(fn(result.data));
|
|
110
|
+
if (result.status === "error") return {
|
|
111
|
+
status: "error",
|
|
112
|
+
error: result.error
|
|
113
|
+
};
|
|
114
|
+
if (result.status === "pending") return {
|
|
115
|
+
status: "pending",
|
|
116
|
+
..."progress" in result ? { progress: result.progress } : {}
|
|
117
|
+
};
|
|
118
|
+
return Result.ok(fn(result.data));
|
|
224
119
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
// Test with error result
|
|
234
|
-
const errorResult = { status: "error", error: "error message" };
|
|
235
|
-
const mappedError = mapResult(errorResult, (n) => n * 2);
|
|
236
|
-
expect(mappedError.status).toBe("error");
|
|
237
|
-
if (mappedError.status === "error") {
|
|
238
|
-
expect(mappedError.error).toBe("error message");
|
|
239
|
-
}
|
|
240
|
-
// Test with pending result (no progress)
|
|
241
|
-
const pendingResult = { status: "pending", progress: undefined };
|
|
242
|
-
const mappedPending = mapResult(pendingResult, (n) => n * 2);
|
|
243
|
-
expect(mappedPending.status).toBe("pending");
|
|
244
|
-
// Test with pending result (with progress)
|
|
245
|
-
const progressValue = { loaded: 50, total: 100 };
|
|
246
|
-
const pendingWithProgress = {
|
|
247
|
-
status: "pending",
|
|
248
|
-
progress: progressValue
|
|
249
|
-
};
|
|
250
|
-
const mappedPendingWithProgress = mapResult(pendingWithProgress, (n) => n * 2);
|
|
251
|
-
expect(mappedPendingWithProgress.status).toBe("pending");
|
|
252
|
-
if (mappedPendingWithProgress.status === "pending") {
|
|
253
|
-
expect(mappedPendingWithProgress.progress).toBe(progressValue);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
class RetryError extends AggregateError {
|
|
257
|
-
constructor(errors) {
|
|
258
|
-
const strings = errors.map(e => nicify(e));
|
|
259
|
-
const isAllSame = strings.length > 1 && strings.every(s => s === strings[0]);
|
|
260
|
-
super(errors, deindent `
|
|
120
|
+
var RetryError = class extends AggregateError {
|
|
121
|
+
constructor(errors) {
|
|
122
|
+
const strings = errors.map((e) => (0, import_strings.nicify)(e));
|
|
123
|
+
const isAllSame = strings.length > 1 && strings.every((s) => s === strings[0]);
|
|
124
|
+
super(
|
|
125
|
+
errors,
|
|
126
|
+
import_strings.deindent`
|
|
261
127
|
Error after ${errors.length} attempts.
|
|
262
128
|
|
|
263
|
-
${isAllSame ? deindent
|
|
129
|
+
${isAllSame ? import_strings.deindent`
|
|
264
130
|
Attempts 1-${errors.length}:
|
|
265
131
|
${strings[0]}
|
|
266
|
-
` : strings.map((s, i) => deindent
|
|
132
|
+
` : strings.map((s, i) => import_strings.deindent`
|
|
267
133
|
Attempt ${i + 1}:
|
|
268
134
|
${s}
|
|
269
135
|
`).join("\n\n")}
|
|
270
|
-
`,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
136
|
+
`,
|
|
137
|
+
{ cause: errors[errors.length - 1] }
|
|
138
|
+
);
|
|
139
|
+
this.errors = errors;
|
|
140
|
+
this.name = "RetryError";
|
|
141
|
+
}
|
|
142
|
+
get attempts() {
|
|
143
|
+
return this.errors.length;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
278
146
|
RetryError.prototype.name = "RetryError";
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
expect(retryErrorMultiple.errors).toEqual([error1, error2]);
|
|
294
|
-
expect(retryErrorMultiple.attempts).toBe(2);
|
|
295
|
-
expect(retryErrorMultiple.cause).toBe(error2);
|
|
296
|
-
expect(retryErrorMultiple.message).toContain("Error after 2 attempts");
|
|
297
|
-
expect(retryErrorMultiple.message).toContain("Attempt 1");
|
|
298
|
-
expect(retryErrorMultiple.message).toContain("Attempt 2");
|
|
299
|
-
// Test with multiple identical errors
|
|
300
|
-
const sameError = new Error("Same error");
|
|
301
|
-
const retryErrorSame = new RetryError([sameError, sameError]);
|
|
302
|
-
expect(retryErrorSame.name).toBe("RetryError");
|
|
303
|
-
expect(retryErrorSame.errors).toEqual([sameError, sameError]);
|
|
304
|
-
expect(retryErrorSame.attempts).toBe(2);
|
|
305
|
-
expect(retryErrorSame.cause).toBe(sameError);
|
|
306
|
-
expect(retryErrorSame.message).toContain("Error after 2 attempts");
|
|
307
|
-
expect(retryErrorSame.message).toContain("Attempts 1-2");
|
|
308
|
-
});
|
|
309
|
-
async function retry(fn, totalAttempts, { exponentialDelayBase = 1000 } = {}) {
|
|
310
|
-
const errors = [];
|
|
311
|
-
for (let i = 0; i < totalAttempts; i++) {
|
|
312
|
-
const res = await fn(i);
|
|
313
|
-
if (res.status === "ok") {
|
|
314
|
-
return Object.assign(Result.ok(res.data), { attempts: i + 1 });
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
errors.push(res.error);
|
|
318
|
-
if (i < totalAttempts - 1) {
|
|
319
|
-
await wait((Math.random() + 0.5) * exponentialDelayBase * (2 ** i));
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return Object.assign(Result.error(new RetryError(errors)), { attempts: totalAttempts });
|
|
147
|
+
async function retry(fn, totalAttempts, { exponentialDelayBase = 1e3 } = {}) {
|
|
148
|
+
const errors = [];
|
|
149
|
+
for (let i = 0; i < totalAttempts; i++) {
|
|
150
|
+
const res = await fn(i);
|
|
151
|
+
if (res.status === "ok") {
|
|
152
|
+
return Object.assign(Result.ok(res.data), { attempts: i + 1 });
|
|
153
|
+
} else {
|
|
154
|
+
errors.push(res.error);
|
|
155
|
+
if (i < totalAttempts - 1) {
|
|
156
|
+
await (0, import_promises.wait)((Math.random() + 0.5) * exponentialDelayBase * 2 ** i);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return Object.assign(Result.error(new RetryError(errors)), { attempts: totalAttempts });
|
|
324
161
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
expect(successResult).toEqual({ status: "ok", data: "success", attempts: 1 });
|
|
330
|
-
// Test successful after failures
|
|
331
|
-
let attemptCount = 0;
|
|
332
|
-
const eventualSuccessFn = async () => {
|
|
333
|
-
return ++attemptCount < 2 ? Result.error(new Error(`Attempt ${attemptCount} failed`))
|
|
334
|
-
: Result.ok("eventual success");
|
|
335
|
-
};
|
|
336
|
-
const eventualSuccessResult = await retry(eventualSuccessFn, 3, { exponentialDelayBase: 0 });
|
|
337
|
-
expect(eventualSuccessResult).toEqual({ status: "ok", data: "eventual success", attempts: 2 });
|
|
338
|
-
// Test all attempts fail
|
|
339
|
-
const errors = [new Error("Error 1"), new Error("Error 2"), new Error("Error 3")];
|
|
340
|
-
const allFailFn = async (attempt) => {
|
|
341
|
-
return Result.error(errors[attempt]);
|
|
342
|
-
};
|
|
343
|
-
const allFailResult = await retry(allFailFn, 3, { exponentialDelayBase: 0 });
|
|
344
|
-
expect(allFailResult).toEqual({ status: "error", error: expect.any(RetryError), attempts: 3 });
|
|
345
|
-
const retryError = allFailResult.error;
|
|
346
|
-
expect(retryError.errors).toEqual(errors);
|
|
347
|
-
expect(retryError.attempts).toBe(3);
|
|
162
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
+
0 && (module.exports = {
|
|
164
|
+
AsyncResult,
|
|
165
|
+
Result
|
|
348
166
|
});
|
|
167
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/results.tsx"],"sourcesContent":["import { wait } from \"./promises\";\nimport { deindent, nicify } from \"./strings\";\n\nexport type Result<T, E = unknown> =\n | {\n status: \"ok\",\n data: T,\n }\n | {\n status: \"error\",\n error: E,\n };\n\nexport type AsyncResult<T, E = unknown, P = void> =\n | Result<T, E>\n | (\n & {\n status: \"pending\",\n }\n & {\n progress: P,\n }\n );\n\n\nexport const Result = {\n fromThrowing,\n fromThrowingAsync,\n fromPromise: promiseToResult,\n ok<T>(data: T): Result<T, never> & { status: \"ok\" } {\n return {\n status: \"ok\",\n data,\n };\n },\n error<E>(error: E): Result<never, E> & { status: \"error\" } {\n return {\n status: \"error\",\n error,\n };\n },\n map: mapResult,\n or: <T, E, U>(result: Result<T, E>, fallback: U): T | U => {\n return result.status === \"ok\" ? result.data : fallback;\n },\n orThrow: <T, E>(result: Result<T, E>): T => {\n if (result.status === \"error\") {\n throw result.error;\n }\n return result.data;\n },\n orThrowAsync: async <T, E>(result: Promise<Result<T, E>>): Promise<T> => {\n return Result.orThrow(await result);\n },\n retry,\n};\nundefined?.test(\"Result.ok and Result.error\", ({ expect }) => {\n // Test Result.ok\n const okResult = Result.ok(42);\n expect(okResult.status).toBe(\"ok\");\n expect(okResult.data).toBe(42);\n\n // Test Result.error\n const error = new Error(\"Test error\");\n const errorResult = Result.error(error);\n expect(errorResult.status).toBe(\"error\");\n expect(errorResult.error).toBe(error);\n});\n\nundefined?.test(\"Result.or\", ({ expect }) => {\n // Test with ok result\n const okResult: Result<number, string> = { status: \"ok\", data: 42 };\n expect(Result.or(okResult, 0)).toBe(42);\n\n // Test with error result\n const errorResult: Result<number, string> = { status: \"error\", error: \"error message\" };\n expect(Result.or(errorResult, 0)).toBe(0);\n});\n\nundefined?.test(\"Result.orThrow\", ({ expect }) => {\n // Test with ok result\n const okResult: Result<number, Error> = { status: \"ok\", data: 42 };\n expect(Result.orThrow(okResult)).toBe(42);\n\n // Test with error result\n const error = new Error(\"Test error\");\n const errorResult: Result<number, Error> = { status: \"error\", error };\n expect(() => Result.orThrow(errorResult)).toThrow(error);\n});\n\nundefined?.test(\"Result.orThrowAsync\", async ({ expect }) => {\n // Test with ok result\n const okPromise = Promise.resolve({ status: \"ok\", data: 42 } as Result<number, Error>);\n expect(await Result.orThrowAsync(okPromise)).toBe(42);\n\n // Test with error result\n const error = new Error(\"Test error\");\n const errorPromise = Promise.resolve({ status: \"error\", error } as Result<number, Error>);\n await expect(Result.orThrowAsync(errorPromise)).rejects.toThrow(error);\n});\n\nexport const AsyncResult = {\n fromThrowing,\n fromPromise: promiseToResult,\n ok: Result.ok,\n error: Result.error,\n pending,\n map: mapResult,\n or: <T, E, P, U>(result: AsyncResult<T, E, P>, fallback: U): T | U => {\n if (result.status === \"pending\") {\n return fallback;\n }\n return Result.or(result, fallback);\n },\n orThrow: <T, E, P>(result: AsyncResult<T, E, P>): T => {\n if (result.status === \"pending\") {\n throw new Error(\"Result still pending\");\n }\n return Result.orThrow(result);\n },\n retry,\n};\nundefined?.test(\"AsyncResult.or\", ({ expect }) => {\n // Test with ok result\n const okResult: AsyncResult<number, string> = { status: \"ok\", data: 42 };\n expect(AsyncResult.or(okResult, 0)).toBe(42);\n\n // Test with error result\n const errorResult: AsyncResult<number, string> = { status: \"error\", error: \"error message\" };\n expect(AsyncResult.or(errorResult, 0)).toBe(0);\n\n // Test with pending result\n const pendingResult: AsyncResult<number, string> = { status: \"pending\", progress: undefined };\n expect(AsyncResult.or(pendingResult, 0)).toBe(0);\n});\n\nundefined?.test(\"AsyncResult.orThrow\", ({ expect }) => {\n // Test with ok result\n const okResult: AsyncResult<number, Error> = { status: \"ok\", data: 42 };\n expect(AsyncResult.orThrow(okResult)).toBe(42);\n\n // Test with error result\n const error = new Error(\"Test error\");\n const errorResult: AsyncResult<number, Error> = { status: \"error\", error };\n expect(() => AsyncResult.orThrow(errorResult)).toThrow(error);\n\n // Test with pending result\n const pendingResult: AsyncResult<number, Error> = { status: \"pending\", progress: undefined };\n expect(() => AsyncResult.orThrow(pendingResult)).toThrow(\"Result still pending\");\n});\n\nfunction pending(): AsyncResult<never, never, void> & { status: \"pending\" };\nfunction pending<P>(progress: P): AsyncResult<never, never, P> & { status: \"pending\" };\nfunction pending<P>(progress?: P): AsyncResult<never, never, P> & { status: \"pending\" } {\n return {\n status: \"pending\",\n progress: progress!,\n };\n}\nundefined?.test(\"pending\", ({ expect }) => {\n // Test without progress\n const pendingResult = pending();\n expect(pendingResult.status).toBe(\"pending\");\n expect(pendingResult.progress).toBe(undefined);\n\n // Test with progress\n const progressValue = { loaded: 50, total: 100 };\n const pendingWithProgress = pending(progressValue);\n expect(pendingWithProgress.status).toBe(\"pending\");\n expect(pendingWithProgress.progress).toBe(progressValue);\n});\n\nasync function promiseToResult<T>(promise: Promise<T>): Promise<Result<T>> {\n try {\n const value = await promise;\n return Result.ok(value);\n } catch (error) {\n return Result.error(error);\n }\n}\nundefined?.test(\"promiseToResult\", async ({ expect }) => {\n // Test with resolved promise\n const resolvedPromise = Promise.resolve(42);\n const resolvedResult = await promiseToResult(resolvedPromise);\n expect(resolvedResult.status).toBe(\"ok\");\n if (resolvedResult.status === \"ok\") {\n expect(resolvedResult.data).toBe(42);\n }\n\n // Test with rejected promise\n const error = new Error(\"Test error\");\n const rejectedPromise = Promise.reject(error);\n const rejectedResult = await promiseToResult(rejectedPromise);\n expect(rejectedResult.status).toBe(\"error\");\n if (rejectedResult.status === \"error\") {\n expect(rejectedResult.error).toBe(error);\n }\n});\n\nfunction fromThrowing<T>(fn: () => T): Result<T, unknown> {\n try {\n return Result.ok(fn());\n } catch (error) {\n return Result.error(error);\n }\n}\nundefined?.test(\"fromThrowing\", ({ expect }) => {\n // Test with function that succeeds\n const successFn = () => 42;\n const successResult = fromThrowing(successFn);\n expect(successResult.status).toBe(\"ok\");\n if (successResult.status === \"ok\") {\n expect(successResult.data).toBe(42);\n }\n\n // Test with function that throws\n const error = new Error(\"Test error\");\n const errorFn = () => {\n throw error;\n };\n const errorResult = fromThrowing(errorFn);\n expect(errorResult.status).toBe(\"error\");\n if (errorResult.status === \"error\") {\n expect(errorResult.error).toBe(error);\n }\n});\n\nasync function fromThrowingAsync<T>(fn: () => Promise<T>): Promise<Result<T, unknown>> {\n try {\n return Result.ok(await fn());\n } catch (error) {\n return Result.error(error);\n }\n}\nundefined?.test(\"fromThrowingAsync\", async ({ expect }) => {\n // Test with async function that succeeds\n const successFn = async () => 42;\n const successResult = await fromThrowingAsync(successFn);\n expect(successResult.status).toBe(\"ok\");\n if (successResult.status === \"ok\") {\n expect(successResult.data).toBe(42);\n }\n\n // Test with async function that throws\n const error = new Error(\"Test error\");\n const errorFn = async () => {\n throw error;\n };\n const errorResult = await fromThrowingAsync(errorFn);\n expect(errorResult.status).toBe(\"error\");\n if (errorResult.status === \"error\") {\n expect(errorResult.error).toBe(error);\n }\n});\n\nfunction mapResult<T, U, E = unknown, P = unknown>(result: Result<T, E>, fn: (data: T) => U): Result<U, E>;\nfunction mapResult<T, U, E = unknown, P = unknown>(result: AsyncResult<T, E, P>, fn: (data: T) => U): AsyncResult<U, E, P>;\nfunction mapResult<T, U, E = unknown, P = unknown>(result: AsyncResult<T, E, P>, fn: (data: T) => U): AsyncResult<U, E, P> {\n if (result.status === \"error\") return {\n status: \"error\",\n error: result.error,\n };\n if (result.status === \"pending\") return {\n status: \"pending\",\n ...\"progress\" in result ? { progress: result.progress } : {},\n } as any;\n\n return Result.ok(fn(result.data));\n}\nundefined?.test(\"mapResult\", ({ expect }) => {\n // Test with ok result\n const okResult: Result<number, string> = { status: \"ok\", data: 42 };\n const mappedOk = mapResult(okResult, (n: number) => n * 2);\n expect(mappedOk.status).toBe(\"ok\");\n if (mappedOk.status === \"ok\") {\n expect(mappedOk.data).toBe(84);\n }\n\n // Test with error result\n const errorResult: Result<number, string> = { status: \"error\", error: \"error message\" };\n const mappedError = mapResult(errorResult, (n: number) => n * 2);\n expect(mappedError.status).toBe(\"error\");\n if (mappedError.status === \"error\") {\n expect(mappedError.error).toBe(\"error message\");\n }\n\n // Test with pending result (no progress)\n const pendingResult: AsyncResult<number, string, void> = { status: \"pending\", progress: undefined };\n const mappedPending = mapResult(pendingResult, (n: number) => n * 2);\n expect(mappedPending.status).toBe(\"pending\");\n\n // Test with pending result (with progress)\n const progressValue = { loaded: 50, total: 100 };\n const pendingWithProgress: AsyncResult<number, string, typeof progressValue> = {\n status: \"pending\",\n progress: progressValue\n };\n const mappedPendingWithProgress = mapResult(pendingWithProgress, (n: number) => n * 2);\n expect(mappedPendingWithProgress.status).toBe(\"pending\");\n if (mappedPendingWithProgress.status === \"pending\") {\n expect(mappedPendingWithProgress.progress).toBe(progressValue);\n }\n});\n\n\nclass RetryError extends AggregateError {\n constructor(public readonly errors: unknown[]) {\n const strings = errors.map(e => nicify(e));\n const isAllSame = strings.length > 1 && strings.every(s => s === strings[0]);\n super(\n errors,\n deindent`\n Error after ${errors.length} attempts.\n \n ${isAllSame ? deindent`\n Attempts 1-${errors.length}:\n ${strings[0]}\n ` : strings.map((s, i) => deindent`\n Attempt ${i + 1}:\n ${s}\n `).join(\"\\n\\n\")}\n `,\n { cause: errors[errors.length - 1] }\n );\n this.name = \"RetryError\";\n }\n\n get attempts() {\n return this.errors.length;\n }\n}\nRetryError.prototype.name = \"RetryError\";\n\nundefined?.test(\"RetryError\", ({ expect }) => {\n // Test with single error\n const singleError = new Error(\"Single error\");\n const retryErrorSingle = new RetryError([singleError]);\n expect(retryErrorSingle.name).toBe(\"RetryError\");\n expect(retryErrorSingle.errors).toEqual([singleError]);\n expect(retryErrorSingle.attempts).toBe(1);\n expect(retryErrorSingle.cause).toBe(singleError);\n expect(retryErrorSingle.message).toContain(\"Error after 1 attempts\");\n\n // Test with multiple different errors\n const error1 = new Error(\"Error 1\");\n const error2 = new Error(\"Error 2\");\n const retryErrorMultiple = new RetryError([error1, error2]);\n expect(retryErrorMultiple.name).toBe(\"RetryError\");\n expect(retryErrorMultiple.errors).toEqual([error1, error2]);\n expect(retryErrorMultiple.attempts).toBe(2);\n expect(retryErrorMultiple.cause).toBe(error2);\n expect(retryErrorMultiple.message).toContain(\"Error after 2 attempts\");\n expect(retryErrorMultiple.message).toContain(\"Attempt 1\");\n expect(retryErrorMultiple.message).toContain(\"Attempt 2\");\n\n // Test with multiple identical errors\n const sameError = new Error(\"Same error\");\n const retryErrorSame = new RetryError([sameError, sameError]);\n expect(retryErrorSame.name).toBe(\"RetryError\");\n expect(retryErrorSame.errors).toEqual([sameError, sameError]);\n expect(retryErrorSame.attempts).toBe(2);\n expect(retryErrorSame.cause).toBe(sameError);\n expect(retryErrorSame.message).toContain(\"Error after 2 attempts\");\n expect(retryErrorSame.message).toContain(\"Attempts 1-2\");\n});\n\nasync function retry<T>(\n fn: (attemptIndex: number) => Result<T> | Promise<Result<T>>,\n totalAttempts: number,\n { exponentialDelayBase = 1000 } = {},\n): Promise<Result<T, RetryError> & { attempts: number }> {\n const errors: unknown[] = [];\n for (let i = 0; i < totalAttempts; i++) {\n const res = await fn(i);\n if (res.status === \"ok\") {\n return Object.assign(Result.ok(res.data), { attempts: i + 1 });\n } else {\n errors.push(res.error);\n if (i < totalAttempts - 1) {\n await wait((Math.random() + 0.5) * exponentialDelayBase * (2 ** i));\n }\n }\n }\n return Object.assign(Result.error(new RetryError(errors)), { attempts: totalAttempts });\n}\nundefined?.test(\"retry\", async ({ expect }) => {\n // Test successful on first attempt\n const successFn = async () => Result.ok(\"success\");\n const successResult = await retry(successFn, 3, { exponentialDelayBase: 0 });\n expect(successResult).toEqual({ status: \"ok\", data: \"success\", attempts: 1 });\n\n // Test successful after failures\n let attemptCount = 0;\n const eventualSuccessFn = async () => {\n return ++attemptCount < 2 ? Result.error(new Error(`Attempt ${attemptCount} failed`))\n : Result.ok(\"eventual success\");\n };\n const eventualSuccessResult = await retry(eventualSuccessFn, 3, { exponentialDelayBase: 0 });\n expect(eventualSuccessResult).toEqual({ status: \"ok\", data: \"eventual success\", attempts: 2 });\n\n // Test all attempts fail\n const errors = [new Error(\"Error 1\"), new Error(\"Error 2\"), new Error(\"Error 3\")];\n const allFailFn = async (attempt: number) => {\n return Result.error(errors[attempt]);\n };\n const allFailResult = await retry(allFailFn, 3, { exponentialDelayBase: 0 });\n expect(allFailResult).toEqual({ status: \"error\", error: expect.any(RetryError), attempts: 3 });\n const retryError = (allFailResult as any).error as RetryError;\n expect(retryError.errors).toEqual(errors);\n expect(retryError.attempts).toBe(3);\n});\n"],"mappings":"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","names":[]}
|
package/dist/utils/sentry.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import * as Sentry from
|
|
2
|
-
|
|
1
|
+
import * as Sentry from '@sentry/nextjs';
|
|
2
|
+
|
|
3
|
+
declare const sentryBaseConfig: Sentry.BrowserOptions & Sentry.NodeOptions & Sentry.VercelEdgeOptions;
|
|
4
|
+
|
|
5
|
+
export { sentryBaseConfig };
|
package/dist/utils/sentry.js
CHANGED
|
@@ -1,15 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// Adjust this value in production, or use tracesSampler for greater control
|
|
10
|
-
tracesSampleRate: 1.0,
|
|
11
|
-
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
12
|
-
debug: false,
|
|
13
|
-
replaysOnErrorSampleRate: 1.0,
|
|
14
|
-
replaysSessionSampleRate: 1.0,
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
9
|
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/sentry.tsx
|
|
21
|
+
var sentry_exports = {};
|
|
22
|
+
__export(sentry_exports, {
|
|
23
|
+
sentryBaseConfig: () => sentryBaseConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(sentry_exports);
|
|
26
|
+
var sentryBaseConfig = {
|
|
27
|
+
ignoreErrors: [
|
|
28
|
+
// React throws these errors when used with some browser extensions (eg. Google Translate)
|
|
29
|
+
"NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.",
|
|
30
|
+
"NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node."
|
|
31
|
+
],
|
|
32
|
+
normalizeDepth: 5,
|
|
33
|
+
maxValueLength: 5e3,
|
|
34
|
+
// Adjust this value in production, or use tracesSampler for greater control
|
|
35
|
+
tracesSampleRate: 1,
|
|
36
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
37
|
+
debug: false,
|
|
38
|
+
replaysOnErrorSampleRate: 1,
|
|
39
|
+
replaysSessionSampleRate: 1
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
sentryBaseConfig
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=sentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/sentry.tsx"],"sourcesContent":["import * as Sentry from \"@sentry/nextjs\";\n\nexport const sentryBaseConfig: Sentry.BrowserOptions & Sentry.NodeOptions & Sentry.VercelEdgeOptions = {\n ignoreErrors: [\n // React throws these errors when used with some browser extensions (eg. Google Translate)\n \"NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.\",\n \"NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.\",\n ],\n\n normalizeDepth: 5,\n maxValueLength: 5000,\n\n // Adjust this value in production, or use tracesSampler for greater control\n tracesSampleRate: 1.0,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n\n replaysOnErrorSampleRate: 1.0,\n\n replaysSessionSampleRate: 1.0,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,IAAM,mBAA0F;AAAA,EACrG,cAAc;AAAA;AAAA,IAEZ;AAAA,IACA;AAAA,EACF;AAAA,EAEA,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAGhB,kBAAkB;AAAA;AAAA,EAGlB,OAAO;AAAA,EAEP,0BAA0B;AAAA,EAE1B,0BAA0B;AAC5B;","names":[]}
|