@buildspacestudio/sdk 0.2.2 → 0.4.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.
- package/README.md +126 -0
- package/dist/auth/index.cjs +259 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +3 -0
- package/dist/auth/index.d.ts +3 -5
- package/dist/auth/index.js +255 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/billing/index.cjs +226 -0
- package/dist/billing/index.cjs.map +1 -0
- package/dist/billing/index.d.cts +60 -0
- package/dist/billing/index.d.ts +60 -0
- package/dist/billing/index.js +222 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/client/index.cjs +558 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +89 -0
- package/dist/client/index.d.ts +12 -7
- package/dist/client/index.js +546 -105
- package/dist/client/index.js.map +1 -1
- package/dist/client-BYUWUiGZ.d.cts +143 -0
- package/dist/{auth/client.d.ts → client-ByNR5EZz.d.ts} +7 -5
- package/dist/client-D0vypxWb.d.cts +58 -0
- package/dist/{auth/client.js → client-D7bqvGJv.d.cts} +27 -30
- package/dist/{events/client.d.ts → client-DbGRRMt7.d.ts} +5 -3
- package/dist/client-d7kX5WfR.d.ts +143 -0
- package/dist/events/index.cjs +131 -0
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/{server.d.ts → index.d.cts} +7 -4
- package/dist/events/index.d.ts +59 -4
- package/dist/events/index.js +127 -2
- package/dist/events/index.js.map +1 -1
- package/dist/http-D2gXpNpr.d.cts +100 -0
- package/dist/http-D2gXpNpr.d.ts +100 -0
- package/dist/index.cjs +1029 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +92 -0
- package/dist/index.d.ts +21 -15
- package/dist/index.js +1010 -106
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +183 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +164 -0
- package/dist/next/index.d.ts +164 -0
- package/dist/next/index.js +172 -0
- package/dist/next/index.js.map +1 -0
- package/dist/notifications/index.cjs +56 -0
- package/dist/notifications/index.cjs.map +1 -0
- package/dist/notifications/{server.d.ts → index.d.cts} +8 -6
- package/dist/notifications/index.d.ts +79 -3
- package/dist/notifications/index.js +53 -1
- package/dist/notifications/index.js.map +1 -1
- package/dist/react/index.cjs +120 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +567 -0
- package/dist/react/index.d.ts +567 -0
- package/dist/react/index.js +92 -0
- package/dist/react/index.js.map +1 -0
- package/dist/server-CoPDzSUP.d.cts +117 -0
- package/dist/{auth/server.d.ts → server-Suq3tZZC.d.ts} +8 -6
- package/dist/storage/index.cjs +213 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +195 -0
- package/dist/storage/index.d.ts +195 -5
- package/dist/storage/index.js +209 -2
- package/dist/storage/index.js.map +1 -1
- package/package.json +124 -16
- package/dist/auth/client.d.ts.map +0 -1
- package/dist/auth/client.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/auth/server.js +0 -148
- package/dist/auth/server.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/config.d.ts +0 -40
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -27
- package/dist/config.js.map +0 -1
- package/dist/errors.d.ts +0 -31
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -30
- package/dist/errors.js.map +0 -1
- package/dist/events/client.d.ts.map +0 -1
- package/dist/events/client.js +0 -97
- package/dist/events/client.js.map +0 -1
- package/dist/events/index.d.ts.map +0 -1
- package/dist/events/server.d.ts.map +0 -1
- package/dist/events/server.js +0 -65
- package/dist/events/server.js.map +0 -1
- package/dist/http.d.ts +0 -39
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -74
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/notifications/index.d.ts.map +0 -1
- package/dist/notifications/server.d.ts.map +0 -1
- package/dist/notifications/server.js +0 -73
- package/dist/notifications/server.js.map +0 -1
- package/dist/storage/client.d.ts +0 -91
- package/dist/storage/client.d.ts.map +0 -1
- package/dist/storage/client.js +0 -117
- package/dist/storage/client.js.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/server.d.ts +0 -104
- package/dist/storage/server.d.ts.map +0 -1
- package/dist/storage/server.js +0 -104
- package/dist/storage/server.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { A as AuthClientNamespace } from '../client-D7bqvGJv.cjs';
|
|
2
|
+
import { B as BuildspaceClientConfig } from '../http-D2gXpNpr.cjs';
|
|
3
|
+
import { B as BillingClientNamespace } from '../client-BYUWUiGZ.cjs';
|
|
4
|
+
import { E as EventsClientNamespace } from '../client-D0vypxWb.cjs';
|
|
5
|
+
import { StorageClientNamespace } from '../storage/index.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Buildspace client SDK — use with a publishable key (`bs_pub_*`).
|
|
9
|
+
*
|
|
10
|
+
* Provides client-safe access to auth URL generation, event tracking
|
|
11
|
+
* (with automatic batching), and file uploads. For server-side usage
|
|
12
|
+
* with full API access, use `new Buildspace()` from `@buildspacestudio/sdk`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { createClient } from "@buildspacestudio/sdk/client";
|
|
17
|
+
*
|
|
18
|
+
* const buildspace = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_KEY!);
|
|
19
|
+
*
|
|
20
|
+
* // Generate a sign-in URL
|
|
21
|
+
* const url = buildspace.auth.getSignInUrl({
|
|
22
|
+
* redirectUri: "https://yourapp.com/auth/callback",
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Track an event (fire and forget)
|
|
26
|
+
* buildspace.events.track("button.clicked", { label: "upgrade" });
|
|
27
|
+
*
|
|
28
|
+
* // Upload a file
|
|
29
|
+
* const { key, url } = await buildspace.storage.upload(file, {
|
|
30
|
+
* path: "avatars/user-123.png",
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare class BuildspaceClient {
|
|
35
|
+
private readonly transport;
|
|
36
|
+
private readonly config;
|
|
37
|
+
private _auth;
|
|
38
|
+
private _billing;
|
|
39
|
+
private _events;
|
|
40
|
+
private _storage;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new client SDK instance.
|
|
43
|
+
*
|
|
44
|
+
* @param publishableKey - Your Buildspace publishable key (starts with `bs_pub_`).
|
|
45
|
+
* @param config - Optional configuration overrides.
|
|
46
|
+
*/
|
|
47
|
+
constructor(publishableKey: string, config?: BuildspaceClientConfig);
|
|
48
|
+
/** Client-side auth: sign-in and sign-up URL generation. */
|
|
49
|
+
get auth(): AuthClientNamespace;
|
|
50
|
+
/** Client-side event tracking with automatic batching. */
|
|
51
|
+
get events(): EventsClientNamespace;
|
|
52
|
+
/** Client-side billing: list prices and redirect to Checkout or Portal. */
|
|
53
|
+
get billing(): BillingClientNamespace;
|
|
54
|
+
/** Client-side file storage: uploads, downloads, listing, deletion. */
|
|
55
|
+
get storage(): StorageClientNamespace;
|
|
56
|
+
/**
|
|
57
|
+
* Notifications are server-only and not available on the client SDK.
|
|
58
|
+
*
|
|
59
|
+
* @throws {BuildspaceError} Always throws — use the server SDK for notifications.
|
|
60
|
+
*/
|
|
61
|
+
get notifications(): never;
|
|
62
|
+
/** Clear the stored session token. */
|
|
63
|
+
clearSession(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Set a session token that will be sent as `X-Session-Token` on all
|
|
66
|
+
* subsequent API requests.
|
|
67
|
+
*
|
|
68
|
+
* @param sessionToken - The session token to attach to requests.
|
|
69
|
+
*/
|
|
70
|
+
setSession(sessionToken: string): void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a Buildspace client SDK instance.
|
|
74
|
+
*
|
|
75
|
+
* Preferred over `new BuildspaceClient()` for a more concise API.
|
|
76
|
+
*
|
|
77
|
+
* @param publishableKey - Your Buildspace publishable key (starts with `bs_pub_`).
|
|
78
|
+
* @param config - Optional configuration overrides.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { createClient } from "@buildspacestudio/sdk/client";
|
|
83
|
+
*
|
|
84
|
+
* const buildspace = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_KEY!);
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare function createClient(publishableKey: string, config?: BuildspaceClientConfig): BuildspaceClient;
|
|
88
|
+
|
|
89
|
+
export { BuildspaceClient, createClient };
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AuthClientNamespace } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { A as AuthClientNamespace } from '../client-ByNR5EZz.js';
|
|
2
|
+
import { B as BuildspaceClientConfig } from '../http-D2gXpNpr.js';
|
|
3
|
+
import { B as BillingClientNamespace } from '../client-d7kX5WfR.js';
|
|
4
|
+
import { E as EventsClientNamespace } from '../client-DbGRRMt7.js';
|
|
5
|
+
import { StorageClientNamespace } from '../storage/index.js';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Buildspace client SDK — use with a publishable key (`bs_pub_*`).
|
|
7
9
|
*
|
|
@@ -33,6 +35,7 @@ declare class BuildspaceClient {
|
|
|
33
35
|
private readonly transport;
|
|
34
36
|
private readonly config;
|
|
35
37
|
private _auth;
|
|
38
|
+
private _billing;
|
|
36
39
|
private _events;
|
|
37
40
|
private _storage;
|
|
38
41
|
/**
|
|
@@ -46,6 +49,8 @@ declare class BuildspaceClient {
|
|
|
46
49
|
get auth(): AuthClientNamespace;
|
|
47
50
|
/** Client-side event tracking with automatic batching. */
|
|
48
51
|
get events(): EventsClientNamespace;
|
|
52
|
+
/** Client-side billing: list prices and redirect to Checkout or Portal. */
|
|
53
|
+
get billing(): BillingClientNamespace;
|
|
49
54
|
/** Client-side file storage: uploads, downloads, listing, deletion. */
|
|
50
55
|
get storage(): StorageClientNamespace;
|
|
51
56
|
/**
|
|
@@ -79,6 +84,6 @@ declare class BuildspaceClient {
|
|
|
79
84
|
* const buildspace = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_KEY!);
|
|
80
85
|
* ```
|
|
81
86
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
declare function createClient(publishableKey: string, config?: BuildspaceClientConfig): BuildspaceClient;
|
|
88
|
+
|
|
89
|
+
export { BuildspaceClient, createClient };
|