@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"devices.d.ts","sourceRoot":"","sources":["../src/devices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/E,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG5C"}
package/dist/devices.js DELETED
@@ -1,13 +0,0 @@
1
- export class DevicesModule {
2
- constructor(http) {
3
- this.http = http;
4
- }
5
- /** Register a push token for the current user. */
6
- register(params) {
7
- return this.http.request('/api/devices/', { method: 'POST', body: params });
8
- }
9
- unregister(token) {
10
- return this.http.request('/api/devices/', { method: 'DELETE', body: { token } });
11
- }
12
- }
13
- //# sourceMappingURL=devices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devices.js","sourceRoot":"","sources":["../src/devices.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAa;IACxB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,kDAAkD;IAClD,QAAQ,CAAC,MAAmD;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IACnF,CAAC;CACF"}
package/dist/edge.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { HttpClient } from './http.js';
2
- export declare class EdgeModule {
3
- private readonly http;
4
- constructor(http: HttpClient);
5
- invoke<Result = unknown, Payload = Record<string, unknown>>(route: string, payload?: Payload): Promise<Result>;
6
- }
7
- //# sourceMappingURL=edge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../src/edge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;CAO/G"}
package/dist/edge.js DELETED
@@ -1,13 +0,0 @@
1
- export class EdgeModule {
2
- constructor(http) {
3
- this.http = http;
4
- }
5
- invoke(route, payload) {
6
- return this.http.request(`/api/edge/${encodeURIComponent(route)}`, {
7
- method: 'POST',
8
- body: payload ?? {},
9
- anonymous: true,
10
- });
11
- }
12
- }
13
- //# sourceMappingURL=edge.js.map
package/dist/edge.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"edge.js","sourceRoot":"","sources":["../src/edge.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,UAAU;IACrB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,MAAM,CAAsD,KAAa,EAAE,OAAiB;QAC1F,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAS,aAAa,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;YACzE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO,IAAI,EAAE;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,24 +0,0 @@
1
- import type { HttpClient } from './http.js';
2
- import type { MotherbaseResponse } from './types.js';
3
- export type FunctionInvokeAuth = {
4
- type: 'edge-token';
5
- token: string;
6
- } | {
7
- type: 'public';
8
- };
9
- export interface FunctionInvokeOptions<Body = unknown> {
10
- /** JSON body passed to the edge function. */
11
- body?: Body;
12
- /**
13
- * Authentication override. By default the current session bearer is used.
14
- * Public and dedicated Edge-token invocations must be explicitly selected.
15
- */
16
- auth?: FunctionInvokeAuth;
17
- }
18
- /** Supabase-compatible edge functions client: `client.functions.invoke(name, { body })`. */
19
- export declare class FunctionsClient {
20
- private readonly http;
21
- constructor(http: HttpClient);
22
- invoke<Result = unknown, Body = Record<string, unknown>>(name: string, options?: FunctionInvokeOptions<Body>): Promise<MotherbaseResponse<Result>>;
23
- }
24
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEvB,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,OAAO;IACnD,6CAA6C;IAC7C,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;OAGG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED,4FAA4F;AAC5F,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEvC,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,qBAAqB,CAAC,IAAI,CAAM,GACxC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;CAcvC"}
package/dist/functions.js DELETED
@@ -1,24 +0,0 @@
1
- import { toError } from './http.js';
2
- import { contractPath } from '@motherbase/contracts';
3
- /** Supabase-compatible edge functions client: `client.functions.invoke(name, { body })`. */
4
- export class FunctionsClient {
5
- constructor(http) {
6
- this.http = http;
7
- }
8
- async invoke(name, options = {}) {
9
- try {
10
- const edgeToken = options.auth?.type === 'edge-token' ? options.auth.token : undefined;
11
- const data = await this.http.request(contractPath.edge(name), {
12
- method: 'POST',
13
- body: options.body ?? {},
14
- anonymous: options.auth !== undefined,
15
- headers: edgeToken ? { 'x-motherbase-edge-token': edgeToken } : undefined,
16
- });
17
- return { data, error: null };
18
- }
19
- catch (err) {
20
- return { data: null, error: toError(err) };
21
- }
22
- }
23
- }
24
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAkBrD,4FAA4F;AAC5F,MAAM,OAAO,eAAe;IAC1B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,KAAK,CAAC,MAAM,CACV,IAAY,EACZ,UAAuC,EAAE;QAEzC,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;YACvF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAS,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACpE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;gBACxB,SAAS,EAAE,OAAO,CAAC,IAAI,KAAK,SAAS;gBACrC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS;aAC1E,CAAC,CAAC;YACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;CACF"}
package/dist/http.d.ts DELETED
@@ -1,96 +0,0 @@
1
- import type { SessionStore } from './session.js';
2
- export declare class BackendError extends Error {
3
- /** HTTP status code (0 if the request never completed). */
4
- readonly httpStatus: number;
5
- /** The API envelope's `status` field when present. */
6
- readonly apiStatus?: number;
7
- /** Backend error code, when present. */
8
- readonly code?: string;
9
- /**
10
- * Correlation id for the failed request, from the `x-request-id` response
11
- * header (the backend also puts it in the error body). Quote it in a bug
12
- * report or log it next to your own error: it is what matches this call to
13
- * the server-side stack trace in the project's logs.
14
- */
15
- readonly requestId?: string;
16
- constructor(message: string, httpStatus: number, apiStatus?: number, code?: string, requestId?: string);
17
- }
18
- export interface RequestOptions {
19
- method?: string;
20
- /** Headers scoped to this request. Override client-level headers. */
21
- headers?: Record<string, string>;
22
- /** JSON body. Mutually exclusive with `form`. */
23
- body?: unknown;
24
- /** Multipart body. Mutually exclusive with `body`. */
25
- form?: FormData;
26
- /** Skip attaching the Authorization header (used by auth endpoints). */
27
- anonymous?: boolean;
28
- /** Abort the request when this signal fires (`.abortSignal(signal)`). */
29
- signal?: AbortSignal;
30
- /**
31
- * Parse the response body as-is instead of unwrapping the app's
32
- * `{ status, data }` envelope. Better Auth's native /api/auth/* endpoints
33
- * return plain JSON, so the auth client sets this.
34
- */
35
- raw?: boolean;
36
- /**
37
- * Cookie mode for this request. Defaults to fetch's own `same-origin`.
38
- * OAuth start endpoints need `'include'`: better-auth sets a signed state
39
- * cookie on that response and verifies it on the provider callback, and a
40
- * cross-origin response's cookie is discarded without it (the callback then
41
- * fails with `state_mismatch`).
42
- */
43
- credentials?: RequestCredentials;
44
- /** Internal: prevents infinite refresh recursion. */
45
- _retry?: boolean;
46
- }
47
- /**
48
- * fetch wrapper that injects the bearer token, unwraps the API envelope, maps
49
- * failures to BackendError, and performs single-flight token refresh on 401.
50
- */
51
- export declare class HttpClient {
52
- private readonly baseUrl;
53
- private readonly store;
54
- private readonly opts;
55
- /** Performs the refresh; returns true on success. Injected to avoid a cycle. */
56
- private readonly doRefresh;
57
- private refreshPromise;
58
- constructor(baseUrl: string, store: SessionStore, opts: {
59
- autoRefresh: boolean;
60
- fetch: typeof fetch;
61
- headers?: Record<string, string>;
62
- },
63
- /** Performs the refresh; returns true on success. Injected to avoid a cycle. */
64
- doRefresh: () => Promise<boolean>);
65
- request<T>(path: string, options?: RequestOptions): Promise<T>;
66
- /**
67
- * Like `request`, but keeps the response headers. PostgREST puts the row count
68
- * in `Content-Range`, which is unreachable from the parsed body alone.
69
- */
70
- requestWithHeaders<T>(path: string, options?: RequestOptions): Promise<{
71
- data: T;
72
- headers: Headers;
73
- status: number;
74
- }>;
75
- /** Like `request`, but returns the raw Response (for binary downloads). */
76
- requestRaw(path: string, options?: RequestOptions): Promise<Response>;
77
- private sendWithRefresh;
78
- /** Shared single-flight refresh: concurrent callers await the same promise. */
79
- private refreshOnce;
80
- private send;
81
- private parse;
82
- /** Parse a plain-JSON (non-envelope) response, mapping failures to BackendError. */
83
- private parseRaw;
84
- private errorMessage;
85
- /** Absolute URL for a path. Public so callers can navigate to an endpoint
86
- * rather than fetch it (see AuthClient.signInWithOAuth). */
87
- url(path: string): string;
88
- }
89
- /** Convert a thrown BackendError (or any error) into a Supabase-shaped error object. */
90
- export declare function toError(err: unknown): {
91
- message: string;
92
- status?: number;
93
- code?: string;
94
- requestId?: string;
95
- };
96
- //# sourceMappingURL=http.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAYjD,qBAAa,YAAa,SAAQ,KAAK;IACrC,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC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C,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxE;;;OAGG;IACG,kBAAkB,CAAC,CAAC,EACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAMzD,2EAA2E;IACrE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;YASjE,eAAe;IAW7B,+EAA+E;IAC/E,OAAO,CAAC,WAAW;YASL,IAAI;YAyBJ,KAAK;IAgBnB,oFAAoF;YACtE,QAAQ;YAcR,YAAY;IAU1B;iEAC6D;IAC7D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAG1B;AAED,wFAAwF;AACxF,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAW7G"}
package/dist/http.js DELETED
@@ -1,157 +0,0 @@
1
- /**
2
- * Error thrown internally for any non-successful API response. Callers of the
3
- * public SDK never see this: module boundaries catch it and return a
4
- * `{ data, error }` result instead. Reserved for programmer misuse leaks only.
5
- */
6
- /** The backend sets `x-request-id` on every response; older ones may not. */
7
- function requestIdOf(res) {
8
- return res.headers?.get('x-request-id') ?? undefined;
9
- }
10
- export class BackendError extends Error {
11
- constructor(message, httpStatus, apiStatus, code, requestId) {
12
- super(message);
13
- this.name = 'BackendError';
14
- this.httpStatus = httpStatus;
15
- this.apiStatus = apiStatus;
16
- this.code = code;
17
- this.requestId = requestId;
18
- }
19
- }
20
- /**
21
- * fetch wrapper that injects the bearer token, unwraps the API envelope, maps
22
- * failures to BackendError, and performs single-flight token refresh on 401.
23
- */
24
- export class HttpClient {
25
- constructor(baseUrl, store, opts,
26
- /** Performs the refresh; returns true on success. Injected to avoid a cycle. */
27
- doRefresh) {
28
- this.baseUrl = baseUrl;
29
- this.store = store;
30
- this.opts = opts;
31
- this.doRefresh = doRefresh;
32
- this.refreshPromise = null;
33
- }
34
- async request(path, options = {}) {
35
- return (await this.requestWithHeaders(path, options)).data;
36
- }
37
- /**
38
- * Like `request`, but keeps the response headers. PostgREST puts the row count
39
- * in `Content-Range`, which is unreachable from the parsed body alone.
40
- */
41
- async requestWithHeaders(path, options = {}) {
42
- const res = await this.sendWithRefresh(path, options);
43
- const data = options.raw ? await this.parseRaw(res) : await this.parse(res);
44
- return { data, headers: res.headers, status: res.status };
45
- }
46
- /** Like `request`, but returns the raw Response (for binary downloads). */
47
- async requestRaw(path, options = {}) {
48
- const res = await this.sendWithRefresh(path, options);
49
- if (!res.ok) {
50
- const message = await this.errorMessage(res);
51
- throw new BackendError(message, res.status, undefined, undefined, requestIdOf(res));
52
- }
53
- return res;
54
- }
55
- async sendWithRefresh(path, options) {
56
- const res = await this.send(path, options);
57
- if (res.status === 401 && this.opts.autoRefresh && !options.anonymous && !options._retry) {
58
- const refreshed = await this.refreshOnce();
59
- if (refreshed) {
60
- return this.send(path, { ...options, _retry: true });
61
- }
62
- }
63
- return res;
64
- }
65
- /** Shared single-flight refresh: concurrent callers await the same promise. */
66
- refreshOnce() {
67
- if (!this.refreshPromise) {
68
- this.refreshPromise = this.doRefresh().finally(() => {
69
- this.refreshPromise = null;
70
- });
71
- }
72
- return this.refreshPromise;
73
- }
74
- async send(path, options) {
75
- await this.store.hydrate();
76
- const headers = { ...this.opts.headers, ...options.headers };
77
- const session = this.store.get();
78
- if (!options.anonymous && session?.accessToken) {
79
- headers['Authorization'] = `Bearer ${session.accessToken}`;
80
- }
81
- let body;
82
- if (options.form) {
83
- body = options.form; // browser/runtime sets the multipart boundary
84
- }
85
- else if (options.body !== undefined) {
86
- headers['Content-Type'] = 'application/json';
87
- body = JSON.stringify(options.body);
88
- }
89
- return this.opts.fetch(this.url(path), {
90
- method: options.method ?? 'GET',
91
- headers,
92
- body,
93
- signal: options.signal,
94
- ...(options.credentials ? { credentials: options.credentials } : {}),
95
- });
96
- }
97
- async parse(res) {
98
- let envelope;
99
- try {
100
- envelope = (await res.json());
101
- }
102
- catch {
103
- // non-JSON response
104
- }
105
- if (!res.ok || (envelope && envelope.status === 0)) {
106
- const message = envelope?.message ?? `Request failed with status ${res.status}`;
107
- throw new BackendError(message, res.status, envelope?.status, undefined, requestIdOf(res));
108
- }
109
- return (envelope?.data ?? envelope);
110
- }
111
- /** Parse a plain-JSON (non-envelope) response, mapping failures to BackendError. */
112
- async parseRaw(res) {
113
- let body;
114
- try {
115
- body = await res.json();
116
- }
117
- catch {
118
- body = undefined;
119
- }
120
- if (!res.ok) {
121
- const message = body?.message ?? `Request failed with status ${res.status}`;
122
- throw new BackendError(message, res.status, undefined, body?.code, requestIdOf(res));
123
- }
124
- return body;
125
- }
126
- async errorMessage(res) {
127
- try {
128
- const body = (await res.json());
129
- if (body?.message)
130
- return body.message;
131
- }
132
- catch {
133
- // ignore
134
- }
135
- return `Request failed with status ${res.status}`;
136
- }
137
- /** Absolute URL for a path. Public so callers can navigate to an endpoint
138
- * rather than fetch it (see AuthClient.signInWithOAuth). */
139
- url(path) {
140
- return `${this.baseUrl.replace(/\/$/, '')}${path}`;
141
- }
142
- }
143
- /** Convert a thrown BackendError (or any error) into a Supabase-shaped error object. */
144
- export function toError(err) {
145
- if (err instanceof BackendError) {
146
- return {
147
- message: err.message,
148
- status: err.httpStatus || undefined,
149
- code: err.code,
150
- requestId: err.requestId,
151
- };
152
- }
153
- if (err instanceof Error)
154
- return { message: err.message };
155
- return { message: String(err) };
156
- }
157
- //# sourceMappingURL=http.js.map
package/dist/http.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,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E,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,IAAS,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,GAAa;QACtC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAyB,CAAC;YACxD,IAAI,IAAI,EAAE,OAAO;gBAAE,OAAO,IAAI,CAAC,OAAO,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,OAAO,8BAA8B,GAAG,CAAC,MAAM,EAAE,CAAC;IACpD,CAAC;IAED;iEAC6D;IAC7D,GAAG,CAAC,IAAY;QACd,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;IACrD,CAAC;CACF;AAED,wFAAwF;AACxF,MAAM,UAAU,OAAO,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;QAChC,OAAO;YACL,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,MAAM,EAAE,GAAG,CAAC,UAAU,IAAI,SAAS;YACnC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC;IACJ,CAAC;IACD,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;AAClC,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,118 +0,0 @@
1
- import { memoryStorage, localStorageStorage } from './session.js';
2
- import { AuthClient } from './auth.js';
3
- import { StorageClient } from './storage.js';
4
- import { FunctionsClient } from './functions.js';
5
- import { RealtimeModule } from './realtime.js';
6
- import { RealtimeChannel, type RealtimeChannelOptions } from './channel.js';
7
- import type { PostgrestCount, PostgrestResponse } from './postgrest.js';
8
- import type { ClientOptions } from './types.js';
9
- /** Options for `client.rpc(fn, args, options)`, mirroring supabase-js. */
10
- export interface RpcOptions {
11
- /** Send the request as HEAD: no rows, only the count. */
12
- head?: boolean;
13
- /** Use the read-only GET form, with the arguments as query parameters. */
14
- get?: boolean;
15
- count?: PostgrestCount;
16
- }
17
- import type { DefaultSchemaName, FunctionArgs, FunctionName, FunctionReturns, GenericDatabase, GenericSchema, InsertOf, RelationName, RowOf, SchemaOf, TypedQuery, UpdateOf } from './database.js';
18
- /**
19
- * Supabase-js-compatible client for a Motherbase backend.
20
- *
21
- * Drop-in shaped: `client.from(table).select()…`, `client.auth.signInWithPassword()`,
22
- * `client.storage.from(bucket)`, `client.channel(name)`, `client.functions.invoke()`.
23
- *
24
- * Pass the type generated by `motherbase gen types typescript` to get real
25
- * inference: `createClient<Database>(url, key)` then types every row, rejects
26
- * unknown columns in `.select()`, checks `.insert()` payloads against the
27
- * Insert shape and types `.rpc()` from `Functions`. Without it the client
28
- * behaves exactly as it did before generics existed.
29
- */
30
- export declare class MotherbaseClient<Database = GenericDatabase, SchemaName = DefaultSchemaName<Database>, Schema extends GenericSchema = SchemaOf<Database, SchemaName>> {
31
- private readonly url;
32
- /** Accepted for supabase-js signature parity; sent as an `apikey` header when set. */
33
- readonly key?: string | undefined;
34
- readonly auth: AuthClient;
35
- readonly storage: StorageClient;
36
- readonly functions: FunctionsClient;
37
- /** Low-level realtime transport. Prefer `channel()` for the Supabase surface. */
38
- readonly realtime: RealtimeModule;
39
- private readonly http;
40
- private readonly store;
41
- private readonly channels;
42
- private static warnedAboutStorage;
43
- constructor(url: string,
44
- /** Accepted for supabase-js signature parity; sent as an `apikey` header when set. */
45
- key?: string | undefined, options?: ClientOptions);
46
- /**
47
- * Start a PostgREST-style query against a table or view.
48
- *
49
- * The first overload is the typed path: with a generated `Database` the
50
- * relation name is checked and the row/insert/update types come from it.
51
- * The second keeps the pre-generics form (`from<MyRow>('t')`) working; its
52
- * `never` default makes the parameter unusable unless `Row` is passed
53
- * explicitly, so a bare `from('typo')` still has to satisfy the first
54
- * overload rather than silently falling through to an unchecked one.
55
- */
56
- from<Name extends RelationName<Schema>>(table: Name): TypedQuery<RowOf<Schema, Name>, InsertOf<Schema, Name>, UpdateOf<Schema, Name>>;
57
- from<Row extends object = never>(table: [Row] extends [never] ? never : string): TypedQuery<Row, Partial<Row>, Partial<Row>>;
58
- /**
59
- * Call a database function, typed from the generated `Functions` map.
60
- *
61
- * The transport is `POST /rest/v1/rpc/<fn>`, which the REST layer gains in
62
- * Phase 2.8. The typing is independent of that work: it reads only the
63
- * generated `Database`, so it is correct the moment the route exists.
64
- *
65
- * `get` and `head` switch to the read-only forms, which carry their arguments
66
- * as query parameters rather than as a body, exactly as supabase-js does.
67
- */
68
- rpc<Name extends FunctionName<Schema>>(fn: Name, args?: FunctionArgs<Schema, Name>, options?: RpcOptions): Promise<PostgrestResponse<FunctionReturns<Schema, Name>>>;
69
- /** Create (or reuse) a realtime channel. */
70
- channel(name: string, opts?: RealtimeChannelOptions): RealtimeChannel;
71
- /** Unsubscribe and drop a channel. */
72
- removeChannel(channel: RealtimeChannel): Promise<'ok'>;
73
- /** Unsubscribe and drop every channel. */
74
- removeAllChannels(): Promise<'ok'>;
75
- /** Load any persisted session before first use. Optional but recommended. */
76
- hydrate(): Promise<unknown>;
77
- }
78
- /**
79
- * Create a Supabase-compatible Motherbase client.
80
- *
81
- * In a Next.js app, prefer `createBrowserClient` / `createServerClient` from
82
- * `@motherbase/ssr`: they persist the session to a cookie both halves can read.
83
- * `createClient()` on its own keeps the session in memory, which the server
84
- * cannot see, so every server-rendered `getUser()` returns null.
85
- *
86
- * @param url Backend API base URL.
87
- * @param key Anon/publishable key (optional). Sent as an `apikey` header.
88
- * @param options Session storage, fetch override, extra headers.
89
- *
90
- * @example
91
- * ```ts
92
- * import type { Database } from './database.types'
93
- * const client = createClient<Database>(url, anonKey)
94
- * ```
95
- */
96
- export declare function createClient<Database = GenericDatabase, SchemaName = DefaultSchemaName<Database>, Schema extends GenericSchema = SchemaOf<Database, SchemaName>>(url: string, key?: string, options?: ClientOptions): MotherbaseClient<Database, SchemaName, Schema>;
97
- export { BackendError } from './http.js';
98
- export { memoryStorage, localStorageStorage };
99
- export { cookieStorage, serverCookieStorage, SESSION_COOKIE_KEY } from './cookie.js';
100
- export { PostgrestQueryBuilder } from './postgrest.js';
101
- export type { PostgrestSingleBuilder, PostgrestTextBuilder, PostgrestExplainBuilder, PostgrestResponse, PostgrestPrimitive, PostgrestArrayOperand, PostgrestFilterOperator, PostgrestIsValue, PostgrestCount, TextSearchType, ReferencedTableOption, OrderOptions, SelectOptions, InsertOptions, UpsertOptions, MutateOptions, ExplainOptions, } from './postgrest.js';
102
- export type { GenericDatabase, GenericSchema, GenericTable, GenericView, GenericFunction, DefaultSchemaName, SchemaOf, Relations, RelationName, RowOf, InsertOf, UpdateOf, FunctionName, FunctionArgs, FunctionReturns, TypedQuery, TypedSingleQuery, SelectResult, ValidateSelect, UnknownSelectColumns, EmbeddedSelectSeam, ColumnName, FilterValue, } from './database.js';
103
- export { AuthClient } from './auth.js';
104
- export { MfaClient } from './mfa.js';
105
- export { AuthAdminClient } from './admin.js';
106
- export type { AdminListUsersParams, AdminUserList, AdminCreateUserParams, AdminCreatedUser, AdminUpdateUserParams, } from './admin.js';
107
- export type { MfaFactor, MfaEnrollResponse, MfaChallengeResponse } from './mfa.js';
108
- export type { SignUpCredentials, SignInWithPasswordCredentials, SignInWithOtpCredentials, VerifyOtpParams, SignInWithOAuthCredentials, UpdateUserAttributes, DeleteUserAttributes, Subscription, } from './auth.js';
109
- export { StorageClient, StorageBucket } from './storage.js';
110
- export type { UploadOptions, UploadResult } from './storage.js';
111
- export { FunctionsClient } from './functions.js';
112
- export type { FunctionInvokeAuth, FunctionInvokeOptions } from './functions.js';
113
- export { RealtimeChannel } from './channel.js';
114
- export type { PostgresChangeEvent, PostgresChangeFilter, PostgresChangePayload, ChannelStatus, BroadcastFilter, PresenceFilter, BroadcastMessage, BroadcastReceived, RealtimeChannelOptions, PresenceEntry, PresenceState, PresenceJoinPayload, PresenceLeavePayload, } from './channel.js';
115
- export type { CookieMethods, CookieToSet, CookieOptions } from './cookie.js';
116
- export type { ApiEnvelope, User, Tokens, Session, FileObject, FileVisibility, StorageUploadResponse, StorageRemoveResponse, UploadInput, SessionStorageAdapter, ClientOptions, MotherbaseResponse, MotherbaseError, AuthChangeEvent, AuthChangeListener, } from './types.js';
117
- export type { RealtimeConnectOptions, RealtimeStatus, RealtimeStatusListener, RealtimeWatchEvent, RealtimeWatchOptions, IoFactory, SocketLike, } from './realtime.js';
118
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0EAA0E;IAC1E,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AACD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,eAAe,EAC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