@motherbase/client 1.4.0 → 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 (90) hide show
  1. package/README.md +379 -284
  2. package/package.json +1 -1
  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 -362
  8. package/dist/auth.d.ts.map +0 -1
  9. package/dist/auth.js +0 -721
  10. package/dist/auth.js.map +0 -1
  11. package/dist/channel.d.ts +0 -122
  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/compat.d.ts +0 -40
  16. package/dist/compat.d.ts.map +0 -1
  17. package/dist/compat.js +0 -98
  18. package/dist/compat.js.map +0 -1
  19. package/dist/cookie.d.ts +0 -68
  20. package/dist/cookie.d.ts.map +0 -1
  21. package/dist/cookie.js +0 -152
  22. package/dist/cookie.js.map +0 -1
  23. package/dist/database.d.ts +0 -188
  24. package/dist/database.d.ts.map +0 -1
  25. package/dist/database.js +0 -2
  26. package/dist/database.js.map +0 -1
  27. package/dist/devices.d.ts +0 -13
  28. package/dist/devices.d.ts.map +0 -1
  29. package/dist/devices.js +0 -13
  30. package/dist/devices.js.map +0 -1
  31. package/dist/edge.d.ts +0 -7
  32. package/dist/edge.d.ts.map +0 -1
  33. package/dist/edge.js +0 -13
  34. package/dist/edge.js.map +0 -1
  35. package/dist/functions.d.ts +0 -60
  36. package/dist/functions.d.ts.map +0 -1
  37. package/dist/functions.js +0 -75
  38. package/dist/functions.js.map +0 -1
  39. package/dist/http.d.ts +0 -123
  40. package/dist/http.d.ts.map +0 -1
  41. package/dist/http.js +0 -205
  42. package/dist/http.js.map +0 -1
  43. package/dist/index.d.ts +0 -185
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/index.js +0 -331
  46. package/dist/index.js.map +0 -1
  47. package/dist/mfa.d.ts +0 -109
  48. package/dist/mfa.d.ts.map +0 -1
  49. package/dist/mfa.js +0 -134
  50. package/dist/mfa.js.map +0 -1
  51. package/dist/postgrest.d.ts +0 -326
  52. package/dist/postgrest.d.ts.map +0 -1
  53. package/dist/postgrest.js +0 -629
  54. package/dist/postgrest.js.map +0 -1
  55. package/dist/profile.d.ts +0 -16
  56. package/dist/profile.d.ts.map +0 -1
  57. package/dist/profile.js +0 -26
  58. package/dist/profile.js.map +0 -1
  59. package/dist/query.d.ts +0 -97
  60. package/dist/query.d.ts.map +0 -1
  61. package/dist/query.js +0 -94
  62. package/dist/query.js.map +0 -1
  63. package/dist/realtime.d.ts +0 -114
  64. package/dist/realtime.d.ts.map +0 -1
  65. package/dist/realtime.js +0 -372
  66. package/dist/realtime.js.map +0 -1
  67. package/dist/rest.d.ts +0 -50
  68. package/dist/rest.d.ts.map +0 -1
  69. package/dist/rest.js +0 -75
  70. package/dist/rest.js.map +0 -1
  71. package/dist/session.d.ts +0 -47
  72. package/dist/session.d.ts.map +0 -1
  73. package/dist/session.js +0 -136
  74. package/dist/session.js.map +0 -1
  75. package/dist/storage.d.ts +0 -239
  76. package/dist/storage.d.ts.map +0 -1
  77. package/dist/storage.js +0 -391
  78. package/dist/storage.js.map +0 -1
  79. package/dist/testing.d.ts +0 -38
  80. package/dist/testing.d.ts.map +0 -1
  81. package/dist/testing.js +0 -50
  82. package/dist/testing.js.map +0 -1
  83. package/dist/types.d.ts +0 -343
  84. package/dist/types.d.ts.map +0 -1
  85. package/dist/types.js +0 -2
  86. package/dist/types.js.map +0 -1
  87. package/dist/warn.d.ts +0 -4
  88. package/dist/warn.d.ts.map +0 -1
  89. package/dist/warn.js +0 -27
  90. package/dist/warn.js.map +0 -1
