Skip to content

Commit c3ac535

Browse files
authored
fix: change feature sort order (#365)
1 parent 6bbb5a1 commit c3ac535

2 files changed

Lines changed: 17 additions & 30 deletions

File tree

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bucketco/cli",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"packageManager": "yarn@4.1.1",
55
"description": "CLI for Bucket service",
66
"main": "./dist/index.js",

packages/cli/services/features.ts

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,13 @@ export async function listFeatures(
3131
appId: string,
3232
options: ListOptions = {},
3333
): Promise<Feature[]> {
34-
const response = await authRequest<FeaturesResponse>(
35-
`/apps/${appId}/features`,
36-
{
37-
params: {
38-
sortBy: "name",
39-
sortOrder: "desc",
40-
includeRemoteConfigs: options.includeRemoteConfigs ? "true" : "false",
41-
},
34+
return authRequest<FeaturesResponse>(`/apps/${appId}/features`, {
35+
params: {
36+
sortBy: "key",
37+
sortOrder: "asc",
38+
includeRemoteConfigs: options.includeRemoteConfigs ? "true" : "false",
4239
},
43-
);
44-
45-
return response.data.map(({ name, key, remoteConfigs }) => ({
46-
name,
47-
key,
48-
remoteConfigs,
49-
}));
40+
}).then(({ data }) => data);
5041
}
5142

5243
type FeatureResponse = {
@@ -58,19 +49,15 @@ export async function createFeature(
5849
name: string,
5950
key: string,
6051
): Promise<Feature> {
61-
const response = await authRequest<FeatureResponse>(
62-
`/apps/${appId}/features`,
63-
{
64-
method: "POST",
65-
headers: {
66-
"Content-Type": "application/json",
67-
},
68-
body: JSON.stringify({
69-
name,
70-
key,
71-
source: "event",
72-
}),
52+
return authRequest<FeatureResponse>(`/apps/${appId}/features`, {
53+
method: "POST",
54+
headers: {
55+
"Content-Type": "application/json",
7356
},
74-
);
75-
return response.feature;
57+
body: JSON.stringify({
58+
name,
59+
key,
60+
source: "event",
61+
}),
62+
}).then(({ feature }) => feature);
7663
}

0 commit comments

Comments
 (0)