@objectstack/client 2.0.2 → 2.0.4
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +22 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/client.test.ts +3 -5
- package/src/index.ts +24 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/client@2.0.
|
|
2
|
+
> @objectstack/client@2.0.4 build /home/runner/work/spec/spec/packages/client
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m40.50 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m79.61 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 36ms
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m39.35 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m79.55 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 44ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2837ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m23.61 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m23.61 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @objectstack/client
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Patch release for maintenance and stability improvements
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @objectstack/spec@2.0.4
|
|
10
|
+
- @objectstack/core@2.0.4
|
|
11
|
+
|
|
12
|
+
## 2.0.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Patch release for maintenance and stability improvements
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @objectstack/spec@2.0.3
|
|
19
|
+
- @objectstack/core@2.0.3
|
|
20
|
+
|
|
3
21
|
## 2.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -283,6 +283,13 @@ declare class ObjectStackClient {
|
|
|
283
283
|
ai?: string | undefined;
|
|
284
284
|
i18n?: string | undefined;
|
|
285
285
|
} | undefined;
|
|
286
|
+
services?: Record<string, {
|
|
287
|
+
enabled: boolean;
|
|
288
|
+
status: "degraded" | "available" | "unavailable" | "stub";
|
|
289
|
+
route?: string | undefined;
|
|
290
|
+
provider?: string | undefined;
|
|
291
|
+
message?: string | undefined;
|
|
292
|
+
}> | undefined;
|
|
286
293
|
}>;
|
|
287
294
|
/**
|
|
288
295
|
* Metadata Operations
|
|
@@ -406,17 +413,32 @@ declare class ObjectStackClient {
|
|
|
406
413
|
* Authentication Services
|
|
407
414
|
*/
|
|
408
415
|
auth: {
|
|
416
|
+
/**
|
|
417
|
+
* Login with email and password
|
|
418
|
+
* Uses better-auth endpoint: POST /sign-in/email
|
|
419
|
+
*/
|
|
409
420
|
login: (request: LoginRequest) => Promise<SessionResponse>;
|
|
421
|
+
/**
|
|
422
|
+
* Logout current user
|
|
423
|
+
* Uses better-auth endpoint: POST /sign-out
|
|
424
|
+
*/
|
|
410
425
|
logout: () => Promise<void>;
|
|
426
|
+
/**
|
|
427
|
+
* Get current user session
|
|
428
|
+
* Uses better-auth endpoint: GET /get-session
|
|
429
|
+
*/
|
|
411
430
|
me: () => Promise<SessionResponse>;
|
|
412
431
|
/**
|
|
413
432
|
* Register a new user account
|
|
433
|
+
* Uses better-auth endpoint: POST /sign-up/email
|
|
414
434
|
*/
|
|
415
435
|
register: (request: RegisterRequest) => Promise<SessionResponse>;
|
|
416
436
|
/**
|
|
417
437
|
* Refresh an authentication token
|
|
438
|
+
* Note: better-auth handles token refresh automatically via /get-session
|
|
439
|
+
* @param _refreshToken - Not used (better-auth handles refresh automatically)
|
|
418
440
|
*/
|
|
419
|
-
refreshToken: (
|
|
441
|
+
refreshToken: (_refreshToken: string) => Promise<SessionResponse>;
|
|
420
442
|
};
|
|
421
443
|
/**
|
|
422
444
|
* Storage Services
|
package/dist/index.d.ts
CHANGED
|
@@ -283,6 +283,13 @@ declare class ObjectStackClient {
|
|
|
283
283
|
ai?: string | undefined;
|
|
284
284
|
i18n?: string | undefined;
|
|
285
285
|
} | undefined;
|
|
286
|
+
services?: Record<string, {
|
|
287
|
+
enabled: boolean;
|
|
288
|
+
status: "degraded" | "available" | "unavailable" | "stub";
|
|
289
|
+
route?: string | undefined;
|
|
290
|
+
provider?: string | undefined;
|
|
291
|
+
message?: string | undefined;
|
|
292
|
+
}> | undefined;
|
|
286
293
|
}>;
|
|
287
294
|
/**
|
|
288
295
|
* Metadata Operations
|
|
@@ -406,17 +413,32 @@ declare class ObjectStackClient {
|
|
|
406
413
|
* Authentication Services
|
|
407
414
|
*/
|
|
408
415
|
auth: {
|
|
416
|
+
/**
|
|
417
|
+
* Login with email and password
|
|
418
|
+
* Uses better-auth endpoint: POST /sign-in/email
|
|
419
|
+
*/
|
|
409
420
|
login: (request: LoginRequest) => Promise<SessionResponse>;
|
|
421
|
+
/**
|
|
422
|
+
* Logout current user
|
|
423
|
+
* Uses better-auth endpoint: POST /sign-out
|
|
424
|
+
*/
|
|
410
425
|
logout: () => Promise<void>;
|
|
426
|
+
/**
|
|
427
|
+
* Get current user session
|
|
428
|
+
* Uses better-auth endpoint: GET /get-session
|
|
429
|
+
*/
|
|
411
430
|
me: () => Promise<SessionResponse>;
|
|
412
431
|
/**
|
|
413
432
|
* Register a new user account
|
|
433
|
+
* Uses better-auth endpoint: POST /sign-up/email
|
|
414
434
|
*/
|
|
415
435
|
register: (request: RegisterRequest) => Promise<SessionResponse>;
|
|
416
436
|
/**
|
|
417
437
|
* Refresh an authentication token
|
|
438
|
+
* Note: better-auth handles token refresh automatically via /get-session
|
|
439
|
+
* @param _refreshToken - Not used (better-auth handles refresh automatically)
|
|
418
440
|
*/
|
|
419
|
-
refreshToken: (
|
|
441
|
+
refreshToken: (_refreshToken: string) => Promise<SessionResponse>;
|
|
420
442
|
};
|
|
421
443
|
/**
|
|
422
444
|
* Storage Services
|
package/dist/index.js
CHANGED
|
@@ -518,9 +518,13 @@ var ObjectStackClient = class {
|
|
|
518
518
|
* Authentication Services
|
|
519
519
|
*/
|
|
520
520
|
this.auth = {
|
|
521
|
+
/**
|
|
522
|
+
* Login with email and password
|
|
523
|
+
* Uses better-auth endpoint: POST /sign-in/email
|
|
524
|
+
*/
|
|
521
525
|
login: async (request) => {
|
|
522
526
|
const route = this.getRoute("auth");
|
|
523
|
-
const res = await this.fetch(`${this.baseUrl}${route}/
|
|
527
|
+
const res = await this.fetch(`${this.baseUrl}${route}/sign-in/email`, {
|
|
524
528
|
method: "POST",
|
|
525
529
|
body: JSON.stringify(request)
|
|
526
530
|
});
|
|
@@ -530,22 +534,31 @@ var ObjectStackClient = class {
|
|
|
530
534
|
}
|
|
531
535
|
return data;
|
|
532
536
|
},
|
|
537
|
+
/**
|
|
538
|
+
* Logout current user
|
|
539
|
+
* Uses better-auth endpoint: POST /sign-out
|
|
540
|
+
*/
|
|
533
541
|
logout: async () => {
|
|
534
542
|
const route = this.getRoute("auth");
|
|
535
|
-
await this.fetch(`${this.baseUrl}${route}/
|
|
543
|
+
await this.fetch(`${this.baseUrl}${route}/sign-out`, { method: "POST" });
|
|
536
544
|
this.token = void 0;
|
|
537
545
|
},
|
|
546
|
+
/**
|
|
547
|
+
* Get current user session
|
|
548
|
+
* Uses better-auth endpoint: GET /get-session
|
|
549
|
+
*/
|
|
538
550
|
me: async () => {
|
|
539
551
|
const route = this.getRoute("auth");
|
|
540
|
-
const res = await this.fetch(`${this.baseUrl}${route}/
|
|
552
|
+
const res = await this.fetch(`${this.baseUrl}${route}/get-session`);
|
|
541
553
|
return res.json();
|
|
542
554
|
},
|
|
543
555
|
/**
|
|
544
556
|
* Register a new user account
|
|
557
|
+
* Uses better-auth endpoint: POST /sign-up/email
|
|
545
558
|
*/
|
|
546
559
|
register: async (request) => {
|
|
547
560
|
const route = this.getRoute("auth");
|
|
548
|
-
const res = await this.fetch(`${this.baseUrl}${route}/
|
|
561
|
+
const res = await this.fetch(`${this.baseUrl}${route}/sign-up/email`, {
|
|
549
562
|
method: "POST",
|
|
550
563
|
body: JSON.stringify(request)
|
|
551
564
|
});
|
|
@@ -557,12 +570,13 @@ var ObjectStackClient = class {
|
|
|
557
570
|
},
|
|
558
571
|
/**
|
|
559
572
|
* Refresh an authentication token
|
|
573
|
+
* Note: better-auth handles token refresh automatically via /get-session
|
|
574
|
+
* @param _refreshToken - Not used (better-auth handles refresh automatically)
|
|
560
575
|
*/
|
|
561
|
-
refreshToken: async (
|
|
576
|
+
refreshToken: async (_refreshToken) => {
|
|
562
577
|
const route = this.getRoute("auth");
|
|
563
|
-
const res = await this.fetch(`${this.baseUrl}${route}/
|
|
564
|
-
method: "
|
|
565
|
-
body: JSON.stringify({ refreshToken })
|
|
578
|
+
const res = await this.fetch(`${this.baseUrl}${route}/get-session`, {
|
|
579
|
+
method: "GET"
|
|
566
580
|
});
|
|
567
581
|
const data = await res.json();
|
|
568
582
|
if (data.data?.token) {
|