cloudcommerce 0.0.59 → 0.0.62

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 (136) hide show
  1. package/.eslintrc.cjs +2 -0
  2. package/CHANGELOG.md +42 -0
  3. package/action.yml +6 -1
  4. package/package.json +9 -8
  5. package/packages/api/lib/api.d.ts +5036 -0
  6. package/packages/api/lib/{index.js → api.js} +16 -10
  7. package/packages/api/lib/api.js.map +1 -0
  8. package/packages/api/lib/types.d.ts +1 -0
  9. package/packages/api/package.json +3 -3
  10. package/packages/api/src/{index.ts → api.ts} +21 -17
  11. package/packages/api/src/types.ts +1 -0
  12. package/packages/api/tests/index.test.ts +2 -2
  13. package/packages/apps/discounts/lib/discounts.js +1 -1
  14. package/packages/apps/discounts/lib/discounts.js.map +1 -1
  15. package/packages/apps/discounts/{lib-cjs/apply-discount.cjs → lib-mjs/apply-discount.mjs} +7 -9
  16. package/packages/apps/discounts/{lib-cjs/helpers.cjs → lib-mjs/helpers.mjs} +2 -2
  17. package/packages/apps/discounts/package.json +1 -1
  18. package/packages/apps/discounts/src/discounts.ts +1 -1
  19. package/packages/apps/tiny-erp/lib/event-to-tiny.js +117 -0
  20. package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -0
  21. package/packages/apps/tiny-erp/lib/index.js +2 -0
  22. package/packages/apps/tiny-erp/lib/index.js.map +1 -0
  23. package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +79 -0
  24. package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -0
  25. package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +81 -0
  26. package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -0
  27. package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js +58 -0
  28. package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js.map +1 -0
  29. package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js +7 -0
  30. package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js.map +1 -0
  31. package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +92 -0
  32. package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -0
  33. package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +158 -0
  34. package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -0
  35. package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js +46 -0
  36. package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js.map +1 -0
  37. package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js +193 -0
  38. package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js.map +1 -0
  39. package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +199 -0
  40. package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -0
  41. package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js +129 -0
  42. package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js.map +1 -0
  43. package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js +34 -0
  44. package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js.map +1 -0
  45. package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js +39 -0
  46. package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js.map +1 -0
  47. package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js +47 -0
  48. package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js.map +1 -0
  49. package/packages/apps/tiny-erp/lib/tiny-erp.js +17 -0
  50. package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -0
  51. package/packages/apps/tiny-erp/lib/tiny-webhook.js +92 -0
  52. package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -0
  53. package/packages/apps/tiny-erp/package.json +13 -6
  54. package/packages/apps/tiny-erp/src/event-to-tiny.ts +136 -0
  55. package/packages/apps/tiny-erp/src/index.ts +1 -0
  56. package/packages/apps/tiny-erp/src/integration/after-tiny-queue.ts +80 -0
  57. package/packages/apps/tiny-erp/src/integration/export-order-to-tiny.ts +86 -0
  58. package/packages/apps/tiny-erp/src/integration/export-product-to-tiny.ts +60 -0
  59. package/packages/apps/tiny-erp/src/integration/helpers/format-tiny-date.ts +6 -0
  60. package/packages/apps/tiny-erp/src/integration/import-order-from-tiny.ts +102 -0
  61. package/packages/apps/tiny-erp/src/integration/import-product-from-tiny.ts +162 -0
  62. package/packages/apps/tiny-erp/src/integration/parsers/order-from-tiny.ts +49 -0
  63. package/packages/apps/tiny-erp/src/integration/parsers/order-to-tiny.ts +205 -0
  64. package/packages/apps/tiny-erp/src/integration/parsers/product-from-tiny.ts +215 -0
  65. package/packages/apps/tiny-erp/src/integration/parsers/product-to-tiny.ts +138 -0
  66. package/packages/apps/tiny-erp/src/integration/parsers/status-from-tiny.ts +35 -0
  67. package/packages/apps/tiny-erp/src/integration/parsers/status-to-tiny.ts +42 -0
  68. package/packages/apps/tiny-erp/src/integration/post-tiny-erp.ts +52 -0
  69. package/packages/apps/tiny-erp/src/tiny-erp.ts +23 -0
  70. package/packages/apps/tiny-erp/src/tiny-webhook.ts +100 -0
  71. package/packages/cli/package.json +1 -1
  72. package/packages/events/lib/firebase.js +2 -26
  73. package/packages/events/lib/firebase.js.map +1 -1
  74. package/packages/events/lib/index.js +1 -1
  75. package/packages/events/lib/index.js.map +1 -1
  76. package/packages/events/package.json +1 -1
  77. package/packages/events/src/firebase.ts +2 -28
  78. package/packages/events/src/index.ts +1 -1
  79. package/packages/firebase/lib/config.d.ts +2 -2
  80. package/packages/firebase/lib/config.js +7 -5
  81. package/packages/firebase/lib/config.js.map +1 -1
  82. package/packages/firebase/lib/const.d.ts +2 -0
  83. package/packages/firebase/lib/const.js +6 -0
  84. package/packages/firebase/lib/const.js.map +1 -0
  85. package/packages/firebase/lib/handlers/check-store-events.js +50 -27
  86. package/packages/firebase/lib/handlers/check-store-events.js.map +1 -1
  87. package/packages/firebase/lib/helpers/pubsub.d.ts +9 -0
  88. package/packages/firebase/lib/helpers/pubsub.js +32 -0
  89. package/packages/firebase/lib/helpers/pubsub.js.map +1 -0
  90. package/packages/firebase/lib/helpers/update-app-data.d.ts +9 -0
  91. package/packages/firebase/lib/helpers/update-app-data.js +45 -0
  92. package/packages/firebase/lib/helpers/update-app-data.js.map +1 -0
  93. package/packages/firebase/lib/index.d.ts +1 -2
  94. package/packages/firebase/lib/index.js +1 -6
  95. package/packages/firebase/lib/index.js.map +1 -1
  96. package/packages/firebase/lib/init.d.ts +2 -0
  97. package/packages/firebase/lib/init.js +9 -0
  98. package/packages/firebase/lib/init.js.map +1 -0
  99. package/packages/firebase/package.json +5 -2
  100. package/packages/firebase/src/config.ts +9 -6
  101. package/packages/firebase/src/const.ts +5 -0
  102. package/packages/firebase/src/handlers/check-store-events.ts +56 -33
  103. package/packages/firebase/src/helpers/pubsub.ts +52 -0
  104. package/packages/firebase/src/helpers/update-app-data.ts +49 -0
  105. package/packages/firebase/src/index.ts +1 -7
  106. package/packages/firebase/src/init.ts +9 -0
  107. package/packages/modules/lib/firebase/handle-module.js +4 -5
  108. package/packages/modules/lib/firebase/handle-module.js.map +1 -1
  109. package/packages/modules/lib/firebase/serve-modules-api.js +2 -2
  110. package/packages/modules/lib/firebase/serve-modules-api.js.map +1 -1
  111. package/packages/modules/lib/firebase.js +2 -7
  112. package/packages/modules/lib/firebase.js.map +1 -1
  113. package/packages/modules/package.json +1 -1
  114. package/packages/modules/src/firebase/handle-module.ts +2 -5
  115. package/packages/modules/src/firebase/serve-modules-api.ts +2 -6
  116. package/packages/modules/src/firebase.ts +2 -7
  117. package/packages/passport/lib/firebase/handle-passport.js +12 -10
  118. package/packages/passport/lib/firebase/handle-passport.js.map +1 -1
  119. package/packages/passport/lib/firebase/serve-passport-api.js +2 -2
  120. package/packages/passport/lib/firebase/serve-passport-api.js.map +1 -1
  121. package/packages/passport/lib/firebase.js +2 -7
  122. package/packages/passport/lib/firebase.js.map +1 -1
  123. package/packages/passport/package.json +1 -1
  124. package/packages/passport/src/firebase/handle-passport.ts +10 -19
  125. package/packages/passport/src/firebase/serve-passport-api.ts +0 -2
  126. package/packages/passport/src/firebase.ts +1 -7
  127. package/packages/ssr/lib/firebase.js +1 -4
  128. package/packages/ssr/lib/firebase.js.map +1 -1
  129. package/packages/ssr/package.json +1 -1
  130. package/packages/ssr/src/firebase.ts +1 -4
  131. package/packages/storefront/package.json +4 -4
  132. package/packages/types/index.ts +18 -3
  133. package/packages/types/package.json +1 -1
  134. package/packages/api/lib/index.d.ts +0 -9974
  135. package/packages/api/lib/index.js.map +0 -1
  136. package/packages/apps/tiny-erp/src/firebase.ts +0 -0
