@cloudcommerce/app-correios 2.9.0 → 2.10.1
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/package.json +13 -7
- package/.turbo/turbo-build.log +0 -5
- package/.turbo/turbo-test.log +0 -5
- package/CHANGELOG.md +0 -1
- package/scripts/tests.sh +0 -11
- package/src/correios.ts +0 -8
- package/src/index.ts +0 -1
- package/tests/calculate-shipping.test.mjs +0 -45
- package/tsconfig.json +0 -6
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-correios",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.10.1",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"/lib",
|
|
9
|
+
"/lib-mjs",
|
|
10
|
+
"/types",
|
|
11
|
+
"/*.{js,mjs,ts}"
|
|
12
|
+
],
|
|
7
13
|
"exports": {
|
|
8
14
|
".": "./lib/index.js",
|
|
9
15
|
"./fill-database": "./lib-mjs/correios-db.mjs"
|
|
@@ -21,15 +27,15 @@
|
|
|
21
27
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/correios#readme",
|
|
22
28
|
"dependencies": {
|
|
23
29
|
"@google-cloud/pubsub": "^4.3.3",
|
|
24
|
-
"axios": "^1.6.
|
|
30
|
+
"axios": "^1.6.8",
|
|
25
31
|
"firebase-admin": "^12.0.0",
|
|
26
|
-
"firebase-functions": "^4.8.
|
|
27
|
-
"@cloudcommerce/api": "2.
|
|
28
|
-
"@cloudcommerce/firebase": "2.
|
|
32
|
+
"firebase-functions": "^4.8.1",
|
|
33
|
+
"@cloudcommerce/api": "2.10.1",
|
|
34
|
+
"@cloudcommerce/firebase": "2.10.1"
|
|
29
35
|
},
|
|
30
36
|
"devDependencies": {
|
|
31
|
-
"@cloudcommerce/test-base": "2.
|
|
32
|
-
"@cloudcommerce/types": "2.
|
|
37
|
+
"@cloudcommerce/test-base": "2.10.1",
|
|
38
|
+
"@cloudcommerce/types": "2.10.1"
|
|
33
39
|
},
|
|
34
40
|
"scripts": {
|
|
35
41
|
"build": "bash ../../../scripts/build-lib.sh",
|
package/.turbo/turbo-build.log
DELETED
package/.turbo/turbo-test.log
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Please refer to GitHub [repository releases](https://github.com/ecomplus/cloud-commerce/releases) or monorepo unified [CHANGELOG.md](https://github.com/ecomplus/cloud-commerce/blob/main/CHANGELOG.md).
|
package/scripts/tests.sh
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
if [ -z "$CORREIOS_POSTCARD" ]; then
|
|
4
|
-
echo -e "CORREIOS_POSTCARD not set\n"
|
|
5
|
-
elif [ -z "$CORREIOS_USER" ]; then
|
|
6
|
-
echo -e "CORREIOS_USER not set\n"
|
|
7
|
-
elif [ -z "$CORREIOS_ACCESS_CODE" ]; then
|
|
8
|
-
echo -e "CORREIOS_ACCESS_CODE not set\n"
|
|
9
|
-
else
|
|
10
|
-
node --test tests/
|
|
11
|
-
fi
|
package/src/correios.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import type { AppModuleBody } from '@cloudcommerce/types';
|
|
3
|
-
import '@cloudcommerce/firebase/lib/init';
|
|
4
|
-
import handleCalculateShipping from '../lib-mjs/calculate-shipping.mjs';
|
|
5
|
-
|
|
6
|
-
export const calculateShipping = async (modBody: AppModuleBody) => {
|
|
7
|
-
return handleCalculateShipping(modBody);
|
|
8
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './correios';
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import test, { before, describe } from 'node:test';
|
|
4
|
-
import {
|
|
5
|
-
modulesUrl,
|
|
6
|
-
bodyCalculateShipping,
|
|
7
|
-
} from '@cloudcommerce/test-base';
|
|
8
|
-
|
|
9
|
-
describe('Test Shipping Calculation in the Correios App', async () => {
|
|
10
|
-
let req;
|
|
11
|
-
let data;
|
|
12
|
-
const appId = 126334;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
req = await fetch(`${modulesUrl}/calculate_shipping?app_id=${appId}`, {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
body: JSON.stringify(bodyCalculateShipping),
|
|
18
|
-
headers: {
|
|
19
|
-
'Content-Type': 'application/json',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
data = (await req.json()).result;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('Check Status 200', async () => {
|
|
27
|
-
assert.strictEqual(req?.status, 200);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('Check validated is true', async () => {
|
|
31
|
-
assert.equal(data[0].validated, true);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('Have shipping services', async () => {
|
|
35
|
-
assert.equal(data[0].response.shipping_services.length > 0, true);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('Has PAC shipping services', async () => {
|
|
39
|
-
assert.equal((data[0].response.shipping_services.find((service) => service.label === 'PAC')).label, 'PAC');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('Has SEDEX shipping services', async () => {
|
|
43
|
-
assert.equal((data[0].response.shipping_services.find((service) => service.label === 'SEDEX')).label, 'SEDEX');
|
|
44
|
-
});
|
|
45
|
-
});
|