@koolbase/js 11.0.0 → 11.2.0

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.
Files changed (2) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,87 @@ is based on [Keep a Changelog][kac], and this project adheres to
7
7
  [kac]: https://keepachangelog.com/en/1.1.0/
8
8
  [semver]: https://semver.org/
9
9
 
10
+ ## 11.2.0
11
+
12
+ ### Fixed
13
+
14
+ - **A function that timed out was indistinguishable from one that threw.** A
15
+ 504 fell into the generic 5xx branch and arrived as
16
+ `FunctionExecutionError`. Those need different answers — a timeout means
17
+ retry, raise the function's timeout at deploy, or move the slow part
18
+ elsewhere; an exception means fix the code. The server has always told them
19
+ apart. Now `FunctionTimeoutError`, and 429 gets `FunctionRateLimitError`
20
+ rather than falling through untyped.
21
+
22
+ - **`upload_expired` and `cap_below_usage` were unmapped in storage.** The
23
+ first matters: a presigned upload URL has a lifetime, and a user who picks a
24
+ file, gets distracted and confirms twenty minutes later hit it as a generic
25
+ failure. It is a retry, not a failure — presign again and send the same
26
+ bytes. Now `KoolbaseUploadExpiredError`.
27
+
28
+ - **Four database codes were unmapped**: `ambiguous_match`,
29
+ `constraint_exists`, `constraint_not_found`, `insufficient_authority`. The
30
+ first is the one an app hits — an upsert whose filter matched more than one
31
+ record is refused rather than resolved, because picking one would be a
32
+ silent guess about which row the caller meant.
33
+
34
+ - **Errors report the code the server sent, not their category.**
35
+ `KoolbaseNotFoundError` and `KoolbaseValidationError` each hardcoded one
36
+ code while being used for several, so a `collection_not_found` response
37
+ produced an error reporting `not_found`. Catching the class works as
38
+ before; reading `e.code` now gives the server's answer.
39
+
40
+ ### Why these were missing
41
+
42
+ The API writes error codes through four different helpers, so no single
43
+ search finds them all — which is how twenty-two codes across four surfaces
44
+ went unmapped without anyone noticing. Each surface now has a test asserting
45
+ every known code maps to its own class, so a new one added without a case
46
+ here fails the build rather than a user's upload.
47
+
48
+ ## 11.1.0
49
+
50
+ ### Fixed
51
+
52
+ - **Fourteen error codes the API emits were not mapped**, so they arrived as
53
+ a generic error and an app's `instanceof` branch silently never ran. The
54
+ most consequential is `contact_not_verified` — in a project with verified
55
+ contact required, a user who registers, does not click the link, and comes
56
+ back is the *commonest* auth failure there is, and it had no type. Now:
57
+
58
+ | Code | Class |
59
+ |---|---|
60
+ | `contact_not_verified`, `email_not_verified` | `ContactNotVerifiedError` |
61
+ | `signups_disabled` | `SignupsDisabledError` |
62
+ | `weak_password` | `WeakPasswordError` (existed, never mapped from the server) |
63
+ | `account_exists` | `AccountExistsError` |
64
+ | `token_expired` | `TokenExpiredError` |
65
+ | `token_used` | `TokenAlreadyUsedError` |
66
+ | `invalid_token` | `UnlockTokenInvalidError` |
67
+ | `invalid_password` | `CurrentPasswordIncorrectError` |
68
+ | `oauth_only_account` | `OAuthOnlyAccountError` |
69
+ | `unsupported_oauth_provider` | `UnsupportedOAuthProviderError` |
70
+ | `session_required` | `SessionRequiredError` |
71
+ | `insufficient_authority` | `InsufficientAuthorityError` |
72
+ | `last_credential` | `LastCredentialError` |
73
+ | `hide_requires_verification` | `HideRequiresVerificationError` |
74
+
75
+ `CurrentPasswordIncorrectError` is named for the operation rather than the
76
+ code: the server calls it `invalid_password`, which reads like a rejected
77
+ new password and means the opposite.
78
+
79
+ - **`WeakPasswordError` carries the server's message** when there is one. The
80
+ SDK checks length before sending; a project may require more, and "must be
81
+ at least 8 characters" would then be both wrong and unhelpful. Its
82
+ constructor argument is optional, so existing code is unaffected.
83
+
84
+ ### Why these were missing
85
+
86
+ Nothing inside the SDK can tell that a code fell through — the generic error
87
+ is a valid object and the app's branch simply does not run. There is now a
88
+ test that asserts every code maps to its own class, so a new code added to the
89
+ API without a case here fails the build rather than a user's password reset.
90
+
10
91
  ## 11.0.0
11
92
 
12
93
  ### Read before upgrading
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/js",
3
- "version": "11.0.0",
3
+ "version": "11.2.0",
4
4
  "description": "Koolbase SDK for the browser \u2014 auth, database, storage, realtime, functions, flags and offline sync in one package.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/koolbase/koolbase-react-native"
26
26
  },
27
27
  "dependencies": {
28
- "@koolbase/core": "11.0.0"
28
+ "@koolbase/core": "11.2.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"