@adviser/cement 0.2.18 → 0.2.20

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SysAbstraction } from './base-sys-abstraction-BzVP_lX0.cjs';
2
- export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, a as String2TimeMode, j as SysTime, b as SystemService, h as Time, l as TimeFactory, T as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, f as envFactory } from './base-sys-abstraction-BzVP_lX0.cjs';
1
+ import { S as SysAbstraction } from './base-sys-abstraction-C9WW3w57.cjs';
2
+ export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, a as String2TimeMode, j as SysTime, b as SystemService, h as Time, l as TimeFactory, T as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, f as envFactory } from './base-sys-abstraction-C9WW3w57.cjs';
3
3
  export { i as utils } from './index-_GuS2IT4.cjs';
4
4
  import 'vitest';
5
5
 
@@ -36,49 +36,56 @@ type WithoutResult<T> = T extends Result<infer U> ? U : T;
36
36
 
37
37
  type NullOrUndef = null | undefined;
38
38
  declare function isURL(value: unknown): value is URL;
39
+ declare class MutableURL extends URL {
40
+ private readonly _sysURL;
41
+ private _protocol;
42
+ private _pathname;
43
+ private _hasHostpart;
44
+ readonly hash: string;
45
+ constructor(urlStr: string);
46
+ clone(): MutableURL;
47
+ get hostname(): string;
48
+ set hostname(h: string);
49
+ set pathname(p: string);
50
+ get pathname(): string;
51
+ get protocol(): string;
52
+ set protocol(p: string);
53
+ get searchParams(): URLSearchParams;
54
+ toString(): string;
55
+ }
39
56
  declare class BuildURI {
40
- _url: URL;
57
+ _url: MutableURL;
41
58
  private constructor();
42
59
  static is(value: unknown): value is BuildURI;
43
60
  static from(strURLUri?: CoerceURI, defaultProtocol?: string): BuildURI;
44
61
  hostname(h: string): this;
45
- password(p: string): this;
46
- port(p: string): this;
47
- username(u: string): this;
48
- search(s: string): this;
49
62
  protocol(p: string): this;
50
63
  pathname(p: string): this;
51
- hash(h: string): this;
52
- host(h: string): this;
53
64
  delParam(key: string): this;
54
65
  defParam(key: string, str: string): this;
55
66
  setParam(key: string, str: string): this;
56
67
  toString(): string;
68
+ toJSON(): string;
57
69
  URI(): URI;
58
70
  }
59
- type CoerceURI = string | URL | URI | BuildURI | NullOrUndef;
71
+ type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
60
72
  declare class URI {
61
73
  static merge(into: CoerceURI, from: CoerceURI, defaultProtocol?: string): URI;
62
74
  static is(value: unknown): value is URI;
63
75
  static from(strURLUri?: CoerceURI, defaultProtocol?: string): URI;
64
- readonly _url: URL;
76
+ readonly _url: MutableURL;
65
77
  private constructor();
66
78
  build(): BuildURI;
67
79
  get hostname(): string;
68
- get password(): string;
69
- get port(): string;
70
- get username(): string;
71
- get search(): string;
72
80
  get protocol(): string;
73
81
  get pathname(): string;
74
- get hash(): string;
75
- get host(): string;
76
82
  get getParams(): Iterable<[string, string]>;
77
83
  hasParam(key: string): boolean;
78
84
  getParam(key: string): string | undefined;
79
85
  clone(): URI;
80
86
  asURL(): URL;
81
87
  toString(): string;
88
+ toJSON(): string;
82
89
  }
83
90
 
84
91
  declare enum Level {
@@ -110,6 +117,7 @@ interface LoggerInterface<R> {
110
117
  Module(key: string): R;
111
118
  EnableLevel(level: Level, ...modules: string[]): R;
112
119
  DisableLevel(level: Level, ...modules: string[]): R;
120
+ Attributes(): Record<string, unknown>;
113
121
  SetDebug(...modules: (string | string[])[]): R;
114
122
  SetExposeStack(enable?: boolean): R;
115
123
  Ref(key: string, action: {
@@ -189,6 +197,7 @@ declare class LoggerImpl implements Logger {
189
197
  readonly _logWriter: LogWriterStream;
190
198
  readonly _levelHandler: LevelHandler;
191
199
  constructor(params?: LoggerImplParams);
200
+ Attributes(): Record<string, unknown>;
192
201
  SetExposeStack(enable?: boolean): Logger;
193
202
  EnableLevel(level: Level, ...modules: string[]): Logger;
194
203
  DisableLevel(level: Level, ...modules: string[]): Logger;
@@ -415,4 +424,4 @@ interface CryptoRuntime {
415
424
  }
416
425
  declare function toCryptoRuntime(cryptoOpts?: Partial<CryptoRuntime>): CryptoRuntime;
417
426
 
418
- export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue, LogWriteStream, LogWriterStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, MockLogger, type MockLoggerReturn, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, URI, type WithLogger, type WithoutOption, type WithoutResult, asyncLogValue, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
427
+ export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue, LogWriteStream, LogWriterStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, MockLogger, type MockLoggerReturn, MutableURL, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, URI, type WithLogger, type WithoutOption, type WithoutResult, asyncLogValue, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SysAbstraction } from './base-sys-abstraction-BzVP_lX0.js';
2
- export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, a as String2TimeMode, j as SysTime, b as SystemService, h as Time, l as TimeFactory, T as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, f as envFactory } from './base-sys-abstraction-BzVP_lX0.js';
1
+ import { S as SysAbstraction } from './base-sys-abstraction-C9WW3w57.js';
2
+ export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, a as String2TimeMode, j as SysTime, b as SystemService, h as Time, l as TimeFactory, T as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, f as envFactory } from './base-sys-abstraction-C9WW3w57.js';
3
3
  export { i as utils } from './index-_GuS2IT4.js';
4
4
  import 'vitest';
5
5
 
@@ -36,49 +36,56 @@ type WithoutResult<T> = T extends Result<infer U> ? U : T;
36
36
 
37
37
  type NullOrUndef = null | undefined;
38
38
  declare function isURL(value: unknown): value is URL;
39
+ declare class MutableURL extends URL {
40
+ private readonly _sysURL;
41
+ private _protocol;
42
+ private _pathname;
43
+ private _hasHostpart;
44
+ readonly hash: string;
45
+ constructor(urlStr: string);
46
+ clone(): MutableURL;
47
+ get hostname(): string;
48
+ set hostname(h: string);
49
+ set pathname(p: string);
50
+ get pathname(): string;
51
+ get protocol(): string;
52
+ set protocol(p: string);
53
+ get searchParams(): URLSearchParams;
54
+ toString(): string;
55
+ }
39
56
  declare class BuildURI {
40
- _url: URL;
57
+ _url: MutableURL;
41
58
  private constructor();
42
59
  static is(value: unknown): value is BuildURI;
43
60
  static from(strURLUri?: CoerceURI, defaultProtocol?: string): BuildURI;
44
61
  hostname(h: string): this;
45
- password(p: string): this;
46
- port(p: string): this;
47
- username(u: string): this;
48
- search(s: string): this;
49
62
  protocol(p: string): this;
50
63
  pathname(p: string): this;
51
- hash(h: string): this;
52
- host(h: string): this;
53
64
  delParam(key: string): this;
54
65
  defParam(key: string, str: string): this;
55
66
  setParam(key: string, str: string): this;
56
67
  toString(): string;
68
+ toJSON(): string;
57
69
  URI(): URI;
58
70
  }
59
- type CoerceURI = string | URL | URI | BuildURI | NullOrUndef;
71
+ type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
60
72
  declare class URI {
61
73
  static merge(into: CoerceURI, from: CoerceURI, defaultProtocol?: string): URI;
62
74
  static is(value: unknown): value is URI;
63
75
  static from(strURLUri?: CoerceURI, defaultProtocol?: string): URI;
64
- readonly _url: URL;
76
+ readonly _url: MutableURL;
65
77
  private constructor();
66
78
  build(): BuildURI;
67
79
  get hostname(): string;
68
- get password(): string;
69
- get port(): string;
70
- get username(): string;
71
- get search(): string;
72
80
  get protocol(): string;
73
81
  get pathname(): string;
74
- get hash(): string;
75
- get host(): string;
76
82
  get getParams(): Iterable<[string, string]>;
77
83
  hasParam(key: string): boolean;
78
84
  getParam(key: string): string | undefined;
79
85
  clone(): URI;
80
86
  asURL(): URL;
81
87
  toString(): string;
88
+ toJSON(): string;
82
89
  }
83
90
 
84
91
  declare enum Level {
@@ -110,6 +117,7 @@ interface LoggerInterface<R> {
110
117
  Module(key: string): R;
111
118
  EnableLevel(level: Level, ...modules: string[]): R;
112
119
  DisableLevel(level: Level, ...modules: string[]): R;
120
+ Attributes(): Record<string, unknown>;
113
121
  SetDebug(...modules: (string | string[])[]): R;
114
122
  SetExposeStack(enable?: boolean): R;
115
123
  Ref(key: string, action: {
@@ -189,6 +197,7 @@ declare class LoggerImpl implements Logger {
189
197
  readonly _logWriter: LogWriterStream;
190
198
  readonly _levelHandler: LevelHandler;
191
199
  constructor(params?: LoggerImplParams);
200
+ Attributes(): Record<string, unknown>;
192
201
  SetExposeStack(enable?: boolean): Logger;
193
202
  EnableLevel(level: Level, ...modules: string[]): Logger;
194
203
  DisableLevel(level: Level, ...modules: string[]): Logger;
@@ -415,4 +424,4 @@ interface CryptoRuntime {
415
424
  }
416
425
  declare function toCryptoRuntime(cryptoOpts?: Partial<CryptoRuntime>): CryptoRuntime;
417
426
 
418
- export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue, LogWriteStream, LogWriterStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, MockLogger, type MockLoggerReturn, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, URI, type WithLogger, type WithoutOption, type WithoutResult, asyncLogValue, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
427
+ export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue, LogWriteStream, LogWriterStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, MockLogger, type MockLoggerReturn, MutableURL, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, URI, type WithLogger, type WithoutOption, type WithoutResult, asyncLogValue, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
package/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-AO7BGISE.js";
6
6
  import {
7
7
  WebSysAbstraction
8
- } from "./chunk-LJRKN3XI.js";
8
+ } from "./chunk-2L33RPFJ.js";
9
9
  import {
10
10
  BaseSysAbstraction,
11
11
  BrowserEnvActions,
@@ -30,7 +30,7 @@ import {
30
30
  TimeUnits,
31
31
  WrapperSysAbstraction,
32
32
  envFactory
33
- } from "./chunk-P4FB5FHU.js";
33
+ } from "./chunk-JYUQZNDZ.js";
34
34
  import {
35
35
  __spreadValues,
36
36
  __yieldStar
@@ -123,34 +123,100 @@ function falsy2undef(value) {
123
123
  }
124
124
  function ensureURLWithDefaultProto(url, defaultProtocol) {
125
125
  if (!url) {
126
- return new URL(`${defaultProtocol}//`);
126
+ return new MutableURL(`${defaultProtocol}//`);
127
127
  }
128
128
  if (typeof url === "string") {
129
129
  try {
130
- return new URL(url);
130
+ return new MutableURL(url);
131
131
  } catch (e) {
132
- return new URL(`${defaultProtocol}//${url}`);
132
+ return new MutableURL(`${defaultProtocol}//${url}`);
133
133
  }
134
134
  } else {
135
- return url;
135
+ return new MutableURL(url.toString());
136
136
  }
137
137
  }
138
138
  function isURL(value) {
139
139
  return value instanceof URL || !!value && typeof value.searchParams === "object" && typeof value.searchParams.sort === "function" && typeof value.hash === "string";
140
140
  }
141
+ var MutableURL = class _MutableURL extends URL {
142
+ constructor(urlStr) {
143
+ super("defect://does.not.exist");
144
+ this._sysURL = new URL(urlStr);
145
+ this._protocol = this._sysURL.protocol;
146
+ this._hasHostpart = ["http:", "https:"].includes(this._protocol);
147
+ if (this._hasHostpart) {
148
+ this._pathname = this._sysURL.pathname;
149
+ } else {
150
+ this._pathname = urlStr.replace(new RegExp(`^${this._protocol}//`), "").replace(/[#?].*$/, "");
151
+ }
152
+ this.hash = this._sysURL.hash;
153
+ }
154
+ clone() {
155
+ return new _MutableURL(this.toString());
156
+ }
157
+ get hostname() {
158
+ if (!this._hasHostpart) {
159
+ throw new Error("you can use hostname only if protocol is http or https");
160
+ }
161
+ return this._sysURL.hostname;
162
+ }
163
+ set hostname(h) {
164
+ if (!this._hasHostpart) {
165
+ throw new Error("you can use hostname only if protocol is http or https");
166
+ }
167
+ this._sysURL.hostname = h;
168
+ }
169
+ set pathname(p) {
170
+ this._pathname = p;
171
+ }
172
+ get pathname() {
173
+ return this._pathname;
174
+ }
175
+ get protocol() {
176
+ return this._protocol;
177
+ }
178
+ set protocol(p) {
179
+ if (!p.endsWith(":")) {
180
+ p = `${p}:`;
181
+ }
182
+ this._protocol = p;
183
+ }
184
+ get searchParams() {
185
+ return this._sysURL.searchParams;
186
+ }
187
+ toString() {
188
+ let search = "";
189
+ if (this._sysURL.searchParams.size) {
190
+ for (const [key, value] of Array.from(this._sysURL.searchParams.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
191
+ search += `${!search.length ? "?" : "&"}${key}=${encodeURIComponent(value)}`;
192
+ }
193
+ }
194
+ let hostpart = "";
195
+ if (this._hasHostpart) {
196
+ hostpart = this._sysURL.hostname;
197
+ if (this._sysURL.port) {
198
+ hostpart += `:${this._sysURL.port}`;
199
+ }
200
+ if (!this._pathname.startsWith("/")) {
201
+ hostpart += "/";
202
+ }
203
+ }
204
+ return `${this._protocol}//${hostpart}${this._pathname}${search}`;
205
+ }
206
+ };
141
207
  function from(fac, strURLUri, defaultProtocol) {
142
208
  switch (typeof falsy2undef(strURLUri)) {
143
209
  case "undefined":
144
- return fac(new URL(`${defaultProtocol}//`));
210
+ return fac(new MutableURL(`${defaultProtocol}///`));
145
211
  case "string":
146
212
  return fac(ensureURLWithDefaultProto(strURLUri, defaultProtocol));
147
213
  case "object":
148
214
  if (BuildURI.is(strURLUri)) {
149
- return fac(new URL(strURLUri._url.toString()));
215
+ return fac(new MutableURL(strURLUri._url.toString()));
150
216
  } else if (URI.is(strURLUri)) {
151
- return fac(new URL(strURLUri._url.toString()));
217
+ return fac(new MutableURL(strURLUri._url.toString()));
152
218
  } else if (isURL(strURLUri)) {
153
- return fac(new URL(strURLUri.toString()));
219
+ return fac(new MutableURL(strURLUri.toString()));
154
220
  }
155
221
  throw new Error(`unknown object type: ${strURLUri}`);
156
222
  default:
@@ -172,46 +238,38 @@ var BuildURI = class _BuildURI {
172
238
  this._url.hostname = h;
173
239
  return this;
174
240
  }
175
- password(p) {
176
- this._url.password = p;
177
- return this;
178
- }
179
- port(p) {
180
- this._url.port = p;
181
- return this;
182
- }
183
- username(u) {
184
- this._url.username = u;
185
- return this;
186
- }
187
- search(s) {
188
- this._url.search = s;
189
- return this;
190
- }
241
+ // password(p: string) {
242
+ // this._url.password = p;
243
+ // return this;
244
+ // }
245
+ // port(p: string) {
246
+ // this._url.port = p;
247
+ // return this;
248
+ // }
249
+ // username(u: string) {
250
+ // this._url.username = u;
251
+ // return this;
252
+ // }
253
+ // search(s: string) {
254
+ // this._url.search = s;
255
+ // return this;
256
+ // }
191
257
  protocol(p) {
192
- if (!p.endsWith(":")) {
193
- p = `${p}:`;
194
- }
195
- const mySrc = this._url.toString();
196
- const myDst = mySrc.replace(new RegExp(`^${this._url.protocol}`), `${p}`);
197
- this._url = new URL(myDst);
258
+ this._url.protocol = p;
198
259
  return this;
199
260
  }
200
261
  pathname(p) {
201
- const myp = this.URI().pathname;
202
- const mySrc = this._url.toString();
203
- const myDst = mySrc.replace(new RegExp(`^${this._url.protocol}//${myp}`), `${this._url.protocol}//${p}`);
204
- this._url = new URL(myDst);
205
- return this;
206
- }
207
- hash(h) {
208
- this._url.hash = h;
209
- return this;
210
- }
211
- host(h) {
212
- this._url.host = h;
262
+ this._url.pathname = p;
213
263
  return this;
214
264
  }
265
+ // hash(h: string) {
266
+ // this._url.hash = h;
267
+ // return this;
268
+ // }
269
+ // host(h: string) {
270
+ // this._url.host = h;
271
+ // return this;
272
+ // }
215
273
  delParam(key) {
216
274
  this._url.searchParams.delete(key);
217
275
  return this;
@@ -230,6 +288,9 @@ var BuildURI = class _BuildURI {
230
288
  this._url.searchParams.sort();
231
289
  return this._url.toString();
232
290
  }
291
+ toJSON() {
292
+ return this.toString();
293
+ }
233
294
  URI() {
234
295
  return URI.from(this._url);
235
296
  }
@@ -257,38 +318,38 @@ var URI = class _URI {
257
318
  return from((url) => new _URI(url), strURLUri, defaultProtocol);
258
319
  }
259
320
  constructor(url) {
260
- this._url = url;
321
+ this._url = url.clone();
261
322
  }
262
323
  build() {
263
- return BuildURI.from(this.asURL());
324
+ return BuildURI.from(this._url);
264
325
  }
265
326
  get hostname() {
266
327
  return this._url.hostname;
267
328
  }
268
- get password() {
269
- return this._url.password;
270
- }
271
- get port() {
272
- return this._url.port;
273
- }
274
- get username() {
275
- return this._url.username;
276
- }
277
- get search() {
278
- return this._url.search;
279
- }
329
+ // get password(): string {
330
+ // return this._url.password;
331
+ // }
332
+ // get port(): string {
333
+ // return this._url.port;
334
+ // }
335
+ // get username(): string {
336
+ // return this._url.username;
337
+ // }
338
+ // get search(): string {
339
+ // return this._url.search;
340
+ // }
280
341
  get protocol() {
281
342
  return this._url.protocol;
282
343
  }
283
344
  get pathname() {
284
345
  return this._url.toString().replace(/^.*:\/\//, "").replace(/\?.*$/, "");
285
346
  }
286
- get hash() {
287
- return this._url.hash;
288
- }
289
- get host() {
290
- return this._url.host;
291
- }
347
+ // get hash(): string {
348
+ // return this._url.hash;
349
+ // }
350
+ // get host(): string {
351
+ // return this._url.host;
352
+ // }
292
353
  get getParams() {
293
354
  return this._url.searchParams.entries();
294
355
  }
@@ -299,17 +360,17 @@ var URI = class _URI {
299
360
  return falsy2undef(this._url.searchParams.get(key));
300
361
  }
301
362
  clone() {
302
- return new _URI(this.asURL());
363
+ return new _URI(this._url);
303
364
  }
304
365
  asURL() {
305
- const url = new URL(this._url.toString());
306
- url.searchParams.sort();
307
- return url;
366
+ return this._url.clone();
308
367
  }
309
368
  toString() {
310
- this._url.searchParams.sort();
311
369
  return this._url.toString();
312
370
  }
371
+ toJSON() {
372
+ return this.toString();
373
+ }
313
374
  };
314
375
 
315
376
  // src/runtime.ts
@@ -523,6 +584,17 @@ var LoggerImpl = class _LoggerImpl {
523
584
  this._levelHandler = levelSingleton;
524
585
  }
525
586
  }
587
+ Attributes() {
588
+ return Array.from(Object.entries(this._attributes)).reduce(
589
+ (acc, [key, value]) => {
590
+ if (value instanceof LogValue) {
591
+ acc[key] = value.value();
592
+ }
593
+ return acc;
594
+ },
595
+ {}
596
+ );
597
+ }
526
598
  SetExposeStack(enable) {
527
599
  this._levelHandler.setExposeStack(enable);
528
600
  return this;
@@ -546,7 +618,7 @@ var LoggerImpl = class _LoggerImpl {
546
618
  return this;
547
619
  }
548
620
  Timestamp() {
549
- this._attributes["ts"] = logValue(this._sys.Time().Now().toISOString());
621
+ this._attributes["ts"] = logValue(() => this._sys.Time().Now().toISOString());
550
622
  return this;
551
623
  }
552
624
  Warn() {
@@ -663,18 +735,11 @@ var LoggerImpl = class _LoggerImpl {
663
735
  return ret;
664
736
  }
665
737
  _produceError(attr, ...args) {
666
- var _a;
667
738
  attr["msg"] = logValue(args.join(" "));
668
739
  const msg = attr["msg"].value();
669
740
  if (typeof msg === "string" && !msg.trim().length) {
670
741
  delete attr["msg"];
671
742
  }
672
- if (((_a = toLogValue(attr["ts"])) == null ? void 0 : _a.value()) === "ETERNITY") {
673
- this.Timestamp.call({
674
- _sys: this._sys,
675
- _attributes: attr
676
- });
677
- }
678
743
  return JSON.stringify(attr, removeSelfRef());
679
744
  }
680
745
  Msg(...args) {
@@ -706,6 +771,9 @@ var WithLoggerBuilder = class {
706
771
  Object.assign(this._li._withAttributes, this._li._attributes);
707
772
  return this._li;
708
773
  }
774
+ Attributes() {
775
+ return __spreadValues({}, this._li._attributes);
776
+ }
709
777
  SetExposeStack(enable) {
710
778
  this._li._levelHandler.setExposeStack(enable);
711
779
  return this;
@@ -787,7 +855,7 @@ var WithLoggerBuilder = class {
787
855
  return this;
788
856
  }
789
857
  Timestamp() {
790
- this._li._attributes["ts"] = logValue("ETERNITY");
858
+ this._li.Timestamp();
791
859
  return this;
792
860
  }
793
861
  Any(key, value) {
@@ -1066,6 +1134,7 @@ export {
1066
1134
  LogWriterStream,
1067
1135
  LoggerImpl,
1068
1136
  MockLogger,
1137
+ MutableURL,
1069
1138
  None,
1070
1139
  Option,
1071
1140
  RandomMode,