cloudcommerce 0.0.31 → 0.0.32
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 +7 -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/env.js +19 -0
- package/packages/firebase/lib/env.js.map +1 -0
- package/packages/firebase/lib/index.js +2 -11
- package/packages/firebase/lib/index.js.map +1 -1
- package/packages/firebase/lib/methods/check-store-events.js +4 -1
- package/packages/firebase/lib/methods/check-store-events.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/env.ts +30 -0
- package/packages/firebase/src/index.ts +2 -16
- package/packages/firebase/src/methods/check-store-events.ts +4 -2
- package/packages/storefront/package.json +1 -1
- package/pnpm-lock.yaml +2 -2
- package/packages/firebase/lib/types.js +0 -3
- package/packages/firebase/lib/types.js.map +0 -1
- package/packages/firebase/src/types.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.32](https://github.com/ecomplus/cloud-commerce/compare/v0.0.31...v0.0.32) (2022-07-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **firebase:** Get `process.env` on function handler only ([2095621](https://github.com/ecomplus/cloud-commerce/commit/209562152d31a4f31104502897af2f2330c3330f))
|
|
11
|
+
|
|
5
12
|
### [0.0.31](https://github.com/ecomplus/cloud-commerce/compare/v0.0.30...v0.0.31) (2022-07-20)
|
|
6
13
|
|
|
7
14
|
|
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.32",
|
|
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>",
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
18
|
+
};
|
|
19
|
+
// # sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAMA,eAAe,GAAG,EAAE;IAClB,MAAM,EACJ,sBAAsB,EACtB,YAAY,EACZ,YAAY,GACb,GAAG,OAAO,CAAC,GAAG,CAAC;IAChB,IAAI,CAAC,sBAAsB,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IACD,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;IACD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC;IAC5B,MAAM,WAAW,GAAG,YAAY,CAAC;IACjC,MAAM,GAAG,GAAQ;QACf,gBAAgB;QAChB,MAAM;QACN,WAAW;KACZ,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -5,22 +5,13 @@ import { onRequest } from 'firebase-functions/v2/https';
|
|
|
5
5
|
import config from './config.js';
|
|
6
6
|
import checkStoreEvents from './methods/check-store-events.js';
|
|
7
7
|
|
|
8
|
-
const { AUTHENTICATION_ID, API_KEY, GITHUB_TOKEN } = process.env;
|
|
9
|
-
if (!AUTHENTICATION_ID || !API_KEY || !GITHUB_TOKEN) {
|
|
10
|
-
throw new Error('Missing environment variables');
|
|
11
|
-
}
|
|
12
8
|
const processId = String(Date.now());
|
|
13
|
-
const env = {
|
|
14
|
-
processId,
|
|
15
|
-
authenticationId: AUTHENTICATION_ID,
|
|
16
|
-
apiKey: API_KEY,
|
|
17
|
-
githubToken: GITHUB_TOKEN,
|
|
18
|
-
};
|
|
19
9
|
const options = {
|
|
20
10
|
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
21
11
|
};
|
|
22
12
|
|
|
23
13
|
export const z = onRequest(options, ({ url }, response) => {
|
|
14
|
+
process.env.ECOM_API_KEY = '***';
|
|
24
15
|
if (url === '/hello') {
|
|
25
16
|
logger.info('Hello logs!', {
|
|
26
17
|
structuredData: true,
|
|
@@ -42,6 +33,6 @@ export const ssr = onRequest(options, (request, response) => {
|
|
|
42
33
|
});
|
|
43
34
|
|
|
44
35
|
export const cronStoreEvents = pubsub.schedule('* * * * *').onRun(() => {
|
|
45
|
-
return checkStoreEvents(
|
|
36
|
+
return checkStoreEvents();
|
|
46
37
|
});
|
|
47
38
|
// # sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAg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AAK,CAAC,GAAG,EAAE;IACrE,OAAO,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { logger } from 'firebase-functions';
|
|
2
2
|
import api from '@cloudcommerce/api';
|
|
3
|
+
import getEnv from '../env.js';
|
|
3
4
|
|
|
4
|
-
export default async (
|
|
5
|
+
export default async () => {
|
|
6
|
+
const { authenticationId, apiKey } = getEnv();
|
|
5
7
|
[
|
|
6
8
|
'orders',
|
|
7
9
|
'products',
|
|
@@ -14,5 +16,6 @@ export default async ({ authenticationId, apiKey }) => {
|
|
|
14
16
|
});
|
|
15
17
|
logger.info(`${resource} events: `, result);
|
|
16
18
|
});
|
|
19
|
+
return true;
|
|
17
20
|
};
|
|
18
21
|
// # sourceMappingURL=check-store-events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-store-events.js","sourceRoot":"","sources":["../../src/methods/check-store-events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-store-events.js","sourceRoot":"","sources":["../../src/methods/check-store-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,eAAe,KAAK,IAAI,EAAE;IACxB,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9C;QACE,QAAQ;QACR,UAAU;QACV,OAAO;KACR,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC3B,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,GAAG,CAAC;YACrC,gBAAgB;YAChB,MAAM;YACN,QAAQ,EAAE,UAAU,QAAoB,EAAE;SAC3C,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Env = {
|
|
2
|
+
authenticationId: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
githubToken?: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
const {
|
|
9
|
+
ECOM_AUTHENTICATION_ID,
|
|
10
|
+
ECOM_API_KEY,
|
|
11
|
+
GITHUB_TOKEN,
|
|
12
|
+
} = process.env;
|
|
13
|
+
if (!ECOM_AUTHENTICATION_ID) {
|
|
14
|
+
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
15
|
+
}
|
|
16
|
+
if (!ECOM_API_KEY) {
|
|
17
|
+
throw new Error('ECOM_API_KEY is not set');
|
|
18
|
+
}
|
|
19
|
+
const authenticationId = ECOM_AUTHENTICATION_ID;
|
|
20
|
+
const apiKey = ECOM_API_KEY;
|
|
21
|
+
const githubToken = GITHUB_TOKEN;
|
|
22
|
+
const env: Env = {
|
|
23
|
+
authenticationId,
|
|
24
|
+
apiKey,
|
|
25
|
+
githubToken,
|
|
26
|
+
};
|
|
27
|
+
return env;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type { Env };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Env } from './types';
|
|
2
1
|
import 'source-map-support/register.js';
|
|
3
2
|
import { pubsub, logger } from 'firebase-functions';
|
|
4
3
|
// eslint-disable-next-line import/no-unresolved
|
|
@@ -6,27 +5,14 @@ import { onRequest } from 'firebase-functions/v2/https';
|
|
|
6
5
|
import config from './config';
|
|
7
6
|
import checkStoreEvents from './methods/check-store-events';
|
|
8
7
|
|
|
9
|
-
const {
|
|
10
|
-
AUTHENTICATION_ID,
|
|
11
|
-
API_KEY,
|
|
12
|
-
GITHUB_TOKEN,
|
|
13
|
-
} = process.env;
|
|
14
|
-
if (!AUTHENTICATION_ID || !API_KEY || !GITHUB_TOKEN) {
|
|
15
|
-
throw new Error('Missing environment variables');
|
|
16
|
-
}
|
|
17
8
|
const processId = String(Date.now());
|
|
18
|
-
const env: Env = {
|
|
19
|
-
processId,
|
|
20
|
-
authenticationId: AUTHENTICATION_ID,
|
|
21
|
-
apiKey: API_KEY,
|
|
22
|
-
githubToken: GITHUB_TOKEN,
|
|
23
|
-
};
|
|
24
9
|
|
|
25
10
|
const options = {
|
|
26
11
|
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
27
12
|
};
|
|
28
13
|
|
|
29
14
|
export const z = onRequest(options, ({ url }, response) => {
|
|
15
|
+
process.env.ECOM_API_KEY = '***';
|
|
30
16
|
if (url === '/hello') {
|
|
31
17
|
logger.info('Hello logs!', {
|
|
32
18
|
structuredData: true,
|
|
@@ -48,5 +34,5 @@ export const ssr = onRequest(options, (request, response) => {
|
|
|
48
34
|
});
|
|
49
35
|
|
|
50
36
|
export const cronStoreEvents = pubsub.schedule('* * * * *').onRun(() => {
|
|
51
|
-
return checkStoreEvents(
|
|
37
|
+
return checkStoreEvents();
|
|
52
38
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Env } from '../types';
|
|
2
1
|
import { logger } from 'firebase-functions';
|
|
3
2
|
import api from '@cloudcommerce/api';
|
|
3
|
+
import getEnv from '../env';
|
|
4
4
|
|
|
5
|
-
export default async (
|
|
5
|
+
export default async () => {
|
|
6
|
+
const { authenticationId, apiKey } = getEnv();
|
|
6
7
|
[
|
|
7
8
|
'orders',
|
|
8
9
|
'products',
|
|
@@ -15,4 +16,5 @@ export default async ({ authenticationId, apiKey }: Env) => {
|
|
|
15
16
|
});
|
|
16
17
|
logger.info(`${resource} events: `, result);
|
|
17
18
|
});
|
|
19
|
+
return true;
|
|
18
20
|
};
|
package/pnpm-lock.yaml
CHANGED
|
@@ -96,13 +96,13 @@ importers:
|
|
|
96
96
|
|
|
97
97
|
store:
|
|
98
98
|
specifiers:
|
|
99
|
-
'@cloudcommerce/cli': ^0.0.
|
|
99
|
+
'@cloudcommerce/cli': ^0.0.31
|
|
100
100
|
dependencies:
|
|
101
101
|
'@cloudcommerce/cli': link:../packages/cli
|
|
102
102
|
|
|
103
103
|
store/functions:
|
|
104
104
|
specifiers:
|
|
105
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
105
|
+
'@cloudcommerce/firebase': ^0.0.31
|
|
106
106
|
dependencies:
|
|
107
107
|
'@cloudcommerce/firebase': link:../../packages/firebase
|
|
108
108
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,iDAAiD"}
|