cloudcommerce 0.0.30 → 0.0.33
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 +21 -0
- package/action.yml +9 -3
- package/package.json +1 -1
- package/packages/api/{tests/fetch-polyfill.js → fetch-polyfill.js} +0 -0
- package/packages/api/package.json +1 -1
- package/packages/api/tests/index.test.ts +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 +3 -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 +2 -1
- package/packages/firebase/src/env.ts +30 -0
- package/packages/firebase/src/index.ts +3 -16
- package/packages/firebase/src/methods/check-store-events.ts +4 -2
- package/packages/storefront/package.json +1 -1
- package/pnpm-lock.yaml +4 -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,27 @@
|
|
|
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.33](https://github.com/ecomplus/cloud-commerce/compare/v0.0.32...v0.0.33) (2022-07-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **firecase:** Add `node-fetch` to pkg deps and import polyfill ([3ddf42f](https://github.com/ecomplus/cloud-commerce/commit/3ddf42f7369e20c1e63f4b6612d1688134556d97))
|
|
11
|
+
|
|
12
|
+
### [0.0.32](https://github.com/ecomplus/cloud-commerce/compare/v0.0.31...v0.0.32) (2022-07-20)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **firebase:** Get `process.env` on function handler only ([2095621](https://github.com/ecomplus/cloud-commerce/commit/209562152d31a4f31104502897af2f2330c3330f))
|
|
18
|
+
|
|
19
|
+
### [0.0.31](https://github.com/ecomplus/cloud-commerce/compare/v0.0.30...v0.0.31) (2022-07-20)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* GH Action must get credentials from inputs (`secrets` unrecognized) ([482f82b](https://github.com/ecomplus/cloud-commerce/commit/482f82bc4ff3ddc73445b4ffbbf5bf9655cf7de2))
|
|
25
|
+
|
|
5
26
|
### [0.0.30](https://github.com/ecomplus/cloud-commerce/compare/v0.0.29...v0.0.30) (2022-07-20)
|
|
6
27
|
|
|
7
28
|
|
package/action.yml
CHANGED
|
@@ -8,6 +8,12 @@ inputs:
|
|
|
8
8
|
firebase-service-account:
|
|
9
9
|
description: 'Firebase service account JSON'
|
|
10
10
|
required: true
|
|
11
|
+
ecom-authentication-id:
|
|
12
|
+
description: 'E-Com Plus store authentication ID'
|
|
13
|
+
required: true
|
|
14
|
+
ecom-api-key:
|
|
15
|
+
description: 'E-Com Plus store API key'
|
|
16
|
+
required: true
|
|
11
17
|
|
|
12
18
|
outputs: {}
|
|
13
19
|
|
|
@@ -37,10 +43,10 @@ runs:
|
|
|
37
43
|
name: Deploy to Firebase live
|
|
38
44
|
shell: bash
|
|
39
45
|
env:
|
|
46
|
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
|
40
47
|
FIREBASE_SERVICE_ACCOUNT: ${{ inputs.firebase-service-account }}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }}
|
|
48
|
+
ECOM_AUTHENTICATION_ID: ${{ inputs.ecom-authentication-id }}
|
|
49
|
+
ECOM_API_KEY: ${{ inputs.ecom-api-key }}
|
|
44
50
|
run: |
|
|
45
51
|
export GAC_FILENAME=".gac-$RANDOM.json"
|
|
46
52
|
echo $FIREBASE_SERVICE_ACCOUNT > $GAC_FILENAME
|
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.33",
|
|
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>",
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console, import/no-extraneous-dependencies */
|
|
2
2
|
|
|
3
3
|
import { test, expect } from 'vitest';
|
|
4
|
-
import '
|
|
4
|
+
import '../fetch-polyfill';
|
|
5
5
|
import api, { ApiError } from '../src/index';
|
|
6
6
|
|
|
7
7
|
const productId = '618041aa239b7206d3fc06de';
|
|
@@ -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"}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import 'source-map-support/register.js';
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill.js';
|
|
2
3
|
import { pubsub, logger } from 'firebase-functions';
|
|
3
4
|
// eslint-disable-next-line import/no-unresolved
|
|
4
5
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
6
|
import config from './config.js';
|
|
6
7
|
import checkStoreEvents from './methods/check-store-events.js';
|
|
7
8
|
|
|
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
9
|
const processId = String(Date.now());
|
|
13
|
-
const env = {
|
|
14
|
-
processId,
|
|
15
|
-
authenticationId: AUTHENTICATION_ID,
|
|
16
|
-
apiKey: API_KEY,
|
|
17
|
-
githubToken: GITHUB_TOKEN,
|
|
18
|
-
};
|
|
19
10
|
const options = {
|
|
20
11
|
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
21
12
|
};
|
|
22
13
|
|
|
23
14
|
export const z = onRequest(options, ({ url }, response) => {
|
|
15
|
+
process.env.ECOM_API_KEY = '***';
|
|
24
16
|
if (url === '/hello') {
|
|
25
17
|
logger.info('Hello logs!', {
|
|
26
18
|
structuredData: true,
|
|
@@ -42,6 +34,6 @@ export const ssr = onRequest(options, (request, response) => {
|
|
|
42
34
|
});
|
|
43
35
|
|
|
44
36
|
export const cronStoreEvents = pubsub.schedule('* * * * *').onRun(() => {
|
|
45
|
-
return checkStoreEvents(
|
|
37
|
+
return checkStoreEvents();
|
|
46
38
|
});
|
|
47
39
|
// # 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,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAE5D,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AAErC,MAAM,OAAO,GAAG;IACd,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;CAChD,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE;IACxD,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;IACjC,IAAI,GAAG,KAAK,QAAQ,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE;YACzB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO;KACR;IACD,IAAI,GAAG,KAAK,MAAM,EAAE;QAClB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzB,OAAO;KACR;IACD,QAAQ,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;IAC1D,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.33",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce on Firebase",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@fastify/deepmerge": "^1.1.0",
|
|
28
28
|
"firebase-admin": "^11.0.0",
|
|
29
29
|
"firebase-functions": "^3.22.0",
|
|
30
|
+
"node-fetch": "^3.2.9",
|
|
30
31
|
"source-map-support": "^0.5.21"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -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,32 +1,19 @@
|
|
|
1
|
-
import type { Env } from './types';
|
|
2
1
|
import 'source-map-support/register.js';
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill.js';
|
|
3
3
|
import { pubsub, logger } from 'firebase-functions';
|
|
4
4
|
// eslint-disable-next-line import/no-unresolved
|
|
5
5
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
6
6
|
import config from './config';
|
|
7
7
|
import checkStoreEvents from './methods/check-store-events';
|
|
8
8
|
|
|
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
9
|
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
10
|
|
|
25
11
|
const options = {
|
|
26
12
|
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
27
13
|
};
|
|
28
14
|
|
|
29
15
|
export const z = onRequest(options, ({ url }, response) => {
|
|
16
|
+
process.env.ECOM_API_KEY = '***';
|
|
30
17
|
if (url === '/hello') {
|
|
31
18
|
logger.info('Hello logs!', {
|
|
32
19
|
structuredData: true,
|
|
@@ -48,5 +35,5 @@ export const ssr = onRequest(options, (request, response) => {
|
|
|
48
35
|
});
|
|
49
36
|
|
|
50
37
|
export const cronStoreEvents = pubsub.schedule('* * * * *').onRun(() => {
|
|
51
|
-
return checkStoreEvents(
|
|
38
|
+
return checkStoreEvents();
|
|
52
39
|
});
|
|
@@ -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
|
@@ -76,12 +76,14 @@ importers:
|
|
|
76
76
|
'@firebase/app-types': ^0.7.0
|
|
77
77
|
firebase-admin: ^11.0.0
|
|
78
78
|
firebase-functions: ^3.22.0
|
|
79
|
+
node-fetch: ^3.2.9
|
|
79
80
|
source-map-support: ^0.5.21
|
|
80
81
|
dependencies:
|
|
81
82
|
'@cloudcommerce/api': link:../api
|
|
82
83
|
'@fastify/deepmerge': 1.1.0
|
|
83
84
|
firebase-admin: 11.0.0_@firebase+app-types@0.7.0
|
|
84
85
|
firebase-functions: 3.22.0_firebase-admin@11.0.0
|
|
86
|
+
node-fetch: 3.2.9
|
|
85
87
|
source-map-support: 0.5.21
|
|
86
88
|
devDependencies:
|
|
87
89
|
'@firebase/app-types': 0.7.0
|
|
@@ -96,13 +98,13 @@ importers:
|
|
|
96
98
|
|
|
97
99
|
store:
|
|
98
100
|
specifiers:
|
|
99
|
-
'@cloudcommerce/cli': ^0.0.
|
|
101
|
+
'@cloudcommerce/cli': ^0.0.32
|
|
100
102
|
dependencies:
|
|
101
103
|
'@cloudcommerce/cli': link:../packages/cli
|
|
102
104
|
|
|
103
105
|
store/functions:
|
|
104
106
|
specifiers:
|
|
105
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
107
|
+
'@cloudcommerce/firebase': ^0.0.32
|
|
106
108
|
dependencies:
|
|
107
109
|
'@cloudcommerce/firebase': link:../../packages/firebase
|
|
108
110
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,iDAAiD"}
|