@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.
Files changed (52) hide show
  1. package/README.md +14 -153
  2. package/dist/{schemas.d.mts → common-C2s35du9.d.mts} +3 -2
  3. package/dist/{schemas.mjs → common-JZyHdK6p.mjs} +3 -3
  4. package/dist/credential-sets/index.d.mts +2 -0
  5. package/dist/credential-sets/index.mjs +4 -0
  6. package/dist/index.d.mts +4 -1
  7. package/dist/index.mjs +6 -1
  8. package/dist/operations/index.d.mts +2 -0
  9. package/dist/operations/index.mjs +3 -0
  10. package/dist/schemas/index.d.mts +2 -0
  11. package/dist/schemas/index.mjs +3 -0
  12. package/dist/shopify-app.credential-set-DuAYUhzY.d.mts +65 -0
  13. package/dist/shopify-app.credential-set-M3vKwTji.mjs +17 -0
  14. package/dist/{integration-vSl3XHTG.mjs → shopify.credential-set-CaxST3GP.mjs} +6 -141
  15. package/dist/update-shopify-product.operation-ByYhZggW.mjs +1972 -0
  16. package/dist/update-shopify-product.operation-Db_kLuJa.d.mts +2817 -0
  17. package/package.json +11 -67
  18. package/dist/_official/index.d.mts +0 -38
  19. package/dist/_official/index.mjs +0 -3
  20. package/dist/_runtime/index.d.mts +0 -56
  21. package/dist/_runtime/index.mjs +0 -150
  22. package/dist/articles.d.mts +0 -174
  23. package/dist/articles.mjs +0 -252
  24. package/dist/blogs.d.mts +0 -113
  25. package/dist/blogs.mjs +0 -174
  26. package/dist/client.d.mts +0 -22
  27. package/dist/client.mjs +0 -90
  28. package/dist/collections.d.mts +0 -140
  29. package/dist/collections.mjs +0 -209
  30. package/dist/connection.d.mts +0 -2
  31. package/dist/connection.mjs +0 -3
  32. package/dist/customers.d.mts +0 -161
  33. package/dist/customers.mjs +0 -225
  34. package/dist/events.d.mts +0 -181
  35. package/dist/events.mjs +0 -67
  36. package/dist/factory-BKmxl2-8.mjs +0 -7
  37. package/dist/fulfillments.d.mts +0 -99
  38. package/dist/fulfillments.mjs +0 -167
  39. package/dist/integration-HrSKAMfF.d.mts +0 -70
  40. package/dist/inventory.d.mts +0 -103
  41. package/dist/inventory.mjs +0 -182
  42. package/dist/locations.d.mts +0 -47
  43. package/dist/locations.mjs +0 -81
  44. package/dist/messaging.d.mts +0 -1
  45. package/dist/messaging.mjs +0 -1
  46. package/dist/operation-helpers-CKEDIx0o.mjs +0 -21
  47. package/dist/orders.d.mts +0 -229
  48. package/dist/orders.mjs +0 -271
  49. package/dist/products.d.mts +0 -155
  50. package/dist/products.mjs +0 -171
  51. package/dist/shop.d.mts +0 -20
  52. package/dist/shop.mjs +0 -31
package/README.md CHANGED
@@ -1,35 +1,25 @@
1
1
  # @keystrokehq/shopify
2
2
 
3
- Shopify Admin API integration for Keystroke workflows.
3
+ Shopify Admin API integration for Keystroke workflows. The package follows the canonical Playbook 18 **strict** shape: credential sets and operations are discovered from source primitives, while `src/provider-apps/` retains the platform provider-app seed descriptor.
4
4
 
5
- The package root is intentionally non-canonical. Import from explicit subpaths.
5
+ Per-store `SHOPIFY_STORE_DOMAIN` and `SHOPIFY_ACCESS_TOKEN` fields are required on the user credential set. OAuth uses shop-domain templating via `src/utils/oauth-connection.ts`. Webhook subscription helpers live in `src/utils/webhook-management.ts` (not catalog operations).
6
6
 
7
7
  ## Public Subpaths
8
8
 
9
- - `@keystrokehq/shopify/connection`
10
- - `@keystrokehq/shopify/client`
9
+ - `@keystrokehq/shopify` — root barrel (`credential-sets`, `operations`, `schemas`)
10
+ - `@keystrokehq/shopify/credential-sets`
11
+ - `@keystrokehq/shopify/operations`
11
12
  - `@keystrokehq/shopify/schemas`
12
- - `@keystrokehq/shopify/events`
13
- - `@keystrokehq/shopify/shop`
14
- - `@keystrokehq/shopify/products`
15
- - `@keystrokehq/shopify/collections`
16
- - `@keystrokehq/shopify/orders`
17
- - `@keystrokehq/shopify/customers`
18
- - `@keystrokehq/shopify/blogs`
19
- - `@keystrokehq/shopify/articles`
20
- - `@keystrokehq/shopify/locations`
21
- - `@keystrokehq/shopify/inventory`
22
- - `@keystrokehq/shopify/fulfillments`
23
- - `@keystrokehq/shopify/triggers`
13
+ - `catalog discovery via `src/provider-apps/`` — provider seed descriptor only
24
14
 
25
15
  ## Read Store Data
26
16
 
27
17
  ```ts
28
18
  import { Workflow } from '@keystrokehq/core';
29
19
  import { z } from 'zod';
30
- import { shopify } from '@keystrokehq/shopify/connection';
31
- import { getShop } from '@keystrokehq/shopify/shop';
32
- import { listProducts } from '@keystrokehq/shopify/products';
20
+ import { shopifyCredentialSet } from '@keystrokehq/shopify/credential-sets';
21
+ import { getShopOperation } from '@keystrokehq/shopify/operations';
22
+ import { listProductsOperation } from '@keystrokehq/shopify/operations';
33
23
 
34
24
  export const syncCatalog = new Workflow({
35
25
  id: 'sync-shopify-catalog',
@@ -40,139 +30,10 @@ export const syncCatalog = new Workflow({
40
30
  storeName: z.string(),
41
31
  productCount: z.number(),
42
32
  }),
43
- run: async () => {
44
- const store = await getShop.run({});
45
- const products = await listProducts.run({
46
- first: 25,
47
- query: 'status:active',
48
- });
49
-
50
- return {
51
- credentialSetId: shopify.resolvedCredentialSetId,
52
- storeName: store.name,
53
- productCount: products.nodes.length,
54
- };
55
- },
56
- });
57
- ```
58
-
59
- ## Create Orders And Adjust Inventory
60
-
61
- ```ts
62
- import { Workflow } from '@keystrokehq/core';
63
- import { z } from 'zod';
64
- import { createOrder } from '@keystrokehq/shopify/orders';
65
- import { adjustInventoryQuantities } from '@keystrokehq/shopify/inventory';
66
-
67
- export const backofficeWriteFlow = new Workflow({
68
- id: 'shopify-backoffice-write-flow',
69
- name: 'Shopify Backoffice Write Flow',
70
- input: z.object({ variantId: z.string(), inventoryItemId: z.string(), locationId: z.string() }),
71
- output: z.object({ queued: z.boolean() }),
72
- run: async (input) => {
73
- await createOrder.run({
74
- currency: 'USD',
75
- email: 'buyer@example.com',
76
- lineItems: [
77
- {
78
- variantId: input.variantId,
79
- quantity: 1,
80
- },
81
- ],
82
- });
83
-
84
- await adjustInventoryQuantities.run({
85
- reason: 'correction',
86
- referenceDocumentUri: 'gid://keystroke/inventory-adjustment/docs-example',
87
- changes: [
88
- {
89
- inventoryItemId: input.inventoryItemId,
90
- locationId: input.locationId,
91
- delta: -1,
92
- },
93
- ],
94
- });
95
-
96
- return { queued: true };
97
- },
33
+ steps: [
34
+ getShopOperation.asStep('shop'),
35
+ listProductsOperation.asStep('products'),
36
+ ],
37
+ credentialSets: [shopifyCredentialSet],
98
38
  });
99
39
  ```
