@keystrokehq/shopify 0.0.11 → 0.0.16-integration-id-canonicalization.0
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 +14 -153
- package/dist/{schemas.d.mts → common-C2s35du9.d.mts} +3 -2
- package/dist/{schemas.mjs → common-JZyHdK6p.mjs} +3 -3
- package/dist/credential-sets/index.d.mts +2 -0
- package/dist/credential-sets/index.mjs +4 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +6 -1
- package/dist/operations/index.d.mts +2 -0
- package/dist/operations/index.mjs +3 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/shopify-app.credential-set-DuAYUhzY.d.mts +65 -0
- package/dist/shopify-app.credential-set-M3vKwTji.mjs +17 -0
- package/dist/{integration-vSl3XHTG.mjs → shopify.credential-set-CaxST3GP.mjs} +6 -141
- package/dist/update-shopify-product.operation-ByYhZggW.mjs +1972 -0
- package/dist/update-shopify-product.operation-Db_kLuJa.d.mts +2817 -0
- package/package.json +11 -67
- package/dist/_official/index.d.mts +0 -38
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -56
- package/dist/_runtime/index.mjs +0 -150
- package/dist/articles.d.mts +0 -174
- package/dist/articles.mjs +0 -252
- package/dist/blogs.d.mts +0 -113
- package/dist/blogs.mjs +0 -174
- package/dist/client.d.mts +0 -22
- package/dist/client.mjs +0 -90
- package/dist/collections.d.mts +0 -140
- package/dist/collections.mjs +0 -209
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/customers.d.mts +0 -161
- package/dist/customers.mjs +0 -225
- package/dist/events.d.mts +0 -181
- package/dist/events.mjs +0 -67
- package/dist/factory-BKmxl2-8.mjs +0 -7
- package/dist/fulfillments.d.mts +0 -99
- package/dist/fulfillments.mjs +0 -167
- package/dist/integration-HrSKAMfF.d.mts +0 -70
- package/dist/inventory.d.mts +0 -103
- package/dist/inventory.mjs +0 -182
- package/dist/locations.d.mts +0 -47
- package/dist/locations.mjs +0 -81
- package/dist/messaging.d.mts +0 -1
- package/dist/messaging.mjs +0 -1
- package/dist/operation-helpers-CKEDIx0o.mjs +0 -21
- package/dist/orders.d.mts +0 -229
- package/dist/orders.mjs +0 -271
- package/dist/products.d.mts +0 -155
- package/dist/products.mjs +0 -171
- package/dist/shop.d.mts +0 -20
- package/dist/shop.mjs +0 -31
package/dist/customers.mjs
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { shopifyConnectionNodesSchema, shopifyCustomerSchema, shopifyGlobalIdSchema, shopifyOrderSchema, shopifyUserErrorSchema } from "./schemas.mjs";
|
|
2
|
-
import { createShopifyClient } from "./client.mjs";
|
|
3
|
-
import { t as shopifyOperation } from "./factory-BKmxl2-8.mjs";
|
|
4
|
-
import { n as omitUndefined, r as shopifyPageInputSchema, t as assertNoUserErrors } from "./operation-helpers-CKEDIx0o.mjs";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
//#region src/customers.ts
|
|
8
|
-
const customerSelection = `
|
|
9
|
-
id
|
|
10
|
-
displayName
|
|
11
|
-
firstName
|
|
12
|
-
lastName
|
|
13
|
-
email
|
|
14
|
-
phone
|
|
15
|
-
createdAt
|
|
16
|
-
updatedAt
|
|
17
|
-
`;
|
|
18
|
-
const orderSelection = `
|
|
19
|
-
id
|
|
20
|
-
name
|
|
21
|
-
createdAt
|
|
22
|
-
updatedAt
|
|
23
|
-
cancelledAt
|
|
24
|
-
email
|
|
25
|
-
note
|
|
26
|
-
tags
|
|
27
|
-
displayFinancialStatus
|
|
28
|
-
displayFulfillmentStatus
|
|
29
|
-
currentTotalPriceSet {
|
|
30
|
-
shopMoney {
|
|
31
|
-
amount
|
|
32
|
-
currencyCode
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
customer {
|
|
36
|
-
id
|
|
37
|
-
displayName
|
|
38
|
-
firstName
|
|
39
|
-
lastName
|
|
40
|
-
email
|
|
41
|
-
phone
|
|
42
|
-
createdAt
|
|
43
|
-
updatedAt
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
const customerMutationInputSchema = z.object({
|
|
47
|
-
email: z.email().optional(),
|
|
48
|
-
firstName: z.string().optional(),
|
|
49
|
-
lastName: z.string().optional(),
|
|
50
|
-
phone: z.string().optional(),
|
|
51
|
-
note: z.string().optional(),
|
|
52
|
-
tags: z.array(z.string()).optional()
|
|
53
|
-
});
|
|
54
|
-
const customerMutationResponseSchema = z.object({
|
|
55
|
-
customer: shopifyCustomerSchema.nullable(),
|
|
56
|
-
userErrors: z.array(shopifyUserErrorSchema)
|
|
57
|
-
});
|
|
58
|
-
const listCustomersResponseSchema = z.object({ customers: shopifyConnectionNodesSchema(shopifyCustomerSchema) });
|
|
59
|
-
const getCustomerResponseSchema = z.object({ customer: shopifyCustomerSchema.nullable() });
|
|
60
|
-
const customerDeleteResponseSchema = z.object({
|
|
61
|
-
deletedCustomerId: shopifyGlobalIdSchema.nullable(),
|
|
62
|
-
userErrors: z.array(shopifyUserErrorSchema)
|
|
63
|
-
});
|
|
64
|
-
const customerOrdersResponseSchema = z.object({ customer: z.object({ orders: shopifyConnectionNodesSchema(shopifyOrderSchema) }).nullable() });
|
|
65
|
-
const listCustomers = shopifyOperation({
|
|
66
|
-
id: "shopify.list-shopify-customers",
|
|
67
|
-
name: "List Shopify Customers",
|
|
68
|
-
description: "List customers from the connected Shopify store.",
|
|
69
|
-
input: shopifyPageInputSchema,
|
|
70
|
-
output: shopifyConnectionNodesSchema(shopifyCustomerSchema),
|
|
71
|
-
run: async (input, credentials) => {
|
|
72
|
-
return (await createShopifyClient(credentials).graphql(`
|
|
73
|
-
query ListCustomers($first: Int!, $after: String, $query: String) {
|
|
74
|
-
customers(first: $first, after: $after, query: $query) {
|
|
75
|
-
nodes {
|
|
76
|
-
${customerSelection}
|
|
77
|
-
}
|
|
78
|
-
pageInfo {
|
|
79
|
-
hasNextPage
|
|
80
|
-
hasPreviousPage
|
|
81
|
-
startCursor
|
|
82
|
-
endCursor
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`, listCustomersResponseSchema, { variables: {
|
|
87
|
-
first: input.first,
|
|
88
|
-
...input.after ? { after: input.after } : {},
|
|
89
|
-
...input.query ? { query: input.query } : {}
|
|
90
|
-
} })).customers;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
const getCustomer = shopifyOperation({
|
|
94
|
-
id: "shopify.get-shopify-customer",
|
|
95
|
-
name: "Get Shopify Customer",
|
|
96
|
-
description: "Retrieve a single Shopify customer by its global ID.",
|
|
97
|
-
input: z.object({ id: shopifyGlobalIdSchema }),
|
|
98
|
-
output: shopifyCustomerSchema,
|
|
99
|
-
run: async (input, credentials) => {
|
|
100
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
101
|
-
query GetCustomer($id: ID!) {
|
|
102
|
-
customer(id: $id) {
|
|
103
|
-
${customerSelection}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
`, getCustomerResponseSchema, { variables: { id: input.id } });
|
|
107
|
-
if (!response.customer) throw new Error(`Shopify customer not found: ${input.id}`);
|
|
108
|
-
return response.customer;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const createCustomer = shopifyOperation({
|
|
112
|
-
id: "shopify.create-shopify-customer",
|
|
113
|
-
name: "Create Shopify Customer",
|
|
114
|
-
description: "Create a customer in the connected Shopify store.",
|
|
115
|
-
needsApproval: true,
|
|
116
|
-
input: customerMutationInputSchema.refine((input) => input.email !== void 0 || input.phone !== void 0 || input.firstName !== void 0, { message: "At least one identifying customer field must be provided." }),
|
|
117
|
-
output: shopifyCustomerSchema,
|
|
118
|
-
run: async (input, credentials) => {
|
|
119
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
120
|
-
mutation CreateCustomer($input: CustomerInput!) {
|
|
121
|
-
customerCreate(input: $input) {
|
|
122
|
-
customer {
|
|
123
|
-
${customerSelection}
|
|
124
|
-
}
|
|
125
|
-
userErrors {
|
|
126
|
-
field
|
|
127
|
-
message
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`, z.object({ customerCreate: customerMutationResponseSchema }), { variables: { input: omitUndefined(input) } });
|
|
132
|
-
assertNoUserErrors(response.customerCreate.userErrors);
|
|
133
|
-
if (!response.customerCreate.customer) throw new Error("Shopify did not return the created customer.");
|
|
134
|
-
return response.customerCreate.customer;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
const updateCustomer = shopifyOperation({
|
|
138
|
-
id: "shopify.update-shopify-customer",
|
|
139
|
-
name: "Update Shopify Customer",
|
|
140
|
-
description: "Update a Shopify customer by its global ID.",
|
|
141
|
-
needsApproval: true,
|
|
142
|
-
input: customerMutationInputSchema.extend({ id: shopifyGlobalIdSchema }),
|
|
143
|
-
output: shopifyCustomerSchema,
|
|
144
|
-
run: async (input, credentials) => {
|
|
145
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
146
|
-
mutation UpdateCustomer($input: CustomerInput!) {
|
|
147
|
-
customerUpdate(input: $input) {
|
|
148
|
-
customer {
|
|
149
|
-
${customerSelection}
|
|
150
|
-
}
|
|
151
|
-
userErrors {
|
|
152
|
-
field
|
|
153
|
-
message
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
`, z.object({ customerUpdate: customerMutationResponseSchema }), { variables: { input: omitUndefined(input) } });
|
|
158
|
-
assertNoUserErrors(response.customerUpdate.userErrors);
|
|
159
|
-
if (!response.customerUpdate.customer) throw new Error(`Shopify did not return the updated customer: ${input.id}`);
|
|
160
|
-
return response.customerUpdate.customer;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
const deleteCustomer = shopifyOperation({
|
|
164
|
-
id: "shopify.delete-shopify-customer",
|
|
165
|
-
name: "Delete Shopify Customer",
|
|
166
|
-
description: "Delete a Shopify customer who has no placed orders.",
|
|
167
|
-
needsApproval: true,
|
|
168
|
-
input: z.object({ id: shopifyGlobalIdSchema }),
|
|
169
|
-
output: z.object({ deletedCustomerId: shopifyGlobalIdSchema }),
|
|
170
|
-
run: async (input, credentials) => {
|
|
171
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
172
|
-
mutation DeleteCustomer($id: ID!) {
|
|
173
|
-
customerDelete(input: { id: $id }) {
|
|
174
|
-
deletedCustomerId
|
|
175
|
-
userErrors {
|
|
176
|
-
field
|
|
177
|
-
message
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
`, z.object({ customerDelete: customerDeleteResponseSchema }), { variables: { id: input.id } });
|
|
182
|
-
assertNoUserErrors(response.customerDelete.userErrors);
|
|
183
|
-
if (!response.customerDelete.deletedCustomerId) throw new Error(`Shopify did not confirm customer deletion: ${input.id}`);
|
|
184
|
-
return { deletedCustomerId: response.customerDelete.deletedCustomerId };
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
const getCustomerOrders = shopifyOperation({
|
|
188
|
-
id: "shopify.get-shopify-customer-orders",
|
|
189
|
-
name: "Get Shopify Customer Orders",
|
|
190
|
-
description: "Retrieve orders for a specific Shopify customer.",
|
|
191
|
-
input: z.object({
|
|
192
|
-
id: shopifyGlobalIdSchema,
|
|
193
|
-
first: z.number().int().min(1).max(100).optional().default(25),
|
|
194
|
-
after: z.string().optional()
|
|
195
|
-
}),
|
|
196
|
-
output: shopifyConnectionNodesSchema(shopifyOrderSchema),
|
|
197
|
-
run: async (input, credentials) => {
|
|
198
|
-
const response = await createShopifyClient(credentials).graphql(`
|
|
199
|
-
query GetCustomerOrders($id: ID!, $first: Int!, $after: String) {
|
|
200
|
-
customer(id: $id) {
|
|
201
|
-
orders(first: $first, after: $after) {
|
|
202
|
-
nodes {
|
|
203
|
-
${orderSelection}
|
|
204
|
-
}
|
|
205
|
-
pageInfo {
|
|
206
|
-
hasNextPage
|
|
207
|
-
hasPreviousPage
|
|
208
|
-
startCursor
|
|
209
|
-
endCursor
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
`, customerOrdersResponseSchema, { variables: {
|
|
215
|
-
id: input.id,
|
|
216
|
-
first: input.first,
|
|
217
|
-
...input.after ? { after: input.after } : {}
|
|
218
|
-
} });
|
|
219
|
-
if (!response.customer) throw new Error(`Shopify customer not found for orders lookup: ${input.id}`);
|
|
220
|
-
return response.customer.orders;
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
//#endregion
|
|
225
|
-
export { createCustomer, deleteCustomer, getCustomer, getCustomerOrders, listCustomers, updateCustomer };
|
package/dist/events.d.mts
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
//#region src/events.d.ts
|
|
4
|
-
declare const shopifyWebhookTopicSchema: z.ZodEnum<{
|
|
5
|
-
"products/create": "products/create";
|
|
6
|
-
"products/update": "products/update";
|
|
7
|
-
"products/delete": "products/delete";
|
|
8
|
-
"orders/create": "orders/create";
|
|
9
|
-
"orders/updated": "orders/updated";
|
|
10
|
-
"orders/cancelled": "orders/cancelled";
|
|
11
|
-
"orders/fulfilled": "orders/fulfilled";
|
|
12
|
-
}>;
|
|
13
|
-
declare const shopifyWebhookSubscriptionTopicSchema: z.ZodEnum<{
|
|
14
|
-
PRODUCTS_CREATE: "PRODUCTS_CREATE";
|
|
15
|
-
PRODUCTS_UPDATE: "PRODUCTS_UPDATE";
|
|
16
|
-
PRODUCTS_DELETE: "PRODUCTS_DELETE";
|
|
17
|
-
ORDERS_CREATE: "ORDERS_CREATE";
|
|
18
|
-
ORDERS_UPDATED: "ORDERS_UPDATED";
|
|
19
|
-
ORDERS_CANCELLED: "ORDERS_CANCELLED";
|
|
20
|
-
ORDERS_FULFILLED: "ORDERS_FULFILLED";
|
|
21
|
-
}>;
|
|
22
|
-
declare const shopifyProductWebhookPayloadSchema: z.ZodObject<{
|
|
23
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
24
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
25
|
-
title: z.ZodOptional<z.ZodString>;
|
|
26
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
27
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
28
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
29
|
-
published_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
30
|
-
}, z.core.$loose>;
|
|
31
|
-
declare const shopifyOrderWebhookPayloadSchema: z.ZodObject<{
|
|
32
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
33
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
34
|
-
name: z.ZodOptional<z.ZodString>;
|
|
35
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
36
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
37
|
-
cancelled_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
38
|
-
processed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
39
|
-
closed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
40
|
-
fulfillment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
-
}, z.core.$loose>;
|
|
42
|
-
declare const shopifyProductCreatedEventSchema: z.ZodObject<{
|
|
43
|
-
eventId: z.ZodString;
|
|
44
|
-
topic: z.ZodLiteral<"products/create">;
|
|
45
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
46
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
47
|
-
payload: z.ZodObject<{
|
|
48
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
50
|
-
title: z.ZodOptional<z.ZodString>;
|
|
51
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
52
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
53
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
54
|
-
published_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
55
|
-
}, z.core.$loose>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
declare const shopifyProductUpdatedEventSchema: z.ZodObject<{
|
|
58
|
-
eventId: z.ZodString;
|
|
59
|
-
topic: z.ZodLiteral<"products/update">;
|
|
60
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
61
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
62
|
-
payload: z.ZodObject<{
|
|
63
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
65
|
-
title: z.ZodOptional<z.ZodString>;
|
|
66
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
67
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
68
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
69
|
-
published_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
70
|
-
}, z.core.$loose>;
|
|
71
|
-
}, z.core.$strip>;
|
|
72
|
-
declare const shopifyProductDeletedEventSchema: z.ZodObject<{
|
|
73
|
-
eventId: z.ZodString;
|
|
74
|
-
topic: z.ZodLiteral<"products/delete">;
|
|
75
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
76
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
77
|
-
payload: z.ZodObject<{
|
|
78
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
80
|
-
title: z.ZodOptional<z.ZodString>;
|
|
81
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
82
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
83
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
84
|
-
published_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
85
|
-
}, z.core.$loose>;
|
|
86
|
-
}, z.core.$strip>;
|
|
87
|
-
declare const shopifyOrderCreatedEventSchema: z.ZodObject<{
|
|
88
|
-
eventId: z.ZodString;
|
|
89
|
-
topic: z.ZodLiteral<"orders/create">;
|
|
90
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
91
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
92
|
-
payload: z.ZodObject<{
|
|
93
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
94
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
95
|
-
name: z.ZodOptional<z.ZodString>;
|
|
96
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
97
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
98
|
-
cancelled_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
99
|
-
processed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
100
|
-
closed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
101
|
-
fulfillment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
-
}, z.core.$loose>;
|
|
103
|
-
}, z.core.$strip>;
|
|
104
|
-
declare const shopifyOrderUpdatedEventSchema: z.ZodObject<{
|
|
105
|
-
eventId: z.ZodString;
|
|
106
|
-
topic: z.ZodLiteral<"orders/updated">;
|
|
107
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
108
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
109
|
-
payload: z.ZodObject<{
|
|
110
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
111
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
112
|
-
name: z.ZodOptional<z.ZodString>;
|
|
113
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
114
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
115
|
-
cancelled_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
116
|
-
processed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
117
|
-
closed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
118
|
-
fulfillment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
119
|
-
}, z.core.$loose>;
|
|
120
|
-
}, z.core.$strip>;
|
|
121
|
-
declare const shopifyOrderCancelledEventSchema: z.ZodObject<{
|
|
122
|
-
eventId: z.ZodString;
|
|
123
|
-
topic: z.ZodLiteral<"orders/cancelled">;
|
|
124
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
125
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
126
|
-
payload: z.ZodObject<{
|
|
127
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
128
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
129
|
-
name: z.ZodOptional<z.ZodString>;
|
|
130
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
131
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
132
|
-
cancelled_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
133
|
-
processed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
134
|
-
closed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
135
|
-
fulfillment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
-
}, z.core.$loose>;
|
|
137
|
-
}, z.core.$strip>;
|
|
138
|
-
declare const shopifyOrderFulfilledEventSchema: z.ZodObject<{
|
|
139
|
-
eventId: z.ZodString;
|
|
140
|
-
topic: z.ZodLiteral<"orders/fulfilled">;
|
|
141
|
-
resourceId: z.ZodOptional<z.ZodString>;
|
|
142
|
-
occurredAt: z.ZodOptional<z.ZodString>;
|
|
143
|
-
payload: z.ZodObject<{
|
|
144
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
145
|
-
admin_graphql_api_id: z.ZodOptional<z.ZodString>;
|
|
146
|
-
name: z.ZodOptional<z.ZodString>;
|
|
147
|
-
created_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
148
|
-
updated_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>;
|
|
149
|
-
cancelled_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
150
|
-
processed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
151
|
-
closed_at: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodString]>>>;
|
|
152
|
-
fulfillment_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
153
|
-
}, z.core.$loose>;
|
|
154
|
-
}, z.core.$strip>;
|
|
155
|
-
declare const shopifyWebhookEnvelopeSchema: z.ZodObject<{
|
|
156
|
-
topic: z.ZodEnum<{
|
|
157
|
-
"products/create": "products/create";
|
|
158
|
-
"products/update": "products/update";
|
|
159
|
-
"products/delete": "products/delete";
|
|
160
|
-
"orders/create": "orders/create";
|
|
161
|
-
"orders/updated": "orders/updated";
|
|
162
|
-
"orders/cancelled": "orders/cancelled";
|
|
163
|
-
"orders/fulfilled": "orders/fulfilled";
|
|
164
|
-
}>;
|
|
165
|
-
eventId: z.ZodString;
|
|
166
|
-
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
167
|
-
}, z.core.$strip>;
|
|
168
|
-
type ShopifyWebhookTopic = z.infer<typeof shopifyWebhookTopicSchema>;
|
|
169
|
-
type ShopifyWebhookSubscriptionTopic = z.infer<typeof shopifyWebhookSubscriptionTopicSchema>;
|
|
170
|
-
type ShopifyWebhookEnvelope = z.infer<typeof shopifyWebhookEnvelopeSchema>;
|
|
171
|
-
type ShopifyProductWebhookPayload = z.infer<typeof shopifyProductWebhookPayloadSchema>;
|
|
172
|
-
type ShopifyOrderWebhookPayload = z.infer<typeof shopifyOrderWebhookPayloadSchema>;
|
|
173
|
-
type ShopifyProductCreatedEvent = z.infer<typeof shopifyProductCreatedEventSchema>;
|
|
174
|
-
type ShopifyProductUpdatedEvent = z.infer<typeof shopifyProductUpdatedEventSchema>;
|
|
175
|
-
type ShopifyProductDeletedEvent = z.infer<typeof shopifyProductDeletedEventSchema>;
|
|
176
|
-
type ShopifyOrderCreatedEvent = z.infer<typeof shopifyOrderCreatedEventSchema>;
|
|
177
|
-
type ShopifyOrderUpdatedEvent = z.infer<typeof shopifyOrderUpdatedEventSchema>;
|
|
178
|
-
type ShopifyOrderCancelledEvent = z.infer<typeof shopifyOrderCancelledEventSchema>;
|
|
179
|
-
type ShopifyOrderFulfilledEvent = z.infer<typeof shopifyOrderFulfilledEventSchema>;
|
|
180
|
-
//#endregion
|
|
181
|
-
export { ShopifyOrderCancelledEvent, ShopifyOrderCreatedEvent, ShopifyOrderFulfilledEvent, ShopifyOrderUpdatedEvent, ShopifyOrderWebhookPayload, ShopifyProductCreatedEvent, ShopifyProductDeletedEvent, ShopifyProductUpdatedEvent, ShopifyProductWebhookPayload, ShopifyWebhookEnvelope, ShopifyWebhookSubscriptionTopic, ShopifyWebhookTopic, shopifyOrderCancelledEventSchema, shopifyOrderCreatedEventSchema, shopifyOrderFulfilledEventSchema, shopifyOrderUpdatedEventSchema, shopifyOrderWebhookPayloadSchema, shopifyProductCreatedEventSchema, shopifyProductDeletedEventSchema, shopifyProductUpdatedEventSchema, shopifyProductWebhookPayloadSchema, shopifyWebhookEnvelopeSchema, shopifyWebhookSubscriptionTopicSchema, shopifyWebhookTopicSchema };
|
package/dist/events.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { shopifyGlobalIdSchema } from "./schemas.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
//#region src/events.ts
|
|
5
|
-
const shopifyWebhookTopicSchema = z.enum([
|
|
6
|
-
"products/create",
|
|
7
|
-
"products/update",
|
|
8
|
-
"products/delete",
|
|
9
|
-
"orders/create",
|
|
10
|
-
"orders/updated",
|
|
11
|
-
"orders/cancelled",
|
|
12
|
-
"orders/fulfilled"
|
|
13
|
-
]);
|
|
14
|
-
const shopifyWebhookSubscriptionTopicSchema = z.enum([
|
|
15
|
-
"PRODUCTS_CREATE",
|
|
16
|
-
"PRODUCTS_UPDATE",
|
|
17
|
-
"PRODUCTS_DELETE",
|
|
18
|
-
"ORDERS_CREATE",
|
|
19
|
-
"ORDERS_UPDATED",
|
|
20
|
-
"ORDERS_CANCELLED",
|
|
21
|
-
"ORDERS_FULFILLED"
|
|
22
|
-
]);
|
|
23
|
-
const shopifyWebhookTimestampSchema = z.union([z.iso.datetime(), z.string().min(1)]);
|
|
24
|
-
const shopifyProductWebhookPayloadSchema = z.object({
|
|
25
|
-
id: z.number().int().optional(),
|
|
26
|
-
admin_graphql_api_id: shopifyGlobalIdSchema.optional(),
|
|
27
|
-
title: z.string().optional(),
|
|
28
|
-
handle: z.string().optional(),
|
|
29
|
-
created_at: shopifyWebhookTimestampSchema.optional(),
|
|
30
|
-
updated_at: shopifyWebhookTimestampSchema.optional(),
|
|
31
|
-
published_at: shopifyWebhookTimestampSchema.nullable().optional()
|
|
32
|
-
}).passthrough();
|
|
33
|
-
const shopifyOrderWebhookPayloadSchema = z.object({
|
|
34
|
-
id: z.number().int().optional(),
|
|
35
|
-
admin_graphql_api_id: shopifyGlobalIdSchema.optional(),
|
|
36
|
-
name: z.string().optional(),
|
|
37
|
-
created_at: shopifyWebhookTimestampSchema.optional(),
|
|
38
|
-
updated_at: shopifyWebhookTimestampSchema.optional(),
|
|
39
|
-
cancelled_at: shopifyWebhookTimestampSchema.nullable().optional(),
|
|
40
|
-
processed_at: shopifyWebhookTimestampSchema.nullable().optional(),
|
|
41
|
-
closed_at: shopifyWebhookTimestampSchema.nullable().optional(),
|
|
42
|
-
fulfillment_status: z.string().nullable().optional()
|
|
43
|
-
}).passthrough();
|
|
44
|
-
function createShopifyWebhookEventSchema(topic, payloadSchema) {
|
|
45
|
-
return z.object({
|
|
46
|
-
eventId: z.string().min(1),
|
|
47
|
-
topic: z.literal(topic),
|
|
48
|
-
resourceId: z.string().min(1).optional(),
|
|
49
|
-
occurredAt: z.string().min(1).optional(),
|
|
50
|
-
payload: payloadSchema
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const shopifyProductCreatedEventSchema = createShopifyWebhookEventSchema("products/create", shopifyProductWebhookPayloadSchema);
|
|
54
|
-
const shopifyProductUpdatedEventSchema = createShopifyWebhookEventSchema("products/update", shopifyProductWebhookPayloadSchema);
|
|
55
|
-
const shopifyProductDeletedEventSchema = createShopifyWebhookEventSchema("products/delete", shopifyProductWebhookPayloadSchema);
|
|
56
|
-
const shopifyOrderCreatedEventSchema = createShopifyWebhookEventSchema("orders/create", shopifyOrderWebhookPayloadSchema);
|
|
57
|
-
const shopifyOrderUpdatedEventSchema = createShopifyWebhookEventSchema("orders/updated", shopifyOrderWebhookPayloadSchema);
|
|
58
|
-
const shopifyOrderCancelledEventSchema = createShopifyWebhookEventSchema("orders/cancelled", shopifyOrderWebhookPayloadSchema);
|
|
59
|
-
const shopifyOrderFulfilledEventSchema = createShopifyWebhookEventSchema("orders/fulfilled", shopifyOrderWebhookPayloadSchema);
|
|
60
|
-
const shopifyWebhookEnvelopeSchema = z.object({
|
|
61
|
-
topic: shopifyWebhookTopicSchema,
|
|
62
|
-
eventId: z.string().min(1),
|
|
63
|
-
payload: z.record(z.string(), z.unknown())
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { shopifyOrderCancelledEventSchema, shopifyOrderCreatedEventSchema, shopifyOrderFulfilledEventSchema, shopifyOrderUpdatedEventSchema, shopifyOrderWebhookPayloadSchema, shopifyProductCreatedEventSchema, shopifyProductDeletedEventSchema, shopifyProductUpdatedEventSchema, shopifyProductWebhookPayloadSchema, shopifyWebhookEnvelopeSchema, shopifyWebhookSubscriptionTopicSchema, shopifyWebhookTopicSchema };
|
package/dist/fulfillments.d.mts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
-
|
|
5
|
-
//#region src/fulfillments.d.ts
|
|
6
|
-
declare const listFulfillmentOrdersForOrder: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
-
orderId: z.ZodString;
|
|
8
|
-
first: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
-
after: z.ZodOptional<z.ZodString>;
|
|
10
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
12
|
-
id: z.ZodString;
|
|
13
|
-
status: z.ZodString;
|
|
14
|
-
assignedLocation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
15
|
-
location: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
16
|
-
id: z.ZodString;
|
|
17
|
-
name: z.ZodString;
|
|
18
|
-
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
-
fulfillsOnlineOrders: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
-
}, z.core.$strip>>>;
|
|
21
|
-
}, z.core.$strip>>>;
|
|
22
|
-
lineItems: z.ZodObject<{
|
|
23
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
24
|
-
id: z.ZodString;
|
|
25
|
-
remainingQuantity: z.ZodNumber;
|
|
26
|
-
lineItem: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
27
|
-
id: z.ZodString;
|
|
28
|
-
name: z.ZodString;
|
|
29
|
-
quantity: z.ZodNumber;
|
|
30
|
-
}, z.core.$strip>>>;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
|
-
pageInfo: z.ZodObject<{
|
|
33
|
-
hasNextPage: z.ZodBoolean;
|
|
34
|
-
hasPreviousPage: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
-
startCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
-
endCursor: z.ZodNullable<z.ZodString>;
|
|
37
|
-
}, z.core.$strip>;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
}, z.core.$strip>>;
|
|
40
|
-
pageInfo: z.ZodObject<{
|
|
41
|
-
hasNextPage: z.ZodBoolean;
|
|
42
|
-
hasPreviousPage: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
-
startCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
-
endCursor: z.ZodNullable<z.ZodString>;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"shopify", z.ZodObject<{
|
|
47
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
48
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
49
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
50
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
51
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
52
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
53
|
-
declare const getFulfillment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
54
|
-
id: z.ZodString;
|
|
55
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
-
id: z.ZodString;
|
|
57
|
-
status: z.ZodOptional<z.ZodString>;
|
|
58
|
-
trackingInfo: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
59
|
-
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
61
|
-
}, z.core.$strip>>>;
|
|
62
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"shopify", z.ZodObject<{
|
|
63
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
64
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
65
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
66
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
67
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
68
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
69
|
-
declare const createFulfillment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
70
|
-
lineItemsByFulfillmentOrder: z.ZodArray<z.ZodObject<{
|
|
71
|
-
fulfillmentOrderId: z.ZodString;
|
|
72
|
-
fulfillmentOrderLineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
-
id: z.ZodString;
|
|
74
|
-
quantity: z.ZodNumber;
|
|
75
|
-
}, z.core.$strip>>>;
|
|
76
|
-
}, z.core.$strip>>;
|
|
77
|
-
notifyCustomer: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
-
message: z.ZodOptional<z.ZodString>;
|
|
79
|
-
trackingInfo: z.ZodOptional<z.ZodObject<{
|
|
80
|
-
company: z.ZodOptional<z.ZodString>;
|
|
81
|
-
number: z.ZodOptional<z.ZodString>;
|
|
82
|
-
url: z.ZodOptional<z.ZodURL>;
|
|
83
|
-
}, z.core.$strip>>;
|
|
84
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
-
id: z.ZodString;
|
|
86
|
-
status: z.ZodOptional<z.ZodString>;
|
|
87
|
-
trackingInfo: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
-
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
90
|
-
}, z.core.$strip>>>;
|
|
91
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"shopify", z.ZodObject<{
|
|
92
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
93
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
94
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
95
|
-
SHOPIFY_STORE_DOMAIN: z.ZodString;
|
|
96
|
-
SHOPIFY_ACCESS_TOKEN: z.ZodString;
|
|
97
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
98
|
-
//#endregion
|
|
99
|
-
export { createFulfillment, getFulfillment, listFulfillmentOrdersForOrder };
|