@cloudcommerce/app-correios 2.41.3 → 2.41.6
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/lib-mjs/correios-db.mjs +3 -14
- package/package.json +5 -5
package/lib-mjs/correios-db.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { logger } from '@cloudcommerce/firebase/lib/config';
|
|
2
|
+
import getAppData from '@cloudcommerce/firebase/lib/helpers/get-app-data';
|
|
3
3
|
import { PubSub } from '@google-cloud/pubsub';
|
|
4
4
|
import { getFirestore, Timestamp } from 'firebase-admin/firestore';
|
|
5
5
|
import calculateV2 from './correios-v2.mjs';
|
|
@@ -18,17 +18,6 @@ const firstZipCode = 1000001;
|
|
|
18
18
|
const maxZipCode = 99999999;
|
|
19
19
|
const lastZipCode = maxZipCode - zipRangeStep + 2;
|
|
20
20
|
|
|
21
|
-
const getAppData = async () => {
|
|
22
|
-
const [application] = (await api.get(
|
|
23
|
-
`applications?app_id=${config.get().apps.correios.appId}&fields=hidden_data,data`,
|
|
24
|
-
)).data.result;
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
...application.data,
|
|
28
|
-
...application.hidden_data,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
21
|
const fillDb = async (state) => {
|
|
33
22
|
if (state?.nextZipCode && state.V !== VERSION) {
|
|
34
23
|
logger.warn(`Skip old dup call for (${state.nextZipCode})`);
|
|
@@ -67,7 +56,7 @@ const fillDb = async (state) => {
|
|
|
67
56
|
) {
|
|
68
57
|
logger.info('> Set credentials');
|
|
69
58
|
try {
|
|
70
|
-
configApp = await getAppData();
|
|
59
|
+
configApp = await getAppData('correios');
|
|
71
60
|
if (configApp) {
|
|
72
61
|
setCredentials(configApp);
|
|
73
62
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-correios",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.41.
|
|
4
|
+
"version": "2.41.6",
|
|
5
5
|
"description": "e-com.plus Cloud Commerce app for Correios shipping calculation",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"files": [
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"axios": "^1.8.4",
|
|
31
31
|
"firebase-admin": "^13.2.0",
|
|
32
32
|
"firebase-functions": "^6.3.2",
|
|
33
|
-
"@cloudcommerce/
|
|
34
|
-
"@cloudcommerce/
|
|
33
|
+
"@cloudcommerce/api": "2.41.6",
|
|
34
|
+
"@cloudcommerce/firebase": "2.41.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@cloudcommerce/
|
|
38
|
-
"@cloudcommerce/
|
|
37
|
+
"@cloudcommerce/test-base": "2.41.6",
|
|
38
|
+
"@cloudcommerce/types": "2.41.6"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "bash ../../../scripts/build-lib.sh",
|