@speedkit/cli 2.58.0 → 2.60.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [2.60.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.59.0...v2.60.0) (2024-10-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * **customer-config:** extend default blacklist ([84f4844](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/84f48441086312d4621901ed9deff89e472fe393))
7
+
8
+ # [2.59.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.58.0...v2.59.0) (2024-10-08)
9
+
10
+
11
+ ### Features
12
+
13
+ * **prewarm:** handle rateLimiter on retry ([b744295](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b7442959fded70807d7d0d6ae4e58cc4afa756f3))
14
+ * **prewarm:** increase rateLimit after successfull batch ([d112927](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d11292731b0151a0e467b595630673f452bdf845))
15
+
1
16
  # [2.58.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.57.1...v2.58.0) (2024-09-27)
2
17
 
3
18
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/2.58.0 linux-x64 node-v20.17.0
24
+ @speedkit/cli/2.60.0 linux-x64 node-v20.18.0
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -153,17 +153,22 @@
153
153
  // TODO: adjust/replace this exemplary list
154
154
 
155
155
  // Login & Account:
156
- /\/account/i,
156
+ /account/i,
157
+ /profile/i,
157
158
  /password/i,
158
159
  /registration/i,
159
160
  /register/i,
160
161
  /login/i,
161
162
  /authenticate/i,
163
+ /wish(?:-)list/i,
162
164
 
163
165
  // Checkout & Payment:
164
- /\/cart/i,
165
- /\/basket/i,
166
+ /cart/i,
167
+ /basket/i,
166
168
  /checkout/i,
169
+ /order/i,
170
+ /success/i,
171
+ /confirmation/i,
167
172
  /payment/i,
168
173
  /paypal/i,
169
174
  /klarna/i,
@@ -183,14 +188,9 @@
183
188
  {{#if isPlentymarkets}}
184
189
 
185
190
  // Plentymarkets specific:
186
- /\/mein-warenkorb/i,
187
- /\/mein-checkout/i,
188
- /\/my-account/i,
189
- /\/myaccount/i,
190
- /\/mein-kundenkonto/i,
191
- /\/wish-list/i,
192
191
  /\/rest/i, // REST API
193
- /place-order/i,
192
+ /kundenkonto/i,
193
+ /warenkorb/i,
194
194
  {{/if}}
195
195
  {{#if isSalesforce}}
196
196
 
@@ -4,10 +4,14 @@ export declare class AssetApiClient {
4
4
  private sortParameters;
5
5
  private agent;
6
6
  private rateLimit;
7
+ private lowestRateLimit;
8
+ private isRetry;
7
9
  constructor(authenticationToken: string, app: string, sortParameters: boolean);
8
10
  fetchURL(url: string, variation: string): Promise<Response>;
11
+ setIsRetry(): void;
9
12
  getRateLimit(): number;
10
13
  reduceMaxRequestsPerSecond(): void;
14
+ increaseMaxRequestsPerSecond(): void;
11
15
  private isValidUrl;
12
16
  private setRateLimit;
13
17
  }
@@ -16,7 +16,9 @@ class AssetApiClient {
16
16
  keepAlive: true,
17
17
  rejectUnauthorized: false,
18
18
  });
19
- rateLimit = __1.DEFAULT_MAX_REQUESTS_PER_SECOND;
19
+ rateLimit = __1.DEFAULT_REQUESTS_PER_SECOND;
20
+ lowestRateLimit = __1.DEFAULT_REQUESTS_PER_SECOND;
21
+ isRetry = false;
20
22
  constructor(authenticationToken, app, sortParameters) {
21
23
  this.authenticationToken = authenticationToken;
22
24
  this.app = app;
@@ -39,11 +41,23 @@ class AssetApiClient {
39
41
  method: "HEAD",
40
42
  });
41
43
  }
44
+ setIsRetry() {
45
+ this.isRetry = true;
46
+ this.rateLimit = this.lowestRateLimit;
47
+ }
42
48
  getRateLimit() {
43
49
  return this.rateLimit;
44
50
  }
45
51
  reduceMaxRequestsPerSecond() {
46
52
  this.setRateLimit(this.rateLimit * __1.RATE_LIMIT_MULTIPLICATOR);
53
+ if (this.rateLimit < this.lowestRateLimit) {
54
+ this.lowestRateLimit = this.rateLimit;
55
+ }
56
+ }
57
+ increaseMaxRequestsPerSecond() {
58
+ if (this.rateLimit + 1 <= __1.MAX_REQUESTS_PER_SECOND && !this.isRetry) {
59
+ this.setRateLimit(this.rateLimit + 1);
60
+ }
47
61
  }
48
62
  isValidUrl(url) {
49
63
  if (!node_url_1.URL.canParse(url)) {
@@ -28,7 +28,8 @@ export declare enum ItemStatus {
28
28
  export declare const MIN_TIME_TO_FETCH_BATCH = 1000;
29
29
  export declare const FETCH_TIMEOUT = 10000;
30
30
  export declare const TIMOUT_AFTER_DETECTED_RATE_LIMIT = 5000;
31
- export declare const DEFAULT_MAX_REQUESTS_PER_SECOND = 15;
31
+ export declare const DEFAULT_REQUESTS_PER_SECOND = 10;
32
+ export declare const MAX_REQUESTS_PER_SECOND = 20;
32
33
  export declare const RATE_LIMIT_MULTIPLICATOR = 0.8;
33
34
  export declare const RATE_LIMIT_CODES: string[];
34
35
  export declare const TIMING_HEADER_ERROR_CODE_SELECTOR: RegExp;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_VARIATION = exports.VARIATION_SEPARATOR = exports.PROGRESS_BAR_FORMAT = exports.TIMING_HEADER_KEY = exports.TIMING_HEADER_ERROR_CODE_SELECTOR = exports.RATE_LIMIT_CODES = exports.RATE_LIMIT_MULTIPLICATOR = exports.DEFAULT_MAX_REQUESTS_PER_SECOND = exports.TIMOUT_AFTER_DETECTED_RATE_LIMIT = exports.FETCH_TIMEOUT = exports.MIN_TIME_TO_FETCH_BATCH = exports.ItemStatus = exports.PreWarmContext = void 0;
3
+ exports.DEFAULT_VARIATION = exports.VARIATION_SEPARATOR = exports.PROGRESS_BAR_FORMAT = exports.TIMING_HEADER_KEY = exports.TIMING_HEADER_ERROR_CODE_SELECTOR = exports.RATE_LIMIT_CODES = exports.RATE_LIMIT_MULTIPLICATOR = exports.MAX_REQUESTS_PER_SECOND = exports.DEFAULT_REQUESTS_PER_SECOND = exports.TIMOUT_AFTER_DETECTED_RATE_LIMIT = exports.FETCH_TIMEOUT = exports.MIN_TIME_TO_FETCH_BATCH = exports.ItemStatus = exports.PreWarmContext = void 0;
4
4
  class PreWarmContext {
5
5
  app;
6
6
  path;
@@ -28,7 +28,8 @@ var ItemStatus;
28
28
  exports.MIN_TIME_TO_FETCH_BATCH = 1000;
29
29
  exports.FETCH_TIMEOUT = 10_000;
30
30
  exports.TIMOUT_AFTER_DETECTED_RATE_LIMIT = 5000;
31
- exports.DEFAULT_MAX_REQUESTS_PER_SECOND = 15;
31
+ exports.DEFAULT_REQUESTS_PER_SECOND = 10;
32
+ exports.MAX_REQUESTS_PER_SECOND = 20;
32
33
  exports.RATE_LIMIT_MULTIPLICATOR = 0.8;
33
34
  exports.RATE_LIMIT_CODES = ["308", "310", "316"];
34
35
  exports.TIMING_HEADER_ERROR_CODE_SELECTOR = /errorcode;desc=([^,]*),/;
@@ -63,6 +63,7 @@ class PreWarmService {
63
63
  .getByStatus(_1.ItemStatus.RETRY)
64
64
  .map((entry) => entry.url);
65
65
  const retryList = this.generateAssetRequestList(urlsToRetry);
66
+ this.assetClient.setIsRetry();
66
67
  await this.fetchUrls(retryList);
67
68
  await this.printSummary(retryList);
68
69
  }
@@ -152,7 +153,9 @@ class PreWarmService {
152
153
  if (retryCount > 0) {
153
154
  await this.sleep(_1.TIMOUT_AFTER_DETECTED_RATE_LIMIT);
154
155
  this.assetClient.reduceMaxRequestsPerSecond();
156
+ return;
155
157
  }
158
+ this.assetClient.increaseMaxRequestsPerSecond();
156
159
  }
157
160
  showMinimalStatusUpdate(batch, assetList) {
158
161
  if (!this.cli.quiet) {
@@ -712,5 +712,5 @@
712
712
  ]
713
713
  }
714
714
  },
715
- "version": "2.58.0"
715
+ "version": "2.60.0"
716
716
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.58.0",
4
+ "version": "2.60.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"