Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
repository-provider
Advanced tools
abstract interface to git repository providers like github, bitbucket and gitlab
abstract interface to git repository providers like github, bitbucket, gitlab, gitea, ...
see list of avaliable implementations below
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());
list by repository-provider keyword
Extends OwnedObject
Type: Object
type
stringwritable
booleanprivate
boolean? should the value be showndepends
string? name of an attribute we depend ondescription
stringdefault
any? the default valueset
Function? set the valueget
Function? get the value can be used to calculate default valuesenv
(string | Array<string>)? environment variable use to provide the valueCreate properties from options and default options. Already present properties (direct) are skipped. The attribute list from the class will be applied to the options and merged with the given set of properties.
class aClass {
static get attributes() {
return { with_default: { default: 77 }};
}
}
definePropertiesFromOptions(new aClass());
// equivalent to
Object.definedProperties(new aClass(),{ with_default: { value: 77 }})
object
Object target objectoptions
Object as passed to object constructor (optional, default {}
)properties
Object object properties (optional, default {}
)attributes
Object (optional, default object.constructor.attributes||[]
)Get default values.
attributes
Objectobject
Returns Object filled with default values
Set Object attribute. The name may be a property path like 'a.b.c'.
Deliver attribute value. The name may be a property path like 'a.b.c'.
Returns any value associated with the given property name
Create json based on present options. In other words only produce key value pairs if value is defined.
object
Objectinitial
Object (optional, default {}
)attributes
Object to operator on (optional, default object.constructor.attributes
)Returns Object initial + defined values
Rename attributes. Filters out null, undefined and empty strings.
mapAttributes({a:1},{a:"a'"}) // {"a'": 1}
Returns Object keys renamed after mapping
Same as mapAttributes but with the inverse mapping. Filters out null, undefined and empty strings
Returns Object keys renamed after mapping
Save object attributes in the backing store.
Returns string fullName
Beautified name use for human displaying only.
Returns string human readable name
Complete name in the hierachy.
Returns string
Complete name in the hierachy.
Returns string
Short human readable identifier with provider and branch.
Returns string
By default cannot be written to.
Returns boolean false
Check for equality
other
BaseObjectReturns boolean true if other is present
The provider we live in.
Returns BaseProvider
API as given by the owner.
Returns string url
Forwarded to the owner.
args
...anyForwarded to the owner.
args
...anyForwarded to the owner.
args
...anyForwarded to the owner.
args
...anyBy default we use the owners implementation.
Returns Function as defined in the owner
By default we use the owners implementation.
Returns Function as defined in the owner
By default we use the owners implementation.
Returns Function as defined in the owner
By default we use the owners implementation.
Returns Function as defined in the owner
By default we use the owners implementation.
Returns Function as defined in the owner
By default we use the owners implementation.
Returns Function as defined in the owner
Returns string type we represent
Returns string name of the collection holding us in the owner
Attributes definitions
Returns Object writable attributes
Map attributes between external and internal representation.
Returns Object
The description of the repository content.
Returns string
Unique id within the provider.
Returns string
Unique id.
Returns string
Type: Object
Extends BaseObject
messageDestination
MessageDestinationother
Returns boolean true if other provider is the same as the receiver
All supported base urls. For github something like:
Returns Array<string> common base urls of all repositories
Bring a repository name into its normal form by removing any clutter. like .git suffix or #branch names.
Returns string normalized name
Bring a group name into its normal form by removing any clutter. like .git suffix or #branch names.
Returns string normalized name
Are repository names case sensitive. Overwrite and return false if you want to have case insensitive repository lookup
Returns boolean true
Are repositroy group names case sensitive. Overwrite and return false if you want to have case insensitive group lookup
Returns boolean true
Does the provider support the base name.
base
string to be checkedReturns boolean true if base is supported or base is undefined
Parses repository name and tries to split it into base, group, repository and branch.
name
stringfocus
string where lies the focus if only one path component is given (optional, default "repository"
)Returns Object with separated attributes
Create a repository.
Returns Promise<Repository>
List provider objects of a given type.
type
string name of the method to deliver typed iterator projects,milestones,hooks,repositories,branches,tagspatterns
(string | Array<string>) group / repository filterList projects.
Returns AsyncIterator<Project> all matching projects of the provider
List milestones.
Returns AsyncIterator<Milestone> all matching milestones of the provider
List repositories.
Returns AsyncIterator<Repository> all matching repos of the provider
List branches.
Returns AsyncIterator<Branch> all matching branches of the provider
List tags.
Returns AsyncIterator<Tag> all matching tags of the provider
List hooks.
Returns AsyncIterator<Hook> all matching hooks of the provider
List pull requests.
Returns AsyncIterator<PullRequest> all matching pullRequests of the provider
Deliver the provider name.
Returns string class name by default
We are our own provider.
Returns BaseProvider this
Returns any url of the provider.
List all defined entries from attributes. return {object}
Returns Function repository group class used by the Provider
Returns Function hook class used by the Provider
Returns Function repository class used by the Provider
Returns Function branch class used by the Provider
Returns Function branch class used by the Provider
Returns Function entry class used by the Provider
Returns Function pull request class used by the Provider
Returns string identifier for environment options
Extract options suitable for the constructor form the given set of environment variables. Object with the detected key value pairs is delivered.
env
Object as from process.envinstanceIdentifier
string part of variable name. (optional, default this.instanceIdentifier
)Returns Object undefined if no suitable environment variables have been found
Check if given options are sufficient to create a provider.
options
ObjectReturns boolean true if options ar sufficient to construct a provider
Creates a new provider for a given set of options.
options
Object additional options (optional, default {}
)
options.instanceIdentifier
string? name of the provider instanceenv
Object taken from process.env
Returns BaseProvider newly created provider or undefined if options are not sufficient to construct a provider
In case there are several providers able to support a given source which one sould be used ? this defines the order
Name of the provider.
To forward info/warn and error messages to
Extends Ref
Abstract branch.
owner
RepositoryOwnername
string (optional, default owner.defaultBranchName
)options
Objectrepository
Repositoryprovider
Providername
stringDeliver repository and branch url combined.
Returns string 'repoUrl#branch'
Returns string heades
Returns any true if not isArchived and isDisabled and isLocked
Are we the default branch.
Returns boolean true if name matches the repository default branch
Delete the branch from the Repository.
Returns Promise<any>
Commit entries.
message
string commit messageupdates
Array<ContentEntry> content to be commitedoptions
ObjectReturns Promise<CommitResult>
Add commits into a pull request.
options
Object
options.pullRequestBranch
(Branch | string) to commit intooptions.dry
boolean do not create a branch and do not commit only create dummy PRoptions.skipWithoutCommits
boolean do not create a PR if no commits are givenoptions.bodyFromCommitMessages
boolean generate body from commit messagesoptions.body
string? body of the PRReturns Promise<PullRequest>
Remove entries form the branch.
entries
AsyncIterator<ContentEntry>Create a pull request.
Returns Promise<PullRequest>
Create a new Branch by cloning a given source branch. Simply calls Repository.createBranch() with the receiver as source branch
Returns Promise<Branch> newly created branch (or already present old one with the same name)
Type: Object
ref
stringrepository
repository
Repositorymessage
stringsha
stringauthor
Usercommitter
UserExtends OwnedObject
Repository hook.
Extends OwnedObject
Extends OwnedObject
Extends BaseProvider
Provider supporting serveral repository groups.
Lookup a repository in the provider and all of its repository groups.
name
string of the repositoryReturns Promise<Repository>
Lookup a branch.
name
string of the branchLookup a repository group.
name
string of the groupReturns Promise<RepositoryGroup>
List groups.
Returns AsyncIterator<RepositoryGroup> all matching repositories groups of the provider
Create a new repository group. If there is already a group for the given name it will be returend instead
Returns Promise<RepositoryGroup>
Add a new repository group (not provider specific actions are executed).
Returns RepositoryGroup
Extends BaseObject
Object with a name.
name
stringCheck for equality.
other
NamedObjectReturns boolean true if names are equal and have the same provider
Returns string name with owner name
Provided name and all defined attributes.
options
The url of home page.
Returns string
Extends NamedObject
Named Object registering itself in the owner.
owner
name
options
additionalProperties
Check for equality.
other
OwnedObjectReturns boolean true if receiver and owner are equal
Method name to be called to register one instance in the owner. sample: Application => _addApplication
Returns string
Extends OwnedObject
Extends OwnedObject
Abstract pull request. Repository#addPullRequest
name
stringsource
Branchdestination
Branchtitle
string?state
string?merged
boolean?locked
boolean?url
stringName of the PR together with the repository.
Returns string PR full name
URL of the pull request.
Returns string url
Returns Repository destination repository
Returns BaseProvider
Check for equality
other
PullRequestReturns boolean true if number and repository are equal
Delete the pull request from the Repository.
Returns Promise
Merge the pull request.
method
string (optional, default "MERGE"
)Decline the pull request.
Returns AsyncIterator<Review>
Short human readable identifier with provider and branch.
Returns string
All valid states
Returns Set<string> valid states
States to list pull request by default
Returns Set<string> states to list by default
All valid merge methods
Returns Set<string> valid merge methods
List all pull request for a given repo. Result will be filtered by source branch, destination branch and states
repository
Repository
filter
Object
Returns AsyncIterator<PullRequest>
Open a pull request
The one line description of the pull request.
Returns string
The description of the pull request.
Returns string
state of the pull request.
Returns string
Locked state of the pull request.
Returns boolean
Merged state of the pull request.
Returns boolean
Draft state of the pull request.
Returns boolean
Type: Object
name
stringExtends OwnedObject
Base for Branch and Tag
Full ref path.
Returns string git ref of the Ref
Get sha of our ref.
Returns Promise<string> sha of the ref
List entries of the branch.
Returns AsyncIterator<ContentEntry> all matching entries in the branch
List all entries of the branch.
Returns AsyncIterator<ContentEntry> all entries in the branch
Get exactly one matching entry by name or undefine if no such entry is found.
name
stringReturns Promise<ContentEntry>
Get exactly one matching entry by name (throws if entry is not found).
name
stringReturns Promise<ContentEntry>
Ref owner. By default we provide the repository owner
Returns string
Repository and branch name combined.
Returns string 'repo#branch'
Repository fullName and branch name combined. But skipping the branch name if it is the default branch.
Returns string 'user/repo#branch'
Same as identifier.
Returns string
Url of issue tracking system.
Returns string as provided from the repository
Url of home page.
Returns string as provided from the repository
Forwarded from the repository
Forwarded from the repository
Forwarded from the repository
Returns any false
options
Can the ref be modified.
Returns string
Extends RepositoryOwner(OwnedObject)
Abstract repository collection.
provider
BaseProvider
name
string of the group
options
Object
provider
BaseProvidername
stringMap attributes between external and internal representation.
Type of the repository group either User or Organization.
Returns string
api url
URL of the repository
Returns string
Avatar.
Returns string
Mixin to define a class able to handle a collection of repositories.
base
Class to be extendetExtends OwnedObject
Abstract repository
owner
Ownername
string without (#branch)description
string? from options.descriptionid
string? from options.idbranches
Map<string, Branch>tags
Map<string, Tag>pullRequests
Map<string, PullRequest>milestones
Map<string, Milestone>Full repository name within the provider.
Returns string full repo name
Name of the repo as used in the URL.
Returns string
Lookup entries form the head of the default branch. Branch#entry
name
Returns Promise<ContentEntry>
List entries of the default branch.
Returns AsyncIterator<ContentEntry> all matching entries in the branch
Get exactly one matching entry by name or undefined if no such entry is found.
name
stringReturns Promise<ContentEntry>
List commits of the default branch.
options
ObjectReturns AsyncIterator<Commit> all matching commits in the repository
The url used for cloning the repo.
Returns string
The url of issue tracking system.
Returns string
The url of home page.
Returns string
By default we are not archived.
Returns boolean false
By default we are not locked.
Returns boolean false
By default we are not disabled.
Returns boolean false
By default we are not a template.
Returns boolean false
Delete the repository from the Provider. Provider#deleteRepository
Returns Promise<any>
Lookup the default branch.
Returns Promise<Branch> branch named after defaultBranchName
Lookup branch by name.
name
stringReturns boolean true if there is at least one branch
patterns
Returns AsyncIterator<Branch> of all branches
Create a new Branch by cloning a given source branch.
Returns Promise<Branch> newly created branch (or already present old one with the same name)
Add a new Branch. Internal branch creation does not call repository.initialize()
Returns Branch newly created branch
Delete a Branch.
name
string of the branchReturns Promise<any>
Get a Tag.
name
stringReturns AsyncIterator<Tag> of all tags
Add a new Tag. Internal tag creation does not call repository.initialize()
Returns Tag newly created tag
Create a pull request (or deliver an already present for the given name).
Returns Promise<PullRequest>
Add a pull request.
Returns PullRequest
Deliver all PullRequests.
Returns AsyncIterator<PullRequest> of all pull requests
The @{link PullRequest} for a given name.
name
stringReturns Promise<PullRequest>
Delete a PullRequest.
name
stringReturns Promise<any>
Add a new Hook.
Returns Hook newly created hook
Add a new Hook.
hook
HookList hooks.
Returns AsyncIterator<Hook> all hooks of the repository
Get a Hook.
Returns Promise<Hook> for the given id
Get type of the repository.
Returns string 'git'
Get sha of a ref.
ref
stringReturns Promise<string> sha of the ref
options
The name of the default branch
Returns string
The url of issue tracking system.
Returns string
Extends OwnedObject
Extends RepositoryOwner(BaseProvider)
Provider holding a single set of repositories (no repository groups).
Lookup a repository in the provider and all of its repository groups.
name
string of the repositoryReturns Promise<Repository>
Get a single group.
name
stringReturns Promise<RepositoryGroup> deliver the one and only present group
List groups.
Returns AsyncIterator<RepositoryGroup> always deliver the one and only present group
Extends Ref
Tag refs
Returns string tags
Convert scalar into an array. The value undefined will be represented as an empty array.
value
(any | Array)Returns Array value encapsulated in an array
Strip repository base name away. A URL auth component will be removed to.
name
stringrepositoryBases
Array<string> all possible baseswhenFound
Function? to be called with the found base nameReturns string name without base
Loops over names and executes stripBaseName.
names
(string | Array<string>)repositoryBases
Array<string> all possible baseswhenFound
Function? to be called with the found base nameReturns (Array<string> | undefined) names without base
Find a new branch name for a given pattern. '' will be replaced by a number. 'something/' will get to something/1 something/2 ...
repository
Repositorypattern
stringWith npm do:
npm install repository-provider
BSD-2-Clause
FAQs
abstract interface to git repository providers like github, bitbucket and gitlab
The npm package repository-provider receives a total of 627 weekly downloads. As such, repository-provider popularity was classified as not popular.
We found that repository-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.