@twin.org/core 0.0.2-next.8 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/README.md +1 -9
  2. package/dist/es/encoding/base32.js +75 -0
  3. package/dist/es/encoding/base32.js.map +1 -0
  4. package/dist/es/encoding/base58.js +124 -0
  5. package/dist/es/encoding/base58.js.map +1 -0
  6. package/dist/es/encoding/base64.js +231 -0
  7. package/dist/es/encoding/base64.js.map +1 -0
  8. package/dist/es/encoding/base64Url.js +42 -0
  9. package/dist/es/encoding/base64Url.js.map +1 -0
  10. package/dist/es/errors/alreadyExistsError.js +22 -0
  11. package/dist/es/errors/alreadyExistsError.js.map +1 -0
  12. package/dist/es/errors/baseError.js +257 -0
  13. package/dist/es/errors/baseError.js.map +1 -0
  14. package/dist/es/errors/conflictError.js +23 -0
  15. package/dist/es/errors/conflictError.js.map +1 -0
  16. package/dist/es/errors/generalError.js +21 -0
  17. package/dist/es/errors/generalError.js.map +1 -0
  18. package/dist/es/errors/guardError.js +27 -0
  19. package/dist/es/errors/guardError.js.map +1 -0
  20. package/dist/es/errors/notFoundError.js +22 -0
  21. package/dist/es/errors/notFoundError.js.map +1 -0
  22. package/dist/es/errors/notImplementedError.js +24 -0
  23. package/dist/es/errors/notImplementedError.js.map +1 -0
  24. package/dist/es/errors/notSupportedError.js +21 -0
  25. package/dist/es/errors/notSupportedError.js.map +1 -0
  26. package/dist/es/errors/unauthorizedError.js +21 -0
  27. package/dist/es/errors/unauthorizedError.js.map +1 -0
  28. package/dist/es/errors/unprocessableError.js +21 -0
  29. package/dist/es/errors/unprocessableError.js.map +1 -0
  30. package/dist/es/errors/validationError.js +23 -0
  31. package/dist/es/errors/validationError.js.map +1 -0
  32. package/dist/es/factories/componentFactory.js +9 -0
  33. package/dist/es/factories/componentFactory.js.map +1 -0
  34. package/dist/es/factories/factory.js +297 -0
  35. package/dist/es/factories/factory.js.map +1 -0
  36. package/dist/es/helpers/arrayHelper.js +46 -0
  37. package/dist/es/helpers/arrayHelper.js.map +1 -0
  38. package/dist/es/helpers/envHelper.js +39 -0
  39. package/dist/es/helpers/envHelper.js.map +1 -0
  40. package/dist/es/helpers/errorHelper.js +100 -0
  41. package/dist/es/helpers/errorHelper.js.map +1 -0
  42. package/dist/es/helpers/filenameHelper.js +32 -0
  43. package/dist/es/helpers/filenameHelper.js.map +1 -0
  44. package/dist/es/helpers/hexHelper.js +45 -0
  45. package/dist/es/helpers/hexHelper.js.map +1 -0
  46. package/dist/es/helpers/jsonHelper.js +163 -0
  47. package/dist/es/helpers/jsonHelper.js.map +1 -0
  48. package/dist/es/helpers/numberHelper.js +30 -0
  49. package/dist/es/helpers/numberHelper.js.map +1 -0
  50. package/dist/es/helpers/objectHelper.js +309 -0
  51. package/dist/es/helpers/objectHelper.js.map +1 -0
  52. package/dist/es/helpers/randomHelper.js +66 -0
  53. package/dist/es/helpers/randomHelper.js.map +1 -0
  54. package/dist/es/helpers/stringHelper.js +252 -0
  55. package/dist/es/helpers/stringHelper.js.map +1 -0
  56. package/dist/es/helpers/uint8ArrayHelper.js +26 -0
  57. package/dist/es/helpers/uint8ArrayHelper.js.map +1 -0
  58. package/dist/es/index.js +60 -0
  59. package/dist/es/index.js.map +1 -0
  60. package/dist/es/models/IComponent.js +2 -0
  61. package/dist/es/models/IComponent.js.map +1 -0
  62. package/dist/es/models/IError.js +4 -0
  63. package/dist/es/models/IError.js.map +1 -0
  64. package/dist/es/models/IHealth.js +2 -0
  65. package/dist/es/models/IHealth.js.map +1 -0
  66. package/dist/es/models/II18nShared.js +2 -0
  67. package/dist/es/models/II18nShared.js.map +1 -0
  68. package/dist/es/models/IKeyValue.js +2 -0
  69. package/dist/es/models/IKeyValue.js.map +1 -0
  70. package/dist/es/models/ILabelledValue.js +2 -0
  71. package/dist/es/models/ILabelledValue.js.map +1 -0
  72. package/dist/es/models/ILocale.js +2 -0
  73. package/dist/es/models/ILocale.js.map +1 -0
  74. package/dist/es/models/ILocaleDictionary.js +4 -0
  75. package/dist/es/models/ILocaleDictionary.js.map +1 -0
  76. package/dist/es/models/ILocalesIndex.js +2 -0
  77. package/dist/es/models/ILocalesIndex.js.map +1 -0
  78. package/dist/es/models/IPatchOperation.js +4 -0
  79. package/dist/es/models/IPatchOperation.js.map +1 -0
  80. package/dist/es/models/IUrlParts.js +4 -0
  81. package/dist/es/models/IUrlParts.js.map +1 -0
  82. package/dist/es/models/IValidationFailure.js +2 -0
  83. package/dist/es/models/IValidationFailure.js.map +1 -0
  84. package/dist/es/models/coerceType.js +49 -0
  85. package/dist/es/models/coerceType.js.map +1 -0
  86. package/dist/es/models/compressionType.js +17 -0
  87. package/dist/es/models/compressionType.js.map +1 -0
  88. package/dist/es/models/healthStatus.js +21 -0
  89. package/dist/es/models/healthStatus.js.map +1 -0
  90. package/dist/es/types/bitString.js +98 -0
  91. package/dist/es/types/bitString.js.map +1 -0
  92. package/dist/es/types/objectOrArray.js +2 -0
  93. package/dist/es/types/objectOrArray.js.map +1 -0
  94. package/dist/es/types/singleOccurrenceArray.js +2 -0
  95. package/dist/es/types/singleOccurrenceArray.js.map +1 -0
  96. package/dist/es/types/url.js +144 -0
  97. package/dist/es/types/url.js.map +1 -0
  98. package/dist/es/types/urn.js +211 -0
  99. package/dist/es/types/urn.js.map +1 -0
  100. package/dist/es/utils/asyncCache.js +206 -0
  101. package/dist/es/utils/asyncCache.js.map +1 -0
  102. package/dist/es/utils/coerce.js +269 -0
  103. package/dist/es/utils/coerce.js.map +1 -0
  104. package/dist/es/utils/compression.js +49 -0
  105. package/dist/es/utils/compression.js.map +1 -0
  106. package/dist/es/utils/converter.js +256 -0
  107. package/dist/es/utils/converter.js.map +1 -0
  108. package/dist/es/utils/guards.js +385 -0
  109. package/dist/es/utils/guards.js.map +1 -0
  110. package/dist/es/utils/i18n.js +243 -0
  111. package/dist/es/utils/i18n.js.map +1 -0
  112. package/dist/es/utils/is.js +367 -0
  113. package/dist/es/utils/is.js.map +1 -0
  114. package/dist/es/utils/sharedStore.js +48 -0
  115. package/dist/es/utils/sharedStore.js.map +1 -0
  116. package/dist/es/utils/validation.js +774 -0
  117. package/dist/es/utils/validation.js.map +1 -0
  118. package/dist/types/encoding/base32.d.ts +5 -1
  119. package/dist/types/encoding/base58.d.ts +4 -0
  120. package/dist/types/encoding/base64.d.ts +4 -0
  121. package/dist/types/encoding/base64Url.d.ts +4 -0
  122. package/dist/types/errors/alreadyExistsError.d.ts +6 -3
  123. package/dist/types/errors/baseError.d.ts +2 -2
  124. package/dist/types/errors/conflictError.d.ts +6 -3
  125. package/dist/types/errors/generalError.d.ts +2 -2
  126. package/dist/types/errors/guardError.d.ts +2 -2
  127. package/dist/types/errors/notFoundError.d.ts +6 -3
  128. package/dist/types/errors/notImplementedError.d.ts +6 -2
  129. package/dist/types/errors/notSupportedError.d.ts +6 -3
  130. package/dist/types/errors/unauthorizedError.d.ts +7 -4
  131. package/dist/types/errors/unprocessableError.d.ts +2 -2
  132. package/dist/types/errors/validationError.d.ts +2 -2
  133. package/dist/types/factories/componentFactory.d.ts +2 -2
  134. package/dist/types/factories/factory.d.ts +27 -1
  135. package/dist/types/helpers/arrayHelper.d.ts +1 -8
  136. package/dist/types/helpers/errorHelper.d.ts +1 -1
  137. package/dist/types/helpers/jsonHelper.d.ts +5 -1
  138. package/dist/types/helpers/numberHelper.d.ts +17 -0
  139. package/dist/types/helpers/objectHelper.d.ts +24 -6
  140. package/dist/types/helpers/randomHelper.d.ts +16 -0
  141. package/dist/types/helpers/stringHelper.d.ts +12 -6
  142. package/dist/types/index.d.ts +57 -53
  143. package/dist/types/models/IComponent.d.ts +18 -7
  144. package/dist/types/models/IError.d.ts +1 -1
  145. package/dist/types/models/IHealth.d.ts +32 -0
  146. package/dist/types/models/ILocalesIndex.d.ts +1 -1
  147. package/dist/types/models/IValidationFailure.d.ts +0 -4
  148. package/dist/types/models/healthStatus.d.ts +21 -0
  149. package/dist/types/types/bitString.d.ts +4 -0
  150. package/dist/types/types/singleOccurrenceArray.d.ts +9 -0
  151. package/dist/types/types/url.d.ts +8 -3
  152. package/dist/types/types/urn.d.ts +7 -2
  153. package/dist/types/utils/asyncCache.d.ts +7 -0
  154. package/dist/types/utils/coerce.d.ts +1 -1
  155. package/dist/types/utils/compression.d.ts +5 -1
  156. package/dist/types/utils/guards.d.ts +11 -3
  157. package/dist/types/utils/i18n.d.ts +16 -1
  158. package/dist/types/utils/is.d.ts +8 -1
  159. package/dist/types/utils/validation.d.ts +1 -1
  160. package/docs/changelog.md +1240 -130
  161. package/docs/examples.md +308 -1
  162. package/docs/reference/classes/AlreadyExistsError.md +43 -39
  163. package/docs/reference/classes/ArrayHelper.md +10 -44
  164. package/docs/reference/classes/AsyncCache.md +12 -12
  165. package/docs/reference/classes/Base32.md +11 -3
  166. package/docs/reference/classes/Base58.md +10 -2
  167. package/docs/reference/classes/Base64.md +11 -3
  168. package/docs/reference/classes/Base64Url.md +10 -2
  169. package/docs/reference/classes/BaseError.md +37 -37
  170. package/docs/reference/classes/BitString.md +13 -5
  171. package/docs/reference/classes/Coerce.md +31 -31
  172. package/docs/reference/classes/Compression.md +10 -2
  173. package/docs/reference/classes/ConflictError.md +43 -39
  174. package/docs/reference/classes/Converter.md +18 -18
  175. package/docs/reference/classes/EnvHelper.md +1 -1
  176. package/docs/reference/classes/ErrorHelper.md +5 -5
  177. package/docs/reference/classes/Factory.md +122 -20
  178. package/docs/reference/classes/FilenameHelper.md +1 -1
  179. package/docs/reference/classes/GeneralError.md +38 -38
  180. package/docs/reference/classes/GuardError.md +38 -38
  181. package/docs/reference/classes/Guards.md +80 -34
  182. package/docs/reference/classes/HexHelper.md +6 -6
  183. package/docs/reference/classes/I18n.md +66 -14
  184. package/docs/reference/classes/Is.md +77 -43
  185. package/docs/reference/classes/JsonHelper.md +17 -9
  186. package/docs/reference/classes/NotFoundError.md +43 -39
  187. package/docs/reference/classes/NotImplementedError.md +48 -38
  188. package/docs/reference/classes/NotSupportedError.md +43 -39
  189. package/docs/reference/classes/NumberHelper.md +55 -0
  190. package/docs/reference/classes/ObjectHelper.md +163 -51
  191. package/docs/reference/classes/RandomHelper.md +53 -1
  192. package/docs/reference/classes/SharedStore.md +5 -5
  193. package/docs/reference/classes/StringHelper.md +52 -30
  194. package/docs/reference/classes/Uint8ArrayHelper.md +1 -1
  195. package/docs/reference/classes/UnauthorizedError.md +44 -40
  196. package/docs/reference/classes/UnprocessableError.md +38 -38
  197. package/docs/reference/classes/Url.md +24 -10
  198. package/docs/reference/classes/Urn.md +42 -28
  199. package/docs/reference/classes/Validation.md +27 -27
  200. package/docs/reference/classes/ValidationError.md +37 -37
  201. package/docs/reference/index.md +6 -0
  202. package/docs/reference/interfaces/IComponent.md +57 -27
  203. package/docs/reference/interfaces/IError.md +11 -11
  204. package/docs/reference/interfaces/IHealth.md +55 -0
  205. package/docs/reference/interfaces/II18nShared.md +4 -4
  206. package/docs/reference/interfaces/IKeyValue.md +2 -2
  207. package/docs/reference/interfaces/ILabelledValue.md +2 -2
  208. package/docs/reference/interfaces/ILocale.md +2 -2
  209. package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
  210. package/docs/reference/interfaces/ILocalesIndex.md +1 -1
  211. package/docs/reference/interfaces/IPatchOperation.md +6 -6
  212. package/docs/reference/interfaces/IUrlParts.md +9 -9
  213. package/docs/reference/interfaces/IValidationFailure.md +4 -12
  214. package/docs/reference/type-aliases/HealthStatus.md +5 -0
  215. package/docs/reference/type-aliases/SingleOccurrenceArray.md +15 -0
  216. package/docs/reference/type-aliases/SingleOccurrenceArrayDepthHelper.md +19 -0
  217. package/docs/reference/variables/CoerceType.md +10 -10
  218. package/docs/reference/variables/CompressionType.md +2 -2
  219. package/docs/reference/variables/HealthStatus.md +25 -0
  220. package/locales/.validate-ignore +1 -0
  221. package/locales/en.json +9 -7
  222. package/package.json +24 -12
  223. package/dist/cjs/index.cjs +0 -5175
  224. package/dist/esm/index.mjs +0 -5133
  225. /package/dist/types/{models → types}/objectOrArray.d.ts +0 -0
@@ -1,53 +1,57 @@
1
- export * from "./encoding/base32";
2
- export * from "./encoding/base58";
3
- export * from "./encoding/base64";
4
- export * from "./encoding/base64Url";
5
- export * from "./errors/alreadyExistsError";
6
- export * from "./errors/baseError";
7
- export * from "./errors/conflictError";
8
- export * from "./errors/generalError";
9
- export * from "./errors/guardError";
10
- export * from "./errors/notFoundError";
11
- export * from "./errors/notImplementedError";
12
- export * from "./errors/notSupportedError";
13
- export * from "./errors/unauthorizedError";
14
- export * from "./errors/unprocessableError";
15
- export * from "./errors/validationError";
16
- export * from "./factories/componentFactory";
17
- export * from "./factories/factory";
18
- export * from "./helpers/arrayHelper";
19
- export * from "./helpers/envHelper";
20
- export * from "./helpers/errorHelper";
21
- export * from "./helpers/filenameHelper";
22
- export * from "./helpers/hexHelper";
23
- export * from "./helpers/jsonHelper";
24
- export * from "./helpers/objectHelper";
25
- export * from "./helpers/randomHelper";
26
- export * from "./helpers/stringHelper";
27
- export * from "./helpers/uint8ArrayHelper";
28
- export * from "./models/coerceType";
29
- export * from "./models/compressionType";
30
- export * from "./models/IComponent";
31
- export * from "./models/IError";
32
- export * from "./models/II18nShared";
33
- export * from "./models/IKeyValue";
34
- export * from "./models/ILabelledValue";
35
- export * from "./models/ILocale";
36
- export * from "./models/ILocaleDictionary";
37
- export * from "./models/ILocalesIndex";
38
- export * from "./models/IPatchOperation";
39
- export * from "./models/IUrlParts";
40
- export * from "./models/IValidationFailure";
41
- export * from "./models/objectOrArray";
42
- export * from "./types/bitString";
43
- export * from "./types/url";
44
- export * from "./types/urn";
45
- export * from "./utils/asyncCache";
46
- export * from "./utils/coerce";
47
- export * from "./utils/compression";
48
- export * from "./utils/converter";
49
- export * from "./utils/guards";
50
- export * from "./utils/i18n";
51
- export * from "./utils/is";
52
- export * from "./utils/sharedStore";
53
- export * from "./utils/validation";
1
+ export * from "./encoding/base32.js";
2
+ export * from "./encoding/base58.js";
3
+ export * from "./encoding/base64.js";
4
+ export * from "./encoding/base64Url.js";
5
+ export * from "./errors/alreadyExistsError.js";
6
+ export * from "./errors/baseError.js";
7
+ export * from "./errors/conflictError.js";
8
+ export * from "./errors/generalError.js";
9
+ export * from "./errors/guardError.js";
10
+ export * from "./errors/notFoundError.js";
11
+ export * from "./errors/notImplementedError.js";
12
+ export * from "./errors/notSupportedError.js";
13
+ export * from "./errors/unauthorizedError.js";
14
+ export * from "./errors/unprocessableError.js";
15
+ export * from "./errors/validationError.js";
16
+ export * from "./factories/componentFactory.js";
17
+ export * from "./factories/factory.js";
18
+ export * from "./helpers/arrayHelper.js";
19
+ export * from "./helpers/envHelper.js";
20
+ export * from "./helpers/errorHelper.js";
21
+ export * from "./helpers/filenameHelper.js";
22
+ export * from "./helpers/hexHelper.js";
23
+ export * from "./helpers/jsonHelper.js";
24
+ export * from "./helpers/numberHelper.js";
25
+ export * from "./helpers/objectHelper.js";
26
+ export * from "./helpers/randomHelper.js";
27
+ export * from "./helpers/stringHelper.js";
28
+ export * from "./helpers/uint8ArrayHelper.js";
29
+ export * from "./models/coerceType.js";
30
+ export * from "./models/compressionType.js";
31
+ export * from "./models/healthStatus.js";
32
+ export * from "./models/IComponent.js";
33
+ export * from "./models/IError.js";
34
+ export * from "./models/IHealth.js";
35
+ export * from "./models/II18nShared.js";
36
+ export * from "./models/IKeyValue.js";
37
+ export * from "./models/ILabelledValue.js";
38
+ export * from "./models/ILocale.js";
39
+ export * from "./models/ILocaleDictionary.js";
40
+ export * from "./models/ILocalesIndex.js";
41
+ export * from "./models/IPatchOperation.js";
42
+ export * from "./models/IUrlParts.js";
43
+ export * from "./models/IValidationFailure.js";
44
+ export * from "./types/bitString.js";
45
+ export * from "./types/objectOrArray.js";
46
+ export * from "./types/singleOccurrenceArray.js";
47
+ export * from "./types/url.js";
48
+ export * from "./types/urn.js";
49
+ export * from "./utils/asyncCache.js";
50
+ export * from "./utils/coerce.js";
51
+ export * from "./utils/compression.js";
52
+ export * from "./utils/converter.js";
53
+ export * from "./utils/guards.js";
54
+ export * from "./utils/i18n.js";
55
+ export * from "./utils/is.js";
56
+ export * from "./utils/sharedStore.js";
57
+ export * from "./utils/validation.js";
@@ -1,29 +1,40 @@
1
+ import type { IHealth } from "./IHealth.js";
1
2
  /**
2
3
  * Interface describing a component which can be bootstrapped, started and stopped.
3
4
  */
4
5
  export interface IComponent {
5
6
  /**
6
- * The name of the component.
7
+ * Returns the class name of the component.
8
+ * @returns The class name of the component.
7
9
  */
8
- readonly CLASS_NAME: string;
10
+ className(): string;
9
11
  /**
10
12
  * Bootstrap the component by creating and initializing any resources it needs.
11
13
  * @param nodeLoggingComponentType The node logging component type.
12
14
  * @returns True if the bootstrapping process was successful.
13
15
  */
14
- bootstrap?(nodeLoggingComponentType: string | undefined): Promise<boolean>;
16
+ bootstrap?(nodeLoggingComponentType?: string): Promise<boolean>;
17
+ /**
18
+ * Teardown the component by releasing any resources it holds.
19
+ * @param nodeLoggingComponentType The node logging component type.
20
+ * @returns True if the teardown process was successful.
21
+ */
22
+ teardown?(nodeLoggingComponentType?: string): Promise<boolean>;
15
23
  /**
16
24
  * The component needs to be started when the node is initialized.
17
- * @param nodeIdentity The identity of the node starting the component.
18
25
  * @param nodeLoggingComponentType The node logging component type.
19
26
  * @returns Nothing.
20
27
  */
21
- start?(nodeIdentity: string, nodeLoggingComponentType: string | undefined): Promise<void>;
28
+ start?(nodeLoggingComponentType?: string): Promise<void>;
22
29
  /**
23
30
  * The component needs to be stopped when the node is closed.
24
- * @param nodeIdentity The identity of the node stopping the component.
25
31
  * @param nodeLoggingComponentType The node logging component type.
26
32
  * @returns Nothing.
27
33
  */
28
- stop?(nodeIdentity: string, nodeLoggingComponentType: string | undefined): Promise<void>;
34
+ stop?(nodeLoggingComponentType?: string): Promise<void>;
35
+ /**
36
+ * Returns the health status of the component.
37
+ * @returns The health status of the component, can return multiple entries for elements within the component.
38
+ */
39
+ health?(): Promise<IHealth[]>;
29
40
  }
