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 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.41",
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "functions/dist/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -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
- __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',
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
- get() {
23
- return self.__config;
24
- },
25
- set(config) {
26
- self.__config = deepmerge(self.__config, config);
27
- },
18
+ get() {
19
+ return self.__config;
20
+ },
21
+ set(config) {
22
+ self.__config = deepmerge(self.__config, config);
23
+ },
28
24
  };
29
- // # sourceMappingURL=config.js.map
25
+ //# sourceMappingURL=config.js.map
@@ -1,8 +1,5 @@
1
1
  export const DEFAULT_LANG = 'pt_br';
2
-
3
2
  export const DEFAULT_CURRENCY = 'BRL';
4
-
5
3
  export const DEFAULT_CURRENCY_SYMBOL = 'R$';
6
-
7
4
  export const DEFAULT_COUNTRY_CODE = 'BR';
8
- // # sourceMappingURL=defaults.js.map
5
+ //# sourceMappingURL=defaults.js.map
@@ -1,19 +1,19 @@
1
1
  export default () => {
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;
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
- // # sourceMappingURL=env.js.map
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
- 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}`,
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(`${resource} events: `, result);
29
- });
30
- return true;
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
- // # sourceMappingURL=check-store-events.js.map
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
- return checkStoreEvents();
11
+ return checkStoreEvents();
14
12
  });
15
- // # sourceMappingURL=index.js.map
13
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- // # sourceMappingURL=types.js.map
2
+ //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce storefront with Astro",
6
6
  "main": "src/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "0.0.41",
4
+ "version": "0.0.42",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {