New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@octopusdeploy/api-client

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octopusdeploy/api-client - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

7

CHANGELOG.md
# Changelog
## [1.4.0](https://github.com/OctopusDeploy/api-client.ts/compare/v1.3.2...v1.4.0) (2022-07-21)
### Features
* Allow the environment variable for space to be an Id or a Name ([#102](https://github.com/OctopusDeploy/api-client.ts/issues/102)) ([aa67ae5](https://github.com/OctopusDeploy/api-client.ts/commit/aa67ae5eb52de611e8f7e4b5d5e2707ee11ef407))
## [1.3.2](https://github.com/OctopusDeploy/api-client.ts/compare/v1.3.1...v1.3.2) (2022-07-19)

@@ -4,0 +11,0 @@

2

dist/client.d.ts

@@ -41,3 +41,3 @@ import type { GlobalRootLinks, OctopusError, SpaceRootLinks } from "@octopusdeploy/message-contracts";

forSystem(): Client;
switchToSpace(spaceId: string): Promise<void>;
switchToSpace(spaceIdOrName: string): Promise<void>;
switchToSystem(): void;

@@ -44,0 +44,0 @@ get<TResource>(path: string | undefined, args?: RouteArgs): Promise<TResource>;

@@ -154,3 +154,3 @@ "use strict";

case 4:
if (!(configuration.space !== null && configuration.space !== undefined)) return [3 /*break*/, 8];
if (!(configuration.space !== undefined && configuration.space !== "")) return [3 /*break*/, 8];
_a.label = 5;

@@ -218,5 +218,5 @@ case 5:

};
Client.prototype.switchToSpace = function (spaceId) {
Client.prototype.switchToSpace = function (spaceIdOrName) {
return __awaiter(this, void 0, void 0, function () {
var _a;
var spaceList, uppercaseSpaceIdOrName, spaceResources, spaceResource, _a;
return __generator(this, function (_b) {

@@ -228,8 +228,16 @@ switch (_b.label) {

}
this.spaceId = spaceId;
return [4 /*yield*/, this.get(this.rootDocument.Links["Spaces"])];
case 1:
spaceList = _b.sent();
uppercaseSpaceIdOrName = spaceIdOrName.toUpperCase();
spaceResources = spaceList.Items.filter(function (s) { return s.Name.toUpperCase() === uppercaseSpaceIdOrName || s.Id.toUpperCase() === uppercaseSpaceIdOrName; });
if (!(spaceResources.length == 1)) return [3 /*break*/, 3];
spaceResource = spaceResources[0];
this.spaceId = spaceResource.Id;
_a = this;
return [4 /*yield*/, this.get(this.rootDocument.Links["SpaceHome"], { spaceId: this.spaceId })];
case 1:
return [4 /*yield*/, this.get(spaceResource.Links["SpaceHome"])];
case 2:
_a.spaceRootDocument = _b.sent();
return [2 /*return*/];
case 3: throw new Error("Unable to uniquely identify a space using '".concat(spaceIdOrName, "'."));
}

@@ -236,0 +244,0 @@ });

@@ -58,2 +58,58 @@ "use strict";

}); });
test("connects using space id", function () { return __awaiter(void 0, void 0, void 0, function () {
var clientConfiguration, client;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
clientConfiguration = {
apiKey: process.env["OCTOPUS_API_KEY"] || "",
apiUri: process.env["OCTOPUS_HOST"] || "",
space: "Spaces-1",
autoConnect: true
};
return [4 /*yield*/, client_1.Client.create(clientConfiguration)];
case 1:
client = _a.sent();
expect(client.isConnected()).toBe(true);
return [2 /*return*/];
}
});
}); });
test("connects using space name", function () { return __awaiter(void 0, void 0, void 0, function () {
var clientConfiguration, client;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
clientConfiguration = {
apiKey: process.env["OCTOPUS_API_KEY"] || "",
apiUri: process.env["OCTOPUS_HOST"] || "",
space: "Default",
autoConnect: true
};
return [4 /*yield*/, client_1.Client.create(clientConfiguration)];
case 1:
client = _a.sent();
expect(client.isConnected()).toBe(true);
return [2 /*return*/];
}
});
}); });
test("throws with invalid space", function () { return __awaiter(void 0, void 0, void 0, function () {
var clientConfiguration;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
clientConfiguration = {
apiKey: process.env["OCTOPUS_API_KEY"] || "",
apiUri: process.env["OCTOPUS_HOST"] || "",
space: "NonExistent",
autoConnect: true
};
return [4 /*yield*/, expect(client_1.Client.create(clientConfiguration)).rejects.toThrow()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});

@@ -246,5 +246,5 @@ import { SpaceResource } from "@octopusdeploy/message-contracts";

forSystem(): OctopusSystemRepository;
switchToSpace(spaceId: string): Promise<void>;
switchToSpace(spaceIdOrName: string): Promise<void>;
switchToSystem(): void;
}
export {};

@@ -226,4 +226,4 @@ "use strict";

};
Repository.prototype.switchToSpace = function (spaceId) {
return this.client.switchToSpace(spaceId);
Repository.prototype.switchToSpace = function (spaceIdOrName) {
return this.client.switchToSpace(spaceIdOrName);
};

@@ -230,0 +230,0 @@ Repository.prototype.switchToSystem = function () {

@@ -80,3 +80,3 @@ {

"types": "dist/index.d.ts",
"version": "1.3.2",
"version": "1.4.0",
"jest-junit": {

@@ -83,0 +83,0 @@ "outputDirectory": "reports",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc