@e-mc/types 0.11.8 → 0.11.10

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.11.8/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.10/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -198,10 +198,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
198
198
 
199
199
  ## References
200
200
 
201
- - https://www.unpkg.com/@e-mc/types@0.11.8/index.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/logger.d.ts
203
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/module.d.ts
204
- - https://www.unpkg.com/@e-mc/types@0.11.8/lib/node.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.11.10/index.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.11.10/lib/logger.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.11.10/lib/module.d.ts
204
+ - https://www.unpkg.com/@e-mc/types@0.11.10/lib/node.d.ts
205
205
 
206
206
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
207
207
  * https://www.npmjs.com/package/@types/bytes
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.11.8',
2
+ VERSION = '0.11.10',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
@@ -73,6 +73,7 @@ export const enum ERR_MESSAGE {
73
73
  UNSUPPORTED_MIME = 'Unsupported MIME',
74
74
  UNSUPPORTED_READ = 'Not permitted to read file',
75
75
  UNSUPPORTED_WRITE = 'Not permitted to write file',
76
+ UNSUPPORTED_PATH = 'Not permitted to set absolute path',
76
77
  NOTFOUND_PATH = 'Path not found',
77
78
  NOTFOUND_FILE = 'File not found',
78
79
  NOTFOUND_BINARY = 'Binary not found',
package/index.js CHANGED
@@ -584,18 +584,15 @@ function parseTime(value, start = 0) {
584
584
  const seconds = +value;
585
585
  if (isNaN(seconds) && isString(value)) {
586
586
  let result = 0;
587
- for (const match of value.toLowerCase().matchAll(/\b([\d.]+)\s*(y|M|w|d|h|ms?|s)\b/g)) {
587
+ for (const match of value.matchAll(/\b([\d.]+)\s*(y|w|d|h|ms?|s)\b/gi)) {
588
588
  const n = +match[1];
589
589
  if (isNaN(n)) {
590
590
  continue;
591
591
  }
592
- switch (match[2]) {
592
+ switch (match[2].toLowerCase()) {
593
593
  case 'y':
594
594
  result += n * 31449600000;
595
595
  break;
596
- case 'M':
597
- result += n * 2592000000;
598
- break;
599
596
  case 'w':
600
597
  result += n * 604800000;
601
598
  break;
@@ -605,15 +602,15 @@ function parseTime(value, start = 0) {
605
602
  case 'h':
606
603
  result += n * 3600000;
607
604
  break;
608
- case 'm':
609
- result += n * 60000;
610
- break;
611
605
  case 's':
612
606
  result += n * 1000;
613
607
  break;
614
608
  case 'ms':
615
609
  result += Math.ceil(n);
616
610
  break;
611
+ default:
612
+ result += n * (match[2] === 'M' ? 2592000000 : 60000);
613
+ break;
617
614
  }
618
615
  }
619
616
  if (result > 0) {
@@ -648,10 +645,10 @@ function formatTime(value, elapsed, char = ' ') {
648
645
  if (value >= 60000) {
649
646
  const m = Math.floor(value / 60000);
650
647
  value -= m * 60000;
651
- result += padStart(m, result ? '0' : ' ') + ':';
648
+ result += (result ? padStart(m, '0') : m) + ':';
652
649
  }
653
650
  else {
654
- result += '0:';
651
+ result += result ? '00:' : '0:';
655
652
  }
656
653
  if (value >= 1000) {
657
654
  const s = Math.floor(value / 1000);
package/lib/document.d.ts CHANGED
@@ -81,7 +81,7 @@ export interface TransformOptions<T = AnyObject, U = T> extends TransformOutput
81
81
  supplementChunks: ChunkData[];
82
82
  }
83
83
 
84
- export interface ITransformSeries<T = AnyObject, U = T> extends IModule, TransformOptions<T, U> {
84
+ export interface ITransformSeries<T = AnyObject, U = T, V = object> extends IModule, TransformOptions<T, U> {
85
85
  readonly type: string;
86
86
  init(instance: IModule, dirname?: string): this;
87
87
  close(instance: IModule): void;
@@ -89,12 +89,12 @@ export interface ITransformSeries<T = AnyObject, U = T> extends IModule, Transfo
89
89
  getMainFile(code?: string, imports?: StringMap): SourceInput<string> | undefined;
90
90
  getSourceFiles(imports?: StringMap): SourceInput | undefined;
91
91
  toBaseConfig(all?: boolean): T;
92
- upgrade<V = unknown>(context: V, dirname?: string, pkgname?: string): V;
93
- upgradeESM<V = unknown>(context: V, dirname?: string, pkgname?: string): Promise<V>;
92
+ upgrade<W = unknown>(context: W, dirname?: string, pkgname?: string): W;
93
+ upgradeESM<W = unknown>(context: W, dirname?: string, pkgname?: string): Promise<W>;
94
94
  set code(value);
95
95
  get code(): string;
96
96
  get out(): IOut;
97
- get metadata(): object;
97
+ get metadata(): V;
98
98
  get options(): TransformOutput;
99
99
  get productionRelease(): boolean;
100
100
  get imported(): boolean;
package/lib/index.d.ts CHANGED
@@ -147,7 +147,7 @@ declare namespace functions {
147
147
  executeBatchQuery(batch: V[], sessionKey: string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
148
148
  executeBatchQuery(batch: V[], options?: ExecuteBatchQueryOptions | string, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
149
149
  processRows(batch: V[], tasks: Promise<QueryResult | null>[], parallel: boolean): Promise<BatchQueryResult>;
150
- processRows(batch: V[], tasks: Promise<QueryResult | null>[], options?: ProcessRowsOptions, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
150
+ processRows(batch: V[], tasks: Promise<QueryResult | null>[], options?: ProcessRowsOptions | boolean, outResult?: BatchQueryResult): Promise<BatchQueryResult>;
151
151
  handleFail(err: unknown, item: V, options?: HandleFailOptions): boolean;
152
152
  readTLSCert(value: unknown, cache?: boolean): string;
153
153
  readTLSConfig(options: SecureContextOptions, cache?: boolean): void;
package/lib/request.d.ts CHANGED
@@ -137,6 +137,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction {
137
137
  pipeTo?: string | Writable;
138
138
  postData?: unknown;
139
139
  connected?: ((headers: IncomingHttpHeaders) => boolean | void);
140
+ trailers?: (headers: IncomingHttpHeaders) => void;
140
141
  statusMessage?: string;
141
142
  progressId?: number | string;
142
143
  outFormat?: { out: BufferFormat; parser?: PlainObject };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.11.8",
3
+ "version": "0.11.10",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",