cloud-function-cli 1.1.0 → 1.1.2
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/dist/cli/get.js +12 -4
- package/dist/cli/list.js +12 -4
- package/package.json +1 -1
package/dist/cli/get.js
CHANGED
|
@@ -17,8 +17,16 @@ const get = async (name, options) => {
|
|
|
17
17
|
const apiRootDir = path_1.default.join(process.cwd(), 'api');
|
|
18
18
|
if (parts.length === 1) {
|
|
19
19
|
try {
|
|
20
|
-
const res = await apiClient_1.apiClient.get(`/api/management/list/${group}`, {
|
|
21
|
-
|
|
20
|
+
const res = await apiClient_1.apiClient.get(`/api/management/list/${encodeURIComponent(group)}`, {
|
|
21
|
+
environment,
|
|
22
|
+
page: 1,
|
|
23
|
+
limit: 2000
|
|
24
|
+
});
|
|
25
|
+
const apis = Array.isArray(res.data)
|
|
26
|
+
? res.data
|
|
27
|
+
: Array.isArray(res.data?.items)
|
|
28
|
+
? res.data.items
|
|
29
|
+
: [];
|
|
22
30
|
if (apis.length === 0) {
|
|
23
31
|
logger_1.logger.warn(`No APIs found in group ${group}`);
|
|
24
32
|
return;
|
|
@@ -29,7 +37,7 @@ const get = async (name, options) => {
|
|
|
29
37
|
logger_1.logger.success('All APIs retrieved successfully!');
|
|
30
38
|
}
|
|
31
39
|
catch (error) {
|
|
32
|
-
logger_1.logger.error(`Failed to list APIs: ${error.response?.data?.error || error.message}`);
|
|
40
|
+
logger_1.logger.error(`Failed to list APIs in group ${group}: ${error.response?.data?.error || error.message}`);
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
43
|
else {
|
|
@@ -40,7 +48,7 @@ const get = async (name, options) => {
|
|
|
40
48
|
exports.get = get;
|
|
41
49
|
const getFile = async (apiRootDir, group, api, environment) => {
|
|
42
50
|
try {
|
|
43
|
-
const res = await apiClient_1.apiClient.get(`/api/management/get/${group}/${api}`, { environment });
|
|
51
|
+
const res = await apiClient_1.apiClient.get(`/api/management/get/${encodeURIComponent(group)}/${encodeURIComponent(api)}`, { environment });
|
|
44
52
|
const groupDir = path_1.default.join(apiRootDir, group);
|
|
45
53
|
if (!fs_1.default.existsSync(groupDir)) {
|
|
46
54
|
fs_1.default.mkdirSync(groupDir, { recursive: true });
|
package/dist/cli/list.js
CHANGED
|
@@ -23,8 +23,12 @@ const list = async (group, options) => {
|
|
|
23
23
|
}
|
|
24
24
|
if (!group) {
|
|
25
25
|
try {
|
|
26
|
-
const res = await apiClient_1.apiClient.get('/api/management/groups', { environment });
|
|
27
|
-
const groups = Array.isArray(res.data)
|
|
26
|
+
const res = await apiClient_1.apiClient.get('/api/management/groups', { environment, page: 1, limit: 2000 });
|
|
27
|
+
const groups = Array.isArray(res.data)
|
|
28
|
+
? res.data
|
|
29
|
+
: Array.isArray(res.data?.items)
|
|
30
|
+
? res.data.items
|
|
31
|
+
: [];
|
|
28
32
|
if (groups.length === 0) {
|
|
29
33
|
logger_1.logger.warn(`No groups found (${environment})`);
|
|
30
34
|
return;
|
|
@@ -46,8 +50,12 @@ const list = async (group, options) => {
|
|
|
46
50
|
return;
|
|
47
51
|
}
|
|
48
52
|
try {
|
|
49
|
-
const res = await apiClient_1.apiClient.get(`/api/management/list/${encodeURIComponent(normalizedGroup)}`, { environment });
|
|
50
|
-
const apis = Array.isArray(res.data)
|
|
53
|
+
const res = await apiClient_1.apiClient.get(`/api/management/list/${encodeURIComponent(normalizedGroup)}`, { environment, page: 1, limit: 2000 });
|
|
54
|
+
const apis = Array.isArray(res.data)
|
|
55
|
+
? res.data
|
|
56
|
+
: Array.isArray(res.data?.items)
|
|
57
|
+
? res.data.items
|
|
58
|
+
: [];
|
|
51
59
|
const apiNames = apis.map((x) => x?.api).filter(Boolean);
|
|
52
60
|
if (apiNames.length === 0) {
|
|
53
61
|
logger_1.logger.warn(`No APIs found in group ${normalizedGroup} (${environment})`);
|