package/.eslintrc.cjs CHANGED
@@ -22,6 +22,8 @@ module.exports = {
22
22
  '**/types/*.d.ts',
23
23
  ],
24
24
  rules: {
25
+ 'prefer-template': 'warn',
26
+ 'no-nested-ternary': 'warn',
25
27
  'no-await-in-loop': 'warn',
26
28
  'no-shadow': 'warn',
27
29
  'no-param-reassign': 'warn',
package/CHANGELOG.md CHANGED
@@ -2,6 +2,48 @@
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.62](https://github.com/ecomplus/cloud-commerce/compare/v0.0.61...v0.0.62) (2022-08-31)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Properly import `firebase-admin/firestore` ([5754bb0](https://github.com/ecomplus/cloud-commerce/commit/5754bb0f7378106b15f9f683597f78afeb92ba74))
11
+
12
+ ### [0.0.61](https://github.com/ecomplus/cloud-commerce/compare/v0.0.60...v0.0.61) (2022-08-31)
13
+
14
+
15
+ ### Features
16
+
17
+ * Add optional `tiny-erp-token` input to GH Action to improve Tiny webhooks performance ([0444f65](https://github.com/ecomplus/cloud-commerce/commit/0444f655b0a358979b14cee8ab85f0f018d08df3))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **tiny-erp:** Properly set and reuse `process.env.TINY_ERP_TOKEN` on webhooks ([4aee43a](https://github.com/ecomplus/cloud-commerce/commit/4aee43a3f067eb430c0c183eada27dca1b331fd3))
23
+
24
+ ### [0.0.60](https://github.com/ecomplus/cloud-commerce/compare/v0.0.59...v0.0.60) (2022-08-30)
25
+
26
+
27
+ ### Features
28
+
29
+ * **api:** Check auth from env vars `ECOM_AUTHENTICATION_ID` and `ECOM_API_KEY` ([0dce4e0](https://github.com/ecomplus/cloud-commerce/commit/0dce4e051e178d192e09130279071d6bd5c60e84))
30
+ * **events:** Get app data on events list (scheduled) and send on PubSub message [[#29](https://github.com/ecomplus/cloud-commerce/issues/29)] ([bcdeec1](https://github.com/ecomplus/cloud-commerce/commit/bcdeec173fc3b2ad747014d7e948c907b66f9030))
31
+ * **events:** Read API doc of respective event and send on Pub/Sub message [[#29](https://github.com/ecomplus/cloud-commerce/issues/29)] ([f8702e9](https://github.com/ecomplus/cloud-commerce/commit/f8702e9ac04c586420804da59afbe33c056be5f7))
32
+ * **firebase:** Create helpers to setup Pub/Sub on publish functions ([8e240c6](https://github.com/ecomplus/cloud-commerce/commit/8e240c6d9cb83ad2de4c2a980f9e8478ee32f842))
33
+ * Helper method to update app data on Store API and publish internal PubSub message [[#29](https://github.com/ecomplus/cloud-commerce/issues/29)] ([be7ab47](https://github.com/ecomplus/cloud-commerce/commit/be7ab47b8f5882a0a00da635dd9d2c034ee4ff6e))
34
+ * **tiny-erp:** Refactor Tiny ERP handlers from https://github.com/ecomplus/app-tiny-erp ([6530533](https://github.com/ecomplus/cloud-commerce/commit/6530533643dc055a4aad07e77dc1877aa75eaaf2))
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * **api:** Fix typedefs for authenticated methods (may use env vars) ([f4c51aa](https://github.com/ecomplus/cloud-commerce/commit/f4c51aa9bbcfd805cadfda106913c4b77e69ab28))
40
+ * **api:** Fix typedefs for authenticated methods with optional config ([c1938ae](https://github.com/ecomplus/cloud-commerce/commit/c1938aed2009f39165cd05c693dab949d3362d69))
41
+ * **deps:** Update all non-major dependencies ([#45](https://github.com/ecomplus/cloud-commerce/issues/45)) ([5fef410](https://github.com/ecomplus/cloud-commerce/commit/5fef410e87c8e8a30b728372b0745b623b4a00b9))
42
+ * **events:** Must read full `apiDoc` even on new document events ([b8cbac6](https://github.com/ecomplus/cloud-commerce/commit/b8cbac6258bd16ac867f23cd536817ffdb4ef807))
43
+ * **events:** Prevent handling multiple API events for same ID&topic at once ([f7e3ba3](https://github.com/ecomplus/cloud-commerce/commit/f7e3ba3177ec392b5d1103ca13a3b01046ad3f14))
44
+ * **events:** Remove generic `onNewOrder` function [[#29](https://github.com/ecomplus/cloud-commerce/issues/29)] ([3da6a26](https://github.com/ecomplus/cloud-commerce/commit/3da6a2649e3e92a561464a7d9ab68d7651be6344))
45
+ * **firebase:** Ensure fetch polyfill and Firebase app initialization before any function logic ([09f8ad2](https://github.com/ecomplus/cloud-commerce/commit/09f8ad21d4af03325f297485a0ceb6ecf3ec1126))
46
+
5
47
  ### [0.0.59](https://github.com/ecomplus/cloud-commerce/compare/v0.0.58...v0.0.59) (2022-08-24)
6
48
 
7
49
 
package/action.yml CHANGED
@@ -15,7 +15,9 @@ inputs:
15
15
  description: 'E-Com Plus store API key'
16
16
  required: true
17
17
  ecom-store-id:
18
- description: 'Store ID if defined in config.json'
18
+ description: 'Store ID if not defined in config.json'
19
+ tiny-erp-token:
20
+ description: 'App: Tiny ERP API token'
19
21
 
20
22
  outputs: {}
21
23
 
@@ -26,6 +28,7 @@ runs:
26
28
  with:
27
29
  node-version: 16
28
30
  cache: 'npm'
31
+ cache-dependency-path: '**/package-lock.json'
29
32
 
30
33
  - if: github.event_name == 'push'
31
34
  shell: bash
@@ -52,6 +55,7 @@ runs:
52
55
  ECOM_AUTHENTICATION_ID: ${{ inputs.ecom-authentication-id }}
53
56
  ECOM_API_KEY: ${{ inputs.ecom-api-key }}
54
57
  ECOM_STORE_ID: ${{ inputs.ecom-store-id }}
58
+ TINY_ERP_TOKEN: ${{ inputs.tiny-erp-token }}
55
59
  run: |
56
60
  export GAC_FILENAME=".gac-$RANDOM.json"
57
61
  echo $FIREBASE_SERVICE_ACCOUNT > $GAC_FILENAME
@@ -59,6 +63,7 @@ runs:
59
63
  ECOM_API_KEY=$ECOM_API_KEY
60
64
  ECOM_STORE_ID=$ECOM_STORE_ID
61
65
  GITHUB_TOKEN=$GITHUB_TOKEN
66
+ TINY_ERP_TOKEN=$TINY_ERP_TOKEN
62
67
  " > functions/.env
63
68
  GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy
64
69
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "0.0.59",
4
+ "version": "0.0.62",
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>",
@@ -16,22 +16,23 @@
16
16
  }
17
17
  },
18
18
  "devDependencies": {
19
- "@commitlint/cli": "^17.0.3",
20
- "@commitlint/config-conventional": "^17.0.3",
19
+ "@commitlint/cli": "^17.1.1",
20
+ "@commitlint/config-conventional": "^17.1.0",
21
21
  "@commitlint/rules": "^17.0.0",
22
22
  "@types/node": "^18.0.5",
23
- "@typescript-eslint/eslint-plugin": "^5.33.1",
24
- "@typescript-eslint/parser": "^5.33.1",
23
+ "@typescript-eslint/eslint-plugin": "^5.35.1",
24
+ "@typescript-eslint/parser": "^5.35.1",
25
25
  "esbuild": "^0.15.5",
26
- "eslint": "^8.22.0",
26
+ "eslint": "^8.23.0",
27
27
  "eslint-config-airbnb-base": "^15.0.0",
28
28
  "eslint-plugin-import": "^2.26.0",
29
- "eslint-plugin-vue": "^9.3.0",
29
+ "eslint-plugin-vue": "^9.4.0",
30
30
  "husky": "^8.0.1",
31
31
  "node-fetch": "^3.2.10",
32
32
  "standard-version": "^9.5.0",
33
+ "ts-node": "^10.9.1",
33
34
  "turbo": "^1.4.3",
34
- "typescript": "^4.7.4",
35
+ "typescript": "^4.8.2",
35
36
  "vite": "^3.0.9",
36
37
  "vitest": "^0.22.1",
37
38
  "zx": "^7.0.8"