@motherbase/client 1.5.0 → 1.5.1

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 (93) hide show
  1. package/dist/admin.d.ts +131 -0
  2. package/dist/admin.d.ts.map +1 -0
  3. package/dist/admin.js +121 -0
  4. package/dist/admin.js.map +1 -0
  5. package/dist/auth.d.ts +459 -0
  6. package/dist/auth.d.ts.map +1 -0
  7. package/dist/auth.js +861 -0
  8. package/dist/auth.js.map +1 -0
  9. package/dist/channel.d.ts +129 -0
  10. package/dist/channel.d.ts.map +1 -0
  11. package/dist/channel.js +215 -0
  12. package/dist/channel.js.map +1 -0
  13. package/dist/compat.d.ts +40 -0
  14. package/dist/compat.d.ts.map +1 -0
  15. package/dist/compat.js +100 -0
  16. package/dist/compat.js.map +1 -0
  17. package/dist/cookie.d.ts +68 -0
  18. package/dist/cookie.d.ts.map +1 -0
  19. package/dist/cookie.js +152 -0
  20. package/dist/cookie.js.map +1 -0
  21. package/dist/database.d.ts +188 -0
  22. package/dist/database.d.ts.map +1 -0
  23. package/dist/database.js +2 -0
  24. package/dist/database.js.map +1 -0
  25. package/dist/functions.d.ts +60 -0
  26. package/dist/functions.d.ts.map +1 -0
  27. package/dist/functions.js +75 -0
  28. package/dist/functions.js.map +1 -0
  29. package/dist/http.d.ts +122 -0
  30. package/dist/http.d.ts.map +1 -0
  31. package/dist/http.js +206 -0
  32. package/dist/http.js.map +1 -0
  33. package/dist/index.d.ts +215 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +365 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/mfa.d.ts +126 -0
  38. package/dist/mfa.d.ts.map +1 -0
  39. package/dist/mfa.js +156 -0
  40. package/dist/mfa.js.map +1 -0
  41. package/dist/organization.d.ts +234 -0
  42. package/dist/organization.d.ts.map +1 -0
  43. package/dist/organization.js +157 -0
  44. package/dist/organization.js.map +1 -0
  45. package/dist/passkey.d.ts +59 -0
  46. package/dist/passkey.d.ts.map +1 -0
  47. package/dist/passkey.js +87 -0
  48. package/dist/passkey.js.map +1 -0
  49. package/dist/pkce.d.ts +13 -0
  50. package/dist/pkce.d.ts.map +1 -0
  51. package/dist/pkce.js +52 -0
  52. package/dist/pkce.js.map +1 -0
  53. package/dist/plugin-endpoint.d.ts +20 -0
  54. package/dist/plugin-endpoint.d.ts.map +1 -0
  55. package/dist/plugin-endpoint.js +24 -0
  56. package/dist/plugin-endpoint.js.map +1 -0
  57. package/dist/postgrest.d.ts +326 -0
  58. package/dist/postgrest.d.ts.map +1 -0
  59. package/dist/postgrest.js +625 -0
  60. package/dist/postgrest.js.map +1 -0
  61. package/dist/query.d.ts +97 -0
  62. package/dist/query.d.ts.map +1 -0
  63. package/dist/query.js +94 -0
  64. package/dist/query.js.map +1 -0
  65. package/dist/realtime.d.ts +114 -0
  66. package/dist/realtime.d.ts.map +1 -0
  67. package/dist/realtime.js +376 -0
  68. package/dist/realtime.js.map +1 -0
  69. package/dist/session.d.ts +47 -0
  70. package/dist/session.d.ts.map +1 -0
  71. package/dist/session.js +136 -0
  72. package/dist/session.js.map +1 -0
  73. package/dist/sso.d.ts +147 -0
  74. package/dist/sso.d.ts.map +1 -0
  75. package/dist/sso.js +35 -0
  76. package/dist/sso.js.map +1 -0
  77. package/dist/storage.d.ts +268 -0
  78. package/dist/storage.d.ts.map +1 -0
  79. package/dist/storage.js +441 -0
  80. package/dist/storage.js.map +1 -0
  81. package/dist/testing.d.ts +38 -0
  82. package/dist/testing.d.ts.map +1 -0
  83. package/dist/testing.js +50 -0
  84. package/dist/testing.js.map +1 -0
  85. package/dist/types.d.ts +348 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/types.js +2 -0
  88. package/dist/types.js.map +1 -0
  89. package/dist/warn.d.ts +2 -0
  90. package/dist/warn.d.ts.map +1 -0
  91. package/dist/warn.js +23 -0
  92. package/dist/warn.js.map +1 -0
  93. package/package.json +4 -2
@@ -0,0 +1,348 @@
1
+ /** Shared types for the Motherbase client SDK (Supabase-js compatible surface). */
2
+ import type { StorageRemoveContract, StorageUploadContract } from '@motherbase/contracts';
3
+ /** The envelope non-REST API endpoints (auth, storage, edge) wrap their payload in. */
4
+ export interface ApiEnvelope<T = unknown> {
5
+ status: 0 | 1;
6
+ message: string;
7
+ code?: string;
8
+ requestId?: string;
9
+ data?: T;
10
+ pager?: Record<string, unknown>;
11
+ }
12
+ /**
13
+ * A timestamp as it can reach the client: ISO string over HTTP, `Date` when a
14
+ * server-side caller passes a Better Auth row straight in.
15
+ */
16
+ export type Timestamp = string | Date;
17
+ /**
18
+ * The open bag of profile fields.
19
+ *
20
+ * `User` itself is closed: every field the platform sets is declared, and a
21
+ * typo like `user.emailVerifed` is a compile error. Project-specific columns
22
+ * (anything added to `user.additionalFields` on the server) cannot be known
23
+ * here, so they live in this bag, which is the one place with an index
24
+ * signature. `compat.ts` copies every non-platform field into it, so a custom
25
+ * `plan` column is readable as `user.user_metadata.plan`.
26
+ *
27
+ * Declare your own shape for it when you know the columns:
28
+ * `const meta = user.user_metadata as { plan?: string }`.
29
+ */
30
+ export interface UserMetadata {
31
+ name?: string | null;
32
+ image?: string | null;
33
+ [key: string]: unknown;
34
+ }
35
+ /** Fields Better Auth itself owns on a user row. */
36
+ export interface BetterAuthUserFields {
37
+ /** Display name. Better Auth's own column, mirrored into `user_metadata`. */
38
+ name?: string | null;
39
+ /** Avatar URL. Better Auth's own column, mirrored into `user_metadata`. */
40
+ image?: string | null;
41
+ /** Better Auth stores verification as a boolean, not a timestamp. */
42
+ emailVerified?: boolean;
43
+ createdAt?: Timestamp | null;
44
+ updatedAt?: Timestamp | null;
45
+ /** Set by the `phoneNumber` plugin; aliased to `phone`. */
46
+ phoneNumber?: string | null;
47
+ phoneNumberVerified?: boolean | null;
48
+ /** Set by the `admin` plugin. */
49
+ banned?: boolean | null;
50
+ banReason?: string | null;
51
+ banExpires?: Timestamp | null;
52
+ /** Set by the `twoFactor` plugin. */
53
+ twoFactorEnabled?: boolean | null;
54
+ /** Set by the `anonymous` plugin; aliased to `is_anonymous`. */
55
+ isAnonymous?: boolean | null;
56
+ }
57
+ /**
58
+ * The `additionalFields` Motherbase configures on every project's auth
59
+ * instance (see `apps/server/auth/instance.ts`). The first four are
60
+ * client-writable through `updateUser`; the rest are server-set.
61
+ */
62
+ export interface MotherbaseUserFields {
63
+ username?: string | null;
64
+ firstName?: string | null;
65
+ lastName?: string | null;
66
+ imageUrl?: string | null;
67
+ /** `'USER'` by default on the server, `'authenticated'` after `compat.ts`. */
68
+ role?: string;
69
+ status?: string | null;
70
+ classicEmail?: string | null;
71
+ appleId?: string | null;
72
+ appleEmail?: string | null;
73
+ googleId?: string | null;
74
+ googleEmail?: string | null;
75
+ }
76
+ /**
77
+ * The snake_case aliases `compat.ts` adds on the way out, so code ported from
78
+ * supabase-js reads `user.created_at` and `user.user_metadata.full_name` on a
79
+ * user that came out of Better Auth.
80
+ *
81
+ * They are optional because a `User` you construct yourself (a test fixture, a
82
+ * value on its way *in*) has not been through `compat.ts` yet. Everything the
83
+ * SDK hands back has them.
84
+ */
85
+ export interface SupabaseUserAliases {
86
+ /** Always `'authenticated'`. Present for supabase-js parity. */
87
+ aud?: string;
88
+ created_at?: string | null;
89
+ updated_at?: string | null;
90
+ /** Non-null once the email is verified. Better Auth stores a boolean, so the
91
+ * value is the last-update timestamp rather than the true verification time. */
92
+ email_confirmed_at?: string | null;
93
+ confirmed_at?: string | null;
94
+ /** Alias of `phoneNumber`, `''` when the user has no phone. */
95
+ phone?: string;
96
+ /**
97
+ * Always `{}`: the client is not told which provider issued the session, and
98
+ * a guessed `{ provider: 'email' }` is worse than a missing one.
99
+ */
100
+ app_metadata?: Record<string, unknown>;
101
+ /** Profile fields (`name`, `image`, any configured additional field). */
102
+ user_metadata?: UserMetadata;
103
+ identities?: UserIdentity[];
104
+ is_anonymous?: boolean;
105
+ }
106
+ /** A linked provider, in the supabase-js `UserIdentity` shape. */
107
+ export interface UserIdentity {
108
+ id: string;
109
+ identity_id: string;
110
+ user_id: string;
111
+ provider: string;
112
+ identity_data: Record<string, unknown>;
113
+ created_at: string | null;
114
+ updated_at: string | null;
115
+ last_sign_in_at: string | null;
116
+ }
117
+ /**
118
+ * Authenticated user as returned by the API.
119
+ *
120
+ * Closed on purpose: every field the platform can set is declared above, so
121
+ * reading one that does not exist is a compile error instead of a silent
122
+ * `undefined` at runtime. Project-specific columns go through
123
+ * [`UserMetadata`](#UserMetadata) (`user.user_metadata.<field>`).
124
+ */
125
+ export interface User extends BetterAuthUserFields, MotherbaseUserFields, SupabaseUserAliases {
126
+ id: string;
127
+ email: string;
128
+ }
129
+ /**
130
+ * The bearer token issued by sign-up / sign-in. With Better Auth this is the
131
+ * session token; there is no separate refresh token (a session is valid until
132
+ * it expires, after which the user re-authenticates). `refreshToken` is kept
133
+ * optional for backwards source-compat and is unused.
134
+ */
135
+ export interface Tokens {
136
+ accessToken: string;
137
+ refreshToken?: string;
138
+ }
139
+ /**
140
+ * The locally-held session: the bearer token plus the user it belongs to.
141
+ *
142
+ * The snake_case fields are supabase-js aliases, added by the session store on
143
+ * the way out (see `compat.ts`). `access_token` always mirrors `accessToken`;
144
+ * `expires_at` / `expires_in` are present only when the server dated the
145
+ * session, because supabase-js callers schedule refreshes off them and a
146
+ * fabricated expiry schedules them wrong.
147
+ */
148
+ export interface Session extends Tokens {
149
+ user: User;
150
+ /** supabase-js alias of `accessToken`. */
151
+ access_token?: string;
152
+ /** supabase-js alias of `refreshToken`. Always null on Better Auth sessions. */
153
+ refresh_token?: string | null;
154
+ token_type?: 'bearer';
155
+ /** Unix seconds. Absent when the backend did not date the session. */
156
+ expires_at?: number;
157
+ /** Seconds until `expires_at`. Absent for the same reason. */
158
+ expires_in?: number;
159
+ }
160
+ export type FileVisibility = 'public' | 'private';
161
+ /** Lifecycle of a stored object: `ready` unless a presigned upload is pending. */
162
+ export type FileStatus = 'pending' | 'ready' | 'expired';
163
+ /**
164
+ * A row of the storage table, as `POST /api/files/` returns it.
165
+ *
166
+ * This is the upload shape, not the `list()` shape: `list()` answers in the
167
+ * supabase-js `FileObject` form, which is a different set of fields under
168
+ * different names. Conflating the two is what the old `[key: string]: unknown`
169
+ * hid, and `file.filename` (a field the server never sent) type-checked.
170
+ */
171
+ export interface StoredFile {
172
+ id: string;
173
+ /** Bucket slug. */
174
+ bucket: string;
175
+ /** Object key inside the bucket, including any prefix. */
176
+ key: string;
177
+ mime?: string | null;
178
+ size: number;
179
+ visibility: FileVisibility;
180
+ status: FileStatus;
181
+ /** Set for public objects and for drivers that store an absolute URL. */
182
+ url?: string | null;
183
+ ownerId?: string | null;
184
+ bucketId?: string | null;
185
+ /** Deadline of a presigned upload that has not been finalised. */
186
+ uploadExpiresAt?: string | null;
187
+ createdAt: string;
188
+ updatedAt: string;
189
+ }
190
+ /**
191
+ * One object as `list()` returns it: the supabase-js `FileObject` shape, which
192
+ * is what code ported from Supabase reads (`obj.name`, `obj.metadata.size`).
193
+ */
194
+ export interface FileObject {
195
+ /** Key relative to the bucket. */
196
+ name: string;
197
+ id: string;
198
+ created_at: string | null;
199
+ updated_at: string | null;
200
+ last_accessed_at: string | null;
201
+ metadata: {
202
+ size: number;
203
+ mimetype: string | null;
204
+ cacheControl: string | null;
205
+ };
206
+ }
207
+ /** Exact payload returned by `POST /api/files/`. */
208
+ export type StorageUploadResponse = StorageUploadContract<StoredFile>;
209
+ /** Exact payload returned by `DELETE /api/files/:id`. */
210
+ export type StorageRemoveResponse = StorageRemoveContract;
211
+ /** A file-ish value accepted by multipart uploads (browser File/Blob or RN asset). */
212
+ export type UploadInput = Blob | ArrayBuffer | ArrayBufferView | {
213
+ uri: string;
214
+ name?: string;
215
+ type?: string;
216
+ };
217
+ /**
218
+ * The uniform result envelope every data/auth/storage call resolves to.
219
+ * `error` is `null` on success; `data` is `null` on failure. Never throws for
220
+ * expected API errors: only for programmer misuse.
221
+ */
222
+ export interface MotherbaseResponse<T> {
223
+ data: T | null;
224
+ error: MotherbaseError | null;
225
+ }
226
+ /** Supabase-shaped error object. */
227
+ export interface MotherbaseError {
228
+ message: string;
229
+ /** HTTP status code, when the failure came from an HTTP response. */
230
+ status?: number;
231
+ /** Backend/app error code, when present. */
232
+ code?: string;
233
+ /**
234
+ * Correlation id of the failed request, from the `x-request-id` response
235
+ * header. The same id is on the server-side log line, so quoting it in a bug
236
+ * report (or logging it beside your own error) is what makes an intermittent
237
+ * 500 findable.
238
+ */
239
+ requestId?: string;
240
+ }
241
+ /**
242
+ * Persists the session between runs. Implementations must be synchronous-or-async
243
+ * tolerant: every method may return a value or a promise of it.
244
+ */
245
+ export interface SessionStorageAdapter {
246
+ get(): Session | null | Promise<Session | null>;
247
+ set(session: Session | null): void | Promise<void>;
248
+ }
249
+ /**
250
+ * A key/value store shaped like `window.localStorage` or React Native's
251
+ * `AsyncStorage`. supabase-js takes its session storage in this form, so an app
252
+ * being ported passes one of these; the client wraps it (see
253
+ * `keyValueStorage`) rather than failing at runtime on a missing `.get`.
254
+ */
255
+ export interface KeyValueStorageAdapter {
256
+ getItem(key: string): string | null | Promise<string | null>;
257
+ setItem(key: string, value: string): void | Promise<void>;
258
+ removeItem(key: string): void | Promise<void>;
259
+ }
260
+ /**
261
+ * The supabase-js-shaped half of the options.
262
+ *
263
+ * supabase-js nests its options under `auth`, `db`, `global` and `realtime`.
264
+ * Ported code passes them that way, and silently dropping them is the worst
265
+ * possible outcome: `{ auth: { persistSession: true } }` looks like it works
266
+ * and the user is signed out on every reload. Both spellings are accepted; the
267
+ * flat (native) one wins where they collide.
268
+ */
269
+ export interface SupabaseStyleOptions {
270
+ auth?: {
271
+ /** Refresh on 401 and, with `startAutoRefresh()`, on a timer. Default true. */
272
+ autoRefreshToken?: boolean;
273
+ /**
274
+ * `true` (the default in a browser) persists the session to localStorage
275
+ * when no explicit storage is given. `false` keeps it in memory.
276
+ */
277
+ persistSession?: boolean;
278
+ /** Read the OAuth token out of the URL on construction. Default true in a browser. */
279
+ detectSessionInUrl?: boolean;
280
+ /** Either adapter shape: supabase-js's key/value store or the native one. */
281
+ storage?: KeyValueStorageAdapter | SessionStorageAdapter;
282
+ /** Storage key. Defaults to `motherbase.session`. */
283
+ storageKey?: string;
284
+ /**
285
+ * `implicit` (the default) returns the session in the redirect's URL
286
+ * fragment. `pkce` returns `?code=` instead, exchanged automatically on
287
+ * load (or by `auth.exchangeCodeForSession(code)`) with the verifier this
288
+ * browser kept, so a leaked redirect URL is worth nothing on its own.
289
+ */
290
+ flowType?: 'implicit' | 'pkce';
291
+ debug?: boolean;
292
+ };
293
+ db?: {
294
+ /** Default schema for `from()` and `rpc()`. Only `public` is exposed today. */
295
+ schema?: string;
296
+ };
297
+ global?: {
298
+ headers?: Record<string, string>;
299
+ fetch?: typeof fetch;
300
+ };
301
+ realtime?: Record<string, unknown>;
302
+ }
303
+ export interface ClientOptions extends SupabaseStyleOptions {
304
+ /** Where to persist the session. Defaults to in-memory (SSR-safe). */
305
+ storage?: SessionStorageAdapter;
306
+ /** Refresh the access token automatically on a 401. Default: true. */
307
+ autoRefresh?: boolean;
308
+ /** Override the fetch implementation (for SSR or tests). */
309
+ fetch?: typeof fetch;
310
+ /** Extra headers merged into every request (e.g. a custom `apikey`). */
311
+ headers?: Record<string, string>;
312
+ /**
313
+ * Align the behaviours that differ from supabase-js but share its spelling.
314
+ *
315
+ * A missing method fails loudly. A method that exists and behaves differently
316
+ * does not, and that is what breaks a ported app in production. Differences
317
+ * are recorded in COMPATIBILITY.md:
318
+ *
319
+ * - `update()` / `delete()` whose filter matches nothing answer 404 here and
320
+ * an empty array in supabase-js.
321
+ *
322
+ * Writes already require `.select()` to return rows in every mode.
323
+ *
324
+ * NOT covered, on purpose: an unfiltered `delete()` stays refused with 400.
325
+ * Parity there means removing a guard against deleting a whole table from a
326
+ * typo, and no migration is worth that. Add `.neq('id', 0)`, or run it from
327
+ * the SQL editor.
328
+ */
329
+ compat?: 'supabase';
330
+ /**
331
+ * Inject a socket.io factory for realtime (tests / custom transports).
332
+ * When omitted, `socket.io-client` is imported lazily at connect time.
333
+ */
334
+ realtimeIoFactory?: (url: string, opts: Record<string, unknown>) => import('./realtime.js').SocketLike;
335
+ }
336
+ /**
337
+ * Supabase-compatible auth change events emitted by `onAuthStateChange`.
338
+ *
339
+ * `INITIAL_SESSION` is fired once per subscription, right after subscribing,
340
+ * with whatever session was already stored. supabase-js does the same, and an
341
+ * app that clears its loading flag on it hangs forever without it.
342
+ */
343
+ export type AuthChangeEvent = 'INITIAL_SESSION' | 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED' | 'PASSWORD_RECOVERY' | 'MFA_CHALLENGE_VERIFIED';
344
+ export type AuthChangeListener = (event: AuthChangeEvent, session: Session | null) => void;
345
+ /** Internal event names used by the session store. */
346
+ export type AuthEvent = 'signIn' | 'signOut' | 'tokenRefreshed' | 'userUpdated' | 'mfaVerified';
347
+ export type AuthListener = (event: AuthEvent, session: Session | null) => void;
348
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,uFAAuF;AACvF,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI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W,aAAc,SAAQ,oBAAoB;IACzD,sEAAsE;IACtE,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,eAAe,EAAE,UAAU,CAAC;CACxG;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,mBAAmB,GACnB,wBAAwB,CAAC;AAC7B,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;AAE3F,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,gBAAgB,GAAG,aAAa,GAAG,aAAa,CAAC;AAChG,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/dist/warn.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function warnIgnoredOption(site: string, option: string, consequence: string): void;
2
+ //# sourceMappingURL=warn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../src/warn.ts"],"names":[],"mappings":"AAiBA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAKzF"}
package/dist/warn.js ADDED
@@ -0,0 +1,23 @@
1
+ import { isProduction } from './cookie.js';
2
+ /**
3
+ * One warning per ignored option, in development only.
4
+ *
5
+ * An option this SDK accepts and does not act on is the worst shape of
6
+ * incompatibility: the call compiles, returns a success, and does something
7
+ * other than what the caller asked. supabase-js code passes these because they
8
+ * work there. Saying so once, out loud, is the difference between a five minute
9
+ * fix and a production incident nobody can reproduce.
10
+ *
11
+ * Deduplicated by site and option, because these sit in call paths that run per
12
+ * row, and silent in production, where nobody reads the console and the cost is
13
+ * paid on every call.
14
+ */
15
+ const warned = new Set();
16
+ export function warnIgnoredOption(site, option, consequence) {
17
+ const key = `${site}.${option}`;
18
+ if (warned.has(key) || isProduction())
19
+ return;
20
+ warned.add(key);
21
+ console.warn(`[motherbase] ${site}: \`${option}\` is accepted and ignored. ${consequence}`);
22
+ }
23
+ //# sourceMappingURL=warn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warn.js","sourceRoot":"","sources":["../src/warn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,MAAc,EAAE,WAAmB;IACjF,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;IAChC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,YAAY,EAAE;QAAE,OAAO;IAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,CAAC,IAAI,CAAC,gBAAgB,IAAI,OAAO,MAAM,+BAA+B,WAAW,EAAE,CAAC,CAAC;AAC9F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motherbase/client",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Typed client SDK for Motherbase, the open source self-hosted backend platform.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,9 @@
28
28
  "README.md"
29
29
  ],
30
30
  "scripts": {
31
+ "prebuild": "npm run build -w @motherbase/contracts",
31
32
  "build": "tsc -p tsconfig.json",
33
+ "prepack": "npm run build",
32
34
  "clean": "rm -rf dist",
33
35
  "test": "vitest run --typecheck",
34
36
  "lint": "eslint ."
@@ -43,7 +45,7 @@
43
45
  ],
44
46
  "license": "MIT",
45
47
  "dependencies": {
46
- "@motherbase/contracts": "^1.0.0"
48
+ "@motherbase/contracts": "^1.0.5"
47
49
  },
48
50
  "peerDependencies": {
49
51
  "socket.io-client": "^4.0.0"