@@ -7,7 +7,7 @@ export interface IError {
7
7
  */
8
8
  name: string;
9
9
  /**
10
- * The message for the error.
10
+ * The message for the error as an i18n key.
11
11
  */
12
12
  message: string;
13
13
  /**
@@ -0,0 +1,32 @@
1
+ import type { HealthStatus } from "./healthStatus.js";
2
+ /**
3
+ * Provides health information for a component.
4
+ */
5
+ export interface IHealth {
6
+ /**
7
+ * The source of the health information.
8
+ */
9
+ source: string;
10
+ /**
11
+ * The description of the component as an i18n key.
12
+ */
13
+ description?: string;
14
+ /**
15
+ * The overall status of the component, the entries can also report their own health.
16
+ */
17
+ status: HealthStatus;
18
+ /**
19
+ * The message for the status if there are further details to provide as an i18n key.
20
+ */
21
+ message?: string;
22
+ /**
23
+ * Data to substitute in the i18n key for the message.
24
+ */
25
+ data?: {
26
+ [id: string]: unknown;
27
+ };
28
+ /**
29
+ * The grouped child components, if any.
30
+ */
31
+ grouped?: IHealth[];
32
+ }
@@ -1,4 +1,4 @@
1
- import type { ILocale } from "./ILocale";
1
+ import type { ILocale } from "./ILocale.js";
2
2
  /**
3
3
  * Model for a locales index.
4
4
  */
@@ -10,10 +10,6 @@ export interface IValidationFailure {
10
10
  * The reason the validation failed as an i18 resource error.
11
11
  */
12
12
  reason: string;
13
- /**
14
- * The optional human readable name for the field as an i18 resource.
15
- */
16
- fieldName?: string;
17
13
  /**
18
14
  * Additional properties for the validation failure.
19
15
  */
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The health status of the component.
3
+ */
4
+ export declare const HealthStatus: {
5
+ /**
6
+ * OK.
7
+ */
8
+ readonly Ok: "ok";
9
+ /**
10
+ * Warning.
11
+ */
12
+ readonly Warning: "warning";
13
+ /**
14
+ * Error.
15
+ */
16
+ readonly Error: "error";
17
+ };
18
+ /**
19
+ * The health status of the component.
20
+ */
21
+ export type HealthStatus = (typeof HealthStatus)[keyof typeof HealthStatus];
@@ -2,6 +2,10 @@
2
2
  * A class to represent a bit string.
3
3
  */
4
4
  export declare class BitString {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Create a new instance of BitString.
7
11
  * @param numberBits The length of the bit string.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Helper with bounded recursion depth to keep type instantiation tractable.
3
+ */
4
+ export type SingleOccurrenceArrayDepthHelper<T, U, Depth extends 0[]> = Depth["length"] extends 16 ? [U, ...T[]] : [U, ...T[]] | [T, ...SingleOccurrenceArrayDepthHelper<T, U, [0, ...Depth]>];
5
+ /**
6
+ * Utility type to create a non-empty array with values of type T and exactly one value of type U.
7
+ */
8
+ export type SingleOccurrenceArray<T = unknown, U = never> = SingleOccurrenceArrayDepthHelper<T, U, [
9
+ ]>;
@@ -1,9 +1,13 @@
1
- import type { IUrlParts } from "../models/IUrlParts";
2
- import type { IValidationFailure } from "../models/IValidationFailure";
1
+ import type { IUrlParts } from "../models/IUrlParts.js";
2
+ import type { IValidationFailure } from "../models/IValidationFailure.js";
3
3
  /**
4
4
  * Class to help with urls.
5
5
  */
6
6
  export declare class Url {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static readonly CLASS_NAME: string;
7
11
  /**
8
12
  * Create a new instance of Url.
9
13
  * @param url The url string.
@@ -28,9 +32,10 @@ export declare class Url {
28
32
  * @param property Throw an exception if the url property is invalid.
29
33
  * @param value The url to parse.
30
34
  * @param failures The list of failures to add to.
35
+ * @param fieldNameResource The optional human readable name for the field as an i18 resource.
31
36
  * @returns The formatted url.
32
37
  */
33
- static validate(property: string, value: unknown, failures: IValidationFailure[]): value is Url;
38
+ static validate(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is Url;
34
39
  /**
35
40
  * Construct a url from a URL.
36
41
  * @param url The url to construct from.
@@ -1,8 +1,12 @@
1
- import type { IValidationFailure } from "../models/IValidationFailure";
1
+ import type { IValidationFailure } from "../models/IValidationFailure.js";
2
2
  /**
3
3
  * Class to help with urns.
4
4
  */
5
5
  export declare class Urn {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
6
10
  /**
7
11
  * Create a new instance of Urn.
8
12
  * @param namespaceIdentifier The identifier for the namespace.
@@ -53,9 +57,10 @@ export declare class Urn {
53
57
  * @param property Throw an exception if the urn property is invalid.
54
58
  * @param value The urn to parse.
55
59
  * @param failures The list of failures to add to.
60
+ * @param fieldNameResource The optional human readable name for the field as an i18 resource.
56
61
  * @returns The formatted urn.
57
62
  */
58
- static validate(property: string, value: unknown, failures: IValidationFailure[]): value is string;
63
+ static validate(property: string, value: unknown, failures: IValidationFailure[], fieldNameResource?: string): value is string;
59
64
  /**
60
65
  * Get the parts.
61
66
  * @param startIndex The index to start from, defaults to 0.
@@ -39,4 +39,11 @@ export declare class AsyncCache {
39
39
  * Perform a cleanup of the expired entries in the cache.
40
40
  */
41
41
  static cleanupExpired(): void;
42
+ /**
43
+ * Resolve a waiter by re-running its request method safely.
44
+ * @param requestMethod The method to execute.
45
+ * @param resolve The resolver for the waiter.
46
+ * @param reject The rejector for the waiter.
47
+ */
48
+ private static resolveWaiter;
42
49
  }
@@ -1,4 +1,4 @@
1
- import { CoerceType } from "../models/coerceType";
1
+ import { CoerceType } from "../models/coerceType.js";
2
2
  /**
3
3
  * Coerce an object from one type to another.
4
4
  */
@@ -1,8 +1,12 @@
1
- import { CompressionType } from "../models/compressionType";
1
+ import { CompressionType } from "../models/compressionType.js";
2
2
  /**
3
3
  * A class to handle compression.
4
4
  */
5
5
  export declare class Compression {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
6
10
  /**
7
11
  * Compress bytes using GZIP.
8
12
  * @param bytes The bytes to compress.
@@ -1,4 +1,4 @@
1
- import type { ObjectOrArray } from "../models/objectOrArray";
1
+ import type { ObjectOrArray } from "../types/objectOrArray.js";
2
2
  /**
3
3
  * Class to handle guard operations for parameters.
4
4
  */
@@ -210,10 +210,9 @@ export declare class Guards {
210
210
  * @param source The source of the error.
211
211
  * @param property The name of the property.
212
212
  * @param value The value to test.
213
- * @returns True if the value is a function.
214
213
  * @throws GuardError If the value does not match the assertion.
215
214
  */
216
- static function(source: string, property: string, value: unknown): boolean;
215
+ static function<T extends (...args: any[]) => any = (...args: any[]) => any>(source: string, property: string, value: unknown): asserts value is T;
217
216
  /**
218
217
  * Is the property a string formatted as an email address.
219
218
  * @param source The source of the error.
@@ -222,4 +221,13 @@ export declare class Guards {
222
221
  * @throws GuardError If the value does not match the assertion.
223
222
  */
224
223
  static email(source: string, property: string, value: unknown): asserts value is string;
224
+ /**
225
+ * Is the property a string containing uuidV7.
226
+ * @param source The source of the error.
227
+ * @param property The name of the property.
228
+ * @param value The value to test.
229
+ * @param format The format of the uuidV7, either standard or compact.
230
+ * @throws GuardError If the value does not match the assertion.
231
+ */
232
+ static uuidV7(source: string, property: string, value: unknown, format?: "standard" | "compact"): asserts value is string;
225
233
  }
@@ -1,4 +1,4 @@
1
- import type { ILocaleDictionary } from "../models/ILocaleDictionary";
1
+ import type { ILocaleDictionary } from "../models/ILocaleDictionary.js";
2
2
  /**
3
3
  * Class to perform internationalization.
4
4
  */
@@ -78,4 +78,19 @@ export declare class I18n {
78
78
  * @returns True if the key exists.
79
79
  */
80
80
  static hasMessage(key: string): boolean;
81
+ /**
82
+ * Flatten the translation property paths for faster lookup.
83
+ * @param translation The translation to merge.
84
+ * @param propertyPath The current root path.
85
+ * @param mergedKeys The merged keys dictionary to populate.
86
+ */
87
+ static flattenTranslationKeys(translation: ILocaleDictionary, propertyPath: string, mergedKeys: {
88
+ [key: string]: string;
89
+ }): void;
90
+ /**
91
+ * Get a list of the property names from the message.
92
+ * @param message The message to extract the property names from.
93
+ * @returns The list of property names.
94
+ */
95
+ static getPropertyNames(message: string): string[];
81
96
  }
@@ -195,7 +195,7 @@ export declare class Is {
195
195
  * @param value The value to test.
196
196
  * @returns True if the value is a function.
197
197
  */
198
- static function(value: unknown): value is (...args: unknown[]) => unknown;
198
+ static function<T extends (...args: any[]) => any = (...args: any[]) => any>(value: unknown): value is T;
199
199
  /**
200
200
  * Is the value a string formatted as an email address.
201
201
  * @param value The value to test.
@@ -220,4 +220,11 @@ export declare class Is {
220
220
  * @returns True if the object is a class, false otherwise.
221
221
  */
222
222
  static class<T = unknown>(obj: unknown): obj is new (...args: any[]) => T;
223
+ /**
224
+ * Is the value a uuidV7 string.
225
+ * @param value The value to test.
226
+ * @param format The format of the UUIDv7 string.
227
+ * @returns True if the value is a uuidV7 string.
228
+ */
229
+ static uuidV7(value: unknown, format?: "standard" | "compact"): value is string;
223
230
  }
@@ -1,4 +1,4 @@
1
- import type { IValidationFailure } from "../models/IValidationFailure";
1
+ import type { IValidationFailure } from "../models/IValidationFailure.js";
2
2
  /**
3
3
  * Class to handle validation operations.
4
4
  */