@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/math.js
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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/math.tsx
|
|
21
|
+
var math_exports = {};
|
|
22
|
+
__export(math_exports, {
|
|
23
|
+
remainder: () => remainder
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(math_exports);
|
|
26
|
+
function remainder(n, d) {
|
|
27
|
+
return (n % d + Math.abs(d)) % d;
|
|
6
28
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
expect(remainder(10, 7)).toBe(3);
|
|
11
|
-
// Test with negative numbers
|
|
12
|
-
expect(remainder(-10, 3)).toBe(2);
|
|
13
|
-
expect(remainder(-5, 2)).toBe(1);
|
|
14
|
-
expect(remainder(-7, 4)).toBe(1);
|
|
15
|
-
// Test with decimal numbers
|
|
16
|
-
expect(remainder(10.5, 3)).toBeCloseTo(1.5);
|
|
17
|
-
expect(remainder(-10.5, 3)).toBeCloseTo(1.5);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
remainder
|
|
18
32
|
});
|
|
33
|
+
//# sourceMappingURL=math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/math.tsx"],"sourcesContent":["/**\n * Similar to the modulo operator, but always returns a positive number (even when the input is negative).\n */\nexport function remainder(n: number, d: number): number {\n return ((n % d) + Math.abs(d)) % d;\n}\nundefined?.test(\"remainder\", ({ expect }) => {\n expect(remainder(10, 3)).toBe(1);\n expect(remainder(10, 5)).toBe(0);\n expect(remainder(10, 7)).toBe(3);\n // Test with negative numbers\n expect(remainder(-10, 3)).toBe(2);\n expect(remainder(-5, 2)).toBe(1);\n expect(remainder(-7, 4)).toBe(1);\n // Test with decimal numbers\n expect(remainder(10.5, 3)).toBeCloseTo(1.5);\n expect(remainder(-10.5, 3)).toBeCloseTo(1.5);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,UAAU,GAAW,GAAmB;AACtD,UAAS,IAAI,IAAK,KAAK,IAAI,CAAC,KAAK;AACnC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
|
|
3
|
+
declare class ServerResponseWithBodyChunks extends ServerResponse {
|
|
4
|
+
bodyChunks: Uint8Array[];
|
|
5
|
+
_send(data: string, encoding: BufferEncoding, callback?: (() => void) | null, byteLength?: number): void;
|
|
6
|
+
}
|
|
7
|
+
declare function createNodeHttpServerDuplex(options: {
|
|
8
|
+
method: string;
|
|
9
|
+
originalUrl?: URL;
|
|
10
|
+
url: URL;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
body: Uint8Array;
|
|
13
|
+
}): Promise<[IncomingMessage, ServerResponseWithBodyChunks]>;
|
|
14
|
+
|
|
15
|
+
export { createNodeHttpServerDuplex };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
|
|
4
3
|
declare class ServerResponseWithBodyChunks extends ServerResponse {
|
|
5
4
|
bodyChunks: Uint8Array[];
|
|
6
5
|
_send(data: string, encoding: BufferEncoding, callback?: (() => void) | null, byteLength?: number): void;
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
declare function createNodeHttpServerDuplex(options: {
|
|
9
8
|
method: string;
|
|
10
9
|
originalUrl?: URL;
|
|
11
10
|
url: URL;
|
|
12
11
|
headers: Headers;
|
|
13
12
|
body: Uint8Array;
|
|
14
13
|
}): Promise<[IncomingMessage, ServerResponseWithBodyChunks]>;
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
export { createNodeHttpServerDuplex };
|
package/dist/utils/node-http.js
CHANGED
|
@@ -1,38 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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/node-http.tsx
|
|
21
|
+
var node_http_exports = {};
|
|
22
|
+
__export(node_http_exports, {
|
|
23
|
+
createNodeHttpServerDuplex: () => createNodeHttpServerDuplex
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(node_http_exports);
|
|
26
|
+
var import_http = require("http");
|
|
27
|
+
var import_urls = require("./urls");
|
|
28
|
+
var ServerResponseWithBodyChunks = class extends import_http.ServerResponse {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.bodyChunks = [];
|
|
32
|
+
}
|
|
33
|
+
// note: we actually override this, even though it's private in the parent
|
|
34
|
+
_send(data, encoding, callback, byteLength) {
|
|
35
|
+
if (typeof encoding === "function") {
|
|
36
|
+
callback = encoding;
|
|
37
|
+
encoding = "utf-8";
|
|
7
38
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const rawHeaders = [...options.headers.entries()].flat();
|
|
32
|
-
incomingMessage._addHeaderLines(rawHeaders, rawHeaders.length);
|
|
33
|
-
incomingMessage.push(Buffer.from(options.body));
|
|
34
|
-
incomingMessage.complete = true;
|
|
35
|
-
incomingMessage.push(null); // to emit end event, see: https://github.com/nodejs/node/blob/4cf6fabce20eb3050c5b543d249e931ea3d3cad5/lib/_http_common.js#L150
|
|
36
|
-
const serverResponse = new ServerResponseWithBodyChunks(incomingMessage);
|
|
37
|
-
return [incomingMessage, serverResponse];
|
|
39
|
+
const encodedBuffer = new Uint8Array(Buffer.from(data, encoding));
|
|
40
|
+
this.bodyChunks.push(encodedBuffer);
|
|
41
|
+
callback?.();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
async function createNodeHttpServerDuplex(options) {
|
|
45
|
+
const incomingMessage = new import_http.IncomingMessage({
|
|
46
|
+
encrypted: options.originalUrl?.protocol === "https:"
|
|
47
|
+
// trick frameworks into believing this is an HTTPS request
|
|
48
|
+
});
|
|
49
|
+
incomingMessage.httpVersionMajor = 1;
|
|
50
|
+
incomingMessage.httpVersionMinor = 1;
|
|
51
|
+
incomingMessage.httpVersion = "1.1";
|
|
52
|
+
incomingMessage.method = options.method;
|
|
53
|
+
incomingMessage.url = (0, import_urls.getRelativePart)(options.url);
|
|
54
|
+
incomingMessage.originalUrl = options.originalUrl && (0, import_urls.getRelativePart)(options.originalUrl);
|
|
55
|
+
const rawHeaders = [...options.headers.entries()].flat();
|
|
56
|
+
incomingMessage._addHeaderLines(rawHeaders, rawHeaders.length);
|
|
57
|
+
incomingMessage.push(Buffer.from(options.body));
|
|
58
|
+
incomingMessage.complete = true;
|
|
59
|
+
incomingMessage.push(null);
|
|
60
|
+
const serverResponse = new ServerResponseWithBodyChunks(incomingMessage);
|
|
61
|
+
return [incomingMessage, serverResponse];
|
|
38
62
|
}
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
createNodeHttpServerDuplex
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=node-http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/node-http.tsx"],"sourcesContent":["import { IncomingMessage, ServerResponse } from \"http\";\nimport { getRelativePart } from \"./urls\";\n\nclass ServerResponseWithBodyChunks extends ServerResponse {\n bodyChunks: Uint8Array[] = [];\n\n // note: we actually override this, even though it's private in the parent\n _send(data: string, encoding: BufferEncoding, callback?: (() => void) | null, byteLength?: number) {\n if (typeof encoding === \"function\") {\n callback = encoding;\n encoding = \"utf-8\";\n }\n const encodedBuffer = new Uint8Array(Buffer.from(data, encoding));\n this.bodyChunks.push(encodedBuffer);\n callback?.();\n }\n}\n\nexport async function createNodeHttpServerDuplex(options: {\n method: string,\n originalUrl?: URL,\n url: URL,\n headers: Headers,\n body: Uint8Array,\n}): Promise<[IncomingMessage, ServerResponseWithBodyChunks]> {\n // See https://github.com/nodejs/node/blob/main/lib/_http_incoming.js\n // and https://github.com/nodejs/node/blob/main/lib/_http_common.js (particularly the `parserXyz` functions)\n\n const incomingMessage = new IncomingMessage({\n encrypted: options.originalUrl?.protocol === \"https:\", // trick frameworks into believing this is an HTTPS request\n } as any);\n incomingMessage.httpVersionMajor = 1;\n incomingMessage.httpVersionMinor = 1;\n incomingMessage.httpVersion = '1.1';\n incomingMessage.method = options.method;\n incomingMessage.url = getRelativePart(options.url);\n (incomingMessage as any).originalUrl = options.originalUrl && getRelativePart(options.originalUrl); // originalUrl is an extension used by some servers; for example, oidc-provider reads it to construct the paths for the .well-known/openid-configuration\n const rawHeaders = [...options.headers.entries()].flat();\n (incomingMessage as any)._addHeaderLines(rawHeaders, rawHeaders.length);\n incomingMessage.push(Buffer.from(options.body));\n incomingMessage.complete = true;\n incomingMessage.push(null); // to emit end event, see: https://github.com/nodejs/node/blob/4cf6fabce20eb3050c5b543d249e931ea3d3cad5/lib/_http_common.js#L150\n\n const serverResponse = new ServerResponseWithBodyChunks(incomingMessage);\n\n return [incomingMessage, serverResponse];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAChD,kBAAgC;AAEhC,IAAM,+BAAN,cAA2C,2BAAe;AAAA,EAA1D;AAAA;AACE,sBAA2B,CAAC;AAAA;AAAA;AAAA,EAG5B,MAAM,MAAc,UAA0B,UAAgC,YAAqB;AACjG,QAAI,OAAO,aAAa,YAAY;AAClC,iBAAW;AACX,iBAAW;AAAA,IACb;AACA,UAAM,gBAAgB,IAAI,WAAW,OAAO,KAAK,MAAM,QAAQ,CAAC;AAChE,SAAK,WAAW,KAAK,aAAa;AAClC,eAAW;AAAA,EACb;AACF;AAEA,eAAsB,2BAA2B,SAMY;AAI3D,QAAM,kBAAkB,IAAI,4BAAgB;AAAA,IAC1C,WAAW,QAAQ,aAAa,aAAa;AAAA;AAAA,EAC/C,CAAQ;AACR,kBAAgB,mBAAmB;AACnC,kBAAgB,mBAAmB;AACnC,kBAAgB,cAAc;AAC9B,kBAAgB,SAAS,QAAQ;AACjC,kBAAgB,UAAM,6BAAgB,QAAQ,GAAG;AACjD,EAAC,gBAAwB,cAAc,QAAQ,mBAAe,6BAAgB,QAAQ,WAAW;AACjG,QAAM,aAAa,CAAC,GAAG,QAAQ,QAAQ,QAAQ,CAAC,EAAE,KAAK;AACvD,EAAC,gBAAwB,gBAAgB,YAAY,WAAW,MAAM;AACtE,kBAAgB,KAAK,OAAO,KAAK,QAAQ,IAAI,CAAC;AAC9C,kBAAgB,WAAW;AAC3B,kBAAgB,KAAK,IAAI;AAEzB,QAAM,iBAAiB,IAAI,6BAA6B,eAAe;AAEvE,SAAO,CAAC,iBAAiB,cAAc;AACzC;","names":[]}
|
package/dist/utils/numbers.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare function prettyPrintWithMagnitudes(num: number): string;
|
|
2
|
+
declare function toFixedMax(num: number, maxDecimals: number): string;
|
|
3
|
+
declare function numberCompare(a: number, b: number): number;
|
|
4
|
+
|
|
5
|
+
export { numberCompare, prettyPrintWithMagnitudes, toFixedMax };
|
package/dist/utils/numbers.js
CHANGED
|
@@ -1,72 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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/numbers.tsx
|
|
21
|
+
var numbers_exports = {};
|
|
22
|
+
__export(numbers_exports, {
|
|
23
|
+
numberCompare: () => numberCompare,
|
|
24
|
+
prettyPrintWithMagnitudes: () => prettyPrintWithMagnitudes,
|
|
25
|
+
toFixedMax: () => toFixedMax
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(numbers_exports);
|
|
28
|
+
var magnitudes = [
|
|
29
|
+
[1e15, "trln"],
|
|
30
|
+
[1e12, "bln"],
|
|
31
|
+
[1e9, "bn"],
|
|
32
|
+
[1e6, "M"],
|
|
33
|
+
[1e3, "k"]
|
|
7
34
|
];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return "∞";
|
|
17
|
-
for (const [magnitude, suffix] of magnitudes) {
|
|
18
|
-
if (num >= magnitude) {
|
|
19
|
-
return toFixedMax(num / magnitude, 1) + suffix;
|
|
20
|
-
}
|
|
35
|
+
function prettyPrintWithMagnitudes(num) {
|
|
36
|
+
if (typeof num !== "number") throw new Error("Expected a number");
|
|
37
|
+
if (Number.isNaN(num)) return "NaN";
|
|
38
|
+
if (num < 0) return "-" + prettyPrintWithMagnitudes(-num);
|
|
39
|
+
if (!Number.isFinite(num)) return "\u221E";
|
|
40
|
+
for (const [magnitude, suffix] of magnitudes) {
|
|
41
|
+
if (num >= magnitude) {
|
|
42
|
+
return toFixedMax(num / magnitude, 1) + suffix;
|
|
21
43
|
}
|
|
22
|
-
|
|
44
|
+
}
|
|
45
|
+
return toFixedMax(num, 1);
|
|
23
46
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
expect(prettyPrintWithMagnitudes(1000)).toBe("1k");
|
|
27
|
-
expect(prettyPrintWithMagnitudes(1500)).toBe("1.5k");
|
|
28
|
-
expect(prettyPrintWithMagnitudes(1000000)).toBe("1M");
|
|
29
|
-
expect(prettyPrintWithMagnitudes(1500000)).toBe("1.5M");
|
|
30
|
-
expect(prettyPrintWithMagnitudes(1000000000)).toBe("1bn");
|
|
31
|
-
expect(prettyPrintWithMagnitudes(1500000000)).toBe("1.5bn");
|
|
32
|
-
expect(prettyPrintWithMagnitudes(1000000000000)).toBe("1bln");
|
|
33
|
-
expect(prettyPrintWithMagnitudes(1500000000000)).toBe("1.5bln");
|
|
34
|
-
expect(prettyPrintWithMagnitudes(1000000000000000)).toBe("1trln");
|
|
35
|
-
expect(prettyPrintWithMagnitudes(1500000000000000)).toBe("1.5trln");
|
|
36
|
-
// Test small numbers
|
|
37
|
-
expect(prettyPrintWithMagnitudes(100)).toBe("100");
|
|
38
|
-
expect(prettyPrintWithMagnitudes(0)).toBe("0");
|
|
39
|
-
expect(prettyPrintWithMagnitudes(0.5)).toBe("0.5");
|
|
40
|
-
// Test negative numbers
|
|
41
|
-
expect(prettyPrintWithMagnitudes(-1000)).toBe("-1k");
|
|
42
|
-
expect(prettyPrintWithMagnitudes(-1500000)).toBe("-1.5M");
|
|
43
|
-
// Test special cases
|
|
44
|
-
expect(prettyPrintWithMagnitudes(NaN)).toBe("NaN");
|
|
45
|
-
expect(prettyPrintWithMagnitudes(Infinity)).toBe("∞");
|
|
46
|
-
expect(prettyPrintWithMagnitudes(-Infinity)).toBe("-∞");
|
|
47
|
-
});
|
|
48
|
-
export function toFixedMax(num, maxDecimals) {
|
|
49
|
-
return num.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
47
|
+
function toFixedMax(num, maxDecimals) {
|
|
48
|
+
return num.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
expect(toFixedMax(1.2, 2)).toBe("1.2");
|
|
54
|
-
expect(toFixedMax(1.23, 2)).toBe("1.23");
|
|
55
|
-
expect(toFixedMax(1.234, 2)).toBe("1.23");
|
|
56
|
-
expect(toFixedMax(1.0, 2)).toBe("1");
|
|
57
|
-
expect(toFixedMax(1.20, 2)).toBe("1.2");
|
|
58
|
-
expect(toFixedMax(0, 2)).toBe("0");
|
|
59
|
-
});
|
|
60
|
-
export function numberCompare(a, b) {
|
|
61
|
-
return Math.sign(a - b);
|
|
50
|
+
function numberCompare(a, b) {
|
|
51
|
+
return Math.sign(a - b);
|
|
62
52
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
expect(numberCompare(-1, -2)).toBe(1);
|
|
69
|
-
expect(numberCompare(-2, -1)).toBe(-1);
|
|
70
|
-
expect(numberCompare(-1, 1)).toBe(-1);
|
|
71
|
-
expect(numberCompare(1, -1)).toBe(1);
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
numberCompare,
|
|
56
|
+
prettyPrintWithMagnitudes,
|
|
57
|
+
toFixedMax
|
|
72
58
|
});
|
|
59
|
+
//# sourceMappingURL=numbers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/numbers.tsx"],"sourcesContent":["const magnitudes = [\n [1_000_000_000_000_000, \"trln\"],\n [1_000_000_000_000, \"bln\"],\n [1_000_000_000, \"bn\"],\n [1_000_000, \"M\"],\n [1_000, \"k\"],\n] as const;\n\nexport function prettyPrintWithMagnitudes(num: number): string {\n if (typeof num !== \"number\") throw new Error(\"Expected a number\");\n if (Number.isNaN(num)) return \"NaN\";\n if (num < 0) return \"-\" + prettyPrintWithMagnitudes(-num);\n if (!Number.isFinite(num)) return \"∞\";\n\n for (const [magnitude, suffix] of magnitudes) {\n if (num >= magnitude) {\n return toFixedMax(num / magnitude, 1) + suffix;\n }\n }\n return toFixedMax(num, 1); // Handle numbers less than 1,000 without suffix.\n}\nundefined?.test(\"prettyPrintWithMagnitudes\", ({ expect }) => {\n // Test different magnitudes\n expect(prettyPrintWithMagnitudes(1000)).toBe(\"1k\");\n expect(prettyPrintWithMagnitudes(1500)).toBe(\"1.5k\");\n expect(prettyPrintWithMagnitudes(1000000)).toBe(\"1M\");\n expect(prettyPrintWithMagnitudes(1500000)).toBe(\"1.5M\");\n expect(prettyPrintWithMagnitudes(1000000000)).toBe(\"1bn\");\n expect(prettyPrintWithMagnitudes(1500000000)).toBe(\"1.5bn\");\n expect(prettyPrintWithMagnitudes(1000000000000)).toBe(\"1bln\");\n expect(prettyPrintWithMagnitudes(1500000000000)).toBe(\"1.5bln\");\n expect(prettyPrintWithMagnitudes(1000000000000000)).toBe(\"1trln\");\n expect(prettyPrintWithMagnitudes(1500000000000000)).toBe(\"1.5trln\");\n // Test small numbers\n expect(prettyPrintWithMagnitudes(100)).toBe(\"100\");\n expect(prettyPrintWithMagnitudes(0)).toBe(\"0\");\n expect(prettyPrintWithMagnitudes(0.5)).toBe(\"0.5\");\n // Test negative numbers\n expect(prettyPrintWithMagnitudes(-1000)).toBe(\"-1k\");\n expect(prettyPrintWithMagnitudes(-1500000)).toBe(\"-1.5M\");\n // Test special cases\n expect(prettyPrintWithMagnitudes(NaN)).toBe(\"NaN\");\n expect(prettyPrintWithMagnitudes(Infinity)).toBe(\"∞\");\n expect(prettyPrintWithMagnitudes(-Infinity)).toBe(\"-∞\");\n});\n\nexport function toFixedMax(num: number, maxDecimals: number): string {\n return num.toFixed(maxDecimals).replace(/\\.?0+$/, \"\");\n}\nundefined?.test(\"toFixedMax\", ({ expect }) => {\n expect(toFixedMax(1, 2)).toBe(\"1\");\n expect(toFixedMax(1.2, 2)).toBe(\"1.2\");\n expect(toFixedMax(1.23, 2)).toBe(\"1.23\");\n expect(toFixedMax(1.234, 2)).toBe(\"1.23\");\n expect(toFixedMax(1.0, 2)).toBe(\"1\");\n expect(toFixedMax(1.20, 2)).toBe(\"1.2\");\n expect(toFixedMax(0, 2)).toBe(\"0\");\n});\n\nexport function numberCompare(a: number, b: number): number {\n return Math.sign(a - b);\n}\nundefined?.test(\"numberCompare\", ({ expect }) => {\n expect(numberCompare(1, 2)).toBe(-1);\n expect(numberCompare(2, 1)).toBe(1);\n expect(numberCompare(1, 1)).toBe(0);\n expect(numberCompare(0, 0)).toBe(0);\n expect(numberCompare(-1, -2)).toBe(1);\n expect(numberCompare(-2, -1)).toBe(-1);\n expect(numberCompare(-1, 1)).toBe(-1);\n expect(numberCompare(1, -1)).toBe(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,aAAa;AAAA,EACjB,CAAC,MAAuB,MAAM;AAAA,EAC9B,CAAC,MAAmB,KAAK;AAAA,EACzB,CAAC,KAAe,IAAI;AAAA,EACpB,CAAC,KAAW,GAAG;AAAA,EACf,CAAC,KAAO,GAAG;AACb;AAEO,SAAS,0BAA0B,KAAqB;AAC7D,MAAI,OAAO,QAAQ,SAAU,OAAM,IAAI,MAAM,mBAAmB;AAChE,MAAI,OAAO,MAAM,GAAG,EAAG,QAAO;AAC9B,MAAI,MAAM,EAAG,QAAO,MAAM,0BAA0B,CAAC,GAAG;AACxD,MAAI,CAAC,OAAO,SAAS,GAAG,EAAG,QAAO;AAElC,aAAW,CAAC,WAAW,MAAM,KAAK,YAAY;AAC5C,QAAI,OAAO,WAAW;AACpB,aAAO,WAAW,MAAM,WAAW,CAAC,IAAI;AAAA,IAC1C;AAAA,EACF;AACA,SAAO,WAAW,KAAK,CAAC;AAC1B;AA0BO,SAAS,WAAW,KAAa,aAA6B;AACnE,SAAO,IAAI,QAAQ,WAAW,EAAE,QAAQ,UAAU,EAAE;AACtD;AAWO,SAAS,cAAc,GAAW,GAAmB;AAC1D,SAAO,KAAK,KAAK,IAAI,CAAC;AACxB;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const standardProviders: readonly ["google", "github", "microsoft", "spotify", "facebook", "discord", "gitlab", "bitbucket", "linkedin", "apple", "x"];
|
|
2
|
+
declare const sharedProviders: readonly ["google", "github", "microsoft", "spotify"];
|
|
3
|
+
declare const allProviders: readonly ["google", "github", "microsoft", "spotify", "facebook", "discord", "gitlab", "bitbucket", "linkedin", "apple", "x"];
|
|
4
|
+
type ProviderType = typeof allProviders[number];
|
|
5
|
+
type StandardProviderType = typeof standardProviders[number];
|
|
6
|
+
type SharedProviderType = typeof sharedProviders[number];
|
|
7
|
+
|
|
8
|
+
export { type ProviderType, type SharedProviderType, type StandardProviderType, allProviders, sharedProviders, standardProviders };
|
package/dist/utils/oauth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
declare const standardProviders: readonly ["google", "github", "microsoft", "spotify", "facebook", "discord", "gitlab", "bitbucket", "linkedin", "apple", "x"];
|
|
2
|
+
declare const sharedProviders: readonly ["google", "github", "microsoft", "spotify"];
|
|
3
|
+
declare const allProviders: readonly ["google", "github", "microsoft", "spotify", "facebook", "discord", "gitlab", "bitbucket", "linkedin", "apple", "x"];
|
|
4
|
+
type ProviderType = typeof allProviders[number];
|
|
5
|
+
type StandardProviderType = typeof standardProviders[number];
|
|
6
|
+
type SharedProviderType = typeof sharedProviders[number];
|
|
7
|
+
|
|
8
|
+
export { type ProviderType, type SharedProviderType, type StandardProviderType, allProviders, sharedProviders, standardProviders };
|
package/dist/utils/oauth.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
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/utils/oauth.tsx
|
|
21
|
+
var oauth_exports = {};
|
|
22
|
+
__export(oauth_exports, {
|
|
23
|
+
allProviders: () => allProviders,
|
|
24
|
+
sharedProviders: () => sharedProviders,
|
|
25
|
+
standardProviders: () => standardProviders
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(oauth_exports);
|
|
28
|
+
var standardProviders = ["google", "github", "microsoft", "spotify", "facebook", "discord", "gitlab", "bitbucket", "linkedin", "apple", "x"];
|
|
29
|
+
var sharedProviders = ["google", "github", "microsoft", "spotify"];
|
|
30
|
+
var allProviders = standardProviders;
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
allProviders,
|
|
34
|
+
sharedProviders,
|
|
35
|
+
standardProviders
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/oauth.tsx"],"sourcesContent":["export const standardProviders = [\"google\", \"github\", \"microsoft\", \"spotify\", \"facebook\", \"discord\", \"gitlab\", \"bitbucket\", \"linkedin\", \"apple\", \"x\"] as const;\n// No more shared providers should be added except for special cases\nexport const sharedProviders = [\"google\", \"github\", \"microsoft\", \"spotify\"] as const;\nexport const allProviders = standardProviders;\n\nexport type ProviderType = typeof allProviders[number];\nexport type StandardProviderType = typeof standardProviders[number];\nexport type SharedProviderType = typeof sharedProviders[number];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,oBAAoB,CAAC,UAAU,UAAU,aAAa,WAAW,YAAY,WAAW,UAAU,aAAa,YAAY,SAAS,GAAG;AAE7I,IAAM,kBAAkB,CAAC,UAAU,UAAU,aAAa,SAAS;AACnE,IAAM,eAAe;","names":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare function isNotNull<T>(value: T): value is NonNullable<T>;
|
|
2
|
+
type DeepPartial<T> = T extends object ? (T extends (infer E)[] ? T : {
|
|
3
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
4
|
+
}) : T;
|
|
5
|
+
type DeepRequired<T> = T extends object ? (T extends (infer E)[] ? T : {
|
|
6
|
+
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
7
|
+
}) : T;
|
|
8
|
+
/**
|
|
9
|
+
* Assumes both objects are primitives, arrays, or non-function plain objects, and compares them deeply.
|
|
10
|
+
*
|
|
11
|
+
* Note that since they are assumed to be plain objects, this function does not compare prototypes.
|
|
12
|
+
*/
|
|
13
|
+
declare function deepPlainEquals<T>(obj1: T, obj2: unknown, options?: {
|
|
14
|
+
ignoreUndefinedValues?: boolean;
|
|
15
|
+
}): obj2 is T;
|
|
16
|
+
declare function isCloneable<T>(obj: T): obj is Exclude<T, symbol | Function>;
|
|
17
|
+
declare function shallowClone<T extends object>(obj: T): T;
|
|
18
|
+
declare function deepPlainClone<T>(obj: T): T;
|
|
19
|
+
type DeepMerge<T, U> = Omit<T, keyof U> & Omit<U, keyof T> & DeepMergeInner<Pick<T, keyof U & keyof T>, Pick<U, keyof U & keyof T>>;
|
|
20
|
+
type DeepMergeInner<T, U> = {
|
|
21
|
+
[K in keyof U]-?: undefined extends U[K] ? K extends keyof T ? T[K] extends object ? Exclude<U[K], undefined> extends object ? DeepMerge<T[K], Exclude<U[K], undefined>> : T[K] | Exclude<U[K], undefined> : T[K] | Exclude<U[K], undefined> : Exclude<U[K], undefined> : K extends keyof T ? T[K] extends object ? U[K] extends object ? DeepMerge<T[K], U[K]> : U[K] : U[K] : U[K];
|
|
22
|
+
};
|
|
23
|
+
declare function deepMerge<T extends {}, U extends {}>(baseObj: T, mergeObj: U): DeepMerge<T, U>;
|
|
24
|
+
declare function typedEntries<T extends {}>(obj: T): [keyof T, T[keyof T]][];
|
|
25
|
+
declare function typedFromEntries<K extends PropertyKey, V>(entries: (readonly [K, V])[]): Record<K, V>;
|
|
26
|
+
declare function typedKeys<T extends {}>(obj: T): (keyof T)[];
|
|
27
|
+
declare function typedValues<T extends {}>(obj: T): T[keyof T][];
|
|
28
|
+
declare function typedAssign<T extends {}, U extends {}>(target: T, source: U): T & U;
|
|
29
|
+
type FilterUndefined<T> = {
|
|
30
|
+
[k in keyof T as (undefined extends T[k] ? (T[k] extends undefined | void ? never : k) : never)]+?: T[k] & ({} | null);
|
|
31
|
+
} & {
|
|
32
|
+
[k in keyof T as (undefined extends T[k] ? never : k)]: T[k] & ({} | null);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Returns a new object with all undefined values removed. Useful when spreading optional parameters on an object, as
|
|
36
|
+
* TypeScript's `Partial<XYZ>` type allows `undefined` values.
|
|
37
|
+
*/
|
|
38
|
+
declare function filterUndefined<T extends object>(obj: T): FilterUndefined<T>;
|
|
39
|
+
type FilterUndefinedOrNull<T> = FilterUndefined<{
|
|
40
|
+
[k in keyof T]: null extends T[k] ? NonNullable<T[k]> | undefined : T[k];
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a new object with all undefined and null values removed. Useful when spreading optional parameters on an object, as
|
|
44
|
+
* TypeScript's `Partial<XYZ>` type allows `undefined` values.
|
|
45
|
+
*/
|
|
46
|
+
declare function filterUndefinedOrNull<T extends object>(obj: T): FilterUndefinedOrNull<T>;
|
|
47
|
+
type DeepFilterUndefined<T> = T extends object ? FilterUndefined<{
|
|
48
|
+
[K in keyof T]: DeepFilterUndefined<T[K]>;
|
|
49
|
+
}> : T;
|
|
50
|
+
declare function deepFilterUndefined<T extends object>(obj: T): DeepFilterUndefined<T>;
|
|
51
|
+
declare function pick<T extends {}, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
52
|
+
declare function omit<T extends {}, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
53
|
+
declare function split<T extends {}, K extends keyof T>(obj: T, keys: K[]): [Pick<T, K>, Omit<T, K>];
|
|
54
|
+
declare function mapValues<T extends object, U>(obj: T, fn: (value: T extends (infer E)[] ? E : T[keyof T]) => U): Record<keyof T, U>;
|
|
55
|
+
declare function sortKeys<T extends object>(obj: T): T;
|
|
56
|
+
declare function deepSortKeys<T extends object>(obj: T): T;
|
|
57
|
+
declare function set<T extends object, K extends keyof T>(obj: T, key: K, value: T[K]): void;
|
|
58
|
+
declare function get<T extends object, K extends keyof T>(obj: T, key: K): T[K];
|
|
59
|
+
declare function getOrUndefined<T extends object, K extends keyof T>(obj: T, key: K): T[K] | undefined;
|
|
60
|
+
declare function has<T extends object, K extends keyof T>(obj: T, key: K): obj is T & {
|
|
61
|
+
[k in K]: unknown;
|
|
62
|
+
};
|
|
63
|
+
declare function hasAndNotUndefined<T extends object, K extends keyof T>(obj: T, key: K): obj is T & {
|
|
64
|
+
[k in K]: Exclude<T[K], undefined>;
|
|
65
|
+
};
|
|
66
|
+
declare function deleteKey<T extends object, K extends keyof T>(obj: T, key: K): void;
|
|
67
|
+
declare function isObjectLike(value: unknown): value is object;
|
|
68
|
+
|
|
69
|
+
export { type DeepFilterUndefined, type DeepMerge, type DeepPartial, type DeepRequired, type FilterUndefined, type FilterUndefinedOrNull, deepFilterUndefined, deepMerge, deepPlainClone, deepPlainEquals, deepSortKeys, deleteKey, filterUndefined, filterUndefinedOrNull, get, getOrUndefined, has, hasAndNotUndefined, isCloneable, isNotNull, isObjectLike, mapValues, omit, pick, set, shallowClone, sortKeys, split, typedAssign, typedEntries, typedFromEntries, typedKeys, typedValues };
|
package/dist/utils/objects.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare function isNotNull<T>(value: T): value is NonNullable<T>;
|
|
2
|
+
type DeepPartial<T> = T extends object ? (T extends (infer E)[] ? T : {
|
|
3
3
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
4
|
-
} : T;
|
|
5
|
-
|
|
4
|
+
}) : T;
|
|
5
|
+
type DeepRequired<T> = T extends object ? (T extends (infer E)[] ? T : {
|
|
6
6
|
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
7
|
-
} : T;
|
|
7
|
+
}) : T;
|
|
8
8
|
/**
|
|
9
9
|
* Assumes both objects are primitives, arrays, or non-function plain objects, and compares them deeply.
|
|
10
10
|
*
|
|
11
11
|
* Note that since they are assumed to be plain objects, this function does not compare prototypes.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
declare function deepPlainEquals<T>(obj1: T, obj2: unknown, options?: {
|
|
14
14
|
ignoreUndefinedValues?: boolean;
|
|
15
15
|
}): obj2 is T;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
declare function isCloneable<T>(obj: T): obj is Exclude<T, symbol | Function>;
|
|
17
|
+
declare function shallowClone<T extends object>(obj: T): T;
|
|
18
|
+
declare function deepPlainClone<T>(obj: T): T;
|
|
19
|
+
type DeepMerge<T, U> = Omit<T, keyof U> & Omit<U, keyof T> & DeepMergeInner<Pick<T, keyof U & keyof T>, Pick<U, keyof U & keyof T>>;
|
|
20
20
|
type DeepMergeInner<T, U> = {
|
|
21
21
|
[K in keyof U]-?: undefined extends U[K] ? K extends keyof T ? T[K] extends object ? Exclude<U[K], undefined> extends object ? DeepMerge<T[K], Exclude<U[K], undefined>> : T[K] | Exclude<U[K], undefined> : T[K] | Exclude<U[K], undefined> : Exclude<U[K], undefined> : K extends keyof T ? T[K] extends object ? U[K] extends object ? DeepMerge<T[K], U[K]> : U[K] : U[K] : U[K];
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
declare function deepMerge<T extends {}, U extends {}>(baseObj: T, mergeObj: U): DeepMerge<T, U>;
|
|
24
|
+
declare function typedEntries<T extends {}>(obj: T): [keyof T, T[keyof T]][];
|
|
25
|
+
declare function typedFromEntries<K extends PropertyKey, V>(entries: (readonly [K, V])[]): Record<K, V>;
|
|
26
|
+
declare function typedKeys<T extends {}>(obj: T): (keyof T)[];
|
|
27
|
+
declare function typedValues<T extends {}>(obj: T): T[keyof T][];
|
|
28
|
+
declare function typedAssign<T extends {}, U extends {}>(target: T, source: U): T & U;
|
|
29
|
+
type FilterUndefined<T> = {
|
|
30
30
|
[k in keyof T as (undefined extends T[k] ? (T[k] extends undefined | void ? never : k) : never)]+?: T[k] & ({} | null);
|
|
31
31
|
} & {
|
|
32
32
|
[k in keyof T as (undefined extends T[k] ? never : k)]: T[k] & ({} | null);
|
|
@@ -35,30 +35,35 @@ export type FilterUndefined<T> = {
|
|
|
35
35
|
* Returns a new object with all undefined values removed. Useful when spreading optional parameters on an object, as
|
|
36
36
|
* TypeScript's `Partial<XYZ>` type allows `undefined` values.
|
|
37
37
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
declare function filterUndefined<T extends object>(obj: T): FilterUndefined<T>;
|
|
39
|
+
type FilterUndefinedOrNull<T> = FilterUndefined<{
|
|
40
40
|
[k in keyof T]: null extends T[k] ? NonNullable<T[k]> | undefined : T[k];
|
|
41
41
|
}>;
|
|
42
42
|
/**
|
|
43
43
|
* Returns a new object with all undefined and null values removed. Useful when spreading optional parameters on an object, as
|
|
44
44
|
* TypeScript's `Partial<XYZ>` type allows `undefined` values.
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
declare function filterUndefinedOrNull<T extends object>(obj: T): FilterUndefinedOrNull<T>;
|
|
47
|
+
type DeepFilterUndefined<T> = T extends object ? FilterUndefined<{
|
|
48
48
|
[K in keyof T]: DeepFilterUndefined<T[K]>;
|
|
49
49
|
}> : T;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
declare function deepFilterUndefined<T extends object>(obj: T): DeepFilterUndefined<T>;
|
|
51
|
+
declare function pick<T extends {}, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
52
|
+
declare function omit<T extends {}, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
53
|
+
declare function split<T extends {}, K extends keyof T>(obj: T, keys: K[]): [Pick<T, K>, Omit<T, K>];
|
|
54
|
+
declare function mapValues<T extends object, U>(obj: T, fn: (value: T extends (infer E)[] ? E : T[keyof T]) => U): Record<keyof T, U>;
|
|
55
|
+
declare function sortKeys<T extends object>(obj: T): T;
|
|
56
|
+
declare function deepSortKeys<T extends object>(obj: T): T;
|
|
57
|
+
declare function set<T extends object, K extends keyof T>(obj: T, key: K, value: T[K]): void;
|
|
58
|
+
declare function get<T extends object, K extends keyof T>(obj: T, key: K): T[K];
|
|
59
|
+
declare function getOrUndefined<T extends object, K extends keyof T>(obj: T, key: K): T[K] | undefined;
|
|
60
|
+
declare function has<T extends object, K extends keyof T>(obj: T, key: K): obj is T & {
|
|
57
61
|
[k in K]: unknown;
|
|
58
62
|
};
|
|
59
|
-
|
|
63
|
+
declare function hasAndNotUndefined<T extends object, K extends keyof T>(obj: T, key: K): obj is T & {
|
|
60
64
|
[k in K]: Exclude<T[K], undefined>;
|
|
61
65
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
declare function deleteKey<T extends object, K extends keyof T>(obj: T, key: K): void;
|
|
67
|
+
declare function isObjectLike(value: unknown): value is object;
|
|
68
|
+
|
|
69
|
+
export { type DeepFilterUndefined, type DeepMerge, type DeepPartial, type DeepRequired, type FilterUndefined, type FilterUndefinedOrNull, deepFilterUndefined, deepMerge, deepPlainClone, deepPlainEquals, deepSortKeys, deleteKey, filterUndefined, filterUndefinedOrNull, get, getOrUndefined, has, hasAndNotUndefined, isCloneable, isNotNull, isObjectLike, mapValues, omit, pick, set, shallowClone, sortKeys, split, typedAssign, typedEntries, typedFromEntries, typedKeys, typedValues };
|