@aurabase/aurabase-js 0.5.2 → 0.5.3
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.
- package/dist/{AuraClient-DL7mqfNu.d.cts → AuraClient-K3hRdh9J.d.cts} +27 -3
- package/dist/{AuraClient-DL7mqfNu.d.ts → AuraClient-K3hRdh9J.d.ts} +27 -3
- package/dist/index.cjs +23 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -1
- package/dist/ssr.cjs +23 -1
- package/dist/ssr.d.cts +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +23 -1
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AiService } from '@aurabase/ai';
|
|
2
2
|
import { AuthService, AuthAdminService } from '@aurabase/auth';
|
|
3
3
|
import { AuraClientLike, BaseAuthStore, AuraObservabilityEvent, AuraClientOptions, ChannelConfig } from '@aurabase/core';
|
|
4
|
-
import { DatabaseService } from '@aurabase/db';
|
|
4
|
+
import { GenericSchema, DatabaseService, AuraQueryBuilder, AuraClientOptionsT } from '@aurabase/db';
|
|
5
5
|
import { FunctionsService } from '@aurabase/functions';
|
|
6
6
|
import { NotificationsService } from '@aurabase/notifications';
|
|
7
7
|
import { RealtimeService, AuraChannel } from '@aurabase/realtime';
|
|
@@ -23,7 +23,9 @@ import { StorageService } from '@aurabase/storage';
|
|
|
23
23
|
* const { data } = await aura.db.from('posts').eq('published', true)
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
declare class AuraClient<Database = any
|
|
26
|
+
declare class AuraClient<Database = any, Schema extends GenericSchema = Database extends {
|
|
27
|
+
public: infer S;
|
|
28
|
+
} ? S extends GenericSchema ? S : any : any> implements AuraClientLike {
|
|
27
29
|
/** URL du projet (`https://<slug>.aurabase.cloud`), sans barre finale. */
|
|
28
30
|
readonly baseUrl: string;
|
|
29
31
|
readonly apiKey: string | null;
|
|
@@ -64,12 +66,34 @@ declare class AuraClient<Database = any> implements AuraClientLike {
|
|
|
64
66
|
dispose(): void;
|
|
65
67
|
get auth(): AuthService;
|
|
66
68
|
get authAdmin(): AuthAdminService;
|
|
67
|
-
get db(): DatabaseService<Database>;
|
|
69
|
+
get db(): DatabaseService<Database, Schema>;
|
|
68
70
|
get storage(): StorageService;
|
|
69
71
|
get realtime(): RealtimeService;
|
|
70
72
|
get functions(): FunctionsService;
|
|
71
73
|
get ai(): AiService;
|
|
72
74
|
get notifications(): NotificationsService;
|
|
75
|
+
/**
|
|
76
|
+
* Shortcut: query a database table or view (Supabase-compatible API).
|
|
77
|
+
* Equivalent to `aura.db.from(table)`.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const { data, error } = await aura.from('posts').select('*').limit(10)
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(table: TableName): AuraQueryBuilder<Schema, Table, TableName, AuraClientOptionsT>;
|
|
85
|
+
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(view: ViewName): AuraQueryBuilder<Schema, View, ViewName, AuraClientOptionsT>;
|
|
86
|
+
from(table: string): AuraQueryBuilder<any, any, any, AuraClientOptionsT>;
|
|
87
|
+
/**
|
|
88
|
+
* Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
|
|
89
|
+
* Equivalent to `aura.db.rpc(fn, args, options)`.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { data, error } = await aura.rpc('echo_test', { message: 'hello' })
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
rpc<T = any>(fn: string, args?: Record<string, unknown>, options?: any): any;
|
|
73
97
|
/**
|
|
74
98
|
* Shortcut: create a realtime channel with Supabase-compatible API.
|
|
75
99
|
* Equivalent to `aura.realtime.channel(name)`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AiService } from '@aurabase/ai';
|
|
2
2
|
import { AuthService, AuthAdminService } from '@aurabase/auth';
|
|
3
3
|
import { AuraClientLike, BaseAuthStore, AuraObservabilityEvent, AuraClientOptions, ChannelConfig } from '@aurabase/core';
|
|
4
|
-
import { DatabaseService } from '@aurabase/db';
|
|
4
|
+
import { GenericSchema, DatabaseService, AuraQueryBuilder, AuraClientOptionsT } from '@aurabase/db';
|
|
5
5
|
import { FunctionsService } from '@aurabase/functions';
|
|
6
6
|
import { NotificationsService } from '@aurabase/notifications';
|
|
7
7
|
import { RealtimeService, AuraChannel } from '@aurabase/realtime';
|
|
@@ -23,7 +23,9 @@ import { StorageService } from '@aurabase/storage';
|
|
|
23
23
|
* const { data } = await aura.db.from('posts').eq('published', true)
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
declare class AuraClient<Database = any
|
|
26
|
+
declare class AuraClient<Database = any, Schema extends GenericSchema = Database extends {
|
|
27
|
+
public: infer S;
|
|
28
|
+
} ? S extends GenericSchema ? S : any : any> implements AuraClientLike {
|
|
27
29
|
/** URL du projet (`https://<slug>.aurabase.cloud`), sans barre finale. */
|
|
28
30
|
readonly baseUrl: string;
|
|
29
31
|
readonly apiKey: string | null;
|
|
@@ -64,12 +66,34 @@ declare class AuraClient<Database = any> implements AuraClientLike {
|
|
|
64
66
|
dispose(): void;
|
|
65
67
|
get auth(): AuthService;
|
|
66
68
|
get authAdmin(): AuthAdminService;
|
|
67
|
-
get db(): DatabaseService<Database>;
|
|
69
|
+
get db(): DatabaseService<Database, Schema>;
|
|
68
70
|
get storage(): StorageService;
|
|
69
71
|
get realtime(): RealtimeService;
|
|
70
72
|
get functions(): FunctionsService;
|
|
71
73
|
get ai(): AiService;
|
|
72
74
|
get notifications(): NotificationsService;
|
|
75
|
+
/**
|
|
76
|
+
* Shortcut: query a database table or view (Supabase-compatible API).
|
|
77
|
+
* Equivalent to `aura.db.from(table)`.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const { data, error } = await aura.from('posts').select('*').limit(10)
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
from<TableName extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName]>(table: TableName): AuraQueryBuilder<Schema, Table, TableName, AuraClientOptionsT>;
|
|
85
|
+
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(view: ViewName): AuraQueryBuilder<Schema, View, ViewName, AuraClientOptionsT>;
|
|
86
|
+
from(table: string): AuraQueryBuilder<any, any, any, AuraClientOptionsT>;
|
|
87
|
+
/**
|
|
88
|
+
* Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
|
|
89
|
+
* Equivalent to `aura.db.rpc(fn, args, options)`.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { data, error } = await aura.rpc('echo_test', { message: 'hello' })
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
rpc<T = any>(fn: string, args?: Record<string, unknown>, options?: any): any;
|
|
73
97
|
/**
|
|
74
98
|
* Shortcut: create a realtime channel with Supabase-compatible API.
|
|
75
99
|
* Equivalent to `aura.realtime.channel(name)`.
|
package/dist/index.cjs
CHANGED
|
@@ -76,7 +76,12 @@ var AuraClient = class {
|
|
|
76
76
|
this.authStore = resolvedOptions.auth.storage;
|
|
77
77
|
} else if (resolvedOptions?.auth?.persistSession === false) {
|
|
78
78
|
this.authStore = new core.BaseAuthStore();
|
|
79
|
-
} else if (typeof localStorage !== "undefined") {
|
|
79
|
+
} else if (isBrowserContext() && typeof window.localStorage !== "undefined" || typeof globalThis !== "undefined" && (() => {
|
|
80
|
+
const g = globalThis;
|
|
81
|
+
const proc = g?.process;
|
|
82
|
+
const isTest = !!(proc?.env?.VITEST || proc?.env?.NODE_ENV === "test" || proc?.env?.JEST_WORKER_ID);
|
|
83
|
+
return isTest && g?.localStorage && typeof g.localStorage.getItem === "function";
|
|
84
|
+
})()) {
|
|
80
85
|
this.authStore = new core.LocalAuthStore(`aura-${core.clientScope(this.baseUrl)}-auth`);
|
|
81
86
|
} else {
|
|
82
87
|
this.authStore = new core.BaseAuthStore();
|
|
@@ -153,6 +158,23 @@ var AuraClient = class {
|
|
|
153
158
|
if (!this._notifications) this._notifications = new notifications.NotificationsService(this);
|
|
154
159
|
return this._notifications;
|
|
155
160
|
}
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
162
|
+
from(table) {
|
|
163
|
+
return this.db.from(table);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
|
|
167
|
+
* Equivalent to `aura.db.rpc(fn, args, options)`.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const { data, error } = await aura.rpc('echo_test', { message: 'hello' })
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
+
rpc(fn, args, options) {
|
|
176
|
+
return this.db.rpc(fn, args, options);
|
|
177
|
+
}
|
|
156
178
|
/**
|
|
157
179
|
* Shortcut: create a realtime channel with Supabase-compatible API.
|
|
158
180
|
* Equivalent to `aura.realtime.channel(name)`.
|
package/dist/index.d.cts
CHANGED
|
@@ -6,8 +6,8 @@ export { DatabaseService, QueryBuilder } from '@aurabase/db';
|
|
|
6
6
|
export { FunctionsService } from '@aurabase/functions';
|
|
7
7
|
export { NotificationsAdminService, NotificationsService } from '@aurabase/notifications';
|
|
8
8
|
export { AuraChannel, RealtimeService } from '@aurabase/realtime';
|
|
9
|
-
export { StorageService } from '@aurabase/storage';
|
|
10
|
-
import { A as AuraClient } from './AuraClient-
|
|
9
|
+
export { StorageBucketClient, StorageService } from '@aurabase/storage';
|
|
10
|
+
import { A as AuraClient } from './AuraClient-K3hRdh9J.cjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new Aurabase client instance.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export { DatabaseService, QueryBuilder } from '@aurabase/db';
|
|
|
6
6
|
export { FunctionsService } from '@aurabase/functions';
|
|
7
7
|
export { NotificationsAdminService, NotificationsService } from '@aurabase/notifications';
|
|
8
8
|
export { AuraChannel, RealtimeService } from '@aurabase/realtime';
|
|
9
|
-
export { StorageService } from '@aurabase/storage';
|
|
10
|
-
import { A as AuraClient } from './AuraClient-
|
|
9
|
+
export { StorageBucketClient, StorageService } from '@aurabase/storage';
|
|
10
|
+
import { A as AuraClient } from './AuraClient-K3hRdh9J.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a new Aurabase client instance.
|
package/dist/index.js
CHANGED
|
@@ -82,7 +82,12 @@ var AuraClient = class {
|
|
|
82
82
|
this.authStore = resolvedOptions.auth.storage;
|
|
83
83
|
} else if (resolvedOptions?.auth?.persistSession === false) {
|
|
84
84
|
this.authStore = new BaseAuthStore();
|
|
85
|
-
} else if (typeof localStorage !== "undefined") {
|
|
85
|
+
} else if (isBrowserContext() && typeof window.localStorage !== "undefined" || typeof globalThis !== "undefined" && (() => {
|
|
86
|
+
const g = globalThis;
|
|
87
|
+
const proc = g?.process;
|
|
88
|
+
const isTest = !!(proc?.env?.VITEST || proc?.env?.NODE_ENV === "test" || proc?.env?.JEST_WORKER_ID);
|
|
89
|
+
return isTest && g?.localStorage && typeof g.localStorage.getItem === "function";
|
|
90
|
+
})()) {
|
|
86
91
|
this.authStore = new LocalAuthStore(`aura-${clientScope(this.baseUrl)}-auth`);
|
|
87
92
|
} else {
|
|
88
93
|
this.authStore = new BaseAuthStore();
|
|
@@ -159,6 +164,23 @@ var AuraClient = class {
|
|
|
159
164
|
if (!this._notifications) this._notifications = new NotificationsService(this);
|
|
160
165
|
return this._notifications;
|
|
161
166
|
}
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
from(table) {
|
|
169
|
+
return this.db.from(table);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
|
|
173
|
+
* Equivalent to `aura.db.rpc(fn, args, options)`.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const { data, error } = await aura.rpc('echo_test', { message: 'hello' })
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
+
rpc(fn, args, options) {
|
|
182
|
+
return this.db.rpc(fn, args, options);
|
|
183
|
+
}
|
|
162
184
|
/**
|
|
163
185
|
* Shortcut: create a realtime channel with Supabase-compatible API.
|
|
164
186
|
* Equivalent to `aura.realtime.channel(name)`.
|
package/dist/ssr.cjs
CHANGED
|
@@ -76,7 +76,12 @@ var AuraClient = class {
|
|
|
76
76
|
this.authStore = resolvedOptions.auth.storage;
|
|
77
77
|
} else if (resolvedOptions?.auth?.persistSession === false) {
|
|
78
78
|
this.authStore = new core.BaseAuthStore();
|
|
79
|
-
} else if (typeof localStorage !== "undefined") {
|
|
79
|
+
} else if (isBrowserContext() && typeof window.localStorage !== "undefined" || typeof globalThis !== "undefined" && (() => {
|
|
80
|
+
const g = globalThis;
|
|
81
|
+
const proc = g?.process;
|
|
82
|
+
const isTest = !!(proc?.env?.VITEST || proc?.env?.NODE_ENV === "test" || proc?.env?.JEST_WORKER_ID);
|
|
83
|
+
return isTest && g?.localStorage && typeof g.localStorage.getItem === "function";
|
|
84
|
+
})()) {
|
|
80
85
|
this.authStore = new core.LocalAuthStore(`aura-${core.clientScope(this.baseUrl)}-auth`);
|
|
81
86
|
} else {
|
|
82
87
|
this.authStore = new core.BaseAuthStore();
|
|
@@ -153,6 +158,23 @@ var AuraClient = class {
|
|
|
153
158
|
if (!this._notifications) this._notifications = new notifications.NotificationsService(this);
|
|
154
159
|
return this._notifications;
|
|
155
160
|
}
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
162
|
+
from(table) {
|
|
163
|
+
return this.db.from(table);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
|
|
167
|
+
* Equivalent to `aura.db.rpc(fn, args, options)`.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const { data, error } = await aura.rpc('echo_test', { message: 'hello' })
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
+
rpc(fn, args, options) {
|
|
176
|
+
return this.db.rpc(fn, args, options);
|
|
177
|
+
}
|
|
156
178
|
/**
|
|
157
179
|
* Shortcut: create a realtime channel with Supabase-compatible API.
|
|
158
180
|
* Equivalent to `aura.realtime.channel(name)`.
|
package/dist/ssr.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SerializeCookieOptions, AuraClientOptions } from '@aurabase/core';
|
|
2
2
|
export { SerializeCookieOptions, parseCookieHeader, serializeCookieHeader } from '@aurabase/core';
|
|
3
|
-
import { A as AuraClient } from './AuraClient-
|
|
3
|
+
import { A as AuraClient } from './AuraClient-K3hRdh9J.cjs';
|
|
4
4
|
import '@aurabase/ai';
|
|
5
5
|
import '@aurabase/auth';
|
|
6
6
|
import '@aurabase/db';
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SerializeCookieOptions, AuraClientOptions } from '@aurabase/core';
|
|
2
2
|
export { SerializeCookieOptions, parseCookieHeader, serializeCookieHeader } from '@aurabase/core';
|
|
3
|
-
import { A as AuraClient } from './AuraClient-
|
|
3
|
+
import { A as AuraClient } from './AuraClient-K3hRdh9J.js';
|
|
4
4
|
import '@aurabase/ai';
|
|
5
5
|
import '@aurabase/auth';
|
|
6
6
|
import '@aurabase/db';
|
package/dist/ssr.js
CHANGED
|
@@ -75,7 +75,12 @@ var AuraClient = class {
|
|
|
75
75
|
this.authStore = resolvedOptions.auth.storage;
|
|
76
76
|
} else if (resolvedOptions?.auth?.persistSession === false) {
|
|
77
77
|
this.authStore = new BaseAuthStore();
|
|
78
|
-
} else if (typeof localStorage !== "undefined") {
|
|
78
|
+
} else if (isBrowserContext() && typeof window.localStorage !== "undefined" || typeof globalThis !== "undefined" && (() => {
|
|
79
|
+
const g = globalThis;
|
|
80
|
+
const proc = g?.process;
|
|
81
|
+
const isTest = !!(proc?.env?.VITEST || proc?.env?.NODE_ENV === "test" || proc?.env?.JEST_WORKER_ID);
|
|
82
|
+
return isTest && g?.localStorage && typeof g.localStorage.getItem === "function";
|
|
83
|
+
})()) {
|
|
79
84
|
this.authStore = new LocalAuthStore(`aura-${clientScope(this.baseUrl)}-auth`);
|
|
80
85
|
} else {
|
|
81
86
|
this.authStore = new BaseAuthStore();
|
|
@@ -152,6 +157,23 @@ var AuraClient = class {
|
|
|
152
157
|
if (!this._notifications) this._notifications = new NotificationsService(this);
|
|
153
158
|
return this._notifications;
|
|
154
159
|
}
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
161
|
+
from(table) {
|
|
162
|
+
return this.db.from(table);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API).
|
|
166
|
+
* Equivalent to `aura.db.rpc(fn, args, options)`.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const { data, error } = await aura.rpc('echo_test', { message: 'hello' })
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
+
rpc(fn, args, options) {
|
|
175
|
+
return this.db.rpc(fn, args, options);
|
|
176
|
+
}
|
|
155
177
|
/**
|
|
156
178
|
* Shortcut: create a realtime channel with Supabase-compatible API.
|
|
157
179
|
* Equivalent to `aura.realtime.channel(name)`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurabase/aurabase-js",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Official JavaScript/TypeScript client for Aurabase BaaS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"client"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@aurabase/core": "0.5.
|
|
60
|
-
"@aurabase/
|
|
61
|
-
"@aurabase/
|
|
62
|
-
"@aurabase/
|
|
63
|
-
"@aurabase/
|
|
64
|
-
"@aurabase/
|
|
65
|
-
"@aurabase/
|
|
66
|
-
"@aurabase/
|
|
59
|
+
"@aurabase/core": "0.5.3",
|
|
60
|
+
"@aurabase/realtime": "0.5.3",
|
|
61
|
+
"@aurabase/auth": "0.5.3",
|
|
62
|
+
"@aurabase/functions": "0.5.3",
|
|
63
|
+
"@aurabase/notifications": "0.5.3",
|
|
64
|
+
"@aurabase/ai": "0.5.3",
|
|
65
|
+
"@aurabase/storage": "0.5.3",
|
|
66
|
+
"@aurabase/db": "0.5.3"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/node": "20.14.15",
|