repository-provider
abstract interface to git repository providers like github bitbucket
Last updated 7 hours ago by arlac77 .
BSD-2-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install repository-provider 
SYNC missed versions from official npm registry.

npm License minified size downloads Build Status semantic-release styled with prettier Commitizen friendly Known Vulnerabilities codecov.io Coverage Status

repository-provider

abstract interface to git repository providers like github, bitbucket, gitlab, gitea, ...

see list of avaliable implementations below

Example

import { Provider } from 'repository-provider';

const provider = new Provider({ token: 'xxx' });

const branch = await provider.branch('myuser/myrepo#myBranch');

for await (const entry of branch.entries('**/*.md')) {
  console.log(entry.name);
}

const readme = await branch.entry('README.md');

console.log(await readme.getString());

Derived Providers

list by repository-provider keyword

API

Table of Contents

Provider

Extends Owner

Base repository provider acts as a source of repositories

Parameters

Properties

equals

Parameters

  • other

Returns boolean true if other provider is the same as the receiver

repositoryGroup

Lookup a repository group

Parameters

Returns Promise<RepositoryGroup>

createRepositoryGroup

Create a new repository group If there is already a group for the given name it will be returend instead

Parameters

Returns Promise<RepositoryGroup>

addRepositoryGroup

Add a new repository group (not provider specific actions are executed)

Parameters

Returns RepositoryGroup

repositoryBases

All possible base urls For github something like

Returns Array<string> common base urls of all repositories

normalizeRepositoryName

Bring a repository name into its normal form by removing any clutter like .git suffix or #branch names

Parameters

Returns string normalized name

parseName

Parses repository name and tries to split it into base, group, repository and branch

Parameters

Returns Object

decomposeName

Parameters

repository

Lookup a repository in the provider and all of its repository groups

Parameters

  • name string of the repository

Returns Promise<Repository>

branch

Lookup a branch in the provider and all of its repository groups

Parameters

Returns Promise<Branch>

repositoryGroups

List groups

Parameters

Returns Iterator<RepositoryGroup> all matching repositories groups of the provider

repositories

List repositories

Parameters

Returns Iterator<Repository> all matching repos of the provider

branches

List branches

Parameters

Returns Iterator<Branch> all matching branches of the provider

tags

List tags

Parameters

Returns Iterator<Branch> all matching tags of the provider

repositoryGroupClass

Returns Class repository group class used by the Provider

hookClass

Returns Class hook class used by the Provider

name

Deliver the provider name

Returns string class name by default

provider

we are our own provider

Returns Provider this

toJSON

list all defined entries from defaultOptions

optionsFromEnvironment

Extract options suitable for the constructor form the given set of environment variables

Parameters

  • env Object taken from process.env

Returns Object undefined if no suitable environment variables have been found

environmentOptions

Known mapping from environment variable to options

Returns Object with the mapping of environmentvaraible names to option keys

areOptionsSufficciant

Check if given options are sufficint to create a provider

Parameters

Returns boolean true if options ar sufficiant to construct a provider

initialize

Creates a new provider for a given set of options

Parameters

  • options Object additional options
  • env Object taken from process.env

Returns Provider newly createdprovider or undefined if optionsa re not sufficient to construct a provider

priority

in case there are several provider able to support a given source which one sould be used ? this defines the order

Branch

Abstract branch

Parameters

Properties

equals

Check for equality

Parameters

Returns boolean true if name and repository are equal

provider

The provider we live in

Returns Provider

owner

Branch owner By default we provide the repository owner

Returns string

fullName

Repository and branch name combined

Returns string 'repo#branch'

fullCondensedName

Repository fullName and branch name combined. But skipping the branch name if it is the default branch

Returns string 'user/repo#branch'

url

Deliver repository and branch url combined

Returns string 'repoUrl#branch'

issuesURL

Url of issue tracking system.

Returns string as provided from the repository

homePageURL

Url of home page.

Returns string as provided from the repository

ref

Git branch ref name

Returns string git ref of the branch

isDefault

Are we the default branch

