@stackframe/stack-shared 2.8.8 → 2.8.11
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 +14 -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 +729 -0
- package/dist/config/schema.d.ts +59 -51
- package/dist/config/schema.js +232 -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 +201 -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 +180 -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 +1238 -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 +177 -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 +295 -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 +20 -12
- 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 +627 -0
- package/dist/interface/crud/projects.d.ts +43 -51
- package/dist/interface/crud/projects.js +210 -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 +447 -0
- package/dist/known-errors.d.ts +15 -9
- package/dist/known-errors.js +1104 -562
- 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 +69 -0
- package/dist/utils/objects.d.ts +37 -32
- package/dist/utils/objects.js +224 -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 +300 -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/maps.js
CHANGED
|
@@ -1,345 +1,209 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// We can't easily test garbage collection in this environment,
|
|
28
|
-
// but we can verify the basic functionality works
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* A WeakMap-like object that can be iterated over.
|
|
32
|
-
*
|
|
33
|
-
* Note that it relies on WeakRef, and always falls back to the regular Map behavior (ie. no GC) in browsers that don't support it.
|
|
34
|
-
*/
|
|
35
|
-
export class IterableWeakMap {
|
|
36
|
-
constructor(entries) {
|
|
37
|
-
this[_a] = "IterableWeakMap";
|
|
38
|
-
const mappedEntries = entries?.map((e) => [e[0], { value: e[1], keyRef: new WeakRefIfAvailable(e[0]) }]);
|
|
39
|
-
this._weakMap = new WeakMap(mappedEntries ?? []);
|
|
40
|
-
this._keyRefs = new Set(mappedEntries?.map((e) => e[1].keyRef) ?? []);
|
|
41
|
-
}
|
|
42
|
-
get(key) {
|
|
43
|
-
return this._weakMap.get(key)?.value;
|
|
44
|
-
}
|
|
45
|
-
set(key, value) {
|
|
46
|
-
const existing = this._weakMap.get(key);
|
|
47
|
-
const updated = { value, keyRef: existing?.keyRef ?? new WeakRefIfAvailable(key) };
|
|
48
|
-
this._weakMap.set(key, updated);
|
|
49
|
-
this._keyRefs.add(updated.keyRef);
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
delete(key) {
|
|
53
|
-
const res = this._weakMap.get(key);
|
|
54
|
-
if (res) {
|
|
55
|
-
this._weakMap.delete(key);
|
|
56
|
-
this._keyRefs.delete(res.keyRef);
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
has(key) {
|
|
62
|
-
return this._weakMap.has(key) && this._keyRefs.has(this._weakMap.get(key).keyRef);
|
|
63
|
-
}
|
|
64
|
-
*[Symbol.iterator]() {
|
|
65
|
-
for (const keyRef of this._keyRefs) {
|
|
66
|
-
const key = keyRef.deref();
|
|
67
|
-
const existing = key ? this._weakMap.get(key) : undefined;
|
|
68
|
-
if (!key) {
|
|
69
|
-
// This can happen if the key was GCed. Remove it so the next iteration is faster.
|
|
70
|
-
this._keyRefs.delete(keyRef);
|
|
71
|
-
}
|
|
72
|
-
else if (existing) {
|
|
73
|
-
yield [key, existing.value];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
_a = Symbol.toStringTag;
|
|
79
|
-
import.meta.vitest?.test("IterableWeakMap", ({ expect }) => {
|
|
80
|
-
// Test basic functionality
|
|
81
|
-
const map = new IterableWeakMap();
|
|
82
|
-
// Create object keys
|
|
83
|
-
const obj1 = { id: 1 };
|
|
84
|
-
const obj2 = { id: 2 };
|
|
85
|
-
// Test set and get
|
|
86
|
-
map.set(obj1, "value1");
|
|
87
|
-
expect(map.get(obj1)).toBe("value1");
|
|
88
|
-
// Test has
|
|
89
|
-
expect(map.has(obj1)).toBe(true);
|
|
90
|
-
expect(map.has(obj2)).toBe(false);
|
|
91
|
-
expect(map.has({ id: 1 })).toBe(false); // Different object with same content
|
|
92
|
-
// Test with multiple keys
|
|
93
|
-
map.set(obj2, "value2");
|
|
94
|
-
expect(map.get(obj2)).toBe("value2");
|
|
95
|
-
expect(map.get(obj1)).toBe("value1"); // Original still exists
|
|
96
|
-
// Test delete
|
|
97
|
-
expect(map.delete(obj1)).toBe(true);
|
|
98
|
-
expect(map.has(obj1)).toBe(false);
|
|
99
|
-
expect(map.get(obj1)).toBeUndefined();
|
|
100
|
-
expect(map.has(obj2)).toBe(true); // Other key still exists
|
|
101
|
-
// Test delete non-existent key
|
|
102
|
-
expect(map.delete({ id: 3 })).toBe(false);
|
|
103
|
-
// Test iteration
|
|
104
|
-
const iterMap = new IterableWeakMap();
|
|
105
|
-
const iterObj1 = { id: 1 };
|
|
106
|
-
const iterObj2 = { id: 2 };
|
|
107
|
-
const iterObj3 = { id: 3 };
|
|
108
|
-
iterMap.set(iterObj1, 1);
|
|
109
|
-
iterMap.set(iterObj2, 2);
|
|
110
|
-
iterMap.set(iterObj3, 3);
|
|
111
|
-
const entries = Array.from(iterMap);
|
|
112
|
-
expect(entries.length).toBe(3);
|
|
113
|
-
// Find entries by their values since we can't directly compare objects in the array
|
|
114
|
-
const values = entries.map(entry => entry[1]);
|
|
115
|
-
expect(values).toContain(1);
|
|
116
|
-
expect(values).toContain(2);
|
|
117
|
-
expect(values).toContain(3);
|
|
118
|
-
// Test constructor with entries
|
|
119
|
-
const initialEntries = [
|
|
120
|
-
[{ id: 4 }, "initial1"],
|
|
121
|
-
[{ id: 5 }, "initial2"]
|
|
122
|
-
];
|
|
123
|
-
const mapWithEntries = new IterableWeakMap(initialEntries);
|
|
124
|
-
// We can't directly access the initial entries since they're different object references
|
|
125
|
-
// But we can verify the map has the correct number of entries
|
|
126
|
-
const entriesFromConstructor = Array.from(mapWithEntries);
|
|
127
|
-
expect(entriesFromConstructor.length).toBe(2);
|
|
128
|
-
});
|
|
129
|
-
/**
|
|
130
|
-
* A map that is a IterableWeakMap for object keys and a regular Map for primitive keys. Also provides iteration over both
|
|
131
|
-
* object and primitive keys.
|
|
132
|
-
*
|
|
133
|
-
* Note that, just like IterableWeakMap, older browsers without support for WeakRef will use a regular Map for object keys.
|
|
134
|
-
*/
|
|
135
|
-
export class MaybeWeakMap {
|
|
136
|
-
constructor(entries) {
|
|
137
|
-
this[_b] = "MaybeWeakMap";
|
|
138
|
-
const entriesArray = [...entries ?? []];
|
|
139
|
-
this._primitiveMap = new Map(entriesArray.filter((e) => !this._isAllowedInWeakMap(e[0])));
|
|
140
|
-
this._weakMap = new IterableWeakMap(entriesArray.filter((e) => this._isAllowedInWeakMap(e[0])));
|
|
141
|
-
}
|
|
142
|
-
_isAllowedInWeakMap(key) {
|
|
143
|
-
return (typeof key === "object" && key !== null) || (typeof key === "symbol" && Symbol.keyFor(key) === undefined);
|
|
144
|
-
}
|
|
145
|
-
get(key) {
|
|
146
|
-
if (this._isAllowedInWeakMap(key)) {
|
|
147
|
-
return this._weakMap.get(key);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
return this._primitiveMap.get(key);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
set(key, value) {
|
|
154
|
-
if (this._isAllowedInWeakMap(key)) {
|
|
155
|
-
this._weakMap.set(key, value);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this._primitiveMap.set(key, value);
|
|
159
|
-
}
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
delete(key) {
|
|
163
|
-
if (this._isAllowedInWeakMap(key)) {
|
|
164
|
-
return this._weakMap.delete(key);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
return this._primitiveMap.delete(key);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
has(key) {
|
|
171
|
-
if (this._isAllowedInWeakMap(key)) {
|
|
172
|
-
return this._weakMap.has(key);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
return this._primitiveMap.has(key);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
*[Symbol.iterator]() {
|
|
179
|
-
yield* this._primitiveMap;
|
|
180
|
-
yield* this._weakMap;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
_b = Symbol.toStringTag;
|
|
184
|
-
import.meta.vitest?.test("MaybeWeakMap", ({ expect }) => {
|
|
185
|
-
// Test with primitive keys
|
|
186
|
-
const map = new MaybeWeakMap();
|
|
187
|
-
// Test with string keys
|
|
188
|
-
map.set("key1", 1);
|
|
189
|
-
map.set("key2", 2);
|
|
190
|
-
expect(map.get("key1")).toBe(1);
|
|
191
|
-
expect(map.get("key2")).toBe(2);
|
|
192
|
-
expect(map.has("key1")).toBe(true);
|
|
193
|
-
expect(map.has("nonexistent")).toBe(false);
|
|
194
|
-
// Test with object keys
|
|
195
|
-
const obj1 = { id: 1 };
|
|
196
|
-
const obj2 = { id: 2 };
|
|
197
|
-
map.set(obj1, 3);
|
|
198
|
-
map.set(obj2, 4);
|
|
199
|
-
expect(map.get(obj1)).toBe(3);
|
|
200
|
-
expect(map.get(obj2)).toBe(4);
|
|
201
|
-
expect(map.has(obj1)).toBe(true);
|
|
202
|
-
// Test delete with primitive key
|
|
203
|
-
expect(map.delete("key1")).toBe(true);
|
|
204
|
-
expect(map.has("key1")).toBe(false);
|
|
205
|
-
expect(map.delete("nonexistent")).toBe(false);
|
|
206
|
-
// Test delete with object key
|
|
207
|
-
expect(map.delete(obj1)).toBe(true);
|
|
208
|
-
expect(map.has(obj1)).toBe(false);
|
|
209
|
-
// Test iteration
|
|
210
|
-
const entries = Array.from(map);
|
|
211
|
-
expect(entries.length).toBe(2);
|
|
212
|
-
expect(entries).toContainEqual(["key2", 2]);
|
|
213
|
-
expect(entries).toContainEqual([obj2, 4]);
|
|
214
|
-
// Test constructor with entries
|
|
215
|
-
const initialEntries = [
|
|
216
|
-
["initial1", 10],
|
|
217
|
-
[{ id: 3 }, 20]
|
|
218
|
-
];
|
|
219
|
-
const mapWithEntries = new MaybeWeakMap(initialEntries);
|
|
220
|
-
expect(mapWithEntries.get("initial1")).toBe(10);
|
|
221
|
-
expect(mapWithEntries.get(initialEntries[1][0])).toBe(20);
|
|
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/maps.tsx
|
|
21
|
+
var maps_exports = {};
|
|
22
|
+
__export(maps_exports, {
|
|
23
|
+
DependenciesMap: () => DependenciesMap,
|
|
24
|
+
IterableWeakMap: () => IterableWeakMap,
|
|
25
|
+
MaybeWeakMap: () => MaybeWeakMap,
|
|
26
|
+
WeakRefIfAvailable: () => WeakRefIfAvailable
|
|
222
27
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
28
|
+
module.exports = __toCommonJS(maps_exports);
|
|
29
|
+
var import_results = require("./results");
|
|
30
|
+
var WeakRefIfAvailable = class {
|
|
31
|
+
constructor(value) {
|
|
32
|
+
if (typeof WeakRef === "undefined") {
|
|
33
|
+
this._ref = { deref: () => value };
|
|
34
|
+
} else {
|
|
35
|
+
this._ref = new WeakRef(value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
deref() {
|
|
39
|
+
return this._ref.deref();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var _a, _b;
|
|
43
|
+
var IterableWeakMap = class {
|
|
44
|
+
constructor(entries) {
|
|
45
|
+
this[_a] = "IterableWeakMap";
|
|
46
|
+
const mappedEntries = entries?.map((e) => [e[0], { value: e[1], keyRef: new WeakRefIfAvailable(e[0]) }]);
|
|
47
|
+
this._weakMap = new WeakMap(mappedEntries ?? []);
|
|
48
|
+
this._keyRefs = new Set(mappedEntries?.map((e) => e[1].keyRef) ?? []);
|
|
49
|
+
}
|
|
50
|
+
get(key) {
|
|
51
|
+
return this._weakMap.get(key)?.value;
|
|
52
|
+
}
|
|
53
|
+
set(key, value) {
|
|
54
|
+
const existing = this._weakMap.get(key);
|
|
55
|
+
const updated = { value, keyRef: existing?.keyRef ?? new WeakRefIfAvailable(key) };
|
|
56
|
+
this._weakMap.set(key, updated);
|
|
57
|
+
this._keyRefs.add(updated.keyRef);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
delete(key) {
|
|
61
|
+
const res = this._weakMap.get(key);
|
|
62
|
+
if (res) {
|
|
63
|
+
this._weakMap.delete(key);
|
|
64
|
+
this._keyRefs.delete(res.keyRef);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
has(key) {
|
|
70
|
+
return this._weakMap.has(key) && this._keyRefs.has(this._weakMap.get(key).keyRef);
|
|
71
|
+
}
|
|
72
|
+
*[(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
|
|
73
|
+
for (const keyRef of this._keyRefs) {
|
|
74
|
+
const key = keyRef.deref();
|
|
75
|
+
const existing = key ? this._weakMap.get(key) : void 0;
|
|
76
|
+
if (!key) {
|
|
77
|
+
this._keyRefs.delete(keyRef);
|
|
78
|
+
} else if (existing) {
|
|
79
|
+
yield [key, existing.value];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var _a2, _b2;
|
|
85
|
+
var MaybeWeakMap = class {
|
|
86
|
+
constructor(entries) {
|
|
87
|
+
this[_a2] = "MaybeWeakMap";
|
|
88
|
+
const entriesArray = [...entries ?? []];
|
|
89
|
+
this._primitiveMap = new Map(entriesArray.filter((e) => !this._isAllowedInWeakMap(e[0])));
|
|
90
|
+
this._weakMap = new IterableWeakMap(entriesArray.filter((e) => this._isAllowedInWeakMap(e[0])));
|
|
91
|
+
}
|
|
92
|
+
_isAllowedInWeakMap(key) {
|
|
93
|
+
return typeof key === "object" && key !== null || typeof key === "symbol" && Symbol.keyFor(key) === void 0;
|
|
94
|
+
}
|
|
95
|
+
get(key) {
|
|
96
|
+
if (this._isAllowedInWeakMap(key)) {
|
|
97
|
+
return this._weakMap.get(key);
|
|
98
|
+
} else {
|
|
99
|
+
return this._primitiveMap.get(key);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
set(key, value) {
|
|
103
|
+
if (this._isAllowedInWeakMap(key)) {
|
|
104
|
+
this._weakMap.set(key, value);
|
|
105
|
+
} else {
|
|
106
|
+
this._primitiveMap.set(key, value);
|
|
107
|
+
}
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
delete(key) {
|
|
111
|
+
if (this._isAllowedInWeakMap(key)) {
|
|
112
|
+
return this._weakMap.delete(key);
|
|
113
|
+
} else {
|
|
114
|
+
return this._primitiveMap.delete(key);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
has(key) {
|
|
118
|
+
if (this._isAllowedInWeakMap(key)) {
|
|
119
|
+
return this._weakMap.has(key);
|
|
120
|
+
} else {
|
|
121
|
+
return this._primitiveMap.has(key);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
*[(_b2 = Symbol.iterator, _a2 = Symbol.toStringTag, _b2)]() {
|
|
125
|
+
yield* this._primitiveMap;
|
|
126
|
+
yield* this._weakMap;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var _a3, _b3;
|
|
130
|
+
var DependenciesMap = class {
|
|
131
|
+
constructor() {
|
|
132
|
+
this._inner = { map: new MaybeWeakMap(), hasValue: false, value: void 0 };
|
|
133
|
+
this[_a3] = "DependenciesMap";
|
|
134
|
+
}
|
|
135
|
+
_valueToResult(inner) {
|
|
136
|
+
if (inner.hasValue) {
|
|
137
|
+
return import_results.Result.ok(inner.value);
|
|
138
|
+
} else {
|
|
139
|
+
return import_results.Result.error(void 0);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
_unwrapFromInner(dependencies, inner) {
|
|
143
|
+
if (dependencies.length === 0) {
|
|
144
|
+
return this._valueToResult(inner);
|
|
145
|
+
} else {
|
|
146
|
+
const [key, ...rest] = dependencies;
|
|
147
|
+
const newInner = inner.map.get(key);
|
|
148
|
+
if (!newInner) {
|
|
149
|
+
return import_results.Result.error(void 0);
|
|
150
|
+
}
|
|
151
|
+
return this._unwrapFromInner(rest, newInner);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
_setInInner(dependencies, value, inner) {
|
|
155
|
+
if (dependencies.length === 0) {
|
|
156
|
+
const res = this._valueToResult(inner);
|
|
157
|
+
if (value.status === "ok") {
|
|
158
|
+
inner.hasValue = true;
|
|
159
|
+
inner.value = value.data;
|
|
160
|
+
} else {
|
|
161
|
+
inner.hasValue = false;
|
|
162
|
+
inner.value = void 0;
|
|
163
|
+
}
|
|
164
|
+
return res;
|
|
165
|
+
} else {
|
|
166
|
+
const [key, ...rest] = dependencies;
|
|
167
|
+
let newInner = inner.map.get(key);
|
|
168
|
+
if (!newInner) {
|
|
169
|
+
inner.map.set(key, newInner = { map: new MaybeWeakMap(), hasValue: false, value: void 0 });
|
|
170
|
+
}
|
|
171
|
+
return this._setInInner(rest, value, newInner);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
*_iterateInner(dependencies, inner) {
|
|
175
|
+
if (inner.hasValue) {
|
|
176
|
+
yield [dependencies, inner.value];
|
|
177
|
+
}
|
|
178
|
+
for (const [key, value] of inner.map) {
|
|
179
|
+
yield* this._iterateInner([...dependencies, key], value);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
get(dependencies) {
|
|
183
|
+
return import_results.Result.or(this._unwrapFromInner(dependencies, this._inner), void 0);
|
|
184
|
+
}
|
|
185
|
+
set(dependencies, value) {
|
|
186
|
+
this._setInInner(dependencies, import_results.Result.ok(value), this._inner);
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
delete(dependencies) {
|
|
190
|
+
return this._setInInner(dependencies, import_results.Result.error(void 0), this._inner).status === "ok";
|
|
191
|
+
}
|
|
192
|
+
has(dependencies) {
|
|
193
|
+
return this._unwrapFromInner(dependencies, this._inner).status === "ok";
|
|
194
|
+
}
|
|
195
|
+
clear() {
|
|
196
|
+
this._inner = { map: new MaybeWeakMap(), hasValue: false, value: void 0 };
|
|
197
|
+
}
|
|
198
|
+
*[(_b3 = Symbol.iterator, _a3 = Symbol.toStringTag, _b3)]() {
|
|
199
|
+
yield* this._iterateInner([], this._inner);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
203
|
+
0 && (module.exports = {
|
|
204
|
+
DependenciesMap,
|
|
205
|
+
IterableWeakMap,
|
|
206
|
+
MaybeWeakMap,
|
|
207
|
+
WeakRefIfAvailable
|
|
345
208
|
});
|
|
209
|
+
//# sourceMappingURL=maps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/maps.tsx"],"sourcesContent":["import { Result } from \"./results\";\n\nexport class WeakRefIfAvailable<T extends object> {\n private readonly _ref: { deref: () => T | undefined };\n\n constructor(value: T) {\n if (typeof WeakRef === \"undefined\") {\n this._ref = { deref: () => value };\n } else {\n this._ref = new WeakRef<T>(value);\n }\n }\n\n deref(): T | undefined {\n return this._ref.deref();\n }\n}\nundefined?.test(\"WeakRefIfAvailable\", ({ expect }) => {\n // Test with an object\n const obj = { id: 1, name: \"test\" };\n const weakRef = new WeakRefIfAvailable(obj);\n\n // Test deref returns the original object\n expect(weakRef.deref()).toBe(obj);\n\n // Test with a different object\n const obj2 = { id: 2, name: \"test2\" };\n const weakRef2 = new WeakRefIfAvailable(obj2);\n expect(weakRef2.deref()).toBe(obj2);\n expect(weakRef2.deref()).not.toBe(obj);\n\n // We can't easily test garbage collection in this environment,\n // but we can verify the basic functionality works\n});\n\n\n/**\n * A WeakMap-like object that can be iterated over.\n *\n * Note that it relies on WeakRef, and always falls back to the regular Map behavior (ie. no GC) in browsers that don't support it.\n */\nexport class IterableWeakMap<K extends object, V> {\n private readonly _weakMap: WeakMap<K & WeakKey, { value: V, keyRef: WeakRefIfAvailable<K & WeakKey> }>;\n private readonly _keyRefs: Set<WeakRefIfAvailable<K & WeakKey>>;\n\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n const mappedEntries = entries?.map((e) => [e[0], { value: e[1], keyRef: new WeakRefIfAvailable(e[0]) }] as const);\n this._weakMap = new WeakMap(mappedEntries ?? []);\n this._keyRefs = new Set(mappedEntries?.map((e) => e[1].keyRef) ?? []);\n }\n\n get(key: K): V | undefined {\n return this._weakMap.get(key)?.value;\n }\n\n set(key: K, value: V): this {\n const existing = this._weakMap.get(key);\n const updated = { value, keyRef: existing?.keyRef ?? new WeakRefIfAvailable(key) };\n this._weakMap.set(key, updated);\n this._keyRefs.add(updated.keyRef);\n return this;\n }\n\n delete(key: K): boolean {\n const res = this._weakMap.get(key);\n if (res) {\n this._weakMap.delete(key);\n this._keyRefs.delete(res.keyRef);\n return true;\n }\n return false;\n }\n\n has(key: K): boolean {\n return this._weakMap.has(key) && this._keyRefs.has(this._weakMap.get(key)!.keyRef);\n }\n\n *[Symbol.iterator](): IterableIterator<[K, V]> {\n for (const keyRef of this._keyRefs) {\n const key = keyRef.deref();\n const existing = key ? this._weakMap.get(key) : undefined;\n if (!key) {\n // This can happen if the key was GCed. Remove it so the next iteration is faster.\n this._keyRefs.delete(keyRef);\n } else if (existing) {\n yield [key, existing.value];\n }\n }\n }\n\n [Symbol.toStringTag] = \"IterableWeakMap\";\n}\nundefined?.test(\"IterableWeakMap\", ({ expect }) => {\n // Test basic functionality\n const map = new IterableWeakMap<{ id: number }, string>();\n\n // Create object keys\n const obj1 = { id: 1 };\n const obj2 = { id: 2 };\n\n // Test set and get\n map.set(obj1, \"value1\");\n expect(map.get(obj1)).toBe(\"value1\");\n\n // Test has\n expect(map.has(obj1)).toBe(true);\n expect(map.has(obj2)).toBe(false);\n expect(map.has({ id: 1 })).toBe(false); // Different object with same content\n\n // Test with multiple keys\n map.set(obj2, \"value2\");\n expect(map.get(obj2)).toBe(\"value2\");\n expect(map.get(obj1)).toBe(\"value1\"); // Original still exists\n\n // Test delete\n expect(map.delete(obj1)).toBe(true);\n expect(map.has(obj1)).toBe(false);\n expect(map.get(obj1)).toBeUndefined();\n expect(map.has(obj2)).toBe(true); // Other key still exists\n\n // Test delete non-existent key\n expect(map.delete({ id: 3 })).toBe(false);\n\n // Test iteration\n const iterMap = new IterableWeakMap<{ id: number }, number>();\n const iterObj1 = { id: 1 };\n const iterObj2 = { id: 2 };\n const iterObj3 = { id: 3 };\n\n iterMap.set(iterObj1, 1);\n iterMap.set(iterObj2, 2);\n iterMap.set(iterObj3, 3);\n\n const entries = Array.from(iterMap);\n expect(entries.length).toBe(3);\n\n // Find entries by their values since we can't directly compare objects in the array\n const values = entries.map(entry => entry[1]);\n expect(values).toContain(1);\n expect(values).toContain(2);\n expect(values).toContain(3);\n\n // Test constructor with entries\n const initialEntries: [{ id: number }, string][] = [\n [{ id: 4 }, \"initial1\"],\n [{ id: 5 }, \"initial2\"]\n ];\n const mapWithEntries = new IterableWeakMap(initialEntries);\n\n // We can't directly access the initial entries since they're different object references\n // But we can verify the map has the correct number of entries\n const entriesFromConstructor = Array.from(mapWithEntries);\n expect(entriesFromConstructor.length).toBe(2);\n});\n\n/**\n * A map that is a IterableWeakMap for object keys and a regular Map for primitive keys. Also provides iteration over both\n * object and primitive keys.\n *\n * Note that, just like IterableWeakMap, older browsers without support for WeakRef will use a regular Map for object keys.\n */\nexport class MaybeWeakMap<K, V> {\n private readonly _primitiveMap: Map<K, V>;\n private readonly _weakMap: IterableWeakMap<K & WeakKey, V>;\n\n constructor(entries?: readonly (readonly [K, V])[] | null) {\n const entriesArray = [...entries ?? []];\n this._primitiveMap = new Map(entriesArray.filter((e) => !this._isAllowedInWeakMap(e[0])));\n this._weakMap = new IterableWeakMap(entriesArray.filter((e): e is [K & WeakKey, V] => this._isAllowedInWeakMap(e[0])));\n }\n\n private _isAllowedInWeakMap(key: K): key is K & WeakKey {\n return (typeof key === \"object\" && key !== null) || (typeof key === \"symbol\" && Symbol.keyFor(key) === undefined);\n }\n\n get(key: K): V | undefined {\n if (this._isAllowedInWeakMap(key)) {\n return this._weakMap.get(key);\n } else {\n return this._primitiveMap.get(key);\n }\n }\n\n set(key: K, value: V): this {\n if (this._isAllowedInWeakMap(key)) {\n this._weakMap.set(key, value);\n } else {\n this._primitiveMap.set(key, value);\n }\n return this;\n }\n\n delete(key: K): boolean {\n if (this._isAllowedInWeakMap(key)) {\n return this._weakMap.delete(key);\n } else {\n return this._primitiveMap.delete(key);\n }\n }\n\n has(key: K): boolean {\n if (this._isAllowedInWeakMap(key)) {\n return this._weakMap.has(key);\n } else {\n return this._primitiveMap.has(key);\n }\n }\n\n *[Symbol.iterator](): IterableIterator<[K, V]> {\n yield* this._primitiveMap;\n yield* this._weakMap;\n }\n\n [Symbol.toStringTag] = \"MaybeWeakMap\";\n}\nundefined?.test(\"MaybeWeakMap\", ({ expect }) => {\n // Test with primitive keys\n const map = new MaybeWeakMap<string | object, number>();\n\n // Test with string keys\n map.set(\"key1\", 1);\n map.set(\"key2\", 2);\n expect(map.get(\"key1\")).toBe(1);\n expect(map.get(\"key2\")).toBe(2);\n expect(map.has(\"key1\")).toBe(true);\n expect(map.has(\"nonexistent\")).toBe(false);\n\n // Test with object keys\n const obj1 = { id: 1 };\n const obj2 = { id: 2 };\n map.set(obj1, 3);\n map.set(obj2, 4);\n expect(map.get(obj1)).toBe(3);\n expect(map.get(obj2)).toBe(4);\n expect(map.has(obj1)).toBe(true);\n\n // Test delete with primitive key\n expect(map.delete(\"key1\")).toBe(true);\n expect(map.has(\"key1\")).toBe(false);\n expect(map.delete(\"nonexistent\")).toBe(false);\n\n // Test delete with object key\n expect(map.delete(obj1)).toBe(true);\n expect(map.has(obj1)).toBe(false);\n\n // Test iteration\n const entries = Array.from(map);\n expect(entries.length).toBe(2);\n expect(entries).toContainEqual([\"key2\", 2]);\n expect(entries).toContainEqual([obj2, 4]);\n\n // Test constructor with entries\n const initialEntries: [string | object, number][] = [\n [\"initial1\", 10],\n [{ id: 3 }, 20]\n ];\n const mapWithEntries = new MaybeWeakMap(initialEntries);\n expect(mapWithEntries.get(\"initial1\")).toBe(10);\n expect(mapWithEntries.get(initialEntries[1][0])).toBe(20);\n});\n\n\ntype DependenciesMapInner<V> = (\n & { map: MaybeWeakMap<unknown, DependenciesMapInner<V>> }\n & (\n | { hasValue: true, value: V }\n | { hasValue: false, value: undefined }\n )\n);\n\n/**\n * A map that stores values indexed by an array of keys. If the keys are objects and the environment supports WeakRefs,\n * they are stored in a WeakMap.\n */\nexport class DependenciesMap<K extends any[], V> {\n private _inner: DependenciesMapInner<V> = { map: new MaybeWeakMap(), hasValue: false, value: undefined };\n\n private _valueToResult(inner: DependenciesMapInner<V>): Result<V, void> {\n if (inner.hasValue) {\n return Result.ok(inner.value);\n } else {\n return Result.error(undefined);\n }\n }\n\n\n private _unwrapFromInner(dependencies: any[], inner: DependenciesMapInner<V>): Result<V, void> {\n if ((dependencies.length === 0)) {\n return this._valueToResult(inner);\n } else {\n const [key, ...rest] = dependencies;\n const newInner = inner.map.get(key);\n if (!newInner) {\n return Result.error(undefined);\n }\n return this._unwrapFromInner(rest, newInner);\n }\n }\n\n private _setInInner(dependencies: any[], value: Result<V, void>, inner: DependenciesMapInner<V>): Result<V, void> {\n if (dependencies.length === 0) {\n const res = this._valueToResult(inner);\n if (value.status === \"ok\") {\n inner.hasValue = true;\n inner.value = value.data;\n } else {\n inner.hasValue = false;\n inner.value = undefined;\n }\n return res;\n } else {\n const [key, ...rest] = dependencies;\n let newInner = inner.map.get(key);\n if (!newInner) {\n inner.map.set(key, newInner = { map: new MaybeWeakMap(), hasValue: false, value: undefined });\n }\n return this._setInInner(rest, value, newInner);\n }\n }\n\n private *_iterateInner(dependencies: any[], inner: DependenciesMapInner<V>): IterableIterator<[K, V]> {\n if (inner.hasValue) {\n yield [dependencies as K, inner.value];\n }\n for (const [key, value] of inner.map) {\n yield* this._iterateInner([...dependencies, key], value);\n }\n }\n\n get(dependencies: K): V | undefined {\n return Result.or(this._unwrapFromInner(dependencies, this._inner), undefined);\n }\n\n set(dependencies: K, value: V): this {\n this._setInInner(dependencies, Result.ok(value), this._inner);\n return this;\n }\n\n delete(dependencies: K): boolean {\n return this._setInInner(dependencies, Result.error(undefined), this._inner).status === \"ok\";\n }\n\n has(dependencies: K): boolean {\n return this._unwrapFromInner(dependencies, this._inner).status === \"ok\";\n }\n\n clear(): void {\n this._inner = { map: new MaybeWeakMap(), hasValue: false, value: undefined };\n }\n\n *[Symbol.iterator](): IterableIterator<[K, V]> {\n yield* this._iterateInner([], this._inner);\n }\n\n [Symbol.toStringTag] = \"DependenciesMap\";\n}\nundefined?.test(\"DependenciesMap\", ({ expect }) => {\n // Test basic functionality\n const map = new DependenciesMap<[string, number], string>();\n\n // Test set and get\n map.set([\"key\", 1], \"value1\");\n expect(map.get([\"key\", 1])).toBe(\"value1\");\n\n // Test has\n expect(map.has([\"key\", 1])).toBe(true);\n expect(map.has([\"key\", 2])).toBe(false);\n\n // Test with different dependencies\n map.set([\"key\", 2], \"value2\");\n expect(map.get([\"key\", 2])).toBe(\"value2\");\n expect(map.get([\"key\", 1])).toBe(\"value1\"); // Original still exists\n\n // Test delete\n expect(map.delete([\"key\", 1])).toBe(true);\n expect(map.has([\"key\", 1])).toBe(false);\n expect(map.get([\"key\", 1])).toBeUndefined();\n expect(map.has([\"key\", 2])).toBe(true); // Other key still exists\n\n // Test delete non-existent key\n expect(map.delete([\"nonexistent\", 1])).toBe(false);\n\n // Test clear\n map.clear();\n expect(map.has([\"key\", 2])).toBe(false);\n\n // Test with object keys\n const objMap = new DependenciesMap<[object, number], string>();\n const obj1 = { id: 1 };\n const obj2 = { id: 2 };\n objMap.set([obj1, 1], \"object1\");\n objMap.set([obj2, 2], \"object2\");\n expect(objMap.get([obj1, 1])).toBe(\"object1\");\n expect(objMap.get([obj2, 2])).toBe(\"object2\");\n\n // Test iteration\n const iterMap = new DependenciesMap<[string], number>();\n iterMap.set([\"a\"], 1);\n iterMap.set([\"b\"], 2);\n iterMap.set([\"c\"], 3);\n\n const entries = Array.from(iterMap);\n expect(entries.length).toBe(3);\n expect(entries).toContainEqual([[\"a\"], 1]);\n expect(entries).toContainEqual([[\"b\"], 2]);\n expect(entries).toContainEqual([[\"c\"], 3]);\n});\n"],"mappings":"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","names":["_a","_b"]}
|
package/dist/utils/math.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Similar to the modulo operator, but always returns a positive number (even when the input is negative).
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
declare function remainder(n: number, d: number): number;
|
|
5
|
+
|
|
6
|
+
export { remainder };
|