verdaccio-memory
Advanced tools
Comparing version 11.0.0-6-next.18 to 11.0.0-6-next.19
@@ -13,9 +13,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _localMemory = _interopRequireDefault(require("./local-memory")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = _localMemory.default; | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
import { pluginUtils, searchUtils } from '@verdaccio/core'; | ||
import { Logger, Token } from '@verdaccio/types'; | ||
import MemoryHandler, { DataHandler } from './memory-handler'; | ||
export declare type ConfigMemory = { | ||
export type ConfigMemory = { | ||
limit?: number; | ||
@@ -6,0 +6,0 @@ }; |
@@ -7,16 +7,11 @@ "use strict"; | ||
exports.default = void 0; | ||
var _debug = _interopRequireDefault(require("debug")); | ||
var _core = require("@verdaccio/core"); | ||
var _memoryHandler = _interopRequireDefault(require("./memory-handler")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const debug = (0, _debug.default)('verdaccio:plugin:storage:local-memory'); | ||
const DEFAULT_LIMIT = 1000; | ||
class LocalMemory extends _core.pluginUtils.Plugin { | ||
// @ts-ignore | ||
constructor(config, options) { | ||
@@ -31,11 +26,8 @@ super(config, options); | ||
} | ||
init() { | ||
return Promise.resolve(); | ||
} | ||
getSecret() { | ||
return Promise.resolve(this.data.secret); | ||
} | ||
setSecret(secret) { | ||
@@ -47,3 +39,2 @@ return new Promise(resolve => { | ||
} | ||
async add(name) { | ||
@@ -54,3 +45,2 @@ return new Promise((resolve, reject) => { | ||
} = this.data; | ||
if (list.length < this.limit) { | ||
@@ -60,3 +50,2 @@ if (list.indexOf(name) === -1) { | ||
} | ||
resolve(); | ||
@@ -70,5 +59,5 @@ } else { | ||
}); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async search(query) { | ||
@@ -78,3 +67,2 @@ this.logger.warn('[verdaccio/memory]: search method not implemented, PR is welcome'); | ||
} | ||
async remove(name) { | ||
@@ -86,30 +74,23 @@ return new Promise(resolve => { | ||
const item = list.indexOf(name); | ||
if (item !== -1) { | ||
list.splice(item, 1); | ||
} | ||
return resolve(); | ||
}); | ||
} | ||
async get() { | ||
var _this$data, _this$data$list, _this$data2; | ||
debug('data list length %o', (_this$data = this.data) === null || _this$data === void 0 ? void 0 : (_this$data$list = _this$data.list) === null || _this$data$list === void 0 ? void 0 : _this$data$list.length); | ||
return Promise.resolve((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.list); | ||
} | ||
getPackageStorage(packageInfo) { | ||
return new _memoryHandler.default(packageInfo, this.data.files, this.logger); | ||
} | ||
async hasTarball() { | ||
async hasTarball( /* fileName: string */ | ||
) { | ||
throw new Error('not implemented'); | ||
} | ||
async hasPackage() { | ||
return false; | ||
} | ||
_createEmtpyDatabase() { | ||
@@ -125,3 +106,2 @@ const list = []; | ||
} | ||
saveToken() { | ||
@@ -131,3 +111,2 @@ this.logger.warn('[verdaccio/memory][saveToken] save token has not been implemented yet'); | ||
} | ||
deleteToken(user, tokenKey) { | ||
@@ -140,3 +119,2 @@ this.logger.warn({ | ||
} | ||
readTokens() { | ||
@@ -146,7 +124,5 @@ this.logger.warn('[verdaccio/memory][readTokens] read tokens has not been implemented yet '); | ||
} | ||
} | ||
var _default = LocalMemory; | ||
exports.default = _default; | ||
//# sourceMappingURL=local-memory.js.map |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import { Logger, Manifest } from '@verdaccio/types'; | ||
export declare type DataHandler = { | ||
export type DataHandler = { | ||
[key: string]: string; | ||
@@ -8,0 +8,0 @@ }; |
@@ -7,22 +7,13 @@ "use strict"; | ||
exports.default = void 0; | ||
var _debug = _interopRequireDefault(require("debug")); | ||
var _memfs = require("memfs"); | ||
var _path = _interopRequireDefault(require("path")); | ||
var _stream = require("stream"); | ||
var _promises = require("stream/promises"); | ||
var _core = require("@verdaccio/core"); | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
const debug = (0, _debug.default)('verdaccio:plugin:storage:memory-storage'); | ||
function fstatPromise(fd) { | ||
@@ -34,3 +25,2 @@ return new Promise((resolve, reject) => { | ||
} | ||
return resolve(stats); | ||
@@ -40,3 +30,2 @@ }); | ||
} | ||
function mkdirPPromise(fileName) { | ||
@@ -48,3 +37,2 @@ return new Promise((resolve, reject) => { | ||
} | ||
return resolve(true); | ||
@@ -54,3 +42,2 @@ }); | ||
} | ||
class MemoryHandler { | ||
@@ -65,11 +52,8 @@ constructor(packageName, data, logger) { | ||
} | ||
async hasTarball(fileName) { | ||
throw new Error('not implemented'); | ||
} | ||
async hasPackage() { | ||
return false; | ||
} | ||
async deletePackage(pkgName) { | ||
@@ -79,7 +63,5 @@ delete this.data[pkgName]; | ||
} | ||
removePackage() { | ||
return Promise.resolve(); | ||
} | ||
async createPackage(name, value) { | ||
@@ -89,3 +71,2 @@ debug('create package %o', name); | ||
} | ||
async savePackage(name, value) { | ||
@@ -99,17 +80,11 @@ try { | ||
} | ||
async readPackage(name) { | ||
debug('read package %o', name); | ||
const json = this._getStorage(name); | ||
const isJson = typeof json === 'undefined'; | ||
if (isJson) { | ||
throw _core.errorUtils.getNotFound(); | ||
} | ||
return (0, _utils.parsePackage)(json); | ||
} | ||
async writeTarball(name) { | ||
@@ -119,8 +94,5 @@ const temporalName = `${this.path}/${name}`; | ||
await mkdirPPromise(temporalName); | ||
const writeStream = _memfs.fs.createWriteStream(temporalName); | ||
return writeStream; | ||
} | ||
async readTarball(pkgName, { | ||
@@ -130,3 +102,2 @@ signal | ||
const pathName = this._getStorage(pkgName); | ||
const passStream = new _stream.PassThrough(); | ||
@@ -143,6 +114,10 @@ const readStream = (0, _stream.addAbortSignal)(signal, _memfs.fs.createReadStream(pathName)); | ||
return passStream; | ||
} // public readTarball(name: string): IReadTarball { | ||
} | ||
// public readTarball(name: string): IReadTarball { | ||
// const pathName = `${this.path}/${name}`; | ||
// debug('read tarball %o', pathName); | ||
// const readTarballStream: IReadTarball = new ReadTarball({}); | ||
// process.nextTick(function () { | ||
@@ -153,4 +128,6 @@ // fs.stat(pathName, function (error, stats) { | ||
// } | ||
// try { | ||
// const readStream = fs.createReadStream(pathName); | ||
// readTarballStream.emit('content-length', stats?.size); | ||
@@ -162,2 +139,3 @@ // readTarballStream.emit('open'); | ||
// }); | ||
// readTarballStream.abort = function (): void { | ||
@@ -173,6 +151,6 @@ // readStream.destroy(errorUtils.getBadRequest('read has been aborted')); | ||
// }); | ||
// return readTarballStream; | ||
// } | ||
_getStorage(name = '') { | ||
@@ -182,6 +160,4 @@ debug('get storage %o', name); | ||
} | ||
async updatePackage(packageName, handleUpdate) { | ||
const json = this._getStorage(packageName); | ||
let pkg = (0, _utils.parsePackage)(json); | ||
@@ -191,7 +167,5 @@ const newManifest = await handleUpdate(pkg); | ||
} | ||
} | ||
var _default = MemoryHandler; | ||
exports.default = _default; | ||
//# sourceMappingURL=memory-handler.js.map |
@@ -8,7 +8,5 @@ "use strict"; | ||
exports.stringifyPackage = stringifyPackage; | ||
function stringifyPackage(pkg) { | ||
return JSON.stringify(pkg, null, '\t'); | ||
} | ||
function parsePackage(pkg) { | ||
@@ -15,0 +13,0 @@ return JSON.parse(pkg); |
# Change Log | ||
## 11.0.0-6-next.19 | ||
### Patch Changes | ||
- @verdaccio/core@6.0.0-6-next.52 | ||
## 11.0.0-6-next.18 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "verdaccio-memory", | ||
"version": "11.0.0-6-next.18", | ||
"version": "11.0.0-6-next.19", | ||
"description": "Storage implementation in memory", | ||
@@ -34,11 +34,11 @@ "keywords": [ | ||
"dependencies": { | ||
"@verdaccio/core": "6.0.0-6-next.51", | ||
"@verdaccio/core": "6.0.0-6-next.52", | ||
"memory-fs": "0.5.0", | ||
"debug": "4.3.4", | ||
"memfs": "3.4.7" | ||
"memfs": "3.4.12" | ||
}, | ||
"devDependencies": { | ||
"@verdaccio/types": "11.0.0-6-next.17", | ||
"@verdaccio/config": "6.0.0-6-next.51", | ||
"@verdaccio/logger": "6.0.0-6-next.19" | ||
"@verdaccio/config": "6.0.0-6-next.52", | ||
"@verdaccio/logger": "6.0.0-6-next.20" | ||
}, | ||
@@ -45,0 +45,0 @@ "funding": { |
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
Sorry, the diff of this file is not supported yet
79958
1178
+ Added@verdaccio/core@6.0.0-6-next.52(transitive)
+ Addedajv@8.11.2(transitive)
+ Addedcore-js@3.26.1(transitive)
+ Addedmemfs@3.4.12(transitive)
- Removed@verdaccio/core@6.0.0-6-next.51(transitive)
- Removedajv@8.11.0(transitive)
- Removedcore-js@3.25.5(transitive)
- Removedmemfs@3.4.7(transitive)
Updatedmemfs@3.4.12