cloudcommerce 0.0.74 → 0.0.75
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 +2 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/lib/event-to-tiny.js +115 -0
- package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/index.js +2 -0
- package/packages/apps/tiny-erp/lib/index.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +79 -0
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +84 -0
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js +58 -0
- package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js +7 -0
- package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +92 -0
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +158 -0
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js +46 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js +193 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +199 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js +129 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js +34 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js +39 -0
- package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js.map +1 -0
- package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js +47 -0
- package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js.map +1 -0
- package/packages/apps/tiny-erp/lib/tiny-erp.js +18 -0
- package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -0
- package/packages/apps/tiny-erp/lib/tiny-webhook.js +92 -0
- package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -0
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/lib/firebase/ajv.js +34 -0
- package/packages/modules/lib/firebase/ajv.js.map +1 -0
- package/packages/modules/lib/firebase/call-app-module.js +135 -0
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -0
- package/packages/modules/lib/firebase/checkout.js +1 -0
- package/packages/modules/lib/firebase/checkout.js.map +1 -0
- package/packages/modules/lib/firebase/handle-module.js +169 -0
- package/packages/modules/lib/firebase/handle-module.js.map +1 -0
- package/packages/modules/lib/firebase/proxy-apps.js +1 -0
- package/packages/modules/lib/firebase/proxy-apps.js.map +1 -0
- package/packages/modules/lib/firebase/serve-modules-api.js +58 -0
- package/packages/modules/lib/firebase/serve-modules-api.js.map +1 -0
- package/packages/modules/lib/firebase.js +13 -0
- package/packages/modules/lib/firebase.js.map +1 -0
- package/packages/modules/lib/index.js +25 -0
- package/packages/modules/lib/index.js.map +1 -0
- package/packages/modules/package.json +1 -1
- package/packages/passport/lib/firebase/handle-passport.js +92 -96
- package/packages/passport/lib/firebase/serve-passport-api.js +34 -35
- package/packages/passport/lib/firebase.js +7 -5
- package/packages/passport/lib/index.js +1 -2
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +33 -33
- package/packages/ssr/lib/firebase.js +4 -2
- package/packages/ssr/lib/index.js +2 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/package.json +3 -3
- package/packages/types/package.json +1 -1
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { join as joinPath } from 'path';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
+
|
|
3
4
|
const { STOREFRONT_BASE_DIR } = process.env;
|
|
4
5
|
const baseDir = STOREFRONT_BASE_DIR || process.cwd();
|
|
5
6
|
const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
|
|
7
|
+
|
|
6
8
|
export default (req, res) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
|
|
10
|
+
const setStatusAndCache = (status, defaultCache) => {
|
|
11
|
+
return res.status(status)
|
|
12
|
+
.set('X-SSR-ID', `v1/${Math.random()}`)
|
|
13
|
+
.set('Cache-Control', (typeof global.cache_control === 'function' && global.cache_control(status))
|
|
12
14
|
|| defaultCache);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
};
|
|
16
|
+
const fallback = (err, status = 500) => {
|
|
17
|
+
if (url !== '/fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
|
|
18
|
+
setStatusAndCache(status, 'public, max-age=120')
|
|
19
|
+
.send('<html><head>'
|
|
18
20
|
+ '<meta http-equiv="refresh" content="0; '
|
|
19
21
|
+ `url=/fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
|
|
20
22
|
+ `</head><body>${err.toString()}</body></html>`);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
23
|
+
} else {
|
|
24
|
+
setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
|
|
25
|
+
.send(err.toString());
|
|
26
|
+
}
|
|
27
|
+
};
|
|
27
28
|
/*
|
|
28
29
|
https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
|
|
29
30
|
import { handler as ssrHandler } from '../dist/server/entry.mjs';
|
|
30
31
|
global.ssr_handler = ssrHandler;
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
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
|
+
}
|
|
47
|
+
});
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
// # sourceMappingURL=serve-storefront.js.map
|
|
@@ -4,8 +4,10 @@ import '@cloudcommerce/firebase/lib/init';
|
|
|
4
4
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
6
|
import serveStorefront from './firebase/serve-storefront.js';
|
|
7
|
+
|
|
7
8
|
const { httpsFunctionOptions } = config.get();
|
|
9
|
+
|
|
8
10
|
export const ssr = onRequest(httpsFunctionOptions, (req, res) => {
|
|
9
|
-
|
|
11
|
+
serveStorefront(req, res);
|
|
10
12
|
});
|
|
11
|
-
|
|
13
|
+
// # sourceMappingURL=firebase.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.75",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@astrojs/prefetch": "^0.0.7",
|
|
32
32
|
"@astrojs/sitemap": "^1.0.0",
|
|
33
33
|
"@astrojs/vue": "^1.0.2",
|
|
34
|
-
"@cloudcommerce/api": "workspace
|
|
35
|
-
"@cloudcommerce/config": "workspace
|
|
34
|
+
"@cloudcommerce/api": "workspace:*",
|
|
35
|
+
"@cloudcommerce/config": "workspace:*",
|
|
36
36
|
"@nanostores/vue": "^0.6.0",
|
|
37
37
|
"@picocss/pico": "^1.5.4",
|
|
38
38
|
"astro": "^1.2.2",
|