cloudcommerce 0.0.100 → 0.0.101

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,19 @@
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.101](https://github.com/ecomplus/cloud-commerce/compare/v0.0.100...v0.0.101) (2022-09-27)
6
+
7
+
8
+ ### Features
9
+
10
+ * **firebase:** Get additional deploy options from `process.env` ([b6c38e3](https://github.com/ecomplus/cloud-commerce/commit/b6c38e309fea94bf27eadc2f03ca697c73f56360))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **firebase:** Update config `httpsFunctionOptions` type def with optional props ([ff91e72](https://github.com/ecomplus/cloud-commerce/commit/ff91e723a919f2e0d6369da7a2f904691a619bab))
16
+ * **modules:** Trying default deloy options with concurrency 12 ([5052ac6](https://github.com/ecomplus/cloud-commerce/commit/5052ac6b6c93b18d2979c39d5f88cf6c458b5794))
17
+
5
18
  ### [0.0.100](https://github.com/ecomplus/cloud-commerce/compare/v0.0.99...v0.0.100) (2022-09-27)
6
19
 
7
20
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
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.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/api.js",
7
7
  "types": "lib/api.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-correios",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
6
6
  "main": "lib/correios.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-shipping",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce app for custom shipping methods",
6
6
  "main": "lib/custom-shipping.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "lib/discounts.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-frenet",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce app for Frenet shipping calculation",
6
6
  "main": "lib/frenet.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-tiny-erp",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce app for Tiny ERP",
6
6
  "main": "lib/tiny-erp.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -4,6 +4,9 @@ declare const mergeConfig: {
4
4
  hello: string;
5
5
  httpsFunctionOptions: {
6
6
  region: string;
7
+ memory: "128MiB" | "256MiB" | "512MiB" | "1GiB" | undefined;
8
+ timeoutSeconds: number | undefined;
9
+ minInstances: number | undefined;
7
10
  };
8
11
  apps: {
9
12
  discounts: {
@@ -6,10 +6,18 @@ const tinyErpEvents = [
6
6
  'products-priceSet',
7
7
  'applications-dataSet',
8
8
  ];
9
+ const {
10
+ DEPLOY_REGION, DEPLOY_MEMORY, DEPLOY_TIMEOUT_SECONDS, DEPLOY_MIN_INSTANCES,
11
+ } = process.env;
9
12
  const mergeConfig = {
10
13
  hello: 'from @cloudcommerce/firebase',
11
14
  httpsFunctionOptions: {
12
- region: process.env.DEPLOY_REGION || 'southamerica-east1',
15
+ region: DEPLOY_REGION || 'southamerica-east1',
16
+ memory: DEPLOY_MEMORY,
17
+ timeoutSeconds: DEPLOY_TIMEOUT_SECONDS
18
+ ? Number(DEPLOY_TIMEOUT_SECONDS) : undefined,
19
+ minInstances: DEPLOY_MIN_INSTANCES
20
+ ? Number(DEPLOY_MIN_INSTANCES) : undefined,
13
21
  },
14
22
  apps: {
15
23
  discounts: {
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,MAAsB,MAAM,uBAAuB,CAAC;AAE3D,MAAM,aAAa,GAAmB;IACpC,qBAAqB;IACrB,cAAc;IACd,mBAAmB;IACnB,sBAAsB;CACvB,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,8BAA8B;IACrC,oBAAoB,EAAE;QACpB,MAAM,EAAE,OAA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ACZ;QACD,OAAO,EAAE;YACP,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,aAAa;SACtB;KACF;CACF,CAAC;AACF,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAExB,eAAe,MAId,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -8,10 +8,22 @@ const tinyErpEvents: ApiEventName[] = [
8
8
  'applications-dataSet',
9
9
  ];
10
10
 
11
+ const {
12
+ DEPLOY_REGION,
13
+ DEPLOY_MEMORY,
14
+ DEPLOY_TIMEOUT_SECONDS,
15
+ DEPLOY_MIN_INSTANCES,
16
+ } = process.env;
17
+
11
18
  const mergeConfig = {
12
19
  hello: 'from @cloudcommerce/firebase',
13
20
  httpsFunctionOptions: {
14
- region: process.env.DEPLOY_REGION || 'southamerica-east1',
21
+ region: DEPLOY_REGION || 'southamerica-east1',
22
+ memory: DEPLOY_MEMORY as '128MiB' | '256MiB' | '512MiB' | '1GiB' | undefined,
23
+ timeoutSeconds: DEPLOY_TIMEOUT_SECONDS
24
+ ? Number(DEPLOY_TIMEOUT_SECONDS) : undefined,
25
+ minInstances: DEPLOY_MIN_INSTANCES
26
+ ? Number(DEPLOY_MIN_INSTANCES) : undefined,
15
27
  },
16
28
  apps: {
17
29
  discounts: {
@@ -8,7 +8,7 @@ import serveModulesApi from './firebase/serve-modules-api.js';
8
8
  const { httpsFunctionOptions } = config.get();
9
9
 
10
10
  export const modules = onRequest({
11
- concurrency: 6,
11
+ concurrency: 12,
12
12
  ...httpsFunctionOptions,
13
13
  }, (req, res) => {
14
14
  serveModulesApi(req, res);
@@ -1 +1 @@
1
- {"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,CAAC;IACd,GAAG,oBAAoB;CACxB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACd,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,EAAE;IACf,GAAG,oBAAoB;CACxB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACd,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -8,7 +8,7 @@ import serveModulesApi from './firebase/serve-modules-api';
8
8
  const { httpsFunctionOptions } = config.get();
9
9
 
10
10
  export const modules = onRequest({
11
- concurrency: 6,
11
+ concurrency: 12,
12
12
  ...httpsFunctionOptions,
13
13
  }, (req, res) => {
14
14
  serveModulesApi(req, res);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,11 +1,9 @@
1
1
  import { join as joinPath } from 'path';
2
2
  import { readFile } from 'fs/promises';
3
- import compression from 'compression';
4
3
 
5
4
  const { STOREFRONT_BASE_DIR } = process.env;
6
5
  const baseDir = STOREFRONT_BASE_DIR || process.cwd();
7
6
  const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
8
- const compress = compression();
9
7
 
10
8
  export default (req, res) => {
11
9
  const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
@@ -27,27 +25,25 @@ export default (req, res) => {
27
25
  .send(err.toString());
28
26
  }
29
27
  };
30
- compress(req, res, async () => {
31
28
  /*
32
- https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
33
- import { handler as ssrHandler } from '../dist/server/entry.mjs';
34
- global.ssr_handler = ssrHandler;
35
- */
36
- global.ssr_handler(req, res, async (err) => {
37
- if (err) {
38
- res.set('X-SSR-Error', err.message);
39
- fallback(err);
40
- return;
41
- }
42
- const local = new URL(`.${url}`, clientRoot);
43
- try {
44
- const data = await readFile(local);
45
- setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
46
- .send(data);
47
- } catch {
48
- fallback(err, 404);
49
- }
50
- });
29
+ https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
30
+ import { handler as ssrHandler } from '../dist/server/entry.mjs';
31
+ global.ssr_handler = ssrHandler;
32
+ */
33
+ global.ssr_handler(req, res, async (err) => {
34
+ if (err) {
35
+ res.set('X-SSR-Error', err.message);
36
+ fallback(err);
37
+ return;
38
+ }
39
+ const local = new URL(`.${url}`, clientRoot);
40
+ try {
41
+ const data = await readFile(local);
42
+ setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
43
+ .send(data);
44
+ } catch {
45
+ fallback(err, 404);
46
+ }
51
47
  });
52
48
  };
53
49
  // # sourceMappingURL=serve-storefront.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-storefront.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,WAAW,MAAM,aAAa,CAAC;AAEtC,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAC5C,MAAM,OAAO,GAAG,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AACrD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAE/B,eAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAEhE,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,YAAoB,EAAE,EAAE;QACjE,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;aACtB,GAAG,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;aACnC,GAAG,CACF,eAAe,EACf,CAAC,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU,IAAI,MAAM,CAAC,aAAa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CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;YAC3E,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,CAAC;iBAC7C,IAAI,CAAC,cAAc;kBAChB,yCAAyC;kBACvC,wBAAwB,MAAM,QAAQ,kBAAkB,CAAC,GAAG,CAAC,KAAK;kBACpE,gBAAgB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SACvD;aAAM;YACL,iBAAiB,CAAC,MAAM,EAAE,mCAAmC,CAAC;iBAC3D,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SACzB;IACH,CAAC,CAAC;IAEF;;;;MAIE;IACF,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAQ,EAAE,EAAE;QAC9C,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACpC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;SACR;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,MAAM;YACN,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,20 +1,26 @@
1
- /* eslint-disable import/prefer-default-export, import/no-unresolved, import/first */
1
+ /* eslint-disable import/no-unresolved, import/first */
2
2
  import '@cloudcommerce/api/fetch-polyfill';
3
3
  import { initializeApp } from 'firebase-admin/app';
4
4
 
5
5
  initializeApp();
6
- import { onRequest } from 'firebase-functions/v2/https';
6
+ import functions from 'firebase-functions';
7
7
  import config from '@cloudcommerce/firebase/lib/config';
8
8
  import serveStorefront from './firebase/serve-storefront.js';
9
9
 
10
- const { httpsFunctionOptions } = config.get();
10
+ const {
11
+ httpsFunctionOptions: {
12
+ region, timeoutSeconds, memory, minInstances,
13
+ },
14
+ } = config.get();
11
15
 
12
- export const ssr = onRequest({
13
- timeoutSeconds: 15,
14
- memory: '256MiB',
15
- minInstances: 1,
16
- ...httpsFunctionOptions,
17
- }, (req, res) => {
18
- serveStorefront(req, res);
19
- });
16
+ // eslint-disable-next-line import/prefer-default-export
17
+ export const ssr = functions
18
+ .region(region)
19
+ .runWith({
20
+ timeoutSeconds: timeoutSeconds || 15,
21
+ memory: memory ? memory.replace('i', '') : '256MB',
22
+ minInstances: minInstances || 1,
23
+ }).https.onRequest((req, res) => {
24
+ serveStorefront(req, res);
25
+ });
20
26
  // # sourceMappingURL=firebase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;IAC3B,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,CAAC;IACf,GAAG,oBAAoB;CACxB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACd,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,EACJ,oBAAoB,EAAE,EACpB,MAAM,EACN,cAAc,EACd,MAAM,EACN,YAAY,GACb,GACF,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAEjB,wDAAwD;AACxD,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS;KACzB,MAAM,CAAC,MAAM,CAAC;KACd,OAAO,CAAC;IACP,cAAc,EAAE,cAAc,IAAI,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAY,CAAC,CAAC,CAAC,OAAO;IAC7D,YAAY,EAAE,YAAY,IAAI,CAAC;CAChC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC9B,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -28,7 +28,6 @@
28
28
  "@cloudcommerce/firebase": "workspace:*",
29
29
  "@ecomplus/utils": "^1.4.1",
30
30
  "color": "^4.2.3",
31
- "compression": "^1.7.4",
32
31
  "firebase-admin": "^11.0.1",
33
32
  "firebase-functions": "^3.24.0",
34
33
  "html-escaper": "^3.0.3",
@@ -1,12 +1,10 @@
1
1
  import type { Request, Response } from 'firebase-functions';
2
2
  import { join as joinPath } from 'path';
3
3
  import { readFile } from 'fs/promises';
4
- import compression from 'compression';
5
4
 
6
5
  const { STOREFRONT_BASE_DIR } = process.env;
7
6
  const baseDir = STOREFRONT_BASE_DIR || process.cwd();
8
7
  const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
9
- const compress = compression();
10
8
 
11
9
  export default (req: Request, res: Response) => {
12
10
  const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
@@ -34,26 +32,24 @@ export default (req: Request, res: Response) => {
34
32
  }
35
33
  };
36
34
 
37
- compress(req, res, async () => {
38
- /*
39
- https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
40
- import { handler as ssrHandler } from '../dist/server/entry.mjs';
41
- global.ssr_handler = ssrHandler;
42
- */
43
- global.ssr_handler(req, res, async (err: any) => {
44
- if (err) {
45
- res.set('X-SSR-Error', err.message);
46
- fallback(err);
47
- return;
48
- }
49
- const local = new URL(`.${url}`, clientRoot);
50
- try {
51
- const data = await readFile(local);
52
- setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
53
- .send(data);
54
- } catch {
55
- fallback(err, 404);
56
- }
57
- });
35
+ /*
36
+ https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
37
+ import { handler as ssrHandler } from '../dist/server/entry.mjs';
38
+ global.ssr_handler = ssrHandler;
39
+ */
40
+ global.ssr_handler(req, res, async (err: any) => {
41
+ if (err) {
42
+ res.set('X-SSR-Error', err.message);
43
+ fallback(err);
44
+ return;
45
+ }
46
+ const local = new URL(`.${url}`, clientRoot);
47
+ try {
48
+ const data = await readFile(local);
49
+ setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
50
+ .send(data);
51
+ } catch {
52
+ fallback(err, 404);
53
+ }
58
54
  });
59
55
  };
@@ -1,20 +1,29 @@
1
- /* eslint-disable import/prefer-default-export, import/no-unresolved, import/first */
1
+ /* eslint-disable import/no-unresolved, import/first */
2
2
  import '@cloudcommerce/api/fetch-polyfill';
3
3
  import { initializeApp } from 'firebase-admin/app';
4
4
 
5
5
  initializeApp();
6
6
 
7
- import { onRequest } from 'firebase-functions/v2/https';
7
+ import functions from 'firebase-functions';
8
8
  import config from '@cloudcommerce/firebase/lib/config';
9
9
  import serveStorefront from './firebase/serve-storefront';
10
10
 
11
- const { httpsFunctionOptions } = config.get();
11
+ const {
12
+ httpsFunctionOptions: {
13
+ region,
14
+ timeoutSeconds,
15
+ memory,
16
+ minInstances,
17
+ },
18
+ } = config.get();
12
19
 
13
- export const ssr = onRequest({
14
- timeoutSeconds: 15,
15
- memory: '256MiB',
16
- minInstances: 1,
17
- ...httpsFunctionOptions,
18
- }, (req, res) => {
19
- serveStorefront(req, res);
20
- });
20
+ // eslint-disable-next-line import/prefer-default-export
21
+ export const ssr = functions
22
+ .region(region)
23
+ .runWith({
24
+ timeoutSeconds: timeoutSeconds || 15,
25
+ memory: memory ? memory.replace('i', '') as '256MB' : '256MB',
26
+ minInstances: minInstances || 1,
27
+ }).https.onRequest((req, res) => {
28
+ serveStorefront(req, res);
29
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "0.0.100",
4
+ "version": "0.0.101",
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.100",
4
+ "version": "0.0.101",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {