@venizia/ignis-helpers 0.5.0-2 → 0.5.0-3

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.
Files changed (68) hide show
  1. package/dist/esm/common/const-class.d.ts +22 -0
  2. package/dist/esm/common/const-class.js +41 -0
  3. package/dist/esm/common/const-class.js.map +1 -0
  4. package/dist/esm/common/constants/duration.d.ts +3 -4
  5. package/dist/esm/common/constants/duration.js +3 -15
  6. package/dist/esm/common/constants/duration.js.map +1 -1
  7. package/dist/esm/common/constants/http.d.ts +2 -3
  8. package/dist/esm/common/constants/http.js +2 -5
  9. package/dist/esm/common/constants/http.js.map +1 -1
  10. package/dist/esm/common/constants/mime.d.ts +3 -6
  11. package/dist/esm/common/constants/mime.js +3 -66
  12. package/dist/esm/common/constants/mime.js.map +1 -1
  13. package/dist/esm/common/index.d.ts +1 -0
  14. package/dist/esm/common/index.js +1 -0
  15. package/dist/esm/common/index.js.map +1 -1
  16. package/dist/esm/modules/crypto/algorithms/aes.constants.d.ts +2 -3
  17. package/dist/esm/modules/crypto/algorithms/aes.constants.js +2 -5
  18. package/dist/esm/modules/crypto/algorithms/aes.constants.js.map +1 -1
  19. package/dist/esm/modules/crypto/algorithms/credential.algorithm.js +1 -1
  20. package/dist/esm/modules/crypto/algorithms/credential.algorithm.js.map +1 -1
  21. package/dist/esm/modules/crypto/common/constants.d.ts +4 -9
  22. package/dist/esm/modules/crypto/common/constants.js +4 -21
  23. package/dist/esm/modules/crypto/common/constants.js.map +1 -1
  24. package/dist/esm/modules/logger/common/constants.d.ts +2 -3
  25. package/dist/esm/modules/logger/common/constants.js +2 -5
  26. package/dist/esm/modules/logger/common/constants.js.map +1 -1
  27. package/dist/esm/modules/logger/pino/common/constants.d.ts +2 -3
  28. package/dist/esm/modules/logger/pino/common/constants.js +2 -5
  29. package/dist/esm/modules/logger/pino/common/constants.js.map +1 -1
  30. package/dist/esm/modules/logger/winston/formats.js +2 -2
  31. package/dist/esm/modules/logger/winston/formats.js.map +1 -1
  32. package/dist/esm/modules/queue/kafka/common/constants.d.ts +3 -4
  33. package/dist/esm/modules/queue/kafka/common/constants.js +2 -5
  34. package/dist/esm/modules/queue/kafka/common/constants.js.map +1 -1
  35. package/dist/esm/modules/retry/common/constants.d.ts +3 -6
  36. package/dist/esm/modules/retry/common/constants.js +3 -15
  37. package/dist/esm/modules/retry/common/constants.js.map +1 -1
  38. package/dist/esm/modules/secrets/common/constants.d.ts +3 -6
  39. package/dist/esm/modules/secrets/common/constants.js +3 -10
  40. package/dist/esm/modules/secrets/common/constants.js.map +1 -1
  41. package/dist/esm/modules/socket/socket-io/common/constants.d.ts +2 -4
  42. package/dist/esm/modules/socket/socket-io/common/constants.js +2 -9
  43. package/dist/esm/modules/socket/socket-io/common/constants.js.map +1 -1
  44. package/dist/esm/modules/socket/websocket/common/constants.d.ts +4 -9
  45. package/dist/esm/modules/socket/websocket/common/constants.js +4 -29
  46. package/dist/esm/modules/socket/websocket/common/constants.js.map +1 -1
  47. package/dist/esm/modules/temporal/abstract.js +1 -1
  48. package/dist/esm/modules/temporal/abstract.js.map +1 -1
  49. package/dist/esm/modules/temporal/common/constants.d.ts +6 -15
  50. package/dist/esm/modules/temporal/common/constants.js +6 -40
  51. package/dist/esm/modules/temporal/common/constants.js.map +1 -1
  52. package/dist/esm/modules/temporal/duration/duration.js +1 -1
  53. package/dist/esm/modules/temporal/duration/duration.js.map +1 -1
  54. package/dist/esm/modules/temporal/helper.js +1 -1
  55. package/dist/esm/modules/temporal/helper.js.map +1 -1
  56. package/dist/esm/modules/uid/common/constants.d.ts +3 -6
  57. package/dist/esm/modules/uid/common/constants.js +3 -10
  58. package/dist/esm/modules/uid/common/constants.js.map +1 -1
  59. package/dist/esm/modules/uid/opaque.js +1 -1
  60. package/dist/esm/modules/uid/opaque.js.map +1 -1
  61. package/dist/esm/modules/uid/token.js +1 -1
  62. package/dist/esm/modules/uid/token.js.map +1 -1
  63. package/dist/esm/utilities/request.utility.d.ts +2 -3
  64. package/dist/esm/utilities/request.utility.js +2 -5
  65. package/dist/esm/utilities/request.utility.js.map +1 -1
  66. package/dist/esm/utilities/retry.utility.js +2 -2
  67. package/dist/esm/utilities/retry.utility.js.map +1 -1
  68. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { ConstClass } from '../../../common/const-class.js';
1
2
  import type { TConstValue } from '../../../common/index.js';
2
3
  /** Key size in bits assumed when an algorithm name carries no size suffix (see `getAlgorithmKeySize`). */
3
4
  export declare const DEFAULT_CIPHER_BITS = 256;
@@ -16,7 +17,7 @@ export declare const MINIMUM_KDF_SALT_BYTES = 16;
16
17
  /** NIST SP 800-57 Part 1 floor for RSA past 2030. */
17
18
  export declare const MINIMUM_RSA_MODULUS_BITS = 2048;
18
19
  /** Digest names the hash algorithm accepts. `isValid` narrows a string to `THashAlgorithm`. */
19
- export declare class HashAlgorithms {
20
+ export declare class HashAlgorithms extends ConstClass {
20
21
  /** Cryptographically broken - kept only for wire-protocol compatibility (VNPay checksums); never use for security decisions. */
21
22
  static readonly MD5 = "md5";
22
23
  /** Cryptographically weak - kept for wire-protocol compatibility with legacy integrations; never use for security decisions. */
@@ -24,30 +25,24 @@ export declare class HashAlgorithms {
24
25
  static readonly SHA256 = "sha256";
25
26
  static readonly SHA384 = "sha384";
26
27
  static readonly SHA512 = "sha512";
27
- static readonly SCHEME_SET: Set<string>;
28
- static isValid(value: string): value is THashAlgorithm;
29
28
  }
30
29
  /** One of the `HashAlgorithms` values. */
31
30
  export type THashAlgorithm = TConstValue<typeof HashAlgorithms>;
32
31
  /** Text encodings a digest can be written in. `isValid` narrows a string to `THashOutputEncoding`. */
33
- export declare class HashOutputEncodings {
32
+ export declare class HashOutputEncodings extends ConstClass {
34
33
  static readonly HEX = "hex";
35
34
  static readonly BASE64 = "base64";
36
35
  static readonly BASE64URL = "base64url";
37
- static readonly SCHEME_SET: Set<string>;
38
- static isValid(value: string): value is THashOutputEncoding;
39
36
  }
40
37
  /** One of the `HashOutputEncodings` values. */
41
38
  export type THashOutputEncoding = TConstValue<typeof HashOutputEncodings>;
42
39
  /** Encoding used when `outputEncoding` is omitted. */
43
40
  export declare const DEFAULT_HASH_OUTPUT_ENCODING: THashOutputEncoding;
44
41
  /** Password-hash schemes `CredentialUtility` accepts. `isValid` narrows a string to `TCredentialAlgorithm`. */
45
- export declare class CredentialAlgorithms {
42
+ export declare class CredentialAlgorithms extends ConstClass {
46
43
  /** What `Bun.password` writes with its default parameters; the scheme `hash` uses unless told otherwise. */
47
44
  static readonly ARGON2ID = "argon2id";
48
45
  static readonly BCRYPT = "bcrypt";
49
- static readonly SCHEME_SET: Set<string>;
50
- static isValid(value: string): value is TCredentialAlgorithm;
51
46
  }
52
47
  /** One of the `CredentialAlgorithms` values. */
53
48
  export type TCredentialAlgorithm = TConstValue<typeof CredentialAlgorithms>;
@@ -1,3 +1,4 @@
1
+ import { ConstClass } from '../../../common/const-class.js';
1
2
  /** Key size in bits assumed when an algorithm name carries no size suffix (see `getAlgorithmKeySize`). */
2
3
  export const DEFAULT_CIPHER_BITS = 256;
3
4
  /**
@@ -15,7 +16,7 @@ export const MINIMUM_KDF_SALT_BYTES = 16;
15
16
  /** NIST SP 800-57 Part 1 floor for RSA past 2030. */
16
17
  export const MINIMUM_RSA_MODULUS_BITS = 2048;
17
18
  /** Digest names the hash algorithm accepts. `isValid` narrows a string to `THashAlgorithm`. */
18
- export class HashAlgorithms {
19
+ export class HashAlgorithms extends ConstClass {
19
20
  /** Cryptographically broken - kept only for wire-protocol compatibility (VNPay checksums); never use for security decisions. */
20
21
  static { this.MD5 = 'md5'; }
21
22
  /** Cryptographically weak - kept for wire-protocol compatibility with legacy integrations; never use for security decisions. */
@@ -23,38 +24,20 @@ export class HashAlgorithms {
23
24
  static { this.SHA256 = 'sha256'; }
24
25
  static { this.SHA384 = 'sha384'; }
25
26
  static { this.SHA512 = 'sha512'; }
26
- static { this.SCHEME_SET = new Set([
27
- this.MD5,
28
- this.SHA1,
29
- this.SHA256,
30
- this.SHA384,
31
- this.SHA512,
32
- ]); }
33
- static isValid(value) {
34
- return this.SCHEME_SET.has(value);
35
- }
36
27
  }
37
28
  /** Text encodings a digest can be written in. `isValid` narrows a string to `THashOutputEncoding`. */
38
- export class HashOutputEncodings {
29
+ export class HashOutputEncodings extends ConstClass {
39
30
  static { this.HEX = 'hex'; }
40
31
  static { this.BASE64 = 'base64'; }
41
32
  static { this.BASE64URL = 'base64url'; }
42
- static { this.SCHEME_SET = new Set([this.HEX, this.BASE64, this.BASE64URL]); }
43
- static isValid(value) {
44
- return this.SCHEME_SET.has(value);
45
- }
46
33
  }
47
34
  /** Encoding used when `outputEncoding` is omitted. */
48
35
  export const DEFAULT_HASH_OUTPUT_ENCODING = HashOutputEncodings.HEX;
49
36
  /** Password-hash schemes `CredentialUtility` accepts. `isValid` narrows a string to `TCredentialAlgorithm`. */
50
- export class CredentialAlgorithms {
37
+ export class CredentialAlgorithms extends ConstClass {
51
38
  /** What `Bun.password` writes with its default parameters; the scheme `hash` uses unless told otherwise. */
52
39
  static { this.ARGON2ID = 'argon2id'; }
53
40
  static { this.BCRYPT = 'bcrypt'; }
54
- static { this.SCHEME_SET = new Set([this.ARGON2ID, this.BCRYPT]); }
55
- static isValid(value) {
56
- return this.SCHEME_SET.has(value);
57
- }
58
41
  }
59
42
  /** Scheme `CredentialUtility.hash` uses when `algorithm` is omitted. */
60
43
  export const DEFAULT_CREDENTIAL_ALGORITHM = CredentialAlgorithms.ARGON2ID;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/constants.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACpD,6IAA6I;AAC7I,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,yEAA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AG,UAAU,CAAC;aACtB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3E,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,wEAAwE;AACxE,MAAM,CAAC,MAAM,4BAA4B,GAAyB,oBAAoB,CAAC,QAAQ,CAAC","sourcesContent":["import type { TConstValue } from '@/common';\n\n/** Key size in bits assumed when an algorithm name carries no size suffix (see `getAlgorithmKeySize`). */\nexport const DEFAULT_CIPHER_BITS = 256;\n\n/**\n * Public and identical across every deployment, so it stops a bare dictionary attack but not a\n * table precomputed against this value - pass `kdfSalt` for per-deployment isolation. Never\n * change this: every ciphertext already encrypted under it becomes undecryptable.\n */\nexport const DEFAULT_KDF_SALT = 'ignis-kdf-salt-v1';\n/** PBKDF2 iteration count used when `kdfIterations` is omitted. Changing it makes ciphertext encrypted under the old count undecryptable. */\nexport const DEFAULT_KDF_ITERATIONS = 100_000;\n/** PBKDF2 digest for key derivation; it is not configurable per call. */\nexport const DEFAULT_KDF_DIGEST = 'sha256';\n\n/** NIST SP 800-132 minimum recommended salt size (128 bits) for a caller-supplied `kdfSalt`. */\nexport const MINIMUM_KDF_SALT_BYTES = 16;\n\n/** NIST SP 800-57 Part 1 floor for RSA past 2030. */\nexport const MINIMUM_RSA_MODULUS_BITS = 2048;\n\n/** Digest names the hash algorithm accepts. `isValid` narrows a string to `THashAlgorithm`. */\nexport class HashAlgorithms {\n /** Cryptographically broken - kept only for wire-protocol compatibility (VNPay checksums); never use for security decisions. */\n static readonly MD5 = 'md5';\n\n /** Cryptographically weak - kept for wire-protocol compatibility with legacy integrations; never use for security decisions. */\n static readonly SHA1 = 'sha1';\n\n static readonly SHA256 = 'sha256';\n static readonly SHA384 = 'sha384';\n static readonly SHA512 = 'sha512';\n\n static readonly SCHEME_SET = new Set<string>([\n this.MD5,\n this.SHA1,\n this.SHA256,\n this.SHA384,\n this.SHA512,\n ]);\n\n static isValid(value: string): value is THashAlgorithm {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `HashAlgorithms` values. */\nexport type THashAlgorithm = TConstValue<typeof HashAlgorithms>;\n\n/** Text encodings a digest can be written in. `isValid` narrows a string to `THashOutputEncoding`. */\nexport class HashOutputEncodings {\n static readonly HEX = 'hex';\n static readonly BASE64 = 'base64';\n static readonly BASE64URL = 'base64url';\n\n static readonly SCHEME_SET = new Set<string>([this.HEX, this.BASE64, this.BASE64URL]);\n\n static isValid(value: string): value is THashOutputEncoding {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `HashOutputEncodings` values. */\nexport type THashOutputEncoding = TConstValue<typeof HashOutputEncodings>;\n\n/** Encoding used when `outputEncoding` is omitted. */\nexport const DEFAULT_HASH_OUTPUT_ENCODING: THashOutputEncoding = HashOutputEncodings.HEX;\n\n/** Password-hash schemes `CredentialUtility` accepts. `isValid` narrows a string to `TCredentialAlgorithm`. */\nexport class CredentialAlgorithms {\n /** What `Bun.password` writes with its default parameters; the scheme `hash` uses unless told otherwise. */\n static readonly ARGON2ID = 'argon2id';\n static readonly BCRYPT = 'bcrypt';\n\n static readonly SCHEME_SET = new Set<string>([this.ARGON2ID, this.BCRYPT]);\n\n static isValid(value: string): value is TCredentialAlgorithm {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `CredentialAlgorithms` values. */\nexport type TCredentialAlgorithm = TConstValue<typeof CredentialAlgorithms>;\n\n/** Scheme `CredentialUtility.hash` uses when `algorithm` is omitted. */\nexport const DEFAULT_CREDENTIAL_ALGORITHM: TCredentialAlgorithm = CredentialAlgorithms.ARGON2ID;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACpD,6IAA6I;AAC7I,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAE3C,gGAAgG;AAChG,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,+FAA+F;AAC/F,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,gIAAgI;aAChH,QAAG,GAAG,KAAK,CAAC;IAE5B,gIAAgI;aAChH,SAAI,GAAG,MAAM,CAAC;aAEd,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;;AAMpC,sGAAsG;AACtG,MAAM,OAAO,mBAAoB,SAAQ,UAAU;aACjC,QAAG,GAAG,KAAK,CAAC;aACZ,WAAM,GAAG,QAAQ,CAAC;aAClB,cAAS,GAAG,WAAW,CAAC;;AAM1C,sDAAsD;AACtD,MAAM,CAAC,MAAM,4BAA4B,GAAwB,mBAAmB,CAAC,GAAG,CAAC;AAEzF,+GAA+G;AAC/G,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAClD,4GAA4G;aAC5F,aAAQ,GAAG,UAAU,CAAC;aACtB,WAAM,GAAG,QAAQ,CAAC;;AAMpC,wEAAwE;AACxE,MAAM,CAAC,MAAM,4BAA4B,GAAyB,oBAAoB,CAAC,QAAQ,CAAC","sourcesContent":["import { ConstClass } from '@/common/const-class';\nimport type { TConstValue } from '@/common';\n\n/** Key size in bits assumed when an algorithm name carries no size suffix (see `getAlgorithmKeySize`). */\nexport const DEFAULT_CIPHER_BITS = 256;\n\n/**\n * Public and identical across every deployment, so it stops a bare dictionary attack but not a\n * table precomputed against this value - pass `kdfSalt` for per-deployment isolation. Never\n * change this: every ciphertext already encrypted under it becomes undecryptable.\n */\nexport const DEFAULT_KDF_SALT = 'ignis-kdf-salt-v1';\n/** PBKDF2 iteration count used when `kdfIterations` is omitted. Changing it makes ciphertext encrypted under the old count undecryptable. */\nexport const DEFAULT_KDF_ITERATIONS = 100_000;\n/** PBKDF2 digest for key derivation; it is not configurable per call. */\nexport const DEFAULT_KDF_DIGEST = 'sha256';\n\n/** NIST SP 800-132 minimum recommended salt size (128 bits) for a caller-supplied `kdfSalt`. */\nexport const MINIMUM_KDF_SALT_BYTES = 16;\n\n/** NIST SP 800-57 Part 1 floor for RSA past 2030. */\nexport const MINIMUM_RSA_MODULUS_BITS = 2048;\n\n/** Digest names the hash algorithm accepts. `isValid` narrows a string to `THashAlgorithm`. */\nexport class HashAlgorithms extends ConstClass {\n /** Cryptographically broken - kept only for wire-protocol compatibility (VNPay checksums); never use for security decisions. */\n static readonly MD5 = 'md5';\n\n /** Cryptographically weak - kept for wire-protocol compatibility with legacy integrations; never use for security decisions. */\n static readonly SHA1 = 'sha1';\n\n static readonly SHA256 = 'sha256';\n static readonly SHA384 = 'sha384';\n static readonly SHA512 = 'sha512';\n}\n\n/** One of the `HashAlgorithms` values. */\nexport type THashAlgorithm = TConstValue<typeof HashAlgorithms>;\n\n/** Text encodings a digest can be written in. `isValid` narrows a string to `THashOutputEncoding`. */\nexport class HashOutputEncodings extends ConstClass {\n static readonly HEX = 'hex';\n static readonly BASE64 = 'base64';\n static readonly BASE64URL = 'base64url';\n}\n\n/** One of the `HashOutputEncodings` values. */\nexport type THashOutputEncoding = TConstValue<typeof HashOutputEncodings>;\n\n/** Encoding used when `outputEncoding` is omitted. */\nexport const DEFAULT_HASH_OUTPUT_ENCODING: THashOutputEncoding = HashOutputEncodings.HEX;\n\n/** Password-hash schemes `CredentialUtility` accepts. `isValid` narrows a string to `TCredentialAlgorithm`. */\nexport class CredentialAlgorithms extends ConstClass {\n /** What `Bun.password` writes with its default parameters; the scheme `hash` uses unless told otherwise. */\n static readonly ARGON2ID = 'argon2id';\n static readonly BCRYPT = 'bcrypt';\n}\n\n/** One of the `CredentialAlgorithms` values. */\nexport type TCredentialAlgorithm = TConstValue<typeof CredentialAlgorithms>;\n\n/** Scheme `CredentialUtility.hash` uses when `algorithm` is omitted. */\nexport const DEFAULT_CREDENTIAL_ALGORITHM: TCredentialAlgorithm = CredentialAlgorithms.ARGON2ID;\n"]}
@@ -1,11 +1,10 @@
1
1
  import { type TConstValue } from '../../../common/types/index.js';
2
2
  import { type TLogLevel } from './types.js';
3
+ import { ConstClass } from '../../../common/const-class.js';
3
4
  /** Output shapes of a log line. `isValid` narrows a string to `TLoggerFormat`. */
4
- export declare class LoggerFormats {
5
+ export declare class LoggerFormats extends ConstClass {
5
6
  static readonly JSON = "json";
6
7
  static readonly TEXT = "text";
7
- static readonly SCHEME_SET: Set<string>;
8
- static isValid(input: string): input is TLoggerFormat;
9
8
  }
10
9
  /** One of the `LoggerFormats` values. */
11
10
  export type TLoggerFormat = TConstValue<typeof LoggerFormats>;
@@ -1,15 +1,12 @@
1
1
  import { Environment } from '../../env/index.js';
2
2
  import { ParseUtility } from '../../../utilities/parse.utility.js';
3
3
  import { LogLevels } from './types.js';
4
+ import { ConstClass } from '../../../common/const-class.js';
4
5
  // -------------------------------------------------------------
5
6
  /** Output shapes of a log line. `isValid` narrows a string to `TLoggerFormat`. */
6
- export class LoggerFormats {
7
+ export class LoggerFormats extends ConstClass {
7
8
  static { this.JSON = 'json'; }
8
9
  static { this.TEXT = 'text'; }
9
- static { this.SCHEME_SET = new Set([this.JSON, this.TEXT]); }
10
- static isValid(input) {
11
- return this.SCHEME_SET.has(input);
12
- }
13
10
  }
14
11
  // -------------------------------------------------------------
15
12
  /** Resolves logger settings (level, color) from configured values and the environment. */
@@ -1 +1 @@
1
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IACH,MAAM,CAAC,eAAe,CAAC,IAGtB;QACC,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;QAExE,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACzD,OAAO,YAAY,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QAErC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,EAAE,WAAW,IAAI,WAAW,CAAC,OAAO,CAAC;QAE7D,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { type TConstValue } from '@/common/types';\nimport { Environment } from '@/modules/env';\nimport { ParseUtility } from '@/utilities/parse.utility';\nimport { LogLevels, type TLogLevel } from './types';\n\n// -------------------------------------------------------------\n/** Output shapes of a log line. `isValid` narrows a string to `TLoggerFormat`. */\nexport class LoggerFormats {\n static readonly JSON = 'json';\n static readonly TEXT = 'text';\n\n static readonly SCHEME_SET = new Set([this.JSON, this.TEXT]);\n\n static isValid(input: string): input is TLoggerFormat {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** One of the `LoggerFormats` values. */\nexport type TLoggerFormat = TConstValue<typeof LoggerFormats>;\n\n// -------------------------------------------------------------\n/** Resolves logger settings (level, color) from configured values and the environment. */\nexport class LoggerConfigUtility {\n /** The logger's own level, below which a line never reaches ANY transport. Defaults to `debug` - level gating belongs to the wrapper and each transport, and a stricter default here would silently drop lines the wrapper already let through. */\n static resolveLevel(opts: { configured?: string }): TLogLevel {\n const { configured } = opts;\n\n if (!configured || configured.trim() === '') {\n return LogLevels.DEBUG;\n }\n\n const normalized = configured.trim().toLowerCase();\n\n if (!LogLevels.isValid(normalized)) {\n // console, not Logger: the logger is being built - routing this warning through it would re-enter the very pipeline that is not configured yet.\n console.warn(\n '[resolveLoggerLevel] Invalid logger level | value: %s | valids: %s | fallback: %s',\n configured,\n [...LogLevels.SCHEME_SET],\n LogLevels.DEBUG,\n );\n\n return LogLevels.DEBUG;\n }\n\n return normalized as TLogLevel;\n }\n\n /**\n * Whether log lines may carry ANSI color, resolved at CALL time. First match wins:\n *\n * 1. `APP_ENV_LOGGER_COLOR` - an explicit yes or no from the operator.\n * 2. `NO_COLOR`, set to anything non-empty - the no-color.org convention.\n * 3. `NODE_ENV` outside {@link Environment.DEVELOPMENT_ENVS} - production, staging, uat and any\n * unrecognized name. Fail-closed, the same boundary the error sanitizer draws: colors are a\n * terminal affordance, and in a deployed environment the same bytes land in a file or an\n * aggregator as escape noise every grep then has to strip.\n *\n * `undefined` means the framework has no opinion, so a provider that detects a terminal itself\n * keeps deciding - which is why the pino path forwards nothing in that case.\n */\n static resolveColorize(opts?: {\n configured?: string;\n environment?: string;\n }): boolean | undefined {\n const configured = opts?.configured ?? process.env.APP_ENV_LOGGER_COLOR;\n\n if (configured !== undefined && configured.trim() !== '') {\n return ParseUtility.toBoolean({ input: configured.trim().toLowerCase() });\n }\n\n const noColor = process.env.NO_COLOR;\n\n if (noColor !== undefined && noColor !== '') {\n return false;\n }\n\n const environment = opts?.environment ?? Environment.current;\n\n if (!Environment.DEVELOPMENT_ENVS.has(environment)) {\n return false;\n }\n\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/logger/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;A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I,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QAErC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,EAAE,WAAW,IAAI,WAAW,CAAC,OAAO,CAAC;QAE7D,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { type TConstValue } from '@/common/types';\nimport { Environment } from '@/modules/env';\nimport { ParseUtility } from '@/utilities/parse.utility';\nimport { LogLevels, type TLogLevel } from './types';\nimport { ConstClass } from '@/common/const-class';\n\n// -------------------------------------------------------------\n/** Output shapes of a log line. `isValid` narrows a string to `TLoggerFormat`. */\nexport class LoggerFormats extends ConstClass {\n static readonly JSON = 'json';\n static readonly TEXT = 'text';\n}\n\n/** One of the `LoggerFormats` values. */\nexport type TLoggerFormat = TConstValue<typeof LoggerFormats>;\n\n// -------------------------------------------------------------\n/** Resolves logger settings (level, color) from configured values and the environment. */\nexport class LoggerConfigUtility {\n /** The logger's own level, below which a line never reaches ANY transport. Defaults to `debug` - level gating belongs to the wrapper and each transport, and a stricter default here would silently drop lines the wrapper already let through. */\n static resolveLevel(opts: { configured?: string }): TLogLevel {\n const { configured } = opts;\n\n if (!configured || configured.trim() === '') {\n return LogLevels.DEBUG;\n }\n\n const normalized = configured.trim().toLowerCase();\n\n if (!LogLevels.isValid(normalized)) {\n // console, not Logger: the logger is being built - routing this warning through it would re-enter the very pipeline that is not configured yet.\n console.warn(\n '[resolveLoggerLevel] Invalid logger level | value: %s | valids: %s | fallback: %s',\n configured,\n [...LogLevels.SCHEME_SET],\n LogLevels.DEBUG,\n );\n\n return LogLevels.DEBUG;\n }\n\n return normalized as TLogLevel;\n }\n\n /**\n * Whether log lines may carry ANSI color, resolved at CALL time. First match wins:\n *\n * 1. `APP_ENV_LOGGER_COLOR` - an explicit yes or no from the operator.\n * 2. `NO_COLOR`, set to anything non-empty - the no-color.org convention.\n * 3. `NODE_ENV` outside {@link Environment.DEVELOPMENT_ENVS} - production, staging, uat and any\n * unrecognized name. Fail-closed, the same boundary the error sanitizer draws: colors are a\n * terminal affordance, and in a deployed environment the same bytes land in a file or an\n * aggregator as escape noise every grep then has to strip.\n *\n * `undefined` means the framework has no opinion, so a provider that detects a terminal itself\n * keeps deciding - which is why the pino path forwards nothing in that case.\n */\n static resolveColorize(opts?: {\n configured?: string;\n environment?: string;\n }): boolean | undefined {\n const configured = opts?.configured ?? process.env.APP_ENV_LOGGER_COLOR;\n\n if (configured !== undefined && configured.trim() !== '') {\n return ParseUtility.toBoolean({ input: configured.trim().toLowerCase() });\n }\n\n const noColor = process.env.NO_COLOR;\n\n if (noColor !== undefined && noColor !== '') {\n return false;\n }\n\n const environment = opts?.environment ?? Environment.current;\n\n if (!Environment.DEVELOPMENT_ENVS.has(environment)) {\n return false;\n }\n\n return undefined;\n }\n}\n"]}
@@ -1,13 +1,12 @@
1
1
  import type { TConstValue } from '../../../../common/types/index.js';
2
2
  import { type TPinoCustomLevelName } from './types.js';
3
+ import { ConstClass } from '../../../../common/const-class.js';
3
4
  /** pino levels are ASCENDING severity (error 50 > warn 40 > info 30 > debug 20); `emerg`(70) extends above error. NORMATIVE - do not renumber without updating the spec. */
4
5
  export declare const PINO_CUSTOM_LEVELS: Record<TPinoCustomLevelName, number>;
5
6
  /** How often the file destination rolls (pino-roll's `frequency`). */
6
- export declare class PinoFrequencies {
7
+ export declare class PinoFrequencies extends ConstClass {
7
8
  static readonly HOURLY = "hourly";
8
9
  static readonly DAILY = "daily";
9
- static readonly SCHEME_SET: Set<string>;
10
- static isValid(value: string): boolean;
11
10
  }
12
11
  /** Valid pino roll frequency values. */
13
12
  export type TFrequency = TConstValue<typeof PinoFrequencies>;
@@ -1,14 +1,11 @@
1
+ import { ConstClass } from '../../../../common/const-class.js';
1
2
  /** pino levels are ASCENDING severity (error 50 > warn 40 > info 30 > debug 20); `emerg`(70) extends above error. NORMATIVE - do not renumber without updating the spec. */
2
3
  export const PINO_CUSTOM_LEVELS = {
3
4
  emerg: 70,
4
5
  };
5
6
  /** How often the file destination rolls (pino-roll's `frequency`). */
6
- export class PinoFrequencies {
7
+ export class PinoFrequencies extends ConstClass {
7
8
  static { this.HOURLY = 'hourly'; }
8
9
  static { this.DAILY = 'daily'; }
9
- static { this.SCHEME_SET = new Set([this.HOURLY, this.DAILY]); }
10
- static isValid(value) {
11
- return this.SCHEME_SET.has(value);
12
- }
13
10
  }
14
11
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/logger/pino/common/constants.ts"],"names":[],"mappings":"AAGA,4KAA4K;AAC5K,MAAM,CAAC,MAAM,kBAAkB,GAAyC;IACtE,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,sEAAsE;AACtE,MAAM,OAAO,eAAe;aACV,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAExE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@/common/types';\nimport { type TPinoCustomLevelName } from './types';\n\n/** pino levels are ASCENDING severity (error 50 > warn 40 > info 30 > debug 20); `emerg`(70) extends above error. NORMATIVE - do not renumber without updating the spec. */\nexport const PINO_CUSTOM_LEVELS: Record<TPinoCustomLevelName, number> = {\n emerg: 70,\n};\n\n/** How often the file destination rolls (pino-roll's `frequency`). */\nexport class PinoFrequencies {\n static readonly HOURLY = 'hourly';\n static readonly DAILY = 'daily';\n\n static readonly SCHEME_SET = new Set<string>([this.HOURLY, this.DAILY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid pino roll frequency values. */\nexport type TFrequency = TConstValue<typeof PinoFrequencies>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/logger/pino/common/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,4KAA4K;AAC5K,MAAM,CAAC,MAAM,kBAAkB,GAAyC;IACtE,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,sEAAsE;AACtE,MAAM,OAAO,eAAgB,SAAQ,UAAU;aAC7B,WAAM,GAAG,QAAQ,CAAC;aAClB,UAAK,GAAG,OAAO,CAAC","sourcesContent":["import type { TConstValue } from '@/common/types';\nimport { type TPinoCustomLevelName } from './types';\nimport { ConstClass } from '@/common/const-class';\n\n/** pino levels are ASCENDING severity (error 50 > warn 40 > info 30 > debug 20); `emerg`(70) extends above error. NORMATIVE - do not renumber without updating the spec. */\nexport const PINO_CUSTOM_LEVELS: Record<TPinoCustomLevelName, number> = {\n emerg: 70,\n};\n\n/** How often the file destination rolls (pino-roll's `frequency`). */\nexport class PinoFrequencies extends ConstClass {\n static readonly HOURLY = 'hourly';\n static readonly DAILY = 'daily';\n}\n\n/** Valid pino roll frequency values. */\nexport type TFrequency = TConstValue<typeof PinoFrequencies>;\n"]}
@@ -53,7 +53,7 @@ export class WinstonFormatFactory {
53
53
  }
54
54
  default: {
55
55
  throw getError({
56
- message: `[defineLogger] Invalid logger format | format: ${format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,
56
+ message: `[defineLogger] Invalid logger format | format: ${format} | valids: ${LoggerFormats.values()}`,
57
57
  });
58
58
  }
59
59
  }
@@ -74,7 +74,7 @@ export class WinstonFormatFactory {
74
74
  }
75
75
  default: {
76
76
  throw getError({
77
- message: `[defineCustomLogger] Invalid logger format | format: ${opts.format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,
77
+ message: `[defineCustomLogger] Invalid logger format | format: ${opts.format} | valids: ${LoggerFormats.values()}`,
78
78
  });
79
79
  }
80
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/formats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAsB,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;AAEzB,qGAAqG;AACrG,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAC/B,yKAAyK;IACzK,MAAM,CAAC,IAAI,CAAC,IAAuB;QACjC,OAAO,CAAC,CAAC,OAAO,CACd,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAC9B,CAAC,CAAC,SAAS,EAAE,EACb,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACzB,oBAAoB,CAAC,SAAS,EAAE,CACjC,CAAC;IACJ,CAAC;IAED,sNAAsN;IACtN,MAAM,CAAC,SAAS;QACd,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC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,oBAAoB,CAAC,QAAQ,EAAE,CAAC;wBACrE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;oBACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;iBAC5D,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,QAAQ,CAAC;oBACb,OAAO,EAAE,wDAAwD,IAAI,CAAC,MAAM,cAAc,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAAE;iBAC1H,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;aAEe,4BAAuB,GAA2B,oBAAoB,CAAC,GAAG,CAAC;QACzF,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-inversion';\nimport winston from 'winston';\nimport { LOGGER_FORMAT, LOGGER_PREFIX } from './common/constants';\nimport { LoggerFormats, LoggerConfigUtility, type TLoggerFormat } from '../common';\nimport { LogFormatUtility } from '../formatting';\n\nconst f = winston.format;\n\n/** Winston stashes the extra arguments of `logger.error(msg, ...args)` under this well-known key. */\nconst SPLAT = Symbol.for('splat');\n\n/**\n * Static methods never reach a sibling through `this` - the exported names in `define.ts` are\n * unbound aliases (`WinstonFormatFactory.method`), so `this` would be `undefined` there.\n */\nexport class WinstonFormatFactory {\n /** Per-line prep: label, timestamp, error normalization, deep splat. Final-string assembly is per-transport, so console can colorize while files/UDP get plain lines. */\n static prep(opts: { label: string }) {\n return f.combine(\n f.label({ label: opts.label }),\n f.timestamp(),\n f.errors({ stack: true }),\n WinstonFormatFactory.deepSplat(),\n );\n }\n\n /** Drop-in replacement for `winston.format.splat()` that formats through {@link LogFormatUtility.formatMessage}; every transport reads `info.message`, so widening it here widens console, file and dgram at once. */\n static deepSplat() {\n return f((info) => {\n const args: unknown = Reflect.get(info, SPLAT);\n\n if (!Array.isArray(args) || !args.length || typeof info.message !== 'string') {\n return info;\n }\n\n info.message = LogFormatUtility.formatMessage({ message: info.message, args });\n\n return info;\n })();\n }\n\n static textLine() {\n return f.printf(({ level, message, label, timestamp }) => {\n return `${timestamp} [${label}] ${level}: ${message}`;\n });\n }\n\n static json(opts: { label: string }) {\n return f.combine(WinstonFormatFactory.prep({ label: opts.label }), f.json());\n }\n\n static pretty(opts: { label: string; colorize?: boolean }) {\n // winston has no terminal detection of its own, so \"no opinion\" keeps the historical default.\n const { label, colorize = LoggerConfigUtility.resolveColorize() ?? true } = opts;\n\n if (colorize) {\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n f.colorize(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n static log(opts: { label: string; format?: TLoggerFormat }) {\n const format = opts.format ?? (LOGGER_FORMAT as TLoggerFormat);\n\n switch (format) {\n case LoggerFormats.JSON: {\n return WinstonFormatFactory.json({ label: opts.label });\n }\n case LoggerFormats.TEXT: {\n return WinstonFormatFactory.pretty({ label: opts.label });\n }\n default: {\n throw getError({\n message: `[defineLogger] Invalid logger format | format: ${format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,\n });\n }\n }\n }\n\n /** Per-transport assembly formats: console may colorize, a file never does - ANSI bytes in a rotated log file are noise every grep has to strip. */\n static assembly(opts: { format: TLoggerFormat; colorize: boolean }) {\n switch (opts.format) {\n case LoggerFormats.JSON: {\n return { console: f.json(), file: f.json() };\n }\n case LoggerFormats.TEXT: {\n return {\n console: opts.colorize\n ? f.combine(f.align(), f.colorize(), WinstonFormatFactory.textLine())\n : f.combine(f.align(), WinstonFormatFactory.textLine()),\n file: f.combine(f.align(), WinstonFormatFactory.textLine()),\n };\n }\n default: {\n throw getError({\n message: `[defineCustomLogger] Invalid logger format | format: ${opts.format} | valids: ${[...LoggerFormats.SCHEME_SET]}`,\n });\n }\n }\n }\n\n static readonly applicationLogFormatter: winston.Logform.Format = WinstonFormatFactory.log({\n label: LOGGER_PREFIX,\n });\n}\n"]}
1
+ {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../../../src/modules/logger/winston/formats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAsB,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;AAEzB,qGAAqG;AACrG,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAC/B,yKAAyK;IACzK,MAAM,CAAC,IAAI,CAAC,IAAuB;QACjC,OAAO,CAAC,CAAC,OAAO,CACd,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,EAC9B,CAAC,CAAC,SAAS,EAAE,EACb,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACzB,oBAAoB,CAAC,SAAS,EAAE,CACjC,CAAC;IACJ,CAAC;IAED,sNAAsN;IACtN,MAAM,CAAC,SAAS;QACd,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAE/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,OAAO,KA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AE,CAAC;oBACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC;iBAC5D,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,QAAQ,CAAC;oBACb,OAAO,EAAE,wDAAwD,IAAI,CAAC,MAAM,cAAc,aAAa,CAAC,MAAM,EAAE,EAAE;iBACnH,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;aAEe,4BAAuB,GAA2B,oBAAoB,CAAC,GAAG,CAAC;QACzF,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC","sourcesContent":["import { getError } from '@venizia/ignis-inversion';\nimport winston from 'winston';\nimport { LOGGER_FORMAT, LOGGER_PREFIX } from './common/constants';\nimport { LoggerFormats, LoggerConfigUtility, type TLoggerFormat } from '../common';\nimport { LogFormatUtility } from '../formatting';\n\nconst f = winston.format;\n\n/** Winston stashes the extra arguments of `logger.error(msg, ...args)` under this well-known key. */\nconst SPLAT = Symbol.for('splat');\n\n/**\n * Static methods never reach a sibling through `this` - the exported names in `define.ts` are\n * unbound aliases (`WinstonFormatFactory.method`), so `this` would be `undefined` there.\n */\nexport class WinstonFormatFactory {\n /** Per-line prep: label, timestamp, error normalization, deep splat. Final-string assembly is per-transport, so console can colorize while files/UDP get plain lines. */\n static prep(opts: { label: string }) {\n return f.combine(\n f.label({ label: opts.label }),\n f.timestamp(),\n f.errors({ stack: true }),\n WinstonFormatFactory.deepSplat(),\n );\n }\n\n /** Drop-in replacement for `winston.format.splat()` that formats through {@link LogFormatUtility.formatMessage}; every transport reads `info.message`, so widening it here widens console, file and dgram at once. */\n static deepSplat() {\n return f((info) => {\n const args: unknown = Reflect.get(info, SPLAT);\n\n if (!Array.isArray(args) || !args.length || typeof info.message !== 'string') {\n return info;\n }\n\n info.message = LogFormatUtility.formatMessage({ message: info.message, args });\n\n return info;\n })();\n }\n\n static textLine() {\n return f.printf(({ level, message, label, timestamp }) => {\n return `${timestamp} [${label}] ${level}: ${message}`;\n });\n }\n\n static json(opts: { label: string }) {\n return f.combine(WinstonFormatFactory.prep({ label: opts.label }), f.json());\n }\n\n static pretty(opts: { label: string; colorize?: boolean }) {\n // winston has no terminal detection of its own, so \"no opinion\" keeps the historical default.\n const { label, colorize = LoggerConfigUtility.resolveColorize() ?? true } = opts;\n\n if (colorize) {\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n f.colorize(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n return f.combine(\n WinstonFormatFactory.prep({ label }),\n f.align(),\n WinstonFormatFactory.textLine(),\n );\n }\n\n static log(opts: { label: string; format?: TLoggerFormat }) {\n const format = opts.format ?? (LOGGER_FORMAT as TLoggerFormat);\n\n switch (format) {\n case LoggerFormats.JSON: {\n return WinstonFormatFactory.json({ label: opts.label });\n }\n case LoggerFormats.TEXT: {\n return WinstonFormatFactory.pretty({ label: opts.label });\n }\n default: {\n throw getError({\n message: `[defineLogger] Invalid logger format | format: ${format} | valids: ${LoggerFormats.values()}`,\n });\n }\n }\n }\n\n /** Per-transport assembly formats: console may colorize, a file never does - ANSI bytes in a rotated log file are noise every grep has to strip. */\n static assembly(opts: { format: TLoggerFormat; colorize: boolean }) {\n switch (opts.format) {\n case LoggerFormats.JSON: {\n return { console: f.json(), file: f.json() };\n }\n case LoggerFormats.TEXT: {\n return {\n console: opts.colorize\n ? f.combine(f.align(), f.colorize(), WinstonFormatFactory.textLine())\n : f.combine(f.align(), WinstonFormatFactory.textLine()),\n file: f.combine(f.align(), WinstonFormatFactory.textLine()),\n };\n }\n default: {\n throw getError({\n message: `[defineCustomLogger] Invalid logger format | format: ${opts.format} | valids: ${LoggerFormats.values()}`,\n });\n }\n }\n }\n\n static readonly applicationLogFormatter: winston.Logform.Format = WinstonFormatFactory.log({\n label: LOGGER_PREFIX,\n });\n}\n"]}
@@ -1,10 +1,9 @@
1
- import { type TConstValue } from '../../../../common/index.js';
1
+ import { ConstClass } from '../../../../common/const-class.js';
2
+ import type { TConstValue } from '../../../../common/index.js';
2
3
  /** Consumer group protocol: `classic` or `consumer`. */
3
- export declare class KafkaGroupProtocol {
4
+ export declare class KafkaGroupProtocol extends ConstClass {
4
5
  static readonly CLASSIC = "classic";
5
6
  static readonly CONSUMER = "consumer";
6
- static readonly SCHEME_SET: Set<string>;
7
- static isValid(mode: string): boolean;
8
7
  }
9
8
  /** A {@link KafkaGroupProtocol} value. */
10
9
  export type TKafkaGroupProtocol = TConstValue<typeof KafkaGroupProtocol>;
@@ -1,11 +1,8 @@
1
+ import { ConstClass } from '../../../../common/const-class.js';
1
2
  /** Consumer group protocol: `classic` or `consumer`. */
2
- export class KafkaGroupProtocol {
3
+ export class KafkaGroupProtocol extends ConstClass {
3
4
  static { this.CLASSIC = 'classic'; }
4
5
  static { this.CONSUMER = 'consumer'; }
5
- static { this.SCHEME_SET = new Set([this.CLASSIC, this.CONSUMER]); }
6
- static isValid(mode) {
7
- return this.SCHEME_SET.has(mode);
8
- }
9
6
  }
10
7
  /** Producer acknowledgment level, as the Kafka `acks` number: `0` none, `1` leader, `-1` all in-sync replicas. */
11
8
  export class KafkaAcks {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/queue/kafka/common/constants.ts"],"names":[],"mappings":"AAEA,wDAAwD;AACxD,MAAM,OAAO,kBAAkB;aACb,YAAO,GAAG,SAAS,CAAC;aACpB,aAAQ,GAAG,UAAU,CAAC;aAEtB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEpE,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;;AAMH,kHAAkH;AAClH,MAAM,OAAO,SAAS;aACJ,SAAI,GAAG,CAAC,CAAC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C;aACvB,cAAS,GAAG,CAAC,CAAC;aACd,cAAS,GAAG,SAAS,GAAG,EAAE,CAAC,GAAC,QAAQ;aACpC,kBAAa,GAAG,KAAK,CAAC;aACtB,qBAAgB,GAAG,OAAO,CAAC;aAC3B,mBAAc,GAAG,kBAAkB,CAAC,OAAO,CAAC;aAE5C,iBAAY,GAAG,WAAW,CAAC;aAC3B,0BAAqB,GAAG,QAAQ,CAAC;aAEjC,oBAAe,GAAG,KAAK,CAAC;aACxB,2BAAsB,GAAG,CAAC,CAAC;aAC3B,qBAAgB,GAAG,MAAM,CAAC;aAC1B,yBAAoB,GAAG,MAAM,CAAC;;AAGhD,8GAA8G;AAC9G,MAAM,OAAO,uBAAuB;aAClB,iBAAY,GAAG,cAAc,CAAC;aAC9B,WAAM,GAAG,QAAQ,CAAC","sourcesContent":["import { type TConstValue } from '@/common';\n\n/** Consumer group protocol: `classic` or `consumer`. */\nexport class KafkaGroupProtocol {\n static readonly CLASSIC = 'classic';\n static readonly CONSUMER = 'consumer';\n\n static readonly SCHEME_SET = new Set([this.CLASSIC, this.CONSUMER]);\n\n static isValid(mode: string): boolean {\n return this.SCHEME_SET.has(mode);\n }\n}\n\n/** A {@link KafkaGroupProtocol} value. */\nexport type TKafkaGroupProtocol = TConstValue<typeof KafkaGroupProtocol>;\n\n/** Producer acknowledgment level, as the Kafka `acks` number: `0` none, `1` leader, `-1` all in-sync replicas. */\nexport class KafkaAcks {\n static readonly NONE = 0; // No acknowledgment — fire-and-forget\n static readonly LEADER = 1; // Leader acknowledgment only\n static readonly ALL = -1; // Full ISR acknowledgment\n\n static readonly SCHEME_SET = new Set([this.NONE, this.LEADER, this.ALL]);\n\n static isValid(ack: number): boolean {\n return this.SCHEME_SET.has(ack);\n }\n}\n\n/** A {@link KafkaAcks} value. */\nexport type TKafkaAcks = TConstValue<typeof KafkaAcks>;\n\n/** Connection health of a Kafka helper, as reported by `getHealthStatus()`. */\nexport class KafkaHealthStatuses {\n static readonly CONNECTED = 'connected';\n static readonly DISCONNECTED = 'disconnected';\n static readonly UNKNOWN = 'unknown';\n}\n\n/** A {@link KafkaHealthStatuses} value. */\nexport type TKafkaHealthStatus = TConstValue<typeof KafkaHealthStatuses>;\n\n/** Names of the `@platformatic/kafka` client, consumer-group and stream events the helpers listen to. */\nexport class KafkaClientEvents {\n static readonly BROKER_CONNECT = 'client:broker:connect';\n static readonly BROKER_DISCONNECT = 'client:broker:disconnect';\n static readonly BROKER_FAILED = 'client:broker:failed';\n\n static readonly CONSUMER_GROUP_JOIN = 'consumer:group:join';\n static readonly CONSUMER_GROUP_LEAVE = 'consumer:group:leave';\n static readonly CONSUMER_GROUP_REBALANCE = 'consumer:group:rebalance';\n static readonly CONSUMER_HEARTBEAT_ERROR = 'consumer:heartbeat:error';\n static readonly CONSUMER_LAG = 'consumer:lag';\n static readonly CONSUMER_LAG_ERROR = 'consumer:lag:error';\n\n static readonly STREAM_DATA = 'data';\n static readonly STREAM_ERROR = 'error';\n}\n\n/** The option values the Kafka helpers use for a field the caller leaves unset. Timeouts, delays and intervals are in milliseconds; `MAX_BYTES` is in bytes. */\nexport class KafkaDefaults {\n // Shared\n static readonly RETRIES = 3;\n static readonly RETRY_DELAY = 1_000;\n\n // Producer\n static readonly STRICT = true;\n static readonly AUTOCREATE_TOPICS = false;\n\n // Consumer\n static readonly AUTOCOMMIT = false;\n static readonly SESSION_TIMEOUT = 60_000;\n static readonly HEARTBEAT_INTERVAL = 10_000;\n static readonly HIGH_WATER_MARK = 1024;\n static readonly MIN_BYTES = 1;\n static readonly MAX_BYTES = 1_048_576 * 10; // 10 MB\n static readonly MAX_WAIT_TIME = 5_000;\n static readonly METADATA_MAX_AGE = 300_000;\n static readonly GROUP_PROTOCOL = KafkaGroupProtocol.CLASSIC;\n\n static readonly CONSUME_MODE = 'committed';\n static readonly CONSUME_FALLBACK_MODE = 'latest';\n\n static readonly RECONNECT_DELAY = 2_000;\n static readonly MAX_RECONNECT_ATTEMPTS = 5;\n static readonly SHUTDOWN_TIMEOUT = 30_000;\n static readonly LAG_MONITOR_INTERVAL = 30_000;\n}\n\n/** Why every broker of a consumer is gone: DISCONNECTED (the connections closed) or FAILED (they errored). */\nexport class KafkaBrokersDownReasons {\n static readonly DISCONNECTED = 'disconnected';\n static readonly FAILED = 'failed';\n}\n\n/** Valid Kafka brokers-down reason values. */\nexport type TKafkaBrokersDownReason = TConstValue<typeof KafkaBrokersDownReasons>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/queue/kafka/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,wDAAwD;AACxD,MAAM,OAAO,kBAAmB,SAAQ,UAAU;aAChC,YAAO,GAAG,SAAS,CAAC;aACpB,aAAQ,GAAG,UAAU,CAAC;;AAMxC,kHAAkH;AAClH,MAAM,OAAO,SAAS;aACJ,SAAI,GAAG,CAAC,CAAC,GAAC,sCAAsC;aAChD,WAAM,GAAG,CAAC,CAAC,GAAC,6BAA6B;aACzC,QAAG,GAAG,CAAC,CAAC,CAAC,GAAC,0BAA0B;aAEpC,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEzE,MAAM,CAAC,OAAO,CAAC,GAAW;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;;AAMH,+EAA+E;AAC/E,MAAM,OAAO,mBAAmB;aACd,cAAS,GAAG,WAAW,CAAC;aACxB,iBAAY,GAAG,cAAc,CAAC;aAC9B,YAAO,GAAG,SAAS,CAAC;;AAMtC,yGAAyG;AACzG,MAAM,OAAO,iBAAiB;aACZ,mBAAc,GAAG,uBAAuB,CAAC;aACzC,sBAAiB,GAAG,0BAA0B,CAAC;aAC/C,kBAAa,GAAG,sBAAsB,CAAC;aAEvC,wBAAmB,GAAG,qBAAqB,CAAC;aAC5C,yBAAoB,GAAG,sBAAsB,CAAC;aAC9C,6BAAwB,GAAG,0BAA0B,CAAC;aACtD,6BAAwB,GAAG,0BAA0B,CAAC;aACtD,iBAAY,GAAG,cAAc,CAAC;aAC9B,uBAAkB,GAAG,oBAAoB,CAAC;aAE1C,gBAAW,GAAG,MAAM,CAAC;aACrB,iBAAY,GAAG,OAAO,CAAC;;AAGzC,gKAAgK;AAChK,MAAM,OAAO,aAAa;IACxB,SAAS;aACO,YAAO,GAAG,CAAC,CAAC;aACZ,gBAAW,GAAG,KAAK,CAAC;IAEpC,WAAW;aACK,WAAM,GAAG,IAAI,CAAC;aACd,sBAAiB,GAAG,KAAK,CAAC;IAE1C,WAAW;aACK,eAAU,GAAG,KAAK,CAAC;aACnB,oBAAe,GAAG,MAAM,CAAC;aACzB,uBAAkB,GAAG,MAAM,CAAC;aAC5B,oBAAe,GAAG,IAAI,CAAC;aACvB,cAAS,GAAG,CAAC,CAAC;aACd,cAAS,GAAG,SAAS,GAAG,EAAE,CAAC,GAAC,QAAQ;aACpC,kBAAa,GAAG,KAAK,CAAC;aACtB,qBAAgB,GAAG,OAAO,CAAC;aAC3B,mBAAc,GAAG,kBAAkB,CAAC,OAAO,CAAC;aAE5C,iBAAY,GAAG,WAAW,CAAC;aAC3B,0BAAqB,GAAG,QAAQ,CAAC;aAEjC,oBAAe,GAAG,KAAK,CAAC;aACxB,2BAAsB,GAAG,CAAC,CAAC;aAC3B,qBAAgB,GAAG,MAAM,CAAC;aAC1B,yBAAoB,GAAG,MAAM,CAAC;;AAGhD,8GAA8G;AAC9G,MAAM,OAAO,uBAAuB;aAClB,iBAAY,GAAG,cAAc,CAAC;aAC9B,WAAM,GAAG,QAAQ,CAAC","sourcesContent":["import { ConstClass } from '@/common/const-class';\nimport type { TConstValue } from '@/common';\n\n/** Consumer group protocol: `classic` or `consumer`. */\nexport class KafkaGroupProtocol extends ConstClass {\n static readonly CLASSIC = 'classic';\n static readonly CONSUMER = 'consumer';\n}\n\n/** A {@link KafkaGroupProtocol} value. */\nexport type TKafkaGroupProtocol = TConstValue<typeof KafkaGroupProtocol>;\n\n/** Producer acknowledgment level, as the Kafka `acks` number: `0` none, `1` leader, `-1` all in-sync replicas. */\nexport class KafkaAcks {\n static readonly NONE = 0; // No acknowledgment — fire-and-forget\n static readonly LEADER = 1; // Leader acknowledgment only\n static readonly ALL = -1; // Full ISR acknowledgment\n\n static readonly SCHEME_SET = new Set([this.NONE, this.LEADER, this.ALL]);\n\n static isValid(ack: number): boolean {\n return this.SCHEME_SET.has(ack);\n }\n}\n\n/** A {@link KafkaAcks} value. */\nexport type TKafkaAcks = TConstValue<typeof KafkaAcks>;\n\n/** Connection health of a Kafka helper, as reported by `getHealthStatus()`. */\nexport class KafkaHealthStatuses {\n static readonly CONNECTED = 'connected';\n static readonly DISCONNECTED = 'disconnected';\n static readonly UNKNOWN = 'unknown';\n}\n\n/** A {@link KafkaHealthStatuses} value. */\nexport type TKafkaHealthStatus = TConstValue<typeof KafkaHealthStatuses>;\n\n/** Names of the `@platformatic/kafka` client, consumer-group and stream events the helpers listen to. */\nexport class KafkaClientEvents {\n static readonly BROKER_CONNECT = 'client:broker:connect';\n static readonly BROKER_DISCONNECT = 'client:broker:disconnect';\n static readonly BROKER_FAILED = 'client:broker:failed';\n\n static readonly CONSUMER_GROUP_JOIN = 'consumer:group:join';\n static readonly CONSUMER_GROUP_LEAVE = 'consumer:group:leave';\n static readonly CONSUMER_GROUP_REBALANCE = 'consumer:group:rebalance';\n static readonly CONSUMER_HEARTBEAT_ERROR = 'consumer:heartbeat:error';\n static readonly CONSUMER_LAG = 'consumer:lag';\n static readonly CONSUMER_LAG_ERROR = 'consumer:lag:error';\n\n static readonly STREAM_DATA = 'data';\n static readonly STREAM_ERROR = 'error';\n}\n\n/** The option values the Kafka helpers use for a field the caller leaves unset. Timeouts, delays and intervals are in milliseconds; `MAX_BYTES` is in bytes. */\nexport class KafkaDefaults {\n // Shared\n static readonly RETRIES = 3;\n static readonly RETRY_DELAY = 1_000;\n\n // Producer\n static readonly STRICT = true;\n static readonly AUTOCREATE_TOPICS = false;\n\n // Consumer\n static readonly AUTOCOMMIT = false;\n static readonly SESSION_TIMEOUT = 60_000;\n static readonly HEARTBEAT_INTERVAL = 10_000;\n static readonly HIGH_WATER_MARK = 1024;\n static readonly MIN_BYTES = 1;\n static readonly MAX_BYTES = 1_048_576 * 10; // 10 MB\n static readonly MAX_WAIT_TIME = 5_000;\n static readonly METADATA_MAX_AGE = 300_000;\n static readonly GROUP_PROTOCOL = KafkaGroupProtocol.CLASSIC;\n\n static readonly CONSUME_MODE = 'committed';\n static readonly CONSUME_FALLBACK_MODE = 'latest';\n\n static readonly RECONNECT_DELAY = 2_000;\n static readonly MAX_RECONNECT_ATTEMPTS = 5;\n static readonly SHUTDOWN_TIMEOUT = 30_000;\n static readonly LAG_MONITOR_INTERVAL = 30_000;\n}\n\n/** Why every broker of a consumer is gone: DISCONNECTED (the connections closed) or FAILED (they errored). */\nexport class KafkaBrokersDownReasons {\n static readonly DISCONNECTED = 'disconnected';\n static readonly FAILED = 'failed';\n}\n\n/** Valid Kafka brokers-down reason values. */\nexport type TKafkaBrokersDownReason = TConstValue<typeof KafkaBrokersDownReasons>;\n"]}
@@ -1,26 +1,23 @@
1
+ import { ConstClass } from '../../../common/const-class.js';
1
2
  import type { TConstValue } from '../../../common/index.js';
2
3
  /** How the retry delay grows between attempts. */
3
- export declare class RetryBackoffStrategies {
4
+ export declare class RetryBackoffStrategies extends ConstClass {
4
5
  static readonly FIXED = "fixed";
5
6
  static readonly LINEAR = "linear";
6
7
  static readonly EXPONENTIAL = "exponential";
7
8
  /** An explicit per-attempt cap schedule, e.g. [250, 1000, 4000]; the last entry repeats. */
8
9
  static readonly SCHEDULE = "schedule";
9
- static readonly SCHEME_SET: Set<string>;
10
- static isValid(value: string): value is TRetryBackoffStrategy;
11
10
  }
12
11
  /** Union of the `RetryBackoffStrategies` values. */
13
12
  export type TRetryBackoffStrategy = TConstValue<typeof RetryBackoffStrategies>;
14
13
  /** How randomness is applied to a computed retry delay. */
15
- export declare class RetryJitterModes {
14
+ export declare class RetryJitterModes extends ConstClass {
16
15
  /** The computed delay is used as-is. */
17
16
  static readonly NONE = "none";
18
17
  /** Uniform random in [0, delay) - decorrelates a thundering herd hardest. */
19
18
  static readonly FULL = "full";
20
19
  /** delay/2 + uniform random in [0, delay/2) - jittered but never less than half the delay. */
21
20
  static readonly EQUAL = "equal";
22
- static readonly SCHEME_SET: Set<string>;
23
- static isValid(value: string): value is TRetryJitterMode;
24
21
  }
25
22
  /** Union of the `RetryJitterModes` values. */
26
23
  export type TRetryJitterMode = TConstValue<typeof RetryJitterModes>;
@@ -1,31 +1,19 @@
1
+ import { ConstClass } from '../../../common/const-class.js';
1
2
  /** How the retry delay grows between attempts. */
2
- export class RetryBackoffStrategies {
3
+ export class RetryBackoffStrategies extends ConstClass {
3
4
  static { this.FIXED = 'fixed'; }
4
5
  static { this.LINEAR = 'linear'; }
5
6
  static { this.EXPONENTIAL = 'exponential'; }
6
7
  /** An explicit per-attempt cap schedule, e.g. [250, 1000, 4000]; the last entry repeats. */
7
8
  static { this.SCHEDULE = 'schedule'; }
8
- static { this.SCHEME_SET = new Set([
9
- this.FIXED,
10
- this.LINEAR,
11
- this.EXPONENTIAL,
12
- this.SCHEDULE,
13
- ]); }
14
- static isValid(value) {
15
- return this.SCHEME_SET.has(value);
16
- }
17
9
  }
18
10
  /** How randomness is applied to a computed retry delay. */
19
- export class RetryJitterModes {
11
+ export class RetryJitterModes extends ConstClass {
20
12
  /** The computed delay is used as-is. */
21
13
  static { this.NONE = 'none'; }
22
14
  /** Uniform random in [0, delay) - decorrelates a thundering herd hardest. */
23
15
  static { this.FULL = 'full'; }
24
16
  /** delay/2 + uniform random in [0, delay/2) - jittered but never less than half the delay. */
25
17
  static { this.EQUAL = 'equal'; }
26
- static { this.SCHEME_SET = new Set([this.NONE, this.FULL, this.EQUAL]); }
27
- static isValid(value) {
28
- return this.SCHEME_SET.has(value);
29
- }
30
18
  }
31
19
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/retry/common/constants.ts"],"names":[],"mappings":"AAEA,kDAAkD;AAClD,MAAM,OAAO,sBAAsB;aACjB,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;aAClB,gBAAW,GAAG,aAAa,CAAC;IAE5C,4FAA4F;aAC5E,aAAQ,GAAG,UAAU,CAAC;aAEtB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,WAAW;QAChB,IAAI,CAAC,QAAQ;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,2DAA2D;AAC3D,MAAM,OAAO,gBAAgB;IAC3B,wCAAwC;aACxB,SAAI,GAAG,MAAM,CAAC;IAE9B,6EAA6E;aAC7D,SAAI,GAAG,MAAM,CAAC;IAE9B,8FAA8F;aAC9E,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEjF,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@/common';\n\n/** How the retry delay grows between attempts. */\nexport class RetryBackoffStrategies {\n static readonly FIXED = 'fixed';\n static readonly LINEAR = 'linear';\n static readonly EXPONENTIAL = 'exponential';\n\n /** An explicit per-attempt cap schedule, e.g. [250, 1000, 4000]; the last entry repeats. */\n static readonly SCHEDULE = 'schedule';\n\n static readonly SCHEME_SET = new Set<string>([\n this.FIXED,\n this.LINEAR,\n this.EXPONENTIAL,\n this.SCHEDULE,\n ]);\n\n static isValid(value: string): value is TRetryBackoffStrategy {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Union of the `RetryBackoffStrategies` values. */\nexport type TRetryBackoffStrategy = TConstValue<typeof RetryBackoffStrategies>;\n\n/** How randomness is applied to a computed retry delay. */\nexport class RetryJitterModes {\n /** The computed delay is used as-is. */\n static readonly NONE = 'none';\n\n /** Uniform random in [0, delay) - decorrelates a thundering herd hardest. */\n static readonly FULL = 'full';\n\n /** delay/2 + uniform random in [0, delay/2) - jittered but never less than half the delay. */\n static readonly EQUAL = 'equal';\n\n static readonly SCHEME_SET = new Set<string>([this.NONE, this.FULL, this.EQUAL]);\n\n static isValid(value: string): value is TRetryJitterMode {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Union of the `RetryJitterModes` values. */\nexport type TRetryJitterMode = TConstValue<typeof RetryJitterModes>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/retry/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,kDAAkD;AAClD,MAAM,OAAO,sBAAuB,SAAQ,UAAU;aACpC,UAAK,GAAG,OAAO,CAAC;aAChB,WAAM,GAAG,QAAQ,CAAC;aAClB,gBAAW,GAAG,aAAa,CAAC;IAE5C,4FAA4F;aAC5E,aAAQ,GAAG,UAAU,CAAC;;AAMxC,2DAA2D;AAC3D,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC9C,wCAAwC;aACxB,SAAI,GAAG,MAAM,CAAC;IAE9B,6EAA6E;aAC7D,SAAI,GAAG,MAAM,CAAC;IAE9B,8FAA8F;aAC9E,UAAK,GAAG,OAAO,CAAC","sourcesContent":["import { ConstClass } from '@/common/const-class';\nimport type { TConstValue } from '@/common';\n\n/** How the retry delay grows between attempts. */\nexport class RetryBackoffStrategies extends ConstClass {\n static readonly FIXED = 'fixed';\n static readonly LINEAR = 'linear';\n static readonly EXPONENTIAL = 'exponential';\n\n /** An explicit per-attempt cap schedule, e.g. [250, 1000, 4000]; the last entry repeats. */\n static readonly SCHEDULE = 'schedule';\n}\n\n/** Union of the `RetryBackoffStrategies` values. */\nexport type TRetryBackoffStrategy = TConstValue<typeof RetryBackoffStrategies>;\n\n/** How randomness is applied to a computed retry delay. */\nexport class RetryJitterModes extends ConstClass {\n /** The computed delay is used as-is. */\n static readonly NONE = 'none';\n\n /** Uniform random in [0, delay) - decorrelates a thundering herd hardest. */\n static readonly FULL = 'full';\n\n /** delay/2 + uniform random in [0, delay/2) - jittered but never less than half the delay. */\n static readonly EQUAL = 'equal';\n}\n\n/** Union of the `RetryJitterModes` values. */\nexport type TRetryJitterMode = TConstValue<typeof RetryJitterModes>;\n"]}
@@ -1,21 +1,18 @@
1
1
  import type { TConstValue } from '../../../common/types/index.js';
2
+ import { ConstClass } from '../../../common/const-class.js';
2
3
  /** Secret backends a secrets registration can select. */
3
- export declare class SecretProviders {
4
+ export declare class SecretProviders extends ConstClass {
4
5
  static readonly SYSTEM_ENVS = "system-envs";
5
6
  static readonly HASHICORP_VAULT = "hashicorp-vault";
6
7
  static readonly DOTENV_VAULT = "dotenv-vault";
7
- static readonly SCHEME_SET: Set<string>;
8
- static isValid(value: string): value is TSecretProvider;
9
8
  }
10
9
  /** Union of the `SecretProviders` values. */
11
10
  export type TSecretProvider = TConstValue<typeof SecretProviders>;
12
11
  /** Ways a Vault provider can authenticate. */
13
- export declare class VaultAuthMethods {
12
+ export declare class VaultAuthMethods extends ConstClass {
14
13
  static readonly TOKEN = "token";
15
14
  static readonly APP_ROLE = "app-role";
16
15
  static readonly KUBERNETES = "kubernetes";
17
- static readonly SCHEME_SET: Set<string>;
18
- static isValid(value: string): value is TVaultAuthMethod;
19
16
  }
20
17
  /** Union of the `VaultAuthMethods` values. */
21
18
  export type TVaultAuthMethod = TConstValue<typeof VaultAuthMethods>;
@@ -1,21 +1,14 @@
1
+ import { ConstClass } from '../../../common/const-class.js';
1
2
  /** Secret backends a secrets registration can select. */
2
- export class SecretProviders {
3
+ export class SecretProviders extends ConstClass {
3
4
  static { this.SYSTEM_ENVS = 'system-envs'; }
4
5
  static { this.HASHICORP_VAULT = 'hashicorp-vault'; }
5
6
  static { this.DOTENV_VAULT = 'dotenv-vault'; }
6
- static { this.SCHEME_SET = new Set([this.SYSTEM_ENVS, this.HASHICORP_VAULT, this.DOTENV_VAULT]); }
7
- static isValid(value) {
8
- return this.SCHEME_SET.has(value);
9
- }
10
7
  }
11
8
  /** Ways a Vault provider can authenticate. */
12
- export class VaultAuthMethods {
9
+ export class VaultAuthMethods extends ConstClass {
13
10
  static { this.TOKEN = 'token'; }
14
11
  static { this.APP_ROLE = 'app-role'; }
15
12
  static { this.KUBERNETES = 'kubernetes'; }
16
- static { this.SCHEME_SET = new Set([this.TOKEN, this.APP_ROLE, this.KUBERNETES]); }
17
- static isValid(value) {
18
- return this.SCHEME_SET.has(value);
19
- }
20
13
  }
21
14
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/secrets/common/constants.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,MAAM,OAAO,eAAe;aACV,gBAAW,GAAG,aAAa,CAAC;aAC5B,oBAAe,GAAG,iBAAiB,CAAC;aACpC,iBAAY,GAAG,cAAc,CAAC;aAE9B,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAElG,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,8CAA8C;AAC9C,MAAM,OAAO,gBAAgB;aACX,UAAK,GAAG,OAAO,CAAC;aAChB,aAAQ,GAAG,UAAU,CAAC;aACtB,eAAU,GAAG,YAAY,CAAC;aAE1B,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEnF,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@/common/types';\n\n/** Secret backends a secrets registration can select. */\nexport class SecretProviders {\n static readonly SYSTEM_ENVS = 'system-envs';\n static readonly HASHICORP_VAULT = 'hashicorp-vault';\n static readonly DOTENV_VAULT = 'dotenv-vault';\n\n static readonly SCHEME_SET = new Set([this.SYSTEM_ENVS, this.HASHICORP_VAULT, this.DOTENV_VAULT]);\n\n static isValid(value: string): value is TSecretProvider {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Union of the `SecretProviders` values. */\nexport type TSecretProvider = TConstValue<typeof SecretProviders>;\n\n/** Ways a Vault provider can authenticate. */\nexport class VaultAuthMethods {\n static readonly TOKEN = 'token';\n static readonly APP_ROLE = 'app-role';\n static readonly KUBERNETES = 'kubernetes';\n\n static readonly SCHEME_SET = new Set([this.TOKEN, this.APP_ROLE, this.KUBERNETES]);\n\n static isValid(value: string): value is TVaultAuthMethod {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Union of the `VaultAuthMethods` values. */\nexport type TVaultAuthMethod = TConstValue<typeof VaultAuthMethods>;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/secrets/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,yDAAyD;AACzD,MAAM,OAAO,eAAgB,SAAQ,UAAU;aAC7B,gBAAW,GAAG,aAAa,CAAC;aAC5B,oBAAe,GAAG,iBAAiB,CAAC;aACpC,iBAAY,GAAG,cAAc,CAAC;;AAMhD,8CAA8C;AAC9C,MAAM,OAAO,gBAAiB,SAAQ,UAAU;aAC9B,UAAK,GAAG,OAAO,CAAC;aAChB,aAAQ,GAAG,UAAU,CAAC;aACtB,eAAU,GAAG,YAAY,CAAC","sourcesContent":["import type { TConstValue } from '@/common/types';\nimport { ConstClass } from '@/common/const-class';\n\n/** Secret backends a secrets registration can select. */\nexport class SecretProviders extends ConstClass {\n static readonly SYSTEM_ENVS = 'system-envs';\n static readonly HASHICORP_VAULT = 'hashicorp-vault';\n static readonly DOTENV_VAULT = 'dotenv-vault';\n}\n\n/** Union of the `SecretProviders` values. */\nexport type TSecretProvider = TConstValue<typeof SecretProviders>;\n\n/** Ways a Vault provider can authenticate. */\nexport class VaultAuthMethods extends ConstClass {\n static readonly TOKEN = 'token';\n static readonly APP_ROLE = 'app-role';\n static readonly KUBERNETES = 'kubernetes';\n}\n\n/** Union of the `VaultAuthMethods` values. */\nexport type TVaultAuthMethod = TConstValue<typeof VaultAuthMethods>;\n"]}
@@ -1,4 +1,4 @@
1
- import { type TConstValue } from '../../../../common/types/index.js';
1
+ import { ConstClass } from '../../../../common/const-class.js';
2
2
  /** Event names and default room names used by the Socket.IO server and client helpers. */
3
3
  export declare class SocketIOConstants {
4
4
  static readonly EVENT_PING = "ping";
@@ -15,11 +15,9 @@ export declare class SocketIOConstants {
15
15
  static readonly ROOM_NOTIFICATION = "io-notification";
16
16
  }
17
17
  /** Authentication states of a Socket.IO client. `isValid` narrows a string to one of them. */
18
- export declare class SocketIOClientStates {
18
+ export declare class SocketIOClientStates extends ConstClass {
19
19
  static readonly UNAUTHORIZED = "unauthorized";
20
20
  static readonly AUTHENTICATING = "authenticating";
21
21
  static readonly AUTHENTICATED = "authenticated";
22
- static readonly SCHEME_SET: Set<string>;
23
- static isValid(input: string): input is TConstValue<typeof SocketIOClientStates>;
24
22
  }
25
23
  //# sourceMappingURL=constants.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { ConstClass } from '../../../../common/const-class.js';
1
2
  /** Event names and default room names used by the Socket.IO server and client helpers. */
2
3
  export class SocketIOConstants {
3
4
  static { this.EVENT_PING = 'ping'; }
@@ -14,17 +15,9 @@ export class SocketIOConstants {
14
15
  static { this.ROOM_NOTIFICATION = 'io-notification'; }
15
16
  }
16
17
  /** Authentication states of a Socket.IO client. `isValid` narrows a string to one of them. */
17
- export class SocketIOClientStates {
18
+ export class SocketIOClientStates extends ConstClass {
18
19
  static { this.UNAUTHORIZED = 'unauthorized'; }
19
20
  static { this.AUTHENTICATING = 'authenticating'; }
20
21
  static { this.AUTHENTICATED = 'authenticated'; }
21
- static { this.SCHEME_SET = new Set([
22
- this.UNAUTHORIZED,
23
- this.AUTHENTICATING,
24
- this.AUTHENTICATED,
25
- ]); }
26
- static isValid(input) {
27
- return this.SCHEME_SET.has(input);
28
- }
29
22
  }
30
23
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/socket/socket-io/common/constants.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,MAAM,OAAO,iBAAiB;aACZ,eAAU,GAAG,MAAM,CAAC;aACpB,kBAAa,GAAG,YAAY,CAAC;aAC7B,qBAAgB,GAAG,YAAY,CAAC;aAChC,eAAU,GAAG,MAAM,CAAC;aACpB,gBAAW,GAAG,OAAO,CAAC;aACtB,uBAAkB,GAAG,cAAc,CAAC;aACpC,wBAAmB,GAAG,eAAe,CAAC;aACtC,yBAAoB,GAAG,iBAAiB,CAAC;IAEzD,oIAAoI;aACpH,uBAAkB,GAAG,kBAAkB,CAAC;aACxC,iBAAY,GAAG,YAAY,CAAC;aAC5B,sBAAiB,GAAG,iBAAiB,CAAC;;AAGxD,8FAA8F;AAC9F,MAAM,OAAO,oBAAoB;aACf,iBAAY,GAAG,cAAc,CAAC;aAC9B,mBAAc,GAAG,gBAAgB,CAAC;aAClC,kBAAa,GAAG,eAAe,CAAC;aAEhC,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,cAAc;QACnB,IAAI,CAAC,aAAa;KACnB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import { type TConstValue } from '@/common/types';\n\n/** Event names and default room names used by the Socket.IO server and client helpers. */\nexport class SocketIOConstants {\n static readonly EVENT_PING = 'ping';\n static readonly EVENT_CONNECT = 'connection';\n static readonly EVENT_DISCONNECT = 'disconnect';\n static readonly EVENT_JOIN = 'join';\n static readonly EVENT_LEAVE = 'leave';\n static readonly EVENT_AUTHENTICATE = 'authenticate';\n static readonly EVENT_AUTHENTICATED = 'authenticated';\n static readonly EVENT_UNAUTHENTICATE = 'unauthenticated';\n\n /** Every authenticated socket, and only those, is in this room: a send with no destination goes here, never to the whole server. */\n static readonly ROOM_AUTHENTICATED = 'io-authenticated';\n static readonly ROOM_DEFAULT = 'io-default';\n static readonly ROOM_NOTIFICATION = 'io-notification';\n}\n\n/** Authentication states of a Socket.IO client. `isValid` narrows a string to one of them. */\nexport class SocketIOClientStates {\n static readonly UNAUTHORIZED = 'unauthorized';\n static readonly AUTHENTICATING = 'authenticating';\n static readonly AUTHENTICATED = 'authenticated';\n\n static readonly SCHEME_SET = new Set([\n this.UNAUTHORIZED,\n this.AUTHENTICATING,\n this.AUTHENTICATED,\n ]);\n\n static isValid(input: string): input is TConstValue<typeof SocketIOClientStates> {\n return this.SCHEME_SET.has(input);\n }\n}\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/socket/socket-io/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,0FAA0F;AAC1F,MAAM,OAAO,iBAAiB;aACZ,eAAU,GAAG,MAAM,CAAC;aACpB,kBAAa,GAAG,YAAY,CAAC;aAC7B,qBAAgB,GAAG,YAAY,CAAC;aAChC,eAAU,GAAG,MAAM,CAAC;aACpB,gBAAW,GAAG,OAAO,CAAC;aACtB,uBAAkB,GAAG,cAAc,CAAC;aACpC,wBAAmB,GAAG,eAAe,CAAC;aACtC,yBAAoB,GAAG,iBAAiB,CAAC;IAEzD,oIAAoI;aACpH,uBAAkB,GAAG,kBAAkB,CAAC;aACxC,iBAAY,GAAG,YAAY,CAAC;aAC5B,sBAAiB,GAAG,iBAAiB,CAAC;;AAGxD,8FAA8F;AAC9F,MAAM,OAAO,oBAAqB,SAAQ,UAAU;aAClC,iBAAY,GAAG,cAAc,CAAC;aAC9B,mBAAc,GAAG,gBAAgB,CAAC;aAClC,kBAAa,GAAG,eAAe,CAAC","sourcesContent":["import { ConstClass } from '@/common/const-class';\n\n/** Event names and default room names used by the Socket.IO server and client helpers. */\nexport class SocketIOConstants {\n static readonly EVENT_PING = 'ping';\n static readonly EVENT_CONNECT = 'connection';\n static readonly EVENT_DISCONNECT = 'disconnect';\n static readonly EVENT_JOIN = 'join';\n static readonly EVENT_LEAVE = 'leave';\n static readonly EVENT_AUTHENTICATE = 'authenticate';\n static readonly EVENT_AUTHENTICATED = 'authenticated';\n static readonly EVENT_UNAUTHENTICATE = 'unauthenticated';\n\n /** Every authenticated socket, and only those, is in this room: a send with no destination goes here, never to the whole server. */\n static readonly ROOM_AUTHENTICATED = 'io-authenticated';\n static readonly ROOM_DEFAULT = 'io-default';\n static readonly ROOM_NOTIFICATION = 'io-notification';\n}\n\n/** Authentication states of a Socket.IO client. `isValid` narrows a string to one of them. */\nexport class SocketIOClientStates extends ConstClass {\n static readonly UNAUTHORIZED = 'unauthorized';\n static readonly AUTHENTICATING = 'authenticating';\n static readonly AUTHENTICATED = 'authenticated';\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { type TConstValue } from '../../../../common/types/index.js';
2
+ import { ConstClass } from '../../../../common/const-class.js';
2
3
  /** Event names of the WebSocket protocol. `isValid` narrows a string to one of them. */
3
- export declare class WebSocketEvents {
4
+ export declare class WebSocketEvents extends ConstClass {
4
5
  static readonly AUTHENTICATE = "authenticate";
5
6
  static readonly CONNECTED = "connected";
6
7
  static readonly DISCONNECT = "disconnect";
@@ -9,8 +10,6 @@ export declare class WebSocketEvents {
9
10
  static readonly ERROR = "error";
10
11
  static readonly HEARTBEAT = "heartbeat";
11
12
  static readonly ENCRYPTED = "encrypted";
12
- static readonly SCHEME_SET: Set<string>;
13
- static isValid(input: string): input is TWebSocketEvent;
14
13
  }
15
14
  /** One of the `WebSocketEvents` values. */
16
15
  export type TWebSocketEvent = TConstValue<typeof WebSocketEvents>;
@@ -50,23 +49,19 @@ export declare class WebSocketDefaults {
50
49
  static readonly ENCRYPTED_BATCH_LIMIT = 10;
51
50
  }
52
51
  /** Delivery target types of a WebSocket message. `isValid` narrows a string to one of them. */
53
- export declare class WebSocketMessageTypes {
52
+ export declare class WebSocketMessageTypes extends ConstClass {
54
53
  static readonly CLIENT = "client";
55
54
  static readonly USER = "user";
56
55
  static readonly ROOM = "room";
57
56
  static readonly BROADCAST = "broadcast";
58
- static readonly SCHEME_SET: Set<string>;
59
- static isValid(input: string): input is TWebSocketMessageType;
60
57
  }
61
58
  /** One of the `WebSocketMessageTypes` values. */
62
59
  export type TWebSocketMessageType = TConstValue<typeof WebSocketMessageTypes>;
63
60
  /** Connection states of a WebSocket client. `isValid` narrows a string to one of them. */
64
- export declare class WebSocketClientStates {
61
+ export declare class WebSocketClientStates extends ConstClass {
65
62
  static readonly UNAUTHORIZED = "unauthorized";
66
63
  static readonly AUTHENTICATING = "authenticating";
67
64
  static readonly AUTHENTICATED = "authenticated";
68
65
  static readonly DISCONNECTED = "disconnected";
69
- static readonly SCHEME_SET: Set<string>;
70
- static isValid(input: string): input is TConstValue<typeof WebSocketClientStates>;
71
66
  }
72
67
  //# sourceMappingURL=constants.d.ts.map