@twin.org/core 0.0.2-next.9 → 0.0.3-next.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 (187) hide show
  1. package/dist/es/encoding/base32.js +75 -0
  2. package/dist/es/encoding/base32.js.map +1 -0
  3. package/dist/es/encoding/base58.js +124 -0
  4. package/dist/es/encoding/base58.js.map +1 -0
  5. package/dist/es/encoding/base64.js +231 -0
  6. package/dist/es/encoding/base64.js.map +1 -0
  7. package/dist/es/encoding/base64Url.js +42 -0
  8. package/dist/es/encoding/base64Url.js.map +1 -0
  9. package/dist/es/errors/alreadyExistsError.js +22 -0
  10. package/dist/es/errors/alreadyExistsError.js.map +1 -0
  11. package/dist/es/errors/baseError.js +257 -0
  12. package/dist/es/errors/baseError.js.map +1 -0
  13. package/dist/es/errors/conflictError.js +23 -0
  14. package/dist/es/errors/conflictError.js.map +1 -0
  15. package/dist/es/errors/generalError.js +21 -0
  16. package/dist/es/errors/generalError.js.map +1 -0
  17. package/dist/es/errors/guardError.js +27 -0
  18. package/dist/es/errors/guardError.js.map +1 -0
  19. package/dist/es/errors/notFoundError.js +22 -0
  20. package/dist/es/errors/notFoundError.js.map +1 -0
  21. package/dist/es/errors/notImplementedError.js +24 -0
  22. package/dist/es/errors/notImplementedError.js.map +1 -0
  23. package/dist/es/errors/notSupportedError.js +21 -0
  24. package/dist/es/errors/notSupportedError.js.map +1 -0
  25. package/dist/es/errors/unauthorizedError.js +21 -0
  26. package/dist/es/errors/unauthorizedError.js.map +1 -0
  27. package/dist/es/errors/unprocessableError.js +21 -0
  28. package/dist/es/errors/unprocessableError.js.map +1 -0
  29. package/dist/es/errors/validationError.js +23 -0
  30. package/dist/es/errors/validationError.js.map +1 -0
  31. package/dist/es/factories/componentFactory.js +9 -0
  32. package/dist/es/factories/componentFactory.js.map +1 -0
  33. package/dist/es/factories/factory.js +256 -0
  34. package/dist/es/factories/factory.js.map +1 -0
  35. package/dist/es/helpers/arrayHelper.js +44 -0
  36. package/dist/es/helpers/arrayHelper.js.map +1 -0
  37. package/dist/es/helpers/envHelper.js +39 -0
  38. package/dist/es/helpers/envHelper.js.map +1 -0
  39. package/dist/es/helpers/errorHelper.js +100 -0
  40. package/dist/es/helpers/errorHelper.js.map +1 -0
  41. package/dist/es/helpers/filenameHelper.js +32 -0
  42. package/dist/es/helpers/filenameHelper.js.map +1 -0
  43. package/dist/es/helpers/hexHelper.js +45 -0
  44. package/dist/es/helpers/hexHelper.js.map +1 -0
  45. package/dist/es/helpers/jsonHelper.js +163 -0
  46. package/dist/es/helpers/jsonHelper.js.map +1 -0
  47. package/dist/es/helpers/numberHelper.js +30 -0
  48. package/dist/es/helpers/numberHelper.js.map +1 -0
  49. package/dist/es/helpers/objectHelper.js +333 -0
  50. package/dist/es/helpers/objectHelper.js.map +1 -0
  51. package/dist/es/helpers/randomHelper.js +18 -0
  52. package/dist/es/helpers/randomHelper.js.map +1 -0
  53. package/dist/es/helpers/stringHelper.js +241 -0
  54. package/dist/es/helpers/stringHelper.js.map +1 -0
  55. package/dist/es/helpers/uint8ArrayHelper.js +26 -0
  56. package/dist/es/helpers/uint8ArrayHelper.js.map +1 -0
  57. package/dist/es/index.js +57 -0
  58. package/dist/es/index.js.map +1 -0
  59. package/dist/es/models/IComponent.js +4 -0
  60. package/dist/es/models/IComponent.js.map +1 -0
  61. package/dist/es/models/IError.js +4 -0
  62. package/dist/es/models/IError.js.map +1 -0
  63. package/dist/es/models/II18nShared.js +2 -0
  64. package/dist/es/models/II18nShared.js.map +1 -0
  65. package/dist/es/models/IKeyValue.js +2 -0
  66. package/dist/es/models/IKeyValue.js.map +1 -0
  67. package/dist/es/models/ILabelledValue.js +2 -0
  68. package/dist/es/models/ILabelledValue.js.map +1 -0
  69. package/dist/es/models/ILocale.js +2 -0
  70. package/dist/es/models/ILocale.js.map +1 -0
  71. package/dist/es/models/ILocaleDictionary.js +4 -0
  72. package/dist/es/models/ILocaleDictionary.js.map +1 -0
  73. package/dist/es/models/ILocalesIndex.js +2 -0
  74. package/dist/es/models/ILocalesIndex.js.map +1 -0
  75. package/dist/es/models/IPatchOperation.js +4 -0
  76. package/dist/es/models/IPatchOperation.js.map +1 -0
  77. package/dist/es/models/IUrlParts.js +4 -0
  78. package/dist/es/models/IUrlParts.js.map +1 -0
  79. package/dist/es/models/IValidationFailure.js +2 -0
  80. package/dist/es/models/IValidationFailure.js.map +1 -0
  81. package/dist/es/models/coerceType.js +49 -0
  82. package/dist/es/models/coerceType.js.map +1 -0
  83. package/dist/es/models/compressionType.js +17 -0
  84. package/dist/es/models/compressionType.js.map +1 -0
  85. package/dist/es/models/objectOrArray.js +2 -0
  86. package/dist/es/models/objectOrArray.js.map +1 -0
  87. package/dist/es/types/bitString.js +98 -0
  88. package/dist/es/types/bitString.js.map +1 -0
  89. package/dist/es/types/url.js +144 -0
  90. package/dist/es/types/url.js.map +1 -0
  91. package/dist/es/types/urn.js +212 -0
  92. package/dist/es/types/urn.js.map +1 -0
  93. package/dist/es/utils/asyncCache.js +179 -0
  94. package/dist/es/utils/asyncCache.js.map +1 -0
  95. package/dist/es/utils/coerce.js +269 -0
  96. package/dist/es/utils/coerce.js.map +1 -0
  97. package/dist/es/utils/compression.js +49 -0
  98. package/dist/es/utils/compression.js.map +1 -0
  99. package/dist/es/utils/converter.js +256 -0
  100. package/dist/es/utils/converter.js.map +1 -0
  101. package/dist/es/utils/guards.js +369 -0
  102. package/dist/es/utils/guards.js.map +1 -0
  103. package/dist/es/utils/i18n.js +243 -0
  104. package/dist/es/utils/i18n.js.map +1 -0
  105. package/dist/es/utils/is.js +351 -0
  106. package/dist/es/utils/is.js.map +1 -0
  107. package/dist/es/utils/sharedStore.js +48 -0
  108. package/dist/es/utils/sharedStore.js.map +1 -0
  109. package/dist/es/utils/validation.js +774 -0
  110. package/dist/es/utils/validation.js.map +1 -0
  111. package/dist/types/encoding/base32.d.ts +4 -0
  112. package/dist/types/encoding/base58.d.ts +4 -0
  113. package/dist/types/encoding/base64.d.ts +4 -0
  114. package/dist/types/encoding/base64Url.d.ts +4 -0
  115. package/dist/types/errors/alreadyExistsError.d.ts +5 -2
  116. package/dist/types/errors/baseError.d.ts +1 -1
  117. package/dist/types/errors/conflictError.d.ts +5 -2
  118. package/dist/types/errors/generalError.d.ts +1 -1
  119. package/dist/types/errors/guardError.d.ts +1 -1
  120. package/dist/types/errors/notFoundError.d.ts +5 -2
  121. package/dist/types/errors/notImplementedError.d.ts +6 -2
  122. package/dist/types/errors/notSupportedError.d.ts +5 -2
  123. package/dist/types/errors/unauthorizedError.d.ts +5 -2
  124. package/dist/types/errors/unprocessableError.d.ts +1 -1
  125. package/dist/types/errors/validationError.d.ts +2 -2
  126. package/dist/types/factories/componentFactory.d.ts +2 -2
  127. package/dist/types/factories/factory.d.ts +4 -0
  128. package/dist/types/helpers/arrayHelper.d.ts +1 -1
  129. package/dist/types/helpers/errorHelper.d.ts +1 -1
  130. package/dist/types/helpers/jsonHelper.d.ts +5 -1
  131. package/dist/types/helpers/numberHelper.d.ts +17 -0
  132. package/dist/types/helpers/objectHelper.d.ts +14 -0
  133. package/dist/types/helpers/stringHelper.d.ts +6 -6
  134. package/dist/types/index.d.ts +54 -53
  135. package/dist/types/models/IComponent.d.ts +6 -7
  136. package/dist/types/models/ILocalesIndex.d.ts +1 -1
  137. package/dist/types/models/IValidationFailure.d.ts +0 -4
  138. package/dist/types/types/bitString.d.ts +4 -0
  139. package/dist/types/types/url.d.ts +8 -3
  140. package/dist/types/types/urn.d.ts +7 -2
  141. package/dist/types/utils/coerce.d.ts +1 -1
  142. package/dist/types/utils/compression.d.ts +5 -1
  143. package/dist/types/utils/guards.d.ts +2 -3
  144. package/dist/types/utils/i18n.d.ts +16 -1
  145. package/dist/types/utils/is.d.ts +1 -1
  146. package/dist/types/utils/validation.d.ts +1 -1
  147. package/docs/changelog.md +283 -0
  148. package/docs/reference/classes/AlreadyExistsError.md +8 -4
  149. package/docs/reference/classes/AsyncCache.md +5 -5
  150. package/docs/reference/classes/Base32.md +8 -0
  151. package/docs/reference/classes/Base58.md +8 -0
  152. package/docs/reference/classes/Base64.md +8 -0
  153. package/docs/reference/classes/Base64Url.md +8 -0
  154. package/docs/reference/classes/BaseError.md +3 -3
  155. package/docs/reference/classes/BitString.md +8 -0
  156. package/docs/reference/classes/Coerce.md +20 -20
  157. package/docs/reference/classes/Compression.md +8 -0
  158. package/docs/reference/classes/ConflictError.md +8 -4
  159. package/docs/reference/classes/ErrorHelper.md +2 -2
  160. package/docs/reference/classes/Factory.md +11 -3
  161. package/docs/reference/classes/GeneralError.md +3 -3
  162. package/docs/reference/classes/GuardError.md +3 -3
  163. package/docs/reference/classes/Guards.md +8 -4
  164. package/docs/reference/classes/I18n.md +54 -2
  165. package/docs/reference/classes/Is.md +10 -4
  166. package/docs/reference/classes/JsonHelper.md +8 -0
  167. package/docs/reference/classes/NotFoundError.md +8 -4
  168. package/docs/reference/classes/NotImplementedError.md +14 -4
  169. package/docs/reference/classes/NotSupportedError.md +8 -4
  170. package/docs/reference/classes/NumberHelper.md +55 -0
  171. package/docs/reference/classes/ObjectHelper.md +58 -8
  172. package/docs/reference/classes/SharedStore.md +2 -2
  173. package/docs/reference/classes/StringHelper.md +8 -8
  174. package/docs/reference/classes/UnauthorizedError.md +8 -4
  175. package/docs/reference/classes/UnprocessableError.md +3 -3
  176. package/docs/reference/classes/Url.md +17 -3
  177. package/docs/reference/classes/Urn.md +19 -5
  178. package/docs/reference/classes/Validation.md +2 -2
  179. package/docs/reference/classes/ValidationError.md +3 -3
  180. package/docs/reference/index.md +1 -0
  181. package/docs/reference/interfaces/IComponent.md +19 -25
  182. package/docs/reference/interfaces/IValidationFailure.md +0 -8
  183. package/locales/.validate-ignore +1 -0
  184. package/locales/en.json +4 -5
  185. package/package.json +22 -10
  186. package/dist/cjs/index.cjs +0 -5175
  187. package/dist/esm/index.mjs +0 -5133
@@ -0,0 +1,241 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /* eslint-disable no-continue */
4
+ /* eslint-disable no-bitwise */
5
+ import { Is } from "../utils/is.js";
6
+ /**
7
+ * Class to help with string.
8
+ */
9
+ export class StringHelper {
10
+ /**
11
+ * Implementation signature for trimTrailingSlashes.
12
+ * @param value The value to trim.
13
+ * @returns The trimmed string or the original.
14
+ */
15
+ static trimTrailingSlashes(value) {
16
+ if (Is.string(value)) {
17
+ return value.replace(/\/+$/, "");
18
+ }
19
+ return value;
20
+ }
21
+ /**
22
+ * Implementation signature for trimLeadingSlashes.
23
+ * @param value The value to trim.
24
+ * @returns The trimmed string or the original.
25
+ */
26
+ static trimLeadingSlashes(value) {
27
+ if (Is.string(value)) {
28
+ return value.replace(/^\/+/, "");
29
+ }
30
+ return value;
31
+ }
32
+ /**
33
+ * Convert the input string to kebab case.
34
+ * @param input The input to convert.
35
+ * @param stripInterfacePrefix Strip interface prefixes.
36
+ * @returns The kebab case version of the input.
37
+ */
38
+ static kebabCase(input, stripInterfacePrefix = true) {
39
+ if (Is.stringValue(input)) {
40
+ let output = input;
41
+ if (stripInterfacePrefix && /^I[A-Z]/.test(output)) {
42
+ output = output.slice(1);
43
+ }
44
+ return StringHelper.words(output).join("-").toLowerCase();
45
+ }
46
+ return "";
47
+ }
48
+ /**
49
+ * Convert the input string to snake case.
50
+ * @param input The input to convert.
51
+ * @param stripInterfacePrefix Strip interface prefixes.
52
+ * @returns The snake case version of the input.
53
+ */
54
+ static snakeCase(input, stripInterfacePrefix = true) {
55
+ if (Is.stringValue(input)) {
56
+ let output = input;
57
+ if (stripInterfacePrefix && /^I[A-Z]/.test(output)) {
58
+ output = output.slice(1);
59
+ }
60
+ return StringHelper.words(output).join("_").toLowerCase();
61
+ }
62
+ return "";
63
+ }
64
+ /**
65
+ * Title case all the words.
66
+ * @param input The input to convert.
67
+ * @param stripInterfacePrefix Strip interface prefixes.
68
+ * @returns The title case version of the input.
69
+ */
70
+ static titleCase(input, stripInterfacePrefix = true) {
71
+ if (Is.stringValue(input)) {
72
+ let output = input;
73
+ if (stripInterfacePrefix && /^I[A-Z]/.test(output)) {
74
+ output = output.slice(1);
75
+ }
76
+ return StringHelper.words(output)
77
+ .map(w => `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}`)
78
+ .join(" ");
79
+ }
80
+ return "";
81
+ }
82
+ /**
83
+ * Pascal case all the words.
84
+ * @param input The input to convert.
85
+ * @param stripInterfacePrefix Strip interface prefixes.
86
+ * @returns The pascal case version of the input.
87
+ */
88
+ static pascalCase(input, stripInterfacePrefix = true) {
89
+ if (Is.stringValue(input)) {
90
+ let output = input;
91
+ if (stripInterfacePrefix && /^I[A-Z]/.test(output)) {
92
+ output = output.slice(1);
93
+ }
94
+ return StringHelper.words(output)
95
+ .map(w => `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}`)
96
+ .join("");
97
+ }
98
+ return "";
99
+ }
100
+ /**
101
+ * Camel case all the words.
102
+ * @param input The input to convert.
103
+ * @param stripInterfacePrefix Strip interface prefixes.
104
+ * @returns The camel case version of the input.
105
+ */
106
+ static camelCase(input, stripInterfacePrefix = true) {
107
+ if (Is.stringValue(input)) {
108
+ let output = input;
109
+ if (stripInterfacePrefix && /^I[A-Z]/.test(output)) {
110
+ output = output.slice(1);
111
+ }
112
+ const words = StringHelper.words(output);
113
+ return words.length === 0
114
+ ? ""
115
+ : `${words[0].toLowerCase()}${words
116
+ .slice(1)
117
+ .map(w => `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}`)
118
+ .join("")}`;
119
+ }
120
+ return "";
121
+ }
122
+ /**
123
+ * Convert the words to a path.
124
+ * @param input The input to convert.
125
+ * @param stripInterfacePrefix Strip interface prefixes.
126
+ * @returns The path version of the input.
127
+ */
128
+ static wordPath(input, stripInterfacePrefix = true) {
129
+ if (Is.stringValue(input)) {
130
+ let output = input;
131
+ if (stripInterfacePrefix && /^I[A-Z]/.test(output)) {
132
+ output = output.slice(1);
133
+ }
134
+ const words = StringHelper.words(output);
135
+ return words.join("/").toLowerCase();
136
+ }
137
+ return "";
138
+ }
139
+ /**
140
+ * Strip interface prefix if there is one.
141
+ * @param input The input to strip.
142
+ * @returns The input with any interface prefix stripped.
143
+ */
144
+ static stripPrefix(input) {
145
+ if (Is.stringValue(input)) {
146
+ let output = input;
147
+ if (/^I[A-Z]/.test(output)) {
148
+ output = output.slice(1);
149
+ }
150
+ return output;
151
+ }
152
+ return "";
153
+ }
154
+ /**
155
+ * Split a string into words.
156
+ * @param input The input to split.
157
+ * @returns The string split into words.
158
+ */
159
+ static words(input) {
160
+ if (!Is.stringValue(input)) {
161
+ return [];
162
+ }
163
+ return (input
164
+ .replace(/([A-Z])/g, " $1")
165
+ .trim()
166
+ .match(/[^\u0000-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007F]+/g) ?? []);
167
+ }
168
+ /**
169
+ * Check if a Node.js Buffer or Uint8Array is UTF-8.
170
+ * Url https://tools.ietf.org/html/rfc3629
171
+ * Source https://github.com/hcodes/isutf8
172
+ * UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4.
173
+ * UTF8-1 = %x00-7F.
174
+ * UTF8-2 = %xC2-DF UTF8-tail.
175
+ * UTF8-3 = %xE0 %xA0-BF UTF8-tail.
176
+ * - %xE1-EC 2( UTF8-tail ).
177
+ * - %xED %x80-9F UTF8-tail.
178
+ * - %xEE-EF 2( UTF8-tail ).
179
+ * UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ).
180
+ * - %xF1-F3 3( UTF8-tail ).
181
+ * - %xF4 %x80-8F 2( UTF8-tail ).
182
+ * UTF8-tail = %x80-BF.
183
+ * @param data The data to check.
184
+ * @returns True if the data is utf8.
185
+ */
186
+ static isUtf8(data) {
187
+ if (!Is.uint8Array(data)) {
188
+ return false;
189
+ }
190
+ let i = 0;
191
+ const len = data.length;
192
+ while (i < len) {
193
+ // UTF8-1 = %x00-7F
194
+ if (data[i] <= 0x7f) {
195
+ i++;
196
+ continue;
197
+ }
198
+ // UTF8-2 = %xC2-DF UTF8-tail
199
+ if (data[i] >= 0xc2 && data[i] <= 0xdf) {
200
+ // if(buf[i + 1] >= 0x80 && buf[i + 1] <= 0xBF) {
201
+ if (data[i + 1] >> 6 === 2) {
202
+ i += 2;
203
+ continue;
204
+ }
205
+ else {
206
+ return false;
207
+ }
208
+ }
209
+ // UTF8-3 = %xE0 %xA0-BF UTF8-tail
210
+ // UTF8-3 = %xED %x80-9F UTF8-tail
211
+ if (((data[i] === 0xe0 && data[i + 1] >= 0xa0 && data[i + 1] <= 0xbf) ||
212
+ (data[i] === 0xed && data[i + 1] >= 0x80 && data[i + 1] <= 0x9f)) &&
213
+ data[i + 2] >> 6 === 2) {
214
+ i += 3;
215
+ continue;
216
+ }
217
+ // UTF8-3 = %xE1-EC 2( UTF8-tail )
218
+ // UTF8-3 = %xEE-EF 2( UTF8-tail )
219
+ if (((data[i] >= 0xe1 && data[i] <= 0xec) || (data[i] >= 0xee && data[i] <= 0xef)) &&
220
+ data[i + 1] >> 6 === 2 &&
221
+ data[i + 2] >> 6 === 2) {
222
+ i += 3;
223
+ continue;
224
+ }
225
+ // UTF8-4 = %xF0 %x90-BF 2( UTF8-tail )
226
+ // %xF1-F3 3( UTF8-tail )
227
+ // %xF4 %x80-8F 2( UTF8-tail )
228
+ if (((data[i] === 0xf0 && data[i + 1] >= 0x90 && data[i + 1] <= 0xbf) ||
229
+ (data[i] >= 0xf1 && data[i] <= 0xf3 && data[i + 1] >> 6 === 2) ||
230
+ (data[i] === 0xf4 && data[i + 1] >= 0x80 && data[i + 1] <= 0x8f)) &&
231
+ data[i + 2] >> 6 === 2 &&
232
+ data[i + 3] >> 6 === 2) {
233
+ i += 4;
234
+ continue;
235
+ }
236
+ return false;
237
+ }
238
+ return true;
239
+ }
240
+ }
241
+ //# sourceMappingURL=stringHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringHelper.js","sourceRoot":"","sources":["../../../src/helpers/stringHelper.ts"],"names":[],"mappings":"AAAA,g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,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;gBAC9E,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;gBACtB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EACrB,CAAC;gBACF,CAAC,IAAI,CAAC,CAAC;gBAEP,SAAS;YACV,CAAC;YAED,uCAAuC;YACvC,kCAAkC;YAClC,uCAAuC;YACvC,IACC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;gBAChE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC9D,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;gBAClE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;gBACtB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EACrB,CAAC;gBACF,CAAC,IAAI,CAAC,CAAC;gBAEP,SAAS;YACV,CAAC;YAED,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/* eslint-disable no-continue */\n/* eslint-disable no-bitwise */\nimport { Is } from \"../utils/is.js\";\n\n/**\n * Class to help with string.\n */\nexport class StringHelper {\n\t/**\n\t * Implementation signature for trimTrailingSlashes.\n\t * @param value The value to trim.\n\t * @returns The trimmed string or the original.\n\t */\n\tpublic static trimTrailingSlashes(value: string): string {\n\t\tif (Is.string(value)) {\n\t\t\treturn value.replace(/\\/+$/, \"\");\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Implementation signature for trimLeadingSlashes.\n\t * @param value The value to trim.\n\t * @returns The trimmed string or the original.\n\t */\n\tpublic static trimLeadingSlashes(value: string): string {\n\t\tif (Is.string(value)) {\n\t\t\treturn value.replace(/^\\/+/, \"\");\n\t\t}\n\t\treturn value;\n\t}\n\n\t/**\n\t * Convert the input string to kebab case.\n\t * @param input The input to convert.\n\t * @param stripInterfacePrefix Strip interface prefixes.\n\t * @returns The kebab case version of the input.\n\t */\n\tpublic static kebabCase(input: string, stripInterfacePrefix: boolean = true): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (stripInterfacePrefix && /^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\treturn StringHelper.words(output).join(\"-\").toLowerCase();\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Convert the input string to snake case.\n\t * @param input The input to convert.\n\t * @param stripInterfacePrefix Strip interface prefixes.\n\t * @returns The snake case version of the input.\n\t */\n\tpublic static snakeCase(input: string, stripInterfacePrefix: boolean = true): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (stripInterfacePrefix && /^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\treturn StringHelper.words(output).join(\"_\").toLowerCase();\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Title case all the words.\n\t * @param input The input to convert.\n\t * @param stripInterfacePrefix Strip interface prefixes.\n\t * @returns The title case version of the input.\n\t */\n\tpublic static titleCase(input: string, stripInterfacePrefix: boolean = true): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (stripInterfacePrefix && /^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\treturn StringHelper.words(output)\n\t\t\t\t.map(w => `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}`)\n\t\t\t\t.join(\" \");\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Pascal case all the words.\n\t * @param input The input to convert.\n\t * @param stripInterfacePrefix Strip interface prefixes.\n\t * @returns The pascal case version of the input.\n\t */\n\tpublic static pascalCase(input: string, stripInterfacePrefix: boolean = true): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (stripInterfacePrefix && /^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\treturn StringHelper.words(output)\n\t\t\t\t.map(w => `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}`)\n\t\t\t\t.join(\"\");\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Camel case all the words.\n\t * @param input The input to convert.\n\t * @param stripInterfacePrefix Strip interface prefixes.\n\t * @returns The camel case version of the input.\n\t */\n\tpublic static camelCase(input: string, stripInterfacePrefix: boolean = true): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (stripInterfacePrefix && /^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\tconst words = StringHelper.words(output);\n\t\t\treturn words.length === 0\n\t\t\t\t? \"\"\n\t\t\t\t: `${words[0].toLowerCase()}${words\n\t\t\t\t\t\t.slice(1)\n\t\t\t\t\t\t.map(w => `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}`)\n\t\t\t\t\t\t.join(\"\")}`;\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Convert the words to a path.\n\t * @param input The input to convert.\n\t * @param stripInterfacePrefix Strip interface prefixes.\n\t * @returns The path version of the input.\n\t */\n\tpublic static wordPath(input: string, stripInterfacePrefix: boolean = true): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (stripInterfacePrefix && /^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\tconst words = StringHelper.words(output);\n\t\t\treturn words.join(\"/\").toLowerCase();\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Strip interface prefix if there is one.\n\t * @param input The input to strip.\n\t * @returns The input with any interface prefix stripped.\n\t */\n\tpublic static stripPrefix(input: string): string {\n\t\tif (Is.stringValue(input)) {\n\t\t\tlet output = input;\n\t\t\tif (/^I[A-Z]/.test(output)) {\n\t\t\t\toutput = output.slice(1);\n\t\t\t}\n\t\t\treturn output;\n\t\t}\n\t\treturn \"\";\n\t}\n\n\t/**\n\t * Split a string into words.\n\t * @param input The input to split.\n\t * @returns The string split into words.\n\t */\n\tpublic static words(input: string): string[] {\n\t\tif (!Is.stringValue(input)) {\n\t\t\treturn [];\n\t\t}\n\t\treturn (\n\t\t\tinput\n\t\t\t\t.replace(/([A-Z])/g, \" $1\")\n\t\t\t\t.trim()\n\t\t\t\t.match(/[^\\u0000-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007F]+/g) ?? []\n\t\t);\n\t}\n\n\t/**\n\t * Check if a Node.js Buffer or Uint8Array is UTF-8.\n\t * Url https://tools.ietf.org/html/rfc3629\n\t * Source https://github.com/hcodes/isutf8\n\t * UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4.\n\t * UTF8-1 = %x00-7F.\n\t * UTF8-2 = %xC2-DF UTF8-tail.\n\t * UTF8-3 = %xE0 %xA0-BF UTF8-tail.\n\t * - %xE1-EC 2( UTF8-tail ).\n\t * - %xED %x80-9F UTF8-tail.\n\t * - %xEE-EF 2( UTF8-tail ).\n\t * UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ).\n\t * - %xF1-F3 3( UTF8-tail ).\n\t * - %xF4 %x80-8F 2( UTF8-tail ).\n\t * UTF8-tail = %x80-BF.\n\t * @param data The data to check.\n\t * @returns True if the data is utf8.\n\t */\n\tpublic static isUtf8(data: Uint8Array): boolean {\n\t\tif (!Is.uint8Array(data)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet i = 0;\n\t\tconst len = data.length;\n\n\t\twhile (i < len) {\n\t\t\t// UTF8-1 = %x00-7F\n\t\t\tif (data[i] <= 0x7f) {\n\t\t\t\ti++;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// UTF8-2 = %xC2-DF UTF8-tail\n\t\t\tif (data[i] >= 0xc2 && data[i] <= 0xdf) {\n\t\t\t\t// if(buf[i + 1] >= 0x80 && buf[i + 1] <= 0xBF) {\n\t\t\t\tif (data[i + 1] >> 6 === 2) {\n\t\t\t\t\ti += 2;\n\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// UTF8-3 = %xE0 %xA0-BF UTF8-tail\n\t\t\t// UTF8-3 = %xED %x80-9F UTF8-tail\n\t\t\tif (\n\t\t\t\t((data[i] === 0xe0 && data[i + 1] >= 0xa0 && data[i + 1] <= 0xbf) ||\n\t\t\t\t\t(data[i] === 0xed && data[i + 1] >= 0x80 && data[i + 1] <= 0x9f)) &&\n\t\t\t\tdata[i + 2] >> 6 === 2\n\t\t\t) {\n\t\t\t\ti += 3;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// UTF8-3 = %xE1-EC 2( UTF8-tail )\n\t\t\t// UTF8-3 = %xEE-EF 2( UTF8-tail )\n\t\t\tif (\n\t\t\t\t((data[i] >= 0xe1 && data[i] <= 0xec) || (data[i] >= 0xee && data[i] <= 0xef)) &&\n\t\t\t\tdata[i + 1] >> 6 === 2 &&\n\t\t\t\tdata[i + 2] >> 6 === 2\n\t\t\t) {\n\t\t\t\ti += 3;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// UTF8-4 = %xF0 %x90-BF 2( UTF8-tail )\n\t\t\t// %xF1-F3 3( UTF8-tail )\n\t\t\t// %xF4 %x80-8F 2( UTF8-tail )\n\t\t\tif (\n\t\t\t\t((data[i] === 0xf0 && data[i + 1] >= 0x90 && data[i + 1] <= 0xbf) ||\n\t\t\t\t\t(data[i] >= 0xf1 && data[i] <= 0xf3 && data[i + 1] >> 6 === 2) ||\n\t\t\t\t\t(data[i] === 0xf4 && data[i + 1] >= 0x80 && data[i + 1] <= 0x8f)) &&\n\t\t\t\tdata[i + 2] >> 6 === 2 &&\n\t\t\t\tdata[i + 3] >> 6 === 2\n\t\t\t) {\n\t\t\t\ti += 4;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"]}
@@ -0,0 +1,26 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * Class to help with uint8 arrays.
5
+ */
6
+ export class Uint8ArrayHelper {
7
+ /**
8
+ * Concatenate multiple arrays.
9
+ * @param arrays The array to concatenate.
10
+ * @returns The combined array.
11
+ */
12
+ static concat(arrays) {
13
+ let totalLength = 0;
14
+ for (const array of arrays) {
15
+ totalLength += array.length;
16
+ }
17
+ const concatBytes = new Uint8Array(totalLength);
18
+ let offset = 0;
19
+ for (const array of arrays) {
20
+ concatBytes.set(array, offset);
21
+ offset += array.length;
22
+ }
23
+ return concatBytes;
24
+ }
25
+ }
26
+ //# sourceMappingURL=uint8ArrayHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uint8ArrayHelper.js","sourceRoot":"","sources":["../../../src/helpers/uint8ArrayHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC5B;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,MAAoB;QACxC,IAAI,WAAW,GAAG,CAAC,CAAC;QAEpB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC;QAC7B,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;QAEhD,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACpB,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Class to help with uint8 arrays.\n */\nexport class Uint8ArrayHelper {\n\t/**\n\t * Concatenate multiple arrays.\n\t * @param arrays The array to concatenate.\n\t * @returns The combined array.\n\t */\n\tpublic static concat(arrays: Uint8Array[]): Uint8Array {\n\t\tlet totalLength = 0;\n\n\t\tfor (const array of arrays) {\n\t\t\ttotalLength += array.length;\n\t\t}\n\n\t\tconst concatBytes = new Uint8Array(totalLength);\n\n\t\tlet offset = 0;\n\t\tfor (const array of arrays) {\n\t\t\tconcatBytes.set(array, offset);\n\t\t\toffset += array.length;\n\t\t}\n\n\t\treturn concatBytes;\n\t}\n}\n"]}
@@ -0,0 +1,57 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./encoding/base32.js";
4
+ export * from "./encoding/base58.js";
5
+ export * from "./encoding/base64.js";
6
+ export * from "./encoding/base64Url.js";
7
+ export * from "./errors/alreadyExistsError.js";
8
+ export * from "./errors/baseError.js";
9
+ export * from "./errors/conflictError.js";
10
+ export * from "./errors/generalError.js";
11
+ export * from "./errors/guardError.js";
12
+ export * from "./errors/notFoundError.js";
13
+ export * from "./errors/notImplementedError.js";
14
+ export * from "./errors/notSupportedError.js";
15
+ export * from "./errors/unauthorizedError.js";
16
+ export * from "./errors/unprocessableError.js";
17
+ export * from "./errors/validationError.js";
18
+ export * from "./factories/componentFactory.js";
19
+ export * from "./factories/factory.js";
20
+ export * from "./helpers/arrayHelper.js";
21
+ export * from "./helpers/envHelper.js";
22
+ export * from "./helpers/errorHelper.js";
23
+ export * from "./helpers/filenameHelper.js";
24
+ export * from "./helpers/hexHelper.js";
25
+ export * from "./helpers/jsonHelper.js";
26
+ export * from "./helpers/numberHelper.js";
27
+ export * from "./helpers/objectHelper.js";
28
+ export * from "./helpers/randomHelper.js";
29
+ export * from "./helpers/stringHelper.js";
30
+ export * from "./helpers/uint8ArrayHelper.js";
31
+ export * from "./models/coerceType.js";
32
+ export * from "./models/compressionType.js";
33
+ export * from "./models/IComponent.js";
34
+ export * from "./models/IError.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 "./models/objectOrArray.js";
45
+ export * from "./types/bitString.js";
46
+ export * from "./types/url.js";
47
+ export * from "./types/urn.js";
48
+ export * from "./utils/asyncCache.js";
49
+ export * from "./utils/coerce.js";
50
+ export * from "./utils/compression.js";
51
+ export * from "./utils/converter.js";
52
+ export * from "./utils/guards.js";
53
+ export * from "./utils/i18n.js";
54
+ export * from "./utils/is.js";
55
+ export * from "./utils/sharedStore.js";
56
+ export * from "./utils/validation.js";
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAA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C;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./encoding/base32.js\";\nexport * from \"./encoding/base58.js\";\nexport * from \"./encoding/base64.js\";\nexport * from \"./encoding/base64Url.js\";\nexport * from \"./errors/alreadyExistsError.js\";\nexport * from \"./errors/baseError.js\";\nexport * from \"./errors/conflictError.js\";\nexport * from \"./errors/generalError.js\";\nexport * from \"./errors/guardError.js\";\nexport * from \"./errors/notFoundError.js\";\nexport * from \"./errors/notImplementedError.js\";\nexport * from \"./errors/notSupportedError.js\";\nexport * from \"./errors/unauthorizedError.js\";\nexport * from \"./errors/unprocessableError.js\";\nexport * from \"./errors/validationError.js\";\nexport * from \"./factories/componentFactory.js\";\nexport * from \"./factories/factory.js\";\nexport * from \"./helpers/arrayHelper.js\";\nexport * from \"./helpers/envHelper.js\";\nexport * from \"./helpers/errorHelper.js\";\nexport * from \"./helpers/filenameHelper.js\";\nexport * from \"./helpers/hexHelper.js\";\nexport * from \"./helpers/jsonHelper.js\";\nexport * from \"./helpers/numberHelper.js\";\nexport * from \"./helpers/objectHelper.js\";\nexport * from \"./helpers/randomHelper.js\";\nexport * from \"./helpers/stringHelper.js\";\nexport * from \"./helpers/uint8ArrayHelper.js\";\nexport * from \"./models/coerceType.js\";\nexport * from \"./models/compressionType.js\";\nexport * from \"./models/IComponent.js\";\nexport * from \"./models/IError.js\";\nexport * from \"./models/II18nShared.js\";\nexport * from \"./models/IKeyValue.js\";\nexport * from \"./models/ILabelledValue.js\";\nexport * from \"./models/ILocale.js\";\nexport * from \"./models/ILocaleDictionary.js\";\nexport * from \"./models/ILocalesIndex.js\";\nexport * from \"./models/IPatchOperation.js\";\nexport * from \"./models/IUrlParts.js\";\nexport * from \"./models/IValidationFailure.js\";\nexport * from \"./models/objectOrArray.js\";\nexport * from \"./types/bitString.js\";\nexport * from \"./types/url.js\";\nexport * from \"./types/urn.js\";\nexport * from \"./utils/asyncCache.js\";\nexport * from \"./utils/coerce.js\";\nexport * from \"./utils/compression.js\";\nexport * from \"./utils/converter.js\";\nexport * from \"./utils/guards.js\";\nexport * from \"./utils/i18n.js\";\nexport * from \"./utils/is.js\";\nexport * from \"./utils/sharedStore.js\";\nexport * from \"./utils/validation.js\";\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IComponent.js","sourceRoot":"","sources":["../../../src/models/IComponent.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing a component which can be bootstrapped, started and stopped.\n */\nexport interface IComponent {\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tclassName(): string;\n\n\t/**\n\t * Bootstrap the component by creating and initializing any resources it needs.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns True if the bootstrapping process was successful.\n\t */\n\tbootstrap?(nodeLoggingComponentType?: string): Promise<boolean>;\n\n\t/**\n\t * The component needs to be started when the node is initialized.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns Nothing.\n\t */\n\tstart?(nodeLoggingComponentType?: string): Promise<void>;\n\n\t/**\n\t * The component needs to be stopped when the node is closed.\n\t * @param nodeLoggingComponentType The node logging component type.\n\t * @returns Nothing.\n\t */\n\tstop?(nodeLoggingComponentType?: string): Promise<void>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IError.js","sourceRoot":"","sources":["../../../src/models/IError.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model to describe serialized error.\n */\nexport interface IError {\n\t/**\n\t * The name for the error.\n\t */\n\tname: string;\n\n\t/**\n\t * The message for the error.\n\t */\n\tmessage: string;\n\n\t/**\n\t * The source of the error.\n\t */\n\tsource?: string;\n\n\t/**\n\t * Any additional information for the error.\n\t */\n\tproperties?: { [id: string]: unknown };\n\n\t/**\n\t * The stack trace for the error.\n\t */\n\tstack?: string;\n\n\t/**\n\t * The cause of the error if there was one.\n\t */\n\tcause?: IError;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=II18nShared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"II18nShared.js","sourceRoot":"","sources":["../../../src/models/II18nShared.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * The shared state for the I18n global.\n */\nexport interface II18nShared {\n\t/**\n\t * Dictionaries for lookups.\n\t */\n\tlocaleDictionaries: {\n\t\t[locale: string]: { [key: string]: string };\n\t};\n\n\t/**\n\t * The current locale.\n\t */\n\tcurrentLocale: string;\n\n\t/**\n\t * Change handler for the locale being updated.\n\t */\n\tlocaleChangedHandlers: {\n\t\t[id: string]: (locale: string) => void;\n\t};\n\n\t/**\n\t * Change handler for the dictionaries being updated.\n\t */\n\tdictionaryChangedHandlers: {\n\t\t[id: string]: (locale: string) => void;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IKeyValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IKeyValue.js","sourceRoot":"","sources":["../../../src/models/IKeyValue.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * Interface describing a key/value pair.\n */\nexport interface IKeyValue<T> {\n\t/**\n\t * The key for the item.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value for the item.\n\t */\n\tvalue: T;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ILabelledValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILabelledValue.js","sourceRoot":"","sources":["../../../src/models/ILabelledValue.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * Interface describing a label/value pair.\n */\nexport interface ILabelledValue<T> {\n\t/**\n\t * The label for the item.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The value for the item.\n\t */\n\tvalue: T;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ILocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILocale.js","sourceRoot":"","sources":["../../../src/models/ILocale.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * Model for a local.\n */\nexport interface ILocale {\n\t/**\n\t * The label.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The code.\n\t */\n\tcode: string;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=ILocaleDictionary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILocaleDictionary.js","sourceRoot":"","sources":["../../../src/models/ILocaleDictionary.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Type for the JSON locale dictionary files.\n */\nexport interface ILocaleDictionary {\n\t[key: string]: string | ILocaleDictionary;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ILocalesIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILocalesIndex.js","sourceRoot":"","sources":["../../../src/models/ILocalesIndex.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ILocale } from \"./ILocale.js\";\n\n/**\n * Model for a locales index.\n */\nexport interface ILocalesIndex {\n\t/**\n\t * The list of locales.\n\t */\n\tlocales: ILocale[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IPatchOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPatchOperation.js","sourceRoot":"","sources":["../../../src/models/IPatchOperation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing a patch operation to add a property.\n */\nexport interface IPatchOperation {\n\t/**\n\t * The operation that was performed on the item.\n\t */\n\top: \"add\" | \"remove\" | \"replace\" | \"move\" | \"copy\" | \"test\";\n\n\t/**\n\t * The path to the object that was changed.\n\t */\n\tpath: string;\n\n\t/**\n\t * The path the value was copied or moved from.\n\t */\n\tfrom?: string;\n\n\t/**\n\t * The value to add.\n\t */\n\tvalue?: unknown;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IUrlParts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IUrlParts.js","sourceRoot":"","sources":["../../../src/models/IUrlParts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model to describe the parts of a url.\n */\nexport interface IUrlParts {\n\t/**\n\t * The schema for the url.\n\t */\n\tschema: string;\n\n\t/**\n\t * The host for the url.\n\t */\n\thost: string;\n\n\t/**\n\t * The port for the url.\n\t */\n\tport?: number;\n\n\t/**\n\t * The path for the url.\n\t */\n\tpath: string;\n\n\t/**\n\t * The params for the url.\n\t */\n\tparams?: string;\n\n\t/**\n\t * The hash for the url.\n\t */\n\thash?: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IValidationFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IValidationFailure.js","sourceRoot":"","sources":["../../../src/models/IValidationFailure.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * Interface describing the reason a validation failed.\n */\nexport interface IValidationFailure {\n\t/**\n\t * The property that failed validation.\n\t */\n\tproperty: string;\n\n\t/**\n\t * The reason the validation failed as an i18 resource error.\n\t */\n\treason: string;\n\n\t/**\n\t * Additional properties for the validation failure.\n\t */\n\tproperties?: { [id: string]: unknown };\n}\n"]}
@@ -0,0 +1,49 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * The types the extracted data can be coerced to.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const CoerceType = {
8
+ /**
9
+ * String.
10
+ */
11
+ String: "string",
12
+ /**
13
+ * Number.
14
+ */
15
+ Number: "number",
16
+ /**
17
+ * Integer.
18
+ */
19
+ Integer: "integer",
20
+ /**
21
+ * Boolean.
22
+ */
23
+ Boolean: "boolean",
24
+ /**
25
+ * Big Integer.
26
+ */
27
+ BigInt: "bigint",
28
+ /**
29
+ * Date.
30
+ */
31
+ Date: "date",
32
+ /**
33
+ * Date Time.
34
+ */
35
+ DateTime: "datetime",
36
+ /**
37
+ * Time.
38
+ */
39
+ Time: "time",
40
+ /**
41
+ * Object.
42
+ */
43
+ Object: "object",
44
+ /**
45
+ * Uint8Array.
46
+ */
47
+ Uint8Array: "uint8array"
48
+ };
49
+ //# sourceMappingURL=coerceType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerceType.js","sourceRoot":"","sources":["../../../src/models/coerceType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,UAAU,EAAE,YAAY;CACf,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types the extracted data can be coerced to.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const CoerceType = {\n\t/**\n\t * String.\n\t */\n\tString: \"string\",\n\n\t/**\n\t * Number.\n\t */\n\tNumber: \"number\",\n\n\t/**\n\t * Integer.\n\t */\n\tInteger: \"integer\",\n\n\t/**\n\t * Boolean.\n\t */\n\tBoolean: \"boolean\",\n\n\t/**\n\t * Big Integer.\n\t */\n\tBigInt: \"bigint\",\n\n\t/**\n\t * Date.\n\t */\n\tDate: \"date\",\n\n\t/**\n\t * Date Time.\n\t */\n\tDateTime: \"datetime\",\n\n\t/**\n\t * Time.\n\t */\n\tTime: \"time\",\n\n\t/**\n\t * Object.\n\t */\n\tObject: \"object\",\n\n\t/**\n\t * Uint8Array.\n\t */\n\tUint8Array: \"uint8array\"\n} as const;\n\n/**\n * The types the extracted data can be coerced to.\n */\nexport type CoerceType = (typeof CoerceType)[keyof typeof CoerceType];\n"]}
@@ -0,0 +1,17 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * Compression types.
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/naming-convention
7
+ export const CompressionType = {
8
+ /**
9
+ * Gzip.
10
+ */
11
+ Gzip: "gzip",
12
+ /**
13
+ * Deflate.
14
+ */
15
+ Deflate: "deflate"
16
+ };
17
+ //# sourceMappingURL=compressionType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compressionType.js","sourceRoot":"","sources":["../../../src/models/compressionType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,OAAO,EAAE,SAAS;CACT,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Compression types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const CompressionType = {\n\t/**\n\t * Gzip.\n\t */\n\tGzip: \"gzip\",\n\n\t/**\n\t * Deflate.\n\t */\n\tDeflate: \"deflate\"\n} as const;\n\n/**\n * Compression types.\n */\nexport type CompressionType = (typeof CompressionType)[keyof typeof CompressionType];\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=objectOrArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectOrArray.js","sourceRoot":"","sources":["../../../src/models/objectOrArray.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n/**\n * Object or array data type\n */\nexport type ObjectOrArray<T = unknown> = T | T[];\n"]}