@cloudcommerce/cli 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.
@@ -1,5 +1,5 @@
1
- @cloudcommerce/cli:build: cache hit, replaying output 9d994ce12db97548
2
- @cloudcommerce/cli:build: 
3
- @cloudcommerce/cli:build: > @cloudcommerce/cli@0.0.51 build /home/leo/code/ecomplus/cloud-commerce/packages/cli
4
- @cloudcommerce/cli:build: > sh ../../scripts/build-lib.sh
5
- @cloudcommerce/cli:build: 
1
+ @cloudcommerce/cli:build: cache hit, replaying output cc4c7d1f235b43da
2
+ @cloudcommerce/cli:build: 
3
+ @cloudcommerce/cli:build: > @cloudcommerce/cli@0.0.52 build /home/leo/code/ecomplus/cloud-commerce/packages/cli
4
+ @cloudcommerce/cli:build: > sh ../../scripts/build-lib.sh
5
+ @cloudcommerce/cli:build: 
@@ -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 {
package/package.json CHANGED
@@ -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"
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/cli#readme",
25
25
  "dependencies": {
26
- "@cloudcommerce/api": "0.0.52",
26
+ "@cloudcommerce/api": "0.0.53",
27
27
  "md5": "^2.3.0",
28
28
  "zx": "^7.0.8"
29
29
  },
@@ -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 {