repository-provider
Advanced tools
Comparing version 8.6.3 to 9.0.0
@@ -6,2 +6,4 @@ 'use strict'; | ||
var stream = require('stream'); | ||
require('path'); | ||
require('fs'); | ||
@@ -303,18 +305,2 @@ function notImplementedError() { | ||
} | ||
/// depredations follow | ||
async *list(...args) { | ||
console.log( | ||
`${this.constructor.name}: list is deprecated use entries instead` | ||
); | ||
return this.entries(...args); | ||
} | ||
async content(...args) { | ||
console.log( | ||
`${this.constructor.name}: content is deprecated use entry instead` | ||
); | ||
return this.entry(...args); | ||
} | ||
} | ||
@@ -655,12 +641,2 @@ ); | ||
const {Readable} = stream; | ||
var toReadableStream = input => ( | ||
new Readable({ | ||
read() { | ||
this.push(input); | ||
this.push(null); | ||
} | ||
}) | ||
); | ||
/** | ||
@@ -709,3 +685,17 @@ * Representation of one file or directory entry | ||
const {Readable} = stream; | ||
var toReadableStream = input => ( | ||
new Readable({ | ||
read() { | ||
this.push(input); | ||
this.push(null); | ||
} | ||
}) | ||
); | ||
/** | ||
* Content entries where a stream is the primary data representation | ||
*/ | ||
/** | ||
* Representation of one file or directory entry | ||
@@ -851,11 +841,2 @@ * All names are asolute (no leading '/') and build with '/' | ||
/** | ||
* Create empty content (file) | ||
* @param {string} name | ||
* @return {Entry} | ||
*/ | ||
function emptyEntry(name, options) { | ||
return new Entry(name, ""); | ||
} | ||
/** | ||
* Abstract pull request | ||
@@ -1181,130 +1162,129 @@ * {@link Repository#addPullRequest} | ||
*/ | ||
const Owner = LogLevelMixin(OneTimeInititalizerMixin( | ||
class Owner { | ||
/** | ||
* options | ||
*/ | ||
static get defaultOptions() { | ||
return { | ||
/** | ||
* default logger | ||
*/ | ||
logger: (...arg) => console.log(...args), | ||
logLevel: 'info' | ||
}; | ||
} | ||
const Owner = LogLevelMixin( | ||
OneTimeInititalizerMixin( | ||
class Owner { | ||
/** | ||
* options | ||
*/ | ||
static get defaultOptions() { | ||
return { | ||
/** | ||
* default logger | ||
*/ | ||
logger: (...arg) => console.log(...args), | ||
logLevel: "info" | ||
}; | ||
} | ||
constructor() { | ||
Object.defineProperties( | ||
this, | ||
{ | ||
constructor() { | ||
Object.defineProperties(this, { | ||
repositories: { value: new Map() } | ||
} | ||
); | ||
} | ||
}); | ||
} | ||
/** | ||
* @return {Class} repository class used by the Provider | ||
*/ | ||
get repositoryClass() { | ||
return Repository; | ||
} | ||
/** | ||
* @return {Class} repository class used by the Provider | ||
*/ | ||
get repositoryClass() { | ||
return Repository; | ||
} | ||
/** | ||
* @return {Class} branch class used by the Provider | ||
*/ | ||
get branchClass() { | ||
return Branch; | ||
} | ||
/** | ||
* @return {Class} branch class used by the Provider | ||
*/ | ||
get branchClass() { | ||
return Branch; | ||
} | ||
/** | ||
* @return {Class} entry class used by the Provider | ||
*/ | ||
get entryClass() { | ||
return Entry; | ||
} | ||
/** | ||
* @return {Class} entry class used by the Provider | ||
*/ | ||
get entryClass() { | ||
return Entry; | ||
} | ||
/** | ||
* @return {Class} pull request class used by the Provider | ||
*/ | ||
get pullRequestClass() { | ||
return PullRequest; | ||
} | ||
/** | ||
* @return {Class} pull request class used by the Provider | ||
*/ | ||
get pullRequestClass() { | ||
return PullRequest; | ||
} | ||
/** | ||
* Delete a repository | ||
* @param {string} name | ||
* @return {Promise<undefined>} | ||
*/ | ||
async deleteRepository(name) { | ||
await this.initialize(); | ||
this.repositories.delete(name); | ||
} | ||
/** | ||
* Lookup a repository | ||
* @param {string} name of the repository may contain a #branch | ||
* @return {Promise<Repository>} | ||
*/ | ||
async repository(name, options) { | ||
if (name === undefined) { | ||
return undefined; | ||
/** | ||
* Delete a repository | ||
* @param {string} name | ||
* @return {Promise<undefined>} | ||
*/ | ||
async deleteRepository(name) { | ||
await this.initialize(); | ||
this.repositories.delete(name); | ||
} | ||
const [repoName, branchName] = name.split(/#/); | ||
/** | ||
* Lookup a repository | ||
* @param {string} name of the repository may contain a #branch | ||
* @return {Promise<Repository>} | ||
*/ | ||
async repository(name, options) { | ||
if (name === undefined) { | ||
return undefined; | ||
} | ||
await this.initialize(); | ||
return this.repositories.get(repoName); | ||
} | ||
const [repoName, branchName] = name.split(/#/); | ||
/** | ||
* 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); | ||
this.repositories.set(repository.name, repository); | ||
return repository; | ||
} | ||
await this.initialize(); | ||
return this.repositories.get(repoName); | ||
} | ||
/** | ||
* Lookup a branch | ||
* First lookup repository then the branch | ||
* If no branch was specified then the default branch will be delivered. | ||
* @see {@link Repository#defaultBranch} | ||
* @param {string} name with optional branch name as '#myBranchName' | ||
* @return {Promise<Branch|undefined>} | ||
*/ | ||
async branch(name, options) { | ||
if (name === undefined) { | ||
return undefined; | ||
/** | ||
* 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); | ||
this.repositories.set(repository.name, repository); | ||
return repository; | ||
} | ||
const [repoName, branchName] = name.split(/#/); | ||
const repository = await this.repository(repoName); | ||
/** | ||
* Lookup a branch | ||
* First lookup repository then the branch | ||
* If no branch was specified then the default branch will be delivered. | ||
* @see {@link Repository#defaultBranch} | ||
* @param {string} name with optional branch name as '#myBranchName' | ||
* @return {Promise<Branch|undefined>} | ||
*/ | ||
async branch(name, options) { | ||
if (name === undefined) { | ||
return undefined; | ||
} | ||
if (repository === undefined) { | ||
return undefined; | ||
const [repoName, branchName] = name.split(/#/); | ||
const repository = await this.repository(repoName); | ||
if (repository === undefined) { | ||
return undefined; | ||
} | ||
return branchName === undefined | ||
? repository.defaultBranch | ||
: repository.branch(branchName); | ||
} | ||
return branchName === undefined | ||
? repository.defaultBranch | ||
: repository.branch(branchName); | ||
} | ||
/** | ||
* Deliver the repository type | ||
* @return {string} 'git' | ||
*/ | ||
get type() { | ||
return "git"; | ||
} | ||
/** | ||
* Deliver the repository type | ||
* @return {string} 'git' | ||
*/ | ||
get type() { | ||
return "git"; | ||
async _initialize() {} | ||
} | ||
) | ||
); | ||
async _initialize() {} | ||
} | ||
)); | ||
/** | ||
@@ -1389,20 +1369,2 @@ * Abstract repository collection | ||
/** | ||
* 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 | ||
@@ -1582,7 +1544,2 @@ * @param {Object} options | ||
exports.RepositoryGroup = RepositoryGroup; | ||
exports.BaseEntry = BaseEntry; | ||
exports.Entry = Entry; | ||
exports.BaseCollectionEntry = BaseCollectionEntry; | ||
exports.CollectionEntryMixin = CollectionEntryMixin; | ||
exports.emptyEntry = emptyEntry; | ||
exports.Provider = Provider; |
{ | ||
"name": "repository-provider", | ||
"version": "8.6.3", | ||
"version": "9.0.0", | ||
"publishConfig": { | ||
@@ -32,3 +32,3 @@ "access": "public" | ||
"dependencies": { | ||
"content-entry": "^1.4.1", | ||
"content-entry": "^1.4.2", | ||
"loglevel-mixin": "^2.0.5", | ||
@@ -35,0 +35,0 @@ "to-readable-stream": "^1.0.0" |
@@ -103,17 +103,4 @@ [![npm](https://img.shields.io/npm/v/repository-provider.svg)](https://www.npmjs.com/package/repository-provider) | ||
- [pullRequestClass](#pullrequestclass) | ||
- [Entry](#entry) | ||
- [definePropertiesFromOptions](#definepropertiesfromoptions) | ||
- [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) | ||
@@ -441,78 +428,2 @@ ## 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 | ||
@@ -519,0 +430,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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
82318
12
2376
450
1
Updatedcontent-entry@^1.4.2