@forgecart/sdk 1.0.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @forgecart/sdk - Admin API
3
+ *
4
+ * Admin namespace and types
5
+ */
6
+ export { AdminNamespace } from './admin-namespace.js';
7
+ export type { SDKConfig as AdminSDKConfig } from './admin-namespace.js';
8
+ export * from './admin-types.js';
package/dist/admin.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @forgecart/sdk - Admin API
3
+ *
4
+ * Admin namespace and types
5
+ */
6
+ export { AdminNamespace } from './admin-namespace.js';
7
+ export * from './admin-types.js';
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @forgecart/sdk - Auto-generated TypeScript SDK
3
+ *
4
+ * This file was automatically generated and should not be manually edited.
5
+ * To regenerate, run: npm run codegen:ts
6
+ *
7
+ * 🤖 Generated with ForgeCart SDK Generator
8
+ */
9
+ import { AdminNamespace, AdminSDKConfig } from './admin.js';
10
+ import { ShopNamespace, ShopSDKConfig } from './shop.js';
11
+ /**
12
+ * Unified SDK Configuration
13
+ */
14
+ export interface ForgeCartSDKConfig {
15
+ /** GraphQL HTTP endpoint for admin API */
16
+ adminEndpoint?: string;
17
+ /** WebSocket endpoint for admin subscriptions */
18
+ adminWsEndpoint?: string;
19
+ /** GraphQL HTTP endpoint for shop API */
20
+ shopEndpoint?: string;
21
+ /** WebSocket endpoint for shop subscriptions */
22
+ shopWsEndpoint?: string;
23
+ /** Custom HTTP headers */
24
+ headers?: Record<string, string>;
25
+ /** Custom WebSocket implementation (optional, auto-detected if not provided) */
26
+ webSocketImpl?: unknown;
27
+ }
28
+ export type { AdminSDKConfig, ShopSDKConfig };
29
+ export { AdminNamespace, ShopNamespace };
30
+ /**
31
+ * ForgeCartSDK
32
+ * Unified SDK with categorized operations across multiple namespaces
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const sdk = new ForgeCartSDK({
37
+ * adminEndpoint: 'https://api.forgecart.com/admin-api',
38
+ * shopEndpoint: 'https://api.forgecart.com/shop-api'
39
+ * });
40
+ *
41
+ * // Admin namespace → Category → Operations
42
+ * await sdk.admin.products.products({ take: 10 });
43
+ * await sdk.admin.customer.customer({ id: '1' });
44
+ *
45
+ * // Shop namespace → Category → Operations
46
+ * await sdk.shop.products.products({ take: 10 });
47
+ * await sdk.shop.order.addItemToOrder({ productVariantId: '1', quantity: 1 });
48
+ * ```
49
+ */
50
+ export declare class ForgeCartSDK {
51
+ readonly admin: AdminNamespace;
52
+ readonly shop: ShopNamespace;
53
+ constructor(config?: ForgeCartSDKConfig);
54
+ setAdminAuthToken(token: string): void;
55
+ clearAdminAuthToken(): void;
56
+ setShopAuthToken(token: string): void;
57
+ clearShopAuthToken(): void;
58
+ dispose(): void;
59
+ }
package/dist/index.js ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @forgecart/sdk - Auto-generated TypeScript SDK
3
+ *
4
+ * This file was automatically generated and should not be manually edited.
5
+ * To regenerate, run: npm run codegen:ts
6
+ *
7
+ * 🤖 Generated with ForgeCart SDK Generator
8
+ */
9
+ import { AdminNamespace } from './admin.js';
10
+ import { ShopNamespace } from './shop.js';
11
+ export { AdminNamespace, ShopNamespace };
12
+ /**
13
+ * ForgeCartSDK
14
+ * Unified SDK with categorized operations across multiple namespaces
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const sdk = new ForgeCartSDK({
19
+ * adminEndpoint: 'https://api.forgecart.com/admin-api',
20
+ * shopEndpoint: 'https://api.forgecart.com/shop-api'
21
+ * });
22
+ *
23
+ * // Admin namespace → Category → Operations
24
+ * await sdk.admin.products.products({ take: 10 });
25
+ * await sdk.admin.customer.customer({ id: '1' });
26
+ *
27
+ * // Shop namespace → Category → Operations
28
+ * await sdk.shop.products.products({ take: 10 });
29
+ * await sdk.shop.order.addItemToOrder({ productVariantId: '1', quantity: 1 });
30
+ * ```
31
+ */
32
+ export class ForgeCartSDK {
33
+ constructor(config = {}) {
34
+ const adminConfig = {
35
+ endpoint: config.adminEndpoint || 'https://api.forgecart.com/admin-api',
36
+ wsEndpoint: config.adminWsEndpoint || 'wss://api.forgecart.com/admin-api',
37
+ headers: config.headers,
38
+ webSocketImpl: config.webSocketImpl,
39
+ };
40
+ this.admin = new AdminNamespace(adminConfig);
41
+ const shopConfig = {
42
+ endpoint: config.shopEndpoint || 'https://api.forgecart.com/shop-api',
43
+ wsEndpoint: config.shopWsEndpoint || 'wss://api.forgecart.com/shop-api',
44
+ headers: config.headers,
45
+ webSocketImpl: config.webSocketImpl,
46
+ };
47
+ this.shop = new ShopNamespace(shopConfig);
48
+ }
49
+ setAdminAuthToken(token) {
50
+ this.admin.setAuthToken(token);
51
+ }
52
+ clearAdminAuthToken() {
53
+ this.admin.clearAuthToken();
54
+ }
55
+ setShopAuthToken(token) {
56
+ this.shop.setAuthToken(token);
57
+ }
58
+ clearShopAuthToken() {
59
+ this.shop.clearAuthToken();
60
+ }
61
+ dispose() {
62
+ this.admin.dispose();
63
+ this.shop.dispose();
64
+ }
65
+ }