@capgo/cli 4.10.12 → 4.10.13
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 +7 -0
- package/dist/index.js +7 -5
- package/package.json +1 -1
- package/src/app/add.ts +2 -2
- package/src/app/delete.ts +1 -0
- package/src/app/set.ts +5 -3
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
|
+
### [4.10.13](https://github.com/Cap-go/CLI/compare/v4.10.12...v4.10.13) (2024-06-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* image upload ([cc42ebf](https://github.com/Cap-go/CLI/commit/cc42ebf8b297119383d5e08a73416515218bdbae))
|
|
11
|
+
|
|
5
12
|
### [4.10.12](https://github.com/Cap-go/CLI/compare/v4.10.11...v4.10.12) (2024-06-07)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.js
CHANGED
|
@@ -110508,7 +110508,7 @@ async function getUserId(options) {
|
|
|
110508
110508
|
// package.json
|
|
110509
110509
|
var package_default = {
|
|
110510
110510
|
name: "@capgo/cli",
|
|
110511
|
-
version: "4.10.
|
|
110511
|
+
version: "4.10.13",
|
|
110512
110512
|
description: "A CLI to upload to capgo servers",
|
|
110513
110513
|
author: "github.com/riderx",
|
|
110514
110514
|
license: "Apache 2.0",
|
|
@@ -111868,7 +111868,7 @@ async function addAppInternal(appId, options, organization, throwErr = true) {
|
|
|
111868
111868
|
program.error("");
|
|
111869
111869
|
}
|
|
111870
111870
|
const supabase = await createSupabaseClient(options.apikey);
|
|
111871
|
-
|
|
111871
|
+
await verifyUser(supabase, options.apikey, ["write", "all"]);
|
|
111872
111872
|
const appExist = await checkAppExists(supabase, appId);
|
|
111873
111873
|
if (appExist) {
|
|
111874
111874
|
f2.error(`App ${appId} already exist`);
|
|
@@ -111914,7 +111914,7 @@ async function addAppInternal(appId, options, organization, throwErr = true) {
|
|
|
111914
111914
|
f2.error(`Could not add app ${formatError(error)}`);
|
|
111915
111915
|
program.error("");
|
|
111916
111916
|
}
|
|
111917
|
-
const { data: signedURLData } = await supabase.storage.from(`images/${
|
|
111917
|
+
const { data: signedURLData } = await supabase.storage.from(`images/org/${organizationUid}/${appId}`).getPublicUrl(fileName);
|
|
111918
111918
|
signedURL = signedURLData?.publicUrl || signedURL;
|
|
111919
111919
|
}
|
|
111920
111920
|
const { error: dbError } = await supabase.from("apps").insert({
|
|
@@ -112926,6 +112926,8 @@ async function setApp(appId, options) {
|
|
|
112926
112926
|
program.error(``);
|
|
112927
112927
|
}
|
|
112928
112928
|
const supabase = await createSupabaseClient(options.apikey);
|
|
112929
|
+
const organization = await getOrganization(supabase, ["admin", "super_admin"]);
|
|
112930
|
+
const organizationUid = organization.gid;
|
|
112929
112931
|
const userId = await verifyUser(supabase, options.apikey, ["write", "all"]);
|
|
112930
112932
|
await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appId, 4 /* admin */);
|
|
112931
112933
|
const { name, icon, retention } = options;
|
|
@@ -112954,14 +112956,14 @@ async function setApp(appId, options) {
|
|
|
112954
112956
|
f2.warn(`Cannot find app icon in any of the following locations: ${icon}, ${newIconPath}`);
|
|
112955
112957
|
}
|
|
112956
112958
|
if (iconBuff && iconType) {
|
|
112957
|
-
const { error } = await supabase.storage.from(`images/${
|
|
112959
|
+
const { error } = await supabase.storage.from(`images/org/${organizationUid}/${appId}`).upload(fileName, iconBuff, {
|
|
112958
112960
|
contentType: iconType
|
|
112959
112961
|
});
|
|
112960
112962
|
if (error) {
|
|
112961
112963
|
f2.error(`Could not set app ${formatError(error)}`);
|
|
112962
112964
|
program.error(``);
|
|
112963
112965
|
}
|
|
112964
|
-
const { data: signedURLData } = await supabase.storage.from(`images/${
|
|
112966
|
+
const { data: signedURLData } = await supabase.storage.from(`images/org/${organizationUid}/${appId}`).getPublicUrl(fileName);
|
|
112965
112967
|
signedURL = signedURLData?.publicUrl || signedURL;
|
|
112966
112968
|
}
|
|
112967
112969
|
const { error: dbError } = await supabase.from("apps").update({
|
package/package.json
CHANGED
package/src/app/add.ts
CHANGED
|
@@ -48,7 +48,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
48
48
|
|
|
49
49
|
const supabase = await createSupabaseClient(options.apikey)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
await verifyUser(supabase, options.apikey, ['write', 'all'])
|
|
52
52
|
|
|
53
53
|
// Check we have app access to this appId
|
|
54
54
|
const appExist = await checkAppExists(supabase, appId)
|
|
@@ -111,7 +111,7 @@ export async function addAppInternal(appId: string, options: Options, organizati
|
|
|
111
111
|
}
|
|
112
112
|
const { data: signedURLData } = await supabase
|
|
113
113
|
.storage
|
|
114
|
-
.from(`images/${
|
|
114
|
+
.from(`images/org/${organizationUid}/${appId}`)
|
|
115
115
|
.getPublicUrl(fileName)
|
|
116
116
|
signedURL = signedURLData?.publicUrl || signedURL
|
|
117
117
|
}
|
package/src/app/delete.ts
CHANGED
|
@@ -73,6 +73,7 @@ export async function deleteApp(appId: string, options: OptionsBase) {
|
|
|
73
73
|
p.log.error('Could not delete app logo')
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
// TODO: make the version delete in R2 too
|
|
76
77
|
const { error: delError } = await supabase
|
|
77
78
|
.storage
|
|
78
79
|
.from(`apps/${appId}/${userId}`)
|
package/src/app/set.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { program } from 'commander'
|
|
|
6
6
|
import * as p from '@clack/prompts'
|
|
7
7
|
import type { Options } from '../api/app'
|
|
8
8
|
import { checkAppExistsAndHasPermissionOrgErr, newIconPath } from '../api/app'
|
|
9
|
-
import { OrganizationPerm, createSupabaseClient, findSavedKey, formatError, getConfig, verifyUser } from '../utils'
|
|
9
|
+
import { OrganizationPerm, createSupabaseClient, findSavedKey, formatError, getConfig, getOrganization, verifyUser } from '../utils'
|
|
10
10
|
|
|
11
11
|
export async function setApp(appId: string, options: Options) {
|
|
12
12
|
p.intro(`Set app`)
|
|
@@ -23,6 +23,8 @@ export async function setApp(appId: string, options: Options) {
|
|
|
23
23
|
program.error(``)
|
|
24
24
|
}
|
|
25
25
|
const supabase = await createSupabaseClient(options.apikey)
|
|
26
|
+
const organization = await getOrganization(supabase, ['admin', 'super_admin'])
|
|
27
|
+
const organizationUid = organization.gid
|
|
26
28
|
|
|
27
29
|
const userId = await verifyUser(supabase, options.apikey, ['write', 'all'])
|
|
28
30
|
// Check we have app access to this appId
|
|
@@ -61,7 +63,7 @@ export async function setApp(appId: string, options: Options) {
|
|
|
61
63
|
}
|
|
62
64
|
if (iconBuff && iconType) {
|
|
63
65
|
const { error } = await supabase.storage
|
|
64
|
-
.from(`images/${
|
|
66
|
+
.from(`images/org/${organizationUid}/${appId}`)
|
|
65
67
|
.upload(fileName, iconBuff, {
|
|
66
68
|
contentType: iconType,
|
|
67
69
|
})
|
|
@@ -71,7 +73,7 @@ export async function setApp(appId: string, options: Options) {
|
|
|
71
73
|
}
|
|
72
74
|
const { data: signedURLData } = await supabase
|
|
73
75
|
.storage
|
|
74
|
-
.from(`images/${
|
|
76
|
+
.from(`images/org/${organizationUid}/${appId}`)
|
|
75
77
|
.getPublicUrl(fileName)
|
|
76
78
|
signedURL = signedURLData?.publicUrl || signedURL
|
|
77
79
|
}
|