@elizaos/plugin-shopify 2.0.3-beta.5 → 2.0.3-beta.7
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/dist/index.d.ts +219 -0
- package/dist/index.js +1966 -0
- package/dist/index.js.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Service, IAgentRuntime, ConnectorAccountProvider, Plugin } from '@elizaos/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for connecting to a Shopify store via the Admin GraphQL API.
|
|
5
|
+
*/
|
|
6
|
+
interface ShopifyPluginConfig {
|
|
7
|
+
/** Shopify store domain, e.g. "mystore.myshopify.com" */
|
|
8
|
+
storeDomain?: string;
|
|
9
|
+
/** Shopify Admin API access token */
|
|
10
|
+
accessToken?: string;
|
|
11
|
+
/** Optional default account id for multi-account config */
|
|
12
|
+
accountId?: string;
|
|
13
|
+
/** Optional per-store account records keyed by account id */
|
|
14
|
+
accounts?: Record<string, {
|
|
15
|
+
storeDomain?: string;
|
|
16
|
+
accessToken?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
interface ShopInfo {
|
|
21
|
+
name: string;
|
|
22
|
+
email: string;
|
|
23
|
+
myshopifyDomain: string;
|
|
24
|
+
plan: {
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
currencyCode: string;
|
|
28
|
+
primaryDomain: {
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface MoneyV2 {
|
|
33
|
+
amount: string;
|
|
34
|
+
currencyCode: string;
|
|
35
|
+
}
|
|
36
|
+
interface ShopifyImage {
|
|
37
|
+
url: string;
|
|
38
|
+
altText: string | null;
|
|
39
|
+
}
|
|
40
|
+
interface ProductVariant {
|
|
41
|
+
id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
price: string;
|
|
44
|
+
sku: string | null;
|
|
45
|
+
inventoryQuantity: number | null;
|
|
46
|
+
}
|
|
47
|
+
interface ProductVariantEdge {
|
|
48
|
+
node: ProductVariant;
|
|
49
|
+
}
|
|
50
|
+
interface Product {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
handle: string;
|
|
54
|
+
status: string;
|
|
55
|
+
descriptionHtml: string;
|
|
56
|
+
productType: string;
|
|
57
|
+
vendor: string;
|
|
58
|
+
totalInventory: number | null;
|
|
59
|
+
featuredImage: ShopifyImage | null;
|
|
60
|
+
variants: {
|
|
61
|
+
edges: ProductVariantEdge[];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
interface OrderLineItem {
|
|
65
|
+
title: string;
|
|
66
|
+
quantity: number;
|
|
67
|
+
originalUnitPriceSet: {
|
|
68
|
+
shopMoney: MoneyV2;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface OrderLineItemEdge {
|
|
72
|
+
node: OrderLineItem;
|
|
73
|
+
}
|
|
74
|
+
interface Order {
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
displayFinancialStatus: string | null;
|
|
79
|
+
displayFulfillmentStatus: string;
|
|
80
|
+
totalPriceSet: {
|
|
81
|
+
shopMoney: MoneyV2;
|
|
82
|
+
};
|
|
83
|
+
customer: {
|
|
84
|
+
id: string;
|
|
85
|
+
displayName: string;
|
|
86
|
+
} | null;
|
|
87
|
+
lineItems: {
|
|
88
|
+
edges: OrderLineItemEdge[];
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
interface Customer {
|
|
92
|
+
id: string;
|
|
93
|
+
displayName: string;
|
|
94
|
+
email: string | null;
|
|
95
|
+
phone: string | null;
|
|
96
|
+
ordersCount: string;
|
|
97
|
+
totalSpentV2: MoneyV2;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
}
|
|
100
|
+
interface InventoryLevel {
|
|
101
|
+
id: string;
|
|
102
|
+
available: number | null;
|
|
103
|
+
location: {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface Location {
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
isActive: boolean;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare class ShopifyService extends Service {
|
|
115
|
+
static serviceType: "shopify";
|
|
116
|
+
capabilityDescription: string;
|
|
117
|
+
private clients;
|
|
118
|
+
private defaultAccountId;
|
|
119
|
+
stop(): Promise<void>;
|
|
120
|
+
static start(runtime: IAgentRuntime): Promise<ShopifyService>;
|
|
121
|
+
isConnected(accountId?: string): boolean;
|
|
122
|
+
private getClientState;
|
|
123
|
+
private requireClient;
|
|
124
|
+
getShop(accountId?: string): Promise<ShopInfo>;
|
|
125
|
+
listProducts(opts?: {
|
|
126
|
+
first?: number;
|
|
127
|
+
after?: string | null;
|
|
128
|
+
query?: string | null;
|
|
129
|
+
}, accountId?: string): Promise<{
|
|
130
|
+
products: Product[];
|
|
131
|
+
hasNextPage: boolean;
|
|
132
|
+
endCursor: string | null;
|
|
133
|
+
}>;
|
|
134
|
+
createProduct(input: {
|
|
135
|
+
title: string;
|
|
136
|
+
descriptionHtml?: string;
|
|
137
|
+
productType?: string;
|
|
138
|
+
vendor?: string;
|
|
139
|
+
status?: string;
|
|
140
|
+
}, accountId?: string): Promise<Product>;
|
|
141
|
+
updateProduct(id: string, input: {
|
|
142
|
+
title?: string;
|
|
143
|
+
descriptionHtml?: string;
|
|
144
|
+
productType?: string;
|
|
145
|
+
vendor?: string;
|
|
146
|
+
status?: string;
|
|
147
|
+
}, accountId?: string): Promise<Product>;
|
|
148
|
+
listOrders(opts?: {
|
|
149
|
+
first?: number;
|
|
150
|
+
after?: string | null;
|
|
151
|
+
query?: string | null;
|
|
152
|
+
}, accountId?: string): Promise<{
|
|
153
|
+
orders: Order[];
|
|
154
|
+
hasNextPage: boolean;
|
|
155
|
+
endCursor: string | null;
|
|
156
|
+
}>;
|
|
157
|
+
getOrder(id: string, accountId?: string): Promise<Order | null>;
|
|
158
|
+
fulfillOrder(orderId: string, accountId?: string): Promise<{
|
|
159
|
+
id: string;
|
|
160
|
+
status: string;
|
|
161
|
+
}>;
|
|
162
|
+
listCustomers(opts?: {
|
|
163
|
+
first?: number;
|
|
164
|
+
after?: string | null;
|
|
165
|
+
query?: string | null;
|
|
166
|
+
}, accountId?: string): Promise<{
|
|
167
|
+
customers: Customer[];
|
|
168
|
+
hasNextPage: boolean;
|
|
169
|
+
endCursor: string | null;
|
|
170
|
+
}>;
|
|
171
|
+
checkInventory(inventoryItemId: string, accountId?: string): Promise<InventoryLevel[]>;
|
|
172
|
+
adjustInventory(opts: {
|
|
173
|
+
inventoryItemId: string;
|
|
174
|
+
locationId: string;
|
|
175
|
+
delta: number;
|
|
176
|
+
reason?: string;
|
|
177
|
+
}, accountId?: string): Promise<void>;
|
|
178
|
+
listLocations(accountId?: string): Promise<Location[]>;
|
|
179
|
+
getProductCount(accountId?: string): Promise<number>;
|
|
180
|
+
getOrderCount(accountId?: string): Promise<number>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare const DEFAULT_SHOPIFY_ACCOUNT_ID = "default";
|
|
184
|
+
declare const DEFAULT_SHOPIFY_ACCOUNT_ROLE = "OWNER";
|
|
185
|
+
interface ShopifyAccountConfig {
|
|
186
|
+
accountId: string;
|
|
187
|
+
role: typeof DEFAULT_SHOPIFY_ACCOUNT_ROLE;
|
|
188
|
+
storeDomain: string;
|
|
189
|
+
accessToken: string;
|
|
190
|
+
label?: string;
|
|
191
|
+
}
|
|
192
|
+
declare function normalizeShopifyAccountId(value: unknown): string;
|
|
193
|
+
declare function resolveShopifyAccountId(runtime: IAgentRuntime, options?: Record<string, unknown>): string;
|
|
194
|
+
declare function readShopifyAccounts(runtime: IAgentRuntime): ShopifyAccountConfig[];
|
|
195
|
+
declare function resolveShopifyAccount(accounts: readonly ShopifyAccountConfig[], accountId: string): ShopifyAccountConfig | null;
|
|
196
|
+
declare function resolveShopifyDefaultAccount(accounts: readonly ShopifyAccountConfig[], accountId?: string): ShopifyAccountConfig | null;
|
|
197
|
+
declare function hasShopifyAccountConfig(runtime: IAgentRuntime, options?: Record<string, unknown>): boolean;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Shopify ConnectorAccountManager provider.
|
|
201
|
+
*
|
|
202
|
+
* Bridges plugin-shopify to the @elizaos/core ConnectorAccountManager so the
|
|
203
|
+
* generic HTTP CRUD + OAuth surface can list, create, patch, delete, and run
|
|
204
|
+
* the OAuth flow for Shopify stores.
|
|
205
|
+
*
|
|
206
|
+
* Account model:
|
|
207
|
+
* - role "OWNER" — store admin (Shopify Admin API access token)
|
|
208
|
+
* - accountKey — store domain (e.g. mystore.myshopify.com)
|
|
209
|
+
* - purpose — ["admin"]
|
|
210
|
+
*/
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Build the Shopify ConnectorAccountManager provider.
|
|
214
|
+
*/
|
|
215
|
+
declare function createShopifyConnectorAccountProvider(runtime: IAgentRuntime): ConnectorAccountProvider;
|
|
216
|
+
|
|
217
|
+
declare const shopifyPlugin: Plugin;
|
|
218
|
+
|
|
219
|
+
export { DEFAULT_SHOPIFY_ACCOUNT_ID, DEFAULT_SHOPIFY_ACCOUNT_ROLE, type ShopifyAccountConfig, type ShopifyPluginConfig, ShopifyService, createShopifyConnectorAccountProvider, shopifyPlugin as default, hasShopifyAccountConfig, normalizeShopifyAccountId, readShopifyAccounts, resolveShopifyAccount, resolveShopifyAccountId, resolveShopifyDefaultAccount };
|