@shopify/koa-shopify-webhooks
Advanced tools
Comparing version 0.0.0-snapshot-20220623162708 to 0.0.0-snapshot-20240616173624
@@ -34,3 +34,2 @@ 'use strict'; | ||
const graphqlTopic = topic.toUpperCase().replace(/\//g, '_'); | ||
if (safeCompare__default["default"](generatedHash, hmac)) { | ||
@@ -49,9 +48,7 @@ ctx.res.statusCode = network.StatusCode.Accepted; | ||
} | ||
const middleware = compose__default["default"]([bodyParser__default["default"](), receiveWebhookMiddleware]); | ||
return path ? mount__default["default"](path, middleware) : middleware; | ||
} | ||
function noop() {} | ||
exports.receiveWebhook = receiveWebhook; |
@@ -9,3 +9,2 @@ 'use strict'; | ||
exports.DeliveryMethod = void 0; | ||
(function (DeliveryMethod) { | ||
@@ -15,3 +14,2 @@ DeliveryMethod["Http"] = "http"; | ||
})(exports.DeliveryMethod || (exports.DeliveryMethod = {})); | ||
async function registerWebhook({ | ||
@@ -40,3 +38,2 @@ address, | ||
} | ||
function isSuccess(result, deliveryMethod) { | ||
@@ -46,3 +43,2 @@ switch (deliveryMethod) { | ||
return Boolean(result.data && result.data.webhookSubscriptionCreate && result.data.webhookSubscriptionCreate.webhookSubscription); | ||
case exports.DeliveryMethod.EventBridge: | ||
@@ -52,3 +48,2 @@ return Boolean(result.data && result.data.eventBridgeWebhookSubscriptionCreate && result.data.eventBridgeWebhookSubscriptionCreate.webhookSubscription); | ||
} | ||
function buildArgs(args) { | ||
@@ -60,7 +55,5 @@ const formattedArgs = Object.entries(args).filter(([_key, value]) => typeof value !== 'undefined').map(([key, value]) => { | ||
} | ||
function buildQuery(topic, address, deliveryMethod, includeFields) { | ||
let mutationName; | ||
let webhookSubscriptionArgs; | ||
switch (deliveryMethod) { | ||
@@ -74,3 +67,2 @@ case exports.DeliveryMethod.Http: | ||
break; | ||
case exports.DeliveryMethod.EventBridge: | ||
@@ -84,3 +76,2 @@ mutationName = 'eventBridgeWebhookSubscriptionCreate'; | ||
} | ||
return ` | ||
@@ -87,0 +78,0 @@ mutation webhookSubscriptionCreate { |
@@ -6,3 +6,2 @@ 'use strict'; | ||
exports.WebhookHeader = void 0; | ||
(function (WebhookHeader) { | ||
@@ -9,0 +8,0 @@ WebhookHeader["AccessToken"] = "X-Shopify-Access-Token"; |
@@ -1,3 +0,3 @@ | ||
import { Context, Middleware } from 'koa'; | ||
import { Topic } from './types'; | ||
import type { Context, Middleware } from 'koa'; | ||
import type { Topic } from './types'; | ||
interface Options { | ||
@@ -4,0 +4,0 @@ secret: string; |
@@ -1,3 +0,3 @@ | ||
import { Topic } from './types'; | ||
export declare type ApiVersion = '2020-10' | '2021-01' | '2021-04' | '2021-07' | 'unstable' | 'unversioned' | (string & {}); | ||
import type { Topic } from './types'; | ||
export type ApiVersion = '2020-10' | '2021-01' | '2021-04' | '2021-07' | '2021-10' | '2022-01' | '2022-04' | '2022-07' | '2022-10' | 'unstable' | 'unversioned' | (string & {}); | ||
export declare enum DeliveryMethod { | ||
@@ -4,0 +4,0 @@ Http = "http", |
@@ -7,3 +7,3 @@ export declare enum WebhookHeader { | ||
} | ||
export declare type Topic = 'APP_UNINSTALLED' | 'APP_SUBSCRIPTIONS_UPDATE' | 'APP_PURCHASES_ONE_TIME_UPDATE' | 'CARTS_CREATE' | 'CARTS_UPDATE' | 'CHECKOUTS_CREATE' | 'CHECKOUTS_DELETE' | 'CHECKOUTS_UPDATE' | 'COLLECTION_LISTINGS_ADD' | 'COLLECTION_LISTINGS_REMOVE' | 'COLLECTION_LISTINGS_UPDATE' | 'COLLECTIONS_CREATE' | 'COLLECTIONS_DELETE' | 'COLLECTIONS_UPDATE' | 'CUSTOMER_GROUPS_CREATE' | 'CUSTOMER_GROUPS_DELETE' | 'CUSTOMER_GROUPS_UPDATE' | 'CUSTOMERS_CREATE' | 'CUSTOMERS_DELETE' | 'CUSTOMERS_DISABLE' | 'CUSTOMERS_ENABLE' | 'CUSTOMERS_UPDATE' | 'DRAFT_ORDERS_CREATE' | 'DRAFT_ORDERS_DELETE' | 'DRAFT_ORDERS_UPDATE' | 'FULFILLMENT_EVENTS_CREATE' | 'FULFILLMENT_EVENTS_DELETE' | 'FULFILLMENTS_CREATE' | 'FULFILLMENTS_UPDATE' | 'ORDER_TRANSACTIONS_CREATE' | 'ORDERS_CANCELLED' | 'ORDERS_CREATE' | 'ORDERS_DELETE' | 'ORDERS_FULFILLED' | 'ORDERS_PAID' | 'ORDERS_PARTIALLY_FULFILLED' | 'ORDERS_UPDATED' | 'PRODUCT_LISTINGS_ADD' | 'PRODUCT_LISTINGS_REMOVE' | 'PRODUCT_LISTINGS_UPDATE' | 'PRODUCTS_CREATE' | 'PRODUCTS_DELETE' | 'PRODUCTS_UPDATE' | 'REFUNDS_CREATE' | 'SHOP_UPDATE' | 'THEMES_CREATE' | 'THEMES_DELETE' | 'THEMES_PUBLISH' | 'THEMES_UPDATE' | 'INVENTORY_LEVELS_CONNECT' | 'INVENTORY_LEVELS_UPDATE' | 'INVENTORY_LEVELS_DISCONNECT' | 'INVENTORY_ITEMS_CREATE' | 'INVENTORY_ITEMS_UPDATE' | 'INVENTORY_ITEMS_DELETE' | 'LOCATIONS_CREATE' | 'LOCATIONS_UPDATE' | 'LOCATIONS_DELETE'; | ||
export type Topic = 'APP_UNINSTALLED' | 'APP_SUBSCRIPTIONS_UPDATE' | 'APP_PURCHASES_ONE_TIME_UPDATE' | 'CARTS_CREATE' | 'CARTS_UPDATE' | 'CHECKOUTS_CREATE' | 'CHECKOUTS_DELETE' | 'CHECKOUTS_UPDATE' | 'COLLECTION_LISTINGS_ADD' | 'COLLECTION_LISTINGS_REMOVE' | 'COLLECTION_LISTINGS_UPDATE' | 'COLLECTIONS_CREATE' | 'COLLECTIONS_DELETE' | 'COLLECTIONS_UPDATE' | 'CUSTOMER_GROUPS_CREATE' | 'CUSTOMER_GROUPS_DELETE' | 'CUSTOMER_GROUPS_UPDATE' | 'CUSTOMERS_CREATE' | 'CUSTOMERS_DELETE' | 'CUSTOMERS_DISABLE' | 'CUSTOMERS_ENABLE' | 'CUSTOMERS_UPDATE' | 'DRAFT_ORDERS_CREATE' | 'DRAFT_ORDERS_DELETE' | 'DRAFT_ORDERS_UPDATE' | 'FULFILLMENT_EVENTS_CREATE' | 'FULFILLMENT_EVENTS_DELETE' | 'FULFILLMENTS_CREATE' | 'FULFILLMENTS_UPDATE' | 'ORDER_TRANSACTIONS_CREATE' | 'ORDERS_CANCELLED' | 'ORDERS_CREATE' | 'ORDERS_DELETE' | 'ORDERS_FULFILLED' | 'ORDERS_PAID' | 'ORDERS_PARTIALLY_FULFILLED' | 'ORDERS_UPDATED' | 'PRODUCT_LISTINGS_ADD' | 'PRODUCT_LISTINGS_REMOVE' | 'PRODUCT_LISTINGS_UPDATE' | 'PRODUCTS_CREATE' | 'PRODUCTS_DELETE' | 'PRODUCTS_UPDATE' | 'REFUNDS_CREATE' | 'SHOP_UPDATE' | 'THEMES_CREATE' | 'THEMES_DELETE' | 'THEMES_PUBLISH' | 'THEMES_UPDATE' | 'INVENTORY_LEVELS_CONNECT' | 'INVENTORY_LEVELS_UPDATE' | 'INVENTORY_LEVELS_DISCONNECT' | 'INVENTORY_ITEMS_CREATE' | 'INVENTORY_ITEMS_UPDATE' | 'INVENTORY_ITEMS_DELETE' | 'LOCATIONS_CREATE' | 'LOCATIONS_UPDATE' | 'LOCATIONS_DELETE'; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/index.js"); | ||
module.exports = require("./build/cjs/index.js"); |
{ | ||
"name": "@shopify/koa-shopify-webhooks", | ||
"version": "0.0.0-snapshot-20220623162708", | ||
"version": "0.0.0-snapshot-20240616173624", | ||
"license": "MIT", | ||
@@ -24,6 +24,6 @@ "description": "Receive webhooks from Shopify with ease", | ||
"engines": { | ||
"node": "^14.17.0 || >=16.0.0" | ||
"node": ">=18.12.0" | ||
}, | ||
"dependencies": { | ||
"@shopify/network": "^0.0.0-snapshot-20220623162708", | ||
"@shopify/network": "^3.3.0", | ||
"@types/koa": "^2.0.0", | ||
@@ -36,2 +36,3 @@ "koa-bodyparser": ">=4.0.0 <5.0.0", | ||
"devDependencies": { | ||
"@shopify/jest-dom-mocks": "^5.1.0", | ||
"@types/koa-bodyparser": "*", | ||
@@ -55,2 +56,3 @@ "@types/koa-compose": "*" | ||
".": { | ||
"types": "./build/ts/index.d.ts", | ||
"esnext": "./index.esnext", | ||
@@ -57,0 +59,0 @@ "import": "./index.mjs", |
@@ -12,3 +12,3 @@ # `@shopify/koa-shopify-webhooks` | ||
```bash | ||
$ yarn add @shopify/koa-shopify-webhooks | ||
yarn add @shopify/koa-shopify-webhooks | ||
``` | ||
@@ -186,3 +186,3 @@ | ||
In your terminal | ||
`$ yarn add isomorphic-fetch` | ||
`yarn add isomorphic-fetch` | ||
@@ -189,0 +189,0 @@ In your app |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26058
329
3
+ Added@shopify/network@3.3.0(transitive)
- Removed@shopify/network@0.0.0-snapshot-release-20220622172627(transitive)
Updated@shopify/network@^3.3.0