mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
66f4197236
* chore: test * chore: add * chore: more progress * chore: progress in migration, fix prettier parser * chore: reduce tsc errors * chore: refactor storage utils types * chore: refactor utils types * chore: refactor local storage types * chore: refactor config utils types * chore: refactor tsc types * refactor: apply eslint fix, tabs etc * chore: fix lint errors * test: update unit test conf to typescript setup few test refactored to typescript * chore: enable more unit test migrate to typescript * chore: migrate storage test to tsc * chore: migrate up storage test to tsc * refactor: enable plugin and auth test * chore: migrate plugin loader test * chore: update dependencies * chore: migrate functional test to typescript * chore: add codecove * chore: update express * chore: downgrade puppeteer The latest version does not seems to work properly fine. * chore: update dependencies
50 lines
1.9 KiB
JavaScript
50 lines
1.9 KiB
JavaScript
// @flow
|
|
|
|
// this file is not aim to be tested, just to check flow definitions
|
|
import Config from '../../../../src/lib/config';
|
|
import {generatePackageTemplate} from '../../../../src/lib/storage-utils';
|
|
import {readFile} from '../../../functional/lib/test.utils';
|
|
|
|
const readMetadata = (fileName: string = 'metadata') => readFile(`../../unit/partials/${fileName}`);
|
|
|
|
import {
|
|
Config as AppConfig,
|
|
IPluginMiddleware,
|
|
IStorageManager,
|
|
RemoteUser,
|
|
IBasicAuth,
|
|
} from '@verdaccio/types';
|
|
import { IUploadTarball, IReadTarball } from '@verdaccio/streams';
|
|
|
|
export default class ExampleMiddlewarePlugin implements IPluginMiddleware {
|
|
register_middlewares(app: any, auth: IBasicAuth, storage: IStorageManager): void {
|
|
const remoteUser: RemoteUser = {
|
|
groups: [],
|
|
real_groups: [],
|
|
name: 'test'
|
|
};
|
|
auth.authenticate('user', 'password', () => {});
|
|
auth.allow_access({packageName: 'packageName'}, remoteUser, () => {});
|
|
auth.add_user('user', 'password', () => {});
|
|
auth.aesEncrypt(new Buffer('pass'));
|
|
// storage
|
|
storage.addPackage('name', generatePackageTemplate('test'), () => {});
|
|
storage.addVersion('name', 'version', readMetadata(), 'tag', () => {});
|
|
storage.mergeTags('name', {'latest': '1.0.0'}, () => {});
|
|
storage.changePackage('name', readMetadata(), 'revision', () => {});
|
|
storage.removePackage('name', () => {});
|
|
storage.mergeTags('name', {'latest': '1.0.0'}, () => {});
|
|
storage.removeTarball('name', 'filename', 'revision', () => {});
|
|
/* eslint no-unused-vars: 0 */
|
|
const config1: AppConfig = new Config({
|
|
storage: './storage',
|
|
self_path: '/home/sotrage'
|
|
});
|
|
const add: IUploadTarball = storage.addTarball('name', 'filename');
|
|
storage.getTarball('name', 'filename');
|
|
const read: IReadTarball = storage.getTarball('name', 'filename');
|
|
const search: IReadTarball = storage.search('test');
|
|
/* eslint no-unused-vars: 0 */
|
|
}
|
|
}
|
|
|