@keystrokehq/shopify 0.0.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.
Files changed (46) hide show
  1. package/README.md +178 -0
  2. package/dist/_official/index.d.mts +3 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +56 -0
  5. package/dist/_runtime/index.mjs +3 -0
  6. package/dist/articles.d.mts +174 -0
  7. package/dist/articles.mjs +252 -0
  8. package/dist/blogs.d.mts +113 -0
  9. package/dist/blogs.mjs +174 -0
  10. package/dist/client.d.mts +22 -0
  11. package/dist/client.mjs +90 -0
  12. package/dist/collections.d.mts +140 -0
  13. package/dist/collections.mjs +209 -0
  14. package/dist/connection.d.mts +2 -0
  15. package/dist/connection.mjs +3 -0
  16. package/dist/customers.d.mts +161 -0
  17. package/dist/customers.mjs +225 -0
  18. package/dist/events.d.mts +181 -0
  19. package/dist/events.mjs +67 -0
  20. package/dist/factory-DC-gY8L0.mjs +8 -0
  21. package/dist/fulfillments.d.mts +99 -0
  22. package/dist/fulfillments.mjs +167 -0
  23. package/dist/index.d.mts +1 -0
  24. package/dist/index.mjs +1 -0
  25. package/dist/integration-BN3pjCz4.mjs +204 -0
  26. package/dist/integration-BwDBsGX-.d.mts +71 -0
  27. package/dist/inventory.d.mts +103 -0
  28. package/dist/inventory.mjs +182 -0
  29. package/dist/locations.d.mts +47 -0
  30. package/dist/locations.mjs +81 -0
  31. package/dist/messaging.d.mts +1 -0
  32. package/dist/messaging.mjs +1 -0
  33. package/dist/operation-helpers-CKEDIx0o.mjs +21 -0
  34. package/dist/orders.d.mts +229 -0
  35. package/dist/orders.mjs +271 -0
  36. package/dist/products.d.mts +155 -0
  37. package/dist/products.mjs +171 -0
  38. package/dist/provider-app-DHxVZI6q.d.mts +37 -0
  39. package/dist/schemas.d.mts +233 -0
  40. package/dist/schemas.mjs +164 -0
  41. package/dist/shop.d.mts +20 -0
  42. package/dist/shop.mjs +31 -0
  43. package/dist/triggers.d.mts +23 -0
  44. package/dist/triggers.mjs +138 -0
  45. package/dist/webhook-management-BmIxO0vr.mjs +150 -0
  46. package/package.json +130 -0
@@ -0,0 +1,171 @@
1
+ import { shopifyConnectionNodesSchema, shopifyGlobalIdSchema, shopifyProductSchema, shopifyUserErrorSchema } from "./schemas.mjs";
2
+ import { createShopifyClient } from "./client.mjs";
3
+ import { t as shopifyOperation } from "./factory-DC-gY8L0.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/products.ts
8
+ const productSelection = `
9
+ id
10
+ title
11
+ handle
12
+ status
13
+ productType
14
+ vendor
15
+ descriptionHtml
16
+ onlineStoreUrl
17
+ createdAt
18
+ updatedAt
19
+ tags
20
+ featuredImage {
21
+ url
22
+ altText
23
+ }
24
+ seo {
25
+ title
26
+ description
27
+ }
28
+ `;
29
+ const productMutationInputSchema = z.object({
30
+ title: z.string().min(1).optional(),
31
+ handle: z.string().min(1).optional(),
32
+ descriptionHtml: z.string().optional(),
33
+ vendor: z.string().optional(),
34
+ productType: z.string().optional(),
35
+ tags: z.array(z.string()).optional()
36
+ });
37
+ const listProductsResponseSchema = z.object({ products: shopifyConnectionNodesSchema(shopifyProductSchema) });
38
+ const getProductResponseSchema = z.object({ product: shopifyProductSchema.nullable() });
39
+ const productMutationResponseSchema = z.object({
40
+ product: shopifyProductSchema.nullable(),
41
+ userErrors: z.array(shopifyUserErrorSchema)
42
+ });
43
+ const deleteProductResponseSchema = z.object({
44
+ deletedProductId: shopifyGlobalIdSchema.nullable(),
45
+ userErrors: z.array(shopifyUserErrorSchema)
46
+ });
47
+ const listProducts = shopifyOperation({
48
+ id: "list_shopify_products",
49
+ name: "List Shopify Products",
50
+ description: "List products from the connected Shopify store.",
51
+ input: shopifyPageInputSchema,
52
+ output: shopifyConnectionNodesSchema(shopifyProductSchema),
53
+ run: async (input, credentials) => {
54
+ return (await createShopifyClient(credentials).graphql(`
55
+ query ListProducts($first: Int!, $after: String, $query: String) {
56
+ products(first: $first, after: $after, query: $query) {
57
+ nodes {
58
+ ${productSelection}
59
+ }
60
+ pageInfo {
61
+ hasNextPage
62
+ hasPreviousPage
63
+ startCursor
64
+ endCursor
65
+ }
66
+ }
67
+ }
68
+ `, listProductsResponseSchema, { variables: {
69
+ first: input.first,
70
+ ...input.after ? { after: input.after } : {},
71
+ ...input.query ? { query: input.query } : {}
72
+ } })).products;
73
+ }
74
+ });
75
+ const getProduct = shopifyOperation({
76
+ id: "get_shopify_product",
77
+ name: "Get Shopify Product",
78
+ description: "Retrieve a single Shopify product by its global ID.",
79
+ input: z.object({ id: shopifyGlobalIdSchema }),
80
+ output: shopifyProductSchema,
81
+ run: async (input, credentials) => {
82
+ const response = await createShopifyClient(credentials).graphql(`
83
+ query GetProduct($id: ID!) {
84
+ product(id: $id) {
85
+ ${productSelection}
86
+ }
87
+ }
88
+ `, getProductResponseSchema, { variables: { id: input.id } });
89
+ if (!response.product) throw new Error(`Shopify product not found: ${input.id}`);
90
+ return response.product;
91
+ }
92
+ });
93
+ const createProduct = shopifyOperation({
94
+ id: "create_shopify_product",
95
+ name: "Create Shopify Product",
96
+ description: "Create a product in the connected Shopify store.",
97
+ needsApproval: true,
98
+ input: productMutationInputSchema.extend({ title: z.string().min(1) }),
99
+ output: shopifyProductSchema,
100
+ run: async (input, credentials) => {
101
+ const response = await createShopifyClient(credentials).graphql(`
102
+ mutation CreateProduct($product: ProductCreateInput!) {
103
+ productCreate(product: $product) {
104
+ product {
105
+ ${productSelection}
106
+ }
107
+ userErrors {
108
+ field
109
+ message
110
+ }
111
+ }
112
+ }
113
+ `, z.object({ productCreate: productMutationResponseSchema }), { variables: { product: omitUndefined(input) } });
114
+ assertNoUserErrors(response.productCreate.userErrors);
115
+ if (!response.productCreate.product) throw new Error("Shopify did not return the created product.");
116
+ return response.productCreate.product;
117
+ }
118
+ });
119
+ const updateProduct = shopifyOperation({
120
+ id: "update_shopify_product",
121
+ name: "Update Shopify Product",
122
+ description: "Update a Shopify product by its global ID.",
123
+ needsApproval: true,
124
+ input: productMutationInputSchema.extend({ id: shopifyGlobalIdSchema }),
125
+ output: shopifyProductSchema,
126
+ run: async (input, credentials) => {
127
+ const response = await createShopifyClient(credentials).graphql(`
128
+ mutation UpdateProduct($product: ProductUpdateInput!) {
129
+ productUpdate(product: $product) {
130
+ product {
131
+ ${productSelection}
132
+ }
133
+ userErrors {
134
+ field
135
+ message
136
+ }
137
+ }
138
+ }
139
+ `, z.object({ productUpdate: productMutationResponseSchema }), { variables: { product: omitUndefined(input) } });
140
+ assertNoUserErrors(response.productUpdate.userErrors);
141
+ if (!response.productUpdate.product) throw new Error(`Shopify did not return the updated product: ${input.id}`);
142
+ return response.productUpdate.product;
143
+ }
144
+ });
145
+ const deleteProduct = shopifyOperation({
146
+ id: "delete_shopify_product",
147
+ name: "Delete Shopify Product",
148
+ description: "Delete a Shopify product by its global ID.",
149
+ needsApproval: true,
150
+ input: z.object({ id: shopifyGlobalIdSchema }),
151
+ output: z.object({ deletedProductId: shopifyGlobalIdSchema }),
152
+ run: async (input, credentials) => {
153
+ const response = await createShopifyClient(credentials).graphql(`
154
+ mutation DeleteProduct($input: ProductDeleteInput!) {
155
+ productDelete(input: $input) {
156
+ deletedProductId
157
+ userErrors {
158
+ field
159
+ message
160
+ }
161
+ }
162
+ }
163
+ `, z.object({ productDelete: deleteProductResponseSchema }), { variables: { input: { id: input.id } } });
164
+ assertNoUserErrors(response.productDelete.userErrors);
165
+ if (!response.productDelete.deletedProductId) throw new Error(`Shopify did not confirm product deletion: ${input.id}`);
166
+ return { deletedProductId: response.productDelete.deletedProductId };
167
+ }
168
+ });
169
+
170
+ //#endregion
171
+ export { createProduct, deleteProduct, getProduct, listProducts, updateProduct };
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ import { CredentialSet } from "@keystrokehq/core";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+
6
+ //#region src/_official/provider-app.d.ts
7
+ declare const shopifyAppCredentialSet: CredentialSet<"shopify-app", z.ZodObject<{
8
+ clientId: z.ZodString;
9
+ clientSecret: z.ZodString;
10
+ webhookSecret: z.ZodString;
11
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
12
+ clientId: z.ZodString;
13
+ clientSecret: z.ZodString;
14
+ webhookSecret: z.ZodString;
15
+ }, z.core.$strip>>[] | undefined>;
16
+ declare const shopifyPlatformProviderSeed: {
17
+ readonly provider: "shopify";
18
+ readonly appRef: "shopify-platform";
19
+ readonly displayName: "Shopify Platform";
20
+ readonly credentialSetName: "Keystroke Shopify Platform App";
21
+ readonly envShape: {
22
+ readonly KEYSTROKE_PLATFORM_SHOPIFY_APP_ID: z.ZodOptional<z.ZodString>;
23
+ readonly KEYSTROKE_PLATFORM_SHOPIFY_CLIENT_ID: z.ZodOptional<z.ZodString>;
24
+ readonly KEYSTROKE_PLATFORM_SHOPIFY_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
25
+ readonly KEYSTROKE_PLATFORM_SHOPIFY_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
26
+ };
27
+ readonly requiredEnvKeys: readonly ["KEYSTROKE_PLATFORM_SHOPIFY_APP_ID", "KEYSTROKE_PLATFORM_SHOPIFY_CLIENT_ID", "KEYSTROKE_PLATFORM_SHOPIFY_CLIENT_SECRET", "KEYSTROKE_PLATFORM_SHOPIFY_WEBHOOK_SECRET"];
28
+ readonly externalAppIdEnvKey: "KEYSTROKE_PLATFORM_SHOPIFY_APP_ID";
29
+ readonly buildCredentials: (env: Record<string, string | undefined>) => {
30
+ clientId: string | undefined;
31
+ clientSecret: string | undefined;
32
+ webhookSecret: string | undefined;
33
+ };
34
+ };
35
+ type ShopifyAppCredentials = InferCredentialSetAuth<typeof shopifyAppCredentialSet>;
36
+ //#endregion
37
+ export { shopifyAppCredentialSet as n, shopifyPlatformProviderSeed as r, ShopifyAppCredentials as t };
@@ -0,0 +1,233 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/schemas.d.ts
4
+ declare const shopifyCredentialsSchema: z.ZodObject<{
5
+ SHOPIFY_STORE_DOMAIN: z.ZodString;
6
+ SHOPIFY_ACCESS_TOKEN: z.ZodString;
7
+ }, z.core.$strip>;
8
+ declare const shopifyGlobalIdSchema: z.ZodString;
9
+ declare const shopifyPageInfoSchema: z.ZodObject<{
10
+ hasNextPage: z.ZodBoolean;
11
+ hasPreviousPage: z.ZodOptional<z.ZodBoolean>;
12
+ startCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ endCursor: z.ZodNullable<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ declare function shopifyConnectionNodesSchema<TNode extends z.ZodTypeAny>(node: TNode): z.ZodObject<{
16
+ nodes: z.ZodArray<TNode>;
17
+ pageInfo: z.ZodObject<{
18
+ hasNextPage: z.ZodBoolean;
19
+ hasPreviousPage: z.ZodOptional<z.ZodBoolean>;
20
+ startCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ endCursor: z.ZodNullable<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ }, z.core.$strip>;
24
+ declare const shopifyGraphqlErrorSchema: z.ZodObject<{
25
+ message: z.ZodString;
26
+ path: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
27
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
28
+ }, z.core.$strip>;
29
+ declare const shopifyUserErrorSchema: z.ZodObject<{
30
+ field: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
31
+ message: z.ZodString;
32
+ }, z.core.$strip>;
33
+ declare const shopifyMoneySchema: z.ZodObject<{
34
+ amount: z.ZodString;
35
+ currencyCode: z.ZodString;
36
+ }, z.core.$strip>;
37
+ declare const shopifyMoneyBagSchema: z.ZodObject<{
38
+ shopMoney: z.ZodObject<{
39
+ amount: z.ZodString;
40
+ currencyCode: z.ZodString;
41
+ }, z.core.$strip>;
42
+ presentmentMoney: z.ZodOptional<z.ZodObject<{
43
+ amount: z.ZodString;
44
+ currencyCode: z.ZodString;
45
+ }, z.core.$strip>>;
46
+ }, z.core.$strip>;
47
+ declare const shopifyImageSchema: z.ZodObject<{
48
+ url: z.ZodURL;
49
+ altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$strip>;
51
+ declare const shopifySeoSchema: z.ZodObject<{
52
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ }, z.core.$strip>;
55
+ declare const shopifyMetafieldSchema: z.ZodObject<{
56
+ namespace: z.ZodString;
57
+ key: z.ZodString;
58
+ type: z.ZodOptional<z.ZodString>;
59
+ value: z.ZodNullable<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ declare const shopifyShopSchema: z.ZodObject<{
62
+ id: z.ZodString;
63
+ name: z.ZodString;
64
+ myshopifyDomain: z.ZodString;
65
+ contactEmail: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
66
+ currencyCode: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>;
68
+ declare const shopifyProductSchema: z.ZodObject<{
69
+ id: z.ZodString;
70
+ title: z.ZodString;
71
+ handle: z.ZodString;
72
+ status: z.ZodOptional<z.ZodString>;
73
+ productType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ vendor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
+ descriptionHtml: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ onlineStoreUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
77
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
78
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
79
+ featuredImage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
80
+ url: z.ZodURL;
81
+ altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ }, z.core.$strip>>>;
83
+ seo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
84
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
+ }, z.core.$strip>>>;
87
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ }, z.core.$strip>;
89
+ declare const shopifyCollectionSchema: z.ZodObject<{
90
+ id: z.ZodString;
91
+ title: z.ZodString;
92
+ handle: z.ZodString;
93
+ descriptionHtml: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
95
+ image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
96
+ url: z.ZodURL;
97
+ altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
+ }, z.core.$strip>>>;
99
+ seo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
100
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ }, z.core.$strip>>>;
103
+ }, z.core.$strip>;
104
+ declare const shopifyJobSchema: z.ZodObject<{
105
+ id: z.ZodString;
106
+ done: z.ZodOptional<z.ZodBoolean>;
107
+ }, z.core.$strip>;
108
+ declare const shopifyCustomerSchema: z.ZodObject<{
109
+ id: z.ZodString;
110
+ displayName: z.ZodString;
111
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
+ email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
114
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
116
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
117
+ }, z.core.$strip>;
118
+ declare const shopifyOrderSchema: z.ZodObject<{
119
+ id: z.ZodString;
120
+ name: z.ZodString;
121
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
122
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
123
+ cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
124
+ email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
125
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ displayFinancialStatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ displayFulfillmentStatus: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ currentTotalPriceSet: z.ZodOptional<z.ZodObject<{
130
+ shopMoney: z.ZodObject<{
131
+ amount: z.ZodString;
132
+ currencyCode: z.ZodString;
133
+ }, z.core.$strip>;
134
+ presentmentMoney: z.ZodOptional<z.ZodObject<{
135
+ amount: z.ZodString;
136
+ currencyCode: z.ZodString;
137
+ }, z.core.$strip>>;
138
+ }, z.core.$strip>>;
139
+ customer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
140
+ id: z.ZodString;
141
+ displayName: z.ZodString;
142
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
145
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
147
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
148
+ }, z.core.$strip>>>;
149
+ }, z.core.$strip>;
150
+ declare const shopifyLocationSchema: z.ZodObject<{
151
+ id: z.ZodString;
152
+ name: z.ZodString;
153
+ isActive: z.ZodOptional<z.ZodBoolean>;
154
+ fulfillsOnlineOrders: z.ZodOptional<z.ZodBoolean>;
155
+ }, z.core.$strip>;
156
+ declare const shopifyInventoryItemSchema: z.ZodObject<{
157
+ id: z.ZodString;
158
+ sku: z.ZodOptional<z.ZodNullable<z.ZodString>>;
159
+ tracked: z.ZodOptional<z.ZodBoolean>;
160
+ }, z.core.$strip>;
161
+ declare const shopifyInventoryLevelSchema: z.ZodObject<{
162
+ id: z.ZodString;
163
+ quantities: z.ZodArray<z.ZodObject<{
164
+ name: z.ZodString;
165
+ quantity: z.ZodNumber;
166
+ }, z.core.$strip>>;
167
+ item: z.ZodOptional<z.ZodObject<{
168
+ id: z.ZodString;
169
+ sku: z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
+ tracked: z.ZodOptional<z.ZodBoolean>;
171
+ }, z.core.$strip>>;
172
+ location: z.ZodOptional<z.ZodObject<{
173
+ id: z.ZodString;
174
+ name: z.ZodString;
175
+ isActive: z.ZodOptional<z.ZodBoolean>;
176
+ fulfillsOnlineOrders: z.ZodOptional<z.ZodBoolean>;
177
+ }, z.core.$strip>>;
178
+ }, z.core.$strip>;
179
+ declare const shopifyFulfillmentSchema: z.ZodObject<{
180
+ id: z.ZodString;
181
+ status: z.ZodOptional<z.ZodString>;
182
+ trackingInfo: z.ZodOptional<z.ZodArray<z.ZodObject<{
183
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
184
+ url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
185
+ }, z.core.$strip>>>;
186
+ }, z.core.$strip>;
187
+ declare const shopifyBlogSchema: z.ZodObject<{
188
+ id: z.ZodString;
189
+ title: z.ZodString;
190
+ handle: z.ZodString;
191
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
192
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
193
+ commentPolicy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
194
+ templateSuffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ }, z.core.$strip>;
196
+ declare const shopifyArticleSchema: z.ZodObject<{
197
+ id: z.ZodString;
198
+ title: z.ZodString;
199
+ handle: z.ZodString;
200
+ blog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
201
+ id: z.ZodString;
202
+ title: z.ZodString;
203
+ handle: z.ZodString;
204
+ createdAt: z.ZodOptional<z.ZodISODateTime>;
205
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
206
+ commentPolicy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
207
+ templateSuffix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
208
+ }, z.core.$strip>>>;
209
+ author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
210
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
211
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
212
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
+ image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
214
+ url: z.ZodURL;
215
+ altText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
216
+ }, z.core.$strip>>>;
217
+ publishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
218
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
219
+ }, z.core.$strip>;
220
+ type ShopifyCredentialsShape = z.infer<typeof shopifyCredentialsSchema>;
221
+ type ShopifyShop = z.infer<typeof shopifyShopSchema>;
222
+ type ShopifyProduct = z.infer<typeof shopifyProductSchema>;
223
+ type ShopifyCollection = z.infer<typeof shopifyCollectionSchema>;
224
+ type ShopifyJob = z.infer<typeof shopifyJobSchema>;
225
+ type ShopifyCustomer = z.infer<typeof shopifyCustomerSchema>;
226
+ type ShopifyOrder = z.infer<typeof shopifyOrderSchema>;
227
+ type ShopifyLocation = z.infer<typeof shopifyLocationSchema>;
228
+ type ShopifyInventoryLevel = z.infer<typeof shopifyInventoryLevelSchema>;
229
+ type ShopifyFulfillment = z.infer<typeof shopifyFulfillmentSchema>;
230
+ type ShopifyBlog = z.infer<typeof shopifyBlogSchema>;
231
+ type ShopifyArticle = z.infer<typeof shopifyArticleSchema>;
232
+ //#endregion
233
+ export { ShopifyArticle, ShopifyBlog, ShopifyCollection, ShopifyCredentialsShape, ShopifyCustomer, ShopifyFulfillment, ShopifyInventoryLevel, ShopifyJob, ShopifyLocation, ShopifyOrder, ShopifyProduct, ShopifyShop, shopifyArticleSchema, shopifyBlogSchema, shopifyCollectionSchema, shopifyConnectionNodesSchema, shopifyCredentialsSchema, shopifyCustomerSchema, shopifyFulfillmentSchema, shopifyGlobalIdSchema, shopifyGraphqlErrorSchema, shopifyImageSchema, shopifyInventoryItemSchema, shopifyInventoryLevelSchema, shopifyJobSchema, shopifyLocationSchema, shopifyMetafieldSchema, shopifyMoneyBagSchema, shopifyMoneySchema, shopifyOrderSchema, shopifyPageInfoSchema, shopifyProductSchema, shopifySeoSchema, shopifyShopSchema, shopifyUserErrorSchema };
@@ -0,0 +1,164 @@
1
+ import { i as shopifyStoreDomainSchema } from "./integration-BN3pjCz4.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/schemas.ts
5
+ const shopifyCredentialsSchema = z.object({
6
+ SHOPIFY_STORE_DOMAIN: shopifyStoreDomainSchema,
7
+ SHOPIFY_ACCESS_TOKEN: z.string().min(1)
8
+ });
9
+ const shopifyGlobalIdSchema = z.string().min(1).regex(/^gid:\/\/shopify\//u, "Shopify global IDs must start with \"gid://shopify/\".");
10
+ const shopifyPageInfoSchema = z.object({
11
+ hasNextPage: z.boolean(),
12
+ hasPreviousPage: z.boolean().optional(),
13
+ startCursor: z.string().nullable().optional(),
14
+ endCursor: z.string().nullable()
15
+ });
16
+ function shopifyConnectionNodesSchema(node) {
17
+ return z.object({
18
+ nodes: z.array(node),
19
+ pageInfo: shopifyPageInfoSchema
20
+ });
21
+ }
22
+ const shopifyGraphqlErrorSchema = z.object({
23
+ message: z.string(),
24
+ path: z.array(z.union([z.string(), z.number()])).optional(),
25
+ extensions: z.record(z.string(), z.unknown()).optional()
26
+ });
27
+ const shopifyUserErrorSchema = z.object({
28
+ field: z.array(z.string()).nullable().optional(),
29
+ message: z.string()
30
+ });
31
+ const shopifyMoneySchema = z.object({
32
+ amount: z.string(),
33
+ currencyCode: z.string()
34
+ });
35
+ const shopifyMoneyBagSchema = z.object({
36
+ shopMoney: shopifyMoneySchema,
37
+ presentmentMoney: shopifyMoneySchema.optional()
38
+ });
39
+ const shopifyImageSchema = z.object({
40
+ url: z.url(),
41
+ altText: z.string().nullable().optional()
42
+ });
43
+ const shopifySeoSchema = z.object({
44
+ title: z.string().nullable().optional(),
45
+ description: z.string().nullable().optional()
46
+ });
47
+ const shopifyMetafieldSchema = z.object({
48
+ namespace: z.string(),
49
+ key: z.string(),
50
+ type: z.string().optional(),
51
+ value: z.string().nullable()
52
+ });
53
+ const shopifyShopSchema = z.object({
54
+ id: shopifyGlobalIdSchema,
55
+ name: z.string(),
56
+ myshopifyDomain: shopifyStoreDomainSchema,
57
+ contactEmail: z.email().nullable().optional(),
58
+ currencyCode: z.string().optional()
59
+ });
60
+ const shopifyProductSchema = z.object({
61
+ id: shopifyGlobalIdSchema,
62
+ title: z.string(),
63
+ handle: z.string(),
64
+ status: z.string().optional(),
65
+ productType: z.string().nullable().optional(),
66
+ vendor: z.string().nullable().optional(),
67
+ descriptionHtml: z.string().nullable().optional(),
68
+ onlineStoreUrl: z.url().nullable().optional(),
69
+ createdAt: z.iso.datetime().optional(),
70
+ updatedAt: z.iso.datetime().optional(),
71
+ featuredImage: shopifyImageSchema.nullable().optional(),
72
+ seo: shopifySeoSchema.nullable().optional(),
73
+ tags: z.array(z.string()).optional()
74
+ });
75
+ const shopifyCollectionSchema = z.object({
76
+ id: shopifyGlobalIdSchema,
77
+ title: z.string(),
78
+ handle: z.string(),
79
+ descriptionHtml: z.string().nullable().optional(),
80
+ updatedAt: z.iso.datetime().optional(),
81
+ image: shopifyImageSchema.nullable().optional(),
82
+ seo: shopifySeoSchema.nullable().optional()
83
+ });
84
+ const shopifyJobSchema = z.object({
85
+ id: shopifyGlobalIdSchema,
86
+ done: z.boolean().optional()
87
+ });
88
+ const shopifyCustomerSchema = z.object({
89
+ id: shopifyGlobalIdSchema,
90
+ displayName: z.string(),
91
+ firstName: z.string().nullable().optional(),
92
+ lastName: z.string().nullable().optional(),
93
+ email: z.email().nullable().optional(),
94
+ phone: z.string().nullable().optional(),
95
+ createdAt: z.iso.datetime().optional(),
96
+ updatedAt: z.iso.datetime().optional()
97
+ });
98
+ const shopifyOrderSchema = z.object({
99
+ id: shopifyGlobalIdSchema,
100
+ name: z.string(),
101
+ createdAt: z.iso.datetime().optional(),
102
+ updatedAt: z.iso.datetime().optional(),
103
+ cancelledAt: z.iso.datetime().nullable().optional(),
104
+ email: z.email().nullable().optional(),
105
+ note: z.string().nullable().optional(),
106
+ tags: z.array(z.string()).optional(),
107
+ displayFinancialStatus: z.string().nullable().optional(),
108
+ displayFulfillmentStatus: z.string().nullable().optional(),
109
+ currentTotalPriceSet: shopifyMoneyBagSchema.optional(),
110
+ customer: shopifyCustomerSchema.nullable().optional()
111
+ });
112
+ const shopifyLocationSchema = z.object({
113
+ id: shopifyGlobalIdSchema,
114
+ name: z.string(),
115
+ isActive: z.boolean().optional(),
116
+ fulfillsOnlineOrders: z.boolean().optional()
117
+ });
118
+ const shopifyInventoryItemSchema = z.object({
119
+ id: shopifyGlobalIdSchema,
120
+ sku: z.string().nullable().optional(),
121
+ tracked: z.boolean().optional()
122
+ });
123
+ const shopifyInventoryLevelSchema = z.object({
124
+ id: shopifyGlobalIdSchema,
125
+ quantities: z.array(z.object({
126
+ name: z.string(),
127
+ quantity: z.number()
128
+ })),
129
+ item: shopifyInventoryItemSchema.optional(),
130
+ location: shopifyLocationSchema.optional()
131
+ });
132
+ const shopifyFulfillmentSchema = z.object({
133
+ id: shopifyGlobalIdSchema,
134
+ status: z.string().optional(),
135
+ trackingInfo: z.array(z.object({
136
+ number: z.string().nullable().optional(),
137
+ url: z.url().nullable().optional()
138
+ })).optional()
139
+ });
140
+ const shopifyBlogSchema = z.object({
141
+ id: shopifyGlobalIdSchema,
142
+ title: z.string(),
143
+ handle: z.string(),
144
+ createdAt: z.iso.datetime().optional(),
145
+ updatedAt: z.iso.datetime().optional(),
146
+ commentPolicy: z.string().nullable().optional(),
147
+ templateSuffix: z.string().nullable().optional()
148
+ });
149
+ const shopifyArticleSchema = z.object({
150
+ id: shopifyGlobalIdSchema,
151
+ title: z.string(),
152
+ handle: z.string(),
153
+ blog: shopifyBlogSchema.nullable().optional(),
154
+ author: z.string().nullable().optional(),
155
+ body: z.string().nullable().optional(),
156
+ summary: z.string().nullable().optional(),
157
+ tags: z.array(z.string()).optional(),
158
+ image: shopifyImageSchema.nullable().optional(),
159
+ publishedAt: z.iso.datetime().nullable().optional(),
160
+ updatedAt: z.iso.datetime().optional()
161
+ });
162
+
163
+ //#endregion
164
+ export { shopifyArticleSchema, shopifyBlogSchema, shopifyCollectionSchema, shopifyConnectionNodesSchema, shopifyCredentialsSchema, shopifyCustomerSchema, shopifyFulfillmentSchema, shopifyGlobalIdSchema, shopifyGraphqlErrorSchema, shopifyImageSchema, shopifyInventoryItemSchema, shopifyInventoryLevelSchema, shopifyJobSchema, shopifyLocationSchema, shopifyMetafieldSchema, shopifyMoneyBagSchema, shopifyMoneySchema, shopifyOrderSchema, shopifyPageInfoSchema, shopifyProductSchema, shopifySeoSchema, shopifyShopSchema, shopifyUserErrorSchema };
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+
5
+ //#region src/shop.d.ts
6
+ declare const getShop: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodString;
9
+ myshopifyDomain: z.ZodString;
10
+ contactEmail: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
11
+ currencyCode: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"shopify", z.ZodObject<{
13
+ SHOPIFY_STORE_DOMAIN: z.ZodString;
14
+ SHOPIFY_ACCESS_TOKEN: z.ZodString;
15
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
16
+ SHOPIFY_STORE_DOMAIN: z.ZodString;
17
+ SHOPIFY_ACCESS_TOKEN: z.ZodString;
18
+ }, z.core.$strip>>[] | undefined>], undefined>;
19
+ //#endregion
20
+ export { getShop };
package/dist/shop.mjs ADDED
@@ -0,0 +1,31 @@
1
+ import { shopifyShopSchema } from "./schemas.mjs";
2
+ import { createShopifyClient } from "./client.mjs";
3
+ import { t as shopifyOperation } from "./factory-DC-gY8L0.mjs";
4
+ import { z } from "zod";
5
+
6
+ //#region src/shop.ts
7
+ const getShopResponseSchema = z.object({ shop: shopifyShopSchema });
8
+ const getShopQuery = `
9
+ query GetShop {
10
+ shop {
11
+ id
12
+ name
13
+ myshopifyDomain
14
+ contactEmail
15
+ currencyCode
16
+ }
17
+ }
18
+ `;
19
+ const getShop = shopifyOperation({
20
+ id: "get_shopify_shop",
21
+ name: "Get Shopify Shop",
22
+ description: "Retrieve high-level details about the connected Shopify store.",
23
+ input: z.object({}),
24
+ output: shopifyShopSchema,
25
+ run: async (_input, credentials) => {
26
+ return (await createShopifyClient(credentials).graphql(getShopQuery, getShopResponseSchema)).shop;
27
+ }
28
+ });
29
+
30
+ //#endregion
31
+ export { getShop };
@@ -0,0 +1,23 @@
1
+ import { n as shopify } from "./integration-BwDBsGX-.mjs";
2
+ import { n as shopifyAppCredentialSet } from "./provider-app-DHxVZI6q.mjs";
3
+ import { ShopifyOrderCancelledEvent, ShopifyOrderCreatedEvent, ShopifyOrderFulfilledEvent, ShopifyOrderUpdatedEvent, ShopifyProductCreatedEvent, ShopifyProductDeletedEvent, ShopifyProductUpdatedEvent, shopifyOrderWebhookPayloadSchema, shopifyProductWebhookPayloadSchema } from "./events.mjs";
4
+ import { z } from "zod";
5
+ import { BoundTrigger, WebhookRequest } from "@keystrokehq/core";
6
+ import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
7
+ import { WebhookTriggerManifest } from "@keystrokehq/core/trigger";
8
+
9
+ //#region src/triggers.d.ts
10
+ type ShopifyWebhookCredentialSets = readonly [typeof shopify, typeof shopifyAppCredentialSet];
11
+ type ShopifyWebhookBindingOptions<TEvent, TOutput = TEvent> = IntegrationTriggerBindingOptions<TEvent, TOutput, WebhookRequest>;
12
+ type ShopifyWebhookBinding<TPayloadSchema extends z.ZodTypeAny, TEvent> = <TOutput = TEvent>(options?: ShopifyWebhookBindingOptions<TEvent, TOutput>) => BoundTrigger<z.output<TPayloadSchema>, ShopifyWebhookCredentialSets, WebhookTriggerManifest, TOutput, WebhookRequest>;
13
+ declare const webhooks: Readonly<{
14
+ productCreated: ShopifyWebhookBinding<typeof shopifyProductWebhookPayloadSchema, ShopifyProductCreatedEvent>;
15
+ productUpdated: ShopifyWebhookBinding<typeof shopifyProductWebhookPayloadSchema, ShopifyProductUpdatedEvent>;
16
+ productDeleted: ShopifyWebhookBinding<typeof shopifyProductWebhookPayloadSchema, ShopifyProductDeletedEvent>;
17
+ orderCreated: ShopifyWebhookBinding<typeof shopifyOrderWebhookPayloadSchema, ShopifyOrderCreatedEvent>;
18
+ orderUpdated: ShopifyWebhookBinding<typeof shopifyOrderWebhookPayloadSchema, ShopifyOrderUpdatedEvent>;
19
+ orderCancelled: ShopifyWebhookBinding<typeof shopifyOrderWebhookPayloadSchema, ShopifyOrderCancelledEvent>;
20
+ orderFulfilled: ShopifyWebhookBinding<typeof shopifyOrderWebhookPayloadSchema, ShopifyOrderFulfilledEvent>;
21
+ }>;
22
+ //#endregion
23
+ export { webhooks };