@sommpicks/sommpicks-shopify 24.12.1 → 24.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Logger.d.ts +7 -0
- package/dist/Logger.js +21 -0
- package/dist/Logger.js.map +1 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -0
- package/dist/services/CacheWrapper.d.ts +9 -0
- package/dist/services/CacheWrapper.js +41 -0
- package/dist/services/CacheWrapper.js.map +1 -0
- package/dist/services/CountryCodeService.d.ts +5 -0
- package/dist/services/CountryCodeService.js +511 -0
- package/dist/services/CountryCodeService.js.map +1 -0
- package/dist/shopify/ShopifyAppService.d.ts +41 -0
- package/dist/shopify/ShopifyAppService.js +126 -0
- package/dist/shopify/ShopifyAppService.js.map +1 -0
- package/dist/shopify/ShopifyAssetService.d.ts +6 -0
- package/dist/shopify/ShopifyAssetService.js +36 -0
- package/dist/shopify/ShopifyAssetService.js.map +1 -0
- package/dist/shopify/ShopifyBillingService.d.ts +12 -0
- package/dist/shopify/ShopifyBillingService.js +106 -0
- package/dist/shopify/ShopifyBillingService.js.map +1 -0
- package/dist/shopify/ShopifyCartTrasnformationService.d.ts +39 -0
- package/dist/shopify/ShopifyCartTrasnformationService.js +218 -0
- package/dist/shopify/ShopifyCartTrasnformationService.js.map +1 -0
- package/dist/shopify/ShopifyCollectionService.d.ts +90 -0
- package/dist/shopify/ShopifyCollectionService.js +594 -0
- package/dist/shopify/ShopifyCollectionService.js.map +1 -0
- package/dist/shopify/ShopifyCustomerService.d.ts +172 -0
- package/dist/shopify/ShopifyCustomerService.js +560 -0
- package/dist/shopify/ShopifyCustomerService.js.map +1 -0
- package/dist/shopify/ShopifyDeliveryCustomisationService.d.ts +42 -0
- package/dist/shopify/ShopifyDeliveryCustomisationService.js +238 -0
- package/dist/shopify/ShopifyDeliveryCustomisationService.js.map +1 -0
- package/dist/shopify/ShopifyDiscountService.d.ts +40 -0
- package/dist/shopify/ShopifyDiscountService.js +148 -0
- package/dist/shopify/ShopifyDiscountService.js.map +1 -0
- package/dist/shopify/ShopifyDraftOrderService.d.ts +38 -0
- package/dist/shopify/ShopifyDraftOrderService.js +146 -0
- package/dist/shopify/ShopifyDraftOrderService.js.map +1 -0
- package/dist/shopify/ShopifyFulfillmentService.d.ts +8 -0
- package/dist/shopify/ShopifyFulfillmentService.js +63 -0
- package/dist/shopify/ShopifyFulfillmentService.js.map +1 -0
- package/dist/shopify/ShopifyFunctionsProductDiscountsService.d.ts +37 -0
- package/dist/shopify/ShopifyFunctionsProductDiscountsService.js +178 -0
- package/dist/shopify/ShopifyFunctionsProductDiscountsService.js.map +1 -0
- package/dist/shopify/ShopifyInventoryService.d.ts +104 -0
- package/dist/shopify/ShopifyInventoryService.js +461 -0
- package/dist/shopify/ShopifyInventoryService.js.map +1 -0
- package/dist/shopify/ShopifyLocationService.d.ts +7 -0
- package/dist/shopify/ShopifyLocationService.js +48 -0
- package/dist/shopify/ShopifyLocationService.js.map +1 -0
- package/dist/shopify/ShopifyOrderRefundsService.d.ts +32 -0
- package/dist/shopify/ShopifyOrderRefundsService.js +162 -0
- package/dist/shopify/ShopifyOrderRefundsService.js.map +1 -0
- package/dist/shopify/ShopifyOrderRiskService.d.ts +6 -0
- package/dist/shopify/ShopifyOrderRiskService.js +35 -0
- package/dist/shopify/ShopifyOrderRiskService.js.map +1 -0
- package/dist/shopify/ShopifyOrderService.d.ts +191 -0
- package/dist/shopify/ShopifyOrderService.js +1296 -0
- package/dist/shopify/ShopifyOrderService.js.map +1 -0
- package/dist/shopify/ShopifyPageService.d.ts +15 -0
- package/dist/shopify/ShopifyPageService.js +86 -0
- package/dist/shopify/ShopifyPageService.js.map +1 -0
- package/dist/shopify/ShopifyProductService.d.ts +146 -0
- package/dist/shopify/ShopifyProductService.js +822 -0
- package/dist/shopify/ShopifyProductService.js.map +1 -0
- package/dist/shopify/ShopifyShippingZonesService.d.ts +7 -0
- package/dist/shopify/ShopifyShippingZonesService.js +52 -0
- package/dist/shopify/ShopifyShippingZonesService.js.map +1 -0
- package/dist/shopify/ShopifyShopService.d.ts +34 -0
- package/dist/shopify/ShopifyShopService.js +124 -0
- package/dist/shopify/ShopifyShopService.js.map +1 -0
- package/dist/shopify/ShopifyTemplateService.d.ts +7 -0
- package/dist/shopify/ShopifyTemplateService.js +49 -0
- package/dist/shopify/ShopifyTemplateService.js.map +1 -0
- package/dist/shopify/ShopifyThemeService.d.ts +7 -0
- package/dist/shopify/ShopifyThemeService.js +53 -0
- package/dist/shopify/ShopifyThemeService.js.map +1 -0
- package/dist/shopify/ShopifyUtils.d.ts +13 -0
- package/dist/shopify/ShopifyUtils.js +74 -0
- package/dist/shopify/ShopifyUtils.js.map +1 -0
- package/dist/shopify/ShopifyWebhookService.d.ts +25 -0
- package/dist/shopify/ShopifyWebhookService.js +145 -0
- package/dist/shopify/ShopifyWebhookService.js.map +1 -0
- package/dist/shopify/base/APIVersion.d.ts +4 -0
- package/dist/shopify/base/APIVersion.js +8 -0
- package/dist/shopify/base/APIVersion.js.map +1 -0
- package/dist/shopify/base/AbstractService.d.ts +20 -0
- package/dist/shopify/base/AbstractService.js +159 -0
- package/dist/shopify/base/AbstractService.js.map +1 -0
- package/dist/shopify/base/ErrorHelper.d.ts +3 -0
- package/dist/shopify/base/ErrorHelper.js +32 -0
- package/dist/shopify/base/ErrorHelper.js.map +1 -0
- package/dist/shopify/errors/InspiraShopifyCustomError.d.ts +3 -0
- package/dist/shopify/errors/InspiraShopifyCustomError.js +11 -0
- package/dist/shopify/errors/InspiraShopifyCustomError.js.map +1 -0
- package/dist/shopify/errors/InspiraShopifyError.d.ts +5 -0
- package/dist/shopify/errors/InspiraShopifyError.js +19 -0
- package/dist/shopify/errors/InspiraShopifyError.js.map +1 -0
- package/dist/shopify/errors/InspiraShopifyUnableToReserveInventoryError.d.ts +3 -0
- package/dist/shopify/errors/InspiraShopifyUnableToReserveInventoryError.js +11 -0
- package/dist/shopify/errors/InspiraShopifyUnableToReserveInventoryError.js.map +1 -0
- package/dist/shopify/helpers/ShopifyProductServiceHelper.d.ts +29 -0
- package/dist/shopify/helpers/ShopifyProductServiceHelper.js +454 -0
- package/dist/shopify/helpers/ShopifyProductServiceHelper.js.map +1 -0
- package/dist/shopify/product/ShopifyProductCountService.d.ts +35 -0
- package/dist/shopify/product/ShopifyProductCountService.js +137 -0
- package/dist/shopify/product/ShopifyProductCountService.js.map +1 -0
- package/dist/shopify/product/ShopifyProductListService.d.ts +88 -0
- package/dist/shopify/product/ShopifyProductListService.js +353 -0
- package/dist/shopify/product/ShopifyProductListService.js.map +1 -0
- package/dist/shopify/product/ShopifyProductMetafieldsService.d.ts +65 -0
- package/dist/shopify/product/ShopifyProductMetafieldsService.js +445 -0
- package/dist/shopify/product/ShopifyProductMetafieldsService.js.map +1 -0
- package/dist/shopify/product/ShopifyProductPublicationsService.d.ts +26 -0
- package/dist/shopify/product/ShopifyProductPublicationsService.js +134 -0
- package/dist/shopify/product/ShopifyProductPublicationsService.js.map +1 -0
- package/dist/shopify/product/ShopifyVariantService.d.ts +160 -0
- package/dist/shopify/product/ShopifyVariantService.js +612 -0
- package/dist/shopify/product/ShopifyVariantService.js.map +1 -0
- package/dist/shopify/router/ShopifyMandatoryRouter.d.ts +11 -0
- package/dist/shopify/router/ShopifyMandatoryRouter.js +51 -0
- package/dist/shopify/router/ShopifyMandatoryRouter.js.map +1 -0
- package/dist/shopify/router/ShopifyRouter.d.ts +18 -0
- package/dist/shopify/router/ShopifyRouter.js +96 -0
- package/dist/shopify/router/ShopifyRouter.js.map +1 -0
- package/dist/shopify/router/ShopifyRouterBis.d.ts +18 -0
- package/dist/shopify/router/ShopifyRouterBis.js +96 -0
- package/dist/shopify/router/ShopifyRouterBis.js.map +1 -0
- package/dist/shopify/router/ShopifyRouterBisBis.d.ts +18 -0
- package/dist/shopify/router/ShopifyRouterBisBis.js +96 -0
- package/dist/shopify/router/ShopifyRouterBisBis.js.map +1 -0
- package/dist/shopify/router/ShopifyRouterBisBisBis.d.ts +18 -0
- package/dist/shopify/router/ShopifyRouterBisBisBis.js +96 -0
- package/dist/shopify/router/ShopifyRouterBisBisBis.js.map +1 -0
- package/dist/shopify/router/ShopifyRouterBisBisBisBis.d.ts +18 -0
- package/dist/shopify/router/ShopifyRouterBisBisBisBis.js +96 -0
- package/dist/shopify/router/ShopifyRouterBisBisBisBis.js.map +1 -0
- package/dist/shopify/router/WebhookSkipMiddleware.d.ts +28 -0
- package/dist/shopify/router/WebhookSkipMiddleware.js +67 -0
- package/dist/shopify/router/WebhookSkipMiddleware.js.map +1 -0
- package/dist/shopify/router/services/CryptoService.d.ts +6 -0
- package/dist/shopify/router/services/CryptoService.js +25 -0
- package/dist/shopify/router/services/CryptoService.js.map +1 -0
- package/dist/shopify/router/services/HmacValidator.d.ts +7 -0
- package/dist/shopify/router/services/HmacValidator.js +53 -0
- package/dist/shopify/router/services/HmacValidator.js.map +1 -0
- package/dist/shopify/router/services/OauthService.d.ts +3 -0
- package/dist/shopify/router/services/OauthService.js +21 -0
- package/dist/shopify/router/services/OauthService.js.map +1 -0
- package/dist/shopify/router/services/RestUtils.d.ts +3 -0
- package/dist/shopify/router/services/RestUtils.js +15 -0
- package/dist/shopify/router/services/RestUtils.js.map +1 -0
- package/dist/shopify/router/services/rateLimiter/MemoryStores.d.ts +12 -0
- package/dist/shopify/router/services/rateLimiter/MemoryStores.js +42 -0
- package/dist/shopify/router/services/rateLimiter/MemoryStores.js.map +1 -0
- package/dist/shopify/router/services/rateLimiter/StoreRateLimiter.d.ts +12 -0
- package/dist/shopify/router/services/rateLimiter/StoreRateLimiter.js +37 -0
- package/dist/shopify/router/services/rateLimiter/StoreRateLimiter.js.map +1 -0
- package/dist/test/router/ShopifyRouter.test.d.ts +1 -0
- package/dist/test/router/ShopifyRouter.test.js +52 -0
- package/dist/test/router/ShopifyRouter.test.js.map +1 -0
- package/dist/test/router/WebhookSkipMiddleware.test.d.ts +1 -0
- package/dist/test/router/WebhookSkipMiddleware.test.js +80 -0
- package/dist/test/router/WebhookSkipMiddleware.test.js.map +1 -0
- package/dist/test/router/services/HmacValidator.test.d.ts +1 -0
- package/dist/test/router/services/HmacValidator.test.js +22 -0
- package/dist/test/router/services/HmacValidator.test.js.map +1 -0
- package/dist/test/router/services/RestUtils.test.d.ts +1 -0
- package/dist/test/router/services/RestUtils.test.js +13 -0
- package/dist/test/router/services/RestUtils.test.js.map +1 -0
- package/dist/test/router/services/rateLimiter/StoreRateLimiter.test.d.ts +1 -0
- package/dist/test/router/services/rateLimiter/StoreRateLimiter.test.js +59 -0
- package/dist/test/router/services/rateLimiter/StoreRateLimiter.test.js.map +1 -0
- package/dist/test/services/CacheWrapper.test.d.ts +1 -0
- package/dist/test/services/CacheWrapper.test.js +34 -0
- package/dist/test/services/CacheWrapper.test.js.map +1 -0
- package/dist/test/shopify/ShopifyOrderService.test.d.ts +1 -0
- package/dist/test/shopify/ShopifyOrderService.test.js +32 -0
- package/dist/test/shopify/ShopifyOrderService.test.js.map +1 -0
- package/dist/test/shopify/ShopifyProductService.test.d.ts +1 -0
- package/dist/test/shopify/ShopifyProductService.test.js +127 -0
- package/dist/test/shopify/ShopifyProductService.test.js.map +1 -0
- package/dist/test/shopify/ShopifyWebhookService.test.d.ts +1 -0
- package/dist/test/shopify/ShopifyWebhookService.test.js +99 -0
- package/dist/test/shopify/ShopifyWebhookService.test.js.map +1 -0
- package/package.json +2 -2
- package/shopify/ShopifyUtils.ts +5 -1
package/dist/Logger.d.ts
ADDED
package/dist/Logger.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
+
class Logger {
|
|
6
|
+
}
|
|
7
|
+
exports.Logger = Logger;
|
|
8
|
+
Logger.enableLogging = true;
|
|
9
|
+
Logger.error = (...args) => {
|
|
10
|
+
if (Logger.enableLogging) {
|
|
11
|
+
Logger._error(args);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
Logger.info = (...args) => {
|
|
15
|
+
if (Logger.enableLogging) {
|
|
16
|
+
Logger._info(args);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
Logger._error = (...args) => { };
|
|
20
|
+
Logger._info = (...args) => { };
|
|
21
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../Logger.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,MAAa,MAAM;;AAAnB,wBAgBC;AAfiB,oBAAa,GAAG,IAAI,CAAC;AAErB,YAAK,GAAQ,CAAC,GAAG,IAAI,EAAE,EAAE;IACnC,IAAG,MAAM,CAAC,aAAa,EAAE;QACrB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACvB;AACL,CAAC,CAAC;AACY,WAAI,GAAQ,CAAC,GAAG,IAAI,EAAE,EAAE;IAClC,IAAG,MAAM,CAAC,aAAa,EAAE;QACrB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACtB;AACL,CAAC,CAAC;AAEY,aAAM,GAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,GAAE,CAAC,CAAC;AAC9B,YAAK,GAAQ,CAAC,GAAG,IAAI,EAAE,EAAE,GAAE,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import CacheWrapper from './services/CacheWrapper';
|
|
2
|
+
import HmacValidator from './shopify/router/services/HmacValidator';
|
|
3
|
+
import RestUtils from './shopify/router/services/RestUtils';
|
|
4
|
+
import { ShopifyAssetService } from './shopify/ShopifyAssetService';
|
|
5
|
+
import { ShopifyBillingService } from './shopify/ShopifyBillingService';
|
|
6
|
+
import { ShopifyCollectionService } from './shopify/ShopifyCollectionService';
|
|
7
|
+
import { ShopifyCustomerService } from './shopify/ShopifyCustomerService';
|
|
8
|
+
import { ShopifyDraftOrderService } from './shopify/ShopifyDraftOrderService';
|
|
9
|
+
import { ShopifyFulfillmentService } from './shopify/ShopifyFulfillmentService';
|
|
10
|
+
import { ShopifyInventoryService } from './shopify/ShopifyInventoryService';
|
|
11
|
+
import { ShopifyLocationService } from './shopify/ShopifyLocationService';
|
|
12
|
+
import { ShopifyMandatoryRouter } from './shopify/router/ShopifyMandatoryRouter';
|
|
13
|
+
import { ShopifyOrderRiskService } from './shopify/ShopifyOrderRiskService';
|
|
14
|
+
import { ShopifyOrderService } from './shopify/ShopifyOrderService';
|
|
15
|
+
import { ShopifyPageService } from './shopify/ShopifyPageService';
|
|
16
|
+
import { ShopifyProductService } from './shopify/ShopifyProductService';
|
|
17
|
+
import { ShopifyShopService } from './shopify/ShopifyShopService';
|
|
18
|
+
import { ShopifyTemplateService } from './shopify/ShopifyTemplateService';
|
|
19
|
+
import { ShopifyThemeService } from './shopify/ShopifyThemeService';
|
|
20
|
+
import { ShopifyWebhookService } from './shopify/ShopifyWebhookService';
|
|
21
|
+
import StoreRateLimiter from './shopify/router/services/rateLimiter/StoreRateLimiter';
|
|
22
|
+
import { ShopifyDiscountService } from './shopify/ShopifyDiscountService';
|
|
23
|
+
import { ShopifyOrderRefundsService } from './shopify/ShopifyOrderRefundsService';
|
|
24
|
+
import WebhookSkipMiddleware from './shopify/router/WebhookSkipMiddleware';
|
|
25
|
+
import InspiraShopifyUnableToReserveInventoryError from './shopify/errors/InspiraShopifyUnableToReserveInventoryError';
|
|
26
|
+
import { ShopifyRouter } from './shopify/router/ShopifyRouter';
|
|
27
|
+
import ShopifyRouterBis from './shopify/router/ShopifyRouterBis';
|
|
28
|
+
import ShopifyRouterBisBis from './shopify/router/ShopifyRouterBisBis';
|
|
29
|
+
import ShopifyRouterBisBisBis from './shopify/router/ShopifyRouterBisBisBis';
|
|
30
|
+
import ShopifyRouterBisBisBisBis from './shopify/router/ShopifyRouterBisBisBisBis';
|
|
31
|
+
import { ShopifyDeliveryCustomisationService } from './shopify/ShopifyDeliveryCustomisationService';
|
|
32
|
+
import { ShopifyShippingZonesService } from './shopify/ShopifyShippingZonesService';
|
|
33
|
+
import { ShopifyCartTrasnformationService } from './shopify/ShopifyCartTrasnformationService';
|
|
34
|
+
import { ShopifyFunctionsProductDiscountsService } from './shopify/ShopifyFunctionsProductDiscountsService';
|
|
35
|
+
import { ShopifyAppService } from './shopify/ShopifyAppService';
|
|
36
|
+
export interface ILogger {
|
|
37
|
+
error: (...restOfName: any[]) => void;
|
|
38
|
+
info: (...restOfName: any[]) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface IRest_Options {
|
|
41
|
+
timeout: number;
|
|
42
|
+
retries: number;
|
|
43
|
+
logger: ILogger;
|
|
44
|
+
debug: boolean;
|
|
45
|
+
max_requests_per_sec: number;
|
|
46
|
+
enableCache: boolean;
|
|
47
|
+
cacheTimeInMiliseconds: number;
|
|
48
|
+
}
|
|
49
|
+
export default class ShopifyRest {
|
|
50
|
+
customer: ShopifyCustomerService;
|
|
51
|
+
inventory: ShopifyInventoryService;
|
|
52
|
+
order: ShopifyOrderService;
|
|
53
|
+
product: ShopifyProductService;
|
|
54
|
+
webhook: ShopifyWebhookService;
|
|
55
|
+
fulfillment: ShopifyFulfillmentService;
|
|
56
|
+
store: ShopifyShopService;
|
|
57
|
+
collections: ShopifyCollectionService;
|
|
58
|
+
themes: ShopifyThemeService;
|
|
59
|
+
templates: ShopifyTemplateService;
|
|
60
|
+
assets: ShopifyAssetService;
|
|
61
|
+
billing: ShopifyBillingService;
|
|
62
|
+
draftOrders: ShopifyDraftOrderService;
|
|
63
|
+
locations: ShopifyLocationService;
|
|
64
|
+
orderRisks: ShopifyOrderRiskService;
|
|
65
|
+
shippingZonesService: ShopifyShippingZonesService;
|
|
66
|
+
pages: ShopifyPageService;
|
|
67
|
+
app: ShopifyAppService;
|
|
68
|
+
discounts: ShopifyDiscountService;
|
|
69
|
+
refunds: ShopifyOrderRefundsService;
|
|
70
|
+
shopifyDeliveryCustomisationService: ShopifyDeliveryCustomisationService;
|
|
71
|
+
shopifyCartTrasnformationService: ShopifyCartTrasnformationService;
|
|
72
|
+
shopifyFunctionsProductDiscountsService: ShopifyFunctionsProductDiscountsService;
|
|
73
|
+
private instance;
|
|
74
|
+
constructor(shop: string, token: string, privateAppApiKey: string, privateAppPassword: string, options: IRest_Options);
|
|
75
|
+
/**
|
|
76
|
+
* Enables or disables logging.
|
|
77
|
+
*/
|
|
78
|
+
logging: (enable: boolean) => Promise<void>;
|
|
79
|
+
getQueueInfo: () => {
|
|
80
|
+
request_within_last_second: number;
|
|
81
|
+
apiQueue: number;
|
|
82
|
+
graphQueue: number;
|
|
83
|
+
apiProcessed: number;
|
|
84
|
+
graphProcessed: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export declare const Router: typeof ShopifyRouter;
|
|
88
|
+
export declare const RouterBis: typeof ShopifyRouterBis;
|
|
89
|
+
export declare const RouterBisBis: typeof ShopifyRouterBisBis;
|
|
90
|
+
export declare const RouterBisBisBis: typeof ShopifyRouterBisBisBis;
|
|
91
|
+
export declare const RouterBisBisBisBis: typeof ShopifyRouterBisBisBisBis;
|
|
92
|
+
export declare const MandatoryRoutes: typeof ShopifyMandatoryRouter;
|
|
93
|
+
export declare const HmacUtils: typeof HmacValidator;
|
|
94
|
+
export declare const ShopifyRestUtils: typeof RestUtils;
|
|
95
|
+
export declare const RestCacheWrapper: typeof CacheWrapper;
|
|
96
|
+
export declare const RateLimiter: typeof StoreRateLimiter;
|
|
97
|
+
export declare const ShopifyWebhookSkipMiddleware: typeof WebhookSkipMiddleware;
|
|
98
|
+
export declare const Error_InspiraShopifyUnableToReserveInventoryError: typeof InspiraShopifyUnableToReserveInventoryError;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Error_InspiraShopifyUnableToReserveInventoryError = exports.ShopifyWebhookSkipMiddleware = exports.RateLimiter = exports.RestCacheWrapper = exports.ShopifyRestUtils = exports.HmacUtils = exports.MandatoryRoutes = exports.RouterBisBisBisBis = exports.RouterBisBisBis = exports.RouterBisBis = exports.RouterBis = exports.Router = void 0;
|
|
13
|
+
const CacheWrapper_1 = require("./services/CacheWrapper");
|
|
14
|
+
const HmacValidator_1 = require("./shopify/router/services/HmacValidator");
|
|
15
|
+
const Logger_1 = require("./Logger");
|
|
16
|
+
const RestUtils_1 = require("./shopify/router/services/RestUtils");
|
|
17
|
+
const ShopifyAssetService_1 = require("./shopify/ShopifyAssetService");
|
|
18
|
+
const ShopifyBillingService_1 = require("./shopify/ShopifyBillingService");
|
|
19
|
+
const ShopifyCollectionService_1 = require("./shopify/ShopifyCollectionService");
|
|
20
|
+
const ShopifyCustomerService_1 = require("./shopify/ShopifyCustomerService");
|
|
21
|
+
const ShopifyDraftOrderService_1 = require("./shopify/ShopifyDraftOrderService");
|
|
22
|
+
const ShopifyFulfillmentService_1 = require("./shopify/ShopifyFulfillmentService");
|
|
23
|
+
const ShopifyInventoryService_1 = require("./shopify/ShopifyInventoryService");
|
|
24
|
+
const ShopifyLocationService_1 = require("./shopify/ShopifyLocationService");
|
|
25
|
+
const ShopifyMandatoryRouter_1 = require("./shopify/router/ShopifyMandatoryRouter");
|
|
26
|
+
const ShopifyOrderRiskService_1 = require("./shopify/ShopifyOrderRiskService");
|
|
27
|
+
const ShopifyOrderService_1 = require("./shopify/ShopifyOrderService");
|
|
28
|
+
const ShopifyPageService_1 = require("./shopify/ShopifyPageService");
|
|
29
|
+
const ShopifyProductService_1 = require("./shopify/ShopifyProductService");
|
|
30
|
+
const ShopifyShopService_1 = require("./shopify/ShopifyShopService");
|
|
31
|
+
const ShopifyTemplateService_1 = require("./shopify/ShopifyTemplateService");
|
|
32
|
+
const ShopifyThemeService_1 = require("./shopify/ShopifyThemeService");
|
|
33
|
+
const ShopifyUtils_1 = require("./shopify/ShopifyUtils");
|
|
34
|
+
const ShopifyWebhookService_1 = require("./shopify/ShopifyWebhookService");
|
|
35
|
+
const StoreRateLimiter_1 = require("./shopify/router/services/rateLimiter/StoreRateLimiter");
|
|
36
|
+
const ShopifyDiscountService_1 = require("./shopify/ShopifyDiscountService");
|
|
37
|
+
const ShopifyOrderRefundsService_1 = require("./shopify/ShopifyOrderRefundsService");
|
|
38
|
+
const WebhookSkipMiddleware_1 = require("./shopify/router/WebhookSkipMiddleware");
|
|
39
|
+
const InspiraShopifyUnableToReserveInventoryError_1 = require("./shopify/errors/InspiraShopifyUnableToReserveInventoryError");
|
|
40
|
+
const ShopifyRouter_1 = require("./shopify/router/ShopifyRouter");
|
|
41
|
+
const ShopifyRouterBis_1 = require("./shopify/router/ShopifyRouterBis");
|
|
42
|
+
const ShopifyRouterBisBis_1 = require("./shopify/router/ShopifyRouterBisBis");
|
|
43
|
+
const ShopifyRouterBisBisBis_1 = require("./shopify/router/ShopifyRouterBisBisBis");
|
|
44
|
+
const ShopifyRouterBisBisBisBis_1 = require("./shopify/router/ShopifyRouterBisBisBisBis");
|
|
45
|
+
const ShopifyDeliveryCustomisationService_1 = require("./shopify/ShopifyDeliveryCustomisationService");
|
|
46
|
+
const ShopifyShippingZonesService_1 = require("./shopify/ShopifyShippingZonesService");
|
|
47
|
+
const ShopifyCartTrasnformationService_1 = require("./shopify/ShopifyCartTrasnformationService");
|
|
48
|
+
const ShopifyFunctionsProductDiscountsService_1 = require("./shopify/ShopifyFunctionsProductDiscountsService");
|
|
49
|
+
const ShopifyAppService_1 = require("./shopify/ShopifyAppService");
|
|
50
|
+
class ShopifyRest {
|
|
51
|
+
constructor(shop, token, privateAppApiKey, privateAppPassword, options) {
|
|
52
|
+
this.instance = null;
|
|
53
|
+
/**
|
|
54
|
+
* Enables or disables logging.
|
|
55
|
+
*/
|
|
56
|
+
this.logging = (enable) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
Logger_1.Logger.enableLogging = enable;
|
|
58
|
+
});
|
|
59
|
+
this.getQueueInfo = () => {
|
|
60
|
+
return this.instance.getQueueInfo();
|
|
61
|
+
};
|
|
62
|
+
if (options) {
|
|
63
|
+
if (options.debug) {
|
|
64
|
+
if (!options.logger)
|
|
65
|
+
throw 'If debug mode is on then a looger must be set into options';
|
|
66
|
+
Logger_1.Logger._error = options.logger.error;
|
|
67
|
+
Logger_1.Logger._info = options.logger.info;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const instance = ShopifyUtils_1.ShopifyUtils.getAxiosInstance(shop, token, privateAppApiKey, privateAppPassword, options);
|
|
71
|
+
this.customer = new ShopifyCustomerService_1.ShopifyCustomerService(instance);
|
|
72
|
+
this.inventory = new ShopifyInventoryService_1.ShopifyInventoryService(instance);
|
|
73
|
+
this.order = new ShopifyOrderService_1.ShopifyOrderService(instance);
|
|
74
|
+
this.product = new ShopifyProductService_1.ShopifyProductService(instance);
|
|
75
|
+
this.webhook = new ShopifyWebhookService_1.ShopifyWebhookService(instance);
|
|
76
|
+
this.fulfillment = new ShopifyFulfillmentService_1.ShopifyFulfillmentService(instance);
|
|
77
|
+
this.store = new ShopifyShopService_1.ShopifyShopService(instance);
|
|
78
|
+
this.collections = new ShopifyCollectionService_1.ShopifyCollectionService(instance);
|
|
79
|
+
this.themes = new ShopifyThemeService_1.ShopifyThemeService(instance);
|
|
80
|
+
this.templates = new ShopifyTemplateService_1.ShopifyTemplateService(instance);
|
|
81
|
+
this.assets = new ShopifyAssetService_1.ShopifyAssetService(instance);
|
|
82
|
+
this.billing = new ShopifyBillingService_1.ShopifyBillingService(instance);
|
|
83
|
+
this.draftOrders = new ShopifyDraftOrderService_1.ShopifyDraftOrderService(instance);
|
|
84
|
+
this.locations = new ShopifyLocationService_1.ShopifyLocationService(instance);
|
|
85
|
+
this.orderRisks = new ShopifyOrderRiskService_1.ShopifyOrderRiskService(instance);
|
|
86
|
+
this.pages = new ShopifyPageService_1.ShopifyPageService(instance);
|
|
87
|
+
this.app = new ShopifyAppService_1.ShopifyAppService(instance);
|
|
88
|
+
this.discounts = new ShopifyDiscountService_1.ShopifyDiscountService(instance);
|
|
89
|
+
this.refunds = new ShopifyOrderRefundsService_1.ShopifyOrderRefundsService(instance);
|
|
90
|
+
this.shippingZonesService = new ShopifyShippingZonesService_1.ShopifyShippingZonesService(instance);
|
|
91
|
+
this.shopifyDeliveryCustomisationService = new ShopifyDeliveryCustomisationService_1.ShopifyDeliveryCustomisationService(instance);
|
|
92
|
+
this.shopifyCartTrasnformationService = new ShopifyCartTrasnformationService_1.ShopifyCartTrasnformationService(instance);
|
|
93
|
+
this.shopifyFunctionsProductDiscountsService = new ShopifyFunctionsProductDiscountsService_1.ShopifyFunctionsProductDiscountsService(instance);
|
|
94
|
+
this.instance = instance;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.default = ShopifyRest;
|
|
98
|
+
exports.Router = ShopifyRouter_1.ShopifyRouter;
|
|
99
|
+
exports.RouterBis = ShopifyRouterBis_1.default;
|
|
100
|
+
exports.RouterBisBis = ShopifyRouterBisBis_1.default;
|
|
101
|
+
exports.RouterBisBisBis = ShopifyRouterBisBisBis_1.default;
|
|
102
|
+
exports.RouterBisBisBisBis = ShopifyRouterBisBisBisBis_1.default;
|
|
103
|
+
exports.MandatoryRoutes = ShopifyMandatoryRouter_1.ShopifyMandatoryRouter;
|
|
104
|
+
exports.HmacUtils = HmacValidator_1.default;
|
|
105
|
+
exports.ShopifyRestUtils = RestUtils_1.default;
|
|
106
|
+
exports.RestCacheWrapper = CacheWrapper_1.default;
|
|
107
|
+
exports.RateLimiter = StoreRateLimiter_1.default;
|
|
108
|
+
exports.ShopifyWebhookSkipMiddleware = WebhookSkipMiddleware_1.default;
|
|
109
|
+
exports.Error_InspiraShopifyUnableToReserveInventoryError = InspiraShopifyUnableToReserveInventoryError_1.default;
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAoD;AACpD,2EAAoE;AACpE,qCAAkC;AAClC,mEAA4D;AAC5D,uEAAoE;AACpE,2EAAwE;AACxE,iFAA8E;AAC9E,6EAA0E;AAC1E,iFAA8E;AAC9E,mFAAgF;AAChF,+EAA4E;AAC5E,6EAA0E;AAC1E,oFAAiF;AACjF,+EAA4E;AAC5E,uEAAoE;AACpE,qEAAkE;AAClE,2EAAwE;AACxE,qEAAkE;AAClE,6EAA0E;AAC1E,uEAAoE;AACpE,yDAA6E;AAC7E,2EAAwE;AACxE,6FAAsF;AACtF,6EAA0E;AAC1E,qFAAkF;AAClF,kFAA2E;AAC3E,8HAAuH;AACvH,kEAA+D;AAC/D,wEAAiE;AACjE,8EAAuE;AACvE,oFAA6E;AAC7E,0FAAmF;AACnF,uGAAoG;AACpG,uFAAoF;AACpF,iGAA8F;AAC9F,+GAA4G;AAC5G,mEAAgE;AAShE,MAAqB,WAAW;IA4B5B,YAAY,IAAY,EAAE,KAAa,EAAE,gBAAwB,EAAE,kBAA0B,EAAE,OAAsB;QAH7G,aAAQ,GAA0B,IAAI,CAAC;QAsC/C;;WAEG;QACI,YAAO,GAAG,CAAO,MAAe,EAAiB,EAAE;YACtD,eAAM,C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,eAAe,GAAG,+CAAsB,CAAC;AACzC,QAAA,SAAS,GAAG,uBAAa,CAAC;AAC1B,QAAA,gBAAgB,GAAG,mBAAS,CAAC;AAC7B,QAAA,gBAAgB,GAAG,sBAAY,CAAC;AAChC,QAAA,WAAW,GAAG,0BAAgB,CAAC;AAC/B,QAAA,4BAA4B,GAAG,+BAAqB,CAAC;AACrD,QAAA,iDAAiD,GAAG,qDAA2C,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
class CacheWrapper {
|
|
13
|
+
constructor(maxSize, call) {
|
|
14
|
+
this.maxSize = maxSize;
|
|
15
|
+
this.call = call;
|
|
16
|
+
this.records = new Map();
|
|
17
|
+
this.execute = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
const key = args[0];
|
|
20
|
+
if (this.records.has(key)) {
|
|
21
|
+
resolve(this.records.get(key));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const value = this.call.apply(null, args);
|
|
25
|
+
this.clearEntry();
|
|
26
|
+
this.records.set(key, value);
|
|
27
|
+
resolve(value);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
this.clear = () => {
|
|
31
|
+
this.records.clear();
|
|
32
|
+
};
|
|
33
|
+
this.clearEntry = () => {
|
|
34
|
+
if (this.records.size > this.maxSize) {
|
|
35
|
+
this.records.delete(this.records.keys().next().value);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = CacheWrapper;
|
|
41
|
+
//# sourceMappingURL=CacheWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheWrapper.js","sourceRoot":"","sources":["../../services/CacheWrapper.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAqB,YAAY;IAI7B,YAAoB,OAAe,EAAU,IAAS;QAAlC,YAAO,GAAP,OAAO,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAK;QAF9C,YAAO,GAAqB,IAAI,GAAG,EAAe,CAAC;QAIpD,YAAO,GAAG,CAAO,GAAG,IAAI,EAAc,EAAE;YAC3C,OAAO,IAAI,OAAO,CAAK,CAAC,OAAO,EAAE,EAAE;gBAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;oBACrB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC/B,OAAO;iBACV;gBACD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC1C,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC;QACP,CAAC,CAAA,CAAC;QAEK,UAAK,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC,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