@e-mc/types 0.3.0 → 0.3.2

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/index.d.ts CHANGED
@@ -217,11 +217,13 @@ declare namespace types {
217
217
  };
218
218
 
219
219
  interface THRESHOLD {
220
+ FILEMANAGER_INTERVAL: number;
220
221
  WATCH_INTERVAL: number;
221
222
  WATCH_CHANGE: number;
222
223
  }
223
224
 
224
225
  const THRESHOLD: {
226
+ FILEMANAGER_INTERVAL: number;
225
227
  WATCH_INTERVAL: number;
226
228
  WATCH_CHANGE: number;
227
229
  };
@@ -272,7 +274,7 @@ declare namespace types {
272
274
  function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
273
275
  function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
274
276
  function generateUUID(): string;
275
- function validateUUID(value: unknown): value is string;
277
+ function validateUUID(value: unknown): boolean;
276
278
  function randomString(format: string, dictionary?: string): string;
277
279
  function errorValue(value: string, hint?: string): Error;
278
280
  function errorMessage(title: NumString, value: string, hint?: string): Error;
package/index.js CHANGED
@@ -14,8 +14,6 @@ class AbortError extends Error {
14
14
  this.name = 'AbortError';
15
15
  }
16
16
  }
17
- const REGEXP_GLOB = /(?<!\\)(?:(?:[^*]|^)\*{1,2}(?:[^*]|$)|\{[^}]+\}|\[[!^][^\]]+\]|[!?*+@]\([^)]+\))/;
18
- const REGEXP_CASCADE = /^(.+?)(?:\[(.+)\])?$/;
19
17
  const REGEXP_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
20
18
  const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)([\w_$]*)\s*\(([^)]*)\)\s*\{([\S\s]*)\})$/;
21
19
  const ASYNC_FUNCTION = Object.getPrototypeOf(async () => { }).constructor;
@@ -325,6 +323,7 @@ var IMPORT_MAP;
325
323
  })(IMPORT_MAP = exports.IMPORT_MAP || (exports.IMPORT_MAP = {}));
326
324
  var THRESHOLD;
327
325
  (function (THRESHOLD) {
326
+ THRESHOLD[THRESHOLD["FILEMANAGER_INTERVAL"] = 100] = "FILEMANAGER_INTERVAL";
328
327
  THRESHOLD[THRESHOLD["WATCH_INTERVAL"] = 500] = "WATCH_INTERVAL";
329
328
  THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
330
329
  })(THRESHOLD = exports.THRESHOLD || (exports.THRESHOLD = {}));
@@ -502,7 +501,7 @@ function convertTime(value, format) {
502
501
  }
503
502
  exports.convertTime = convertTime;
504
503
  function hasGlob(value) {
505
- return REGEXP_GLOB.test(value);
504
+ return /(?<!\\)(?:(?:[^*]|^)\*{1,2}(?:[^*]|$)|\{[^}]+\}|\[[!^][^\]]+\]|[!?*+@]\([^)]+\))/.test(value);
506
505
  }
507
506
  exports.hasGlob = hasGlob;
508
507
  function escapePattern(value, lookBehind) {
@@ -571,7 +570,7 @@ function cascadeObject(data, query, fallback) {
571
570
  if (isObject(data) && isString(query)) {
572
571
  const names = query.trim().split(/(?<!\\)\./).map(item => item.indexOf('.') !== -1 ? item.replace(/\\(?=\.)/g, '') : item);
573
572
  for (let i = 0, length = names.length, match, current = data; i < length; ++i) {
574
- if (!(match = REGEXP_CASCADE.exec(names[i]))) {
573
+ if (!(match = /^(.+?)(?:\[(.+)\])?$/.exec(names[i]))) {
575
574
  break;
576
575
  }
577
576
  let index = match[2];
@@ -26,7 +26,7 @@ export interface IModuleLibV4 {
26
26
  isPlainObject<T = PlainObject>(value: unknown): value is T;
27
27
  escapePattern(value: unknown, lookBehind?: boolean): string;
28
28
  generateUUID(format?: string, dictionary?: string): string;
29
- validateUUID(value: unknown): value is string;
29
+ validateUUID(value: unknown): boolean;
30
30
  cloneObject<T, U = unknown>(data: T, options?: boolean | WeakSet<object> | CloneObjectOptions<U>): T;
31
31
  coerceObject<T = unknown>(data: T, parseString?: FunctionType<unknown, string> | boolean, cache?: boolean): T;
32
32
  asFunction<T = unknown, U = FunctionType<Promise<T> | T>>(value: unknown, sync?: boolean): Null<U>;
package/lib/index.d.ts CHANGED
@@ -202,7 +202,7 @@ declare namespace functions {
202
202
  new(module?: U, database?: CloudDatabase[], ...args: unknown[]): ICloud<T, U, V>;
203
203
  }
204
204
 
205
- interface IDocument<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud> extends IClient<T, V, TransformCallback<T, U>> {
205
+ interface IDocument<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends IClient<T, V, TransformCallback<T, U>> {
206
206
  Db: Null<IDb>;
207
207
  assets: U[];
208
208
  config: StandardMap;
@@ -244,7 +244,7 @@ declare namespace functions {
244
244
  get watching(): boolean;
245
245
  }
246
246
 
247
- interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud> extends ModuleConstructor {
247
+ interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ModuleConstructor {
248
248
  finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
249
249
  createSourceMap(code: string, remove: boolean): SourceMap;
250
250
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
package/lib/settings.d.ts CHANGED
@@ -243,10 +243,14 @@ export interface RequestSettings extends PurgeAction, PlainObject {
243
243
  time_format?: "readable" | "relative" | "none";
244
244
  }
245
245
 
246
- export interface WatchModule extends HandlerModule, ServerInfo {
246
+ export interface WatchModule<T = WatchSettings> extends HandlerModule<T>, ServerInfo {
247
247
  interval?: NumString;
248
248
  }
249
249
 
250
+ export interface WatchSettings<T = PlainObject> extends PlainObject {
251
+ users?: ObjectMap<ObjectMap<T>>;
252
+ }
253
+
250
254
  export interface CompressModule<U = CompressSettings> extends HandlerSettings<U> {
251
255
  gzip?: ZlibOptions;
252
256
  brotli?: BrotliOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/lib/android.d.ts DELETED
@@ -1,53 +0,0 @@
1
- import type { FinalizedElement, ControllerSettingsDirectoryUI as IControllerSettingsDirectoryUI } from './squared';
2
-
3
- import type { ExternalAsset } from './asset';
4
- import type { RequestData as IRequestData } from './node';
5
-
6
- export interface DocumentOutput {
7
- targetAPI?: NumString;
8
- manifest?: ManifestData;
9
- namespace?: string;
10
- profileable?: boolean | StringOfArray;
11
- dependencies?: string[];
12
- directories?: ControllerSettingsDirectoryUI;
13
- elements?: FinalizedElement[];
14
- projectName?: string;
15
- mainParentDir?: string;
16
- mainSrcDir?: string;
17
- mainActivityFile?: string;
18
- javaVersion?: NumString;
19
- versionName?: string;
20
- versionCode?: number;
21
- dataBinding?: boolean;
22
- commands?: ArrayOf<StringOfArray>;
23
- extensionData?: PlainObject;
24
- }
25
-
26
- export interface RequestData extends IRequestData<ExternalAsset>, DocumentOutput {}
27
-
28
- export interface ManifestData {
29
- package?: string;
30
- application?: {
31
- supportsRtl?: boolean;
32
- label?: string;
33
- theme?: string;
34
- metaData?: { name?: string; resource?: string; value?: string }[];
35
- activity?: ObjectMap<{
36
- layout?: {
37
- defaultWidth?: string;
38
- defaultHeight?: string;
39
- minWidth?: string;
40
- minHeight?: string;
41
- gravity?: string;
42
- };
43
- }>;
44
- activityName?: string;
45
- fontProvider?: string;
46
- };
47
- }
48
-
49
- export interface ControllerSettingsDirectoryUI extends IControllerSettingsDirectoryUI {
50
- main: string;
51
- animation: string;
52
- theme: string;
53
- }
package/lib/chrome.d.ts DELETED
@@ -1,106 +0,0 @@
1
- import type { AttributeAction, ConditionProperty, CssConditionData, ElementAction, ExcludeAction, FileAsset, FromAction, HashAction, DataSource as IDataSource, ImportAction, MetadataAction, ViewEngine, XmlTagNode } from './squared';
2
-
3
- import type { UploadAction } from './cloud';
4
- import type { CascadeAction, DbSource } from './db';
5
- import type { RequestData as IRequestData } from './node';
6
-
7
- interface ImportFrom {
8
- placeholder: string;
9
- original: string;
10
- uri: string;
11
- type?: string;
12
- dynamic?: boolean;
13
- }
14
-
15
- interface DataObject extends CascadeAction {
16
- format?: string;
17
- options?: PlainObject;
18
- }
19
-
20
- export interface DocumentOutput {
21
- productionRelease?: boolean | string;
22
- productionIncremental?: boolean;
23
- useOriginalHtmlPage?: boolean | string;
24
- useUnsafeReplace?: ArrayOf<"html" | "css"> | boolean;
25
- stripCommentsAndCDATA?: boolean | string;
26
- normalizeHtmlOutput?: boolean | string;
27
- escapeReservedCharacters?: boolean;
28
- ignoreServerCodeBlocks?: string[];
29
- webBundle?: {
30
- rootDirAlias?: string;
31
- baseUrl?: string;
32
- primaryUrl?: string;
33
- copyTo?: string;
34
- rewriteHtmlPage?: boolean | string;
35
- excludeHtmlPage?: boolean;
36
- excludeTransforms?: boolean;
37
- includeScopes?: string[];
38
- excludeScopes?: string[];
39
- };
40
- templateMap?: TemplateMap;
41
- }
42
-
43
- export interface RequestData extends IRequestData<ChromeAsset>, Readonly<DocumentOutput>, Readonly<CssRuleData> {}
44
-
45
- export interface ChromeAsset extends FileAsset, AttributeAction, ElementAction, MetadataAction<PlainObject>, UploadAction, HashAction, ExcludeAction, ImportAction<ImportFrom[] | boolean>, FromAction {
46
- preserve?: boolean;
47
- static?: boolean;
48
- editing?: boolean;
49
- inlineContent?: string;
50
- originAddress?: boolean;
51
- }
52
-
53
- export interface TemplateMap extends PlainObject {
54
- html?: ObjectMap<StringMap>;
55
- js?: ObjectMap<StringMap>;
56
- css?: ObjectMap<StringMap>;
57
- data?: StringMap;
58
- }
59
-
60
- export interface CssRuleData {
61
- usedVariables?: string[];
62
- usedFontFace?: string[];
63
- usedKeyframes?: string[];
64
- unusedStyles?: string[];
65
- unusedMedia?: string[];
66
- unusedContainer?: string[];
67
- unusedSupports?: string[];
68
- unusedAtRules?: UnusedAtRule[];
69
- }
70
-
71
- export interface UnusedAtRule {
72
- selector?: string;
73
- media?: ConditionProperty;
74
- supports?: ConditionProperty;
75
- container?: CssConditionData & Partial<ConditionProperty>;
76
- layer?: string[];
77
- }
78
-
79
- export interface DataSource<T = string> extends IDataSource<T>, ElementAction {
80
- source: "cloud" | "uri" | "local" | "export" | DbSource;
81
- element?: XmlTagNode;
82
- type?: "text" | "attribute" | "display";
83
- dynamic?: boolean;
84
- value?: StringOfArray | ObjectMap<unknown>;
85
- template?: string;
86
- viewEngine?: ViewEngine | string;
87
- ignoreEmpty?: boolean;
88
- }
89
-
90
- export interface UriDataSource extends DataSource, DataObject {
91
- source: "uri";
92
- }
93
-
94
- export interface LocalDataSource extends DataSource, DataObject {
95
- source: "local";
96
- pathname?: string;
97
- }
98
-
99
- export interface ExportDataSource extends DataSource, CascadeAction {
100
- source: "export";
101
- execute?: FunctionType;
102
- pathname?: string;
103
- settings?: string;
104
- params?: unknown;
105
- persist?: boolean;
106
- }