mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
* #2606 add prettier plugin sort imprts * #2606 update pnpm-lock.yaml * #2606 update eslint rules * #2606 fixes website directory formatting Co-authored-by: Ayush Sharma <ayush.sharma@trivago.com>
This commit is contained in:
parent
16458f801e
commit
13310814da
407 changed files with 1196 additions and 1141 deletions
11
.prettierrc
11
.prettierrc
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"endOfLine": "lf",
|
|
||||||
"useTabs": false,
|
|
||||||
"printWidth": 100,
|
|
||||||
"tabWidth": 2,
|
|
||||||
"singleQuote": true,
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"jsxBracketSameLine": true,
|
|
||||||
"trailingComma": "es5",
|
|
||||||
"semi": true
|
|
||||||
}
|
|
|
@ -42,6 +42,7 @@
|
||||||
"@changesets/cli": "2.15.0",
|
"@changesets/cli": "2.15.0",
|
||||||
"@changesets/get-dependents-graph": "1.2.2",
|
"@changesets/get-dependents-graph": "1.2.2",
|
||||||
"@crowdin/cli": "3.7.1",
|
"@crowdin/cli": "3.7.1",
|
||||||
|
"@trivago/prettier-plugin-sort-imports": "3.0.0",
|
||||||
"@types/async": "3.2.7",
|
"@types/async": "3.2.7",
|
||||||
"@types/autocannon": "4.1.1",
|
"@types/autocannon": "4.1.1",
|
||||||
"@types/autosuggest-highlight": "3.1.1",
|
"@types/autosuggest-highlight": "3.1.1",
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import mime from 'mime';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import mime from 'mime';
|
||||||
|
|
||||||
import { media, allow } from '@verdaccio/middleware';
|
|
||||||
import { constants, VerdaccioError } from '@verdaccio/core';
|
|
||||||
import { Package } from '@verdaccio/types';
|
|
||||||
import { Storage } from '@verdaccio/store';
|
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
|
import { VerdaccioError, constants } from '@verdaccio/core';
|
||||||
|
import { allow, media } from '@verdaccio/middleware';
|
||||||
|
import { Storage } from '@verdaccio/store';
|
||||||
|
import { Package } from '@verdaccio/types';
|
||||||
|
|
||||||
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
|
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
|
||||||
|
|
||||||
export default function (route: Router, auth: IAuth, storage: Storage): void {
|
export default function (route: Router, auth: IAuth, storage: Storage): void {
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
|
import bodyParser from 'body-parser';
|
||||||
import express, { Router } from 'express';
|
import express, { Router } from 'express';
|
||||||
|
import semver from 'semver';
|
||||||
|
|
||||||
|
import { IAuth } from '@verdaccio/auth';
|
||||||
import {
|
import {
|
||||||
|
antiLoop,
|
||||||
|
encodeScopePackage,
|
||||||
match,
|
match,
|
||||||
validateName,
|
validateName,
|
||||||
validatePackage,
|
validatePackage,
|
||||||
encodeScopePackage,
|
|
||||||
antiLoop,
|
|
||||||
} from '@verdaccio/middleware';
|
} from '@verdaccio/middleware';
|
||||||
import { IAuth } from '@verdaccio/auth';
|
|
||||||
import { Storage } from '@verdaccio/store';
|
import { Storage } from '@verdaccio/store';
|
||||||
import { Config } from '@verdaccio/types';
|
import { Config } from '@verdaccio/types';
|
||||||
import bodyParser from 'body-parser';
|
|
||||||
import semver from 'semver';
|
|
||||||
|
|
||||||
import whoami from './whoami';
|
|
||||||
import ping from './ping';
|
|
||||||
import user from './user';
|
|
||||||
import distTags from './dist-tags';
|
import distTags from './dist-tags';
|
||||||
|
import pkg from './package';
|
||||||
|
import ping from './ping';
|
||||||
import publish from './publish';
|
import publish from './publish';
|
||||||
import search from './search';
|
import search from './search';
|
||||||
import pkg from './package';
|
|
||||||
import stars from './stars';
|
import stars from './stars';
|
||||||
|
import user from './user';
|
||||||
import profile from './v1/profile';
|
import profile from './v1/profile';
|
||||||
import token from './v1/token';
|
|
||||||
import v1Search from './v1/search';
|
import v1Search from './v1/search';
|
||||||
|
import token from './v1/token';
|
||||||
|
import whoami from './whoami';
|
||||||
|
|
||||||
if (semver.lte(process.version, 'v15.0.0')) {
|
if (semver.lte(process.version, 'v15.0.0')) {
|
||||||
global.AbortController = require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController;
|
global.AbortController = require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController;
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { Router } from 'express';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import { Router } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { allow } from '@verdaccio/middleware';
|
|
||||||
import { getVersion } from '@verdaccio/utils';
|
|
||||||
import { HEADERS, DIST_TAGS, API_ERROR, errorUtils } from '@verdaccio/core';
|
|
||||||
import { Config, Package } from '@verdaccio/types';
|
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
|
import { API_ERROR, DIST_TAGS, HEADERS, errorUtils } from '@verdaccio/core';
|
||||||
|
import { allow } from '@verdaccio/middleware';
|
||||||
import { Storage } from '@verdaccio/store';
|
import { Storage } from '@verdaccio/store';
|
||||||
import { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball';
|
import { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball';
|
||||||
import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom';
|
import { Config, Package } from '@verdaccio/types';
|
||||||
|
import { getVersion } from '@verdaccio/utils';
|
||||||
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:package');
|
const debug = buildDebug('verdaccio:api:package');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom';
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
|
||||||
|
|
||||||
export default function (route: Router): void {
|
export default function (route: Router): void {
|
||||||
route.get(
|
route.get(
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
import Path from 'path';
|
import buildDebug from 'debug';
|
||||||
|
import { Router } from 'express';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import mime from 'mime';
|
import mime from 'mime';
|
||||||
import { Router } from 'express';
|
import Path from 'path';
|
||||||
import buildDebug from 'debug';
|
|
||||||
|
|
||||||
|
import { IAuth } from '@verdaccio/auth';
|
||||||
import {
|
import {
|
||||||
API_MESSAGE,
|
|
||||||
HEADERS,
|
|
||||||
DIST_TAGS,
|
|
||||||
API_ERROR,
|
API_ERROR,
|
||||||
|
API_MESSAGE,
|
||||||
|
DIST_TAGS,
|
||||||
|
HEADERS,
|
||||||
HTTP_STATUS,
|
HTTP_STATUS,
|
||||||
errorUtils,
|
errorUtils,
|
||||||
} from '@verdaccio/core';
|
} from '@verdaccio/core';
|
||||||
import { validateMetadata, isObject, hasDiffOneKey } from '@verdaccio/utils';
|
|
||||||
import { media, expectJson, allow } from '@verdaccio/middleware';
|
|
||||||
import { notify } from '@verdaccio/hooks';
|
import { notify } from '@verdaccio/hooks';
|
||||||
import { Config, Callback, MergeTags, Version, Package, CallbackAction } from '@verdaccio/types';
|
|
||||||
import { logger } from '@verdaccio/logger';
|
import { logger } from '@verdaccio/logger';
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { allow, expectJson, media } from '@verdaccio/middleware';
|
||||||
import { Storage } from '@verdaccio/store';
|
import { Storage } from '@verdaccio/store';
|
||||||
import { $RequestExtend, $ResponseExtend, $NextFunctionVer } from '../types/custom';
|
import { Callback, CallbackAction, Config, MergeTags, Package, Version } from '@verdaccio/types';
|
||||||
|
import { hasDiffOneKey, isObject, validateMetadata } from '@verdaccio/utils';
|
||||||
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
|
||||||
import star from './star';
|
import star from './star';
|
||||||
import { isPublishablePackage, isRelatedToDeprecation } from './utils';
|
import { isPublishablePackage, isRelatedToDeprecation } from './utils';
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { USERS, HTTP_STATUS } from '@verdaccio/core';
|
import buildDebug from 'debug';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import buildDebug from 'debug';
|
|
||||||
|
|
||||||
|
import { HTTP_STATUS, USERS } from '@verdaccio/core';
|
||||||
import { Storage } from '@verdaccio/store';
|
import { Storage } from '@verdaccio/store';
|
||||||
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:publish:star');
|
const debug = buildDebug('verdaccio:api:publish:star');
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { Response, Router } from 'express';
|
import { Response, Router } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { USERS, HTTP_STATUS } from '@verdaccio/core';
|
import { HTTP_STATUS, USERS } from '@verdaccio/core';
|
||||||
|
import { Storage } from '@verdaccio/store';
|
||||||
import { Package } from '@verdaccio/types';
|
import { Package } from '@verdaccio/types';
|
||||||
|
|
||||||
import { Storage } from '@verdaccio/store';
|
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
|
||||||
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
|
|
||||||
|
|
||||||
type Packages = Package[];
|
type Packages = Package[];
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { Response, Router } from 'express';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import { Response, Router } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
|
|
||||||
import { getApiToken } from '@verdaccio/auth';
|
import { getApiToken } from '@verdaccio/auth';
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { createRemoteUser } from '@verdaccio/config';
|
|
||||||
|
|
||||||
import { Config, RemoteUser } from '@verdaccio/types';
|
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
|
import { createRemoteUser } from '@verdaccio/config';
|
||||||
import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils } from '@verdaccio/core';
|
import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils } from '@verdaccio/core';
|
||||||
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
|
import { logger } from '@verdaccio/logger';
|
||||||
|
import { Config, RemoteUser } from '@verdaccio/types';
|
||||||
|
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
|
||||||
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:user');
|
const debug = buildDebug('verdaccio:api:user');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Package } from '@verdaccio/types';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import { Package } from '@verdaccio/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the package metadta has enough data to be published
|
* Check whether the package metadta has enough data to be published
|
||||||
* @param pkg metadata
|
* @param pkg metadata
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { Response, Router } from 'express';
|
import { Response, Router } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import { IAuth } from '@verdaccio/auth';
|
||||||
import { API_ERROR, APP_ERROR, HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core';
|
import { API_ERROR, APP_ERROR, HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core';
|
||||||
import { validatePassword } from '@verdaccio/utils';
|
import { validatePassword } from '@verdaccio/utils';
|
||||||
import { IAuth } from '@verdaccio/auth';
|
|
||||||
import { $RequestExtend, $NextFunctionVer } from '../../types/custom';
|
import { $NextFunctionVer, $RequestExtend } from '../../types/custom';
|
||||||
|
|
||||||
export interface Profile {
|
export interface Profile {
|
||||||
tfa: boolean;
|
tfa: boolean;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
import { logger } from '@verdaccio/logger';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
import { HTTP_STATUS, searchUtils } from '@verdaccio/core';
|
import { HTTP_STATUS, searchUtils } from '@verdaccio/core';
|
||||||
|
import { logger } from '@verdaccio/logger';
|
||||||
import { Storage } from '@verdaccio/store';
|
import { Storage } from '@verdaccio/store';
|
||||||
import { Package } from '@verdaccio/types';
|
import { Package } from '@verdaccio/types';
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { errorUtils, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/core';
|
|
||||||
import { stringToMD5, mask } from '@verdaccio/utils';
|
|
||||||
import { getApiToken } from '@verdaccio/auth';
|
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { Response, Router } from 'express';
|
import { Response, Router } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { Config, RemoteUser, Token } from '@verdaccio/types';
|
import { getApiToken } from '@verdaccio/auth';
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
|
import { HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core';
|
||||||
|
import { logger } from '@verdaccio/logger';
|
||||||
import { Storage } from '@verdaccio/store';
|
import { Storage } from '@verdaccio/store';
|
||||||
import { $RequestExtend, $NextFunctionVer } from '../../types/custom';
|
import { Config, RemoteUser, Token } from '@verdaccio/types';
|
||||||
|
import { mask, stringToMD5 } from '@verdaccio/utils';
|
||||||
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend } from '../../types/custom';
|
||||||
|
|
||||||
export type NormalizeToken = Token & {
|
export type NormalizeToken = Token & {
|
||||||
created: string;
|
created: string;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Response, Router } from 'express';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
import { $RequestExtend, $NextFunctionVer } from '../types/custom';
|
import { Response, Router } from 'express';
|
||||||
|
|
||||||
|
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:user');
|
const debug = buildDebug('verdaccio:api:user');
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import path from 'path';
|
|
||||||
import express, { Application } from 'express';
|
|
||||||
import supertest from 'supertest';
|
|
||||||
import bodyParser from 'body-parser';
|
import bodyParser from 'body-parser';
|
||||||
|
import express, { Application } from 'express';
|
||||||
|
import path from 'path';
|
||||||
|
import supertest from 'supertest';
|
||||||
|
|
||||||
import { Config, parseConfigFile } from '@verdaccio/config';
|
|
||||||
import { Storage } from '@verdaccio/store';
|
|
||||||
import { generatePackageMetadata } from '@verdaccio/helper';
|
|
||||||
import { final, handleError, errorReportingMiddleware } from '@verdaccio/middleware';
|
|
||||||
import { Auth, IAuth } from '@verdaccio/auth';
|
import { Auth, IAuth } from '@verdaccio/auth';
|
||||||
|
import { Config, parseConfigFile } from '@verdaccio/config';
|
||||||
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
|
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
|
||||||
|
import { generatePackageMetadata } from '@verdaccio/helper';
|
||||||
|
import { errorReportingMiddleware, final, handleError } from '@verdaccio/middleware';
|
||||||
|
import { Storage } from '@verdaccio/store';
|
||||||
|
|
||||||
import apiEndpoints from '../../src';
|
import apiEndpoints from '../../src';
|
||||||
|
|
||||||
const getConf = (conf) => {
|
const getConf = (conf) => {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import supertest from 'supertest';
|
import supertest from 'supertest';
|
||||||
|
|
||||||
import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core';
|
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
|
||||||
import { $ResponseExtend, $RequestExtend } from '../../types/custom';
|
|
||||||
|
import { $RequestExtend, $ResponseExtend } from '../../types/custom';
|
||||||
import { initializeServer, publishTaggedVersion, publishVersion } from './_helper';
|
import { initializeServer, publishTaggedVersion, publishVersion } from './_helper';
|
||||||
|
|
||||||
const mockApiJWTmiddleware = jest.fn(
|
const mockApiJWTmiddleware = jest.fn(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import supertest from 'supertest';
|
import supertest from 'supertest';
|
||||||
|
|
||||||
import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core';
|
import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
|
||||||
|
|
||||||
import { initializeServer } from './_helper';
|
import { initializeServer } from './_helper';
|
||||||
|
|
||||||
describe('ping', () => {
|
describe('ping', () => {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { HTTP_STATUS } from '@verdaccio/core';
|
|
||||||
import supertest from 'supertest';
|
import supertest from 'supertest';
|
||||||
import { API_ERROR, API_MESSAGE, HEADER_TYPE, HEADERS } from '@verdaccio/core';
|
|
||||||
|
import { HTTP_STATUS } from '@verdaccio/core';
|
||||||
|
import { API_ERROR, API_MESSAGE, HEADERS, HEADER_TYPE } from '@verdaccio/core';
|
||||||
import { generatePackageMetadata } from '@verdaccio/helper';
|
import { generatePackageMetadata } from '@verdaccio/helper';
|
||||||
import { $ResponseExtend, $RequestExtend } from '../../types/custom';
|
|
||||||
|
import { $RequestExtend, $ResponseExtend } from '../../types/custom';
|
||||||
import { initializeServer, publishVersion } from './_helper';
|
import { initializeServer, publishVersion } from './_helper';
|
||||||
|
|
||||||
const mockApiJWTmiddleware = jest.fn(
|
const mockApiJWTmiddleware = jest.fn(
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import supertest from 'supertest';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import supertest from 'supertest';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
errorUtils,
|
API_ERROR,
|
||||||
|
API_MESSAGE,
|
||||||
HEADERS,
|
HEADERS,
|
||||||
HEADER_TYPE,
|
HEADER_TYPE,
|
||||||
API_MESSAGE,
|
|
||||||
HTTP_STATUS,
|
HTTP_STATUS,
|
||||||
API_ERROR,
|
errorUtils,
|
||||||
} from '@verdaccio/core';
|
} from '@verdaccio/core';
|
||||||
|
|
||||||
import { $RequestExtend, $ResponseExtend } from '../../types/custom';
|
import { $RequestExtend, $ResponseExtend } from '../../types/custom';
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { errorUtils, HTTP_STATUS, API_ERROR } from '@verdaccio/core';
|
import { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addVersion,
|
addVersion,
|
||||||
uploadPackageTarball,
|
publishPackage,
|
||||||
removeTarball,
|
removeTarball,
|
||||||
unPublishPackage,
|
unPublishPackage,
|
||||||
publishPackage,
|
uploadPackageTarball,
|
||||||
} from '../../src/publish';
|
} from '../../src/publish';
|
||||||
|
|
||||||
const REVISION_MOCK = '15-e53a77096b0ee33e';
|
const REVISION_MOCK = '15-e53a77096b0ee33e';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-disable curly */
|
/* eslint-disable curly */
|
||||||
// ensure that all arguments are validated
|
// ensure that all arguments are validated
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate.
|
* Validate.
|
||||||
|
|
3
packages/api/types/custom.d.ts
vendored
3
packages/api/types/custom.d.ts
vendored
|
@ -1,6 +1,7 @@
|
||||||
import { Logger, RemoteUser } from '@verdaccio/types';
|
|
||||||
import { NextFunction, Request, Response } from 'express';
|
import { NextFunction, Request, Response } from 'express';
|
||||||
|
|
||||||
|
import { Logger, RemoteUser } from '@verdaccio/types';
|
||||||
|
|
||||||
export type $RequestExtend = Request & { remote_user?: any; log: Logger };
|
export type $RequestExtend = Request & { remote_user?: any; log: Logger };
|
||||||
export type $ResponseExtend = Response & { cookies?: any };
|
export type $ResponseExtend = Response & { cookies?: any };
|
||||||
export type $NextFunctionVer = NextFunction & any;
|
export type $NextFunctionVer = NextFunction & any;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import { NextFunction, Request, Response } from 'express';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import { NextFunction, Request, Response } from 'express';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import { HTPasswd, HTPasswdConfig } from 'verdaccio-htpasswd';
|
||||||
|
|
||||||
|
import { createAnonymousRemoteUser, createRemoteUser } from '@verdaccio/config';
|
||||||
import {
|
import {
|
||||||
API_ERROR,
|
API_ERROR,
|
||||||
SUPPORT_ERRORS,
|
SUPPORT_ERRORS,
|
||||||
|
@ -11,38 +13,33 @@ import {
|
||||||
errorUtils,
|
errorUtils,
|
||||||
} from '@verdaccio/core';
|
} from '@verdaccio/core';
|
||||||
import { loadPlugin } from '@verdaccio/loaders';
|
import { loadPlugin } from '@verdaccio/loaders';
|
||||||
import { HTPasswd, HTPasswdConfig } from 'verdaccio-htpasswd';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Config,
|
|
||||||
Logger,
|
|
||||||
Callback,
|
|
||||||
IPluginAuth,
|
|
||||||
RemoteUser,
|
|
||||||
JWTSignOptions,
|
|
||||||
Security,
|
|
||||||
AuthPluginPackage,
|
|
||||||
AllowAccess,
|
AllowAccess,
|
||||||
|
AuthPluginPackage,
|
||||||
|
Callback,
|
||||||
|
Config,
|
||||||
|
IPluginAuth,
|
||||||
|
JWTSignOptions,
|
||||||
|
Logger,
|
||||||
PackageAccess,
|
PackageAccess,
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
|
RemoteUser,
|
||||||
|
Security,
|
||||||
} from '@verdaccio/types';
|
} from '@verdaccio/types';
|
||||||
|
import { getMatchedPackagesSpec, isFunction, isNil } from '@verdaccio/utils';
|
||||||
import { getMatchedPackagesSpec, isNil, isFunction } from '@verdaccio/utils';
|
|
||||||
import { createAnonymousRemoteUser, createRemoteUser } from '@verdaccio/config';
|
|
||||||
|
|
||||||
import {
|
|
||||||
getMiddlewareCredentials,
|
|
||||||
getDefaultPlugins,
|
|
||||||
verifyJWTPayload,
|
|
||||||
parseAuthTokenHeader,
|
|
||||||
isAuthHeaderValid,
|
|
||||||
isAESLegacy,
|
|
||||||
convertPayloadToBase64,
|
|
||||||
} from './utils';
|
|
||||||
|
|
||||||
import { signPayload } from './jwt-token';
|
import { signPayload } from './jwt-token';
|
||||||
import { aesEncrypt } from './legacy-token';
|
import { aesEncrypt } from './legacy-token';
|
||||||
import { parseBasicPayload } from './token';
|
import { parseBasicPayload } from './token';
|
||||||
|
import {
|
||||||
|
convertPayloadToBase64,
|
||||||
|
getDefaultPlugins,
|
||||||
|
getMiddlewareCredentials,
|
||||||
|
isAESLegacy,
|
||||||
|
isAuthHeaderValid,
|
||||||
|
parseAuthTokenHeader,
|
||||||
|
verifyJWTPayload,
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const LoggerApi = require('@verdaccio/logger');
|
const LoggerApi = require('@verdaccio/logger');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import jwt from 'jsonwebtoken';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import jwt from 'jsonwebtoken';
|
||||||
|
|
||||||
import { JWTSignOptions, RemoteUser } from '@verdaccio/types';
|
import { JWTSignOptions, RemoteUser } from '@verdaccio/types';
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import {
|
import {
|
||||||
|
HexBase64BinaryEncoding,
|
||||||
|
Utf8AsciiBinaryEncoding,
|
||||||
createCipheriv,
|
createCipheriv,
|
||||||
createDecipheriv,
|
createDecipheriv,
|
||||||
HexBase64BinaryEncoding,
|
|
||||||
randomBytes,
|
randomBytes,
|
||||||
Utf8AsciiBinaryEncoding,
|
|
||||||
} from 'crypto';
|
} from 'crypto';
|
||||||
import { TOKEN_VALID_LENGTH } from '@verdaccio/config';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
|
||||||
|
import { TOKEN_VALID_LENGTH } from '@verdaccio/config';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:auth:token:legacy');
|
const debug = buildDebug('verdaccio:auth:token:legacy');
|
||||||
|
|
||||||
export const defaultAlgorithm = process.env.VERDACCIO_LEGACY_ALGORITHM || 'aes-256-ctr';
|
export const defaultAlgorithm = process.env.VERDACCIO_LEGACY_ALGORITHM || 'aes-256-ctr';
|
||||||
|
|
|
@ -1,26 +1,27 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import { createAnonymousRemoteUser } from '@verdaccio/config';
|
||||||
import {
|
import {
|
||||||
|
API_ERROR,
|
||||||
|
HTTP_STATUS,
|
||||||
|
TOKEN_BASIC,
|
||||||
|
TOKEN_BEARER,
|
||||||
|
VerdaccioError,
|
||||||
|
errorUtils,
|
||||||
|
} from '@verdaccio/core';
|
||||||
|
import {
|
||||||
|
AuthPackageAllow,
|
||||||
Callback,
|
Callback,
|
||||||
Config,
|
Config,
|
||||||
IPluginAuth,
|
IPluginAuth,
|
||||||
RemoteUser,
|
RemoteUser,
|
||||||
Security,
|
Security,
|
||||||
AuthPackageAllow,
|
|
||||||
} from '@verdaccio/types';
|
} from '@verdaccio/types';
|
||||||
import {
|
|
||||||
HTTP_STATUS,
|
|
||||||
TOKEN_BASIC,
|
|
||||||
TOKEN_BEARER,
|
|
||||||
API_ERROR,
|
|
||||||
VerdaccioError,
|
|
||||||
errorUtils,
|
|
||||||
} from '@verdaccio/core';
|
|
||||||
|
|
||||||
import { createAnonymousRemoteUser } from '@verdaccio/config';
|
import { AESPayload, TokenEncryption } from './auth';
|
||||||
import { TokenEncryption, AESPayload } from './auth';
|
|
||||||
import { aesDecrypt } from './legacy-token';
|
|
||||||
import { verifyPayload } from './jwt-token';
|
import { verifyPayload } from './jwt-token';
|
||||||
|
import { aesDecrypt } from './legacy-token';
|
||||||
import { parseBasicPayload } from './token';
|
import { parseBasicPayload } from './token';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:auth:utils');
|
const debug = buildDebug('verdaccio:auth:utils');
|
||||||
|
|
|
@ -1,43 +1,42 @@
|
||||||
import path from 'path';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import { configExample } from '@verdaccio/mock';
|
|
||||||
import {
|
import {
|
||||||
Config as AppConfig,
|
Config as AppConfig,
|
||||||
parseConfigFile,
|
|
||||||
ROLES,
|
ROLES,
|
||||||
createRemoteUser,
|
|
||||||
createAnonymousRemoteUser,
|
createAnonymousRemoteUser,
|
||||||
|
createRemoteUser,
|
||||||
|
parseConfigFile,
|
||||||
} from '@verdaccio/config';
|
} from '@verdaccio/config';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getAuthenticatedMessage,
|
API_ERROR,
|
||||||
buildToken,
|
|
||||||
AllowActionCallbackResponse,
|
|
||||||
buildUserBuffer,
|
|
||||||
} from '@verdaccio/utils';
|
|
||||||
|
|
||||||
import { Config, Security, RemoteUser } from '@verdaccio/types';
|
|
||||||
import {
|
|
||||||
VerdaccioError,
|
|
||||||
CHARACTER_ENCODING,
|
CHARACTER_ENCODING,
|
||||||
TOKEN_BEARER,
|
TOKEN_BEARER,
|
||||||
API_ERROR,
|
VerdaccioError,
|
||||||
errorUtils,
|
errorUtils,
|
||||||
} from '@verdaccio/core';
|
} from '@verdaccio/core';
|
||||||
import { setup } from '@verdaccio/logger';
|
import { setup } from '@verdaccio/logger';
|
||||||
|
import { configExample } from '@verdaccio/mock';
|
||||||
|
import { Config, RemoteUser, Security } from '@verdaccio/types';
|
||||||
|
import {
|
||||||
|
AllowActionCallbackResponse,
|
||||||
|
buildToken,
|
||||||
|
buildUserBuffer,
|
||||||
|
getAuthenticatedMessage,
|
||||||
|
} from '@verdaccio/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IAuth,
|
|
||||||
Auth,
|
|
||||||
ActionsAllowed,
|
ActionsAllowed,
|
||||||
|
Auth,
|
||||||
|
IAuth,
|
||||||
|
aesDecrypt,
|
||||||
allow_action,
|
allow_action,
|
||||||
|
getApiToken,
|
||||||
getDefaultPlugins,
|
getDefaultPlugins,
|
||||||
getMiddlewareCredentials,
|
getMiddlewareCredentials,
|
||||||
getApiToken,
|
|
||||||
verifyJWTPayload,
|
|
||||||
aesDecrypt,
|
|
||||||
verifyPayload,
|
|
||||||
signPayload,
|
signPayload,
|
||||||
|
verifyJWTPayload,
|
||||||
|
verifyPayload,
|
||||||
} from '../src';
|
} from '../src';
|
||||||
|
|
||||||
setup([]);
|
setup([]);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { ROLES, Config as AppConfig } from '@verdaccio/config';
|
|
||||||
import { setup } from '@verdaccio/logger';
|
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
import { Config } from '@verdaccio/types';
|
import { Config as AppConfig, ROLES } from '@verdaccio/config';
|
||||||
import { errorUtils } from '@verdaccio/core';
|
import { errorUtils } from '@verdaccio/core';
|
||||||
|
import { setup } from '@verdaccio/logger';
|
||||||
|
import { Config } from '@verdaccio/types';
|
||||||
|
|
||||||
import { Auth } from '../src';
|
import { Auth } from '../src';
|
||||||
|
import { authPluginFailureConf, authPluginPassThrougConf, authProfileConf } from './helper/plugin';
|
||||||
import { authProfileConf, authPluginFailureConf, authPluginPassThrougConf } from './helper/plugin';
|
|
||||||
|
|
||||||
setup([]);
|
setup([]);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { configExample as config } from '@verdaccio/mock';
|
import { configExample as config } from '@verdaccio/mock';
|
||||||
|
|
||||||
export const authProfileConf = config({
|
export const authProfileConf = config({
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { Cli } from 'clipanion';
|
import { Cli } from 'clipanion';
|
||||||
|
|
||||||
import { warningUtils } from '@verdaccio/core';
|
import { warningUtils } from '@verdaccio/core';
|
||||||
|
|
||||||
|
import { FastifyServer } from './commands/FastifyServer';
|
||||||
import { InfoCommand } from './commands/info';
|
import { InfoCommand } from './commands/info';
|
||||||
import { InitCommand } from './commands/init';
|
import { InitCommand } from './commands/init';
|
||||||
import { VersionCommand } from './commands/version';
|
import { VersionCommand } from './commands/version';
|
||||||
import { FastifyServer } from './commands/FastifyServer';
|
import { MIN_NODE_VERSION, isVersionValid } from './utils';
|
||||||
import { isVersionValid, MIN_NODE_VERSION } from './utils';
|
|
||||||
|
|
||||||
if (process.getuid && process.getuid() === 0) {
|
if (process.getuid && process.getuid() === 0) {
|
||||||
warningUtils.emit(warningUtils.Codes.VERWAR001);
|
warningUtils.emit(warningUtils.Codes.VERWAR001);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { Command, Option } from 'clipanion';
|
import { Command, Option } from 'clipanion';
|
||||||
|
|
||||||
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
||||||
import { setup, logger } from '@verdaccio/logger';
|
|
||||||
import server from '@verdaccio/fastify-migration';
|
import server from '@verdaccio/fastify-migration';
|
||||||
|
import { logger, setup } from '@verdaccio/logger';
|
||||||
import { ConfigRuntime } from '@verdaccio/types';
|
import { ConfigRuntime } from '@verdaccio/types';
|
||||||
|
|
||||||
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import envinfo from 'envinfo';
|
|
||||||
import { Command } from 'clipanion';
|
import { Command } from 'clipanion';
|
||||||
|
import envinfo from 'envinfo';
|
||||||
|
|
||||||
export class InfoCommand extends Command {
|
export class InfoCommand extends Command {
|
||||||
public static paths = [[`--info`], [`-i`]];
|
public static paths = [[`--info`], [`-i`]];
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { Command, Option } from 'clipanion';
|
import { Command, Option } from 'clipanion';
|
||||||
|
|
||||||
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
||||||
import { setup, logger } from '@verdaccio/logger';
|
import { warningUtils } from '@verdaccio/core';
|
||||||
|
import { logger, setup } from '@verdaccio/logger';
|
||||||
import { initServer } from '@verdaccio/node-api';
|
import { initServer } from '@verdaccio/node-api';
|
||||||
import { ConfigRuntime } from '@verdaccio/types';
|
import { ConfigRuntime } from '@verdaccio/types';
|
||||||
import { warningUtils } from '@verdaccio/core';
|
|
||||||
|
|
||||||
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import fs from 'fs';
|
|
||||||
import path from 'path';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import fs from 'fs';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import { CHARACTER_ENCODING } from '@verdaccio/core';
|
import { CHARACTER_ENCODING } from '@verdaccio/core';
|
||||||
import { folderExists, fileExists } from './config-utils';
|
|
||||||
|
import { fileExists, folderExists } from './config-utils';
|
||||||
|
|
||||||
const CONFIG_FILE = 'config.yaml';
|
const CONFIG_FILE = 'config.yaml';
|
||||||
const XDG = 'xdg';
|
const XDG = 'xdg';
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { getMatchedPackagesSpec, generateRandomHexString, isObject } from '@verdaccio/utils';
|
|
||||||
import { APP_ERROR } from '@verdaccio/core';
|
import { APP_ERROR } from '@verdaccio/core';
|
||||||
import {
|
import {
|
||||||
PackageList,
|
|
||||||
Config as AppConfig,
|
Config as AppConfig,
|
||||||
ConfigRuntime,
|
|
||||||
Security,
|
|
||||||
PackageAccess,
|
|
||||||
ServerSettingsConf,
|
|
||||||
AuthConf,
|
AuthConf,
|
||||||
|
ConfigRuntime,
|
||||||
|
PackageAccess,
|
||||||
|
PackageList,
|
||||||
|
Security,
|
||||||
|
ServerSettingsConf,
|
||||||
} from '@verdaccio/types';
|
} from '@verdaccio/types';
|
||||||
|
import { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils';
|
||||||
|
|
||||||
import { generateRandomSecretKey } from './token';
|
|
||||||
import { normalisePackageAccess } from './package-access';
|
|
||||||
import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';
|
|
||||||
import { defaultSecurity } from './security';
|
|
||||||
import { getUserAgent } from './agent';
|
import { getUserAgent } from './agent';
|
||||||
|
import { normalisePackageAccess } from './package-access';
|
||||||
|
import { defaultSecurity } from './security';
|
||||||
import serverSettings from './serverSettings';
|
import serverSettings from './serverSettings';
|
||||||
|
import { generateRandomSecretKey } from './token';
|
||||||
|
import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';
|
||||||
|
|
||||||
const strategicConfigProps = ['uplinks', 'packages'];
|
const strategicConfigProps = ['uplinks', 'packages'];
|
||||||
const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];
|
const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { PackageAccess } from '@verdaccio/types';
|
|
||||||
import { errorUtils } from '@verdaccio/core';
|
import { errorUtils } from '@verdaccio/core';
|
||||||
|
import { PackageAccess } from '@verdaccio/types';
|
||||||
|
|
||||||
export interface LegacyPackageList {
|
export interface LegacyPackageList {
|
||||||
[key: string]: PackageAccess;
|
[key: string]: PackageAccess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import YAML from 'js-yaml';
|
import YAML from 'js-yaml';
|
||||||
|
|
||||||
import { APP_ERROR } from '@verdaccio/core';
|
import { APP_ERROR } from '@verdaccio/core';
|
||||||
import { ConfigRuntime, ConfigYaml } from '@verdaccio/types';
|
import { ConfigRuntime, ConfigYaml } from '@verdaccio/types';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { getMatchedPackagesSpec } from '@verdaccio/utils';
|
|
||||||
import { PackageList, UpLinksConfList } from '@verdaccio/types';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import { PackageList, UpLinksConfList } from '@verdaccio/types';
|
||||||
|
import { getMatchedPackagesSpec } from '@verdaccio/utils';
|
||||||
|
|
||||||
export const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
export const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
||||||
export const DEFAULT_UPLINK = 'npmjs';
|
export const DEFAULT_UPLINK = 'npmjs';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import { findConfigFile } from '../src/config-path';
|
import { findConfigFile } from '../src/config-path';
|
||||||
|
|
||||||
const mockmkDir = jest.fn();
|
const mockmkDir = jest.fn();
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import path from 'path';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Config,
|
Config,
|
||||||
DEFAULT_REGISTRY,
|
DEFAULT_REGISTRY,
|
||||||
DEFAULT_UPLINK,
|
DEFAULT_UPLINK,
|
||||||
defaultSecurity,
|
|
||||||
parseConfigFile,
|
|
||||||
ROLES,
|
ROLES,
|
||||||
WEB_TITLE,
|
WEB_TITLE,
|
||||||
|
defaultSecurity,
|
||||||
|
parseConfigFile,
|
||||||
} from '../src';
|
} from '../src';
|
||||||
import { parseConfigurationFile } from './utils';
|
import { parseConfigurationFile } from './utils';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { normalisePackageAccess, PACKAGE_ACCESS } from '../src/package-access';
|
|
||||||
import { parseConfigFile } from '../src';
|
import { parseConfigFile } from '../src';
|
||||||
|
import { PACKAGE_ACCESS, normalisePackageAccess } from '../src/package-access';
|
||||||
import { parseConfigurationFile } from './utils';
|
import { parseConfigurationFile } from './utils';
|
||||||
|
|
||||||
describe('Package access utilities', () => {
|
describe('Package access utilities', () => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { generateRandomSecretKey, TOKEN_VALID_LENGTH } from '../src/token';
|
import { TOKEN_VALID_LENGTH, generateRandomSecretKey } from '../src/token';
|
||||||
|
|
||||||
test('token test valid length', () => {
|
test('token test valid length', () => {
|
||||||
const token = generateRandomSecretKey();
|
const token = generateRandomSecretKey();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks';
|
|
||||||
import { normalisePackageAccess, parseConfigFile } from '../src';
|
import { normalisePackageAccess, parseConfigFile } from '../src';
|
||||||
|
import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks';
|
||||||
import { parseConfigurationFile } from './utils';
|
import { parseConfigurationFile } from './utils';
|
||||||
|
|
||||||
describe('Uplinks Utilities', () => {
|
describe('Uplinks Utilities', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { ROLES, createAnonymousRemoteUser, createRemoteUser } from '../src';
|
||||||
import { spliceURL } from '../src/string';
|
import { spliceURL } from '../src/string';
|
||||||
import { createAnonymousRemoteUser, createRemoteUser, ROLES } from '../src';
|
|
||||||
|
|
||||||
describe('spliceURL', () => {
|
describe('spliceURL', () => {
|
||||||
test('should splice two strings and generate a url', () => {
|
test('should splice two strings and generate a url', () => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import createError, { HttpError } from 'http-errors';
|
import createError, { HttpError } from 'http-errors';
|
||||||
|
|
||||||
import { DEFAULT_MIN_LIMIT_PASSWORD, HTTP_STATUS } from './constants';
|
import { DEFAULT_MIN_LIMIT_PASSWORD, HTTP_STATUS } from './constants';
|
||||||
|
|
||||||
export const API_ERROR = {
|
export const API_ERROR = {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import * as searchUtils from './search-utils';
|
|
||||||
import * as streamUtils from './stream-utils';
|
|
||||||
import * as errorUtils from './error-utils';
|
|
||||||
import * as validatioUtils from './validation-utils';
|
|
||||||
import * as constants from './constants';
|
import * as constants from './constants';
|
||||||
import * as pluginUtils from './plugin-utils';
|
import * as errorUtils from './error-utils';
|
||||||
import * as fileUtils from './file-utils';
|
import * as fileUtils from './file-utils';
|
||||||
import * as pkgUtils from './pkg-utils';
|
import * as pkgUtils from './pkg-utils';
|
||||||
|
import * as pluginUtils from './plugin-utils';
|
||||||
|
import * as searchUtils from './search-utils';
|
||||||
|
import * as streamUtils from './stream-utils';
|
||||||
|
import * as validatioUtils from './validation-utils';
|
||||||
import * as warningUtils from './warning-utils';
|
import * as warningUtils from './warning-utils';
|
||||||
|
|
||||||
export { VerdaccioError, API_ERROR, SUPPORT_ERRORS, APP_ERROR } from './error-utils';
|
export { VerdaccioError, API_ERROR, SUPPORT_ERRORS, APP_ERROR } from './error-utils';
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { Package } from '@verdaccio/types';
|
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
|
||||||
|
import { Package } from '@verdaccio/types';
|
||||||
|
|
||||||
import { DIST_TAGS } from './constants';
|
import { DIST_TAGS } from './constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Config, IPackageStorage, Token, TokenFilter } from '@verdaccio/types';
|
import { Config, IPackageStorage, Token, TokenFilter } from '@verdaccio/types';
|
||||||
|
|
||||||
import { searchUtils } from '.';
|
import { searchUtils } from '.';
|
||||||
|
|
||||||
interface IPlugin {
|
interface IPlugin {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { PassThrough, TransformOptions, Transform } from 'stream';
|
import { PassThrough, Transform, TransformOptions } from 'stream';
|
||||||
|
|
||||||
export interface IReadTarball {
|
export interface IReadTarball {
|
||||||
abort?: () => void;
|
abort?: () => void;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
|
|
||||||
import { Package } from '@verdaccio/types';
|
import { Package } from '@verdaccio/types';
|
||||||
|
|
||||||
import { DIST_TAGS } from './constants';
|
import { DIST_TAGS } from './constants';
|
||||||
|
|
||||||
export function isPackageNameScoped(name: string): boolean {
|
export function isPackageNameScoped(name: string): boolean {
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { HTTP_STATUS } from '../src/constants';
|
|
||||||
|
|
||||||
|
import { HTTP_STATUS } from '../src/constants';
|
||||||
import {
|
import {
|
||||||
getNotFound,
|
|
||||||
VerdaccioError,
|
|
||||||
getConflict,
|
|
||||||
getBadData,
|
|
||||||
getInternalError,
|
|
||||||
API_ERROR,
|
API_ERROR,
|
||||||
getUnauthorized,
|
VerdaccioError,
|
||||||
getForbidden,
|
getBadData,
|
||||||
getServiceUnavailable,
|
|
||||||
getCode,
|
getCode,
|
||||||
|
getConflict,
|
||||||
|
getForbidden,
|
||||||
|
getInternalError,
|
||||||
|
getNotFound,
|
||||||
|
getServiceUnavailable,
|
||||||
|
getUnauthorized,
|
||||||
} from '../src/error-utils';
|
} from '../src/error-utils';
|
||||||
|
|
||||||
describe('testing errors', () => {
|
describe('testing errors', () => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { semverSort, mergeVersions } from '../src/pkg-utils';
|
import { mergeVersions, semverSort } from '../src/pkg-utils';
|
||||||
|
|
||||||
describe('Storage._merge_versions versions', () => {
|
describe('Storage._merge_versions versions', () => {
|
||||||
test('simple', () => {
|
test('simple', () => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Stream } from 'stream';
|
import { Stream } from 'stream';
|
||||||
import { readableToString, ReadTarball, UploadTarball } from '../src/stream-utils';
|
|
||||||
|
import { ReadTarball, UploadTarball, readableToString } from '../src/stream-utils';
|
||||||
|
|
||||||
describe('mystreams', () => {
|
describe('mystreams', () => {
|
||||||
test('should delay events on ReadTarball abort', (cb) => {
|
test('should delay events on ReadTarball abort', (cb) => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { validateName, validatePackage, isObject } from '../src/validation-utils';
|
import { isObject, validateName, validatePackage } from '../src/validation-utils';
|
||||||
|
|
||||||
describe('validatePackage', () => {
|
describe('validatePackage', () => {
|
||||||
test('should validate package names', () => {
|
test('should validate package names', () => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import locker from 'lockfile';
|
import locker from 'lockfile';
|
||||||
|
|
||||||
import { Callback } from '@verdaccio/types';
|
import { Callback } from '@verdaccio/types';
|
||||||
|
|
||||||
// unlocks file by removing existing lock file
|
// unlocks file by removing existing lock file
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import locker from 'lockfile';
|
import locker from 'lockfile';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
export const statDir = (name: string): Promise<Error | null> => {
|
export const statDir = (name: string): Promise<Error | null> => {
|
||||||
return new Promise((resolve, reject): void => {
|
return new Promise((resolve, reject): void => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import { lockFile, unlockFile, readFile } from '../src/index';
|
import { lockFile, readFile, unlockFile } from '../src/index';
|
||||||
|
|
||||||
interface Error {
|
interface Error {
|
||||||
message: string;
|
message: string;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import marked from 'marked';
|
|
||||||
import createDOMPurify from 'dompurify';
|
import createDOMPurify from 'dompurify';
|
||||||
import { JSDOM } from 'jsdom';
|
import { JSDOM } from 'jsdom';
|
||||||
|
import marked from 'marked';
|
||||||
|
|
||||||
const DOMPurify = createDOMPurify(new JSDOM('').window);
|
const DOMPurify = createDOMPurify(new JSDOM('').window);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import path from 'path';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import { parseConfigFile } from '@verdaccio/config';
|
import { parseConfigFile } from '@verdaccio/config';
|
||||||
import { setup, logger } from '@verdaccio/logger';
|
import { logger, setup } from '@verdaccio/logger';
|
||||||
|
|
||||||
import server from '../src/index';
|
import server from '../src/index';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:fastify:debug');
|
const debug = buildDebug('verdaccio:fastify:debug');
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
/* eslint-disable no-invalid-this */
|
/* eslint-disable no-invalid-this */
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { FastifyInstance } from 'fastify';
|
import { FastifyInstance } from 'fastify';
|
||||||
|
|
||||||
|
import { logger } from '@verdaccio/logger';
|
||||||
|
|
||||||
async function pingRoute(fastify: FastifyInstance) {
|
async function pingRoute(fastify: FastifyInstance) {
|
||||||
fastify.get('/-/ping', async () => {
|
fastify.get('/-/ping', async () => {
|
||||||
logger.http('ping endpoint');
|
logger.http('ping endpoint');
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
/* eslint-disable no-invalid-this */
|
/* eslint-disable no-invalid-this */
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { FastifyInstance } from 'fastify';
|
import { FastifyInstance } from 'fastify';
|
||||||
|
|
||||||
|
import { logger } from '@verdaccio/logger';
|
||||||
|
|
||||||
async function searchRoute(fastify: FastifyInstance) {
|
async function searchRoute(fastify: FastifyInstance) {
|
||||||
fastify.get('/-/v1/search', async (request, reply) => {
|
fastify.get('/-/v1/search', async (request, reply) => {
|
||||||
// TODO: apply security layer here like in
|
// TODO: apply security layer here like in
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { FastifyInstance } from 'fastify';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import { FastifyInstance } from 'fastify';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:tarball');
|
const debug = buildDebug('verdaccio:api:tarball');
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
/* eslint-disable no-invalid-this */
|
/* eslint-disable no-invalid-this */
|
||||||
import _ from 'lodash';
|
|
||||||
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
|
|
||||||
import { RemoteUser } from '@verdaccio/types';
|
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { createRemoteUser } from '@verdaccio/config';
|
|
||||||
import { getApiToken } from '@verdaccio/auth';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
import { FastifyInstance, FastifyRequest } from 'fastify';
|
import { FastifyInstance, FastifyRequest } from 'fastify';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import { getApiToken } from '@verdaccio/auth';
|
||||||
|
import { createRemoteUser } from '@verdaccio/config';
|
||||||
|
import { logger } from '@verdaccio/logger';
|
||||||
|
import { RemoteUser } from '@verdaccio/types';
|
||||||
|
import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:user');
|
const debug = buildDebug('verdaccio:api:user');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { FastifyInstance } from 'fastify';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import { FastifyInstance } from 'fastify';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:api:whoami');
|
const debug = buildDebug('verdaccio:api:whoami');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import fp from 'fastify-plugin';
|
|
||||||
import { Config as IConfig } from '@verdaccio/types';
|
|
||||||
import { Auth, IAuth } from '@verdaccio/auth';
|
|
||||||
import { FastifyInstance } from 'fastify';
|
import { FastifyInstance } from 'fastify';
|
||||||
|
import fp from 'fastify-plugin';
|
||||||
|
|
||||||
|
import { Auth, IAuth } from '@verdaccio/auth';
|
||||||
|
import { Config as IConfig } from '@verdaccio/types';
|
||||||
|
|
||||||
export default fp(
|
export default fp(
|
||||||
async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) {
|
async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { FastifyInstance } from 'fastify';
|
||||||
import fp from 'fastify-plugin';
|
import fp from 'fastify-plugin';
|
||||||
|
|
||||||
import { Config as IConfig, ConfigRuntime } from '@verdaccio/types';
|
|
||||||
import { Config as AppConfig } from '@verdaccio/config';
|
import { Config as AppConfig } from '@verdaccio/config';
|
||||||
import { FastifyInstance } from 'fastify';
|
import { ConfigRuntime, Config as IConfig } from '@verdaccio/types';
|
||||||
|
|
||||||
export default fp(
|
export default fp(
|
||||||
async function (fastify: FastifyInstance, opts: { config: ConfigRuntime }) {
|
async function (fastify: FastifyInstance, opts: { config: ConfigRuntime }) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import fp from 'fastify-plugin';
|
import fp from 'fastify-plugin';
|
||||||
|
|
||||||
import { errorUtils, validatioUtils, API_ERROR, API_MESSAGE, HTTP_STATUS } from '@verdaccio/core';
|
import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils, validatioUtils } from '@verdaccio/core';
|
||||||
|
|
||||||
export default fp(
|
export default fp(
|
||||||
async function (fastify) {
|
async function (fastify) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import fp from 'fastify-plugin';
|
|
||||||
import { Config as IConfig } from '@verdaccio/types';
|
|
||||||
import { Storage } from '@verdaccio/store';
|
|
||||||
import { FastifyInstance } from 'fastify';
|
import { FastifyInstance } from 'fastify';
|
||||||
|
import fp from 'fastify-plugin';
|
||||||
|
|
||||||
|
import { Storage } from '@verdaccio/store';
|
||||||
|
import { Config as IConfig } from '@verdaccio/types';
|
||||||
|
|
||||||
export default fp(
|
export default fp(
|
||||||
async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) {
|
async function (fastify: FastifyInstance, opts: { config: IConfig; filters?: unknown }) {
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import { Config as IConfig, RemoteUser } from '@verdaccio/types';
|
|
||||||
import { Config as AppConfig, createAnonymousRemoteUser } from '@verdaccio/config';
|
|
||||||
|
|
||||||
import fastify from 'fastify';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import fastify from 'fastify';
|
||||||
|
|
||||||
|
import { Config as AppConfig, createAnonymousRemoteUser } from '@verdaccio/config';
|
||||||
|
import { Config as IConfig, RemoteUser } from '@verdaccio/types';
|
||||||
|
|
||||||
import search from './endpoints/search';
|
|
||||||
import storagePlugin from './plugins/storage';
|
|
||||||
import authPlugin from './plugins/auth';
|
|
||||||
import coreUtils from './plugins/coreUtils';
|
|
||||||
import configPlugin from './plugins/config';
|
|
||||||
import ping from './endpoints/ping';
|
import ping from './endpoints/ping';
|
||||||
|
import search from './endpoints/search';
|
||||||
|
import tarball from './endpoints/tarball';
|
||||||
import user from './endpoints/user';
|
import user from './endpoints/user';
|
||||||
import whoami from './endpoints/whoami';
|
import whoami from './endpoints/whoami';
|
||||||
import tarball from './endpoints/tarball';
|
import authPlugin from './plugins/auth';
|
||||||
|
import configPlugin from './plugins/config';
|
||||||
|
import coreUtils from './plugins/coreUtils';
|
||||||
|
import storagePlugin from './plugins/storage';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:fastify');
|
const debug = buildDebug('verdaccio:fastify');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { Package } from '@verdaccio/types';
|
import { Package } from '@verdaccio/types';
|
||||||
import { RequestOptions } from '@verdaccio/url';
|
import { RequestOptions } from '@verdaccio/url';
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
import { getLocalRegistryTarballUri } from './getLocalRegistryTarballUri';
|
import { getLocalRegistryTarballUri } from './getLocalRegistryTarballUri';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import URL from 'url';
|
|
||||||
import { RequestOptions } from '@verdaccio/url';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import URL from 'url';
|
||||||
|
|
||||||
|
import { RequestOptions } from '@verdaccio/url';
|
||||||
import { getPublicUrl } from '@verdaccio/url';
|
import { getPublicUrl } from '@verdaccio/url';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:core:url');
|
const debug = buildDebug('verdaccio:core:url');
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import * as httpMocks from 'node-mocks-http';
|
import * as httpMocks from 'node-mocks-http';
|
||||||
|
|
||||||
import { HEADERS } from '@verdaccio/core';
|
import { HEADERS } from '@verdaccio/core';
|
||||||
|
|
||||||
import { convertDistRemoteToLocalTarballUrls } from '../src';
|
import { convertDistRemoteToLocalTarballUrls } from '../src';
|
||||||
|
|
||||||
describe('convertDistRemoteToLocalTarballUrls', () => {
|
describe('convertDistRemoteToLocalTarballUrls', () => {
|
||||||
|
|
2
packages/core/types/index.d.ts
vendored
2
packages/core/types/index.d.ts
vendored
|
@ -1,6 +1,6 @@
|
||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
|
|
||||||
import { PassThrough } from 'stream';
|
import { PassThrough } from 'stream';
|
||||||
|
|
||||||
declare module '@verdaccio/types' {
|
declare module '@verdaccio/types' {
|
||||||
type StringValue = string | void | null;
|
type StringValue = string | void | null;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { URL } from 'url';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import { URL } from 'url';
|
||||||
import isURLValidator from 'validator/lib/isURL';
|
import isURLValidator from 'validator/lib/isURL';
|
||||||
|
|
||||||
import { HEADERS } from '@verdaccio/core';
|
import { HEADERS } from '@verdaccio/core';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:core:url');
|
const debug = buildDebug('verdaccio:core:url');
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as httpMocks from 'node-mocks-http';
|
import * as httpMocks from 'node-mocks-http';
|
||||||
|
|
||||||
import { HEADERS } from '@verdaccio/core';
|
import { HEADERS } from '@verdaccio/core';
|
||||||
|
|
||||||
import { getPublicUrl } from '../src';
|
import { getPublicUrl } from '../src';
|
||||||
|
|
||||||
describe('host', () => {
|
describe('host', () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { HTTP_STATUS } from '@verdaccio/core';
|
import { HTTP_STATUS } from '@verdaccio/core';
|
||||||
|
import { logger } from '@verdaccio/logger';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:hooks:request');
|
const debug = buildDebug('verdaccio:hooks:request');
|
||||||
const fetch = require('undici-fetch');
|
const fetch = require('undici-fetch');
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
|
import buildDebug from 'debug';
|
||||||
import Handlebars from 'handlebars';
|
import Handlebars from 'handlebars';
|
||||||
|
|
||||||
import buildDebug from 'debug';
|
|
||||||
import { Config, Package, RemoteUser, Notification } from '@verdaccio/types';
|
|
||||||
import { logger } from '@verdaccio/logger';
|
import { logger } from '@verdaccio/logger';
|
||||||
import { notifyRequest, FetchOptions } from './notify-request';
|
import { Config, Notification, Package, RemoteUser } from '@verdaccio/types';
|
||||||
|
|
||||||
|
import { FetchOptions, notifyRequest } from './notify-request';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:hooks');
|
const debug = buildDebug('verdaccio:hooks');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import { createRemoteUser, parseConfigFile } from '@verdaccio/config';
|
||||||
import { setup } from '@verdaccio/logger';
|
import { setup } from '@verdaccio/logger';
|
||||||
import { Config } from '@verdaccio/types';
|
import { Config } from '@verdaccio/types';
|
||||||
import { parseConfigFile, createRemoteUser } from '@verdaccio/config';
|
|
||||||
import { notify } from '../src/notify';
|
import { notify } from '../src/notify';
|
||||||
import { parseConfigurationFile } from './__helper';
|
import { parseConfigurationFile } from './__helper';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import Path from 'path';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import Path from 'path';
|
||||||
|
|
||||||
import { logger } from '@verdaccio/logger';
|
import { logger } from '@verdaccio/logger';
|
||||||
import { Config, IPlugin } from '@verdaccio/types';
|
import { Config, IPlugin } from '@verdaccio/types';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { setup } from '@verdaccio/logger';
|
import { setup } from '@verdaccio/logger';
|
||||||
|
|
||||||
import { loadPlugin } from '../src/plugin-loader';
|
import { loadPlugin } from '../src/plugin-loader';
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { green, red, white } from 'kleur';
|
||||||
import { inspect } from 'util';
|
import { inspect } from 'util';
|
||||||
|
|
||||||
import { white, red, green } from 'kleur';
|
import { LevelCode, calculateLevel, levelsColors, subSystemLevels } from './levels';
|
||||||
import { calculateLevel, LevelCode, levelsColors, subSystemLevels } from './levels';
|
|
||||||
import { formatLoggingDate, isObject, padLeft, padRight } from './utils';
|
|
||||||
import { PrettyOptionsExtended } from './types';
|
import { PrettyOptionsExtended } from './types';
|
||||||
|
import { formatLoggingDate, isObject, padLeft, padRight } from './utils';
|
||||||
|
|
||||||
let LEVEL_VALUE_MAX = 0;
|
let LEVEL_VALUE_MAX = 0;
|
||||||
for (const l in levelsColors) {
|
for (const l in levelsColors) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { yellow, green, red, magenta, black, blue, cyan, white } from 'kleur';
|
import { black, blue, cyan, green, magenta, red, white, yellow } from 'kleur';
|
||||||
|
|
||||||
export type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';
|
export type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
export const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';
|
export const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';
|
||||||
export const CUSTOM_PAD_LENGTH = 1;
|
export const CUSTOM_PAD_LENGTH = 1;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import pino from 'pino';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import pino from 'pino';
|
||||||
|
|
||||||
import { warningUtils } from '@verdaccio/core';
|
import { warningUtils } from '@verdaccio/core';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:logger');
|
const debug = buildDebug('verdaccio:logger');
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { warningUtils } from '@verdaccio/core';
|
import { warningUtils } from '@verdaccio/core';
|
||||||
|
|
||||||
import { logger, setup } from '../src';
|
import { logger, setup } from '../src';
|
||||||
|
|
||||||
const mockWarningUtils = jest.fn();
|
const mockWarningUtils = jest.fn();
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
|
|
||||||
import {
|
|
||||||
validateName as utilValidateName,
|
|
||||||
validatePackage as utilValidatePackage,
|
|
||||||
isObject,
|
|
||||||
stringToMD5,
|
|
||||||
} from '@verdaccio/utils';
|
|
||||||
|
|
||||||
import { NextFunction, Request, Response } from 'express';
|
import { NextFunction, Request, Response } from 'express';
|
||||||
|
import { HttpError } from 'http-errors';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { Config, Package, RemoteUser, Logger } from '@verdaccio/types';
|
|
||||||
import { logger } from '@verdaccio/logger';
|
|
||||||
import { IAuth } from '@verdaccio/auth';
|
import { IAuth } from '@verdaccio/auth';
|
||||||
import {
|
import {
|
||||||
errorUtils,
|
|
||||||
API_ERROR,
|
API_ERROR,
|
||||||
HEADER_TYPE,
|
|
||||||
HEADERS,
|
HEADERS,
|
||||||
|
HEADER_TYPE,
|
||||||
HTTP_STATUS,
|
HTTP_STATUS,
|
||||||
TOKEN_BASIC,
|
TOKEN_BASIC,
|
||||||
TOKEN_BEARER,
|
TOKEN_BEARER,
|
||||||
VerdaccioError,
|
VerdaccioError,
|
||||||
|
errorUtils,
|
||||||
} from '@verdaccio/core';
|
} from '@verdaccio/core';
|
||||||
import { HttpError } from 'http-errors';
|
import { logger } from '@verdaccio/logger';
|
||||||
|
import { Config, Logger, Package, RemoteUser } from '@verdaccio/types';
|
||||||
|
import {
|
||||||
|
isObject,
|
||||||
|
stringToMD5,
|
||||||
|
validateName as utilValidateName,
|
||||||
|
validatePackage as utilValidatePackage,
|
||||||
|
} from '@verdaccio/utils';
|
||||||
|
|
||||||
import { getVersionFromTarball } from './middleware-utils';
|
import { getVersionFromTarball } from './middleware-utils';
|
||||||
|
|
||||||
export type $RequestExtend = Request & { remote_user?: RemoteUser; log: Logger };
|
export type $RequestExtend = Request & { remote_user?: RemoteUser; log: Logger };
|
||||||
|
|
2
packages/middleware/types/custom.d.ts
vendored
2
packages/middleware/types/custom.d.ts
vendored
|
@ -1,6 +1,6 @@
|
||||||
// <reference types="node" />
|
// <reference types="node" />
|
||||||
|
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
|
|
||||||
import { Logger, RemoteUser } from '@verdaccio/types';
|
import { Logger, RemoteUser } from '@verdaccio/types';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import _, { assign, isFunction } from 'lodash';
|
|
||||||
import http from 'http';
|
|
||||||
import https from 'https';
|
|
||||||
import constants from 'constants';
|
import constants from 'constants';
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import http from 'http';
|
||||||
|
import https from 'https';
|
||||||
|
import _, { assign, isFunction } from 'lodash';
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
|
|
||||||
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
||||||
import { API_ERROR } from '@verdaccio/core';
|
import { API_ERROR } from '@verdaccio/core';
|
||||||
import { ConfigRuntime, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types';
|
import { logger, setup } from '@verdaccio/logger';
|
||||||
import { setup, logger } from '@verdaccio/logger';
|
|
||||||
import server from '@verdaccio/server';
|
import server from '@verdaccio/server';
|
||||||
|
import { ConfigRuntime, HttpsConfKeyCert, HttpsConfPfx } from '@verdaccio/types';
|
||||||
|
|
||||||
import { getListListenAddresses } from './cli-utils';
|
import { getListListenAddresses } from './cli-utils';
|
||||||
import { displayExperimentsInfoBox } from './experiments';
|
import { displayExperimentsInfoBox } from './experiments';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_DOMAIN,
|
DEFAULT_DOMAIN,
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { DEFAULT_DOMAIN, DEFAULT_PORT, parseAddress } from '../src/cli-utils';
|
import { DEFAULT_DOMAIN, DEFAULT_PORT, parseAddress } from '../src/cli-utils';
|
||||||
|
|
||||||
describe('Parse listen address', () => {
|
describe('Parse listen address', () => {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
|
|
||||||
import { runServer } from '../src';
|
import { runServer } from '../src';
|
||||||
|
|
||||||
describe('startServer via API', () => {
|
describe('startServer via API', () => {
|
||||||
test('should provide all HTTP server data', async () => {
|
test('should provide all HTTP server data', async () => {
|
||||||
const webServer = await runServer();
|
const webServer = await runServer();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import ActiveDirectory from 'activedirectory2';
|
||||||
|
|
||||||
import { errorUtils } from '@verdaccio/core';
|
import { errorUtils } from '@verdaccio/core';
|
||||||
import { Callback, IPluginAuth, Logger } from '@verdaccio/types';
|
import { Callback, IPluginAuth, Logger } from '@verdaccio/types';
|
||||||
import ActiveDirectory from 'activedirectory2';
|
|
||||||
|
|
||||||
export const NotAuthMessage = 'AD - Active Directory authentication failed';
|
export const NotAuthMessage = 'AD - Active Directory authentication failed';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import ActiveDirectory from 'activedirectory2';
|
import ActiveDirectory from 'activedirectory2';
|
||||||
|
|
||||||
import { HTTP_STATUS } from '@verdaccio/core';
|
import { HTTP_STATUS } from '@verdaccio/core';
|
||||||
|
|
||||||
import ActiveDirectoryPlugin, { NotAuthMessage } from '../src/active-directory';
|
import ActiveDirectoryPlugin, { NotAuthMessage } from '../src/active-directory';
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-mocks-import
|
// eslint-disable-next-line jest/no-mocks-import
|
||||||
import logger from './__mocks__/Logger';
|
import logger from './__mocks__/Logger';
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import https from 'https';
|
|
||||||
|
|
||||||
import fetch from 'node-fetch';
|
|
||||||
import createHttpsProxyAgent from 'https-proxy-agent';
|
|
||||||
import express, { Request, Response } from 'express';
|
|
||||||
import { Logger, IPluginMiddleware, IBasicAuth, PluginOptions } from '@verdaccio/types';
|
|
||||||
|
|
||||||
import { json as jsonParser } from 'body-parser';
|
import { json as jsonParser } from 'body-parser';
|
||||||
|
import express, { Request, Response } from 'express';
|
||||||
|
import https from 'https';
|
||||||
|
import createHttpsProxyAgent from 'https-proxy-agent';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
|
import { IBasicAuth, IPluginMiddleware, Logger, PluginOptions } from '@verdaccio/types';
|
||||||
|
|
||||||
import { ConfigAudit } from './types';
|
import { ConfigAudit } from './types';
|
||||||
|
|
||||||
// FUTURE: we should be able to overwrite this
|
// FUTURE: we should be able to overwrite this
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import buildDebug from 'debug';
|
import buildDebug from 'debug';
|
||||||
import {
|
|
||||||
PluginOptions,
|
|
||||||
Callback,
|
|
||||||
PackageAccess,
|
|
||||||
IPluginAuth,
|
|
||||||
RemoteUser,
|
|
||||||
Logger,
|
|
||||||
} from '@verdaccio/types';
|
|
||||||
import { errorUtils, API_ERROR } from '@verdaccio/core';
|
|
||||||
|
|
||||||
import { VerdaccioMemoryConfig, Users, UserMemory } from './types';
|
import { API_ERROR, errorUtils } from '@verdaccio/core';
|
||||||
|
import {
|
||||||
|
Callback,
|
||||||
|
IPluginAuth,
|
||||||
|
Logger,
|
||||||
|
PackageAccess,
|
||||||
|
PluginOptions,
|
||||||
|
RemoteUser,
|
||||||
|
} from '@verdaccio/types';
|
||||||
|
|
||||||
|
import { UserMemory, Users, VerdaccioMemoryConfig } from './types';
|
||||||
|
|
||||||
const debug = buildDebug('verdaccio:plugin:auth:memory:user');
|
const debug = buildDebug('verdaccio:plugin:auth:memory:user');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Callback } from '@verdaccio/types';
|
import { Callback } from '@verdaccio/types';
|
||||||
|
|
||||||
import { VerdaccioMemoryConfig } from '../src/types';
|
|
||||||
import Memory from '../src/index';
|
import Memory from '../src/index';
|
||||||
|
import { VerdaccioMemoryConfig } from '../src/types';
|
||||||
|
|
||||||
describe('Memory', function () {
|
describe('Memory', function () {
|
||||||
let auth;
|
let auth;
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
|
import { S3 } from 'aws-sdk';
|
||||||
|
|
||||||
|
import { VerdaccioError, errorUtils } from '@verdaccio/core';
|
||||||
import {
|
import {
|
||||||
LocalStorage,
|
|
||||||
Logger,
|
|
||||||
Config,
|
Config,
|
||||||
IPluginStorage,
|
IPluginStorage,
|
||||||
|
LocalStorage,
|
||||||
|
Logger,
|
||||||
PluginOptions,
|
PluginOptions,
|
||||||
Token,
|
Token,
|
||||||
TokenFilter,
|
TokenFilter,
|
||||||
} from '@verdaccio/types';
|
} from '@verdaccio/types';
|
||||||
import { errorUtils, VerdaccioError } from '@verdaccio/core';
|
|
||||||
import { S3 } from 'aws-sdk';
|
|
||||||
|
|
||||||
import { S3Config } from './config';
|
|
||||||
import S3PackageManager from './s3PackageManager';
|
|
||||||
import { convertS3Error, is404Error } from './s3Errors';
|
|
||||||
import addTrailingSlash from './addTrailingSlash';
|
import addTrailingSlash from './addTrailingSlash';
|
||||||
|
import { S3Config } from './config';
|
||||||
|
import { convertS3Error, is404Error } from './s3Errors';
|
||||||
|
import S3PackageManager from './s3PackageManager';
|
||||||
import setConfigValue from './setConfigValue';
|
import setConfigValue from './setConfigValue';
|
||||||
|
|
||||||
export default class S3Database implements IPluginStorage<S3Config> {
|
export default class S3Database implements IPluginStorage<S3Config> {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { AWSError } from 'aws-sdk';
|
import { AWSError } from 'aws-sdk';
|
||||||
import { errorUtils, API_ERROR, HTTP_STATUS, VerdaccioError } from '@verdaccio/core';
|
|
||||||
|
import { API_ERROR, HTTP_STATUS, VerdaccioError, errorUtils } from '@verdaccio/core';
|
||||||
|
|
||||||
export function is404Error(err: VerdaccioError): boolean {
|
export function is404Error(err: VerdaccioError): boolean {
|
||||||
return err.code === HTTP_STATUS.NOT_FOUND;
|
return err.code === HTTP_STATUS.NOT_FOUND;
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { S3, AWSError } from 'aws-sdk';
|
import { AWSError, S3 } from 'aws-sdk';
|
||||||
import { UploadTarball, ReadTarball } from '@verdaccio/streams';
|
|
||||||
import { HEADERS, HTTP_STATUS, VerdaccioError } from '@verdaccio/core';
|
|
||||||
import { Callback, Logger, Package, ILocalPackageManager, CallbackAction } from '@verdaccio/types';
|
|
||||||
import { HttpError } from 'http-errors';
|
import { HttpError } from 'http-errors';
|
||||||
|
|
||||||
import { is404Error, convertS3Error, create409Error } from './s3Errors';
|
import { HEADERS, HTTP_STATUS, VerdaccioError } from '@verdaccio/core';
|
||||||
import { deleteKeyPrefix } from './deleteKeyPrefix';
|
import { ReadTarball, UploadTarball } from '@verdaccio/streams';
|
||||||
import { S3Config } from './config';
|
import { Callback, CallbackAction, ILocalPackageManager, Logger, Package } from '@verdaccio/types';
|
||||||
|
|
||||||
import addTrailingSlash from './addTrailingSlash';
|
import addTrailingSlash from './addTrailingSlash';
|
||||||
|
import { S3Config } from './config';
|
||||||
|
import { deleteKeyPrefix } from './deleteKeyPrefix';
|
||||||
|
import { convertS3Error, create409Error, is404Error } from './s3Errors';
|
||||||
|
|
||||||
const pkgFileName = 'package.json';
|
const pkgFileName = 'package.json';
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue