> Attempted to apply the `noImplicitAny`, parameter types should be specified unless any is manually declared. * 🐞 Fixed an issue in bugVersionAdvice where AbbreviatedManifest was being set abnormally. * 🤖 Added index.d.ts to store declarations for dependencies without types. * 🤔 skipLibCheck has no effect on leoric for now, so it cannot be enabled temporarily. -------- > 尝试应用 `noImplicitAny` 配置,除非手动声明 any,否则需要指定参数类型 * 🐞 修复 bugVersionAdvice 中,AbbreviatedManifest 设置异常 * 🤖 添加 index.d.ts 存放无类型依赖声明 * 🤔 skipLibCheck 对 leoric 失效,暂时无法开启 
114 lines
2.6 KiB
TypeScript
114 lines
2.6 KiB
TypeScript
declare module 'fs-cnpm' {
|
|
export default class FSClient extends NFSClient {
|
|
constructor(options: {
|
|
dir: string;
|
|
});
|
|
}
|
|
}
|
|
|
|
declare module 'ssri' {
|
|
export interface Integrity {
|
|
algorithm: string;
|
|
digest: string;
|
|
options?: string[];
|
|
}
|
|
|
|
export interface HashLike {
|
|
digest: string;
|
|
algorithm: string;
|
|
options?: string[];
|
|
sha1: {
|
|
hexDigest(): string;
|
|
}[];
|
|
sha512: { toString(): string }[];
|
|
}
|
|
|
|
export interface HashOptions {
|
|
algorithms?: string[];
|
|
options?: string[];
|
|
}
|
|
|
|
export interface IntegrityOptions {
|
|
algorithms?: string[];
|
|
options?: string[];
|
|
single?: boolean;
|
|
}
|
|
|
|
export interface CreateRes {
|
|
update(v: string): { digest: () => { toString() }; };
|
|
}
|
|
|
|
export function fromHex(hexDigest: string, algorithm: string, options?: string[]): Integrity;
|
|
|
|
export function fromData(data: Buffer | string | Uint8Array, options?: HashOptions): HashLike;
|
|
|
|
export function fromStream(stream: NodeJS.ReadableStream, options?: HashOptions): Promise<HashLike>;
|
|
|
|
export function checkData(data: Buffer | string, sri: string | Integrity, options?: IntegrityOptions): boolean;
|
|
|
|
export function checkStream(stream: NodeJS.ReadableStream, sri: string | Integrity, options?: IntegrityOptions): Promise<boolean>;
|
|
|
|
export function parse(sri: string): Integrity;
|
|
|
|
export function create(): CreateRes;
|
|
|
|
export function stringify(integrity: Integrity, options?: { strict?: boolean }): string;
|
|
}
|
|
|
|
declare module 'oss-cnpm' {
|
|
import { Readable } from 'stream';
|
|
|
|
export interface AppendResult {
|
|
name: string;
|
|
url: string;
|
|
etag: string;
|
|
size: number;
|
|
}
|
|
|
|
export interface UploadOptions {
|
|
key: string;
|
|
content: Readable;
|
|
size: number;
|
|
}
|
|
|
|
export interface UploadResult {
|
|
name: string;
|
|
url: string;
|
|
etag: string;
|
|
size: number;
|
|
}
|
|
|
|
export interface DownloadOptions {
|
|
key: string;
|
|
}
|
|
|
|
export default class OSSClient {
|
|
constructor(options: {
|
|
cdnBaseUrl?: string;
|
|
accessKeyId: string;
|
|
accessKeySecret: string;
|
|
bucket: string;
|
|
internal?: boolean;
|
|
secure?: boolean;
|
|
timeout?: number;
|
|
cname?: boolean;
|
|
endpoint?: string;
|
|
defaultHeaders?: Record<string, string>;
|
|
});
|
|
|
|
append(options: UploadOptions): Promise<AppendResult>;
|
|
|
|
upload(options: UploadOptions): Promise<UploadResult>;
|
|
|
|
download(options: DownloadOptions): Promise<Readable>;
|
|
|
|
delete(key: string): Promise<void>;
|
|
|
|
exists(key: string): Promise<boolean>;
|
|
|
|
stat(key: string): Promise<{ size: number }>;
|
|
|
|
url(key: string): string;
|
|
}
|
|
}
|