@forgecart/sdk 1.0.0 → 1.2.1
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/LICENSE +21 -0
- package/dist/admin-namespace.d.ts +168 -1
- package/dist/admin-namespace.js +442 -9
- package/dist/admin-types.d.ts +433 -4
- package/dist/admin-types.js +2 -1
- package/dist/admin.js +20 -2
- package/dist/index.d.ts +9 -11
- package/dist/index.js +33 -15
- package/dist/shop-namespace.d.ts +3 -1
- package/dist/shop-namespace.js +49 -8
- package/dist/shop-types.d.ts +43 -4
- package/dist/shop-types.js +2 -1
- package/dist/shop.js +20 -2
- package/package.json +10 -5
- package/src/admin-namespace.ts +582 -4
- package/src/admin-types.ts +460 -4
- package/src/index.ts +31 -17
- package/src/shop-namespace.ts +50 -3
- package/src/shop-types.ts +48 -4
package/dist/admin-types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/admin.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @forgecart/sdk - Admin API
|
|
3
4
|
*
|
|
4
5
|
* Admin namespace and types
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.AdminNamespace = void 0;
|
|
23
|
+
var admin_namespace_js_1 = require("./admin-namespace.js");
|
|
24
|
+
Object.defineProperty(exports, "AdminNamespace", { enumerable: true, get: function () { return admin_namespace_js_1.AdminNamespace; } });
|
|
25
|
+
__exportStar(require("./admin-types.js"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -12,14 +12,12 @@ import { ShopNamespace, ShopSDKConfig } from './shop.js';
|
|
|
12
12
|
* Unified SDK Configuration
|
|
13
13
|
*/
|
|
14
14
|
export interface ForgeCartSDKConfig {
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/** WebSocket endpoint for shop subscriptions */
|
|
22
|
-
shopWsEndpoint?: string;
|
|
15
|
+
/** Base API endpoint (e.g., 'https://api.forgecart.com') */
|
|
16
|
+
endpoint?: string;
|
|
17
|
+
/** Channel token for Vendure multi-tenancy (required) */
|
|
18
|
+
token: string;
|
|
19
|
+
/** Use HTTP only, skip WebSocket initialization (default: false) */
|
|
20
|
+
httpOnly?: boolean;
|
|
23
21
|
/** Custom HTTP headers */
|
|
24
22
|
headers?: Record<string, string>;
|
|
25
23
|
/** Custom WebSocket implementation (optional, auto-detected if not provided) */
|
|
@@ -34,8 +32,8 @@ export { AdminNamespace, ShopNamespace };
|
|
|
34
32
|
* @example
|
|
35
33
|
* ```typescript
|
|
36
34
|
* const sdk = new ForgeCartSDK({
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* endpoint: 'https://api.forgecart.com',
|
|
36
|
+
* token: 'your-channel-token',
|
|
39
37
|
* });
|
|
40
38
|
*
|
|
41
39
|
* // Admin namespace → Category → Operations
|
|
@@ -50,7 +48,7 @@ export { AdminNamespace, ShopNamespace };
|
|
|
50
48
|
export declare class ForgeCartSDK {
|
|
51
49
|
readonly admin: AdminNamespace;
|
|
52
50
|
readonly shop: ShopNamespace;
|
|
53
|
-
constructor(config
|
|
51
|
+
constructor(config: ForgeCartSDKConfig);
|
|
54
52
|
setAdminAuthToken(token: string): void;
|
|
55
53
|
clearAdminAuthToken(): void;
|
|
56
54
|
setShopAuthToken(token: string): void;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @forgecart/sdk - Auto-generated TypeScript SDK
|
|
3
4
|
*
|
|
@@ -6,9 +7,12 @@
|
|
|
6
7
|
*
|
|
7
8
|
* 🤖 Generated with ForgeCart SDK Generator
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ForgeCartSDK = exports.ShopNamespace = exports.AdminNamespace = void 0;
|
|
12
|
+
const admin_js_1 = require("./admin.js");
|
|
13
|
+
Object.defineProperty(exports, "AdminNamespace", { enumerable: true, get: function () { return admin_js_1.AdminNamespace; } });
|
|
14
|
+
const shop_js_1 = require("./shop.js");
|
|
15
|
+
Object.defineProperty(exports, "ShopNamespace", { enumerable: true, get: function () { return shop_js_1.ShopNamespace; } });
|
|
12
16
|
/**
|
|
13
17
|
* ForgeCartSDK
|
|
14
18
|
* Unified SDK with categorized operations across multiple namespaces
|
|
@@ -16,8 +20,8 @@ export { AdminNamespace, ShopNamespace };
|
|
|
16
20
|
* @example
|
|
17
21
|
* ```typescript
|
|
18
22
|
* const sdk = new ForgeCartSDK({
|
|
19
|
-
*
|
|
20
|
-
*
|
|
23
|
+
* endpoint: 'https://api.forgecart.com',
|
|
24
|
+
* token: 'your-channel-token',
|
|
21
25
|
* });
|
|
22
26
|
*
|
|
23
27
|
* // Admin namespace → Category → Operations
|
|
@@ -29,22 +33,35 @@ export { AdminNamespace, ShopNamespace };
|
|
|
29
33
|
* await sdk.shop.order.addItemToOrder({ productVariantId: '1', quantity: 1 });
|
|
30
34
|
* ```
|
|
31
35
|
*/
|
|
32
|
-
|
|
33
|
-
constructor(config
|
|
36
|
+
class ForgeCartSDK {
|
|
37
|
+
constructor(config) {
|
|
38
|
+
// Validate channel token is provided
|
|
39
|
+
if (!config.token || config.token.trim() === '') {
|
|
40
|
+
throw new Error('ForgeCartSDK: Channel token is required. Please provide a valid "token" in the configuration.');
|
|
41
|
+
}
|
|
42
|
+
const baseEndpoint = config.endpoint || 'https://api.forgecart.com';
|
|
43
|
+
const baseWsEndpoint = baseEndpoint.replace('http', 'ws');
|
|
44
|
+
// Build headers with token
|
|
45
|
+
const headers = {
|
|
46
|
+
...config.headers,
|
|
47
|
+
'forge-token': config.token,
|
|
48
|
+
};
|
|
34
49
|
const adminConfig = {
|
|
35
|
-
endpoint:
|
|
36
|
-
wsEndpoint:
|
|
37
|
-
headers
|
|
50
|
+
endpoint: `${baseEndpoint}/admin-api`,
|
|
51
|
+
wsEndpoint: `${baseWsEndpoint}/admin-api`,
|
|
52
|
+
headers,
|
|
38
53
|
webSocketImpl: config.webSocketImpl,
|
|
54
|
+
httpOnly: config.httpOnly,
|
|
39
55
|
};
|
|
40
|
-
this.admin = new AdminNamespace(adminConfig);
|
|
56
|
+
this.admin = new admin_js_1.AdminNamespace(adminConfig);
|
|
41
57
|
const shopConfig = {
|
|
42
|
-
endpoint:
|
|
43
|
-
wsEndpoint:
|
|
44
|
-
headers
|
|
58
|
+
endpoint: `${baseEndpoint}/shop-api`,
|
|
59
|
+
wsEndpoint: `${baseWsEndpoint}/shop-api`,
|
|
60
|
+
headers,
|
|
45
61
|
webSocketImpl: config.webSocketImpl,
|
|
62
|
+
httpOnly: config.httpOnly,
|
|
46
63
|
};
|
|
47
|
-
this.shop = new ShopNamespace(shopConfig);
|
|
64
|
+
this.shop = new shop_js_1.ShopNamespace(shopConfig);
|
|
48
65
|
}
|
|
49
66
|
setAdminAuthToken(token) {
|
|
50
67
|
this.admin.setAuthToken(token);
|
|
@@ -63,3 +80,4 @@ export class ForgeCartSDK {
|
|
|
63
80
|
this.shop.dispose();
|
|
64
81
|
}
|
|
65
82
|
}
|
|
83
|
+
exports.ForgeCartSDK = ForgeCartSDK;
|
package/dist/shop-namespace.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This file was automatically generated and should not be manually edited.
|
|
5
5
|
* To regenerate, run: npm run codegen:ts
|
|
6
6
|
*
|
|
7
|
-
* Generated at: 2025-12-
|
|
7
|
+
* Generated at: 2025-12-15T07:01:16.247Z
|
|
8
8
|
* Generator version: 1.0.0
|
|
9
9
|
*
|
|
10
10
|
* 🤖 Generated with ForgeCart SDK Generator
|
|
@@ -23,6 +23,8 @@ export interface SDKConfig {
|
|
|
23
23
|
headers?: Record<string, string>;
|
|
24
24
|
/** Custom WebSocket implementation (optional, auto-detected if not provided) */
|
|
25
25
|
webSocketImpl?: unknown;
|
|
26
|
+
/** Use HTTP only, skip WebSocket initialization (default: false) */
|
|
27
|
+
httpOnly?: boolean;
|
|
26
28
|
}
|
|
27
29
|
export type AssetQueryVariables = Types.AssetQueryVariables;
|
|
28
30
|
export type AssetQuery = Types.AssetQuery;
|
package/dist/shop-namespace.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @forgecart/sdk - Auto-generated TypeScript SDK
|
|
3
4
|
*
|
|
4
5
|
* This file was automatically generated and should not be manually edited.
|
|
5
6
|
* To regenerate, run: npm run codegen:ts
|
|
6
7
|
*
|
|
7
|
-
* Generated at: 2025-12-
|
|
8
|
+
* Generated at: 2025-12-15T07:01:16.247Z
|
|
8
9
|
* Generator version: 1.0.0
|
|
9
10
|
*
|
|
10
11
|
* 🤖 Generated with ForgeCart SDK Generator
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ShopNamespace = void 0;
|
|
15
|
+
const graphql_request_1 = require("graphql-request");
|
|
16
|
+
const graphql_ws_1 = require("graphql-ws");
|
|
14
17
|
const assetDocument = `query asset($id: ID!) {
|
|
15
18
|
asset(id: $id) {
|
|
16
19
|
id
|
|
@@ -2200,9 +2203,29 @@ class BaseGraphQLClient {
|
|
|
2200
2203
|
this.endpoint = config.endpoint || 'https://api.forgecart.com/shop-api';
|
|
2201
2204
|
this.wsEndpoint = config.wsEndpoint || 'wss://api.forgecart.com/shop-api';
|
|
2202
2205
|
this.config = config;
|
|
2203
|
-
//
|
|
2204
|
-
|
|
2206
|
+
// Custom fetch that captures session token from response headers
|
|
2207
|
+
const customFetch = async (url, options) => {
|
|
2208
|
+
const response = await fetch(url, options);
|
|
2209
|
+
// Capture session token from response header
|
|
2210
|
+
const authToken = response.headers.get('forge-auth-token');
|
|
2211
|
+
if (authToken && authToken !== this.authToken) {
|
|
2212
|
+
this.authToken = authToken;
|
|
2213
|
+
// Reconnect WebSocket with new token
|
|
2214
|
+
if (this.wsClient) {
|
|
2215
|
+
this.wsConnected = false;
|
|
2216
|
+
this.wsClient.dispose();
|
|
2217
|
+
this.wsClient = null;
|
|
2218
|
+
this.wsInitializing = null;
|
|
2219
|
+
this.initializeWebSocket();
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
return response;
|
|
2223
|
+
};
|
|
2224
|
+
// Initialize HTTP client with custom fetch
|
|
2225
|
+
this.httpClient = new graphql_request_1.GraphQLClient(this.endpoint, {
|
|
2205
2226
|
headers: config.headers || {},
|
|
2227
|
+
credentials: 'include',
|
|
2228
|
+
fetch: customFetch,
|
|
2206
2229
|
});
|
|
2207
2230
|
// Initialize WebSocket connection immediately
|
|
2208
2231
|
this.initializeWebSocket();
|
|
@@ -2296,6 +2319,10 @@ class BaseGraphQLClient {
|
|
|
2296
2319
|
* Connects immediately and tracks connection state
|
|
2297
2320
|
*/
|
|
2298
2321
|
initializeWebSocket() {
|
|
2322
|
+
// Skip WebSocket if httpOnly mode is enabled
|
|
2323
|
+
if (this.config.httpOnly) {
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2299
2326
|
// Prevent multiple simultaneous initializations
|
|
2300
2327
|
if (this.wsClient || this.wsInitializing) {
|
|
2301
2328
|
return;
|
|
@@ -2315,7 +2342,20 @@ class BaseGraphQLClient {
|
|
|
2315
2342
|
keepAlive: 10000, // Send keep-alive pings every 10 seconds
|
|
2316
2343
|
connectionParams: async () => {
|
|
2317
2344
|
try {
|
|
2318
|
-
|
|
2345
|
+
const params = {};
|
|
2346
|
+
// Add session token if available
|
|
2347
|
+
if (this.authToken) {
|
|
2348
|
+
params.Authorization = `bearer ${this.authToken}`;
|
|
2349
|
+
}
|
|
2350
|
+
// Pass all configured headers (including forge-token for channel)
|
|
2351
|
+
if (this.config.headers) {
|
|
2352
|
+
Object.entries(this.config.headers).forEach(([key, value]) => {
|
|
2353
|
+
if (value) {
|
|
2354
|
+
params[key] = value;
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
return params;
|
|
2319
2359
|
}
|
|
2320
2360
|
catch (error) {
|
|
2321
2361
|
console.error('Error in connectionParams:', error);
|
|
@@ -2354,7 +2394,7 @@ class BaseGraphQLClient {
|
|
|
2354
2394
|
},
|
|
2355
2395
|
},
|
|
2356
2396
|
};
|
|
2357
|
-
this.wsClient = createClient(wsOptions);
|
|
2397
|
+
this.wsClient = (0, graphql_ws_1.createClient)(wsOptions);
|
|
2358
2398
|
this.wsInitializing = null;
|
|
2359
2399
|
}
|
|
2360
2400
|
catch (error) {
|
|
@@ -2967,7 +3007,7 @@ class SearchOperations {
|
|
|
2967
3007
|
* Shop namespace
|
|
2968
3008
|
* Contains categorized operations for shop API
|
|
2969
3009
|
*/
|
|
2970
|
-
|
|
3010
|
+
class ShopNamespace {
|
|
2971
3011
|
constructor(config) {
|
|
2972
3012
|
this.client = new BaseGraphQLClient(config);
|
|
2973
3013
|
this.asset = new AssetOperations(this.client);
|
|
@@ -3004,3 +3044,4 @@ export class ShopNamespace {
|
|
|
3004
3044
|
this.client.dispose();
|
|
3005
3045
|
}
|
|
3006
3046
|
}
|
|
3047
|
+
exports.ShopNamespace = ShopNamespace;
|
package/dist/shop-types.d.ts
CHANGED
|
@@ -41,22 +41,18 @@ export type Scalars = {
|
|
|
41
41
|
input: number;
|
|
42
42
|
output: number;
|
|
43
43
|
};
|
|
44
|
-
/** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */
|
|
45
44
|
DateTime: {
|
|
46
45
|
input: any;
|
|
47
46
|
output: any;
|
|
48
47
|
};
|
|
49
|
-
/** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
|
|
50
48
|
JSON: {
|
|
51
49
|
input: any;
|
|
52
50
|
output: any;
|
|
53
51
|
};
|
|
54
|
-
/** The `Money` scalar type represents monetary values and supports signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point). */
|
|
55
52
|
Money: {
|
|
56
53
|
input: any;
|
|
57
54
|
output: any;
|
|
58
55
|
};
|
|
59
|
-
/** The `Upload` scalar type represents a file upload. */
|
|
60
56
|
Upload: {
|
|
61
57
|
input: any;
|
|
62
58
|
output: any;
|
|
@@ -72,6 +68,10 @@ export type AcfGroupMember = {
|
|
|
72
68
|
};
|
|
73
69
|
export type AcfValueUnion = BooleanValue | DateValue | FloatValue | GroupValue | IntegerValue | RelationValue | RichTextValue | StringValue;
|
|
74
70
|
export type ActiveOrderResult = NoActiveOrderError | Order;
|
|
71
|
+
export type AddItemInput = {
|
|
72
|
+
productVariantId: Scalars['ID']['input'];
|
|
73
|
+
quantity: Scalars['Int']['input'];
|
|
74
|
+
};
|
|
75
75
|
export type AddPaymentToOrderResult = IneligiblePaymentMethodError | NoActiveOrderError | Order | OrderPaymentStateError | OrderStateTransitionError | PaymentDeclinedError | PaymentFailedError;
|
|
76
76
|
export type Address = Node & {
|
|
77
77
|
__typename?: 'Address';
|
|
@@ -237,6 +237,8 @@ export type BlogPostMeta = {
|
|
|
237
237
|
};
|
|
238
238
|
export type BooleanCustomFieldConfig = CustomField & {
|
|
239
239
|
__typename?: 'BooleanCustomFieldConfig';
|
|
240
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
241
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
240
242
|
description?: Maybe<Array<LocalizedString>>;
|
|
241
243
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
242
244
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -850,6 +852,8 @@ export type CurrentUserChannel = {
|
|
|
850
852
|
token: Scalars['String']['output'];
|
|
851
853
|
};
|
|
852
854
|
export type CustomField = {
|
|
855
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
856
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
853
857
|
description?: Maybe<Array<LocalizedString>>;
|
|
854
858
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
855
859
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -963,6 +967,8 @@ export type DateRange = {
|
|
|
963
967
|
*/
|
|
964
968
|
export type DateTimeCustomFieldConfig = CustomField & {
|
|
965
969
|
__typename?: 'DateTimeCustomFieldConfig';
|
|
970
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
971
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
966
972
|
description?: Maybe<Array<LocalizedString>>;
|
|
967
973
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
968
974
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -1175,6 +1181,8 @@ export type FacetValueTranslation = {
|
|
|
1175
1181
|
};
|
|
1176
1182
|
export type FloatCustomFieldConfig = CustomField & {
|
|
1177
1183
|
__typename?: 'FloatCustomFieldConfig';
|
|
1184
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
1185
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
1178
1186
|
description?: Maybe<Array<LocalizedString>>;
|
|
1179
1187
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
1180
1188
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -1427,6 +1435,8 @@ export type InsufficientStockError = ErrorResult & {
|
|
|
1427
1435
|
};
|
|
1428
1436
|
export type IntCustomFieldConfig = CustomField & {
|
|
1429
1437
|
__typename?: 'IntCustomFieldConfig';
|
|
1438
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
1439
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
1430
1440
|
description?: Maybe<Array<LocalizedString>>;
|
|
1431
1441
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
1432
1442
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -1803,6 +1813,8 @@ export type LanguageCode =
|
|
|
1803
1813
|
| 'zu';
|
|
1804
1814
|
export type LocaleStringCustomFieldConfig = CustomField & {
|
|
1805
1815
|
__typename?: 'LocaleStringCustomFieldConfig';
|
|
1816
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
1817
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
1806
1818
|
description?: Maybe<Array<LocalizedString>>;
|
|
1807
1819
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
1808
1820
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -1818,6 +1830,8 @@ export type LocaleStringCustomFieldConfig = CustomField & {
|
|
|
1818
1830
|
};
|
|
1819
1831
|
export type LocaleTextCustomFieldConfig = CustomField & {
|
|
1820
1832
|
__typename?: 'LocaleTextCustomFieldConfig';
|
|
1833
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
1834
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
1821
1835
|
description?: Maybe<Array<LocalizedString>>;
|
|
1822
1836
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
1823
1837
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -1848,6 +1862,8 @@ export type Mutation = {
|
|
|
1848
1862
|
__typename?: 'Mutation';
|
|
1849
1863
|
/** Adds an item to the Order. If custom fields are defined on the OrderLine entity, a third argument 'customFields' will be available. */
|
|
1850
1864
|
addItemToOrder: UpdateOrderItemsResult;
|
|
1865
|
+
/** Adds mutliple items to the Order. Returns a list of errors for each item that failed to add. It will still add successful items. */
|
|
1866
|
+
addItemsToOrder: UpdateMultipleOrderItemsResult;
|
|
1851
1867
|
/** Add a Payment to the Order */
|
|
1852
1868
|
addPaymentToOrder: AddPaymentToOrderResult;
|
|
1853
1869
|
/** Adjusts an OrderLine. If custom fields are defined on the OrderLine entity, a third argument 'customFields' of type `OrderLineCustomFieldsInput` will be available. */
|
|
@@ -1956,6 +1972,9 @@ export type MutationAddItemToOrderArgs = {
|
|
|
1956
1972
|
productVariantId: Scalars['ID']['input'];
|
|
1957
1973
|
quantity: Scalars['Int']['input'];
|
|
1958
1974
|
};
|
|
1975
|
+
export type MutationAddItemsToOrderArgs = {
|
|
1976
|
+
inputs: Array<AddItemInput>;
|
|
1977
|
+
};
|
|
1959
1978
|
export type MutationAddPaymentToOrderArgs = {
|
|
1960
1979
|
input: PaymentInput;
|
|
1961
1980
|
};
|
|
@@ -3241,6 +3260,8 @@ export type RegisterCustomerInput = {
|
|
|
3241
3260
|
};
|
|
3242
3261
|
export type RelationCustomFieldConfig = CustomField & {
|
|
3243
3262
|
__typename?: 'RelationCustomFieldConfig';
|
|
3263
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
3264
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
3244
3265
|
description?: Maybe<Array<LocalizedString>>;
|
|
3245
3266
|
entity: Scalars['String']['output'];
|
|
3246
3267
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
@@ -3314,6 +3335,7 @@ export type SearchInput = {
|
|
|
3314
3335
|
collectionSlug?: InputMaybe<Scalars['String']['input']>;
|
|
3315
3336
|
facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>;
|
|
3316
3337
|
groupByProduct?: InputMaybe<Scalars['Boolean']['input']>;
|
|
3338
|
+
groupBySKU?: InputMaybe<Scalars['Boolean']['input']>;
|
|
3317
3339
|
inStock?: InputMaybe<Scalars['Boolean']['input']>;
|
|
3318
3340
|
priceRange?: InputMaybe<PriceRangeInput>;
|
|
3319
3341
|
priceRangeWithTax?: InputMaybe<PriceRangeInput>;
|
|
@@ -3455,6 +3477,8 @@ export type SinglePrice = {
|
|
|
3455
3477
|
export type SortOrder = 'ASC' | 'DESC';
|
|
3456
3478
|
export type StringCustomFieldConfig = CustomField & {
|
|
3457
3479
|
__typename?: 'StringCustomFieldConfig';
|
|
3480
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
3481
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
3458
3482
|
description?: Maybe<Array<LocalizedString>>;
|
|
3459
3483
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
3460
3484
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -3522,6 +3546,8 @@ export type StringValue = {
|
|
|
3522
3546
|
};
|
|
3523
3547
|
export type StructCustomFieldConfig = CustomField & {
|
|
3524
3548
|
__typename?: 'StructCustomFieldConfig';
|
|
3549
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
3550
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
3525
3551
|
description?: Maybe<Array<LocalizedString>>;
|
|
3526
3552
|
fields: Array<StructFieldConfig>;
|
|
3527
3553
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
@@ -3606,6 +3632,8 @@ export type TaxRateList = PaginatedList & {
|
|
|
3606
3632
|
};
|
|
3607
3633
|
export type TextCustomFieldConfig = CustomField & {
|
|
3608
3634
|
__typename?: 'TextCustomFieldConfig';
|
|
3635
|
+
deprecated?: Maybe<Scalars['Boolean']['output']>;
|
|
3636
|
+
deprecationReason?: Maybe<Scalars['String']['output']>;
|
|
3609
3637
|
description?: Maybe<Array<LocalizedString>>;
|
|
3610
3638
|
internal?: Maybe<Scalars['Boolean']['output']>;
|
|
3611
3639
|
label?: Maybe<Array<LocalizedString>>;
|
|
@@ -3671,9 +3699,20 @@ export type UpdateCustomerInput = {
|
|
|
3671
3699
|
title?: InputMaybe<Scalars['String']['input']>;
|
|
3672
3700
|
};
|
|
3673
3701
|
export type UpdateCustomerPasswordResult = InvalidCredentialsError | NativeAuthStrategyError | PasswordValidationError | Success;
|
|
3702
|
+
/**
|
|
3703
|
+
* Returned when multiple items are added to an Order.
|
|
3704
|
+
* The errorResults array contains the errors that occurred for each item, if any.
|
|
3705
|
+
*/
|
|
3706
|
+
export type UpdateMultipleOrderItemsResult = {
|
|
3707
|
+
__typename?: 'UpdateMultipleOrderItemsResult';
|
|
3708
|
+
errorResults: Array<UpdateOrderItemErrorResult>;
|
|
3709
|
+
order: Order;
|
|
3710
|
+
};
|
|
3674
3711
|
export type UpdateOrderInput = {
|
|
3675
3712
|
customFields?: InputMaybe<Scalars['JSON']['input']>;
|
|
3676
3713
|
};
|
|
3714
|
+
/** Union type of all possible errors that can occur when adding or removing items from an Order. */
|
|
3715
|
+
export type UpdateOrderItemErrorResult = InsufficientStockError | NegativeQuantityError | OrderInterceptorError | OrderLimitError | OrderModificationError;
|
|
3677
3716
|
export type UpdateOrderItemsResult = InsufficientStockError | NegativeQuantityError | Order | OrderInterceptorError | OrderLimitError | OrderModificationError;
|
|
3678
3717
|
export type User = Node & {
|
|
3679
3718
|
__typename?: 'User';
|
package/dist/shop-types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/shop.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @forgecart/sdk - Shop API
|
|
3
4
|
*
|
|
4
5
|
* Shop namespace and types
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ShopNamespace = void 0;
|
|
23
|
+
var shop_namespace_js_1 = require("./shop-namespace.js");
|
|
24
|
+
Object.defineProperty(exports, "ShopNamespace", { enumerable: true, get: function () { return shop_namespace_js_1.ShopNamespace; } });
|
|
25
|
+
__exportStar(require("./shop-types.js"), exports);
|
package/package.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgecart/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "TypeScript SDK for ForgeCart API - Auto-generated GraphQL client",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"main": "./dist/index.js",
|
|
7
6
|
"module": "./dist/index.js",
|
|
8
7
|
"types": "./dist/index.d.ts",
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
|
-
"
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
13
14
|
},
|
|
14
15
|
"./admin": {
|
|
16
|
+
"types": "./dist/admin.d.ts",
|
|
15
17
|
"import": "./dist/admin.js",
|
|
16
|
-
"
|
|
18
|
+
"require": "./dist/admin.js",
|
|
19
|
+
"default": "./dist/admin.js"
|
|
17
20
|
},
|
|
18
21
|
"./shop": {
|
|
22
|
+
"types": "./dist/shop.d.ts",
|
|
19
23
|
"import": "./dist/shop.js",
|
|
20
|
-
"
|
|
24
|
+
"require": "./dist/shop.js",
|
|
25
|
+
"default": "./dist/shop.js"
|
|
21
26
|
}
|
|
22
27
|
},
|
|
23
28
|
"files": [
|