@supatype/client 0.9.2 → 0.10.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 (99) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +112 -77
  3. package/.turbo/turbo-typecheck.log +2 -2
  4. package/CHANGELOG.md +123 -20
  5. package/README.md +18 -0
  6. package/dist/auth.d.ts +4 -0
  7. package/dist/auth.d.ts.map +1 -1
  8. package/dist/auth.js +38 -13
  9. package/dist/auth.js.map +1 -1
  10. package/dist/bindings.d.ts +3 -0
  11. package/dist/bindings.d.ts.map +1 -1
  12. package/dist/bindings.js +1 -0
  13. package/dist/bindings.js.map +1 -1
  14. package/dist/channel-watch.d.ts +42 -0
  15. package/dist/channel-watch.d.ts.map +1 -0
  16. package/dist/channel-watch.js +59 -0
  17. package/dist/channel-watch.js.map +1 -0
  18. package/dist/errors.d.ts +40 -0
  19. package/dist/errors.d.ts.map +1 -1
  20. package/dist/errors.js +31 -0
  21. package/dist/errors.js.map +1 -1
  22. package/dist/exact-values.d.ts +18 -5
  23. package/dist/exact-values.d.ts.map +1 -1
  24. package/dist/exact-values.js +76 -12
  25. package/dist/exact-values.js.map +1 -1
  26. package/dist/field-kinds-registry.d.ts +1 -1
  27. package/dist/field-kinds-registry.d.ts.map +1 -1
  28. package/dist/field-kinds-registry.js +20 -2
  29. package/dist/field-kinds-registry.js.map +1 -1
  30. package/dist/index.d.ts +6 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +5 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/public-env.d.ts +13 -0
  35. package/dist/public-env.d.ts.map +1 -0
  36. package/dist/public-env.js +23 -0
  37. package/dist/public-env.js.map +1 -0
  38. package/dist/query-cache.d.ts +2 -1
  39. package/dist/query-cache.d.ts.map +1 -1
  40. package/dist/query-cache.js.map +1 -1
  41. package/dist/query.js +1 -1
  42. package/dist/query.js.map +1 -1
  43. package/dist/realtime-refusals.d.ts +35 -0
  44. package/dist/realtime-refusals.d.ts.map +1 -0
  45. package/dist/realtime-refusals.js +73 -0
  46. package/dist/realtime-refusals.js.map +1 -0
  47. package/dist/realtime.d.ts +70 -2
  48. package/dist/realtime.d.ts.map +1 -1
  49. package/dist/realtime.js +198 -18
  50. package/dist/realtime.js.map +1 -1
  51. package/dist/runtime-env.d.ts +2 -0
  52. package/dist/runtime-env.d.ts.map +1 -1
  53. package/dist/runtime-env.js +5 -0
  54. package/dist/runtime-env.js.map +1 -1
  55. package/dist/table-subscription.d.ts +23 -9
  56. package/dist/table-subscription.d.ts.map +1 -1
  57. package/dist/table-subscription.js +155 -23
  58. package/dist/table-subscription.js.map +1 -1
  59. package/dist/types.d.ts +29 -1
  60. package/dist/types.d.ts.map +1 -1
  61. package/dist/types.js.map +1 -1
  62. package/package.json +2 -2
  63. package/src/auth.ts +40 -12
  64. package/src/bindings.ts +3 -0
  65. package/src/channel-watch.ts +86 -0
  66. package/src/errors.ts +54 -0
  67. package/src/exact-values.ts +101 -13
  68. package/src/field-kinds-registry.ts +2 -3
  69. package/src/index.ts +13 -1
  70. package/src/public-env.ts +22 -0
  71. package/src/query-cache.ts +2 -1
  72. package/src/query.ts +1 -1
  73. package/src/realtime-refusals.ts +100 -0
  74. package/src/realtime.ts +256 -20
  75. package/src/runtime-env.ts +6 -0
  76. package/src/table-subscription.ts +186 -30
  77. package/src/types.ts +35 -1
  78. package/tests/auth-restore-user.test.ts +84 -0
  79. package/tests/auth.test.ts +11 -0
  80. package/tests/channel-watch-private.test.ts +105 -0
  81. package/tests/channel-watch.test.ts +97 -0
  82. package/tests/exact-response.test.ts +101 -0
  83. package/tests/exact-values.test.ts +57 -0
  84. package/tests/field-kinds-registry.test.ts +12 -0
  85. package/tests/helpers/close-event.ts +12 -0
  86. package/tests/helpers/fake-client.ts +38 -0
  87. package/tests/public-env.test.ts +43 -0
  88. package/tests/query-cache.test.ts +1 -1
  89. package/tests/realtime-connection.test.ts +228 -0
  90. package/tests/realtime-exact-values.test.ts +42 -0
  91. package/tests/realtime-private-channels.test.ts +377 -0
  92. package/tests/realtime-refusal-error.test.ts +2 -1
  93. package/tests/realtime-typed-channels.test.ts +49 -0
  94. package/tests/runtime-env.test.ts +14 -0
  95. package/tests/table-subscription-rows.test.ts +136 -0
  96. package/tests/table-subscription.test.ts +4 -3
  97. package/tsconfig.tsbuildinfo +1 -1
  98. package/type-tests/declared-channels.ts +30 -0
  99. package/type-tests/tsconfig.json +4 -0
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/client@0.9.2 build /home/runner/work/supatype/supatype/packages/client
2
+ > @supatype/client@0.10.0 build /home/runner/work/supatype/supatype/packages/client
3
3
  > tsc --project tsconfig.json
4
4
 
@@ -1,87 +1,122 @@
1
1
 
2
- > @supatype/client@0.9.2 test /home/runner/work/supatype/supatype/packages/client
2
+ > @supatype/client@0.10.0 test /home/runner/work/supatype/supatype/packages/client
3
3
  > vitest run --maxWorkers=50%
4
4
 
5
5
 
6
6
   RUN  v4.0.18 /home/runner/work/supatype/supatype/packages/client
7
7
 
8
- ✓ tests/auth.test.ts (46 tests) 430ms
9
- ✓ tests/query.test.ts (39 tests) 300ms
10
- ✓ tests/mfa-totp-integration.test.ts (12 tests) 518ms
11
- ✓ tests/types.test.ts (30 tests) 567ms
12
- ✓ .single() resolves to QueryResult<Row>  397ms
13
- ✓ tests/draft-profile.test.ts (18 tests) 270ms
14
- ✓ tests/table-subscribe.test.ts (12 tests) 427ms
15
- ✓ tests/auth-sso.test.ts (20 tests) 516ms
16
- ✓ tests/runtime-env.test.ts (31 tests) 360ms
17
- ✓ tests/realtime-multi-tenant-integration.test.ts (7 tests) 224ms
18
- ✓ tests/draft-insert.test.ts (18 tests) 254ms
19
- ✓ tests/graphql-json.test.ts (12 tests) 223ms
20
- ✓ tests/realtime-shared-channel.test.ts (8 tests) 310ms
21
- ✓ tests/realtime-rows-after-broadcast.test.ts (9 tests) 291ms
22
- ✓ tests/server-bodies.test.ts (20 tests) 146ms
23
- ✓ tests/draft-update.test.ts (11 tests) 237ms
24
- ✓ tests/auth-url-session.test.ts (10 tests) 217ms
25
- ✓ tests/retry-integration.test.ts (12 tests) 148ms
26
- ✓ tests/subscribe-frame.test.ts (10 tests) 301ms
27
- ✓ tests/exact-values.test.ts (24 tests) 56ms
28
- ✓ tests/runtime-env-page-script.test.ts (16 tests) 168ms
29
- ✓ tests/storage-quota-integration.test.ts (10 tests) 249ms
30
- ✓ tests/rate-limit-integration.test.ts (8 tests) 295ms
31
- ✓ tests/storage-upload-limit-integration.test.ts (11 tests) 181ms
32
- ✓ tests/realtime-exact-values.test.ts (8 tests) 304ms
33
- ✓ tests/retry-policy.test.ts (17 tests) 1729ms
34
- ✓ tests/realtime-session-auth.test.ts (7 tests) 214ms
8
+ ✓ tests/auth.test.ts (47 tests) 436ms
9
+ ✓ tests/realtime-private-channels.test.ts (37 tests) 838ms
10
+ ✓ tests/query.test.ts (39 tests) 593ms
11
+ ✓ tests/types.test.ts (30 tests) 904ms
12
+ ✓ .single() resolves to QueryResult<Row>  712ms
13
+ ✓ tests/mfa-totp-integration.test.ts (12 tests) 809ms
14
+ ✓ calls POST /factors with factor_type=totp  420ms
15
+ ✓ tests/draft-profile.test.ts (18 tests) 710ms
16
+ ✓ is sent as Accept-Profile when the query asks for it  313ms
17
+ ✓ tests/table-subscribe.test.ts (12 tests) 843ms
18
+ ✓ opens a socket, sends the subscribe frame, and delivers a change  480ms
19
+ ✓ tests/runtime-env.test.ts (33 tests) 358ms
20
+ ✓ tests/auth-sso.test.ts (20 tests) 531ms
21
+ ✓ tests/realtime-multi-tenant-integration.test.ts (7 tests) 367ms
22
+ ✓ tests/draft-insert.test.ts (18 tests) 429ms
23
+ ✓ tests/graphql-json.test.ts (12 tests) 306ms
24
+ ✓ tests/realtime-rows-after-broadcast.test.ts (9 tests) 404ms
25
+ ✓ tests/exact-values.test.ts (33 tests) 135ms
26
+ ✓ tests/realtime-shared-channel.test.ts (8 tests) 289ms
27
+ ✓ tests/draft-update.test.ts (11 tests) 482ms
28
+ ✓ tests/exact-response.test.ts (20 tests) 96ms
29
+ ✓ tests/server-bodies.test.ts (20 tests) 707ms
30
+ ✓ tests/auth-url-session.test.ts (10 tests) 558ms
31
+ ✓ signs in from implicit-grant tokens in the fragment and cleans the URL  361ms
32
+ ✓ tests/subscribe-frame.test.ts (10 tests) 449ms
33
+ ✓ tests/realtime-exact-values.test.ts (12 tests) 728ms
34
+ ✓ gives a bigint column a native bigint  381ms
35
+ ✓ tests/realtime-connection.test.ts (12 tests) 2469ms
36
+ ✓ reports a drop as connecting, and connected again once the socket is back  1058ms
37
+ ✓ drops the socket on the error and reconnects  1027ms
38
+ ✓ tests/retry-integration.test.ts (12 tests) 549ms
39
+ ✓ tests/storage-quota-integration.test.ts (10 tests) 196ms
40
+ ✓ tests/runtime-env-page-script.test.ts (16 tests) 261ms
41
+ ✓ tests/storage-upload-limit-integration.test.ts (11 tests) 404ms
42
+ ✓ tests/rate-limit-integration.test.ts (8 tests) 771ms
43
+ ✓ waits Retry-After seconds then retries on 429  474ms
44
+ ✓ tests/realtime-session-auth.test.ts (7 tests) 240ms
45
+ ✓ tests/retry-policy.test.ts (17 tests) 1933ms
35
46
  ↓ tests/draft-update.integration.test.ts (3 tests | 3 skipped)
36
- ✓ tests/minimal-writes.test.ts (8 tests) 75ms
47
+ ✓ tests/minimal-writes.test.ts (8 tests) 437ms
48
+ ✓ insert asks for no representation and resolves to no rows  302ms
37
49
  ↓ tests/draft-insert.integration.test.ts (4 tests | 4 skipped)
38
- ✓ tests/supatype-prepare.test.ts (12 tests) 3879ms
39
- ✓ succeeds, and generates nothing, where the CLI is not installed  542ms
40
- ✓ runs supatype generate where the CLI is installed, its bin named  521ms
41
- ✓ finds a CLI hoisted into a parent directory  471ms
42
- ✓ fails the install when generate fails  458ms
43
- ✓ tests/filters.test.ts (11 tests) 237ms
44
- ✓ tests/realtime-ack-ref.test.ts (4 tests) 128ms
45
- ✓ tests/unauthorized-resend.test.ts (5 tests) 141ms
46
- ✓ tests/storage-object-shape.test.ts (8 tests) 173ms
47
- ✓ tests/result-error-class.test.ts (12 tests) 163ms
48
- ✓ tests/postgrest-error-codes.test.ts (28 tests) 116ms
49
- ✓ tests/examples-runtime-env.test.ts (8 tests) 6629ms
50
- ✓ loads, and sends the key the server's /supatype-env.js set  3500ms
51
- ✓ loads, and sends the key the server's /supatype-env.js set  1520ms
52
- ✓ loads, and sends the key the server's /supatype-env.js set  1586ms
53
- ✓ tests/auth-events.test.ts (6 tests) 47ms
54
- ✓ tests/runtime-env-bundle.test.ts (3 tests) 2004ms
55
- ✓ tests/data-plane-auth.test.ts (2 tests) 72ms
56
- ✓ tests/serverless.test.ts (9 tests) 7ms
57
- ✓ tests/exact-response.test.ts (8 tests) 8ms
58
- ✓ tests/query-cache.test.ts (8 tests) 31ms
59
- ✓ tests/auth-errors.test.ts (14 tests) 65ms
60
- ✓ tests/table-subscription.test.ts (8 tests) 58ms
61
- ✓ tests/identity-change.test.ts (6 tests) 6ms
62
- ✓ tests/signed-url-absolute.test.ts (5 tests) 51ms
63
- ✓ tests/error-family.test.ts (10 tests) 9ms
64
- ✓ tests/table-transport.test.ts (8 tests) 445ms
65
- ✓ tests/storage-upload-browser.test.ts (3 tests) 52ms
66
- ✓ tests/realtime-refusal-error.test.ts (4 tests) 68ms
67
- ✓ tests/field-kinds-registry.test.ts (7 tests) 6ms
68
- ✓ tests/thrown-error.test.ts (6 tests) 7ms
69
- ✓ tests/realtime-presence.test.ts (3 tests) 81ms
70
- ✓ tests/storage-reference-url.test.ts (5 tests) 5ms
71
- ✓ tests/auth-error-codes.test.ts (26 tests) 14ms
72
- ✓ tests/runtime-env-expo.test.ts (3 tests) 9ms
73
- ✓ tests/realtime-swap-status.test.ts (4 tests) 116ms
74
- ✓ tests/rpc-resend.test.ts (1 test) 65ms
75
- ✓ tests/masked-fields.test.ts (6 tests) 6ms
76
- ✓ tests/count.test.ts (11 tests) 9ms
77
- ✓ tests/storage-url-encoding.test.ts (4 tests) 60ms
78
- ✓ tests/entry-points.test.ts (4 tests) 12ms
79
- ✓ tests/pkce.test.ts (4 tests) 11ms
80
- ✓ tests/dynamic-headers.test.ts (2 tests) 58ms
81
- ✓ tests/sha256-hex.test.ts (1 test) 4ms
50
+ ✓ tests/supatype-prepare.test.ts (12 tests) 5116ms
51
+ ✓ ignores a CLI in the home folder's .node_modules  428ms
52
+ ✓ runs supatype generate where the CLI is installed, its bin named  401ms
53
+ ✓ runs supatype generate where the CLI is installed, its bin given as a string  542ms
54
+ ✓ finds a CLI hoisted into a parent directory  656ms
55
+ ✓ runs the nearest CLI  659ms
56
+ ✓ passes over a node_modules it cannot look inside  336ms
57
+ ✓ fails the install when the CLI folder is a link to nothing  391ms
58
+ ✓ fails the install when the CLI folder is an empty folder  355ms
59
+ ✓ fails the install when generate fails  452ms
60
+ ✓ tests/filters.test.ts (11 tests) 448ms
61
+ ✓ an array becomes a Postgres array literal, not JSON  306ms
62
+ ✓ tests/realtime-ack-ref.test.ts (4 tests) 173ms
63
+ ✓ tests/unauthorized-resend.test.ts (5 tests) 287ms
64
+ ✓ tests/table-subscription-rows.test.ts (9 tests) 1473ms
65
+ ✓ reads the table again once the join is back, so a change made while down shows up  1234ms
66
+ ✓ tests/storage-object-shape.test.ts (8 tests) 208ms
67
+ ✓ tests/result-error-class.test.ts (12 tests) 278ms
68
+ ✓ tests/postgrest-error-codes.test.ts (28 tests) 268ms
69
+ ✓ tests/examples-runtime-env.test.ts (8 tests) 9782ms
70
+ ✓ loads, and sends the key the server's /supatype-env.js set  4921ms
71
+ ✓ loads, and sends the key the server's /supatype-env.js set  2839ms
72
+ ✓ loads, and sends the key the server's /supatype-env.js set  1992ms
73
+ ✓ tests/channel-watch-private.test.ts (6 tests) 206ms
74
+ ✓ tests/auth-events.test.ts (6 tests) 53ms
75
+ ✓ tests/runtime-env-bundle.test.ts (3 tests) 2008ms
76
+ ✓ tests/data-plane-auth.test.ts (2 tests) 67ms
77
+ ✓ tests/serverless.test.ts (9 tests) 20ms
78
+ ✓ tests/query-cache.test.ts (8 tests) 65ms
79
+ ✓ tests/auth-errors.test.ts (14 tests) 63ms
80
+ ✓ tests/table-subscription.test.ts (8 tests) 63ms
81
+ ✓ tests/identity-change.test.ts (6 tests) 17ms
82
+ ✓ tests/field-kinds-registry.test.ts (9 tests) 22ms
83
+ ✓ tests/channel-watch.test.ts (5 tests) 132ms
84
+ ✓ tests/table-transport.test.ts (8 tests) 475ms
85
+ ✓ tests/signed-url-absolute.test.ts (5 tests) 108ms
86
+ (node:11496) TimeoutOverflowWarning: 2306736714334 does not fit into a 32-bit signed integer.
87
+ Timeout duration was set to 1.
88
+ (Use `node --trace-warnings ...` to show where the warning was created)
89
+ (node:11496) TimeoutOverflowWarning: 2306736714332 does not fit into a 32-bit signed integer.
90
+ Timeout duration was set to 1.
91
+ (node:11496) TimeoutOverflowWarning: 2306736714330 does not fit into a 32-bit signed integer.
92
+ Timeout duration was set to 1.
93
+ (node:11496) TimeoutOverflowWarning: 2306736714330 does not fit into a 32-bit signed integer.
94
+ Timeout duration was set to 1.
95
+ (node:11496) TimeoutOverflowWarning: 2306736714328 does not fit into a 32-bit signed integer.
96
+ Timeout duration was set to 1.
97
+ ✓ tests/auth-restore-user.test.ts (3 tests) 100ms
98
+ ✓ tests/error-family.test.ts (10 tests) 24ms
99
+ ✓ tests/realtime-refusal-error.test.ts (4 tests) 83ms
100
+ ✓ tests/storage-upload-browser.test.ts (3 tests) 159ms
101
+ ✓ tests/realtime-presence.test.ts (3 tests) 116ms
102
+ ✓ tests/thrown-error.test.ts (6 tests) 24ms
103
+ ✓ tests/storage-reference-url.test.ts (5 tests) 12ms
104
+ ✓ tests/runtime-env-expo.test.ts (3 tests) 25ms
105
+ ✓ tests/realtime-swap-status.test.ts (4 tests) 167ms
106
+ ✓ tests/auth-error-codes.test.ts (26 tests) 31ms
107
+ ✓ tests/masked-fields.test.ts (6 tests) 10ms
108
+ ✓ tests/rpc-resend.test.ts (1 test) 60ms
109
+ ✓ tests/count.test.ts (11 tests) 16ms
110
+ ✓ tests/storage-url-encoding.test.ts (4 tests) 58ms
111
+ ✓ tests/realtime-typed-channels.test.ts (3 tests) 14ms
112
+ ✓ tests/entry-points.test.ts (4 tests) 18ms
113
+ ✓ tests/public-env.test.ts (5 tests) 6ms
114
+ ✓ tests/dynamic-headers.test.ts (2 tests) 45ms
115
+ ✓ tests/pkce.test.ts (4 tests) 8ms
116
+ ✓ tests/sha256-hex.test.ts (1 test) 5ms
82
117
 
83
-  Test Files  64 passed | 2 skipped (66)
84
-  Tests  703 passed | 7 skipped (710)
85
-  Start at  12:01:38
86
-  Duration  41.85s (transform 7.05s, setup 0ms, import 20.22s, tests 23.86s, environment 40ms)
118
+  Test Files  72 passed | 2 skipped (74)
119
+  Tests  813 passed | 7 skipped (820)
120
+  Start at  15:46:01
121
+  Duration  68.62s (transform 9.66s, setup 0ms, import 32.75s, tests 40.55s, environment 61ms)
87
122
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/client@0.9.2 typecheck /home/runner/work/supatype/supatype/packages/client
3
- > tsc --project tests/tsconfig.json --noEmit
2
+ > @supatype/client@0.10.0 typecheck /home/runner/work/supatype/supatype/packages/client
3
+ > tsc --project tests/tsconfig.json --noEmit && tsc --project type-tests/tsconfig.json --noEmit
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,6 +1,80 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.9.3
4
+
5
+ ### Breaking Changes
6
+
7
+ * **bindings:** `watchTable` (on `@supatype/client/bindings`) takes the client as its first argument, not
8
+ `client.realtime`, because it now reads the table to seed its rows. The Vue, Solid and Svelte
9
+ bindings are updated; anyone calling it directly must pass the client, as `watchTable(client, table,
10
+ options, handlers)`.
11
+
12
+ ### Features
13
+
14
+ * **client:** `client.anonKey`, beside `client.url`: the anon key as given, else as the page set it,
15
+ read each time and an empty string while neither has one.
16
+ * **realtime:** `client.realtime.isConnected`, `client.realtime.connectionState` and
17
+ `client.realtime.onConnectionChange(listener)`, which returns an unsubscribe function. The state is
18
+ `"connected"`, `"connecting"` (first connect, a reconnect after a drop or a sign-in swap, or a wait
19
+ before retrying) or `"disconnected"`. Channel statuses are unchanged. Exports
20
+ `RealtimeConnectionState`, `RealtimeConnectionListener` and the `ChannelSubscription` type.
21
+ * **bindings:** `watchChannel`, `watchConnection` and `channelSlot` on `@supatype/client/bindings`, which the
22
+ Vue, Solid and Svelte `useChannel` / `createChannel` share. `watchTable` takes the client, not its realtime
23
+ client, so it can read the table: its rows are seeded by a read after each join and re-join and kept by
24
+ upsert on a key (the `key` option, default `id`), so the Vue, Solid and Svelte `useSubscription` /
25
+ `createSubscription` hold rows that existed before subscribing and recover from a drop.
26
+ * **realtime:** `channel(name, { private: true })` asserts that a channel is guarded by a schema
27
+ `Channel` declaration. The join carries `private: true`. The server enforces declarations whether
28
+ or not it is set; the option makes a name no declaration matches a refused join (a typo fails at
29
+ once) and makes the client refuse to join at all when the server does not announce
30
+ `private_channels` on its first frame, since an older server would ignore the flag and admit an
31
+ open channel. A private join waits for that first frame before it is sent.
32
+ * **realtime:** `RealtimeChannelError` (a `RealtimeError`) is what a channel's status callback gets
33
+ with `CHANNEL_ERROR` for any channel-scoped refusal. `reason` is `unsupported_server`,
34
+ `join_denied`, `not_declared`, `does_not_fit`, `unavailable`, `shared_instance`, `withdrawn` or
35
+ `refused`; `channel` names it and `retryable` is true for `unavailable`. It was a plain `Error`
36
+ with the server's message, which `message` still carries. `isRealtimeChannelError(value)` tells one from any other error, across copies of the package.
37
+ * **realtime:** access the server takes away from a channel you hold (token change, periodic
38
+ re-check, declaration removed) reaches every handle as `CHANNEL_ERROR` with reason `withdrawn`.
39
+ It was swallowed for a handle with no row listener. The client does not rejoin by itself;
40
+ subscribing again does.
41
+ * **realtime:** a refusal is read from the `code` the server sends, not from its sentence, so a reworded
42
+ message cannot change what the client does. A server that sends no code is still read by its
43
+ sentence, and a code the client does not know is `refused`.
44
+ * **realtime:** a broadcast, presence track or payload the server refuses on a channel that is
45
+ joined no longer moves the channel to `CHANNEL_ERROR`. `onRefused((refusal) => ...)` on a channel
46
+ handle receives `{ channel, code, message }` with `code` one of `send_denied`, `track_denied` or
47
+ `payload_refused`; the status stays `SUBSCRIBED`. `ChannelActionRefusal` and
48
+ `ChannelActionRefusalCode` are exported.
49
+ * **realtime:** `ChannelOptions` is exported. A broadcast sent from the database with
50
+ `_supatype.realtime_send` reaches `onBroadcast` listeners like any other; the README says so.
51
+ * **realtime:** `channel()` takes a `ChannelName`: a topic the schema declares (`lot:${string}` for
52
+ `Channel<"lot:{id}", ...>`, `lobby:${string}` for a trailing `*`, `${number}` for an Integer
53
+ parameter), which autocompletes, or any other string, which an `open` server still admits. The
54
+ declared topics come from the new `SupatypeChannels` interface that `supatype generate` fills in;
55
+ `DeclaredTopic` and `DeclaredTopics<T>` are exported. Before generating, the name is a plain string.
56
+ * **bindings:** `watchChannel` and `channelSlot` take a `ChannelName`, as `channel()` does, so the Vue, Solid
57
+ and Svelte channel bindings accept a declared topic or any other string.
58
+ * **bindings:** `watchChannel` and `channelSlot` take `ChannelOptions` as a last argument, and a binding's
59
+ `error` for a refused or withdrawn channel is the `RealtimeChannelError` itself, not a copy of its message.
60
+ * **bindings:** `watchChannel` and `channelSlot` take an `onRefused` callback, which the Vue, Solid and
61
+ Svelte channel bindings expose as `refusal`.
62
+
63
+ ### Bug Fixes
64
+
65
+ * **realtime:** a socket that fails before it opens is dropped and retried. Node's built-in
66
+ WebSocket, refused with a 502 while realtime restarted, fired error and never close, so the client
67
+ counted it as live and stopped reconnecting for good.
68
+ * **realtime:** a socket still connecting after 10 seconds is given up and replaced. One opened while
69
+ realtime restarted behind the gateway could stay connecting with no error and no close.
70
+ * **auth:** a restored session kept the user without `isAnonymous`, so a guest looked registered after
71
+ every reload. The persisted user's camelCase keys, including those of `identities` and `factors`
72
+ (`userId`, `identityData`, `factorType`, ...), are read back, and a user stored without the flag takes
73
+ it from the token's `is_anonymous` claim.
74
+ * **realtime:** reconnect backoff is capped at 30 seconds. It doubled from one second for 10 attempts,
75
+ reaching 512 seconds.
76
+
77
+ ## 0.9.1 (2026-11-09)
4
78
 
5
79
  ### Breaking Changes
6
80
 
@@ -15,20 +89,6 @@
15
89
  `details` and `hint` are absent rather than `null` when the server gave none, and an rpc refusal
16
90
  is the `PostgrestError` itself. `AuthRedirectError` is a class too, with `provider` as one more
17
91
  own field. `SupatypeErrorFields` is the fields' type, as the constructor takes them.
18
- * **query:** `insert`, `update`, `upsert` and `delete` ask for no rows back and resolve to
19
- `data: null`, as postgrest-js does. Chain `.select()` (or `.select(columns)`) to get the written
20
- rows. Returning a row needs the right to read it, so a table whose rules let a caller create but
21
- not read (an anon order form, say) refused every insert with 401 `42501`. A plain `delete()`
22
- resolves to `null` rather than `[]`. On a model that keeps drafts, the drafts are read back only
23
- after `.select()`.
24
- * **query:** `.single()` and `.maybeSingle()` on a write are a type error until `.select()` is
25
- chained. Called without it from untyped code, they answer an error and send nothing.
26
- * **query:** `fetchWithOptional401Retry`'s `onUnauthorized` (and `GraphqlTransport.onUnauthorized`)
27
- is an `UnauthorizedHandler`: `(refusedToken: string) => Promise<boolean>`, answering whether the
28
- session now holds a different token. It was `() => Promise<void>`.
29
- * **bindings:** `runMutation(client, table, operation, data, request)` takes one `MutationRequest`
30
- (`filter`, `publish`, `select`) in place of the positional `filter` and update options, and returns
31
- rows only when `request.select` asks for them (`true`, or the columns as `.select()` takes them).
32
92
 
33
93
  ### Features
34
94
 
@@ -59,6 +119,25 @@
59
119
 
60
120
  ### Bug Fixes
61
121
 
122
+ * **realtime:** a change frame that names an exact-column kind this client does not know is no
123
+ longer dropped. The unknown kind is ignored and that column's value passes through as sent, while
124
+ the kinds it does know are still converted, so a kind added by a newer service never costs a
125
+ change. The REST field-kinds document already behaved this way and is now pinned by the same
126
+ shared check.
127
+ * **client:** a response is refused, with the same error as a single lossy number, when a number
128
+ inside an array in a column the generated types do not describe would lose digits in
129
+ `JSON.parse`. The error names the column. Elements are checked at any nesting depth by the
130
+ rules that already applied to a single value: a literal is lossy when its value changes, so
131
+ `19.0000` and `1e2` pass. Columns registered as `bigint[]` or `numeric[]` are still kept exact,
132
+ not refused. A json column holding an array of numbers too large for a double was read with
133
+ rounded elements before; it is now refused.
134
+ * **client:** an array of exact values no longer loses digits. A stored `bigint[]` of
135
+ 9007199254740993 came back as 9007199254740992 and a `numeric[]` of 1.10 as 1.1, because only a
136
+ number that was the direct value of a column was protected from `JSON.parse`. Every element of
137
+ a `bigint[]` or `numeric[]` column, at any nesting depth, is now kept as written: `bigint[]`
138
+ elements are native bigints and `numeric[]` elements are exact strings, as the single values
139
+ are. Nulls inside an array stay null. A generated `client.ts` from before this change still
140
+ works, and registers no array kinds until `supatype push` regenerates it.
62
141
  * **client:** `MissingClientValuesError` gives the script tag as
63
142
  `<script src="/supatype-env.js" vite-ignore></script>`, the form `vite build` leaves alone. The
64
143
  tag it gave made every `vite build` warn that it could not bundle the script.
@@ -85,11 +164,6 @@
85
164
  from a server too old to serve it) and to open it in the browser. A page with no element is told
86
165
  to add it, as before.
87
166
 
88
- * **auth:** a request refused with 401 is sent again only when the server said the token was
89
- expired or invalid (`PGRST301`, `PGRST303`, or "JWT expired"), a session was there to refresh, and
90
- the refresh produced a different token. Every 401 used to be sent twice, an anon write a row rule
91
- refused among them. The refresh now runs even when the local clock still calls the token valid,
92
- since the server has said otherwise.
93
167
  * **bindings:** `reportThrown(where, thrown)` turns a request that threw instead of answering
94
168
  `{ data, error }` into the binding's `error`, and logs it once with `console.error`. A thrown
95
169
  `Error` is kept as it is, so `instanceof` still names it; the SDK's own error classes get the shape
@@ -108,3 +182,32 @@
108
182
  from one. Server refusals, client-side refusals (`Not authenticated`) and `reportThrown` follow
109
183
  suit: `reportThrown` keeps an SDK error as it is and holds any other thrown value as the `cause`
110
184
  of a `SupatypeError`.
185
+
186
+ ## 0.9.0 (2026-11-04)
187
+
188
+ ### Breaking Changes
189
+
190
+ * **query:** `insert`, `update`, `upsert` and `delete` ask for no rows back and resolve to
191
+ `data: null`, as postgrest-js does. Chain `.select()` (or `.select(columns)`) to get the written
192
+ rows. Returning a row needs the right to read it, so a table whose rules let a caller create but
193
+ not read (an anon order form, say) refused every insert with 401 `42501`. A plain `delete()`
194
+ resolves to `null` rather than `[]`. On a model that keeps drafts, the drafts are read back only
195
+ after `.select()`.
196
+ * **query:** `.single()` and `.maybeSingle()` on a write are a type error until `.select()` is
197
+ chained. Called without it from untyped code, they answer an error and send nothing.
198
+ * **query:** `fetchWithOptional401Retry`'s `onUnauthorized` (and `GraphqlTransport.onUnauthorized`)
199
+ is an `UnauthorizedHandler`: `(refusedToken: string) => Promise<boolean>`, answering whether the
200
+ session now holds a different token. It was `() => Promise<void>`.
201
+ * **bindings:** `runMutation(client, table, operation, data, request)` takes one `MutationRequest`
202
+ (`filter`, `publish`, `select`) in place of the positional `filter` and update options, and returns
203
+ rows only when `request.select` asks for them (`true`, or the columns as `.select()` takes them).
204
+
205
+ ### Bug Fixes
206
+
207
+ * **auth:** a request refused with 401 is sent again only when the server said the token was
208
+ expired or invalid (`PGRST301`, `PGRST303`, or "JWT expired"), a session was there to refresh, and
209
+ the refresh produced a different token. Every 401 used to be sent twice, an anon write a row rule
210
+ refused among them. The refresh now runs even when the local clock still calls the token valid,
211
+ since the server has said otherwise.
212
+
213
+
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @supatype/client
2
+
3
+ The typed Supatype client: REST, auth, storage and realtime. The full guide, including private
4
+ channels, is on the docs site: https://www.supatype.com/docs/realtime.html
5
+
6
+ ## Private channels
7
+
8
+ A channel is private when your schema declares it. The server enforces every declaration for every
9
+ client; `private: true` asserts it, so a name no declaration matches is refused and a server that
10
+ cannot enforce it is never asked.
11
+
12
+ ```ts
13
+ client.realtime.channel(`lot:${id}`, { private: true }).onBroadcast("bid", show).subscribe()
14
+ ```
15
+
16
+ A refusal arrives as `CHANNEL_ERROR` with a `RealtimeChannelError` (`reason`, `channel`). A function in
17
+ the database can broadcast to the channel with `_supatype.realtime_send`; the client receives it like
18
+ any other broadcast. See the docs page for the reasons and the rules.
package/dist/auth.d.ts CHANGED
@@ -131,6 +131,10 @@ export declare class AuthClient {
131
131
  signInWithPassword(credentials: {
132
132
  email: string;
133
133
  password: string;
134
+ /** `captchaToken` is the provider widget's answer, which a project with captcha on requires. */
135
+ options?: {
136
+ captchaToken?: string | undefined;
137
+ } | undefined;
134
138
  }): Promise<{
135
139
  data: {
136
140
  session: Session | null;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,WAAW,EAEX,OAAO,EACP,OAAO,EACP,wBAAwB,EAExB,mBAAmB,EACnB,IAAI,EAEL,MAAM,YAAY,CAAA;AAMnB,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAqBzE,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;AAEpF,UAAU,iBAAiB;IACzB,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACpC,sGAAsG;IACtG,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,8FAA8F;IAC9F,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACzC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA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E,WAAW,IAAI,IAAI,CAAA;aAAE,CAAA;SAAE,CAAA;KAChD;IAmBD,2EAA2E;IAC3E,IAAI,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAEtC;IAED,OAAO,CAAC,iBAAiB;IASzB;;;OAGG;YACW,aAAa;YASb,YAAY;YAUZ,cAAc;IAS5B,4EAA4E;YAC9D,YAAY;IAM1B;;;OAGG;YACW,SAAS;YAOT,gBAAgB;YAMhB,iBAAiB;IAK/B,8DAA8D;IAC9D,OAAO,CAAC,YAAY;YAON,eAAe;YAKf,yBAAyB;IASvC,OAAO,CAAC,oBAAoB;IAmC5B,OAAO,CAAC,qBAAqB;IAQ7B,oGAAoG;IACpG,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,oBAAoB;YAKd,qBAAqB;IA+CnC,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,WAAW;IAgBnB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI;IAqB1C,OAAO,CAAC,UAAU;IAMlB,4FAA4F;YAC9E,WAAW;IAIzB,yFAAyF;YAC3E,SAAS;YAIT,kBAAkB;IA4BhC,OAAO,CAAC,UAAU;CAkBnB"}
package/dist/auth.js CHANGED
@@ -72,18 +72,41 @@ function eitherKey(body, first, second, guard) {
72
72
  const b = body[second];
73
73
  return guard(b) ? b : undefined;
74
74
  }
75
- /** A stored user with its camelCase keys copied to the snake_case ones `_parseUser` reads. */
76
- function snakeCaseUser(user) {
77
- const aliases = [
78
- ["app_metadata", "appMetadata"],
79
- ["user_metadata", "userMetadata"],
80
- ["created_at", "createdAt"],
81
- ["updated_at", "updatedAt"],
82
- ];
83
- const normalized = { ...user };
84
- for (const [snake, camel] of aliases) {
85
- if (user[snake] === undefined && user[camel] !== undefined)
86
- normalized[snake] = user[camel];
75
+ /** `appMetadata` as `app_metadata`: the key `_parseUser` and its helpers read. */
76
+ function snakeCaseKey(key) {
77
+ return key.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
78
+ }
79
+ /** A stored object with each camelCase key also under its snake_case name, unless that is set. Shallow. */
80
+ function withSnakeKeys(stored) {
81
+ const normalized = { ...stored };
82
+ for (const [key, value] of Object.entries(stored)) {
83
+ const snake = snakeCaseKey(key);
84
+ if (snake !== key && stored[snake] === undefined)
85
+ normalized[snake] = value;
86
+ }
87
+ return normalized;
88
+ }
89
+ /** The `is_anonymous` claim of an access token, or undefined when it has none. */
90
+ function anonymousClaim(accessToken) {
91
+ const claim = decodeJwtPayload(accessToken.split(".")[1] ?? "")?.["is_anonymous"];
92
+ return typeof claim === "boolean" ? claim : undefined;
93
+ }
94
+ /**
95
+ * A stored user with its camelCase keys copied to the snake_case ones `_parseUser` reads, so a user
96
+ * this client wrote (`isAnonymous`, `identities[].userId`, ...) survives a restore. A user stored
97
+ * without the anonymous flag takes it from the token's claim.
98
+ */
99
+ function snakeCaseUser(user, accessToken) {
100
+ const normalized = withSnakeKeys(user);
101
+ for (const list of ["identities", "factors"]) {
102
+ const items = user[list];
103
+ if (Array.isArray(items))
104
+ normalized[list] = items.map((i) => (isJsonObject(i) ? withSnakeKeys(i) : i));
105
+ }
106
+ if (normalized["is_anonymous"] === undefined) {
107
+ const claim = anonymousClaim(accessToken);
108
+ if (claim !== undefined)
109
+ normalized["is_anonymous"] = claim;
87
110
  }
88
111
  return normalized;
89
112
  }
@@ -358,12 +381,14 @@ export class AuthClient {
358
381
  return this._parseAuthResponse(res);
359
382
  }
360
383
  async signInWithPassword(credentials) {
384
+ const captchaToken = credentials.options?.captchaToken;
361
385
  const res = await this.send(`${this.url}/token?grant_type=password`, {
362
386
  method: "POST",
363
387
  headers: this.baseHeaders,
364
388
  body: JSON.stringify({
365
389
  email: credentials.email,
366
390
  password: credentials.password,
391
+ ...(captchaToken !== undefined && { supatype_meta_security: { captcha_token: captchaToken } }),
367
392
  }),
368
393
  });
369
394
  return this._parseAuthResponse(res);
@@ -1172,7 +1197,7 @@ export class AuthClient {
1172
1197
  refreshToken: eitherKey(raw, "refreshToken", "refresh_token", isString) ?? "",
1173
1198
  tokenType: eitherKey(raw, "tokenType", "token_type", isString) ?? "bearer",
1174
1199
  expiresIn: eitherKey(raw, "expiresIn", "expires_in", isNumber) ?? 3600,
1175
- user: this._parseUser(snakeCaseUser(user)),
1200
+ user: this._parseUser(snakeCaseUser(user, accessToken)),
1176
1201
  ...(expiresAt !== undefined && { expiresAt }),
1177
1202
  };
1178
1203
  }