@forgecart/sdk 1.2.5 → 1.2.6
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 +2 -87
- package/dist/admin-types.generated.d.ts +9884 -0
- package/dist/admin.d.ts +55 -8
- package/dist/admin.generated.d.ts +790 -0
- package/dist/admin.generated.js +1801 -0
- package/dist/admin.js +112 -23
- package/dist/client.generated.d.ts +251 -0
- package/dist/client.generated.js +757 -0
- package/dist/documents.generated.d.ts +465 -0
- package/dist/documents.generated.js +24283 -0
- package/dist/error-utils.d.ts +25 -0
- package/dist/error-utils.js +59 -0
- package/dist/hook-event-map.generated.d.ts +243 -0
- package/dist/hook-event-map.generated.js +9 -0
- package/dist/index.d.ts +23 -59
- package/dist/index.js +35 -83
- package/dist/sdk-hook-subscription.generated.d.ts +29 -0
- package/dist/sdk-hook-subscription.generated.js +73 -0
- package/dist/sdk-plugin.generated.d.ts +38 -0
- package/dist/sdk-plugin.generated.js +31 -0
- package/dist/sdk-types.generated.d.ts +56 -0
- package/dist/sdk-types.generated.js +28 -0
- package/dist/shop-types.generated.d.ts +4776 -0
- package/dist/shop.d.ts +18 -8
- package/dist/shop.generated.d.ts +213 -0
- package/dist/shop.generated.js +465 -0
- package/dist/shop.js +37 -23
- package/dist/upload.d.ts +14 -0
- package/dist/upload.js +163 -0
- package/package.json +10 -25
- package/src/admin-types.generated.ts +28377 -0
- package/src/admin.generated.ts +1771 -0
- package/src/admin.ts +55 -9
- package/src/client.generated.ts +845 -0
- package/src/documents.generated.ts +24730 -0
- package/src/error-utils.ts +74 -0
- package/src/hook-event-map.generated.ts +252 -0
- package/src/index.ts +23 -115
- package/src/sdk-hook-subscription.generated.ts +93 -0
- package/src/sdk-plugin.generated.ts +59 -0
- package/src/sdk-types.generated.ts +79 -0
- package/src/shop-types.generated.ts +10400 -0
- package/src/shop.generated.ts +452 -0
- package/src/shop.ts +18 -9
- package/src/upload.ts +211 -0
- package/LICENSE +0 -21
- package/dist/admin-namespace.d.ts +0 -2688
- package/dist/admin-namespace.js +0 -9691
- package/dist/admin-types.d.ts +0 -16195
- package/dist/shop-namespace.d.ts +0 -718
- package/dist/shop-namespace.js +0 -3124
- package/dist/shop-types.d.ts +0 -6310
- package/src/admin-namespace.ts +0 -11428
- package/src/admin-types.ts +0 -10809
- package/src/shop-namespace.ts +0 -3547
- package/src/shop-types.ts +0 -4684
- /package/dist/{admin-types.js → admin-types.generated.js} +0 -0
- /package/dist/{shop-types.js → shop-types.generated.js} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE — DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file was generated by @forgecart/client-sdk-generators.
|
|
5
|
+
* Any manual changes will be overwritten on the next generation run.
|
|
6
|
+
*/
|
|
7
|
+
import type { Type, ApiExtension, HookHandler } from './sdk-types.generated';
|
|
8
|
+
export interface ConfigurationItem {
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
readonly type: 'string' | 'number' | 'boolean' | 'json';
|
|
13
|
+
readonly defaultValue?: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface ManageableConfig {
|
|
16
|
+
readonly description: string;
|
|
17
|
+
readonly imageUrl?: string;
|
|
18
|
+
readonly tags: string[];
|
|
19
|
+
readonly configurationItems: ConfigurationItem[];
|
|
20
|
+
}
|
|
21
|
+
export interface IHookRegistry {
|
|
22
|
+
on(hookPoint: string, handler: HookHandler, priority?: number): void;
|
|
23
|
+
}
|
|
24
|
+
export declare abstract class ForgeCartPlugin {
|
|
25
|
+
abstract readonly code: string;
|
|
26
|
+
abstract readonly name: string;
|
|
27
|
+
abstract readonly version: string;
|
|
28
|
+
readonly entities: Type[];
|
|
29
|
+
readonly services: Type[];
|
|
30
|
+
readonly resolvers: Type[];
|
|
31
|
+
readonly controllers: Type[];
|
|
32
|
+
readonly adminApiExtensions?: ApiExtension;
|
|
33
|
+
readonly shopApiExtensions?: ApiExtension;
|
|
34
|
+
register(_hooks: IHookRegistry): void;
|
|
35
|
+
onBootstrap(): Promise<void>;
|
|
36
|
+
onShutdown(): Promise<void>;
|
|
37
|
+
readonly manageable?: ManageableConfig;
|
|
38
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* AUTO-GENERATED FILE — DO NOT EDIT
|
|
5
|
+
*
|
|
6
|
+
* This file was generated by @forgecart/client-sdk-generators.
|
|
7
|
+
* Any manual changes will be overwritten on the next generation run.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ForgeCartPlugin = void 0;
|
|
11
|
+
class ForgeCartPlugin {
|
|
12
|
+
entities = [];
|
|
13
|
+
services = [];
|
|
14
|
+
resolvers = [];
|
|
15
|
+
controllers = [];
|
|
16
|
+
adminApiExtensions;
|
|
17
|
+
shopApiExtensions;
|
|
18
|
+
register(_hooks) {
|
|
19
|
+
// no-op default
|
|
20
|
+
}
|
|
21
|
+
onBootstrap() {
|
|
22
|
+
// no-op default
|
|
23
|
+
return Promise.resolve();
|
|
24
|
+
}
|
|
25
|
+
onShutdown() {
|
|
26
|
+
// no-op default
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
}
|
|
29
|
+
manageable;
|
|
30
|
+
}
|
|
31
|
+
exports.ForgeCartPlugin = ForgeCartPlugin;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE — DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file was generated by @forgecart/client-sdk-generators.
|
|
5
|
+
* Any manual changes will be overwritten on the next generation run.
|
|
6
|
+
*/
|
|
7
|
+
export type ID = string & {
|
|
8
|
+
readonly __brand?: 'ID';
|
|
9
|
+
};
|
|
10
|
+
export type Type<T = unknown> = new (...args: any[]) => T;
|
|
11
|
+
export interface ApiExtension {
|
|
12
|
+
schema?: unknown;
|
|
13
|
+
resolvers?: Type[];
|
|
14
|
+
}
|
|
15
|
+
/** Minimal RequestContext interface for SDK consumers */
|
|
16
|
+
export interface IRequestContext {
|
|
17
|
+
readonly channelId: string;
|
|
18
|
+
readonly channelToken: string;
|
|
19
|
+
readonly apiType: 'admin' | 'shop';
|
|
20
|
+
readonly languageCode: string;
|
|
21
|
+
readonly hookDepth: number;
|
|
22
|
+
/** Cross-process correlation token set by the platform during hook dispatch */
|
|
23
|
+
readonly transactionToken?: string;
|
|
24
|
+
}
|
|
25
|
+
export type HookHandler = (...args: unknown[]) => Promise<void>;
|
|
26
|
+
export interface FulfillmentHandlerCapabilities {
|
|
27
|
+
supportsTracking: boolean;
|
|
28
|
+
requiresShippingAddress: boolean;
|
|
29
|
+
autoFulfillOnPayment: boolean;
|
|
30
|
+
autoDeliver: boolean;
|
|
31
|
+
autoCreateLabel: boolean;
|
|
32
|
+
supportsReturn: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface OrderLineInput {
|
|
35
|
+
orderLineId: ID;
|
|
36
|
+
variantId: ID;
|
|
37
|
+
quantity: number;
|
|
38
|
+
}
|
|
39
|
+
export interface IFulfillmentHandler {
|
|
40
|
+
readonly code: string;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
getCapabilities(): FulfillmentHandlerCapabilities;
|
|
43
|
+
groupLines(ctx: IRequestContext, lines: OrderLineInput[]): Promise<OrderLineInput[][]>;
|
|
44
|
+
onCreated(ctx: IRequestContext, fulfillment: unknown): Promise<unknown>;
|
|
45
|
+
onStateTransition(ctx: IRequestContext, fulfillment: unknown, fromState: string, toState: string): Promise<unknown>;
|
|
46
|
+
}
|
|
47
|
+
export declare enum SdkErrorCode {
|
|
48
|
+
SERVICE_NOT_FOUND = "SERVICE_NOT_FOUND",
|
|
49
|
+
METHOD_NOT_FOUND = "METHOD_NOT_FOUND",
|
|
50
|
+
WEBSOCKET_TIMEOUT = "WEBSOCKET_TIMEOUT"
|
|
51
|
+
}
|
|
52
|
+
export declare class SdkError extends Error {
|
|
53
|
+
readonly code: SdkErrorCode;
|
|
54
|
+
readonly variables: Record<string, string>;
|
|
55
|
+
constructor(code: SdkErrorCode, variables?: Record<string, string>);
|
|
56
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* AUTO-GENERATED FILE — DO NOT EDIT
|
|
5
|
+
*
|
|
6
|
+
* This file was generated by @forgecart/client-sdk-generators.
|
|
7
|
+
* Any manual changes will be overwritten on the next generation run.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SdkError = exports.SdkErrorCode = void 0;
|
|
11
|
+
var SdkErrorCode;
|
|
12
|
+
(function (SdkErrorCode) {
|
|
13
|
+
SdkErrorCode["SERVICE_NOT_FOUND"] = "SERVICE_NOT_FOUND";
|
|
14
|
+
SdkErrorCode["METHOD_NOT_FOUND"] = "METHOD_NOT_FOUND";
|
|
15
|
+
SdkErrorCode["WEBSOCKET_TIMEOUT"] = "WEBSOCKET_TIMEOUT";
|
|
16
|
+
})(SdkErrorCode || (exports.SdkErrorCode = SdkErrorCode = {}));
|
|
17
|
+
class SdkError extends Error {
|
|
18
|
+
code;
|
|
19
|
+
variables;
|
|
20
|
+
constructor(code, variables = {}) {
|
|
21
|
+
super(code);
|
|
22
|
+
this.code = code;
|
|
23
|
+
this.variables = variables;
|
|
24
|
+
this.name = 'SdkError';
|
|
25
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.SdkError = SdkError;
|