Returns boolean true if name is the repository default branch

isLocked

forwarded from the repository

isArchived

forwarded from the repository

isDisabled

forwarded from the repository

delete

Delete the branch from the Repository.

Returns Promise<undefined>

commit

Commit entries

Parameters

  • message string commit message
  • updates Array<Entry> content to be commited
  • options Object

Returns Promise

entries

List entries of the branch

Parameters

Returns Entry all matching entries in the branch

asyncIterator

List all entries of the branch

Returns asyncIterator<Entry> all entries in the branch

maybeEntry

get exactly one matching entry by name or undefine if no such entry is found

Parameters

Returns Promise<Entry>

entry

get exactly one matching entry by name (throws if entry is not found)

Parameters

Returns Promise<Entry>

removeEntries

Remove entries form the branch

Parameters

  • entries Iterator<Entry>

refId

Get sha of a ref

Parameters

  • ref string (optional, default this.ref)

Returns string sha of the ref

entryClass

By default we use the providers implementation.

Returns Class as defined in the repository

createPullRequest

Create a pull request

Parameters

Returns Promise<PullRequest>

pullRequestClass

By default we use the repository implementation.

Returns Class as defined in the repository

createBranch

Create a new Branch by cloning a given source branch. Simply calls Repository.createBranch() with the receiver as source branch

Parameters

Returns Promise<Branch> newly created branch (or already present old one with the same name)

toJSON

provide name and all defined defaultOptions

defaultOptions

options

Owner

Collection of repositories

Properties

RepositoryOwnerMixin

Collection of repositories

Parameters

  • parent

Properties

defaultOptions

options

defaultOptions

options

log

default logger

Parameters

  • args ...any

Repository

Abstract repository

Parameters

  • owner Owner
  • name string (#branch) will be removed
  • options Object
    • options.description string? human readable description
    • options.id string? internal id

Properties

description

the description of the repository content.

Returns string

description

the description of the repository group.

Returns string

id

unique id within the provider.

Returns string

id

internal id.

Returns string

id

unique id within the provider.

Returns string

uuid

unique id.

Returns string

uuid

unique id.

Returns string

defaultBranchName

The name of the default branch

Returns string

urls

urls of the repository

Returns Array<string>

homePageURL

the url of home page.

Returns string

issuesURL

the url of issue tracking system.

Returns string

PullRequest

Abstract pull request Repository#addPullRequest

Parameters

Properties

repository

Returns Repository destination repository

provider

Returns Provider

equals

Check for equality

Parameters

Returns boolean true if number and repository are equal

delete

Delete the pull request from the Repository.

Returns Promise

merge

Merge the pull request

Parameters

decline

Decline the pull request

validStates

All valid states

Returns Set<string> valid states

defaultListStates

States to list pull request by default

Returns Set<string> states to list by default

validMergeMethods

All valid merge methods

Returns Set<string> valid merge methods

list

List all pull request for a given repo result will be filtered by source branch, destination branch and states

Parameters

Returns Iterator<PullRequest>

open

Opens a new pull request

Parameters

Returns PullRequest

title

the one line description of the pull request.

Returns string

body

the description of the pull request.

Returns string

state

state of the pull request.

  • OPEN
  • MERGED
  • CLOSED

Returns string

locked

locked state of the pull request.

Returns boolean

merged

merged state of the pull request.

Returns boolean

Hook

Parameters

  • repository
  • name
  • events (optional, default new Set(["*"]))
  • options

Properties

equals

Check for equality

Parameters

Returns boolean true if name and repository are equal

toJSON

provide name, events and all defined defaultOptions

Milestone

Parameters

  • owner
  • options

RepositoryGroup

Extends Owner

Abstract repository collection

Parameters

Properties

repositoryClass

By default we use the providers implementation.

Returns Class as defined in the provider

branchClass

By default we use the providers implementation.

Returns Class as defined in the provider

contentClass

By default we use the providers implementation.

Returns Class as defined in the provider

pullRequestClass

By default we use the providers implementation.

Returns Class as defined in the provider

url

group home.

Returns string

definePropertiesFromOptions

  • **See: Object.definedProperties() **
  • **See: Object.hasOwnProperty() **

Create properties from options and default options Already present properties (direct) are skipped

Parameters

  • object Object target object
  • options Object as passed to object constructor
  • properties Object object properties (optional, default {})

optionJSON

create json based on present options. In other words only produce key value pairs if value is defined.

Parameters

  • object Object
  • initial Object (optional, default {})
  • skip Array<string> keys not to put in the result (optional, default [])

Returns Object initial + defined values

generateBranchName

find a new branch name for a given pattern '' will be replaced by a number 'something/' will get to something/1 something/2 ...

Parameters

mapAttributes

Rename attributes

Parameters

Returns Object keys renamed after mapping

install

With npm do:

npm install repository-provider

license

BSD-2-Clause

Current Tags

  • 20.1.3                                ...           latest (7 hours ago)

271 Versions

  • 20.1.3                                ...           7 hours ago
  • 20.1.2                                ...           a day ago
  • 20.1.1                                ...           2 days ago
  • 20.1.0                                ...           3 days ago
  • 20.0.0                                ...           3 days ago
  • 19.5.0                                ...           3 days ago
  • 19.4.0                                ...           3 days ago
  • 19.3.0                                ...           3 days ago
  • 19.2.2                                ...           4 days ago
  • 19.2.1                                ...           4 days ago
  • 19.2.0                                ...           4 days ago
  • 19.1.1                                ...           5 days ago
  • 19.1.0                                ...           5 days ago
  • 19.0.2                                ...           5 days ago
  • 19.0.1                                ...           5 days ago
  • 19.0.0                                ...           6 days ago
  • 18.5.2                                ...           7 days ago
  • 18.5.1                                ...           7 days ago
  • 18.5.0                                ...           7 days ago
  • 18.4.0                                ...           7 days ago
  • 18.3.0                                ...           21 days ago
  • 18.2.0                                ...           21 days ago
  • 18.1.0                                ...           25 days ago
  • 18.0.0                                ...           a month ago
  • 17.2.0                                ...           a month ago
  • 17.1.1                                ...           a month ago
  • 17.1.0                                ...           a month ago
  • 17.0.2                                ...           a month ago
  • 17.0.1                                ...           a month ago
  • 17.0.0                                ...           a month ago
  • 16.17.6                                ...           a month ago
  • 16.17.5                                ...           a month ago
  • 16.17.4                                ...           a month ago
  • 16.17.3                                ...           a month ago
  • 16.17.2                                ...           a month ago
  • 16.17.1                                ...           a month ago
  • 16.17.0                                ...           a month ago
  • 16.16.2                                ...           a month ago
  • 16.16.1                                ...           a month ago
  • 16.16.0                                ...           2 months ago
  • 16.15.1                                ...           2 months ago
  • 16.15.0                                ...           2 months ago
  • 16.14.1                                ...           2 months ago
  • 16.14.0                                ...           2 months ago
  • 16.13.1                                ...           2 months ago
  • 16.13.0                                ...           2 months ago
  • 16.12.4                                ...           2 months ago
  • 16.12.3                                ...           3 months ago
  • 16.12.2                                ...           3 months ago
  • 16.12.1                                ...           4 months ago
  • 16.12.0                                ...           4 months ago
  • 16.11.3                                ...           4 months ago
  • 16.11.2                                ...           4 months ago
  • 16.11.1                                ...           5 months ago
  • 16.11.0                                ...           5 months ago
  • 16.10.3                                ...           6 months ago
  • 16.10.2                                ...           6 months ago
  • 16.10.1                                ...           6 months ago
  • 16.10.0                                ...           6 months ago
  • 16.9.0                                ...           6 months ago
  • 16.8.6                                ...           7 months ago
  • 16.8.5                                ...           7 months ago
  • 16.8.4                                ...           7 months ago
  • 16.8.3                                ...           7 months ago
  • 16.8.2                                ...           7 months ago
  • 16.8.1                                ...           7 months ago
  • 16.8.0                                ...           7 months ago
  • 16.7.9                                ...           8 months ago
  • 16.7.8                                ...           8 months ago
  • 16.7.7                                ...           8 months ago
  • 16.7.6                                ...           8 months ago
  • 16.7.5                                ...           8 months ago
  • 16.7.4                                ...           8 months ago
  • 16.7.3                                ...           8 months ago
  • 16.7.2                                ...           a year ago
  • 16.7.1                                ...           a year ago
  • 16.7.0                                ...           a year ago
  • 16.6.1                                ...           a year ago
  • 16.6.0                                ...           a year ago
  • 16.5.5                                ...           a year ago
  • 16.5.4                                ...           a year ago
  • 16.5.3                                ...           a year ago
  • 16.5.2                                ...           a year ago
  • 16.5.1                                ...           a year ago
  • 16.5.0                                ...           a year ago
  • 16.4.0                                ...           a year ago
  • 16.3.0                                ...           a year ago
  • 16.2.0                                ...           a year ago
  • 16.1.1                                ...           a year ago
  • 16.1.0                                ...           a year ago
  • 16.0.4                                ...           a year ago
  • 16.0.3                                ...           a year ago
  • 16.0.2                                ...           a year ago
  • 16.0.1                                ...           a year ago
  • 16.0.0                                ...           a year ago
  • 15.1.1                                ...           a year ago
  • 15.1.0                                ...           a year ago
  • 15.0.0                                ...           a year ago
  • 14.8.1                                ...           a year ago
  • 14.8.0                                ...           a year ago
  • 14.7.4                                ...           a year ago
  • 14.7.3                                ...           a year ago
  • 14.7.2                                ...           a year ago
  • 14.7.1                                ...           a year ago
  • 14.7.0                                ...           a year ago
  • 14.6.1                                ...           a year ago
  • 14.6.0                                ...           a year ago
  • 14.5.0                                ...           a year ago
  • 14.4.0                                ...           a year ago
  • 14.3.0                                ...           a year ago
  • 14.2.1                                ...           a year ago
  • 14.2.0                                ...           a year ago
  • 14.1.1                                ...           a year ago
  • 14.1.0                                ...           a year ago
  • 14.0.0                                ...           a year ago
  • 13.2.0                                ...           a year ago
  • 13.1.7                                ...           a year ago
  • 13.1.6                                ...           a year ago
  • 13.1.5                                ...           a year ago
  • 13.1.4                                ...           a year ago
  • 13.1.3                                ...           a year ago
  • 13.1.2                                ...           a year ago
  • 13.1.1                                ...           a year ago
  • 13.1.0                                ...           a year ago
  • 13.0.3                                ...           a year ago
  • 13.0.2                                ...           a year ago
  • 13.0.1                                ...           a year ago
  • 13.0.0                                ...           a year ago
  • 12.7.0                                ...           a year ago
  • 12.6.0                                ...           a year ago
  • 12.5.3                                ...           a year ago
  • 12.5.2                                ...           a year ago
  • 12.5.1                                ...           a year ago
  • 12.5.0                                ...           a year ago
  • 12.4.2                                ...           a year ago
  • 12.4.1                                ...           a year ago
  • 12.4.0                                ...           a year ago
  • 12.3.0                                ...           a year ago
  • 12.2.2                                ...           a year ago
  • 12.2.1                                ...           a year ago
  • 12.2.0                                ...           a year ago
  • 12.1.0                                ...           a year ago
  • 12.0.0                                ...           a year ago
  • 11.0.0                                ...           a year ago
  • 10.0.1                                ...           a year ago
  • 10.0.0                                ...           a year ago
  • 9.0.4                                ...           a year ago
  • 9.0.3                                ...           a year ago
  • 9.0.2                                ...           a year ago
  • 9.0.1                                ...           a year ago
  • 9.0.0                                ...           a year ago
  • 8.6.3                                ...           a year ago
  • 8.6.2                                ...           2 years ago
  • 8.6.1                                ...           2 years ago
  • 8.6.0                                ...           2 years ago
  • 8.5.0                                ...           2 years ago
  • 8.4.1                                ...           2 years ago
  • 8.4.0                                ...           2 years ago
  • 8.3.1                                ...           2 years ago
  • 8.3.0                                ...           2 years ago
  • 8.2.0                                ...           2 years ago
  • 8.1.1                                ...           2 years ago
  • 8.1.0                                ...           2 years ago
  • 8.0.1                                ...           2 years ago
  • 8.0.0                                ...           2 years ago
  • 7.2.2                                ...           2 years ago
  • 7.2.1                                ...           2 years ago
  • 7.2.0                                ...           2 years ago
  • 7.1.0                                ...           2 years ago
  • 7.0.1                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.7.5                                ...           2 years ago
  • 5.7.4                                ...           2 years ago
  • 5.7.3                                ...           2 years ago
  • 5.7.2                                ...           2 years ago
  • 5.7.1                                ...           2 years ago
  • 5.7.0                                ...           2 years ago
  • 5.6.0                                ...           2 years ago
  • 5.5.0                                ...           2 years ago
  • 5.4.0                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.6                                ...           2 years ago
  • 5.2.5                                ...           2 years ago
  • 5.2.4                                ...           2 years ago
  • 5.2.3                                ...           2 years ago
  • 5.2.2                                ...           2 years ago
  • 5.2.1                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.2                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.1                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 3.9.1                                ...           2 years ago
  • 3.9.0                                ...           2 years ago
  • 3.8.3                                ...           2 years ago
  • 3.8.2                                ...           2 years ago
  • 3.8.1                                ...           2 years ago
  • 3.8.0                                ...           2 years ago
  • 3.7.0                                ...           2 years ago
  • 3.6.3                                ...           2 years ago
  • 3.6.2                                ...           2 years ago
  • 3.6.1                                ...           2 years ago
  • 3.6.0                                ...           2 years ago
  • 3.5.1                                ...           2 years ago
  • 3.5.0                                ...           2 years ago
  • 3.4.1                                ...           2 years ago
  • 3.4.0                                ...           2 years ago
  • 3.3.2                                ...           2 years ago
  • 3.3.1                                ...           2 years ago
  • 3.3.0                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.24.1                                ...           2 years ago
  • 2.24.0                                ...           2 years ago
  • 2.23.1                                ...           2 years ago
  • 2.23.0                                ...           2 years ago
  • 2.22.0                                ...           2 years ago
  • 2.21.0                                ...           2 years ago
  • 2.20.1                                ...           2 years ago
  • 2.20.0                                ...           2 years ago
  • 2.19.0                                ...           2 years ago
  • 2.18.0                                ...           2 years ago
  • 2.17.1                                ...           2 years ago
  • 2.17.0                                ...           2 years ago
  • 2.16.0                                ...           2 years ago
  • 2.15.1                                ...           2 years ago
  • 2.15.0                                ...           2 years ago
  • 2.14.0                                ...           2 years ago
  • 2.13.0                                ...           2 years ago
  • 2.12.0                                ...           2 years ago
  • 2.11.1                                ...           2 years ago
  • 2.11.0                                ...           2 years ago
  • 2.10.1                                ...           2 years ago
  • 2.10.0                                ...           2 years ago
  • 2.9.0                                ...           2 years ago
  • 2.8.0                                ...           2 years ago
  • 2.7.0                                ...           2 years ago
  • 2.6.1                                ...           2 years ago
  • 2.6.0                                ...           2 years ago
  • 2.5.2                                ...           2 years ago
  • 2.5.1                                ...           2 years ago
  • 2.5.0                                ...           2 years ago
  • 2.4.3                                ...           2 years ago
  • 2.4.2                                ...           2 years ago
  • 2.4.1                                ...           2 years ago
  • 2.4.0                                ...           2 years ago
  • 2.3.2                                ...           2 years ago
  • 2.3.1                                ...           2 years ago
  • 2.3.0                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 2
This Week 43
This Month 43
Last Day 27
Last Week 243
Last Month 452
Dependencies (2)
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |