cloudcommerce 0.0.38 → 0.0.39
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/.gitattributes +3 -0
- 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/lib/build.js +1 -1
- package/packages/cli/lib/index.js +1 -0
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/build.ts +1 -1
- package/packages/cli/src/index.ts +1 -0
- package/packages/firebase/lib/config.js +22 -18
- package/packages/firebase/lib/defaults.js +4 -1
- package/packages/firebase/lib/env.js +17 -17
- package/packages/firebase/lib/handlers/check-store-events.js +24 -23
- package/packages/firebase/lib/index.js +4 -2
- package/packages/firebase/lib/types.js +1 -1
- package/packages/firebase/package.json +3 -2
- 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/pnpm-lock.yaml +28 -4
- package/pnpm-workspace.yaml +2 -1
package/.gitattributes
ADDED
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.39](https://github.com/ecomplus/cloud-commerce/compare/v0.0.38...v0.0.39) (2022-07-29)
|
|
6
|
+
|
|
5
7
|
### [0.0.38](https://github.com/ecomplus/cloud-commerce/compare/v0.0.37...v0.0.38) (2022-07-28)
|
|
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.39",
|
|
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>",
|
|
@@ -6,7 +6,7 @@ const copyFunctionsConfig = async () => {
|
|
|
6
6
|
const filesToCopy = ['.env', 'config.json'];
|
|
7
7
|
const dirents = await fs.readdir(functionsDir, { withFileTypes: true });
|
|
8
8
|
for (let i = 0; i < dirents.length; i++) {
|
|
9
|
-
if (dirents[i].isDirectory()) {
|
|
9
|
+
if (dirents[i].isDirectory() && dirents[i].name.charAt(0) !== '.') {
|
|
10
10
|
for (let ii = 0; ii < filesToCopy.length; ii++) {
|
|
11
11
|
// eslint-disable-next-line no-await-in-loop
|
|
12
12
|
await fs.copy(path.join(functionsDir, filesToCopy[ii]), path.join(functionsDir, dirents[i].name, filesToCopy[ii]));
|
|
@@ -46,6 +46,7 @@ export default async () => {
|
|
|
46
46
|
return $`firebase --project=${projectId} ${cmd}${options}`;
|
|
47
47
|
};
|
|
48
48
|
if (argv._.includes('serve')) {
|
|
49
|
+
await build();
|
|
49
50
|
return $firebase('emulators:start').catch(async (err) => {
|
|
50
51
|
await echo`
|
|
51
52
|
Try killing open emulators with:
|
|
@@ -6,7 +6,7 @@ const copyFunctionsConfig = async () => {
|
|
|
6
6
|
const filesToCopy = ['.env', 'config.json'];
|
|
7
7
|
const dirents = await fs.readdir(functionsDir, { withFileTypes: true });
|
|
8
8
|
for (let i = 0; i < dirents.length; i++) {
|
|
9
|
-
if (dirents[i].isDirectory()) {
|
|
9
|
+
if (dirents[i].isDirectory() && dirents[i].name.charAt(0) !== '.') {
|
|
10
10
|
for (let ii = 0; ii < filesToCopy.length; ii++) {
|
|
11
11
|
// eslint-disable-next-line no-await-in-loop
|
|
12
12
|
await fs.copy(
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import Deepmerge from '@fastify/deepmerge';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE,
|
|
4
|
+
} from './defaults.js';
|
|
5
|
+
|
|
3
6
|
const deepmerge = Deepmerge();
|
|
4
7
|
const self = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
8
|
+
__config: {
|
|
9
|
+
hello: 'from @cloudcommerce/firebase',
|
|
10
|
+
lang: process.env.ECOM_LANG || DEFAULT_LANG,
|
|
11
|
+
currency: process.env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
12
|
+
currencySymbol: process.env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
13
|
+
countryCode: process.env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
14
|
+
storeId: Number(process.env.ECOM_STORE_ID),
|
|
15
|
+
httpsFunctionOptions: {
|
|
16
|
+
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
15
17
|
},
|
|
18
|
+
},
|
|
16
19
|
};
|
|
20
|
+
|
|
17
21
|
export default {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
get() {
|
|
23
|
+
return self.__config;
|
|
24
|
+
},
|
|
25
|
+
set(config) {
|
|
26
|
+
self.__config = deepmerge(self.__config, config);
|
|
27
|
+
},
|
|
24
28
|
};
|
|
25
|
-
|
|
29
|
+
// # 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,29 +3,30 @@ 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
|
+
|
|
6
7
|
export default async () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const { authenticationId, apiKey } = getEnv();
|
|
9
|
+
const eventsSubs = await getFirestore().collection('eventsSubs').get();
|
|
10
|
+
const listenedEvents = [];
|
|
11
|
+
eventsSubs.forEach((doc) => {
|
|
12
|
+
const eventSub = doc.data();
|
|
13
|
+
if (!listenedEvents.includes(eventSub.event)) {
|
|
14
|
+
listenedEvents.push(eventSub.event);
|
|
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}`,
|
|
15
27
|
});
|
|
16
|
-
logger.info({
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
|
28
|
+
logger.info(`${resource} events: `, result);
|
|
29
|
+
});
|
|
30
|
+
return true;
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
+
// # sourceMappingURL=check-store-events.js.map
|
|
@@ -6,8 +6,10 @@ 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
|
+
|
|
9
10
|
initializeApp();
|
|
11
|
+
|
|
10
12
|
export const cronStoreEvents = pubsub.schedule('* * * * *').onRun(() => {
|
|
11
|
-
|
|
13
|
+
return checkStoreEvents();
|
|
12
14
|
});
|
|
13
|
-
|
|
15
|
+
// # sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
|
|
2
|
+
// # sourceMappingURL=types.js.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.39",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce on Firebase",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./lib/index.js",
|
|
10
|
-
"./config": "./
|
|
10
|
+
"./config": "./config.js",
|
|
11
|
+
"./lib/config": "./lib/config.js"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
package/pnpm-lock.yaml
CHANGED
|
@@ -171,15 +171,39 @@ importers:
|
|
|
171
171
|
|
|
172
172
|
store:
|
|
173
173
|
specifiers:
|
|
174
|
-
'@cloudcommerce/cli': ^0.0.
|
|
174
|
+
'@cloudcommerce/cli': ^0.0.38
|
|
175
175
|
dependencies:
|
|
176
176
|
'@cloudcommerce/cli': link:../packages/cli
|
|
177
177
|
|
|
178
|
-
store/functions:
|
|
178
|
+
store/functions/core:
|
|
179
179
|
specifiers:
|
|
180
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
180
|
+
'@cloudcommerce/firebase': ^0.0.38
|
|
181
181
|
dependencies:
|
|
182
|
-
'@cloudcommerce/firebase': link
|
|
182
|
+
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
183
|
+
|
|
184
|
+
store/functions/modules:
|
|
185
|
+
specifiers:
|
|
186
|
+
'@cloudcommerce/firebase': ^0.0.38
|
|
187
|
+
'@cloudcommerce/modules': ^0.0.38
|
|
188
|
+
dependencies:
|
|
189
|
+
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
190
|
+
'@cloudcommerce/modules': link:../../../packages/modules
|
|
191
|
+
|
|
192
|
+
store/functions/passport:
|
|
193
|
+
specifiers:
|
|
194
|
+
'@cloudcommerce/firebase': ^0.0.38
|
|
195
|
+
'@cloudcommerce/passport': ^0.0.38
|
|
196
|
+
dependencies:
|
|
197
|
+
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
198
|
+
'@cloudcommerce/passport': link:../../../packages/passport
|
|
199
|
+
|
|
200
|
+
store/functions/ssr:
|
|
201
|
+
specifiers:
|
|
202
|
+
'@cloudcommerce/firebase': ^0.0.38
|
|
203
|
+
'@cloudcommerce/ssr': ^0.0.38
|
|
204
|
+
dependencies:
|
|
205
|
+
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
206
|
+
'@cloudcommerce/ssr': link:../../../packages/ssr
|
|
183
207
|
|
|
184
208
|
packages:
|
|
185
209
|
|