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

@octopusdeploy/api-client

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.0.0 to 1.1.2

@@ -73,3 +73,2 @@ "use strict";

catch (error) {
console.error(error);
if (error instanceof got_1.RequestError) {

@@ -76,0 +75,0 @@ this.handleError(error);

@@ -46,3 +46,2 @@ export * from "./repositories/accountRepository";

export * from "./repositories/progressionRepository";
export * from "./repositories/projectContextRepository";
export * from "./repositories/projectGroupRepository";

@@ -49,0 +48,0 @@ export * from "./repositories/projectRepository";

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

__exportStar(require("./repositories/progressionRepository"), exports);
__exportStar(require("./repositories/projectContextRepository"), exports);
__exportStar(require("./repositories/projectGroupRepository"), exports);

@@ -61,0 +60,0 @@ __exportStar(require("./repositories/projectRepository"), exports);

@@ -1,3 +0,3 @@

import type { ChannelOclResource, ChannelResource, FeedType, ICommitCommand, ModifyChannelOclCommand, ProjectResource, ResourceCollection, ReleaseResource, VersionRuleTestResponse } from "@octopusdeploy/message-contracts";
import type { ListArgs } from "./basicRepository";
import type { ChannelOclResource, ChannelResource, FeedType, ICommitCommand, ModifyChannelOclCommand, NewChannelResource, ProjectResource, ResourceCollection, ReleaseResource, VersionRuleTestResponse } from "@octopusdeploy/message-contracts";
import type { AllArgs, ListArgs } from "./basicRepository";
import type { Client } from "../client";

@@ -7,2 +7,11 @@ import { ProjectScopedRepository } from "./projectScopedRepository";

import type { RouteArgs } from "../resolver";
declare type ChannelRepositoryListArgs = {
name?: string;
partialName?: string;
skip?: number;
take?: number;
} & RouteArgs;
declare type ChannelRepositoryAllArgs = {
ids?: string[];
} & AllArgs;
export declare type ReleasesListArgs = {

@@ -17,4 +26,5 @@ searchByVersion?: string;

};
export declare class ChannelRepository extends ProjectScopedRepository<ChannelResource, ChannelResource> {
export declare class ChannelRepository extends ProjectScopedRepository<ChannelResource, NewChannelResource, ChannelRepositoryListArgs, ChannelRepositoryAllArgs> {
constructor(projectRepository: ProjectRepository, client: Client);
find(nameOrId: string): Promise<ChannelResource | undefined>;
ruleTest(searchOptions: SearchOptions): Promise<VersionRuleTestResponse>;

@@ -28,1 +38,2 @@ getReleases(channel: ChannelResource, options?: ReleasesListArgs): Promise<ResourceCollection<ReleaseResource>>;

}
export {};

@@ -9,2 +9,15 @@ "use strict";

}
async find(nameOrId) {
if (nameOrId.length === 0)
return;
try {
return await this.get(nameOrId);
}
catch {
}
const channels = await this.list({
partialName: nameOrId,
});
return channels.Items.find((e) => e.Name.localeCompare(nameOrId, undefined, { sensitivity: 'base' }) === 0);
}
ruleTest(searchOptions) {

@@ -11,0 +24,0 @@ return this.client.post(this.client.getLink("VersionRuleTest"), searchOptions);

@@ -1,13 +0,20 @@

import type { DeploymentProcessOclResource, DeploymentProcessResource, ModifyDeploymentProcessCommand, OctopusValidationResponse, ProjectResource, ReleaseResource, ReleaseTemplateResource, VcsBranchResource } from "@octopusdeploy/message-contracts";
import type { ChannelResource, DeploymentProcessOclResource, DeploymentProcessResource, ModifyDeploymentProcessCommand, NewDeploymentProcessResource, OctopusValidationResponse, ReleaseResource, ReleaseTemplateResource } from "@octopusdeploy/message-contracts";
import type { AllArgs } from "./basicRepository";
import type { Client } from "../client";
export declare class DeploymentProcessRepository {
private readonly client;
private readonly project;
private readonly branch;
import { ProjectScopedRepository } from "./projectScopedRepository";
import type ProjectRepository from "./projectRepository";
import type { RouteArgs } from "../resolver";
declare type DeploymentProcessRepositoryListArgs = {
skip?: number;
take?: number;
} & RouteArgs;
declare type DeploymentProcessRepositoryAllArgs = {
ids?: string[];
} & AllArgs;
export declare class DeploymentProcessRepository extends ProjectScopedRepository<DeploymentProcessResource, NewDeploymentProcessResource, DeploymentProcessRepositoryListArgs, DeploymentProcessRepositoryAllArgs> {
readonly resourceLink = "DeploymentProcess";
readonly collectionLink = "DeploymentProcesses";
constructor(client: Client, project: ProjectResource, branch: VcsBranchResource | undefined);
get(): Promise<DeploymentProcessResource>;
constructor(projectRepository: ProjectRepository, client: Client);
getForRelease(release: ReleaseResource): Promise<DeploymentProcessResource>;
getTemplate(deploymentProcess: DeploymentProcessResource, channelId: string, releaseId: string): Promise<ReleaseTemplateResource>;
getTemplate(deploymentProcess: DeploymentProcessResource, channel: ChannelResource, releaseId?: string): Promise<ReleaseTemplateResource>;
modify(deploymentProcess: ModifyDeploymentProcessCommand): Promise<DeploymentProcessResource>;

@@ -18,1 +25,2 @@ validate(deploymentProcess: DeploymentProcessResource): Promise<OctopusValidationResponse>;

}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeploymentProcessRepository = void 0;
class DeploymentProcessRepository {
constructor(client, project, branch) {
this.client = client;
this.project = project;
this.branch = branch;
const projectScopedRepository_1 = require("./projectScopedRepository");
class DeploymentProcessRepository extends projectScopedRepository_1.ProjectScopedRepository {
constructor(projectRepository, client) {
super(projectRepository, "DeploymentProcesses", client);
this.resourceLink = "DeploymentProcess";
this.collectionLink = "DeploymentProcesses";
this.client = client;
}
get() {
if (this.project.IsVersionControlled && this.branch !== undefined) {
return this.client.get(this.branch.Links[this.resourceLink]);
}
return this.client.get(this.project.Links[this.resourceLink]);
}
getForRelease(release) {
return this.client.get(this.client.getLink(this.collectionLink), { id: release.ProjectDeploymentProcessSnapshotId });
}
getTemplate(deploymentProcess, channelId, releaseId) {
return this.client.get(deploymentProcess.Links["Template"], { channel: channelId, releaseId });
getTemplate(deploymentProcess, channel, releaseId) {
return this.client.get(deploymentProcess.Links["Template"], { channel: channel.Id, releaseId });
}

@@ -25,0 +17,0 @@ modify(deploymentProcess) {

@@ -1,2 +0,2 @@

import type { DeploymentResource, TaskState } from "@octopusdeploy/message-contracts";
import type { DeploymentResource, NewDeploymentResource, TaskState } from "@octopusdeploy/message-contracts";
import type { ListArgs } from "./basicRepository";

@@ -12,5 +12,5 @@ import { BasicRepository } from "./basicRepository";

} & ListArgs;
export declare class DeploymentRepository extends BasicRepository<DeploymentResource, DeploymentResource, DeploymentListArgs> {
export declare class DeploymentRepository extends BasicRepository<DeploymentResource, NewDeploymentResource, DeploymentListArgs> {
constructor(client: Client);
}
export {};
import type { ProjectResource, VcsBranchResource } from "@octopusdeploy/message-contracts";
import { BranchesRepository } from "./branchesRepository";
import type { Client } from "../client";
import { DeploymentProcessRepository } from "./deploymentProcessRepository";
import { DeploymentSettingsRepository } from "./deploymentSettingsRepository";

@@ -9,3 +8,2 @@ import { VcsRunbookRepository } from "./vcsRunbookRepository";

Branches: BranchesRepository;
DeploymentProcesses: DeploymentProcessRepository;
DeploymentSettings: DeploymentSettingsRepository;

@@ -12,0 +10,0 @@ Runbooks: VcsRunbookRepository;

@@ -5,3 +5,2 @@ "use strict";

const branchesRepository_1 = require("./branchesRepository");
const deploymentProcessRepository_1 = require("./deploymentProcessRepository");
const deploymentSettingsRepository_1 = require("./deploymentSettingsRepository");

@@ -11,3 +10,2 @@ const vcsRunbookRepository_1 = require("./vcsRunbookRepository");

constructor(client, project, branch) {
this.DeploymentProcesses = new deploymentProcessRepository_1.DeploymentProcessRepository(client, project, branch);
this.DeploymentSettings = new deploymentSettingsRepository_1.DeploymentSettingsRepository(client, project, branch);

@@ -14,0 +12,0 @@ this.Runbooks = new vcsRunbookRepository_1.VcsRunbookRepository(client, project, branch);

@@ -1,2 +0,2 @@

import type { ChannelResource, DeploymentPreviewResource, DeploymentPreviewRequests, DeploymentPromotionTarget, DeploymentResource, DeploymentTemplateResource, LifecycleProgressionResource, LifecycleResource, ResourceCollection, ReleaseResource } from "@octopusdeploy/message-contracts";
import type { ChannelResource, DeploymentPreviewResource, DeploymentPreviewRequests, DeploymentPromotionTarget, DeploymentResource, DeploymentTemplateResource, LifecycleProgressionResource, LifecycleResource, NewReleaseResource, ResourceCollection, ReleaseResource } from "@octopusdeploy/message-contracts";
import type { ListArgs } from "./basicRepository";

@@ -6,3 +6,3 @@ import { BasicRepository } from "./basicRepository";

declare type GetDeploymentArgs = ListArgs;
export declare class ReleasesRepository extends BasicRepository<ReleaseResource, ReleaseResource> {
export declare class ReleasesRepository extends BasicRepository<ReleaseResource, NewReleaseResource> {
constructor(client: Client);

@@ -9,0 +9,0 @@ getDeployments(release: ReleaseResource, options?: GetDeploymentArgs): Promise<ResourceCollection<DeploymentResource>>;

@@ -76,2 +76,3 @@ import { AuthenticationRepository } from "./repositories/authenticationRepository";

import { WorkerShellsRepository } from "./repositories/workerShellsRepository";
import { DeploymentProcessRepository } from ".";
interface ServerInformation {

@@ -126,2 +127,3 @@ version: string;

defects: DefectRepository;
deploymentProcesses: DeploymentProcessRepository;
deployments: DeploymentRepository;

@@ -176,2 +178,3 @@ environments: EnvironmentRepository;

defects: DefectRepository;
deploymentProcesses: DeploymentProcessRepository;
deployments: DeploymentRepository;

@@ -178,0 +181,0 @@ dynamicExtensions: DynamicExtensionRepository;

@@ -80,2 +80,3 @@ "use strict";

const workerShellsRepository_1 = require("./repositories/workerShellsRepository");
const _1 = require(".");
class Repository {

@@ -133,2 +134,3 @@ constructor(client) {

this.channels = new channelRepository_1.ChannelRepository(this.projects, client);
this.deploymentProcesses = new _1.DeploymentProcessRepository(this.projects, client);
this.projectTriggers = new projectTriggerRepository_1.ProjectTriggerRepository(client);

@@ -135,0 +137,0 @@ this.proxies = new proxyRepository_1.ProxyRepository(client);

@@ -7,2 +7,3 @@ {

"dependencies": {
"@octopusdeploy/message-contracts": "^1.1.1",
"@types/semver": "^7.3.9",

@@ -14,3 +15,2 @@ "consola": "^2.15.3",

"devDependencies": {
"@octopusdeploy/message-contracts": "^1.0.0",
"@octopusdeploy/runtime-inputs": "^0.16.0",

@@ -23,6 +23,9 @@ "@tsconfig/node16": "^1.0.2",

"prop-types": "^15.7.2",
"semver": "^7.3.5",
"typescript": "^4.4.4",
"urijs": "^1.19.7"
},
"files": ["dist/**/*"],
"files": [
"dist/**/*"
],
"homepage": "https://github.com/OctopusDeploy/api-client.ts#readme",

@@ -41,3 +44,3 @@ "keywords": [

"type": "git",
"url": "git+https://github.com/OctopusDeploy/api-client.ts.git"
"url": "https://github.com/OctopusDeploy/api-client.ts.git"
},

@@ -47,6 +50,9 @@ "scripts": {

"docs": "typedoc --options typedoc.json --readme none",
"prepublish": "tsc --p tsconfig.json"
"lint": "tslint -p tsconfig.json",
"prepare": "npm run build",
"preversion": "npm run lint",
"test": "jest --config jestconfig.json"
},
"types": "dist/index.d.ts",
"version": "1.0.0"
}
"version": "1.1.2"
}

@@ -8,20 +8,25 @@ # api-client.ts

```typescript
import { Client, ClientConfiguration, Repository } from '@octopusdeploy/api-client';
import type { ProjectResource } from '@octopusdeploy/message-contracts';
import { Client, ClientConfiguration, Repository } from '@octopusdeploy/api-client';
const configuration: ClientConfiguration = {
// agent: new Agent({ proxy: { hostname: '127.0.0.1', port: 8866 } }), // proxy agent if required
apiKey: '<api-key>',
apiUri: '<api-uri>',
space: '<space-id>',
apiKey: 'api-key',
apiUri: 'api-uri',
space: 'space-id',
};
const client = await Client.NewClient(configuration);
const client = await Client.create(configuration);
if (client === undefined) {
throw new Error('client could not be constructed');
}
const repository = new Repository(client);
const projectNameOrId: string = '<project-name-or-ID>';
const projectNameOrId: string = 'project-name-or-ID';
console.log(`Getting project, "${projectNameOrId}"...`);
let project: ProjectResource | undefined;
try {
console.log(`Getting project, "${projectNameOrId}"...`);
project = await repository.projects.find(projectNameOrId);

@@ -28,0 +33,0 @@ } catch (error) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet