Skip to content

Commit

Permalink
[TA-2736] Add PackageKeyAndVersionPair interface
Browse files Browse the repository at this point in the history
  • Loading branch information
LaberionAjvazi committed Jan 24, 2024
1 parent 2bc8fb7 commit 457a063
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/api/batch-import-export-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {PackageExportTransport, VariableManifestTransport} from "../interfaces/package-export-transport";
import {
PackageExportTransport,
PackageKeyAndVersionPair,
VariableManifestTransport
} from "../interfaces/package-export-transport";
import {httpClientV2} from "../services/http-client-service.v2";
import {FatalError} from "../util/logger";

Expand Down Expand Up @@ -37,7 +41,7 @@ class BatchImportExportApi {
});
}

public findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: VariableManifestTransport[]): Promise<VariableManifestTransport[]> {
public findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: PackageKeyAndVersionPair[]): Promise<VariableManifestTransport[]> {
return httpClientV2.post("/package-manager/api/core/packages/export/batch/variables-with-assignments", packagesByKeyAndVersion).catch(e => {
throw new FatalError(`Problem exporting package variables: ${e}`);
})
Expand Down
5 changes: 5 additions & 0 deletions src/interfaces/package-export-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export interface VariableManifestTransport {
variables?: VariableExportTransport[];
}

export interface PackageKeyAndVersionPair {
packageKey: string;
version: string;
}

export interface NodeExportTransport {
key: string;
parentNodeKey: string;
Expand Down
3 changes: 2 additions & 1 deletion src/services/package-manager/batch-import-export-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {logger} from "../../util/logger";
import {v4 as uuidv4} from "uuid";
import {
PackageExportTransport,
PackageKeyAndVersionPair,
PackageManifestTransport,
VariableManifestTransport
} from "../../interfaces/package-export-transport";
Expand Down Expand Up @@ -84,7 +85,7 @@ class BatchImportExportService {
}

private getVersionedVariablesForPackagesWithKeys(versionsByPackageKey: Map<string, string[]>): Promise<VariableManifestTransport[]> {
const variableExportRequest: VariableManifestTransport[] = [];
const variableExportRequest: PackageKeyAndVersionPair[] = [];
versionsByPackageKey?.forEach((versions, key) => {
versions?.forEach(version => {
variableExportRequest.push({
Expand Down

0 comments on commit 457a063

Please sign in to comment.