@oomol-lab/open-connector 1.6.3 → 1.6.5
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/assets/open-connector/catalog/apps/aisa.json +568 -0
- package/assets/open-connector/catalog/apps/bilibili.json +2586 -0
- package/assets/open-connector/catalog/apps/bitwarden.json +1423 -0
- package/assets/open-connector/catalog/apps/cronfree.json +303 -0
- package/assets/open-connector/catalog/apps/cufinder.json +368 -0
- package/assets/open-connector/catalog/apps/feishu_app_bot.json +2 -2
- package/assets/open-connector/catalog/apps/gmail.json +73 -0
- package/assets/open-connector/catalog/apps/investoday_mcp.json +22228 -197
- package/assets/open-connector/catalog/apps/ixspy.json +2274 -0
- package/assets/open-connector/catalog/apps/jin10.json +1 -1
- package/assets/open-connector/catalog/apps/osv.json +663 -0
- package/assets/open-connector/catalog/apps/pdf_vector.json +329 -0
- package/assets/open-connector/catalog/apps/pulsetic.json +406 -0
- package/assets/open-connector/catalog/apps/shopee.json +1785 -0
- package/assets/open-connector/catalog/apps/slack.json +81 -0
- package/assets/open-connector/catalog/apps/slackbot.json +81 -0
- package/assets/open-connector/catalog/apps/speak_ai.json +360 -0
- package/assets/open-connector/catalog/apps/tongdaxin.json +11 -440
- package/assets/open-connector/catalog/apps/zyhub.json +1585 -0
- package/assets/open-connector/catalog/apps-index.json +1 -1
- package/package.json +1 -1
- package/src/core/json-schema.d.ts +5 -1
- package/src/core/json-schema.js +14 -2
- package/src/core/types.d.ts +9 -0
- package/src/oauth/oauth-credential-refresh-service.js +3 -1
- package/src/oauth/oauth-flow-service.js +17 -2
- package/src/oauth/oauth-token.d.ts +13 -0
- package/src/providers/action-contracts.generated.d.ts +16 -4
- package/src/providers/aisa/executors.d.ts +4 -0
- package/src/providers/aisa/executors.js +176 -0
- package/src/providers/bilibili/articles.d.ts +3 -0
- package/src/providers/bilibili/articles.js +369 -0
- package/src/providers/bilibili/executors.d.ts +8 -0
- package/src/providers/bilibili/executors.js +262 -0
- package/src/providers/bilibili/runtime.d.ts +95 -0
- package/src/providers/bilibili/runtime.js +238 -0
- package/src/providers/bilibili/upload.d.ts +14 -0
- package/src/providers/bilibili/upload.js +105 -0
- package/src/providers/bitwarden/executors.d.ts +3 -0
- package/src/providers/bitwarden/executors.js +146 -0
- package/src/providers/cronfree/executors.d.ts +4 -0
- package/src/providers/cronfree/executors.js +89 -0
- package/src/providers/cufinder/executors.d.ts +4 -0
- package/src/providers/cufinder/executors.js +105 -0
- package/src/providers/dropbox/executors.js +21 -3
- package/src/providers/elevenreader/runtime.js +6 -5
- package/src/providers/feishu_app_bot/scopes.js +1 -1
- package/src/providers/gmail/attachment-stream.d.ts +2 -0
- package/src/providers/gmail/attachment-stream.js +162 -0
- package/src/providers/gmail/executors.d.ts +3 -1
- package/src/providers/gmail/executors.js +53 -25
- package/src/providers/investoday_mcp/official-actions.js +19 -372
- package/src/providers/investoday_mcp/official-tool-types.d.ts +10 -0
- package/src/providers/investoday_mcp/official-tool-types.js +4 -0
- package/src/providers/investoday_mcp/official-tools/charts.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/charts.js +32 -0
- package/src/providers/investoday_mcp/official-tools/fixed-income.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/fixed-income.js +326 -0
- package/src/providers/investoday_mcp/official-tools/funds.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/funds.js +1085 -0
- package/src/providers/investoday_mcp/official-tools/hong-kong.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/hong-kong.js +275 -0
- package/src/providers/investoday_mcp/official-tools/indices-industries.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/indices-industries.js +642 -0
- package/src/providers/investoday_mcp/official-tools/macro-calendar.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/macro-calendar.js +398 -0
- package/src/providers/investoday_mcp/official-tools/other.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/other.js +131 -0
- package/src/providers/investoday_mcp/official-tools/research-news.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/research-news.js +302 -0
- package/src/providers/investoday_mcp/official-tools/stocks.d.ts +2 -0
- package/src/providers/investoday_mcp/official-tools/stocks.js +2829 -0
- package/src/providers/ixspy/executors.d.ts +3 -0
- package/src/providers/ixspy/executors.js +220 -0
- package/src/providers/mcp-client.d.ts +1 -0
- package/src/providers/mcp-client.js +41 -27
- package/src/providers/osv/executors.d.ts +2 -0
- package/src/providers/osv/executors.js +11 -0
- package/src/providers/osv/runtime.d.ts +9 -0
- package/src/providers/osv/runtime.js +66 -0
- package/src/providers/pdf_vector/executors.d.ts +4 -0
- package/src/providers/pdf_vector/executors.js +108 -0
- package/src/providers/provider-runtime.d.ts +3 -0
- package/src/providers/provider-runtime.js +4 -1
- package/src/providers/pulsetic/executors.d.ts +4 -0
- package/src/providers/pulsetic/executors.js +126 -0
- package/src/providers/registry.generated.js +12 -0
- package/src/providers/sellersprite_mcp/executors.js +2 -1
- package/src/providers/shopee/actions.d.ts +2 -0
- package/src/providers/shopee/actions.js +474 -0
- package/src/providers/shopee/executors.d.ts +3 -0
- package/src/providers/shopee/executors.js +85 -0
- package/src/providers/shopee/runtime.d.ts +79 -0
- package/src/providers/shopee/runtime.js +693 -0
- package/src/providers/slack/actions.js +17 -0
- package/src/providers/slack/runtime.js +62 -4
- package/src/providers/speak_ai/executors.d.ts +3 -0
- package/src/providers/speak_ai/executors.js +187 -0
- package/src/providers/tongdaxin/executors.js +5 -4
- package/src/providers/tongdaxin/named-action-output.js +3 -9
- package/src/providers/tongdaxin/named-action-routing.js +1 -1
- package/src/providers/tongdaxin/named-actions.js +1 -6
- package/src/providers/tushare/runtime.js +22 -9
- package/src/providers/twenty_crm/runtime.js +4 -2
- package/src/providers/zyhub/executors.d.ts +3 -0
- package/src/providers/zyhub/executors.js +240 -0
- package/src/server/files/transit-files.d.ts +3 -2
- package/src/server/files/transit-files.js +31 -35
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { s } from "../../core/json-schema.js";
|
|
2
|
+
import { defineProviderAction } from "../../core/provider-definition.js";
|
|
3
|
+
const service = "shopee";
|
|
4
|
+
const entityIdSchema = (description) => s.integer(description, { minimum: 1 });
|
|
5
|
+
const timestampSchema = (description) => s.integer(description, { minimum: 0 });
|
|
6
|
+
const rawDataSchema = s.looseObject("The response data returned by Shopee Open Platform.");
|
|
7
|
+
const responseSchema = s.object("A normalized Shopee Open Platform response.", {
|
|
8
|
+
requestId: s.string("The Shopee request ID used for upstream error tracking."),
|
|
9
|
+
data: rawDataSchema,
|
|
10
|
+
}, { optional: ["requestId"] });
|
|
11
|
+
const merchantInputSchema = s.object("A Shopee merchant selected from the authorized CNSC account.", {
|
|
12
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
13
|
+
}, { optional: ["merchantId"] });
|
|
14
|
+
const shopInputSchema = s.object("A Shopee shop selected from the authorized account.", {
|
|
15
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
16
|
+
}, { optional: ["shopId"] });
|
|
17
|
+
const languageSchema = s.stringEnum("The language used for category and attribute names.", ["en", "zh-hans"]);
|
|
18
|
+
const attributeValueSchema = s.object("A value assigned to a Shopee global product attribute.", {
|
|
19
|
+
valueId: s.integer("The predefined Shopee attribute value ID, or 0 for a custom value."),
|
|
20
|
+
originalValueName: s.string("The predefined or custom attribute value name."),
|
|
21
|
+
valueUnit: s.string("The unit for a quantitative attribute value."),
|
|
22
|
+
}, { optional: ["valueId", "originalValueName", "valueUnit"] });
|
|
23
|
+
const attributeSchema = s.object("A Shopee global product attribute and its selected values.", {
|
|
24
|
+
attributeId: entityIdSchema("The Shopee attribute ID."),
|
|
25
|
+
values: s.array("The values selected for this attribute.", attributeValueSchema, {
|
|
26
|
+
minItems: 1,
|
|
27
|
+
}),
|
|
28
|
+
}, { optional: ["values"] });
|
|
29
|
+
const sellerStockSchema = s.object("Stock held at a Shopee seller stock location.", {
|
|
30
|
+
locationId: s.string("The Shopee seller stock location ID."),
|
|
31
|
+
stock: s.integer("The available stock at this location.", { minimum: 0 }),
|
|
32
|
+
});
|
|
33
|
+
const itemStatusSchema = s.stringEnum("A Shopee listing status.", [
|
|
34
|
+
"NORMAL",
|
|
35
|
+
"BANNED",
|
|
36
|
+
"UNLIST",
|
|
37
|
+
"REVIEWING",
|
|
38
|
+
"SELLER_DELETE",
|
|
39
|
+
"SHOPEE_DELETE",
|
|
40
|
+
]);
|
|
41
|
+
const priceUpdateSchema = s.object("A new price for an item or variation model.", {
|
|
42
|
+
modelId: entityIdSchema("The Shopee model ID. Omit it for an item without variations."),
|
|
43
|
+
originalPrice: s.number("The new original price in the shop currency.", {
|
|
44
|
+
exclusiveMinimum: 0,
|
|
45
|
+
}),
|
|
46
|
+
}, { optional: ["modelId"] });
|
|
47
|
+
const stockLocationUpdateSchema = s.object("Stock assigned to one seller warehouse location.", {
|
|
48
|
+
locationId: s.string("The warehouse location ID returned by Shopee."),
|
|
49
|
+
stock: s.integer("The new available stock at this location.", { minimum: 0 }),
|
|
50
|
+
}, { optional: ["locationId"] });
|
|
51
|
+
const stockUpdateSchema = s.object("New stock for an item or variation model.", {
|
|
52
|
+
modelId: entityIdSchema("The Shopee model ID. Omit it for an item without variations."),
|
|
53
|
+
sellerStock: s.array("The new seller stock values, optionally split by warehouse location.", stockLocationUpdateSchema, { minItems: 1 }),
|
|
54
|
+
}, { optional: ["modelId"] });
|
|
55
|
+
const packageInputProperties = {
|
|
56
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
57
|
+
orderSerialNumber: s.string("The Shopee order serial number."),
|
|
58
|
+
packageNumber: s.string("The package number for an order split into packages."),
|
|
59
|
+
};
|
|
60
|
+
export const shopeeActions = [
|
|
61
|
+
defineProviderAction(service, {
|
|
62
|
+
name: "get_merchant_info",
|
|
63
|
+
operationType: "read",
|
|
64
|
+
description: "Get the identity, region, currency, and authorization status of a Shopee merchant.",
|
|
65
|
+
requiredScopes: ["shopee.read"],
|
|
66
|
+
inputSchema: merchantInputSchema,
|
|
67
|
+
outputSchema: responseSchema,
|
|
68
|
+
}),
|
|
69
|
+
defineProviderAction(service, {
|
|
70
|
+
name: "list_global_categories",
|
|
71
|
+
operationType: "read",
|
|
72
|
+
description: "List the Shopee global product category tree for a cross-border merchant.",
|
|
73
|
+
requiredScopes: ["shopee.read"],
|
|
74
|
+
inputSchema: s.object("The merchant and display language for the global category tree.", {
|
|
75
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
76
|
+
language: languageSchema,
|
|
77
|
+
}, { optional: ["merchantId", "language"] }),
|
|
78
|
+
outputSchema: responseSchema,
|
|
79
|
+
}),
|
|
80
|
+
defineProviderAction(service, {
|
|
81
|
+
name: "get_global_attribute_tree",
|
|
82
|
+
operationType: "read",
|
|
83
|
+
description: "Get Shopee global product attributes for up to 20 category IDs.",
|
|
84
|
+
requiredScopes: ["shopee.read"],
|
|
85
|
+
inputSchema: s.object("The merchant, categories, and display language for global product attributes.", {
|
|
86
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
87
|
+
categoryIds: s.array("The global category IDs whose attribute definitions should be returned.", entityIdSchema("A Shopee global category ID."), { minItems: 1, maxItems: 20, uniqueItems: true }),
|
|
88
|
+
language: languageSchema,
|
|
89
|
+
}, { optional: ["merchantId", "language"] }),
|
|
90
|
+
outputSchema: responseSchema,
|
|
91
|
+
}),
|
|
92
|
+
defineProviderAction(service, {
|
|
93
|
+
name: "list_global_brands",
|
|
94
|
+
operationType: "read",
|
|
95
|
+
description: "List Shopee brands available for a global product category.",
|
|
96
|
+
requiredScopes: ["shopee.read"],
|
|
97
|
+
inputSchema: s.object("The category and pagination parameters for Shopee global brands.", {
|
|
98
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
99
|
+
categoryId: entityIdSchema("The Shopee global category ID."),
|
|
100
|
+
offset: s.integer("The zero-based result offset.", { minimum: 0 }),
|
|
101
|
+
pageSize: s.integer("The number of brands to return, from 1 to 100.", {
|
|
102
|
+
minimum: 1,
|
|
103
|
+
maximum: 100,
|
|
104
|
+
}),
|
|
105
|
+
status: s.integer("The brand status: 1 for normal or 2 for pending.", {
|
|
106
|
+
minimum: 1,
|
|
107
|
+
maximum: 2,
|
|
108
|
+
}),
|
|
109
|
+
}, { optional: ["merchantId", "offset", "pageSize", "status"] }),
|
|
110
|
+
outputSchema: responseSchema,
|
|
111
|
+
}),
|
|
112
|
+
defineProviderAction(service, {
|
|
113
|
+
name: "upload_product_image",
|
|
114
|
+
operationType: "write",
|
|
115
|
+
description: "Download a public image URL and upload it to Shopee Media Space for products.",
|
|
116
|
+
requiredScopes: ["shopee.write"],
|
|
117
|
+
inputSchema: s.object("A public image URL and Shopee image processing options.", {
|
|
118
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
119
|
+
imageUrl: s.string("A public HTTPS URL for a JPG, JPEG, or PNG image up to 10 MB.", {
|
|
120
|
+
format: "uri",
|
|
121
|
+
}),
|
|
122
|
+
scene: s.stringEnum("How Shopee processes the image.", ["normal", "desc"]),
|
|
123
|
+
ratio: s.stringEnum("The requested image ratio for eligible sellers.", ["1:1", "3:4"]),
|
|
124
|
+
}, { optional: ["shopId", "scene", "ratio"] }),
|
|
125
|
+
outputSchema: responseSchema,
|
|
126
|
+
}),
|
|
127
|
+
defineProviderAction(service, {
|
|
128
|
+
name: "create_global_item",
|
|
129
|
+
operationType: "write",
|
|
130
|
+
description: "Create a Shopee global product draft for a mainland China CNSC merchant.",
|
|
131
|
+
requiredScopes: ["shopee.write"],
|
|
132
|
+
inputSchema: s.object("The product information used to create a Shopee global product draft.", {
|
|
133
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
134
|
+
categoryId: entityIdSchema("The Shopee global category ID."),
|
|
135
|
+
name: s.string("The global product name."),
|
|
136
|
+
description: s.string("The global product description."),
|
|
137
|
+
sku: s.string("The seller-defined global product SKU."),
|
|
138
|
+
imageIds: s.stringArray("Shopee Media Space image IDs for the product.", {
|
|
139
|
+
minItems: 1,
|
|
140
|
+
maxItems: 9,
|
|
141
|
+
uniqueItems: true,
|
|
142
|
+
itemDescription: "A Shopee Media Space image ID.",
|
|
143
|
+
}),
|
|
144
|
+
originalPrice: s.number("The original global product price in the merchant base currency.", {
|
|
145
|
+
exclusiveMinimum: 0,
|
|
146
|
+
}),
|
|
147
|
+
stock: s.integer("The available normal stock for the product.", { minimum: 0 }),
|
|
148
|
+
weight: s.number("The package weight in kilograms.", { exclusiveMinimum: 0 }),
|
|
149
|
+
packageLength: s.number("The package length in centimeters.", { exclusiveMinimum: 0 }),
|
|
150
|
+
packageWidth: s.number("The package width in centimeters.", { exclusiveMinimum: 0 }),
|
|
151
|
+
packageHeight: s.number("The package height in centimeters.", { exclusiveMinimum: 0 }),
|
|
152
|
+
daysToShip: s.integer("The number of days needed to ship the product.", { minimum: 1 }),
|
|
153
|
+
condition: s.stringEnum("The product condition.", ["NEW", "USED"]),
|
|
154
|
+
brandId: entityIdSchema("The Shopee brand ID."),
|
|
155
|
+
brandName: s.string("The original brand name."),
|
|
156
|
+
attributes: s.array("The product attributes required by its category.", attributeSchema),
|
|
157
|
+
sellerStock: s.array("Stock allocated to Shopee seller stock locations.", sellerStockSchema),
|
|
158
|
+
}, {
|
|
159
|
+
optional: [
|
|
160
|
+
"merchantId",
|
|
161
|
+
"sku",
|
|
162
|
+
"imageIds",
|
|
163
|
+
"stock",
|
|
164
|
+
"packageLength",
|
|
165
|
+
"packageWidth",
|
|
166
|
+
"packageHeight",
|
|
167
|
+
"brandId",
|
|
168
|
+
"brandName",
|
|
169
|
+
"attributes",
|
|
170
|
+
"sellerStock",
|
|
171
|
+
],
|
|
172
|
+
}),
|
|
173
|
+
outputSchema: responseSchema,
|
|
174
|
+
}),
|
|
175
|
+
defineProviderAction(service, {
|
|
176
|
+
name: "list_merchant_shops",
|
|
177
|
+
operationType: "read",
|
|
178
|
+
description: "List shops authorized and bound to a Shopee merchant.",
|
|
179
|
+
requiredScopes: ["shopee.read"],
|
|
180
|
+
inputSchema: s.object("Pagination parameters for shops bound to a Shopee merchant.", {
|
|
181
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
182
|
+
page: s.integer("The one-based page number to retrieve.", { minimum: 1 }),
|
|
183
|
+
pageSize: s.integer("The number of shops to return, from 1 to 500.", {
|
|
184
|
+
minimum: 1,
|
|
185
|
+
maximum: 500,
|
|
186
|
+
}),
|
|
187
|
+
}, { optional: ["merchantId", "page", "pageSize"] }),
|
|
188
|
+
outputSchema: responseSchema,
|
|
189
|
+
}),
|
|
190
|
+
defineProviderAction(service, {
|
|
191
|
+
name: "get_shop_info",
|
|
192
|
+
operationType: "read",
|
|
193
|
+
description: "Get the profile, region, authorization, and cross-border status of a Shopee shop.",
|
|
194
|
+
requiredScopes: ["shopee.read"],
|
|
195
|
+
inputSchema: shopInputSchema,
|
|
196
|
+
outputSchema: responseSchema,
|
|
197
|
+
}),
|
|
198
|
+
defineProviderAction(service, {
|
|
199
|
+
name: "list_global_items",
|
|
200
|
+
operationType: "read",
|
|
201
|
+
description: "List global products owned by a Shopee cross-border merchant.",
|
|
202
|
+
requiredScopes: ["shopee.read"],
|
|
203
|
+
inputSchema: s.object("Cursor and update-time filters for Shopee global products.", {
|
|
204
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
205
|
+
cursor: s.string("The cursor returned by the previous page."),
|
|
206
|
+
pageSize: s.integer("The number of global products to return, from 1 to 50.", {
|
|
207
|
+
minimum: 1,
|
|
208
|
+
maximum: 50,
|
|
209
|
+
}),
|
|
210
|
+
updatedFrom: timestampSchema("The earliest item update time as a Unix timestamp in seconds."),
|
|
211
|
+
updatedTo: timestampSchema("The latest item update time as a Unix timestamp in seconds."),
|
|
212
|
+
}, { optional: ["merchantId", "cursor", "pageSize", "updatedFrom", "updatedTo"] }),
|
|
213
|
+
outputSchema: responseSchema,
|
|
214
|
+
}),
|
|
215
|
+
defineProviderAction(service, {
|
|
216
|
+
name: "get_global_items",
|
|
217
|
+
operationType: "read",
|
|
218
|
+
description: "Get details for up to 20 Shopee global products.",
|
|
219
|
+
requiredScopes: ["shopee.read"],
|
|
220
|
+
inputSchema: s.object("Shopee global product identifiers.", {
|
|
221
|
+
merchantId: entityIdSchema("The Shopee merchant ID. Omit it when the connection has exactly one merchant."),
|
|
222
|
+
globalItemIds: s.array("The global product IDs to retrieve.", entityIdSchema("A Shopee global product ID."), {
|
|
223
|
+
minItems: 1,
|
|
224
|
+
maxItems: 20,
|
|
225
|
+
uniqueItems: true,
|
|
226
|
+
}),
|
|
227
|
+
}, { optional: ["merchantId"] }),
|
|
228
|
+
outputSchema: responseSchema,
|
|
229
|
+
}),
|
|
230
|
+
defineProviderAction(service, {
|
|
231
|
+
name: "list_shop_items",
|
|
232
|
+
operationType: "read",
|
|
233
|
+
description: "List Shopee shop items by listing status and update time.",
|
|
234
|
+
requiredScopes: ["shopee.read"],
|
|
235
|
+
inputSchema: s.object("Filters and offset pagination for Shopee shop items.", {
|
|
236
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
237
|
+
offset: s.integer("The zero-based result offset.", { minimum: 0 }),
|
|
238
|
+
pageSize: s.integer("The number of items to return, from 1 to 100.", {
|
|
239
|
+
minimum: 1,
|
|
240
|
+
maximum: 100,
|
|
241
|
+
}),
|
|
242
|
+
statuses: s.array("The listing statuses to include.", itemStatusSchema, {
|
|
243
|
+
minItems: 1,
|
|
244
|
+
uniqueItems: true,
|
|
245
|
+
}),
|
|
246
|
+
updatedFrom: timestampSchema("The earliest item update time as a Unix timestamp."),
|
|
247
|
+
updatedTo: timestampSchema("The latest item update time as a Unix timestamp."),
|
|
248
|
+
}, { optional: ["shopId", "offset", "pageSize", "updatedFrom", "updatedTo"] }),
|
|
249
|
+
outputSchema: responseSchema,
|
|
250
|
+
}),
|
|
251
|
+
defineProviderAction(service, {
|
|
252
|
+
name: "get_shop_items",
|
|
253
|
+
operationType: "read",
|
|
254
|
+
description: "Get base information for up to 50 Shopee shop items.",
|
|
255
|
+
requiredScopes: ["shopee.read"],
|
|
256
|
+
inputSchema: s.object("Shopee shop item identifiers and optional detail sections.", {
|
|
257
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
258
|
+
itemIds: s.array("The Shopee item IDs to retrieve.", entityIdSchema("A Shopee item ID."), {
|
|
259
|
+
minItems: 1,
|
|
260
|
+
maxItems: 50,
|
|
261
|
+
uniqueItems: true,
|
|
262
|
+
}),
|
|
263
|
+
includeTaxInfo: s.boolean("Whether to include item tax information."),
|
|
264
|
+
includeComplaintPolicy: s.boolean("Whether to include item complaint policies."),
|
|
265
|
+
}, { optional: ["shopId", "includeTaxInfo", "includeComplaintPolicy"] }),
|
|
266
|
+
outputSchema: responseSchema,
|
|
267
|
+
}),
|
|
268
|
+
defineProviderAction(service, {
|
|
269
|
+
name: "get_item_models",
|
|
270
|
+
operationType: "read",
|
|
271
|
+
description: "Get variation tiers, model prices, and model stock for a Shopee shop item.",
|
|
272
|
+
requiredScopes: ["shopee.read"],
|
|
273
|
+
inputSchema: s.object("A Shopee shop item whose variation models should be returned.", {
|
|
274
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
275
|
+
itemId: entityIdSchema("The Shopee item ID."),
|
|
276
|
+
}, { optional: ["shopId"] }),
|
|
277
|
+
outputSchema: responseSchema,
|
|
278
|
+
}),
|
|
279
|
+
defineProviderAction(service, {
|
|
280
|
+
name: "update_item_prices",
|
|
281
|
+
operationType: "destructive",
|
|
282
|
+
description: "Replace prices for up to 50 models of one Shopee shop item.",
|
|
283
|
+
requiredScopes: ["shopee.write"],
|
|
284
|
+
inputSchema: s.object("A Shopee shop item and its replacement prices.", {
|
|
285
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
286
|
+
itemId: entityIdSchema("The Shopee item ID."),
|
|
287
|
+
prices: s.array("The replacement prices for the item or its models.", priceUpdateSchema, {
|
|
288
|
+
minItems: 1,
|
|
289
|
+
maxItems: 50,
|
|
290
|
+
}),
|
|
291
|
+
}, { optional: ["shopId"] }),
|
|
292
|
+
outputSchema: responseSchema,
|
|
293
|
+
}),
|
|
294
|
+
defineProviderAction(service, {
|
|
295
|
+
name: "update_item_stocks",
|
|
296
|
+
operationType: "destructive",
|
|
297
|
+
description: "Replace seller stock for up to 50 models of one Shopee shop item.",
|
|
298
|
+
requiredScopes: ["shopee.write"],
|
|
299
|
+
inputSchema: s.object("A Shopee shop item and its replacement seller stock.", {
|
|
300
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
301
|
+
itemId: entityIdSchema("The Shopee item ID."),
|
|
302
|
+
stocks: s.array("The replacement stock for the item or its models.", stockUpdateSchema, {
|
|
303
|
+
minItems: 1,
|
|
304
|
+
maxItems: 50,
|
|
305
|
+
}),
|
|
306
|
+
}, { optional: ["shopId"] }),
|
|
307
|
+
outputSchema: responseSchema,
|
|
308
|
+
}),
|
|
309
|
+
defineProviderAction(service, {
|
|
310
|
+
name: "list_orders",
|
|
311
|
+
operationType: "read",
|
|
312
|
+
description: "List Shopee shop orders created or updated in a time range of at most 15 days.",
|
|
313
|
+
requiredScopes: ["shopee.read"],
|
|
314
|
+
inputSchema: s.object("Filters and cursor pagination for Shopee shop orders.", {
|
|
315
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
316
|
+
timeRangeField: s.stringEnum("The order timestamp field used for the range.", ["create_time", "update_time"]),
|
|
317
|
+
timeFrom: timestampSchema("The inclusive range start as a Unix timestamp in seconds."),
|
|
318
|
+
timeTo: timestampSchema("The inclusive range end as a Unix timestamp in seconds."),
|
|
319
|
+
pageSize: s.integer("The number of orders to return, from 1 to 100.", {
|
|
320
|
+
minimum: 1,
|
|
321
|
+
maximum: 100,
|
|
322
|
+
}),
|
|
323
|
+
cursor: s.string("The cursor returned by the previous page."),
|
|
324
|
+
orderStatus: s.stringEnum("The Shopee order status to include.", [
|
|
325
|
+
"UNPAID",
|
|
326
|
+
"READY_TO_SHIP",
|
|
327
|
+
"PROCESSED",
|
|
328
|
+
"SHIPPED",
|
|
329
|
+
"COMPLETED",
|
|
330
|
+
"IN_CANCEL",
|
|
331
|
+
"CANCELLED",
|
|
332
|
+
"INVOICE_PENDING",
|
|
333
|
+
]),
|
|
334
|
+
}, { optional: ["shopId", "timeRangeField", "pageSize", "cursor", "orderStatus"] }),
|
|
335
|
+
outputSchema: responseSchema,
|
|
336
|
+
}),
|
|
337
|
+
defineProviderAction(service, {
|
|
338
|
+
name: "get_orders",
|
|
339
|
+
operationType: "read",
|
|
340
|
+
description: "Get detailed information for up to 50 Shopee orders from one shop.",
|
|
341
|
+
requiredScopes: ["shopee.read"],
|
|
342
|
+
inputSchema: s.object("Shopee order identifiers and optional response fields.", {
|
|
343
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
344
|
+
orderSerialNumbers: s.stringArray("The Shopee order serial numbers to retrieve.", {
|
|
345
|
+
minItems: 1,
|
|
346
|
+
maxItems: 50,
|
|
347
|
+
uniqueItems: true,
|
|
348
|
+
itemDescription: "A Shopee order serial number.",
|
|
349
|
+
}),
|
|
350
|
+
optionalFields: s.stringArray("Additional documented order fields to include in the response.", {
|
|
351
|
+
minItems: 1,
|
|
352
|
+
uniqueItems: true,
|
|
353
|
+
itemDescription: "A field name from the Shopee get order detail API.",
|
|
354
|
+
}),
|
|
355
|
+
}, { optional: ["shopId", "optionalFields"] }),
|
|
356
|
+
outputSchema: responseSchema,
|
|
357
|
+
}),
|
|
358
|
+
defineProviderAction(service, {
|
|
359
|
+
name: "get_shipping_parameters",
|
|
360
|
+
operationType: "read",
|
|
361
|
+
description: "Get the pickup, drop-off, or non-integrated shipping options for an order package.",
|
|
362
|
+
requiredScopes: ["shopee.read"],
|
|
363
|
+
inputSchema: s.object("A Shopee order package ready for shipment.", packageInputProperties, {
|
|
364
|
+
optional: ["shopId", "packageNumber"],
|
|
365
|
+
}),
|
|
366
|
+
outputSchema: responseSchema,
|
|
367
|
+
}),
|
|
368
|
+
defineProviderAction(service, {
|
|
369
|
+
name: "ship_order",
|
|
370
|
+
operationType: "write",
|
|
371
|
+
description: "Arrange pickup, drop-off, or non-integrated shipment for a Shopee order package.",
|
|
372
|
+
requiredScopes: ["shopee.write"],
|
|
373
|
+
inputSchema: s.object("A Shopee order package and one shipping method returned by get_shipping_parameters.", {
|
|
374
|
+
...packageInputProperties,
|
|
375
|
+
pickup: s.object("Pickup options returned by Shopee.", {
|
|
376
|
+
addressId: entityIdSchema("The pickup address ID."),
|
|
377
|
+
pickupTimeId: s.string("The pickup time-slot ID."),
|
|
378
|
+
trackingNumber: s.string("A carrier-assigned tracking number when required."),
|
|
379
|
+
}, { optional: ["pickupTimeId", "trackingNumber"] }),
|
|
380
|
+
dropoff: s.object("Drop-off options returned by Shopee.", {
|
|
381
|
+
branchId: entityIdSchema("The carrier branch ID."),
|
|
382
|
+
senderRealName: s.string("The sender's legal name when required."),
|
|
383
|
+
trackingNumber: s.string("A carrier-assigned tracking number when required."),
|
|
384
|
+
slug: s.string("The selected third-party logistics provider slug."),
|
|
385
|
+
}, { optional: ["branchId", "senderRealName", "trackingNumber", "slug"] }),
|
|
386
|
+
nonIntegrated: s.object("Options for a non-integrated logistics channel.", { trackingNumber: s.string("The carrier-assigned tracking number.") }, { optional: ["trackingNumber"] }),
|
|
387
|
+
}, { optional: ["shopId", "packageNumber", "pickup", "dropoff", "nonIntegrated"] }),
|
|
388
|
+
outputSchema: responseSchema,
|
|
389
|
+
}),
|
|
390
|
+
defineProviderAction(service, {
|
|
391
|
+
name: "get_tracking_number",
|
|
392
|
+
operationType: "read",
|
|
393
|
+
description: "Get carrier tracking numbers for a shipped Shopee order package.",
|
|
394
|
+
requiredScopes: ["shopee.read"],
|
|
395
|
+
inputSchema: s.object("A shipped Shopee order package and optional tracking fields.", {
|
|
396
|
+
...packageInputProperties,
|
|
397
|
+
optionalFields: s.array("Additional tracking number fields to return.", s.stringEnum("A supported tracking number field.", [
|
|
398
|
+
"plp_number",
|
|
399
|
+
"first_mile_tracking_number",
|
|
400
|
+
"last_mile_tracking_number",
|
|
401
|
+
]), { uniqueItems: true }),
|
|
402
|
+
}, { optional: ["shopId", "packageNumber", "optionalFields"] }),
|
|
403
|
+
outputSchema: responseSchema,
|
|
404
|
+
}),
|
|
405
|
+
defineProviderAction(service, {
|
|
406
|
+
name: "get_tracking_info",
|
|
407
|
+
operationType: "read",
|
|
408
|
+
description: "Get logistics tracking events for a Shopee order package.",
|
|
409
|
+
requiredScopes: ["shopee.read"],
|
|
410
|
+
inputSchema: s.object("A shipped Shopee order package.", packageInputProperties, {
|
|
411
|
+
optional: ["shopId", "packageNumber"],
|
|
412
|
+
}),
|
|
413
|
+
outputSchema: responseSchema,
|
|
414
|
+
}),
|
|
415
|
+
defineProviderAction(service, {
|
|
416
|
+
name: "list_returns",
|
|
417
|
+
operationType: "read",
|
|
418
|
+
description: "List Shopee returns by creation time, update time, and workflow status.",
|
|
419
|
+
requiredScopes: ["shopee.read"],
|
|
420
|
+
inputSchema: s.object("Filters and page pagination for Shopee returns.", {
|
|
421
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
422
|
+
page: s.integer("The one-based page number.", { minimum: 1 }),
|
|
423
|
+
pageSize: s.integer("The number of returns to include, from 1 to 100.", {
|
|
424
|
+
minimum: 1,
|
|
425
|
+
maximum: 100,
|
|
426
|
+
}),
|
|
427
|
+
createdFrom: timestampSchema("The earliest return creation time as a Unix timestamp."),
|
|
428
|
+
createdTo: timestampSchema("The latest return creation time as a Unix timestamp."),
|
|
429
|
+
updatedFrom: timestampSchema("The earliest return update time as a Unix timestamp."),
|
|
430
|
+
updatedTo: timestampSchema("The latest return update time as a Unix timestamp."),
|
|
431
|
+
status: s.string("A Shopee ReturnStatus value."),
|
|
432
|
+
negotiationStatus: s.string("A Shopee NegotiationStatus value."),
|
|
433
|
+
sellerProofStatus: s.string("A Shopee SellerProofStatus value."),
|
|
434
|
+
sellerCompensationStatus: s.string("A Shopee SellerCompensationStatus value."),
|
|
435
|
+
}, {
|
|
436
|
+
optional: [
|
|
437
|
+
"shopId",
|
|
438
|
+
"page",
|
|
439
|
+
"pageSize",
|
|
440
|
+
"createdFrom",
|
|
441
|
+
"createdTo",
|
|
442
|
+
"updatedFrom",
|
|
443
|
+
"updatedTo",
|
|
444
|
+
"status",
|
|
445
|
+
"negotiationStatus",
|
|
446
|
+
"sellerProofStatus",
|
|
447
|
+
"sellerCompensationStatus",
|
|
448
|
+
],
|
|
449
|
+
}),
|
|
450
|
+
outputSchema: responseSchema,
|
|
451
|
+
}),
|
|
452
|
+
defineProviderAction(service, {
|
|
453
|
+
name: "get_return",
|
|
454
|
+
operationType: "read",
|
|
455
|
+
description: "Get the details and current workflow state of a Shopee return.",
|
|
456
|
+
requiredScopes: ["shopee.read"],
|
|
457
|
+
inputSchema: s.object("A Shopee return selected from one shop.", {
|
|
458
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
459
|
+
returnSerialNumber: s.string("The Shopee return serial number."),
|
|
460
|
+
}, { optional: ["shopId"] }),
|
|
461
|
+
outputSchema: responseSchema,
|
|
462
|
+
}),
|
|
463
|
+
defineProviderAction(service, {
|
|
464
|
+
name: "get_order_escrow",
|
|
465
|
+
operationType: "read",
|
|
466
|
+
description: "Get Shopee accounting and fee details for one order.",
|
|
467
|
+
requiredScopes: ["shopee.read"],
|
|
468
|
+
inputSchema: s.object("A Shopee order whose escrow accounting should be returned.", {
|
|
469
|
+
shopId: entityIdSchema("The Shopee shop ID. Omit it when the connection has exactly one shop."),
|
|
470
|
+
orderSerialNumber: s.string("The Shopee order serial number."),
|
|
471
|
+
}, { optional: ["shopId"] }),
|
|
472
|
+
outputSchema: responseSchema,
|
|
473
|
+
}),
|
|
474
|
+
];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { looseArray, optionalInteger, optionalRecord, optionalString } from "../../core/cast.js";
|
|
2
|
+
import { defineProviderExecutors, providerResponseError, requireOAuthCredential } from "../provider-runtime.js";
|
|
3
|
+
import { shopeeActions } from "./actions.js";
|
|
4
|
+
import { executeShopeeAction, fetchShopeeEntityInfo } from "./runtime.js";
|
|
5
|
+
const service = "shopee";
|
|
6
|
+
const handlers = Object.fromEntries(shopeeActions.map((action) => [
|
|
7
|
+
action.name,
|
|
8
|
+
(input, context) => executeShopeeAction(action.name, input, context),
|
|
9
|
+
]));
|
|
10
|
+
export const executors = defineProviderExecutors({
|
|
11
|
+
service,
|
|
12
|
+
handlers,
|
|
13
|
+
async createContext(context, fetcher) {
|
|
14
|
+
const credential = await requireOAuthCredential(context, service);
|
|
15
|
+
return {
|
|
16
|
+
clientConfig: readClientConfig(credential.providerSecret),
|
|
17
|
+
providerSecret: credential.providerSecret,
|
|
18
|
+
fetcher,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export const credentialValidators = {
|
|
23
|
+
async oauth2(input, { fetcher }) {
|
|
24
|
+
const clientConfig = readClientConfig(input.providerSecret);
|
|
25
|
+
const merchantId = firstPositiveInteger(input.metadata.merchantIds);
|
|
26
|
+
const shopId = firstPositiveInteger(input.metadata.shopIds);
|
|
27
|
+
if (merchantId != null) {
|
|
28
|
+
const merchant = await fetchShopeeEntityInfo({
|
|
29
|
+
entityType: "merchant",
|
|
30
|
+
entityId: merchantId,
|
|
31
|
+
accessToken: input.accessToken,
|
|
32
|
+
clientConfig,
|
|
33
|
+
fetcher,
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
profile: {
|
|
37
|
+
accountId: `merchant:${merchantId}`,
|
|
38
|
+
displayName: optionalString(merchant.merchant_name) ?? `Shopee merchant ${merchantId}`,
|
|
39
|
+
grantedScopes: ["all"],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (shopId != null) {
|
|
44
|
+
const shop = await fetchShopeeEntityInfo({
|
|
45
|
+
entityType: "shop",
|
|
46
|
+
entityId: shopId,
|
|
47
|
+
accessToken: input.accessToken,
|
|
48
|
+
clientConfig,
|
|
49
|
+
fetcher,
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
profile: {
|
|
53
|
+
accountId: `shop:${shopId}`,
|
|
54
|
+
displayName: optionalString(shop.shop_name) ?? `Shopee shop ${shopId}`,
|
|
55
|
+
grantedScopes: ["all"],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
throw providerResponseError("Shopee connection has no authorized merchant or shop.");
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
function readClientConfig(providerSecret) {
|
|
63
|
+
const value = optionalRecord(providerSecret?.signingConfig);
|
|
64
|
+
const clientId = optionalString(value?.clientId);
|
|
65
|
+
const clientSecret = optionalString(value?.clientSecret);
|
|
66
|
+
const apiBaseUrl = optionalString(value?.apiBaseUrl);
|
|
67
|
+
if (!clientId || !clientSecret || !apiBaseUrl) {
|
|
68
|
+
throw providerResponseError("Shopee connection is missing its signing configuration.");
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
service,
|
|
72
|
+
clientId,
|
|
73
|
+
clientSecret,
|
|
74
|
+
extra: { apiBaseUrl },
|
|
75
|
+
secretExtra: {},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function firstPositiveInteger(value) {
|
|
79
|
+
for (const item of looseArray(value)) {
|
|
80
|
+
const integer = optionalInteger(item);
|
|
81
|
+
if (integer != null && integer > 0)
|
|
82
|
+
return integer;
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { OAuthClientConfig } from "../../oauth/oauth-client-config-service.ts";
|
|
2
|
+
interface ShopeeEntityToken {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
refreshToken: string;
|
|
5
|
+
expiresAt: string;
|
|
6
|
+
}
|
|
7
|
+
interface ShopeeTokenInventory {
|
|
8
|
+
shops: Record<string, ShopeeEntityToken>;
|
|
9
|
+
merchants: Record<string, ShopeeEntityToken>;
|
|
10
|
+
}
|
|
11
|
+
interface ShopeeActionContext {
|
|
12
|
+
clientConfig: OAuthClientConfig;
|
|
13
|
+
providerSecret?: Record<string, unknown>;
|
|
14
|
+
fetcher: typeof fetch;
|
|
15
|
+
}
|
|
16
|
+
interface ShopeeNormalizedResponse {
|
|
17
|
+
requestId?: string;
|
|
18
|
+
data: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface ShopeeTokenPayload {
|
|
21
|
+
access_token?: unknown;
|
|
22
|
+
refresh_token?: unknown;
|
|
23
|
+
expire_in?: unknown;
|
|
24
|
+
shop_id?: unknown;
|
|
25
|
+
merchant_id?: unknown;
|
|
26
|
+
shop_id_list?: unknown;
|
|
27
|
+
merchant_id_list?: unknown;
|
|
28
|
+
request_id?: unknown;
|
|
29
|
+
error?: unknown;
|
|
30
|
+
message?: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface ShopeeParsedToken {
|
|
33
|
+
accessToken: string;
|
|
34
|
+
refreshToken: string;
|
|
35
|
+
expiresAt: string;
|
|
36
|
+
shopIds: number[];
|
|
37
|
+
merchantIds: number[];
|
|
38
|
+
requestId?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ShopeeRefreshInventoryResult {
|
|
41
|
+
inventory: ShopeeTokenInventory;
|
|
42
|
+
representative: ShopeeEntityToken;
|
|
43
|
+
}
|
|
44
|
+
export declare function resolveShopeeApiBaseUrl(clientConfig: OAuthClientConfig): string;
|
|
45
|
+
export declare function parseShopeePartnerId(clientConfig: OAuthClientConfig): number;
|
|
46
|
+
export declare function createShopeeSignature(input: {
|
|
47
|
+
partnerId: number;
|
|
48
|
+
partnerKey: string;
|
|
49
|
+
path: string;
|
|
50
|
+
timestamp: number;
|
|
51
|
+
accessToken?: string;
|
|
52
|
+
entityId?: number;
|
|
53
|
+
}): string;
|
|
54
|
+
export declare function parseShopeeToken(payload: ShopeeTokenPayload, now?: Date): ShopeeParsedToken;
|
|
55
|
+
export declare function createInitialShopeeTokenInventory(token: ShopeeParsedToken): ShopeeTokenInventory;
|
|
56
|
+
export declare function readShopeeTokenInventory(providerSecret: Record<string, unknown> | undefined): ShopeeTokenInventory;
|
|
57
|
+
export declare function refreshShopeeTokenInventory(input: {
|
|
58
|
+
clientConfig: OAuthClientConfig;
|
|
59
|
+
providerSecret?: Record<string, unknown>;
|
|
60
|
+
fallbackRefreshToken: string;
|
|
61
|
+
fetcher: typeof fetch;
|
|
62
|
+
now?: Date;
|
|
63
|
+
}): Promise<ShopeeRefreshInventoryResult>;
|
|
64
|
+
export declare function requestShopeeToken(input: {
|
|
65
|
+
clientConfig: OAuthClientConfig;
|
|
66
|
+
body: Record<string, unknown>;
|
|
67
|
+
path: "/api/v2/auth/token/get" | "/api/v2/auth/access_token/get";
|
|
68
|
+
fetcher: typeof fetch;
|
|
69
|
+
now?: Date;
|
|
70
|
+
}): Promise<ShopeeParsedToken>;
|
|
71
|
+
export declare function executeShopeeAction(actionName: string, input: Record<string, unknown>, context: ShopeeActionContext): Promise<ShopeeNormalizedResponse>;
|
|
72
|
+
export declare function fetchShopeeEntityInfo(input: {
|
|
73
|
+
entityType: "shop" | "merchant";
|
|
74
|
+
entityId: number;
|
|
75
|
+
accessToken: string;
|
|
76
|
+
clientConfig: OAuthClientConfig;
|
|
77
|
+
fetcher: typeof fetch;
|
|
78
|
+
}): Promise<Record<string, unknown>>;
|
|
79
|
+
export {};
|