@e-mc/types 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -10
- package/constant.d.ts +11 -1
- package/index.d.ts +12 -0
- package/index.js +14 -8
- package/lib/cloud.d.ts +13 -11
- package/lib/core.d.ts +1 -0
- package/lib/db.d.ts +2 -0
- package/lib/filemanager.d.ts +12 -1
- package/lib/index.d.ts +9 -2
- package/lib/module.d.ts +9 -4
- package/lib/settings.d.ts +6 -2
- package/lib/squared.d.ts +30 -6
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright 2023 An Pham
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
1
|
+
Copyright 2023 An Pham
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
11
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/constant.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const enum INTERNAL {
|
|
2
|
-
VERSION = '0.
|
|
2
|
+
VERSION = '0.7.1',
|
|
3
3
|
TEMP_DIR = 'tmp', // eslint-disable-line @typescript-eslint/no-shadow
|
|
4
4
|
CJS = '__cjs__'
|
|
5
5
|
}
|
|
@@ -19,6 +19,8 @@ export const enum VAL_CLOUD {
|
|
|
19
19
|
DOWNLOAD_FILE = 'Download success',
|
|
20
20
|
DELETE_FILE = 'Delete success',
|
|
21
21
|
RENAME_FILE = 'File renamed',
|
|
22
|
+
CREATE_TAG = 'Tags created',
|
|
23
|
+
DELETE_TAG = 'Tags deleted',
|
|
22
24
|
PUBLIC_READ = 'Grant public-read',
|
|
23
25
|
CREATE_BUCKET = 'Bucket created',
|
|
24
26
|
DELETE_BUCKET = 'Bucket deleted',
|
|
@@ -35,8 +37,10 @@ export const enum ERR_MESSAGE {
|
|
|
35
37
|
ABORTED = 'Aborted',
|
|
36
38
|
ABORTED_OPERATION = 'The operation was aborted',
|
|
37
39
|
FAILED = 'Failed',
|
|
40
|
+
FAILED_CHECKSUM = 'Checksum did not match',
|
|
38
41
|
PARAMETERS = 'Invalid parameters',
|
|
39
42
|
FORMAT = 'Invalid format',
|
|
43
|
+
CHECKSUM = 'Invalid checksum',
|
|
40
44
|
ERROR_CODE = 'Error code',
|
|
41
45
|
EXEC_PERMISSION = 'Exec command not permitted',
|
|
42
46
|
NOT_CACHEABLE = 'Not able to cache',
|
|
@@ -225,6 +229,12 @@ export const enum LOG_TYPE {
|
|
|
225
229
|
DB = 65536
|
|
226
230
|
}
|
|
227
231
|
|
|
232
|
+
export const enum READDIR_SORT {
|
|
233
|
+
FILE = 0,
|
|
234
|
+
DIRECTORY = 1,
|
|
235
|
+
DESCENDING = 2
|
|
236
|
+
}
|
|
237
|
+
|
|
228
238
|
export const enum SETTINGS_KEY_NAME {
|
|
229
239
|
NODE_PROCESS_CPUUSAGE = "node.process.cpu_usage",
|
|
230
240
|
NODE_PROCESS_MEMORYUSAGE = "node.process.memory_usage",
|
package/index.d.ts
CHANGED
|
@@ -216,6 +216,18 @@ declare namespace types {
|
|
|
216
216
|
ERROR: "error";
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
+
interface READDIR_SORT {
|
|
220
|
+
FILE: number;
|
|
221
|
+
DIRECTORY: number;
|
|
222
|
+
DESCENDING: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const READDIR_SORT: {
|
|
226
|
+
FILE: 0;
|
|
227
|
+
DIRECTORY: 1;
|
|
228
|
+
DESCENDING: 2;
|
|
229
|
+
};
|
|
230
|
+
|
|
219
231
|
interface THRESHOLD {
|
|
220
232
|
FILEMANAGER_INTERVAL: number;
|
|
221
233
|
WATCH_INTERVAL: number;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.generateUUID = exports.purgeMemory = void 0;
|
|
3
|
+
exports.errorValue = exports.validateUUID = exports.randomString = exports.decryptUTF8 = exports.encryptUTF8 = exports.getEncoding = exports.asFunction = exports.coerceObject = exports.cloneObject = exports.cascadeObject = exports.formatSize = exports.renameExt = exports.escapePattern = exports.hasGlob = exports.convertTime = exports.formatTime = exports.parseExpires = exports.parseTime = exports.isEmpty = exports.isString = exports.isObject = exports.isPlainObject = exports.isArray = exports.setTempDir = exports.getTempDir = exports.setLogCurrent = exports.getLogCurrent = exports.existsFlag = exports.mainFlag = exports.processFlag = exports.modifiedFlag = exports.watchFlag = exports.usingFlag = exports.cloneFlag = exports.ignoreFlag = exports.hasBit = exports.createAbortError = exports.IMPORT_MAP = exports.THRESHOLD = exports.READDIR_SORT = exports.WATCH_EVENT = exports.DB_TRANSACTION = exports.DB_TYPE = exports.FETCH_TYPE = exports.DOWNLOAD_TYPE = exports.ERR_CODE = exports.ASSET_FLAG = exports.FILE_TYPE = exports.STATUS_TYPE = exports.LOG_TYPE = void 0;
|
|
4
|
+
exports.generateUUID = exports.purgeMemory = exports.errorMessage = void 0;
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const crypto = require("crypto");
|
|
@@ -241,6 +241,18 @@ var WATCH_EVENT;
|
|
|
241
241
|
WATCH_EVENT["CLOSE"] = "close";
|
|
242
242
|
WATCH_EVENT["ERROR"] = "error";
|
|
243
243
|
})(WATCH_EVENT || (exports.WATCH_EVENT = WATCH_EVENT = {}));
|
|
244
|
+
var READDIR_SORT;
|
|
245
|
+
(function (READDIR_SORT) {
|
|
246
|
+
READDIR_SORT[READDIR_SORT["FILE"] = 0] = "FILE";
|
|
247
|
+
READDIR_SORT[READDIR_SORT["DIRECTORY"] = 1] = "DIRECTORY";
|
|
248
|
+
READDIR_SORT[READDIR_SORT["DESCENDING"] = 2] = "DESCENDING";
|
|
249
|
+
})(READDIR_SORT || (exports.READDIR_SORT = READDIR_SORT = {}));
|
|
250
|
+
var THRESHOLD;
|
|
251
|
+
(function (THRESHOLD) {
|
|
252
|
+
THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
|
|
253
|
+
THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
|
|
254
|
+
THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
|
|
255
|
+
})(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
|
|
244
256
|
var IMPORT_MAP;
|
|
245
257
|
(function (IMPORT_MAP) {
|
|
246
258
|
IMPORT_MAP["@squared-functions/cloud"] = "@e-mc/cloud";
|
|
@@ -321,12 +333,6 @@ var IMPORT_MAP;
|
|
|
321
333
|
IMPORT_MAP["@squared-functions/document/packages/terser"] = "@pi-r/terser";
|
|
322
334
|
IMPORT_MAP["@squared-functions/document/packages/uglify-js"] = "@pi-r/uglify-js";
|
|
323
335
|
})(IMPORT_MAP || (exports.IMPORT_MAP = IMPORT_MAP = {}));
|
|
324
|
-
var THRESHOLD;
|
|
325
|
-
(function (THRESHOLD) {
|
|
326
|
-
THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
|
|
327
|
-
THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
|
|
328
|
-
THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
|
|
329
|
-
})(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
|
|
330
336
|
function createAbortError() {
|
|
331
337
|
return new AbortError();
|
|
332
338
|
}
|
package/lib/cloud.d.ts
CHANGED
|
@@ -25,27 +25,29 @@ export interface CloudStorage extends CloudService {
|
|
|
25
25
|
download?: CloudStorageDownload;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown> extends CloudStorageACL<U> {
|
|
28
|
+
export interface CloudStorageAdmin<T = unknown, U = string, V = unknown, W = unknown> extends CloudStorageACL<U> {
|
|
29
29
|
emptyBucket?: boolean;
|
|
30
30
|
configBucket?: {
|
|
31
31
|
create?: T;
|
|
32
32
|
policy?: V;
|
|
33
33
|
website?: BucketWebsiteOptions;
|
|
34
|
+
retentionPolicy?: W;
|
|
34
35
|
};
|
|
35
36
|
recursive?: boolean;
|
|
36
37
|
preservePath?: boolean;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export interface CloudStorageAction<T = unknown, U = string, V = unknown> extends Partial<LocationUri> {
|
|
40
|
+
export interface CloudStorageAction<T = unknown, U = string, V = unknown, W = unknown> extends Partial<LocationUri> {
|
|
40
41
|
active?: boolean;
|
|
41
42
|
overwrite?: boolean;
|
|
42
|
-
admin?: CloudStorageAdmin<T, U, V>;
|
|
43
|
+
admin?: CloudStorageAdmin<T, U, V, W>;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string> extends CloudStorageACL<U>, CloudStorageAction<V, W> {
|
|
46
|
+
export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = string, X = unknown> extends CloudStorageACL<U>, CloudStorageAction<V, W, unknown, X> {
|
|
46
47
|
buffer?: Null<Buffer>;
|
|
47
48
|
contentType?: string;
|
|
48
49
|
metadata?: Record<string, string>;
|
|
50
|
+
tags?: Record<string, string> | false;
|
|
49
51
|
options?: T;
|
|
50
52
|
fileGroup?: [BufferContent, string, string?][];
|
|
51
53
|
localStorage?: boolean;
|
|
@@ -71,19 +73,19 @@ export interface BucketWebsiteOptions {
|
|
|
71
73
|
errorPath?: string;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
export interface
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface UploadData<T = unknown, U = string, V = unknown, W = string> extends FunctionData {
|
|
79
|
-
upload: CloudStorageUpload<T, U, V, W>;
|
|
76
|
+
export interface UploadData<T = unknown, U = string, V = unknown, W = string, X = unknown> extends BucketAction {
|
|
77
|
+
upload: CloudStorageUpload<T, U, V, W, X>;
|
|
80
78
|
localUri: string;
|
|
81
79
|
buffer: Buffer;
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
export interface DownloadData<T = unknown> extends
|
|
82
|
+
export interface DownloadData<T = unknown> extends BucketAction {
|
|
85
83
|
download: CloudStorageDownload<T>;
|
|
86
84
|
}
|
|
87
85
|
|
|
86
|
+
export interface BucketAction {
|
|
87
|
+
bucket: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
88
90
|
export type CloudFeatures = "storage" | "database";
|
|
89
91
|
export type CloudFunctions = "upload" | "download";
|
package/lib/core.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ export interface PermissionConstructor {
|
|
|
109
109
|
validate(settings: unknown): settings is PermittedDirectories;
|
|
110
110
|
clone(permission: IPermission, freeze?: boolean): IPermission;
|
|
111
111
|
match(pathname: string, pattern: StringOfArray): boolean;
|
|
112
|
+
toPosix(value: unknown): StringOfArray;
|
|
112
113
|
readonly prototype: IPermission;
|
|
113
114
|
new(freeze?: boolean): IPermission;
|
|
114
115
|
}
|
package/lib/db.d.ts
CHANGED
package/lib/filemanager.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { BundleAction, FileInfo, LogStatus } from './squared';
|
|
1
|
+
import type { BundleAction, ChecksumOutput, FileInfo, LogStatus } from './squared';
|
|
2
2
|
|
|
3
3
|
import type { IFileManager, IModule, ModuleConstructor } from './index';
|
|
4
4
|
import type { ExternalAsset } from './asset';
|
|
5
5
|
import type { HostInitLog as IHostInitLog } from './core';
|
|
6
|
+
import type { ReadHashOptions } from './module';
|
|
6
7
|
import type { RequestData as IRequestData } from './node';
|
|
7
8
|
import type { RequestInit } from './request';
|
|
8
9
|
|
|
@@ -99,5 +100,15 @@ export interface FindAssetOptions<T extends ExternalAsset = ExternalAsset> {
|
|
|
99
100
|
replaced?: boolean;
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
export interface ChecksumOptions extends ReadHashOptions, Pick<ChecksumOutput, "include" | "exclude" | "recursive"> {
|
|
104
|
+
dot?: boolean;
|
|
105
|
+
sortBy?: number;
|
|
106
|
+
verbose?: boolean;
|
|
107
|
+
ignore?: string[];
|
|
108
|
+
joinRoot?: boolean;
|
|
109
|
+
outPath?: string;
|
|
110
|
+
throwsEmpty?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
102
113
|
export type FetchType = FETCH_TYPE[keyof FETCH_TYPE];
|
|
103
114
|
export type PostFinalizeCallback = (files: FileInfo[] | string[], errors: string[], status?: LogStatus[]) => void;
|
package/lib/index.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ import type { BufferResult, CompressFormat, TryFileCompressor, TryFileResult, Tr
|
|
|
11
11
|
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
12
12
|
import type { BatchQueryResult, DB_TYPE, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, PoolConfig, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
13
13
|
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
14
|
-
import type { AssetContentOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
14
|
+
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
15
15
|
import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http';
|
|
16
16
|
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from './image';
|
|
17
17
|
import type { ExecCommand, LOG_TYPE, LogArguments, LogComponent, LogDate, LogFailOptions, LogMessageOptions, LogOptions, LogProcessOptions, LogTime, LogType, LogValue, STATUS_TYPE, StatusType } from './logger';
|
|
18
|
-
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
18
|
+
import type { AsHashOptions, CheckSemVerOptions, CopyDirOptions, CopyDirResult, CopyFileOptions, CreateDirOptions, DeleteFileOptions, GetTempDirOptions, MoveFileOptions, NormalizeFlags, ParseFunctionOptions, PermissionOptions, ProtocolType, ReadFileCallback, ReadFileOptions, ReadHashOptions, RemoveDirOptions, WriteFileOptions } from './module';
|
|
19
19
|
import type { RequestData, Settings } from './node';
|
|
20
20
|
import type { ApplyOptions, Aria2Options, BufferFormat, DataEncodedResult, DataObjectResult, FormDataPart, HostConfig, OpenOptions, PostOptions, ProxySettings, ReadExpectType, RequestInit } from './request';
|
|
21
21
|
import type { ClientModule, CloudModule, CloudServiceOptions, CompressModule, CompressSettings, DbCoerceSettings, DbModule, DbSourceOptions, DnsLookupSettings, DocumentComponent, DocumentComponentOption, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, RequestSettings, TaskModule, WatchModule } from './settings';
|
|
@@ -486,6 +486,12 @@ declare namespace functions {
|
|
|
486
486
|
loadSettings(settings: Settings, password?: string): boolean;
|
|
487
487
|
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
488
488
|
sanitizeAssets(assets: T[], exclusions?: string[]): T[];
|
|
489
|
+
writeChecksum(root: string, options?: ChecksumOptions): Promise<string[]>;
|
|
490
|
+
writeChecksum(root: string, to: Undef<string>, options?: ChecksumOptions): Promise<Null<string[]>>;
|
|
491
|
+
writeChecksum(root: string, to?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<string[]>>;
|
|
492
|
+
verifyChecksum(root: string, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
|
|
493
|
+
verifyChecksum(root: string, from: Undef<string>, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
|
|
494
|
+
verifyChecksum(root: string, from?: string | ChecksumOptions, options?: ChecksumOptions): Promise<Null<[string[], string[]]>>;
|
|
489
495
|
createFileThread(host: IFileManager<T>, file: T): IFileThread<T>;
|
|
490
496
|
setTimeout(options: ObjectMap<NumString>): void;
|
|
491
497
|
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
@@ -684,6 +690,7 @@ declare namespace functions {
|
|
|
684
690
|
asHash(data: BinaryLike, options: AsHashOptions): string;
|
|
685
691
|
asHash(data: BinaryLike, minLength: number): string;
|
|
686
692
|
asHash(data: BinaryLike, algorithm?: NumString | AsHashOptions, minLength?: number | AsHashOptions): string;
|
|
693
|
+
readHash(value: string | URL, options?: ReadHashOptions): Promise<string>;
|
|
687
694
|
toPosix(value: unknown, normalize: boolean): string;
|
|
688
695
|
toPosix(value: unknown, filename?: string, normalize?: boolean): string;
|
|
689
696
|
hasLogType(value: LogType): boolean;
|
package/lib/module.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChecksumBase } from './squared';
|
|
2
|
+
|
|
3
|
+
import type { HashOptions } from 'crypto';
|
|
2
4
|
|
|
3
5
|
declare enum NORMALIZE_FLAGS {
|
|
4
6
|
NONE = 0,
|
|
@@ -95,9 +97,12 @@ export interface CopyDirResult {
|
|
|
95
97
|
ignored: string[];
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
export interface
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
export interface ReadHashOptions extends ChecksumBase {
|
|
101
|
+
chunkSize?: number;
|
|
102
|
+
minStreamSize?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface AsHashOptions extends HashOptions, ChecksumBase {
|
|
101
106
|
minLength?: number;
|
|
102
107
|
}
|
|
103
108
|
|
package/lib/settings.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface ClientSettings extends PlainObject {
|
|
|
33
33
|
cache_dir?: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export interface NodeModule {
|
|
36
|
+
export interface NodeModule<T = PlainObject> extends HandlerSettings<T> {
|
|
37
37
|
process?: {
|
|
38
38
|
cpu_usage?: boolean;
|
|
39
39
|
memory_usage?: boolean;
|
|
@@ -125,6 +125,10 @@ export interface DocumentGroup<T = { imports?: StringMap } & AnyObject, U = T> {
|
|
|
125
125
|
imports?: StringMap;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
export interface DocumentUsersGroup<T = AnyObject, U = T> extends DocumentGroup<T, U> {
|
|
129
|
+
extensions?: Null<string[]>;
|
|
130
|
+
}
|
|
131
|
+
|
|
128
132
|
export interface DocumentComponent<T = boolean, U = T, V = U> extends Omit<DocumentGroup<T, U>, "pages"> {
|
|
129
133
|
cloud?: V;
|
|
130
134
|
}
|
|
@@ -137,7 +141,7 @@ export interface DocumentComponentOption<T = unknown> {
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
export interface DocumentSettings extends DocumentGroup, PurgeAction, PlainObject {
|
|
140
|
-
users?: ObjectMap<
|
|
144
|
+
users?: ObjectMap<DocumentUsersGroup>;
|
|
141
145
|
directory?: DocumentDirectory;
|
|
142
146
|
options?: DocumentComponentOptions;
|
|
143
147
|
}
|
package/lib/squared.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference path="type.d.ts" />
|
|
2
2
|
/// <reference path="object.d.ts" />
|
|
3
3
|
|
|
4
|
+
import type { BinaryToTextEncoding } from "crypto";
|
|
5
|
+
|
|
4
6
|
interface Asset extends MimeTypeAction {
|
|
5
7
|
uri?: string;
|
|
6
8
|
}
|
|
@@ -33,7 +35,7 @@ interface BoxRectDimension extends BoxRect, Dimension {
|
|
|
33
35
|
overflow?: boolean;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
export interface FileAsset extends TextAsset, OutputAction, DocumentAction, MultipartAction, ResourceAction, IncrementalAction {
|
|
38
|
+
export interface FileAsset extends TextAsset, OutputAction, DocumentAction, MultipartAction, ResourceAction, IncrementalAction, ChecksumAction {
|
|
37
39
|
format?: StringOfArray;
|
|
38
40
|
dataView?: NodeJS.ArrayBufferView;
|
|
39
41
|
base64?: string;
|
|
@@ -96,6 +98,11 @@ export interface BundleAction<T = unknown> {
|
|
|
96
98
|
exported?: boolean;
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
export interface ChecksumAction {
|
|
102
|
+
checksum?: ChecksumValue;
|
|
103
|
+
checksumOutput?: ChecksumValue;
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
export interface DocumentAction {
|
|
100
107
|
document?: StringOfArray;
|
|
101
108
|
encoding?: BufferEncoding;
|
|
@@ -220,11 +227,8 @@ export interface CompressFormat extends CompressLevel {
|
|
|
220
227
|
options?: PlainObject & { apiKey?: string };
|
|
221
228
|
}
|
|
222
229
|
|
|
223
|
-
export interface WatchInterval<T = FileAsset> {
|
|
230
|
+
export interface WatchInterval<T = FileAsset> extends TaskBase {
|
|
224
231
|
id?: string;
|
|
225
|
-
interval?: NumString;
|
|
226
|
-
start?: NumString;
|
|
227
|
-
expires?: NumString;
|
|
228
232
|
main?: boolean;
|
|
229
233
|
reload?: WatchReload;
|
|
230
234
|
assets?: T[];
|
|
@@ -282,6 +286,7 @@ export interface RequestData extends RequestBase, ImportAction<StringMap>, Incre
|
|
|
282
286
|
task?: string[];
|
|
283
287
|
modules?: string[];
|
|
284
288
|
update?: WatchInterval;
|
|
289
|
+
checksum?: string | boolean | 1 | ChecksumOutput;
|
|
285
290
|
cache?: boolean | AnyObject;
|
|
286
291
|
}
|
|
287
292
|
|
|
@@ -343,8 +348,27 @@ export interface ControllerSettingsDirectoryUI {
|
|
|
343
348
|
audio: string;
|
|
344
349
|
}
|
|
345
350
|
|
|
351
|
+
export interface ChecksumBase<T = BinaryToTextEncoding> {
|
|
352
|
+
algorithm?: string;
|
|
353
|
+
digest?: T;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface ChecksumOutput<T = BinaryToTextEncoding> extends ChecksumBase<T> {
|
|
357
|
+
filename?: string;
|
|
358
|
+
include?: StringOfArray;
|
|
359
|
+
exclude?: StringOfArray;
|
|
360
|
+
recursive?: boolean | 1;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface TaskBase {
|
|
364
|
+
interval?: NumString;
|
|
365
|
+
start?: NumString;
|
|
366
|
+
expires?: NumString;
|
|
367
|
+
}
|
|
368
|
+
|
|
346
369
|
export type WebSocketEvent = "close" | "error";
|
|
347
370
|
export type IncrementalMatch = "none" | "staging" | "etag" | "exists";
|
|
348
371
|
export type TextEncoding = "utf-8" | "utf-16" | "utf-16be" | "utf-16le" | "latin1";
|
|
349
372
|
export type AttributeMap = ObjectMap<unknown>;
|
|
350
|
-
export type WatchValue = boolean | WatchInterval;
|
|
373
|
+
export type WatchValue = boolean | WatchInterval;
|
|
374
|
+
export type ChecksumValue = string | ChecksumBase & { value?: string };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Type definitions for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"bytes": "^3.1.2",
|
|
24
|
-
"uuid": "^9.0.
|
|
24
|
+
"uuid": "^9.0.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"typescript": "5.
|
|
27
|
+
"typescript": "5.3.3"
|
|
28
28
|
}
|
|
29
29
|
}
|