cloudcommerce 2.6.1 → 2.6.2
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 +7 -0
- package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
- package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme-v5/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/lib/cron-ssr-save-views.js +21 -16
- package/packages/ssr/lib/lib/cron-ssr-save-views.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/lib/cron-ssr-save-views.ts +27 -20
- package/packages/storefront/package.json +1 -1
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.6.2](https://github.com/ecomplus/cloud-commerce/compare/v2.6.1...v2.6.2) (2024-02-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ssr:** Ensure cache refresh req is sent after CDN cache purge on cron save views ([943f001](https://github.com/ecomplus/cloud-commerce/commit/943f00128e618354b84fd203db071b6245351281))
|
|
11
|
+
|
|
5
12
|
### [2.6.1](https://github.com/ecomplus/cloud-commerce/compare/v2.6.0...v2.6.1) (2024-02-24)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^2.6.
|
|
19
|
-
"@cloudcommerce/firebase": "^2.6.
|
|
20
|
-
"@cloudcommerce/passport": "^2.6.
|
|
18
|
+
"@cloudcommerce/feeds": "^2.6.1",
|
|
19
|
+
"@cloudcommerce/firebase": "^2.6.1",
|
|
20
|
+
"@cloudcommerce/passport": "^2.6.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cloudcommerce/api": "^2.6.
|
|
23
|
-
"@cloudcommerce/firebase": "^2.6.
|
|
24
|
-
"@cloudcommerce/ssr": "^2.6.
|
|
22
|
+
"@cloudcommerce/api": "^2.6.1",
|
|
23
|
+
"@cloudcommerce/firebase": "^2.6.1",
|
|
24
|
+
"@cloudcommerce/ssr": "^2.6.1",
|
|
25
25
|
"@headlessui/vue": "^1.7.18",
|
|
26
26
|
"micromark": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/i18n": "^2.6.
|
|
30
|
-
"@cloudcommerce/storefront": "^2.6.
|
|
31
|
-
"@cloudcommerce/types": "^2.6.
|
|
29
|
+
"@cloudcommerce/i18n": "^2.6.1",
|
|
30
|
+
"@cloudcommerce/storefront": "^2.6.1",
|
|
31
|
+
"@cloudcommerce/types": "^2.6.1",
|
|
32
32
|
"@iconify-json/mingcute": "^1.1.16",
|
|
33
33
|
"photoswipe": "^5.4.3"
|
|
34
34
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^2.6.
|
|
19
|
-
"@cloudcommerce/firebase": "^2.6.
|
|
20
|
-
"@cloudcommerce/modules": "^2.6.
|
|
18
|
+
"@cloudcommerce/events": "^2.6.1",
|
|
19
|
+
"@cloudcommerce/firebase": "^2.6.1",
|
|
20
|
+
"@cloudcommerce/modules": "^2.6.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cloudcommerce/cli": "^2.6.
|
|
29
|
+
"@cloudcommerce/cli": "^2.6.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudcommerce/eslint": "^2.6.
|
|
32
|
+
"@cloudcommerce/eslint": "^2.6.1",
|
|
33
33
|
"husky": "^9.0.10",
|
|
34
34
|
"lint-staged": "^15.2.2"
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.2",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vite": "^5.0.11",
|
|
37
37
|
"vitest": "^1.3.0",
|
|
38
38
|
"zx": "^7.2.3",
|
|
39
|
-
"@cloudcommerce/eslint": "2.6.
|
|
39
|
+
"@cloudcommerce/eslint": "2.6.2"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"fix-install": "bash scripts/pre-install.sh && pnpm i",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFirestore } from 'firebase-admin/firestore';
|
|
2
|
-
import { error } from 'firebase-functions/logger';
|
|
2
|
+
import { info, error } from 'firebase-functions/logger';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
@@ -101,13 +101,15 @@ const saveViews = async () => {
|
|
|
101
101
|
const url = data.url.replace(/\?.*$/, '');
|
|
102
102
|
doc.ref.update({ isCachePurged: true });
|
|
103
103
|
if (url?.startsWith(`https://${domain}`) && !purgedUrls.includes(url)) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
const reqs = [
|
|
105
|
+
bunnyAxios('/purge', {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
params: {
|
|
108
|
+
async: permaCacheZoneFolder ? 'true' : 'false',
|
|
109
|
+
url,
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
];
|
|
111
113
|
purgedUrls.push(url);
|
|
112
114
|
if (permaCacheZoneFolder) {
|
|
113
115
|
let pathname = url.replace(`https://${domain}`, '');
|
|
@@ -121,20 +123,23 @@ const saveViews = async () => {
|
|
|
121
123
|
// https://support.bunny.net/hc/en-us/articles/360017048720-Perma-Cache-Folder-Structure-Explained
|
|
122
124
|
const permaCachePath = `__bcdn_perma_cache__/${permaCacheZoneFolder}`
|
|
123
125
|
+ `/${folderpath}___${filename}___/___file___`;
|
|
124
|
-
|
|
126
|
+
reqs.push(axios({
|
|
125
127
|
method: 'DELETE',
|
|
126
128
|
url: `https://storage.bunnycdn.com/${bunnyStorageName}/${permaCachePath}`,
|
|
127
129
|
headers: {
|
|
128
130
|
AccessKey: bunnyStoragePass,
|
|
129
131
|
},
|
|
130
|
-
})
|
|
131
|
-
.
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
.catch((err) => {
|
|
135
|
-
if (err.response?.status !== 404) throw err;
|
|
136
|
-
});
|
|
132
|
+
}).catch((err) => {
|
|
133
|
+
if (err.response?.status !== 404) throw err;
|
|
134
|
+
}));
|
|
137
135
|
}
|
|
136
|
+
await Promise.all(reqs).then(([, deletePermaCacheRes]) => {
|
|
137
|
+
if (deletePermaCacheRes) {
|
|
138
|
+
info(`Full cache bump ${url}`);
|
|
139
|
+
return axios.get(`${url}?__isrV=${deployRand}`).catch(error);
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
});
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-ssr-save-views.js","sourceRoot":"","sources":["../../src/lib/cron-ssr-save-views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"cron-ssr-save-views.js","sourceRoot":"","sources":["../../src/lib/cron-ssr-save-views.ts"],"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|
2
|
-
import { error } from 'firebase-functions/logger';
|
|
2
|
+
import { info, error } from 'firebase-functions/logger';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
@@ -103,13 +103,15 @@ const saveViews = async () => {
|
|
|
103
103
|
const url = data.url.replace(/\?.*$/, '');
|
|
104
104
|
doc.ref.update({ isCachePurged: true });
|
|
105
105
|
if (url?.startsWith(`https://${domain}`) && !purgedUrls.includes(url)) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
const reqs: Promise<any>[] = [
|
|
107
|
+
bunnyAxios('/purge', {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
params: {
|
|
110
|
+
async: permaCacheZoneFolder ? 'true' : 'false',
|
|
111
|
+
url,
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
];
|
|
113
115
|
purgedUrls.push(url);
|
|
114
116
|
if (permaCacheZoneFolder) {
|
|
115
117
|
let pathname = url.replace(`https://${domain}`, '');
|
|
@@ -123,20 +125,25 @@ const saveViews = async () => {
|
|
|
123
125
|
// https://support.bunny.net/hc/en-us/articles/360017048720-Perma-Cache-Folder-Structure-Explained
|
|
124
126
|
const permaCachePath = `__bcdn_perma_cache__/${permaCacheZoneFolder}`
|
|
125
127
|
+ `/${folderpath}___${filename}___/___file___`;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
.
|
|
134
|
-
axios.get(`${url}?__isrV=${deployRand}`).catch(error);
|
|
135
|
-
})
|
|
136
|
-
.catch((err) => {
|
|
128
|
+
reqs.push(
|
|
129
|
+
axios({
|
|
130
|
+
method: 'DELETE',
|
|
131
|
+
url: `https://storage.bunnycdn.com/${bunnyStorageName}/${permaCachePath}`,
|
|
132
|
+
headers: {
|
|
133
|
+
AccessKey: bunnyStoragePass,
|
|
134
|
+
},
|
|
135
|
+
}).catch((err) => {
|
|
137
136
|
if (err.response?.status !== 404) throw err;
|
|
138
|
-
})
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
139
|
}
|
|
140
|
+
await Promise.all(reqs).then(([, deletePermaCacheRes]) => {
|
|
141
|
+
if (deletePermaCacheRes) {
|
|
142
|
+
info(`Full cache bump ${url}`);
|
|
143
|
+
return axios.get(`${url}?__isrV=${deployRand}`).catch(error);
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
});
|
|
140
147
|
}
|
|
141
148
|
}
|
|
142
149
|
} catch (err: any) {
|