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