chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
@@ -0,0 +1,102 @@
import { z, IntegrationDefinitionProps } from '@botpress/sdk'
import { productSchema, customerSchema, orderSchema, pageInfoSchema } from './schemas'
export const actions = {
listProducts: {
title: 'List Products',
description: 'Search and list products from the Shopify Admin API',
input: {
schema: z.object({
query: z.string().optional().title('Search Query').describe('Search query to filter products'),
first: z
.number()
.min(1)
.max(250)
.default(50)
.optional()
.title('Limit')
.describe('Number of products to return'),
after: z.string().optional().title('After Cursor').describe('Cursor for pagination'),
}),
},
output: {
schema: z.object({
products: z.array(productSchema).title('Products').describe('List of products'),
pageInfo: pageInfoSchema.title('Page Info').describe('Pagination info'),
}),
},
},
getProduct: {
title: 'Get Product',
description: 'Get a single product with its variants from the Shopify Admin API',
input: {
schema: z.object({
productId: z
.string()
.title('Product ID')
.describe('The Shopify GID of the product (e.g. gid://shopify/Product/12345)'),
}),
},
output: {
schema: z.object({
product: productSchema.title('Product').describe('The product details'),
}),
},
},
searchCustomers: {
title: 'Search Customers',
description: 'Search for customers by email, name, or phone in the Shopify Admin API',
input: {
schema: z.object({
query: z.string().title('Search Query').describe('Search query (email, name, or phone)'),
}),
},
output: {
schema: z.object({
customers: z.array(customerSchema).title('Customers').describe('List of matching customers'),
}),
},
},
getOrder: {
title: 'Get Order',
description: 'Get full order details by ID from the Shopify Admin API',
input: {
schema: z.object({
orderId: z.string().title('Order ID').describe('The Shopify GID of the order (e.g. gid://shopify/Order/12345)'),
}),
},
output: {
schema: z.object({
order: orderSchema.title('Order').describe('The order details'),
}),
},
},
listCustomerOrders: {
title: 'List Customer Orders',
description: 'List orders for a specific customer, optionally filtered by status',
input: {
schema: z.object({
customerId: z
.string()
.title('Customer ID')
.describe('The Shopify GID of the customer (e.g. gid://shopify/Customer/12345)'),
status: z
.enum(['open', 'closed', 'cancelled', 'any'])
.default('any')
.optional()
.title('Status Filter')
.describe('Filter orders by status'),
first: z.number().min(1).max(250).default(50).optional().title('Limit').describe('Number of orders to return'),
}),
},
output: {
schema: z.object({
orders: z.array(orderSchema).title('Orders').describe('List of customer orders'),
}),
},
},
} satisfies IntegrationDefinitionProps['actions']
@@ -0,0 +1,30 @@
import { IntegrationDefinitionProps } from '@botpress/sdk'
import { orderEventSchema } from './schemas'
export const events = {
orderCreated: {
title: 'Order Created',
description: 'Triggered when a new order is placed',
schema: orderEventSchema,
},
orderUpdated: {
title: 'Order Updated',
description: 'Triggered when an order is modified',
schema: orderEventSchema,
},
orderCancelled: {
title: 'Order Cancelled',
description: 'Triggered when an order is cancelled',
schema: orderEventSchema,
},
orderFulfilled: {
title: 'Order Fulfilled',
description: 'Triggered when all items in an order are fulfilled',
schema: orderEventSchema,
},
orderPaid: {
title: 'Order Paid',
description: 'Triggered when payment for an order is confirmed',
schema: orderEventSchema,
},
} satisfies IntegrationDefinitionProps['events']
@@ -0,0 +1,18 @@
import { z } from '@botpress/sdk'
export { actions } from './actions'
export { events } from './events'
export { states } from './states'
export * as schemas from './schemas'
export const configuration = {
identifier: {
linkTemplateScript: 'linkTemplate.vrl',
},
schema: z.object({}),
}
export const secrets = {
SHOPIFY_CLIENT_ID: { description: 'The Client ID of the Shopify app' },
SHOPIFY_CLIENT_SECRET: { description: 'The Client Secret of the Shopify app' },
}
@@ -0,0 +1,90 @@
import { z } from '@botpress/sdk'
export const productVariantSchema = z.object({
id: z.string().title('Variant ID').describe('The Shopify GID of the product variant'),
title: z.string().title('Title').describe('The title of the variant'),
price: z.string().title('Price').describe('The price of the variant'),
sku: z.string().optional().title('SKU').describe('The SKU of the variant'),
inventoryQuantity: z.number().optional().title('Inventory Quantity').describe('The available inventory'),
})
export const productSchema = z.object({
id: z.string().title('Product ID').describe('The Shopify GID of the product'),
title: z.string().title('Title').describe('The title of the product'),
handle: z.string().title('Handle').describe('The URL-friendly handle of the product'),
status: z.string().title('Status').describe('The status of the product (ACTIVE, ARCHIVED, DRAFT)'),
vendor: z.string().optional().title('Vendor').describe('The vendor of the product'),
productType: z.string().optional().title('Product Type').describe('The product type'),
descriptionHtml: z.string().optional().title('Description HTML').describe('The HTML description'),
createdAt: z.string().title('Created At').describe('When the product was created'),
updatedAt: z.string().title('Updated At').describe('When the product was last updated'),
storefrontUrl: z
.string()
.title('Storefront URL')
.describe("Canonical storefront URL on the shop's myshopify.com domain — always populated"),
onlineStoreUrl: z
.string()
.optional()
.title('Online Store URL')
.describe(
'Published Online Store URL (may use a custom domain). Undefined if the product is not published to the Online Store sales channel'
),
onlineStorePreviewUrl: z
.string()
.optional()
.title('Online Store Preview URL')
.describe('Preview URL that works even when the product is not published'),
variants: z.array(productVariantSchema).title('Variants').describe('The product variants'),
})
export const customerSchema = z.object({
id: z.string().title('Customer ID').describe('The Shopify GID of the customer'),
firstName: z.string().optional().title('First Name').describe('The first name of the customer'),
lastName: z.string().optional().title('Last Name').describe('The last name of the customer'),
email: z.string().optional().title('Email').describe('The email address of the customer'),
phone: z.string().optional().title('Phone').describe('The phone number of the customer'),
numberOfOrders: z.number().optional().title('Number of Orders').describe('Total number of orders'),
amountSpent: z.string().optional().title('Amount Spent').describe('Total amount spent'),
createdAt: z.string().title('Created At').describe('When the customer was created'),
updatedAt: z.string().title('Updated At').describe('When the customer was last updated'),
})
export const orderLineItemSchema = z.object({
title: z.string().title('Title').describe('The title of the line item'),
quantity: z.number().title('Quantity').describe('The quantity ordered'),
variant: productVariantSchema.optional().title('Variant').describe('The associated product variant'),
})
export const orderSchema = z.object({
id: z.string().title('Order ID').describe('The Shopify GID of the order'),
name: z.string().title('Order Number').describe('The order number (e.g. #1001)'),
email: z.string().optional().title('Email').describe('The email associated with the order'),
phone: z.string().optional().title('Phone').describe('The phone number associated with the order'),
createdAt: z.string().title('Created At').describe('When the order was created'),
updatedAt: z.string().title('Updated At').describe('When the order was last updated'),
cancelledAt: z.string().optional().title('Cancelled At').describe('When the order was cancelled'),
closedAt: z.string().optional().title('Closed At').describe('When the order was closed'),
financialStatus: z.string().title('Financial Status').describe('The financial status of the order'),
fulfillmentStatus: z.string().optional().title('Fulfillment Status').describe('The fulfillment status'),
totalPrice: z.string().title('Total Price').describe('The total price of the order'),
currencyCode: z.string().title('Currency Code').describe('The currency code (e.g. USD)'),
lineItems: z.array(orderLineItemSchema).title('Line Items').describe('The order line items'),
customer: customerSchema.optional().title('Customer').describe('The customer who placed the order'),
})
export const orderEventSchema = z.object({
id: z.string().title('Order ID').describe('The Shopify order ID'),
name: z.string().title('Order Number').describe('The order number (e.g. #1001)'),
email: z.string().optional().title('Email').describe('The email associated with the order'),
financialStatus: z.string().title('Financial Status').describe('The financial status'),
fulfillmentStatus: z.string().optional().title('Fulfillment Status').describe('The fulfillment status'),
totalPrice: z.string().title('Total Price').describe('The total price of the order'),
currencyCode: z.string().title('Currency Code').describe('The currency code'),
createdAt: z.string().title('Created At').describe('When the order was created'),
updatedAt: z.string().title('Updated At').describe('When the order was last updated'),
})
export const pageInfoSchema = z.object({
hasNextPage: z.boolean().title('Has Next Page').describe('Whether there are more results'),
endCursor: z.string().optional().title('End Cursor').describe('Cursor for the next page'),
})
@@ -0,0 +1,37 @@
import { z, IntegrationDefinitionProps } from '@botpress/sdk'
export const states = {
credentials: {
type: 'integration',
schema: z.object({
shopDomain: z.string().optional().title('Shop Domain').describe('The myshopify.com domain of the store'),
accessToken: z
.string()
.optional()
.title('Admin Access Token')
.describe('Shopify Admin API expiring offline access token (60-min TTL)'),
refreshToken: z
.string()
.optional()
.title('Admin Refresh Token')
.describe(
'Used to obtain a new access token without merchant interaction. Expires after 90 days; merchant must re-authorize when this expires.'
),
accessTokenExpiresAtSeconds: z
.number()
.optional()
.title('Access Token Expires At (s)')
.describe('Unix epoch seconds at which the access token expires.'),
refreshTokenExpiresAtSeconds: z
.number()
.optional()
.title('Refresh Token Expires At (s)')
.describe('Unix epoch seconds at which the refresh token expires.'),
webhookSubscriptionIds: z
.array(z.string())
.optional()
.title('Webhook Subscription IDs')
.describe('GIDs of webhook subscriptions created during register; used by unregister for cleanup'),
}),
},
} satisfies IntegrationDefinitionProps['states']