diff --git a/src/tree/accounts/AccountItem.ts b/src/tree/accounts/AccountItem.ts index 6925569..c651c8b 100644 --- a/src/tree/accounts/AccountItem.ts +++ b/src/tree/accounts/AccountItem.ts @@ -36,7 +36,8 @@ export class AccountItem extends TreeItem implements PiExtTreeItem, Reorderable } async viewProperties(): Promise { - return JSON.stringify(this.account, undefined, 4); + const { id, ...accountWithoutId } = this.account as any; + return JSON.stringify(accountWithoutId, undefined, 4); } getResourceId(): string { diff --git a/src/tree/accounts/AccountsItem.ts b/src/tree/accounts/AccountsItem.ts index 2308ef6..56b8fda 100644 --- a/src/tree/accounts/AccountsItem.ts +++ b/src/tree/accounts/AccountsItem.ts @@ -48,19 +48,19 @@ export class AccountsItem extends TreeItem implements PiExtTreeItem, Reorderer { } const showDeprecated = settingUtils.getShowDeprecatedResources(); - + // Separate deprecated and non-deprecated accounts const nonDeprecatedAccounts = accounts.filter(a => !a.is_deprecated); const deprecatedAccounts = showDeprecated ? accounts.filter(a => a.is_deprecated) : []; const orderedAccounts: Account[] = await this.getOrderedResourceModels(nonDeprecatedAccounts); - + // Cache all accounts (both deprecated and non-deprecated) to preserve deprecated items after reordering const allAccounts = [...orderedAccounts, ...accounts.filter(a => a.is_deprecated)]; ext.resourceCache.set(AccountsItem.generatePiExtAccountsId(this.email), allAccounts); const items: PiExtTreeItem[] = orderedAccounts.map(a => new AccountItem(this, this.email, a)); - + // Add deprecated accounts at the end if (deprecatedAccounts.length > 0) { items.push(...deprecatedAccounts.map(a => new AccountDeprecatedItem(this, this.email, a))); @@ -91,16 +91,18 @@ export class AccountsItem extends TreeItem implements PiExtTreeItem, Reorderer { async viewProperties(): Promise { const accounts: Account[] = await AccountsItem.getAccountsWithCache(this.email); const showDeprecated = settingUtils.getShowDeprecatedResources(); - + // Separate deprecated and non-deprecated accounts const nonDeprecatedAccounts = accounts.filter(a => !a.is_deprecated); const deprecatedAccounts = showDeprecated ? accounts.filter(a => a.is_deprecated) : []; - + // Order non-deprecated accounts and append deprecated ones at the end const orderedAccounts = await this.getOrderedResourceModels(nonDeprecatedAccounts); const result = [...orderedAccounts, ...deprecatedAccounts]; - - return JSON.stringify(result, undefined, 4); + + // Remove id field from all accounts + const resultWithoutId = result.map(({ id, ...account }: any) => account); + return JSON.stringify(resultWithoutId, undefined, 4); } static async getAccounts(email: string): Promise { diff --git a/src/tree/holdings/HoldingItem.ts b/src/tree/holdings/HoldingItem.ts index a8d6c93..fea9c9a 100644 --- a/src/tree/holdings/HoldingItem.ts +++ b/src/tree/holdings/HoldingItem.ts @@ -35,7 +35,8 @@ export class HoldingItem extends TreeItem implements PiExtTreeItem, Reorderable } viewProperties(): string { - return JSON.stringify(this.holding, undefined, 4); + const { id, ...holdingWithoutId } = this.holding as any; + return JSON.stringify(holdingWithoutId, undefined, 4); } getResourceId(): string { diff --git a/src/tree/holdings/HoldingsItem.ts b/src/tree/holdings/HoldingsItem.ts index f407f24..880c4fc 100644 --- a/src/tree/holdings/HoldingsItem.ts +++ b/src/tree/holdings/HoldingsItem.ts @@ -48,19 +48,19 @@ export class HoldingsItem extends TreeItem implements PiExtTreeItem, Reorderer { } const showDeprecated = settingUtils.getShowDeprecatedResources(); - + // Separate deprecated and non-deprecated holdings const nonDeprecatedHoldings = holdings.filter(h => !h.is_deprecated); const deprecatedHoldings = showDeprecated ? holdings.filter(h => h.is_deprecated) : []; const orderedHoldings: Holding[] = await this.getOrderedResourceModels(nonDeprecatedHoldings); - + // Cache all holdings (both deprecated and non-deprecated) to preserve deprecated items after reordering const allHoldings = [...orderedHoldings, ...holdings.filter(h => h.is_deprecated)]; ext.resourceCache.set(HoldingsItem.generatePiExtHoldingsId(this.email), allHoldings); const items: PiExtTreeItem[] = orderedHoldings.map(h => new HoldingItem(this, this.email, h)); - + // Add deprecated holdings at the end if (deprecatedHoldings.length > 0) { items.push(...deprecatedHoldings.map(h => new HoldingDeprecatedItem(this, this.email, h))); @@ -91,16 +91,18 @@ export class HoldingsItem extends TreeItem implements PiExtTreeItem, Reorderer { async viewProperties(): Promise { const holdings: Holding[] = await HoldingsItem.getHoldingsWithCache(this.email); const showDeprecated = settingUtils.getShowDeprecatedResources(); - + // Separate deprecated and non-deprecated holdings const nonDeprecatedHoldings = holdings.filter(h => !h.is_deprecated); const deprecatedHoldings = showDeprecated ? holdings.filter(h => h.is_deprecated) : []; - + // Order non-deprecated holdings and append deprecated ones at the end const orderedHoldings = await this.getOrderedResourceModels(nonDeprecatedHoldings); const result = [...orderedHoldings, ...deprecatedHoldings]; - - return JSON.stringify(result, undefined, 4); + + // Remove id field from all holdings + const resultWithoutId = result.map(({ id, ...holding }: any) => holding); + return JSON.stringify(resultWithoutId, undefined, 4); } static async getHoldings(email: string): Promise {