@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,181 @@
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 };
@@ -0,0 +1,67 @@
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 };
@@ -0,0 +1,8 @@
1
+ import { t as shopify } from "./integration-BN3pjCz4.mjs";
2
+ import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
3
+
4
+ //#region src/factory.ts
5
+ const shopifyOperation = createOfficialOperationFactory(shopify);
6
+
7
+ //#endregion
8
+ export { shopifyOperation as t };
@@ -0,0 +1,99 @@
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/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 };
@@ -0,0 +1,167 @@
1
+ import { shopifyConnectionNodesSchema, shopifyFulfillmentSchema, shopifyGlobalIdSchema, shopifyLocationSchema, shopifyUserErrorSchema } from "./schemas.mjs";
2
+ import { createShopifyClient } from "./client.mjs";
3
+ import { t as shopifyOperation } from "./factory-DC-gY8L0.mjs";
4
+ import { t as assertNoUserErrors } from "./operation-helpers-CKEDIx0o.mjs";
5
+ import { z } from "zod";
6
+
7
+ //#region src/fulfillments.ts
8
+ const fulfillmentSelection = `
9
+ id
10
+ status
11
+ trackingInfo {
12
+ number
13
+ url
14
+ }
15
+ `;
16
+ const fulfillmentOrderLineItemSchema = z.object({
17
+ id: shopifyGlobalIdSchema,
18
+ remainingQuantity: z.number().int(),
19
+ lineItem: z.object({
20
+ id: shopifyGlobalIdSchema,
21
+ name: z.string(),
22
+ quantity: z.number().int()
23
+ }).nullable().optional()
24
+ });
25
+ const fulfillmentOrderSchema = z.object({
26
+ id: shopifyGlobalIdSchema,
27
+ status: z.string(),
28
+ assignedLocation: z.object({ location: shopifyLocationSchema.nullable().optional() }).nullable().optional(),
29
+ lineItems: shopifyConnectionNodesSchema(fulfillmentOrderLineItemSchema)
30
+ });
31
+ const fulfillmentOrderConnectionSchema = z.object({ order: z.object({ fulfillmentOrders: shopifyConnectionNodesSchema(fulfillmentOrderSchema) }).nullable() });
32
+ const fulfillmentResponseSchema = z.object({ fulfillment: shopifyFulfillmentSchema.nullable() });
33
+ const fulfillmentCreatePayloadSchema = z.object({
34
+ fulfillment: shopifyFulfillmentSchema.nullable(),
35
+ userErrors: z.array(shopifyUserErrorSchema)
36
+ });
37
+ const listFulfillmentOrdersForOrder = shopifyOperation({
38
+ id: "list_shopify_fulfillment_orders_for_order",
39
+ name: "List Shopify Fulfillment Orders For Order",
40
+ description: "List fulfillment orders for a Shopify order so they can be fulfilled.",
41
+ input: z.object({
42
+ orderId: shopifyGlobalIdSchema,
43
+ first: z.number().int().min(1).max(100).optional().default(25),
44
+ after: z.string().optional()
45
+ }),
46
+ output: shopifyConnectionNodesSchema(fulfillmentOrderSchema),
47
+ run: async (input, credentials) => {
48
+ const response = await createShopifyClient(credentials).graphql(`
49
+ query ListFulfillmentOrdersForOrder($id: ID!, $first: Int!, $after: String) {
50
+ order(id: $id) {
51
+ fulfillmentOrders(first: $first, after: $after) {
52
+ nodes {
53
+ id
54
+ status
55
+ assignedLocation {
56
+ location {
57
+ id
58
+ name
59
+ isActive
60
+ fulfillsOnlineOrders
61
+ }
62
+ }
63
+ lineItems(first: 50) {
64
+ nodes {
65
+ id
66
+ remainingQuantity
67
+ lineItem {
68
+ id
69
+ name
70
+ quantity
71
+ }
72
+ }
73
+ pageInfo {
74
+ hasNextPage
75
+ hasPreviousPage
76
+ startCursor
77
+ endCursor
78
+ }
79
+ }
80
+ }
81
+ pageInfo {
82
+ hasNextPage
83
+ hasPreviousPage
84
+ startCursor
85
+ endCursor
86
+ }
87
+ }
88
+ }
89
+ }
90
+ `, fulfillmentOrderConnectionSchema, { variables: {
91
+ id: input.orderId,
92
+ first: input.first,
93
+ ...input.after ? { after: input.after } : {}
94
+ } });
95
+ if (!response.order) throw new Error(`Shopify order not found for fulfillment orders lookup: ${input.orderId}`);
96
+ return response.order.fulfillmentOrders;
97
+ }
98
+ });
99
+ const getFulfillment = shopifyOperation({
100
+ id: "get_shopify_fulfillment",
101
+ name: "Get Shopify Fulfillment",
102
+ description: "Retrieve a single Shopify fulfillment by its global ID.",
103
+ input: z.object({ id: shopifyGlobalIdSchema }),
104
+ output: shopifyFulfillmentSchema,
105
+ run: async (input, credentials) => {
106
+ const response = await createShopifyClient(credentials).graphql(`
107
+ query GetFulfillment($id: ID!) {
108
+ fulfillment(id: $id) {
109
+ ${fulfillmentSelection}
110
+ }
111
+ }
112
+ `, fulfillmentResponseSchema, { variables: { id: input.id } });
113
+ if (!response.fulfillment) throw new Error(`Shopify fulfillment not found: ${input.id}`);
114
+ return response.fulfillment;
115
+ }
116
+ });
117
+ const createFulfillment = shopifyOperation({
118
+ id: "create_shopify_fulfillment",
119
+ name: "Create Shopify Fulfillment",
120
+ description: "Create a fulfillment from one or more Shopify fulfillment orders.",
121
+ needsApproval: true,
122
+ input: z.object({
123
+ lineItemsByFulfillmentOrder: z.array(z.object({
124
+ fulfillmentOrderId: shopifyGlobalIdSchema,
125
+ fulfillmentOrderLineItems: z.array(z.object({
126
+ id: shopifyGlobalIdSchema,
127
+ quantity: z.number().int().min(1)
128
+ })).optional()
129
+ })).min(1),
130
+ notifyCustomer: z.boolean().optional(),
131
+ message: z.string().optional(),
132
+ trackingInfo: z.object({
133
+ company: z.string().optional(),
134
+ number: z.string().optional(),
135
+ url: z.url().optional()
136
+ }).optional()
137
+ }),
138
+ output: shopifyFulfillmentSchema,
139
+ run: async (input, credentials) => {
140
+ const response = await createShopifyClient(credentials).graphql(`
141
+ mutation CreateFulfillment($fulfillment: FulfillmentInput!, $message: String) {
142
+ fulfillmentCreate(fulfillment: $fulfillment, message: $message) {
143
+ fulfillment {
144
+ ${fulfillmentSelection}
145
+ }
146
+ userErrors {
147
+ field
148
+ message
149
+ }
150
+ }
151
+ }
152
+ `, z.object({ fulfillmentCreate: fulfillmentCreatePayloadSchema }), { variables: {
153
+ fulfillment: {
154
+ lineItemsByFulfillmentOrder: input.lineItemsByFulfillmentOrder,
155
+ notifyCustomer: input.notifyCustomer,
156
+ trackingInfo: input.trackingInfo
157
+ },
158
+ ...input.message ? { message: input.message } : {}
159
+ } });
160
+ assertNoUserErrors(response.fulfillmentCreate.userErrors);
161
+ if (!response.fulfillmentCreate.fulfillment) throw new Error("Shopify did not return the created fulfillment.");
162
+ return response.fulfillmentCreate.fulfillment;
163
+ }
164
+ });
165
+
166
+ //#endregion
167
+ export { createFulfillment, getFulfillment, listFulfillmentOrdersForOrder };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };