@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/hooks/use-hash.js
CHANGED
|
@@ -1,9 +1,42 @@
|
|
|
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
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/hooks/use-hash.tsx
|
|
21
|
+
var use_hash_exports = {};
|
|
22
|
+
__export(use_hash_exports, {
|
|
23
|
+
useHash: () => useHash
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_hash_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_react2 = require("../utils/react");
|
|
28
|
+
var useHash = () => {
|
|
29
|
+
(0, import_react2.suspendIfSsr)("useHash");
|
|
30
|
+
return (0, import_react.useSyncExternalStore)(
|
|
31
|
+
(onChange) => {
|
|
32
|
+
const interval = setInterval(() => onChange(), 10);
|
|
33
|
+
return () => clearInterval(interval);
|
|
34
|
+
},
|
|
35
|
+
() => window.location.hash.substring(1)
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
useHash
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=use-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-hash.tsx"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\nimport { suspendIfSsr } from \"../utils/react\";\n\nexport const useHash = () => {\n suspendIfSsr(\"useHash\");\n return useSyncExternalStore(\n (onChange) => {\n const interval = setInterval(() => onChange(), 10);\n return () => clearInterval(interval);\n },\n () => window.location.hash.substring(1)\n );\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqC;AACrC,IAAAA,gBAA6B;AAEtB,IAAM,UAAU,MAAM;AAC3B,kCAAa,SAAS;AACtB,aAAO;AAAA,IACL,CAAC,aAAa;AACZ,YAAM,WAAW,YAAY,MAAM,SAAS,GAAG,EAAE;AACjD,aAAO,MAAM,cAAc,QAAQ;AAAA,IACrC;AAAA,IACA,MAAM,OAAO,SAAS,KAAK,UAAU,CAAC;AAAA,EACxC;AACF;","names":["import_react"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like memo, but minimizes recomputation of the value at all costs (instead of useMemo which recomputes whenever the renderer feels like it).
|
|
3
|
+
*
|
|
4
|
+
* The most recent value will be kept from garbage collection until one of the dependencies becomes unreachable. This may be true even after the component no longer renders. Be wary of memory leaks.
|
|
5
|
+
*/
|
|
6
|
+
declare function useStrictMemo<T>(callback: () => T, dependencies: any[]): T;
|
|
7
|
+
|
|
8
|
+
export { useStrictMemo };
|
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The most recent value will be kept from garbage collection until one of the dependencies becomes unreachable. This may be true even after the component no longer renders. Be wary of memory leaks.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
declare function useStrictMemo<T>(callback: () => T, dependencies: any[]): T;
|
|
7
|
+
|
|
8
|
+
export { useStrictMemo };
|
|
@@ -1,139 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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/hooks/use-strict-memo.tsx
|
|
21
|
+
var use_strict_memo_exports = {};
|
|
22
|
+
__export(use_strict_memo_exports, {
|
|
23
|
+
useStrictMemo: () => useStrictMemo
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_strict_memo_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_results = require("../utils/results");
|
|
28
|
+
var cached = /* @__PURE__ */ new Map();
|
|
4
29
|
function unwrapFromInner(dependencies, inner) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return Result.error(undefined);
|
|
14
|
-
}
|
|
30
|
+
if (dependencies.length === 0 !== "isNotNestedMap" in inner) {
|
|
31
|
+
return import_results.Result.error(void 0);
|
|
32
|
+
}
|
|
33
|
+
if ("isNotNestedMap" in inner) {
|
|
34
|
+
if (dependencies.length === 0) {
|
|
35
|
+
return import_results.Result.ok(inner.value);
|
|
36
|
+
} else {
|
|
37
|
+
return import_results.Result.error(void 0);
|
|
15
38
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return unwrapFromInner(rest, newInner);
|
|
27
|
-
}
|
|
39
|
+
} else {
|
|
40
|
+
if (dependencies.length === 0) {
|
|
41
|
+
return import_results.Result.error(void 0);
|
|
42
|
+
} else {
|
|
43
|
+
const [key, ...rest] = dependencies;
|
|
44
|
+
const newInner = inner.get(key);
|
|
45
|
+
if (!newInner) {
|
|
46
|
+
return import_results.Result.error(void 0);
|
|
47
|
+
}
|
|
48
|
+
return unwrapFromInner(rest, newInner);
|
|
28
49
|
}
|
|
50
|
+
}
|
|
29
51
|
}
|
|
30
|
-
import.meta.vitest?.test("unwrapFromInner", ({ expect }) => {
|
|
31
|
-
// Test with empty dependencies and non-nested map
|
|
32
|
-
const nonNestedMap = { isNotNestedMap: true, value: "test" };
|
|
33
|
-
const result1 = unwrapFromInner([], nonNestedMap);
|
|
34
|
-
expect(result1.status).toBe("ok");
|
|
35
|
-
if (result1.status === "ok") {
|
|
36
|
-
expect(result1.data).toBe("test");
|
|
37
|
-
}
|
|
38
|
-
// Test with non-empty dependencies and non-nested map (should error)
|
|
39
|
-
expect(unwrapFromInner(["key"], nonNestedMap).status).toBe("error");
|
|
40
|
-
// Test with empty dependencies and nested map (should error)
|
|
41
|
-
const nestedMap = new Map([["key", { isNotNestedMap: true, value: "test" }]]);
|
|
42
|
-
expect(unwrapFromInner([], nestedMap).status).toBe("error");
|
|
43
|
-
// Test with matching dependencies and nested map
|
|
44
|
-
const result2 = unwrapFromInner(["key"], nestedMap);
|
|
45
|
-
expect(result2.status).toBe("ok");
|
|
46
|
-
if (result2.status === "ok") {
|
|
47
|
-
expect(result2.data).toBe("test");
|
|
48
|
-
}
|
|
49
|
-
// Test with non-matching dependencies and nested map
|
|
50
|
-
expect(unwrapFromInner(["wrongKey"], nestedMap).status).toBe("error");
|
|
51
|
-
// Test with deeply nested map
|
|
52
|
-
const deeplyNestedMap = new Map([
|
|
53
|
-
["key1", new Map([
|
|
54
|
-
["key2", { isNotNestedMap: true, value: "nested" }]
|
|
55
|
-
])]
|
|
56
|
-
]);
|
|
57
|
-
const result3 = unwrapFromInner(["key1", "key2"], deeplyNestedMap);
|
|
58
|
-
expect(result3.status).toBe("ok");
|
|
59
|
-
if (result3.status === "ok") {
|
|
60
|
-
expect(result3.data).toBe("nested");
|
|
61
|
-
}
|
|
62
|
-
// Test with partial match in deeply nested map
|
|
63
|
-
expect(unwrapFromInner(["key1", "wrongKey"], deeplyNestedMap).status).toBe("error");
|
|
64
|
-
});
|
|
65
52
|
function wrapToInner(dependencies, value) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
53
|
+
if (dependencies.length === 0) {
|
|
54
|
+
return { isNotNestedMap: true, value };
|
|
55
|
+
}
|
|
56
|
+
const [key, ...rest] = dependencies;
|
|
57
|
+
const inner = wrapToInner(rest, value);
|
|
58
|
+
const isObject = typeof key === "object" && key !== null;
|
|
59
|
+
const isUnregisteredSymbol = typeof key === "symbol" && Symbol.keyFor(key) === void 0;
|
|
60
|
+
const isWeak = isObject || isUnregisteredSymbol;
|
|
61
|
+
const mapType = isWeak ? WeakMap : Map;
|
|
62
|
+
return new mapType([[key, inner]]);
|
|
76
63
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
expect(multiResult instanceof Map).toBe(true);
|
|
90
|
-
// Need to cast to access Map methods
|
|
91
|
-
const multiMap = multiResult;
|
|
92
|
-
const innerMap = multiMap.get("key1");
|
|
93
|
-
expect(innerMap instanceof Map).toBe(true);
|
|
94
|
-
expect(innerMap.get("key2")).toEqual({ isNotNestedMap: true, value: "test" });
|
|
95
|
-
// Test with object dependency (should use WeakMap)
|
|
96
|
-
const obj = { test: true };
|
|
97
|
-
const objResult = wrapToInner([obj], "test");
|
|
98
|
-
expect(objResult instanceof WeakMap).toBe(true);
|
|
99
|
-
// Need to cast to access WeakMap methods
|
|
100
|
-
const objMap = objResult;
|
|
101
|
-
expect(objMap.get(obj)).toEqual({ isNotNestedMap: true, value: "test" });
|
|
102
|
-
// Test with unregistered symbol dependency (should use WeakMap)
|
|
103
|
-
const symbolObj = Symbol("test");
|
|
104
|
-
const symbolResult = wrapToInner([symbolObj], "test");
|
|
105
|
-
expect(symbolResult instanceof WeakMap).toBe(true);
|
|
106
|
-
// Need to cast to access WeakMap methods
|
|
107
|
-
const symbolMap = symbolResult;
|
|
108
|
-
expect(symbolMap.get(symbolObj)).toEqual({ isNotNestedMap: true, value: "test" });
|
|
109
|
-
// Test with registered symbol dependency (should use Map)
|
|
110
|
-
const registeredSymbol = Symbol.for("test");
|
|
111
|
-
const registeredSymbolResult = wrapToInner([registeredSymbol], "test");
|
|
112
|
-
expect(registeredSymbolResult instanceof Map).toBe(true);
|
|
113
|
-
// Need to cast to access Map methods
|
|
114
|
-
const registeredSymbolMap = registeredSymbolResult;
|
|
115
|
-
expect(registeredSymbolMap.get(registeredSymbol)).toEqual({ isNotNestedMap: true, value: "test" });
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* Like memo, but minimizes recomputation of the value at all costs (instead of useMemo which recomputes whenever the renderer feels like it).
|
|
119
|
-
*
|
|
120
|
-
* The most recent value will be kept from garbage collection until one of the dependencies becomes unreachable. This may be true even after the component no longer renders. Be wary of memory leaks.
|
|
121
|
-
*/
|
|
122
|
-
export function useStrictMemo(callback, dependencies) {
|
|
123
|
-
const id = useId();
|
|
124
|
-
useInsertionEffect(() => {
|
|
125
|
-
return () => {
|
|
126
|
-
cached.delete(id);
|
|
127
|
-
};
|
|
128
|
-
}, [id]);
|
|
129
|
-
const c = cached.get(id);
|
|
130
|
-
if (c) {
|
|
131
|
-
const unwrapped = unwrapFromInner(dependencies, c);
|
|
132
|
-
if (unwrapped.status === "ok") {
|
|
133
|
-
return unwrapped.data;
|
|
134
|
-
}
|
|
64
|
+
function useStrictMemo(callback, dependencies) {
|
|
65
|
+
const id = (0, import_react.useId)();
|
|
66
|
+
(0, import_react.useInsertionEffect)(() => {
|
|
67
|
+
return () => {
|
|
68
|
+
cached.delete(id);
|
|
69
|
+
};
|
|
70
|
+
}, [id]);
|
|
71
|
+
const c = cached.get(id);
|
|
72
|
+
if (c) {
|
|
73
|
+
const unwrapped = unwrapFromInner(dependencies, c);
|
|
74
|
+
if (unwrapped.status === "ok") {
|
|
75
|
+
return unwrapped.data;
|
|
135
76
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
77
|
+
}
|
|
78
|
+
const value = callback();
|
|
79
|
+
cached.set(id, wrapToInner(dependencies, value));
|
|
80
|
+
return value;
|
|
139
81
|
}
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
useStrictMemo
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=use-strict-memo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-strict-memo.tsx"],"sourcesContent":["import { useId, useInsertionEffect, useMemo } from \"react\";\nimport { Result } from \"../utils/results\";\n\ntype CacheInner = Map<unknown, CacheInner> | WeakMap<WeakKey, CacheInner> | { isNotNestedMap: true, value: any };\n\nconst cached = new Map<string, CacheInner>();\n\nfunction unwrapFromInner(dependencies: any[], inner: CacheInner): Result<any, void> {\n if ((dependencies.length === 0) !== (\"isNotNestedMap\" in inner)) {\n return Result.error(undefined);\n }\n if (\"isNotNestedMap\" in inner) {\n if (dependencies.length === 0) {\n return Result.ok(inner.value);\n } else {\n return Result.error(undefined);\n }\n } else {\n if (dependencies.length === 0) {\n return Result.error(undefined);\n } else {\n const [key, ...rest] = dependencies;\n const newInner = inner.get(key);\n if (!newInner) {\n return Result.error(undefined);\n }\n return unwrapFromInner(rest, newInner);\n }\n }\n}\nundefined?.test(\"unwrapFromInner\", ({ expect }) => {\n // Test with empty dependencies and non-nested map\n const nonNestedMap = { isNotNestedMap: true, value: \"test\" } as CacheInner;\n const result1 = unwrapFromInner([], nonNestedMap);\n expect(result1.status).toBe(\"ok\");\n if (result1.status === \"ok\") {\n expect(result1.data).toBe(\"test\");\n }\n\n // Test with non-empty dependencies and non-nested map (should error)\n expect(unwrapFromInner([\"key\"], nonNestedMap).status).toBe(\"error\");\n\n // Test with empty dependencies and nested map (should error)\n const nestedMap = new Map([[\"key\", { isNotNestedMap: true, value: \"test\" } as CacheInner]]) as CacheInner;\n expect(unwrapFromInner([], nestedMap).status).toBe(\"error\");\n\n // Test with matching dependencies and nested map\n const result2 = unwrapFromInner([\"key\"], nestedMap);\n expect(result2.status).toBe(\"ok\");\n if (result2.status === \"ok\") {\n expect(result2.data).toBe(\"test\");\n }\n\n // Test with non-matching dependencies and nested map\n expect(unwrapFromInner([\"wrongKey\"], nestedMap).status).toBe(\"error\");\n\n // Test with deeply nested map\n const deeplyNestedMap = new Map([\n [\"key1\", new Map([\n [\"key2\", { isNotNestedMap: true, value: \"nested\" } as CacheInner]\n ]) as CacheInner]\n ]) as CacheInner;\n\n const result3 = unwrapFromInner([\"key1\", \"key2\"], deeplyNestedMap);\n expect(result3.status).toBe(\"ok\");\n if (result3.status === \"ok\") {\n expect(result3.data).toBe(\"nested\");\n }\n\n // Test with partial match in deeply nested map\n expect(unwrapFromInner([\"key1\", \"wrongKey\"], deeplyNestedMap).status).toBe(\"error\");\n});\n\nfunction wrapToInner(dependencies: any[], value: any): CacheInner {\n if (dependencies.length === 0) {\n return { isNotNestedMap: true, value };\n }\n const [key, ...rest] = dependencies;\n const inner = wrapToInner(rest, value);\n\n const isObject = (typeof key === \"object\" && key !== null);\n const isUnregisteredSymbol = (typeof key === \"symbol\" && Symbol.keyFor(key) === undefined);\n const isWeak = isObject || isUnregisteredSymbol;\n const mapType = isWeak ? WeakMap : Map;\n\n return new mapType([[key, inner]]);\n}\nundefined?.test(\"wrapToInner\", ({ expect }) => {\n // Test with empty dependencies\n const emptyResult = wrapToInner([], \"test\");\n expect(emptyResult).toEqual({ isNotNestedMap: true, value: \"test\" });\n\n // Test with single string dependency\n const singleResult = wrapToInner([\"key\"], \"test\");\n expect(singleResult instanceof Map).toBe(true);\n // Need to cast to access Map methods\n const singleMap = singleResult as Map<unknown, CacheInner>;\n expect(singleMap.get(\"key\")).toEqual({ isNotNestedMap: true, value: \"test\" });\n\n // Test with multiple string dependencies\n const multiResult = wrapToInner([\"key1\", \"key2\"], \"test\");\n expect(multiResult instanceof Map).toBe(true);\n // Need to cast to access Map methods\n const multiMap = multiResult as Map<unknown, CacheInner>;\n const innerMap = multiMap.get(\"key1\") as Map<unknown, CacheInner>;\n expect(innerMap instanceof Map).toBe(true);\n expect(innerMap.get(\"key2\")).toEqual({ isNotNestedMap: true, value: \"test\" });\n\n // Test with object dependency (should use WeakMap)\n const obj = { test: true };\n const objResult = wrapToInner([obj], \"test\");\n expect(objResult instanceof WeakMap).toBe(true);\n // Need to cast to access WeakMap methods\n const objMap = objResult as WeakMap<WeakKey, CacheInner>;\n expect(objMap.get(obj)).toEqual({ isNotNestedMap: true, value: \"test\" });\n\n // Test with unregistered symbol dependency (should use WeakMap)\n const symbolObj = Symbol(\"test\");\n const symbolResult = wrapToInner([symbolObj], \"test\");\n expect(symbolResult instanceof WeakMap).toBe(true);\n // Need to cast to access WeakMap methods\n const symbolMap = symbolResult as WeakMap<WeakKey, CacheInner>;\n expect(symbolMap.get(symbolObj as unknown as object)).toEqual({ isNotNestedMap: true, value: \"test\" });\n\n // Test with registered symbol dependency (should use Map)\n const registeredSymbol = Symbol.for(\"test\");\n const registeredSymbolResult = wrapToInner([registeredSymbol], \"test\");\n expect(registeredSymbolResult instanceof Map).toBe(true);\n // Need to cast to access Map methods\n const registeredSymbolMap = registeredSymbolResult as Map<unknown, CacheInner>;\n expect(registeredSymbolMap.get(registeredSymbol)).toEqual({ isNotNestedMap: true, value: \"test\" });\n});\n\n/**\n * Like memo, but minimizes recomputation of the value at all costs (instead of useMemo which recomputes whenever the renderer feels like it).\n *\n * The most recent value will be kept from garbage collection until one of the dependencies becomes unreachable. This may be true even after the component no longer renders. Be wary of memory leaks.\n */\nexport function useStrictMemo<T>(callback: () => T, dependencies: any[]): T {\n const id = useId();\n useInsertionEffect(() => {\n return () => {\n cached.delete(id);\n };\n }, [id]);\n\n const c = cached.get(id);\n if (c) {\n const unwrapped = unwrapFromInner(dependencies, c);\n if (unwrapped.status === \"ok\") {\n return unwrapped.data;\n }\n }\n const value = callback();\n cached.set(id, wrapToInner(dependencies, value));\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmD;AACnD,qBAAuB;AAIvB,IAAM,SAAS,oBAAI,IAAwB;AAE3C,SAAS,gBAAgB,cAAqB,OAAsC;AAClF,MAAK,aAAa,WAAW,MAAQ,oBAAoB,OAAQ;AAC/D,WAAO,sBAAO,MAAM,MAAS;AAAA,EAC/B;AACA,MAAI,oBAAoB,OAAO;AAC7B,QAAI,aAAa,WAAW,GAAG;AAC7B,aAAO,sBAAO,GAAG,MAAM,KAAK;AAAA,IAC9B,OAAO;AACL,aAAO,sBAAO,MAAM,MAAS;AAAA,IAC/B;AAAA,EACF,OAAO;AACL,QAAI,aAAa,WAAW,GAAG;AAC7B,aAAO,sBAAO,MAAM,MAAS;AAAA,IAC/B,OAAO;AACL,YAAM,CAAC,KAAK,GAAG,IAAI,IAAI;AACvB,YAAM,WAAW,MAAM,IAAI,GAAG;AAC9B,UAAI,CAAC,UAAU;AACb,eAAO,sBAAO,MAAM,MAAS;AAAA,MAC/B;AACA,aAAO,gBAAgB,MAAM,QAAQ;AAAA,IACvC;AAAA,EACF;AACF;AA4CA,SAAS,YAAY,cAAqB,OAAwB;AAChE,MAAI,aAAa,WAAW,GAAG;AAC7B,WAAO,EAAE,gBAAgB,MAAM,MAAM;AAAA,EACvC;AACA,QAAM,CAAC,KAAK,GAAG,IAAI,IAAI;AACvB,QAAM,QAAQ,YAAY,MAAM,KAAK;AAErC,QAAM,WAAY,OAAO,QAAQ,YAAY,QAAQ;AACrD,QAAM,uBAAwB,OAAO,QAAQ,YAAY,OAAO,OAAO,GAAG,MAAM;AAChF,QAAM,SAAS,YAAY;AAC3B,QAAM,UAAU,SAAS,UAAU;AAEnC,SAAO,IAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;AACnC;AAoDO,SAAS,cAAiB,UAAmB,cAAwB;AAC1E,QAAM,SAAK,oBAAM;AACjB,uCAAmB,MAAM;AACvB,WAAO,MAAM;AACX,aAAO,OAAO,EAAE;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,EAAE,CAAC;AAEP,QAAM,IAAI,OAAO,IAAI,EAAE;AACvB,MAAI,GAAG;AACL,UAAM,YAAY,gBAAgB,cAAc,CAAC;AACjD,QAAI,UAAU,WAAW,MAAM;AAC7B,aAAO,UAAU;AAAA,IACnB;AAAA,EACF;AACA,QAAM,QAAQ,SAAS;AACvB,SAAO,IAAI,IAAI,YAAY,cAAc,KAAK,CAAC;AAC/C,SAAO;AACT;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { StackAdminInterface } from './interface/adminInterface.cjs';
|
|
2
|
+
export { StackClientInterface } from './interface/clientInterface.cjs';
|
|
3
|
+
export { StackServerInterface } from './interface/serverInterface.cjs';
|
|
4
|
+
export { KnownError, KnownErrors } from './known-errors.cjs';
|
|
5
|
+
import './sessions.cjs';
|
|
6
|
+
import 'jose';
|
|
7
|
+
import './interface/crud/email-templates.cjs';
|
|
8
|
+
import './crud.cjs';
|
|
9
|
+
import 'yup';
|
|
10
|
+
import './utils/types.cjs';
|
|
11
|
+
import './interface/crud/emails.cjs';
|
|
12
|
+
import './interface/crud/internal-api-keys.cjs';
|
|
13
|
+
import './interface/crud/project-permissions.cjs';
|
|
14
|
+
import './interface/crud/projects.cjs';
|
|
15
|
+
import './interface/crud/svix-token.cjs';
|
|
16
|
+
import './interface/crud/team-permissions.cjs';
|
|
17
|
+
import './utils/results.cjs';
|
|
18
|
+
import './interface/crud/contact-channels.cjs';
|
|
19
|
+
import './interface/crud/current-user.cjs';
|
|
20
|
+
import './interface/crud/oauth.cjs';
|
|
21
|
+
import './interface/crud/sessions.cjs';
|
|
22
|
+
import './interface/crud/team-invitation.cjs';
|
|
23
|
+
import './interface/crud/team-member-profiles.cjs';
|
|
24
|
+
import './interface/crud/team-memberships.cjs';
|
|
25
|
+
import './interface/crud/teams.cjs';
|
|
26
|
+
import './interface/crud/users.cjs';
|
|
27
|
+
import './utils/errors.cjs';
|
|
28
|
+
import './utils/json.cjs';
|
|
29
|
+
import '@simplewebauthn/types';
|
|
30
|
+
import './interface/crud/project-api-keys.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
export { StackAdminInterface } from
|
|
2
|
-
export { StackClientInterface } from
|
|
3
|
-
export { StackServerInterface } from
|
|
4
|
-
export { KnownError, KnownErrors } from
|
|
1
|
+
export { StackAdminInterface } from './interface/adminInterface.js';
|
|
2
|
+
export { StackClientInterface } from './interface/clientInterface.js';
|
|
3
|
+
export { StackServerInterface } from './interface/serverInterface.js';
|
|
4
|
+
export { KnownError, KnownErrors } from './known-errors.js';
|
|
5
|
+
import './sessions.js';
|
|
6
|
+
import 'jose';
|
|
7
|
+
import './interface/crud/email-templates.js';
|
|
8
|
+
import './crud.js';
|
|
9
|
+
import 'yup';
|
|
10
|
+
import './utils/types.js';
|
|
11
|
+
import './interface/crud/emails.js';
|
|
12
|
+
import './interface/crud/internal-api-keys.js';
|
|
13
|
+
import './interface/crud/project-permissions.js';
|
|
14
|
+
import './interface/crud/projects.js';
|
|
15
|
+
import './interface/crud/svix-token.js';
|
|
16
|
+
import './interface/crud/team-permissions.js';
|
|
17
|
+
import './utils/results.js';
|
|
18
|
+
import './interface/crud/contact-channels.js';
|
|
19
|
+
import './interface/crud/current-user.js';
|
|
20
|
+
import './interface/crud/oauth.js';
|
|
21
|
+
import './interface/crud/sessions.js';
|
|
22
|
+
import './interface/crud/team-invitation.js';
|
|
23
|
+
import './interface/crud/team-member-profiles.js';
|
|
24
|
+
import './interface/crud/team-memberships.js';
|
|
25
|
+
import './interface/crud/teams.js';
|
|
26
|
+
import './interface/crud/users.js';
|
|
27
|
+
import './utils/errors.js';
|
|
28
|
+
import './utils/json.js';
|
|
29
|
+
import '@simplewebauthn/types';
|
|
30
|
+
import './interface/crud/project-api-keys.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
KnownError: () => import_known_errors.KnownError,
|
|
24
|
+
KnownErrors: () => import_known_errors.KnownErrors,
|
|
25
|
+
StackAdminInterface: () => import_adminInterface.StackAdminInterface,
|
|
26
|
+
StackClientInterface: () => import_clientInterface.StackClientInterface,
|
|
27
|
+
StackServerInterface: () => import_serverInterface.StackServerInterface
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
|
+
var import_adminInterface = require("./interface/adminInterface");
|
|
31
|
+
var import_clientInterface = require("./interface/clientInterface");
|
|
32
|
+
var import_serverInterface = require("./interface/serverInterface");
|
|
33
|
+
var import_known_errors = require("./known-errors");
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
KnownError,
|
|
37
|
+
KnownErrors,
|
|
38
|
+
StackAdminInterface,
|
|
39
|
+
StackClientInterface,
|
|
40
|
+
StackServerInterface
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n StackAdminInterface\n} from \"./interface/adminInterface\";\nexport {\n StackClientInterface\n} from \"./interface/clientInterface\";\nexport {\n StackServerInterface\n} from \"./interface/serverInterface\";\nexport {\n KnownError,\n KnownErrors\n} from \"./known-errors\";\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAEO;AACP,6BAEO;AACP,6BAEO;AACP,0BAGO;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { InternalSession, AccessToken, RefreshToken } from '../sessions.cjs';
|
|
2
|
+
import { EmailTemplateCrud, EmailTemplateType } from './crud/email-templates.cjs';
|
|
3
|
+
import { InternalEmailsCrud } from './crud/emails.cjs';
|
|
4
|
+
import { InternalApiKeysCrud } from './crud/internal-api-keys.cjs';
|
|
5
|
+
import { ProjectPermissionDefinitionsCrud } from './crud/project-permissions.cjs';
|
|
6
|
+
import { ProjectsCrud } from './crud/projects.cjs';
|
|
7
|
+
import { SvixTokenCrud } from './crud/svix-token.cjs';
|
|
8
|
+
import { TeamPermissionDefinitionsCrud } from './crud/team-permissions.cjs';
|
|
9
|
+
import { ServerAuthApplicationOptions, StackServerInterface } from './serverInterface.cjs';
|
|
10
|
+
import './clientInterface.cjs';
|
|
11
|
+
import '../known-errors.cjs';
|
|
12
|
+
import 'jose';
|
|
13
|
+
import '../crud.cjs';
|
|
14
|
+
import 'yup';
|
|
15
|
+
import '../utils/types.cjs';
|
|
16
|
+
import '../utils/results.cjs';
|
|
17
|
+
import './crud/contact-channels.cjs';
|
|
18
|
+
import './crud/current-user.cjs';
|
|
19
|
+
import './crud/oauth.cjs';
|
|
20
|
+
import './crud/sessions.cjs';
|
|
21
|
+
import './crud/team-invitation.cjs';
|
|
22
|
+
import './crud/team-member-profiles.cjs';
|
|
23
|
+
import './crud/team-memberships.cjs';
|
|
24
|
+
import './crud/teams.cjs';
|
|
25
|
+
import './crud/users.cjs';
|
|
26
|
+
import '../utils/errors.cjs';
|
|
27
|
+
import '../utils/json.cjs';
|
|
28
|
+
import '@simplewebauthn/types';
|
|
29
|
+
import './crud/project-api-keys.cjs';
|
|
30
|
+
|
|
31
|
+
type AdminAuthApplicationOptions = ServerAuthApplicationOptions & ({
|
|
32
|
+
superSecretAdminKey: string;
|
|
33
|
+
} | {
|
|
34
|
+
projectOwnerSession: InternalSession;
|
|
35
|
+
});
|
|
36
|
+
type InternalApiKeyCreateCrudRequest = {
|
|
37
|
+
has_publishable_client_key: boolean;
|
|
38
|
+
has_secret_server_key: boolean;
|
|
39
|
+
has_super_secret_admin_key: boolean;
|
|
40
|
+
expires_at_millis: number;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
type InternalApiKeyCreateCrudResponse = InternalApiKeysCrud["Admin"]["Read"] & {
|
|
44
|
+
publishable_client_key?: string;
|
|
45
|
+
secret_server_key?: string;
|
|
46
|
+
super_secret_admin_key?: string;
|
|
47
|
+
};
|
|
48
|
+
declare class StackAdminInterface extends StackServerInterface {
|
|
49
|
+
readonly options: AdminAuthApplicationOptions;
|
|
50
|
+
constructor(options: AdminAuthApplicationOptions);
|
|
51
|
+
sendAdminRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "admin"): Promise<Response & {
|
|
52
|
+
usedTokens: {
|
|
53
|
+
accessToken: AccessToken;
|
|
54
|
+
refreshToken: RefreshToken | null;
|
|
55
|
+
} | null;
|
|
56
|
+
}>;
|
|
57
|
+
getProject(): Promise<ProjectsCrud["Admin"]["Read"]>;
|
|
58
|
+
updateProject(update: ProjectsCrud["Admin"]["Update"]): Promise<ProjectsCrud["Admin"]["Read"]>;
|
|
59
|
+
createInternalApiKey(options: InternalApiKeyCreateCrudRequest): Promise<InternalApiKeyCreateCrudResponse>;
|
|
60
|
+
listInternalApiKeys(): Promise<InternalApiKeysCrud["Admin"]["Read"][]>;
|
|
61
|
+
revokeInternalApiKeyById(id: string): Promise<void>;
|
|
62
|
+
getInternalApiKey(id: string, session: InternalSession): Promise<InternalApiKeysCrud["Admin"]["Read"]>;
|
|
63
|
+
listEmailTemplates(): Promise<EmailTemplateCrud['Admin']['Read'][]>;
|
|
64
|
+
updateEmailTemplate(type: EmailTemplateType, data: EmailTemplateCrud['Admin']['Update']): Promise<EmailTemplateCrud['Admin']['Read']>;
|
|
65
|
+
resetEmailTemplate(type: EmailTemplateType): Promise<void>;
|
|
66
|
+
listTeamPermissionDefinitions(): Promise<TeamPermissionDefinitionsCrud['Admin']['Read'][]>;
|
|
67
|
+
createTeamPermissionDefinition(data: TeamPermissionDefinitionsCrud['Admin']['Create']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
|
|
68
|
+
updateTeamPermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
|
|
69
|
+
deleteTeamPermissionDefinition(permissionId: string): Promise<void>;
|
|
70
|
+
listProjectPermissionDefinitions(): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read'][]>;
|
|
71
|
+
createProjectPermissionDefinition(data: ProjectPermissionDefinitionsCrud['Admin']['Create']): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read']>;
|
|
72
|
+
updateProjectPermissionDefinition(permissionId: string, data: ProjectPermissionDefinitionsCrud['Admin']['Update']): Promise<ProjectPermissionDefinitionsCrud['Admin']['Read']>;
|
|
73
|
+
deleteProjectPermissionDefinition(permissionId: string): Promise<void>;
|
|
74
|
+
getSvixToken(): Promise<SvixTokenCrud["Admin"]["Read"]>;
|
|
75
|
+
deleteProject(): Promise<void>;
|
|
76
|
+
getMetrics(): Promise<any>;
|
|
77
|
+
sendTestEmail(data: {
|
|
78
|
+
recipient_email: string;
|
|
79
|
+
email_config: {
|
|
80
|
+
host: string;
|
|
81
|
+
port: number;
|
|
82
|
+
username: string;
|
|
83
|
+
password: string;
|
|
84
|
+
sender_email: string;
|
|
85
|
+
sender_name: string;
|
|
86
|
+
};
|
|
87
|
+
}): Promise<{
|
|
88
|
+
success: boolean;
|
|
89
|
+
error_message?: string;
|
|
90
|
+
}>;
|
|
91
|
+
listSentEmails(): Promise<InternalEmailsCrud["Admin"]["List"]>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { type AdminAuthApplicationOptions, type InternalApiKeyCreateCrudRequest, type InternalApiKeyCreateCrudResponse, StackAdminInterface };
|
|
@@ -1,36 +1,57 @@
|
|
|
1
|
-
import { InternalSession } from
|
|
2
|
-
import { EmailTemplateCrud, EmailTemplateType } from
|
|
3
|
-
import { InternalEmailsCrud } from
|
|
4
|
-
import { InternalApiKeysCrud } from
|
|
5
|
-
import { ProjectPermissionDefinitionsCrud } from
|
|
6
|
-
import { ProjectsCrud } from
|
|
7
|
-
import { SvixTokenCrud } from
|
|
8
|
-
import { TeamPermissionDefinitionsCrud } from
|
|
9
|
-
import { ServerAuthApplicationOptions, StackServerInterface } from
|
|
10
|
-
|
|
1
|
+
import { InternalSession, AccessToken, RefreshToken } from '../sessions.js';
|
|
2
|
+
import { EmailTemplateCrud, EmailTemplateType } from './crud/email-templates.js';
|
|
3
|
+
import { InternalEmailsCrud } from './crud/emails.js';
|
|
4
|
+
import { InternalApiKeysCrud } from './crud/internal-api-keys.js';
|
|
5
|
+
import { ProjectPermissionDefinitionsCrud } from './crud/project-permissions.js';
|
|
6
|
+
import { ProjectsCrud } from './crud/projects.js';
|
|
7
|
+
import { SvixTokenCrud } from './crud/svix-token.js';
|
|
8
|
+
import { TeamPermissionDefinitionsCrud } from './crud/team-permissions.js';
|
|
9
|
+
import { ServerAuthApplicationOptions, StackServerInterface } from './serverInterface.js';
|
|
10
|
+
import './clientInterface.js';
|
|
11
|
+
import '../known-errors.js';
|
|
12
|
+
import 'jose';
|
|
13
|
+
import '../crud.js';
|
|
14
|
+
import 'yup';
|
|
15
|
+
import '../utils/types.js';
|
|
16
|
+
import '../utils/results.js';
|
|
17
|
+
import './crud/contact-channels.js';
|
|
18
|
+
import './crud/current-user.js';
|
|
19
|
+
import './crud/oauth.js';
|
|
20
|
+
import './crud/sessions.js';
|
|
21
|
+
import './crud/team-invitation.js';
|
|
22
|
+
import './crud/team-member-profiles.js';
|
|
23
|
+
import './crud/team-memberships.js';
|
|
24
|
+
import './crud/teams.js';
|
|
25
|
+
import './crud/users.js';
|
|
26
|
+
import '../utils/errors.js';
|
|
27
|
+
import '../utils/json.js';
|
|
28
|
+
import '@simplewebauthn/types';
|
|
29
|
+
import './crud/project-api-keys.js';
|
|
30
|
+
|
|
31
|
+
type AdminAuthApplicationOptions = ServerAuthApplicationOptions & ({
|
|
11
32
|
superSecretAdminKey: string;
|
|
12
33
|
} | {
|
|
13
34
|
projectOwnerSession: InternalSession;
|
|
14
35
|
});
|
|
15
|
-
|
|
36
|
+
type InternalApiKeyCreateCrudRequest = {
|
|
16
37
|
has_publishable_client_key: boolean;
|
|
17
38
|
has_secret_server_key: boolean;
|
|
18
39
|
has_super_secret_admin_key: boolean;
|
|
19
40
|
expires_at_millis: number;
|
|
20
41
|
description: string;
|
|
21
42
|
};
|
|
22
|
-
|
|
43
|
+
type InternalApiKeyCreateCrudResponse = InternalApiKeysCrud["Admin"]["Read"] & {
|
|
23
44
|
publishable_client_key?: string;
|
|
24
45
|
secret_server_key?: string;
|
|
25
46
|
super_secret_admin_key?: string;
|
|
26
47
|
};
|
|
27
|
-
|
|
48
|
+
declare class StackAdminInterface extends StackServerInterface {
|
|
28
49
|
readonly options: AdminAuthApplicationOptions;
|
|
29
50
|
constructor(options: AdminAuthApplicationOptions);
|
|
30
51
|
sendAdminRequest(path: string, options: RequestInit, session: InternalSession | null, requestType?: "admin"): Promise<Response & {
|
|
31
52
|
usedTokens: {
|
|
32
|
-
accessToken:
|
|
33
|
-
refreshToken:
|
|
53
|
+
accessToken: AccessToken;
|
|
54
|
+
refreshToken: RefreshToken | null;
|
|
34
55
|
} | null;
|
|
35
56
|
}>;
|
|
36
57
|
getProject(): Promise<ProjectsCrud["Admin"]["Read"]>;
|
|
@@ -69,3 +90,5 @@ export declare class StackAdminInterface extends StackServerInterface {
|
|
|
69
90
|
}>;
|
|
70
91
|
listSentEmails(): Promise<InternalEmailsCrud["Admin"]["List"]>;
|
|
71
92
|
}
|
|
93
|
+
|
|
94
|
+
export { type AdminAuthApplicationOptions, type InternalApiKeyCreateCrudRequest, type InternalApiKeyCreateCrudResponse, StackAdminInterface };
|