@koolbase/react-native 11.1.0 → 11.3.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 +90 -0
  2. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,96 @@ adheres to [Semantic Versioning][semver].
7
7
  [kac]: https://keepachangelog.com/en/1.1.0/
8
8
  [semver]: https://semver.org/
9
9
 
10
+ ## 11.3.0
11
+
12
+ ### Fixed
13
+
14
+ - **Thirty error codes the API emits were not mapped**, so they arrived as
15
+ generic errors and an app's `instanceof` branch silently never ran. The
16
+ worst of them is `revision_mismatch`: the server attaches the current
17
+ record and both revisions to that 409 specifically so a conflict can be
18
+ resolved without a second fetch, and no app could reach any of it.
19
+ `KoolbaseRevisionMismatchError` now carries `expectedRevision`,
20
+ `currentRevision` and `current` as typed fields.
21
+
22
+ Also now catchable: `plan_limit_reached` (as `KoolbasePlanLimitError`,
23
+ shared across database, storage and functions, carrying resource, limit
24
+ and plan), `insufficient_scope`, `idempotency_key_reused` /
25
+ `idempotency_conflict`, `batch_failed`, `duplicate_values`,
26
+ `identity_not_found`, `provider_identity_already_linked`,
27
+ `vector_field_exists`, `field_not_auto_embed`, `invalid_embedding_config`,
28
+ `provider_not_configured`, `provider_invalid`, `upload_url_failed`,
29
+ `slug_taken`, `invitation_invalid`, `project_invalid`, `invalid_body`,
30
+ `no_changes`, the four seed codes, and the generic conflict codes.
31
+
32
+ - **Two mappings were for codes the API does not emit.** `session_expired`
33
+ and `token_revoked` were handled as though the server sent them; it sends
34
+ `invalid_refresh_token`, which already maps to `SessionExpiredError`.
35
+ Removed, along with three message-substring guesses at revocation.
36
+ `TokenRevokedError` stays as a class: explicit revocation is worth
37
+ distinguishing from expiry, but only once the server can establish it —
38
+ a generic 401 cannot, and the SDK must not infer it.
39
+
40
+ - **`restoreSession` no longer clears the stored session on
41
+ `InvalidCredentialsError`.** It means "these credentials are wrong", which
42
+ during a restore points at the project key or the request rather than the
43
+ user's session — and deleting the refresh token on that reading signs
44
+ someone out with no way back. Only a refused refresh clears it now.
45
+
46
+ - **Errors report the code the server sent.**
47
+ `KoolbaseIdempotencyKeyReusedError` hardcoded one code while serving two.
48
+
49
+ ### Why these were missing
50
+
51
+ The API wrote error codes through four different helpers, so no single search
52
+ found them all, and the comparison against what these SDKs map took four grep
53
+ patterns and still missed several. The API now declares every code as a
54
+ constant in one file, with a test that fails the build on a literal — so the
55
+ comparison is exact. That is how these thirty were found, and three codes
56
+ nobody had written down anywhere.
57
+
58
+ Every surface here has a test asserting each code maps to its own class and
59
+ reports its own code, so the next one added to the API without a case here
60
+ fails the build rather than a user's upload.
61
+
62
+ ## 11.2.0
63
+
64
+ ### Fixed
65
+
66
+ - **A function that timed out was indistinguishable from one that threw.** A
67
+ 504 fell into the generic 5xx branch and arrived as
68
+ `FunctionExecutionError`. Those need different answers — a timeout means
69
+ retry, raise the function's timeout at deploy, or move the slow part
70
+ elsewhere; an exception means fix the code. The server has always told them
71
+ apart. Now `FunctionTimeoutError`, and 429 gets `FunctionRateLimitError`
72
+ rather than falling through untyped.
73
+
74
+ - **`upload_expired` and `cap_below_usage` were unmapped in storage.** The
75
+ first matters: a presigned upload URL has a lifetime, and a user who picks a
76
+ file, gets distracted and confirms twenty minutes later hit it as a generic
77
+ failure. It is a retry, not a failure — presign again and send the same
78
+ bytes. Now `KoolbaseUploadExpiredError`.
79
+
80
+ - **Four database codes were unmapped**: `ambiguous_match`,
81
+ `constraint_exists`, `constraint_not_found`, `insufficient_authority`. The
82
+ first is the one an app hits — an upsert whose filter matched more than one
83
+ record is refused rather than resolved, because picking one would be a
84
+ silent guess about which row the caller meant.
85
+
86
+ - **Errors report the code the server sent, not their category.**
87
+ `KoolbaseNotFoundError` and `KoolbaseValidationError` each hardcoded one
88
+ code while being used for several, so a `collection_not_found` response
89
+ produced an error reporting `not_found`. Catching the class works as
90
+ before; reading `e.code` now gives the server's answer.
91
+
92
+ ### Why these were missing
93
+
94
+ The API writes error codes through four different helpers, so no single
95
+ search finds them all — which is how twenty-two codes across four surfaces
96
+ went unmapped without anyone noticing. Each surface now has a test asserting
97
+ every known code maps to its own class, so a new one added without a case
98
+ here fails the build rather than a user's upload.
99
+
10
100
  ## 11.1.0
11
101
 
12
102
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/react-native",
3
- "version": "11.1.0",
3
+ "version": "11.3.0",
4
4
  "description": "React Native SDK for Koolbase \u2014 auth, database, storage, realtime, feature flags, and functions in one package.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/koolbase/koolbase-react-native"
25
25
  },
26
26
  "dependencies": {
27
- "@koolbase/core": "11.1.0"
27
+ "@koolbase/core": "11.3.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-native-async-storage/async-storage": "^3.0.2",