From b11f280a528c92f4214a9cc175a883f57b25ce10 Mon Sep 17 00:00:00 2001 From: Erik Hughes Date: Mon, 10 Mar 2025 16:10:21 +0100 Subject: [PATCH] fix: change feature sort order --- packages/cli/package.json | 2 +- packages/cli/services/features.ts | 45 +++++++++++-------------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index d4564d67..bda762ce 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@bucketco/cli", - "version": "0.1.3", + "version": "0.1.4", "packageManager": "yarn@4.1.1", "description": "CLI for Bucket service", "main": "./dist/index.js", diff --git a/packages/cli/services/features.ts b/packages/cli/services/features.ts index 2ce2f715..5014c717 100644 --- a/packages/cli/services/features.ts +++ b/packages/cli/services/features.ts @@ -31,22 +31,13 @@ export async function listFeatures( appId: string, options: ListOptions = {}, ): Promise { - const response = await authRequest( - `/apps/${appId}/features`, - { - params: { - sortBy: "name", - sortOrder: "desc", - includeRemoteConfigs: options.includeRemoteConfigs ? "true" : "false", - }, + return authRequest(`/apps/${appId}/features`, { + params: { + sortBy: "key", + sortOrder: "asc", + includeRemoteConfigs: options.includeRemoteConfigs ? "true" : "false", }, - ); - - return response.data.map(({ name, key, remoteConfigs }) => ({ - name, - key, - remoteConfigs, - })); + }).then(({ data }) => data); } type FeatureResponse = { @@ -58,19 +49,15 @@ export async function createFeature( name: string, key: string, ): Promise { - const response = await authRequest( - `/apps/${appId}/features`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - name, - key, - source: "event", - }), + return authRequest(`/apps/${appId}/features`, { + method: "POST", + headers: { + "Content-Type": "application/json", }, - ); - return response.feature; + body: JSON.stringify({ + name, + key, + source: "event", + }), + }).then(({ feature }) => feature); }