@stackframe/stack-shared 2.8.8 → 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 +8 -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/fs.js
CHANGED
|
@@ -1,31 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/utils/fs.tsx
|
|
31
|
+
var fs_exports = {};
|
|
32
|
+
__export(fs_exports, {
|
|
33
|
+
list: () => list,
|
|
34
|
+
listRecursively: () => listRecursively,
|
|
35
|
+
writeFileSyncIfChanged: () => writeFileSyncIfChanged
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(fs_exports);
|
|
38
|
+
var stackFs = __toESM(require("fs"), 1);
|
|
39
|
+
var path = __toESM(require("path"), 1);
|
|
40
|
+
async function list(path2) {
|
|
41
|
+
return await stackFs.promises.readdir(path2);
|
|
5
42
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
];
|
|
43
|
+
async function listRecursively(p, options = {}) {
|
|
44
|
+
const files = await list(p);
|
|
45
|
+
return [
|
|
46
|
+
...(await Promise.all(files.map(async (fileName) => {
|
|
47
|
+
const filePath = path.join(p, fileName);
|
|
48
|
+
if ((await stackFs.promises.stat(filePath)).isDirectory()) {
|
|
49
|
+
return [
|
|
50
|
+
...await listRecursively(filePath, options),
|
|
51
|
+
...options.excludeDirectories ? [] : [filePath]
|
|
52
|
+
];
|
|
53
|
+
} else {
|
|
54
|
+
return [filePath];
|
|
55
|
+
}
|
|
56
|
+
}))).flat()
|
|
57
|
+
];
|
|
22
58
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
59
|
+
function writeFileSyncIfChanged(path2, content) {
|
|
60
|
+
if (stackFs.existsSync(path2)) {
|
|
61
|
+
const existingContent = stackFs.readFileSync(path2, "utf-8");
|
|
62
|
+
if (existingContent === content) {
|
|
63
|
+
return;
|
|
29
64
|
}
|
|
30
|
-
|
|
65
|
+
}
|
|
66
|
+
stackFs.writeFileSync(path2, content);
|
|
31
67
|
}
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
list,
|
|
71
|
+
listRecursively,
|
|
72
|
+
writeFileSyncIfChanged
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/fs.tsx"],"sourcesContent":["import * as stackFs from \"fs\";\nimport * as path from \"path\";\n\nexport async function list(path: string) {\n return await stackFs.promises.readdir(path);\n}\n\nexport async function listRecursively(p: string, options: { excludeDirectories?: boolean } = {}): Promise<string[]> {\n const files = await list(p);\n return [\n ...(await Promise.all(files.map(async (fileName) => {\n const filePath = path.join(p, fileName);\n if ((await stackFs.promises.stat(filePath)).isDirectory()) {\n return [\n ...(await listRecursively(filePath, options)),\n ...(options.excludeDirectories ? [] : [filePath]),\n ];\n } else {\n return [filePath];\n }\n }))).flat(),\n ];\n}\n\nexport function writeFileSyncIfChanged(path: string, content: string): void {\n if (stackFs.existsSync(path)) {\n const existingContent = stackFs.readFileSync(path, \"utf-8\");\n if (existingContent === content) {\n return;\n }\n }\n stackFs.writeFileSync(path, content);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAyB;AACzB,WAAsB;AAEtB,eAAsB,KAAKA,OAAc;AACvC,SAAO,MAAc,iBAAS,QAAQA,KAAI;AAC5C;AAEA,eAAsB,gBAAgB,GAAW,UAA4C,CAAC,GAAsB;AAClH,QAAM,QAAQ,MAAM,KAAK,CAAC;AAC1B,SAAO;AAAA,IACL,IAAI,MAAM,QAAQ,IAAI,MAAM,IAAI,OAAO,aAAa;AAClD,YAAM,WAAgB,UAAK,GAAG,QAAQ;AACtC,WAAK,MAAc,iBAAS,KAAK,QAAQ,GAAG,YAAY,GAAG;AACzD,eAAO;AAAA,UACL,GAAI,MAAM,gBAAgB,UAAU,OAAO;AAAA,UAC3C,GAAI,QAAQ,qBAAqB,CAAC,IAAI,CAAC,QAAQ;AAAA,QACjD;AAAA,MACF,OAAO;AACL,eAAO,CAAC,QAAQ;AAAA,MAClB;AAAA,IACF,CAAC,CAAC,GAAG,KAAK;AAAA,EACZ;AACF;AAEO,SAAS,uBAAuBA,OAAc,SAAuB;AAC1E,MAAY,mBAAWA,KAAI,GAAG;AAC5B,UAAM,kBAA0B,qBAAaA,OAAM,OAAO;AAC1D,QAAI,oBAAoB,SAAS;AAC/B;AAAA,IACF;AAAA,EACF;AACA,EAAQ,sBAAcA,OAAM,OAAO;AACrC;","names":["path"]}
|
package/dist/utils/functions.js
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 });
|
|
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/functions.tsx
|
|
21
|
+
var functions_exports = {};
|
|
22
|
+
__export(functions_exports, {
|
|
23
|
+
identity: () => identity,
|
|
24
|
+
identityArgs: () => identityArgs
|
|
11
25
|
});
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
module.exports = __toCommonJS(functions_exports);
|
|
27
|
+
function identity(t) {
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
function identityArgs(...args) {
|
|
31
|
+
return args;
|
|
14
32
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
expect(identityArgs("a", "b", "c")).toEqual(["a", "b", "c"]);
|
|
20
|
-
expect(identityArgs(null, undefined)).toEqual([null, undefined]);
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
identity,
|
|
36
|
+
identityArgs
|
|
21
37
|
});
|
|
38
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/functions.tsx"],"sourcesContent":["export function identity<T>(t: T): T {\n return t;\n}\nundefined?.test(\"identity\", ({ expect }) => {\n expect(identity(1)).toBe(1);\n expect(identity(\"test\")).toBe(\"test\");\n expect(identity(null)).toBe(null);\n expect(identity(undefined)).toBe(undefined);\n const obj = { a: 1 };\n expect(identity(obj)).toBe(obj);\n});\n\nexport function identityArgs<T extends any[]>(...args: T): T {\n return args;\n}\nundefined?.test(\"identityArgs\", ({ expect }) => {\n expect(identityArgs()).toEqual([]);\n expect(identityArgs(1)).toEqual([1]);\n expect(identityArgs(1, 2, 3)).toEqual([1, 2, 3]);\n expect(identityArgs(\"a\", \"b\", \"c\")).toEqual([\"a\", \"b\", \"c\"]);\n expect(identityArgs(null, undefined)).toEqual([null, undefined]);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,SAAY,GAAS;AACnC,SAAO;AACT;AAUO,SAAS,gBAAiC,MAAY;AAC3D,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
|
|
3
|
+
declare const geoInfoSchema: yup.ObjectSchema<{
|
|
4
|
+
ip: string;
|
|
5
|
+
countryCode: string | null | undefined;
|
|
6
|
+
regionCode: string | null | undefined;
|
|
7
|
+
cityName: string | null | undefined;
|
|
8
|
+
latitude: number | null | undefined;
|
|
9
|
+
longitude: number | null | undefined;
|
|
10
|
+
tzIdentifier: string | null | undefined;
|
|
11
|
+
}, yup.AnyObject, {
|
|
12
|
+
ip: undefined;
|
|
13
|
+
countryCode: undefined;
|
|
14
|
+
regionCode: undefined;
|
|
15
|
+
cityName: undefined;
|
|
16
|
+
latitude: undefined;
|
|
17
|
+
longitude: undefined;
|
|
18
|
+
tzIdentifier: undefined;
|
|
19
|
+
}, "">;
|
|
20
|
+
type GeoInfo = yup.InferType<typeof geoInfoSchema>;
|
|
21
|
+
|
|
22
|
+
export { type GeoInfo, geoInfoSchema };
|
package/dist/utils/geo.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as yup from
|
|
2
|
-
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
|
|
3
|
+
declare const geoInfoSchema: yup.ObjectSchema<{
|
|
3
4
|
ip: string;
|
|
4
5
|
countryCode: string | null | undefined;
|
|
5
6
|
regionCode: string | null | undefined;
|
|
@@ -16,4 +17,6 @@ export declare const geoInfoSchema: yup.ObjectSchema<{
|
|
|
16
17
|
longitude: undefined;
|
|
17
18
|
tzIdentifier: undefined;
|
|
18
19
|
}, "">;
|
|
19
|
-
|
|
20
|
+
type GeoInfo = yup.InferType<typeof geoInfoSchema>;
|
|
21
|
+
|
|
22
|
+
export { type GeoInfo, geoInfoSchema };
|
package/dist/utils/geo.js
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 });
|
|
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/geo.tsx
|
|
21
|
+
var geo_exports = {};
|
|
22
|
+
__export(geo_exports, {
|
|
23
|
+
geoInfoSchema: () => geoInfoSchema
|
|
10
24
|
});
|
|
25
|
+
module.exports = __toCommonJS(geo_exports);
|
|
26
|
+
var import_schema_fields = require("../schema-fields");
|
|
27
|
+
var geoInfoSchema = (0, import_schema_fields.yupObject)({
|
|
28
|
+
ip: (0, import_schema_fields.yupString)().defined(),
|
|
29
|
+
countryCode: (0, import_schema_fields.yupString)().nullable(),
|
|
30
|
+
regionCode: (0, import_schema_fields.yupString)().nullable(),
|
|
31
|
+
cityName: (0, import_schema_fields.yupString)().nullable(),
|
|
32
|
+
latitude: (0, import_schema_fields.yupNumber)().nullable(),
|
|
33
|
+
longitude: (0, import_schema_fields.yupNumber)().nullable(),
|
|
34
|
+
tzIdentifier: (0, import_schema_fields.yupString)().nullable()
|
|
35
|
+
});
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
geoInfoSchema
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=geo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/geo.tsx"],"sourcesContent":["\nimport * as yup from \"yup\";\nimport { yupNumber, yupObject, yupString } from \"../schema-fields\";\n\nexport const geoInfoSchema = yupObject({\n ip: yupString().defined(),\n countryCode: yupString().nullable(),\n regionCode: yupString().nullable(),\n cityName: yupString().nullable(),\n latitude: yupNumber().nullable(),\n longitude: yupNumber().nullable(),\n tzIdentifier: yupString().nullable(),\n});\n\nexport type GeoInfo = yup.InferType<typeof geoInfoSchema>;\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAAgD;AAEzC,IAAM,oBAAgB,gCAAU;AAAA,EACrC,QAAI,gCAAU,EAAE,QAAQ;AAAA,EACxB,iBAAa,gCAAU,EAAE,SAAS;AAAA,EAClC,gBAAY,gCAAU,EAAE,SAAS;AAAA,EACjC,cAAU,gCAAU,EAAE,SAAS;AAAA,EAC/B,cAAU,gCAAU,EAAE,SAAS;AAAA,EAC/B,eAAW,gCAAU,EAAE,SAAS;AAAA,EAChC,kBAAc,gCAAU,EAAE,SAAS;AACrC,CAAC;","names":[]}
|
package/dist/utils/globals.d.ts
CHANGED
package/dist/utils/globals.js
CHANGED
|
@@ -1,17 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
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/globals.tsx
|
|
21
|
+
var globals_exports = {};
|
|
22
|
+
__export(globals_exports, {
|
|
23
|
+
createGlobal: () => createGlobal,
|
|
24
|
+
globalVar: () => globalVar
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(globals_exports);
|
|
27
|
+
var globalVar = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {};
|
|
28
|
+
if (typeof globalThis === "undefined") {
|
|
29
|
+
globalVar.globalThis = globalVar;
|
|
9
30
|
}
|
|
10
|
-
|
|
31
|
+
var stackGlobalsSymbol = Symbol.for("__stack-globals");
|
|
11
32
|
globalVar[stackGlobalsSymbol] ??= {};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
33
|
+
function createGlobal(key, init) {
|
|
34
|
+
if (!globalVar[stackGlobalsSymbol][key]) {
|
|
35
|
+
globalVar[stackGlobalsSymbol][key] = init();
|
|
36
|
+
}
|
|
37
|
+
return globalVar[stackGlobalsSymbol][key];
|
|
17
38
|
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
createGlobal,
|
|
42
|
+
globalVar
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=globals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/globals.tsx"],"sourcesContent":["const globalVar: any =\n typeof globalThis !== 'undefined' ? globalThis :\n typeof global !== 'undefined' ? global :\n typeof window !== 'undefined' ? window :\n typeof self !== 'undefined' ? self :\n {};\nexport {\n globalVar,\n};\n\nif (typeof globalThis === 'undefined') {\n (globalVar as any).globalThis = globalVar;\n}\n\nconst stackGlobalsSymbol = Symbol.for('__stack-globals');\nglobalVar[stackGlobalsSymbol] ??= {};\n\nexport function createGlobal<T>(key: string, init: () => T) {\n if (!globalVar[stackGlobalsSymbol][key]) {\n globalVar[stackGlobalsSymbol][key] = init();\n }\n return globalVar[stackGlobalsSymbol][key] as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,YACJ,OAAO,eAAe,cAAc,aAClC,OAAO,WAAW,cAAc,SAC9B,OAAO,WAAW,cAAc,SAC9B,OAAO,SAAS,cAAc,OAC5B,CAAC;AAKX,IAAI,OAAO,eAAe,aAAa;AACrC,EAAC,UAAkB,aAAa;AAClC;AAEA,IAAM,qBAAqB,OAAO,IAAI,iBAAiB;AACvD,UAAU,kBAAkB,MAAM,CAAC;AAE5B,SAAS,aAAgB,KAAa,MAAe;AAC1D,MAAI,CAAC,UAAU,kBAAkB,EAAE,GAAG,GAAG;AACvC,cAAU,kBAAkB,EAAE,GAAG,IAAI,KAAK;AAAA,EAC5C;AACA,SAAO,UAAU,kBAAkB,EAAE,GAAG;AAC1C;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function sha512(input: Uint8Array | string): Promise<Uint8Array>;
|
|
2
|
+
declare function hashPassword(password: string): Promise<string>;
|
|
3
|
+
declare function comparePassword(password: string, hash: string): Promise<boolean>;
|
|
4
|
+
declare function isPasswordHashValid(hash: string): Promise<boolean>;
|
|
5
|
+
declare function getPasswordHashAlgorithm(hash: string): Promise<"bcrypt" | undefined>;
|
|
6
|
+
|
|
7
|
+
export { comparePassword, getPasswordHashAlgorithm, hashPassword, isPasswordHashValid, sha512 };
|
package/dist/utils/hashes.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
declare function sha512(input: Uint8Array | string): Promise<Uint8Array>;
|
|
2
|
+
declare function hashPassword(password: string): Promise<string>;
|
|
3
|
+
declare function comparePassword(password: string, hash: string): Promise<boolean>;
|
|
4
|
+
declare function isPasswordHashValid(hash: string): Promise<boolean>;
|
|
5
|
+
declare function getPasswordHashAlgorithm(hash: string): Promise<"bcrypt" | undefined>;
|
|
6
|
+
|
|
7
|
+
export { comparePassword, getPasswordHashAlgorithm, hashPassword, isPasswordHashValid, sha512 };
|
package/dist/utils/hashes.js
CHANGED
|
@@ -1,48 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/utils/hashes.tsx
|
|
31
|
+
var hashes_exports = {};
|
|
32
|
+
__export(hashes_exports, {
|
|
33
|
+
comparePassword: () => comparePassword,
|
|
34
|
+
getPasswordHashAlgorithm: () => getPasswordHashAlgorithm,
|
|
35
|
+
hashPassword: () => hashPassword,
|
|
36
|
+
isPasswordHashValid: () => isPasswordHashValid,
|
|
37
|
+
sha512: () => sha512
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(hashes_exports);
|
|
40
|
+
var import_bcrypt = __toESM(require("bcrypt"), 1);
|
|
41
|
+
var import_errors = require("./errors");
|
|
42
|
+
async function sha512(input) {
|
|
43
|
+
const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
44
|
+
return new Uint8Array(await crypto.subtle.digest("SHA-512", bytes));
|
|
6
45
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
46
|
+
async function hashPassword(password) {
|
|
47
|
+
const passwordBytes = new TextEncoder().encode(password);
|
|
48
|
+
if (passwordBytes.length >= 72) {
|
|
49
|
+
throw new import_errors.StackAssertionError(`Password is too long for bcrypt`, { len: passwordBytes.length });
|
|
50
|
+
}
|
|
51
|
+
const salt = await import_bcrypt.default.genSalt(10);
|
|
52
|
+
return await import_bcrypt.default.hash(password, salt);
|
|
14
53
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
54
|
+
async function comparePassword(password, hash) {
|
|
55
|
+
switch (await getPasswordHashAlgorithm(hash)) {
|
|
56
|
+
case "bcrypt": {
|
|
57
|
+
return await import_bcrypt.default.compare(password, hash);
|
|
58
|
+
}
|
|
59
|
+
default: {
|
|
60
|
+
return false;
|
|
23
61
|
}
|
|
62
|
+
}
|
|
24
63
|
}
|
|
25
|
-
|
|
26
|
-
|
|
64
|
+
async function isPasswordHashValid(hash) {
|
|
65
|
+
return !!await getPasswordHashAlgorithm(hash);
|
|
27
66
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return undefined;
|
|
67
|
+
async function getPasswordHashAlgorithm(hash) {
|
|
68
|
+
if (typeof hash !== "string") {
|
|
69
|
+
throw new import_errors.StackAssertionError(`Passed non-string value to getPasswordHashAlgorithm`, { hash });
|
|
70
|
+
}
|
|
71
|
+
if (hash.match(/^\$2[ayb]\$.{56}$/)) {
|
|
72
|
+
try {
|
|
73
|
+
if (import_bcrypt.default.getRounds(hash) > 16) {
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
await import_bcrypt.default.compare("any string", hash);
|
|
77
|
+
return "bcrypt";
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.warn(`Error while checking bcrypt password hash. Assuming the hash is invalid`, e);
|
|
80
|
+
return void 0;
|
|
47
81
|
}
|
|
82
|
+
} else {
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
48
85
|
}
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
comparePassword,
|
|
89
|
+
getPasswordHashAlgorithm,
|
|
90
|
+
hashPassword,
|
|
91
|
+
isPasswordHashValid,
|
|
92
|
+
sha512
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=hashes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/hashes.tsx"],"sourcesContent":["import bcrypt from 'bcrypt';\nimport { StackAssertionError } from './errors';\n\nexport async function sha512(input: Uint8Array | string): Promise<Uint8Array> {\n const bytes = typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n return new Uint8Array(await crypto.subtle.digest(\"SHA-512\", bytes));\n}\n\nexport async function hashPassword(password: string) {\n const passwordBytes = new TextEncoder().encode(password);\n if (passwordBytes.length >= 72) {\n throw new StackAssertionError(`Password is too long for bcrypt`, { len: passwordBytes.length });\n }\n const salt = await bcrypt.genSalt(10);\n return await bcrypt.hash(password, salt);\n}\n\nexport async function comparePassword(password: string, hash: string): Promise<boolean> {\n switch (await getPasswordHashAlgorithm(hash)) {\n case \"bcrypt\": {\n return await bcrypt.compare(password, hash);\n }\n default: {\n return false;\n }\n }\n}\n\nexport async function isPasswordHashValid(hash: string) {\n return !!(await getPasswordHashAlgorithm(hash));\n}\n\nexport async function getPasswordHashAlgorithm(hash: string): Promise<\"bcrypt\" | undefined> {\n if (typeof hash !== \"string\") {\n throw new StackAssertionError(`Passed non-string value to getPasswordHashAlgorithm`, { hash });\n }\n if (hash.match(/^\\$2[ayb]\\$.{56}$/)) {\n try {\n if (bcrypt.getRounds(hash) > 16) {\n return undefined;\n }\n await bcrypt.compare(\"any string\", hash);\n return \"bcrypt\";\n } catch (e) {\n console.warn(`Error while checking bcrypt password hash. Assuming the hash is invalid`, e);\n return undefined;\n }\n } else {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,oBAAoC;AAEpC,eAAsB,OAAO,OAAiD;AAC5E,QAAM,QAAQ,OAAO,UAAU,WAAW,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI;AAC5E,SAAO,IAAI,WAAW,MAAM,OAAO,OAAO,OAAO,WAAW,KAAK,CAAC;AACpE;AAEA,eAAsB,aAAa,UAAkB;AACnD,QAAM,gBAAgB,IAAI,YAAY,EAAE,OAAO,QAAQ;AACvD,MAAI,cAAc,UAAU,IAAI;AAC9B,UAAM,IAAI,kCAAoB,mCAAmC,EAAE,KAAK,cAAc,OAAO,CAAC;AAAA,EAChG;AACA,QAAM,OAAO,MAAM,cAAAA,QAAO,QAAQ,EAAE;AACpC,SAAO,MAAM,cAAAA,QAAO,KAAK,UAAU,IAAI;AACzC;AAEA,eAAsB,gBAAgB,UAAkB,MAAgC;AACtF,UAAQ,MAAM,yBAAyB,IAAI,GAAG;AAAA,IAC5C,KAAK,UAAU;AACb,aAAO,MAAM,cAAAA,QAAO,QAAQ,UAAU,IAAI;AAAA,IAC5C;AAAA,IACA,SAAS;AACP,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,eAAsB,oBAAoB,MAAc;AACtD,SAAO,CAAC,CAAE,MAAM,yBAAyB,IAAI;AAC/C;AAEA,eAAsB,yBAAyB,MAA6C;AAC1F,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,IAAI,kCAAoB,uDAAuD,EAAE,KAAK,CAAC;AAAA,EAC/F;AACA,MAAI,KAAK,MAAM,mBAAmB,GAAG;AACnC,QAAI;AACF,UAAI,cAAAA,QAAO,UAAU,IAAI,IAAI,IAAI;AAC/B,eAAO;AAAA,MACT;AACA,YAAM,cAAAA,QAAO,QAAQ,cAAc,IAAI;AACvC,aAAO;AAAA,IACT,SAAS,GAAG;AACV,cAAQ,KAAK,2EAA2E,CAAC;AACzF,aAAO;AAAA,IACT;AAAA,EACF,OAAO;AACL,WAAO;AAAA,EACT;AACF;","names":["bcrypt"]}
|
package/dist/utils/html.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare function escapeHtml(unsafe: string): string;
|
|
2
|
+
declare function html(strings: TemplateStringsArray, ...values: any[]): string;
|
|
3
|
+
|
|
4
|
+
export { escapeHtml, html };
|
package/dist/utils/html.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 });
|
|
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/html.tsx
|
|
21
|
+
var html_exports = {};
|
|
22
|
+
__export(html_exports, {
|
|
23
|
+
escapeHtml: () => escapeHtml,
|
|
24
|
+
html: () => html
|
|
22
25
|
});
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
module.exports = __toCommonJS(html_exports);
|
|
27
|
+
var import_strings = require("./strings");
|
|
28
|
+
function escapeHtml(unsafe) {
|
|
29
|
+
return `${unsafe}`.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
30
|
+
}
|
|
31
|
+
function html(strings, ...values) {
|
|
32
|
+
return (0, import_strings.templateIdentity)(strings, ...values.map((v) => escapeHtml(`${v}`)));
|
|
25
33
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
expect(html `Hello, ${"world"}!`).toBe("Hello, world!");
|
|
31
|
-
// Test with number interpolation
|
|
32
|
-
expect(html `Count: ${42}`).toBe("Count: 42");
|
|
33
|
-
// Test with HTML special characters in interpolated values
|
|
34
|
-
expect(html `<div>${"<script>"}</div>`).toBe("<div><script></div>");
|
|
35
|
-
// Test with multiple interpolations
|
|
36
|
-
expect(html `${1} + ${2} = ${"<3"}`).toBe("1 + 2 = <3");
|
|
37
|
-
// Test with object interpolation
|
|
38
|
-
const obj = { toString: () => "<object>" };
|
|
39
|
-
expect(html `Object: ${obj}`).toBe("Object: <object>");
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
escapeHtml,
|
|
37
|
+
html
|
|
40
38
|
});
|
|
39
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/html.tsx"],"sourcesContent":["import { templateIdentity } from \"./strings\";\n\nexport function escapeHtml(unsafe: string): string {\n return `${unsafe}`\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\nundefined?.test(\"escapeHtml\", ({ expect }) => {\n // Test with empty string\n expect(escapeHtml(\"\")).toBe(\"\");\n\n // Test with string without special characters\n expect(escapeHtml(\"hello world\")).toBe(\"hello world\");\n\n // Test with special characters\n expect(escapeHtml(\"<div>\")).toBe(\"<div>\");\n expect(escapeHtml(\"a & b\")).toBe(\"a & b\");\n expect(escapeHtml('a \"quoted\" string')).toBe(\"a "quoted" string\");\n expect(escapeHtml(\"it's a test\")).toBe(\"it's a test\");\n\n // Test with multiple special characters\n expect(escapeHtml(\"<a href=\\\"test\\\">It's a link</a>\")).toBe(\n \"<a href="test">It's a link</a>\"\n );\n});\n\nexport function html(strings: TemplateStringsArray, ...values: any[]): string {\n return templateIdentity(strings, ...values.map(v => escapeHtml(`${v}`)));\n}\nundefined?.test(\"html\", ({ expect }) => {\n // Test with no interpolation\n expect(html`simple string`).toBe(\"simple string\");\n\n // Test with string interpolation\n expect(html`Hello, ${\"world\"}!`).toBe(\"Hello, world!\");\n\n // Test with number interpolation\n expect(html`Count: ${42}`).toBe(\"Count: 42\");\n\n // Test with HTML special characters in interpolated values\n expect(html`<div>${\"<script>\"}</div>`).toBe(\"<div><script></div>\");\n\n // Test with multiple interpolations\n expect(html`${1} + ${2} = ${\"<3\"}`).toBe(\"1 + 2 = <3\");\n\n // Test with object interpolation\n const obj = { toString: () => \"<object>\" };\n expect(html`Object: ${obj}`).toBe(\"Object: <object>\");\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiC;AAE1B,SAAS,WAAW,QAAwB;AACjD,SAAO,GAAG,MAAM,GACb,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ,EACtB,QAAQ,MAAM,QAAQ;AAC3B;AAoBO,SAAS,KAAK,YAAkC,QAAuB;AAC5E,aAAO,iCAAiB,SAAS,GAAG,OAAO,IAAI,OAAK,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC;AACzE;","names":[]}
|