cloudcommerce 0.0.52 → 0.0.53

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,13 @@
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.53](https://github.com/ecomplus/cloud-commerce/compare/v0.0.52...v0.0.53) (2022-08-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cli:** Fix GCloud IAM roles with temporary `serviceUsageAdmin` for first deploy ([3481f0c](https://github.com/ecomplus/cloud-commerce/commit/3481f0c2dc47fd5b25c321bf28d12ed1b6e5ffde))
11
+
5
12
  ### [0.0.52](https://github.com/ecomplus/cloud-commerce/compare/v0.0.51...v0.0.52) (2022-08-18)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
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.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "lib/discounts.js",
7
7
  "repository": {
@@ -30,6 +30,7 @@ const siginGcloudAndSetIAM = async (projectId, pwd) => {
30
30
  'roles/iam.serviceAccountUser',
31
31
  'roles/run.viewer',
32
32
  'roles/serviceusage.apiKeysViewer',
33
+ 'roles/serviceusage.serviceUsageAdmin',
33
34
  ];
34
35
  const serviceAccount = await checkServiceAccountExists(projectId);
35
36
  if (!serviceAccount) {
@@ -53,6 +54,14 @@ const siginGcloudAndSetIAM = async (projectId, pwd) => {
53
54
  ],
54
55
  role,
55
56
  };
57
+ if (role === 'roles/serviceusage.serviceUsageAdmin') {
58
+ const roleExpiration = Date.now() + 1000 * 60 * 60 * 12;
59
+ newBinding.condition = {
60
+ expression: `request.time < timestamp("${new Date(roleExpiration).toISOString()}")`,
61
+ title: 'Enable APIs on first deploy',
62
+ description: null,
63
+ };
64
+ }
56
65
  bindings.push(newBinding);
57
66
  mustUpdatePolicy = true;
58
67
  } else {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -32,6 +32,7 @@ const siginGcloudAndSetIAM = async (projectId: string, pwd: string) => {
32
32
  'roles/iam.serviceAccountUser',
33
33
  'roles/run.viewer',
34
34
  'roles/serviceusage.apiKeysViewer',
35
+ 'roles/serviceusage.serviceUsageAdmin',
35
36
  ];
36
37
  const serviceAccount = await checkServiceAccountExists(projectId);
37
38
  if (!serviceAccount) {
@@ -47,17 +48,23 @@ const siginGcloudAndSetIAM = async (projectId: string, pwd: string) => {
47
48
 
48
49
  let mustUpdatePolicy = false;
49
50
  roles.forEach((role) => {
50
- const roleFound = bindings.find(
51
- (binding: { [key: string]: string | string[] }) => binding.role === role,
52
- );
51
+ const roleFound = bindings.find((binding) => binding.role === role);
53
52
  const memberServiceAccount = `serviceAccount:${getAccountEmail(projectId)}`;
54
53
  if (!roleFound) {
55
- const newBinding = {
54
+ const newBinding: { [key: string]: any } = {
56
55
  members: [
57
56
  memberServiceAccount,
58
57
  ],
59
58
  role,
60
59
  };
60
+ if (role === 'roles/serviceusage.serviceUsageAdmin') {
61
+ const roleExpiration = Date.now() + 1000 * 60 * 60 * 12;
62
+ newBinding.condition = {
63
+ expression: `request.time < timestamp("${new Date(roleExpiration).toISOString()}")`,
64
+ title: 'Enable APIs on first deploy',
65
+ description: null,
66
+ };
67
+ }
61
68
  bindings.push(newBinding);
62
69
  mustUpdatePolicy = true;
63
70
  } else {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.0.52",
4
+ "version": "0.0.53",
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.52",
4
+ "version": "0.0.53",
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.52",
4
+ "version": "0.0.53",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {