repository-provider
Advanced tools
Comparing version 8.6.2 to 8.6.3
@@ -15,3 +15,3 @@ 'use strict'; | ||
* @param {Object} object target object | ||
* @param {Object} options | ||
* @param {Object} options as passed to object constructor | ||
* @param {Object} properties object properties | ||
@@ -667,5 +667,5 @@ */ | ||
* All names are asolute (no leading '/') and build with '/' | ||
* @property {string} name file name inside of the repository | ||
* @property {string} name name inside of the container | ||
* | ||
* @param {string} name file name inside of the repository | ||
* @param {string} name name inside of the container | ||
*/ | ||
@@ -693,6 +693,10 @@ class BaseEntry { | ||
get isDirectory() { | ||
get isCollection() { | ||
return false; | ||
} | ||
get isBlob() { | ||
return false; | ||
} | ||
toJSON() { | ||
@@ -706,19 +710,2 @@ return { | ||
/** | ||
* brings Directory attributes | ||
*/ | ||
function DirectoryEntryMixin(superclass) { | ||
return class DirectoryEntryMixin extends superclass { | ||
get isDirectory() { | ||
return true; | ||
} | ||
async getTypes() { | ||
return ["public.directory"]; | ||
} | ||
}; | ||
} | ||
const BaseDirectoryEntry = DirectoryEntryMixin(BaseEntry); | ||
/** | ||
* Representation of one file or directory entry | ||
@@ -861,44 +848,2 @@ * All names are asolute (no leading '/') and build with '/' | ||
} | ||
/*** DEPRECATED methods properties follow */ | ||
/** | ||
* Deliver content as string | ||
* @return {string} content | ||
*/ | ||
toString() { | ||
console.log( | ||
`${ | ||
this.constructor.name | ||
}: toString() is deprecated use getString() instead` | ||
); | ||
} | ||
/** | ||
* @return {boolean} true if content represents a directory | ||
*/ | ||
get isDirectory() { | ||
console.log(`${this.constructor.name}: isDirectory is deprecated`); | ||
return this.type === Entry.TYPE_TREE; | ||
} | ||
/** | ||
* @return {boolean} true if content represents a blob (plain old file) | ||
*/ | ||
get isFile() { | ||
console.log(`${this.constructor.name}: isFile is deprecated`); | ||
return this.type === Entry.TYPE_BLOB; | ||
} | ||
/** | ||
* deprecated is name instead | ||
*/ | ||
get path() { | ||
console.log( | ||
`${this.constructor.name}: path is deprecated use name instead` | ||
); | ||
return this.name; | ||
} | ||
} | ||
@@ -1443,2 +1388,20 @@ | ||
/** | ||
* brings Directory attributes to entries | ||
*/ | ||
function CollectionEntryMixin(superclass) { | ||
return class CollectionEntryMixin extends superclass { | ||
get isCollection() { | ||
return true; | ||
} | ||
async getTypes() { | ||
return ["public.directory"]; | ||
} | ||
}; | ||
} | ||
const BaseCollectionEntry = CollectionEntryMixin(BaseEntry); | ||
/** | ||
* Base repository provider acts as a source of repositories | ||
@@ -1620,5 +1583,5 @@ * @param {Object} options | ||
exports.Entry = Entry; | ||
exports.BaseDirectoryEntry = BaseDirectoryEntry; | ||
exports.DirectoryEntryMixin = DirectoryEntryMixin; | ||
exports.BaseCollectionEntry = BaseCollectionEntry; | ||
exports.CollectionEntryMixin = CollectionEntryMixin; | ||
exports.emptyEntry = emptyEntry; | ||
exports.Provider = Provider; |
{ | ||
"name": "repository-provider", | ||
"version": "8.6.2", | ||
"version": "8.6.3", | ||
"publishConfig": { | ||
@@ -32,2 +32,3 @@ "access": "public" | ||
"dependencies": { | ||
"content-entry": "^1.4.1", | ||
"loglevel-mixin": "^2.0.5", | ||
@@ -37,6 +38,6 @@ "to-readable-stream": "^1.0.0" | ||
"devDependencies": { | ||
"ava": "^1.0.0-rc.2", | ||
"documentation": "^8.1.2", | ||
"ava": "^1.0.1", | ||
"documentation": "^9.1.1", | ||
"markdown-doctest": "^0.9.1", | ||
"rollup": "^0.67.3", | ||
"rollup": "^0.68.2", | ||
"rollup-plugin-cleanup": "^3.0.0", | ||
@@ -46,5 +47,5 @@ "rollup-plugin-commonjs": "^9.2.0", | ||
"rollup-plugin-json": "^3.1.0", | ||
"rollup-plugin-node-resolve": "^3.4.0", | ||
"semantic-release": "^15.12.2", | ||
"travis-deploy-once": "^5.0.9", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"semantic-release": "^15.13.1", | ||
"travis-deploy-once": "^5.0.11", | ||
"c8": "^3.2.1", | ||
@@ -54,3 +55,3 @@ "esm": "^3.0.84" | ||
"engines": { | ||
"node": ">=10.14" | ||
"node": ">=10.14.2" | ||
}, | ||
@@ -57,0 +58,0 @@ "repository": { |
371
README.md
@@ -65,2 +65,55 @@ [![npm](https://img.shields.io/npm/v/repository-provider.svg)](https://www.npmjs.com/package/repository-provider) | ||
- [priority](#priority) | ||
- [Branch](#branch-1) | ||
- [Parameters](#parameters-6) | ||
- [Properties](#properties-1) | ||
- [defaultOptions](#defaultoptions) | ||
- [defaultOptions](#defaultoptions-1) | ||
- [defaultOptions](#defaultoptions-2) | ||
- [OneTimeInititalizer](#onetimeinititalizer) | ||
- [Owner](#owner) | ||
- [Properties](#properties-2) | ||
- [logger](#logger) | ||
- [Parameters](#parameters-7) | ||
- [Repository](#repository-1) | ||
- [Parameters](#parameters-8) | ||
- [Properties](#properties-3) | ||
- [description](#description) | ||
- [description](#description-1) | ||
- [id](#id) | ||
- [id](#id-1) | ||
- [id](#id-2) | ||
- [PullRequest](#pullrequest) | ||
- [Parameters](#parameters-9) | ||
- [Properties](#properties-4) | ||
- [provider](#provider-2) | ||
- [delete](#delete) | ||
- [merge](#merge) | ||
- [decline](#decline) | ||
- [title](#title) | ||
- [body](#body) | ||
- [state](#state) | ||
- [locked](#locked) | ||
- [merged](#merged) | ||
- [RepositoryGroup](#repositorygroup-1) | ||
- [Parameters](#parameters-10) | ||
- [Properties](#properties-5) | ||
- [repositoryClass](#repositoryclass) | ||
- [branchClass](#branchclass) | ||
- [contentClass](#contentclass) | ||
- [pullRequestClass](#pullrequestclass) | ||
- [Entry](#entry) | ||
- [Parameters](#parameters-11) | ||
- [Properties](#properties-6) | ||
- [getString](#getstring) | ||
- [getReadStream](#getreadstream) | ||
- [equalsMeta](#equalsmeta) | ||
- [Parameters](#parameters-12) | ||
- [equalsContent](#equalscontent) | ||
- [Parameters](#parameters-13) | ||
- [equals](#equals) | ||
- [Parameters](#parameters-14) | ||
- [emptyEntry](#emptyentry) | ||
- [Parameters](#parameters-15) | ||
- [definePropertiesFromOptions](#definepropertiesfromoptions) | ||
- [Parameters](#parameters-16) | ||
@@ -79,3 +132,3 @@ ## Provider | ||
- `repositoryGroups` **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), RepositoryGroup>** | ||
- `repositoryGroups` **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [RepositoryGroup](#repositorygroup)>** | ||
@@ -91,3 +144,3 @@ ### repositoryGroup | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<RepositoryGroup>** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[RepositoryGroup](#repositorygroup)>** | ||
@@ -103,3 +156,3 @@ ### createRepositoryGroup | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<RepositoryGroup>** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[RepositoryGroup](#repositorygroup)>** | ||
@@ -115,3 +168,3 @@ ### repository | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<Repository>** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Repository](#repository)>** | ||
@@ -127,3 +180,3 @@ ### branch | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<Branch>** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Branch](#branch)>** | ||
@@ -173,2 +226,310 @@ ### repositoryGroupClass | ||
## Branch | ||
- **See: [Repository#addBranch](Repository#addBranch)** | ||
Abstract branch | ||
### Parameters | ||
- `repository` **[Repository](#repository)** | ||
- `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)** | ||
### Properties | ||
- `repository` **[Repository](#repository)** | ||
- `provider` **[Provider](#provider)** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## defaultOptions | ||
options | ||
## defaultOptions | ||
options | ||
## defaultOptions | ||
options | ||
## OneTimeInititalizer | ||
enshures that \_initialize() will be called only once | ||
## Owner | ||
Collection of repositories | ||
### Properties | ||
- `repositories` **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [Repository](#repository)>** | ||
## logger | ||
default logger | ||
### Parameters | ||
- `arg` **...any** | ||
## Repository | ||
Abstract repository | ||
### Parameters | ||
- `owner` **[Owner](#owner)** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (#branch) will be removed | ||
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
- `options.description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** human readable description | ||
- `options.id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** internal id | ||
### Properties | ||
- `owner` **[Owner](#owner)** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** without (#branch) | ||
- `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** from options.description | ||
- `id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** from options.id | ||
- `branches` **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [Branch](#branch)>** | ||
- `pullRequests` **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [PullRequest](#pullrequest)>** | ||
## description | ||
the description of the repository content. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## description | ||
the description of the repository group. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## id | ||
unique id within the provider. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## id | ||
internal id. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## id | ||
unique id within the provider. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## PullRequest | ||
Abstract pull request | ||
[Repository#addPullRequest](Repository#addPullRequest) | ||
### Parameters | ||
- `source` **[Branch](#branch)** | ||
- `destination` **[Branch](#branch)** | ||
- `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)** | ||
- `options.title` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** | ||
- `options.state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** | ||
- `options.merged` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** | ||
- `options.locked` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** | ||
### Properties | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `source` **[Branch](#branch)** | ||
- `destination` **[Branch](#branch)** | ||
- `title` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** | ||
- `state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** | ||
- `merged` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** | ||
- `locked` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** | ||
### provider | ||
Returns **[Provider](#provider)** | ||
### delete | ||
- **See: [Repository#deletePullRequest](Repository#deletePullRequest)** | ||
Delete the pull request from the [Repository](#repository). | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** | ||
### merge | ||
Merge the pull request | ||
### decline | ||
Decline the pull request | ||
## title | ||
the one line description of the pull request. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## body | ||
the description of the pull request. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## state | ||
state of the pull request. | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
## locked | ||
locked state of the pull request. | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** | ||
## merged | ||
merged state of the pull request. | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** | ||
## RepositoryGroup | ||
**Extends Owner** | ||
Abstract repository collection | ||
### Parameters | ||
- `provider` **[Provider](#provider)** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of the group | ||
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
- `options.description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** human readable description | ||
- `options.id` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** internal id | ||
### Properties | ||
- `provider` **[Provider](#provider)** | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
### 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 | ||
## Entry | ||
**Extends BaseEntry** | ||
Representation of one file or directory entry | ||
All names are asolute (no leading '/') and build with '/' | ||
### Parameters | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file name inside of the repository | ||
- `content` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html) \| [Stream](https://nodejs.org/api/stream.html))** (optional, default `undefined`) | ||
- `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type of the content (optional, default `Entry.TYPE_BLOB`) | ||
- `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file permissions (optional, default `"100644"`) | ||
- `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sha of the content | ||
### Properties | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file name inside of the repository | ||
- `content` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html) \| [Stream](https://nodejs.org/api/stream.html))** | ||
- `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type of the content | ||
- `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file permissions | ||
- `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sha of the content | ||
### getString | ||
Deliver content as string | ||
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** content | ||
### getReadStream | ||
Deliver content as read stream | ||
Returns **ReadableStream** content | ||
### equalsMeta | ||
compare meta info against other entry | ||
#### Parameters | ||
- `other` **[Entry](#entry)** | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if other has the same meta information (name...) | ||
### equalsContent | ||
compare content against other entry | ||
#### Parameters | ||
- `other` **[Entry](#entry)** | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if other has the same content (bitwise) | ||
### equals | ||
compare against other entry | ||
#### Parameters | ||
- `other` **[Entry](#entry)** | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if other describes the same content | ||
## emptyEntry | ||
Create empty content (file) | ||
### Parameters | ||
- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `options` | ||
Returns **[Entry](#entry)** | ||
## definePropertiesFromOptions | ||
- **See: Object.definedProperties()** | ||
create properties from options and default options | ||
### Parameters | ||
- `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** target object | ||
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** as passed to object constructor | ||
- `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** object properties (optional, default `{}`) | ||
# install | ||
@@ -175,0 +536,0 @@ |
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
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
90334
539
3
2579
+ Addedcontent-entry@^1.4.1
+ Addedcontent-entry@1.9.0(transitive)