@motherbase/client 1.3.1 → 1.5.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 (74) hide show
  1. package/README.md +127 -13
  2. package/package.json +10 -2
  3. package/dist/admin.d.ts +0 -81
  4. package/dist/admin.d.ts.map +0 -1
  5. package/dist/admin.js +0 -85
  6. package/dist/admin.js.map +0 -1
  7. package/dist/auth.d.ts +0 -233
  8. package/dist/auth.d.ts.map +0 -1
  9. package/dist/auth.js +0 -418
  10. package/dist/auth.js.map +0 -1
  11. package/dist/channel.d.ts +0 -119
  12. package/dist/channel.d.ts.map +0 -1
  13. package/dist/channel.js +0 -213
  14. package/dist/channel.js.map +0 -1
  15. package/dist/cookie.d.ts +0 -60
  16. package/dist/cookie.d.ts.map +0 -1
  17. package/dist/cookie.js +0 -144
  18. package/dist/cookie.js.map +0 -1
  19. package/dist/database.d.ts +0 -169
  20. package/dist/database.d.ts.map +0 -1
  21. package/dist/database.js +0 -2
  22. package/dist/database.js.map +0 -1
  23. package/dist/devices.d.ts +0 -13
  24. package/dist/devices.d.ts.map +0 -1
  25. package/dist/devices.js +0 -13
  26. package/dist/devices.js.map +0 -1
  27. package/dist/edge.d.ts +0 -7
  28. package/dist/edge.d.ts.map +0 -1
  29. package/dist/edge.js +0 -13
  30. package/dist/edge.js.map +0 -1
  31. package/dist/functions.d.ts +0 -24
  32. package/dist/functions.d.ts.map +0 -1
  33. package/dist/functions.js +0 -24
  34. package/dist/functions.js.map +0 -1
  35. package/dist/http.d.ts +0 -96
  36. package/dist/http.d.ts.map +0 -1
  37. package/dist/http.js +0 -157
  38. package/dist/http.js.map +0 -1
  39. package/dist/index.d.ts +0 -118
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/index.js +0 -180
  42. package/dist/index.js.map +0 -1
  43. package/dist/mfa.d.ts +0 -109
  44. package/dist/mfa.d.ts.map +0 -1
  45. package/dist/mfa.js +0 -134
  46. package/dist/mfa.js.map +0 -1
  47. package/dist/postgrest.d.ts +0 -239
  48. package/dist/postgrest.d.ts.map +0 -1
  49. package/dist/postgrest.js +0 -467
  50. package/dist/postgrest.js.map +0 -1
  51. package/dist/profile.d.ts +0 -16
  52. package/dist/profile.d.ts.map +0 -1
  53. package/dist/profile.js +0 -26
  54. package/dist/profile.js.map +0 -1
  55. package/dist/realtime.d.ts +0 -114
  56. package/dist/realtime.d.ts.map +0 -1
  57. package/dist/realtime.js +0 -372
  58. package/dist/realtime.js.map +0 -1
  59. package/dist/rest.d.ts +0 -50
  60. package/dist/rest.d.ts.map +0 -1
  61. package/dist/rest.js +0 -75
  62. package/dist/rest.js.map +0 -1
  63. package/dist/session.d.ts +0 -36
  64. package/dist/session.d.ts.map +0 -1
  65. package/dist/session.js +0 -90
  66. package/dist/session.js.map +0 -1
  67. package/dist/storage.d.ts +0 -72
  68. package/dist/storage.d.ts.map +0 -1
  69. package/dist/storage.js +0 -148
  70. package/dist/storage.js.map +0 -1
  71. package/dist/types.d.ts +0 -106
  72. package/dist/types.d.ts.map +0 -1
  73. package/dist/types.js +0 -2
  74. package/dist/types.js.map +0 -1
package/dist/channel.js DELETED
@@ -1,213 +0,0 @@
1
- /**
2
- * Supabase-compatible realtime channel. Multiplexes broadcast, presence, and
3
- * postgres_changes over a single topic. `postgres_changes` is delivered through
4
- * the RealtimeModule.watchTable bridge in this release; broadcast/presence are
5
- * routed by topic via rt:msg envelopes.
6
- */
7
- export class RealtimeChannel {
8
- constructor(topic, realtime, options = {}) {
9
- this.topic = topic;
10
- this.realtime = realtime;
11
- this.options = options;
12
- this.pgBindings = [];
13
- this.broadcastBindings = [];
14
- this.presenceBindings = [];
15
- this.status = 'CLOSED';
16
- this.presence = {};
17
- /** Settles when the current subscribe() attempt has an ack (or has failed). */
18
- this.ready = Promise.resolve();
19
- /** Last state passed to track(), replayed after a reconnect. */
20
- this.trackedState = null;
21
- }
22
- on(type, filter, callback) {
23
- if (type === 'broadcast') {
24
- this.broadcastBindings.push({
25
- event: filter.event,
26
- callback: callback,
27
- });
28
- }
29
- else if (type === 'presence') {
30
- this.presenceBindings.push({
31
- event: filter.event,
32
- callback: callback,
33
- });
34
- }
35
- else if (type === 'postgres_changes') {
36
- this.pgBindings.push({
37
- filter: filter,
38
- callback: callback,
39
- });
40
- }
41
- else {
42
- throw new Error(`Unsupported channel event type "${type}". Use broadcast | presence | postgres_changes.`);
43
- }
44
- return this;
45
- }
46
- /**
47
- * Join the topic. Returns `this` (supabase-js shape), so it is NOT awaitable:
48
- * `send()` / `track()` / `untrack()` issued straight after are queued until the
49
- * join is acked instead of leaving early and being rejected by the server.
50
- */
51
- subscribe(onStatus, timeoutMs = 10000) {
52
- this.onStatus = onStatus;
53
- this.ready = (async () => {
54
- try {
55
- await this.realtime.connect({ fallbackPolling: false });
56
- }
57
- catch (err) {
58
- this.setStatus('CHANNEL_ERROR', err instanceof Error ? err : new Error(String(err)));
59
- return;
60
- }
61
- this.realtime.registerChannel(this.topic, this);
62
- const ack = await this.realtime.joinTopic(this.topic, this.buildConfig(), timeoutMs);
63
- if (ack.status === 'ok')
64
- this.setStatus('SUBSCRIBED');
65
- else if (ack.error === 'timeout')
66
- this.setStatus('TIMED_OUT', new Error('Realtime join timed out'));
67
- else
68
- this.setStatus('CHANNEL_ERROR', new Error(ack.error ?? 'Realtime join failed'));
69
- })();
70
- return this;
71
- }
72
- async unsubscribe() {
73
- this.realtime.leaveTopic(this.topic);
74
- this.realtime.unregisterChannel(this.topic);
75
- this.presence = {};
76
- this.trackedState = null;
77
- this.status = 'CLOSED';
78
- this.ready = Promise.resolve();
79
- return 'ok';
80
- }
81
- /**
82
- * Broadcast a message to the topic. Other clients on the topic with a matching
83
- * `on('broadcast', { event })` binding receive it; the sender receives its own
84
- * message only when the channel was created with `config.broadcast.self`.
85
- * With `config.broadcast.ack`, resolves on the server ack.
86
- */
87
- async send(message) {
88
- if (!(await this.subscribed()))
89
- return 'error';
90
- if (this.options.config?.broadcast?.ack) {
91
- return this.realtime.sendTopicWithAck(this.topic, 'broadcast', message.event, message.payload ?? {});
92
- }
93
- this.realtime.sendTopic(this.topic, 'broadcast', message.event, message.payload ?? {});
94
- return 'ok';
95
- }
96
- /** Announce this client's presence on the topic with the given state. */
97
- async track(state) {
98
- this.trackedState = state;
99
- if (!(await this.subscribed()))
100
- return 'error';
101
- return this.realtime.sendTopicWithAck(this.topic, 'presence', 'track', { state });
102
- }
103
- /** Remove this client's presence from the topic. */
104
- async untrack() {
105
- this.trackedState = null;
106
- if (!(await this.subscribed()))
107
- return 'error';
108
- return this.realtime.sendTopicWithAck(this.topic, 'presence', 'untrack', {});
109
- }
110
- /** Current presence state, keyed by presence key. */
111
- presenceState() {
112
- return this.presence;
113
- }
114
- /** Wait for a pending subscribe() to settle; false when the topic is not joined. */
115
- async subscribed() {
116
- await this.ready;
117
- return this.status === 'SUBSCRIBED';
118
- }
119
- setStatus(status, err) {
120
- this.status = status;
121
- this.onStatus?.(status, err);
122
- }
123
- /** Internal: the module replayed this topic's join on a new socket. */
124
- _rejoined(ok) {
125
- if (!ok) {
126
- this.setStatus('CHANNEL_ERROR', new Error('Realtime rejoin failed'));
127
- return;
128
- }
129
- // Presence lives on the server socket that just died: re-announce it.
130
- if (this.trackedState) {
131
- void this.realtime.sendTopicWithAck(this.topic, 'presence', 'track', { state: this.trackedState });
132
- }
133
- this.setStatus('SUBSCRIBED');
134
- }
135
- /** Internal: receive a topic envelope routed by RealtimeModule. */
136
- _receive(envelope) {
137
- if (envelope.type === 'broadcast') {
138
- for (const binding of this.broadcastBindings) {
139
- if (binding.event === '*' || binding.event === envelope.event) {
140
- binding.callback({ type: 'broadcast', event: envelope.event, payload: envelope.payload });
141
- }
142
- }
143
- }
144
- else if (envelope.type === 'presence') {
145
- // The server sends the full presence state; diff it into sync/join/leave.
146
- if (envelope.event === 'state')
147
- this.applyPresenceState(envelope.payload);
148
- }
149
- else if (envelope.type === 'postgres_changes') {
150
- const payload = envelope.payload;
151
- for (const binding of this.pgBindings) {
152
- const filter = binding.filter;
153
- if ((filter.schema ?? 'public') !== payload.schema)
154
- continue;
155
- if (filter.table !== payload.table)
156
- continue;
157
- if (filter.event !== '*' && filter.event !== payload.eventType)
158
- continue;
159
- binding.callback(payload);
160
- }
161
- }
162
- }
163
- applyPresenceState(next) {
164
- const prev = this.presence;
165
- const prevRefs = new Set();
166
- for (const key of Object.keys(prev))
167
- for (const p of prev[key])
168
- prevRefs.add(p.presence_ref);
169
- const nextRefs = new Set();
170
- for (const key of Object.keys(next))
171
- for (const p of next[key])
172
- nextRefs.add(p.presence_ref);
173
- for (const key of Object.keys(next)) {
174
- const newPresences = next[key].filter(p => !prevRefs.has(p.presence_ref));
175
- if (newPresences.length) {
176
- this.emitPresence('join', { key, newPresences, currentPresences: next[key] });
177
- }
178
- }
179
- for (const key of Object.keys(prev)) {
180
- const leftPresences = prev[key].filter(p => !nextRefs.has(p.presence_ref));
181
- if (leftPresences.length) {
182
- this.emitPresence('leave', { key, leftPresences, currentPresences: next[key] ?? [] });
183
- }
184
- }
185
- this.presence = next;
186
- this.emitPresence('sync', undefined);
187
- }
188
- emitPresence(event, payload) {
189
- for (const binding of this.presenceBindings) {
190
- if (binding.event === event)
191
- binding.callback(payload);
192
- }
193
- }
194
- buildConfig() {
195
- const config = {};
196
- if (this.options.config?.broadcast) {
197
- config.broadcast = { self: Boolean(this.options.config.broadcast.self) };
198
- }
199
- if (this.options.config?.presence) {
200
- config.presence = { key: this.options.config.presence.key };
201
- }
202
- if (this.pgBindings.length) {
203
- config.postgres_changes = this.pgBindings.map(b => ({
204
- event: b.filter.event,
205
- schema: b.filter.schema ?? 'public',
206
- table: b.filter.table,
207
- filter: b.filter.filter,
208
- }));
209
- }
210
- return config;
211
- }
212
- }
213
- //# sourceMappingURL=channel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAuFA;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAY1B,YAC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ION_COOKIE_KEY } from './session.js';
3
- export interface CookieOptions {
4
- path?: string;
5
- maxAge?: number;
6
- secure?: boolean;
7
- sameSite?: 'lax' | 'strict' | 'none';
8
- httpOnly?: boolean;
9
- domain?: string;
10
- }
11
- /** A single cookie to write, as returned by `document.cookie`/`next/headers` style APIs. */
12
- export interface CookieToSet {
13
- name: string;
14
- value: string;
15
- options?: CookieOptions;
16
- }
17
- /**
18
- * Batch cookie read/write, matching the shape Next.js's `cookies()` and
19
- * `NextRequest.cookies`/`NextResponse.cookies` already provide.
20
- */
21
- export interface CookieMethods {
22
- getAll(): {
23
- name: string;
24
- value: string;
25
- }[];
26
- setAll(cookies: CookieToSet[]): void;
27
- }
28
- /**
29
- * The cookie the session is stored in. Re-exported here because both halves of
30
- * an SSR setup have to agree on it: the browser writes it, the server reads it,
31
- * and a key that matches on only one side looks exactly like "logged out".
32
- */
33
- export { SESSION_COOKIE_KEY };
34
- /**
35
- * `process` is not declared in this package's lib (it targets the browser), so
36
- * read it off `globalThis` rather than pulling in @types/node for one check.
37
- * @internal
38
- */
39
- export declare function isProduction(): boolean;
40
- /** @internal exported for tests; not part of the package's public surface. */
41
- export declare function parseSession(raw: string | undefined): Session | null;
42
- /**
43
- * Browser cookie adapter. Falls back to in-memory storage when
44
- * `document` is not available (SSR, Node.js environments).
45
- */
46
- export declare function cookieStorage(options?: {
47
- key?: string;
48
- path?: string;
49
- secure?: boolean;
50
- sameSite?: 'lax' | 'strict' | 'none';
51
- }): SessionStorageAdapter;
52
- /**
53
- * Server-side cookie adapter built on batch `getAll`/`setAll` methods —
54
- * the shape Next.js's `cookies()` (Server Components/Route Handlers) and
55
- * `NextRequest.cookies`/`NextResponse.cookies` (middleware) already expose.
56
- */
57
- export declare function serverCookieStorage(cookies: CookieMethods, key?: string, options?: {
58
- secure?: boolean;
59
- }): SessionStorageAdapter;
60
- //# sourceMappingURL=cookie.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookie.d.ts","sourceRoot":"","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;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,GAAG,SAAc,EACjB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,qBAAqB,CAwCvB"}
package/dist/cookie.js DELETED
@@ -1,144 +0,0 @@
1
- import { memoryStorage, SESSION_COOKIE_KEY } from './session.js';
2
- /**
3
- * The cookie the session is stored in. Re-exported here because both halves of
4
- * an SSR setup have to agree on it: the browser writes it, the server reads it,
5
- * and a key that matches on only one side looks exactly like "logged out".
6
- */
7
- export { SESSION_COOKIE_KEY };
8
- const DEFAULT_KEY = SESSION_COOKIE_KEY;
9
- let warnedAboutCookieWrite = false;
10
- /**
11
- * `process` is not declared in this package's lib (it targets the browser), so
12
- * read it off `globalThis` rather than pulling in @types/node for one check.
13
- * @internal
14
- */
15
- export function isProduction() {
16
- const proc = globalThis.process;
17
- return proc?.env?.NODE_ENV === 'production';
18
- }
19
- /**
20
- * The single most expensive failure in an SSR setup is silent: the session
21
- * cookie is never written, so `getUser()`/`getSession()` return null everywhere
22
- * and no Authorization header is ever attached, with nothing in the logs.
23
- *
24
- * It happens because Next.js forbids writing cookies from a Server Component,
25
- * and the documented adapter shape swallows that failure in its own try/catch.
26
- * The cookie has to be written from middleware instead, which is what
27
- * `updateSession` from `@motherbase/ssr` is for. Say so, once, in development.
28
- */
29
- function warnSessionCookieUnwritable(reason) {
30
- if (warnedAboutCookieWrite)
31
- return;
32
- if (isProduction())
33
- return;
34
- warnedAboutCookieWrite = true;
35
- console.warn(`[motherbase] The session cookie could not be written (${reason}). Server Components cannot `
36
- + 'set cookies, so the session has to be refreshed in middleware: call `updateSession` from '
37
- + '`@motherbase/ssr` in `proxy.ts` (Next.js 16+) or `middleware.ts` (Next.js 14/15). Until '
38
- + 'then auth.getUser() and auth.getSession() return null on every request.');
39
- }
40
- function escapeRegex(s) {
41
- return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
42
- }
43
- /** @internal exported for tests; not part of the package's public surface. */
44
- export function parseSession(raw) {
45
- if (!raw)
46
- return null;
47
- // Server adapters (Next's `cookies()`) hand back an already-decoded value;
48
- // `document.cookie` hands back the percent-encoded one. Try both.
49
- try {
50
- return JSON.parse(raw);
51
- }
52
- catch {
53
- /* not plain JSON — fall through */
54
- }
55
- try {
56
- return JSON.parse(decodeURIComponent(raw));
57
- }
58
- catch {
59
- return null;
60
- }
61
- }
62
- function serializeSession(session) {
63
- return encodeURIComponent(JSON.stringify(session));
64
- }
65
- /**
66
- * Browser cookie adapter. Falls back to in-memory storage when
67
- * `document` is not available (SSR, Node.js environments).
68
- */
69
- export function cookieStorage(options = {}) {
70
- const doc = typeof document !== 'undefined' ? document : undefined;
71
- if (!doc)
72
- return memoryStorage();
73
- const key = options.key ?? DEFAULT_KEY;
74
- const path = options.path ?? '/';
75
- const secure = options.secure ?? true;
76
- const sameSite = options.sameSite ?? 'lax';
77
- const pattern = new RegExp(`(?:^|; )${escapeRegex(key)}=([^;]*)`);
78
- return {
79
- get: () => {
80
- const match = doc.cookie.match(pattern);
81
- return parseSession(match?.[1]);
82
- },
83
- set: (session) => {
84
- if (session) {
85
- let cookie = `${key}=${serializeSession(session)}; path=${path}; SameSite=${sameSite}`;
86
- if (secure)
87
- cookie += '; Secure';
88
- doc.cookie = cookie;
89
- }
90
- else {
91
- doc.cookie = `${key}=; path=${path}; max-age=0`;
92
- }
93
- },
94
- };
95
- }
96
- /**
97
- * Server-side cookie adapter built on batch `getAll`/`setAll` methods —
98
- * the shape Next.js's `cookies()` (Server Components/Route Handlers) and
99
- * `NextRequest.cookies`/`NextResponse.cookies` (middleware) already expose.
100
- */
101
- export function serverCookieStorage(cookies, key = DEFAULT_KEY, options = {}) {
102
- const secure = options.secure ?? true;
103
- return {
104
- get: () => {
105
- const match = cookies.getAll().find((c) => c.name === key);
106
- return parseSession(match?.value);
107
- },
108
- set: (session) => {
109
- if (!session) {
110
- try {
111
- cookies.setAll([{ name: key, value: '', options: { path: '/', maxAge: 0 } }]);
112
- }
113
- catch {
114
- // Signing out from a Server Component cannot clear the cookie either,
115
- // but middleware will on the next navigation. Not worth a warning.
116
- }
117
- return;
118
- }
119
- try {
120
- cookies.setAll([
121
- {
122
- name: key,
123
- // No percent-encoding here: `cookies().set()` encodes the value
124
- // itself, and encoding first yields a double-encoded cookie the
125
- // browser adapter can no longer parse.
126
- value: JSON.stringify(session),
127
- options: { path: '/', sameSite: 'lax', secure },
128
- },
129
- ]);
130
- }
131
- catch (err) {
132
- warnSessionCookieUnwritable(err instanceof Error ? err.message : String(err));
133
- return;
134
- }
135
- // The adapter shape everyone copies wraps `setAll` in its own try/catch,
136
- // so a refused write does not reach the catch above — it just does
137
- // nothing. Reading it back is the only way to tell the difference.
138
- if (!cookies.getAll().some((c) => c.name === key && c.value !== '')) {
139
- warnSessionCookieUnwritable('the write was accepted but the cookie is not readable back');
140
- }
141
- },
142
- };
143
- }
144
- //# sourceMappingURL=cookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../src/cookie.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA2BjE;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAEvC,IAAI,sBAAsB,GAAG,KAAK,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,GAAI,UAAyE,CAAC,OAAO,CAAC;IAChG,OAAO,IAAI,EAAE,GAAG,EAAE,QAAQ,KAAK,YAAY,CAAC;AAC9C,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,2BAA2B,CAAC,MAAc;IACjD,IAAI,sBAAsB;QAAE,OAAO;IACnC,IAAI,YAAY,EAAE;QAAE,OAAO;IAC3B,sBAAsB,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,IAAI,CACV,yD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AAE,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAChF,CAAC;gBAAC,MAAM,CAAC;oBACP,sEAAsE;oBACtE,mEAAmE;gBACrE,CAAC;gBACD,OAAO;YACT,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,CAAC,MAAM,CAAC;oBACb;wBACE,IAAI,EAAE,GAAG;wBACT,gEAAgE;wBAChE,gEAAgE;wBAChE,uCAAuC;wBACvC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;wBAC9B,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;qBAChD;iBACF,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,2BAA2B,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9E,OAAO;YACT,CAAC;YACD,yEAAyE;YACzE,mEAAmE;YACnE,mEAAmE;YACnE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,EAAE,CAAC;gBACpE,2BAA2B,CAAC,4DAA4D,CAAC,CAAC;YAC5F,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,169 +0,0 @@
1
- /**
2
- * Type-level plumbing for `createClient<Database>(url, key)`.
3
- *
4
- * `Database` is the type generated by `motherbase gen types typescript`, which
5
- * emits the exact shape supabase-js emits. Everything here reads that shape and
6
- * nothing else, so a `database.types.ts` produced by Supabase's own generator
7
- * works unchanged.
8
- *
9
- * This file is types only: it contains no runtime code. The query builder it
10
- * describes is the existing `PostgrestQueryBuilder`; `MotherbaseClient.from()`
11
- * hands back the same object viewed through this narrower interface.
12
- */
13
- import type { ExplainOptions, InsertOptions, MutateOptions, OrderOptions, PostgrestArrayOperand, PostgrestExplainBuilder, PostgrestFilterOperator, PostgrestIsValue, PostgrestResponse, PostgrestTextBuilder, ReferencedTableOption, SelectOptions, TextSearchType, UpsertOptions } from './postgrest.js';
14
- export interface GenericTable {
15
- Row: Record<string, unknown>;
16
- Insert: Record<string, unknown>;
17
- Update: Record<string, unknown>;
18
- Relationships?: unknown;
19
- }
20
- export interface GenericView {
21
- Row: Record<string, unknown>;
22
- Relationships?: unknown;
23
- }
24
- export interface GenericFunction {
25
- Args: Record<string, unknown>;
26
- Returns: unknown;
27
- }
28
- export interface GenericSchema {
29
- Tables: Record<string, GenericTable>;
30
- Views: Record<string, GenericView>;
31
- Functions: Record<string, GenericFunction>;
32
- Enums?: Record<string, unknown>;
33
- CompositeTypes?: Record<string, unknown>;
34
- }
35
- /**
36
- * The default when no `Database` is supplied. Every relation name is accepted
37
- * and every row is `Record<string, unknown>`, which is exactly how the SDK
38
- * behaved before generics existed. Passing a generated `Database` is opt-in.
39
- */
40
- export type GenericDatabase = Record<string, GenericSchema>;
41
- /**
42
- * The schema a client reads by default. `public` when the database has one,
43
- * otherwise whatever single schema was generated: `motherbase gen types
44
- * typescript --schema shop` emits only `shop`, and requiring every call site to
45
- * pass the name again would be pure friction.
46
- */
47
- export type DefaultSchemaName<Database> = 'public' extends keyof Database ? 'public' : keyof Database;
48
- export type SchemaOf<Database, Name> = Name extends keyof Database ? Database[Name] extends GenericSchema ? Database[Name] : GenericSchema : GenericSchema;
49
- /** Tables and views together: both are selectable through `.from()`. */
50
- export type Relations<Schema extends GenericSchema> = Schema['Tables'] & Schema['Views'];
51
- export type RelationName<Schema extends GenericSchema> = string & keyof Relations<Schema>;
52
- export type RowOf<Schema extends GenericSchema, Name extends RelationName<Schema>> = Relations<Schema>[Name] extends {
53
- Row: infer R;
54
- } ? R : never;
55
- export type InsertOf<Schema extends GenericSchema, Name extends RelationName<Schema>> = Name extends keyof Schema['Tables'] ? Schema['Tables'][Name] extends {
56
- Insert: infer I;
57
- } ? I : never : never;
58
- export type UpdateOf<Schema extends GenericSchema, Name extends RelationName<Schema>> = Name extends keyof Schema['Tables'] ? Schema['Tables'][Name] extends {
59
- Update: infer U;
60
- } ? U : never : never;
61
- export type FunctionName<Schema extends GenericSchema> = string & keyof Schema['Functions'];
62
- export type FunctionArgs<Schema extends GenericSchema, Name extends FunctionName<Schema>> = Schema['Functions'][Name] extends {
63
- Args: infer A;
64
- } ? A : never;
65
- export type FunctionReturns<Schema extends GenericSchema, Name extends FunctionName<Schema>> = Schema['Functions'][Name] extends {
66
- Returns: infer R;
67
- } ? R : never;
68
- type Trim<S extends string> = S extends ` ${infer Rest}` ? Trim<Rest> : S extends `${infer Rest} ` ? Trim<Rest> : S;
69
- /** `'id, name'` -> `'id' | 'name'`. */
70
- type SplitColumns<S extends string> = S extends `${infer Head},${infer Tail}` ? Trim<Head> | SplitColumns<Tail> : Trim<S>;
71
- /** `'created_at::text'` -> `'created_at'`. Casts change the wire type, not the source column. */
72
- type StripCast<S extends string> = S extends `${infer Column}::${string}` ? Column : S;
73
- type AliasPart<S extends string> = S extends `${infer Alias}:${string}` ? Alias : S;
74
- type ColumnPart<S extends string> = S extends `${string}:${infer Column}` ? Column : S;
75
- /** `'writer:author_id'` -> `'writer'` (the key the row will carry). */
76
- type OutputName<S extends string> = AliasPart<StripCast<S>>;
77
- /** `'writer:author_id'` -> `'author_id'` (the column the type comes from). */
78
- type SourceName<S extends string> = ColumnPart<StripCast<S>>;
79
- /**
80
- * SEAM: relational embedding (`select=*,author(*)`) is not implemented on the
81
- * server yet, so a select string containing a parenthesised relation is not
82
- * narrowed. It resolves to the base row plus an open index signature, which
83
- * types the columns we do know and leaves the embedded keys accessible without
84
- * pretending we know their shape.
85
- *
86
- * When embedding lands, replace this with a resolver that walks
87
- * `Relationships` to decide object vs array and recurse into the target row.
88
- */
89
- export type EmbeddedSelectSeam<Row> = Row & Record<string, unknown>;
90
- type IsEmbeddedSelect<S extends string> = S extends `${string}(${string}` ? true : false;
91
- /** Columns named in the select string that the relation does not have. */
92
- export type UnknownSelectColumns<Row, S extends string> = Exclude<SourceName<SplitColumns<S>>, (keyof Row & string) | '*'>;
93
- /**
94
- * The `columns` argument type. Resolves to `unknown` (no extra constraint) when
95
- * every named column exists, and to an error-message string literal otherwise,
96
- * so a typo fails at the call site with the offending name in the message.
97
- */
98
- export type ValidateSelect<Row, S extends string> = IsEmbeddedSelect<S> extends true ? unknown : [UnknownSelectColumns<Row, S>] extends [never] ? unknown : `Unknown column in select: ${UnknownSelectColumns<Row, S> & string}`;
99
- /** The row shape a select resolves to. */
100
- export type SelectResult<Row, S extends string> = IsEmbeddedSelect<S> extends true ? EmbeddedSelectSeam<Row> : '*' extends SplitColumns<S> ? Row : {
101
- [K in SplitColumns<S> as OutputName<K>]: Row[SourceName<K> & keyof Row];
102
- };
103
- export type FilterValue = string | number | boolean | null;
104
- /** Columns that can be filtered or ordered on. Any string when untyped. */
105
- export type ColumnName<Row> = keyof Row & string;
106
- /**
107
- * The `.from()` result. Structurally the existing `PostgrestQueryBuilder`, with
108
- * the generated row/insert/update types threaded through. `Result` tracks what
109
- * the current `select` narrowed the row to; it starts as the full row.
110
- */
111
- export interface TypedQuery<Row, Insert, Update, Result = Row> extends PromiseLike<PostgrestResponse<Result[]>> {
112
- select<S extends string = '*'>(columns?: S & ValidateSelect<Row, S>, options?: SelectOptions): TypedQuery<Row, Insert, Update, SelectResult<Row, S>>;
113
- insert(values: Insert | readonly Insert[], options?: InsertOptions): TypedQuery<Row, Insert, Update, Result>;
114
- upsert(values: Insert | readonly Insert[], options?: UpsertOptions): TypedQuery<Row, Insert, Update, Result>;
115
- update(values: Update, options?: MutateOptions): TypedQuery<Row, Insert, Update, Result>;
116
- delete(options?: MutateOptions): TypedQuery<Row, Insert, Update, Result>;
117
- eq(column: ColumnName<Row>, value: FilterValue): this;
118
- neq(column: ColumnName<Row>, value: FilterValue): this;
119
- gt(column: ColumnName<Row>, value: FilterValue): this;
120
- gte(column: ColumnName<Row>, value: FilterValue): this;
121
- lt(column: ColumnName<Row>, value: FilterValue): this;
122
- lte(column: ColumnName<Row>, value: FilterValue): this;
123
- like(column: ColumnName<Row>, pattern: string): this;
124
- ilike(column: ColumnName<Row>, pattern: string): this;
125
- likeAllOf(column: ColumnName<Row>, patterns: readonly string[]): this;
126
- likeAnyOf(column: ColumnName<Row>, patterns: readonly string[]): this;
127
- ilikeAllOf(column: ColumnName<Row>, patterns: readonly string[]): this;
128
- ilikeAnyOf(column: ColumnName<Row>, patterns: readonly string[]): this;
129
- in(column: ColumnName<Row>, values: readonly FilterValue[]): this;
130
- is(column: ColumnName<Row>, value: PostgrestIsValue): this;
131
- match(query: Partial<Record<ColumnName<Row>, FilterValue>>): this;
132
- /** Escape hatches: the column is a free string so json paths (`data->>k`) work. */
133
- not(column: string, operator: PostgrestFilterOperator | (string & {}), value: FilterValue | readonly FilterValue[]): this;
134
- filter(column: string, operator: PostgrestFilterOperator | (string & {}), value: FilterValue | readonly FilterValue[]): this;
135
- or(filters: string, options?: ReferencedTableOption): this;
136
- textSearch(column: ColumnName<Row>, query: string, options?: {
137
- type?: TextSearchType;
138
- config?: string;
139
- }): this;
140
- contains(column: ColumnName<Row>, value: PostgrestArrayOperand): this;
141
- containedBy(column: ColumnName<Row>, value: PostgrestArrayOperand): this;
142
- overlaps(column: ColumnName<Row>, value: PostgrestArrayOperand): this;
143
- rangeGt(column: ColumnName<Row>, range: string): this;
144
- rangeGte(column: ColumnName<Row>, range: string): this;
145
- rangeLt(column: ColumnName<Row>, range: string): this;
146
- rangeLte(column: ColumnName<Row>, range: string): this;
147
- rangeAdjacent(column: ColumnName<Row>, range: string): this;
148
- order(column: ColumnName<Row>, options?: OrderOptions): this;
149
- limit(count: number, options?: ReferencedTableOption): this;
150
- range(from: number, to: number, options?: ReferencedTableOption): this;
151
- abortSignal(signal: AbortSignal): this;
152
- /** Re-type the rows: for shapes the generated `Database` cannot express. */
153
- returns<T>(): TypedQuery<Row, Insert, Update, T>;
154
- csv(): PostgrestTextBuilder;
155
- explain(options?: ExplainOptions): PostgrestExplainBuilder;
156
- single(): TypedSingleQuery<Result>;
157
- maybeSingle(): TypedSingleQuery<Result | null>;
158
- /** The URL path (with query string) this builder targets. Exposed for tests. */
159
- toPath(): string;
160
- /** The headers this builder sends (Prefer, Accept). Exposed for tests. */
161
- toHeaders(): Record<string, string>;
162
- }
163
- /** A builder narrowed to one row by `.single()` / `.maybeSingle()`. */
164
- export interface TypedSingleQuery<Result> extends PromiseLike<PostgrestResponse<Result>> {
165
- toPath(): string;
166
- toHeaders(): Record<string, string>;
167
- }
168
- export {};
169
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,gBAAgB,CAAC;AAIxB,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAA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AAG,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5D,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACvE,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEvC,4EAA4E;IAC5E,OAAO,CAAC,CAAC,KAAK,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACjD,GAAG,IAAI,oBAAoB,CAAC;IAC5B,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,uBAAuB,CAAC;IAE3D,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,IAAI,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE/C,gFAAgF;IAChF,MAAM,IAAI,MAAM,CAAC;IACjB,0EAA0E;IAC1E,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,uEAAuE;AACvE,MAAM,WAAW,gBAAgB,CAAC,MAAM,CAAE,SAAQ,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACtF,MAAM,IAAI,MAAM,CAAC;IACjB,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC"}
package/dist/database.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=database.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":""}
package/dist/devices.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { HttpClient } from './http.js';
2
- import type { DevicePlatform } from './types.js';
3
- export declare class DevicesModule {
4
- private readonly http;
5
- constructor(http: HttpClient);
6
- /** Register a push token for the current user. */
7
- register(params: {
8
- token: string;
9
- platform: DevicePlatform;
10
- }): Promise<unknown>;
11
- unregister(token: string): Promise<unknown>;
12
- }
13
- //# sourceMappingURL=devices.d.ts.map