100
-
101
- ## Bind Webhook Triggers
102
-
103
- ```ts
104
- import { Workflow } from '@keystrokehq/core';
105
- import { z } from 'zod';
106
- import { webhooks } from '@keystrokehq/shopify/triggers';
107
-
108
- const orderCreated = webhooks.orderCreated({
109
- name: 'Shopify Order Created',
110
- transform: (event) => ({
111
- orderId: event.resourceId ?? event.payload.admin_graphql_api_id ?? '',
112
- topic: event.topic,
113
- }),
114
- });
115
-
116
- export const onNewShopifyOrder = new Workflow({
117
- id: 'on-new-shopify-order',
118
- name: 'On New Shopify Order',
119
- input: z.object({
120
- orderId: z.string(),
121
- topic: z.literal('orders/create'),
122
- }),
123
- output: z.object({ ok: z.boolean() }),
124
- triggers: [orderCreated],
125
- run: async () => ({ ok: true }),
126
- });
127
- ```
128
-
129
- ## Notes
130
-
131
- - Mutating operations are marked with `needsApproval: true`.
132
- - Shopify webhook helpers are direct-binding surfaces under `@keystrokehq/shopify/triggers`.
133
- - Hidden `_official` and `_runtime` exports are for repo internals, not workflow authoring.
134
-
135
- ## Live Test Runbook
136
-
137
- The Shopify package now has dedicated `test:int` coverage for every exported operation plus live webhook subscription management:
138
-
139
- - `shop.int.test.ts`
140
- - `products.int.test.ts`
141
- - `collections.int.test.ts`
142
- - `customers.int.test.ts`
143
- - `blogs.int.test.ts`
144
- - `articles.int.test.ts`
145
- - `orders.int.test.ts`
146
- - `inventory.int.test.ts`
147
- - `locations.int.test.ts`
148
- - `fulfillments.int.test.ts`
149
- - `webhook-management.int.test.ts`
150
-
151
- Set up `.env.test` with at least:
152
-
153
- - `RUN_LIVE_INT=true`
154
- - `SHOPIFY_LIVE_STORE_DOMAIN`
155
- - `SHOPIFY_LIVE_ACCESS_TOKEN`
156
- - `SHOPIFY_LIVE_REFRESH_TOKEN` for control-plane refresh coverage
157
- - `PUBLIC_SERVER_URL` for webhook subscription coverage
158
- - `KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID`
159
- - `KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_ID`
160
- - `KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_SECRET`
161
- - `KEYSTROKE_OFFICIAL_SHOPIFY_WEBHOOK_SECRET`
162
-
163
- Recommended execution flow:
164
-
165
- ```bash
166
- pnpm test:int:wiring
167
- pnpm --filter @keystrokehq/shopify test:int
168
- pnpm --filter @keystroke/server test:int
169
- pnpm --filter @keystroke/control-plane test:int
170
- ```
171
-
172
- Operational guidance:
173
-
174
- - Use a dedicated disposable dev store. `orders`, `inventory`, `fulfillments`, and webhook tests are destructive by design.
175
- - Keep `PUBLIC_SERVER_URL` pointed at a real public tunnel or staging URL when exercising webhook subscription or OAuth callback flows.
176
- - The package test helpers try to clean up created products, collections, blogs, articles, and order-free customers automatically.
177
- - Orders with fulfillment history and customers with placed orders should be treated as disposable-store artifacts rather than shared-environment fixtures.
178
- - Shopify webhook subscription management requires `read_webhooks` and `write_webhooks` scopes in addition to the Admin API scopes used by the operation surface.
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
 
3
- //#region src/schemas.d.ts
3
+ //#region src/schemas/common.d.ts
4
+ declare const shopifyStoreDomainSchema: z.ZodString;
4
5
  declare const shopifyCredentialsSchema: z.ZodObject<{
5
6
  SHOPIFY_STORE_DOMAIN: z.ZodString;
6
7
  SHOPIFY_ACCESS_TOKEN: z.ZodString;
@@ -230,4 +231,4 @@ type ShopifyFulfillment = z.infer<typeof shopifyFulfillmentSchema>;
230
231
  type ShopifyBlog = z.infer<typeof shopifyBlogSchema>;
231
232
  type ShopifyArticle = z.infer<typeof shopifyArticleSchema>;
232
233
  //#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 };
234
+ export { shopifyOrderSchema as A, shopifyInventoryItemSchema as C, shopifyMetafieldSchema as D, shopifyLocationSchema as E, shopifyStoreDomainSchema as F, shopifyUserErrorSchema as I, shopifyProductSchema as M, shopifySeoSchema as N, shopifyMoneyBagSchema as O, shopifyShopSchema as P, shopifyImageSchema as S, shopifyJobSchema as T, shopifyCredentialsSchema as _, ShopifyCustomer as a, shopifyGlobalIdSchema as b, ShopifyJob as c, ShopifyProduct as d, ShopifyShop as f, shopifyConnectionNodesSchema as g, shopifyCollectionSchema as h, ShopifyCredentialsShape as i, shopifyPageInfoSchema as j, shopifyMoneySchema as k, ShopifyLocation as l, shopifyBlogSchema as m, ShopifyBlog as n, ShopifyFulfillment as o, shopifyArticleSchema as p, ShopifyCollection as r, ShopifyInventoryLevel as s, ShopifyArticle as t, ShopifyOrder as u, shopifyCustomerSchema as v, shopifyInventoryLevelSchema as w, shopifyGraphqlErrorSchema as x, shopifyFulfillmentSchema as y };
@@ -1,7 +1,7 @@
1
- import { i as shopifyStoreDomainSchema } from "./integration-vSl3XHTG.mjs";
2
1
  import { z } from "zod";
3
2
 
4
- //#region src/schemas.ts
3
+ //#region src/schemas/common.ts
4
+ const shopifyStoreDomainSchema = z.string().min(1).regex(/^[a-z0-9][a-z0-9-]*\.myshopify\.com$/i, "Shopify store domain must look like \"example.myshopify.com\".");
5
5
  const shopifyCredentialsSchema = z.object({
6
6
  SHOPIFY_STORE_DOMAIN: shopifyStoreDomainSchema,
7
7
  SHOPIFY_ACCESS_TOKEN: z.string().min(1)
@@ -161,4 +161,4 @@ const shopifyArticleSchema = z.object({
161
161
  });
162
162
 
163
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 };
164
+ export { shopifyStoreDomainSchema as C, shopifyShopSchema as S, shopifyMoneySchema as _, shopifyCredentialsSchema as a, shopifyProductSchema as b, shopifyGlobalIdSchema as c, shopifyInventoryItemSchema as d, shopifyInventoryLevelSchema as f, shopifyMoneyBagSchema as g, shopifyMetafieldSchema as h, shopifyConnectionNodesSchema as i, shopifyGraphqlErrorSchema as l, shopifyLocationSchema as m, shopifyBlogSchema as n, shopifyCustomerSchema as o, shopifyJobSchema as p, shopifyCollectionSchema as r, shopifyFulfillmentSchema as s, shopifyArticleSchema as t, shopifyImageSchema as u, shopifyOrderSchema as v, shopifyUserErrorSchema as w, shopifySeoSchema as x, shopifyPageInfoSchema as y };
@@ -0,0 +1,2 @@
1
+ import { i as shopifyCredentialSet, n as shopifyAppCredentialSet, r as ShopifyCredentials, t as ShopifyAppCredentials } from "../shopify-app.credential-set-DuAYUhzY.mjs";
2
+ export { type ShopifyAppCredentials, type ShopifyCredentials, shopifyAppCredentialSet, shopifyCredentialSet };
@@ -0,0 +1,4 @@
1
+ import { t as shopifyCredentialSet } from "../shopify.credential-set-CaxST3GP.mjs";
2
+ import { t as shopifyAppCredentialSet } from "../shopify-app.credential-set-M3vKwTji.mjs";
3
+
4
+ export { shopifyAppCredentialSet, shopifyCredentialSet };
package/dist/index.d.mts CHANGED
@@ -1 +1,4 @@
1
- export { };
1
+ import { i as shopifyCredentialSet, n as shopifyAppCredentialSet, r as ShopifyCredentials, t as ShopifyAppCredentials } from "./shopify-app.credential-set-DuAYUhzY.mjs";
2
+ import { A as deleteCollectionOperation, B as cancelOrderOperation, C as getCustomerOrdersOperation, D as getArticleOperation, E as getBlogOperation, F as createFulfillmentOperation, H as addProductsToCollectionOperation, I as createCustomerOperation, L as createCollectionOperation, M as deleteArticleOperation, N as createProductOperation, O as deleteProductOperation, P as createOrderOperation, R as createBlogOperation, S as getFulfillmentOperation, T as getCollectionOperation, V as adjustInventoryQuantitiesOperation, _ as getProductOperation, a as updateArticleOperation, b as getInventoryLevelsForItemOperation, c as listOrdersOperation, d as listFulfillmentOrdersForOrderOperation, f as listCustomersOperation, g as getShopOperation, h as listArticlesOperation, i as updateBlogOperation, j as deleteBlogOperation, k as deleteCustomerOperation, l as listLocationsOperation, m as listBlogsOperation, n as updateOrderOperation, o as removeProductsFromCollectionOperation, p as listCollectionsOperation, r as updateCustomerOperation, s as listProductsOperation, t as updateProductOperation, u as listInventoryItemsOperation, v as getOrderOperation, w as getCustomerOperation, x as getInventoryItemOperation, y as getLocationOperation, z as createArticleOperation } from "./update-shopify-product.operation-Db_kLuJa.mjs";
3
+ import { A as shopifyOrderSchema, C as shopifyInventoryItemSchema, D as shopifyMetafieldSchema, E as shopifyLocationSchema, F as shopifyStoreDomainSchema, I as shopifyUserErrorSchema, M as shopifyProductSchema, N as shopifySeoSchema, O as shopifyMoneyBagSchema, P as shopifyShopSchema, S as shopifyImageSchema, T as shopifyJobSchema, _ as shopifyCredentialsSchema, a as ShopifyCustomer, b as shopifyGlobalIdSchema, c as ShopifyJob, d as ShopifyProduct, f as ShopifyShop, g as shopifyConnectionNodesSchema, h as shopifyCollectionSchema, i as ShopifyCredentialsShape, j as shopifyPageInfoSchema, k as shopifyMoneySchema, l as ShopifyLocation, m as shopifyBlogSchema, n as ShopifyBlog, o as ShopifyFulfillment, p as shopifyArticleSchema, r as ShopifyCollection, s as ShopifyInventoryLevel, t as ShopifyArticle, u as ShopifyOrder, v as shopifyCustomerSchema, w as shopifyInventoryLevelSchema, x as shopifyGraphqlErrorSchema, y as shopifyFulfillmentSchema } from "./common-C2s35du9.mjs";
4
+ export { ShopifyAppCredentials, ShopifyArticle, ShopifyBlog, ShopifyCollection, ShopifyCredentials, ShopifyCredentialsShape, ShopifyCustomer, ShopifyFulfillment, ShopifyInventoryLevel, ShopifyJob, ShopifyLocation, ShopifyOrder, ShopifyProduct, ShopifyShop, addProductsToCollectionOperation, addProductsToCollectionOperation as addProductsToCollectionTool, adjustInventoryQuantitiesOperation, adjustInventoryQuantitiesOperation as adjustInventoryQuantitiesTool, cancelOrderOperation, cancelOrderOperation as cancelOrderTool, createArticleOperation, createArticleOperation as createArticleTool, createBlogOperation, createBlogOperation as createBlogTool, createCollectionOperation, createCollectionOperation as createCollectionTool, createCustomerOperation, createCustomerOperation as createCustomerTool, createFulfillmentOperation, createFulfillmentOperation as createFulfillmentTool, createOrderOperation, createOrderOperation as createOrderTool, createProductOperation, createProductOperation as createProductTool, deleteArticleOperation, deleteArticleOperation as deleteArticleTool, deleteBlogOperation, deleteBlogOperation as deleteBlogTool, deleteCollectionOperation, deleteCollectionOperation as deleteCollectionTool, deleteCustomerOperation, deleteCustomerOperation as deleteCustomerTool, deleteProductOperation, deleteProductOperation as deleteProductTool, getArticleOperation, getArticleOperation as getArticleTool, getBlogOperation, getBlogOperation as getBlogTool, getCollectionOperation, getCollectionOperation as getCollectionTool, getCustomerOperation, getCustomerOperation as getCustomerTool, getCustomerOrdersOperation, getCustomerOrdersOperation as getCustomerOrdersTool, getFulfillmentOperation, getFulfillmentOperation as getFulfillmentTool, getInventoryItemOperation, getInventoryItemOperation as getInventoryItemTool, getInventoryLevelsForItemOperation, getInventoryLevelsForItemOperation as getInventoryLevelsForItemTool, getLocationOperation, getLocationOperation as getLocationTool, getOrderOperation, getOrderOperation as getOrderTool, getProductOperation, getProductOperation as getProductTool, getShopOperation, getShopOperation as getShopTool, listArticlesOperation, listArticlesOperation as listArticlesTool, listBlogsOperation, listBlogsOperation as listBlogsTool, listCollectionsOperation, listCollectionsOperation as listCollectionsTool, listCustomersOperation, listCustomersOperation as listCustomersTool, listFulfillmentOrdersForOrderOperation, listFulfillmentOrdersForOrderOperation as listFulfillmentOrdersForOrderTool, listInventoryItemsOperation, listInventoryItemsOperation as listInventoryItemsTool, listLocationsOperation, listLocationsOperation as listLocationsTool, listOrdersOperation, listOrdersOperation as listOrdersTool, listProductsOperation, listProductsOperation as listProductsTool, removeProductsFromCollectionOperation, removeProductsFromCollectionOperation as removeProductsFromCollectionTool, shopifyAppCredentialSet, shopifyArticleSchema, shopifyBlogSchema, shopifyCollectionSchema, shopifyConnectionNodesSchema, shopifyCredentialSet, shopifyCredentialsSchema, shopifyCustomerSchema, shopifyFulfillmentSchema, shopifyGlobalIdSchema, shopifyGraphqlErrorSchema, shopifyImageSchema, shopifyInventoryItemSchema, shopifyInventoryLevelSchema, shopifyJobSchema, shopifyLocationSchema, shopifyMetafieldSchema, shopifyMoneyBagSchema, shopifyMoneySchema, shopifyOrderSchema, shopifyPageInfoSchema, shopifyProductSchema, shopifySeoSchema, shopifyShopSchema, shopifyStoreDomainSchema, shopifyUserErrorSchema, updateArticleOperation, updateArticleOperation as updateArticleTool, updateBlogOperation, updateBlogOperation as updateBlogTool, updateCustomerOperation, updateCustomerOperation as updateCustomerTool, updateOrderOperation, updateOrderOperation as updateOrderTool, updateProductOperation, updateProductOperation as updateProductTool };
package/dist/index.mjs CHANGED
@@ -1 +1,6 @@
1
- export { };
1
+ import { C as shopifyStoreDomainSchema, S as shopifyShopSchema, _ as shopifyMoneySchema, a as shopifyCredentialsSchema, b as shopifyProductSchema, c as shopifyGlobalIdSchema, d as shopifyInventoryItemSchema, f as shopifyInventoryLevelSchema, g as shopifyMoneyBagSchema, h as shopifyMetafieldSchema, i as shopifyConnectionNodesSchema, l as shopifyGraphqlErrorSchema, m as shopifyLocationSchema, n as shopifyBlogSchema, o as shopifyCustomerSchema, p as shopifyJobSchema, r as shopifyCollectionSchema, s as shopifyFulfillmentSchema, t as shopifyArticleSchema, u as shopifyImageSchema, v as shopifyOrderSchema, w as shopifyUserErrorSchema, x as shopifySeoSchema, y as shopifyPageInfoSchema } from "./common-JZyHdK6p.mjs";
2
+ import { t as shopifyCredentialSet } from "./shopify.credential-set-CaxST3GP.mjs";
3
+ import { t as shopifyAppCredentialSet } from "./shopify-app.credential-set-M3vKwTji.mjs";
4
+ import { A as deleteCollectionOperation, B as cancelOrderOperation, C as getCustomerOrdersOperation, D as getArticleOperation, E as getBlogOperation, F as createFulfillmentOperation, H as addProductsToCollectionOperation, I as createCustomerOperation, L as createCollectionOperation, M as deleteArticleOperation, N as createProductOperation, O as deleteProductOperation, P as createOrderOperation, R as createBlogOperation, S as getFulfillmentOperation, T as getCollectionOperation, V as adjustInventoryQuantitiesOperation, _ as getProductOperation, a as updateArticleOperation, b as getInventoryLevelsForItemOperation, c as listOrdersOperation, d as listFulfillmentOrdersForOrderOperation, f as listCustomersOperation, g as getShopOperation, h as listArticlesOperation, i as updateBlogOperation, j as deleteBlogOperation, k as deleteCustomerOperation, l as listLocationsOperation, m as listBlogsOperation, n as updateOrderOperation, o as removeProductsFromCollectionOperation, p as listCollectionsOperation, r as updateCustomerOperation, s as listProductsOperation, t as updateProductOperation, u as listInventoryItemsOperation, v as getOrderOperation, w as getCustomerOperation, x as getInventoryItemOperation, y as getLocationOperation, z as createArticleOperation } from "./update-shopify-product.operation-ByYhZggW.mjs";
5
+
6
+ export { addProductsToCollectionOperation, addProductsToCollectionOperation as addProductsToCollectionTool, adjustInventoryQuantitiesOperation, adjustInventoryQuantitiesOperation as adjustInventoryQuantitiesTool, cancelOrderOperation, cancelOrderOperation as cancelOrderTool, createArticleOperation, createArticleOperation as createArticleTool, createBlogOperation, createBlogOperation as createBlogTool, createCollectionOperation, createCollectionOperation as createCollectionTool, createCustomerOperation, createCustomerOperation as createCustomerTool, createFulfillmentOperation, createFulfillmentOperation as createFulfillmentTool, createOrderOperation, createOrderOperation as createOrderTool, createProductOperation, createProductOperation as createProductTool, deleteArticleOperation, deleteArticleOperation as deleteArticleTool, deleteBlogOperation, deleteBlogOperation as deleteBlogTool, deleteCollectionOperation, deleteCollectionOperation as deleteCollectionTool, deleteCustomerOperation, deleteCustomerOperation as deleteCustomerTool, deleteProductOperation, deleteProductOperation as deleteProductTool, getArticleOperation, getArticleOperation as getArticleTool, getBlogOperation, getBlogOperation as getBlogTool, getCollectionOperation, getCollectionOperation as getCollectionTool, getCustomerOperation, getCustomerOperation as getCustomerTool, getCustomerOrdersOperation, getCustomerOrdersOperation as getCustomerOrdersTool, getFulfillmentOperation, getFulfillmentOperation as getFulfillmentTool, getInventoryItemOperation, getInventoryItemOperation as getInventoryItemTool, getInventoryLevelsForItemOperation, getInventoryLevelsForItemOperation as getInventoryLevelsForItemTool, getLocationOperation, getLocationOperation as getLocationTool, getOrderOperation, getOrderOperation as getOrderTool, getProductOperation, getProductOperation as getProductTool, getShopOperation, getShopOperation as getShopTool, listArticlesOperation, listArticlesOperation as listArticlesTool, listBlogsOperation, listBlogsOperation as listBlogsTool, listCollectionsOperation, listCollectionsOperation as listCollectionsTool, listCustomersOperation, listCustomersOperation as listCustomersTool, listFulfillmentOrdersForOrderOperation, listFulfillmentOrdersForOrderOperation as listFulfillmentOrdersForOrderTool, listInventoryItemsOperation, listInventoryItemsOperation as listInventoryItemsTool, listLocationsOperation, listLocationsOperation as listLocationsTool, listOrdersOperation, listOrdersOperation as listOrdersTool, listProductsOperation, listProductsOperation as listProductsTool, removeProductsFromCollectionOperation, removeProductsFromCollectionOperation as removeProductsFromCollectionTool, shopifyAppCredentialSet, shopifyArticleSchema, shopifyBlogSchema, shopifyCollectionSchema, shopifyConnectionNodesSchema, shopifyCredentialSet, shopifyCredentialsSchema, shopifyCustomerSchema, shopifyFulfillmentSchema, shopifyGlobalIdSchema, shopifyGraphqlErrorSchema, shopifyImageSchema, shopifyInventoryItemSchema, shopifyInventoryLevelSchema, shopifyJobSchema, shopifyLocationSchema, shopifyMetafieldSchema, shopifyMoneyBagSchema, shopifyMoneySchema, shopifyOrderSchema, shopifyPageInfoSchema, shopifyProductSchema, shopifySeoSchema, shopifyShopSchema, shopifyStoreDomainSchema, shopifyUserErrorSchema, updateArticleOperation, updateArticleOperation as updateArticleTool, updateBlogOperation, updateBlogOperation as updateBlogTool, updateCustomerOperation, updateCustomerOperation as updateCustomerTool, updateOrderOperation, updateOrderOperation as updateOrderTool, updateProductOperation, updateProductOperation as updateProductTool };
@@ -0,0 +1,2 @@
1
+ import { A as deleteCollectionOperation, B as cancelOrderOperation, C as getCustomerOrdersOperation, D as getArticleOperation, E as getBlogOperation, F as createFulfillmentOperation, H as addProductsToCollectionOperation, I as createCustomerOperation, L as createCollectionOperation, M as deleteArticleOperation, N as createProductOperation, O as deleteProductOperation, P as createOrderOperation, R as createBlogOperation, S as getFulfillmentOperation, T as getCollectionOperation, V as adjustInventoryQuantitiesOperation, _ as getProductOperation, a as updateArticleOperation, b as getInventoryLevelsForItemOperation, c as listOrdersOperation, d as listFulfillmentOrdersForOrderOperation, f as listCustomersOperation, g as getShopOperation, h as listArticlesOperation, i as updateBlogOperation, j as deleteBlogOperation, k as deleteCustomerOperation, l as listLocationsOperation, m as listBlogsOperation, n as updateOrderOperation, o as removeProductsFromCollectionOperation, p as listCollectionsOperation, r as updateCustomerOperation, s as listProductsOperation, t as updateProductOperation, u as listInventoryItemsOperation, v as getOrderOperation, w as getCustomerOperation, x as getInventoryItemOperation, y as getLocationOperation, z as createArticleOperation } from "../update-shopify-product.operation-Db_kLuJa.mjs";
2
+ export { addProductsToCollectionOperation, addProductsToCollectionOperation as addProductsToCollectionTool, adjustInventoryQuantitiesOperation, adjustInventoryQuantitiesOperation as adjustInventoryQuantitiesTool, cancelOrderOperation, cancelOrderOperation as cancelOrderTool, createArticleOperation, createArticleOperation as createArticleTool, createBlogOperation, createBlogOperation as createBlogTool, createCollectionOperation, createCollectionOperation as createCollectionTool, createCustomerOperation, createCustomerOperation as createCustomerTool, createFulfillmentOperation, createFulfillmentOperation as createFulfillmentTool, createOrderOperation, createOrderOperation as createOrderTool, createProductOperation, createProductOperation as createProductTool, deleteArticleOperation, deleteArticleOperation as deleteArticleTool, deleteBlogOperation, deleteBlogOperation as deleteBlogTool, deleteCollectionOperation, deleteCollectionOperation as deleteCollectionTool, deleteCustomerOperation, deleteCustomerOperation as deleteCustomerTool, deleteProductOperation, deleteProductOperation as deleteProductTool, getArticleOperation, getArticleOperation as getArticleTool, getBlogOperation, getBlogOperation as getBlogTool, getCollectionOperation, getCollectionOperation as getCollectionTool, getCustomerOperation, getCustomerOperation as getCustomerTool, getCustomerOrdersOperation, getCustomerOrdersOperation as getCustomerOrdersTool, getFulfillmentOperation, getFulfillmentOperation as getFulfillmentTool, getInventoryItemOperation, getInventoryItemOperation as getInventoryItemTool, getInventoryLevelsForItemOperation, getInventoryLevelsForItemOperation as getInventoryLevelsForItemTool, getLocationOperation, getLocationOperation as getLocationTool, getOrderOperation, getOrderOperation as getOrderTool, getProductOperation, getProductOperation as getProductTool, getShopOperation, getShopOperation as getShopTool, listArticlesOperation, listArticlesOperation as listArticlesTool, listBlogsOperation, listBlogsOperation as listBlogsTool, listCollectionsOperation, listCollectionsOperation as listCollectionsTool, listCustomersOperation, listCustomersOperation as listCustomersTool, listFulfillmentOrdersForOrderOperation, listFulfillmentOrdersForOrderOperation as listFulfillmentOrdersForOrderTool, listInventoryItemsOperation, listInventoryItemsOperation as listInventoryItemsTool, listLocationsOperation, listLocationsOperation as listLocationsTool, listOrdersOperation, listOrdersOperation as listOrdersTool, listProductsOperation, listProductsOperation as listProductsTool, removeProductsFromCollectionOperation, removeProductsFromCollectionOperation as removeProductsFromCollectionTool, updateArticleOperation, updateArticleOperation as updateArticleTool, updateBlogOperation, updateBlogOperation as updateBlogTool, updateCustomerOperation, updateCustomerOperation as updateCustomerTool, updateOrderOperation, updateOrderOperation as updateOrderTool, updateProductOperation, updateProductOperation as updateProductTool };
@@ -0,0 +1,3 @@
1
+ import { A as deleteCollectionOperation, B as cancelOrderOperation, C as getCustomerOrdersOperation, D as getArticleOperation, E as getBlogOperation, F as createFulfillmentOperation, H as addProductsToCollectionOperation, I as createCustomerOperation, L as createCollectionOperation, M as deleteArticleOperation, N as createProductOperation, O as deleteProductOperation, P as createOrderOperation, R as createBlogOperation, S as getFulfillmentOperation, T as getCollectionOperation, V as adjustInventoryQuantitiesOperation, _ as getProductOperation, a as updateArticleOperation, b as getInventoryLevelsForItemOperation, c as listOrdersOperation, d as listFulfillmentOrdersForOrderOperation, f as listCustomersOperation, g as getShopOperation, h as listArticlesOperation, i as updateBlogOperation, j as deleteBlogOperation, k as deleteCustomerOperation, l as listLocationsOperation, m as listBlogsOperation, n as updateOrderOperation, o as removeProductsFromCollectionOperation, p as listCollectionsOperation, r as updateCustomerOperation, s as listProductsOperation, t as updateProductOperation, u as listInventoryItemsOperation, v as getOrderOperation, w as getCustomerOperation, x as getInventoryItemOperation, y as getLocationOperation, z as createArticleOperation } from "../update-shopify-product.operation-ByYhZggW.mjs";
2
+
3
+ export { addProductsToCollectionOperation, addProductsToCollectionOperation as addProductsToCollectionTool, adjustInventoryQuantitiesOperation, adjustInventoryQuantitiesOperation as adjustInventoryQuantitiesTool, cancelOrderOperation, cancelOrderOperation as cancelOrderTool, createArticleOperation, createArticleOperation as createArticleTool, createBlogOperation, createBlogOperation as createBlogTool, createCollectionOperation, createCollectionOperation as createCollectionTool, createCustomerOperation, createCustomerOperation as createCustomerTool, createFulfillmentOperation, createFulfillmentOperation as createFulfillmentTool, createOrderOperation, createOrderOperation as createOrderTool, createProductOperation, createProductOperation as createProductTool, deleteArticleOperation, deleteArticleOperation as deleteArticleTool, deleteBlogOperation, deleteBlogOperation as deleteBlogTool, deleteCollectionOperation, deleteCollectionOperation as deleteCollectionTool, deleteCustomerOperation, deleteCustomerOperation as deleteCustomerTool, deleteProductOperation, deleteProductOperation as deleteProductTool, getArticleOperation, getArticleOperation as getArticleTool, getBlogOperation, getBlogOperation as getBlogTool, getCollectionOperation, getCollectionOperation as getCollectionTool, getCustomerOperation, getCustomerOperation as getCustomerTool, getCustomerOrdersOperation, getCustomerOrdersOperation as getCustomerOrdersTool, getFulfillmentOperation, getFulfillmentOperation as getFulfillmentTool, getInventoryItemOperation, getInventoryItemOperation as getInventoryItemTool, getInventoryLevelsForItemOperation, getInventoryLevelsForItemOperation as getInventoryLevelsForItemTool, getLocationOperation, getLocationOperation as getLocationTool, getOrderOperation, getOrderOperation as getOrderTool, getProductOperation, getProductOperation as getProductTool, getShopOperation, getShopOperation as getShopTool, listArticlesOperation, listArticlesOperation as listArticlesTool, listBlogsOperation, listBlogsOperation as listBlogsTool, listCollectionsOperation, listCollectionsOperation as listCollectionsTool, listCustomersOperation, listCustomersOperation as listCustomersTool, listFulfillmentOrdersForOrderOperation, listFulfillmentOrdersForOrderOperation as listFulfillmentOrdersForOrderTool, listInventoryItemsOperation, listInventoryItemsOperation as listInventoryItemsTool, listLocationsOperation, listLocationsOperation as listLocationsTool, listOrdersOperation, listOrdersOperation as listOrdersTool, listProductsOperation, listProductsOperation as listProductsTool, removeProductsFromCollectionOperation, removeProductsFromCollectionOperation as removeProductsFromCollectionTool, updateArticleOperation, updateArticleOperation as updateArticleTool, updateBlogOperation, updateBlogOperation as updateBlogTool, updateCustomerOperation, updateCustomerOperation as updateCustomerTool, updateOrderOperation, updateOrderOperation as updateOrderTool, updateProductOperation, updateProductOperation as updateProductTool };
@@ -0,0 +1,2 @@
1
+ import { A as shopifyOrderSchema, C as shopifyInventoryItemSchema, D as shopifyMetafieldSchema, E as shopifyLocationSchema, F as shopifyStoreDomainSchema, I as shopifyUserErrorSchema, M as shopifyProductSchema, N as shopifySeoSchema, O as shopifyMoneyBagSchema, P as shopifyShopSchema, S as shopifyImageSchema, T as shopifyJobSchema, _ as shopifyCredentialsSchema, a as ShopifyCustomer, b as shopifyGlobalIdSchema, c as ShopifyJob, d as ShopifyProduct, f as ShopifyShop, g as shopifyConnectionNodesSchema, h as shopifyCollectionSchema, i as ShopifyCredentialsShape, j as shopifyPageInfoSchema, k as shopifyMoneySchema, l as ShopifyLocation, m as shopifyBlogSchema, n as ShopifyBlog, o as ShopifyFulfillment, p as shopifyArticleSchema, r as ShopifyCollection, s as ShopifyInventoryLevel, t as ShopifyArticle, u as ShopifyOrder, v as shopifyCustomerSchema, w as shopifyInventoryLevelSchema, x as shopifyGraphqlErrorSchema, y as shopifyFulfillmentSchema } from "../common-C2s35du9.mjs";
2
+ 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, shopifyStoreDomainSchema, shopifyUserErrorSchema };
@@ -0,0 +1,3 @@
1
+ import { C as shopifyStoreDomainSchema, S as shopifyShopSchema, _ as shopifyMoneySchema, a as shopifyCredentialsSchema, b as shopifyProductSchema, c as shopifyGlobalIdSchema, d as shopifyInventoryItemSchema, f as shopifyInventoryLevelSchema, g as shopifyMoneyBagSchema, h as shopifyMetafieldSchema, i as shopifyConnectionNodesSchema, l as shopifyGraphqlErrorSchema, m as shopifyLocationSchema, n as shopifyBlogSchema, o as shopifyCustomerSchema, p as shopifyJobSchema, r as shopifyCollectionSchema, s as shopifyFulfillmentSchema, t as shopifyArticleSchema, u as shopifyImageSchema, v as shopifyOrderSchema, w as shopifyUserErrorSchema, x as shopifySeoSchema, y as shopifyPageInfoSchema } from "../common-JZyHdK6p.mjs";
2
+
3
+ export { shopifyArticleSchema, shopifyBlogSchema, shopifyCollectionSchema, shopifyConnectionNodesSchema, shopifyCredentialsSchema, shopifyCustomerSchema, shopifyFulfillmentSchema, shopifyGlobalIdSchema, shopifyGraphqlErrorSchema, shopifyImageSchema, shopifyInventoryItemSchema, shopifyInventoryLevelSchema, shopifyJobSchema, shopifyLocationSchema, shopifyMetafieldSchema, shopifyMoneyBagSchema, shopifyMoneySchema, shopifyOrderSchema, shopifyPageInfoSchema, shopifyProductSchema, shopifySeoSchema, shopifyShopSchema, shopifyStoreDomainSchema, shopifyUserErrorSchema };
@@ -0,0 +1,65 @@
1
+ import { CredentialSet } from "@keystrokehq/core";
2
+ import { z } from "zod";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+
6
+ //#region src/credential-sets/shopify.credential-set.d.ts
7
+ declare const shopifyCredentialSet: CredentialSet<"shopify", z.ZodObject<{
8
+ SHOPIFY_STORE_DOMAIN: z.ZodString;
9
+ SHOPIFY_ACCESS_TOKEN: z.ZodString;
10
+ }, z.core.$strip>, {
11
+ kind: "oauth";
12
+ tokenType: "refreshable";
13
+ authUrl: "https://{shop}.myshopify.com/admin/oauth/authorize";
14
+ tokenUrl: "https://{shop}.myshopify.com/admin/oauth/access_token";
15
+ revokeUrl: null;
16
+ scopes: readonly ["read_products", "write_products", "read_orders", "write_orders", "read_customers", "write_customers", "read_inventory", "write_inventory", "read_locations", "read_fulfillments", "write_fulfillments", "read_content", "write_content", "read_webhooks", "write_webhooks"];
17
+ vault: {
18
+ readonly accessToken: "SHOPIFY_ACCESS_TOKEN";
19
+ readonly raw: {
20
+ readonly SHOPIFY_STORE_DOMAIN: "_shopifyShopDomain";
21
+ };
22
+ };
23
+ buildAuthUrl: ({
24
+ oauthClient,
25
+ redirectUri,
26
+ state,
27
+ connection,
28
+ initiateInput,
29
+ requestedScopes
30
+ }: _keystrokehq_core_credential_set0.BuildAuthUrlContext) => string;
31
+ exchangeCode: ({
32
+ oauthClient,
33
+ code,
34
+ queryParams
35
+ }: _keystrokehq_core_credential_set0.ExchangeCodeContext) => Promise<_keystrokehq_core_credential_set0.TokenResult>;
36
+ refreshToken: ({
37
+ oauthClient,
38
+ refreshToken
39
+ }: _keystrokehq_core_credential_set0.RefreshTokenContext) => Promise<_keystrokehq_core_credential_set0.TokenResult>;
40
+ extractInstallationInfo: ({
41
+ tokenResult
42
+ }: _keystrokehq_core_credential_set0.ExtractInstallationContext) => {
43
+ externalInstallationId: string | undefined;
44
+ externalWorkspaceId: string | undefined;
45
+ metadata: {
46
+ shopDomain: string;
47
+ } | undefined;
48
+ };
49
+ id: string;
50
+ }[]>;
51
+ type ShopifyCredentials = InferCredentialSetAuth<typeof shopifyCredentialSet>;
52
+ //#endregion
53
+ //#region src/credential-sets/shopify-app.credential-set.d.ts
54
+ declare const shopifyAppCredentialSet: CredentialSet<"shopify-app", z.ZodObject<{
55
+ clientId: z.ZodString;
56
+ clientSecret: z.ZodString;
57
+ webhookSecret: z.ZodString;
58
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
59
+ clientId: z.ZodString;
60
+ clientSecret: z.ZodString;
61
+ webhookSecret: z.ZodString;
62
+ }, z.core.$strip>>[] | undefined>;
63
+ type ShopifyAppCredentials = InferCredentialSetAuth<typeof shopifyAppCredentialSet>;
64
+ //#endregion
65
+ export { shopifyCredentialSet as i, shopifyAppCredentialSet as n, ShopifyCredentials as r, ShopifyAppCredentials as t };
@@ -0,0 +1,17 @@
1
+ import { CredentialSet } from "@keystrokehq/core";
2
+ import { z } from "zod";
3
+
4
+ //#region src/credential-sets/shopify-app.credential-set.ts
5
+ const shopifyAppCredentialSet = new CredentialSet({
6
+ id: "shopify-app",
7
+ exposure: "platform-only",
8
+ name: "Shopify App",
9
+ auth: z.object({
10
+ clientId: z.string(),
11
+ clientSecret: z.string(),
12
+ webhookSecret: z.string()
13
+ })
14
+ });
15
+
16
+ //#endregion
17
+ export { shopifyAppCredentialSet as t };
@@ -1,137 +1,8 @@
1
- import { CredentialSet, Operation } from "@keystrokehq/core";
1
+ import { C as shopifyStoreDomainSchema } from "./common-JZyHdK6p.mjs";
2
+ import { CredentialSet } from "@keystrokehq/core";
2
3
  import { z } from "zod";
3
4
  import { createHmac, timingSafeEqual } from "node:crypto";
4
5
 
5
- //#region ../../packages/integration-authoring/dist/official/runtime.mjs
6
- const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
7
- function getRegistry() {
8
- const globalStore = globalThis;
9
- if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
10
- return globalStore[REGISTRY_KEY];
11
- }
12
- function registerOfficialOperation(operation, metadata) {
13
- getRegistry().set(operation, Object.freeze({ ...metadata }));
14
- }
15
-
16
- //#endregion
17
- //#region ../../packages/integration-authoring/dist/official/index.mjs
18
- const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
19
- function officialCredentialSetId(id) {
20
- return `${OFFICIAL_CREDENTIAL_SET_ID_PREFIX}${id}`;
21
- }
22
- function stripOfficialCredentialSetIdPrefix(id) {
23
- return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
24
- }
25
- /**
26
- * Creates a factory for Keystroke-official integration operations.
27
- *
28
- * It keeps the same flat `run(input, credentials)` ergonomics as the generic
29
- * operation factory, while registering official metadata for builder/runtime
30
- * operation metadata.
31
- */
32
- function createOfficialOperationFactory(credentialSet) {
33
- const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
34
- return (config) => {
35
- const wrappedRun = async (input, ctx) => {
36
- const creds = ctx.credentials[credentialSet.id];
37
- return config.run(input, creds);
38
- };
39
- const operation = new Operation({
40
- id: config.id,
41
- name: config.name,
42
- description: config.description,
43
- input: config.input,
44
- output: config.output,
45
- credentialSets: [credentialSet],
46
- ...config.tags !== void 0 ? { tags: config.tags } : {},
47
- ...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
48
- ...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
49
- ...config.retries !== void 0 ? { retries: config.retries } : {},
50
- ...config.timeout !== void 0 ? { timeout: config.timeout } : {},
51
- ...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
52
- run: wrappedRun
53
- });
54
- registerOfficialOperation(operation, { integrationId });
55
- return operation;
56
- };
57
- }
58
- /**
59
- * Creates an official integration bundle from a single config object.
60
- *
61
- * - Creates the public `CredentialSet` internally.
62
- * - Accepts optional `internal` fields for Keystroke-owned platform credentials.
63
- */
64
- function defineOfficialIntegration(config) {
65
- const internalCredentialSets = config.internal ?? {};
66
- const allInternalCredentialSets = [
67
- ...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
68
- ...internalCredentialSets.providerAppVariants ?? [],
69
- ...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
70
- ...internalCredentialSets.other ?? []
71
- ];
72
- const credentialSet = new CredentialSet({
73
- id: config.id,
74
- name: config.name,
75
- description: config.description,
76
- auth: config.auth,
77
- ...config.connections ? { connections: config.connections } : {},
78
- ...config.proxy ? { proxy: config.proxy } : {},
79
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {}
80
- });
81
- return Object.freeze({
82
- integration: {
83
- id: config.id,
84
- name: config.name,
85
- ...config.description !== void 0 ? { description: config.description } : {},
86
- auth: config.auth,
87
- ...config.proxy ? { proxy: config.proxy } : {},
88
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {},
89
- ...config.connections ? { connections: config.connections } : {}
90
- },
91
- credentialSet,
92
- internalCredentialSets,
93
- allInternalCredentialSets
94
- });
95
- }
96
-
97
- //#endregion
98
- //#region src/_official/provider-app.ts
99
- const shopifyAppCredentialSet = new CredentialSet({
100
- id: officialCredentialSetId("shopify-app"),
101
- exposure: "platform-only",
102
- name: "Shopify App",
103
- auth: z.object({
104
- clientId: z.string(),
105
- clientSecret: z.string(),
106
- webhookSecret: z.string()
107
- })
108
- });
109
- const shopifyOfficialProviderSeed = {
110
- provider: "shopify",
111
- appRef: "shopify-platform",
112
- displayName: "Shopify Platform",
113
- credentialSetName: "Keystroke Shopify Platform App",
114
- envShape: {
115
- KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID: z.string().optional(),
116
- KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_ID: z.string().optional(),
117
- KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_SECRET: z.string().optional(),
118
- KEYSTROKE_OFFICIAL_SHOPIFY_WEBHOOK_SECRET: z.string().optional()
119
- },
120
- requiredEnvKeys: [
121
- "KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID",
122
- "KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_ID",
123
- "KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_SECRET",
124
- "KEYSTROKE_OFFICIAL_SHOPIFY_WEBHOOK_SECRET"
125
- ],
126
- externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_SHOPIFY_APP_ID",
127
- buildCredentials: (env) => ({
128
- clientId: env.KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_ID,
129
- clientSecret: env.KEYSTROKE_OFFICIAL_SHOPIFY_CLIENT_SECRET,
130
- webhookSecret: env.KEYSTROKE_OFFICIAL_SHOPIFY_WEBHOOK_SECRET
131
- })
132
- };
133
-
134
- //#endregion
135
6
  //#region ../../packages/credential-connection/dist/defaults-YE9AvLIc.mjs
136
7
  /**
137
8
  * Shared OAuth 2.0 token-response plumbing.
@@ -177,7 +48,7 @@ function normalizeOAuthTokens(tokenData) {
177
48
  }
178
49
 
179
50
  //#endregion
180
- //#region src/oauth-connection.ts
51
+ //#region src/utils/oauth-connection.ts
181
52
  /**
182
53
  * Shopify OAuth connection configuration.
183
54
  *
@@ -314,13 +185,12 @@ const shopifyOAuthConnection = {
314
185
  };
315
186
 
316
187
  //#endregion
317
- //#region src/integration.ts
318
- const shopifyStoreDomainSchema = z.string().min(1).regex(/^[a-z0-9][a-z0-9-]*\.myshopify\.com$/i, "Shopify store domain must look like \"example.myshopify.com\".");
188
+ //#region src/credential-sets/shopify.credential-set.ts
319
189
  const shopifyAuthSchema = z.object({
320
190
  SHOPIFY_STORE_DOMAIN: shopifyStoreDomainSchema,
321
191
  SHOPIFY_ACCESS_TOKEN: z.string().min(1)
322
192
  });
323
- const shopifyOfficialIntegration = {
193
+ const shopifyCredentialSet = new CredentialSet({
324
194
  id: "shopify",
325
195
  name: "Shopify",
326
196
  description: "Shopify Admin API — stores, products, orders, customers, and webhooks",
@@ -329,12 +199,7 @@ const shopifyOfficialIntegration = {
329
199
  id: "oauth",
330
200
  ...shopifyOAuthConnection
331
201
  }]
332
- };
333
- const shopifyBundle = defineOfficialIntegration({
334
- ...shopifyOfficialIntegration,
335
- internal: { providerApp: shopifyAppCredentialSet }
336
202
  });
337
- const shopify = shopifyBundle.credentialSet;
338
203
 
339
204
  //#endregion
340
- export { shopifyAppCredentialSet as a, shopifyStoreDomainSchema as i, shopifyBundle as n, shopifyOfficialProviderSeed as o, shopifyOfficialIntegration as r, createOfficialOperationFactory as s, shopify as t };
205
+ export { shopifyCredentialSet as t };