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.
Files changed (74) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/package.json +1 -1
  3. package/packages/api/package.json +1 -1
  4. package/packages/apps/correios/package.json +1 -1
  5. package/packages/apps/custom-shipping/package.json +1 -1
  6. package/packages/apps/discounts/package.json +1 -1
  7. package/packages/apps/frenet/package.json +1 -1
  8. package/packages/apps/tiny-erp/lib/event-to-tiny.js +115 -0
  9. package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -0
  10. package/packages/apps/tiny-erp/lib/index.js +2 -0
  11. package/packages/apps/tiny-erp/lib/index.js.map +1 -0
  12. package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +79 -0
  13. package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -0
  14. package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +84 -0
  15. package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -0
  16. package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js +58 -0
  17. package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js.map +1 -0
  18. package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js +7 -0
  19. package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js.map +1 -0
  20. package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +92 -0
  21. package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -0
  22. package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +158 -0
  23. package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -0
  24. package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js +46 -0
  25. package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js.map +1 -0
  26. package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js +193 -0
  27. package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js.map +1 -0
  28. package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +199 -0
  29. package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -0
  30. package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js +129 -0
  31. package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js.map +1 -0
  32. package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js +34 -0
  33. package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js.map +1 -0
  34. package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js +39 -0
  35. package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js.map +1 -0
  36. package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js +47 -0
  37. package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js.map +1 -0
  38. package/packages/apps/tiny-erp/lib/tiny-erp.js +18 -0
  39. package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -0
  40. package/packages/apps/tiny-erp/lib/tiny-webhook.js +92 -0
  41. package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -0
  42. package/packages/apps/tiny-erp/package.json +1 -1
  43. package/packages/cli/package.json +1 -1
  44. package/packages/config/package.json +1 -1
  45. package/packages/events/package.json +1 -1
  46. package/packages/firebase/package.json +1 -1
  47. package/packages/modules/lib/firebase/ajv.js +34 -0
  48. package/packages/modules/lib/firebase/ajv.js.map +1 -0
  49. package/packages/modules/lib/firebase/call-app-module.js +135 -0
  50. package/packages/modules/lib/firebase/call-app-module.js.map +1 -0
  51. package/packages/modules/lib/firebase/checkout.js +1 -0
  52. package/packages/modules/lib/firebase/checkout.js.map +1 -0
  53. package/packages/modules/lib/firebase/handle-module.js +169 -0
  54. package/packages/modules/lib/firebase/handle-module.js.map +1 -0
  55. package/packages/modules/lib/firebase/proxy-apps.js +1 -0
  56. package/packages/modules/lib/firebase/proxy-apps.js.map +1 -0
  57. package/packages/modules/lib/firebase/serve-modules-api.js +58 -0
  58. package/packages/modules/lib/firebase/serve-modules-api.js.map +1 -0
  59. package/packages/modules/lib/firebase.js +13 -0
  60. package/packages/modules/lib/firebase.js.map +1 -0
  61. package/packages/modules/lib/index.js +25 -0
  62. package/packages/modules/lib/index.js.map +1 -0
  63. package/packages/modules/package.json +1 -1
  64. package/packages/passport/lib/firebase/handle-passport.js +92 -96
  65. package/packages/passport/lib/firebase/serve-passport-api.js +34 -35
  66. package/packages/passport/lib/firebase.js +7 -5
  67. package/packages/passport/lib/index.js +1 -2
  68. package/packages/passport/package.json +1 -1
  69. package/packages/ssr/lib/firebase/serve-storefront.js +33 -33
  70. package/packages/ssr/lib/firebase.js +4 -2
  71. package/packages/ssr/lib/index.js +2 -1
  72. package/packages/ssr/package.json +1 -1
  73. package/packages/storefront/package.json +3 -3
  74. 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
- const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
8
- const setStatusAndCache = (status, defaultCache) => {
9
- return res.status(status)
10
- .set('X-SSR-ID', `v1/${Math.random()}`)
11
- .set('Cache-Control', (typeof global.cache_control === 'function' && global.cache_control(status))
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
- const fallback = (err, status = 500) => {
15
- if (url !== '/fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
16
- setStatusAndCache(status, 'public, max-age=120')
17
- .send('<html><head>'
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
- else {
23
- setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
24
- .send(err.toString());
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
- global.ssr_handler(req, res, async (err) => {
33
- if (err) {
34
- res.set('X-SSR-Error', err.message);
35
- fallback(err);
36
- return;
37
- }
38
- const local = new URL(`.${url}`, clientRoot);
39
- try {
40
- const data = await readFile(local);
41
- setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
42
- .send(data);
43
- }
44
- catch {
45
- fallback(err, 404);
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
- //# sourceMappingURL=serve-storefront.js.map
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
- serveStorefront(req, res);
11
+ serveStorefront(req, res);
10
12
  });
11
- //# sourceMappingURL=firebase.js.map
13
+ // # sourceMappingURL=firebase.js.map
@@ -1,3 +1,4 @@
1
1
  import serveStorefront from './firebase/serve-storefront.js';
2
+
2
3
  export default serveStorefront;
3
- //# sourceMappingURL=index.js.map
4
+ // # sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.0.74",
4
+ "version": "0.0.75",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "0.0.74",
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:0.0.73",
35
- "@cloudcommerce/config": "workspace:0.0.73",
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",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "0.0.74",
4
+ "version": "0.0.75",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {