repository-provider
Advanced tools
Comparing version 2.10.1 to 2.11.0
@@ -72,3 +72,3 @@ 'use strict'; | ||
* @see {@link Repository#deleteBranch} | ||
* @return {Promise} | ||
* @return {Promise<undefined>} | ||
*/ | ||
@@ -249,2 +249,11 @@ async delete() { | ||
/** | ||
* Delete the repository from the {@link Provider}. | ||
* @see {@link Provider#deleteRepository} | ||
* @return {Promise<undefined>} | ||
*/ | ||
async delete() { | ||
return this.provider.deleteRepository(this.name); | ||
} | ||
async createPullRequest() { | ||
@@ -405,3 +414,22 @@ return notImplementedError(); | ||
async _initialize() { | ||
if (this._isInitialized) { | ||
return; | ||
} | ||
await this.initialize(); | ||
this._isInitialized = true; | ||
} | ||
/** | ||
* Provider initialization | ||
* will be called once before content addressing method is called | ||
* @see {@link Provider#repository} | ||
* @see {@link Provider#branch} | ||
* @see {@link Provider#createRepository} | ||
* @see {@link Provider#deleteRepository} | ||
* @return {Promise<undefined>} | ||
*/ | ||
async initialize() {} | ||
/** | ||
* @return {Class} repository class used by the Provider | ||
@@ -429,5 +457,8 @@ */ | ||
* Create a new repository | ||
* @param {string} name | ||
* @param {Object} options | ||
* @return {Promise<Repository>} | ||
*/ | ||
async createRepository(name, options) { | ||
await this._initialize(); | ||
const repository = new this.repositoryClass(this, name, options); | ||
@@ -440,2 +471,12 @@ await repository.initialize(); | ||
/** | ||
* Delete a repository | ||
* @param {string} name | ||
* @return {Promise<undefined>} | ||
*/ | ||
async deleteRepository(name) { | ||
await this._initialize(); | ||
this.repositories.delete(name); | ||
} | ||
/** | ||
* Lookup a repository | ||
@@ -446,2 +487,3 @@ * @param {string} name | ||
async repository(name) { | ||
await this._initialize(); | ||
return this.repositories.get(name); | ||
@@ -459,2 +501,3 @@ } | ||
async branch(name) { | ||
await this._initialize(); | ||
const [repoName, branchName] = name.split(/#/); | ||
@@ -461,0 +504,0 @@ let repository; |
{ | ||
"name": "repository-provider", | ||
"version": "2.10.1", | ||
"version": "2.11.0", | ||
"main": "dist/repository-provider.js", | ||
@@ -36,5 +36,5 @@ "module": "src/repository-provider.js", | ||
"nyc": "^11.4.1", | ||
"rollup": "^0.54.0", | ||
"rollup": "^0.54.1", | ||
"rollup-plugin-multi-entry": "^2.0.2", | ||
"semantic-release": "^12.2.2", | ||
"semantic-release": "^12.2.3", | ||
"documentation": "^5.3.5", | ||
@@ -41,0 +41,0 @@ "travis-deploy-once": "^4.3.2" |
@@ -45,2 +45,3 @@ [![npm](https://img.shields.io/npm/v/repository-provider.svg)](https://www.npmjs.com/package/repository-provider) | ||
- [Provider](#provider) | ||
- [initialize](#initialize) | ||
- [repositoryClass](#repositoryclass) | ||
@@ -50,2 +51,3 @@ - [branchClass](#branchclass) | ||
- [createRepository](#createrepository) | ||
- [deleteRepository](#deleterepository) | ||
- [repository](#repository) | ||
@@ -58,3 +60,3 @@ - [branch](#branch) | ||
- [Branch](#branch-1) | ||
- [initialize](#initialize) | ||
- [initialize](#initialize-1) | ||
- [provider](#provider-1) | ||
@@ -72,3 +74,3 @@ - [owner](#owner) | ||
- [Repository](#repository-1) | ||
- [initialize](#initialize-1) | ||
- [initialize](#initialize-2) | ||
- [content](#content-2) | ||
@@ -84,2 +86,3 @@ - [urls](#urls) | ||
- [addBranch](#addbranch) | ||
- [delete](#delete-1) | ||
- [pullRequests](#pullrequests) | ||
@@ -93,3 +96,3 @@ - [pullRequest](#pullrequest) | ||
- [provider](#provider-2) | ||
- [delete](#delete-1) | ||
- [delete](#delete-2) | ||
@@ -120,2 +123,14 @@ ## Content | ||
### initialize | ||
- **See: [Provider#repository](#providerrepository)** | ||
- **See: [Provider#branch](#providerbranch)** | ||
- **See: [Provider#createRepository](#providercreaterepository)** | ||
- **See: [Provider#deleteRepository](#providerdeleterepository)** | ||
Provider initialization | ||
will be called once before content addressing method is called | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)>** | ||
### repositoryClass | ||
@@ -139,7 +154,17 @@ | ||
- `name` | ||
- `options` | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Repository](#repository)>** | ||
### deleteRepository | ||
Delete a repository | ||
**Parameters** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)>** | ||
### repository | ||
@@ -255,3 +280,3 @@ | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)>** | ||
@@ -417,2 +442,10 @@ ### content | ||
### delete | ||
- **See: [Provider#deleteRepository](#providerdeleterepository)** | ||
Delete the repository from the [Provider](#provider). | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)>** | ||
### pullRequests | ||
@@ -419,0 +452,0 @@ |
@@ -66,3 +66,3 @@ import { notImplementedError } from './util'; | ||
* @see {@link Repository#deleteBranch} | ||
* @return {Promise} | ||
* @return {Promise<undefined>} | ||
*/ | ||
@@ -69,0 +69,0 @@ async delete() { |
@@ -49,3 +49,22 @@ import { Branch } from './branch'; | ||
async _initialize() { | ||
if (this._isInitialized) { | ||
return; | ||
} | ||
await this.initialize(); | ||
this._isInitialized = true; | ||
} | ||
/** | ||
* Provider initialization | ||
* will be called once before content addressing method is called | ||
* @see {@link Provider#repository} | ||
* @see {@link Provider#branch} | ||
* @see {@link Provider#createRepository} | ||
* @see {@link Provider#deleteRepository} | ||
* @return {Promise<undefined>} | ||
*/ | ||
async initialize() {} | ||
/** | ||
* @return {Class} repository class used by the Provider | ||
@@ -73,5 +92,8 @@ */ | ||
* Create a new repository | ||
* @param {string} name | ||
* @param {Object} options | ||
* @return {Promise<Repository>} | ||
*/ | ||
async createRepository(name, options) { | ||
await this._initialize(); | ||
const repository = new this.repositoryClass(this, name, options); | ||
@@ -84,2 +106,12 @@ await repository.initialize(); | ||
/** | ||
* Delete a repository | ||
* @param {string} name | ||
* @return {Promise<undefined>} | ||
*/ | ||
async deleteRepository(name) { | ||
await this._initialize(); | ||
this.repositories.delete(name); | ||
} | ||
/** | ||
* Lookup a repository | ||
@@ -90,2 +122,3 @@ * @param {string} name | ||
async repository(name) { | ||
await this._initialize(); | ||
return this.repositories.get(name); | ||
@@ -103,2 +136,3 @@ } | ||
async branch(name) { | ||
await this._initialize(); | ||
const [repoName, branchName] = name.split(/#/); | ||
@@ -105,0 +139,0 @@ let repository; |
@@ -118,2 +118,11 @@ import { notImplementedError } from './util'; | ||
/** | ||
* Delete the repository from the {@link Provider}. | ||
* @see {@link Provider#deleteRepository} | ||
* @return {Promise<undefined>} | ||
*/ | ||
async delete() { | ||
return this.provider.deleteRepository(this.name); | ||
} | ||
async createPullRequest() { | ||
@@ -120,0 +129,0 @@ return notImplementedError(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45022
949
536