npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hapic/harbor

v3.0.1

Published

A harbor http api client.

Readme

@hapic/harbor 🚢

npm version main Known Vulnerabilities Conventional Commits

This client provides an easy way to interact with various domain endpoints such as repositories, projects, and more. The Harbor Image Registry is an open-source platform that enables users to store, manage, and distribute container images. The client offers a variety of abstractions to simplify interaction with the platform and speed up the development process. Whether you are an experienced developer or new to the world of container images, this API client is a powerful tool to get the most out of the platform.

Table of Contents

Documentation

To read the docs, visit https://hapic.tada5hi.net

Installation

npm install @hapic/harbor --save

Usage

Config

To create a configuration for the HarborClient, a configuration must be specified, like described in the following:

import { HarborClient } from '@hapic/harbor';

const client = new HarborClient({
    request: {
        credentials: 'include',
    },
    conenctionOptions: {
        host: 'https://example.com/api/v2.0/',
        user: 'admin',
        password: 'start123'
    },
    // connectionString: 'admin:start123@https://example.com/api/v2.0/'
});

Project

GetMany

Retrieves a set of projects in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.project.getMany({
    query: {
        // page_size: 10
    }
});
console.log(data);
// { meta: { total: 1 }, data: [ {...}, ... ] }

GetOne

Retrieves details for a specific project in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// get project by id
let data = await harbor.project.getOne(1);

// get project by name
data = await harbor.project.getOne('name', true);
console.log(data);
// { name: 'new-name', ... }

Create

Creates a new project in Harbor with the given name and metadata.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.project.create({
    project_name: 'project-z',
});
console.log(data);
// { name: 'project-z', ... }

Delete

Deletes a specific project in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// delete project by id
await harbor.project.delete(1);

// delete project by name
await harbor.project.delete('name', true);

Update

Updates the metadata for a specific project in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

await harbor.project.update(1, {
    project_name: 'new-name'
});

Project Repository

GetMany

Retrieves a set of project repositories in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const response = await harbor.projectRepository.getMany({
    projectName: 'project-name',
    query: {
        // page_size: 10
    }
});

console.log(response);
// { meta: {total: 1}, data: [{ name: 'xxx', ... }, ... ] }

GetOne

Retrieves a specific project repository in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// find repository by options
let data = await harbor.projectRepository.getOne({
    projectName: 'project-name',
    repositoryName: 'repository-name'
});

// find repository by name
data = await harbor.projectRepository.getOne(
    'project-name/repository-name'
);

console.log(data);
// { name: 'xxx', ... }

FindOne

Finds a specific project repository in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// find repository by options
let data = await harbor.projectRepository.findOne({
    projectName: 'project-name',
    repositoryName: 'repository-name'
});

// find repository by name
data = await harbor.projectRepository.findOne(
    'project-name/repository-name'
);

console.log(data);
// { name: 'xxx', ... } | undefined

Update

Updates a specific registry repository in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.projectRepository.update({
    projectName: 'foo',
    repositoryName: 'bar',
    data: {
        name: 'xxx',
        // ...
    }
});
console.log(data);
// { name: 'xxx', ... }

Delete

Deletes a specific project repository in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// delete repository by options
await harbor.projectRepository.delete({
    projectName: 'project-name',
    repositoryName: 'repository-name'
});

// delete repository by name
await harbor.projectRepository.delete(
    'project-name/repository-name'
);

Project Repository Artifact

GetMany

Retrieves a list of all project repository artifacts in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.projectRepositoryArtifact.getMany({
    projectName: 'project-z',
    repositoryName: 'repository-x',
    query: {
        // with_tag: true,
        // with_label: true
    }
});
console.log(data);
// [ {...}, ... ]

Delete

Deletes a specific project repository artifact in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

await harbor.projectRepositoryArtifact.delete({
    projectName: 'project-z',
    repositoryName: 'repository-x',
    // tagOrDigest: 'latest'
});

Copy

Copy a specific project repository artifact to another location.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

await harbor.projectRepositoryArtifact.copy(
    {
        projectName: 'destination-project',
        repositoryName: 'destination-repository',
    },
    {
        projectName: 'source-project',
        repositoryName: 'source-repository',
    }
);

Project Repository Artifact Label

Create

Assigns an existing label object to a project repository artifact in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// assign a label object to a specific project & repo
const data = await harbor.projectRepositoryArtifactLabel.create({
    labelId: 1,
    projectName: 'project-name',
    repositoryName: 'repository-name',
    // tagOrDigest: 'latest',
});

Delete

Delete an assigned label of a project repository artifact in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// delete an assigned label of a specific project & repo
const data = await harbor.projectRepositoryArtifactLabel.delete({
    labelId: 1,
    projectName: 'project-name',
    repositoryName: 'repository-name',
    // tagOrDigest: 'latest'
});

Project Webhook Policy

Create

Creates a project webhook policy in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

await harbor.projectWebhookPolicy.create({
    name: 'webhook',
    // ...
}, {
    projectIdOrName: 1,
    // isProjectName: false
});

GetMany

Retrieves a set of project webhook policies in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const response = await harbor.projectWebhookPolicy.getMany({
    projectIdOrName: 1,
    // isProjectName: false,
    query: {
        q: {
            name: 'webhook'
        }
    }
});
console.log(response);
// { meta: { total: 1 }, data: { { ... } ] }

GetOne

Retrieves a specific project webhook policy in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.projectWebhookPolicy.getOne({
    projectIdOrName: 1,
    // isProjectName: false,
    id: 1
});
console.log(data);
// { name: 'xxx', ... }

Delete

Deletes a specific project webhook policy in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

await harbor.projectWebhookPolicy.delete({
    projectIdOrName: 1,
    // isProjectName: false,
    id: 1
});

Robot

Create

Creates a robot in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.robots.create({
    name: 'system',
});
console.log(data);
// { name: 'xxx', ... }

GetMany

Retrieves a set of robots in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const response = await harbor.robots.getMany({
    query: {
        q: {
            name: 'robot'
        }
    }
});
console.log(response);
// { meta: { total: 1 }, data: { { ... } ] }

GetOne

Retrieves a specific robot in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.robots.getOne(1);
console.log(data);
// { name: 'xxx', ... }

Update

Updates a specific robot in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

const data = await harbor.robots.update(1, {
    name: 'system',
    description: 'foo',
    disable: true
});
console.log(data);
// { name: 'xxx', ... }

UpdateSecret

Sets a specific robot secret in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

// optional provie a secret as second argument.
const data = await harbor.robots.updateSecret(1);
console.log(data);
// { secret: 'xxx', ... }

Delete

Deletes a robot in Harbor.

import { HarborClient } from '@hapic/harbor';

const harbor = new HarborClient({
    // ...
});

await harbor.robots.delete(1);

License

Made with 💚

Published under MIT License.