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 ADDED
@@ -0,0 +1,3 @@
1
+ packages/api/src/types/* linguist-vendored
2
+ packages/modules/schemas/* linguist-documentation
3
+ packages/types/modules/* linguist-generated
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.38",
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>",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "0.0.38",
4
+ "version": "0.0.39",
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.38",
4
+ "version": "0.0.39",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "functions/dist/index.js",
7
7
  "repository": {
@@ -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:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.0.38",
4
+ "version": "0.0.39",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -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(
@@ -60,6 +60,7 @@ export default async () => {
60
60
  };
61
61
 
62
62
  if (argv._.includes('serve')) {
63
+ await build();
63
64
  return $firebase('emulators:start').catch(async (err: any) => {
64
65
  await echo`
65
66
  Try killing open emulators with:
@@ -1,25 +1,29 @@
1
1
  import Deepmerge from '@fastify/deepmerge';
2
- import { DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE, } from './defaults.js';
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
- __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
- },
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
- get() {
19
- return self.__config;
20
- },
21
- set(config) {
22
- self.__config = deepmerge(self.__config, config);
23
- },
22
+ get() {
23
+ return self.__config;
24
+ },
25
+ set(config) {
26
+ self.__config = deepmerge(self.__config, config);
27
+ },
24
28
  };
25
- //# sourceMappingURL=config.js.map
29
+ // # sourceMappingURL=config.js.map
@@ -1,5 +1,8 @@
1
1
  export const DEFAULT_LANG = 'pt_br';
2
+
2
3
  export const DEFAULT_CURRENCY = 'BRL';
4
+
3
5
  export const DEFAULT_CURRENCY_SYMBOL = 'R$';
6
+
4
7
  export const DEFAULT_COUNTRY_CODE = 'BR';
5
- //# sourceMappingURL=defaults.js.map
8
+ // # 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,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
- 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
- }
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({ 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;
28
+ logger.info(`${resource} events: `, result);
29
+ });
30
+ return true;
30
31
  };
31
- //# sourceMappingURL=check-store-events.js.map
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
- return checkStoreEvents();
13
+ return checkStoreEvents();
12
14
  });
13
- //# sourceMappingURL=index.js.map
15
+ // # sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
2
+ // # sourceMappingURL=types.js.map
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.0.38",
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": "./lib/config.js"
10
+ "./config": "./config.js",
11
+ "./lib/config": "./lib/config.js"
11
12
  },
12
13
  "repository": {
13
14
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.0.38",
4
+ "version": "0.0.39",
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.38",
4
+ "version": "0.0.39",
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.38",
4
+ "version": "0.0.39",
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.38",
4
+ "version": "0.0.39",
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.38",
4
+ "version": "0.0.39",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {
package/pnpm-lock.yaml CHANGED
@@ -171,15 +171,39 @@ importers:
171
171
 
172
172
  store:
173
173
  specifiers:
174
- '@cloudcommerce/cli': ^0.0.37
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.37
180
+ '@cloudcommerce/firebase': ^0.0.38
181
181
  dependencies:
182
- '@cloudcommerce/firebase': link:../../packages/firebase
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
 
@@ -1,6 +1,7 @@
1
1
  packages:
2
2
  - 'packages/*'
3
- - 'packages/*/*'
3
+ - 'packages/apps/*'
4
4
  - 'docs'
5
5
  - 'store'
6
6
  - 'store/*'
7
+ - 'store/functions/*'