@speedkit/cli 2.31.1 → 2.32.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 (94) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -1
  3. package/dist/helpers/file-helper.d.ts +6 -0
  4. package/dist/helpers/file-helper.js +6 -0
  5. package/dist/helpers/race.d.ts +1 -1
  6. package/dist/helpers/race.js +8 -9
  7. package/dist/helpers/safe.js +2 -2
  8. package/dist/models/cli-parameters.js +4 -3
  9. package/dist/services/athena/athena-service.js +3 -2
  10. package/dist/services/athena/error/athena-query-error.d.ts +4 -0
  11. package/dist/services/athena/error/athena-query-error.js +9 -0
  12. package/dist/services/athena/error/fetch-credentials-error.d.ts +5 -1
  13. package/dist/services/athena/error/fetch-credentials-error.js +9 -1
  14. package/dist/services/bundler/bundle-service.js +5 -3
  15. package/dist/services/bundler/error/bundle-fetch-error.d.ts +3 -0
  16. package/dist/services/bundler/error/bundle-fetch-error.js +8 -0
  17. package/dist/services/bundler/error/bundle-resolve-error.d.ts +3 -0
  18. package/dist/services/bundler/error/bundle-resolve-error.js +8 -0
  19. package/dist/services/config-api/client.d.ts +1 -1
  20. package/dist/services/config-api/client.js +29 -7
  21. package/dist/services/config-api/error/json-response-error.d.ts +3 -1
  22. package/dist/services/config-api/error/json-response-error.js +4 -1
  23. package/dist/services/config-api/error/login-error.d.ts +3 -3
  24. package/dist/services/config-api/error/login-error.js +3 -4
  25. package/dist/services/config-api/factory/config-api-service-factory.js +2 -1
  26. package/dist/services/config-api-service.d.ts +3 -0
  27. package/dist/services/config-api-service.js +3 -0
  28. package/dist/services/customer-config/customer-config-service-model.d.ts +2 -0
  29. package/dist/services/customer-config/customer-config-service.js +10 -2
  30. package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +35 -1
  31. package/dist/services/customer-config/templates/config_documentHandler.js.hbs +112 -112
  32. package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +290 -108
  33. package/dist/services/customer-config/templates/config_dynamicStyles.css.hbs +8 -8
  34. package/dist/services/customer-config/templates/config_loadHandler.js.hbs +61 -0
  35. package/dist/services/deploy/error/file-handler-error.d.ts +4 -0
  36. package/dist/services/deploy/error/file-handler-error.js +9 -0
  37. package/dist/services/diff-service.d.ts +3 -0
  38. package/dist/services/diff-service.js +3 -0
  39. package/dist/services/document-handler-runtime/document-handler-server.js +2 -4
  40. package/dist/services/error-handling/error/application-error.d.ts +18 -0
  41. package/dist/services/error-handling/error/application-error.js +28 -0
  42. package/dist/services/error-handling/error/config-file-error.d.ts +4 -0
  43. package/dist/services/error-handling/error/config-file-error.js +9 -0
  44. package/dist/services/error-handling/error/connection-error.d.ts +4 -0
  45. package/dist/services/error-handling/error/connection-error.js +9 -0
  46. package/dist/services/integration-api/error/customer-config-error.d.ts +2 -1
  47. package/dist/services/integration-api/error/customer-config-error.js +2 -1
  48. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +3 -1
  49. package/dist/services/integration-api/error/customer-config-legacy-error.js +4 -1
  50. package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +3 -2
  51. package/dist/services/integration-api/error/mandatory-file-missing-error.js +4 -4
  52. package/dist/services/integration-api/error/origin-error.d.ts +2 -1
  53. package/dist/services/integration-api/error/origin-error.js +2 -1
  54. package/dist/services/integration-api/error/read-files-error.d.ts +5 -0
  55. package/dist/services/integration-api/error/read-files-error.js +10 -0
  56. package/dist/services/integration-api/external/external-file-reader.js +8 -2
  57. package/dist/services/integration-api/file-reader.js +12 -4
  58. package/dist/services/integration-api/handler/customer-config-handler.d.ts +1 -0
  59. package/dist/services/integration-api/handler/customer-config-handler.js +22 -5
  60. package/dist/services/integration-api/handler/install-resource-handler.js +2 -1
  61. package/dist/services/integration-api/integration-api-service.js +2 -1
  62. package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +4 -3
  63. package/dist/services/integration-api/validator/customer-config-validator.js +1 -1
  64. package/dist/services/integration-api/validator/mandatory-files-validator.js +6 -2
  65. package/dist/services/onboarding/error/vm-error.d.ts +3 -1
  66. package/dist/services/onboarding/error/vm-error.js +4 -1
  67. package/dist/services/onboarding/fetch-event-handler.js +1 -1
  68. package/dist/services/onboarding/todo-collector.d.ts +1 -1
  69. package/dist/services/onboarding/todo-collector.js +2 -2
  70. package/dist/services/prewarm/csv-reader.js +1 -3
  71. package/dist/services/prewarm/error/invalid-origin-error.d.ts +2 -1
  72. package/dist/services/prewarm/error/invalid-origin-error.js +3 -1
  73. package/dist/services/prewarm/error/read-csv-error.d.ts +4 -5
  74. package/dist/services/prewarm/error/read-csv-error.js +5 -8
  75. package/oclif.manifest.json +7 -1
  76. package/package.json +1 -1
  77. package/dist/helpers/get-chrome-path.d.ts +0 -7
  78. package/dist/helpers/get-chrome-path.js +0 -31
  79. package/dist/helpers/is-executable.d.ts +0 -1
  80. package/dist/helpers/is-executable.js +0 -15
  81. package/dist/helpers/watch-files.d.ts +0 -1
  82. package/dist/helpers/watch-files.js +0 -20
  83. package/dist/services/deploy/error/create-find-temporary-directory-error.d.ts +0 -4
  84. package/dist/services/deploy/error/create-find-temporary-directory-error.js +0 -10
  85. package/dist/services/deploy/error/deploy-app-error.d.ts +0 -2
  86. package/dist/services/deploy/error/deploy-app-error.js +0 -5
  87. package/dist/services/deploy/error/no-active-installation-error.d.ts +0 -4
  88. package/dist/services/deploy/error/no-active-installation-error.js +0 -10
  89. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +0 -5
  90. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +0 -24
  91. package/dist/services/integration-api/error/handler/origin-handler.d.ts +0 -5
  92. package/dist/services/integration-api/error/handler/origin-handler.js +0 -22
  93. package/dist/services/integration-api/error/load-customer-error.d.ts +0 -4
  94. package/dist/services/integration-api/error/load-customer-error.js +0 -10
@@ -1,130 +1,130 @@
1
1
  {{#unless addPreRendering}}
2
2
  {{#if removeLazyLoading}}
3
- const lazyLoadDefaultConfig = {
4
- attributes: [
5
- { find: 'data-src', set: 'src' },
6
- { find: 'data-srcset', set: 'srcset' },
7
- ],
8
- lazyClass: 'lazyload',
9
- lazyLoad: false,
10
- preload: true, // preload lazy-removed images in head
11
- }
3
+ const lazyLoadDefaultConfig = {
4
+ attributes: [
5
+ {find: 'data-src', set: 'src'},
6
+ {find: 'data-srcset', set: 'srcset'},
7
+ ],
8
+ lazyClass: 'lazyload',
9
+ lazyLoad: false,
10
+ preload: true // preload lazy-removed images in head
11
+ }
12
12
 
13
- const lazyLoadList = [
14
- // TODO: adjust/replace this exemplary list
13
+ const lazyLoadList = [
14
+ // TODO: adjust/replace this exemplary list
15
15
 
16
- // Content page's stage image:
17
- {
18
- ...lazyLoadDefaultConfig,
19
- parentClasses: [
20
- 'image-with-text-overlay__banner',
21
- ],
22
- limit: 1
23
- },
16
+ // Content page's stage image:
17
+ {
18
+ ...lazyLoadDefaultConfig,
19
+ parentClasses: [
20
+ 'image-with-text-overlay__banner',
21
+ ],
22
+ limit: 1
23
+ },
24
24
 
25
- // PLP product images:
26
- {
27
- ...lazyLoadDefaultConfig,
28
- parentClasses: [
29
- 'product-image__wrapper',
30
- ],
31
- limit: 4
32
- },
25
+ // PLP product images:
26
+ {
27
+ ...lazyLoadDefaultConfig,
28
+ parentClasses: [
29
+ 'product-image__wrapper',
30
+ ],
31
+ limit: 4
32
+ },
33
33
 
34
- // PDP hero image:
35
- {
36
- ...lazyLoadDefaultConfig,
37
- parentClasses: [
38
- 'product-gallery__image',
39
- ],
40
- limit: 1
41
- },
42
- ];
34
+ // PDP hero image:
35
+ {
36
+ ...lazyLoadDefaultConfig,
37
+ parentClasses: [
38
+ 'product-gallery__image',
39
+ ],
40
+ limit: 1
41
+ },
42
+ ];
43
43
 
44
44
  {{/if}}
45
45
  {{/unless}}
46
46
  const config = {
47
- rejectHTML({ db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers }) {
47
+ rejectHTML({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
48
48
  /* Use to configure guards to prevent e.g. error and captcha pages from being cached */
49
49
  return false;
50
50
  },
51
- blacklistHTML({ db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers }) {
51
+ blacklistHTML({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
52
52
  /* Use to configure guards to black-list e.g. specific page types */
53
53
  return false;
54
54
  },
55
- shouldTransform({ db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers }) {
55
+ shouldTransform({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
56
56
  return true;
57
57
  },
58
- shouldDelayDom({ db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers }) {
59
- {{#if isPlentymarkets}}
60
- return false; // Plentymarkets specific
61
- {{else}}
62
- return true;
63
- {{/if}}
58
+ shouldDelayDom({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
59
+ {{#if isPlentymarkets}}
60
+ return false; // Plentymarkets specific
61
+ {{else}}
62
+ return true;
63
+ {{/if}}
64
64
  },
65
65
  async preTransform({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
66
- {{#unless addPreRendering}}
67
- return html;
68
- {{else}}
69
- // do nothing
70
- {{/unless}}
66
+ {{#unless addPreRendering}}
67
+ return html;
68
+ {{else}}
69
+ // do nothing
70
+ {{/unless}}
71
71
  },
72
72
  postTransform({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
73
- {{#unless addPreRendering}}
74
- {{#if includeServiceWorker}}
75
- html = injectServiceWorkerScript(html, '{{includeServiceWorker}}');
76
- {{/if}}
77
- return html;
78
- {{else}}
79
- // do nothing
80
- {{/unless}}
73
+ {{#unless addPreRendering}}
74
+ {{#if includeServiceWorker}}
75
+ html = injectServiceWorkerScript(html, '{{includeServiceWorker}}');
76
+ {{/if}}
77
+ return html;
78
+ {{else}}
79
+ // do nothing
80
+ {{/unless}}
81
81
  },
82
- {{#if isPlentymarkets}}
83
- stripComments: false, // Plentymarkets specific
84
- {{/if}}
85
- {{#if isShopify}}
86
- delayScriptPath: "/apps/speed-kit/speed-kit-dom-ready.js", // Shopify specific
87
- {{else}}
88
- delayScriptPath: "/speed-kit-dom-ready.js",
89
- {{/if}}
90
- executeDeploymentDetection: true,
91
- {{#unless addPreRendering}}
92
- {{#if removeLazyLoading}}
93
- lazyLoadList,
82
+ {{#if isPlentymarkets}}
83
+ stripComments: false, // Plentymarkets specific
94
84
  {{/if}}
95
- {{else}}
96
- preRender: {
97
- lambdaUrl: 'https://pw5wfiqnr2kqdzzc45tu3rdjue0zildl.lambda-url.eu-central-1.on.aws',
98
- elements: [
99
- // app shell e.g. vue often uses #app
100
- // this will be the main element to extract from the rendered DOM
101
- { selector: '#app' }
102
- ],
103
- guards: [
104
- { // plp
105
- whenPresent: '.products-list-page', // check wait for selectors, when this is present on current Page
106
- waitFor: [
107
- // e.g. wait for first 4 images to be loaded
108
- '.products-list-page__products-list .products-list__tiles__element:nth-child(-n+4) img[src=""]',
109
- ],
110
- },
111
- ],
112
- rules: {
113
- url: [
114
- // additional domains for the page to work need to be added here (main domain is already added)
115
- '<scripts-domain.com>',
85
+ {{#if isShopify}}
86
+ delayScriptPath: "/apps/speed-kit/speed-kit-dom-ready.js", // Shopify specific
87
+ {{else}}
88
+ delayScriptPath: "/speed-kit-dom-ready.js",
89
+ {{/if}}
90
+ executeDeploymentDetection: true,
91
+ {{#unless addPreRendering}}
92
+ {{#if removeLazyLoading}}
93
+ lazyLoadList,
94
+ {{/if}}
95
+ {{else}}
96
+ preRender: {
97
+ lambdaUrl: 'https://pw5wfiqnr2kqdzzc45tu3rdjue0zildl.lambda-url.eu-central-1.on.aws',
98
+ elements: [
99
+ // app shell e.g. vue often uses #app
100
+ // this will be the main element to extract from the rendered DOM
101
+ {selector: '#app'}
116
102
  ],
117
- resourceType: [
118
- // only resource types listed here will be fetched
119
- 'xhr',
120
- 'font',
121
- 'script',
122
- 'document',
123
- 'stylesheet',
103
+ guards: [
104
+ { // plp
105
+ whenPresent: '.products-list-page', // check wait for selectors, when this is present on current Page
106
+ waitFor: [
107
+ // e.g. wait for first 4 images to be loaded
108
+ '.products-list-page__products-list .products-list__tiles__element:nth-child(-n+4) img[src=""]',
109
+ ],
110
+ },
124
111
  ],
112
+ rules: {
113
+ url: [
114
+ // additional domains for the page to work need to be added here (main domain is already added)
115
+ '<scripts-domain.com>',
116
+ ],
117
+ resourceType: [
118
+ // only resource types listed here will be fetched
119
+ 'xhr',
120
+ 'font',
121
+ 'script',
122
+ 'document',
123
+ 'stylesheet',
124
+ ],
125
+ },
125
126
  },
126
- },
127
- {{/unless}}
127
+ {{/unless}}
128
128
  }
129
129
 
130
130
  const documentHandler = new DocumentHandler({
@@ -139,19 +139,19 @@ export const post = async (db, req, res) => {
139
139
  await documentHandler.transformAndSend(db, req, res);
140
140
  }
141
141
  {{#unless addPreRendering}}
142
- {{#if includeServiceWorker}}
142
+ {{#if includeServiceWorker}}
143
143
 
144
- //================================================================================
145
- // Utility Functions
146
- //================================================================================
144
+ //================================================================================
145
+ // Utility Functions
146
+ //================================================================================
147
147
 
148
- function prepend(string, searchString, prependString) {
149
- const index = string.lastIndexOf(searchString);
150
- return string.slice(0, index) + prependString + string.slice(index);
151
- }
148
+ function prepend(string, searchString, prependString) {
149
+ const index = string.lastIndexOf(searchString);
150
+ return string.slice(0, index) + prependString + string.slice(index);
151
+ }
152
152
 
153
- function injectServiceWorkerScript(html, searchedSwPath) {
154
- return prepend(html, '</head>', `
153
+ function injectServiceWorkerScript(html, searchedSwPath) {
154
+ return prepend(html, '</head>', `
155
155
  <script class="speed-kit-service-worker">
156
156
  var serviceWorkerRegister = ServiceWorkerContainer.prototype.register;
157
157
  ServiceWorkerContainer.prototype.register = function (swPath, options) {
@@ -162,6 +162,6 @@ function injectServiceWorkerScript(html, searchedSwPath) {
162
162
  };
163
163
  </script>
164
164
  `);
165
- }
166
- {{/if}}
165
+ }
166
+ {{/if}}
167
167
  {{/unless}}