@squared-functions/types
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -1,2 +0,2 @@ | ||
import type { BundleAction, FileAsset } from './squared'; | ||
import type { BundleAction, FileAsset, StorageAction } from './squared'; | ||
import type { CloudStorage } from './cloud'; | ||
@@ -22,3 +22,3 @@ | ||
export interface ExternalAsset extends FileAsset<CloudStorage>, BundleAction { | ||
export interface ExternalAsset<T = CloudStorage> extends FileAsset, BundleAction, StorageAction<T> { | ||
localUri?: string; | ||
@@ -25,0 +25,0 @@ relativeUri?: string; |
@@ -1,3 +0,1 @@ | ||
/// <reference path="type.d.ts" /> | ||
import type { AttributeMap, ElementAction, DataSource as IDataSource, ViewEngine } from './squared'; | ||
@@ -22,3 +20,3 @@ | ||
export interface RequestData extends DocumentOutput, CssSelectorData { | ||
export interface RequestData extends DocumentOutput, ICssRuleData { | ||
baseUrl?: string; | ||
@@ -33,3 +31,3 @@ templateMap?: TemplateMap; | ||
export interface CssSelectorData { | ||
export interface ICssRuleData { | ||
usedVariables?: string[]; | ||
@@ -36,0 +34,0 @@ usedFontFace?: string[]; |
@@ -0,1 +1,3 @@ | ||
import type { IDocument, IFileManager } from './index'; | ||
import type { ExternalAsset } from './asset'; | ||
@@ -38,8 +40,6 @@ import type { ModuleWriteFailMethod } from './logger'; | ||
reset: () => void; | ||
nextMap: (name: string, code: string, map: SourceMap | string, sourceMappingURL?: string) => boolean; | ||
nextMap: (name: string, code: string, map: SourceMap | string, sourceMappingURL?: string, emptySources?: boolean) => boolean; | ||
} | ||
export interface SourceMapOutput extends TransformResult { | ||
map: SourceMap; | ||
} | ||
export interface SourceMapOutput extends TransformResult {} | ||
@@ -58,2 +58,3 @@ export interface SourceMap { | ||
export type ConfigOrTransformer = StandardMap | Transformer; | ||
export type PluginConfig = [string, Undef<ConfigOrTransformer>, Undef<StandardMap>] | []; | ||
export type PluginConfig = [string, Undef<ConfigOrTransformer>, Undef<StandardMap>] | []; | ||
export type TransformCallback = (this: IFileManager, instance: IDocument, documentDir: string) => Void<Promise<void>>; |
@@ -9,4 +9,9 @@ import type { FileInfo } from './squared'; | ||
export interface HttpRequestBuffer { | ||
expires: number; | ||
limit: number; | ||
} | ||
export type PerformAsyncTaskMethod = () => void; | ||
export type PostFinalizeCallback = (files: FileInfo[], errors: string[]) => void; | ||
export type CompleteAsyncTaskCallback<T = unknown, U = unknown> = (err?: Null<Error>, value?: T, parent?: U) => void; |
@@ -11,6 +11,6 @@ /// <reference path="type.d.ts" /> | ||
import type { ConfigOrTransformer, PluginConfig, SourceMapInput, SourceMapOptions, SourceMapOutput, TransformOutput, TransformResult } from './document'; | ||
import type { CompleteAsyncTaskCallback, InstallData, PerformAsyncTaskMethod, PostFinalizeCallback } from './filemanager'; | ||
import type { CompleteAsyncTaskCallback, HttpRequestBuffer, InstallData, PerformAsyncTaskMethod, PostFinalizeCallback } from './filemanager'; | ||
import type { CropData, QualityData, ResizeData, RotateData } from './image'; | ||
import type { LOG_TYPE, LogMessageOptions, LogValue, ModuleFormatMessageMethod, ModuleWriteFailMethod } from './logger'; | ||
import type { CloudModule, DocumentModule } from './module'; | ||
import type { CloudModule, DocumentModule, TaskModule } from './module'; | ||
import type { RequestBody, Settings } from './node'; | ||
@@ -22,3 +22,10 @@ import type { FileWatch } from './watch'; | ||
import type * as request from 'request'; | ||
import type * as bytes from 'bytes'; | ||
declare namespace functions { | ||
interface IHost<T = IFileManager> { | ||
host?: T; | ||
} | ||
interface IScopeOrigin<T = IModule, U = IModule> { | ||
@@ -29,3 +36,3 @@ host?: T; | ||
interface ICompress extends IModule { | ||
interface ICompress extends IModule, IHost { | ||
level: ObjectMap<number>; | ||
@@ -38,6 +45,6 @@ compressors: ObjectMap<CompressTryFileMethod>; | ||
tryFile: CompressTryFileMethod; | ||
tryImage(uri: string, data: CompressFormat, callback?: CompleteAsyncTaskCallback<Buffer | Uint8Array>): void; | ||
tryImage(uri: string, data: CompressFormat, callback?: CompleteAsyncTaskCallback<Buffer | Uint8Array>, buffer?: Buffer): void; | ||
} | ||
interface IImage extends IModule { | ||
interface IImage extends IModule, IHost { | ||
resizeData?: ResizeData; | ||
@@ -68,3 +75,3 @@ cropData?: CropData; | ||
interface ITask extends IModule { | ||
interface ITask extends IModule, IHost { | ||
module: DocumentModule; | ||
@@ -79,3 +86,3 @@ execute?(manager: IFileManager, task: PlainObject, callback: (value?: unknown) => void): void; | ||
interface ICloud extends IModule { | ||
interface ICloud extends IModule, IHost { | ||
settings: CloudModule; | ||
@@ -117,7 +124,6 @@ database: CloudDatabase[]; | ||
interface IDocument<T = IFileManager, U = ICloud> extends IModule { | ||
interface IDocument<T = IFileManager, U = ICloud> extends IModule, IHost<T> { | ||
module: DocumentModule; | ||
moduleName: string; | ||
assets: ExternalAsset[]; | ||
host?: IFileManager; | ||
configData?: StandardMap; | ||
@@ -130,2 +136,3 @@ init(assets: ExternalAsset[], body: RequestBody): void; | ||
setLocalUri?(file: Partial<LocationUri>): void; | ||
resolveUri?(file: ExternalAsset, source: string): string; | ||
addCopy?(data: FileData, saveAs: string, replace?: boolean): Undef<string>; | ||
@@ -143,13 +150,14 @@ writeImage?(data: OutputData): boolean; | ||
cleanup(this: IFileManager, instance: IDocument): Promise<void>; | ||
sanitizeAssets(assets: ExternalAsset[], exclusions?: ExternalAsset[]): void; | ||
createSourceMap(code: string, file?: ExternalAsset): SourceMapInput; | ||
writeSourceMap(localUri: string, sourceMap: SourceMapOutput, options?: SourceMapOptions): Undef<string>; | ||
writeSourceMap(localUri: string, sourceMap: SourceMapOutput, options?: SourceMapOptions, emptySources?: boolean): Undef<string>; | ||
removeSourceMappingURL(value: string): [string, string?]; | ||
sanitizeAssets?(assets: ExternalAsset[], exclusions?: ExternalAsset[]): void; | ||
new(module: DocumentModule, ...args: unknown[]): IDocument; | ||
} | ||
interface IWatch extends IModule { | ||
interface IWatch extends IModule, IHost { | ||
interval: number; | ||
port: number; | ||
securePort: number; | ||
whenModified?: (assets: ExternalAsset[], postFinalize?: FunctionType<void>) => void; | ||
whenModified?: (assets: ExternalAsset[], postFinalize?: FunctionType) => void; | ||
start(assets: ExternalAsset[], permission?: IPermission): void; | ||
@@ -163,2 +171,3 @@ modified(watch: FileWatch): void; | ||
shutdown(): void; | ||
parseExpires(value: NumString, start?: number) : number; | ||
new(interval?: number, port?: number): IWatch; | ||
@@ -189,3 +198,5 @@ } | ||
cleared: boolean; | ||
keepAliveTimeout: number; | ||
cacheHttpRequest: boolean; | ||
cacheHttpRequestBuffer: HttpRequestBuffer; | ||
Document: InstallData<IDocument, DocumentConstructor>[]; | ||
@@ -209,12 +220,21 @@ Task: InstallData<ITask, TaskConstructor>[]; | ||
readonly contentToAppend: Map<string, string[]>; | ||
readonly contentToReplace: Map<string, string[]>; | ||
readonly emptyDir: Set<string>; | ||
readonly permission: IPermission; | ||
readonly archiving: boolean; | ||
readonly postFinalize?: PostFinalizeCallback; | ||
install(name: string, ...params: unknown[]): Undef<IModule>; | ||
add(value: string, parent?: ExternalAsset): void; | ||
delete(value: string, emptyDir?: boolean): void; | ||
has(value: Undef<string>): value is string; | ||
readonly postFinalize: Null<PostFinalizeCallback>; | ||
install(name: "cloud", module: CloudModule): Undef<ICloud>; | ||
install(name: "compress"): Undef<ICompress>; | ||
install(name: "document", target: DocumentConstructor, module: DocumentModule): Undef<IDocument>; | ||
install(name: "image", data: Map<string, ImageConstructor>): void; | ||
install(name: "task", target: TaskConstructor, module: TaskModule): Undef<ITask>; | ||
install(name: "watch", interval?: number, port?: number): Undef<IWatch>; | ||
install(name: string, ...params: unknown[]): any; | ||
add(value: unknown, parent?: ExternalAsset): void; | ||
delete(value: unknown, emptyDir?: boolean): void; | ||
has(value: unknown): value is string; | ||
removeCwd(value: unknown): string; | ||
findAsset(value: unknown, instance?: IModule): Undef<ExternalAsset>; | ||
removeAsset(file: ExternalAsset): void; | ||
replace(file: ExternalAsset, replaceWith: string, mimeType?: string): void; | ||
removeAsset(file: ExternalAsset): void; | ||
performAsyncTask: PerformAsyncTaskMethod; | ||
@@ -232,7 +252,5 @@ removeAsyncTask(): void; | ||
getRelativeUri(file: ExternalAsset, filename?: string): string; | ||
findAsset(uri: string, instance?: IModule): Undef<ExternalAsset>; | ||
removeCwd(value: Undef<string>): string; | ||
getUTF8String(file: ExternalAsset, localUri?: string): string; | ||
setAssetContent(file: ExternalAsset, localUri: string, content: string, index?: number): Promise<string>; | ||
getAssetContent(file: ExternalAsset): Undef<string>; | ||
setAssetContent(file: ExternalAsset, localUri: string, content: string, index?: number, replacePattern?: string): Promise<string>; | ||
getAssetContent(file: ExternalAsset, source?: string): Undef<string>; | ||
writeBuffer(file: ExternalAsset): Null<Buffer>; | ||
@@ -244,2 +262,3 @@ writeImage(document: StringOfArray, data: OutputData): boolean; | ||
transformAsset(data: FileData, parent?: ExternalAsset): Promise<void>; | ||
createRequestAgentOptions(uri: string, options?: request.CoreOptions, timeout?: number): Undef<request.CoreOptions>; | ||
processAssets(emptyDir?: boolean): void; | ||
@@ -253,3 +272,4 @@ finalize(): Promise<void>; | ||
resolveMime(data: Buffer | string): Promise<Undef<FileTypeResult>>; | ||
formatSize(value: number, options?: PlainObject): string; | ||
formatSize(value: string): number; | ||
formatSize(value: number, options?: bytes.BytesOptions): string; | ||
new(baseDirectory: string, body: RequestBody, postFinalize?: PostFinalizeCallback, archiving?: boolean): IFileManager; | ||
@@ -282,3 +302,3 @@ } | ||
isString(value: unknown): value is string; | ||
generateUUID(format?: string): string; | ||
generateUUID(format?: string, dictionary?: string): string; | ||
escapePattern(value: string): string; | ||
@@ -290,2 +310,3 @@ parseFunction(value: string, name?: string, sync?: boolean): Undef<FunctionType<Promise<string> | string>>; | ||
hasSameOrigin(value: string, other: string): boolean; | ||
hasSameStat(src: string, dest: string): boolean; | ||
isFileHTTP(value: string): boolean; | ||
@@ -297,3 +318,3 @@ isFileUNC(value: string): boolean; | ||
resolvePath(value: string, href: string): string; | ||
joinPath(...values: Undef<string>[]): string; | ||
joinPath(...values: unknown[]): string; | ||
getFileSize(value: PathLike): number; | ||
@@ -300,0 +321,0 @@ loadSettings(value: Settings): void; |
@@ -14,3 +14,5 @@ /* eslint no-shadow: "off" */ | ||
CLOUD = 64, | ||
TIME_ELAPSED = 128 | ||
TIME_ELAPSED = 128, | ||
TIME_PROCESS = 256, | ||
FAIL = 512 | ||
} | ||
@@ -30,4 +32,11 @@ | ||
export interface LoggerFormat { | ||
width?: number; | ||
color?: typeof ForegroundColor; | ||
bgColor?: typeof BackgroundColor; | ||
justify?: "left" | "center" | "right"; | ||
} | ||
export type LogValue = string | [string, Optional<string>]; | ||
export type ModuleWriteFailMethod = (value: string | [string, string], message?: Null<Error>, type?: LOG_TYPE) => void; | ||
export type ModuleFormatMessageMethod = (type: LOG_TYPE, title: string, value: string | [string, string], message?: unknown, options?: LogMessageOptions) => void; |
import type { CacheTimeout } from './cloud'; | ||
import type { LoggerFormat } from './logger'; | ||
export interface HandlerModule { | ||
handler?: string; | ||
extensions?: string[]; | ||
} | ||
@@ -17,3 +19,3 @@ | ||
export interface ImageModule extends HandlerModule, StringMap {} | ||
export interface ImageModule extends HandlerModule, PlainObject {} | ||
@@ -30,2 +32,10 @@ export interface CloudModule { | ||
export interface LoggerModule { | ||
format?: { | ||
title?: LoggerFormat; | ||
value?: LoggerFormat; | ||
hint?: LoggerFormat; | ||
message?: LoggerFormat; | ||
}; | ||
silent?: boolean; | ||
message?: boolean; | ||
color?: boolean; | ||
@@ -41,2 +51,3 @@ unknown?: boolean; | ||
time_elapsed?: boolean; | ||
time_process?: boolean; | ||
} |
/// <reference path="type.d.ts" /> | ||
/// <reference path="dom.d.ts" /> | ||
@@ -22,3 +23,3 @@ interface ElementScope { | ||
export interface DataSource extends ElementAction, DocumentAction, PlainObject { | ||
export interface DataSource extends ElementAction, DocumentAction { | ||
source: string; | ||
@@ -31,7 +32,8 @@ index?: number; | ||
export interface OutputAction<T = unknown> extends DocumentAction { | ||
export interface OutputAction extends DocumentAction { | ||
moveTo?: string; | ||
process?: string[]; | ||
commands?: string[]; | ||
compress?: CompressFormat[]; | ||
cloudStorage?: T[]; | ||
willChange?: boolean; | ||
} | ||
@@ -48,2 +50,3 @@ | ||
bundleIndex?: number; | ||
bundleReplace?: string; | ||
bundleRoot?: string; | ||
@@ -61,2 +64,6 @@ trailingContent?: string[]; | ||
export interface StorageAction<T = unknown> { | ||
cloudStorage?: T[]; | ||
} | ||
export interface ElementAction { | ||
@@ -99,3 +106,3 @@ element?: XmlTagNode; | ||
export interface FileAsset<T = unknown> extends TextAsset, OutputAction<T> { | ||
export interface FileAsset extends TextAsset, OutputAction { | ||
format?: string; | ||
@@ -128,2 +135,3 @@ base64?: string; | ||
export interface WatchInterval<T = FileAsset> { | ||
id?: string; | ||
interval?: number; | ||
@@ -165,3 +173,19 @@ expires?: string; | ||
export interface FinalizedElement { | ||
documentId: string; | ||
bounds: BoxRectDimension; | ||
css: CssStyleMap; | ||
outerWrapperIds?: string[]; | ||
} | ||
export interface ControllerSettingsDirectoryUI { | ||
layout: string; | ||
string: string; | ||
font: string; | ||
image: string; | ||
video: string; | ||
audio: string; | ||
} | ||
export type AttributeMap = ObjectMap<Optional<string>>; | ||
export type WatchValue = boolean | WatchInterval; |
@@ -5,5 +5,10 @@ type Undef<T> = T | undefined; | ||
type Optional<T> = Undef<T> | Null<T>; | ||
type Nullable<T> = { [P in keyof T]: T[P] | null; }; | ||
type KeyOfType<T, U = any, V = any> = { [K in keyof T]: K extends U ? T[K] extends V ? K : never : never }[keyof T]; | ||
type MapOfType<T, U = any, V = any> = { [K in KeyOfType<T, U, V>]: K extends U ? T[K] extends V ? T[K] : never : never }; | ||
type Constructor<T> = new(...args: any[]) => T; | ||
type FunctionType<T, U = unknown> = (...args: U[]) => T; | ||
type FunctionType<T = unknown, U = unknown> = (...args: U[]) => T; | ||
type NumString = number | string; | ||
@@ -10,0 +15,0 @@ type StringOfArray = string | string[]; |
@@ -9,2 +9,3 @@ import type { ExternalAsset } from './asset'; | ||
interval: number; | ||
id?: string; | ||
port?: number; | ||
@@ -11,0 +12,0 @@ socketId?: string; |
{ | ||
"name": "@squared-functions/types", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "Type definitions for squared-functions", | ||
@@ -16,5 +16,5 @@ "types": "lib/index.d.ts", | ||
"homepage": "https://github.com/anpham6/squared-functions#readme", | ||
"dependencies": { | ||
"typescript": "^4.2.4" | ||
"devDependencies": { | ||
"typescript": "^4.3.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34670
0
19
813
1
- Removedtypescript@^4.2.4
- Removedtypescript@4.9.5(transitive)