repository-provider
Advanced tools
Comparing version 7.0.1 to 7.1.0
@@ -186,7 +186,7 @@ 'use strict'; | ||
* Deliver file content from the head | ||
* @param {string} path | ||
* @param {string} name | ||
* @return {Promise<Content>} content of a given file | ||
*/ | ||
async content(path) { | ||
throw new Error(`No such object '${path}'`); | ||
async content(name) { | ||
throw new Error(`No such object '${name}'`); | ||
} | ||
@@ -242,9 +242,18 @@ | ||
async *list(matchingPatterns) { | ||
return this.entries(matchingPatterns); | ||
} | ||
/** | ||
* List paths of the branch | ||
* List entries of the branch | ||
* @param {string[]} matchingPatterns | ||
* @return {string[]} all file names in the branch | ||
*/ | ||
async *list(matchingPatterns) {} | ||
async *entries(matchingPatterns) { | ||
} | ||
async entry(name) { | ||
return (await this.entries(name).next()).value; | ||
} | ||
/** | ||
@@ -624,4 +633,4 @@ * Value delivered from the provider | ||
* Representation of one file or directory entry | ||
* All paths are asolute (no leading '/') and build with '/' | ||
* @property {string} path file name inside of the repository | ||
* All names are asolute (no leading '/') and build with '/' | ||
* @property {string} name file name inside of the repository | ||
* @property {string|Buffer|Stream} content | ||
@@ -632,3 +641,3 @@ * @property {string} type type of the content | ||
* | ||
* @param {string} path file name inside of the repository | ||
* @param {string} name file name inside of the repository | ||
* @param {string|Buffer|Stream} content | ||
@@ -649,3 +658,3 @@ * @param {string} type type of the content | ||
constructor( | ||
path, | ||
name, | ||
content = undefined, | ||
@@ -656,5 +665,5 @@ type = Content.TYPE_BLOB, | ||
) { | ||
if (path[0] === "/" || path.indexOf("\\") >= 0) { | ||
if (name[0] === "/" || name.indexOf("\\") >= 0) { | ||
throw new TypeError( | ||
`Paths should not contain leading '/' or any '\\': ${path}` | ||
`Names should not contain leading '/' or any '\\': ${name}` | ||
); | ||
@@ -664,3 +673,3 @@ } | ||
Object.defineProperties(this, { | ||
path: { value: path }, | ||
name: { value: name }, | ||
content: { | ||
@@ -688,2 +697,9 @@ get() { | ||
/** | ||
* deprecated is name instead | ||
*/ | ||
get path() { | ||
return this.name; | ||
} | ||
/** | ||
* @return {boolean} true if content represents a directory | ||
@@ -719,3 +735,3 @@ */ | ||
/** | ||
* Deliver content as stream | ||
* Deliver content as read stream | ||
* @return {ReadableStream} content | ||
@@ -731,3 +747,3 @@ */ | ||
return { | ||
path: this.path, | ||
name: this.name, | ||
type: this.type, | ||
@@ -740,16 +756,21 @@ mode: this.mode, | ||
/** | ||
* compare against other content | ||
* compare meta info against other entry | ||
* @param {Content} other | ||
* @return {boolean} true if other describes the same content | ||
* @return {boolean} true if other has the same meta information (name...) | ||
*/ | ||
equals(other) { | ||
if ( | ||
other === undefined || | ||
this.path !== other.path || | ||
this.type !== other.type || | ||
this.mode !== other.mode | ||
) { | ||
return false; | ||
} | ||
equalsMeta(other) { | ||
return ( | ||
other !== undefined && | ||
(this.name === other.name && | ||
this.type === other.type && | ||
this.mode === other.mode) | ||
); | ||
} | ||
/** | ||
* compare content against other entry | ||
* @param {Content} other | ||
* @return {boolean} true if other has the same content (bitwise) | ||
*/ | ||
equalsContent(other) { | ||
if (Buffer.isBuffer(this.content)) { | ||
@@ -763,2 +784,11 @@ if (Buffer.isBuffer(other.content)) { | ||
} | ||
/** | ||
* compare against other content | ||
* @param {Content} other | ||
* @return {boolean} true if other describes the same content | ||
*/ | ||
equals(other) { | ||
return this.equalsMeta(other) && this.equalsContent(other); | ||
} | ||
} | ||
@@ -768,7 +798,7 @@ | ||
* Create empty content (file) | ||
* @param {string} path | ||
* @param {string} name | ||
* @return {Content} | ||
*/ | ||
function emptyContent(path, options) { | ||
return new Content(path, ""); | ||
function emptyContent(name, options) { | ||
return new Content(name, ""); | ||
} | ||
@@ -775,0 +805,0 @@ |
{ | ||
"name": "repository-provider", | ||
"version": "7.0.1", | ||
"version": "7.1.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
70830
2292
0