package/dist/cookie.js DELETED
@@ -1,152 +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
- * `httpOnly` defaults to false, and that default is load-bearing: in the
102
- * standard SSR setup `createBrowserClient` reads this same cookie from
103
- * `document.cookie`, so hiding it from scripts signs the browser half out.
104
- * Turn it on only when the browser client keeps its own copy elsewhere
105
- * (`storage: localStorageStorage()`). Either way the cookie is unsigned, so
106
- * `auth.getSession()` stays untrusted; `auth.getUser()` is the verified read.
107
- */
108
- export function serverCookieStorage(cookies, key = DEFAULT_KEY, options = {}) {
109
- const secure = options.secure ?? true;
110
- const httpOnly = options.httpOnly ?? false;
111
- return {
112
- get: () => {
113
- const match = cookies.getAll().find((c) => c.name === key);
114
- return parseSession(match?.value);
115
- },
116
- set: (session) => {
117
- if (!session) {
118
- try {
119
- cookies.setAll([{ name: key, value: '', options: { path: '/', maxAge: 0 } }]);
120
- }
121
- catch {
122
- // Signing out from a Server Component cannot clear the cookie either,
123
- // but middleware will on the next navigation. Not worth a warning.
124
- }
125
- return;
126
- }
127
- try {
128
- cookies.setAll([
129
- {
130
- name: key,
131
- // No percent-encoding here: `cookies().set()` encodes the value
132
- // itself, and encoding first yields a double-encoded cookie the
133
- // browser adapter can no longer parse.
134
- value: JSON.stringify(session),
135
- options: { path: '/', sameSite: 'lax', secure, httpOnly },
136
- },
137
- ]);
138
- }
139
- catch (err) {
140
- warnSessionCookieUnwritable(err instanceof Error ? err.message : String(err));
141
- return;
142
- }
143
- // The adapter shape everyone copies wraps `setAll` in its own try/catch,
144
- // so a refused write does not reach the catch above. It just does
145
- // nothing. Reading it back is the only way to tell the difference.
146
- if (!cookies.getAll().some((c) => c.name === key && c.value !== '')) {
147
- warnSessionCookieUnwritable('the write was accepted but the cookie is not readable back');
148
- }
149
- },
150
- };
151
- }
152
- //# 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,yDAAyD,MAAM,8BAA8B;UACzF,2FAA2F;U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EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,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,QAAQ,EAAE;qBAC1D;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,kEAAkE;YAClE,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,188 +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, PaginateOptions, 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
- overrideTypes<T>(): TypedQuery<Row, Insert, Update, T>;
155
- /** Reject instead of resolving `{ data: null, error }`. */
156
- throwOnError(): this;
157
- /** Refuse the write if it would touch more than `count` rows. */
158
- maxAffected(count: number): this;
159
- /** Run the query, then roll the transaction back. */
160
- rollback(): this;
161
- csv(): PostgrestTextBuilder;
162
- geojson(): PostgrestExplainBuilder;
163
- explain(options?: ExplainOptions): PostgrestExplainBuilder;
164
- /**
165
- * Walk every matching row instead of stopping at the server's row cap.
166
- * Throws on error: a `for await` loop has nowhere to put an error value, and
167
- * ending the iteration quietly looks exactly like reaching the last page.
168
- */
169
- stream(options?: PaginateOptions): AsyncGenerator<Result, void, undefined>;
170
- paginate(options?: PaginateOptions): AsyncGenerator<{
171
- rows: Result[];
172
- from: number;
173
- count: number | null;
174
- }, void, undefined>;
175
- single(): TypedSingleQuery<Result>;
176
- maybeSingle(): TypedSingleQuery<Result | null>;
177
- /** The URL path (with query string) this builder targets. Exposed for tests. */
178
- toPath(): string;
179
- /** The headers this builder sends (Prefer, Accept). Exposed for tests. */
180
- toHeaders(): Record<string, string>;
181
- }
182
- /** A builder narrowed to one row by `.single()` / `.maybeSingle()`. */
183
- export interface TypedSingleQuery<Result> extends PromiseLike<PostgrestResponse<Result>> {
184
- toPath(): string;
185
- toHeaders(): Record<string, string>;
186
- }
187
- export {};
188
- //# 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,eAAe,EACf,qBAAqB,EACrB,uBAA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AAM,GAAG,IAAI,CAAC;IACjC,qDAAqD;IACrD,QAAQ,IAAI,IAAI,CAAC;IACjB,GAAG,IAAI,oBAAoB,CAAC;IAC5B,OAAO,IAAI,uBAAuB,CAAC;IACnC,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,uBAAuB,CAAC;IAE3D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAC3E,QAAQ,CACN,OAAO,CAAC,EAAE,eAAe,GACxB,cAAc,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAE3F,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
@@ -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,60 +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
- /** HTTP method the function receives. Defaults to POST, as in supabase-js. */
18
- method?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE';
19
- /** Extra request headers, forwarded to the function. */
20
- headers?: Record<string, string>;
21
- /**
22
- * Accepted for supabase-js signature parity and ignored: a self-hosted
23
- * Motherbase runs its functions in one place, so there is no region to pick.
24
- */
25
- region?: string;
26
- }
27
- /**
28
- * The error classes supabase-js throws from `functions.invoke`.
29
- *
30
- * Ported code branches on them (`if (error instanceof FunctionsHttpError)`), so
31
- * they exist here and `invoke` puts the matching instance in `error`. It still
32
- * resolves rather than throws: the `{ data, error }` envelope is the contract
33
- * everywhere else in this SDK, and a method that sometimes throws and sometimes
34
- * does not is worse than either.
35
- */
36
- export declare class FunctionsError extends Error {
37
- readonly name_: string;
38
- readonly context?: unknown | undefined;
39
- constructor(message: string, name_?: string, context?: unknown | undefined);
40
- }
41
- /** The function ran and answered with a non-2xx status. */
42
- export declare class FunctionsHttpError extends FunctionsError {
43
- readonly status?: number;
44
- constructor(message: string, status?: number, context?: unknown);
45
- }
46
- /** The function threw before producing a response. */
47
- export declare class FunctionsRelayError extends FunctionsError {
48
- constructor(message: string, context?: unknown);
49
- }
50
- /** The request never reached the function (network, abort, DNS). */
51
- export declare class FunctionsFetchError extends FunctionsError {
52
- constructor(message: string, context?: unknown);
53
- }
54
- /** Supabase-compatible edge functions client: `client.functions.invoke(name, { body })`. */
55
- export declare class FunctionsClient {
56
- private readonly http;
57
- constructor(http: HttpClient);
58
- invoke<Result = unknown, Body = Record<string, unknown>>(name: string, options?: FunctionInvokeOptions<Body>): Promise<MotherbaseResponse<Result>>;
59
- }
60
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAGA,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;IAC1B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrD,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACV,QAAQ,CAAC,KAAK;IAAqB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAA9E,OAAO,EAAE,MAAM,EAAW,KAAK,SAAmB,EAAW,OAAO,CAAC,EAAE,OAAO,YAAA;CAI3F;AAED,2DAA2D;AAC3D,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBACb,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAIhE;AAED,sDAAsD;AACtD,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAG/C;AAED,oEAAoE;AACpE,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAG/C;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;CAgCvC"}
package/dist/functions.js DELETED
@@ -1,75 +0,0 @@
1
- import { BackendError, toError } from './http.js';
2
- import { warnIgnoredOption } from './warn.js';
3
- import { contractPath } from '@motherbase/contracts';
4
- /**
5
- * The error classes supabase-js throws from `functions.invoke`.
6
- *
7
- * Ported code branches on them (`if (error instanceof FunctionsHttpError)`), so
8
- * they exist here and `invoke` puts the matching instance in `error`. It still
9
- * resolves rather than throws: the `{ data, error }` envelope is the contract
10
- * everywhere else in this SDK, and a method that sometimes throws and sometimes
11
- * does not is worse than either.
12
- */
13
- export class FunctionsError extends Error {
14
- constructor(message, name_ = 'FunctionsError', context) {
15
- super(message);
16
- this.name_ = name_;
17
- this.context = context;
18
- this.name = name_;
19
- }
20
- }
21
- /** The function ran and answered with a non-2xx status. */
22
- export class FunctionsHttpError extends FunctionsError {
23
- constructor(message, status, context) {
24
- super(message, 'FunctionsHttpError', context);
25
- this.status = status;
26
- }
27
- }
28
- /** The function threw before producing a response. */
29
- export class FunctionsRelayError extends FunctionsError {
30
- constructor(message, context) {
31
- super(message, 'FunctionsRelayError', context);
32
- }
33
- }
34
- /** The request never reached the function (network, abort, DNS). */
35
- export class FunctionsFetchError extends FunctionsError {
36
- constructor(message, context) {
37
- super(message, 'FunctionsFetchError', context);
38
- }
39
- }
40
- /** Supabase-compatible edge functions client: `client.functions.invoke(name, { body })`. */
41
- export class FunctionsClient {
42
- constructor(http) {
43
- this.http = http;
44
- }
45
- async invoke(name, options = {}) {
46
- try {
47
- if (options.region) {
48
- warnIgnoredOption('functions.invoke', 'region', 'A self-hosted Motherbase runs every function in one place, so the call goes there regardless.');
49
- }
50
- const edgeToken = options.auth?.type === 'edge-token' ? options.auth.token : undefined;
51
- const method = options.method ?? 'POST';
52
- const data = await this.http.request(contractPath.edge(name), {
53
- method,
54
- // A GET or DELETE with a JSON body is refused by some proxies and means
55
- // nothing to the function, so the body is only sent where it can be read.
56
- body: method === 'GET' || method === 'DELETE' ? undefined : (options.body ?? {}),
57
- anonymous: options.auth !== undefined,
58
- headers: {
59
- ...options.headers,
60
- ...(edgeToken ? { 'x-motherbase-edge-token': edgeToken } : {}),
61
- },
62
- });
63
- return { data, error: null };
64
- }
65
- catch (err) {
66
- const base = toError(err);
67
- const status = err instanceof BackendError ? err.httpStatus : 0;
68
- const error = status
69
- ? Object.assign(new FunctionsHttpError(base.message, status), base)
70
- : Object.assign(new FunctionsFetchError(base.message), base);
71
- return { data: null, error };
72
- }
73
- }
74
- }
75
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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