@aurabase/aurabase-js 0.6.1 → 0.6.2
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/README.md +9 -3
- package/dist/index.cjs +15 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -0
- package/dist/nextjs.cjs +22 -7
- package/dist/nextjs.d.cts +2 -2
- package/dist/nextjs.d.ts +2 -2
- package/dist/nextjs.js +22 -7
- package/dist/ssr.cjs +16 -1
- package/dist/ssr.d.cts +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +16 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Client JavaScript/TypeScript officiel pour [Aurabase](https://aurabase.cloud) : la plateforme Backend-as-a-Service open-source haute performance propulsée par Rust.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@aurabase/aurabase-js) [](https://github.com/
|
|
5
|
+
[](https://www.npmjs.com/package/@aurabase/aurabase-js) [](https://github.com/Aurabase-cloud/Aurabase/blob/main/LICENSE)
|
|
6
6
|
|
|
7
7
|
🌐 **Site officiel** : [https://aurabase.cloud](https://aurabase.cloud)
|
|
8
8
|
📖 **Documentation** : [https://aurabase.cloud/docs](https://aurabase.cloud)
|
|
9
|
-
🐙 **GitHub** : [
|
|
9
|
+
🐙 **GitHub** : [Aurabase-cloud/Aurabase](https://github.com/Aurabase-cloud/Aurabase)
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm i @aurabase/aurabase-js
|
|
15
|
+
# ou
|
|
16
|
+
pnpm add @aurabase/aurabase-js
|
|
17
|
+
yarn add @aurabase/aurabase-js
|
|
18
|
+
bun add @aurabase/aurabase-js
|
|
15
19
|
```
|
|
16
20
|
|
|
21
|
+
> **Attention au nom.** Le paquet officiel est `@aurabase/aurabase-js` (avec la portée `@aurabase/`). Le paquet `aurabase-js` sans portée n'est **pas** maintenu par Aurabase : ne l'installez pas.
|
|
22
|
+
|
|
17
23
|
## Rôle
|
|
18
24
|
|
|
19
25
|
Ce package ne réimplémente aucune logique de service : il compose `AuthService`, `DatabaseService`, `StorageService`, `RealtimeService`, `FunctionsService`, `AiService` et `NotificationsService` (chacun dans son propre package `@aurabase/*`) derrière un seul client.
|
|
@@ -33,7 +39,7 @@ const { data, error } = await aura.db
|
|
|
33
39
|
.from('posts')
|
|
34
40
|
.select('id,title,published')
|
|
35
41
|
.eq('published', true)
|
|
36
|
-
.order('created_at',
|
|
42
|
+
.order('created_at', { ascending: false })
|
|
37
43
|
.limit(10)
|
|
38
44
|
|
|
39
45
|
if (error) {
|
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,21 @@ var AuraClient = class {
|
|
|
61
61
|
* @param apiKey Clé API du projet (`aura_anon_…`, `aura_auth_…`, `aura_sk_…`).
|
|
62
62
|
*/
|
|
63
63
|
constructor(baseUrl, apiKey, options) {
|
|
64
|
+
if (typeof baseUrl !== "string" || baseUrl.trim() === "") {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"[aurabase] Project URL is required: set NEXT_PUBLIC_AURABASE_URL to the project URL shown in Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080), then pass it to createClient(url, key)."
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (!/^https?:\/\//i.test(baseUrl.trim())) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`[aurabase] baseUrl must start with http:// or https:// (got "${baseUrl}"): copy the project URL from Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080).`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (apiKey === void 0 || apiKey === null) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
"[aurabase] API key is required: set NEXT_PUBLIC_AURABASE_ANON_KEY (browser) or AURABASE_SERVICE_ROLE_KEY (server only) to a key shown in Studio \u203A Settings \u203A Connection, then pass it to createClient(url, key)."
|
|
77
|
+
);
|
|
78
|
+
}
|
|
64
79
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
65
80
|
const resolvedOptions = options;
|
|
66
81
|
this.apiKey = apiKey || null;
|
package/dist/index.d.cts
CHANGED
|
@@ -38,7 +38,7 @@ declare function createClient<Database = any>(baseUrl: string, apiKey: string, o
|
|
|
38
38
|
* @example
|
|
39
39
|
* ```ts
|
|
40
40
|
* // server-side only (API route, edge function, backend)
|
|
41
|
-
* const admin = createAdminClient(projectUrl, process.env.
|
|
41
|
+
* const admin = createAdminClient(projectUrl, process.env.AURABASE_SERVICE_ROLE_KEY!)
|
|
42
42
|
* await admin.authAdmin.listUsers()
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ declare function createClient<Database = any>(baseUrl: string, apiKey: string, o
|
|
|
38
38
|
* @example
|
|
39
39
|
* ```ts
|
|
40
40
|
* // server-side only (API route, edge function, backend)
|
|
41
|
-
* const admin = createAdminClient(projectUrl, process.env.
|
|
41
|
+
* const admin = createAdminClient(projectUrl, process.env.AURABASE_SERVICE_ROLE_KEY!)
|
|
42
42
|
* await admin.authAdmin.listUsers()
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
package/dist/index.js
CHANGED
|
@@ -67,6 +67,21 @@ var AuraClient = class {
|
|
|
67
67
|
* @param apiKey Clé API du projet (`aura_anon_…`, `aura_auth_…`, `aura_sk_…`).
|
|
68
68
|
*/
|
|
69
69
|
constructor(baseUrl, apiKey, options) {
|
|
70
|
+
if (typeof baseUrl !== "string" || baseUrl.trim() === "") {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"[aurabase] Project URL is required: set NEXT_PUBLIC_AURABASE_URL to the project URL shown in Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080), then pass it to createClient(url, key)."
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (!/^https?:\/\//i.test(baseUrl.trim())) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`[aurabase] baseUrl must start with http:// or https:// (got "${baseUrl}"): copy the project URL from Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080).`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
if (apiKey === void 0 || apiKey === null) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
"[aurabase] API key is required: set NEXT_PUBLIC_AURABASE_ANON_KEY (browser) or AURABASE_SERVICE_ROLE_KEY (server only) to a key shown in Studio \u203A Settings \u203A Connection, then pass it to createClient(url, key)."
|
|
83
|
+
);
|
|
84
|
+
}
|
|
70
85
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
71
86
|
const resolvedOptions = options;
|
|
72
87
|
this.apiKey = apiKey || null;
|
package/dist/nextjs.cjs
CHANGED
|
@@ -61,6 +61,21 @@ var AuraClient = class {
|
|
|
61
61
|
* @param apiKey Clé API du projet (`aura_anon_…`, `aura_auth_…`, `aura_sk_…`).
|
|
62
62
|
*/
|
|
63
63
|
constructor(baseUrl, apiKey, options) {
|
|
64
|
+
if (typeof baseUrl !== "string" || baseUrl.trim() === "") {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"[aurabase] Project URL is required: set NEXT_PUBLIC_AURABASE_URL to the project URL shown in Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080), then pass it to createClient(url, key)."
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (!/^https?:\/\//i.test(baseUrl.trim())) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`[aurabase] baseUrl must start with http:// or https:// (got "${baseUrl}"): copy the project URL from Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080).`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (apiKey === void 0 || apiKey === null) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
"[aurabase] API key is required: set NEXT_PUBLIC_AURABASE_ANON_KEY (browser) or AURABASE_SERVICE_ROLE_KEY (server only) to a key shown in Studio \u203A Settings \u203A Connection, then pass it to createClient(url, key)."
|
|
77
|
+
);
|
|
78
|
+
}
|
|
64
79
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
65
80
|
const resolvedOptions = options;
|
|
66
81
|
this.apiKey = apiKey || null;
|
|
@@ -263,7 +278,7 @@ function createServerClient(baseUrl, apiKey, options) {
|
|
|
263
278
|
const defaultCookieOpts = {
|
|
264
279
|
path: "/",
|
|
265
280
|
secure: baseUrl.startsWith("https://"),
|
|
266
|
-
sameSite: "
|
|
281
|
+
sameSite: "lax",
|
|
267
282
|
httpOnly: true,
|
|
268
283
|
maxAge: 60 * 60 * 24 * 30,
|
|
269
284
|
// 30 days
|
|
@@ -325,8 +340,8 @@ function createAuthMiddleware(options = {}) {
|
|
|
325
340
|
);
|
|
326
341
|
}
|
|
327
342
|
const { NextResponse } = nextServer;
|
|
328
|
-
const projectUrl = options.projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ??
|
|
329
|
-
const anonKey = options.anonKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ??
|
|
343
|
+
const projectUrl = options.projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ?? "";
|
|
344
|
+
const anonKey = options.anonKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ?? "";
|
|
330
345
|
if (!projectUrl || !anonKey) {
|
|
331
346
|
console.warn(
|
|
332
347
|
"[@aurabase/nextjs] Variables d'environnement manquantes : NEXT_PUBLIC_AURABASE_URL ou NEXT_PUBLIC_AURABASE_ANON_KEY non d\xE9finies."
|
|
@@ -370,8 +385,8 @@ function createAuthMiddleware(options = {}) {
|
|
|
370
385
|
};
|
|
371
386
|
}
|
|
372
387
|
function createClientForServerComponent(cookieStore, projectUrl, apiKey) {
|
|
373
|
-
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ??
|
|
374
|
-
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ??
|
|
388
|
+
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ?? "";
|
|
389
|
+
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ?? "";
|
|
375
390
|
return createServerClient(url, key, {
|
|
376
391
|
cookies: {
|
|
377
392
|
getAll: () => cookieStore.getAll(),
|
|
@@ -381,8 +396,8 @@ function createClientForServerComponent(cookieStore, projectUrl, apiKey) {
|
|
|
381
396
|
});
|
|
382
397
|
}
|
|
383
398
|
function createClientForServerAction(cookieStore, projectUrl, apiKey) {
|
|
384
|
-
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ??
|
|
385
|
-
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ??
|
|
399
|
+
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ?? "";
|
|
400
|
+
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ?? "";
|
|
386
401
|
return createServerClient(url, key, {
|
|
387
402
|
cookies: {
|
|
388
403
|
getAll: () => cookieStore.getAll(),
|
package/dist/nextjs.d.cts
CHANGED
|
@@ -53,9 +53,9 @@ interface AuthContextParam {
|
|
|
53
53
|
request: NextRequestLike;
|
|
54
54
|
}
|
|
55
55
|
interface AuthMiddlewareOptions {
|
|
56
|
-
/** Project URL (defaults to process.env.NEXT_PUBLIC_AURABASE_URL
|
|
56
|
+
/** Project URL (defaults to process.env.NEXT_PUBLIC_AURABASE_URL — J1-004 : seul nom reconnu). */
|
|
57
57
|
projectUrl?: string;
|
|
58
|
-
/** Anon API Key (defaults to process.env.NEXT_PUBLIC_AURABASE_ANON_KEY
|
|
58
|
+
/** Anon API Key (defaults to process.env.NEXT_PUBLIC_AURABASE_ANON_KEY — J1-004 : seul nom reconnu). */
|
|
59
59
|
anonKey?: string;
|
|
60
60
|
/** List of route patterns that do not require authentication (e.g. ['/', '/login', '/signup', '/auth/*']). */
|
|
61
61
|
publicRoutes?: string[];
|
package/dist/nextjs.d.ts
CHANGED
|
@@ -53,9 +53,9 @@ interface AuthContextParam {
|
|
|
53
53
|
request: NextRequestLike;
|
|
54
54
|
}
|
|
55
55
|
interface AuthMiddlewareOptions {
|
|
56
|
-
/** Project URL (defaults to process.env.NEXT_PUBLIC_AURABASE_URL
|
|
56
|
+
/** Project URL (defaults to process.env.NEXT_PUBLIC_AURABASE_URL — J1-004 : seul nom reconnu). */
|
|
57
57
|
projectUrl?: string;
|
|
58
|
-
/** Anon API Key (defaults to process.env.NEXT_PUBLIC_AURABASE_ANON_KEY
|
|
58
|
+
/** Anon API Key (defaults to process.env.NEXT_PUBLIC_AURABASE_ANON_KEY — J1-004 : seul nom reconnu). */
|
|
59
59
|
anonKey?: string;
|
|
60
60
|
/** List of route patterns that do not require authentication (e.g. ['/', '/login', '/signup', '/auth/*']). */
|
|
61
61
|
publicRoutes?: string[];
|
package/dist/nextjs.js
CHANGED
|
@@ -59,6 +59,21 @@ var AuraClient = class {
|
|
|
59
59
|
* @param apiKey Clé API du projet (`aura_anon_…`, `aura_auth_…`, `aura_sk_…`).
|
|
60
60
|
*/
|
|
61
61
|
constructor(baseUrl, apiKey, options) {
|
|
62
|
+
if (typeof baseUrl !== "string" || baseUrl.trim() === "") {
|
|
63
|
+
throw new Error(
|
|
64
|
+
"[aurabase] Project URL is required: set NEXT_PUBLIC_AURABASE_URL to the project URL shown in Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080), then pass it to createClient(url, key)."
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
if (!/^https?:\/\//i.test(baseUrl.trim())) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`[aurabase] baseUrl must start with http:// or https:// (got "${baseUrl}"): copy the project URL from Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080).`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (apiKey === void 0 || apiKey === null) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
"[aurabase] API key is required: set NEXT_PUBLIC_AURABASE_ANON_KEY (browser) or AURABASE_SERVICE_ROLE_KEY (server only) to a key shown in Studio \u203A Settings \u203A Connection, then pass it to createClient(url, key)."
|
|
75
|
+
);
|
|
76
|
+
}
|
|
62
77
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
63
78
|
const resolvedOptions = options;
|
|
64
79
|
this.apiKey = apiKey || null;
|
|
@@ -261,7 +276,7 @@ function createServerClient(baseUrl, apiKey, options) {
|
|
|
261
276
|
const defaultCookieOpts = {
|
|
262
277
|
path: "/",
|
|
263
278
|
secure: baseUrl.startsWith("https://"),
|
|
264
|
-
sameSite: "
|
|
279
|
+
sameSite: "lax",
|
|
265
280
|
httpOnly: true,
|
|
266
281
|
maxAge: 60 * 60 * 24 * 30,
|
|
267
282
|
// 30 days
|
|
@@ -323,8 +338,8 @@ function createAuthMiddleware(options = {}) {
|
|
|
323
338
|
);
|
|
324
339
|
}
|
|
325
340
|
const { NextResponse } = nextServer;
|
|
326
|
-
const projectUrl = options.projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ??
|
|
327
|
-
const anonKey = options.anonKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ??
|
|
341
|
+
const projectUrl = options.projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ?? "";
|
|
342
|
+
const anonKey = options.anonKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ?? "";
|
|
328
343
|
if (!projectUrl || !anonKey) {
|
|
329
344
|
console.warn(
|
|
330
345
|
"[@aurabase/nextjs] Variables d'environnement manquantes : NEXT_PUBLIC_AURABASE_URL ou NEXT_PUBLIC_AURABASE_ANON_KEY non d\xE9finies."
|
|
@@ -368,8 +383,8 @@ function createAuthMiddleware(options = {}) {
|
|
|
368
383
|
};
|
|
369
384
|
}
|
|
370
385
|
function createClientForServerComponent(cookieStore, projectUrl, apiKey) {
|
|
371
|
-
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ??
|
|
372
|
-
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ??
|
|
386
|
+
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ?? "";
|
|
387
|
+
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ?? "";
|
|
373
388
|
return createServerClient(url, key, {
|
|
374
389
|
cookies: {
|
|
375
390
|
getAll: () => cookieStore.getAll(),
|
|
@@ -379,8 +394,8 @@ function createClientForServerComponent(cookieStore, projectUrl, apiKey) {
|
|
|
379
394
|
});
|
|
380
395
|
}
|
|
381
396
|
function createClientForServerAction(cookieStore, projectUrl, apiKey) {
|
|
382
|
-
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ??
|
|
383
|
-
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ??
|
|
397
|
+
const url = projectUrl ?? process.env.NEXT_PUBLIC_AURABASE_URL ?? "";
|
|
398
|
+
const key = apiKey ?? process.env.NEXT_PUBLIC_AURABASE_ANON_KEY ?? "";
|
|
384
399
|
return createServerClient(url, key, {
|
|
385
400
|
cookies: {
|
|
386
401
|
getAll: () => cookieStore.getAll(),
|
package/dist/ssr.cjs
CHANGED
|
@@ -61,6 +61,21 @@ var AuraClient = class {
|
|
|
61
61
|
* @param apiKey Clé API du projet (`aura_anon_…`, `aura_auth_…`, `aura_sk_…`).
|
|
62
62
|
*/
|
|
63
63
|
constructor(baseUrl, apiKey, options) {
|
|
64
|
+
if (typeof baseUrl !== "string" || baseUrl.trim() === "") {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"[aurabase] Project URL is required: set NEXT_PUBLIC_AURABASE_URL to the project URL shown in Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080), then pass it to createClient(url, key)."
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (!/^https?:\/\//i.test(baseUrl.trim())) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`[aurabase] baseUrl must start with http:// or https:// (got "${baseUrl}"): copy the project URL from Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080).`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (apiKey === void 0 || apiKey === null) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
"[aurabase] API key is required: set NEXT_PUBLIC_AURABASE_ANON_KEY (browser) or AURABASE_SERVICE_ROLE_KEY (server only) to a key shown in Studio \u203A Settings \u203A Connection, then pass it to createClient(url, key)."
|
|
77
|
+
);
|
|
78
|
+
}
|
|
64
79
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
65
80
|
const resolvedOptions = options;
|
|
66
81
|
this.apiKey = apiKey || null;
|
|
@@ -263,7 +278,7 @@ function createServerClient(baseUrl, apiKey, options) {
|
|
|
263
278
|
const defaultCookieOpts = {
|
|
264
279
|
path: "/",
|
|
265
280
|
secure: baseUrl.startsWith("https://"),
|
|
266
|
-
sameSite: "
|
|
281
|
+
sameSite: "lax",
|
|
267
282
|
httpOnly: true,
|
|
268
283
|
maxAge: 60 * 60 * 24 * 30,
|
|
269
284
|
// 30 days
|
package/dist/ssr.d.cts
CHANGED
|
@@ -18,7 +18,7 @@ import '@aurabase/storage';
|
|
|
18
18
|
*
|
|
19
19
|
* export async function middleware(request) {
|
|
20
20
|
* let response = NextResponse.next({ request })
|
|
21
|
-
* const client = createServerClient(
|
|
21
|
+
* const client = createServerClient(NEXT_PUBLIC_AURABASE_URL, NEXT_PUBLIC_AURABASE_ANON_KEY, {
|
|
22
22
|
* cookies: {
|
|
23
23
|
* getAll: () => request.cookies.getAll(),
|
|
24
24
|
* setAll: (cookies) => {
|
package/dist/ssr.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import '@aurabase/storage';
|
|
|
18
18
|
*
|
|
19
19
|
* export async function middleware(request) {
|
|
20
20
|
* let response = NextResponse.next({ request })
|
|
21
|
-
* const client = createServerClient(
|
|
21
|
+
* const client = createServerClient(NEXT_PUBLIC_AURABASE_URL, NEXT_PUBLIC_AURABASE_ANON_KEY, {
|
|
22
22
|
* cookies: {
|
|
23
23
|
* getAll: () => request.cookies.getAll(),
|
|
24
24
|
* setAll: (cookies) => {
|
package/dist/ssr.js
CHANGED
|
@@ -60,6 +60,21 @@ var AuraClient = class {
|
|
|
60
60
|
* @param apiKey Clé API du projet (`aura_anon_…`, `aura_auth_…`, `aura_sk_…`).
|
|
61
61
|
*/
|
|
62
62
|
constructor(baseUrl, apiKey, options) {
|
|
63
|
+
if (typeof baseUrl !== "string" || baseUrl.trim() === "") {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"[aurabase] Project URL is required: set NEXT_PUBLIC_AURABASE_URL to the project URL shown in Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080), then pass it to createClient(url, key)."
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (!/^https?:\/\//i.test(baseUrl.trim())) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`[aurabase] baseUrl must start with http:// or https:// (got "${baseUrl}"): copy the project URL from Studio \u203A Settings \u203A Connection (e.g. http://<slug>.localhost:8080).`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
if (apiKey === void 0 || apiKey === null) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
"[aurabase] API key is required: set NEXT_PUBLIC_AURABASE_ANON_KEY (browser) or AURABASE_SERVICE_ROLE_KEY (server only) to a key shown in Studio \u203A Settings \u203A Connection, then pass it to createClient(url, key)."
|
|
76
|
+
);
|
|
77
|
+
}
|
|
63
78
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
64
79
|
const resolvedOptions = options;
|
|
65
80
|
this.apiKey = apiKey || null;
|
|
@@ -262,7 +277,7 @@ function createServerClient(baseUrl, apiKey, options) {
|
|
|
262
277
|
const defaultCookieOpts = {
|
|
263
278
|
path: "/",
|
|
264
279
|
secure: baseUrl.startsWith("https://"),
|
|
265
|
-
sameSite: "
|
|
280
|
+
sameSite: "lax",
|
|
266
281
|
httpOnly: true,
|
|
267
282
|
maxAge: 60 * 60 * 24 * 30,
|
|
268
283
|
// 30 days
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurabase/aurabase-js",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Official JavaScript/TypeScript client for Aurabase BaaS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"author": "Aurabase",
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|
|
64
|
-
"url": "git+https://github.com/
|
|
64
|
+
"url": "git+https://github.com/Aurabase-cloud/Aurabase.git",
|
|
65
65
|
"directory": "aurabase-js/packages/aurabase"
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://aurabase.cloud",
|
|
68
68
|
"bugs": {
|
|
69
|
-
"url": "https://github.com/
|
|
69
|
+
"url": "https://github.com/Aurabase-cloud/Aurabase/issues"
|
|
70
70
|
},
|
|
71
71
|
"keywords": [
|
|
72
72
|
"aurabase",
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
"client"
|
|
77
77
|
],
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@aurabase/
|
|
80
|
-
"@aurabase/
|
|
81
|
-
"@aurabase/
|
|
82
|
-
"@aurabase/storage": "0.6.
|
|
83
|
-
"@aurabase/
|
|
84
|
-
"@aurabase/
|
|
85
|
-
"@aurabase/
|
|
86
|
-
"@aurabase/
|
|
79
|
+
"@aurabase/core": "0.6.2",
|
|
80
|
+
"@aurabase/auth": "0.6.2",
|
|
81
|
+
"@aurabase/db": "0.6.2",
|
|
82
|
+
"@aurabase/storage": "0.6.2",
|
|
83
|
+
"@aurabase/realtime": "0.6.2",
|
|
84
|
+
"@aurabase/functions": "0.6.2",
|
|
85
|
+
"@aurabase/ai": "0.6.2",
|
|
86
|
+
"@aurabase/notifications": "0.6.2"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/node": "20.14.15",
|