@diia-inhouse/utils 6.1.30 → 6.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/address.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- //#region src/address.d.ts
2
- declare class AddressUtils {
1
+ export declare class AddressUtils {
3
2
  private readonly regionAtuIdByCode;
4
3
  getRegionAtuIdByKatottgCode(katottgCode: string): number | null;
5
- }
6
- //#endregion
7
- export { AddressUtils };
4
+ }
package/dist/address.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/address.ts
1
+ // src/address.ts
2
2
  var AddressUtils = class {
3
3
  regionAtuIdByCode = {
4
4
  "01": 1,
@@ -34,5 +34,4 @@ var AddressUtils = class {
34
34
  return this.regionAtuIdByCode[code] ?? null;
35
35
  }
36
36
  };
37
- //#endregion
38
37
  export { AddressUtils };
@@ -1,9 +1,7 @@
1
1
  import { ToRelativeUnit } from "luxon";
2
2
  import { ApiError } from "@diia-inhouse/errors";
3
3
  import { ActHeaders, ActionSession, ActionVersion, AppVersions, Gender, HashedFile, HashedFileWithSignature, PlatformType, SignedItem, TokenData, UserTokenData, WithAppVersions } from "@diia-inhouse/types";
4
-
5
- //#region src/applicationUtils.d.ts
6
- declare class ApplicationUtils {
4
+ export declare class ApplicationUtils {
7
5
  private static documentTypeToCamelCaseExceptions;
8
6
  private static camelCaseToDocumentTypeExceptions;
9
7
  private static defaultItnDate;
@@ -22,18 +20,18 @@ declare class ApplicationUtils {
22
20
  static mapCyrillic(value: string): string;
23
21
  static mapLatin(value: string): string;
24
22
  /**
25
- * Validates the Ukrainian IBAN number by format and checksum.
26
- */
23
+ * Validates the Ukrainian IBAN number by format and checksum.
24
+ */
27
25
  static isIbanNumberValid(iban: string): boolean;
28
26
  /**
29
- * Extracts the bank code (МФО) from Ukrainian IBAN (4-10 digits). Does not validate the IBAN.
30
- *
31
- * @link https://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country
32
- * @example
33
- * ```typescript
34
- * const bankCode = extractBankCodeFromIban('UA833052991234567890123456789') // '305299'
35
- * ```
36
- */
27
+ * Extracts the bank code (МФО) from Ukrainian IBAN (4-10 digits). Does not validate the IBAN.
28
+ *
29
+ * @link https://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country
30
+ * @example
31
+ * ```typescript
32
+ * const bankCode = extractBankCodeFromIban('UA833052991234567890123456789') // '305299'
33
+ * ```
34
+ */
37
35
  static extractBankCodeFromIban(iban: string): string;
38
36
  static getStreetName(street: string, streetType: string): string;
39
37
  static toHashedFilesWithSignatures(hashedFiles: HashedFile[], signedItems: SignedItem[]): [HashedFileWithSignature[], string[]];
@@ -42,17 +40,17 @@ declare class ApplicationUtils {
42
40
  static getActionNameWithVersion(actionName: string, actionVersion?: ActionVersion): string;
43
41
  static getGreeting(fName: string, skipEmogi?: boolean): string;
44
42
  /**
45
- * Get age from birth date. Powered by {@link https://moment.github.io/luxon/#/ luxon}
46
- *
47
- * @param birthDay Input birth date.
48
- * @param params Additional parameters. Default: `{ format: 'dd.MM.yyyy', unitOfTime: 'years' }`
49
- * @param params.format Input date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'dd.MM.yyyy'
50
- * @param params.unitOfTime Unit of time to get the difference in. Default - 'years'
51
- * @param params.relativeTo Date to compare the input date to. Default - current date
52
- *
53
- * @returns Age in years if other `unitOfTime` is not specified
54
- * @throws If input date is invalid
55
- */
43
+ * Get age from birth date. Powered by {@link https://moment.github.io/luxon/#/ luxon}
44
+ *
45
+ * @param birthDay Input birth date.
46
+ * @param params Additional parameters. Default: `{ format: 'dd.MM.yyyy', unitOfTime: 'years' }`
47
+ * @param params.format Input date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'dd.MM.yyyy'
48
+ * @param params.unitOfTime Unit of time to get the difference in. Default - 'years'
49
+ * @param params.relativeTo Date to compare the input date to. Default - current date
50
+ *
51
+ * @returns Age in years if other `unitOfTime` is not specified
52
+ * @throws If input date is invalid
53
+ */
56
54
  static getAge(birthDay: string, params?: {
57
55
  format?: string;
58
56
  unitOfTime?: ToRelativeUnit;
@@ -61,22 +59,12 @@ declare class ApplicationUtils {
61
59
  static getFullName(lastName: string, firstName: string, middleName?: string, separator?: string): string;
62
60
  static getShortName(lastName: string, firstName: string, middleName?: string): string;
63
61
  static getUserFullName(user: UserTokenData): string;
64
- static getPassportFullName({
65
- lastNameUA,
66
- firstNameUA,
67
- middleNameUA
68
- }: {
62
+ static getPassportFullName({ lastNameUA, firstNameUA, middleNameUA }: {
69
63
  lastNameUA: string;
70
64
  firstNameUA: string;
71
65
  middleNameUA?: string;
72
66
  }): string;
73
- static getChildFullName({
74
- child: {
75
- lastName,
76
- firstName,
77
- middleName
78
- }
79
- }: {
67
+ static getChildFullName({ child: { lastName, firstName, middleName } }: {
80
68
  child: {
81
69
  lastName: string;
82
70
  firstName: string;
@@ -86,32 +74,32 @@ declare class ApplicationUtils {
86
74
  static encodeObjectToBase64<T>(object: T): string;
87
75
  static decodeObjectFromBase64<T>(encodedObject: string): T;
88
76
  /**
89
- * Format string or Date to the specified string format. Powered by {@link https://moment.github.io/luxon/#/ luxon}
90
- *
91
- * @param date Input date
92
- * @param format Output date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens)
93
- * @param fromFormat Input date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Used for string `date`. Default - 'dd.MM.yyyy'
94
- *
95
- * @throws If input date is invalid
96
- */
77
+ * Format string or Date to the specified string format. Powered by {@link https://moment.github.io/luxon/#/ luxon}
78
+ *
79
+ * @param date Input date
80
+ * @param format Output date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens)
81
+ * @param fromFormat Input date format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Used for string `date`. Default - 'dd.MM.yyyy'
82
+ *
83
+ * @throws If input date is invalid
84
+ */
97
85
  static formatDate(date: string | Date, format: string, fromFormat?: string): string;
98
86
  /**
99
- * Check if the input date is valid. Powered by {@link https://moment.github.io/luxon/#/ luxon}
100
- *
101
- * @param date Input date.
102
- * @param format `date` format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'yyyy-MM-dd'
103
- *
104
- * @throws If input date is invalid
105
- */
87
+ * Check if the input date is valid. Powered by {@link https://moment.github.io/luxon/#/ luxon}
88
+ *
89
+ * @param date Input date.
90
+ * @param format `date` format (https://moment.github.io/luxon/#/formatting?id=table-of-tokens). Default - 'yyyy-MM-dd'
91
+ *
92
+ * @throws If input date is invalid
93
+ */
106
94
  static validateDate(date: string, format?: string): void | never;
107
95
  static formatPhoneNumber(rawPhone: string, separator?: string, prefix?: string): string;
108
96
  /**
109
- * Format number as: "XX XXX,XX {units}".
110
- *
111
- * @param amount Input number
112
- * @param units Unit to be append at the end of the formatted number
113
- * @param minimumFractionDigits Minimum number of fraction digits
114
- */
97
+ * Format number as: "XX XXX,XX {units}".
98
+ *
99
+ * @param amount Input number
100
+ * @param units Unit to be append at the end of the formatted number
101
+ * @param minimumFractionDigits Minimum number of fraction digits
102
+ */
115
103
  static formatAmountWithThousandsSeparator(amount: number, units?: string, minimumFractionDigits?: number): string;
116
104
  static convertToPennies(amount: number): number;
117
105
  static convertFromPennies(amount: number): number;
@@ -122,104 +110,102 @@ declare class ApplicationUtils {
122
110
  static getFileName(name: string, id: string, requestDateTime?: string, postFix?: string): string;
123
111
  static sanitizeString(input: string): string;
124
112
  /**
125
- * Returns the appropriate plural form of a string based on the specified numeric value and locale.
126
- * Uses the pluralization rules for the provided locale to determine the correct form among the options.
127
- *
128
- * @param value - The number used to determine the plural form.
129
- * @param one - The form for singular (e.g., "one item").
130
- * @param few - The form for a few items (e.g., "few items").
131
- * @param many - The form for many items (e.g., "many items").
132
- * @param other - Optional. The fallback form if none of the specific plural rules match.
133
- * Defaults to the 'many' form if not provided.
134
- * @param locale - The locale used for pluralization rules. Defaults to 'uk' (Ukrainian).
135
- * @returns The appropriate pluralized string based on the value.
136
- *
137
- * @example
138
- * getPluralForm(1, 'яблуко', 'яблука', 'яблук'); // 'яблуко'
139
- * getPluralForm(2, 'яблуко', 'яблука', 'яблук'); // 'яблука'
140
- * getPluralForm(0, 'яблуко', 'яблука', 'яблук', 'плоди'); // 'плоди'
141
- * getPluralForm(0, 'яблуко', 'яблука', 'яблук'); // 'яблук' (uses 'many' as default fallback)
142
- */
113
+ * Returns the appropriate plural form of a string based on the specified numeric value and locale.
114
+ * Uses the pluralization rules for the provided locale to determine the correct form among the options.
115
+ *
116
+ * @param value - The number used to determine the plural form.
117
+ * @param one - The form for singular (e.g., "one item").
118
+ * @param few - The form for a few items (e.g., "few items").
119
+ * @param many - The form for many items (e.g., "many items").
120
+ * @param other - Optional. The fallback form if none of the specific plural rules match.
121
+ * Defaults to the 'many' form if not provided.
122
+ * @param locale - The locale used for pluralization rules. Defaults to 'uk' (Ukrainian).
123
+ * @returns The appropriate pluralized string based on the value.
124
+ *
125
+ * @example
126
+ * getPluralForm(1, 'яблуко', 'яблука', 'яблук'); // 'яблуко'
127
+ * getPluralForm(2, 'яблуко', 'яблука', 'яблук'); // 'яблука'
128
+ * getPluralForm(0, 'яблуко', 'яблука', 'яблук', 'плоди'); // 'плоди'
129
+ * getPluralForm(0, 'яблуко', 'яблука', 'яблук'); // 'яблук' (uses 'many' as default fallback)
130
+ */
143
131
  static pluralizeString(value: number, one: string, few: string, many: string, other?: string, locale?: string): string;
144
132
  /**
145
- * Returns the name of a service from a package.json in the current working directory (process.cwd()) converted to PascalCase.
146
- * If the name is scoped, it will be returned without the scope.
147
- * If the name is not found, an empty string is returned. Also, all whitespace characters are removed.
148
- *
149
- * @returns The name of the service in PascalCase.
150
- *
151
- * @example
152
- * getServiceName() // 'my-service' -> 'MyService'
153
- * getServiceName() // '@scope/my-service' -> 'MyService'
154
- */
133
+ * Returns the name of a service from a package.json in the current working directory (process.cwd()) converted to PascalCase.
134
+ * If the name is scoped, it will be returned without the scope.
135
+ * If the name is not found, an empty string is returned. Also, all whitespace characters are removed.
136
+ *
137
+ * @returns The name of the service in PascalCase.
138
+ *
139
+ * @example
140
+ * getServiceName() // 'my-service' -> 'MyService'
141
+ * getServiceName() // '@scope/my-service' -> 'MyService'
142
+ */
155
143
  static getServiceName(): string;
156
144
  /**
157
- * Returns the version of a service from a package.json in the current working directory (process.cwd()).
158
- * If the version is not found, an empty string is returned.
159
- *
160
- * @returns The version of the service.
161
- *
162
- * @example
163
- * getServiceVersion() // '1.143.0-rc.2'
164
- */
145
+ * Returns the version of a service from a package.json in the current working directory (process.cwd()).
146
+ * If the version is not found, an empty string is returned.
147
+ *
148
+ * @returns The version of the service.
149
+ *
150
+ * @example
151
+ * getServiceVersion() // '1.143.0-rc.2'
152
+ */
165
153
  static getServiceVersion(): string;
166
154
  /**
167
- * Format string according to mask pattern
168
- *
169
- * Basic Examples:
170
- * '12345' with '##-###' -> '12-345'
171
- * 'AB345' with '##-###' -> 'AB-345'
172
- * '123456' with '##.####' -> '12.3456'
173
- * '12345' with '### ##' -> '123 45'
174
- * 'ABCDEF' with '##-##-##' -> 'AB-CD-EF'
175
- */
155
+ * Format string according to mask pattern
156
+ *
157
+ * Basic Examples:
158
+ * '12345' with '##-###' -> '12-345'
159
+ * 'AB345' with '##-###' -> 'AB-345'
160
+ * '123456' with '##.####' -> '12.3456'
161
+ * '12345' with '### ##' -> '123 45'
162
+ * 'ABCDEF' with '##-##-##' -> 'AB-CD-EF'
163
+ */
176
164
  static formatMask(rawData: string, mask: string): string;
177
165
  /**
178
- * Memoize a function.
179
- * The function is memoized by the arguments (`JSON.stringify(args)`) and the result is cached for the specified time to live in milliseconds.
180
- * If the function is called with the same arguments again, the cached result is returned.
181
- * If the function is called with the same arguments again after the time to live has expired, the function is called again and the result is cached again.
182
- *
183
- * @param fn - The function to memoize.
184
- * @param ttl - The time to live for the cached value in milliseconds.
185
- * @returns The memoized function.
186
- */
166
+ * Memoize a function.
167
+ * The function is memoized by the arguments (`JSON.stringify(args)`) and the result is cached for the specified time to live in milliseconds.
168
+ * If the function is called with the same arguments again, the cached result is returned.
169
+ * If the function is called with the same arguments again after the time to live has expired, the function is called again and the result is cached again.
170
+ *
171
+ * @param fn - The function to memoize.
172
+ * @param ttl - The time to live for the cached value in milliseconds.
173
+ * @returns The memoized function.
174
+ */
187
175
  static memoize<T extends (...args: Parameters<T>) => ReturnType<T>>(fn: T, ttl?: number): T;
188
176
  /**
189
- * Recursively encodes all string values in an object or string using encodeURIComponent.
190
- * For objects, it creates a deep clone and processes all string values.
191
- * For strings, it directly applies the encoding.
192
- *
193
- * @param data Input data to encode - can be an object or string
194
- * @returns Deep cloned object with encoded string values, or encoded string if input was string
195
- * @example
196
- * ```typescript
197
- * const data = { name: 'John Doe', email: 'john@example.com' }
198
- * const encoded = ApplicationUtils.encodeValuesWithIterator(data)
199
- * // Result: { name: 'John%20Doe', email: 'john%40example.com' }
200
- * ```
201
- */
177
+ * Recursively encodes all string values in an object or string using encodeURIComponent.
178
+ * For objects, it creates a deep clone and processes all string values.
179
+ * For strings, it directly applies the encoding.
180
+ *
181
+ * @param data Input data to encode - can be an object or string
182
+ * @returns Deep cloned object with encoded string values, or encoded string if input was string
183
+ * @example
184
+ * ```typescript
185
+ * const data = { name: 'John Doe', email: 'john@example.com' }
186
+ * const encoded = ApplicationUtils.encodeValuesWithIterator(data)
187
+ * // Result: { name: 'John%20Doe', email: 'john%40example.com' }
188
+ * ```
189
+ */
202
190
  static encodeValuesWithIterator(data: object | string): object | string;
203
191
  /**
204
- * Recursively decodes all string values in an object or string using decodeURIComponent.
205
- * For objects, it creates a deep clone and processes all string values.
206
- * For strings, it directly applies the decoding.
207
- *
208
- * @param data Input data to decode - can be an object or string
209
- * @returns Deep cloned object with decoded string values, or decoded string if input was string
210
- * @example
211
- * ```typescript
212
- * const data = { name: 'John%20Doe', email: 'john%40example.com' }
213
- * const decoded = ApplicationUtils.decodeValuesWithIterator(data)
214
- * // Result: { name: 'John Doe', email: 'john@example.com' }
215
- * ```
216
- */
192
+ * Recursively decodes all string values in an object or string using decodeURIComponent.
193
+ * For objects, it creates a deep clone and processes all string values.
194
+ * For strings, it directly applies the decoding.
195
+ *
196
+ * @param data Input data to decode - can be an object or string
197
+ * @returns Deep cloned object with decoded string values, or decoded string if input was string
198
+ * @example
199
+ * ```typescript
200
+ * const data = { name: 'John%20Doe', email: 'john%40example.com' }
201
+ * const decoded = ApplicationUtils.decodeValuesWithIterator(data)
202
+ * // Result: { name: 'John Doe', email: 'john@example.com' }
203
+ * ```
204
+ */
217
205
  static decodeValuesWithIterator(data: object | string): object | string;
218
206
  private static mod97;
219
207
  private static toApiError;
220
208
  private static getPackageJson;
221
209
  private static processObject;
222
210
  private static processValues;
223
- }
224
- //#endregion
225
- export { ApplicationUtils };
211
+ }
@@ -6,7 +6,7 @@ import { DateTime } from "luxon";
6
6
  import mapAgeCleaner from "map-age-cleaner";
7
7
  import { ApiError, BadRequestError } from "@diia-inhouse/errors";
8
8
  import { ActionVersion, Gender, HttpStatusCode, SessionType } from "@diia-inhouse/types";
9
- //#region src/applicationUtils.ts
9
+ // src/applicationUtils.ts
10
10
  const { camelCase, cloneDeep, kebabCase, startCase } = lodash;
11
11
  var ApplicationUtils = class ApplicationUtils {
12
12
  static documentTypeToCamelCaseExceptions = {
@@ -19,7 +19,7 @@ var ApplicationUtils = class ApplicationUtils {
19
19
  };
20
20
  static defaultItnDate = "31.12.1899";
21
21
  static defaultFormat = "dd.MM.yyyy";
22
- static cyrillicToLatin = new Map([
22
+ static cyrillicToLatin = /* @__PURE__ */ new Map([
23
23
  ["і", "i"],
24
24
  ["е", "e"],
25
25
  ["у", "y"],
@@ -574,5 +574,4 @@ var ApplicationUtils = class ApplicationUtils {
574
574
  return this.processObject(clonedData, processor);
575
575
  }
576
576
  };
577
- //#endregion
578
577
  export { ApplicationUtils };
package/dist/asserts.d.ts CHANGED
@@ -1,6 +1,2 @@
1
1
  import { AssertsContainer } from "./interfaces/asserts.js";
2
-
3
- //#region src/asserts.d.ts
4
- declare const Asserts: AssertsContainer;
5
- //#endregion
6
- export { Asserts };
2
+ export declare const Asserts: AssertsContainer;
package/dist/asserts.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BadRequestError, UnauthorizedError } from "@diia-inhouse/errors";
2
- //#region src/asserts.ts
2
+ // src/asserts.ts
3
3
  const Asserts = {
4
4
  isRefreshTokenExists(tokenData) {
5
5
  if (!tokenData.refreshToken) throw new UnauthorizedError("RefreshToken does not exists");
@@ -9,5 +9,4 @@ const Asserts = {
9
9
  if (!keys.some((key) => key in object)) throw new BadRequestError(`Expected to have one of [${keys.join(", ")}]`);
10
10
  }
11
11
  };
12
- //#endregion
13
12
  export { Asserts };
@@ -1,5 +1,5 @@
1
1
  import { phoneNumberWithoutPlusValidation } from "@diia-inhouse/validators";
2
- //#region src/dictionaries/phoneCodes.ts
2
+ // src/dictionaries/phoneCodes.ts
3
3
  const phoneCodes = [
4
4
  {
5
5
  id: "ac",
@@ -2432,5 +2432,4 @@ const phoneCodes = [
2432
2432
  validation: []
2433
2433
  }
2434
2434
  ];
2435
- //#endregion
2436
2435
  export { phoneCodes };
package/dist/guards.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { ApiError } from "@diia-inhouse/errors";
2
2
  import { AcquirerSession, ActionSession, AppUser, EResidentSession, EResidentTokenData, OnBeforeApplicationShutdown, OnDestroy, OnHealthCheck, OnInit, OnRegistrationsFinished, ServiceEntranceSession, UserSession, UserTokenData } from "@diia-inhouse/types";
3
-
4
- //#region src/guards.d.ts
5
- declare const Guards: {
3
+ export declare const Guards: {
6
4
  isError(value: unknown): value is Error;
7
5
  apiError(err: Error): err is ApiError;
8
6
  isUserSession(session: ActionSession | undefined): session is UserSession;
@@ -17,6 +15,4 @@ declare const Guards: {
17
15
  hasOnRegistrationsFinishedHook(instance: unknown): instance is OnRegistrationsFinished;
18
16
  hasOnBeforeApplicationShutdownHook(instance: unknown): instance is OnBeforeApplicationShutdown;
19
17
  isSettledError(value: PromiseSettledResult<unknown>): value is PromiseRejectedResult;
20
- };
21
- //#endregion
22
- export { Guards };
18
+ };
package/dist/guards.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import lodash from "lodash";
2
2
  import { ApiError } from "@diia-inhouse/errors";
3
3
  import { SessionType } from "@diia-inhouse/types";
4
- //#region src/guards.ts
4
+ // src/guards.ts
5
5
  const { isFunction } = lodash;
6
6
  const Guards = {
7
7
  isError(value) {
@@ -55,5 +55,4 @@ const Guards = {
55
55
  return value.status === "rejected";
56
56
  }
57
57
  };
58
- //#endregion
59
58
  export { Guards };
package/dist/index.d.ts CHANGED
@@ -12,13 +12,11 @@ import { SlackFormattingUtils } from "./slackFormatting.js";
12
12
  import { TypeUtils } from "./typeUtils.js";
13
13
  import { phoneticChecker } from "./phoneticChecker/index.js";
14
14
  import { extractProfileFeatures, profileFeaturesToList } from "./session.js";
15
-
16
- //#region src/index.d.ts
17
15
  declare const asserts: typeof Asserts;
18
16
  declare const guards: typeof Guards;
19
17
  declare const utils: typeof ApplicationUtils;
20
18
  declare const pdfUtils: typeof PdfUtils;
21
- declare class Utils {
19
+ export declare class Utils {
22
20
  address: typeof AddressUtils;
23
21
  application: typeof ApplicationUtils;
24
22
  network: typeof NetworkUtils;
@@ -32,5 +30,4 @@ declare class Utils {
32
30
  random: typeof RandomUtils;
33
31
  type: typeof TypeUtils;
34
32
  }
35
- //#endregion
36
- export { AddressUtils, IntegrationUtils, NetworkUtils, PaymentUtils, PublicServiceUtils, RandomUtils, SlackFormattingUtils, TypeUtils, Utils, asserts, extractProfileFeatures, guards, pdfUtils, phoneticChecker, profileFeaturesToList, utils };
33
+ export { AddressUtils, IntegrationUtils, NetworkUtils, PaymentUtils, PublicServiceUtils, RandomUtils, SlackFormattingUtils, TypeUtils, asserts, extractProfileFeatures, guards, pdfUtils, phoneticChecker, profileFeaturesToList, utils };
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { SlackFormattingUtils } from "./slackFormatting.js";
12
12
  import { TypeUtils } from "./typeUtils.js";
13
13
  import { phoneticChecker } from "./phoneticChecker/index.js";
14
14
  import { extractProfileFeatures, profileFeaturesToList } from "./session.js";
15
- //#region src/index.ts
15
+ // src/index.ts
16
16
  const asserts = Asserts;
17
17
  const guards = Guards;
18
18
  const utils = ApplicationUtils;
@@ -31,5 +31,4 @@ var Utils = class {
31
31
  random = RandomUtils;
32
32
  type = TypeUtils;
33
33
  };
34
- //#endregion
35
34
  export { AddressUtils, IntegrationUtils, NetworkUtils, PaymentUtils, PublicServiceUtils, RandomUtils, SlackFormattingUtils, TypeUtils, Utils, asserts, extractProfileFeatures, guards, pdfUtils, phoneticChecker, profileFeaturesToList, utils };
@@ -1,6 +1,3 @@
1
- //#region src/integration.d.ts
2
- declare const IntegrationUtils: {
1
+ export declare const IntegrationUtils: {
3
2
  getRetryDelay(retry: number, timeLeft: number, initDelay: number, maxDelay: number, multiplier: number): number;
4
- };
5
- //#endregion
6
- export { IntegrationUtils };
3
+ };
@@ -1,7 +1,6 @@
1
- //#region src/integration.ts
1
+ // src/integration.ts
2
2
  const IntegrationUtils = { getRetryDelay(retry, timeLeft, initDelay, maxDelay, multiplier) {
3
3
  const delay = Math.min(initDelay * Math.pow(multiplier, retry), maxDelay);
4
4
  return Math.min(delay, timeLeft);
5
5
  } };
6
- //#endregion
7
6
  export { IntegrationUtils };
@@ -1,9 +1,5 @@
1
1
  import { TokenData, VerifiedBaseTokenData } from "@diia-inhouse/types";
2
-
3
- //#region src/interfaces/asserts.d.ts
4
- interface AssertsContainer {
2
+ export interface AssertsContainer {
5
3
  isRefreshTokenExists(tokenData: TokenData): asserts tokenData is VerifiedBaseTokenData<TokenData>;
6
4
  assertObjectHasOnlyOneOf<T extends object>(object: T, ...keys: (keyof T)[]): void | never;
7
- }
8
- //#endregion
9
- export { AssertsContainer };
5
+ }
@@ -1,11 +1,8 @@
1
- //#region src/interfaces/publicService.d.ts
2
- interface InputPhoneCodeOrgParams {
1
+ export interface InputPhoneCodeOrgParams {
3
2
  inputCode?: string;
4
3
  phoneValue?: string;
5
4
  codeValueId?: string;
6
5
  codeIds?: string[];
7
6
  hint?: string;
8
7
  codeValueIsEditable?: boolean;
9
- }
10
- //#endregion
11
- export { InputPhoneCodeOrgParams };
8
+ }
@@ -1,6 +1,3 @@
1
- //#region src/interfaces/slack.d.ts
2
- interface GetListValueOptions {
1
+ export interface GetListValueOptions {
3
2
  isError?: boolean;
4
- }
5
- //#endregion
6
- export { GetListValueOptions };
3
+ }
package/dist/network.d.ts CHANGED
@@ -1,17 +1,13 @@
1
1
  import { GrpcStatusCode } from "@diia-inhouse/types";
2
-
3
- //#region src/network.d.ts
4
- declare class NetworkUtils {
2
+ export declare class NetworkUtils {
5
3
  private static readonly grpcStatusCodes;
6
4
  private static readonly httpStatusCodeToGrpcCode;
7
5
  /**
8
- * @see https://gist.github.com/hamakn/708b9802ca845eb59f3975dbb3ae2a01
9
- */
6
+ * @see https://gist.github.com/hamakn/708b9802ca845eb59f3975dbb3ae2a01
7
+ */
10
8
  private static readonly grpcCodeToHttpStatusCode;
11
9
  static isHttpCode(code: number | undefined): boolean;
12
10
  static isGrpcCode(code: number | undefined): boolean;
13
11
  static getHttpStatusCodeByGrpcCode(code: GrpcStatusCode): number;
14
12
  static getGrpcCodeByHttpStatusCode(code: number): GrpcStatusCode;
15
- }
16
- //#endregion
17
- export { NetworkUtils };
13
+ }
package/dist/network.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { GrpcStatusCode, HttpStatusCode } from "@diia-inhouse/types";
2
- //#region src/network.ts
2
+ // src/network.ts
3
3
  var NetworkUtils = class {
4
4
  static grpcStatusCodes = Object.values(GrpcStatusCode);
5
5
  static httpStatusCodeToGrpcCode = {
@@ -60,5 +60,4 @@ var NetworkUtils = class {
60
60
  return this.httpStatusCodeToGrpcCode[code] ?? GrpcStatusCode.UNKNOWN;
61
61
  }
62
62
  };
63
- //#endregion
64
63
  export { NetworkUtils };
package/dist/payment.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- //#region src/payment.d.ts
2
- declare class PaymentUtils {
1
+ export declare class PaymentUtils {
3
2
  private static readonly config;
4
3
  static getPaymentPayCommission(amount: number): number;
5
4
  static getPaymentTotalAmount(amount: number, commission: number): number;
6
- }
7
- //#endregion
8
- export { PaymentUtils };
5
+ }
package/dist/payment.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ApplicationUtils } from "./applicationUtils.js";
2
- //#region src/payment.ts
2
+ // src/payment.ts
3
3
  var PaymentUtils = class {
4
4
  static config = {
5
5
  defaultMinCommission: 1,
@@ -15,5 +15,4 @@ var PaymentUtils = class {
15
15
  return ApplicationUtils.toDecimalPlaces(amount + commission, 2);
16
16
  }
17
17
  };
18
- //#endregion
19
18
  export { PaymentUtils };
@@ -1,6 +1,3 @@
1
- //#region src/pdfUtils.d.ts
2
- declare const PdfUtils: {
1
+ export declare const PdfUtils: {
3
2
  getPdfFileName(name: string, id: string, requestDateTime?: string): string;
4
- };
5
- //#endregion
6
- export { PdfUtils };
3
+ };
package/dist/pdfUtils.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ApplicationUtils } from "./applicationUtils.js";
2
- //#region src/pdfUtils.ts
2
+ // src/pdfUtils.ts
3
3
  const PdfUtils = { getPdfFileName(name, id, requestDateTime) {
4
4
  return `${ApplicationUtils.getFileName(name, id, requestDateTime)}.pdf`;
5
5
  } };
6
- //#endregion
7
6
  export { PdfUtils };
@@ -1,9 +1,7 @@
1
- //#region src/phoneticChecker/index.d.ts
2
1
  declare class PhoneticChecker {
3
2
  private equalityCoefficientThreshold;
4
3
  arePhoneticallySimilar(etalonValue: string, slaveValue: string, threshold?: number): boolean;
5
4
  private getEqualityCoefficient;
6
5
  }
7
- declare const phoneticChecker: PhoneticChecker;
8
- //#endregion
9
- export { phoneticChecker };
6
+ export declare const phoneticChecker: PhoneticChecker;
7
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { metaphone } from "./metaphone.js";
2
2
  import flevenshtein from "fast-levenshtein";
3
- //#region src/phoneticChecker/index.ts
3
+ // src/phoneticChecker/index.ts
4
4
  var PhoneticChecker = class {
5
5
  equalityCoefficientThreshold = .75;
6
6
  arePhoneticallySimilar(etalonValue, slaveValue, threshold = this.equalityCoefficientThreshold) {
@@ -15,5 +15,4 @@ var PhoneticChecker = class {
15
15
  }
16
16
  };
17
17
  const phoneticChecker = new PhoneticChecker();
18
- //#endregion
19
18
  export { phoneticChecker };
@@ -1,4 +1,4 @@
1
- //#region src/phoneticChecker/metaphone.ts
1
+ // src/phoneticChecker/metaphone.ts
2
2
  var Metaphone = class {
3
3
  process(word) {
4
4
  let normalizedValue = word.toUpperCase();
@@ -34,5 +34,4 @@ var Metaphone = class {
34
34
  }
35
35
  };
36
36
  const metaphone = new Metaphone();
37
- //#endregion
38
37
  export { metaphone };
@@ -1,60 +1,56 @@
1
1
  import { InputPhoneCodeOrgParams } from "./interfaces/publicService.js";
2
2
  import { Logger, UserTokenData } from "@diia-inhouse/types";
3
3
  import { ContactsResponse, DSBodyItem, InputPhoneCodeItem, InputPhoneCodeOrg, InputTextMlc, TextLabelMlc } from "@diia-inhouse/design-system";
4
-
5
- //#region src/publicService.d.ts
6
- declare const PublicServiceUtils: {
4
+ export declare const PublicServiceUtils: {
7
5
  getContacts(user: UserTokenData): ContactsResponse;
8
6
  getContactsText(user: UserTokenData): string;
9
7
  getContactsComponent(user: UserTokenData, inputCode?: string): DSBodyItem;
10
8
  /**
11
- * Creates an InputPhoneCodeOrg with specified parameters
12
- * @param params.codeIds - Optional array of allowed country code IDs
13
- * @returns InputPhoneCodeOrg
14
- * @example
15
- * // Create a phone input with Ukrainian code
16
- * const phoneInput = getInputPhoneCodeOrg({
17
- * inputCode: 'phone',
18
- * phoneValue: '501234567',
19
- * codeValueId: 'ua',
20
- * codeIds: ['ua', 'pl'],
21
- * hint: 'Enter your phone number'
22
- * });
23
- */
9
+ * Creates an InputPhoneCodeOrg with specified parameters
10
+ * @param params.codeIds - Optional array of allowed country code IDs
11
+ * @returns InputPhoneCodeOrg
12
+ * @example
13
+ * // Create a phone input with Ukrainian code
14
+ * const phoneInput = getInputPhoneCodeOrg({
15
+ * inputCode: 'phone',
16
+ * phoneValue: '501234567',
17
+ * codeValueId: 'ua',
18
+ * codeIds: ['ua', 'pl'],
19
+ * hint: 'Enter your phone number'
20
+ * });
21
+ */
24
22
  getInputPhoneCodeOrg(params: InputPhoneCodeOrgParams): InputPhoneCodeOrg;
25
23
  /**
26
- * Returns an array of phone code items, optionally filtered by provided code IDs
27
- * @param filter - Optional array of phone code IDs to filter by
28
- * @returns Array of phone code items matching the filter criteria, or all phone codes if no filter is provided
29
- * @example
30
- * // Get all phone codes
31
- * const allCodes = getInputPhoneCodeItems();
32
- *
33
- * @example
34
- * // Get only Ukrainian and Polish phone codes
35
- * const filteredCodes = getInputPhoneCodeItems(['ua', 'pl']);
36
- */
24
+ * Returns an array of phone code items, optionally filtered by provided code IDs
25
+ * @param filter - Optional array of phone code IDs to filter by
26
+ * @returns Array of phone code items matching the filter criteria, or all phone codes if no filter is provided
27
+ * @example
28
+ * // Get all phone codes
29
+ * const allCodes = getInputPhoneCodeItems();
30
+ *
31
+ * @example
32
+ * // Get only Ukrainian and Polish phone codes
33
+ * const filteredCodes = getInputPhoneCodeItems(['ua', 'pl']);
34
+ */
37
35
  getInputPhoneCodeItems(filter?: string[]): InputPhoneCodeItem[];
38
36
  getEmailInputTextMlc(emailValue: string, inputCode?: string): InputTextMlc;
39
37
  getContactsComponentTextLabel(user: UserTokenData, phoneNumber: string): TextLabelMlc | undefined;
40
38
  /**
41
- * Extracts the phone number from the phone number string
42
- *
43
- * @param phoneNumber - Phone number to extract the number from
44
- * @param phoneCodeValue - Phone country code in ISO 3166-1 alpha-2 format
45
- * @returns Extracted phone number (without country code)
46
- *
47
- * @example
48
- * extractPhoneNumber('+380123456789', 'ua') // 123456789
49
- *
50
- * @example
51
- * extractPhoneNumber('123456789', 'ua') // throws Error(`Phone number must start with country code 380`)
52
- *
53
- * @example
54
- * extractPhoneNumber('380123456789', 'invalid') // throws Error(`Invalid country code`)
55
- */
39
+ * Extracts the phone number from the phone number string
40
+ *
41
+ * @param phoneNumber - Phone number to extract the number from
42
+ * @param phoneCodeValue - Phone country code in ISO 3166-1 alpha-2 format
43
+ * @returns Extracted phone number (without country code)
44
+ *
45
+ * @example
46
+ * extractPhoneNumber('+380123456789', 'ua') // 123456789
47
+ *
48
+ * @example
49
+ * extractPhoneNumber('123456789', 'ua') // throws Error(`Phone number must start with country code 380`)
50
+ *
51
+ * @example
52
+ * extractPhoneNumber('380123456789', 'invalid') // throws Error(`Invalid country code`)
53
+ */
56
54
  extractPhoneNumber(phoneNumber: string, phoneCodeValue: string): string | never;
57
55
  extractPhoneNumberSafe(phoneNumber: string, phoneCodeValue: string, logger: Logger): string | undefined;
58
- };
59
- //#endregion
60
- export { PublicServiceUtils };
56
+ };
@@ -1,6 +1,6 @@
1
1
  import { phoneCodes } from "./dictionaries/phoneCodes.js";
2
2
  import { emailRuValidation, emailValidation } from "@diia-inhouse/validators";
3
- //#region src/publicService.ts
3
+ // src/publicService.ts
4
4
  const PublicServiceUtils = {
5
5
  getContacts(user) {
6
6
  const { phoneNumber, email } = user;
@@ -145,5 +145,4 @@ const PublicServiceUtils = {
145
145
  }
146
146
  }
147
147
  };
148
- //#endregion
149
148
  export { PublicServiceUtils };
package/dist/random.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- //#region src/random.d.ts
2
- declare const RandomUtils: {
1
+ export declare const RandomUtils: {
3
2
  generateUUID(): string;
4
3
  getRandomIntsString(length?: number): string;
5
- };
6
- //#endregion
7
- export { RandomUtils };
4
+ };
package/dist/random.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { randomInt, randomUUID } from "node:crypto";
2
- //#region src/random.ts
2
+ // src/random.ts
3
3
  const RandomUtils = {
4
4
  generateUUID() {
5
5
  return randomUUID();
@@ -8,5 +8,4 @@ const RandomUtils = {
8
8
  return Array.from({ length }, () => randomInt(0, 10)).join("");
9
9
  }
10
10
  };
11
- //#endregion
12
11
  export { RandomUtils };
package/dist/session.d.ts CHANGED
@@ -1,7 +1,3 @@
1
1
  import { EResidentSession, ProfileFeature, UserFeatures, UserSession } from "@diia-inhouse/types";
2
-
3
- //#region src/session.d.ts
4
- declare function profileFeaturesToList(features: UserFeatures): ProfileFeature[];
5
- declare function extractProfileFeatures(session: UserSession | EResidentSession): ProfileFeature[];
6
- //#endregion
7
- export { extractProfileFeatures, profileFeaturesToList };
2
+ export declare function profileFeaturesToList(features: UserFeatures): ProfileFeature[];
3
+ export declare function extractProfileFeatures(session: UserSession | EResidentSession): ProfileFeature[];
package/dist/session.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DiiaOfficeStatus, ProfileFeature } from "@diia-inhouse/types";
2
- //#region src/session.ts
2
+ // src/session.ts
3
3
  function profileFeaturesToList(features) {
4
4
  return Object.entries(features).filter(([, value]) => value).map(([key]) => key).filter((feature) => {
5
5
  if (feature !== ProfileFeature.office) return true;
@@ -10,5 +10,4 @@ function extractProfileFeatures(session) {
10
10
  if (!("features" in session) || !session.features) return [];
11
11
  return profileFeaturesToList(session.features);
12
12
  }
13
- //#endregion
14
13
  export { extractProfileFeatures, profileFeaturesToList };
@@ -1,13 +1,7 @@
1
1
  import { GetListValueOptions } from "./interfaces/slack.js";
2
2
  import { RichTextElement, RichTextEmoji } from "@slack/types";
3
-
4
- //#region src/slackFormatting.d.ts
5
- declare class SlackFormattingUtils {
3
+ export declare class SlackFormattingUtils {
6
4
  readonly greenCircleEmoji: RichTextEmoji;
7
5
  readonly redCircleEmoji: RichTextEmoji;
8
- getValue(name: string, value: string | number | undefined, {
9
- isError
10
- }?: GetListValueOptions): RichTextElement[];
11
- }
12
- //#endregion
13
- export { SlackFormattingUtils };
6
+ getValue(name: string, value: string | number | undefined, { isError }?: GetListValueOptions): RichTextElement[];
7
+ }
@@ -1,4 +1,4 @@
1
- //#region src/slackFormatting.ts
1
+ // src/slackFormatting.ts
2
2
  var SlackFormattingUtils = class {
3
3
  greenCircleEmoji = {
4
4
  type: "emoji",
@@ -37,5 +37,4 @@ var SlackFormattingUtils = class {
37
37
  ];
38
38
  }
39
39
  };
40
- //#endregion
41
40
  export { SlackFormattingUtils };
@@ -1,8 +1,5 @@
1
- //#region src/typeUtils.d.ts
2
- declare const TypeUtils: {
1
+ export declare const TypeUtils: {
3
2
  isObject(value: any): boolean;
4
3
  isArray(value: any): boolean;
5
4
  isBuffer(value: any): boolean;
6
- };
7
- //#endregion
8
- export { TypeUtils };
5
+ };
package/dist/typeUtils.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/typeUtils.ts
1
+ // src/typeUtils.ts
2
2
  const TypeUtils = {
3
3
  isObject(value) {
4
4
  return value && typeof value === "object" && value.constructor === Object;
@@ -10,5 +10,4 @@ const TypeUtils = {
10
10
  return value && (value.type === "Buffer" || Buffer.isBuffer(value));
11
11
  }
12
12
  };
13
- //#endregion
14
13
  export { TypeUtils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diia-inhouse/utils",
3
- "version": "6.1.30",
3
+ "version": "6.1.32",
4
4
  "description": "Generic utils",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "diia-team",
@@ -31,41 +31,41 @@
31
31
  "find-circulars": "madge --circular --extensions ts ./"
32
32
  },
33
33
  "dependencies": {
34
- "@diia-inhouse/design-system": "5.25.2",
35
- "@types/luxon": "3.7.1",
36
- "bson": "7.2.0",
34
+ "@diia-inhouse/design-system": "5.27.0",
35
+ "@types/luxon": "3.7.6",
36
+ "bson": "7.3.3",
37
37
  "compare-versions": "6.1.1",
38
38
  "fast-levenshtein": "3.0.0",
39
39
  "lodash": "4.18.1",
40
40
  "luxon": "3.7.2",
41
41
  "map-age-cleaner": "0.2.0",
42
42
  "moment": "2.31.0",
43
- "type-fest": "5.6.0"
43
+ "type-fest": "5.10.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@diia-inhouse/configs": "7.2.2",
47
- "@diia-inhouse/errors": "2.3.25",
48
- "@diia-inhouse/oxc-config": "4.0.3",
49
- "@diia-inhouse/test": "8.3.40",
50
- "@diia-inhouse/types": "14.6.1",
51
- "@diia-inhouse/validators": "2.2.114",
52
- "@slack/types": "2.21.1",
47
+ "@diia-inhouse/errors": "2.3.26",
48
+ "@diia-inhouse/oxc-config": "5.0.2",
49
+ "@diia-inhouse/test": "8.3.43",
50
+ "@diia-inhouse/types": "14.7.2",
51
+ "@diia-inhouse/validators": "2.2.115",
52
+ "@slack/types": "3.2.0",
53
53
  "@types/fast-levenshtein": "0.0.4",
54
- "@types/lodash": "4.17.24",
54
+ "@types/lodash": "4.17.27",
55
55
  "@types/node": "25.6.2",
56
- "@vitest/coverage-v8": "4.1.5",
57
- "@vitest/ui": "4.1.5",
58
- "lockfile-lint": "5.0.0",
56
+ "@vitest/coverage-v8": "4.1.11",
57
+ "@vitest/ui": "4.1.11",
58
+ "lockfile-lint": "5.1.0",
59
59
  "madge": "8.0.0",
60
- "oxfmt": "0.72.0",
61
- "oxlint": "1.87.0",
62
- "oxlint-tsgolint": "7.0.2003",
63
- "protobufjs": "8.6.6",
60
+ "oxfmt": "0.74.0",
61
+ "oxlint": "1.89.0",
62
+ "oxlint-tsgolint": "7.0.2004",
63
+ "protobufjs": "8.8.1",
64
64
  "rimraf": "6.1.3",
65
- "tsdown": "0.22.0",
65
+ "tsdown": "0.23.1",
66
66
  "typescript": "5.9.3",
67
67
  "vite-tsconfig-paths": "6.1.1",
68
- "vitest": "4.1.5"
68
+ "vitest": "4.1.11"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@diia-inhouse/errors": ">=2.0.0",