0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/types/index.js
Priscila 9f6106cfe9 Package Refactor (#1145)
* chore: fix unit test, forgotten line on merge

chore: add node 11 to circleci (#1153)

chore: fix the use of Node 11 in CircleCI (#1154)

refactor: added css in js, new design, added types

feat: added Tag component

refactor: added modifiers

refactor: replaced by polished ellipsis

refactor: added types, new design and css in js

refactor: removed ul. it needs refactor

refactor: changed media queries

refactor: changed icon height

refactor: changed Header media queries

refactor: removed margin top

refactor: updated snapshots

refactor: removed unnecessary format author

refactor: added license icon & changed size

refactor: changed media queries

refactor: added icon size

refactor: changed media queries

refactor: updated snap

refactor: replaced Description by Details

refactor: updated tests

refactor: fixed modifiers type

feat: created missed types

fix: fixed types

fix: fixed prop type

fix: fixed undefined prop

refactor: replaced label by name

refactor: updated snap

refactor: moved polished to dev

refactor: changed formatAuthor and pkg author type

fix: removed incorrect meta's type

refactor: removed polished

refactor: added spacing & ellipsis mixin

refactor: added modifier type

refactor: changed datetime format

refactor: updated snapshots

refactor: rreplaced polished by mixins func

* refactor: updated styled

* fix: added missed semicolon

* refactor: updated media

* refactor: updated tests

* refactor: organized modifiers

* refactor: removed unused imports

* refactor: design adjusts

* refactor: updated snapshot

* refactor: changed minor things

* refactor: updated snapshots

* refactor: commented tests. fix later
2018-12-13 19:05:47 +01:00

163 lines
3.6 KiB
JavaScript

// @flow
import type {
IBasicAuth,
IBasicStorage,
IStorageManager,
UpLinkConf,
Callback,
Versions,
Version,
RemoteUser,
Config,
Logger,
JWTSignOptions,
PackageAccess,
StringValue as verdaccio$StringValue,
Package} from '@verdaccio/types';
import type {
IReadTarball,
} from '@verdaccio/streams';
import type {ILocalData} from '@verdaccio/local-storage';
import lunrMutable from 'lunr-mutable-indexes';
import type {NextFunction, $Request, $Response} from 'request';
export type StringValue = verdaccio$StringValue;
export type StartUpConfig = {
storage: string;
plugins?: string;
self_path: string;
}
export type MatchedPackage = PackageAccess | void;
export type JWTPayload = RemoteUser & {
password?: string;
}
export type AESPayload = {
user: string;
password: string;
}
export type AuthTokenHeader = {
scheme: string;
token: string;
}
export type BasicPayload = AESPayload | void;
export type AuthMiddlewarePayload = RemoteUser | BasicPayload;
export type ProxyList = {
[key: string]: IProxy;
}
export type CookieSessionToken = {
expires: Date;
}
export type Utils = {
ErrorCode: any;
getLatestVersion: Callback;
isObject: (value: any) => boolean;
validate_name: (value: any) => boolean;
tag_version: (value: any, version: string, tag: string) => void;
normalizeDistTags: (pkg: Package) => void;
semverSort: (keys: Array<string>) => Array<string>;
}
export type Profile = {
tfa: boolean;
name: string;
email: string;
email_verified: string;
created: string;
updated: string;
cidr_whitelist: any;
fullname: string;
}
export type $RequestExtend = $Request & {remote_user?: any}
export type $ResponseExtend = $Response & {cookies?: any}
export type $NextFunctionVer = NextFunction & mixed;
export type $SidebarPackage = Package & {latest: mixed}
export interface IAuthWebUI {
jwtEncrypt(user: RemoteUser, signOptions: JWTSignOptions): string;
aesEncrypt(buf: Buffer): Buffer;
}
interface IAuthMiddleware {
apiJWTmiddleware(): $NextFunctionVer;
webUIJWTmiddleware(): $NextFunctionVer;
}
export interface IAuth extends IBasicAuth, IAuthMiddleware, IAuthWebUI {
config: verdaccio$Config;
logger: verdaccio$Logger;
secret: string;
plugins: Array<any>;
}
export interface IWebSearch {
index: lunrMutable.index;
storage: IStorageHandler;
query(query: string): any;
add(pkg: Version): void;
remove(name: string): void;
reindex(): void;
configureStorage(storage: IStorageHandler): void;
}
export interface IProxy {
config: UpLinkConf;
failed_requests: number;
userAgent: string;
ca?: string | void;
logger: Logger;
server_id: string;
url: any;
maxage: number;
timeout: number;
max_fails: number;
fail_timeout: number;
upname: string;
fetchTarball(url: string): IReadTarball;
isUplinkValid(url: string): boolean;
getRemoteMetadata(name: string, options: any, callback: Callback): void;
}
export interface IStorage extends IBasicStorage {
config: Config;
localData: ILocalData;
logger: Logger;
}
export type IGetPackageOptions = {
callback: Callback;
name: string;
keepUpLinkData: boolean;
uplinksLook: boolean;
req: any;
}
export type ISyncUplinks = {
uplinksLook?: boolean;
etag?: string;
}
export interface IStorageHandler extends IStorageManager {
localStorage: IStorage;
uplinks: ProxyList;
_syncUplinksMetadata(name: string, packageInfo: Package, options: any, callback: Callback): void;
_updateVersionsHiddenUpLink(versions: Versions, upLink: IProxy): void;
}
/**
* @property { string | number | Styles } [ruleOrSelector]
*/
export type Styles = {
[ruleOrSelector: string]: string | number | Styles,
};