cloudcommerce 0.0.45 → 0.0.48
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 +22 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/discounts/lib/index.js +3 -0
- package/packages/apps/discounts/lib/index.js.map +1 -1
- package/packages/apps/discounts/package.json +6 -3
- package/packages/apps/discounts/src/index.ts +2 -0
- package/packages/cli/package.json +1 -1
- package/packages/events/firebase.js +1 -0
- package/packages/events/lib/firebase.js +31 -0
- package/packages/events/lib/firebase.js.map +1 -0
- package/packages/events/lib/index.js +2 -0
- package/packages/events/lib/index.js.map +1 -0
- package/packages/events/package.json +2 -2
- package/packages/events/src/firebase.ts +6 -4
- package/packages/firebase/lib/config.js +3 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/lib/env.d.ts +5 -2
- package/packages/firebase/lib/env.js +12 -3
- package/packages/firebase/lib/env.js.map +1 -1
- package/packages/firebase/lib/handlers/auth-callback.d.ts +3 -0
- package/packages/firebase/lib/handlers/auth-callback.js +45 -0
- package/packages/firebase/lib/handlers/auth-callback.js.map +1 -0
- package/packages/firebase/lib/handlers/check-store-events.js +4 -7
- package/packages/firebase/lib/handlers/check-store-events.js.map +1 -1
- package/packages/firebase/lib/index.d.ts +3 -1
- package/packages/firebase/lib/index.js +18 -5
- package/packages/firebase/lib/index.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/config.ts +3 -0
- package/packages/firebase/src/env.ts +15 -4
- package/packages/firebase/src/handlers/auth-callback.ts +49 -0
- package/packages/firebase/src/handlers/check-store-events.ts +4 -7
- package/packages/firebase/src/index.ts +20 -5
- package/packages/modules/lib/firebase.js +3 -7
- package/packages/modules/lib/firebase.js.map +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/modules/src/firebase.ts +3 -7
- package/packages/passport/lib/firebase.js +1 -2
- package/packages/passport/lib/firebase.js.map +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/passport/src/firebase.ts +1 -2
- 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 +111 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
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.48](https://github.com/ecomplus/cloud-commerce/compare/v0.0.47...v0.0.48) (2022-08-07)
|
|
6
|
+
|
|
7
|
+
### [0.0.47](https://github.com/ecomplus/cloud-commerce/compare/v0.0.46...v0.0.47) (2022-08-07)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Setup app auth callback function to handle installation callback ([12d5780](https://github.com/ecomplus/cloud-commerce/commit/12d57808a8d742b4a29ac2ce3ea1ae3a5af836dc))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **events:** Add root `firebase.js` as complement to pkg named export ([178fd8c](https://github.com/ecomplus/cloud-commerce/commit/178fd8c128ed55b098a28abe70e6c5385043ec89))
|
|
18
|
+
* Set `ECOM_STORE_ID` env from `config.storeId` ([65e806e](https://github.com/ecomplus/cloud-commerce/commit/65e806ee2228392cfa3c9c6a58537e6248d1f862))
|
|
19
|
+
|
|
20
|
+
### [0.0.46](https://github.com/ecomplus/cloud-commerce/compare/v0.0.45...v0.0.46) (2022-08-05)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* Set Firebase Functions v2 names with one word at all ([23d5f17](https://github.com/ecomplus/cloud-commerce/commit/23d5f17bbeca0bccc14047c6a5fa4a92753ae9b8))
|
|
26
|
+
|
|
5
27
|
### [0.0.45](https://github.com/ecomplus/cloud-commerce/compare/v0.0.44...v0.0.45) (2022-08-05)
|
|
6
28
|
|
|
7
29
|
|
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.48",
|
|
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 +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":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAqB,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-discounts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.48",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for complex discount rules",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -19,9 +19,12 @@
|
|
|
19
19
|
"build": "sh ../../../scripts/build-lib.sh"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cloudcommerce/api": "workspace:*"
|
|
22
|
+
"@cloudcommerce/api": "workspace:*",
|
|
23
|
+
"firebase-admin": "^11.0.1",
|
|
24
|
+
"firebase-functions": "^3.22.0"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
|
-
"@cloudcommerce/types": "workspace:*"
|
|
27
|
+
"@cloudcommerce/types": "workspace:*",
|
|
28
|
+
"@firebase/app-types": "^0.7.0"
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/firebase.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
import 'source-map-support/register.js';
|
|
3
|
+
// eslint-disable-next-line import/no-unresolved
|
|
4
|
+
import { initializeApp } from 'firebase-admin/app';
|
|
5
|
+
import functions from 'firebase-functions';
|
|
6
|
+
import config from '@cloudcommerce/firebase/lib/config';
|
|
7
|
+
|
|
8
|
+
const { logger } = functions;
|
|
9
|
+
initializeApp();
|
|
10
|
+
const eventMaxAgeMs = 60000;
|
|
11
|
+
const newOrderTopic = 'orders-new';
|
|
12
|
+
const { httpsFunctionOptions: { region } } = config.get();
|
|
13
|
+
|
|
14
|
+
export const onNewOrder = functions.region(region)
|
|
15
|
+
.runWith({ failurePolicy: true })
|
|
16
|
+
.pubsub.topic(newOrderTopic).onPublish((message, context) => {
|
|
17
|
+
const eventAgeMs = Date.now() - Date.parse(context.timestamp);
|
|
18
|
+
if (eventAgeMs > eventMaxAgeMs) {
|
|
19
|
+
logger.warn(`Dropping event ${context.eventId} with age[ms]: ${eventAgeMs}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Hide API key for security
|
|
23
|
+
process.env.ECOM_API_KEY = '***';
|
|
24
|
+
const { json } = message;
|
|
25
|
+
logger.info({
|
|
26
|
+
topic: newOrderTopic,
|
|
27
|
+
eventId: context.eventId,
|
|
28
|
+
json,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
// # sourceMappingURL=firebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAGjD,OAAO,gCAAgC,CAAC;AACxC,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;AAC7B,aAAa,EAAE,CAAC;AAEhB,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,aAAa,GAAmB,YAAY,CAAC;AACnD,MAAM,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;KAC/C,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;KAChC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9D,IAAI,UAAU,GAAG,aAAa,EAAE;QAC9B,MAAM,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,OAAO,kBAAkB,UAAU,EAAE,CAAC,CAAC;QAC7E,OAAO;KACR;IACD,4BAA4B;IAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;IACjC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,MAAM,CAAC,IAAI,CAAC;QACV,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,IAAI;KACL,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/events",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.48",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app events",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/events#readme",
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "
|
|
23
|
+
"build": "sh ../../scripts/build-lib.sh"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@cloudcommerce/api": "workspace:*",
|
|
@@ -4,16 +4,18 @@ import type { AppEventsTopic } from '@cloudcommerce/types';
|
|
|
4
4
|
import 'source-map-support/register.js';
|
|
5
5
|
// eslint-disable-next-line import/no-unresolved
|
|
6
6
|
import { initializeApp } from 'firebase-admin/app';
|
|
7
|
-
|
|
8
|
-
import
|
|
7
|
+
import functions from 'firebase-functions';
|
|
8
|
+
import config from '@cloudcommerce/firebase/lib/config';
|
|
9
9
|
|
|
10
|
+
const { logger } = functions;
|
|
10
11
|
initializeApp();
|
|
11
12
|
|
|
12
13
|
const eventMaxAgeMs = 60000;
|
|
13
14
|
const newOrderTopic: AppEventsTopic = 'orders-new';
|
|
15
|
+
const { httpsFunctionOptions: { region } } = config.get();
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
export const onNewOrder = functions.region(region)
|
|
18
|
+
.runWith({ failurePolicy: true })
|
|
17
19
|
.pubsub.topic(newOrderTopic).onPublish((message, context) => {
|
|
18
20
|
const eventAgeMs = Date.now() - Date.parse(context.timestamp);
|
|
19
21
|
if (eventAgeMs > eventMaxAgeMs) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAE9B,MAAM,IAAI,GAAG;IACX,QAAQ,EAAE;QACR,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,gBAAgB;QACvD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB;QAC3E,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB;QAClE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC1C,oBAAoB,EAAE;YACpB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;SAChD;QACD,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,KAAK,EAAE,MAAM;aACd;SACF;KACF;CACF,CAAC;AAEF,eAAe;IACb,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,GAAG,CAAC,MAAM;QACR,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAE9B,MAAM,IAAI,GAAG;IACX,QAAQ,EAAE;QACR,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,gBAAgB;QACvD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB;QAC3E,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB;QAClE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC1C,oBAAoB,EAAE;YACpB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;SAChD;QACD,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,KAAK,EAAE,MAAM;aACd;SACF;KACF;CACF,CAAC;AAEF,eAAe;IACb,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,GAAG,CAAC,MAAM;QACR,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC;SAC5C;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export default () => {
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
ECOM_STORE_ID, ECOM_AUTHENTICATION_ID, ECOM_API_KEY, GITHUB_TOKEN,
|
|
4
|
+
} = process.env;
|
|
5
|
+
const storeId = ECOM_STORE_ID && parseInt(ECOM_STORE_ID, 10);
|
|
6
|
+
if (!storeId) {
|
|
7
|
+
throw new Error('ECOM_STORE_ID is not set or not a number');
|
|
8
|
+
}
|
|
3
9
|
if (!ECOM_AUTHENTICATION_ID) {
|
|
4
10
|
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
5
11
|
}
|
|
@@ -10,8 +16,11 @@ export default () => {
|
|
|
10
16
|
const apiKey = ECOM_API_KEY;
|
|
11
17
|
const githubToken = GITHUB_TOKEN;
|
|
12
18
|
const env = {
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
storeId,
|
|
20
|
+
apiAuth: {
|
|
21
|
+
authenticationId,
|
|
22
|
+
apiKey,
|
|
23
|
+
},
|
|
15
24
|
githubToken,
|
|
16
25
|
};
|
|
17
26
|
return env;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AASA,eAAe,GAAG,EAAE;IAClB,MAAM,EACJ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,YAAY,GACb,GAAG,OAAO,CAAC,GAAG,CAAC;IAChB,MAAM,OAAO,GAAG,aAAa,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;IACD,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,OAAO;QACP,OAAO,EAAE;YACP,gBAAgB;YAChB,MAAM;SACP;QACD,WAAW;KACZ,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
2
|
+
import { getFirestore } from 'firebase-admin/firestore';
|
|
3
|
+
import api from '@cloudcommerce/api';
|
|
4
|
+
import config from '../config.js';
|
|
5
|
+
|
|
6
|
+
export default async (req, res) => {
|
|
7
|
+
const { storeId, apps } = config.get();
|
|
8
|
+
const { body } = req;
|
|
9
|
+
if (Number(req.get('X-Store-ID')) === storeId
|
|
10
|
+
&& body && body.store_id === storeId) {
|
|
11
|
+
const { application, authentication } = body;
|
|
12
|
+
if (application && authentication) {
|
|
13
|
+
const matchApp = Object.keys(apps).find((slug) => {
|
|
14
|
+
return apps[slug].appId === application.app_id;
|
|
15
|
+
});
|
|
16
|
+
if (matchApp) {
|
|
17
|
+
const authenticationId = authentication.authentication_id;
|
|
18
|
+
const firestoreDoc = getFirestore().doc(`installedApps/${authenticationId}`);
|
|
19
|
+
const installedApp = await firestoreDoc.get();
|
|
20
|
+
if (installedApp.exists) {
|
|
21
|
+
res.sendStatus(200);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const appDataEndpoint = `applications/${application._id}/hidden_data`;
|
|
25
|
+
try {
|
|
26
|
+
await api.patch(appDataEndpoint, {
|
|
27
|
+
__installedAt: new Date().toISOString(),
|
|
28
|
+
}, {
|
|
29
|
+
authenticationId: authentication._id,
|
|
30
|
+
apiKey: authentication.api_key,
|
|
31
|
+
});
|
|
32
|
+
} catch (e) {
|
|
33
|
+
res.sendStatus(403);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Received app authentication is valid
|
|
37
|
+
await firestoreDoc.set({ application, authentication });
|
|
38
|
+
res.sendStatus(201);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
res.sendStatus(400);
|
|
44
|
+
};
|
|
45
|
+
// # sourceMappingURL=auth-callback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-callback.js","sourceRoot":"","sources":["../../src/handlers/auth-callback.ts"],"names":[],"mappings":"AACA,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,GAAoB,MAAM,oBAAoB,CAAC;AACtD,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,eAAe,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;IACnD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IACrB,IACE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,OAAO;WACtC,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,EACpC;QACA,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAC7C,IAAI,WAAW,IAAI,cAAc,EAAE;YACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,MAAM,CAAC;YACjD,CAAC,CAAC,CAAC;YACH,IAAI,QAAQ,EAAE;gBACZ,MAAM,gBAAgB,GAAG,cAAc,CAAC,iBAAiB,CAAC;gBAC1D,MAAM,YAAY,GAAG,YAAY,EAAE,CAAC,GAAG,CAAC,iBAAiB,gBAAgB,EAAE,CAAC,CAAC;gBAC7E,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,CAAC;gBAC9C,IAAI,YAAY,CAAC,MAAM,EAAE;oBACvB,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;oBACpB,OAAO;iBACR;gBAED,MAAM,eAAe,GAAgB,gBAAgB,WAAW,CAAC,GAAG,cAAc,CAAC;gBACnF,IAAI;oBACF,MAAM,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE;wBAC/B,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;qBACxC,EAAE;wBACD,gBAAgB,EAAE,cAAc,CAAC,GAAG;wBACpC,MAAM,EAAE,cAAc,CAAC,OAAO;qBAC/B,CAAC,CAAC;iBACJ;gBAAC,OAAO,CAAC,EAAE;oBACV,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;oBACpB,OAAO;iBACR;gBAED,uCAAuC;gBACvC,MAAM,YAAY,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;gBACxD,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBACpB,OAAO;aACR;SACF;KACF;IACD,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-unresolved
|
|
2
2
|
import { getFirestore } from 'firebase-admin/firestore';
|
|
3
|
-
import
|
|
3
|
+
import logger from 'firebase-functions/lib/logger';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import getEnv from '../env.js';
|
|
6
6
|
|
|
7
7
|
export default async () => {
|
|
8
|
-
const {
|
|
8
|
+
const { apiAuth } = getEnv();
|
|
9
9
|
const eventsSubs = await getFirestore().collection('eventsSubs').get();
|
|
10
10
|
const listenedEvents = [];
|
|
11
11
|
eventsSubs.forEach((doc) => {
|
|
@@ -20,11 +20,8 @@ export default async () => {
|
|
|
20
20
|
'products',
|
|
21
21
|
'carts',
|
|
22
22
|
].forEach(async (resource) => {
|
|
23
|
-
const { data: { result } } = await api
|
|
24
|
-
|
|
25
|
-
apiKey,
|
|
26
|
-
endpoint: `events/${resource}`,
|
|
27
|
-
});
|
|
23
|
+
const { data: { result } } = await api
|
|
24
|
+
.get(`events/${resource}`, apiAuth);
|
|
28
25
|
logger.info(`${resource} events: `, result);
|
|
29
26
|
});
|
|
30
27
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-store-events.js","sourceRoot":"","sources":["../../src/handlers/check-store-events.ts"],"names":[],"mappings":"AACA,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"check-store-events.js","sourceRoot":"","sources":["../../src/handlers/check-store-events.ts"],"names":[],"mappings":"AACA,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,eAAe,KAAK,IAAI,EAAE;IACxB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,MAAM,YAAY,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC;IACvE,MAAM,cAAc,GAAwB,EAAE,CAAC;IAC/C,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACzB,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAc,CAAC;QACxC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC5C,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;IAChC;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;aACnC,GAAG,CAAC,UAAU,QAAoB,EAAE,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import 'source-map-support/register.js';
|
|
2
2
|
import '@cloudcommerce/api/fetch-polyfill.js';
|
|
3
|
-
|
|
3
|
+
import functions from 'firebase-functions';
|
|
4
|
+
export declare const cronStoreEvents: functions.CloudFunction<unknown>;
|
|
5
|
+
export declare const appAuthCallback: functions.HttpsFunction;
|
|
@@ -4,13 +4,26 @@ import '@cloudcommerce/api/fetch-polyfill.js';
|
|
|
4
4
|
// https://github.com/import-js/eslint-plugin-import/issues/1810
|
|
5
5
|
// eslint-disable-next-line import/no-unresolved
|
|
6
6
|
import { initializeApp } from 'firebase-admin/app';
|
|
7
|
-
import
|
|
7
|
+
import functions from 'firebase-functions';
|
|
8
|
+
import config from './config.js';
|
|
8
9
|
import checkStoreEvents from './handlers/check-store-events.js';
|
|
10
|
+
import handleAuthCallback from './handlers/auth-callback.js';
|
|
9
11
|
|
|
10
12
|
initializeApp();
|
|
13
|
+
const { httpsFunctionOptions: { region } } = config.get();
|
|
14
|
+
const functionBuilder = functions
|
|
15
|
+
.region(region)
|
|
16
|
+
.runWith({
|
|
17
|
+
timeoutSeconds: 300,
|
|
18
|
+
memory: '128MB',
|
|
19
|
+
});
|
|
11
20
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
export const cronStoreEvents = functionBuilder.pubsub
|
|
22
|
+
.schedule('* * * * *')
|
|
23
|
+
.onRun(() => {
|
|
24
|
+
return checkStoreEvents();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const appAuthCallback = functionBuilder.https
|
|
28
|
+
.onRequest(handleAuthCallback);
|
|
16
29
|
// # sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,gEAAgE;AAChE,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,gEAAgE;AAChE,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D,aAAa,EAAE,CAAC;AAEhB,MAAM,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE1D,MAAM,eAAe,GAAG,SAAS;KAC9B,MAAM,CAAC,MAAM,CAAC;KACd,OAAO,CAAC;IACP,cAAc,EAAE,GAAG;IACnB,MAAM,EAAE,OAAO;CAChB,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,MAAM;KAClD,QAAQ,CAAC,WAAW,CAAC;KACrB,KAAK,CAAC,GAAG,EAAE;IACV,OAAO,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,KAAK;KACjD,SAAS,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
type Env = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
storeId: number;
|
|
3
|
+
apiAuth: {
|
|
4
|
+
authenticationId: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
},
|
|
4
7
|
githubToken?: string;
|
|
5
8
|
};
|
|
6
9
|
|
|
7
10
|
export default () => {
|
|
8
11
|
const {
|
|
12
|
+
ECOM_STORE_ID,
|
|
9
13
|
ECOM_AUTHENTICATION_ID,
|
|
10
14
|
ECOM_API_KEY,
|
|
11
15
|
GITHUB_TOKEN,
|
|
12
16
|
} = process.env;
|
|
17
|
+
const storeId = ECOM_STORE_ID && parseInt(ECOM_STORE_ID, 10);
|
|
18
|
+
if (!storeId) {
|
|
19
|
+
throw new Error('ECOM_STORE_ID is not set or not a number');
|
|
20
|
+
}
|
|
13
21
|
if (!ECOM_AUTHENTICATION_ID) {
|
|
14
22
|
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
15
23
|
}
|
|
@@ -20,8 +28,11 @@ export default () => {
|
|
|
20
28
|
const apiKey = ECOM_API_KEY;
|
|
21
29
|
const githubToken = GITHUB_TOKEN;
|
|
22
30
|
const env: Env = {
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
storeId,
|
|
32
|
+
apiAuth: {
|
|
33
|
+
authenticationId,
|
|
34
|
+
apiKey,
|
|
35
|
+
},
|
|
25
36
|
githubToken,
|
|
26
37
|
};
|
|
27
38
|
return env;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Request, Response } from 'firebase-functions';
|
|
2
|
+
// eslint-disable-next-line import/no-unresolved
|
|
3
|
+
import { getFirestore } from 'firebase-admin/firestore';
|
|
4
|
+
import api, { ApiEndpoint } from '@cloudcommerce/api';
|
|
5
|
+
import config from '../config';
|
|
6
|
+
|
|
7
|
+
export default async (req: Request, res: Response) => {
|
|
8
|
+
const { storeId, apps } = config.get();
|
|
9
|
+
const { body } = req;
|
|
10
|
+
if (
|
|
11
|
+
Number(req.get('X-Store-ID')) === storeId
|
|
12
|
+
&& body && body.store_id === storeId
|
|
13
|
+
) {
|
|
14
|
+
const { application, authentication } = body;
|
|
15
|
+
if (application && authentication) {
|
|
16
|
+
const matchApp = Object.keys(apps).find((slug) => {
|
|
17
|
+
return apps[slug].appId === application.app_id;
|
|
18
|
+
});
|
|
19
|
+
if (matchApp) {
|
|
20
|
+
const authenticationId = authentication.authentication_id;
|
|
21
|
+
const firestoreDoc = getFirestore().doc(`installedApps/${authenticationId}`);
|
|
22
|
+
const installedApp = await firestoreDoc.get();
|
|
23
|
+
if (installedApp.exists) {
|
|
24
|
+
res.sendStatus(200);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const appDataEndpoint: ApiEndpoint = `applications/${application._id}/hidden_data`;
|
|
29
|
+
try {
|
|
30
|
+
await api.patch(appDataEndpoint, {
|
|
31
|
+
__installedAt: new Date().toISOString(),
|
|
32
|
+
}, {
|
|
33
|
+
authenticationId: authentication._id,
|
|
34
|
+
apiKey: authentication.api_key,
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
res.sendStatus(403);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Received app authentication is valid
|
|
42
|
+
await firestoreDoc.set({ application, authentication });
|
|
43
|
+
res.sendStatus(201);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
res.sendStatus(400);
|
|
49
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EventSub } from '../types';
|
|
2
2
|
// eslint-disable-next-line import/no-unresolved
|
|
3
3
|
import { getFirestore } from 'firebase-admin/firestore';
|
|
4
|
-
import
|
|
4
|
+
import logger from 'firebase-functions/lib/logger';
|
|
5
5
|
import api from '@cloudcommerce/api';
|
|
6
6
|
import getEnv from '../env';
|
|
7
7
|
|
|
8
8
|
export default async () => {
|
|
9
|
-
const {
|
|
9
|
+
const { apiAuth } = getEnv();
|
|
10
10
|
const eventsSubs = await getFirestore().collection('eventsSubs').get();
|
|
11
11
|
const listenedEvents: EventSub['event'][] = [];
|
|
12
12
|
eventsSubs.forEach((doc) => {
|
|
@@ -21,11 +21,8 @@ export default async () => {
|
|
|
21
21
|
'products',
|
|
22
22
|
'carts',
|
|
23
23
|
].forEach(async (resource) => {
|
|
24
|
-
const { data: { result } } = await api
|
|
25
|
-
|
|
26
|
-
apiKey,
|
|
27
|
-
endpoint: `events/${resource as 'orders'}`,
|
|
28
|
-
});
|
|
24
|
+
const { data: { result } } = await api
|
|
25
|
+
.get(`events/${resource as 'orders'}`, apiAuth);
|
|
29
26
|
logger.info(`${resource} events: `, result);
|
|
30
27
|
});
|
|
31
28
|
return true;
|
|
@@ -5,12 +5,27 @@ import '@cloudcommerce/api/fetch-polyfill.js';
|
|
|
5
5
|
// https://github.com/import-js/eslint-plugin-import/issues/1810
|
|
6
6
|
// eslint-disable-next-line import/no-unresolved
|
|
7
7
|
import { initializeApp } from 'firebase-admin/app';
|
|
8
|
-
import
|
|
8
|
+
import functions from 'firebase-functions';
|
|
9
|
+
import config from './config';
|
|
9
10
|
import checkStoreEvents from './handlers/check-store-events';
|
|
11
|
+
import handleAuthCallback from './handlers/auth-callback';
|
|
10
12
|
|
|
11
13
|
initializeApp();
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const { httpsFunctionOptions: { region } } = config.get();
|
|
16
|
+
|
|
17
|
+
const functionBuilder = functions
|
|
18
|
+
.region(region)
|
|
19
|
+
.runWith({
|
|
20
|
+
timeoutSeconds: 300,
|
|
21
|
+
memory: '128MB',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const cronStoreEvents = functionBuilder.pubsub
|
|
25
|
+
.schedule('* * * * *')
|
|
26
|
+
.onRun(() => {
|
|
27
|
+
return checkStoreEvents();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const appAuthCallback = functionBuilder.https
|
|
31
|
+
.onRequest(handleAuthCallback);
|
|
@@ -11,14 +11,10 @@ import serveModulesApi from './firebase/serve-modules-api.js';
|
|
|
11
11
|
initializeApp();
|
|
12
12
|
const { httpsFunctionOptions } = config.get();
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const { authenticationId, apiKey } = getEnv();
|
|
14
|
+
export const modules = onRequest(httpsFunctionOptions, (req, res) => {
|
|
15
|
+
const { apiAuth } = getEnv();
|
|
17
16
|
// Hide API key for security
|
|
18
17
|
process.env.ECOM_API_KEY = '***';
|
|
19
|
-
serveModulesApi(req, res,
|
|
20
|
-
authenticationId,
|
|
21
|
-
apiKey,
|
|
22
|
-
});
|
|
18
|
+
serveModulesApi(req, res, apiAuth);
|
|
23
19
|
});
|
|
24
20
|
// # sourceMappingURL=firebase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,gCAAgC,CAAC;AACxC,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,MAAM,MAAM,iCAAiC,CAAC;AACrD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,aAAa,EAAE,CAAC;AAChB,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,gCAAgC,CAAC;AACxC,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,MAAM,MAAM,iCAAiC,CAAC;AACrD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,aAAa,EAAE,CAAC;AAChB,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAClE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,4BAA4B;IAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;IACjC,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC"}
|
|
@@ -12,13 +12,9 @@ import serveModulesApi from './firebase/serve-modules-api';
|
|
|
12
12
|
initializeApp();
|
|
13
13
|
const { httpsFunctionOptions } = config.get();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const { authenticationId, apiKey } = getEnv();
|
|
15
|
+
export const modules = onRequest(httpsFunctionOptions, (req, res) => {
|
|
16
|
+
const { apiAuth } = getEnv();
|
|
18
17
|
// Hide API key for security
|
|
19
18
|
process.env.ECOM_API_KEY = '***';
|
|
20
|
-
serveModulesApi(req, res,
|
|
21
|
-
authenticationId,
|
|
22
|
-
apiKey,
|
|
23
|
-
});
|
|
19
|
+
serveModulesApi(req, res, apiAuth);
|
|
24
20
|
});
|
|
@@ -9,8 +9,7 @@ import config from '@cloudcommerce/firebase/lib/config';
|
|
|
9
9
|
initializeApp();
|
|
10
10
|
const options = config.get().httpsFunctionOptions;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
export const passport_api = onRequest(options, (request, response) => {
|
|
12
|
+
export const passport = onRequest(options, (request, response) => {
|
|
14
13
|
process.env.ECOM_API_KEY = '***';
|
|
15
14
|
response.send('Hello passport!');
|
|
16
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,gCAAgC,CAAC;AACxC,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD,aAAa,EAAE,CAAC;AAChB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;AAElD,
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,gCAAgC,CAAC;AACxC,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD,aAAa,EAAE,CAAC;AAChB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;IAC/D,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC"}
|
|
@@ -10,8 +10,7 @@ import config from '@cloudcommerce/firebase/lib/config';
|
|
|
10
10
|
initializeApp();
|
|
11
11
|
const options = config.get().httpsFunctionOptions;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
export const passport_api = onRequest(options, (request, response) => {
|
|
13
|
+
export const passport = onRequest(options, (request, response) => {
|
|
15
14
|
process.env.ECOM_API_KEY = '***';
|
|
16
15
|
response.send('Hello passport!');
|
|
17
16
|
});
|
package/pnpm-lock.yaml
CHANGED
|
@@ -60,10 +60,16 @@ importers:
|
|
|
60
60
|
specifiers:
|
|
61
61
|
'@cloudcommerce/api': workspace:*
|
|
62
62
|
'@cloudcommerce/types': workspace:*
|
|
63
|
+
'@firebase/app-types': ^0.7.0
|
|
64
|
+
firebase-admin: ^11.0.1
|
|
65
|
+
firebase-functions: ^3.22.0
|
|
63
66
|
dependencies:
|
|
64
67
|
'@cloudcommerce/api': link:../../api
|
|
68
|
+
firebase-admin: 11.0.1_@firebase+app-types@0.7.0
|
|
69
|
+
firebase-functions: 3.22.0_firebase-admin@11.0.1
|
|
65
70
|
devDependencies:
|
|
66
71
|
'@cloudcommerce/types': link:../../types
|
|
72
|
+
'@firebase/app-types': 0.7.0
|
|
67
73
|
|
|
68
74
|
packages/cli:
|
|
69
75
|
specifiers:
|
|
@@ -198,36 +204,44 @@ importers:
|
|
|
198
204
|
|
|
199
205
|
store:
|
|
200
206
|
specifiers:
|
|
201
|
-
'@cloudcommerce/cli': ^0.0.
|
|
207
|
+
'@cloudcommerce/cli': ^0.0.47
|
|
202
208
|
dependencies:
|
|
203
209
|
'@cloudcommerce/cli': link:../packages/cli
|
|
204
210
|
|
|
205
211
|
store/functions/core:
|
|
206
212
|
specifiers:
|
|
207
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
213
|
+
'@cloudcommerce/firebase': ^0.0.47
|
|
208
214
|
dependencies:
|
|
209
215
|
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
210
216
|
|
|
217
|
+
store/functions/events:
|
|
218
|
+
specifiers:
|
|
219
|
+
'@cloudcommerce/events': ^0.0.46
|
|
220
|
+
'@cloudcommerce/firebase': ^0.0.46
|
|
221
|
+
dependencies:
|
|
222
|
+
'@cloudcommerce/events': 0.0.46
|
|
223
|
+
'@cloudcommerce/firebase': 0.0.46
|
|
224
|
+
|
|
211
225
|
store/functions/modules:
|
|
212
226
|
specifiers:
|
|
213
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
214
|
-
'@cloudcommerce/modules': ^0.0.
|
|
227
|
+
'@cloudcommerce/firebase': ^0.0.47
|
|
228
|
+
'@cloudcommerce/modules': ^0.0.47
|
|
215
229
|
dependencies:
|
|
216
230
|
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
217
231
|
'@cloudcommerce/modules': link:../../../packages/modules
|
|
218
232
|
|
|
219
233
|
store/functions/passport:
|
|
220
234
|
specifiers:
|
|
221
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
222
|
-
'@cloudcommerce/passport': ^0.0.
|
|
235
|
+
'@cloudcommerce/firebase': ^0.0.47
|
|
236
|
+
'@cloudcommerce/passport': ^0.0.47
|
|
223
237
|
dependencies:
|
|
224
238
|
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
225
239
|
'@cloudcommerce/passport': link:../../../packages/passport
|
|
226
240
|
|
|
227
241
|
store/functions/ssr:
|
|
228
242
|
specifiers:
|
|
229
|
-
'@cloudcommerce/firebase': ^0.0.
|
|
230
|
-
'@cloudcommerce/ssr': ^0.0.
|
|
243
|
+
'@cloudcommerce/firebase': ^0.0.47
|
|
244
|
+
'@cloudcommerce/ssr': ^0.0.47
|
|
231
245
|
dependencies:
|
|
232
246
|
'@cloudcommerce/firebase': link:../../../packages/firebase
|
|
233
247
|
'@cloudcommerce/ssr': link:../../../packages/ssr
|
|
@@ -554,6 +568,39 @@ packages:
|
|
|
554
568
|
to-fast-properties: 2.0.0
|
|
555
569
|
dev: false
|
|
556
570
|
|
|
571
|
+
/@cloudcommerce/api/0.0.46:
|
|
572
|
+
resolution: {integrity: sha512-cZ7V/6dFOnhh6c0Qkgz94v9XG/zWQxOGWiSA1czg4/ALKe2j606NXxBTu1fF0olVw5q9YEB+k5ZOmh1Mh5vJ2g==}
|
|
573
|
+
dev: false
|
|
574
|
+
|
|
575
|
+
/@cloudcommerce/events/0.0.46:
|
|
576
|
+
resolution: {integrity: sha512-DQklAU2QCIo0U8QNV1uDhNEXr8tVrwnNwDQGzrJO/3QtsqPgRkEUvOMUZUVyq96j9XNfuaKm/amARgC13z0Z7w==}
|
|
577
|
+
dependencies:
|
|
578
|
+
'@cloudcommerce/api': 0.0.46
|
|
579
|
+
'@cloudcommerce/firebase': 0.0.46
|
|
580
|
+
firebase-admin: 11.0.1
|
|
581
|
+
firebase-functions: 3.22.0_firebase-admin@11.0.1
|
|
582
|
+
source-map-support: 0.5.21
|
|
583
|
+
transitivePeerDependencies:
|
|
584
|
+
- '@firebase/app-types'
|
|
585
|
+
- encoding
|
|
586
|
+
- supports-color
|
|
587
|
+
dev: false
|
|
588
|
+
|
|
589
|
+
/@cloudcommerce/firebase/0.0.46:
|
|
590
|
+
resolution: {integrity: sha512-fyzMHHLE2I6MdLWYTNwCWhLkaU9Pj9Z7liKEvkndV1rKZtWQ3NWsBDzFlIRIg6v4dz+RYAkXSCOyn+VwBKjHvw==}
|
|
591
|
+
dependencies:
|
|
592
|
+
'@cloudcommerce/api': 0.0.46
|
|
593
|
+
'@fastify/deepmerge': 1.1.0
|
|
594
|
+
firebase-admin: 11.0.1
|
|
595
|
+
firebase-functions: 3.22.0_firebase-admin@11.0.1
|
|
596
|
+
node-fetch: 3.2.10
|
|
597
|
+
source-map-support: 0.5.21
|
|
598
|
+
transitivePeerDependencies:
|
|
599
|
+
- '@firebase/app-types'
|
|
600
|
+
- encoding
|
|
601
|
+
- supports-color
|
|
602
|
+
dev: false
|
|
603
|
+
|
|
557
604
|
/@commitlint/cli/17.0.3:
|
|
558
605
|
resolution: {integrity: sha512-oAo2vi5d8QZnAbtU5+0cR2j+A7PO8zuccux65R/EycwvsZrDVyW518FFrnJK2UQxbRtHFFIG+NjQ6vOiJV0Q8A==}
|
|
559
606
|
engines: {node: '>=v14'}
|
|
@@ -768,6 +815,15 @@ packages:
|
|
|
768
815
|
/@firebase/app-types/0.7.0:
|
|
769
816
|
resolution: {integrity: sha512-6fbHQwDv2jp/v6bXhBw2eSRbNBpxHcd1NBF864UksSMVIqIyri9qpJB1Mn6sGZE+bnDsSQBC5j2TbMxYsJQkQg==}
|
|
770
817
|
|
|
818
|
+
/@firebase/auth-interop-types/0.1.6_@firebase+util@1.6.3:
|
|
819
|
+
resolution: {integrity: sha512-etIi92fW3CctsmR9e3sYM3Uqnoq861M0Id9mdOPF6PWIg38BXL5k4upCNBggGUpLIS0H1grMOvy/wn1xymwe2g==}
|
|
820
|
+
peerDependencies:
|
|
821
|
+
'@firebase/app-types': 0.x
|
|
822
|
+
'@firebase/util': 1.x
|
|
823
|
+
dependencies:
|
|
824
|
+
'@firebase/util': 1.6.3
|
|
825
|
+
dev: false
|
|
826
|
+
|
|
771
827
|
/@firebase/auth-interop-types/0.1.6_pbfwexsq7uf6mrzcwnikj3g37m:
|
|
772
828
|
resolution: {integrity: sha512-etIi92fW3CctsmR9e3sYM3Uqnoq861M0Id9mdOPF6PWIg38BXL5k4upCNBggGUpLIS0H1grMOvy/wn1xymwe2g==}
|
|
773
829
|
peerDependencies:
|
|
@@ -785,6 +841,19 @@ packages:
|
|
|
785
841
|
tslib: 2.4.0
|
|
786
842
|
dev: false
|
|
787
843
|
|
|
844
|
+
/@firebase/database-compat/0.2.3:
|
|
845
|
+
resolution: {integrity: sha512-uwSMnbjlSQM5gQRq8OoBLs7uc7obwsl0D6kSDAnMOlPtPl9ert79Rq9faU/COjybsJ8l7tNXMVYYJo3mQ5XNrA==}
|
|
846
|
+
dependencies:
|
|
847
|
+
'@firebase/component': 0.5.17
|
|
848
|
+
'@firebase/database': 0.13.3
|
|
849
|
+
'@firebase/database-types': 0.9.11
|
|
850
|
+
'@firebase/logger': 0.3.3
|
|
851
|
+
'@firebase/util': 1.6.3
|
|
852
|
+
tslib: 2.4.0
|
|
853
|
+
transitivePeerDependencies:
|
|
854
|
+
- '@firebase/app-types'
|
|
855
|
+
dev: false
|
|
856
|
+
|
|
788
857
|
/@firebase/database-compat/0.2.3_@firebase+app-types@0.7.0:
|
|
789
858
|
resolution: {integrity: sha512-uwSMnbjlSQM5gQRq8OoBLs7uc7obwsl0D6kSDAnMOlPtPl9ert79Rq9faU/COjybsJ8l7tNXMVYYJo3mQ5XNrA==}
|
|
790
859
|
dependencies:
|
|
@@ -805,6 +874,19 @@ packages:
|
|
|
805
874
|
'@firebase/util': 1.6.3
|
|
806
875
|
dev: false
|
|
807
876
|
|
|
877
|
+
/@firebase/database/0.13.3:
|
|
878
|
+
resolution: {integrity: sha512-ZE+QJqQUaCTZiIzGq3RJLo64HRMtbdaEwyDhfZyPEzMJV4kyLsw3cHdEHVCtBmdasTvwtpO2YRFmd4AXAoKtNw==}
|
|
879
|
+
dependencies:
|
|
880
|
+
'@firebase/auth-interop-types': 0.1.6_@firebase+util@1.6.3
|
|
881
|
+
'@firebase/component': 0.5.17
|
|
882
|
+
'@firebase/logger': 0.3.3
|
|
883
|
+
'@firebase/util': 1.6.3
|
|
884
|
+
faye-websocket: 0.11.4
|
|
885
|
+
tslib: 2.4.0
|
|
886
|
+
transitivePeerDependencies:
|
|
887
|
+
- '@firebase/app-types'
|
|
888
|
+
dev: false
|
|
889
|
+
|
|
808
890
|
/@firebase/database/0.13.3_@firebase+app-types@0.7.0:
|
|
809
891
|
resolution: {integrity: sha512-ZE+QJqQUaCTZiIzGq3RJLo64HRMtbdaEwyDhfZyPEzMJV4kyLsw3cHdEHVCtBmdasTvwtpO2YRFmd4AXAoKtNw==}
|
|
810
892
|
dependencies:
|
|
@@ -3573,6 +3655,27 @@ packages:
|
|
|
3573
3655
|
pkg-dir: 4.2.0
|
|
3574
3656
|
dev: false
|
|
3575
3657
|
|
|
3658
|
+
/firebase-admin/11.0.1:
|
|
3659
|
+
resolution: {integrity: sha512-rL3wlZbi2Kb/KJgcmj1YHlD4ZhfmhfgRO2YJialxAllm0tj1IQea878hHuBLGmv4DpbW9t9nLvX9kddNR2Y65Q==}
|
|
3660
|
+
engines: {node: '>=14'}
|
|
3661
|
+
dependencies:
|
|
3662
|
+
'@fastify/busboy': 1.1.0
|
|
3663
|
+
'@firebase/database-compat': 0.2.3
|
|
3664
|
+
'@firebase/database-types': 0.9.11
|
|
3665
|
+
'@types/node': 18.0.6
|
|
3666
|
+
jsonwebtoken: 8.5.1
|
|
3667
|
+
jwks-rsa: 2.1.4
|
|
3668
|
+
node-forge: 1.3.1
|
|
3669
|
+
uuid: 8.3.2
|
|
3670
|
+
optionalDependencies:
|
|
3671
|
+
'@google-cloud/firestore': 5.0.2
|
|
3672
|
+
'@google-cloud/storage': 6.2.3
|
|
3673
|
+
transitivePeerDependencies:
|
|
3674
|
+
- '@firebase/app-types'
|
|
3675
|
+
- encoding
|
|
3676
|
+
- supports-color
|
|
3677
|
+
dev: false
|
|
3678
|
+
|
|
3576
3679
|
/firebase-admin/11.0.1_@firebase+app-types@0.7.0:
|
|
3577
3680
|
resolution: {integrity: sha512-rL3wlZbi2Kb/KJgcmj1YHlD4ZhfmhfgRO2YJialxAllm0tj1IQea878hHuBLGmv4DpbW9t9nLvX9kddNR2Y65Q==}
|
|
3578
3681
|
engines: {node: '>=14'}
|