cloudcommerce 0.0.41 → 0.0.42
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 +2 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/firebase/lib/config.js +18 -22
- package/packages/firebase/lib/defaults.js +1 -4
- package/packages/firebase/lib/env.js +17 -17
- package/packages/firebase/lib/handlers/check-store-events.js +23 -24
- package/packages/firebase/lib/index.js +2 -4
- package/packages/firebase/lib/types.js +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/package.json +1 -1
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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
|
+
### [0.0.42](https://github.com/ecomplus/cloud-commerce/compare/v0.0.41...v0.0.42) (2022-08-02)
|
|
6
|
+
|
|
5
7
|
### [0.0.41](https://github.com/ecomplus/cloud-commerce/compare/v0.0.40...v0.0.41) (2022-08-02)
|
|
6
8
|
|
|
7
9
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.42",
|
|
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>",
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
import Deepmerge from '@fastify/deepmerge';
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE,
|
|
4
|
-
} from './defaults.js';
|
|
5
|
-
|
|
2
|
+
import { DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE, } from './defaults.js';
|
|
6
3
|
const deepmerge = Deepmerge();
|
|
7
4
|
const self = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
__config: {
|
|
6
|
+
hello: 'from @cloudcommerce/firebase',
|
|
7
|
+
lang: process.env.ECOM_LANG || DEFAULT_LANG,
|
|
8
|
+
currency: process.env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
9
|
+
currencySymbol: process.env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
10
|
+
countryCode: process.env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
11
|
+
storeId: Number(process.env.ECOM_STORE_ID),
|
|
12
|
+
httpsFunctionOptions: {
|
|
13
|
+
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
14
|
+
},
|
|
17
15
|
},
|
|
18
|
-
},
|
|
19
16
|
};
|
|
20
|
-
|
|
21
17
|
export default {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
get() {
|
|
19
|
+
return self.__config;
|
|
20
|
+
},
|
|
21
|
+
set(config) {
|
|
22
|
+
self.__config = deepmerge(self.__config, config);
|
|
23
|
+
},
|
|
28
24
|
};
|
|
29
|
-
|
|
25
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export default () => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
const { ECOM_AUTHENTICATION_ID, ECOM_API_KEY, GITHUB_TOKEN, } = process.env;
|
|
3
|
+
if (!ECOM_AUTHENTICATION_ID) {
|
|
4
|
+
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
5
|
+
}
|
|
6
|
+
if (!ECOM_API_KEY) {
|
|
7
|
+
throw new Error('ECOM_API_KEY is not set');
|
|
8
|
+
}
|
|
9
|
+
const authenticationId = ECOM_AUTHENTICATION_ID;
|
|
10
|
+
const apiKey = ECOM_API_KEY;
|
|
11
|
+
const githubToken = GITHUB_TOKEN;
|
|
12
|
+
const env = {
|
|
13
|
+
authenticationId,
|
|
14
|
+
apiKey,
|
|
15
|
+
githubToken,
|
|
16
|
+
};
|
|
17
|
+
return env;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -3,30 +3,29 @@ import { getFirestore } from 'firebase-admin/firestore';
|
|
|
3
3
|
import { logger } from 'firebase-functions';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import getEnv from '../env.js';
|
|
6
|
-
|
|
7
6
|
export default async () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
logger.info({ listenedEvents });
|
|
18
|
-
[
|
|
19
|
-
'orders',
|
|
20
|
-
'products',
|
|
21
|
-
'carts',
|
|
22
|
-
].forEach(async (resource) => {
|
|
23
|
-
const { data: { result } } = await api({
|
|
24
|
-
authenticationId,
|
|
25
|
-
apiKey,
|
|
26
|
-
endpoint: `events/${resource}`,
|
|
7
|
+
const { authenticationId, apiKey } = getEnv();
|
|
8
|
+
const eventsSubs = await getFirestore().collection('eventsSubs').get();
|
|
9
|
+
const listenedEvents = [];
|
|
10
|
+
eventsSubs.forEach((doc) => {
|
|
11
|
+
const eventSub = doc.data();
|
|
12
|
+
if (!listenedEvents.includes(eventSub.event)) {
|
|
13
|
+
listenedEvents.push(eventSub.event);
|
|
14
|
+
}
|
|
27
15
|
});
|
|
28
|
-
logger.info(
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
logger.info({ listenedEvents });
|
|
17
|
+
[
|
|
18
|
+
'orders',
|
|
19
|
+
'products',
|
|
20
|
+
'carts',
|
|
21
|
+
].forEach(async (resource) => {
|
|
22
|
+
const { data: { result } } = await api({
|
|
23
|
+
authenticationId,
|
|
24
|
+
apiKey,
|
|
25
|
+
endpoint: `events/${resource}`,
|
|
26
|
+
});
|
|
27
|
+
logger.info(`${resource} events: `, result);
|
|
28
|
+
});
|
|
29
|
+
return true;
|
|
31
30
|
};
|
|
32
|
-
|
|
31
|
+
//# sourceMappingURL=check-store-events.js.map
|
|
@@ -6,10 +6,8 @@ import '@cloudcommerce/api/fetch-polyfill.js';
|
|
|
6
6
|
import { initializeApp } from 'firebase-admin/app';
|
|
7
7
|
import { pubsub } from 'firebase-functions';
|
|
8
8
|
import checkStoreEvents from './handlers/check-store-events.js';
|
|
9
|
-
|
|
10
9
|
initializeApp();
|
|
11
|
-
|
|
12
10
|
export const cronStoreEvents = pubsub.schedule('* * * * *').onRun(() => {
|
|
13
|
-
|
|
11
|
+
return checkStoreEvents();
|
|
14
12
|
});
|
|
15
|
-
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
|
|
2
|
+
//# sourceMappingURL=types.js.map
|